Fundamentals of Software Engineering

Size: px
Start display at page:

Download "Fundamentals of Software Engineering"

Transcription

1 Fundamentals of Software Engineering First-Order Logic Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard Bubel, Reiner Hähnle (Chalmers University of Technology, Gothenburg, Sweden) Ina Schaefer FSE 1

2 Main Approaches Spin 1st part of course Abstract programs, Simple properties Concrete programs, Simple properties Abstract programs, Complex properties Concrete programs, Complex properties KeY 2nd part of course Ina Schaefer FSE 33

3 Motivation for Introducing First-Order Logic We will specify Java programs with Java Modeling Language (JML) JML combines Java expressions First-Order Logic (FOL) Ina Schaefer FSE 2

4 Motivation for Introducing First-Order Logic We will specify Java programs with Java Modeling Language (JML) JML combines Java expressions First-Order Logic (FOL) We will verify Java programs using Dynamic Logic Dynamic Logic combines First-Order Logic (FOL) Java programs Ina Schaefer FSE 3

5 FOL: Language and Calculus We introduce: FOL as a language (no formal semantics) calculus for proving FOL formulas KeY system as FOL prover (to start with) Ina Schaefer FSE 4

6 First-Order Logic: Signature Signature A first-order signature Σ consists of a set T Σ of types a set F Σ of function symbols a set P Σ of predicate symbols a typing α Σ Ina Schaefer FSE 5

7 First-Order Logic: Signature Signature A first-order signature Σ consists of a set T Σ of types a set F Σ of function symbols a set P Σ of predicate symbols a typing α Σ intuitively, the typing α Σ determines for each function and predicate symbol: its arity, i.e., number of arguments its argument types for each function symbol its result type. Ina Schaefer FSE 6

8 First-Order Logic: Signature Signature A first-order signature Σ consists of a set T Σ of types a set F Σ of function symbols a set P Σ of predicate symbols a typing α Σ intuitively, the typing α Σ determines for each function and predicate symbol: its arity, i.e., number of arguments its argument types for each function symbol its result type. formally: α Σ (p) T Σ for all p P Σ (arity of p is α Σ (p) ) α Σ (f ) T Σ T Σ for all f F Σ (arity of f is α Σ (f ) 1) Ina Schaefer FSE 7

9 Example Signature 1 + Constants T Σ1 = {int}, F Σ1 = {+, -} {..., -2, -1, 0, 1, 2,...}, P Σ1 = {<} Ina Schaefer FSE 8

10 Example Signature 1 + Constants T Σ1 = {int}, F Σ1 = {+, -} {..., -2, -1, 0, 1, 2,...}, P Σ1 = {<} α Σ1 (<) =(int,int) α Σ1 (+) =α Σ1 (-) =(int,int,int) α Σ1 (0) =α Σ1 (1) =α Σ1 (-1) =... =(int) Ina Schaefer FSE 9

11 Example Signature 1 + Constants T Σ1 = {int}, F Σ1 = {+, -} {..., -2, -1, 0, 1, 2,...}, P Σ1 = {<} α Σ1 (<) =(int,int) α Σ1 (+) =α Σ1 (-) =(int,int,int) α Σ1 (0) =α Σ1 (1) =α Σ1 (-1) =... =(int) Constants A function symbol f with α Σ1 (f ) = 1 (i.e., with arity 0) is called constant symbol. Ina Schaefer FSE 10

12 Example Signature 1 + Constants T Σ1 = {int}, F Σ1 = {+, -} {..., -2, -1, 0, 1, 2,...}, P Σ1 = {<} α Σ1 (<) =(int,int) α Σ1 (+) =α Σ1 (-) =(int,int,int) α Σ1 (0) =α Σ1 (1) =α Σ1 (-1) =... =(int) Constants A function symbol f with α Σ1 (f ) = 1 (i.e., with arity 0) is called constant symbol. here, the constants are:..., -2, -1, 0, 1, 2,... Ina Schaefer FSE 11

13 Syntax of First-Order Logic: Signature Cont d Type declaration of signature symbols Write τ x; to declare variable x of type τ Write p(τ 1,..., τ r ); for α(p) =(τ 1,..., τ r ) Write τ f (τ 1,..., τ r ); for α(f )=(τ 1,..., τ r,τ) r = 0 is allowed, then write f instead of f (), etc. Ina Schaefer FSE 12

14 Syntax of First-Order Logic: Signature Cont d Type declaration of signature symbols Write τ x; to declare variable x of type τ Write p(τ 1,..., τ r ); for α(p) =(τ 1,..., τ r ) Write τ f (τ 1,..., τ r ); for α(f )=(τ 1,..., τ r,τ) r = 0 is allowed, then write f instead of f (), etc. Example Variables integerarray a; int i; Predicates isempty(list); alerton; Functions int arraylookup(int); Object o; Ina Schaefer FSE 13

15 Example Signature 1 + Notation typing of Signature 1: α Σ1 (<) =(int,int) α Σ1 (+) =α Σ1 (-) =(int,int,int) α Σ1 (0) =α Σ1 (1) =α Σ1 (-1) =... =(int) can alternatively be written as: <(int,int); int +(int,int); int 0; int 1; int -1;... Ina Schaefer FSE 14

16 Example Signature 2 T Σ2 = {int, LinkedIntList}, F Σ2 = {null, new, elem, next} {...,-2,-1,0,1,2,...} P Σ2 = {} Ina Schaefer FSE 15

17 Example Signature 2 T Σ2 = {int, LinkedIntList}, F Σ2 = {null, new, elem, next} {...,-2,-1,0,1,2,...} P Σ2 = {} intuitively, elem and next model fields of LinkedIntList objects Ina Schaefer FSE 16

18 Example Signature 2 T Σ2 = {int, LinkedIntList}, F Σ2 = {null, new, elem, next} {...,-2,-1,0,1,2,...} P Σ2 = {} intuitively, elem and next model fields of LinkedIntList objects type declarations: Ina Schaefer FSE 17

19 Example Signature 2 T Σ2 = {int, LinkedIntList}, F Σ2 = {null, new, elem, next} {...,-2,-1,0,1,2,...} P Σ2 = {} intuitively, elem and next model fields of LinkedIntList objects type declarations: LinkedIntList null; LinkedIntList new(int,linkedintlist); int elem(linkedintlist); LinkedIntList next(linkedintlist); Ina Schaefer FSE 18

20 Example Signature 2 T Σ2 = {int, LinkedIntList}, F Σ2 = {null, new, elem, next} {...,-2,-1,0,1,2,...} P Σ2 = {} intuitively, elem and next model fields of LinkedIntList objects type declarations: LinkedIntList null; LinkedIntList new(int,linkedintlist); int elem(linkedintlist); LinkedIntList next(linkedintlist); and as before: int 0; int 1; int -1;... Ina Schaefer FSE 19

21 First-Order Terms We assume a set V of variables (V (F Σ P Σ )= ). Each v V has a unique type α Σ (v) T Σ. Ina Schaefer FSE 20

22 First-Order Terms We assume a set V of variables (V (F Σ P Σ )= ). Each v V has a unique type α Σ (v) T Σ. Terms are defined recursively: Terms A first-order term of type τ T Σ is either a variable of type τ, or has the form f (t 1,..., t n ), where f F Σ has result type τ, and each t i is term of the correct type, following the typing α Σ of f. Ina Schaefer FSE 21

23 First-Order Terms We assume a set V of variables (V (F Σ P Σ )= ). Each v V has a unique type α Σ (v) T Σ. Terms are defined recursively: Terms A first-order term of type τ T Σ is either a variable of type τ, or has the form f (t 1,..., t n ), where f F Σ has result type τ, and each t i is term of the correct type, following the typing α Σ of f. If f is a constant symbol, the term is written f, instead of f (). Ina Schaefer FSE 22

24 Terms over Signature 1 example terms over Σ 1 : (assume variables int v 1 ; int v 2 ;) Ina Schaefer FSE 23

25 Terms over Signature 1 example terms over Σ 1 : (assume variables int v 1 ; int v 2 ;) -7 +(-2, 99) -(7, 8) +(-(7, 8), 1) +(-(v 1, 8), v 2 ) Ina Schaefer FSE 24

26 Terms over Signature 1 example terms over Σ 1 : (assume variables int v 1 ; int v 2 ;) -7 +(-2, 99) -(7, 8) +(-(7, 8), 1) +(-(v 1, 8), v 2 ) some variants of FOL allow infix notation of functions: (7-8) + 1 (v 1-8) + v 2 Ina Schaefer FSE 25

27 Terms over Signature 2 example terms over Σ 2 : (assume variables LinkedIntList o; int v;) Ina Schaefer FSE 26

28 Terms over Signature 2 example terms over Σ 2 : (assume variables LinkedIntList o; int v;) -7 null new(13, null) elem(new(13, null)) next(next(o)) Ina Schaefer FSE 27

