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

automata and program analysis
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Automata and program analysis

Thomas Colcombet FCT
 Bordeaux 13 September 2017

based on joint work with Laure Daviaud et Florian Zuleger

slide-2
SLIDE 2

Weighted automata and tropical automata

slide-3
SLIDE 3

Weighted automata

[Schützenberger 61]

slide-4
SLIDE 4

Weighted automata

Consider a non-deterministic automaton (A,Q,I,F,Δ). [Schützenberger 61]

slide-5
SLIDE 5

Weighted automata

Consider a non-deterministic automaton (A,Q,I,F,Δ). It computes a language L: A* ➝ {0,1} [Schützenberger 61]

slide-6
SLIDE 6

Weighted automata

Consider a non-deterministic automaton (A,Q,I,F,Δ). It computes a language L: A* ➝ {0,1} [Schützenberger 61] accepted not accepted

slide-7
SLIDE 7

Weighted automata

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

slide-8
SLIDE 8

Weighted automata

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

slide-9
SLIDE 9

Weighted automata

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

slide-10
SLIDE 10

Weighted automata

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

  • peration over an arbitrary semiring (S,⊕,⊗,0,1).

accepted not accepted

slide-11
SLIDE 11

Weighted automata

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

  • peration over an arbitrary semiring (S,⊕,⊗,0,1).

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

slide-12
SLIDE 12

Example of weighted automata

slide-13
SLIDE 13

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

0⨂a = a⨂0 = 0

slide-14
SLIDE 14

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

0⨂a = a⨂0 = 0

addition multiplication

slide-15
SLIDE 15

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

0⨂a = a⨂0 = 0

}

Gives rise to product of S valued matrices that form a monoid. addition multiplication

slide-16
SLIDE 16

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

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

slide-17
SLIDE 17

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

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

slide-18
SLIDE 18

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

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

slide-19
SLIDE 19

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

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

slide-20
SLIDE 20

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

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

slide-21
SLIDE 21

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

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

slide-22
SLIDE 22

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

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

slide-23
SLIDE 23

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

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

slide-24
SLIDE 24

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

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

slide-25
SLIDE 25

Example of weighted automata

A semiring (S,⨁,⨂,0,1) is such that:

  • (R, ⨁) is a commutative monoid with identity element 0:

(a ⨁ b) ⨁ c = a ⨁ (b ⨁ c) ; 0 ⨁ a = a ⨁ 0 = a ; a ⨁ b = b ⨁ a

  • (R, ⨁) is a monoid with identity element 1:

(a⨂b)⋅c = a⨂(b⨂c) ; 1⨂a = a⨂1 = a

  • Multiplication left and right distributes over addition:

a⨂(b ⨁ c) = (a⨂b) ⨁ (a⨂c) ; (a ⨁ b)⨂c = (a⨂c) ⨁ (b⨂c)

  • Multiplication by 0 annihilates S:

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

slide-26
SLIDE 26

Tropical automata

slide-27
SLIDE 27

Tropical automata

L(a₁a₂…an) = ⨁ I(q₀) ⨂ ( ⨂ Δ(qi-1,ai,qi) ) ⨂ F(qn)

p₀,…,pn

i=1 n

slide-28
SLIDE 28

Tropical automata

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

slide-29
SLIDE 29

Tropical automata

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

slide-30
SLIDE 30

Tropical automata

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

slide-31
SLIDE 31

Tropical automata

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

slide-32
SLIDE 32

Tropical automata

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

slide-33
SLIDE 33

Tropical automata

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

slide-34
SLIDE 34

Tropical automata

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

slide-35
SLIDE 35

Tropical automata

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

slide-36
SLIDE 36

Tropical automata

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

slide-37
SLIDE 37

Alternation of quantifiers

slide-38
SLIDE 38

Alternation of quantifiers

Emptiness of NDA ? (∃ word w) (∃ run ρ over w) ρ is accepting

slide-39
SLIDE 39

Alternation of quantifiers

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

slide-40
SLIDE 40

Alternation of quantifiers

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

slide-41
SLIDE 41

Alternation of quantifiers

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)

slide-42
SLIDE 42

Alternation of quantifiers

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)

slide-43
SLIDE 43

Alternation of quantifiers

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)

slide-44
SLIDE 44

Alternation of quantifiers

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)

slide-45
SLIDE 45

Alternation of quantifiers

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)

slide-46
SLIDE 46

Alternation of quantifiers

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)

slide-47
SLIDE 47

Alternation of quantifiers

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)

slide-48
SLIDE 48

Alternation of quantifiers

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)

slide-49
SLIDE 49

Alternation of quantifiers

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]

slide-50
SLIDE 50

Alternation of quantifiers

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]

slide-51
SLIDE 51

Alternation of quantifiers

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.

slide-52
SLIDE 52

More on asymptotic analysis

slide-53
SLIDE 53

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θ

slide-54
SLIDE 54

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.

slide-55
SLIDE 55

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 length of the word s=|u| n

slide-56
SLIDE 56

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. What is the asymptotic? result length of the word s=|u| n

slide-57
SLIDE 57

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. 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

  • f length at least s

Compute:

slide-58
SLIDE 58

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. What is the asymptotic?

lim sup

u∈A∗

log |u| log f(|u|) = 1 θ

find the longest size of a word

  • f value at most n

result length of the word s=|u| n

lim inf

u∈A∗

log f(u) log |u| = θ

find the least value of a word

  • f length at least s

Compute:

slide-59
SLIDE 59

Ingredients of the proof

slide-60
SLIDE 60

Ingredients of the proof

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

slide-61
SLIDE 61

Ingredients of the proof

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.

slide-62
SLIDE 62

Ingredients of the proof

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.

slide-63
SLIDE 63

