Equalities and Uninterpreted Functions. Chapter 3. Decision Procedures. An Algorithmic Point of View. Revision 1.0

Size: px
Start display at page:

Download "Equalities and Uninterpreted Functions. Chapter 3. Decision Procedures. An Algorithmic Point of View. Revision 1.0"

Transcription

1 Equalities and Uninterpreted Functions Chapter 3 Decision Procedures An Algorithmic Point of View D.Kroening O.Strichman Revision 1.0

2 Outline Decision Procedures Equalities and Uninterpreted Functions 2

3 Equality Logic A Boolean combination of Equalities and Propositions x 1 = x 2 (x 2 = x 3 ((x 1 = x 3 ) b x 1 = 2)) We always push negations inside (NNF): x 1 = x 2 (x 2 = x 3 ((x 1 x 3 ) b x 1 2)) Decision Procedures Equalities and Uninterpreted Functions 3

4 Syntax of Equality Logic formula : formula formula formula atom atom : term-variable = term-variable term-variable = constant Boolean-variable The term-variables are defined over some (possible infinite) domain. The constants are from the same domain. The set of Boolean variables is always separate from the set of term variables Decision Procedures Equalities and Uninterpreted Functions 4

5 Expressiveness and complexity Allows more natural description of systems, although technically it is as expressible as Propositional Logic. Obviously NP-hard. In fact, it is in NP, and hence NP-complete, for reasons we shall see later. Decision Procedures Equalities and Uninterpreted Functions 5

6 Equality logic with uninterpreted functions formula : formula formula formula atom atom : term = term Boolean-variable term : term-variable function ( list of terms ) The term-variables are defined over some (possible infinite) domain. Constants are functions with an empty list of terms. Decision Procedures Equalities and Uninterpreted Functions 6

7 Uninterpreted Functions Every function is a mapping from a domain to a range. Example: the + function over the naturals N is a mapping from N N to N. Decision Procedures Equalities and Uninterpreted Functions 7

8 Uninterpreted Functions Suppose we replace + by an uninterpreted binary function f(a, b) Example: x 1 + x 2 = x 3 + x 4 is replaced by f(x 1, x 2 ) = f(x 3, x 4 ) We lost the semantics of +, as f can represent any binary function. Loosing the semantics means that f is not restricted by any axioms or rules of inference. But f is still a function! Decision Procedures Equalities and Uninterpreted Functions 8

9 Uninterpreted Functions The most general axiom for any function is functional consistency. Example: if x = y, then f(x) = f(y) for any function f. Functional consistency axiom schema: x 1 = x 1... x n = x n = f(x 1,..., x n ) = f(x 1,..., x n) Sometimes, functional consistency is all that is needed for a proof. Decision Procedures Equalities and Uninterpreted Functions 9

10 Example: Circuit Transformations Circuits consist of combinational gates and latches (registers) I R 1 Latch Combinational part Decision Procedures Equalities and Uninterpreted Functions 10

11 Example: Circuit Transformations Circuits consist of combinational gates and latches (registers) I R 1 Latch Combinational part The combinational gates can be modeled using functions The latches can be modeled with variables f(x, y) := x y R 1 = f(r 1, I) Decision Procedures Equalities and Uninterpreted Functions 10

12 Example: Circuit Transformations in F L1 G K H L2 L3 L4 C D 1 0 L5 Decision Procedures Equalities and Uninterpreted Functions 11

13 Example: Circuit Transformations in in: a primary input of the circuit F L1 G H K L2 L3 L4 C D 1 0 L5 Decision Procedures Equalities and Uninterpreted Functions 11

14 Example: Circuit Transformations in F in: a primary input of the circuit L1 G F, G, H, K, D: some functions over bit-vectors H K L2 L3 L4 C D 1 0 L5 Decision Procedures Equalities and Uninterpreted Functions 11

15 Example: Circuit Transformations in F in: a primary input of the circuit L2 C L1 G H K L3 L4 D 1 0 L5 F, G, H, K, D: some functions over bit-vectors L 1,..., L 5 : latches (registers) Decision Procedures Equalities and Uninterpreted Functions 11

16 Example: Circuit Transformations in F in: a primary input of the circuit L2 C L1 G H K L3 L4 D 1 0 F, G, H, K, D: some functions over bit-vectors L 1,..., L 5 : latches (registers) C: a predicate over bit-vectors a multiplexer (case-split) L5 Decision Procedures Equalities and Uninterpreted Functions 11

17 Example: Circuit Transformations in F L1 G K H A pipeline processes data in stages Data is processed in parallel as in an assembly line Formal model: L 1 = f(i) L2 C L3 L4 D 1 0 L 2 = L 1 L 3 = k(g(l 1 )) L 4 = h(l 1 ) L 5 = c(l 2 )? L 3 : l(l 4 ) L5 Decision Procedures Equalities and Uninterpreted Functions 12

18 Example: Circuit Transformations Stage 1 in F L1 G K H A pipeline processes data in stages Data is processed in parallel as in an assembly line Formal model: L 1 = f(i) L2 C L3 L4 D 1 0 L 2 = L 1 L 3 = k(g(l 1 )) L 4 = h(l 1 ) L 5 = c(l 2 )? L 3 : l(l 4 ) L5 Decision Procedures Equalities and Uninterpreted Functions 12

19 Example: Circuit Transformations in F Stage 2 L1 G K H A pipeline processes data in stages Data is processed in parallel as in an assembly line Formal model: L 1 = f(i) L2 C L3 L4 D 1 0 L 2 = L 1 L 3 = k(g(l 1 )) L 4 = h(l 1 ) L 5 = c(l 2 )? L 3 : l(l 4 ) L5 Decision Procedures Equalities and Uninterpreted Functions 12

20 Example: Circuit Transformations in F L1 G K H A pipeline processes data in stages Data is processed in parallel as in an assembly line Formal model: L 1 = f(i) L2 C Stage 3 L3 L4 D 1 0 L 2 = L 1 L 3 = k(g(l 1 )) L 4 = h(l 1 ) L 5 = c(l 2 )? L 3 : l(l 4 ) L5 Decision Procedures Equalities and Uninterpreted Functions 12

21 Example: Circuit Transformations in F L2 L1 G K L3 H L4 The maximum clock frequency depends on the longest path between two latches Note that the output of g is used as input to k We want to speed up the design by postponing k to the third stage C D 1 0 L5 Decision Procedures Equalities and Uninterpreted Functions 13

22 Example: Circuit Transformations in F L2 C L1 G H K L3 L4 D 1 0 The maximum clock frequency depends on the longest path between two latches Note that the output of g is used as input to k We want to speed up the design by postponing k to the third stage Also note that the circuit only uses one of L 3 or L 4, never both We can remove one of the latches L5 Decision Procedures Equalities and Uninterpreted Functions 13

23 Example: Circuit Transformations in in F F L1 L 1 G C G H H L2 K L3 L4 =? L L 3 C D K D L5 L 5 Decision Procedures Equalities and Uninterpreted Functions 14