29 Terms over Signature 2 example terms over Σ 2 : (assume variables LinkedIntList o; int v;) -7 null new(13, null) elem(new(13, null)) next(next(o)) for first-order functions modeling object fields, we allow dotted postfix notation: new(13, null).elem o.next.next Ina Schaefer FSE 28

30 Atomic Formulas Logical Atoms Given a signature Σ. A logical atom has either of the forms true false t 1 = t 2 ( equality ), where t 1 and t 2 have the same type. p(t 1,..., t n ) ( predicate ), where p P Σ, and each t i is term of the correct type, following the typing α Σ of p. Ina Schaefer FSE 29

31 Atomic Formulas over Signature 1 example formulas over Σ 1 : (assume variable int v;) Ina Schaefer FSE 30

32 Atomic Formulas over Signature 1 example formulas over Σ 1 : (assume variable int v;) 7 = 8 7 < v < 99 v < (v + 1) Ina Schaefer FSE 31

33 Atomic Formulas over Signature 2 example formulas over Σ 2 : (assume variables LinkedIntList o; int v;) Ina Schaefer FSE 32

34 Atomic Formulas over Signature 2 example formulas over Σ 2 : (assume variables LinkedIntList o; int v;) new(13, null) = null elem(new(13, null)) = 13 next(new(13, null)) = null next(next(o)) = o Ina Schaefer FSE 33

35 General Formulas first-order formulas are defined recursively: Formulas each atomic formula is a formula with φ and ψ formulas, x a variable, and τ a type, the following are also formulas: φ ( not φ ) φ ψ ( φ and ψ ) φ ψ ( φ or ψ ) φ ψ ( φ implies ψ ) φ ψ ( φ is equivalent to ψ ) Ina Schaefer FSE 34

36 General Formulas first-order formulas are defined recursively: Formulas each atomic formula is a formula with φ and ψ formulas, x a variable, and τ a type, the following are also formulas: φ ( not φ ) φ ψ ( φ and ψ ) φ ψ ( φ or ψ ) φ ψ ( φ implies ψ ) φ ψ ( φ is equivalent to ψ ) τ x; φ ( for all x of type τ holds φ ) Ina Schaefer FSE 35

37 General Formulas first-order formulas are defined recursively: Formulas each atomic formula is a formula with φ and ψ formulas, x a variable, and τ a type, the following are also formulas: φ ( not φ ) φ ψ ( φ and ψ ) φ ψ ( φ or ψ ) φ ψ ( φ implies ψ ) φ ψ ( φ is equivalent to ψ ) τ x; φ ( for all x of type τ holds φ ) τ x; φ ( there exists an x of type τ such that φ ) Ina Schaefer FSE 36

38 General Formulas first-order formulas are defined recursively: Formulas each atomic formula is a formula with φ and ψ formulas, x a variable, and τ a type, the following are also formulas: φ ( not φ ) φ ψ ( φ and ψ ) φ ψ ( φ or ψ ) φ ψ ( φ implies ψ ) φ ψ ( φ is equivalent to ψ ) τ x; φ ( for all x of type τ holds φ ) τ x; φ ( there exists an x of type τ such that φ ) In τ x; φ and τ x; φ the variable x is bound (i.e., not free ). Ina Schaefer FSE 37

39 General Formulas first-order formulas are defined recursively: Formulas each atomic formula is a formula with φ and ψ formulas, x a variable, and τ a type, the following are also formulas: φ ( not φ ) φ ψ ( φ and ψ ) φ ψ ( φ or ψ ) φ ψ ( φ implies ψ ) φ ψ ( φ is equivalent to ψ ) τ x; φ ( for all x of type τ holds φ ) τ x; φ ( there exists an x of type τ such that φ ) In τ x; φ and τ x; φ the variable x is bound (i.e., not free ). Formulas with no free variable are closed. Ina Schaefer FSE 38

40 General Formulas: Examples (signatures/types left out here) Example (There are at least two elements) Ina Schaefer FSE 39

41 General Formulas: Examples (signatures/types left out here) Example (There are at least two elements) x, y; (x = y) Ina Schaefer FSE 40

42 General Formulas: Examples (signatures/types left out here) Example (Strict partial order) Ina Schaefer FSE 41

43 General Formulas: Examples (signatures/types left out here) Example (Strict partial order) Irreflexivity x; (x < x) Asymmetry x; y;(x < y (y < x)) Transitivity x; y; z; (x < y y < z x < z) Ina Schaefer FSE 42

44 General Formulas: Examples (signatures/types left out here) Example (Strict partial order) Irreflexivity x; (x < x) Asymmetry x; y;(x < y (y < x)) Transitivity x; y; z; (x < y y < z x < z) (is any of the three formulas redundant?) Ina Schaefer FSE 43

45 General Formulas: Examples (signatures/types left out here) Example (All models have infinite domain) Ina Schaefer FSE 44

46 General Formulas: Examples (signatures/types left out here) Example (All models have infinite domain) Signature and axioms of strict partial order plus Existence Successor x; y; x < y Ina Schaefer FSE 45

47 Semantics (briefly, but see Appendix) Domain A domain D is a set of elements which are (potentially) the meaning of terms and variables. Ina Schaefer FSE 46

48 Semantics (briefly, but see Appendix) Domain A domain D is a set of elements which are (potentially) the meaning of terms and variables. Interpretation An interpretation I (over D) assigns meaning to the symbols in F Σ P Σ (assigning functions to function symbols, relations to predicate symbols). Ina Schaefer FSE 47

49 Semantics (briefly, but see Appendix) Domain A domain D is a set of elements which are (potentially) the meaning of terms and variables. Interpretation An interpretation I (over D) assigns meaning to the symbols in F Σ P Σ (assigning functions to function symbols, relations to predicate symbols). Valuation In a given D and I, a closed formula evaluates to either T or F. Ina Schaefer FSE 48

50 Semantics (briefly, but see Appendix) Domain A domain D is a set of elements which are (potentially) the meaning of terms and variables. Interpretation An interpretation I (over D) assigns meaning to the symbols in F Σ P Σ (assigning functions to function symbols, relations to predicate symbols). Valuation In a given D and I, a closed formula evaluates to either T or F. Validity A closed formula is valid if it evaluates to T in all D and I. Ina Schaefer FSE 49

51 Semantics (briefly, but see Appendix) Domain A domain D is a set of elements which are (potentially) the meaning of terms and variables. Interpretation An interpretation I (over D) assigns meaning to the symbols in F Σ P Σ (assigning functions to function symbols, relations to predicate symbols). Valuation In a given D and I, a closed formula evaluates to either T or F. Validity A closed formula is valid if it evaluates to T in all D and I. In the context of specification/verification of programs: each (D, I) is called a state. Ina Schaefer FSE 50

52 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: Ina Schaefer FSE 51

53 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) Ina Schaefer FSE 52

54 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ Ina Schaefer FSE 53

55 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) Ina Schaefer FSE 54

56 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ Ina Schaefer FSE 55

57 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) Ina Schaefer FSE 56

58 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ Ina Schaefer FSE 57

59 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ (false φ) Ina Schaefer FSE 58

60 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ (false φ) φ Ina Schaefer FSE 59

61 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ (false φ) φ true φ Ina Schaefer FSE 60

62 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ (false φ) φ true φ (false φ) Ina Schaefer FSE 61

63 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ (false φ) φ true φ (false φ) (φ ψ) Ina Schaefer FSE 62

64 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ (false φ) φ true φ (false φ) (φ ψ) ( φ ψ) Ina Schaefer FSE 63

65 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ (false φ) φ true φ (false φ) (φ ψ) ( φ ψ) φ true Ina Schaefer FSE 64

66 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ (false φ) φ true φ (false φ) (φ ψ) ( φ ψ) φ true false φ Ina Schaefer FSE 65

67 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ (false φ) φ true φ (false φ) (φ ψ) ( φ ψ) φ true false φ (true φ) Ina Schaefer FSE 66

68 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ (false φ) φ true φ (false φ) (φ ψ) ( φ ψ) φ true false φ (true φ) φ Ina Schaefer FSE 67

69 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ (false φ) φ true φ (false φ) (φ ψ) ( φ ψ) φ true false φ (true φ) φ (φ false) Ina Schaefer FSE 68

70 Useful Valid Formulas Let φ and ψ be arbitrary, closed formulas (whether valid of not). The following formulas are valid: (φ ψ) φ ψ (φ ψ) φ ψ (true φ) φ (false φ) φ true φ (false φ) (φ ψ) ( φ ψ) φ true false φ (true φ) φ (φ false) φ Ina Schaefer FSE 69

71 Useful Valid Formulas Assume that x is the only variable which may appear freely in φ or ψ. The following formulas are valid: Ina Schaefer FSE 70

72 Useful Valid Formulas Assume that x is the only variable which may appear freely in φ or ψ. The following formulas are valid: ( τ x; φ) Ina Schaefer FSE 71

73 Useful Valid Formulas Assume that x is the only variable which may appear freely in φ or ψ. The following formulas are valid: ( τ x; φ) τ x; φ Ina Schaefer FSE 72

