automata and program analysis
play

Automata and program analysis Thomas Colcombet FCT Bordeaux 13 - PowerPoint PPT Presentation

Automata and program analysis Thomas Colcombet FCT Bordeaux 13 September 2017 based on joint work with Laure Daviaud et Florian Zuleger Weighted automata and tropical automata Weighted automata [Schtzenberger 61] Weighted automata


  1. Example of weighted automata multiplication A semiring (S, ⨁ , ⨂ ,0,1) is such that: addition (R, ⨁ ) is a commutative monoid with identity element 0 : - n } (a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a Gives rise to (R, ⨁ ) is a monoid with identity element 1 : - product of S (a ⨂ b) ⋅ c = a ⨂ (b ⨂ c) ; 1 ⨂ a = a ⨂ 1 = a valued matrices Multiplication left and right distributes over addition: - that form a a ⨂ (b ⨁ c) = (a ⨂ b) ⨁ (a ⨂ c) ; (a ⨁ b) ⨂ c = (a ⨂ c) ⨁ (b ⨂ c) monoid. Multiplication by 0 annihilates S : - 0 ⨂ a = a ⨂ 0 = 0 L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 Boolean semiring: ({0,1}, ⋁ , ⋀ ,0,1) Non-deterministic automata Computes the number of Reals/Integers/Rationals/Natural numbers: ( R ,+, × ,0,1) runs of the NDA « Rat semiring »: (Rat(A), ∪ , ⋅ , ∅ , { ε } )

  2. Example of weighted automata multiplication A semiring (S, ⨁ , ⨂ ,0,1) is such that: addition (R, ⨁ ) is a commutative monoid with identity element 0 : - n } (a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a Gives rise to (R, ⨁ ) is a monoid with identity element 1 : - product of S (a ⨂ b) ⋅ c = a ⨂ (b ⨂ c) ; 1 ⨂ a = a ⨂ 1 = a valued matrices Multiplication left and right distributes over addition: - that form a a ⨂ (b ⨁ c) = (a ⨂ b) ⨁ (a ⨂ c) ; (a ⨁ b) ⨂ c = (a ⨂ c) ⨁ (b ⨂ c) monoid. Multiplication by 0 annihilates S : - 0 ⨂ a = a ⨂ 0 = 0 L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 Boolean semiring: ({0,1}, ⋁ , ⋀ ,0,1) Non-deterministic automata Computes the number of Reals/Integers/Rationals/Natural numbers: ( R ,+, × ,0,1) runs of the NDA « Rat semiring »: (Rat(A), ∪ , ⋅ , ∅ , { ε } ) Rational transducers

  3. Example of weighted automata multiplication A semiring (S, ⨁ , ⨂ ,0,1) is such that: addition (R, ⨁ ) is a commutative monoid with identity element 0 : - n } (a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a Gives rise to (R, ⨁ ) is a monoid with identity element 1 : - product of S (a ⨂ b) ⋅ c = a ⨂ (b ⨂ c) ; 1 ⨂ a = a ⨂ 1 = a valued matrices Multiplication left and right distributes over addition: - that form a a ⨂ (b ⨁ c) = (a ⨂ b) ⨁ (a ⨂ c) ; (a ⨁ b) ⨂ c = (a ⨂ c) ⨁ (b ⨂ c) monoid. Multiplication by 0 annihilates S : - 0 ⨂ a = a ⨂ 0 = 0 L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 Boolean semiring: ({0,1}, ⋁ , ⋀ ,0,1) Non-deterministic automata Computes the number of Reals/Integers/Rationals/Natural numbers: ( R ,+, × ,0,1) runs of the NDA « Rat semiring »: (Rat(A), ∪ , ⋅ , ∅ , { ε } ) Rational transducers Tropical semiring: ( R ∪ {- ∞ },max,+,- ∞ ,0) ( R ∪ {+ ∞ },min,+,+ ∞ ,0), ( N ∪ {- ∞ },max,+,- ∞ ,0), ( N ∪ {+ ∞ },min,+,+ ∞ ,0)

  4. Example of weighted automata multiplication A semiring (S, ⨁ , ⨂ ,0,1) is such that: addition (R, ⨁ ) is a commutative monoid with identity element 0 : - n } (a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a Gives rise to (R, ⨁ ) is a monoid with identity element 1 : - product of S (a ⨂ b) ⋅ c = a ⨂ (b ⨂ c) ; 1 ⨂ a = a ⨂ 1 = a valued matrices Multiplication left and right distributes over addition: - that form a a ⨂ (b ⨁ c) = (a ⨂ b) ⨁ (a ⨂ c) ; (a ⨁ b) ⨂ c = (a ⨂ c) ⨁ (b ⨂ c) monoid. Multiplication by 0 annihilates S : - 0 ⨂ a = a ⨂ 0 = 0 L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 Boolean semiring: ({0,1}, ⋁ , ⋀ ,0,1) Non-deterministic automata Computes the number of Reals/Integers/Rationals/Natural numbers: ( R ,+, × ,0,1) runs of the NDA « Rat semiring »: (Rat(A), ∪ , ⋅ , ∅ , { ε } ) Rational transducers Tropical semiring: ( R ∪ {- ∞ },max,+,- ∞ ,0) Tropical automata ( R ∪ {+ ∞ },min,+,+ ∞ ,0), ( N ∪ {- ∞ },max,+,- ∞ ,0), ( N ∪ {+ ∞ },min,+,+ ∞ ,0)

  5. Example of weighted automata multiplication A semiring (S, ⨁ , ⨂ ,0,1) is such that: addition (R, ⨁ ) is a commutative monoid with identity element 0 : - n } (a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a Gives rise to (R, ⨁ ) is a monoid with identity element 1 : - product of S (a ⨂ b) ⋅ c = a ⨂ (b ⨂ c) ; 1 ⨂ a = a ⨂ 1 = a valued matrices Multiplication left and right distributes over addition: - that form a a ⨂ (b ⨁ c) = (a ⨂ b) ⨁ (a ⨂ c) ; (a ⨁ b) ⨂ c = (a ⨂ c) ⨁ (b ⨂ c) monoid. Multiplication by 0 annihilates S : - 0 ⨂ a = a ⨂ 0 = 0 L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 Boolean semiring: ({0,1}, ⋁ , ⋀ ,0,1) Non-deterministic automata Computes the number of Reals/Integers/Rationals/Natural numbers: ( R ,+, × ,0,1) runs of the NDA « Rat semiring »: (Rat(A), ∪ , ⋅ , ∅ , { ε } ) Rational transducers Tropical semiring: ( R ∪ {- ∞ },max,+,- ∞ ,0) Tropical automata ( R ∪ {+ ∞ },min,+,+ ∞ ,0), ( N ∪ {- ∞ },max,+,- ∞ ,0), ( N ∪ {+ ∞ },min,+,+ ∞ ,0)

  6. Tropical automata

  7. Tropical automata n L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1

  8. Tropical automata n L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 ( N ∪ {- ∞ },max,+,- ∞ ,0) L(u) ≥ n if and only if ( ∃ run ρ over u) weight( ρ ) ≥ n

  9. Tropical automata n L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 ( N ∪ {- ∞ },max,+,- ∞ ,0) L(u) ≥ n if and only if ( ∃ run ρ over u) weight( ρ ) ≥ n ( N ∪ { ∞ },min,+, ∞ ,0) L(u) ≥ n if and only if ( ∀ run ρ over u) weight( ρ ) ≥ n

  10. Tropical automata n L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 ( N ∪ {- ∞ },max,+,- ∞ ,0) L(u) ≥ n if and only if ( ∃ run ρ over u) weight( ρ ) ≥ n ( N ∪ { ∞ },min,+, ∞ ,0) L(u) ≥ n if and only if ( ∀ run ρ over u) weight( ρ ) ≥ n a, b : 0 a : 1 a, b : 0 b : 0 b : 0 0 0 p q r

  11. Tropical automata n L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 ( N ∪ {- ∞ },max,+,- ∞ ,0) L(u) ≥ n if and only if ( ∃ run ρ over u) weight( ρ ) ≥ n ( N ∪ { ∞ },min,+, ∞ ,0) L(u) ≥ n if and only if ( ∀ run ρ over u) weight( ρ ) ≥ n a, b : 0 a : 1 a, b : 0 by convention zero-transitions (- ∞ /+ ∞ ) are not displayed b : 0 b : 0 0 0 p q r (neutral for ⨂ and absorbing for ⨂ )

  12. Tropical automata n L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 ( N ∪ {- ∞ },max,+,- ∞ ,0) L(u) ≥ n if and only if ( ∃ run ρ over u) weight( ρ ) ≥ n ( N ∪ { ∞ },min,+, ∞ ,0) L(u) ≥ n if and only if ( ∀ run ρ over u) weight( ρ ) ≥ n a, b : 0 a : 1 a, b : 0 by convention zero-transitions (- ∞ /+ ∞ ) are not displayed b : 0 b : 0 0 0 p q r (neutral for ⨂ and absorbing for ⨂ ) The max-plus automaton computes:

  13. Tropical automata n L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 ( N ∪ {- ∞ },max,+,- ∞ ,0) L(u) ≥ n if and only if ( ∃ run ρ over u) weight( ρ ) ≥ n ( N ∪ { ∞ },min,+, ∞ ,0) L(u) ≥ n if and only if ( ∀ run ρ over u) weight( ρ ) ≥ n a, b : 0 a : 1 a, b : 0 by convention zero-transitions (- ∞ /+ ∞ ) are not displayed b : 0 b : 0 0 0 p q r (neutral for ⨂ and absorbing for ⨂ ) The max-plus automaton computes: L A : A* ➝ N ∪ {- ∞ } u ⟼

  14. Tropical automata n L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 ( N ∪ {- ∞ },max,+,- ∞ ,0) L(u) ≥ n if and only if ( ∃ run ρ over u) weight( ρ ) ≥ n ( N ∪ { ∞ },min,+, ∞ ,0) L(u) ≥ n if and only if ( ∀ run ρ over u) weight( ρ ) ≥ n a, b : 0 a : 1 a, b : 0 by convention zero-transitions (- ∞ /+ ∞ ) are not displayed b : 0 b : 0 0 0 p q r (neutral for ⨂ and absorbing for ⨂ ) The max-plus automaton computes: L A : A* ➝ N ∪ {- ∞ } u ⟼ the size of the longest block of consecutive a’s surrounded by 2 b’s

  15. Tropical automata n L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 ( N ∪ {- ∞ },max,+,- ∞ ,0) L(u) ≥ n if and only if ( ∃ run ρ over u) weight( ρ ) ≥ n ( N ∪ { ∞ },min,+, ∞ ,0) L(u) ≥ n if and only if ( ∀ run ρ over u) weight( ρ ) ≥ n a, b : 0 a : 1 a, b : 0 by convention zero-transitions (- ∞ /+ ∞ ) are not displayed b : 0 b : 0 0 0 p q r (neutral for ⨂ and absorbing for ⨂ ) [Krob 94] The equality of max-plus The max-plus automaton computes: definable functions is undecidable. L A : A* ➝ N ∪ {- ∞ } u ⟼ the size of the longest block of consecutive a’s surrounded by 2 b’s

  16. Tropical automata n L(a ₁ a ₂ …a n ) = ⨁ I(q ₀ ) ⨂ ( ⨂ Δ (q i-1 ,a i ,q i ) ) ⨂ F(q n ) p ₀ ,…,p n i=1 ( N ∪ {- ∞ },max,+,- ∞ ,0) L(u) ≥ n if and only if ( ∃ run ρ over u) weight( ρ ) ≥ n ( N ∪ { ∞ },min,+, ∞ ,0) L(u) ≥ n if and only if ( ∀ run ρ over u) weight( ρ ) ≥ n a, b : 0 a : 1 a, b : 0 by convention zero-transitions (- ∞ /+ ∞ ) are not displayed b : 0 b : 0 0 0 p q r (neutral for ⨂ and absorbing for ⨂ ) [Krob 94] The equality of max-plus The max-plus automaton computes: definable functions is undecidable. L A : A* ➝ N ∪ {- ∞ } [Hashiguchi 81] The boundedness of u ⟼ the size of the distance automata is decidable. 
 longest block of [Leung88] [Simon78,94] [Kirsten05] 
 consecutive a’s [C. & Bojanczyk 06] [C. 09] [Bojanczyk15] surrounded by 2 b’s

  17. Alternation of quantifiers

  18. Alternation of quantifiers Emptiness of NDA ? ( ∃ word w) ( ∃ run ρ over w) ρ is accepting

  19. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting

  20. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting Universality of NDA ? ( ∀ word w) ( ∃ run ρ over w) ρ is accepting

  21. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting Universality of NDA ? PSPACE-c (powerset) ( ∀ word w) ( ∃ run ρ over w) ρ is accepting

  22. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting Universality of NDA ? PSPACE-c (powerset) ( ∀ word w) ( ∃ run ρ over w) ρ is accepting Is a ( Z ∪ { ∞ },max,+) automaton ≤ 0 ? ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ 0

  23. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting Universality of NDA ? PSPACE-c (powerset) ( ∀ word w) ( ∃ run ρ over w) ρ is accepting Is a ( Z ∪ { ∞ },max,+) automaton ≤ 0 ? NL-c ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ 0

  24. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting Universality of NDA ? PSPACE-c (powerset) ( ∀ word w) ( ∃ run ρ over w) ρ is accepting Is a ( Z ∪ { ∞ },max,+) automaton ≤ 0 ? NL-c ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ 0 Is a ( Z ∪ { ∞ },max,+) automaton ≥ 0 ? ( ∀ word w) ( ∃ run ρ over w) weight( ρ ) ≥ 0

  25. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting Universality of NDA ? PSPACE-c (powerset) ( ∀ word w) ( ∃ run ρ over w) ρ is accepting Is a ( Z ∪ { ∞ },max,+) automaton ≤ 0 ? NL-c ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ 0 Is a ( Z ∪ { ∞ },max,+) automaton ≥ 0 ? undecidable [Krob92, other form] ( ∀ word w) ( ∃ run ρ over w) weight( ρ ) ≥ 0

  26. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting Universality of NDA ? PSPACE-c (powerset) ( ∀ word w) ( ∃ run ρ over w) ρ is accepting Is a ( Z ∪ { ∞ },max,+) automaton ≤ 0 ? NL-c ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ 0 Is a ( Z ∪ { ∞ },max,+) automaton ≥ 0 ? undecidable [Krob92, other form] ( ∀ word w) ( ∃ run ρ over w) weight( ρ ) ≥ 0 Is a ( N ∪ {- ∞ },max,+) automaton bounded? ( ∃ n ∈ N ) ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ n

  27. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting Universality of NDA ? PSPACE-c (powerset) ( ∀ word w) ( ∃ run ρ over w) ρ is accepting Is a ( Z ∪ { ∞ },max,+) automaton ≤ 0 ? NL-c ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ 0 Is a ( Z ∪ { ∞ },max,+) automaton ≥ 0 ? undecidable [Krob92, other form] ( ∀ word w) ( ∃ run ρ over w) weight( ρ ) ≥ 0 Is a ( N ∪ {- ∞ },max,+) automaton bounded? NL-c ( ∃ n ∈ N ) ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ n

  28. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting Universality of NDA ? PSPACE-c (powerset) ( ∀ word w) ( ∃ run ρ over w) ρ is accepting Is a ( Z ∪ { ∞ },max,+) automaton ≤ 0 ? NL-c ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ 0 Is a ( Z ∪ { ∞ },max,+) automaton ≥ 0 ? undecidable [Krob92, other form] ( ∀ word w) ( ∃ run ρ over w) weight( ρ ) ≥ 0 Is a ( N ∪ {- ∞ },max,+) automaton bounded? NL-c ( ∃ n ∈ N ) ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ n Is a ( N ∪ { ∞ },min,+) automaton bounded? ( ∃ n ∈ N ) ( ∀ word w) ( ∃ run ρ over w) weight( ρ ) ≤ n

  29. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting Universality of NDA ? PSPACE-c (powerset) ( ∀ word w) ( ∃ run ρ over w) ρ is accepting Is a ( Z ∪ { ∞ },max,+) automaton ≤ 0 ? NL-c ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ 0 Is a ( Z ∪ { ∞ },max,+) automaton ≥ 0 ? undecidable [Krob92, other form] ( ∀ word w) ( ∃ run ρ over w) weight( ρ ) ≥ 0 Is a ( N ∪ {- ∞ },max,+) automaton bounded? NL-c ( ∃ n ∈ N ) ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ n Is a ( N ∪ { ∞ },min,+) automaton bounded? PSPACE-c 
 ( ∃ n ∈ N ) ( ∀ word w) ( ∃ run ρ over w) weight( ρ ) ≤ n [Hashiguchi81,Leung84]

  30. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting Universality of NDA ? PSPACE-c (powerset) ( ∀ word w) ( ∃ run ρ over w) ρ is accepting Is a ( Z ∪ { ∞ },max,+) automaton ≤ 0 ? NL-c ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ 0 Is a ( Z ∪ { ∞ },max,+) automaton ≥ 0 ? undecidable [Krob92, other form] ( ∀ word w) ( ∃ run ρ over w) weight( ρ ) ≥ 0 Is a ( N ∪ {- ∞ },max,+) automaton bounded? NL-c ( ∃ n ∈ N ) ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ n Is a ( N ∪ { ∞ },min,+) automaton bounded? PSPACE-c 
 ( ∃ n ∈ N ) ( ∀ word w) ( ∃ run ρ over w) weight( ρ ) ≤ n [Hashiguchi81,Leung84] Given a ( N ∪ { ∞ },max,+) automaton , find the least θ ∈ [0,1] such that ( ∃ a) ( ∀ s ∈ N ) ( ∃ word w, |w| ≥ s) ( ∀ run ρ over w) weight( ρ ) ≤ as θ

  31. Alternation of quantifiers Emptiness of NDA ? NL-c ( ∃ word w) ( ∃ run ρ over w) ρ is accepting Universality of NDA ? PSPACE-c (powerset) ( ∀ word w) ( ∃ run ρ over w) ρ is accepting Is a ( Z ∪ { ∞ },max,+) automaton ≤ 0 ? NL-c ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ 0 Is a ( Z ∪ { ∞ },max,+) automaton ≥ 0 ? undecidable [Krob92, other form] ( ∀ word w) ( ∃ run ρ over w) weight( ρ ) ≥ 0 Is a ( N ∪ {- ∞ },max,+) automaton bounded? NL-c ( ∃ n ∈ N ) ( ∀ word w) ( ∀ run ρ over w) weight( ρ ) ≤ n Is a ( N ∪ { ∞ },min,+) automaton bounded? PSPACE-c 
 ( ∃ n ∈ N ) ( ∀ word w) ( ∃ run ρ over w) weight( ρ ) ≤ n [Hashiguchi81,Leung84] Given a ( N ∪ { ∞ },max,+) automaton , find the least θ ∈ [0,1] such that ( ∃ a) ( ∀ s ∈ N ) ( ∃ word w, |w| ≥ s) ( ∀ run ρ over w) weight( ρ ) ≤ as θ [C., Daviaud, Zuleger 14] This θ exists and is rational. 
 Furthermore, it can be constructed in EXPSPACE, likely to be PSPACE-complete.

  32. More on asymptotic analysis

  33. More on asymptotic analysis Given a ( N ∪ { ∞ },max,+) automaton , find the least θ ∈ [0,1] such that ( ∃ a) ( ∀ s ∈ N ) ( ∃ word w, |w| ≥ s) ( ∀ run ρ over w) weight( ρ ) ≤ as θ

  34. More on asymptotic analysis Given a ( N ∪ { ∞ },max,+) automaton , find the least θ ∈ [0,1] such that ( ∃ a) ( ∀ s ∈ N ) ( ∃ word w, |w| ≥ s) ( ∀ run ρ over w) weight( ρ ) ≤ as θ [C., Daviaud, Zuleger 14] This θ exists and is rational. 
 Furthermore, it can be constructed in EXPSPACE, likely to be PSPACE-complete.

  35. More on asymptotic analysis Given a ( N ∪ { ∞ },max,+) automaton , find the least θ ∈ [0,1] such that ( ∃ a) ( ∀ s ∈ N ) ( ∃ word w, |w| ≥ s) ( ∀ run ρ over w) weight( ρ ) ≤ as θ [C., Daviaud, Zuleger 14] This θ exists and is rational. 
 Furthermore, it can be constructed in EXPSPACE, likely to be PSPACE-complete. result n s=|u| length of the word

  36. More on asymptotic analysis Given a ( N ∪ { ∞ },max,+) automaton , find the least θ ∈ [0,1] such that ( ∃ a) ( ∀ s ∈ N ) ( ∃ word w, |w| ≥ s) ( ∀ run ρ over w) weight( ρ ) ≤ as θ [C., Daviaud, Zuleger 14] This θ exists and is rational. 
 Furthermore, it can be constructed in EXPSPACE, likely to be PSPACE-complete. result n What is the asymptotic? s=|u| length of the word

  37. More on asymptotic analysis Given a ( N ∪ { ∞ },max,+) automaton , find the least θ ∈ [0,1] such that ( ∃ a) ( ∀ s ∈ N ) ( ∃ word w, |w| ≥ s) ( ∀ run ρ over w) weight( ρ ) ≤ as θ [C., Daviaud, Zuleger 14] This θ exists and is rational. 
 Furthermore, it can be constructed in EXPSPACE, likely to be PSPACE-complete. result n What is the asymptotic? s=|u| length of the word log f ( u ) lim inf = θ Compute: log | u | u ∈ A ∗ find the least value of a word of length at least s

  38. More on asymptotic analysis Given a ( N ∪ { ∞ },max,+) automaton , find the least θ ∈ [0,1] such that ( ∃ a) ( ∀ s ∈ N ) ( ∃ word w, |w| ≥ s) ( ∀ run ρ over w) weight( ρ ) ≤ as θ [C., Daviaud, Zuleger 14] This θ exists and is rational. 
 Furthermore, it can be constructed in EXPSPACE, likely to be PSPACE-complete. result n What is the asymptotic? s=|u| length of the word log f ( | u | ) = 1 log | u | log f ( u ) lim sup lim inf = θ Compute: θ log | u | u ∈ A ∗ u ∈ A ∗ find the least value of a word find the longest size of a word of length at least s of value at most n

  39. Ingredients of the proof

  40. Ingredients of the proof Ingredient 1. Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context.

  41. Ingredients of the proof Ingredient 1. Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. I(W) = { P ⊆ Q : P=Reach(I,u) for some u ∈ W } e.g. for universality

  42. Ingredients of the proof Ingredient 1. Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. I(W) = { P ⊆ Q : P=Reach(I,u) for some u ∈ W } e.g. for universality In our case, I(W) = { f:Q × Q ➝ N : there is a run that displays this behavior } ⊆ P(N Q × Q )

  43. Ingredients of the proof Ingredient 1. Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. I(W) = { P ⊆ Q : P=Reach(I,u) for some u ∈ W } e.g. for universality In our case, I(W) = { f:Q × Q ➝ N : there is a run that displays this behavior } ⊆ P(N Q × Q ) Ingredient 2. Give a notion of approximation for such sets: Hausdorff-like keeping asymptotes.

  44. Ingredients of the proof Ingredient 1. Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. I(W) = { P ⊆ Q : P=Reach(I,u) for some u ∈ W } e.g. for universality In our case, I(W) = { f:Q × Q ➝ N : there is a run that displays this behavior } ⊆ P(N Q × Q ) Ingredient 2. Give a notion of approximation for such sets: Hausdorff-like keeping asymptotes. Ingredient 3. Define presentable sets families of such sets of maps that are nicely behaved (that can be algorithmically handled). In our case unions of convex polytopes in R Q × Q representing simultaneous asymptotic behaviors.

  45. Ingredients of the proof Ingredient 1. Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. I(W) = { P ⊆ Q : P=Reach(I,u) for some u ∈ W } e.g. for universality In our case, I(W) = { f:Q × Q ➝ N : there is a run that displays this behavior } ⊆ P(N Q × Q ) Ingredient 2. Give a notion of approximation for such sets: Hausdorff-like keeping asymptotes. Ingredient 3. Define presentable sets families of such sets of maps that are nicely behaved (that can be algorithmically handled). In our case unions of convex polytopes in R Q × Q representing simultaneous asymptotic behaviors. Step 4. Compute a presentable equivalent (up to approximation) of I(A*)

  46. Ingredients of the proof Ingredient 1. Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. I(W) = { P ⊆ Q : P=Reach(I,u) for some u ∈ W } e.g. for universality In our case, I(W) = { f:Q × Q ➝ N : there is a run that displays this behavior } ⊆ P(N Q × Q ) Ingredient 2. Give a notion of approximation for such sets: Hausdorff-like keeping asymptotes. Ingredient 3. Define presentable sets families of such sets of maps that are nicely behaved (that can be algorithmically handled). In our case unions of convex polytopes in R Q × Q representing simultaneous asymptotic behaviors. Step 4. Compute a presentable equivalent (up to approximation) of I(A*) This is done by induction of the factorisation forest height [Simon] .

  47. Program analysis and the size-change abstraction

  48. Program analysis Given an input program/piece of program: - Does it perform a zero division? - Does it access a non-allocated memory area? - Is there a dynamic type problem? - Does it comply to the specification? - Is there a memory leakage? - Does it terminate? - What is its running time?

  49. Program analysis Given an input program/piece of program: - Does it perform a zero division? - Does it access a non-allocated memory area? - Is there a dynamic type problem? - Does it comply to the specification? - Is there a memory leakage? - Does it terminate? - What is its running time? [Rice-like] Essentially, all these questions are undecidable.

  50. Program analysis Given an input program/piece of program: - Does it perform a zero division? - Does it access a non-allocated memory area? - Is there a dynamic type problem? - Does it comply to the specification? - Is there a memory leakage? - Does it terminate? - What is its running time? [Rice-like] Essentially, all these questions are undecidable. Solution here : in this talk, we use the size-change abstract model 
 ( [Ben-Amram, Chin Soon Lee, Neil D. Jones 01] ).

  51. Example void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } 
 }

  52. Example these variables remain non-negative. void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } 
 }

  53. Example these variables remain non-negative. void main() { uint x,y; x = read_input(); are initialized with an uncontrolled value y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } 
 }

  54. Example these variables remain non-negative. void main() { uint x,y; x = read_input(); are initialized with an uncontrolled value y = read_input(); while (x > 0) { if (y > 0) { y--; } either y decreases else { y = read_input(); x--; } } 
 }

  55. Example these variables remain non-negative. void main() { uint x,y; x = read_input(); are initialized with an uncontrolled value y = read_input(); while (x > 0) { if (y > 0) { y--; } either y decreases else or x decreases, { y = read_input(); and y gets an uncontrolled value x--; } } 
 }

  56. Example these variables remain non-negative. void main() { uint x,y; x = read_input(); are initialized with an uncontrolled value y = read_input(); while (x > 0) { if (y > 0) { y--; } either y decreases else or x decreases, { y = read_input(); and y gets an uncontrolled value x--; } } 
 } Remark : This program terminates.

  57. Example these variables remain non-negative. void main() { uint x,y; x = read_input(); are initialized with an uncontrolled value y = read_input(); while (x > 0) { if (y > 0) { y--; } either y decreases else or x decreases, { y = read_input(); and y gets an uncontrolled value x--; } } 
 } Remark : This program terminates. Question : what method can automatically establish it ?

  58. Principle of abstraction

  59. Principle of abstraction Principle : replace the program by an abstraction: - Information that is lost is replaced by non-determinism. 
 This includes: 
 + The dynamic information resulting from the interactions with the environment. 
 + All the tests and computations that cannot be abstracted in the restricted model of the abstraction. - The resulting abstraction can be analyzed: it can be decided whether the resulting abstraction stops an all its executions. - If the abstraction stops on all its executions, then the original programs stops an all its executions.

  60. Principle of abstraction Principle : replace the program by an abstraction: - Information that is lost is replaced by non-determinism. 
 This includes: 
 + The dynamic information resulting from the interactions with the environment. 
 + All the tests and computations that cannot be abstracted in the restricted model of the abstraction. - The resulting abstraction can be analyzed: it can be decided whether the resulting abstraction stops an all its executions. - If the abstraction stops on all its executions, then the original programs stops an all its executions. Remark : Of course, this is a compromise between the efficiency of the decision problem, and the loss of information during the abstraction.

  61. Principle of abstraction Principle : replace the program by an abstraction: - Information that is lost is replaced by non-determinism. 
 This includes: 
 + The dynamic information resulting from the interactions with the environment. 
 + All the tests and computations that cannot be abstracted in the restricted model of the abstraction. - The resulting abstraction can be analyzed: it can be decided whether the resulting abstraction stops an all its executions. - If the abstraction stops on all its executions, then the original programs stops an all its executions. Remark : Of course, this is a compromise between the efficiency of the decision problem, and the loss of information during the abstraction. ⇒ In this talk, we use the model of size-change abstraction.

  62. Size-change abstraction

  63. Size-change abstraction [Ben-Amram et al. 01] A size-change abstraction ( SCA ): - this is a non-determininistic finite state machine - that uses a finite set variables ( x , y , z …) ranging over non-negative integers - during each transition , a guards relate the variables before and after: 
 x ≥ y’ meaning « val of x before the transition ≥ val of y after the transition » 
 x > y’ meaning « val of x before the transition > val of y after the transition »

  64. Size-change abstraction [Ben-Amram et al. 01] A size-change abstraction ( SCA ): - this is a non-determininistic finite state machine - that uses a finite set variables ( x , y , z …) ranging over non-negative integers - during each transition , a guards relate the variables before and after: 
 x ≥ y’ meaning « val of x before the transition ≥ val of y after the transition » 
 x > y’ meaning « val of x before the transition > val of y after the transition » a: x ≥ x’ p b: x>x’ ⋀ y>y’

  65. Size-change abstraction [Ben-Amram et al. 01] A size-change abstraction ( SCA ): - this is a non-determininistic finite state machine - that uses a finite set variables ( x , y , z …) ranging over non-negative integers - during each transition , a guards relate the variables before and after: 
 x ≥ y’ meaning « val of x before the transition ≥ val of y after the transition » 
 x > y’ meaning « val of x before the transition > val of y after the transition » A configuration is a state together with a non- negative integer value for each of the variables . a: x ≥ x’ p b: x>x’ ⋀ y>y’

  66. Size-change abstraction [Ben-Amram et al. 01] A size-change abstraction ( SCA ): - this is a non-determininistic finite state machine - that uses a finite set variables ( x , y , z …) ranging over non-negative integers - during each transition , a guards relate the variables before and after: 
 x ≥ y’ meaning « val of x before the transition ≥ val of y after the transition » 
 x > y’ meaning « val of x before the transition > val of y after the transition » A configuration is a state together with a non- negative integer value for each of the variables . a: x ≥ x’ p b: x>x’ A run of the SCA is a sequence of configurations ⋀ y>y’ that starts in an initial configuration, ends in a final one, and each consecutive configurations satisfy the guard of some possible transition.

  67. Size-change abstraction [Ben-Amram et al. 01] A size-change abstraction ( SCA ): - this is a non-determininistic finite state machine - that uses a finite set variables ( x , y , z …) ranging over non-negative integers - during each transition , a guards relate the variables before and after: 
 x ≥ y’ meaning « val of x before the transition ≥ val of y after the transition » 
 x > y’ meaning « val of x before the transition > val of y after the transition » A configuration is a state together with a non- negative integer value for each of the variables . a: x ≥ x’ p b: x>x’ A run of the SCA is a sequence of configurations ⋀ y>y’ that starts in an initial configuration, ends in a final one, and each consecutive configurations satisfy the guard of some possible transition. (p,2,2) (p,2,1) (p,2,0) (p,1,2) (p,1,1) (p,0,2) (p,0,1) (p,0,0)

  68. Size-change abstraction [Ben-Amram et al. 01] A size-change abstraction ( SCA ): - this is a non-determininistic finite state machine - that uses a finite set variables ( x , y , z …) ranging over non-negative integers - during each transition , a guards relate the variables before and after: 
 x ≥ y’ meaning « val of x before the transition ≥ val of y after the transition » 
 x > y’ meaning « val of x before the transition > val of y after the transition » A configuration is a state together with a non- negative integer value for each of the variables . a: x ≥ x’ p b: x>x’ A run of the SCA is a sequence of configurations ⋀ y>y’ that starts in an initial configuration, ends in a final one, and each consecutive configurations satisfy the guard of some possible transition. (p,2,2) (p,2,1) (p,2,0) (p,1,2) (p,1,1) (p,0,2) (p,0,1) (p,0,0) a a b a b a a

  69. Size-change abstraction [Ben-Amram et al. 01] A size-change abstraction ( SCA ): - this is a non-determininistic finite state machine - that uses a finite set variables ( x , y , z …) ranging over non-negative integers - during each transition , a guards relate the variables before and after: 
 x ≥ y’ meaning « val of x before the transition ≥ val of y after the transition » 
 x > y’ meaning « val of x before the transition > val of y after the transition » A configuration is a state together with a non- negative integer value for each of the variables . a: x ≥ x’ p b: x>x’ A run of the SCA is a sequence of configurations ⋀ y>y’ that starts in an initial configuration, ends in a final one, and each consecutive configurations satisfy the guard of some possible transition. (p,2,2) (p,2,1) (p,2,0) (p,1,2) (p,1,1) (p,0,2) (p,0,1) (p,0,0) a a b a b a a A size-change abstraction terminates if it has no infinite run .

  70. Size-change abstraction [Ben-Amram et al. 01] A size-change abstraction ( SCA ): - this is a non-determininistic finite state machine - that uses a finite set variables ( x , y , z …) ranging over non-negative integers - during each transition , a guards relate the variables before and after: 
 x ≥ y’ meaning « val of x before the transition ≥ val of y after the transition » 
 x > y’ meaning « val of x before the transition > val of y after the transition » A configuration is a state together with a non- negative integer value for each of the variables . a: x ≥ x’ p b: x>x’ A run of the SCA is a sequence of configurations ⋀ y>y’ that starts in an initial configuration, ends in a final one, and each consecutive configurations satisfy the guard of some possible transition. (p,2,2) (p,2,1) (p,2,0) (p,1,2) (p,1,1) (p,0,2) (p,0,1) (p,0,0) a a b a b a a A size-change abstraction terminates if it has no infinite run . [Ben-Aram et al. 01] Termination of size-change abstraction is PSPACE.

  71. Abstracting - fix quantities to keep track of, here x , y (can be other quantities) - construct the control flow graph of the code - use as guard the best ones you can infer void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } 
 }

  72. Abstracting - fix quantities to keep track of, here x , y (can be other quantities) - construct the control flow graph of the code - use as guard the best ones you can infer void main() { uint x,y; a: x ≥ x’ p b: x>x’ x = read_input(); ⋀ y>y’ y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } 
 }

  73. Abstracting - fix quantities to keep track of, here x , y (can be other quantities) - construct the control flow graph of the code - use as guard the best ones you can infer void main() { uint x,y; a: x ≥ x’ p b: x>x’ x = read_input(); ⋀ y>y’ y = read_input(); while (x > 0) { if (y > 0) { y--; } else Remark : every run of the original program { y = read_input(); induces a run of the SCA of game size. 
 x--; } } 
 Hence if the SCA terminates, the original } program also does (on all its executions).

  74. Deciding the termination of size-change abstraction

  75. Deciding the termination of size-change abstraction [Ben-Amram et al. 01] : The termination of SCA is decidable.

  76. Deciding the termination of size-change abstraction [Ben-Amram et al. 01] : The termination of SCA is decidable. p a: x ≥ x’ b: x>x’ ⋀ y>y’

  77. Deciding the termination of size-change abstraction [Ben-Amram et al. 01] : The termination of SCA is decidable. Proof: We construct a Büchi automaton Aut as follows. p a: x ≥ x’ b: x>x’ ⋀ y>y’

  78. Deciding the termination of size-change abstraction [Ben-Amram et al. 01] : The termination of SCA is decidable. Proof: We construct a Büchi automaton Aut as follows. p a: x ≥ x’ b: x>x’ ⋀ y>y’ a :0, b :1 * * x * * ⊥ ⊤ * * y a :1

  79. Deciding the termination of size-change abstraction [Ben-Amram et al. 01] : The termination of SCA is decidable. Proof: We construct a Büchi automaton Aut as follows. Take as alphabet the transitions of the SCA . p a: x ≥ x’ b: x>x’ ⋀ y>y’ a :0, b :1 * * x * * ⊥ ⊤ * * y a :1

  80. Deciding the termination of size-change abstraction [Ben-Amram et al. 01] : The termination of SCA is decidable. Proof: We construct a Büchi automaton Aut as follows. Take as alphabet the transitions of the SCA . Take as states of the automaton, the variables of the SCA + { ⊤ , ⊥ }. p a: x ≥ x’ b: x>x’ ⋀ y>y’ a :0, b :1 * * x * * ⊥ ⊤ * * y a :1

Recommend


More recommend