Polynomial Invariants for Affine Programs Ehud Hrushovski, Jol - - PowerPoint PPT Presentation

polynomial invariants for affine programs
SMART_READER_LITE
LIVE PREVIEW

Polynomial Invariants for Affine Programs Ehud Hrushovski, Jol - - PowerPoint PPT Presentation

Polynomial Invariants for Affine Programs Ehud Hrushovski, Jol Ouaknine, Amaury Pouly, James Worrell Max Planck Institute for Software Systems & Department of Computer Science, Oxford University & Mathematical Institute, Oxford


slide-1
SLIDE 1

Polynomial Invariants for Affine Programs

Ehud Hrushovski, Joël Ouaknine, Amaury Pouly, James Worrell

Max Planck Institute for Software Systems & Department of Computer Science, Oxford University & Mathematical Institute, Oxford University

1 / 17

slide-2
SLIDE 2

Does this program halt?

Affine program

x := 2−10 y := 1 while y x do x y

  • :=

2

7 4 1 4

x y

  • 2 / 17
slide-3
SLIDE 3

Does this program halt?

Affine program

x := 2−10 y := 1 while y x do x y

  • :=

2

7 4 1 4

x y

  • y

x

2 / 17

slide-4
SLIDE 4

Does this program halt?

Affine program

x := 2−10 y := 1 while y x do x y

  • :=

2

7 4 1 4

x y

  • y

x

2 / 17

slide-5
SLIDE 5

Does this program halt?

Affine program

x := 2−10 y := 1 while y x do x y

  • :=

2

7 4 1 4

x y

  • y

x

2 / 17

slide-6
SLIDE 6

Does this program halt?

Affine program

x := 2−10 y := 1 while y x do x y

  • :=

2

7 4 1 4

x y

  • y

x

2 / 17

slide-7
SLIDE 7

Does this program halt?

Affine program

x := 2−10 y := 1 while y x do x y

  • :=

2

7 4 1 4

x y

  • y

x

2 / 17

slide-8
SLIDE 8

Does this program halt?

Affine program

x := 2−10 y := 1 while y x do x y

  • :=

2

7 4 1 4

x y

  • Certificate of non-termination:

x2y − x3 =

1023 1073741824

(1) y x

2 / 17

slide-9
SLIDE 9

Does this program halt?

Affine program

x := 2−10 y := 1 while y x do x y

  • :=

2

7 4 1 4

x y

  • Certificate of non-termination:

x2y − x3 =

1023 1073741824

(1) y x ◮ (1) is an invariant: it holds at every step

2 / 17

slide-10
SLIDE 10

Does this program halt?

Affine program

x := 2−10 y := 1 while y x do x y

  • :=

2

7 4 1 4

x y

  • Certificate of non-termination:

x2y − x3 =

1023 1073741824

(1) y x ◮ (1) is an invariant: it holds at every step ◮ (1) implies the guard is true

2 / 17

slide-11
SLIDE 11

Invariants

invariant = overapproximation of the reachable states

3 / 17

slide-12
SLIDE 12

Invariants

invariant = overapproximation of the reachable states inductive invariant = invariant preserved by the transition relation transition

3 / 17

slide-13
SLIDE 13

Inductive invariants: example

1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-14
SLIDE 14

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-15
SLIDE 15

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-16
SLIDE 16

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-17
SLIDE 17

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-18
SLIDE 18

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-19
SLIDE 19

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-20
SLIDE 20

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-21
SLIDE 21

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-22
SLIDE 22

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-23
SLIDE 23

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-24
SLIDE 24

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-25
SLIDE 25

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

4 / 17

slide-26
SLIDE 26

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

S1 S2 S3

S1,S2,S3 is an invariant

4 / 17

slide-27
SLIDE 27

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

S1 S2 S3

S1,S2,S3 is an inductive invariant

4 / 17

slide-28
SLIDE 28

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

I1 S1 I2 S2 I3 S3

I1,I2,I3 is an invariant

4 / 17

slide-29
SLIDE 29

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

I1 I2 I3

I1,I2,I3 is NOT an inductive invariant

4 / 17

slide-30
SLIDE 30

Inductive invariants: example

