Introduction to Satisfiability Modulo Theories(SMT).ppt
《Introduction to Satisfiability Modulo Theories(SMT).ppt》由会员分享,可在线阅读,更多相关《Introduction to Satisfiability Modulo Theories(SMT).ppt(65页珍藏版)》请在麦多课文档分享上搜索。
1、Introduction to Satisfiability Modulo Theories (SMT),Clark Barrett, NYU Sanjit A. Seshia, UC Berkeley,ICCAD TutorialNovember 2, 2009,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,2,Boolean Satisfiability (SAT),:,. . .,p2,p1,pn,Is there an assignment to the p1, p2, , pn variables such that evaluates
2、to 1?,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,3,Satisfiability Modulo Theories,:,. . .,p2,p1,pn,Is there an assignment to the x,y,z,w variables s.t. evaluates to 1?,x + 2 z 1,x % 26 = v,w & 0xFFFF = x,x = y,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,4,Satisfiability Modulo Theories,Given a
3、formula in first-order logic, with associated background theories, is the formula satisfiable? Yes: return a satisfying solution No generate a proof of unsatisfiability,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,5,Applications of SMT,Hardware verification at higher levels of abstraction (RTL and
4、above) Verification of analog/mixed-signal circuits Verification of hybrid systems Software model checking Software testing Security: Finding vulnerabilities, verifying electronic voting machines, Program synthesis ,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,6,References,Satisfiability Modulo The
5、ories Clark Barrett, Roberto Sebastiani, Sanjit A. Seshia, and Cesare Tinelli. Chapter 8 in the Handbook of Satisfiability, Armin Biere, Hans van Maaren, and Toby Walsh, editors, IOS Press, 2009. (available from our webpages)SMTLIB: A repository for SMT formulas (common format) and tools SMTCOMP: An
6、 annual competition of SMT solvers,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,7,Roadmap for this Tutorial,Background and Notation Survey of Theories Theory Solvers Approaches to SMT Solving Lazy Encoding to SAT Eager Encoding to SAT Conclusion,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,8,Roadm
7、ap for this Tutorial,Background and Notation Survey of Theories Theory Solvers Approaches to SMT Solving Lazy Encoding to SAT Eager Encoding to SAT Conclusion,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,9,First-Order Logic,A formal notation for mathematics, with expressions involving Propositional
8、 symbols Predicates Functions and constant symbols Quantifiers In contrast, propositional (Boolean) logic only involves propositional symbols and operators,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,10,First-Order Logic: Syntax,As with propositional logic, expressions in first-order logic are mad
9、e up of sequences of symbols. Symbols are divided into logical symbols and non-logical symbols or parameters. Example:(x = y) (y = z) (f(z) f(x)+1),C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,11,First-Order Logic: Syntax,Logical Symbols Propositional connectives: , , :, !, $ Variables: v1, v2, . .
10、 . Quantifiers: 8, 9 Non-logical symbols/Parameters Equality: = Functions: +, -, %, bit-wise &, f(), concat, Predicates: , is_substring, Constant symbols: 0, 1.0, null, ,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,12,Quantifier-free Subset,We will largely restrict ourselves to formulas without qua
11、ntifiers (8, 9) This is called the quantifier-free subset/fragment of first-order logic with the relevant theory,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,13,Logical Theory,Defines a set of parameters (non-logical symbols) and their meanings This definition is called a signature. Example of a si
12、gnature:Theory of linear arithmetic over integersSignature is (0,1,+,-,) interpreted over Z,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,14,Roadmap for this Tutorial,Background and Notation Survey of Theories Theory Solvers Two Approaches to SMT Solving Lazy Encoding to SAT Eager Encoding to SAT Co
13、nclusion,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,15,Some Useful Theories,Equality (with uninterpreted functions) Linear arithmetic (over Q or Z) Difference logic (over Q or Z) Finite-precision bit-vectors integer or floating-point Arrays / memories Misc.: Non-linear arithmetic, strings, induct
14、ive datatypes (e.g. lists), sets, ,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,16,Theory of Equality and Uninterpreted Functions (EUF),Also called the “free theory” Because function symbols can take any meaning Only property required is congruence: that these symbols map identical arguments to ide
15、ntical values i.e., x = y ) f(x) = f(y) SMTLIB name: QF_UF,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,17,Data and Function Abstraction with EUF,Common Operations,10,x,y,p,ITE(p, x, y),If-then-else,x,y,x = y,=,Test for equality,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,18,Hardware Abstraction
16、with EUF,For any Block that Transforms or Evaluates Data: Replace with generic, unspecified function Also view instruction memory as function,F2,F1,F3,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,19,Example QF_UF (EUF) Formula,(x = y) (y = z) (f(x) f(z)Transitivity: (x = y) (y = z) ) (x = z)Congrue
17、nce:(x = z) ) (f(x) = f(z),C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,20,Equivalence Checking of Program Fragments,int fun1(int y) int x, z;z = y;y = x;x = z;return x*x; ,int fun2(int y) return y*y; ,What if we use SAT to check equivalence?,SMT formula Satisfiable iff programs non-equivalent( z =
18、 y y1 = x x1 = z ret1 = x1*x1) ( ret2 = y*y ) ( ret1 ret2 ),C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,21,Equivalence Checking of Program Fragments,int fun1(int y) int x, z;z = y;y = x;x = z;return x*x; ,int fun2(int y) return y*y; ,SMT formula Satisfiable iff programs non-equivalent( z = y y1 =
19、x x1 = z ret1 = x1*x1) ( ret2 = y*y ) ( ret1 ret2 ),Using SAT to check equivalence (w/ Minisat)32 bits for y: Did not finish in over 5 hours16 bits for y: 37 sec.8 bits for y: 0.5 sec.,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,22,Equivalence Checking of Program Fragments,int fun1(int y) int x, z
20、;z = y;y = x;x = z;return x*x; ,int fun2(int y) return y*y; ,SMT formula ( z = y y1 = x x1 = z ret1 = sq(x1) ) ( ret2 = sq(y) ) ( ret1 ret2 ),Using EUF solver: 0.01 sec,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,23,Equivalence Checking of Program Fragments,int fun1(int y) int x;x = x y;y = x y;x
21、= x y;return x*x; ,int fun2(int y) return y*y; ,Does EUF still work?,No! Must reason about bit-wise XOR.Need a solver for bit-vector arithmetic.Solvable in less than a sec. with a current bit-vector solver.,C. Barrett & S. A. Seshia,ICCAD 2009 Tutorial,24,Finite-Precision Bit-Vector Arithmetic (QF_B
22、V),Fixed width data words Can model int, short, long, etc. Arithmetic operations E.g., add/subtract/multiply/divide & comparisons Twos complement and unsigned operations Bit-wise logical operations E.g., and/or/xor, shift/extract and equality Boolean connectives,C. Barrett & S. A. Seshia,ICCAD 2009
23、Tutorial,25,Linear Arithmetic (QF_LRA, QF_LIA),Boolean combination of linear constraints of the form(a1 x1 + a2 x2 + + an xn b) xis could be in Q or Z , 2 ,=Many applications, including: Verification of analog circuits Software verification, e.g., of array bounds,C. Barrett & S. A. Seshia,ICCAD 2009
24、 Tutorial,26,Difference Logic (QF_IDL, QF_RDL),Boolean combination of linear constraints of the formxi - xj cij or xi ci 2 ,=, xis in Q or Z Applications: Software verification (most linear constraints are of this form) Processor datapath verification Job shop scheduling / real-time systems Timing v
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- INTRODUCTIONTOSATISFIABILITYMODULOTHEORIESSMTPPT

链接地址:http://www.mydoc123.com/p-376714.html