Decision Procedures An Algorithmic Point of View Linear Arithmetic - - PowerPoint PPT Presentation

decision procedures
SMART_READER_LITE
LIVE PREVIEW

Decision Procedures An Algorithmic Point of View Linear Arithmetic - - PowerPoint PPT Presentation

Decision Procedures An Algorithmic Point of View Linear Arithmetic D. Kroening O. Strichman ETH/Technion Version 1.0, 2007 Part V Linear Arithmetic Fourier-Motzkin Variable Elimination Outline 1 History 2 Linear Arithmetic over the Reals 3


slide-1
SLIDE 1

Decision Procedures

An Algorithmic Point of View Linear Arithmetic

  • D. Kroening
  • O. Strichman

ETH/Technion

Version 1.0, 2007

slide-2
SLIDE 2

Part V Linear Arithmetic

slide-3
SLIDE 3

Fourier-Motzkin Variable Elimination

Outline

1 History 2 Linear Arithmetic over the Reals 3 Partitioning and Bounds 4 Complexity

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 3 / 11

slide-4
SLIDE 4

Fourier-Motzkin Variable Elimination Goal: decide satisfiability of conjunction of linear constraints over reals

  • 1≤i≤m
  • 1≤j≤n

ai,jxj ≤ bi

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 4 / 11

slide-5
SLIDE 5

Fourier-Motzkin Variable Elimination Goal: decide satisfiability of conjunction of linear constraints over reals

  • 1≤i≤m
  • 1≤j≤n

ai,jxj ≤ bi Earliest method for solving linear inequalities Discovered in 1826 by Fourier, re-discovered by Motzkin in 1936

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 4 / 11

slide-6
SLIDE 6

Fourier-Motzkin Variable Elimination Goal: decide satisfiability of conjunction of linear constraints over reals

  • 1≤i≤m
  • 1≤j≤n

ai,jxj ≤ bi Earliest method for solving linear inequalities Discovered in 1826 by Fourier, re-discovered by Motzkin in 1936 Basic idea of variable elimination:

Pick one variable and eliminate it Continue until all variables but one are eliminated

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 4 / 11

slide-7
SLIDE 7

Linear Arithmetic over the Reals Input: A system of conjoined linear inequalities Ax ≤ b m constraints       a11 a12 · · · · · · a1n a21 a22 ... . . . . . . ... . . . am1 a22 · · · · · · amn             x1 . . . . . . xn       ≤       b1 . . . . . . bn       n variables

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 5 / 11

slide-8
SLIDE 8

Removing unbounded variables Iteratively remove variables that are not bounded in both ways (and all the constraints that use them) The new problem has a solution iff the old problem has one! 8x ≥ 7y x ≥ 3 y ≥ z z ≥ 10 20 ≥ z

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 6 / 11

slide-9
SLIDE 9

Removing unbounded variables Iteratively remove variables that are not bounded in both ways (and all the constraints that use them) The new problem has a solution iff the old problem has one! 8x ≥ 7y x ≥ 3 y ≥ z z ≥ 10 20 ≥ z

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 6 / 11

slide-10
SLIDE 10

Removing unbounded variables Iteratively remove variables that are not bounded in both ways (and all the constraints that use them) The new problem has a solution iff the old problem has one! 8x ≥ 7y x ≥ 3 y ≥ z z ≥ 10 20 ≥ z − → y ≥ z z ≥ 10 20 ≥ z

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 6 / 11

slide-11
SLIDE 11

Removing unbounded variables Iteratively remove variables that are not bounded in both ways (and all the constraints that use them) The new problem has a solution iff the old problem has one! 8x ≥ 7y x ≥ 3 y ≥ z z ≥ 10 20 ≥ z − → y ≥ z z ≥ 10 20 ≥ z

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 6 / 11

slide-12
SLIDE 12

Removing unbounded variables Iteratively remove variables that are not bounded in both ways (and all the constraints that use them) The new problem has a solution iff the old problem has one! 8x ≥ 7y x ≥ 3 y ≥ z z ≥ 10 20 ≥ z − → y ≥ z z ≥ 10 20 ≥ z − → z ≥ 10 20 ≥ z

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 6 / 11

slide-13
SLIDE 13

Partitioning the Constraints

  • 1. When eliminating xn, partition the constraints according to the

coefficient ain:

ai,n > 0: upper bound βi ai,n < 0: lower bound βi

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 7 / 11

slide-14
SLIDE 14

Partitioning the Constraints

  • 1. When eliminating xn, partition the constraints according to the

coefficient ain:

ai,n > 0: upper bound βi ai,n < 0: lower bound βi

n

  • j=1

ai,j · xj ≤ bi

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 7 / 11

slide-15
SLIDE 15

Partitioning the Constraints

  • 1. When eliminating xn, partition the constraints according to the

coefficient ain:

ai,n > 0: upper bound βi ai,n < 0: lower bound βi

n

  • j=1

ai,j · xj ≤ bi ⇒ ai,n · xn ≤ bi −

n−1

  • j=1

ai,j · xj

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 7 / 11

slide-16
SLIDE 16

Partitioning the Constraints

  • 1. When eliminating xn, partition the constraints according to the

coefficient ain:

ai,n > 0: upper bound βi ai,n < 0: lower bound βi

n

  • j=1

ai,j · xj ≤ bi ⇒ ai,n · xn ≤ bi −

n−1

  • j=1

ai,j · xj ⇒ xn ≤ bi ai,n −

n−1

  • j=1

ai,j ai,n · xj =: βi

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 7 / 11

slide-17
SLIDE 17

Example for Upper and Lower Bounds

Category?