74 Useful Valid Formulas Assume that x is the only variable which may appear freely in φ or ψ. The following formulas are valid: ( τ x; φ) τ x; φ ( τ x; φ) Ina Schaefer FSE 73

75 Useful Valid Formulas Assume that x is the only variable which may appear freely in φ or ψ. The following formulas are valid: ( τ x; φ) τ x; φ ( τ x; φ) τ x; φ Ina Schaefer FSE 74

76 Useful Valid Formulas Assume that x is the only variable which may appear freely in φ or ψ. The following formulas are valid: ( τ x; φ) τ x; φ ( τ x; φ) τ x; φ ( τ x; φ ψ) Ina Schaefer FSE 75

77 Useful Valid Formulas Assume that x is the only variable which may appear freely in φ or ψ. The following formulas are valid: ( τ x; φ) τ x; φ ( τ x; φ) τ x; φ ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) Ina Schaefer FSE 76

78 Useful Valid Formulas Assume that x is the only variable which may appear freely in φ or ψ. The following formulas are valid: ( τ x; φ) τ x; φ ( τ x; φ) τ x; φ ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) ( τ x; φ ψ) Ina Schaefer FSE 77

79 Useful Valid Formulas Assume that x is the only variable which may appear freely in φ or ψ. The following formulas are valid: ( τ x; φ) τ x; φ ( τ x; φ) τ x; φ ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) Ina Schaefer FSE 78

80 Useful Valid Formulas Assume that x is the only variable which may appear freely in φ or ψ. The following formulas are valid: ( τ x; φ) τ x; φ ( τ x; φ) τ x; φ ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) Are the following formulas also valid? Ina Schaefer FSE 79

81 Useful Valid Formulas Assume that x is the only variable which may appear freely in φ or ψ. The following formulas are valid: ( τ x; φ) τ x; φ ( τ x; φ) τ x; φ ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) Are the following formulas also valid? ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) Ina Schaefer FSE 80

82 Useful Valid Formulas Assume that x is the only variable which may appear freely in φ or ψ. The following formulas are valid: ( τ x; φ) τ x; φ ( τ x; φ) τ x; φ ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) Are the following formulas also valid? ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) ( τ x; φ ψ) ( τ x; φ) ( τ x; ψ) Ina Schaefer FSE 81

83 Remark on Concrete Syntax Text book Spin KeY Negation!! Conjunction && & Disjunction Implication, > > Equivalence < > < > Universal Quantifier x; φ n/a \forall τ x; φ Existential Quantifier x; φ n/a \exists τ x; φ. Value equality = == = Ina Schaefer FSE 82

84 Part I Sequent Calculus for FOL Ina Schaefer FSE 83

85 Reasoning by Syntactic Transformation Prove Validity of φ by syntactic transformation of φ Ina Schaefer FSE 84

