Automata and program analysis
Thomas Colcombet FCT Bordeaux 13 September 2017
based on joint work with Laure Daviaud et Florian Zuleger
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
Thomas Colcombet FCT Bordeaux 13 September 2017
based on joint work with Laure Daviaud et Florian Zuleger
[Schützenberger 61]
Consider a non-deterministic automaton (A,Q,I,F,Δ). [Schützenberger 61]
Consider a non-deterministic automaton (A,Q,I,F,Δ). It computes a language L: A* ➝ {0,1} [Schützenberger 61]
Consider a non-deterministic automaton (A,Q,I,F,Δ). It computes a language L: A* ➝ {0,1} [Schützenberger 61] accepted not accepted
Consider a non-deterministic automaton (A,Q,I,F,Δ). It computes a language L: A* ➝ {0,1} [Schützenberger 61] Q states, initial I: Q ➝ {0,1}, final F: Q ➝ {0,1}, weights Δ: Q×A×Q ➝ {0,1} accepted not accepted
Consider a non-deterministic automaton (A,Q,I,F,Δ). It computes a language L: A* ➝ {0,1} [Schützenberger 61] Definition: u = a₁,a₂,…,an ∈ L iff there exists an accepting run over it. Q states, initial I: Q ➝ {0,1}, final F: Q ➝ {0,1}, weights Δ: Q×A×Q ➝ {0,1} accepted not accepted
Consider a non-deterministic automaton (A,Q,I,F,Δ). It computes a language L: A* ➝ {0,1} [Schützenberger 61] Definition: u = a₁,a₂,…,an ∈ L iff there exists an accepting run over it. Q states, initial I: Q ➝ {0,1}, final F: Q ➝ {0,1}, weights Δ: Q×A×Q ➝ {0,1} Logically, there exist p₀,p₁,…,pn such that I(q₀) ⋀ Δ(q₀,a₁,q₁) ⋀ Δ(q₁,a₂,q₂) ⋀ … ⋀ Δ(qn-1,an,qn) ⋀ F(qn) accepted not accepted
Consider a non-deterministic automaton (A,Q,I,F,Δ). It computes a language L: A* ➝ {0,1} [Schützenberger 61] Definition: u = a₁,a₂,…,an ∈ L iff there exists an accepting run over it. Q states, initial I: Q ➝ {0,1}, final F: Q ➝ {0,1}, weights Δ: Q×A×Q ➝ {0,1} Logically, there exist p₀,p₁,…,pn such that I(q₀) ⋀ Δ(q₀,a₁,q₁) ⋀ Δ(q₁,a₂,q₂) ⋀ … ⋀ Δ(qn-1,an,qn) ⋀ F(qn) [Schützenberger 61] disjunction and conjunction can be replaced by the
accepted not accepted
Consider a non-deterministic automaton (A,Q,I,F,Δ). It computes a language L: A* ➝ {0,1} [Schützenberger 61] Definition: u = a₁,a₂,…,an ∈ L iff there exists an accepting run over it. Q states, initial I: Q ➝ {0,1}, final F: Q ➝ {0,1}, weights Δ: Q×A×Q ➝ {0,1} Logically, there exist p₀,p₁,…,pn such that I(q₀) ⋀ Δ(q₀,a₁,q₁) ⋀ Δ(q₁,a₂,q₂) ⋀ … ⋀ Δ(qn-1,an,qn) ⋀ F(qn) [Schützenberger 61] disjunction and conjunction can be replaced by the
accepted not accepted
An automaton (A,Q,I,F,Δ) with I: Q➝S, F: Q➝S, and Δ: Q×A×Q, computes a map L: A* ➝ S defined as L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
addition multiplication
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
Gives rise to product of S valued matrices that form a monoid. addition multiplication
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n } Gives rise to product of S valued matrices that form a monoid. addition multiplication
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
Boolean semiring: ({0,1},⋁,⋀,0,1) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n } Gives rise to product of S valued matrices that form a monoid. addition multiplication
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
Boolean semiring: ({0,1},⋁,⋀,0,1) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n } Gives rise to product of S valued matrices that form a monoid. Non-deterministic automata addition multiplication
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
Boolean semiring: ({0,1},⋁,⋀,0,1) Reals/Integers/Rationals/Natural numbers: (R,+,×,0,1) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n } Gives rise to product of S valued matrices that form a monoid. Non-deterministic automata addition multiplication
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
Boolean semiring: ({0,1},⋁,⋀,0,1) Reals/Integers/Rationals/Natural numbers: (R,+,×,0,1) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n } Gives rise to product of S valued matrices that form a monoid. Non-deterministic automata Computes the number of runs of the NDA addition multiplication
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
Boolean semiring: ({0,1},⋁,⋀,0,1) Reals/Integers/Rationals/Natural numbers: (R,+,×,0,1) « Rat semiring »: (Rat(A), ∪ , ⋅ , ∅, {ε} ) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n } Gives rise to product of S valued matrices that form a monoid. Non-deterministic automata Computes the number of runs of the NDA addition multiplication
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
Boolean semiring: ({0,1},⋁,⋀,0,1) Reals/Integers/Rationals/Natural numbers: (R,+,×,0,1) « Rat semiring »: (Rat(A), ∪ , ⋅ , ∅, {ε} ) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n } Gives rise to product of S valued matrices that form a monoid. Non-deterministic automata Rational transducers Computes the number of runs of the NDA addition multiplication
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
Boolean semiring: ({0,1},⋁,⋀,0,1) Reals/Integers/Rationals/Natural numbers: (R,+,×,0,1) « Rat semiring »: (Rat(A), ∪ , ⋅ , ∅, {ε} ) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n } Gives rise to product of S valued matrices that form a monoid. Non-deterministic automata Rational transducers Tropical semiring: (R∪{-∞},max,+,-∞,0) (R∪{+∞},min,+,+∞,0), (N∪{-∞},max,+,-∞,0), (N∪{+∞},min,+,+∞,0) Computes the number of runs of the NDA addition multiplication
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
Boolean semiring: ({0,1},⋁,⋀,0,1) Reals/Integers/Rationals/Natural numbers: (R,+,×,0,1) « Rat semiring »: (Rat(A), ∪ , ⋅ , ∅, {ε} ) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n } Gives rise to product of S valued matrices that form a monoid. Non-deterministic automata Rational transducers Tropical automata Tropical semiring: (R∪{-∞},max,+,-∞,0) (R∪{+∞},min,+,+∞,0), (N∪{-∞},max,+,-∞,0), (N∪{+∞},min,+,+∞,0) Computes the number of runs of the NDA addition multiplication
A semiring (S,⨁,⨂,0,1) is such that:
(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a
(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a
a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)
0⨂a = a⨂0 = 0
Boolean semiring: ({0,1},⋁,⋀,0,1) Reals/Integers/Rationals/Natural numbers: (R,+,×,0,1) « Rat semiring »: (Rat(A), ∪ , ⋅ , ∅, {ε} ) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n } Gives rise to product of S valued matrices that form a monoid. Non-deterministic automata Rational transducers Tropical automata Tropical semiring: (R∪{-∞},max,+,-∞,0) (R∪{+∞},min,+,+∞,0), (N∪{-∞},max,+,-∞,0), (N∪{+∞},min,+,+∞,0) Computes the number of runs of the NDA addition multiplication
L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n
L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n
(N∪{-∞},max,+,-∞,0)
L(u)≥n if and only if (∃ run ρ over u) weight(ρ)≥n
L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n
(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
L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n
p q r a : 1 b : 0 b : 0 a, b : 0 a, b : 0
(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
by convention zero-transitions (-∞/+∞) are not displayed (neutral for ⨂ and absorbing for ⨂) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n
p q r a : 1 b : 0 b : 0 a, b : 0 a, b : 0
(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
by convention zero-transitions (-∞/+∞) are not displayed (neutral for ⨂ and absorbing for ⨂) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n
p q r a : 1 b : 0 b : 0 a, b : 0 a, b : 0
The max-plus automaton computes:
(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
by convention zero-transitions (-∞/+∞) are not displayed (neutral for ⨂ and absorbing for ⨂) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n
p q r a : 1 b : 0 b : 0 a, b : 0 a, b : 0
The max-plus automaton computes: LA: A* ➝ N∪{-∞} u ⟼
(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
by convention zero-transitions (-∞/+∞) are not displayed (neutral for ⨂ and absorbing for ⨂) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n
p q r a : 1 b : 0 b : 0 a, b : 0 a, b : 0
The max-plus automaton computes: the size of the longest block of consecutive a’s surrounded by 2 b’s LA: A* ➝ N∪{-∞} u ⟼
(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
by convention zero-transitions (-∞/+∞) are not displayed (neutral for ⨂ and absorbing for ⨂) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n
p q r a : 1 b : 0 b : 0 a, b : 0 a, b : 0
The max-plus automaton computes: the size of the longest block of consecutive a’s surrounded by 2 b’s LA: A* ➝ N∪{-∞} u ⟼
(N∪{-∞},max,+,-∞,0)
L(u)≥n if and only if (∃ run ρ over u) weight(ρ)≥n
[Krob 94] The equality of max-plus definable functions is undecidable.
(N∪{∞},min,+,∞,0)
L(u)≥n if and only if (∀ run ρ over u) weight(ρ)≥n
by convention zero-transitions (-∞/+∞) are not displayed (neutral for ⨂ and absorbing for ⨂) L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)
p₀,…,pn
i=1 n
p q r a : 1 b : 0 b : 0 a, b : 0 a, b : 0
The max-plus automaton computes: the size of the longest block of consecutive a’s surrounded by 2 b’s LA: A* ➝ N∪{-∞} u ⟼
(N∪{-∞},max,+,-∞,0)
L(u)≥n if and only if (∃ run ρ over u) weight(ρ)≥n
[Hashiguchi 81] The boundedness of distance automata is decidable. [Leung88] [Simon78,94] [Kirsten05] [C. & Bojanczyk 06] [C. 09] [Bojanczyk15] [Krob 94] The equality of max-plus definable functions is undecidable.
(N∪{∞},min,+,∞,0)
L(u)≥n if and only if (∀ run ρ over u) weight(ρ)≥n
Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting
Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting NL-c
Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting Universality of NDA ? (∀ word w) (∃ run ρ over w) ρ is accepting NL-c
Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting Universality of NDA ? (∀ word w) (∃ run ρ over w) ρ is accepting NL-c PSPACE-c (powerset)
Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting Universality of NDA ? (∀ word w) (∃ run ρ over w) ρ is accepting Is a (Z∪{∞},max,+) automaton ≤ 0 ? (∀ word w) (∀ run ρ over w) weight(ρ)≤0 NL-c PSPACE-c (powerset)
Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting Universality of NDA ? (∀ word w) (∃ run ρ over w) ρ is accepting Is a (Z∪{∞},max,+) automaton ≤ 0 ? (∀ word w) (∀ run ρ over w) weight(ρ)≤0 NL-c NL-c PSPACE-c (powerset)
Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting Universality of NDA ? (∀ word w) (∃ run ρ over w) ρ is accepting Is a (Z∪{∞},max,+) automaton ≥ 0 ? (∀ word w) (∃ run ρ over w) weight(ρ)≥0 Is a (Z∪{∞},max,+) automaton ≤ 0 ? (∀ word w) (∀ run ρ over w) weight(ρ)≤0 NL-c NL-c PSPACE-c (powerset)
Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting Universality of NDA ? (∀ word w) (∃ run ρ over w) ρ is accepting Is a (Z∪{∞},max,+) automaton ≥ 0 ? (∀ word w) (∃ run ρ over w) weight(ρ)≥0 Is a (Z∪{∞},max,+) automaton ≤ 0 ? (∀ word w) (∀ run ρ over w) weight(ρ)≤0 NL-c NL-c undecidable [Krob92, other form] PSPACE-c (powerset)
Is a (N∪{-∞},max,+) automaton bounded? (∃ n∈N) (∀ word w) (∀ run ρ over w) weight(ρ)≤n Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting Universality of NDA ? (∀ word w) (∃ run ρ over w) ρ is accepting Is a (Z∪{∞},max,+) automaton ≥ 0 ? (∀ word w) (∃ run ρ over w) weight(ρ)≥0 Is a (Z∪{∞},max,+) automaton ≤ 0 ? (∀ word w) (∀ run ρ over w) weight(ρ)≤0 NL-c NL-c undecidable [Krob92, other form] PSPACE-c (powerset)
Is a (N∪{-∞},max,+) automaton bounded? (∃ n∈N) (∀ word w) (∀ run ρ over w) weight(ρ)≤n Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting Universality of NDA ? (∀ word w) (∃ run ρ over w) ρ is accepting Is a (Z∪{∞},max,+) automaton ≥ 0 ? (∀ word w) (∃ run ρ over w) weight(ρ)≥0 Is a (Z∪{∞},max,+) automaton ≤ 0 ? (∀ word w) (∀ run ρ over w) weight(ρ)≤0 NL-c NL-c undecidable [Krob92, other form] NL-c PSPACE-c (powerset)
Is a (N∪{-∞},max,+) automaton bounded? (∃ n∈N) (∀ word w) (∀ run ρ over w) weight(ρ)≤n Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting Universality of NDA ? (∀ word w) (∃ run ρ over w) ρ is accepting Is a (Z∪{∞},max,+) automaton ≥ 0 ? (∀ word w) (∃ run ρ over w) weight(ρ)≥0 Is a (Z∪{∞},max,+) automaton ≤ 0 ? (∀ word w) (∀ run ρ over w) weight(ρ)≤0 Is a (N∪{∞},min,+) automaton bounded? (∃ n∈N) (∀ word w) (∃ run ρ over w) weight(ρ)≤n NL-c NL-c undecidable [Krob92, other form] NL-c PSPACE-c (powerset)
Is a (N∪{-∞},max,+) automaton bounded? (∃ n∈N) (∀ word w) (∀ run ρ over w) weight(ρ)≤n Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting Universality of NDA ? (∀ word w) (∃ run ρ over w) ρ is accepting Is a (Z∪{∞},max,+) automaton ≥ 0 ? (∀ word w) (∃ run ρ over w) weight(ρ)≥0 Is a (Z∪{∞},max,+) automaton ≤ 0 ? (∀ word w) (∀ run ρ over w) weight(ρ)≤0 Is a (N∪{∞},min,+) automaton bounded? (∃ n∈N) (∀ word w) (∃ run ρ over w) weight(ρ)≤n NL-c NL-c undecidable [Krob92, other form] NL-c PSPACE-c (powerset) PSPACE-c [Hashiguchi81,Leung84]
Is a (N∪{-∞},max,+) automaton bounded? (∃ n∈N) (∀ word w) (∀ run ρ over w) weight(ρ)≤n Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting Universality of NDA ? (∀ word w) (∃ run ρ over w) ρ is accepting Is a (Z∪{∞},max,+) automaton ≥ 0 ? (∀ word w) (∃ run ρ over w) weight(ρ)≥0 Is a (Z∪{∞},max,+) automaton ≤ 0 ? (∀ word w) (∀ run ρ over w) weight(ρ)≤0 Is a (N∪{∞},min,+) automaton bounded? (∃ n∈N) (∀ word w) (∃ run ρ over w) weight(ρ)≤n NL-c NL-c undecidable [Krob92, other form] NL-c PSPACE-c (powerset) Given a (N∪{∞},max,+) automaton, find the least θ∈[0,1] such that (∃ a) (∀ s∈N) (∃ word w, |w|≥s) (∀ run ρ over w) weight(ρ) ≤ asθ PSPACE-c [Hashiguchi81,Leung84]
Is a (N∪{-∞},max,+) automaton bounded? (∃ n∈N) (∀ word w) (∀ run ρ over w) weight(ρ)≤n Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting Universality of NDA ? (∀ word w) (∃ run ρ over w) ρ is accepting Is a (Z∪{∞},max,+) automaton ≥ 0 ? (∀ word w) (∃ run ρ over w) weight(ρ)≥0 Is a (Z∪{∞},max,+) automaton ≤ 0 ? (∀ word w) (∀ run ρ over w) weight(ρ)≤0 Is a (N∪{∞},min,+) automaton bounded? (∃ n∈N) (∀ word w) (∃ run ρ over w) weight(ρ)≤n NL-c NL-c undecidable [Krob92, other form] NL-c PSPACE-c (powerset) Given a (N∪{∞},max,+) automaton, find the least θ∈[0,1] such that (∃ a) (∀ s∈N) (∃ word w, |w|≥s) (∀ run ρ over w) weight(ρ) ≤ asθ PSPACE-c [Hashiguchi81,Leung84] [C., Daviaud, Zuleger 14] This θ exists and is rational. Furthermore, it can be constructed in EXPSPACE, likely to be PSPACE-complete.
Given a (N∪{∞},max,+) automaton, find the least θ∈[0,1] such that (∃ a) (∀ s∈N) (∃ word w, |w|≥s) (∀ run ρ over w) weight(ρ) ≤ asθ
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.
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 length of the word s=|u| n
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. What is the asymptotic? result length of the word s=|u| n
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. What is the asymptotic? result length of the word s=|u| n
lim inf
u∈A∗
log f(u) log |u| = θ
find the least value of a word
Compute:
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. What is the asymptotic?
lim sup
u∈A∗
log |u| log f(|u|) = 1 θ
find the longest size of a word
result length of the word s=|u| n
lim inf
u∈A∗
log f(u) log |u| = θ
find the least value of a word
Compute:
Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. Ingredient 1.
e.g. for universality I(W) = {P⊆Q : P=Reach(I,u) for some u∈W} Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. Ingredient 1.
e.g. for universality I(W) = {P⊆Q : P=Reach(I,u) for some u∈W} In our case, I(W) = { f:Q×Q➝N : there is a run that displays this behavior } ⊆ P(NQ×Q) Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. Ingredient 1.
e.g. for universality I(W) = {P⊆Q : P=Reach(I,u) for some u∈W} In our case, I(W) = { f:Q×Q➝N : there is a run that displays this behavior } ⊆ P(NQ×Q) Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. Ingredient 1. Ingredient 2. Give a notion of approximation for such sets: Hausdorff-like keeping asymptotes.
e.g. for universality I(W) = {P⊆Q : P=Reach(I,u) for some u∈W} In our case, I(W) = { f:Q×Q➝N : there is a run that displays this behavior } ⊆ P(NQ×Q) Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. Ingredient 1. 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 RQ×Q representing simultaneous asymptotic behaviors.
e.g. for universality I(W) = {P⊆Q : P=Reach(I,u) for some u∈W} In our case, I(W) = { f:Q×Q➝N : there is a run that displays this behavior } ⊆ P(NQ×Q) Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. Ingredient 1. 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 RQ×Q representing simultaneous asymptotic behaviors. Step 4. Compute a presentable equivalent (up to approximation) of I(A*)
e.g. for universality I(W) = {P⊆Q : P=Reach(I,u) for some u∈W} In our case, I(W) = { f:Q×Q➝N : there is a run that displays this behavior } ⊆ P(NQ×Q) Given a set of words W, collect an information I(W) sufficient for understanding its behavior in any context. Ingredient 1. 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 RQ×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].
Given an input program/piece of program:
Given an input program/piece of program:
[Rice-like] Essentially, all these questions are undecidable.
Given an input program/piece of program:
[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]).
void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } }
void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } }
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--; } } }
these variables remain non-negative. are initialized with an uncontrolled value
void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } }
these variables remain non-negative. are initialized with an uncontrolled value either y decreases
void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } }
these variables remain non-negative. are initialized with an uncontrolled value either y decreases
and y gets an uncontrolled value
void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } }
these variables remain non-negative. are initialized with an uncontrolled value either y decreases
and y gets an uncontrolled value Remark: This program terminates.
void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } }
these variables remain non-negative. are initialized with an uncontrolled value either y decreases
and y gets an uncontrolled value Remark: This program terminates. Question: what method can automatically establish it ?
Principle: replace the program by an abstraction:
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 stops an all its executions.
programs stops an all its executions.
Principle: replace the program by an abstraction:
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 stops an all its executions.
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.
Principle: replace the program by an abstraction:
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 stops an all its executions.
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.
[Ben-Amram et al. 01] A size-change abstraction (SCA):
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 »
[Ben-Amram et al. 01] A size-change abstraction (SCA):
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’ ⋀ y>y’ b: x>x’
p
[Ben-Amram et al. 01] A size-change abstraction (SCA):
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’ ⋀ y>y’ b: x>x’
p
A configuration is a state together with a non- negative integer value for each of the variables.
[Ben-Amram et al. 01] A size-change abstraction (SCA):
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’ ⋀ y>y’ b: x>x’
p
A run of the SCA is a sequence of configurations that starts in an initial configuration, ends in a final one, and each consecutive configurations satisfy the guard of some possible transition. A configuration is a state together with a non- negative integer value for each of the variables.
[Ben-Amram et al. 01] A size-change abstraction (SCA):
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’ ⋀ y>y’ b: x>x’
p
A run of the SCA is a sequence of configurations that starts in an initial configuration, ends in a final one, and each consecutive configurations satisfy the guard of some possible transition. A configuration is a state together with a non- negative integer value for each of the variables. (p,2,2) (p,2,1) (p,2,0) (p,1,2) (p,1,1) (p,0,2) (p,0,1) (p,0,0)
[Ben-Amram et al. 01] A size-change abstraction (SCA):
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’ ⋀ y>y’ b: x>x’
p
A run of the SCA is a sequence of configurations that starts in an initial configuration, ends in a final one, and each consecutive configurations satisfy the guard of some possible transition. A configuration is a state together with a non- negative integer value for each of the variables. (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 b a a a
[Ben-Amram et al. 01] A size-change abstraction (SCA):
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’ ⋀ y>y’ b: x>x’
p
A run of the SCA is a sequence of configurations that starts in an initial configuration, ends in a final one, and each consecutive configurations satisfy the guard of some possible transition. A configuration is a state together with a non- negative integer value for each of the variables. (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 b a a a A size-change abstraction terminates if it has no infinite run.
[Ben-Amram et al. 01] A size-change abstraction (SCA):
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’ ⋀ y>y’ b: x>x’
p
A run of the SCA is a sequence of configurations that starts in an initial configuration, ends in a final one, and each consecutive configurations satisfy the guard of some possible transition. A configuration is a state together with a non- negative integer value for each of the variables. (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 b a 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.
void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } }
void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } }
a: x≥x’ ⋀ y>y’ b: x>x’
p
void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } }
a: x≥x’ ⋀ y>y’ b: x>x’
p
Remark: every run of the original program induces a run of the SCA of game size. Hence if the SCA terminates, the original program also does (on all its executions).
[Ben-Amram et al. 01]: The termination of SCA is decidable.
[Ben-Amram et al. 01]: The termination of SCA is decidable.
a: x≥x’ ⋀ y>y’ b: x>x’
p
[Ben-Amram et al. 01]: The termination of SCA is decidable. Proof: We construct a Büchi automaton Aut as follows.
a: x≥x’ ⋀ y>y’ b: x>x’
p
[Ben-Amram et al. 01]: The termination of SCA is decidable. Proof: We construct a Büchi automaton Aut as follows.
a: x≥x’ ⋀ y>y’ b: x>x’
p
⊤ x y ⊥ * * * * * * a:0, b:1 a:1
[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.
a: x≥x’ ⋀ y>y’ b: x>x’
p
⊤ x y ⊥ * * * * * * a:0, b:1 a:1
[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 + {⊤,⊥}.
a: x≥x’ ⋀ y>y’ b: x>x’
p
⊤ x y ⊥ * * * * * * a:0, b:1 a:1
[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 + {⊤,⊥}. All states of the automaton are initial.
a: x≥x’ ⋀ y>y’ b: x>x’
p
⊤ x y ⊥ * * * * * * a:0, b:1 a:1
[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 + {⊤,⊥}. All states of the automaton are initial. Δ(x,a,y) ={ -∞ otherwise (no guard) 0 if there is a guard x ≥ y’ in a 1 if there is a guard x > y’ in a
a: x≥x’ ⋀ y>y’ b: x>x’
p
⊤ x y ⊥ * * * * * * a:0, b:1 a:1
[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 + {⊤,⊥}. All states of the automaton are initial. Δ(x,a,y) ={ -∞ otherwise (no guard) 0 if there is a guard x ≥ y’ in a 1 if there is a guard x > y’ in a
a: x≥x’ ⋀ y>y’ b: x>x’
p
(Δ(⊥,?,?)=0, Δ(?,?,⊤)=0) ⊤ x y ⊥ * * * * * * a:0, b:1 a:1
[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 + {⊤,⊥}. All states of the automaton are initial. Δ(x,a,y) ={ -∞ otherwise (no guard) 0 if there is a guard x ≥ y’ in a 1 if there is a guard x > y’ in a
a: x≥x’ ⋀ y>y’ b: x>x’
p
(Δ(⊥,?,?)=0, Δ(?,?,⊤)=0) ∃ input word u for Aut of same length such that 1) it is a value-free valid run (regular) 2) there is no run of Aut with infinitely many 1’s (Büchi condition) ∃ run ρ of SCA Claim: ⊤ x y ⊥ * * * * * * a:0, b:1 a:1
[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 + {⊤,⊥}. All states of the automaton are initial. Δ(x,a,y) ={ -∞ otherwise (no guard) 0 if there is a guard x ≥ y’ in a 1 if there is a guard x > y’ in a
a: x≥x’ ⋀ y>y’ b: x>x’
p
(Δ(⊥,?,?)=0, Δ(?,?,⊤)=0) ∃ input word u for Aut of same length such that 1) it is a value-free valid run (regular) 2) there is no run of Aut with infinitely many 1’s (Büchi condition) ∃ run ρ of SCA Claim: ⇒ Runs/Aut=∅ ? ⊤ x y ⊥ * * * * * * a:0, b:1 a:1
[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 + {⊤,⊥}. All states of the automaton are initial. Δ(x,a,y) ={ -∞ otherwise (no guard) 0 if there is a guard x ≥ y’ in a 1 if there is a guard x > y’ in a
a: x≥x’ ⋀ y>y’ b: x>x’
p
(Δ(⊥,?,?)=0, Δ(?,?,⊤)=0) ∃ input word u for Aut of same length such that 1) it is a value-free valid run (regular) 2) there is no run of Aut with infinitely many 1’s (Büchi condition) ∃ run ρ of SCA Claim: ⇒ Runs/Aut=∅ ?
⇒ PSPACE
⊤ x y ⊥ * * * * * * a:0, b:1 a:1
Some code size-change abstraction Büchi automaton Decide an inclusion problem for Büchi automata
reflects termination Does it terminate?
void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } } a: x≥x’ ⋀ y>y’ b: x>x’
p
⊤ x y ⊥ * * * * * * a:0, b:1 a:1
equivalent for termination
Some code size-change abstraction Büchi automaton Decide an inclusion problem for Büchi automata
reflects termination does it terminate?
void main() { uint x,y; x = read_input(); y = read_input(); while (x > 0) { if (y > 0) { y--; } else { y = read_input(); x--; } } } a: x≥x’ ⋀ y>y’ b: x>x’
p
⊤ x y ⊥ * * * * * * a:0, b:1 a:1
equivalent for termination
Some code size-change abstraction N-max-plus automaton Compute the asymptotic worst-case behavior
reflects complexity What is its complexity? (as a function of a parameter n)
void main(uint n) { uint x,y; x = read_input(n); y = read_input(n); while (x > 0) { if (y > 0) { y--; } else { y = read_input(n); x--; } } } a: x≥x’ ⋀ y>y’ b: x>x’
p
⊤ x y ⊥ * * * * * * a:0, b:1 a:1
equivalent for complexity More precisely, find α such that the program stops in Θ(nα).
void main(uint n) { uint x,y; x = read_input(n); y = read_input(n); while (x > 0) { if (y > 0) { y--; } else { y = read_input(n); x--; } } }
a: x≥x’ ⋀ y>y’ b: x>x’
p
void main(uint n) { uint x,y; x = read_input(n); y = read_input(n); while (x > 0) { if (y > 0) { y--; } else { y = read_input(n); x--; } } }
a: x≥x’ ⋀ y>y’ b: x>x’
p
void main(uint n) { uint x,y; x = read_input(n); y = read_input(n); while (x > 0) { if (y > 0) { y--; } else { y = read_input(n); x--; } } }
An n-run of the SCA is a run in which all the variables take their values in [1,n]
a: x≥x’ ⋀ y>y’ b: x>x’
p
Remark: every run of the original program for a given n induces an n-run of the SCA of same length. Hence if the SCA terminates in time t for a given n, the original program also does (on all its executions).
void main(uint n) { uint x,y; x = read_input(n); y = read_input(n); while (x > 0) { if (y > 0) { y--; } else { y = read_input(n); x--; } } }
An n-run of the SCA is a run in which all the variables take their values in [1,n]
[C., Daviaud, Zuleger 14] If the SCA terminates, there exists a computable rational α such that the worst-case length of an n-run of the SCA has size Θ(nα).
a: x≥x’ ⋀ y>y’ b: x>x’
p
[C., Daviaud, Zuleger 14] If the SCA terminates, there exists a computable rational α such that the worst-case length of an n-run of the SCA has size Θ(nα).
a: x≥x’ ⋀ y>y’ b: x>x’
p
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 + {⊤,⊥}. All states of the automaton are initial and final.
Δ(x,a,y) ={ -∞ otherwise (no guard)
0 if there is a guard x ≥ y’ in a 1 if there is a guard x > y’ in a (Δ(⊥,?,?)=0, Δ(?,?,⊤)=0)
[C., Daviaud, Zuleger 14] If the SCA terminates, there exists a computable rational α such that the worst-case length of an n-run of the SCA has size Θ(nα).
a: x≥x’ ⋀ y>y’ b: x>x’
p
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 + {⊤,⊥}. All states of the automaton are initial and final.
Δ(x,a,y) ={ -∞ otherwise (no guard)
0 if there is a guard x ≥ y’ in a 1 if there is a guard x > y’ in a (Δ(⊥,?,?)=0, Δ(?,?,⊤)=0) ⊤ x y ⊥ * * * * * * a:0, b:1 a:1
(∃ n-run of SCA of size s) Claim: if and only if ∃ input word u of size s such that 1) it is a value-free valid run (regular) 2) there is no run of Aut with weight >n.
[C., Daviaud, Zuleger 14] If the SCA terminates, there exists a computable rational α such that the worst-case length of an n-run of the SCA has size Θ(nα).
a: x≥x’ ⋀ y>y’ b: x>x’
p
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 + {⊤,⊥}. All states of the automaton are initial and final.
Δ(x,a,y) ={ -∞ otherwise (no guard)
0 if there is a guard x ≥ y’ in a 1 if there is a guard x > y’ in a (Δ(⊥,?,?)=0, Δ(?,?,⊤)=0) ⊤ x y ⊥ * * * * * * a:0, b:1 a:1
(∃ n-run of SCA of size s) Claim: if and only if ∃ input word u of size s such that 1) it is a value-free valid run (regular) 2) there is no run of Aut with weight >n.
[C., Daviaud, Zuleger 14] If the SCA terminates, there exists a computable rational α such that the worst-case length of an n-run of the SCA has size Θ(nα).
a: x≥x’ ⋀ y>y’ b: x>x’
p
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 + {⊤,⊥}. All states of the automaton are initial and final.
Δ(x,a,y) ={ -∞ otherwise (no guard)
0 if there is a guard x ≥ y’ in a 1 if there is a guard x > y’ in a (Δ(⊥,?,?)=0, Δ(?,?,⊤)=0) ⊤ x y ⊥ * * * * * * a:0, b:1 a:1
(∃ n-run of SCA of size s) Claim: if and only if ∃ input word u of size s such that 1) it is a value-free valid run (regular) 2) there is no run of Aut with weight >n.
[C., Daviaud, Zuleger 14] If the SCA terminates, there exists a computable rational α such that the worst-case length of an n-run of the SCA has size Θ(nα).
a: x≥x’ ⋀ y>y’ b: x>x’
p
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 + {⊤,⊥}. All states of the automaton are initial and final.
Δ(x,a,y) ={ -∞ otherwise (no guard)
0 if there is a guard x ≥ y’ in a 1 if there is a guard x > y’ in a (Δ(⊥,?,?)=0, Δ(?,?,⊤)=0) ⊤ x y ⊥ * * * * * * a:0, b:1 a:1
One needs to find the asymptotic exponent of the size of the longest word that is has only run of value at most n:
lim sup
u∈A∗
log |u| log Aut(|u|) = α
(∃ n-run of SCA of size s) Claim: if and only if ∃ input word u of size s such that 1) it is a value-free valid run (regular) 2) there is no run of Aut with weight >n.
[C., Daviaud, Zuleger 14] If the SCA terminates, there exists a computable rational α such that the worst-case length of an n-run of the SCA has size Θ(nα).
a: x≥x’ ⋀ y>y’ b: x>x’
p
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 + {⊤,⊥}. All states of the automaton are initial and final.
Δ(x,a,y) ={ -∞ otherwise (no guard)
0 if there is a guard x ≥ y’ in a 1 if there is a guard x > y’ in a (Δ(⊥,?,?)=0, Δ(?,?,⊤)=0) ⊤ x y ⊥ * * * * * * a:0, b:1 a:1
One needs to find the asymptotic exponent of the size of the longest word that is has only run of value at most n:
lim sup
u∈A∗
log |u| log Aut(|u|) = α
⇒ Decidable.
a: x≥x’ ⋀ y>y’ b: x>x’
p
For instance, has worst-case complexity n2.
a: x≥x’ ⋀ y>y’ b: x>x’
p
For instance, has worst-case complexity n2. It was conjectured that the asymptotic worst-case could only have integer exponent.
p
x>x’ ⋀ y≥y’ ⋀ z>z’ ⋀ t≥t’
a:
x>x’ ⋀ y≥y’ ⋀ y≥z’ ⋀ y>t’ ⋀ z>t’ ⋀ t>t’
b:
y>y’ ⋀ y≥z’ ⋀ y≥t’ ⋀ z>y’ ⋀ z≥z’ ⋀ z≥t’ ⋀ t>y’ ⋀ t≥z’ ⋀ t≥t’
c:
a: x≥x’ ⋀ y>y’ b: x>x’
p
For instance, has worst-case complexity n2. It was conjectured that the asymptotic worst-case could only have integer exponent.
p
x>x’ ⋀ y≥y’ ⋀ z>z’ ⋀ t≥t’
a:
x>x’ ⋀ y≥y’ ⋀ y≥z’ ⋀ y>t’ ⋀ z>t’ ⋀ t>t’
b:
y>y’ ⋀ y≥z’ ⋀ y≥t’ ⋀ z>y’ ⋀ z≥z’ ⋀ z≥t’ ⋀ t>y’ ⋀ t≥z’ ⋀ t≥t’
c:
However: The longest n-run of the following SCA has asymptotical length Θ(n3/2).
a: x≥x’ ⋀ y>y’ b: x>x’
p
For instance, has worst-case complexity n2. It was conjectured that the asymptotic worst-case could only have integer exponent.
The size-change abstraction is good model for proving the termination of some forms of programs. This offers a natural reduction to question of automata theory. We have shown that this technique can be greatly refined for computing asymptotic worst-case complexity of some programs. This relies on advanced results on the asymptotic analysis of tropical automata.
a: x≥x’ ⋀ y>y’ b: x>x’
p
⊤ x y ⊥ * * * * * * a:0, b:1 a:1
void main(uint n) { uint x,y; x = read_input(n); y = read_input(n); while (x > 0) { if (y > 0) { y--; } else { y = read_input(n); x--; } } }
The size-change abstraction is good model for proving the termination of some forms of programs. This offers a natural reduction to question of automata theory. We have shown that this technique can be greatly refined for computing asymptotic worst-case complexity of some programs. This relies on advanced results on the asymptotic analysis of tropical automata.
a: x≥x’ ⋀ y>y’ b: x>x’
p
⊤ x y ⊥ * * * * * * a:0, b:1 a:1
void main(uint n) { uint x,y; x = read_input(n); y = read_input(n); while (x > 0) { if (y > 0) { y--; } else { y = read_input(n); x--; } } }
What is the exact complexity? How to construct ranking functions? Is there a more general model of automata and results?