24 Example: Circuit Transformations L 1 = f(i) L 2 = L 1 L 3 = k(g(l 1 )) L 4 = h(l 1 ) L 5 = c(l 2 )? L 3 : l(l 4 ) L 1 = f(i) L 2 = c(l 1) L 3 = c(l 1)? g(l 1) : h(l 1) L 5 = L 2? k(l 3) : l(l 3) L 5? = L 5 Decision Procedures Equalities and Uninterpreted Functions 15

25 Example: Circuit Transformations L 1 = f(i) L 2 = L 1 L 3 = k(g(l 1 )) L 4 = h(l 1 ) L 5 = c(l 2 )? L 3 : l(l 4 ) L 1 = f(i) L 2 = c(l 1) L 3 = c(l 1)? g(l 1) : h(l 1) L 5 = L 2? k(l 3) : l(l 3) L 5? = L 5 Equivalence in this case holds regardless of the actual functions Conclusion: can be decided using Equality Logic and Uninterpreted Functions Decision Procedures Equalities and Uninterpreted Functions 15

26 Transforming UFs to Equality Logic using Ackermann s reduction Given: a formula ϕ UF with uninterpreted functions For each function in ϕ UF : 1. Number function instances (from the inside out) F 2 ( F 1 (x) ) = 0 Decision Procedures Equalities and Uninterpreted Functions 16