86 Reasoning by Syntactic Transformation Prove Validity of φ by syntactic transformation of φ Logic Calculus: Sequent Calculus based on notion of sequent: ψ 1,..., ψ m }{{} Antecedent = φ 1,..., φ n }{{} Succedent Ina Schaefer FSE 85

87 Reasoning by Syntactic Transformation Prove Validity of φ by syntactic transformation of φ Logic Calculus: Sequent Calculus based on notion of sequent: ψ 1,..., ψ m }{{} Antecedent = φ 1,..., φ n }{{} Succedent has same meaning as (ψ 1 ψ m ) (φ 1 φ n ) Ina Schaefer FSE 86

88 Reasoning by Syntactic Transformation Prove Validity of φ by syntactic transformation of φ Logic Calculus: Sequent Calculus based on notion of sequent: ψ 1,..., ψ m }{{} Antecedent = φ 1,..., φ n }{{} Succedent has same meaning as (ψ 1 ψ m ) (φ 1 φ n ) which has same meaning as {ψ 1,..., ψ m } = φ 1 φ n Ina Schaefer FSE 87

89 Notation for Sequents ψ 1,..., ψ m = φ 1,..., φ n Consider antecedent/succedent as sets of formulas, may be empty Ina Schaefer FSE 88

90 Notation for Sequents ψ 1,..., ψ m = φ 1,..., φ n Consider antecedent/succedent as sets of formulas, may be empty Schema Variables φ, ψ,... match formulas, Γ,,... match sets of formulas Characterize infinitely many sequents with a single schematic sequent Γ = φ ψ, Matches any sequent with occurrence of conjunction in succedent Call φ ψ main formula and Γ, side formulas of sequent Any sequent of the form Γ,φ = φ, is logically valid: axiom Ina Schaefer FSE 89

91 Sequent Calculus Rules Write syntactic transformation schema for sequents that reflects semantics of connectives as closely as possible RuleName Premisses {}}{ Γ 1 = 1 Γ r = r Γ= }{{} Conclusion Ina Schaefer FSE 90

92 Sequent Calculus Rules Write syntactic transformation schema for sequents that reflects semantics of connectives as closely as possible RuleName Premisses {}}{ Γ 1 = 1 Γ r = r Γ= }{{} Conclusion Meaning: For proving the Conclusion, it suffices to prove all Premisses. Ina Schaefer FSE 91

93 Sequent Calculus Rules Write syntactic transformation schema for sequents that reflects semantics of connectives as closely as possible RuleName Premisses {}}{ Γ 1 = 1 Γ r = r Γ= }{{} Conclusion Meaning: For proving the Conclusion, it suffices to prove all Premisses. Example andright Γ= φ, Γ = ψ, Γ= φ ψ, Ina Schaefer FSE 92

94 Sequent Calculus Rules Write syntactic transformation schema for sequents that reflects semantics of connectives as closely as possible RuleName Premisses {}}{ Γ 1 = 1 Γ r = r Γ= }{{} Conclusion Meaning: For proving the Conclusion, it suffices to prove all Premisses. Example andright Γ= φ, Γ = ψ, Γ= φ ψ, Admissible to have no premisses (iff conclusion is valid, eg axiom) Ina Schaefer FSE 93

95 Propositional Sequent Calculus Rules main left side (antecedent) right side (succedent) Γ= φ, Γ,φ = not Γ, φ = Γ= φ, Ina Schaefer FSE 94

96 Propositional Sequent Calculus Rules main left side (antecedent) right side (succedent) Γ= φ, Γ,φ = not Γ, φ = Γ= φ, and Γ, φ, ψ = Γ,φ ψ = Γ= φ, Γ = ψ, Γ= φ ψ, Ina Schaefer FSE 95

97 Propositional Sequent Calculus Rules main left side (antecedent) right side (succedent) Γ= φ, Γ,φ = not Γ, φ = Γ= φ, and or Γ, φ, ψ = Γ,φ ψ = Γ,φ = Γ,ψ = Γ,φ ψ = Γ= φ, Γ = ψ, Γ= φ ψ, Γ= φ, ψ, Γ= φ ψ, Ina Schaefer FSE 96

98 Propositional Sequent Calculus Rules main left side (antecedent) right side (succedent) Γ= φ, Γ,φ = not Γ, φ = Γ= φ, and or imp Γ, φ, ψ = Γ,φ ψ = Γ,φ = Γ,ψ = Γ,φ ψ = Γ= φ, Γ,ψ = Γ,φ ψ = Γ= φ, Γ = ψ, Γ= φ ψ, Γ= φ, ψ, Γ= φ ψ, Γ,φ = ψ, Γ= φ ψ, Ina Schaefer FSE 97

99 Propositional Sequent Calculus Rules main left side (antecedent) right side (succedent) Γ= φ, Γ,φ = not Γ, φ = Γ= φ, and or imp Γ, φ, ψ = Γ,φ ψ = Γ,φ = Γ,ψ = Γ,φ ψ = Γ= φ, Γ,ψ = Γ,φ ψ = Γ= φ, Γ = ψ, Γ= φ ψ, Γ= φ, ψ, Γ= φ ψ, Γ,φ = ψ, Γ= φ ψ, close Γ,φ = φ, Ina Schaefer FSE 98

100 Propositional Sequent Calculus Rules main left side (antecedent) right side (succedent) Γ= φ, Γ,φ = not Γ, φ = Γ= φ, and or imp Γ, φ, ψ = Γ,φ ψ = Γ,φ = Γ,ψ = Γ,φ ψ = Γ= φ, Γ,ψ = Γ,φ ψ = Γ= φ, Γ = ψ, Γ= φ ψ, Γ= φ, ψ, Γ= φ ψ, Γ,φ = ψ, Γ= φ ψ, close Γ,φ = φ, true Γ= true, Ina Schaefer FSE 99

101 Propositional Sequent Calculus Rules main left side (antecedent) right side (succedent) Γ= φ, Γ,φ = not Γ, φ = Γ= φ, and or imp Γ, φ, ψ = Γ,φ ψ = Γ,φ = Γ,ψ = Γ,φ ψ = Γ= φ, Γ,ψ = Γ,φ ψ = Γ= φ, Γ = ψ, Γ= φ ψ, Γ= φ, ψ, Γ= φ ψ, Γ,φ = ψ, Γ= φ ψ, close Γ,φ = φ, true Γ= true, false Γ, false = Ina Schaefer FSE 100

102 Sequent Calculus Proofs Goal to prove: G = ψ 1,..., ψ m = φ 1,..., φ n find rule R whose conclusion matches G instantiate R such that conclusion identical to G recursively find proofs for resulting premisses G 1,..., G r tree structure with goal as root close proof branch when rule without premiss encountered Goal-directed proof search In KeY tool proof displayed as Java Swing tree Ina Schaefer FSE 101

103 A Simple Proof = (p (p q)) q Ina Schaefer FSE 102

104 A Simple Proof p (p q) = q = (p (p q)) q Ina Schaefer FSE 103

105 A Simple Proof p, (p q) = q p (p q) = q = (p (p q)) q Ina Schaefer FSE 104

106 A Simple Proof p = q, p p, q = q p, (p q) = q p (p q) = q = (p (p q)) q Ina Schaefer FSE 105

107 A Simple Proof Close p = q, p p, q = q Close p, (p q) = q p (p q) = q = (p (p q)) q Ina Schaefer FSE 106

108 A Simple Proof Close p = q, p p, q = q Close p, (p q) = q p (p q) = q = (p (p q)) q Demo A proof is closed iff all its branches are closed prop.key Ina Schaefer FSE 107

109 Proving Validity of First-Order Formulas Proving a universally quantified formula Claim: τ x; φ is true How is such a claim proved in mathematics? Ina Schaefer FSE 108

110 Proving Validity of First-Order Formulas Proving a universally quantified formula Claim: τ x; φ is true How is such a claim proved in mathematics? All even numbers are divisible by 2 int x; (even(x) divbytwo(x)) Ina Schaefer FSE 109

111 Proving Validity of First-Order Formulas Proving a universally quantified formula Claim: τ x; φ is true How is such a claim proved in mathematics? All even numbers are divisible by 2 int x; (even(x) divbytwo(x)) Let c be an arbitrary number Declare unused constant int c Ina Schaefer FSE 110

112 Proving Validity of First-Order Formulas Proving a universally quantified formula Claim: τ x; φ is true How is such a claim proved in mathematics? All even numbers are divisible by 2 int x; (even(x) divbytwo(x)) Let c be an arbitrary number Declare unused constant int c The even number c is divisible by 2 prove even(c) divbytwo(c) Ina Schaefer FSE 111

113 Proving Validity of First-Order Formulas Proving a universally quantified formula Claim: τ x; φ is true How is such a claim proved in mathematics? All even numbers are divisible by 2 int x; (even(x) divbytwo(x)) Let c be an arbitrary number Declare unused constant int c The even number c is divisible by 2 prove even(c) divbytwo(c) Sequent rule -right forallright Γ= [x/c] φ, Γ= τ x; φ, [x/c] φ is result of replacing each occurrence of x in φ with c c new constant of type τ Ina Schaefer FSE 112

114 Proving Validity of First-Order Formulas Cont d Proving an existentially quantified formula Claim: τ x; φ is true How is such a claim proved in mathematics? Ina Schaefer FSE 113

115 Proving Validity of First-Order Formulas Cont d Proving an existentially quantified formula Claim: τ x; φ is true How is such a claim proved in mathematics? There is at least one prime number int x; prime(x) Ina Schaefer FSE 114

116 Proving Validity of First-Order Formulas Cont d Proving an existentially quantified formula Claim: τ x; φ is true How is such a claim proved in mathematics? There is at least one prime number int x; prime(x) Provide any witness, say, 7 Use variable-free term int 7 Ina Schaefer FSE 115

117 Proving Validity of First-Order Formulas Cont d Proving an existentially quantified formula Claim: τ x; φ is true How is such a claim proved in mathematics? There is at least one prime number int x; prime(x) Provide any witness, say, 7 Use variable-free term int 7 7 is a prime number prime(7) Ina Schaefer FSE 116

118 Proving Validity of First-Order Formulas Cont d Proving an existentially quantified formula Claim: τ x; φ is true How is such a claim proved in mathematics? There is at least one prime number int x; prime(x) Provide any witness, say, 7 Use variable-free term int 7 7 is a prime number prime(7) Sequent rule -right existsright Γ= [x/t ] φ, τ x; φ, Γ= τ x; φ, t any variable-free term of type τ Proof might not work with t! Need to keep premise to try again Ina Schaefer FSE 117

119 Proving Validity of First-Order Formulas Cont d Using a universally quantified formula We assume τ x; φ is true How is such a fact used in a mathematical proof? Ina Schaefer FSE 118

120 Proving Validity of First-Order Formulas Cont d Using a universally quantified formula We assume τ x; φ is true How is such a fact used in a mathematical proof? We know that all primes are odd int x; (prime(x) odd(x)) Ina Schaefer FSE 119

121 Proving Validity of First-Order Formulas Cont d Using a universally quantified formula We assume τ x; φ is true How is such a fact used in a mathematical proof? We know that all primes are odd int x; (prime(x) odd(x)) In particular, this holds for 17 Use variable-free term int 17 Ina Schaefer FSE 120

122 Proving Validity of First-Order Formulas Cont d Using a universally quantified formula We assume τ x; φ is true How is such a fact used in a mathematical proof? We know that all primes are odd int x; (prime(x) odd(x)) In particular, this holds for 17 Use variable-free term int 17 We know: if 17 is prime it is odd prime(17) odd(17) Ina Schaefer FSE 121

123 Proving Validity of First-Order Formulas Cont d Using a universally quantified formula We assume τ x; φ is true How is such a fact used in a mathematical proof? We know that all primes are odd int x; (prime(x) odd(x)) In particular, this holds for 17 Use variable-free term int 17 We know: if 17 is prime it is odd Sequent rule -left prime(17) odd(17) forallleft Γ, τ x; φ, [x/t ] φ = Γ, τ x; φ = t any variable-free term of type τ We might need other instances besides t! Keep premise τ x; φ Ina Schaefer FSE 122

124 Proving Validity of First-Order Formulas Cont d Using an existentially quantified formula We assume τ x; φ is true How is such a fact used in a mathematical proof? Ina Schaefer FSE 123

125 Proving Validity of First-Order Formulas Cont d Using an existentially quantified formula We assume τ x; φ is true How is such a fact used in a mathematical proof? We know such an element exists. Let s give it a new name for future reference. Ina Schaefer FSE 124

126 Proving Validity of First-Order Formulas Cont d Using an existentially quantified formula We assume τ x; φ is true How is such a fact used in a mathematical proof? We know such an element exists. Let s give it a new name for future reference. Sequent rule -left existsleft Γ, [x/c] φ = Γ, τ x; φ = c new constant of type τ Ina Schaefer FSE 125

127 Proving Validity of First-Order Formulas Cont d Using an existentially quantified formula Ina Schaefer FSE 126

128 Proving Validity of First-Order Formulas Cont d Using an existentially quantified formula Let x, y denote integer constants, both are not zero. (x. = 0), (y. = 0) = Ina Schaefer FSE 127

129 Proving Validity of First-Order Formulas Cont d Using an existentially quantified formula Let x, y denote integer constants, both are not zero. We know further that x divides y. (x. = 0), (y. = 0), int k; k x. = y = Ina Schaefer FSE 128

130 Proving Validity of First-Order Formulas Cont d Using an existentially quantified formula Let x, y denote integer constants, both are not zero. We know further that x divides y. Show: (y/x) x. = y ( / is division on integers, i.e. the equation is not always true, e.g. x =2, y = 1) (x. = 0), (y. = 0), int k; k x. = y = (y/x) x. = y Ina Schaefer FSE 129

131 Proving Validity of First-Order Formulas Cont d Using an existentially quantified formula Let x, y denote integer constants, both are not zero. We know further that x divides y. Show: (y/x) x. = y ( / is division on integers, i.e. the equation is not always true, e.g. x =2, y = 1) Proof: We know x divides y, i.e. there exists a k such that k x. = y. Let now c denote such a k. (x. = 0), (y. = 0), c x. = y = (y/x) x. = y (x. = 0), (y. = 0), int k; k x. = y = (y/x) x. = y Ina Schaefer FSE 130

132 Proving Validity of First-Order Formulas Cont d Using an existentially quantified formula Let x, y denote integer constants, both are not zero. We know further that x divides y. Show: (y/x) x =. y ( / is division on integers, i.e. the equation is not always true, e.g. x =2, y = 1) Proof: We know x divides y, i.e. there exists a k such that k x =. y. Let now c denote such a k. Hence we can replace y by c x on the right side (see slide 34). (x. = 0), (y. = 0), c x. = y = ((c x)/x) x. = y (x. = 0), (y. = 0), c x. = y = (y/x) x. = y (x. = 0), (y. = 0), int k; k x. = y = (y/x) x. = y Ina Schaefer FSE 131

133 Proving Validity of First-Order Formulas Cont d Using an existentially quantified formula Let x, y denote integer constants, both are not zero. We know further that x divides y. Show: (y/x) x =. y ( / is division on integers, i.e. the equation is not always true, e.g. x =2, y = 1) Proof: We know x divides y, i.e. there exists a k such that k x =. y. Let now c denote such a k. Hence we can replace y by c x on the right side (see slide 34)..... (x. = 0), (y. = 0), c x. = y = ((c x)/x) x. = y (x. = 0), (y. = 0), c x. = y = (y/x) x. = y (x. = 0), (y. = 0), int k; k x. = y = (y/x) x. = y Ina Schaefer FSE 132

134 Proving Validity of First-Order Formulas Cont d Example (A simple theorem about binary relations) x; y; p(x, y) = y; x; p(x, y) Untyped logic: let static type of x and y be Ina Schaefer FSE 133

135 Proving Validity of First-Order Formulas Cont d Example (A simple theorem about binary relations) y; p(c, y) = y; x; p(x, y) x; y; p(x, y) = y; x; p(x, y) -left: substitute new constant c of type for x Ina Schaefer FSE 134

136 Proving Validity of First-Order Formulas Cont d Example (A simple theorem about binary relations) y; p(c, y) = x; p(x, d) y; p(c, y) = y; x; p(x, y) x; y; p(x, y) = y; x; p(x, y) -right: substitute new constant d of type for y Ina Schaefer FSE 135

137 Proving Validity of First-Order Formulas Cont d Example (A simple theorem about binary relations) p(c, d), y; p(c, y) = x; p(x, d) y; p(c, y) = x; p(x, d) y; p(c, y) = y; x; p(x, y) x; y; p(x, y) = y; x; p(x, y) -left: free to substitute any term of type for y, choose d Ina Schaefer FSE 136

138 Proving Validity of First-Order Formulas Cont d Example (A simple theorem about binary relations) p(c, d), y; p(c, y) = p(c, d), x; p(x, y) p(c, d), y; p(c, y) = x; p(x, d) y; p(c, y) = x; p(x, d) y; p(c, y) = y; x; p(x, y) x; y; p(x, y) = y; x; p(x, y) -right: free to substitute any term of type for x, choose c Ina Schaefer FSE 137

139 Proving Validity of First-Order Formulas Cont d Example (A simple theorem about binary relations) p(c, d), y; p(c, y) = p(c, d), x; p(x, y) p(c, d), y; p(c, y) = x; p(x, d) y; p(c, y) = x; p(x, d) y; p(c, y) = y; x; p(x, y) x; y; p(x, y) = y; x; p(x, y) Close Ina Schaefer FSE 138

140 Proving Validity of First-Order Formulas Cont d Example (A simple theorem about binary relations) p(c, d), y; p(c, y) = p(c, d), x; p(x, y) p(c, d), y; p(c, y) = x; p(x, d) y; p(c, y) = x; p(x, d) y; p(c, y) = y; x; p(x, y) x; y; p(x, y) = y; x; p(x, y) Demo relsimple.key Ina Schaefer FSE 139

141 Proving Validity of First-Order Formulas Cont d Using an equation between terms We assume t. = t is true How is such a fact used in a mathematical proof? Ina Schaefer FSE 140

142 Proving Validity of First-Order Formulas Cont d Using an equation between terms We assume t. = t is true How is such a fact used in a mathematical proof? Use x =. y 1 to simplify x+1/y x =. y 1 = 1 =. x+1/y Ina Schaefer FSE 141

143 Proving Validity of First-Order Formulas Cont d Using an equation between terms We assume t. = t is true How is such a fact used in a mathematical proof? Use x =. y 1 to simplify x+1/y x =. y 1 = 1 =. x+1/y Replace x in conclusion with right-hand side of equation Ina Schaefer FSE 142

144 Proving Validity of First-Order Formulas Cont d Using an equation between terms We assume t. = t is true How is such a fact used in a mathematical proof? Use x =. y 1 to simplify x+1/y x =. y 1 = 1 =. x+1/y Replace x in conclusion with right-hand side of equation We know: x+1/y equal to y 1+1/y x. = y 1 = 1. = y 1+1/y Ina Schaefer FSE 143

145 Proving Validity of First-Order Formulas Cont d Using an equation between terms We assume t. = t is true How is such a fact used in a mathematical proof? Use x =. y 1 to simplify x+1/y x =. y 1 = 1 =. x+1/y Replace x in conclusion with right-hand side of equation We know: x+1/y equal to y 1+1/y x. = y 1 = 1. = y 1+1/y Sequent rule =-left. applyeql Γ, t =. t, [t/t ] φ = Γ, t =. t,φ = applyeqr Γ, t. = t = [t/t ] φ, Γ, t. = t = φ, Always replace left- with right-hand side (use eqsymm if necessary) t,t variable-free terms of the same type Ina Schaefer FSE 144

146 Proving Validity of First-Order Formulas Cont d Closing a subgoal in a proof We derived a sequent that is obviously valid close Γ,φ = φ, true Γ= true, false Γ, false = We derived an equation that is obviously valid eqclose Γ= t. = t, Ina Schaefer FSE 145

147 Sequent Calculus for FOL at One Glance left side, antecedent Γ, τ x; φ, [x/t ] φ = Γ, τ x; φ = Γ, [x/c] φ = Γ, τ x; φ = right side, succedent Γ= [x/c] φ, Γ= τ x; φ, Γ= [x/t ] φ, τ x; φ, Γ= τ x; φ,. = Γ, t. = t = [t/t ] φ, Γ, t. = t = φ, Γ= t. = t, (+ application rule on left side) [t/t ] φ is result of replacing each occurrence of t in φ with t t,t variable-free terms of type τ c new constant of type τ (occurs not on current proof branch) Equations can be reversed by commutativity Ina Schaefer FSE 146

148 Recap: Propositional Sequent Calculus Rules main left side (antecedent) right side (succedent) Γ= φ, Γ,φ = not Γ, φ = Γ= φ, and or imp Γ, φ, ψ = Γ,φ ψ = Γ,φ = Γ,ψ = Γ,φ ψ = Γ= φ, Γ,ψ = Γ,φ ψ = Γ= φ, Γ = ψ, Γ= φ ψ, Γ= φ, ψ, Γ= φ ψ, Γ,φ = ψ, Γ= φ ψ, close Γ,φ = φ, true Γ= true, false Γ, false = Ina Schaefer FSE 147

149 Features of the KeY Theorem Prover Demo Feature List rel.key, twoinstances.key Can work on multiple proofs simultaneously (task list) Proof trees visualized as Java Swing tree Point-and-click navigation within proof Undo proof steps, prune proof trees Pop-up menu with proof rules applicable in pointer focus Preview of rule effect as tool tip Quantifier instantiation and equality rules by drag-and-drop Possible to hide (and unhide) parts of a sequent Saving and loading of proofs Ina Schaefer FSE 148

150 Literature for this Lecture essential: W. Ahrendt Using KeY Chapter 10 in [KeYbook] further reading: M. Giese First-Order Logic Chapter 2 in [KeYbook] KeYbook B. Beckert, R. Hähnle, and P. Schmitt, editors, Verification of Object-Oriented Software: The KeY Approach, vol 4334 of LNCS (Lecture Notes in Computer Science), Springer, 2006 (access via Chalmers library E-books Lecture Notes in Computer Science) Ina Schaefer FSE 149

151 Part II Appendix: First-Order Semantics Ina Schaefer FSE 150

152 First-Order Semantics From propositional to first-order semantics In prop. logic, an interpretation of variables with {T, F } sufficed In first-order logic we must assign meaning to: variables bound in quantifiers constant and function symbols predicate symbols Each variable or function value may denote a different object Respect typing: int i, List l must denote different objects What we need (to interpret a first-order formula) 1. A collection of typed universes of objects 2. A mapping from variables to objects 3. A mapping from function arguments to function values Ina Schaefer FSE 151

153 First-Order Domains/Universes 1. A collection of typed universes of objects Definition (Universe/Domain) A non-empty set D of objects is a universe or domain Each element of D has a fixed type given by δ : D τ Notation for the domain elements of type τ T : D τ = {d D δ(d) =τ} Each type τ T must contain at least one domain element: D τ Ina Schaefer FSE 152

154 First-Order States 3. A mapping from function arguments to function values 4. The set of argument tuples where a predicate is true Definition (First-Order State) Let D be a domain with typing function δ Let f be declared as τ f (τ 1,..., τ r ); Let p be declared as p(τ 1,..., τ r ); Let I(f ):D τ 1 D τr D τ Let I(p) D τ 1 D τr Then S =(D, δ, I) is a first-order state Ina Schaefer FSE 153

155 First-Order States Cont d Example Signature: int i; short j; int f(int); Object obj; <(int,int); D = {17, 2, o} where all numbers are short I(i) = 17 I(j) = 17 I(obj) =o D int I(f ) D int D int in I(<)? (2, 2) F (2, 17) T (17, 2) F (17, 17) F One of uncountably many possible first-order states! Ina Schaefer FSE 154

156 Semantics of Reserved Signature Symbols Definition Equality symbol. = declared as. = (, ) Interpretation is fixed as I(. =) = {(d, d) d D} Referential Equality (holds if arguments refer to identical object) Exercise: write down the predicate table for example domain Ina Schaefer FSE 155

157 Signature Symbols vs. Domain Elements Domain elements different from the terms representing them First-order formulas and terms have no access to domain Example Signature: Object obj1, obj2; Domain: D = {o} In this state, necessarily I(obj1) = I(obj2) = o Ina Schaefer FSE 156

158 Variable Assignments 2. A mapping from variables to objects Think of variable assignment as environment for storage of local variables Definition (Variable Assignment) A variable assignment β maps variables to domain elements It respects the variable type, i.e., if x has type τ then β(x) D τ Definition (Modified Variable Assignment) Let y be variable of type τ, β variable assignment, d D τ : { βy d β(x) x y (x) := d x = y Ina Schaefer FSE 157

159 Semantic Evaluation of Terms Given a first-order state S and a variable assignment β it is possible to evaluate first-order terms under S and β Definition (Valuation of Terms) val S,β : Term D such that val S,β (t) D τ for t Term τ : val S,β (x) =β(x) val S,β (f (t 1,..., t r )) = I(f )(val S,β (t 1 ),..., val S,β (t r )) Ina Schaefer FSE 158

160 Semantic Evaluation of Terms Cont d Example Signature: int i; short j; int f(int); D = {17, 2, o} where all numbers are short Variables: Object obj; int x; I(i) = 17 I(j) = 17 D int I(f) Var β obj o x 17 val S,β (f(f(i)))? val S,β (x)? Ina Schaefer FSE 159

161 Semantic Evaluation of Formulas Definition (Valuation of Formulas) val S,β (φ) for φ For val S,β (p(t 1,..., t r )=T iff (val S,β (t 1 ),..., val S,β (t r )) I(p) val S,β (φ ψ) =T iff val S,β (φ) =T and val S,β (ψ) =T... as in propositional logic val S,β ( τ x; φ) =T iff val S,β d x ( τ x; φ) =T for all d D τ val S,β ( τ x; φ) =T iff val S,β d x ( τ x; φ) =T for at least one d D τ Ina Schaefer FSE 160

162 Semantic Evaluation of Formulas Cont d Example Signature: short j; int f(int); Object obj; <(int,int); D = {17, 2, o} where all numbers are short I(j) = 17 I(obj) =o D int I(f ) D int D int in I(<)? (2, 2) F (2, 17) T (17, 2) F (17, 17) F val S,β (f (j) < j)? val S,β ( int x; f (x). = x)? val S,β ( Object o1; Object o2; o1. = o2)? Ina Schaefer FSE 161

163 Semantic Notions Definition (Satisfiability, Truth, Validity) val S,β (φ) =T (φ is satisfiable) S = φ iff for all β : val S,β (φ) =T (φ is true in S) = φ iff for all S : S = φ (φ is valid) Closed formulas that are satisfiable are also true: one top-level notion Ina Schaefer FSE 162

164 Semantic Notions Definition (Satisfiability, Truth, Validity) val S,β (φ) =T (φ is satisfiable) S = φ iff for all β : val S,β (φ) =T (φ is true in S) = φ iff for all S : S = φ (φ is valid) Closed formulas that are satisfiable are also true: one top-level notion Example f (j) < j is true in S. int x; i = x is valid int x; (x. = x) is not satisfiable Ina Schaefer FSE 163

Fundamentals of Software Engineering

Fundamentals of Software Engineering Fundamentals of Software Engineering First-Order Logic Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard Bubel, Reiner Hähnle (Chalmers

More information

Software Engineering using Formal Methods

Software Engineering using Formal Methods Software Engineering using Formal Methods First-Order Logic Wolfgang Ahrendt 26th September 2013 SEFM: First-Order Logic 130926 1 / 53 Install the KeY-Tool... KeY used in Friday s exercise Requires: Java

More information

Propositional and Predicate Logic

Propositional and Predicate Logic Formal Verification of Software Propositional and Predicate Logic Bernhard Beckert UNIVERSITÄT KOBLENZ-LANDAU B. Beckert: Formal Verification of Software p.1 Propositional Logic: Syntax Special symbols

More information

Formal Methods for Java

Formal Methods for Java Formal Methods for Java Lecture 20: Sequent Calculus Jochen Hoenicke Software Engineering Albert-Ludwigs-University Freiburg January 15, 2013 Jochen Hoenicke (Software Engineering) Formal Methods for Java

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

Formal Methods for Java

Formal Methods for Java Formal Methods for Java Lecture 12: Soundness of Sequent Calculus Jochen Hoenicke Software Engineering Albert-Ludwigs-University Freiburg June 12, 2017 Jochen Hoenicke (Software Engineering) Formal Methods

More information

CS411 Notes 3 Induction and Recursion

CS411 Notes 3 Induction and Recursion CS411 Notes 3 Induction and Recursion A. Demers 5 Feb 2001 These notes present inductive techniques for defining sets and subsets, for defining functions over sets, and for proving that a property holds

More information

Notes on Satisfiability-Based Problem Solving. First Order Logic. David Mitchell October 23, 2013

Notes on Satisfiability-Based Problem Solving. First Order Logic. David Mitchell October 23, 2013 Notes on Satisfiability-Based Problem Solving First Order Logic David Mitchell mitchell@cs.sfu.ca October 23, 2013 Preliminary draft. Please do not distribute. Corrections and suggestions welcome. In this

More information

Notation for Logical Operators:

Notation for Logical Operators: Notation for Logical Operators: always true always false... and...... or... if... then...... if-and-only-if... x:x p(x) x:x p(x) for all x of type X, p(x) there exists an x of type X, s.t. p(x) = is equal

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

Outline. Overview. Syntax Semantics. Introduction Hilbert Calculus Natural Deduction. 1 Introduction. 2 Language: Syntax and Semantics

Outline. Overview. Syntax Semantics. Introduction Hilbert Calculus Natural Deduction. 1 Introduction. 2 Language: Syntax and Semantics Introduction Arnd Poetzsch-Heffter Software Technology Group Fachbereich Informatik Technische Universität Kaiserslautern Sommersemester 2010 Arnd Poetzsch-Heffter ( Software Technology Group Fachbereich

More information

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw Applied Logic Lecture 1 - Propositional logic Marcin Szczuka Institute of Informatics, The University of Warsaw Monographic lecture, Spring semester 2017/2018 Marcin Szczuka (MIMUW) Applied Logic 2018

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

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

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas. 1 Chapter 1 Propositional Logic Mathematical logic studies correct thinking, correct deductions of statements from other statements. Let us make it more precise. A fundamental property of a statement is

More information

First-Order Logic. Chapter Overview Syntax

First-Order Logic. Chapter Overview Syntax Chapter 10 First-Order Logic 10.1 Overview First-Order Logic is the calculus one usually has in mind when using the word logic. It is expressive enough for all of mathematics, except for those concepts

More information

Logic for Computer Science - Week 4 Natural Deduction

Logic for Computer Science - Week 4 Natural Deduction Logic for Computer Science - Week 4 Natural Deduction 1 Introduction In the previous lecture we have discussed some important notions about the semantics of propositional logic. 1. the truth value of a

More information

Propositions and Proofs

Propositions and Proofs Chapter 2 Propositions and Proofs The goal of this chapter is to develop the two principal notions of logic, namely propositions and proofs There is no universal agreement about the proper foundations

More information

CS 2800: Logic and Computation Fall 2010 (Lecture 13)

CS 2800: Logic and Computation Fall 2010 (Lecture 13) CS 2800: Logic and Computation Fall 2010 (Lecture 13) 13 October 2010 1 An Introduction to First-order Logic In Propositional(Boolean) Logic, we used large portions of mathematical language, namely those

More information

CHAPTER 10. Gentzen Style Proof Systems for Classical Logic

CHAPTER 10. Gentzen Style Proof Systems for Classical Logic CHAPTER 10 Gentzen Style Proof Systems for Classical Logic Hilbert style systems are easy to define and admit a simple proof of the Completeness Theorem but they are difficult to use. By humans, not mentioning

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

Automated Reasoning Lecture 5: First-Order Logic

Automated Reasoning Lecture 5: First-Order Logic Automated Reasoning Lecture 5: First-Order Logic Jacques Fleuriot jdf@inf.ac.uk Recap Over the last three lectures, we have looked at: Propositional logic, semantics and proof systems Doing propositional

More information

ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes)

ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes) ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes) Steve Vickers CS Theory Group Birmingham 2. Theories and models Categorical approach to many-sorted

More information

Informal Statement Calculus

Informal Statement Calculus FOUNDATIONS OF MATHEMATICS Branches of Logic 1. Theory of Computations (i.e. Recursion Theory). 2. Proof Theory. 3. Model Theory. 4. Set Theory. Informal Statement Calculus STATEMENTS AND CONNECTIVES Example

More information

1 FUNDAMENTALS OF LOGIC NO.10 HERBRAND THEOREM Tatsuya Hagino hagino@sfc.keio.ac.jp lecture URL https://vu5.sfc.keio.ac.jp/slide/ 2 So Far Propositional Logic Logical connectives (,,, ) Truth table Tautology

More information

Axiomatization of Typed First-Order Logic

Axiomatization of Typed First-Order Logic Axiomatization of Typed First-Order Logic Peter H Schmitt and Mattias Ulbrich Karlsruhe Institute of Technology (KIT), Dept of Informatics Am Fasanengarten 5, 76131 Karlsruhe, Germany Abstract This paper

More information

Chapter 2: Basic Notions of Predicate Logic

Chapter 2: Basic Notions of Predicate Logic 2. Basic Notions of Predicate Logic 2-1 Deductive Databases and Logic Programming (Winter 2009/2010) Chapter 2: Basic Notions of Predicate Logic Signature, Formula Interpretation, Model Implication, Consistency,

More information

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic Mathematics 114L Spring 2018 D.A. Martin Mathematical Logic 1 First-Order Languages. Symbols. All first-order languages we consider will have the following symbols: (i) variables v 1, v 2, v 3,... ; (ii)

More information

Comp487/587 - Boolean Formulas

Comp487/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 information

Chapter 1. Logic and Proof

Chapter 1. Logic and Proof Chapter 1. Logic and Proof 1.1 Remark: A little over 100 years ago, it was found that some mathematical proofs contained paradoxes, and these paradoxes could be used to prove statements that were known

More information

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P. First-Order Logic Syntax The alphabet of a first-order language is organised into the following categories. Logical connectives:,,,,, and. Auxiliary symbols:.,,, ( and ). Variables: we assume a countable

More information

A Little Logic. Propositional Logic. Satisfiability Problems. Solving Sudokus. First Order Logic. Logic Programming

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

Outline. Formale Methoden der Informatik First-Order Logic for Forgetters. Why PL1? Why PL1? Cont d. Motivation

Outline. Formale Methoden der Informatik First-Order Logic for Forgetters. Why PL1? Why PL1? Cont d. Motivation Outline Formale Methoden der Informatik First-Order Logic for Forgetters Uwe Egly Vienna University of Technology Institute of Information Systems Knowledge-Based Systems Group Motivation Syntax of PL1

More information

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims Introduction INTRODUCTION TO LOGIC 2 Syntax and Semantics of Propositional Logic Volker Halbach In what follows I look at some formal languages that are much simpler than English and define validity of

More information

A Cut-Free Calculus for Second-Order Gödel Logic

A Cut-Free Calculus for Second-Order Gödel Logic Fuzzy Sets and Systems 00 (2014) 1 30 Fuzzy Sets and Systems A Cut-Free Calculus for Second-Order Gödel Logic Ori Lahav, Arnon Avron School of Computer Science, Tel Aviv University Abstract We prove that

More information

Logic and Modelling. Introduction to Predicate Logic. Jörg Endrullis. VU University Amsterdam

Logic and Modelling. Introduction to Predicate Logic. Jörg Endrullis. VU University Amsterdam Logic and Modelling Introduction to Predicate Logic Jörg Endrullis VU University Amsterdam Predicate Logic In propositional logic there are: propositional variables p, q, r,... that can be T or F In predicate

More information

HANDOUT AND SET THEORY. Ariyadi Wijaya

HANDOUT AND SET THEORY. Ariyadi Wijaya HANDOUT LOGIC AND SET THEORY Ariyadi Wijaya Mathematics Education Department Faculty of Mathematics and Natural Science Yogyakarta State University 2009 1 Mathematics Education Department Faculty of Mathematics

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

Uniform Schemata for Proof Rules

Uniform Schemata for Proof Rules Uniform Schemata for Proof Rules Ulrich Berger and Tie Hou Department of omputer Science, Swansea University, UK {u.berger,cshou}@swansea.ac.uk Abstract. Motivated by the desire to facilitate the implementation

More information

Propositional Logic Language

Propositional Logic Language Propositional Logic Language A logic consists of: an alphabet A, a language L, i.e., a set of formulas, and a binary relation = between a set of formulas and a formula. An alphabet A consists of a finite

More information

Mathematical Preliminaries. Sipser pages 1-28

Mathematical Preliminaries. Sipser pages 1-28 Mathematical Preliminaries Sipser pages 1-28 Mathematical Preliminaries This course is about the fundamental capabilities and limitations of computers. It has 3 parts 1. Automata Models of computation

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

Intelligent Agents. First Order Logic. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University. last change: 19.

Intelligent Agents. First Order Logic. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University. last change: 19. Intelligent Agents First Order Logic Ute Schmid Cognitive Systems, Applied Computer Science, Bamberg University last change: 19. Mai 2015 U. Schmid (CogSys) Intelligent Agents last change: 19. Mai 2015

More information

Exercises 1 - Solutions

Exercises 1 - Solutions Exercises 1 - Solutions SAV 2013 1 PL validity For each of the following propositional logic formulae determine whether it is valid or not. If it is valid prove it, otherwise give a counterexample. Note

More information

MAI0203 Lecture 7: Inference and Predicate Calculus

MAI0203 Lecture 7: Inference and Predicate Calculus MAI0203 Lecture 7: Inference and Predicate Calculus Methods of Artificial Intelligence WS 2002/2003 Part II: Inference and Knowledge Representation II.7 Inference and Predicate Calculus MAI0203 Lecture

More information

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic The Importance of Being Formal Martin Henz February 5, 2014 Propositional Logic 1 Motivation In traditional logic, terms represent sets, and therefore, propositions are limited to stating facts on sets

More information

cis32-ai lecture # 18 mon-3-apr-2006

cis32-ai lecture # 18 mon-3-apr-2006 cis32-ai lecture # 18 mon-3-apr-2006 today s topics: propositional logic cis32-spring2006-sklar-lec18 1 Introduction Weak (search-based) problem-solving does not scale to real problems. To succeed, problem

More information

INTRODUCTION TO PREDICATE LOGIC HUTH AND RYAN 2.1, 2.2, 2.4

INTRODUCTION TO PREDICATE LOGIC HUTH AND RYAN 2.1, 2.2, 2.4 INTRODUCTION TO PREDICATE LOGIC HUTH AND RYAN 2.1, 2.2, 2.4 Neil D. Jones DIKU 2005 Some slides today new, some based on logic 2004 (Nils Andersen), some based on kernebegreber (NJ 2005) PREDICATE LOGIC:

More information

With Question/Answer Animations. Chapter 2

With Question/Answer Animations. Chapter 2 With Question/Answer Animations Chapter 2 Chapter Summary Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Sequences and Summations Types of

More information

First order Logic ( Predicate Logic) and Methods of Proof

First order Logic ( Predicate Logic) and Methods of Proof First order Logic ( Predicate Logic) and Methods of Proof 1 Outline Introduction Terminology: Propositional functions; arguments; arity; universe of discourse Quantifiers Definition; using, mixing, negating

More information

First Order Logic (FOL) 1 znj/dm2017

First Order Logic (FOL) 1   znj/dm2017 First Order Logic (FOL) 1 http://lcs.ios.ac.cn/ znj/dm2017 Naijun Zhan March 19, 2017 1 Special thanks to Profs Hanpin Wang (PKU) and Lijun Zhang (ISCAS) for their courtesy of the slides on this course.

More information

185.A09 Advanced Mathematical Logic

185.A09 Advanced Mathematical Logic 185.A09 Advanced Mathematical Logic www.volny.cz/behounek/logic/teaching/mathlog13 Libor Běhounek, behounek@cs.cas.cz Lecture #1, October 15, 2013 Organizational matters Study materials will be posted

More information

Propositional Logic: Deductive Proof & Natural Deduction Part 1

Propositional Logic: Deductive Proof & Natural Deduction Part 1 Propositional Logic: Deductive Proof & Natural Deduction Part 1 CS402, Spring 2016 Shin Yoo Deductive Proof In propositional logic, a valid formula is a tautology. So far, we could show the validity of

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

Part 2: First-Order Logic

Part 2: First-Order Logic Part 2: First-Order Logic First-order logic formalizes fundamental mathematical concepts is expressive (Turing-complete) is not too expressive (e. g. not axiomatizable: natural numbers, uncountable sets)

More information

Relations to first order logic

Relations to first order logic An Introduction to Description Logic IV Relations to first order logic Marco Cerami Palacký University in Olomouc Department of Computer Science Olomouc, Czech Republic Olomouc, November 6 th 2014 Marco

More information

Section 5 Circumscription. Subsection 5.1 Introducing Circumscription. TU Dresden, WS 2017/18 Introduction to Nonmonotonic Reasoning Slide 128

Section 5 Circumscription. Subsection 5.1 Introducing Circumscription. TU Dresden, WS 2017/18 Introduction to Nonmonotonic Reasoning Slide 128 Section 5 Circumscription Subsection 5.1 Introducing Circumscription TU Dresden, WS 2017/18 Introduction to Nonmonotonic Reasoning Slide 128 Circumscription developed by John McCarthy, refined by Vladimir

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

AAA615: Formal Methods. Lecture 2 First-Order Logic

AAA615: Formal Methods. Lecture 2 First-Order Logic AAA615: Formal Methods Lecture 2 First-Order Logic Hakjoo Oh 2017 Fall Hakjoo Oh AAA615 2017 Fall, Lecture 2 September 24, 2017 1 / 29 First-Order Logic An extension of propositional logic with predicates,

More information

Introduction to Logic in Computer Science: Autumn 2007

Introduction to Logic in Computer Science: Autumn 2007 Introduction to Logic in Computer Science: Autumn 2007 Ulle Endriss Institute for Logic, Language and Computation University of Amsterdam Ulle Endriss 1 Tableaux for First-order Logic The next part of

More information

Syntax of FOL. Introduction to Logic in Computer Science: Autumn Tableaux for First-order Logic. Syntax of FOL (2)

Syntax of FOL. Introduction to Logic in Computer Science: Autumn Tableaux for First-order Logic. Syntax of FOL (2) Syntax of FOL Introduction to Logic in Computer Science: Autumn 2007 Ulle Endriss Institute for Logic, Language and Computation University of Amsterdam The syntax of a language defines the way in which

More information

Logic: Propositional Logic (Part I)

Logic: Propositional Logic (Part I) Logic: Propositional Logic (Part I) Alessandro Artale Free University of Bozen-Bolzano Faculty of Computer Science http://www.inf.unibz.it/ artale Descrete Mathematics and Logic BSc course Thanks to Prof.

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

Classical First-Order Logic

Classical First-Order Logic Classical First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2009/2010 Maria João Frade (DI-UM) First-Order Logic (Classical) MFES 2009/10

More information

Predicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC)

Predicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC) University of Science and Technology of China (USTC) 09/26/2011 Overview Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic?

