Challenges in Decomposing Encodings of Verification Problems Peter Schrammel HCVS 2016 Eindhoven, The Netherlands
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Motivation Modern software verification tools: program formula solver verification problem specification 2 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Motivation Modern software verification tools: program formula solver verification problem specification Large programs: Problem: Formula too large for existing backend solvers 2 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Motivation Modern software verification tools: program formula solver verification problem specification Large programs: Problem: Formula too large for existing backend solvers Solution: Make formula smaller 2 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Motivation Modern software verification tools: program formula solver verification problem specification Large programs: Problem: Formula too large for existing backend solvers Solution: Make formula smaller program preprocess formula solver verification problem specification 2 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Motivation Modern software verification tools: program formula solver verification problem specification Large programs: Problem: Formula too large for existing backend solvers Solution: Make formula smaller program solver solver preprocess formula decompose solver verification problem specification 2 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Case Studies: Termination Analyses (ASE’15) Universal termination: Result: terminating / potentially non-term. / non-terminating Decision problem Conditional termination: Result: sufficient precondition for termination Inference problem 3 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Case Studies: Termination Analyses (ASE’15) Universal termination: Result: terminating / potentially non-term. / non-terminating Decision problem Conditional termination: Result: sufficient precondition for termination Inference problem 3 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Example: Universal Termination Analysis Encoding of the modular universal termination problem: ∃ 2 Summary f 1 , . . . , Summary f n : � f ∈ F ∃ 2 Inv f , RR f : ∀ x inf , x f , x ′ f , x outf : Init f ( x inf , x f ) = ⇒ Inv f ( x f ) h i ∈ H f Summary h ( x p inh i , x p outh i ) Inv f ( x f ) ∧ Trans f ( x f , x ′ f ) ∧ � ∧ = ⇒ Inv f ( x ′ f ) ∧ RR f ( x f , x ′ f ) Init f ( x inf , x f ) ∧ Inv f ( x ′ f ) ∧ Out f ( x ′ f , x outf ) ∧ ⇒ Summary f ( x inf , x outf ) = Decomposition: Procedural, top-down, context-sensitive 4 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Example: Universal Termination Analysis Benchmarks: Product line benchmarks from SV-COMP (597 benchmarks, 1.6 MLOC) Non-trivial procedural structure (on average 67 procedures, 5.5 loops) 2LS IPTA 2LS MTA Results: expected Ultimate TAN terminating 264 249 26 18 50 non-terminating 333 320 333 3 324 potentially non-terminating — 14 1 425 0 timed out (0.5h) — 237 150 43 14 errors — 0 0 1 180 total run time (h) — 58.7 119.6 92.8 23.9 5 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned 2LS for Program Analysis http://www.cprover.org/2LS Verification and static analysis on logical formulae Approximates solution to 2OL by reduction to FOL program template- template- template- abstract based based preprocess formula based verification & refine synthesis synthesis synthesis problem specification Bit-precise analysis SV-COMP’16 (including floating-point arithmetic) Template-based synthesis (using strategy iteration for optimisation) Analysis features: Interprocedural static analysis, termination analysis Incremental BMC, k -induction, k I k I (SAS’15) 6 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Logical Specification of Verification Problems Safety verification: ∀ x in , x , x ′ . ∃ 2 Inv . � Init ( x in , x ) = � ⇒ Inv ( x ) ∧ ( Inv ( x ) ∧ Trans ( x , x ′ ) = ⇒ Inv ( x ′ )) ∧ ( Inv ( x ) = ⇒ ¬ Err ( x )) (Blass and Gurevich ’87, Grebenshchikov et al ’12, David et al ’15, ...) 7 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Logical Specification of Verification Problems Safety verification: ∀ x in , x , x ′ . ∃ 2 Inv . � Init ( x in , x ) = � ⇒ Inv ( x ) ∧ ( Inv ( x ) ∧ Trans ( x , x ′ ) = ⇒ Inv ( x ′ )) ∧ ( Inv ( x ) = ⇒ ¬ Err ( x )) Invariant inference: min Inv . ∀ x , x ′ . ( Init ( x ) = ⇒ Inv ( x )) ∧ ( Inv ( x ) ∧ Trans ( x , x ′ ) = ⇒ Inv ( x ′ )) (Blass and Gurevich ’87, Grebenshchikov et al ’12, David et al ’15, ...) 7 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Logical Specification of Verification Problems Safety verification: ∀ x in , x , x ′ . ∃ 2 Inv . � Init ( x in , x ) = � ⇒ Inv ( x ) ∧ ( Inv ( x ) ∧ Trans ( x , x ′ ) = ⇒ Inv ( x ′ )) ∧ ( Inv ( x ) = ⇒ ¬ Err ( x )) Invariant inference: min Inv . ∀ x , x ′ . ( Init ( x ) = ⇒ Inv ( x )) ∧ ( Inv ( x ) ∧ Trans ( x , x ′ ) = ⇒ Inv ( x ′ )) Termination verification: ∀ x , x ′ . ∃ 2 RR , Inv . ( Init ( x ) = ⇒ Inv ( x )) ∧ � � Inv ( x ) ∧ Trans ( x , x ′ ) = ⇒ Inv ( x ′ ) ∧ RR ( x , x ′ ) . . . (Blass and Gurevich ’87, Grebenshchikov et al ’12, David et al ’15, ...) 7 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Template-Based Synthesis Reduction to first-order logic via templates, e.g. safety verification: ∃ 2 Inv . ∀ x , x ′ 1 . ( Init ( x ) = ⇒ Inv ( x )) ∧ ( Inv ( x ) ∧ Trans ( x , x ′ ) = ⇒ Inv ( x ′ )) ∧ ( Inv ( x ) = ⇒ ¬ Err ( x )) 8 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Template-Based Synthesis Reduction to first-order logic via templates, e.g. safety verification: ∀ x , x ′ . ( Init ( x ) = ⇒ T ( x , d )) ∧ ∃ d . ( T ( x , d ) ∧ Trans ( x , x ′ ) = ⇒ T ( x ′ , d )) ∧ ( T ( x , d ) = ⇒ ¬ Err ( x )) where d are template parameters. (Graf & Sa¨ ıdi CAV’97, . . . , Reps et al, . . . Brauer et al, . . . , Srivastava et al, . . . ) 8 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Template-Based Synthesis Reduction to first-order logic via templates, e.g. invariant inference: ∀ x , x ′ . min d . ( Init ( x ) = ⇒ T ( x , d )) ∧ ( T ( x , d ) ∧ Trans ( x , x ′ ) = ⇒ T ( x ′ , d )) where d are template parameters. (Graf & Sa¨ ıdi CAV’97, . . . , Reps et al, . . . Brauer et al, . . . , Srivastava et al, . . . ) 8 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Solver Hierarchy verification, synthesis, inference ∃ 2 ∀ 1 min 2 ∀ 1 Eldarica, Spacer, . . . Symba, MathSAT-opt, . . . min 1 ∀ 1 ∃ 1 ∀ 1 CVC4, Z3, MathSAT, . . . ∃ 1 ∃ -propositional MiniSAT, Glucose, . . . 9 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Solver Hierarchy verification, synthesis, inference ∃ 2 ∀ 1 min 2 ∀ 1 Eldarica, Spacer, . . . ——————————————reduction Symba, MathSAT-opt, . . . min 1 ∀ 1 ∃ 1 ∀ 1 CVC4, Z3, MathSAT, . . . ∃ 1 ∃ -propositional MiniSAT, Glucose, . . . 9 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Program Encoding Non-recursive programs with multiple procedures Init ( x in , x ) Out ( x , x out ) � Trans ( x , x ′ ) � Procedure f : , , 10 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Program Encoding Non-recursive programs with multiple procedures Init ( x in , x ) Out ( x , x out ) � Trans ( x , x ′ ) � Procedure f : , , unsigned f( unsigned z) { unsigned w = 0; w 0 = 0 if (z > 0) ∧ g 4 = z > 0 w = h(z); ∧ h 0 ( z , r h 0 ) ∧ w 1 = r h 0 w φ ∧ 2 = g 4 ? w 1 : w 0 r h = x φ return w; ∧ 1 } unsigned h( unsigned y) { unsigned x; g 0 = true for (x=0; ∧ x 0 = 0 g 1 = g 0 ∧ x φ 1 = ( ls 3 ? x lb ∧ 3 : x 0 ) g 2 = ( x φ x < 10; ∧ 1 < 10 ∧ g 1 ) x 2 = x φ x+=y); ∧ 1 + y r h = x φ return x; ∧ 1 } 10 / 24
Introduction 2LS for Program Analysis Encoding Decomposition Lessons Learned Program Encoding Non-recursive programs with multiple procedures Init ( x in , x ) Out ( x , x out ) � Trans ( x , x ′ ) � Procedure f : , , unsigned f( unsigned z) { unsigned w = 0; w 0 = 0 if (z > 0) ∧ g 4 = z > 0 w = h(z); ∧ h 0 ( z , r h 0 ) ∧ w 1 = r h 0 w φ ∧ 2 = g 4 ? w 1 : w 0 r h = x φ return w; ∧ 1 } unsigned h( unsigned y) { unsigned x; g 0 = true for (x=0; ∧ x 0 = 0 g 1 = g 0 ∧ x φ 1 = ( ls 3 ? x lb ∧ 3 : x 0 ) g 2 = ( x φ x < 10; ∧ 1 < 10 ∧ g 1 ) x 2 = x φ x+=y); ∧ 1 + y r h = x φ return x; ∧ 1 } 10 / 24
Recommend
More recommend