Reasoning with Nonlinear Formulas in Isabelle/HOL Wenda Li University of Cambridge wl302@cam.ac.uk January 7, 2020 Joint work with Grant Passmore and Larry Paulson 1 / 36
Alfred Tarski (1930s): the first-order theory of real closed fields is complete and decidable. That is, we have a decision procedure for closed sentences like the following: ∃ x ∈ R . ∀ y ∈ R . ∃ z ∈ R . xz − y 2 < 0 ∧ x > 0 . 2 / 36
The Sturm-Tarski theorem (also known as Tarski’s theorem) Given P , Q ∈ R [ X ], P � = 0, a , b ∈ R , a < b and are not roots of P , TaQ ( Q , P , a , b ) = Var ( SRemS ( P , P ′ Q ); a , b ) , where ◮ � TaQ ( Q , P , a , b ) = sgn ( Q ( x )) , x ∈ ( a , b ) , P ( x )=0 ◮ P ′ is the first derivative of P , ◮ Var computes the sign variations, ◮ SRemS computes the signed remainder sequence. Also, TaQ (1 , P , a , b ) computes the number of real roots of P within the interval ( a , b ) (i.e., Sturm’s theorem). 3 / 36
To decide ∃ x ∈ R . P ( x ) = 0 ∧ Q 1 ( x ) > 0 Let c ( Q 1 ⊲ ⊳ 1 0 , · · · , Q n ⊲ ⊳ n 0) = card( { x | P ( x ) = 0 ∧ Q 1 ( x ) ⊲ ⊳ 1 0 ∧ · · · ∧ Q n ( x ) ⊲ ⊳ n 0 } ) , where ⊲ ⊳ i ∈ { <, >, = } , and TaQ P ( Q i ) = TaQ ( Q i , P , −∞ , + ∞ ). We have ∃ x ∈ R . P ( x ) = 0 ∧ Q 1 ( x ) > 0 ⇐ ⇒ c ( Q 1 > 0) > 0 , while c ( Q 1 > 0) can be found by solving the following linear equation: 1 1 1 c ( Q 1 = 0) TaQ P (1) = . 0 1 − 1 c ( Q 1 > 0) TaQ P ( Q 1 ) TaQ P ( Q 2 0 1 1 c ( Q 1 < 0) 1 ) 4 / 36
The number of linear equations grows very quickly. ∃ x ∈ R . P ( x ) = 0 ∧ Q 1 ( x ) > 0 ∧ Q 2 ( x ) < 0 ⇐ ⇒ c ( Q 1 > 0 , Q 2 < 0) > 0 , requires us to solve a system with 9 equations: c ( Q 1 = 0 , Q 2 = 0) TaQ P (1) c ( Q 1 = 0 , Q 2 > 0) TaQ P ( Q 2 ) 1 1 1 1 1 1 · · · · · · ⊗ 0 1 − 1 0 1 − 1 = TaQ P ( Q 1 Q 2 c ( Q 1 > 0 , Q 2 < 0) 2 ) 0 1 1 0 1 1 · · · · · · TaQ P ( Q 2 1 Q 2 c ( Q 1 < 0 , Q 2 < 0) 2 ) where ⊗ is tensor product. 5 / 36
Tarski’s elimination procedure is mostly of theoretical interest Univariate case: exponential in the number of polynomials General case: non-elementary in the number of variables Due to its elegance, Tarski’s elimination procedure has been implemented in Coq 1 , HOL Light 2 and PVS 3 . 1 Mahboubi and Cohen, “Formal proofs in real algebraic geometry: from ordered fields to quantifier elimination”. 2 Nieuwenhuis, CADE-20: 20th International Conference on Automated Deduction, proceedings . 3 Narkawicz, Mu˜ noz, and Dutle, “Formally-Verified Decision Procedures for Univariate Polynomial Computation Based on Sturm’s and Tarski’s Theorems.” 6 / 36
Can we have a more practical procedure? George E. Collins (1976): Yes, here is cylindrical algebraic decomposition (CAD). 7 / 36
What is cylindrical algebraic decomposition (CAD) x 2 √ 3 ∧ x 2 < x 2 D 1 , 1 = { ( x 1 , x 2 ) | x 1 < − 1 / 2 } √ 3 ∧ x 2 = x 2 D 1 , 2 = { ( x 1 , x 2 ) | x 1 < − 1 / 2 } P 1 P 2 √ √ 3 ∧ x 2 > x 2 D 1 , 3 = { ( x 1 , x 2 ) | x 1 < − 1 / 2 } 3 , 3 ( − 2 ) √ √ √ D 2 , 1 = { ( x 1 , x 2 ) | x 1 = − 3 ∧ x 2 < 0 } ( − 2 , 1) ( 2 , 1) √ D 2 , 2 = { ( x 1 , x 2 ) | x 1 = − 3 ∧ x 2 = 0 } x 1 . √ √ . . − 3 3 √ 3 ∧ x 2 = x 2 D 9 , 2 = { ( x 1 , x 2 ) | x 1 > 1 / 2 } √ 3 ∧ x 2 > x 2 D 9 , 3 = { ( x 1 , x 2 ) | x 1 > 1 / 2 } Here, P 1 ( x 1 , x 2 ) = x 2 2 + x 2 1 − 3 and P 2 ( x 1 , x 2 ) = x 2 − x 2 1 / 2. 8 / 36
What is cylindrical algebraic decomposition (CAD) x 2 √ 3 ∧ x 2 < x 2 D 1 , 1 = { ( x 1 , x 2 ) | x 1 < − 1 / 2 } √ 3 ∧ x 2 = x 2 D 1 , 2 = { ( x 1 , x 2 ) | x 1 < − 1 / 2 } P 1 P 2 √ √ 3 ∧ x 2 > x 2 D 1 , 3 = { ( x 1 , x 2 ) | x 1 < − 1 / 2 } 3 , 3 ( − 2 ) √ √ √ D 2 , 1 = { ( x 1 , x 2 ) | x 1 = − 3 ∧ x 2 < 0 } ( − 2 , 1) ( 2 , 1) √ D 2 , 2 = { ( x 1 , x 2 ) | x 1 = − 3 ∧ x 2 = 0 } x 1 . √ √ . . − 3 3 √ 3 ∧ x 2 = x 2 D 9 , 2 = { ( x 1 , x 2 ) | x 1 > 1 / 2 } √ 3 ∧ x 2 > x 2 D 9 , 3 = { ( x 1 , x 2 ) | x 1 > 1 / 2 } Here, P 1 ( x 1 , x 2 ) = x 2 2 + x 2 1 − 3 and P 2 ( x 1 , x 2 ) = x 2 − x 2 1 / 2. 9 / 36
What is cylindrical algebraic decomposition (CAD) x 2 √ 3 ∧ x 2 < x 2 D 1 , 1 = { ( x 1 , x 2 ) | x 1 < − 1 / 2 } √ 3 ∧ x 2 = x 2 D 1 , 2 = { ( x 1 , x 2 ) | x 1 < − 1 / 2 } P 1 P 2 √ √ 3 ∧ x 2 > x 2 D 1 , 3 = { ( x 1 , x 2 ) | x 1 < − 1 / 2 } 3 , 3 ( − 2 ) √ √ √ D 2 , 1 = { ( x 1 , x 2 ) | x 1 = − 3 ∧ x 2 < 0 } ( − 2 , 1) ( 2 , 1) √ D 2 , 2 = { ( x 1 , x 2 ) | x 1 = − 3 ∧ x 2 = 0 } x 1 . √ √ . . − 3 3 √ 3 ∧ x 2 = x 2 D 9 , 2 = { ( x 1 , x 2 ) | x 1 > 1 / 2 } √ 3 ∧ x 2 > x 2 D 9 , 3 = { ( x 1 , x 2 ) | x 1 > 1 / 2 } Here, P 1 ( x 1 , x 2 ) = x 2 2 + x 2 1 − 3 and P 2 ( x 1 , x 2 ) = x 2 − x 2 1 / 2. 10 / 36
What is cylindrical algebraic decomposition (CAD) x 2 √ 3 ∧ x 2 < x 2 D 1 , 1 = { ( x 1 , x 2 ) | x 1 < − 1 / 2 } √ 3 ∧ x 2 = x 2 D 1 , 2 = { ( x 1 , x 2 ) | x 1 < − 1 / 2 } P 1 P 2 √ √ 3 ∧ x 2 > x 2 D 1 , 3 = { ( x 1 , x 2 ) | x 1 < − 1 / 2 } 3 , 3 ( − 2 ) √ √ √ D 2 , 1 = { ( x 1 , x 2 ) | x 1 = − 3 ∧ x 2 < 0 } ( − 2 , 1) ( 2 , 1) √ D 2 , 2 = { ( x 1 , x 2 ) | x 1 = − 3 ∧ x 2 = 0 } x 1 . √ √ . . − 3 3 √ 3 ∧ x 2 = x 2 D 9 , 2 = { ( x 1 , x 2 ) | x 1 > 1 / 2 } √ 3 ∧ x 2 > x 2 D 9 , 3 = { ( x 1 , x 2 ) | x 1 > 1 / 2 } such that � D = R 2 ∀ X ∈ D . ∀ Y ∈ D . X � = Y → X ∩ Y = ∅ and both P 1 ( x 1 , x 2 ) = x 2 2 + x 2 1 − 3 and P 2 ( x 1 , x 2 ) = x 2 − x 2 1 / 2 have constant sign over every X ∈ D (or { P 1 , P 2 } is adapted to D ) 11 / 36
x 2 ( − 2 , 0) ∈ D 1 , 1 ( − 2 , 2) ∈ D 1 , 2 ( − 2 , 2 . 5) ∈ D 1 , 3 √ ( − 3 , − 1) ∈ D 2 , 1 √ ( − 3 , 0) ∈ D 2 , 2 x 1 . . . (2 , 2) ∈ D 9 , 2 (2 , 2 . 5) ∈ D 9 , 3 Let S = { ( − 2 , 0) , ( − 2 , 2) , ( − 2 , 2 . 5) , · · · , (2 , 2) , (2 , 2 . 5) } . Sentences like the following can be decided: ∀ x 1 x 2 . P 1 ( x 1 , x 2 ) = 0 ∧ P 2 ( x 1 , x 2 ) > 0 ⇐ ⇒ ∀ ( x 1 , x 2 ) ∈ S . P 1 ( x 1 , x 2 ) = 0 ∧ P 2 ( x 1 , x 2 ) > 0 12 / 36
Definition (Stack) A stack D = { D 1 , D 2 , . . . , D 2 k +1 } over a connected S ⊆ R n is a decomposition of the cylinder S × R such that ◮ there is a sequence of continuous functions f 0 , f 1 , . . . , f k +1 : S − → R , such that f 0 ( x ) < f 1 ( x ) < · · · < f k +1 ( x ) for all x ∈ S , f 0 ( x ) = −∞ , f k +1 ( x ) = + ∞ , ◮ D 2 i +1 = { ( x , x ′ ) ∈ S × R | f i ( x ) < x ′ < f i +1 ( x ) } , for i = 0 , 1 , . . . , k , ◮ D 2 i = { ( x , x ′ ) ∈ S × R | x ′ = f i ( x ) } , for i = 1 , 2 , . . . , k . 13 / 36
Example of a stack Let √ √ S =] − 2 , 2[ , � 3 − x 2 , f 1 ( x ) = − x 2 f 2 ( x ) = x 2 / 2 , � f 3 ( x ) = 3 − x 2 . √ A stack decomposes S × R : ( − 2 , 1) D 1 = { ( x 1 , x 2 ) | x 1 ∈ S ∧ x 2 < f 1 ( x 1 ) } x 1 D 2 = { ( x 1 , x 2 ) | x 1 ∈ S ∧ x 2 = f 1 ( x 1 ) } √ D 3 = { ( x 1 , x 2 ) | x 1 ∈ S ( 2 , − 1) ∧ f 1 ( x 1 ) < x 2 < f 2 ( x 2 ) } . . . D 7 = { ( x 1 , x 2 ) | x 1 ∈ S ∧ x 2 > f 3 ( x ) } 14 / 36
Definition (Cylindrical) A decomposition D of R n is cylindrical if ◮ n = 1, D decomposes R : there exist a finite number of points a i ∈ R for 1 ≤ i ≤ k , such that a i < a i +1 (1 ≤ i ≤ k − 1) and D = { ( −∞ , a 1 ) , { a 1 } , ( a 1 , a 2 ) , { a 2 } , . . . , ( a k − 1 , a k ) , { a k } , ( a k , ∞ ) } . ◮ n > 1, there exists a cylindrical decomposition D ′ of R n − 1 such that over each X ∈ D ′ there is a stack t ( X ) and � D = t ( X ) . X ∈ D ′ 15 / 36
Theorem (Delineability) Let P ⊆ R [ x 1 , . . . , x n − 1 ][ x n ] be a set of polynomials and C be a connected subset of R n − 1 . If 1. for every P ∈ P , the total number of complex roots (counting multiplicities) of P ( β, x ) is constant as β varies over C, where P ( β, x ) is a univariate polynomial in which the variables x 1 , . . . , x n − 1 are instantiated by β ∈ R n − 1 , 2. for every P ∈ P , the number of distinct complex roots of P ( β, x ) is constant as β varies over C, 3. for every P , Q ∈ P , the total number of common complex roots (counting multiplicities) of P ( β, x ) and Q ( β, x ) is constant as β varies over C, then the total number of distinct real roots of ( � P )( β, x ) is constant as β varies over C. 16 / 36
Require: a finite set of polynomials P ⊆ R [ x 1 , . . . , x n ] Ensure: Return a set of sample points S n ⊆ R n from a CAD that is adapted to P 1: procedure CAD ( P ) P n ← P 2: for i = n to 2 do ⊲ Projection phase, where 3: P i ⊆ R [ x 1 , . . . , x i ] P i − 1 ← proj ( P i ) 4: end for 5: S 1 ← base ( P 1 ) ⊲ Base case, where base ( Q ) returns a set 6: of sample points adapted to Q ⊆ R [ x ] ⊲ Lifting phase, where S i ⊆ R i for i = 1 to n − 1 do 7: S i +1 ← � β ∈S i ( { β } × base ( P i +1 ( β, x ))) 8: end for 9: return S n 10: 11: end procedure 17 / 36
Recommend
More recommend