x, y, z range over Q fi : R3 → R3 1 2 3 f1 f2 f3 f4 f5

I1 I2 I3

I1,I2,I3 is an inductive invariant

4 / 17

slide-31
SLIDE 31

Why Invariants?

I S

BAD! The classical approach to the verification of temporal safety properties of programs requires the construction of inductive invariants [...]. Automation of this construction is the main challenge in program verification.

  • D. Beyer, T. Henzinger, R. Majumdar, and A. Rybalchenko

Invariant Synthesis for Combined Theories, 2007

5 / 17

slide-32
SLIDE 32

Which invariants?

6 / 17

slide-33
SLIDE 33

Which invariants?

Intervals

6 / 17

slide-34
SLIDE 34

Which invariants?

Intervals Octagons

  • 6 / 17
slide-35
SLIDE 35

Which invariants?

Intervals Octagons Affine/linear sets

  • 6 / 17
slide-36
SLIDE 36

Which invariants?

Intervals Octagons Polyhedrons Affine/linear sets

  • 6 / 17
slide-37
SLIDE 37

Which invariants?

Intervals Octagons Polyhedrons Affine/linear sets Algebraic sets = polynomial equalities

  • 6 / 17
slide-38
SLIDE 38

Which invariants?

Intervals Octagons Polyhedrons Affine/linear sets Algebraic sets = polynomial equalities Semialgebraic sets

  • 6 / 17
slide-39
SLIDE 39

Affine programs

1 2 3 f1 f2 f3 f4 f5

7 / 17

slide-40
SLIDE 40

Affine programs

◮ Nondeterministic branching (no guards) 1 2 3 f1 f2 f3 f4 f5

7 / 17

slide-41
SLIDE 41

Affine programs

◮ Nondeterministic branching (no guards) ◮ All assignments are affine 1 2 3 x := 3x − 7y + 1 f2 f3 f4 f5

7 / 17

slide-42
SLIDE 42

Affine programs

◮ Nondeterministic branching (no guards) ◮ All assignments are affine ◮ Allow nondeterministic assignments (x := ∗) 1 2 3 x := 3x − 7y + 1 f2 f3 y := ∗ f5

7 / 17

slide-43
SLIDE 43

Affine programs

◮ Nondeterministic branching (no guards) ◮ All assignments are affine ◮ Allow nondeterministic assignments (x := ∗) 1 2 3 x := 3x − 7y + 1 f2 f3 y := ∗ f5 ◮ Can overapproximate complex programs

7 / 17

slide-44
SLIDE 44

Affine programs

◮ Nondeterministic branching (no guards) ◮ All assignments are affine ◮ Allow nondeterministic assignments (x := ∗) 1 2 3 x := 3x − 7y + 1 f2 f3 y := ∗ f5 ◮ Can overapproximate complex programs ◮ Covers existing formalisms: probabilistic, quantum, quantitative automata

7 / 17

slide-45
SLIDE 45

Karr’s Algorithm

Theorem (Karr 76)

There is an algorithm which computes, for any given affine program

  • ver Q, its strongest affine inductive invariant.

8 / 17

slide-46
SLIDE 46

Randomized Karr’s Algorithm @ POPL 2003

9 / 17

slide-47
SLIDE 47

Some polynomial invariants

Theorem (ICALP 2004)

There is an algorithm which computes, for any given affine program

  • ver Q, all its polynomial inductive invariants up to any fixed degree d.

10 / 17

slide-48
SLIDE 48

A challenge: finding all polynomial invariants

11 / 17

slide-49
SLIDE 49

A challenge: finding all polynomial invariants

11 / 17

slide-50
SLIDE 50

Why fixed degree is not enough

12 / 17

slide-51
SLIDE 51

Why fixed degree is not enough

◮ Paraboloid z = x2 + y2

12 / 17

slide-52
SLIDE 52

Why fixed degree is not enough

◮ Paraboloid z = x2 + y2

12 / 17

slide-53
SLIDE 53

Why fixed degree is not enough

◮ Paraboloid z = x2 + y2 ◮ Union of 3 hyperplanes (x − y)(10y + x)(y + 10x) = 0

12 / 17

slide-54
SLIDE 54

Why fixed degree is not enough