More information

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes These notes form a brief summary of what has been covered during the lectures. All the definitions must be memorized and understood. Statements

More information

CSCE 222 Discrete Structures for Computing. Propositional Logic. Dr. Hyunyoung Lee. !!!!!! Based on slides by Andreas Klappenecker

CSCE 222 Discrete Structures for Computing. Propositional Logic. Dr. Hyunyoung Lee. !!!!!! Based on slides by Andreas Klappenecker CSCE 222 Discrete Structures for Computing Propositional Logic Dr. Hyunyoung Lee Based on slides by Andreas Klappenecker 1 Propositions A proposition is a declarative sentence that is either true or false

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 (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

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

PREDICATE LOGIC. Schaum's outline chapter 4 Rosen chapter 1. September 11, ioc.pdf

PREDICATE LOGIC. Schaum's outline chapter 4 Rosen chapter 1. September 11, ioc.pdf PREDICATE LOGIC Schaum's outline chapter 4 Rosen chapter 1 September 11, 2018 margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 1 / 25 Contents 1 Predicates and quantiers 2 Logical equivalences

More information

Introduction to Metalogic

Introduction to Metalogic Philosophy 135 Spring 2008 Tony Martin Introduction to Metalogic 1 The semantics of sentential logic. The language L of sentential logic. Symbols of L: Remarks: (i) sentence letters p 0, p 1, p 2,... (ii)

More information

Natural Deduction for Propositional Logic

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

Advanced Topics in LP and FP

Advanced Topics in LP and FP Lecture 1: Prolog and Summary of this lecture 1 Introduction to Prolog 2 3 Truth value evaluation 4 Prolog Logic programming language Introduction to Prolog Introduced in the 1970s Program = collection

More information

Today. Proof using contrapositive. Compound Propositions. Manipulating Propositions. Tautology

Today. Proof using contrapositive. Compound Propositions. Manipulating Propositions. Tautology 1 Math/CSE 1019N: Discrete Mathematics for Computer Science Winter 2007 Suprakash Datta datta@cs.yorku.ca Office: CSEB 3043 Phone: 416-736-2100 ext 77875 Course page: http://www.cs.yorku.ca/course/1019

More information

Logic Overview, I. and T T T T F F F T F F F F

Logic Overview, I. and T T T T F F F T F F F F Logic Overview, I DEFINITIONS A statement (proposition) is a declarative sentence that can be assigned a truth value T or F, but not both. Statements are denoted by letters p, q, r, s,... The 5 basic logical

More information

Logic: The Big Picture

Logic: The Big Picture Logic: The Big Picture A typical logic is described in terms of syntax: what are the legitimate formulas semantics: under what circumstances is a formula true proof theory/ axiomatization: rules for proving

More information

First-Order Predicate Logic. Basics

First-Order Predicate Logic. Basics First-Order Predicate Logic Basics 1 Syntax of predicate logic: terms A variable is a symbol of the form x i where i = 1, 2, 3.... A function symbol is of the form fi k where i = 1, 2, 3... und k = 0,

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

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

A. Propositional Logic

A. Propositional Logic CmSc 175 Discrete Mathematics A. Propositional Logic 1. Statements (Propositions ): Statements are sentences that claim certain things. Can be either true or false, but not both. Propositional logic deals

More information

Predicate Logic. Xinyu Feng 11/20/2013. University of Science and Technology of China (USTC)

Predicate Logic. Xinyu Feng 11/20/2013. University of Science and Technology of China (USTC) University of Science and Technology of China (USTC) 11/20/2013 Overview Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic?

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

Chapter 11: Automated Proof Systems (1)

Chapter 11: Automated Proof Systems (1) Chapter 11: Automated Proof Systems (1) SYSTEM RS OVERVIEW Hilbert style systems are easy to define and admit a simple proof of the Completeness Theorem but they are difficult to use. Automated systems

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

Predicate Logic: Sematics Part 1

Predicate Logic: Sematics Part 1 Predicate Logic: Sematics Part 1 CS402, Spring 2018 Shin Yoo Predicate Calculus Propositional logic is also called sentential logic, i.e. a logical system that deals with whole sentences connected with

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

https://vu5.sfc.keio.ac.jp/slide/

https://vu5.sfc.keio.ac.jp/slide/ 1 FUNDAMENTALS OF LOGIC NO.7 PREDICATE LOGIC Tatsuya Hagino hagino@sfc.keio.ac.jp lecture URL https://vu5.sfc.keio.ac.jp/slide/ 2 So Far Propositional Logic Logical Connectives (,,, ) Truth Table Tautology

More information

Notes. Corneliu Popeea. May 3, 2013

Notes. Corneliu Popeea. May 3, 2013 Notes Corneliu Popeea May 3, 2013 1 Propositional logic Syntax We rely on a set of atomic propositions, AP, containing atoms like p, q. A propositional logic formula φ Formula is then defined by the following

More information

CS589 Principles of DB Systems Fall 2008 Lecture 4e: Logic (Model-theoretic view of a DB) Lois Delcambre

CS589 Principles of DB Systems Fall 2008 Lecture 4e: Logic (Model-theoretic view of a DB) Lois Delcambre CS589 Principles of DB Systems Fall 2008 Lecture 4e: Logic (Model-theoretic view of a DB) Lois Delcambre lmd@cs.pdx.edu 503 725-2405 Goals for today Review propositional logic (including truth assignment)

More information

1. Introduction to commutative rings and fields

1. Introduction to commutative rings and fields 1. Introduction to commutative rings and fields Very informally speaking, a commutative ring is a set in which we can add, subtract and multiply elements so that the usual laws hold. A field is a commutative

More information

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017 3. The Logic of Quantified Statements Summary Aaron Tan 28 31 August 2017 1 3. The Logic of Quantified Statements 3.1 Predicates and Quantified Statements I Predicate; domain; truth set Universal quantifier,

More information

Chapter 11: Automated Proof Systems

Chapter 11: Automated Proof Systems Chapter 11: Automated Proof Systems SYSTEM RS OVERVIEW Hilbert style systems are easy to define and admit a simple proof of the Completeness Theorem but they are difficult to use. Automated systems are

More information

Propositional Logic. Spring Propositional Logic Spring / 32

Propositional Logic. Spring Propositional Logic Spring / 32 Propositional Logic Spring 2016 Propositional Logic Spring 2016 1 / 32 Introduction Learning Outcomes for this Presentation Learning Outcomes... At the conclusion of this session, we will Define the elements

More information

Classical First-Order Logic

Classical First-Order Logic Classical First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) First-Order Logic (Classical) MFES 2008/09

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

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula:

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula: Logic: The Big Picture 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

More information

Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques

Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics Some slides based on ones by Myrto Arapinis Colin Stirling (Informatics) Discrete Mathematics

More information

1.1 Language and Logic

1.1 Language and Logic c Oksana Shatalov, Spring 2018 1 1.1 Language and Logic Mathematical Statements DEFINITION 1. A proposition is any declarative sentence (i.e. it has both a subject and a verb) that is either true or false,

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