Introduction to Z3. Bow-Yaw Wang. December 19, Institute of Information Science Academia Sinica, Taiwan
|
|
- Howard Mills
- 6 years ago
- Views:
Transcription
1 Introduction to Z3 Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan December 19, 2017 Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
2 Outline 1 Introduction to Z3 Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
3 SMT Solvers I SAT solvers have been used in hardware verification. Propositional logic suffices to model digital circuits. Can we use SAT solvers to verify programs? Not really. In general, we need predicate logic with mathematical vocabulary. The problem is undecidable. However, there are tools that can help us solve simple cases. Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
4 SMT Solvers II Satisfiability Modulo Theories (SMT) solvers are SAT solvers extended with various theories. For instance, theories of linear arithmetic, uninterpreted functions, etc. Such theories allow us to verify properties about programs. The basic idea is not complicated. In addition to propositional atoms, we introduce predicate symbols as new propositional atoms. Efficient SAT algorithms can still be used on top of these propositional atoms. In fact, many SMT solvers are based on SAT solvers. Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
5 SMT Solvers III Similar to SAT solvers, there is a competition for SMT solvers. Recent SMT solvers thus adopt the SMT-LIB input format. In the following, we will introduce the SMT solver Z3. Z3 is developed at Microsoft Research. Source codes are available. We will use its Python interface in class. Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
6 Using Z3 in Python from z3 import # i mport Z3 l i b r a r y s = S o l v e r ( ) # c r e a t e an SMT s o l v e r s p r i n t s. check ( ) # check s a t i s f i a b i l i t y p r i n t s. model ( ) # o b t a i n a model We first import Z3 Python library. Remember to add your Z3 Python path to PYTHONPATH. The Z3 solver checks whether the conjunction of formulae is satisfiable. When there is no formula, the degenerated conjunction is true. The empty model suffices to satisfy the degenerated conjunction. Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
7 Equational Theory I from z3 import s = S o l v e r ( ) m = I n t ( M ) c r e a t e the i n t e g e r c o n s t a n t M n = I n t ( N ) c r e a t e the i n t e g e r c o n s t a n t N s. add (m == n ) add the f o r m u l a M = N p r i n t s. check ( ) i f s. check ( ) == s a t : p r i n t s. model ( ) The Python variable m contains a Z3 Boolean constant M. The Python variable n contains a Z3 Boolean constant N. m == n is the Z3 formula for M = N. Clearly, M = N is satisfiable. The model [ N = 0, M = 0 ] is returned. Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
8 Boolean Theory I from z3 import s = S o l v e r ( ) x = Bool ( X ) # c r e a t e the Boolean c o n s t a n t X s. add ( Not ( x ) ) # add the f o r m u l a X p r i n t s. check ( ) i f s. check ( ) == s a t : p r i n t s. model ( ) Not(x) is the Z3 formula for X. The formula X is satisfiable. The model [ X = False ] is returned. Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
9 Boolean Theory II from z3 import s = S o l v e r ( ) x = Bool ( X ) s. add ( Not ( x ) ) s. add ( x ) # add the f o r m u l a X p r i n t s. check ( ) i f s. check ( ) == s a t : p r i n t s. model ( ) The formulae X and X is not satisfiable. What if we ask Z3 to give a model? Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
10 Boolean Theory III Boolean sort: BoolSort() Boolean values: BoolVal(False), BoolVal(True) False and True are Python Boolean values Constant declaration: Bool(name) or Bools(names) Unary operator: Not (negation) Binary operators: Or (disjunction), And (conjunction), Xor (exclusive or), Implies (implication) Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
11 Boolean Theory IV 3 P i g e o n s to l i v e i n 2 h o l e s from z3 import s = S o l v e r ( ) p i g e o n s = [ B o o l V e c t o r ( P, 2 ), B o o l V e c t o r ( Q, 2 ), B o o l V e c t o r ( R, 2) ] each p i g e o n must l i v e i n one h o l e s. add ( Or ( p i g e o n s [ 0 ] [ 0 ], p i g e o n s [ 0 ] [ 1 ] ) ) s. add ( Or ( p i g e o n s [ 1 ] [ 0 ], p i g e o n s [ 1 ] [ 1 ] ) ) s. add ( Or ( p i g e o n s [ 2 ] [ 0 ], p i g e o n s [ 2 ] [ 1 ] ) ) a h o l e r e c e i v e s a t most one p i g e o n s. add ( And ( Or ( Not ( p i g e o n s [ 0 ] [ 0 ] ), Not ( p i g e o n s [ 1 ] [ 0 ] ) ), Or ( Not ( p i g e o n s [ 0 ] [ 0 ] ), Not ( p i g e o n s [ 2 ] [ 0 ] ) ), Or ( Not ( p i g e o n s [ 1 ] [ 0 ] ), Not ( p i g e o n s [ 2 ] [ 0 ] ) ) ) ) s. add ( And ( Or ( Not ( p i g e o n s [ 0 ] [ 1 ] ), Not ( p i g e o n s [ 1 ] [ 1 ] ) ), Or ( Not ( p i g e o n s [ 0 ] [ 1 ] ), Not ( p i g e o n s [ 2 ] [ 1 ] ) ), Or ( Not ( p i g e o n s [ 1 ] [ 1 ] ), Not ( p i g e o n s [ 2 ] [ 1 ] ) ) ) ) p r i n t s. check ( ) Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
12 Arithmetic Theory I from z3 import s = S o l v e r ( ) i = I n t ( I ) x = Real ( X ) s. add ( i < x ) s. add ( x < i + 1) p r i n t s. check ( ) i f s. check ( ) == s a t : p r i n t s. model ( ) Z3 supports integer and real numbers. Int( I ) declares a Z3 integer constant named I. Real( X ) declares a Z3 real constant named X. We can use Python arithmetic expressions as Z3. The Z3 Python module overloads arithmetic functions. Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
13 Arithmetic Theory II Integer sort: IntSort(), RealSort() Integer values: IntVal(value), RealVal(value) Constant declaration: Int(name) or Real(name) Binary operators: +,,, /, and %. Binary relations: <, <=, >, and >=. Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
14 Bitvector Theory I from z3 import s = S o l v e r ( ) # c r e a t e a 32 b i t b i t v e c t o r c o n s t a n t X x = BitVec ( x, 16) s. add ( x > 0) s. add ( x & ( x 1) == 0) # a t r i c k to f i n d a l l s o l u t i o n s w h i l e s. check ( ) == s a t : p r i n t s. model ( ) [ x ] s. add ( x!= s. model ( ) [ x ] ) Z3 supports bit-vectors. BitVec( x, 16) declares a 16-bit bit-vector constant named x. Again, Python bit-vector expressions are overloaded to construct Z3 bit-vector expressions. Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
15 Bitvector Theory II Sort declaration: BitVecSort(width) Constant declaration: BitVec(name,width) Binary operators: & (bitwise-and), (bitwise-or), (bitwise-invert), ˆ (exclusive-or), +,,, /, %, >> (right-shift), and << (left-shift). Binary relations: <, <=, >, and >=. Additional functions: Concat(bitvecs) represents the concatenation of a list of bit-vectors. Extract(high, low, bitvec) represents a sub bit-vector of bitvec. RotateLeft(bitvec, r) represents the left rotation of bitvec. RotateRight(bitvec, r) represents the right rotation of bitvec. Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
16 Theory of Uninterpreted Functions I from z3 import # d e c l a r e an unknown s o r t o f u n i v e r s e U = D e c l a r e S o r t ( U ) # a and b a r e c o n s t a n t s o f s o r t U a, b = Const ( a, U), Const ( b, U) # f i s an u n t e r p r e t e d f u n c t i o n from U U to U f = F u n c t i o n ( f, U, U, U) s = S o l v e r ( ) s. add ( f ( a, b ) == a ) p r i n t s. check ( ) s. add ( f ( f ( a, b ), b )!= a ) p r i n t s. check ( ) Z3 allows uninterpreted functions. An uninterpreted function need not be fully specified. If a b, f (a, a) can take any value in U. However, Z3 deduces f (f (a, b), b) = a from f (a, b) = a. Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
17 Theory of Uninterpreted Functions II Sort declaration: DeclareSort(name) Constant declaration: Const(name, sort) Uninterpreted function declaration: Function(name, domainsorts, rangesort) Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
18 Save and Restore Context from z3 import s = S o l v e r ( ) x = Bool ( X ) s. add ( Not ( x ) ) p r i n t s. check ( ) i f s. check ( ) == s a t : p r i n t s. model ( ) s. push ( ) # s a v e t h e c u r r e n t c o n t e x t s. add ( x == BoolVal ( True ) ) p r i n t s. check ( ) i f s. check ( ) == s a t : p r i n t s. model ( ) s. pop ( ) # r e s t o r e t h e s a v e d c o n t e x t p r i n t s. check ( ) i f s. check ( ) == s a t : p r i n t s. model ( ) How do you simulate push and pop in MiniSAT? Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
19 McCarthy91 i n t mccarthy91 ( i n t n ) { i n t c ; i n t r e t ; r e t = n ; c = 1 ; w h i l e ( c > 0) { i f ( r e t > 100) { r e t = r e t 1 0 ; c ; } e l s e { r e t = r e t ; c++; } } r e t u r n r e t ; } For n 100, mccarthy91(n) is 91. For n > 100, mccarthy91(n) is n 10. Let us try to find an invariant to prove it! Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
20 Invariant for McCarthy 91 I First, we will set up pre- and post-conditions. Immediately before entering the loop, we have ret = n c = 1. from z3 import n = I n t ( n ) r e t = I n t ( r e t ) c = I n t ( c ) s o l v e r = S o l v e r ( ) This is represented by And(ret == n, c == 1). Immediately after leaving the loop, we want to show (n 100 ret = 91) (n > 100 ret = n 10). This is represented by And(Implies(n <= 100, ret == 91), Implies(n > 100, ret == n 10)). Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
21 Invariant for McCarthy 91 II Any invariant η must have AR ret = n c = 1 η; AR η (c > 0) [(n 100 ret = 91) (n > 100 ret = n 10)]; and finally, ( η c > 0 ) if (ret > 100) { ret = ret 10; c ; } else { ret = ret + 11; c + +; } ( η ) Suppose we come up with an η and express it in Z3 Python. How do we use Z3 to check them? Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
22 Invariant for McCarthy 91 III The first two requirements are similar. They are of the form AR φ ψ. It is equivalent to φ ψ is not satisfiable. We use the following Python code: d e f c h e c k i m p l i e s ( phi, p s i ) : s o l v e r. push ( ) f = And ( phi, Not ( p s i ) ) s o l v e r. add ( f ) r e s u l t = s o l v e r. check ( ) s o l v e r. pop ( ) r e t u r n r e s u l t!= s a t Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
23 Invariant for McCarthy 91 IV For the last requirement, note that ret > 100 η[c c 1][ret ret 10] ( (ret > 100) η[c c + 1][ret ret + 11] if (ret > 100) { ( η[c c 1][ret ret 10] ) ret = ret 10; ( η[c c 1] ) c ; ( η ) } else { ( η[c c + 1][ret ret + 11] ) ret = ret + 11; ( η[c c + 1] ) c + +; ( η ) } ( η ) ) Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
24 Invariant for McCarthy 91 V Hence it suffices to check AR η c > 0 ( ret > 100 η[c c 1][ret ret 10] (ret > 100) η[c c + 1][ret ret + 11] ) When we guess an η, we can check the last requirement after performing 4 substitutions. Luckily, Z3 Python can do substitutions for us. d e f r e q u i r e m e n t 3 ( e t a ) : b t r u e = I m p l i e s ( r e t > 100, s u b s t i t u t e ( s u b s t i t u t e ( eta, ( c, c 1 ) ), ( r e t, r e t 1 0 ) ) ) b f a l s e = I m p l i e s ( Not ( r e t > ), s u b s t i t u t e ( s u b s t i t u t e ( eta, ( c, c + 1 ) ), ( r e t, r e t ) ) ) r e t u r n c h e c k i m p l i e s ( And ( Not ( c > 0 ), e t a ), And ( b t r u e, b f a l s e ) ) Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
25 Invariant for McCarthy 91 VI We have almost everything except η. Here is what we will do: Guess η and express it in Z3 Python. Use Z3 Python to check the three requirements on η. If all three requirements pass, we are done. Otherwise, guess another η and repeat. Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
26 Invariant for McCarthy 91 VII It may be too hard to guess η for all input n. We hence consider two sub-problems: ( n > 100 )ret = mccarthy91(n)( ret = n 10 ); and ( n 100 )ret = mccarthy91(n)( ret = 91 ) Try to find an invariant for each sub-problem. Then combine two sub-invariants into one for the main problem. Have fun! Bow-Yaw Wang (Academia Sinica) Introduction to Z3 December 19, / 26
An Introduction to Z3
An Introduction to Z3 Huixing Fang National Trusted Embedded Software Engineering Technology Research Center April 12, 2017 Outline 1 SMT 2 Z3 Huixing Fang (ECNU) An Introduction to Z3 April 12, 2017 2
More informationCSE 20 DISCRETE MATH. Fall
CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Today's learning goals Describe and use algorithms for integer operations based on their expansions Relate algorithms for integer
More informationProof Calculus for Partial Correctness
Proof Calculus for Partial Correctness Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan September 7, 2016 Bow-Yaw Wang (Academia Sinica) Proof Calculus for Partial Correctness September
More informationSMT BASICS WS 2017/2018 ( ) LOGIC SATISFIABILITY MODULO THEORIES. Institute for Formal Models and Verification Johannes Kepler Universität Linz
LOGIC SATISFIABILITY MODULO THEORIES SMT BASICS WS 2017/2018 (342.208) Armin Biere Martina Seidl biere@jku.at martina.seidl@jku.at Institute for Formal Models and Verification Johannes Kepler Universität
More informationSatisfiability Modulo Theories (SMT)
CS510 Software Engineering Satisfiability Modulo Theories (SMT) Slides modified from those by Aarti Gupta Textbook: The Calculus of Computation by A. Bradley and Z. Manna 1 Satisfiability Modulo Theory
More informationNormal Forms of Propositional Logic
Normal Forms of Propositional Logic Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan September 12, 2017 Bow-Yaw Wang (Academia Sinica) Normal Forms of Propositional Logic September
More informationChapter 4: Classical Propositional Semantics
Chapter 4: Classical Propositional Semantics Language : L {,,, }. Classical Semantics assumptions: TWO VALUES: there are only two logical values: truth (T) and false (F), and EXTENSIONALITY: the logical
More informationDiscrete Mathematics and Its Applications
Discrete Mathematics and Its Applications Lecture 1: Proposition logic MING GAO DASE @ ECNU (for course related communications) mgao@dase.ecnu.edu.cn Sep. 12, 2017 Outline 1 Propositions 2 Connectives
More informationCSE507. Satisfiability Modulo Theories. Computer-Aided Reasoning for Software. Emina Torlak
Computer-Aided Reasoning for Software CSE507 Satisfiability Modulo Theories courses.cs.washington.edu/courses/cse507/18sp/ Emina Torlak emina@cs.washington.edu Today Last lecture Practical applications
More informationLecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)
Lecture 2 Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits Reading (Epp s textbook) 2.1-2.4 1 Logic Logic is a system based on statements. A statement (or
More informationNatural Deduction for Propositional Logic
Natural Deduction for Propositional Logic Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan September 10, 2018 Bow-Yaw Wang (Academia Sinica) Natural Deduction for Propositional Logic
More informationFirst-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig
First-Order Logic First-Order Theories Roopsha Samanta Partly based on slides by Aaron Bradley and Isil Dillig Roadmap Review: propositional logic Syntax and semantics of first-order logic (FOL) Semantic
More informationInterpolation. Seminar Slides. Betim Musa. 27 th June Albert-Ludwigs-Universität Freiburg
Interpolation Seminar Slides Albert-Ludwigs-Universität Freiburg Betim Musa 27 th June 2015 Motivation program add(int a, int b) { var x,i : int; l 0 assume(b 0); l 1 x := a; l 2 i := 0; while(i < b) {
More informationPropositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.
Propositional Logic Winter 2012 Propositional Logic: Section 1.1 Proposition A proposition is a declarative sentence that is either true or false. Which ones of the following sentences are propositions?
More informationTutorial 1: Modern SMT Solvers and Verification
University of Illinois at Urbana-Champaign Tutorial 1: Modern SMT Solvers and Verification Sayan Mitra Electrical & Computer Engineering Coordinated Science Laboratory University of Illinois at Urbana
More informationFormal Modeling with Propositional Logic
Formal Modeling with Propositional Logic Assaf Kfoury February 6, 2017 (last modified: September 3, 2018) Contents 1 The Pigeon Hole Principle 2 2 Graph Problems 3 2.1 Paths in Directed Graphs..................................
More informationXI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.
2017-18 XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL HALF ADDER 1. The circuit that performs addition within the Arithmetic and Logic Unit of the CPU are called adders. 2. A unit that adds two
More informationPropositional Calculus
Propositional Calculus Dr. Neil T. Dantam CSCI-498/598 RPM, Colorado School of Mines Spring 2018 Dantam (Mines CSCI, RPM) Propositional Calculus Spring 2018 1 / 64 Calculus? Definition: Calculus A well
More informationMAT2345 Discrete Math
Fall 2013 General Syllabus Schedule (note exam dates) Homework, Worksheets, Quizzes, and possibly Programs & Reports Academic Integrity Do Your Own Work Course Web Site: www.eiu.edu/~mathcs Course Overview
More informationThe Coq Proof Assistant
The Coq Proof Assistant Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan October 15, 2018 Bow-Yaw Wang (Academia Sinica) The Coq Proof Assistant October 15, 2018 1 / 59 Outline 1 The
More informationLogic and Boolean algebra
Computer Mathematics Week 7 Logic and Boolean algebra College of Information Science and Engineering Ritsumeikan University last week coding theory channel coding information theory concept Hamming distance
More informationSAT/SMT/AR Introduction and Applications
SAT/SMT/AR Introduction and Applications Ákos Hajdu Budapest University of Technology and Economics Department of Measurement and Information Systems 1 Ákos Hajdu About me o PhD student at BME MIT (2016
More informationDISCRETE STRUCTURES WEEK5 LECTURE1
DISCRETE STRUCTURES WEEK5 LECTURE1 Let s get started with... Logic! Spring 2010 CPCS 222 - Discrete Structures 2 Logic Crucial for mathematical reasoning Important for program design Used for designing
More informationLogic Synthesis and Verification
Logic Synthesis and Verification Boolean Algebra Jie-Hong Roland Jiang 江介宏 Department of Electrical Engineering National Taiwan University Fall 2014 1 2 Boolean Algebra Reading F. M. Brown. Boolean Reasoning:
More informationBoolean algebra. Values
Boolean algebra 1854 by George Boole in his book An Investigation of the Laws of Thought, is a variant of ordinary elementary algebra differing in its values, operations, and laws. Instead of the usual
More informationLogic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies
Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies Valentin Stockholm University September 2016 Propositions Proposition:
More informationComp487/587 - Boolean Formulas
Comp487/587 - Boolean Formulas 1 Logic and SAT 1.1 What is a Boolean Formula Logic is a way through which we can analyze and reason about simple or complicated events. In particular, we are interested
More informationNote: The area of logic that deals with propositions is called the propositional calculus or propositional logic.
Ch. 1.1 Logic Logic 1 Def. A Proposition is a statement that is either true or false. Example 1: Which of the following are propositions? Statement Proposition (yes or no) UHD is a University 1 + 3 = 0
More informationSatisfiability Modulo Theories
Satisfiability Modulo Theories Bruno Dutertre SRI International Leonardo de Moura Microsoft Research Satisfiability a > b + 2, a = 2c + 10, c + b 1000 SAT a = 0, b = 3, c = 5 Model 0 > 3 + 2, 0 = 2 5 +
More informationCSE 1400 Applied Discrete Mathematics Definitions
CSE 1400 Applied Discrete Mathematics Definitions Department of Computer Sciences College of Engineering Florida Tech Fall 2011 Arithmetic 1 Alphabets, Strings, Languages, & Words 2 Number Systems 3 Machine
More informationSatisfiability Modulo Theories
Satisfiability Modulo Theories Summer School on Formal Methods Menlo College, 2011 Bruno Dutertre and Leonardo de Moura bruno@csl.sri.com, leonardo@microsoft.com SRI International, Microsoft Research SAT/SMT
More informationBuilding a Computer Adder
Logic Gates are used to translate Boolean logic into circuits. In the abstract it is clear that we can build AND gates that perform the AND function and OR gates that perform the OR function and so on.
More informationECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates
ECE 250 / CPS 250 Computer Architecture Basics of Logic Design Boolean Algebra, Logic Gates Benjamin Lee Slides based on those from Andrew Hilton (Duke), Alvy Lebeck (Duke) Benjamin Lee (Duke), and Amir
More informationIntroduction to Artificial Intelligence Propositional Logic & SAT Solving. UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010
Introduction to Artificial Intelligence Propositional Logic & SAT Solving UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010 Today Representation in Propositional Logic Semantics & Deduction
More informationPROPOSITIONAL LOGIC. VL Logik: WS 2018/19
PROPOSITIONAL LOGIC VL Logik: WS 2018/19 (Version 2018.2) Martina Seidl (martina.seidl@jku.at), Armin Biere (biere@jku.at) Institut für Formale Modelle und Verifikation BOX Game: Rules 1. The game board
More informationChapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin
Chapter 0 Introduction Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin October 2014 Automata Theory 2 of 22 Automata theory deals
More informationLOGIC PROPOSITIONAL REASONING
LOGIC PROPOSITIONAL REASONING WS 2017/2018 (342.208) Armin Biere Martina Seidl biere@jku.at martina.seidl@jku.at Institute for Formal Models and Verification Johannes Kepler Universität Linz Version 2018.1
More informationPropositional Logic: Evaluating the Formulas
Institute for Formal Models and Verification Johannes Kepler University Linz VL Logik (LVA-Nr. 342208) Winter Semester 2015/2016 Propositional Logic: Evaluating the Formulas Version 2015.2 Armin Biere
More informationConstraint Solving for Finite Model Finding in SMT Solvers
myjournal manuscript No. (will be inserted by the editor) Constraint Solving for Finite Model Finding in SMT Solvers Andrew Reynolds Cesare Tinelli Clark Barrett Received: date / Accepted: date Abstract
More informationChapter 2: Switching Algebra and Logic Circuits
Chapter 2: Switching Algebra and Logic Circuits Formal Foundation of Digital Design In 1854 George Boole published An investigation into the Laws of Thoughts Algebraic system with two values 0 and 1 Used
More informationA Little Logic. Propositional Logic. Satisfiability Problems. Solving Sudokus. First Order Logic. Logic Programming
A Little Logic International Center for Computational Logic Technische Universität Dresden Germany Propositional Logic Satisfiability Problems Solving Sudokus First Order Logic Logic Programming A Little
More informationEqualities and Uninterpreted Functions. Chapter 3. Decision Procedures. An Algorithmic Point of View. Revision 1.0
Equalities and Uninterpreted Functions Chapter 3 Decision Procedures An Algorithmic Point of View D.Kroening O.Strichman Revision 1.0 Outline Decision Procedures Equalities and Uninterpreted Functions
More informationCompound Propositions
Discrete Structures Compound Propositions Producing new propositions from existing propositions. Logical Operators or Connectives 1. Not 2. And 3. Or 4. Exclusive or 5. Implication 6. Biconditional Truth
More informationHW1 graded review form? HW2 released CSE 20 DISCRETE MATH. Fall
CSE 20 HW1 graded review form? HW2 released DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Today's learning goals Translate sentences from English to propositional logic using appropriate
More informationECE/CS 250 Computer Architecture
ECE/CS 250 Computer Architecture Basics of Logic Design: Boolean Algebra, Logic Gates (Combinational Logic) Tyler Bletsch Duke University Slides are derived from work by Daniel J. Sorin (Duke), Alvy Lebeck
More informationComputer Organization: Boolean Logic
Computer Organization: Boolean Logic Representing and Manipulating Data Last Unit How to represent data as a sequence of bits How to interpret bit representations Use of levels of abstraction in representing
More informationPacket #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics
CSC 224/226 Notes Packet #2: Set Theory & Predicate Calculus Barnes Packet #2: Set Theory & Predicate Calculus Applied Discrete Mathematics Table of Contents Full Adder Information Page 1 Predicate Calculus
More informationLogic. Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another.
Math 0413 Appendix A.0 Logic Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another. This type of logic is called propositional.
More informationTDDD08 Tutorial 1. Who? From? When? 6 september Victor Lagerkvist (& Wªodek Drabent)
TDDD08 Tutorial 1 Who? From? Victor Lagerkvist (& Wªodek Drabent) Theoretical Computer Science Laboratory, Linköpings Universitet, Sweden When? 6 september 2015 1 / 18 Preparations Before you start with
More informationConjunction: p q is true if both p, q are true, and false if at least one of p, q is false. The truth table for conjunction is as follows.
Chapter 1 Logic 1.1 Introduction and Definitions Definitions. A sentence (statement, proposition) is an utterance (that is, a string of characters) which is either true (T) or false (F). A predicate is
More informationSample Problems for all sections of CMSC250, Midterm 1 Fall 2014
Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014 1. Translate each of the following English sentences into formal statements using the logical operators (,,,,, and ). You may also use mathematical
More informationSymbolic Analysis. Xiangyu Zhang
Symbolic Analysis Xiangyu Zhang What is Symbolic Analysis CS510 S o f t w a r e E n g i n e e r i n g Static analysis considers all paths are feasible Dynamic considers one path or a number of paths Symbolic
More information1.1 Statements and Compound Statements
Chapter 1 Propositional Logic 1.1 Statements and Compound Statements A statement or proposition is an assertion which is either true or false, though you may not know which. That is, a statement is something
More informationcse541 LOGIC FOR COMPUTER SCIENCE
cse541 LOGIC FOR COMPUTER SCIENCE Professor Anita Wasilewska Spring 2015 LECTURE 2 Chapter 2 Introduction to Classical Propositional Logic PART 1: Classical Propositional Model Assumptions PART 2: Syntax
More informationChapter 2: Introduction to Propositional Logic
Chapter 2: Introduction to Propositional Logic PART ONE: History and Motivation Origins: Stoic school of philosophy (3rd century B.C.), with the most eminent representative was Chryssipus. Modern Origins:
More informationChapter 4, Logic using Propositional Calculus Handout
ECS 20 Chapter 4, Logic using Propositional Calculus Handout 0. Introduction to Discrete Mathematics. 0.1. Discrete = Individually separate and distinct as opposed to continuous and capable of infinitesimal
More information4 Switching Algebra 4.1 Axioms; Signals and Switching Algebra
4 Switching Algebra 4.1 Axioms; Signals and Switching Algebra To design a digital circuit that will perform a required function, it is necessary to manipulate and combine the various input signals in certain
More informationSAT Modulo Monotonic Theories
SAT Modulo Monotonic Theories Sam Bayless, Noah Bayless, Holger H. Hoos, Alan J. Hu University of British Columbia Point Grey Secondary School Sam Bayless (UBC) SAT Modulo Monotonic Theories / 0 Procedural
More informationVerification using Satisfiability Checking, Predicate Abstraction, and Craig Interpolation. Himanshu Jain THESIS ORAL TALK
Verification using Satisfiability Checking, Predicate Abstraction, and Craig Interpolation Himanshu Jain THESIS ORAL TALK 1 Computer Systems are Pervasive Computer Systems = Software + Hardware Software/Hardware
More informationScalable and Accurate Verification of Data Flow Systems. Cesare Tinelli The University of Iowa
Scalable and Accurate Verification of Data Flow Systems Cesare Tinelli The University of Iowa Overview AFOSR Supported Research Collaborations NYU (project partner) Chalmers University (research collaborator)
More informationPart Two: The Basic Components of the SOFL Specification Language
Part Two: The Basic Components of the SOFL Specification Language SOFL logic Module Condition Data Flow Diagrams Process specification Function definition and specification Process decomposition Other
More informationCS 220: Discrete Structures and their Applications. Propositional Logic Sections in zybooks
CS 220: Discrete Structures and their Applications Propositional Logic Sections 1.1-1.2 in zybooks Logic in computer science Used in many areas of computer science: ü Booleans and Boolean expressions in
More informationExample. Logic. Logical Statements. Outline of logic topics. Logical Connectives. Logical Connectives
Logic Logic is study of abstract reasoning, specifically, concerned with whether reasoning is correct. Logic focuses on relationship among statements as opposed to the content of any particular statement.
More informationWhy Learning Logic? Logic. Propositional Logic. Compound Propositions
Logic Objectives Propositions and compound propositions Negation, conjunction, disjunction, and exclusive or Implication and biconditional Logic equivalence and satisfiability Application of propositional
More informationTopics in Model-Based Reasoning
Towards Integration of Proving and Solving Dipartimento di Informatica Università degli Studi di Verona Verona, Italy March, 2014 Automated reasoning Artificial Intelligence Automated Reasoning Computational
More informationPacket #1: Logic & Proofs. Applied Discrete Mathematics
Packet #1: Logic & Proofs Applied Discrete Mathematics Table of Contents Course Objectives Page 2 Propositional Calculus Information Pages 3-13 Course Objectives At the conclusion of this course, you should
More informationLogical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional
Logical Operators Conjunction Disjunction Negation Exclusive Or Implication Biconditional 1 Statement meaning p q p implies q if p, then q if p, q when p, q whenever p, q q if p q when p q whenever p p
More informationTecniche di Verifica. Introduction to Propositional Logic
Tecniche di Verifica Introduction to Propositional Logic 1 Logic A formal logic is defined by its syntax and semantics. Syntax An alphabet is a set of symbols. A finite sequence of these symbols is called
More informationCHAPTER 4 CLASSICAL PROPOSITIONAL SEMANTICS
CHAPTER 4 CLASSICAL PROPOSITIONAL SEMANTICS 1 Language There are several propositional languages that are routinely called classical propositional logic languages. It is due to the functional dependency
More informationLogic and Proofs. (A brief summary)
Logic and Proofs (A brief summary) Why Study Logic: To learn to prove claims/statements rigorously To be able to judge better the soundness and consistency of (others ) arguments To gain the foundations
More informationLogic. Propositional Logic: Syntax. Wffs
Logic Propositional Logic: Syntax Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about
More informationLecture 1: Logical Foundations
Lecture 1: Logical Foundations Zak Kincaid January 13, 2016 Logics have two components: syntax and semantics Syntax: defines the well-formed phrases of the language. given by a formal grammar. Typically
More informationThe Reachability-Bound Problem. Gulwani and Zuleger PLDI 10
The Reachability-Bound Problem Gulwani and Zuleger PLDI 10 CS252r Spring 2011 The Reachability-Bound problem Find a symbolic worst case bound on the number of times a program point is reached Intra-procedural:
More informationA statement is a sentence that is definitely either true or false but not both.
5 Logic In this part of the course we consider logic. Logic is used in many places in computer science including digital circuit design, relational databases, automata theory and computability, and artificial
More informationECE/CS 250: Computer Architecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Benjamin Lee
ECE/CS 250: Computer Architecture Basics of Logic Design: Boolean Algebra, Logic Gates Benjamin Lee Slides based on those from Alvin Lebeck, Daniel Sorin, Andrew Hilton, Amir Roth, Gershon Kedem Admin
More informationICS141: Discrete Mathematics for Computer Science I
ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Originals slides by Dr. Baek and Dr. Still, adapted by J. Stelovsky Based on slides Dr. M. P. Frank and Dr. J.L. Gross
More informationDiscrete Mathematical Structures. Chapter 1 The Foundation: Logic
Discrete Mathematical Structures Chapter 1 he oundation: Logic 1 Lecture Overview 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Quantifiers l l l l l Statement Logical Connectives Conjunction
More informationEssential facts about NP-completeness:
CMPSCI611: NP Completeness Lecture 17 Essential facts about NP-completeness: Any NP-complete problem can be solved by a simple, but exponentially slow algorithm. We don t have polynomial-time solutions
More informationUnary negation: T F F T
Unary negation: ϕ 1 ϕ 1 T F F T Binary (inclusive) or: ϕ 1 ϕ 2 (ϕ 1 ϕ 2 ) T T T T F T F T T F F F Binary (exclusive) or: ϕ 1 ϕ 2 (ϕ 1 ϕ 2 ) T T F T F T F T T F F F Classical (material) conditional: ϕ 1
More informationCSE 240 Logic and Discrete Mathematics
CSE 240 Logic and Discrete Mathematics Instructor: odd Sproull Department of Computer Science and Engineering Washington University in St. Louis 1Extensible - CSE 240 Logic Networking and Discrete Platform
More informationCS156: The Calculus of Computation Zohar Manna Autumn 2008
Page 3 of 52 Page 4 of 52 CS156: The Calculus of Computation Zohar Manna Autumn 2008 Lecturer: Zohar Manna (manna@cs.stanford.edu) Office Hours: MW 12:30-1:00 at Gates 481 TAs: Boyu Wang (wangboyu@stanford.edu)
More informationAI Principles, Semester 2, Week 2, Lecture 5 Propositional Logic and Predicate Logic
AI Principles, Semester 2, Week 2, Lecture 5 Propositional Logic and Predicate Logic Propositional logic Logical connectives Rules for wffs Truth tables for the connectives Using Truth Tables to evaluate
More informationAlgorithmic verification
Algorithmic verification Ahmed Rezine IDA, Linköpings Universitet Hösttermin 2018 Outline Overview Model checking Symbolic execution Outline Overview Model checking Symbolic execution Program verification
More informationAgenda. Artificial Intelligence. Reasoning in the Wumpus World. The Wumpus World
Agenda Artificial Intelligence 10. Propositional Reasoning, Part I: Principles How to Think About What is True or False 1 Introduction Álvaro Torralba Wolfgang Wahlster 2 Propositional Logic 3 Resolution
More informationCS156: The Calculus of Computation
CS156: The Calculus of Computation Zohar Manna Winter 2010 It is reasonable to hope that the relationship between computation and mathematical logic will be as fruitful in the next century as that between
More informationXOR - XNOR Gates. The graphic symbol and truth table of XOR gate is shown in the figure.
XOR - XNOR Gates Lesson Objectives: In addition to AND, OR, NOT, NAND and NOR gates, exclusive-or (XOR) and exclusive-nor (XNOR) gates are also used in the design of digital circuits. These have special
More information1 Propositional Logic
CS 2800, Logic and Computation Propositional Logic Lectures Pete Manolios Version: 384 Spring 2011 1 Propositional Logic The study of logic was initiated by the ancient Greeks, who were concerned with
More informationChapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013
Chapter 2 Reductions and NP CS 573: Algorithms, Fall 2013 August 29, 2013 2.1 Reductions Continued 2.1.1 The Satisfiability Problem SAT 2.1.1.1 Propositional Formulas Definition 2.1.1. Consider a set of
More informationProblem 1: Suppose A, B, C and D are finite sets such that A B = C D and C = D. Prove or disprove: A = B.
Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination III (Spring 2007) Problem 1: Suppose A, B, C and D are finite sets
More informationEECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits)
EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) September 5, 2002 John Wawrzynek Fall 2002 EECS150 Lec4-bool1 Page 1, 9/5 9am Outline Review of
More informationWarm-Up Problem. Is the following true or false? 1/35
Warm-Up Problem Is the following true or false? 1/35 Propositional Logic: Resolution Carmen Bruni Lecture 6 Based on work by J Buss, A Gao, L Kari, A Lubiw, B Bonakdarpour, D Maftuleac, C Roberts, R Trefler,
More informationLearning Goals of CS245 Logic and Computation
Learning Goals of CS245 Logic and Computation Alice Gao April 27, 2018 Contents 1 Propositional Logic 2 2 Predicate Logic 4 3 Program Verification 6 4 Undecidability 7 1 1 Propositional Logic Introduction
More informationOverview. 1. Introduction to Propositional Logic. 2. Operations on Propositions. 3. Truth Tables. 4. Translating Sentences into Logical Expressions
Note 01 Propositional Logic 1 / 10-1 Overview 1. Introduction to Propositional Logic 2. Operations on Propositions 3. Truth Tables 4. Translating Sentences into Logical Expressions 5. Preview: Propositional
More informationDefinition 2. Conjunction of p and q
Proposition Propositional Logic CPSC 2070 Discrete Structures Rosen (6 th Ed.) 1.1, 1.2 A proposition is a statement that is either true or false, but not both. Clemson will defeat Georgia in football
More informationcse 311: foundations of computing Spring 2015 Lecture 3: Logic and Boolean algebra
cse 311: foundations of computing Spring 2015 Lecture 3: Logic and Boolean algebra gradescope Homework #1 is up (and has been since Friday). It is due Friday, October 9 th at 11:59pm. You should have received
More informationFirst-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms
First-Order Logic 1 Syntax Domain of Discourse The domain of discourse for first order logic is FO structures or models. A FO structure contains Relations Functions Constants (functions of arity 0) FO
More informationCombined Satisfiability Modulo Parametric Theories
Intel 07 p.1/39 Combined Satisfiability Modulo Parametric Theories Sava Krstić*, Amit Goel*, Jim Grundy*, and Cesare Tinelli** *Strategic CAD Labs, Intel **The University of Iowa Intel 07 p.2/39 This Talk
More informationFormal Methods in Software Engineering
Formal Methods in Software Engineering An Introduction to Model-Based Analyis and Testing Vesal Vojdani Department of Computer Science University of Tartu Fall 2014 Vesal Vojdani (University of Tartu)
More informationOutline. EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) Combinational Logic (CL) Defined
EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) January 30, 2003 John Wawrzynek Outline Review of three representations for combinational logic:
More informationLeonardo de Moura Microsoft Research
Leonardo de Moura Microsoft Research Is formula F satisfiable modulo theory T? SMT solvers have specialized algorithms for T b + 2 = c and f(read(write(a,b,3), c-2)) f(c-b+1) b + 2 = c and f(read(write(a,b,3),
More information