Ingredients of the proof

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.

slide-64
SLIDE 64

Ingredients of the proof

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.

slide-65
SLIDE 65

Ingredients of the proof

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*)

slide-66
SLIDE 66

Ingredients of the proof

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].

slide-67
SLIDE 67

Program analysis and the size-change abstraction

slide-68
SLIDE 68

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?
slide-69
SLIDE 69

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.

slide-70
SLIDE 70

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]).

slide-71
SLIDE 71

Example

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

slide-72
SLIDE 72

Example

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.

slide-73
SLIDE 73

Example

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

slide-74
SLIDE 74

Example

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

slide-75
SLIDE 75

Example

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

  • r x decreases,

and y gets an uncontrolled value

slide-76
SLIDE 76

Example

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

  • r x decreases,

and y gets an uncontrolled value Remark: This program terminates.

slide-77
SLIDE 77

Example

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

  • r x decreases,

and y gets an uncontrolled value Remark: This program terminates. Question: what method can automatically establish it ?

slide-78
SLIDE 78

Principle of abstraction

slide-79
SLIDE 79

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.

slide-80
SLIDE 80

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.

slide-81
SLIDE 81

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.

slide-82
SLIDE 82

Size-change abstraction

slide-83
SLIDE 83

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 »

slide-84
SLIDE 84

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’ ⋀ y>y’ b: x>x’

p

slide-85
SLIDE 85

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’ ⋀ y>y’ b: x>x’

p

A configuration is a state together with a non- negative integer value for each of the variables.

slide-86
SLIDE 86

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’ ⋀ 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.

slide-87
SLIDE 87

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’ ⋀ 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)

slide-88
SLIDE 88

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’ ⋀ 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

slide-89
SLIDE 89

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’ ⋀ 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.

slide-90
SLIDE 90

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’ ⋀ 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.

slide-91
SLIDE 91

Abstracting

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

  • 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
slide-92
SLIDE 92

Abstracting

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

  • 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
slide-93
SLIDE 93

Abstracting

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

  • 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

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).

slide-94
SLIDE 94

Deciding the termination

  • f size-change abstraction
slide-95
SLIDE 95

Deciding the termination

  • f size-change abstraction

[Ben-Amram et al. 01]: The termination of SCA is decidable.

slide-96
SLIDE 96

Deciding the termination

  • f size-change abstraction

[Ben-Amram et al. 01]: The termination of SCA is decidable.

a: x≥x’ ⋀ y>y’ b: x>x’

p

slide-97
SLIDE 97

Deciding the termination

  • f size-change abstraction

[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

slide-98
SLIDE 98

Deciding the termination

  • f size-change abstraction

[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

slide-99
SLIDE 99

Deciding the termination

  • f 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.

a: x≥x’ ⋀ y>y’ b: x>x’

p

⊤ x y ⊥ * * * * * * a:0, b:1 a:1

slide-100
SLIDE 100

Deciding the termination

  • f 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 + {⊤,⊥}.

a: x≥x’ ⋀ y>y’ b: x>x’

p

⊤ x y ⊥ * * * * * * a:0, b:1 a:1

slide-101
SLIDE 101

Deciding the termination

  • f 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 + {⊤,⊥}. All states of the automaton are initial.

a: x≥x’ ⋀ y>y’ b: x>x’

p

⊤ x y ⊥ * * * * * * a:0, b:1 a:1

slide-102
SLIDE 102

Deciding the termination

  • f 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 + {⊤,⊥}. 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

slide-103
SLIDE 103

Deciding the termination

  • f 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 + {⊤,⊥}. 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

slide-104
SLIDE 104

Deciding the termination

  • f 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 + {⊤,⊥}. 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

slide-105
SLIDE 105

Deciding the termination

  • f 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 + {⊤,⊥}. 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

slide-106
SLIDE 106

Deciding the termination

  • f 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 + {⊤,⊥}. 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

slide-107
SLIDE 107

Overall picture

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

slide-108
SLIDE 108

Finer program analysis

slide-109
SLIDE 109

Termiation

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

slide-110
SLIDE 110

Asymptotic complexity

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α).

slide-111
SLIDE 111

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 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--; } }
 }

slide-112
SLIDE 112

Abstracting

a: x≥x’ ⋀ y>y’ b: x>x’

p

  • 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 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--; } }
 }

slide-113
SLIDE 113

Abstracting

a: x≥x’ ⋀ y>y’ b: x>x’

p

  • 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 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]

slide-114
SLIDE 114

Abstracting

a: x≥x’ ⋀ y>y’ b: x>x’

p

  • 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

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]

slide-115
SLIDE 115

Complexity analysis

[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

slide-116
SLIDE 116

Complexity analysis

[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)

slide-117
SLIDE 117

Complexity analysis

[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

slide-118
SLIDE 118

(∃ 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.

( ) Complexity analysis

[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

slide-119
SLIDE 119

(∃ 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.

( ) Complexity analysis

[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

slide-120
SLIDE 120

(∃ 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.

( ) Complexity analysis

[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|) = α

slide-121
SLIDE 121

(∃ 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.

( ) Complexity analysis

[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.

slide-122
SLIDE 122

An unexpected phenomenon

slide-123
SLIDE 123

An unexpected phenomenon

a: x≥x’ ⋀ y>y’ b: x>x’

p

For instance, has worst-case complexity n2.

slide-124
SLIDE 124

An unexpected phenomenon

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.

slide-125
SLIDE 125

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:

An unexpected phenomenon

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.

slide-126
SLIDE 126

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:

An unexpected phenomenon

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.

slide-127
SLIDE 127

Summary

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--; } }
 }

slide-128
SLIDE 128

Summary

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?

Some open questions

slide-129
SLIDE 129

Thanks !