Invertibility Conditions for Floating Point Formulas

Slides:



Advertisements
Similar presentations
50.530: Software Engineering
Advertisements

Finding bugs: Analysis Techniques & Tools Symbolic Execution & Constraint Solving CS161 Computer Security Cho, Chia Yuan.
Introduction to Formal Methods for SW and HW Development 09: SAT Based Abstraction/Refinement in Model-Checking Roberto Sebastiani Based on work and slides.
Satisfiability Modulo Theories (An introduction)
SMT Solvers (an extension of SAT) Kenneth Roe. Slide thanks to C. Barrett & S. A. Seshia, ICCAD 2009 Tutorial 2 Boolean Satisfiability (SAT) ⋁ ⋀ ¬ ⋁ ⋀
Timed Automata.
© Anvesh Komuravelli Quantified Invariants in Rich Domains using Model Checking and Abstract Interpretation Anvesh Komuravelli, CMU Joint work with Ken.
Panel on Decision Procedures Panel on Decision Procedures Randal E. Bryant Lintao Zhang Nils Klarlund Harald Ruess Sergey Berezin Rajeev Joshi.
Reduction of Interpolants for Logic Synthesis John Backes Marc Riedel University of Minnesota Dept.
Theoretical Program Checking Greg Bronevetsky. Background The field of Program Checking is about 13 years old. Pioneered by Manuel Blum, Hal Wasserman,
Interpolants [Craig 1957] G(y,z) F(x,y)
1 Predicate Abstraction of ANSI-C Programs using SAT Edmund Clarke Daniel Kroening Natalia Sharygina Karen Yorav (modified by Zaher Andraus for presentation.
SAT-Based Decision Procedures for Subsets of First-Order Logic
On Solving Presburger and Linear Arithmetic with SAT Ofer Strichman Carnegie Mellon University.
Daniel Kroening and Ofer Strichman Decision Procedure
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
Disclosure risk when responding to queries with deterministic guarantees Krish Muralidhar University of Kentucky Rathindra Sarathy Oklahoma State University.
1 MVD 2010 University of Iowa New York University Comparing Proof Systems for Linear Real Arithmetic Using LFSC Andrew Reynolds September 17, 2010.
1 Markov Decision Processes Infinite Horizon Problems Alan Fern * * Based in part on slides by Craig Boutilier and Daniel Weld.
1 Markov Decision Processes Infinite Horizon Problems Alan Fern * * Based in part on slides by Craig Boutilier and Daniel Weld.
Proving Non-Termination Gupta, Henzinger, Majumdar, Rybalchenko, Ru-Gang Xu presentation by erkan.
CSV 889: Concurrent Software Verification Subodh Sharma Indian Institute of Technology Delhi Scalable Symbolic Execution: KLEE.
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
© Anvesh Komuravelli Spacer Model Checking with Proofs and Counterexamples Anvesh Komuravelli Carnegie Mellon University Joint work with Arie Gurfinkel,
Math for CS Fourier Transforms
Solving Equations by Factoring.
CVC4 for Sygus Comp 2017 CVC4 is an SMT solver
Logical path planning Róbert Baláž Technical University of Košice
3.3 Dividing Polynomials.
Automatic Test Generation
CHAPTER 5: Exponential and Logarithmic Functions
SS 2017 Software Verification Bounded Model Checking, Outlook
Further with Hoare Logic Sections 6.12, 6.10, 6.13
Learning Invariants using Decision Trees and Implication Counterexamples Pranav Garg Amazon India.
Solving Equations by Factoring
Inference and search for the propositional satisfiability problem
On the Size of Pairing-based Non-interactive Arguments
Chapter 2 Equations and Inequalities in One Variable
Solver & Optimization Problems
Computability and Complexity
L9Matrix and linear equation
Lazy Proofs for DPLL(T)-Based SMT Solvers
SMT-Based Verification of Parameterized Systems
Revisiting Predicate Logic LN chapters 3,4
Optimizing Big-Data Queries using Program Synthesis
Solving Linear Arithmetic with SAT-based MC
Parametric Symbolic Reachability
Automating Induction for Solving Horn Clauses
Piecewise Linear Neural Network Verification
Lecture 10: Floating Point, Digital Design
Chapter P Prerequisites. Chapter P Prerequisites.
Solve Systems of Linear Equations by Elimination
Sum of Squares, Planted Clique, and Pseudo-Calibration
Digital Signature Schemes and the Random Oracle Model
Solving Equations by Factoring.
Satisfiability Modulo Theories
Propositional Calculus: Boolean Algebra and Simplification
Relatively Complete Refinement Type System for Verification of Higher-Order Non-deterministic Programs Hiroshi Unno (University of Tsukuba) Yuki Satake.
Solving Exponential and Logarithmic Equations
LPSAT: A Unified Approach to RTL Satisfiability
Property Directed Reachability with Word-Level Abstraction
Complexity 6-1 The Class P Complexity Andrei Bulatov.
Lial/Hungerford/Holcomb: Mathematics with Applications 11e Finite Mathematics with Applications 11e Copyright ©2015 Pearson Education, Inc. All right.
Research Status of Equivalence Checking at Zhejiang University
Solving Linear Equations
Solving Linear Equations
Standard Form Quadratic Equation
Predicate Abstraction
Solving Linear Equations
Presentation transcript:

Invertibility Conditions for Floating Point Formulas Aina Niemetz Mathias Preiner Clark Barrett Andrew Reynolds Cesare Tinelli Martin Brain

SMT Solvers for Quantifiers + Floating Points Floating point reasoning in SMT is hard Bit-blasting [Brillout et al 2009, Brain et al 2019] Interval techniques [Brain et al 2014, Marre et al 2017] Quantified reasoning in SMT is hard Heuristic instantiation techniques [deMoura et al 2007] Model-based instantiation for finite domains [Wintersteiger et al 2013] Floating Point + Quantified reasoning in SMT is very hard! …no existing works to our knowledge, despite potential applications Proving safety properties, synthesizing bounding polynomials, …

In This Talk: Towards solving quantified floating points via Invertibility Conditions Extends approach for quantified bit-vectors [Niemetz et al CAV 18] Goal: establish invertibility conditions for theory of floating points Developed custom synthesis framework on top of CVC4SY Preliminary evidence that ICs are useful for solving FP formulas

What is an invertibility condition? Given equation : x. xs~t An invertibility condition is a predicate IC(s,t) that holds exactly when the above formula has a solution for x For example: x. x*2=t  t%2=0 is an invertibility condition for this formula (assuming x,t are integers)

What can we do with Invertibility Conditions? Invertibility conditions can be used for: Local search techniques [Niemetz et al CAV 2016] Accelerate search for satisfiable q.f. inputs Solving quantified formulas Quantifier elimination x. xs~t  IC(s,t) Quantifier instantiation x. (xs~t  P(x))  (IC(s,t)  P(kIC(s,t)))

How do we find Invertibility Conditions? Say I want to find invertibility condition for floating point equation: IC. st:FPe,s. (x:FPe,s.xs~t)  I(s,t)

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FPe,s. (x:FPe,s.xs~t)  IC(s,t) …there exists a predicate IC that is equivalent to x:FPe,s.xs~t

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FPe,s. (x:FPe,s.xs~t)  IC(s,t) … solve via syntax-guided synthesis (SyGuS) solver CVC4SY ? ? SY

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FPe,s. (x:FPe,s.xs~t)  IC(s,t) Challenge #1: problem is parameteric Parameterized by # exponent bits e, # significant bits s

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FP3,5. (x:FP3,5.xs~t)  IC(s,t) Challenge #1: problem is parameteric  Solve for a fixed format, check if solution generalizes [Niemetz et al CAV 2018] Choose e=3, s=5 … large enough to exhibit FP behaviors, small enough for synthesis to scale

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FP3,5. (x:FP3,5.xs~t)  IC(s,t)

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FP3,5. (x:FP3,5.xs~t)  IC(s,t) Challenge #2: problem has three levels of quantifier alternation …SyGuS solvers only typically handle two

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FP3,5. (x:FP,cs~t )  IC(s,t) Challenge #2: problem has three levels of quantifier alternation Expand the innermost quantifier [Niemetz et al CAV 2018] Since domain is (relatively) small and finite Only 227 values for FP3,5 227  c=1

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FP3,5. (x:FP,cs~t )  IC(s,t) Challenge #3 227  c=1 …can now give as input to SyGuS solver

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FP3,5. (x:FP,cs~t )  IC(s,t) Challenge #3: Scalability! With respect to BV synthesis @ 4 bits [Niemetz et al CAV 2018]: Roughly 14 times more constraints, q.f. FP is much harder than BV 227  c=1 SY

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FP3,5. (x:FP,cs~t )  IC(s,t) Challenge #3: Scalability 227  c=1

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FP3,5cs,t  IC(s,t) Challenge #3: Scalability Statically compute the I/O behavior of entire domain of IC(s,t) Each cs,t is determined by a quantifier-free satisfiability query 227*227 = 51529, takes ~10 minutes27 = 51529 sat queries to compute for 2- dimensions of FP3,5 time for formats considered in this paper 227 227   s=1 t=1 x.x*s=t? where s, t are constants

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FP3,5cs,t  IC(s,t) 227 227   s=1 t=1

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FP3,5cs,t  IC(s,t) 227 227   s=1 t=1 Sample c1,2  IC(1,2) c3,7  IC(3,7) c1,7  IC(1,7) … SY Candidate Solutions

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FP3,5cs,t  IC(s,t) 227 227   s=1 t=1 Test (Fast!) Sample c1,2  IC(1,2) c3,7  IC(3,7) c1,7  IC(1,7) … SY Candidate Solutions

How do we find Invertibility Conditions? Can express as a synthesis problem: IC. st:FP3,5cs,t  IC(s,t) 227 227   s=1 t=1 Sample c1,2  IC(1,2) c3,7  IC(3,7) c1,7  IC(1,7) … SY Candidate Solutions “User in the loop”

Visualizing I/O Specs of Invertibility Conditions sub-normal t 227 227   s=1 t=1 Can express as a synthesis problem: IC. st:FP3,5cs,t  IC(s,t) normal t t= White = IC is true, Black = IC is false  Behavior of IC is highly complex! t=NaN

Synthesizing Invertibility Conditions

Synthesizing Invertibility Conditions “Full I/O Specification for IC” (Verifier) (Synthesizer) SY

Synthesizing Invertibility Conditions Initial Examples C Red = Counterexample not specified SY

Synthesizing Invertibility Conditions IC1(s,t) SY

Synthesizing Invertibility Conditions Counterexamples C,C1 Test SY

Synthesizing Invertibility Conditions Counterexamples C,C1,C2 IC2(s,t) SY

Synthesizing Invertibility Conditions Counterexamples C,C1,C2,C3 IC3(s,t) SY

Synthesizing Invertibility Conditions Counterexamples C,C1,C2,C3,C4 IC4(s,t) SY

Synthesizing Invertibility Conditions Counterexamples C,C1,C2,C3,C4,C5 IC5(s,t) SY

Synthesizing Invertibility Conditions Counterexamples C,C1,C2,C3,C4,C5,C6 SY

Synthesizing Invertibility Conditions Counterexamples C,C1,C2,C3,C4,C5,C6 SY

Synthesizing Invertibility Conditions Counterexamples { C | s.t. SC} User may control: Grammar G for synthesizer “Side condition” SC for verifier ? IC(s,t)G SY

Finding Invertibility Conditions: Results In total, found 167 of 188 conditions

Finding Invertibility Conditions: Results In total, found 167 of 188 conditions 14 choices for argument positions of  add1, sub1,2, mult1, div1,2, rem1,2, fma1,3, sqrt1, abs1, neg1, roundToIntegral1 13 choices for ~ =, , , >, <, , isNormal, isSubnormal, isZero, isInfinite, isNaN, isPositive, isNegative 7 additional ICs for equations with only a relation, e.g. x>t  14*13 + 7 = 188 When applicable, ICs hold for each 5 rounding modes {RNE, RNA, RTP, RTN, RTZ} of operator xs~t

Finding Invertibility Conditions: Results In total, found 167 of 188 conditions

Finding Invertibility Conditions: Results Others were hard to find ??? …behavior is pseudo-random!

Do Invertibility Conditions hold for all FP Formats? We checked all 167 invertibility conditions on other FP Formats Targeted formats FP3,5, FP4,5, FP4,6, FP5,11, FP8,24, FP11,53 All invertibility conditions (appear to) generalize to all formats Successful in 94.5% of the above cases using CVC4, Z3 (failures due to timeouts) Approximately 32 days of compute time Future work: Format-Independent Verification!

What can we do with Invertibility Conditions? Floating point invertibility conditions can be used for:  In this paper: Quantifier Elimination Currently limited to “linear” (single variable) quantified floating points Preliminary work in this paper: Implemented prototype preprocessing pass in CVC4 leveraging ICs Led to +7 / 56 quantified FP verification benchmarks from SMT LIB

What can we do with Invertibility Conditions? Summary of intuition:

What can we do with Invertibility Conditions? Summary of intuition: Try inverse in rounding mode R?

What can we do with Invertibility Conditions? Summary of intuition: … Try inverse in rounding mode R? … red = wrong (showing R=RNE)

What can we do with Invertibility Conditions? Summary of intuition:

What can we do with Invertibility Conditions? Summary of intuition: 

What can we do with Invertibility Conditions? Summary of intuition:  Try rounding towards positive

What can we do with Invertibility Conditions? Summary of intuition:  Try rounding towards positive Try rounding towards negative

What can we do with Invertibility Conditions? Summary of intuition:  Try rounding towards positive Try rounding towards negative Corner case, try zero

What can we do with Invertibility Conditions? Similar intuition for many other invertibility conditions: Equation Set of Possible Solutions corner cases for 0, , NaN +

Ongoing Work Integrate invertibility conditions into quantifier instantiation in CVC4 Format-independent verification of invertibility conditions “Towards Bit-Width Independent Proofs in SMT Solvers” [Niemetz et al CADE 2019] Tackle harder synthesis problems using our synthesis framework: Equations that are “non-linear”, e.g. x*x=t Invertibility conditions that have 3+ dimensions ...

Ongoing Work FP equations having 3+ dimensions Thanks for Listening! : time FP equations having 3+ dimensions Fused multiply-add with equality Thanks for Listening!