27 Transforming UFs to Equality Logic using Ackermann s reduction Given: a formula ϕ UF with uninterpreted functions For each function in ϕ UF : 1. Number function instances (from the inside out) f 1 {}}{ F 2 ( F 1 (x) ) = 0 }{{} f 2 2. Replace each function instance with a new variable f2 = 0 Decision Procedures Equalities and Uninterpreted Functions 16

28 Transforming UFs to Equality Logic using Ackermann s reduction Given: a formula ϕ UF with uninterpreted functions For each function in ϕ UF : 1. Number function instances (from the inside out) f 1 {}}{ F 2 ( F 1 (x) ) = 0 }{{} f 2 2. Replace each function instance with a new variable f2 = 0 3. Add functional consistency constraint to ϕ UF for every pair of instances of the same function. ((x = f 1 ) (f 2 = f 1 ) f 2 = 0 Decision Procedures Equalities and Uninterpreted Functions 16

29 Ackermann s reduction: Example Suppose we want to check x 1 x 2 F (x 1 ) = F (x 2 ) F (x 1 ) F (x 3 ) for validity. 1 First number the function instances: x 1 x 2 F 1 (x 1 ) = F 2 (x 2 ) F 1 (x 1 ) F 3 (x 3 ) Decision Procedures Equalities and Uninterpreted Functions 17

30 Ackermann s reduction: Example Suppose we want to check x 1 x 2 F (x 1 ) = F (x 2 ) F (x 1 ) F (x 3 ) for validity. 1 First number the function instances: x 1 x 2 F 1 (x 1 ) = F 2 (x 2 ) F 1 (x 1 ) F 3 (x 3 ) 2 Replace each function with a new variable: x 1 x 2 f 1 = f 2 f 1 f 3 Decision Procedures Equalities and Uninterpreted Functions 17

31 Ackermann s reduction: Example Suppose we want to check x 1 x 2 F (x 1 ) = F (x 2 ) F (x 1 ) F (x 3 ) for validity. 1 First number the function instances: x 1 x 2 F 1 (x 1 ) = F 2 (x 2 ) F 1 (x 1 ) F 3 (x 3 ) 2 Replace each function with a new variable: x 1 x 2 f 1 = f 2 f 1 f 3 3 Add functional consistency constraints: (x 1 = x 2 f 1 = f 2 ) (x 1 = x 3 f 1 = f 3 ) (x 2 = x 3 f 2 = f 3 ) Decision Procedures Equalities and Uninterpreted Functions 17

32 Transforming UFs to Equality Logic using Bryant s reduction Given: a formula ϕ UF with uninterpreted functions For each function in ϕ UF : 1. Number function instances (from the inside out) F 1 (a) = F 2 (b) Decision Procedures Equalities and Uninterpreted Functions 18

33 Transforming UFs to Equality Logic using Bryant s reduction Given: a formula ϕ UF with uninterpreted functions For each function in ϕ UF : 1. Number function instances (from the inside out) 2. Replace each function instance F i with an expression F i F 1 (a) = F 2 (b) F 1 = F 2 Decision Procedures Equalities and Uninterpreted Functions 18

34 Transforming UFs to Equality Logic using Bryant s reduction Given: a formula ϕ UF with uninterpreted functions For each function in ϕ UF : 1. Number function instances (from the inside out) 2. Replace each function instance F i with an expression Fi F i := case x 1 = x i : f 1 x 2 = x i : f 2.. x i 1 = x i : f i 1 true : f i F 1 (a) = F 2 (b) F 1 = F 2 f 1 = ( case a = b: f1 true : f 2 Decision Procedures Equalities and Uninterpreted Functions 18

35 Example of Bryant s reduction Original formula: a = b F (G(a) = F (G(b)) Decision Procedures Equalities and Uninterpreted Functions 19

36 Example of Bryant s reduction Original formula: a = b F (G(a) = F (G(b)) Number the instances: a = b F 1 (G 1 (a) = F 2 (G 2 (b)) Decision Procedures Equalities and Uninterpreted Functions 19

37 Example of Bryant s reduction Original formula: a = b F (G(a) = F (G(b)) Number the instances: a = b F 1 (G 1 (a) = F 2 (G 2 (b)) Replace each function application with an expression: where a = b F1 = F2 F1 = f ( 1 case G F2 = 1 = G 2 : f 1 true : f 2 ) G 1 = g ( 1 ) case a = b : G g1 2 = true : g 2 Decision Procedures Equalities and Uninterpreted Functions 19

38 Using uninterpreted functions in proofs Uninterpreted functions give us the ability to represent an abstract view of functions. It over-approximates the concrete system = 1 is a contradiction But F (1, 1) = 1 is satisfiable! Decision Procedures Equalities and Uninterpreted Functions 20

39 Using uninterpreted functions in proofs Uninterpreted functions give us the ability to represent an abstract view of functions. It over-approximates the concrete system = 1 is a contradiction But F (1, 1) = 1 is satisfiable! Conclusion: unless we are careful, we can give wrong answers, and this way, loose soundness. Decision Procedures Equalities and Uninterpreted Functions 20

40 Using uninterpreted functions in proofs In general, a sound but incomplete method is more useful than an unsound but complete method. A sound but incomplete algorithm for deciding a formula with uninterpreted functions ϕ UF : 1 Transform it into Equality Logic formula ϕ E 2 If ϕ E is unsatisfiable, return Unsatisfiable 3 Else return Don t know Decision Procedures Equalities and Uninterpreted Functions 21

41 Using uninterpreted functions in proofs Question #1: is this useful? Decision Procedures Equalities and Uninterpreted Functions 22

42 Using uninterpreted functions in proofs Question #1: is this useful? Question #2: can it be made complete in some cases? Decision Procedures Equalities and Uninterpreted Functions 22

43 Using uninterpreted functions in proofs Question #1: is this useful? Question #2: can it be made complete in some cases? When the abstract view is sufficient for the proof, it enables (or at least simplifies) a mechanical proof. Decision Procedures Equalities and Uninterpreted Functions 22

44 Using uninterpreted functions in proofs Question #1: is this useful? Question #2: can it be made complete in some cases? When the abstract view is sufficient for the proof, it enables (or at least simplifies) a mechanical proof. So when is the abstract view sufficient? Decision Procedures Equalities and Uninterpreted Functions 22

45 Using uninterpreted functions in proofs (common) Proving equivalence between: Two versions of a hardware design (one with and one without a pipeline) Source and target of a compiler ( Translation Validation ) Decision Procedures Equalities and Uninterpreted Functions 23

46 Using uninterpreted functions in proofs (common) Proving equivalence between: Two versions of a hardware design (one with and one without a pipeline) Source and target of a compiler ( Translation Validation ) (rare) Proving properties that do not rely on the exact functionality of some of the functions Decision Procedures Equalities and Uninterpreted Functions 23

47 Example: Translation Validation Assume the source program has the statement z = (x 1 + y 1 ) (x 2 + y 2 ); which the compiler turned into: u 1 = x 1 + y 1 ; u 2 = x 2 + y 2 ; z = u 1 u 2 ; Decision Procedures Equalities and Uninterpreted Functions 24

48 Example: Translation Validation Assume the source program has the statement z = (x 1 + y 1 ) (x 2 + y 2 ); which the compiler turned into: u 1 = x 1 + y 1 ; u 2 = x 2 + y 2 ; z = u 1 u 2 ; We need to prove that: (u 1 = x 1 + y 1 u 2 = x 2 + y 2 z = u 1 u 2 ) (z = (x 1 + y 1 ) (x 2 + y 2 )) Decision Procedures Equalities and Uninterpreted Functions 24

49 Example: Translation Validation Claim: ϕ UF is valid We will prove this by reducing it to an Equality Logic formula ϕ E = (x 1 = x 2 y 1 = y 2 f 1 = f 2 ) (u 1 = f 1 u 2 = f 2 g 1 = g 2 ) ((u 1 = f 1 u 2 = f 2 z = g 1 ) z = g 2 ) Decision Procedures Equalities and Uninterpreted Functions 25

50 Uninterpreted functions: usability Good: each function on the left can be mapped to a function on the right with equivalent arguments Decision Procedures Equalities and Uninterpreted Functions 26

51 Uninterpreted functions: usability Good: each function on the left can be mapped to a function on the right with equivalent arguments Bad: almost all other cases Example: Left x + x Right 2x Decision Procedures Equalities and Uninterpreted Functions 26

52 Uninterpreted functions: usability This is easy to prove: (x 1 = x 2 y 1 = y 2 ) (x 1 + y 1 = x 2 + y 2 ) Decision Procedures Equalities and Uninterpreted Functions 27

53 Uninterpreted functions: usability This is easy to prove: (x 1 = x 2 y 1 = y 2 ) (x 1 + y 1 = x 2 + y 2 ) This requires commutativity: (x 1 = x 2 y 1 = y 2 ) (x 1 + y 1 = y 2 + x 2 ) Decision Procedures Equalities and Uninterpreted Functions 27

54 Uninterpreted functions: usability This is easy to prove: (x 1 = x 2 y 1 = y 2 ) (x 1 + y 1 = x 2 + y 2 ) This requires commutativity: (x 1 = x 2 y 1 = y 2 ) (x 1 + y 1 = y 2 + x 2 ) Fix by adding: (x 1 + y 1 = y 1 + x 1 ) (x 2 + y 2 = y 2 + x 2 ) Decision Procedures Equalities and Uninterpreted Functions 27

55 Uninterpreted functions: usability This is easy to prove: (x 1 = x 2 y 1 = y 2 ) (x 1 + y 1 = x 2 + y 2 ) This requires commutativity: (x 1 = x 2 y 1 = y 2 ) (x 1 + y 1 = y 2 + x 2 ) Fix by adding: (x 1 + y 1 = y 1 + x 1 ) (x 2 + y 2 = y 2 + x 2 ) What about other cases? Use more rewriting rules! Decision Procedures Equalities and Uninterpreted Functions 27

56 Example: equivalence of C programs (1/4) int power3(int in) { out = in; } for(i=0; i<2; i++) out = out * in; return out; int power3 new(int in) { out = (in*in)*in; return out; } These two functions return the same value regardless if it is * or any other function. Conclusion: we can prove equivalence by replacing * with an uninterpreted function Decision Procedures Equalities and Uninterpreted Functions 28

57 From programs to equations But first we need to know how to turn programs into equations. There are several options we will see static single assignment for bounded programs. Decision Procedures Equalities and Uninterpreted Functions 29

58 Static Single Assignment (SSA) form see compiler class Idea: Rename variables such that each variable is assigned exactly once Example: x=x+y; x=x*2; a[i]=100; x 1 =x 0 +y 0 ; x 2 =x 1 *2; a 1 [i 0 ]=100; Decision Procedures Equalities and Uninterpreted Functions 30

59 Static Single Assignment (SSA) form see compiler class Idea: Rename variables such that each variable is assigned exactly once Example: x=x+y; x=x*2; a[i]=100; x 1 =x 0 +y 0 ; x 2 =x 1 *2; a 1 [i 0 ]=100; Read assignments as equalities Generate constraints by simply conjoining these equalities x 1 =x 0 +y 0 ; x x 2 =x 1 *2; 1 = x 0 + y 0 Example: x 2 = x 1 2 a 1 [i 0 ]=100; a 1 [i 0 ] = 100 Decision Procedures Equalities and Uninterpreted Functions 30

60 SSA for bounded programs What about if? Branches are handled using φ-nodes. int main() { int x, y, z; y=8; if(x) y--; else y++; } z=y+1; Decision Procedures Equalities and Uninterpreted Functions 31

61 SSA for bounded programs What about if? Branches are handled using φ-nodes. int main() { int x, y, z; } y=8; if(x) y--; else y++; z=y+1; int main() { int x, y, z; } y 1 =8; if(x 0 ) y 2 =y 1-1; else y 3 =y 1 +1; y 4 =φ(y 2, y 3 ); z 1 =y 4 +1; Decision Procedures Equalities and Uninterpreted Functions 31

62 SSA for bounded programs What about if? Branches are handled using φ-nodes. int main() { int x, y, z; } y=8; if(x) y--; else y++; z=y+1; int main() { int x, y, z; } y 1 =8; if(x 0 ) y 2 =y 1-1; else y 3 =y 1 +1; y 4 =φ(y 2, y 3 ); z 1 =y 4 +1; y 1 = 8 y 2 = y 1 1 y 3 = y y 4 = (x 0 0? y 2 : y 3 ) z 1 = y Decision Procedures Equalities and Uninterpreted Functions 31

63 SSA for bounded programs What about loops? We unwind them! void f(...) {... while(cond) { BODY; }... Remainder; } Decision Procedures Equalities and Uninterpreted Functions 32

64 SSA for bounded programs What about loops? We unwind them! void f(...) {... if(cond) { BODY; while(cond) { BODY; } }... Remainder; } Decision Procedures Equalities and Uninterpreted Functions 32

65 SSA for bounded programs What about loops? We unwind them! void f(...) {... if(cond) { BODY; if(cond) { BODY; while(cond) { BODY; } } }... Remainder; } Decision Procedures Equalities and Uninterpreted Functions 32

66 SSA for bounded programs Some caveats: Unwind how many times? Must preserve locality of variables declared inside loop Decision Procedures Equalities and Uninterpreted Functions 33

67 SSA for bounded programs Some caveats: Unwind how many times? Must preserve locality of variables declared inside loop There is a tool available that does this CBMC C Bounded Model Checker Bound is verified using unwinding assertions Used frequently for embedded software Bound is a run-time guarantee Integrated into Eclipse Decision problem can be exported Decision Procedures Equalities and Uninterpreted Functions 33

68 SSA for bounded programs: CBMC Decision Procedures Equalities and Uninterpreted Functions 34

69 Example: equivalence of C programs (2/4) int power3(int in) { out = in; } for(i=0; i<2; i++) out = out * in; return out; int power3 new(int in) { out = (in*in)*in; return out; } Decision Procedures Equalities and Uninterpreted Functions 35

70 Example: equivalence of C programs (2/4) int power3(int in) { out = in; } for(i=0; i<2; i++) out = out * in; return out; int power3 new(int in) { out = (in*in)*in; return out; } Static single assignment (SSA) form: out 1 = in out 2 = out 1 in out 1 = (in in) in out 3 = out 2 in Prove that both functions return the same value: out 3 = out 1 Decision Procedures Equalities and Uninterpreted Functions 35

71 Example: equivalence of C programs (3/4) Static single assignment (SSA) form: out 1 = in out 2 = out 1 in out 1 = (in in) in out 3 = out 2 in With uninterpreted functions: out 1 = in out 2 = F (out 1, in) out 3 = F (out 2, in) out 1 = F (F (in, in), in) Decision Procedures Equalities and Uninterpreted Functions 36

72 Example: equivalence of C programs (3/4) Static single assignment (SSA) form: out 1 = in out 2 = out 1 in out 1 = (in in) in out 3 = out 2 in With uninterpreted functions: out 1 = in out 2 = F (out 1, in) out 3 = F (out 2, in) out 1 = F (F (in, in), in) With numbered uninterpreted functions: out 1 = in out 2 = F 1 (out 1, in) out 1 = F 4(F 3 (in, in), in) out 3 = F 2 (out 2, in) Decision Procedures Equalities and Uninterpreted Functions 36

73 Example: equivalence of C programs (4/4) With numbered uninterpreted functions: out 1 = in out 2 = F 1 (out 1, in) out 1 = F 4(F 3 (in, in), in) out 3 = F 2 (out 2, in) Decision Procedures Equalities and Uninterpreted Functions 37

74 Example: equivalence of C programs (4/4) With numbered uninterpreted functions: out 1 = in out 2 = F 1 (out 1, in) out 1 = F 4(F 3 (in, in), in) out 3 = F 2 (out 2, in) Ackermann s reduction: out 1 = in ϕ E a : out 2 = f 1 ϕ E b : out 1 = f 4 out 3 = f 2 Decision Procedures Equalities and Uninterpreted Functions 37

75 Example: equivalence of C programs (4/4) With numbered uninterpreted functions: out 1 = in out 2 = F 1 (out 1, in) out 1 = F 4(F 3 (in, in), in) out 3 = F 2 (out 2, in) Ackermann s reduction: out 1 = in ϕ E a : out 2 = f 1 ϕ E b : out 1 = f 4 out 3 = f 2 The verification condition: (out 1 = out 2 f 1 = f 2 ) (out 1 = in f 1 = f 3 ) (out 1 = f 3 f 1 = f 4 ) (out 2 = in f 2 = f 3 ) ϕ E a ϕ E b (out 2 = f 3 f 2 = f 3 ) (in = f 3 f 3 = f 4 ) out 3 = out 1 Decision Procedures Equalities and Uninterpreted Functions 37

76 Uninterpreted functions: simplifications Let n be the number of instances of F () Both reduction schemes require O(n 2 ) comparisons This can be the bottleneck of the verification effort Decision Procedures Equalities and Uninterpreted Functions 38

77 Uninterpreted functions: simplifications Let n be the number of instances of F () Both reduction schemes require O(n 2 ) comparisons This can be the bottleneck of the verification effort Solution: try to guess the pairing of functions Still sound: wrong guess can only make a valid formula invalid Decision Procedures Equalities and Uninterpreted Functions 38

78 Simplifications (1) Given x 1 = x 1, x 2 = x 2, x 3 = x 3, prove = o 1 = o 2. o 1 = (x 1 + (a x 2 )) a = x }{{} }{{} f 1 f 2 Left o 2 = (x 1 + (b x }{{ 2) ) b = x3 + 5 }}{{} f 3 f 4 Right 4 function instances 6 comparisons Decision Procedures Equalities and Uninterpreted Functions 39

79 Simplifications (1) Given x 1 = x 1, x 2 = x 2, x 3 = x 3, prove = o 1 = o 2. o 1 = (x 1 + (a x 2 )) a = x }{{} }{{} f 1 f 2 Left o 2 = (x 1 + (b x }{{ 2) ) b = x3 + 5 }}{{} f 3 f 4 Right 4 function instances 6 comparisons Guess: validity does not rely on f 1 = f 2 or on f 3 = f 4 Idea: only enforce functional consistency of pairs (Left,Right). Decision Procedures Equalities and Uninterpreted Functions 39

80 Simplifications (2) o 1 = (x 1 + (a x 2 )) a = x }{{} }{{} f 1 f 2 Left o 2 = (x 1 + (b x }{{ 2) ) b = x3 + 5 }}{{} f 3 f 4 Right Down to 4 comparisons! Decision Procedures Equalities and Uninterpreted Functions 40

81 Simplifications (2) o 1 = (x 1 + (a x 2 )) a = x }{{} }{{} f 1 f 2 Left o 2 = (x 1 + (b x }{{ 2) ) b = x3 + 5 }}{{} f 3 f 4 Right Down to 4 comparisons! Another guess: equivalence only depends on f 1 = f 3 and f 2 = f 4 Pattern matching may help here Decision Procedures Equalities and Uninterpreted Functions 40

82 Simplifications (3) o 1 = (x 1 + (a x 2 )) a = x }{{} }{{} f 1 f 2 Left o 2 = (x 1 + (b x }{{ 2) ) b = x3 + 5 }}{{} f 3 f 4 Right Match according to patterns ( signatures ) Down to 2 comparisons! + v v v f 1, f 3 + v 5 f 2, f 4 Decision Procedures Equalities and Uninterpreted Functions 41

83 Simplifications (4) o 1 = (x 1 + (a x 2 )) a = x }{{} }{{} f 1 f 2 Left Substitute intermediate variables (in the example: a, b) o 2 = (x 1 + (b x }{{ 2) ) b = x3 + 5 }}{{} f 3 f 4 + v v v + v 5 Right

84 Simplifications (4) o 1 = (x 1 + (a x 2 )) a = x }{{} }{{} f 1 f 2 Left Substitute intermediate variables (in the example: a, b) o 2 = (x 1 + (b x }{{ 2) ) b = x3 + 5 }}{{} f 3 f 4 + v Xv v + v 5 Right + v + v v 5 f 1, f 3 Decision Procedures Equalities and Uninterpreted Functions 42

85 The SSA example revisited (1) With numbered uninterpreted functions: out 1 = in out 2 = F 1 (out 1, in) out 1 = F 4(F 3 (in, in), in) out 3 = F 2 (out 2, in) Decision Procedures Equalities and Uninterpreted Functions 43

86 The SSA example revisited (1) With numbered uninterpreted functions: out 1 = in out 2 = F 1 (out 1, in) out 1 = F 4(F 3 (in, in), in) out 3 = F 2 (out 2, in) Map F 1 to F 3 : F v v Map F 2 to F 4 : F v F v v Decision Procedures Equalities and Uninterpreted Functions 43

87 The SSA example revisited (2) With numbered uninterpreted functions: out 1 = in out 2 = F 1 (out 1, in) out 1 = F 4(F 3 (in, in), in) out 3 = F 2 (out 2, in) Ackermann s reduction: out 1 = in ϕ E a : out 2 = f 1 ϕ E b : out 1 = f 4 out 3 = f 2 The verification condition has shrunk: [( ) ] (out1 = in f 1 = f 3 ) ϕ E a ϕ E (out 2 = f 3 f 2 = f 4 ) b out 3 = out 1 Decision Procedures Equalities and Uninterpreted Functions 44

88 Same example with Bryant s reduction With numbered uninterpreted functions: out 1 = in out 2 = F 1 (out 1, in) out 1 = F 4(F 3 (in, in), in) out 3 = F 2 (out 2, in) Bryant s reduction: out 1 = in ϕ E a : out 2 = f 1 out 3 = f 2 ϕ ( E b : out 1 = case «case in = out1 : f 1 ) = out true : f 2 : f 2 3 true : f 4 The verification condition: (ϕ E a ϕ E b ) out 3 = out 1 Decision Procedures Equalities and Uninterpreted Functions 45

89 So is Equality Logic with UFs interesting? 1 It is expressible enough to state something interesting. 2 It is decidable and more efficiently solvable than richer logics, for example in which some functions are interpreted. 3 Models which rely on infinite-type variables are expressed more naturally in this logic in comparison with Propositional Logic. Decision Procedures Equalities and Uninterpreted Functions 46

(Yet another) decision procedure for Equality Logic

(Yet another) decision procedure for Equality Logic (Yet another) decision procedure for Equality Logic Ofer Strichman and Orly Meir echnion echnion 1 Equality Logic 0 0 0 1 0 1 E : (x 1 = x 2 Æ (x 2 x 3 Ç x 1 x 3 )) Domain: x 1,x 2,x 3 2 N he satisfiability

More information

SMT BASICS WS 2017/2018 ( ) LOGIC SATISFIABILITY MODULO THEORIES. Institute for Formal Models and Verification Johannes Kepler Universität Linz

SMT 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 information

CSE507. Satisfiability Modulo Theories. Computer-Aided Reasoning for Software. Emina Torlak

CSE507. 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 information

Warm-Up Problem. Is the following true or false? 1/35

Warm-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 information

Satisfiability Modulo Theories (SMT)

Satisfiability 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 information

First-Order Logic (FOL)

First-Order Logic (FOL) First-Order Logic (FOL) Also called Predicate Logic or Predicate Calculus 2. First-Order Logic (FOL) FOL Syntax variables x, y, z, constants a, b, c, functions f, g, h, terms variables, constants or n-ary

More information

Tutorial 1: Modern SMT Solvers and Verification

Tutorial 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 information

CS156: The Calculus of Computation

CS156: 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 information

First-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 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 information

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics Dynamic Semantics Operational Semantics Denotational Semantic Dynamic Semantics Operational Semantics Operational Semantics Describe meaning by executing program on machine Machine can be actual or simulated

More information

Equality Logic and Uninterpreted Functions

Equality Logic and Uninterpreted Functions Equality Logic and Uninterpreted Functions Seminar: Decision Procedures Michaela Tießler 28.06.2016 Agenda 1. Definitions 2. Use of Uninterpreted Functions 3. Decision Procedures formula: atom: term: Equality

More information

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014

Sample 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 information

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5) B.Y. Choueiry 1 Instructor s notes #12 Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5) Introduction to Artificial Intelligence CSCE 476-876, Fall 2018 URL: www.cse.unl.edu/ choueiry/f18-476-876

More information

Description Logics. Deduction in Propositional Logic. franconi. Enrico Franconi

Description Logics. Deduction in Propositional Logic.   franconi. Enrico Franconi (1/20) Description Logics Deduction in Propositional Logic Enrico Franconi franconi@cs.man.ac.uk http://www.cs.man.ac.uk/ franconi Department of Computer Science, University of Manchester (2/20) Decision

More information

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester)

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester) First-Order Theorem Proving and Vampire Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester) Outline Introduction First-Order Logic and TPTP Inference Systems

More information

Functions. Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways:

Functions. Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways: Boolean Algebra (1) Functions Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways: An expression is finite but not unique f(x,y)

More information

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna The Calculus of Computation: Decision Procedures with Applications to Verification Part I: FOUNDATIONS by Aaron Bradley Zohar Manna 1. Propositional Logic(PL) Springer 2007 1-1 1-2 Propositional Logic(PL)

More information

CS156: The Calculus of Computation Zohar Manna Winter 2010

CS156: The Calculus of Computation Zohar Manna Winter 2010 Page 3 of 35 Page 4 of 35 quantifiers CS156: The Calculus of Computation Zohar Manna Winter 2010 Chapter 2: First-Order Logic (FOL) existential quantifier x. F [x] there exists an x such that F [x] Note:

More information

WHAT IS AN SMT SOLVER? Jaeheon Yi - April 17, 2008

WHAT IS AN SMT SOLVER? Jaeheon Yi - April 17, 2008 WHAT IS AN SMT SOLVER? Jaeheon Yi - April 17, 2008 WHAT I LL TALK ABOUT Propositional Logic Terminology, Satisfiability, Decision Procedure First-Order Logic Terminology, Background Theories Satisfiability

More information

First-Order Theorem Proving and Vampire

First-Order Theorem Proving and Vampire First-Order Theorem Proving and Vampire Laura Kovács 1,2 and Martin Suda 2 1 TU Wien 2 Chalmers Outline Introduction First-Order Logic and TPTP Inference Systems Saturation Algorithms Redundancy Elimination

More information

Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE

Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE 6341 1 Outline Introduction What are axiomatic semantics? First-order logic & assertions about states Results (triples)

More information

Learning Goals of CS245 Logic and Computation

Learning 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 information

Motivation. CS389L: Automated Logical Reasoning. Lecture 10: Overview of First-Order Theories. Signature and Axioms of First-Order Theory

Motivation. CS389L: Automated Logical Reasoning. Lecture 10: Overview of First-Order Theories. Signature and Axioms of First-Order Theory Motivation CS389L: Automated Logical Reasoning Lecture 10: Overview of First-Order Theories Işıl Dillig Last few lectures: Full first-order logic In FOL, functions/predicates are uninterpreted (i.e., structure

More information

Proof Techniques (Review of Math 271)

Proof Techniques (Review of Math 271) Chapter 2 Proof Techniques (Review of Math 271) 2.1 Overview This chapter reviews proof techniques that were probably introduced in Math 271 and that may also have been used in a different way in Phil

More information

A brief introduction to Logic. (slides from

A brief introduction to Logic. (slides from A brief introduction to Logic (slides from http://www.decision-procedures.org/) 1 A Brief Introduction to Logic - Outline Propositional Logic :Syntax Propositional Logic :Semantics Satisfiability and validity

More information

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 8: Procedures for First-Order Theories, Part 2

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 8: Procedures for First-Order Theories, Part 2 Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 8: Procedures for First-Order Theories, Part 2 Matt Fredrikson mfredrik@cs.cmu.edu October 17, 2016 Matt Fredrikson Theory Procedures

More information

Logic. Propositional Logic: Syntax. Wffs

Logic. 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 information

Lecture Notes: Axiomatic Semantics and Hoare-style Verification

Lecture Notes: Axiomatic Semantics and Hoare-style Verification Lecture Notes: Axiomatic Semantics and Hoare-style Verification 17-355/17-665/17-819O: Program Analysis (Spring 2018) Claire Le Goues and Jonathan Aldrich clegoues@cs.cmu.edu, aldrich@cs.cmu.edu It has

More information

Algorithmic verification

Algorithmic 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 information

Topics in Model-Based Reasoning

Topics 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 information

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11.

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11. Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 1 Overview We ll develop proof rules, such as: { I b } S { I } { I } while b do S end { I b } That allow us to verify

More information

Formal Verification Methods 1: Propositional Logic

Formal Verification Methods 1: Propositional Logic Formal Verification Methods 1: Propositional Logic John Harrison Intel Corporation Course overview Propositional logic A resurgence of interest Logic and circuits Normal forms The Davis-Putnam procedure

More information

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning. 3: Logic Why logic? Logic about inference or argument Start from assumptions or axioms Make deductions according to rules of reasoning Logic 3-1 Why logic? (continued) If I don t buy a lottery ticket on

More information

Lecture 13: Soundness, Completeness and Compactness

Lecture 13: Soundness, Completeness and Compactness Discrete Mathematics (II) Spring 2017 Lecture 13: Soundness, Completeness and Compactness Lecturer: Yi Li 1 Overview In this lecture, we will prvoe the soundness and completeness of tableau proof system,

More information

Overview. CS389L: Automated Logical Reasoning. Lecture 7: Validity Proofs and Properties of FOL. Motivation for semantic argument method

Overview. CS389L: Automated Logical Reasoning. Lecture 7: Validity Proofs and Properties of FOL. Motivation for semantic argument method Overview CS389L: Automated Logical Reasoning Lecture 7: Validity Proofs and Properties of FOL Agenda for today: Semantic argument method for proving FOL validity Işıl Dillig Important properties of FOL

More information

An Introduction to Z3

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 information

Part 1: Propositional Logic

Part 1: Propositional Logic Part 1: Propositional Logic Literature (also for first-order logic) Schöning: Logik für Informatiker, Spektrum Fitting: First-Order Logic and Automated Theorem Proving, Springer 1 Last time 1.1 Syntax

More information

First-order resolution for CTL

First-order resolution for CTL First-order resolution for Lan Zhang, Ullrich Hustadt and Clare Dixon Department of Computer Science, University of Liverpool Liverpool, L69 3BX, UK {Lan.Zhang, U.Hustadt, CLDixon}@liverpool.ac.uk Abstract

More information

Lecture 7. Logic. Section1: Statement Logic.

Lecture 7. Logic. Section1: Statement Logic. Ling 726: Mathematical Linguistics, Logic, Section : Statement Logic V. Borschev and B. Partee, October 5, 26 p. Lecture 7. Logic. Section: Statement Logic.. Statement Logic..... Goals..... Syntax of Statement

More information

Proof Rules for Correctness Triples

Proof Rules for Correctness Triples Proof Rules for Correctness Triples CS 536: Science of Programming, Fall 2018 A. Why? We can t generally prove that correctness triples are valid using truth tables. We need proof axioms for atomic statements

More information

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

PROPOSITIONAL 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 information

CS156: The Calculus of Computation Zohar Manna Autumn 2008

CS156: 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 information

Normal Forms of Propositional Logic

Normal 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 information

KE/Tableaux. What is it for?

KE/Tableaux. What is it for? CS3UR: utomated Reasoning 2002 The term Tableaux refers to a family of deduction methods for different logics. We start by introducing one of them: non-free-variable KE for classical FOL What is it for?

More information

Propositional Logic: Models and Proofs

Propositional Logic: Models and Proofs Propositional Logic: Models and Proofs C. R. Ramakrishnan CSE 505 1 Syntax 2 Model Theory 3 Proof Theory and Resolution Compiled at 11:51 on 2016/11/02 Computing with Logic Propositional Logic CSE 505

More information

Decision Procedures for Equality Logic and Uninterpreted Functions

Decision Procedures for Equality Logic and Uninterpreted Functions 4 Decision Procedures for Equality Logic and Uninterpreted Functions In Chap. 3, we saw how useful the theory of equality logic with uninterpretedfunction (EUF) is. In this chapter, we concentrate on decision

More information

1 Circuit Complexity. CS 6743 Lecture 15 1 Fall Definitions

1 Circuit Complexity. CS 6743 Lecture 15 1 Fall Definitions CS 6743 Lecture 15 1 Fall 2007 1 Circuit Complexity 1.1 Definitions A Boolean circuit C on n inputs x 1,..., x n is a directed acyclic graph (DAG) with n nodes of in-degree 0 (the inputs x 1,..., x n ),

More information

02 Propositional Logic

02 Propositional Logic SE 2F03 Fall 2005 02 Propositional Logic Instructor: W. M. Farmer Revised: 25 September 2005 1 What is Propositional Logic? Propositional logic is the study of the truth or falsehood of propositions or

More information

The Simplify Theorem Prover

The Simplify Theorem Prover The Simplify Theorem Prover Class Notes for Lecture No.8 by Mooly Sagiv Notes prepared by Daniel Deutch Introduction This lecture will present key aspects in the leading theorem proving systems existing

More information

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness Lecture 19 NP-Completeness I 19.1 Overview In the past few lectures we have looked at increasingly more expressive problems that we were able to solve using efficient algorithms. In this lecture we introduce

More information

Solving Quantified Verification Conditions using Satisfiability Modulo Theories

Solving Quantified Verification Conditions using Satisfiability Modulo Theories Solving Quantified Verification Conditions using Satisfiability Modulo Theories Yeting Ge, Clark Barrett, Cesare Tinelli Solving Quantified Verification Conditions using Satisfiability Modulo Theories

More information

Lecture 2: Syntax. January 24, 2018

Lecture 2: Syntax. January 24, 2018 Lecture 2: Syntax January 24, 2018 We now review the basic definitions of first-order logic in more detail. Recall that a language consists of a collection of symbols {P i }, each of which has some specified

More information

Tecniche di Verifica. Introduction to Propositional Logic

Tecniche 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 information

The Eager Approach to SMT. Eager Approach to SMT

The Eager Approach to SMT. Eager Approach to SMT The Eager Approach to SMT Sanjit A. Seshia UC Berkeley Slides based on ICCAD 09 Tutorial Eager Approach to SMT Input Formula Satisfiability-preserving Boolean Encoder Boolean Formula SAT Solver SAT Solver

More information

Chapter 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. 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 information

Essential facts about NP-completeness:

Essential 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 information

CHAPTER1: Digital Logic Circuits Combination Circuits

CHAPTER1: Digital Logic Circuits Combination Circuits CS224: Computer Organization S.KHABET CHAPTER1: Digital Logic Circuits Combination Circuits 1 PRIMITIVE LOGIC GATES Each of our basic operations can be implemented in hardware using a primitive logic gate.

More information

Logic. Propositional Logic: Syntax

Logic. Propositional Logic: Syntax 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 information

Symbolic Trajectory Evaluation (STE): Orna Grumberg Technion, Israel

Symbolic Trajectory Evaluation (STE): Orna Grumberg Technion, Israel Symbolic Trajectory Evaluation (STE): Automatic Refinement and Vacuity Detection Orna Grumberg Technion, Israel Marktoberdort 2007 1 Agenda Model checking Symbolic Trajectory Evaluation Basic Concepts

More information

Price: $25 (incl. T-Shirt, morning tea and lunch) Visit:

Price: $25 (incl. T-Shirt, morning tea and lunch) Visit: Three days of interesting talks & workshops from industry experts across Australia Explore new computing topics Network with students & employers in Brisbane Price: $25 (incl. T-Shirt, morning tea and

More information

Abstractions and Decision Procedures for Effective Software Model Checking

Abstractions and Decision Procedures for Effective Software Model Checking Abstractions and Decision Procedures for Effective Software Model Checking Prof. Natasha Sharygina The University of Lugano, Carnegie Mellon University Microsoft Summer School, Moscow, July 2011 Lecture

More information

Proving languages to be nonregular

Proving languages to be nonregular Proving languages to be nonregular We already know that there exist languages A Σ that are nonregular, for any choice of an alphabet Σ. This is because there are uncountably many languages in total and

More information

Introduction 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 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 information

Chapter 4: Computation tree logic

Chapter 4: Computation tree logic INFOF412 Formal verification of computer systems Chapter 4: Computation tree logic Mickael Randour Formal Methods and Verification group Computer Science Department, ULB March 2017 1 CTL: a specification

More information

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning COMP219: Artificial Intelligence Lecture 20: Propositional Reasoning 1 Overview Last time Logic for KR in general; Propositional Logic; Natural Deduction Today Entailment, satisfiability and validity Normal

More information

Propositional Resolution

Propositional Resolution Artificial Intelligence Propositional Resolution Marco Piastra Propositional Resolution 1] Deductive systems and automation Is problem decidible? A deductive system a la Hilbert (i.e. derivation using

More information

Artificial Intelligence Chapter 7: Logical Agents

Artificial Intelligence Chapter 7: Logical Agents Artificial Intelligence Chapter 7: Logical Agents Michael Scherger Department of Computer Science Kent State University February 20, 2006 AI: Chapter 7: Logical Agents 1 Contents Knowledge Based Agents

More information

Contribution of Problems

Contribution of Problems Exam topics 1. Basic structures: sets, lists, functions (a) Sets { }: write all elements, or define by condition (b) Set operations: A B, A B, A\B, A c (c) Lists ( ): Cartesian product A B (d) Functions

More information

Propositional Logic: Part II - Syntax & Proofs 0-0

Propositional Logic: Part II - Syntax & Proofs 0-0 Propositional Logic: Part II - Syntax & Proofs 0-0 Outline Syntax of Propositional Formulas Motivating Proofs Syntactic Entailment and Proofs Proof Rules for Natural Deduction Axioms, theories and theorems

More information

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic: x NOT ~x x y AND x /\ y x y OR x \/ y Figure 1: Types of gates in a digital circuit. CS2742 midterm test 2 study sheet Boolean circuits: Boolean circuits is a generalization of Boolean formulas in which

More information

NP-Completeness. Algorithmique Fall semester 2011/12

NP-Completeness. Algorithmique Fall semester 2011/12 NP-Completeness Algorithmique Fall semester 2011/12 1 What is an Algorithm? We haven t really answered this question in this course. Informally, an algorithm is a step-by-step procedure for computing a

More information

Notes on induction proofs and recursive definitions

Notes on induction proofs and recursive definitions Notes on induction proofs and recursive definitions James Aspnes December 13, 2010 1 Simple induction Most of the proof techniques we ve talked about so far are only really useful for proving a property

More information

Section 1.1: Logical Form and Logical Equivalence

Section 1.1: Logical Form and Logical Equivalence Section 1.1: Logical Form and Logical Equivalence An argument is a sequence of statements aimed at demonstrating the truth of an assertion. The assertion at the end of an argument is called the conclusion,

More information

Deductive Verification

Deductive Verification Deductive Verification Mooly Sagiv Slides from Zvonimir Rakamaric First-Order Logic A formal notation for mathematics, with expressions involving Propositional symbols Predicates Functions and constant

More information

COP4020 Programming Languages. Introduction to Axiomatic Semantics Prof. Robert van Engelen

COP4020 Programming Languages. Introduction to Axiomatic Semantics Prof. Robert van Engelen COP4020 Programming Languages Introduction to Axiomatic Semantics Prof. Robert van Engelen Assertions and Preconditions Assertions are used by programmers to verify run-time execution An assertion is a

More information

Propositional Logic: Syntax

Propositional Logic: Syntax Logic Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about time (and programs) epistemic

More information

CMPE12 - Notes chapter 1. Digital Logic. (Textbook Chapter 3)

CMPE12 - Notes chapter 1. Digital Logic. (Textbook Chapter 3) CMPE12 - Notes chapter 1 Digital Logic (Textbook Chapter 3) Transistor: Building Block of Computers Microprocessors contain TONS of transistors Intel Montecito (2005): 1.72 billion Intel Pentium 4 (2000):

More information

Digital Control of Electric Drives

Digital Control of Electric Drives Digital Control of Electric Drives Logic Circuits - equential Description Form, Finite tate Machine (FM) Czech Technical University in Prague Faculty of Electrical Engineering Ver.. J. Zdenek 27 Logic

More information

Alan Bundy. Automated Reasoning LTL Model Checking

Alan Bundy. Automated Reasoning LTL Model Checking Automated Reasoning LTL Model Checking Alan Bundy Lecture 9, page 1 Introduction So far we have looked at theorem proving Powerful, especially where good sets of rewrite rules or decision procedures have

More information

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel Foundations of AI 7. Propositional Logic Rational Thinking, Logic, Resolution Wolfram Burgard and Bernhard Nebel Contents Agents that think rationally The wumpus world Propositional logic: syntax and semantics

More information

Introduction to Logic in Computer Science: Autumn 2006

Introduction to Logic in Computer Science: Autumn 2006 Introduction to Logic in Computer Science: Autumn 2006 Ulle Endriss Institute for Logic, Language and Computation University of Amsterdam Ulle Endriss 1 Plan for Today Today s class will be an introduction

More information

Decision Procedures for Satisfiability and Validity in Propositional Logic

Decision Procedures for Satisfiability and Validity in Propositional Logic Decision Procedures for Satisfiability and Validity in Propositional Logic Meghdad Ghari Institute for Research in Fundamental Sciences (IPM) School of Mathematics-Isfahan Branch Logic Group http://math.ipm.ac.ir/isfahan/logic-group.htm

More information

LOGIC PROPOSITIONAL REASONING

LOGIC 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 information

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30) Computational Logic Davide Martinenghi Free University of Bozen-Bolzano Spring 2010 Computational Logic Davide Martinenghi (1/30) Propositional Logic - sequent calculus To overcome the problems of natural

More information

Herbrand Theorem, Equality, and Compactness

Herbrand Theorem, Equality, and Compactness CSC 438F/2404F Notes (S. Cook and T. Pitassi) Fall, 2014 Herbrand Theorem, Equality, and Compactness The Herbrand Theorem We now consider a complete method for proving the unsatisfiability of sets of first-order

More information

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

First-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 information

Logic for Computer Scientists

Logic for Computer Scientists Logic for Computer Scientists Pascal Hitzler http://www.pascal-hitzler.de CS 499/699 Lecture, Spring Quarter 2010 Wright State University, Dayton, OH, U.S.A. Final version. Contents 1 Propositional Logic

More information

Deductive Systems. Lecture - 3

Deductive Systems. Lecture - 3 Deductive Systems Lecture - 3 Axiomatic System Axiomatic System (AS) for PL AS is based on the set of only three axioms and one rule of deduction. It is minimal in structure but as powerful as the truth

More information

Přednáška 12. Důkazové kalkuly Kalkul Hilbertova typu. 11/29/2006 Hilbertův kalkul 1

Přednáška 12. Důkazové kalkuly Kalkul Hilbertova typu. 11/29/2006 Hilbertův kalkul 1 Přednáška 12 Důkazové kalkuly Kalkul Hilbertova typu 11/29/2006 Hilbertův kalkul 1 Formal systems, Proof calculi A proof calculus (of a theory) is given by: A. a language B. a set of axioms C. a set of

More information

Propositional Reasoning

Propositional Reasoning Propositional Reasoning CS 440 / ECE 448 Introduction to Artificial Intelligence Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri Spring 2010 Intro to AI (CS

More information

Hoare Logic: Reasoning About Imperative Programs

Hoare Logic: Reasoning About Imperative Programs Hoare Logic: Reasoning About Imperative Programs COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2018 Programming Paradigms Functional. (Haskell, SML, OCaml,... ) main paradigm:

More information

Basing Decisions on Sentences in Decision Diagrams

Basing Decisions on Sentences in Decision Diagrams Proceedings of the Twenty-Sixth AAAI Conference on Artificial Intelligence Basing Decisions on Sentences in Decision Diagrams Yexiang Xue Department of Computer Science Cornell University yexiang@cs.cornell.edu

More information

Logical agents. Chapter 7. Chapter 7 1

Logical agents. Chapter 7. Chapter 7 1 Logical agents Chapter 7 Chapter 7 1 Outline Knowledge-based agents Logic in general models and entailment Propositional (oolean) logic Equivalence, validity, satisfiability Inference rules and theorem

More information

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B Discrete Math Review Discrete Math Review (Rosen, Chapter 1.1 1.7, 5.5) TOPICS Sets and Functions Propositional and Predicate Logic Logical Operators and Truth Tables Logical Equivalences and Inference

More information

Overview. Discrete Event Systems Verification of Finite Automata. What can finite automata be used for? What can finite automata be used for?

Overview. Discrete Event Systems Verification of Finite Automata. What can finite automata be used for? What can finite automata be used for? Computer Engineering and Networks Overview Discrete Event Systems Verification of Finite Automata Lothar Thiele Introduction Binary Decision Diagrams Representation of Boolean Functions Comparing two circuits

More information

Leonardo de Moura Microsoft Research

Leonardo 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

First Order Logic: Syntax and Semantics

First Order Logic: Syntax and Semantics CS1081 First Order Logic: Syntax and Semantics COMP30412 Sean Bechhofer sean.bechhofer@manchester.ac.uk Problems Propositional logic isn t very expressive As an example, consider p = Scotland won on Saturday

More information

NP-Complete Reductions 2

NP-Complete Reductions 2 x 1 x 1 x 2 x 2 x 3 x 3 x 4 x 4 12 22 32 CS 447 11 13 21 23 31 33 Algorithms NP-Complete Reductions 2 Prof. Gregory Provan Department of Computer Science University College Cork 1 Lecture Outline NP-Complete

More information

Z = F(X) Combinational circuit. A combinational circuit can be specified either by a truth table. Truth Table

Z = F(X) Combinational circuit. A combinational circuit can be specified either by a truth table. Truth Table Lesson Objectives In this lesson, you will learn about What are combinational circuits Design procedure of combinational circuits Examples of combinational circuit design Combinational Circuits Logic circuit

More information

Using the Prover I: Lee Pike. June 3, NASA Langley Formal Methods Group Using the Prover I:

Using the Prover I: Lee Pike. June 3, NASA Langley Formal Methods Group Using the Prover I: Basic Basic NASA Langley Formal Methods Group lee.s.pike@nasa.gov June 3, 2005 Basic Sequents Basic Sequent semantics: The conjunction of the antecedents above the turnstile implies the disjunction of

More information