(1) x1 − x2 ≤ 0 (2) x1 − x3 ≤ 0 (3) −x1 + x2 + 2x3 ≤ 0 (4) −x3 ≤ −1 Assume we eliminate x1.

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 8 / 11

slide-18
SLIDE 18

Example for Upper and Lower Bounds

Category?

(1) x1 − x2 ≤ 0 Upper bound (2) x1 − x3 ≤ 0 (3) −x1 + x2 + 2x3 ≤ 0 (4) −x3 ≤ −1 Assume we eliminate x1.

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 8 / 11

slide-19
SLIDE 19

Example for Upper and Lower Bounds

Category?

(1) x1 − x2 ≤ 0 Upper bound (2) x1 − x3 ≤ 0 Upper bound (3) −x1 + x2 + 2x3 ≤ 0 (4) −x3 ≤ −1 Assume we eliminate x1.

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 8 / 11

slide-20
SLIDE 20

Example for Upper and Lower Bounds

Category?

(1) x1 − x2 ≤ 0 Upper bound (2) x1 − x3 ≤ 0 Upper bound (3) −x1 + x2 + 2x3 ≤ 0 Lower bound (4) −x3 ≤ −1 Assume we eliminate x1.

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 8 / 11

slide-21
SLIDE 21

Adding the constraints

  • 2. For each pair of a lower bound al,n < 0 and

upper bound au,n > 0, we have

βl ≤ xn ≤ βu

  • 3. For each such pair, add the constraint

βl ≤ βu

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 9 / 11

slide-22
SLIDE 22

Fourier-Motzkin: Example

Category?

(1) x1 − x2 ≤ 0 (2) x1 − x3 ≤ 0 (3) −x1 + x2 + 2x3 ≤ 0 (4) −x3 ≤ −1

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 10 / 11

slide-23
SLIDE 23

Fourier-Motzkin: Example

Category?

(1) x1 − x2 ≤ 0 Upper bound (2) x1 − x3 ≤ 0 Upper bound (3) −x1 + x2 + 2x3 ≤ 0 Lower bound (4) −x3 ≤ −1

we eliminate x1

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 10 / 11

slide-24
SLIDE 24

Fourier-Motzkin: Example

Category?

(1) x1 − x2 ≤ 0 Upper bound (2) x1 − x3 ≤ 0 Upper bound (3) −x1 + x2 + 2x3 ≤ 0 Lower bound (4) −x3 ≤ −1

we eliminate x1

(5) 2x3 ≤ 0 (from 1,3)

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 10 / 11

slide-25
SLIDE 25

Fourier-Motzkin: Example

Category?

(1) x1 − x2 ≤ 0 Upper bound (2) x1 − x3 ≤ 0 Upper bound (3) −x1 + x2 + 2x3 ≤ 0 Lower bound (4) −x3 ≤ −1

we eliminate x1

(5) 2x3 ≤ 0 (from 1,3) (6) x2 + x3 ≤ 0 (from 2,3)

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 10 / 11

slide-26
SLIDE 26

Fourier-Motzkin: Example

Category?

(1) x1 − x2 ≤ 0 (2) x1 − x3 ≤ 0 (3) −x1 + x2 + 2x3 ≤ 0 (4) −x3 ≤ −1

we eliminate x1

(5) 2x3 ≤ 0 (from 1,3) (6) x2 + x3 ≤ 0 (from 2,3)

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 10 / 11

slide-27
SLIDE 27

Fourier-Motzkin: Example

Category?

(1) x1 − x2 ≤ 0 (2) x1 − x3 ≤ 0 (3) −x1 + x2 + 2x3 ≤ 0 (4) −x3 ≤ −1

we eliminate x1

(5) 2x3 ≤ 0 (from 1,3) (6) x2 + x3 ≤ 0 (from 2,3)

we eliminate x3

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 10 / 11

slide-28
SLIDE 28

Fourier-Motzkin: Example

Category?

(1) x1 − x2 ≤ 0 (2) x1 − x3 ≤ 0 (3) −x1 + x2 + 2x3 ≤ 0 (4) −x3 ≤ −1 Lower bound

we eliminate x1

(5) 2x3 ≤ 0 (from 1,3) Upper bound (6) x2 + x3 ≤ 0 (from 2,3) Upper bound

we eliminate x3

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 10 / 11

slide-29
SLIDE 29

Fourier-Motzkin: Example

Category?

(1) x1 − x2 ≤ 0 (2) x1 − x3 ≤ 0 (3) −x1 + x2 + 2x3 ≤ 0 (4) −x3 ≤ −1 Lower bound

we eliminate x1

(5) 2x3 ≤ 0 (from 1,3) Upper bound (6) x2 + x3 ≤ 0 (from 2,3) Upper bound

we eliminate x3

(7) 0 ≤ −1 (from 4,5) → Contradiction (the system is UNSAT)

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 10 / 11

slide-30
SLIDE 30

Complexity Worst-case complexity: m → m2

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 11 / 11

slide-31
SLIDE 31

Complexity Worst-case complexity: m → m2 → (m2)2

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 11 / 11

slide-32
SLIDE 32

Complexity Worst-case complexity: m → m2 → (m2)2 → . . . → m2n

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 11 / 11

slide-33
SLIDE 33

Complexity Worst-case complexity: m → m2 → (m2)2 → . . . → m2n Heavy! So why is it so popular in verification?

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 11 / 11

slide-34
SLIDE 34

Complexity Worst-case complexity: m → m2 → (m2)2 → . . . → m2n Heavy! So why is it so popular in verification? The bottleneck: case-splitting

  • D. Kroening, O. Strichman (ETH/Technion)

Decision Procedures Version 1.0, 2007 11 / 11