◮ Paraboloid z = x2 + y2 ◮ Union of 3 hyperplanes (x − y)(10y + x)(y + 10x) = 0

12 / 17

slide-55
SLIDE 55

Why fixed degree is not enough

◮ Paraboloid z = x2 + y2 ◮ Union of 3 hyperplanes (x − y)(10y + x)(y + 10x) = 0

12 / 17

slide-56
SLIDE 56

Main result

Theorem

There is an algorithm which computes, for any given affine program

  • ver Q, its strongest polynomial inductive invariant.

13 / 17

slide-57
SLIDE 57

Main result

Theorem

There is an algorithm which computes, for any given affine program

  • ver Q, its strongest polynomial inductive invariant.

◮ strongest polynomial invariant ⇐ ⇒ smallest algebraic set

13 / 17

slide-58
SLIDE 58

Main result

Theorem

There is an algorithm which computes, for any given affine program

  • ver Q, its strongest polynomial inductive invariant.

◮ strongest polynomial invariant ⇐ ⇒ smallest algebraic set

◮ algebraic sets = finite and of polynomial equalities

13 / 17

slide-59
SLIDE 59

Main result

Theorem

There is an algorithm which computes, for any given affine program

  • ver Q, its strongest polynomial inductive invariant.

◮ strongest polynomial invariant ⇐ ⇒ smallest algebraic set

◮ algebraic sets = finite and of polynomial equalities

◮ Thus our algorithm computes all polynomial relations that always hold among program variables at each program location, in all possible executions of the program

13 / 17

slide-60
SLIDE 60

Main result

Theorem

There is an algorithm which computes, for any given affine program

  • ver Q, its strongest polynomial inductive invariant.

◮ strongest polynomial invariant ⇐ ⇒ smallest algebraic set

◮ algebraic sets = finite and of polynomial equalities

◮ Thus our algorithm computes all polynomial relations that always hold among program variables at each program location, in all possible executions of the program ◮ We can represent this (usually infinite) set of relations using a finite basis of polynomial equalities

13 / 17

slide-61
SLIDE 61

At the edge of decidability

x:=x0

x := M1x x := M2x . . . x := Mkx

S

14 / 17

slide-62
SLIDE 62

At the edge of decidability

x:=x0

x := M1x x := M2x . . . x := Mkx

S Theorem (Markov 1947∗)

There is a fixed set of 6 × 6 integer matrices M1, . . . , Mk such that the reachability problem “y is reachable from x0?” is undecidable.

∗Original theorems about semigroups, reformulated with affine programs. 14 / 17

slide-63
SLIDE 63

At the edge of decidability

x:=x0

x := M1x x := M2x . . . x := Mkx

S Theorem (Markov 1947∗)

There is a fixed set of 6 × 6 integer matrices M1, . . . , Mk such that the reachability problem “y is reachable from x0?” is undecidable.

Theorem (Paterson 1970∗)

The mortality problem “ 0 is reachable from x0 with M1, . . . , Mk?” is undecidable for 3 × 3 matrices.

∗Original theorems about semigroups, reformulated with affine programs. 14 / 17

slide-64
SLIDE 64

Tools

◮ Algebraic geometry ◮ Number theory ◮ Group theory

15 / 17

slide-65
SLIDE 65

Tools

◮ Algebraic geometry ◮ Number theory ◮ Group theory

Theorem (Derksen, Jeandel and Koiran, 2004)

There is an algorithm which computes, for any given affine program

  • ver Q using only invertible transformations, its strongest polynomial

inductive invariant.

15 / 17

slide-66
SLIDE 66

Main contribution

Theorem

Given a finite set of rational square matrices of the same dimension, we can compute the Zariski closure of the semigroup that they generate.

Corollary

Given an affine program, we can compute for each location the ideal of all polynomial relations that hold at that location.

16 / 17

slide-67
SLIDE 67

Summary

◮ invariant = overapproximation of reachable states ◮ invariants allow verification of safety properties ◮ affine program:

◮ nondeterministic branching, no guards, affine assignments

1 2 3 x := 3x − 7y + 1 f2 f3 y := ∗ f5

Theorem

There is an algorithm which computes, for any given affine program

  • ver Q, its strongest polynomial inductive invariant.

17 / 17