The Abstract Domain of Segmented Ranking Functions
Caterina Urban
D´ epartement d’Informatique ´ Ecole Normale Sup´ erieure
SAS 2013 Seattle, USA
The Abstract Domain of Segmented Ranking Functions Caterina Urban - - PowerPoint PPT Presentation
The Abstract Domain of Segmented Ranking Functions Caterina Urban D epartement dInformatique Ecole Normale Sup erieure SAS 2013 Seattle, USA Introduction Concrete Semantics Our Contribution An Abstract Domain for Termination
Caterina Urban
D´ epartement d’Informatique ´ Ecole Normale Sup´ erieure
SAS 2013 Seattle, USA
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
liveness properties ⇒ “something good eventually happens”
termination
ranking functions1
functions that strictly decrease at each program step. . . . . . and that are bounded from below
idea: computation of ranking functions by abstract interpretation2 family of parameterized abstract domains for program termination
piecewise-defined ranking functions backward invariance analysis sufficient conditions for termination
instance based on intervals and affine functions
1Floyd - Assigning Meanings to Programs (1967) 2Cousot&Cousot - An Abstract Interpretation Framework for Termination (POPL 2012)
2 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
liveness properties ⇒ “something good eventually happens”
termination
ranking functions1
functions that strictly decrease at each program step. . . . . . and that are bounded from below
idea: computation of ranking functions by abstract interpretation2 family of parameterized abstract domains for program termination
piecewise-defined ranking functions backward invariance analysis sufficient conditions for termination
instance based on intervals and affine functions
1Floyd - Assigning Meanings to Programs (1967) 2Cousot&Cousot - An Abstract Interpretation Framework for Termination (POPL 2012)
2 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
liveness properties ⇒ “something good eventually happens”
termination
ranking functions1
functions that strictly decrease at each program step. . . . . . and that are bounded from below
idea: computation of ranking functions by abstract interpretation2 family of parameterized abstract domains for program termination
piecewise-defined ranking functions backward invariance analysis sufficient conditions for termination
instance based on intervals and affine functions
1Floyd - Assigning Meanings to Programs (1967) 2Cousot&Cousot - An Abstract Interpretation Framework for Termination (POPL 2012)
2 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
liveness properties ⇒ “something good eventually happens”
termination
ranking functions1
functions that strictly decrease at each program step. . . . . . and that are bounded from below
idea: computation of ranking functions by abstract interpretation2 family of parameterized abstract domains for program termination
piecewise-defined ranking functions backward invariance analysis sufficient conditions for termination
instance based on intervals and affine functions
1Floyd - Assigning Meanings to Programs (1967) 2Cousot&Cousot - An Abstract Interpretation Framework for Termination (POPL 2012)
2 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
liveness properties ⇒ “something good eventually happens”
termination
ranking functions1
functions that strictly decrease at each program step. . . . . . and that are bounded from below
idea: computation of ranking functions by abstract interpretation2 family of parameterized abstract domains for program termination
piecewise-defined ranking functions backward invariance analysis sufficient conditions for termination
instance based on intervals and affine functions
1Floyd - Assigning Meanings to Programs (1967) 2Cousot&Cousot - An Abstract Interpretation Framework for Termination (POPL 2012)
2 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
Example int : x while 1(x ≥ 0) do
2x := −2x + 10
1 2 3
x < 0 x := −2x + 10 x ≥ 0
3 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
Example int : x while 1(x ≥ 0) do
2x := −2x + 10
the program terminates but there exists no linear ranking function! 1 2 3
x < 0 x := −2x + 10 x ≥ 0
3 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
Example int : x while 1(x ≥ 0) do
2x := −2x + 10
we map each point to a function of x giving an upper bound on the steps before termination 1 2 3
x < 0 x := −2x + 10 x ≥ 0
3 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
Example int : x while 1(x ≥ 0) do
2x := −2x + 10
we map each point to a function of x giving an upper bound on the steps before termination 1 2 3
x < 0 x := −2x + 10 x ≥ 0
⊥ ⊥ ⊥
3 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
Example int : x while 1(x ≥ 0) do
2x := −2x + 10
we map each point to a function of x giving an upper bound on the steps before termination we start at the end with 0 steps before termination 1 2 3
x < 0 x := −2x + 10 x ≥ 0
x ⊥ ⊥
3 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
Example int : x while 1(x ≥ 0) do
2x := −2x + 10
we map each point to a function of x giving an upper bound on the steps before termination we take into account x < 0 and we have now 1 step to termination 1 2 3
x < 0 x := −2x + 10 x ≥ 0
x ⊥ x
3 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
Example int : x while 1(x ≥ 0) do
2x := −2x + 10
we map each point to a function of x giving an upper bound on the steps before termination we consider the assignment and we are now at 2 steps to termination 1 2 3
x < 0 x := −2x + 10 x ≥ 0
x x 6 x
3 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
Example int : x while 1(x ≥ 0) do
2x := −2x + 10
we map each point to a function of x giving an upper bound on the steps before termination we consider x ≥ 0 and we do the join 1 2 3
x < 0 x := −2x + 10 x ≥ 0
x x 6 x
⊔
x 6
=
x 6
3 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
Example int : x while 1(x ≥ 0) do
2x := −2x + 10
we map each point to a function of x giving an upper bound on the steps before termination 1 2 3
x < 0 x := −2x + 10 x ≥ 0
x x 2 6 x
⊔
x 2 6
=
x 0 2 6
3 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
Example int : x while 1(x ≥ 0) do
2x := −2x + 10
we map each point to a function of x giving an upper bound on the steps before termination 1 2 3
x < 0 x := −2x + 10 x ≥ 0
x x 2 4 6 x
⊔
x 2 4 6
=
x 0 2 4 6
3 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
Example int : x while 1(x ≥ 0) do
2x := −2x + 10
we map each point to a function of x giving an upper bound on the steps before termination 1 2 3
x < 0 x := −2x + 10 x ≥ 0
x x 2 4 6 x
⊔
x 2 4 6
=
x 0 2 4 6
3 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Our Contribution
Example int : x while 1(x ≥ 0) do
2x := −2x + 10
we map each point to a function of x giving an upper bound on the steps before termination we are able to find a piecewise-defined ranking function for the program! 1 2 3
x < 0 x := −2x + 10 x ≥ 0
x x 2 4 6 x 0 2 4 6
3 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
program P → trace semantics finite traces Σ+ infinite traces Σ∞ βτ final states Σ states τ transition relation
5 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
vτ ∈ Σ → O vτ lfp φτ φτ(v) λs.
sup{v(s′) + 1 | s, s′ ∈ τ} if s ∈ pre(dom(v)) Example Theorem (Soundness and Completeness) vτ is sound and complete to prove the termination of programs
Cousot&Cousot - An Abstract Interpretation Framework for Termination (POPL 2012)
6 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
vτ ∈ Σ → O vτ lfp φτ φτ(v) λs.
sup{v(s′) + 1 | s, s′ ∈ τ} if s ∈ pre(dom(v)) Example Theorem (Soundness and Completeness) vτ is sound and complete to prove the termination of programs
Cousot&Cousot - An Abstract Interpretation Framework for Termination (POPL 2012)
6 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
vτ ∈ Σ → O vτ lfp φτ φτ(v) λs.
sup{v(s′) + 1 | s, s′ ∈ τ} if s ∈ pre(dom(v)) Example 1 Theorem (Soundness and Completeness) vτ is sound and complete to prove the termination of programs
Cousot&Cousot - An Abstract Interpretation Framework for Termination (POPL 2012)
6 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
vτ ∈ Σ → O vτ lfp φτ φτ(v) λs.
sup{v(s′) + 1 | s, s′ ∈ τ} if s ∈ pre(dom(v)) Example 1 2 1 Theorem (Soundness and Completeness) vτ is sound and complete to prove the termination of programs
Cousot&Cousot - An Abstract Interpretation Framework for Termination (POPL 2012)
6 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
vτ ∈ Σ → O vτ lfp φτ φτ(v) λs.
sup{v(s′) + 1 | s, s′ ∈ τ} if s ∈ pre(dom(v)) Example 1 2 1 2 1 Theorem (Soundness and Completeness) vτ is sound and complete to prove the termination of programs
Cousot&Cousot - An Abstract Interpretation Framework for Termination (POPL 2012)
6 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
vτ ∈ Σ → O vτ lfp φτ φτ(v) λs.
sup{v(s′) + 1 | s, s′ ∈ τ} if s ∈ pre(dom(v)) Example 1 2 1 2 1 Theorem (Soundness and Completeness) vτ is sound and complete to prove the termination of programs
Cousot&Cousot - An Abstract Interpretation Framework for Termination (POPL 2012)
6 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x < 10 x := x + 1 x ≥ 10
7 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x < 10 x := x + 1 x ≥ 10
x ⊥ x 10
7 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x < 10 x := x + 1 x ≥ 10
x x 9 x 10
⊔
x 9
=
x 10
7 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x < 10 x := x + 1 x ≥ 10
x x 9 x 10
⊔
x 9
=
x 8 10
7 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x < 10 x := x + 1 x ≥ 10
x x 7 9 x 10
⊔
x 7 9
=
x 8 10
7 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x < 10 x := x + 1 x ≥ 10
x x 7 9 x 10
⊔
x 7 9
=
x 6 8 10
7 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work Trace Semantics Termination Semantics
Example int : x while 1(x < 10) do
2x := x + 1
vτ is not computable! 1 2 3
x < 10 x := x + 1 x ≥ 10
x x 1 3 5 7 9 x 0 2 4 6 8 10
7 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
vτ v #
τ
α γ States Abstract Domain E Functions Abstract Domain P Segmented Ranking Functions Abstract Domain V(E, P)
9 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Σ → O, ⊑ V#, ⊑# αV γV States Abstract Domain E Functions Abstract Domain P Segmented Ranking Functions Abstract Domain V(E, P)
x 5 9
9 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Σ → O, ⊑ V#, ⊑# αV γV States Abstract Domain E Functions Abstract Domain P Segmented Ranking Functions Abstract Domain V(E, P)
x 5 9
9 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Σ → O, ⊑ V#, ⊑# αV γV States Abstract Domain E Functions Abstract Domain P Segmented Ranking Functions Abstract Domain V(E, P)
x 5 9
9 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Σ → O, ⊑ V#, ⊑# αV γV States Abstract Domain E
Intervals Abstract Domain
Functions Abstract Domain P
Affine Functions Abstract Domain
Segmented Ranking Functions Abstract Domain V(E, P)
Segmented Affine Ranking Functions Abstract Domain
x 5 9
9 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
℘(Σ), ⊆ E#, ⊑E αE γE E# {⊥E}∪{[a, b] | a ∈ I∪{−∞}, b ∈ I∪{+∞}} I ∈ {Z, . . . } join: ⊔E meet: ⊓E widening: ▽E backward assignments: ASSIGNE tests: FILTERE
3Cousot&Cousot - Static Determination of Dynamic Properties of Programs (1976)
10 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Σ → O, ⊑ P# ≡ E# × F#, ⊑P αP γP F# {⊥F} ∪ {f # | f # ∈ In → N} ∪ {⊤F} where f # ≡ y = f (x1, . . . , xn) = m1x1 + · · · + mnxn + q approximation order: ρ#
1 , f # 1 ⊑P ρ# 2 , f # 2 ρ# 1 ⊒E ρ# 2 ∧ f # 1 ⊑F f # 2
computational order: ρ#
1 , f # 1 P ρ# 2 , f # 2 ρ# 1 ⊑E ρ# 2 ∧ f # 1 ⊑F f # 2
11 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Σ → O, ⊑ P# ≡ E# × F#, ⊑P αP γP F# {⊥F} ∪ {f # | f # ∈ In → N} ∪ {⊤F} where f # ≡ y = f (x1, . . . , xn) = m1x1 + · · · + mnxn + q approximation order: ρ#
1 , f # 1 ⊑P ρ# 2 , f # 2 ρ# 1 ⊒E ρ# 2 ∧ f # 1 ⊑F f # 2
computational order: ρ#
1 , f # 1 P ρ# 2 , f # 2 ρ# 1 ⊑E ρ# 2 ∧ f # 1 ⊑F f # 2
11 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
join: ⊔P Example x1 x2 4 4
f1(x1, x2) = − 1
2x2 + 2
⊔P x1 x2 4 4
f2(x1, x2) = − 1
2x1 + 2
= x1 x2 4 4
f (x1, x2) = − 1
2x1 − 1 2x2 + 4
backward assignments: ASSIGNP Example x 3 9
f (x) = x − 2
x := x + 1 = ⇒ x 2 8
f (x) = x + 1 − 2 + 1 = x
12 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
join: ⊔P Example x1 x2 4 4
f1(x1, x2) = − 1
2x2 + 2
⊔P x1 x2 4 4
f2(x1, x2) = − 1
2x1 + 2
= x1 x2 4 4
f (x1, x2) = − 1
2x1 − 1 2x2 + 4
backward assignments: ASSIGNP Example x 3 9
f (x) = x − 2
x := x + 1 = ⇒ x 2 8
f (x) = x + 1 − 2 + 1 = x
12 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Σ → O, ⊑ V#, ⊑V αV γV V# {(E# × F#)k | k ≥ 0} segmentation unification Example x y 4 3 + x y 2 1 = x y 2 4 1 3
13 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Σ → O, ⊑ V#, ⊑V αV γV V# {(E# × F#)k | k ≥ 0} segmentation unification Example x y 4 3 + x y 2 1 = x y 2 4 1 3
13 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
approximation order: ⊑V computational order: V join: ⊔V widening: ▽V Example x
6 11
▽ ▽ ▽V x = x
14 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
approximation order: ⊑V computational order: V join: ⊔V widening: ▽V Example x
6 11
▽ ▽ ▽V x
3 6 11
= x
14 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
approximation order: ⊑V computational order: V join: ⊔V widening: ▽V Example x
6 11
▽ ▽ ▽V x
6 11
= x
14 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
approximation order: ⊑V computational order: V join: ⊔V widening: ▽V Example x
6 11
▽ ▽ ▽V x
6 11
= x
6 11
14 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
approximation order: ⊑V computational order: V join: ⊔V widening: ▽V Example x
6 11
▽ ▽ ▽V x
6 11
= x
6 11
14 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
backward assignments: ASSIGNV Example x 6
x → (−∞, 5], ⊥F x → [6, +∞), y = 4
x := x + [0, 4] = ⇒ x 2 5
x → (−∞, 5], ⊥F x → [2, +∞), y = 4 + 1
tests: FILTERV
15 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
backward assignments: ASSIGNV Example x 6
x → (−∞, 5], ⊥F x → [6, +∞), y = 4
x := x + [0, 4] = ⇒ x 6
x → (−∞, 1], ⊥F x → [2, 5], ⊥F x → [6, +∞), y = 5
tests: FILTERV
15 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
backward assignments: ASSIGNV Example x 6
x → (−∞, 5], ⊥F x → [6, +∞), y = 4
x := x + [0, 4] = ⇒ x 6
x → (−∞, 1], ⊥F x → [2, 5], ⊥F x → [6, +∞), y = 5
tests: FILTERV
15 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
vτ ∈ Σ → O v #
τ ∈ V#
αV γV
S#statement ∈ V#
POST → V# PRE
S#x := Av ASSIGNV(x := A, v) S#if B then S1 else S2 fiv FILTERV(B, S#S1v) V FILTERV(¬B, S#S2v) S#while B do S odv lfp#V
⊥V φ#
where φ# λx. FILTERV(¬B, v) V FILTERV(B, S#Sx) S#S1 ; S2v S#S1(S#S2v)
Theorem (Soundness) v#
τ is sound to prove the termination of programs
16 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x ≥ 10 x < 10 x := x + 1
17 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x ≥ 10 x < 10 x := x + 1
x ⊥ x 10
17 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x ≥ 10 x < 10 x := x + 1
x x 9 x 10
V
x 9
=
x 10
17 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x ≥ 10 x < 10 x := x + 1
x x 9 x 10
V
x 9
=
x 8 10
17 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x ≥ 10 x < 10 x := x + 1
x x 9 x 10
▽ ▽ ▽V
x 8 10
=
x 8 10
17 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x ≥ 10 x < 10 x := x + 1
x x 7 9 x 8 10
▽V
x 8 10
=
x 8 10
17 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x ≥ 10 x < 10 x := x + 1
x x 7 9 x 8 10
17 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x while 1(x < 10) do
2x := x + 1
1 2 3
x ≥ 10 x < 10 x := x + 1
x x 7 9 x 8 10
Alias&Darte&Feautrier&Gonnord - Multi-Dimensional Rankings, Program Termination, and Complexity Bounds
Berdine&al. - Variance Analyses from Invariance Analyses (POPL 2007)
17 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x1, x2 while 1(x1 ≥ 0 ∧ x2 ≥ 0) do if 2(?) then
3x1 := x1 − 1
else
4x2 := x2 − 1
fi
18 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x1, x2 while 1(x1 ≥ 0 ∧ x2 ≥ 0) do if 2(?) then
3x1 := x1 − 1
else
4x2 := x2 − 1
fi
Cook&Podelski&Rybalchenko - Terminator: Beyond Safety (CAV 2006)
18 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x while 1(x < 10) do
2x := 2 ∗ x
f (x) =
5 ≤ x ≤ 9 1 10 ≤ x f (x) = 9 x = 1 7 x = 2 5 3 ≤ x ≤ 4 3 5 ≤ x ≤ 9 1 10 ≤ x
19 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x while 1(x < 10) do
2x := 2 ∗ x
f (x) =
5 ≤ x ≤ 9 1 10 ≤ x f (x) = 9 x = 1 7 x = 2 5 3 ≤ x ≤ 4 3 5 ≤ x ≤ 9 1 10 ≤ x
19 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
Example int : x while 1(x < 10) do
2x := 2 ∗ x
f (x) =
5 ≤ x ≤ 9 1 10 ≤ x f (x) = 9 x = 1 7 x = 2 5 3 ≤ x ≤ 4 3 5 ≤ x ≤ 9 1 10 ≤ x
19 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
http://www.di.ens.fr/~urban/FuncTion.html written in OCaml implemented on top of Apron4 forward reachability analysis to improve precision Example int : x1, x2
1x2 := 1
while 2(x1 < 10) do
3x1 := x1 + x2
4http://apron.cri.ensmp.fr/library/
20 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work States Abstract Domain Functions Abstract Domain Segmented Ranking Functions Abstract Domain Abstract Termination Semantics Implementation
http://www.di.ens.fr/~urban/FuncTion.html written in OCaml implemented on top of Apron4 forward reachability analysis to improve precision Example int : x1, x2
1x2 := 1
while 2(x1 < 10) do
3x1 := x1 + x2
4http://apron.cri.ensmp.fr/library/
20 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work
Conclusions family of parameterized abstract domains for program termination
piecewise-defined ranking functions backward invariance analysis
instance based on intervals and affine functions
segmentation overcomes non-existence of linear ranking functions analysis not limited to simple loops sufficient conditions for termination
Future Work more abstract domains (e.g. non-linear functions)
cost analysis non-termination
21 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work
Conclusions family of parameterized abstract domains for program termination
piecewise-defined ranking functions backward invariance analysis
instance based on intervals and affine functions
segmentation overcomes non-existence of linear ranking functions analysis not limited to simple loops sufficient conditions for termination
Future Work more abstract domains (e.g. non-linear functions)
cost analysis non-termination
21 / 22
Introduction Concrete Semantics An Abstract Domain for Termination Conclusion and Future Work
Conclusions family of parameterized abstract domains for program termination
piecewise-defined ranking functions backward invariance analysis
instance based on intervals and affine functions
segmentation overcomes non-existence of linear ranking functions analysis not limited to simple loops sufficient conditions for termination
Future Work more abstract domains (e.g. non-linear functions)
cost analysis non-termination
21 / 22
“. . . the purpose of abstraction is not to be vague, but to create a new semantic level in which one can be absolutely precise.” (Edsger Dijkstra)