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 Partitioning and Bounds 4 Complexity D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 3 / 11
Fourier-Motzkin Variable Elimination Goal: decide satisfiability of conjunction of linear constraints over reals � � a i,j x j ≤ b i 1 ≤ i ≤ m 1 ≤ j ≤ n D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 4 / 11
Fourier-Motzkin Variable Elimination Goal: decide satisfiability of conjunction of linear constraints over reals � � a i,j x j ≤ b i 1 ≤ i ≤ m 1 ≤ j ≤ n 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
Fourier-Motzkin Variable Elimination Goal: decide satisfiability of conjunction of linear constraints over reals � � a i,j x j ≤ b i 1 ≤ i ≤ m 1 ≤ j ≤ n 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
Linear Arithmetic over the Reals Input: A system of conjoined linear inequalities Ax ≤ b a 11 a 12 a 1 n x 1 b 1 · · · · · · . . . ... . . . a 21 a 22 . . . m constraints ≤ . . . . ... . . . . . . . . a m 1 a 22 a mn x n b n · · · · · · n variables D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 5 / 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! 8 x 7 y ≥ x 3 ≥ y z ≥ z 10 ≥ 20 z ≥ D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 6 / 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! 8 x 7 y ≥ x 3 ≥ y z ≥ z 10 ≥ 20 z ≥ D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 6 / 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! 8 x 7 y ≥ x 3 y z ≥ ≥ 10 y z z ≥ − → ≥ z 10 20 z ≥ ≥ 20 z ≥ D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 6 / 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! 8 x 7 y ≥ x 3 y z ≥ ≥ 10 y z z ≥ − → ≥ z 10 20 z ≥ ≥ 20 z ≥ D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 6 / 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! 8 x 7 y ≥ x 3 y z ≥ ≥ z 10 ≥ 10 y z z ≥ − → ≥ − → 20 ≥ z z 10 20 z ≥ ≥ 20 z ≥ D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 6 / 11
Partitioning the Constraints 1. When eliminating x n , partition the constraints according to the coefficient a in : a i,n > 0 : upper bound β i a i,n < 0 : lower bound β i D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 7 / 11
Partitioning the Constraints 1. When eliminating x n , partition the constraints according to the coefficient a in : a i,n > 0 : upper bound β i a i,n < 0 : lower bound β i n � a i,j · x j ≤ b i j =1 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 7 / 11
Partitioning the Constraints 1. When eliminating x n , partition the constraints according to the coefficient a in : a i,n > 0 : upper bound β i a i,n < 0 : lower bound β i n � a i,j · x j ≤ b i j =1 n − 1 � ⇒ a i,n · x n ≤ b i − a i,j · x j j =1 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 7 / 11
Partitioning the Constraints 1. When eliminating x n , partition the constraints according to the coefficient a in : a i,n > 0 : upper bound β i a i,n < 0 : lower bound β i n � a i,j · x j ≤ b i j =1 n − 1 � ⇒ a i,n · x n ≤ b i − a i,j · x j j =1 n − 1 b i a i,j � x n ≤ · x j =: β i ⇒ − a i,n a i,n j =1 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 7 / 11
Example for Upper and Lower Bounds Category? (1) x 1 − x 2 ≤ 0 (2) x 1 − x 3 ≤ 0 (3) − x 1 + x 2 + 2 x 3 ≤ 0 (4) − x 3 ≤ − 1 Assume we eliminate x 1 . D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 8 / 11
Example for Upper and Lower Bounds Category? (1) x 1 − x 2 ≤ 0 Upper bound (2) x 1 − x 3 ≤ 0 (3) − x 1 + x 2 + 2 x 3 ≤ 0 (4) − x 3 ≤ − 1 Assume we eliminate x 1 . D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 8 / 11
Example for Upper and Lower Bounds Category? (1) x 1 − x 2 ≤ 0 Upper bound (2) x 1 − x 3 ≤ 0 Upper bound (3) − x 1 + x 2 + 2 x 3 ≤ 0 (4) − x 3 ≤ − 1 Assume we eliminate x 1 . D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 8 / 11
Example for Upper and Lower Bounds Category? (1) x 1 − x 2 ≤ 0 Upper bound (2) x 1 − x 3 ≤ 0 Upper bound (3) − x 1 + x 2 + 2 x 3 ≤ 0 Lower bound (4) − x 3 ≤ − 1 Assume we eliminate x 1 . D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 8 / 11
Adding the constraints 2. For each pair of a lower bound a l,n < 0 and upper bound a u,n > 0 , we have β l x n β 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
Fourier-Motzkin: Example Category? (1) x 1 − x 2 ≤ 0 (2) x 1 − x 3 ≤ 0 (3) − x 1 + x 2 + 2 x 3 ≤ 0 (4) − x 3 ≤ − 1 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 10 / 11
Fourier-Motzkin: Example Category? (1) x 1 − x 2 ≤ 0 Upper bound (2) x 1 − x 3 ≤ 0 Upper bound (3) − x 1 + x 2 + 2 x 3 ≤ 0 Lower bound (4) − x 3 ≤ − 1 we eliminate x 1 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 10 / 11
Fourier-Motzkin: Example Category? (1) x 1 − x 2 ≤ 0 Upper bound (2) x 1 − x 3 ≤ 0 Upper bound (3) − x 1 + x 2 + 2 x 3 ≤ 0 Lower bound (4) − x 3 ≤ − 1 we eliminate x 1 (5) 2 x 3 ≤ 0 (from 1,3) D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 10 / 11
Fourier-Motzkin: Example Category? (1) x 1 − x 2 ≤ 0 Upper bound (2) x 1 − x 3 ≤ 0 Upper bound (3) − x 1 + x 2 + 2 x 3 ≤ 0 Lower bound (4) − x 3 ≤ − 1 we eliminate x 1 (5) 2 x 3 ≤ 0 (from 1,3) (6) x 2 + x 3 ≤ 0 (from 2,3) D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 10 / 11
Fourier-Motzkin: Example Category? (1) x 1 − x 2 ≤ 0 (2) x 1 − x 3 ≤ 0 (3) − x 1 + x 2 + 2 x 3 ≤ 0 (4) − x 3 ≤ − 1 we eliminate x 1 (5) 2 x 3 ≤ 0 (from 1,3) (6) x 2 + x 3 ≤ 0 (from 2,3) D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 10 / 11
Fourier-Motzkin: Example Category? (1) x 1 − x 2 ≤ 0 (2) x 1 − x 3 ≤ 0 (3) − x 1 + x 2 + 2 x 3 ≤ 0 (4) − x 3 ≤ − 1 we eliminate x 1 (5) 2 x 3 ≤ 0 (from 1,3) (6) x 2 + x 3 ≤ 0 (from 2,3) we eliminate x 3 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 10 / 11
Fourier-Motzkin: Example Category? (1) x 1 − x 2 ≤ 0 (2) x 1 − x 3 ≤ 0 (3) − x 1 + x 2 + 2 x 3 ≤ 0 (4) − x 3 ≤ − 1 Lower bound we eliminate x 1 (5) 2 x 3 ≤ 0 (from 1,3) Upper bound (6) x 2 + x 3 ≤ 0 (from 2,3) Upper bound we eliminate x 3 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 10 / 11
Fourier-Motzkin: Example Category? (1) x 1 − x 2 ≤ 0 (2) x 1 − x 3 ≤ 0 (3) − x 1 + x 2 + 2 x 3 ≤ 0 (4) − x 3 ≤ − 1 Lower bound we eliminate x 1 (5) 2 x 3 ≤ 0 (from 1,3) Upper bound (6) x 2 + x 3 ≤ 0 (from 2,3) Upper bound we eliminate x 3 (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
Complexity Worst-case complexity: m → m 2 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, 2007 11 / 11
Recommend
More recommend