4 Predicate / First Order Logic

Size: px
Start display at page:

Download "4 Predicate / First Order Logic"

Transcription

1 4 Predicate / First Order Logic 4.1 Syntax 4.2 Substitutions 4.3 Semantics 4.4 Equivalence and Normal Forms 4.5 Unification 4.6 Proof Procedures 4.7 Implementation of Proof Procedures 4.8 Properties First Order Logic (24th November 2008) 1

2 4.1 Syntax Definition 4.1 An alphabet of (first order) predicate logic consists of a finite or countably infinite set R of relation symbols, a finite or countably infinite set F of function symbols, a countably infinite set V of variables, the set { /1, /2, /2, /2, /2} of connectives, the set {, } of quantifiers, and the special characters (, ), and,. First Order Logic (24th November 2008) 2

3 Syntax (Continued) is called universal quantifier, is called existential quantifier. An arity n N is assigned to each function and relation symbol. Nullary function symbols are called constant symbols. Notation p, q,... relation symbols, p/n relation symbol with arity n, g, h,... function symbols, g/n function symbol with arity n, a, b,... constant symbols, X, Y,... variables, Agreement In the following we assume that R, F, and V are given. First Order Logic (24th November 2008) 3

4 Terms Definition 4.2 The set T (F, V) of terms is the smallest set satisfying the following conditions: 1. Every variable X V is a term. 2. If g/n F and {t 1,..., t n } T (F, V), then the string g(t 1,..., t n ) is a term. A term is closed or ground (instantiated), if it does not contain any variables. The set of ground terms is denoted by T (F). Notation We write g instead of g(). First Order Logic (24th November 2008) 4

5 Predicate Logic Formulas Definition 4.3 The set of atomic formulas (or, briefly, atoms) of the language L(R, F, V) is the set of strings of the form p(t 1,..., t n ), where p/n R and {t 1,..., t n } T (F, V). Notation We write p instead of p(). Definition 4.4 The set of predicate logic formulas of the language L(R, F, V) is the smallest set satisfying the following conditions: 1. Every atom is a formula. 2. If F is a formula, then F is a formula. 3. If F 1 and F 2 are formulas and /2 is a binary connective, then (F 1 F 2 ) is a formula. 4. If F is a formula, Q is a quantifier and X V, then (QX) F is a formula. Notation A (possibly indexed) denotes an atom, F, G, H (possibly indexed) denote formulas. First Order Logic (24th November 2008) 5

6 Structural Induction Structural induction theorems can be formulated for T (F, V) and L(R, F, V). Every term in T (F, V) has property E, if the following conditions are satisfied: 1. Induction basis: Every variable has property E. 2. Induction step: If f/n is an n-ary function symbol, and the terms t 1,..., t n in T (F, V) have property E, then the term f(t 1,..., t n ) also has property E. Likewise for formulas Exercise. First Order Logic (24th November 2008) 6

7 Structural Recursion Structural recursion theorems can be formulated for T (F, V) and L(R, F, V). There is exactly one function foo over the set of terms satisfying the following conditions: 1. Recursion base: The value of foo for variables and constant symbols is explicitly defined. 2. Recursion step: The value of foo for f(t 1,..., t n ), n > 0, is defined depending only on the values of foo for t 1,..., t n. Example foo(t ) = 8 < : 0 if T is a variable, 1 if T is a constant symbol, P n i=1 foo(t i) if T is of the form f(t 1,..., t n ). Likewise for formulas Exercise. First Order Logic (24th November 2008) 7

8 Subterms and Subformulas Definition 3.8 (propositional subformulas) can be extended to terms and first order formulas Exercise. Example {g(f(x), Y ), f(x), X, Y } is the set of subterms of the term g(f(x), Y ). { ( X)( Y ) (q(x) p(g(a, b), f(f(y )))), ( Y ) (q(x) p(g(a, b), f(f(y )))), (q(x) p(g(a, b), f(f(y )))), q(x), p(g(a, b), f(f(y ))) } is the set of subformulas of the formula ( X)( Y ) (q(x) p(g(a, b), f(f(y )))). First Order Logic (24th November 2008) 8

9 Free and Bound Occurrences of Variables Definition 4.5 The free occurrences of a variable in a predicate logic formula are defined as follows: 1. The free occurrences of a variable in an atomic formula F are the occurrences of a variable in F. 2. The free occurrences of a variable in a formula F are the free occurrences of a variable in F. 3. The free occurrences of a variable in a formula (F 1 F 2 ) are the free occurrences of a variable in F 1 together with the free occurrences of a variable in F The free occurrences of a variable in a formula (QX) F are the free occurrences of a variable in F without the occurrences of X. The occurrence of a variable is called bound, if it is not free. First Order Logic (24th November 2008) 9

10 Closed Terms and Formulas Remember A term is closed if it does not contain any occurrence of a variable. Definition 4.6 A closed formula (or, briefly, a sentence) is a formula, where every occurrence of a variable is bound. First Order Logic (24th November 2008) 10

11 4.2 Substitutions Definition 4.7 A substitution is a mapping σ : V T (F, V), where only a finite number of variables is not mapped to itself. Let σ be a substitution: dom(σ) = {X X V and σ(x) X}. dom(σ) is finite. σ can be represented by a finite set of pairs and vice versa. {X σ(x) X dom(σ)} If dom(σ) =, then σ is called empty substitution. ε denotes an empty substitution. The restriction of σ to a set U V of variables is defined as σ U = {X t X t σ and X U}. First Order Logic (24th November 2008) 11

12 Instances Notation Instead of σ(x) we will write Xσ in the sequel. Definition 4.8 Let σ be a substitution. σ : V T (F, V) is extended to a mapping bσ : T (F, V) T (F, V) as follows: Let t T (F, V), then tbσ = j tσ if t V, f(t 1 bσ,..., t n bσ) if t is of the form f(t 1,..., t n ). tbσ is called instance of t under bσ. If tbσ is closed, then tbσ is called ground instance of t under bσ, and bσ is said to be a ground substitution for t. Proposition 4.9 Let t be a term, µ = {X r} a substitution, and assume that variable X does not occur in t. Then, tbµ = t. First Order Logic (24th November 2008) 12

13 Composition of Substitutions Definition 4.10 Let σ and θ be substitutions. The composition σθ of σ and θ is the substitution {X t b θ X t σ and X t b θ} {Y s Y s θ and Y dom(σ)}. Corollary 4.11 For each substitution σ we find εσ = σ = σε. Proposition 4.12 Let σ and θ be substitutions. For every term t, we have t( c σθ) = (tbσ) b θ. Proof Structural induction over t Exercise. First Order Logic (24th November 2008) 13

14 Composition of Substitutions (continued) Proposition 4.13 Let t T (F, V) and σ, θ and λ be substitutions. Then: 1. t( (σθ)λ) = t( σ(θλ)). 2. (σθ)λ = σ(θλ). Proof 1. t( (σθ)λ) = (t( σθ)) c λ b (Proposition 4.12) = ((tbσ) θ) b λ b (Proposition 4.12) = (tbσ)( θλ) c (Proposition 4.12) = t( σ(θλ)) (Proposition 4.12) 2. Exercise qed Notation From now on we write σ instead of bσ. First Order Logic (24th November 2008) 14

15 More on Substitutions Definition 4.14 Let σ be a substitution. σ X = j σ σ \ {X t} if X dom(σ) if X t σ Proposition 4.15 Let σ be a substition and t a term, and assume that variable X does not occur in t. Then, tσ = tσ X. First Order Logic (24th November 2008) 15

16 Applications of Substitutions to Formulas Definition 4.16 Let σ be a substitution. The application of a substitution to a formula is defined as follows: 1. p(t 1,..., t n )σ = p(t 1 σ,..., t n σ) for every atom of the form p(t 1,..., t n ). 2. ( F )σ = (F σ). 3. (F 1 F 2 )σ = (F 1 σ F 2 σ) for every binary connective /2. 4. ((QX) F )σ = (QX) (F σ X ) for every quantifier Q. If F is a formula and F σ is closed, then F σ is called ground instance of F under σ, and σ is said to be a ground substitution for F. First Order Logic (24th November 2008) 16

17 Substitutions and Formulas Definition 4.17 conditions: A substition σ is free for F if it free according to the following 1. σ is free for F if F is an atom. 2. σ is free for F iff σ is free for F. 3. σ is free for (F G) iff σ is free for F and G. 4. σ is free for (QY ) F iff σ Y is free for F and if for all variables X, which occur freely in F and which are different from Y, we find that Y does not occur in Xσ. Theorem 4.18 If σ is free for F and θ is free for F σ, then (F σ)θ = F (σθ). First Order Logic (24th November 2008) 17

18 Proof of Theorem 4.18 (1) Theorem 4.18 If σ is free for F and θ is free for F σ, then (F σ)θ = F (σθ). Proof Structural induction on F. IA If F is an atom of the form p(t 1,..., t n ), then p(t 1,..., t n )(σθ) = p(t 1 (σθ),..., t n (σθ)) = p((t 1 σ)θ,..., (t n σ)θ) = p(t 1 σ,..., t n σ)θ = (p(t 1,..., t n )σ)θ. IH The result holds for F. IS F Let σ be free for F and θ free for ( F )σ. Because σ is free for F, so is σ for F. Because θ is free for ( F )σ and ( F )σ = (F σ), so is θ for F σ. (( F )σ)θ = ( (F σ))θ = ((F σ)θ) = (IH) (F G) Exercise. (F (σθ)) = ( F )σθ. First Order Logic (24th November 2008) 18

19 Proof of Theorem 4.18 (2) ( X) F Let σ be free ( X) F θ be free for (( X) F )σ. Because σ is free for ( X) F, so is σ X for F. Because θ is free for (( X) F )σ = ( X) (F σ X ), so is θ X for F σ X. Conjecture F (σ X θ X ) = F (σθ) X. Then: ((( X) F )σ)θ = (( X) (F σ X ))θ (Definition 4.14(4.)) = ( X) ((F σ X )θ X ) (Definition 4.14(4.)) = ( X) (F (σ X θ X )) (IH) = ( X) (F (σθ) X ) (Conjecture) = (( X) F )(σθ) (Definition 4.14(4.)) ( X) F Exercise. First Order Logic (24th November 2008) 19

20 Proof of Theorem 4.18 (3) Conjecture Under the given assumptions we find F (σ X θ X ) = F (σθ) X. Proof Because only variables occurring freely in F are replaced, it suffices to prove for each Y occurring in F that Y (σ X θ X ) = Y (σθ) X. Y = X Y (σ X θ X ) = Y = Y (σθ) X. Y X Y σ = Y σ X and Y (σθ) = Y (σθ) X. Because σ is free for ( X) F, X does not occur in Y σ. Hence, (Y σ)θ = (Y σ)θ X. Therefore, Y (σ X θ X ) = (Y σ X )θ X (Proposition 4.12) = (Y σ)θ X (X Y ) = (Y σ)θ (s.a.) = Y (σθ) (Proposition 4.12) = Y (σθ) X (X Y ) First Order Logic (24th November 2008) 20

21 Variants Definition 4.19 Let E 1 and E 2 be either two terms or two predicate logic formulas. E 1 and E 2 are called variants, if there are substitutions σ and θ such that E 1 = E 2 σ and E 2 = E 1 θ. In this case, we will call E 1 variant of E 2 and E 2 variant of E 1. If E 1 and E 2 are variants and the variables occurring in E 2 have not been used so far in the context, then E 2 is a new variant of E 1. First Order Logic (24th November 2008) 21

22 4.3 Semantics What is the meaning of predicate logic formulas? Relations and Functions Interpretations Herbrand-Interpretations Models for Closed Formulas Models for Non-Closed Formulas First Order Logic (24th November 2008) 22

23 4.3.1 Relations and Functions Let D be a set. D 2 = D D = {(d 1, d 2 ) d 1 D and d 2 D} D n = D n 1 D = {(t, d n ) t D n 1 and d n D} =: {(d 1,..., d n ) d i D, 1 i n}, n > 2 D 1 = D =: {(d) d D} D 0 = = {( )} Relations R D 2 R = {(n, m) n, m N and n < m} R D 3 R = {(x, y, z) x, y, z N and x 2 + y 2 = z 2 } R D 1 R = {(n) n N and n even} R D 0 R = or R = {( )} First Order Logic (24th November 2008) 23

24 Functions Remember Let D be a set. D 2 = D D = {(d 1, d 2 ) d 1 D and d 2 D} D n = D n 1 D = {(t, d n ) t D n 1 and d n D} =: {(d 1,..., d n ) d i D, 1 i n}, n > 2 D 1 = D =: {(d) d D} D 0 = = {( )} Functions + : N 2 N +(2, 3) 5 succ : N 1 N succ(3) 4 0 : N 0 N 0( ) 0 First Order Logic (24th November 2008) 24

25 4.3.2 Interpretations and Models Definition 4.20 A predicate logic interpretation I for a predicate logic language L(R, F, V) consists of a non-empty set D and a mapping I, which satisfies the following conditions: 1. Every n-ary function symbol g/n F is mapped to an n-ary function g I : D n D. 2. Every n-ary relation symbol p/n R is mapped to an n-ary relation p I D n. D is called domain of the interpretation. First Order Logic (24th November 2008) 25

26 Variable Assignments What is the meaning of a variable? Definition 4.21 A variable assignment wrt an interpretation I = (D, I) is a mapping Z : V D. The image of a variable X under Z is denoted by X Z. Let Z be a variable assignment and d D. {X d}z denotes the variable assignment, where: Y {X d}z = j d if Y = X, otherwise. Y Z First Order Logic (24th November 2008) 26

27 Interpretation of Terms Definition 4.22 Let I = (D, I) be an interpretation and Z a variable assignment wrt I. The meaning t I,Z of a term t T (F, V) is defined as follows: 1 For every variable X V we have X I,Z = X Z. 2 For every term of the form g(t 1,..., t n ) we have [g(t 1,..., t n )] I,Z = g I (t I,Z 1,..., t I,Z n ), where g/n F and t 1,..., t n are terms. First Order Logic (24th November 2008) 27

28 Example Let F = {h/1, g/2, a/0}. D 1 = N with successor function s/1 and addition +/2. D 2 = Z with predecessor function p/1 and subtraction /2. D 3 = set of words over Σ = {o, m} with function add m /1, which appends m to a word at the right, and function conc/2, which concatenates two words. a h g X Z g(h(a), h(h(a))) g(h(x), g(h(a), h(x))) I 1 0 s I 2 1 p I 3 o add m conc omo omomm omomomomom First Order Logic (24th November 2008) 28

29 Interpretation of Formulas Definition 4.23 Let I = (D, I) be an interpretation and Z a variable assignment wrt I. I and Z assign to every formula F L(R, F, V) a truth value F I,Z as follows: 1. [p(t 1,..., t n )] I,Z = iff (t I,Z 1,..., t I,Z n ) pi. 2. [ F ] I,Z = (F I,Z ). 3. [(F 1 F 2 )] I,Z = (F I,Z 1 F I,Z 2 ) for all binary connectives /2. 4. [( X) F ] I,Z = iff for all d D: F I,{X d}z =. 5. [( X) F ] I,Z = iff for some d D: F I,{X d}z =. First Order Logic (24th November 2008) 29

30 Interpretations of Closed Formulas Proposition 4.24 If F L(R, F, V) is closed, then F I,Z = F I,Z for all interpretations I and variable assignments Z and Z wrt I. Proof Exercise If formulas are closed, then their meaning is independent of a variable assignment. Notation If F is closed, then we write F I instead of F I,Z. First Order Logic (24th November 2008) 30

31 Substitutions and Variable Assignments Lemma 4.25 Let s, t be terms, G a formula, Y a variable, I = (D, I) an interpretation and Z a variable assignment wrt I and d D. If [t] I,Z = d, then: 1. [s{y t}] I,Z = [s] I,{Y d}z, 2. [G{Y t}] I,Z = [G] I,{Y d}z if t is free for Y in G. Proof induction on the structure of s and G Exercise. First Order Logic (24th November 2008) 31

32 4.3.3 Herbrand-Interpretations In the following we assume that F contains at least one constant. Otherwise we add a symbol a/0 to F. Definition 4.26 An interpretation I = (D, I) for a predicate logic language L(R, F, V) is a Herbrand-interpretation, if the following conditions are satisfied: 1. D = T (F); it is called Herbrand-universe. 2. For every t T (F) we have t I = t. F = {a/0, b/0, h/1, g/2}. T (F) = {a, b, h(a), h(b), g(a, a), g(a, b), g(b, a), g(b, b), h(h(a)),...}. First Order Logic (24th November 2008) 32

33 Herbrand-Interpretations and Formulas L({p/1, q/1, r/1}, {g/1, a/0}, V) F = (( X) (p(x) q(x)) ( Y ) r(g(y ))) T (F) = {a, g(a), g(g(a)),...} I 1 : p I 1 = q I 1 = r I 1 = T (F). I 1 is a model for F. I 2 : p I 2 = q I 2 = r I 2 =. I 2 is not a model for F. I 3 : p I 3 = {g(g(a)), g(g(g(g(a)))),...}, q I 3 = {a, g(a)}, r I 3 I 3 is not a model for F. = {g(g(a))}. Notation I 1 = {p(a), q(a), r(a), p(g(a)), q(g(a)), r(g(a)),...} I 2 = I 3 = {p(g(g(a))), p(g(g(g(g(a))))),..., q(a), q(g(a)), r(g(g(a)))} First Order Logic (24th November 2008) 33

34 4.3.4 Models for Closed Formulas Definition 4.27 Let I = (D, I) be an interpretation and F L(R, F, V) be closed. I is called model for F, in symbols I = F, if F I = holds. Many notions and results known from propositional logic can be extended to predicate logic. For example: Validity, satisfiability, falsifiability, unsatisfiability. E.g., a closed formula F is valid iff all interpretations are models for F. Theorem 3.12 (extended) A closed formula F is valid iff F is unsatisfiable. Theorem 3.15 (extended) Let F, F 1,..., F n be closed formulas. {F 1,..., F n } = F iff = ( F 1,..., F n F ). First Order Logic (24th November 2008) 34

35 Logical Consequence Definition 4.28 A closed formula F is a (predicate logic) consequence of a set G of closed formulas, in symbols G = F, iff every model for G is also a model for F. First Order Logic (24th November 2008) 35

36 Propositional vs. First Order Logic What is the relation between propositional and first order logic? If all relation symbols in R are nullary, then first order logic is equivalent to propositional logic. If no variables are occurring in the formulas, then first order logic is equivalent to propositional logic. First Order Logic (24th November 2008) 36

37 4.3.5 Models for Non-Closed Formulas We want to extend the notion of models for all formulas. How shall we treat free variables? Let fv : L(R, F, V) 2 V be a function, which assigns to each formula G the set of variables which occur free in G. Definition 4.29 Let G L(R, F, V) and fv(g) = {X 1,..., X n }. 1. ucl(g) := ( X 1,..., X n ) G is the universal closure of G. 2. ecl(g) := ( X 1,..., X n ) G is the existential closure of G. Definition 4.30 Let G L(R, F, V) and I be an interpretation. 1. I = u G if I = ucl(g). 2. I = e G if I = ecl(g). First Order Logic (24th November 2008) 37

38 Closures of Closed Formulas Propositition 4.31 For all sentences G we find: 1. ucl(g) = G = ecl(g). 2. I = G iff I = u G iff I = e G. In the sequel I will discuss = u. First Order Logic (24th November 2008) 38

39 Some Properties of Universal Closures = u (( X) p(x) p(x)) To show = ( X) (( X) p(x) p(x)). Suppose = ( X) (( X) p(x) p(x)). Then we find (D, I) with [( X) (( X) p(x) p(x))] I =. Then we find Z and d D with [(( X) p(x) p(x))] I,{X d}z =. But this holds only if [( X) p(x)] I = and [p(x)] I,{X d}z =, In other words, for all e D we find e p I and d p I, which is impossible. = u (p(x) ( X) p(x)) To show = ( X) (p(x) ( X) p(x)). Consider ({a, b}, I) and Z with p I = {a}. Then we find [p(x)] I,{X a}z = and [( X) p(x)] I =. Hence, [( X) (p(x) ( X) p(x))] I =. First Order Logic (24th November 2008) 39

40 4.4 Equivalence and Normal Forms Semantic Equivalence Prenex Normal Form Skolem Normal Form Clause Form First Order Logic (24th November 2008) 40

41 4.4.1 Semantic Equivalence In this subsection, formulas need not to be closed. Two formulas F and G are called semantically equivalent, in symbols F G if F I,Z = G I,Z holds for all interpretations I and all variable assignments Z wrt I. Note For closed formulas we find G F if G I = F I for all interpretations I. Theorem 3.19 (propositional semantic equivalences) holds also for first-order formulas. First Order Logic (24th November 2008) 41

42 Some Semantic Equivalences Theorem 4.32 Let F and G be formulas. The following equivalences hold: ( X) F ( X) F ( X) F ( X) F (( X) F ( X) G) ( X) (F G) (( X) F ( X) G) ( X) (F G) ( X) ( Y ) F ( Y ) ( X) F ( X) ( Y ) F ( Y ) ( X) F (( X) F G) ( X) (F G), if X does not occur free in G. (( X) F G) ( X) (F G), if X does not occur free in G. (( X) F G) ( X) (F G), if X does not occur free in G. (( X) F G) ( X) (F G), if X does not occur free in G. First Order Logic (24th November 2008) 42

43 Proof for ( X) F ( X) F Let I = (D, I) be an interpretation and Z a variable assignment wrt I. We find: [ ( X) F ] I,Z = iff [( X) F ] I,Z = iff [( X) F ] I,Z = iff F I,{X d}z = does not hold for all d D iff F I,{X d}z = holds for some d D iff F I,{X d}z = holds for some d D iff [( X) F ] I,Z =. qed First Order Logic (24th November 2008) 43

44 Standardizing Apart Replacement Theorem 3.23 holds also for predicate logic formulas. Definition 4.33 The variables occurring in a formula F are standardized apart, if no two quantifiers occurring in F bind the same variable, and no variable occurs both free and bound. Proposition 4.34 For every formula, there is a semantically equivalent formula where the variables are standardized apart. Auxiliary Proposition Let Q be a quantifier, F a formula of the form (QX) G, and Y a variable not occurring in F. Then F (QY ) G{X Y } holds. Proof Exercise. First Order Logic (24th November 2008) 44

45 Proof Sketch of Proposition 4.34 Proof Let F be a predicate logic formula. We find only finitely many, say n, occurrences of subformulas of the form (QX)G in F. We prove by induction on n that each of these occurrences can be replaced according to the auxiliary proposition. Let G be the formula obtained from F in this way. The variables occurring in G are standardized apart. qed Agreement From now on we assume wlog that variables are standardized apart. First Order Logic (24th November 2008) 45

46 4.4.2 Prenex Normal Form Definition 4.35 A formula F is in prenex normal form, if it is of the form (Q 1 X 1 )... (Q n X n ) G, where Q i {, } and n 0 holds, X 1,..., X n are variables, and G itself does not contain any further quantifier. G is called matrix of F. Proposition 4.36 There is an algorithm which transforms each sentence F into a semantically equivalent sentence F in prenex normal form. First Order Logic (24th November 2008) 46

47 An Algorithm for Transformation into Prenex Normal form While F is not in prenex normal form apply one of the following rules: ( X) G ( X) G ( X) G ( X) G ((QX) G H) (QX) (G H) (G (QX) H) (QX) (G H) ((QX) G H) (QX) (G H) (G (QX) H) (QX) (G H) Example ( ( X) ( Y ) p(x, Y ) ( Z) q(z)) (( X) ( Y ) p(x, Y ) ( Z) q(z)) (( X) ( Y ) p(x, Y ) ( Z) q(z)) ( X) (( Y ) p(x, Y ) ( Z) q(z)) ( X) ( Y ) ( p(x, Y ) ( Z) q(z)) ( X) ( Y ) ( Z)( p(x, Y ) q(z)). Soundness and termination Exercise. First Order Logic (24th November 2008) 47

48 4.4.3 Skolem Normal Form Idea We eliminate all existential quantifiers. Definition 4.37 Let L(R, F, V) be a predicate logic language. Let F S be a countable set of function symbols such that F S F = and F S contains countably many function symbols for each arity. The elements of F S are called Skolem function symbols. We now consider L(R, F F S, V). Notation Nullary Skolem function symbols are often called Skolem constant symbols. Definition 4.38 A formula is in Skolem normal form if it is of the form ( X 1 )... ( X n ) G, where n 0 holds, X 1,..., X n are variables, and G itself does not contain any further quantifier. First Order Logic (24th November 2008) 48

49 Transformation into Skolem Normal Form Let F be a formula in prenex normal form (variables are standardized apart). While F is not in Skolem normal form apply the following rule: ( X 1 )... ( X n ) ( Y ) G ( X 1 )... ( X n ) (G{Y g(x 1,..., X n )}) Theorem 4.39 If G is a Skolem normal form of the sentence F, then F is satisfiable iff G is satisfiable. The transformation into Skolem normal form preserves satisfiability. Alternatively we could have eliminated the universal quantifiers: dual Skolem Normal Form, validity preserving. First Order Logic (24th November 2008) 49

50 Proof Sketch of Theorem 4.39 Suppose F is in prenex normal form and variables are standardized apart. Auxiliary Proposition Let F be a formula in prenex normal form, where the variables are standardized apart, and F be the formula obtained from F by a single application of the replacement rule. Then the following holds: F is satisfiable iff F is satisfiable. Proof of Auxiliary Proposition Exercise. Let E be the proposition: F is a formula in prenex normal form, where all variables are standardized apart, and is satisfiable iff F is satisfiable. With F = F proposition E holds before entering the while-loop. From the Auxiliary Proposition we learn that E is a loop invariant. From Theorem 3.30 we learn that E holds after the loop has been left. The loop is left only if F is in Skolem normal form. qed First Order Logic (24th November 2008) 50

51 4.4.4 Clause Form Let F be a sentence and H a Skolem normal form of F. F is satisfiable iff H is satisfiable. H is of the form G = ( X 1 )... ( X n ) G, where X 1,..., X n are all the variables occurring in F. There are no quantifiers occurring in the matrix G. Every variable occurring in H is universally quantified. We can transform G into clause form. Let G be a formula in clause form which is semantically equivalent to G. F is satisfiable F is unsatisfiable iff G is satisfiable. iff G is unsatisfiable. First Order Logic (24th November 2008) 51

52 Example: Proving Mathematical Theorems by Machines Theorem: Let G be a group with as binary operator in infix notation and e as identity element. If, for all elements X of G, the property X X = e holds, then G is a commutative group. A group G satisfies the following axioms: A 1 If X, Y G, then also X Y G. A 2 For all X, Y, Z G holds (X (Y Z)) = ((X Y ) Z). A 3 For all X G holds X e = e X = X. A 4 For every X G there exists a unique (inverse) element X 1 G with property X X 1 = X 1 X = e. We represent X Y = Z by p(x, Y, Z) and X 1 by f(x). First Order Logic (24th November 2008) 52

53 Proving Mathematical Theorems by Machines (continued) The group axioms can be represented as follows: A 1 ( X 1 )( Y 1 )( Z 1 ) p(x 1, Y 1, Z 1 ) A 2 (( X 2 )( Y 2 )( Z 2 )( U 2 )( V 2 )( W 2 ) (p(x 2, Y 2, U 2 ), p(y 2, Z 2, V 2 ), p(u 2, Z 2, W 2 ) p(x 2, V 2, W 2 )) ( X 3 )( Y 3 )( Z 3 )( U 3 )( V 3 )( W 3 ) ( p(x 3, Y 3, U 3 ), p(y 3, Z 3, V 3 ), p(x 3, V 3, W 3 ) p(u 3, Z 3, W 3 ))) A 3 (( X 4 ) p(x 4, e, X 4 ) ( X 5 ) p(e, X 5, X 5 )) A 4 (( X 6 ) p(x 6, f(x 6 ), e) ( X 7 ) p(f(x 7 ), X 7, e)) First Order Logic (24th November 2008) 53

54 Proving Mathematical Theorems by Machines (continued) The conclusion of the theorem can be represented as follows: C (( X 8 ) p(x 8, X 8, e) (( U 9 )( V 9 )( W 9 ) (p(u 9, V 9, W 9 ) p(v 9, U 9, W 9 )))) Hence, the theorem is represented by the formula: F = ( A 1, A 2, A 3, A 4 C ) The theorem is proven if F is valid, or, equivalently, if is unsatisfiable. F = A 1, A 2, A 3, A 4, C First Order Logic (24th November 2008) 54

55 Proving Mathematical Theorems by Machines (continued) As clause form of F we obtain: [p(x 1, Y 1, g(x 1,Y 1 ))], [ p(x 2, Y 2, U 2 ), p(y 2, Z 2, V 2 ), p(u 2, Z 2, W 2 ), p(x 2, V 2, W 2 )], [ p(x 3, Y 3, U 3 ), p(y 3, Z 3, V 3 ), p(x 3, V 3, W 3 ), p(u 3, Z 3, W 3 )], [p(x 4, e, X 4 )], [p(e, X 5, X 5 )], [p(x 6, f(x 6 ), e], [p(f(x 7 ), X 7, e)], [p(x 8, X 8, e)], [p(a, b, c)], [ p(b, a, c)]. How can we show unsatisfiablity of a predicate logic formula? First Order Logic (24th November 2008) 55

56 4.5 Unification We consider terms from T (F, V). Definition 4.40 An equation is an expression of the form s t, where s and t are terms. Definition 4.41 A unification problem consists of a multiset of equations {s 1 t 1,..., s n t n } and is the question, whether there exists a substitution σ such that s i σ = t i σ holds for all 1 i n. If such a substitution σ exists, then the terms s i and t i, 1 i n, are said to be simultaneously unifiable and σ is said to be a unifier for the unification problem. First Order Logic (24th November 2008) 56

57 Example {X a, Y Z, g(w, X) g(w, a) } Unifiers: σ 1 = {X a, Y Z} σ 2 = {X a, Z Y } σ 3 = {X a, Y a, Z a} σ 4 = {X a, Y g(a, U), Z g(a, U), W a} Do you prefer unifiers over other unifiers? First Order Logic (24th November 2008) 57

58 Most General Unifiers Definition 4.42 Let σ and θ be substitutions. σ is more general than θ, in symbols σ θ, if there is a substitution λ such that σλ = θ holds. Definition 4.43 Two substitutions σ and θ are said to be variants, in symbols σ θ, if σ θ and θ σ hold. Definition 4.44 Let U be a unification problem. A substitution σ is a most general unifier for U, if σ is a unifier for U and σ θ holds for every unifier θ for U. Theorem 4.45 (Unification Theorem) Let U be a solvable unification problem. There exists a most general unifier for U. Proof Specification of a unification algorithm next slide. Proof of termination and soundness see lecture Foundations of LP. Corollary 4.46 Let U be a unfication problem and σ as well as θ mgus for U. Then, θ σ. First Order Logic (24th November 2008) 58

59 Unification Algorithm Input A unification problem U. Output A most general unifier θ for U, if U is solvable, or not unifiable, otherwise. θ := ε. While U is non-empty do: Select an equation s t from U. U := U \ {s t }. Apply one of the following rules: (1) If s t is of the form X r or r X and variable X does not occur in the term r, then θ := θ{x r} and U := U{X r}. (2) If s t is of the form X X, then do nothing. (3) If s t is of the form X r or r X, variable X occurs in the term r and r X holds, then terminate with not unifiable. (4) If s t is of the form f(s 1,..., s n ) f(t 1,..., t n ), then add the equations s 1 t 1,..., s n t n to U. (5) If s t is of the form f(s 1,..., s n ) g(t 1,..., t m ) where f g, then terminate with not unifiable. First Order Logic (24th November 2008) 59

60 4.6 Proof Methods Resolution Semantic Tableaus Calculus of Natural Deduction Other Methods Hilbert Systems Sequent Calculus Connection Method First Order Logic (24th November 2008) 60

61 4.6.1 Resolution Formulas are negated and an attempt is made to show unsatisfiability. The alphabet is the alphabet of predicate logic. The language is the set of predicate logic formulas in clause form. The only axiom is the empty clause. The derivation rules are the resolution and the factorization rule. First Order Logic (24th November 2008) 61

62 The Resolution Rule Definition 4.47 Let and be clauses, where k, m, n 0. C 1 = [p(s 1,..., s k ), L 1,..., L m ] C 2 = [ p(t 1,..., t k ), L m+1,..., L n ] If {s i t i 1 i k } is unifiable with mgu σ then C = [L 1,..., L n ]σ is called resolvent of C 1 and C 2 wrt p(s 1,..., s k ) and p(t 1,..., t k ). C has been obtained by applying the resolution rule to C 1 and C 2, where p(s 1,..., s k ) and p(t 1,..., t k ) are said to be the literals resolved upon. First Order Logic (24th November 2008) 62

63 The Factoring Rule Definition 4.48 Let C = [p(s 1,..., s k ), p(t 1,..., t k ), L 1,..., L m ] or C = [ p(s 1,..., s k ), p(t 1,..., t k ), L 1,..., L m ] be clauses, where k, m 0. If {s i t i 1 i k } is unifiable with mgu σ then C = [p(t 1,..., t k ), L 1,..., L m ]σ and C = [ p(t 1,..., t k ), L 1,..., L m ]σ, are factors of C, respectively. C has been obtained by applying the factoring rule to C. First Order Logic (24th November 2008) 63

64 Resolution Derivations and Refutations Definition 4.49 Let F = C 1,..., C n be a sentence in clause form, where C i, 1 i n, are clauses. 1. The sequence (C i 1 i n) is a resolution derivation for C. 2. If (C i 1 i m) is a resolution derivation for F, and C m+1 is obtained by applying the resolution or the factoring rule to new variants of elements from (C i 1 i m), then (C i 1 i m + 1) is a resolution derivation for F. 3. A resolution derivation for F which contains the empty clause [ ] is called resolution refutation for F. Note A resolvent can be computed from two variants of one clause. F may contain already [ ]. It suffices to consider refutations in which [ ] occurs only once. We may assume that [ ] is the last clause in a refutation. First Order Logic (24th November 2008) 64

65 Example Is the following formula unsatisfiable? Clause form: ((p(0) ( X)(p(X) p(h(x)))) p(h(h(h(h(0)))))) ( X) [p(0)], [ p(x), p(h(x))], [ p(h(h(h(h(0)))))]. Resolution refutation of the matrix: 1 [p(0)] 2 [ p(x), p(h(x))] 3 [ p(h(h(h(h(0)))))] 4 [ p(x 1 ), p(h(h(x 1 )))] res(2,2) 5 [ p(x 3 ), p(h(h(h(h(x 3 )))))] res(4,4) 6 [p(h(h(h(h(0)))))] res(1,5) 7 [ ] res(3,6) First Order Logic (24th November 2008) 65

66 Another Example The barber shaves all male inhabitants, who do not shave themselves. Clause form: ( X)( p(x, X) p(b, X)) ( X)( Y ) [p(x, X), p(b, X)], [ p(b, Y ), p(y, Y )]. Resolution refutation of the matrix: 1 [p(x, X), p(b, X)] 2 [ p(b, Y ), p(y, Y )] 3 [p(b, b)] fac(1) 4 [ p(b, b)] fac(2) 5 [ ] res(3,4) First Order Logic (24th November 2008) 66

67 Resolution Proof Definition 4.50 Let F = C 1,..., C n be a predicate logic formula in clause form and S = (C i 1 i m) a resolution derivation for F. The length of S is m n. Definition 4.51 Let F be a sentence and G a clause form of F. A resolution proof for F is a resolution refutation for G. F is called theorem of the resolution calculus, if there exists a resolution proof for F. We denote with r F that there exists a resolution proof for F. First Order Logic (24th November 2008) 67

68 Proving Mathematical Theorems by Machines (continued) 1 [p(x 1, Y 1, g(x 1, Y 2 ))] 2 [ p(x 2, Y 2, U 2 ), p(y 2, Z 2, V 2 ), p(u 2, Z 2, W 2 ), p(x 2, V 2, W 2 )] 3 [ p(x 3, Y 3, U 3 ), p(y 3, Z 3, V 3 ), p(x 3, V 3, W 3 ), p(u 3, Z 3, W 3 )] 4 [p(x 4, e, X 4 )] 5 [p(e, X 5, X 5 )] 6 [p(x 6, f(x 6 ), e)] 7 [p(f(x 7 ), X 7, e)] 8 [p(x 8, X 8, e)] 9 [p(a, b, c)] 10 [ p(b, a, c)] 11 [p(x 9, V 2, e), p(y 9, U 9, V 9 ), p(x 2, Y 2, U 2 )] res(2, 8) 13 [p(x 10, V 10, W 10 ), p(e, Z 10, W 10 ), p(x 10, Z 10, V 10 )] res(2, 8) 14 [p(x 11, V 11, U 11 ), p(y 11, e, V 11 ), p(x 11, Y 11, U 11 )] res(2, 4) 40 [p(x 12, e, W 12 ), p(e, X 12, W 12 )] res(13, 8) 43 [p(x 13, V 13, Z 13 ), p(x 13, Z 13, V 13 )] res(13, 5) 67 [p(x 14, g(x 14, Z 14 ), Z 14 )] res(43, 1) 3239 [p(e, V 15, Y 15 ), p(y 15, e, V 15 )] res(14, 5) 3325 [ p(y 16, e, a), p(b, Y 16, c)] res(10, 14) 3627 [ p(g(b, c), e, a)] res(3325, 67) 4630 [p(e, Z 17, X 17 ), p(x 17, Z 17, e)] res(3239, 43) 5199 [p(z 18, e, X 18 ), p(x 18, Z 18, e)] res(40, 4630) 5800 [ p(a, g(b, c), e)] res(3627, 5199) [p(a, V 19, e), p(b, c, V 19 )] res(11, 9) [p(a, g(b, c), e)] res(518609, 1) [ ] res(645778, 5800) First Order Logic (24th November 2008) 68

69 4.6.3 First-Order Calculus of Natural Deduction We extend the propositional calculus of natural deduction by adding introduction and elimination rules for the quantifiers. We cannot restrict ourselves to closed formulas, but must consider formulas with free variables. There are several possibilities to define models for non-closed formulas. The new inference rules depend on the these possibilities. Here we consider the universal closure of a formula. Recall R n = R {[ ]}. [ ] is nullary with [ ] I = for all interpretations I. Now we consider L(R n, F, V). First Order Logic (24th November 2008) 69

70 A Note on Substitutions Let t T (F, V). If t Y then {Y t} represents a substitution. However, if t = Y then {Y t} does not represent a substitution. In this section we agree to use {Y Y } as an acronym for ε. Note that ε and, hence, {Y Y } is free for all G L(R, F, V). First Order Logic (24th November 2008) 70

71 Additional Inference Rules Universal Quantification F ( Y ) F ( I) ( Y ) F F {Y t} ( E) Existential Quantification F {Y t} ( Y ) F ( I) ( Y ) F G F. G ( E) First Order Logic (24th November 2008) 71

72 Derivation Trees Definition 4.56 The set of derivation trees in the first-order calculus of natural deduction is the smallest set X with the following properties: 1. Each tree consisting of a single node labeled by some F L(R n, F, V) is in X as in the propositional case. 7. If F X and Y does not occur free in any uncancelled hypothesis of F, then F ( I) ( Y ) F is a derivation tree in X. 8. If ( Y ) F X, t T (F, V) and {Y t} is free for F, then ( Y ) F F {Y t} ( E) is a derivation tree in X. First Order Logic (24th November 2008) 72

73 Derivation Trees (Continued) 9. If F {Y t} X, t T (F, V) and {Y t} is free for F, then is a derivation tree in X. F {Y t} ( I) ( Y ) F 10. If ( Y ) F, F G X, Y is not free in G or in an uncancelled hypothesis of F G other than in F, and j is a new index, then ( Y ) F G F j G ( E) j is a derivation tree in X. First Order Logic (24th November 2008) 73

74 Why do we need the restriction on ( I)? Consider But p(x, 0) 1 ( I) ( X) p(x, 0) ( I) 1 (p(x, 0) ( X) p(x, 0)) ( I) ( X) (p(x, 0) ( X) p(x, 0)) ( E) (p(0, 0) ( X) p(x, 0)) = (p(0, 0) ( X) p(x, 0)). Let I = ({a, b}, I) such that 0 I = a p I = {(a, a), (b, b)} Then [p(0, 0)] I =, but [( X) p(x, 0)] I =. First Order Logic (24th November 2008) 74

75 Why do we need the restriction on ( E)? Consider ( X) ( Y ) p(x, Y ) 1 ( E) ( Y )p(y, Y ) (( X) ( Y ) p(x, Y ) ( Y ) p(y, Y )) ( I) 1 But = (( X) ( Y ) p(x, Y ) ( Y ) p(y, Y )). Let I = ({a, b}, I) with p I = {(a, a), (b, b)}. Then [( X) ( Y ) p(x, Y )] I =, but [ ( Y ) p(y, Y ))] I =. First Order Logic (24th November 2008) 75

76 Some Examples If X fv(f ) then n (( X) F F ) ( X) F 1 F 1 ( E) F ( X) F (( X) F F ) ( I) ( I) 1 Note that {X X} is free for F in ( E) and that X fv(f ) in ( I). If X fv(f ) then n (( X) F F ) ( X) F 1 F 2 ( E) 2 F 1 F ( X) F (( X) F F ) ( I) ( I) 1 Note that {X X} is free for F in ( I) and that X fv(f ) in ( E). First Order Logic (24th November 2008) 76

77 Another Example n (( X) F ( X) F ) ( X) F 4 ( E) F 1 F [ ] ( E) F 3 ( X) F 2 ( X) F 2 ( X) F ( X) F ( E) (f) ( E) 1 ( X) F 4 [ ] (raa) 3 ( X) F ( I) ( E) [ ] ( I) 2 F ( I) ( X) F ( X) F ( I) 4 (( X) F ( X) F ) First Order Logic (24th November 2008) 77

78 Comments The first-order calculus of natural deduction is sound and complete wrt = u, i.e., n F iff = u F (see e.g. van Dalen: Logic and Structure. Springer 1997). The first-order calculus of natural deduction is incomplete wrt = e : Consider F = (p(a) p(x)). We find = e F and = u F. Because the calculus is sound and complete wrt = u we conclude n F. First Order Logic (24th November 2008) 78

79 4.8 Properties Herbrand interpretations For each interpretation there is a corresponding Herbrand interpretation Soundness and completeness = F iff r F Compactness F is satisfiable iff each finite subset of F is satisfiable Undecidability The question whether F = G is undecidable in first-order logic. First Order Logic (24th November 2008) 79

80 Completeness of the Resolution Method Overview {F 1,..., F n } = F Theorem 3.17 (extended) ( F 1,..., F n F ) is valid Theorem 3.14 (extended) ( F 1,..., F n F ) is unsatisfiable Theorem 4.39 G is unsatisfiable, where G is a clause form of ( F 1,..., F n F ) Theorem 4.62 {Cσ C is clause in G and σ is ground substitution for C} is unsatisfiable Bijection ground atoms propositional variables H is unsatisfiable, where H is the set of propositional clauses corresponding to {Cσ...} Corollary 3.46 finite subset H H is unsatisfiable Theorem 3.49 there is a propositional resolution refutation for H Bijection ground atoms propositional variables there is a first-order resolution refutation for H Lemma 4.66 there is a first-order resolution refutation for G Definition 4.51 there is a first-order resolution proof for ( F 1,..., F n F ) First Order Logic (24th November 2008) 80

81 4.8.1 Herbrand Interpretations F = {a/0, f/1} and R = {p/1, q/1, r/1}. G = ( X)( Y ) [p(x), q(x)], [r(f(y ))] Herbrand universe: T (F) = {a, f(a), f(f(a))...}. Herbrand interpretations, e.g.: I 1 = {p(a), q(a), r(f(a)), p(f(a)), q(f(a)), r(f(f(a))),...} I 2 =. Different interpretations, e.g.: I 3 = (D, I3) where D = {0, 1}, a 0, f/1 f /1 : D D with f (0) = 1 and f (1) = 0, p I = {0}, q I = {0}, r I = {0}. We can construct a corresponding Herbrand interpretation! First Order Logic (24th November 2008) 81

82 Corresponding Herbrand Interpretations Definition 4.58 Let I = (D, I) be an interpretation and {t 1,..., t n } T (F). A Herbrand interpretation J is called corresponding to I if the following condition is satisfied: for all relation symbols p/n holds: p(t 1,..., t n ) I = iff p(t 1,..., t n ) J. First Order Logic (24th November 2008) 82

83 Example Consider again I 3 = (D, I3) with D = {0, 1}, a 0, f/1 f /1 : D D mit f (0) = 1 and f (1) = 0, p I = {0}, q I = {0}, r I = {0}. Set of ground atoms: {p(a), q(a), r(a), r(f(a)), p(f(a)), q(f(a)), r(f(f(a))),...} Meaning under I 3 : p(a) q(a) r(a) r(f(a)) p(f(a)) q(f(a)) r(f(f(a))) Corresponding Herbrand interpretation: J 3 = {p(a), q(a), r(a), p(f(f(a))),...} First Order Logic (24th November 2008) 83

84 Interpretation vs. Herbrand Interpretation Lemma 4.59 If an interpretation I is a model for a predicate logic sentence F in Skolem normal form, then every Herbrand interpretation corresponding to I is also a model for F. Proof Exercise. Implication The real numbers cannot be characterized within predicate logic. Suppose, the real numbers can be characterized. Then there exists a sentence F such that for all I = (D, I) we find: F I = iff D is uncountable. Select I with F I =. Let J be the Herbrand interpretation corresponding to I. Then F J =. But the domain of Herbrand interpretations is countable. Contradiction qed First Order Logic (24th November 2008) 84

85 Interpretations vs. Herbrand Interpretations (continued) Theorem 4.60 A predicate logic sentence F in Skolem normal form is unsatisfiable iff F is mapped to under each Herbrand interpretation. Proof immediate. Suppose, F is mapped to under each Herbrand interpretation, but is satisfiable. Then there exists an I with F I =. Let J be the Herbrand interpretation corresponding to I. By Lemma 4.59 we find F J =. Contradiction qed First Order Logic (24th November 2008) 85

86 Interpretations vs. Herbrand Interpretations (cont.) Lemma 4.59 and Theorem 4.60 hold only for formulas in Skolem normal form. Example Let F = {a/0}, R = {p/1} and X V. Consider F = (p(a) ( X) p(x)). Let I = ({1, 2}, I) with a I = 1 and p I = {1}. Then, (p(a) ( X) p(x)) I = p(a) I (( X) p(x)) I = a I p I (( X) p(x)) I = 1 {1} (( X) p(x)) I = (( X) p(x)) I = (( X) p(x)) I = because 2 {1} T (F) = {a} I = {p(a)} is the Herbrand interpretation corresponding to I. F I = Lemma 4.59 does not carry over. For I = we find F I = Theorem 4.60 does not carry over. First Order Logic (24th November 2008) 86

87 Further Properties Proposition 4.61 Let F be a predicate logic formula, I a Herbrand interpretation, Z a variable assignment wrt I, and t 1,..., t n T (F). Then, Proof Exercise. F I,{X 1 t 1 }...{X n tn}z = [F {X 1 t 1,..., X n t n }] I,Z. First Order Logic (24th November 2008) 87

88 Further Properties (continued) Theorem 4.62 Let F = C 1,..., C n be a sentence in clause form. F is satisfiable iff {C i σ 1 i n, σ is a ground substitution for C i } is satisfiable. Proof Let X 1,..., X k be all variables occurring in C 1,..., C n. F is satisfiable iff there exists a Herbrand model for F (Lemma 4.59). I = F iff [ C 1,..., C n ] I,{X 1 t 1 }...{X k t k }Z = for all t 1,..., t k T (F) and arbitrary Z iff [ C 1,..., C n {X 1 t 1,..., X k t k }] I = for all t 1,..., t k T (F) (Proposition 4.61) iff [ C 1,..., C n σ] I = for all ground substitutions σ for C 1,..., C n iff [C i σ] I = for 1 i n and all ground substitutions σ for C i iff I = {C i σ 1 i n, σ ground substitution for C i }. qed First Order Logic (24th November 2008) 88

89 Example Let F = {a/0, s/1}, R = {p/1, q/1} and X, Y V. Consider: We obtain: F = C 1, C 2 = ( X)( Y ) [p(x)], [ q(s(y ))]. G = {C i σ 1 i 2, σ ground substitution for C i } = {[p(a)], [p(s(a))],...} {[ q(s(a))], [ q(s(s(a)))],...} Obviously: I = F iff I = G. First Order Logic (24th November 2008) 89

90 4.8.2 Soundness and Completeness Theorems First Order Resolution Lemma 4.63 Let F = C 1,..., C n be a first order sentence in clause form with clauses C i, 1 i n, and let C be a resolvent or a factor of new variants of clauses from F. Then F C 1,..., C n, C. Proof Observe: C 1,..., C n, C (F C). To show: for all I: I = F iff I = (F C). If I = (F C) then I = F for all I. Suppose, I = F. 1st C is a factor Exercise. 2nd Let C = [L 1,..., L n ]σ resolvent of C = [p(s 1,..., s k ), L 1,..., L m ] and C = [ p(t 1,..., t k ), L m+1,..., L n ], where C and C are new variants of clauses from F and σ is a mgu for {s i t i 1 i k }. First Order Logic (24th November 2008) 90

91 Proof of Lemma 4.63 (continued) Suppose, I is not a model for C. Then we find a variable assignment Z wrt. I with [L 1 σ] I,Z... [L n σ] I,Z =. (1) Because I = F we find: I = (C σ) and I = (C σ). Hence: [p(s 1,..., s k )σ] I,Z [L 1 σ] I,Z... [L m σ] I,Z = (2) and [ p(t 1,..., t k )σ] I,Z [L m+1 σ] I,Z... [L n σ] I,Z = (3) Because of (1) and (2) we conclude: [p(s 1,..., s k )σ] I,Z =. Because of (1) and (3) we conclude: [ p(t 1,..., t k )σ] I,Z =. Contradiction, because s i σ = t i σ for all 1 i k. qed First Order Logic (24th November 2008) 91

92 Example Consider the sentence: (( X)p(X) ( Y ) (p(y ) q(y ))). It s clause form is: ( X)( Y ) [p(x)], [ p(y ), q(y )]. As a resolvent of new variants of the two clauses we obtain: [q(z)]. We find: [p(x)], [ p(y ), q(y )] [p(x)], [ p(y ), q(y )], [q(z)]. First Order Logic (24th November 2008) 92

93 Generalized Resolution Lemma Lemma 4.64 Let F = C 1,..., C n be a predicate logic sentence in clauseform and (C i 1 i m) a resolution derivation for F. Then: F C 1,..., C m. Proof Structural induction on the length k = m n of the resolution derivation. IB k = 0: immediate because n = m. IH Suppose the proposition holds for k. IS Let (C i 1 i m + 1) be a resolution derivation of length k + 1. From IH we conclude: F C 1,..., C m. From Lemma 4.63 we conclude: C 1,..., C m C 1,..., C m, C m+1. Because is transitive, we conclude F C 1,..., C m+1. The proposition follows by an application of the induction theorem. qed First Order Logic (24th November 2008) 93

94 The Lifting-Lemma Lemma 4.65 (Lifting-Lemma) Let C 1 and C 2 be clauses and σ a ground substitution for C 1 and C 2. (i) If C is a resolvent of C 1 σ and C 2 σ, then there exists a resolvent C of C 1 and C 2 as well as a substitution λ, such that C λ = C holds. (ii) If C is a factor of C 1 σ, then there exists a factor C of C 1 as well as a substitution λ, such that C λ = C holds. First Order Logic (24th November 2008) 94

95 Proof of the Lifting-Lemma Proof (i) C 1 = [p(s 1,..., s k ), L 1,..., L m ], C 2 = [ p(t 1,..., t k ), L m+1,..., L n ]. s i σ = t i σ for 1 i k, because σ is a ground substitution for C 1 and C 2. C = [L 1,..., L n ]σ. σ is a unifier for U = {s 1 t 1,..., s k t k }. We find an mgu θ for U and λ, such that: θλ = σ (Theorem 4.45). C = [L 1,..., L n ]θ is resolvent for C 1 and C 2. C λ = [L 1,..., L n ]θλ = [L 1,..., L n ]σ = C. (ii) Exercise qed First Order Logic (24th November 2008) 95

96 Example Consider: C 1 = [ p(w )], C 2 = [p(f(x)), q(x)], σ = {X a, W f(a)}. Then: C 1 σ = [ p(f(a))], C 2 σ = [p(f(a)), q(a)]. As resolvent of C 1 σ and C 2 σ we obtain: C = [ q(a)] As resolvent of C 1 and C 2 with mgu θ = {W f(x)} we obtain C = [ q(x)] With λ = {X a} we find C λ = C and θλ = σ. First Order Logic (24th November 2008) 96

97 The Generalized Lifting Lemma Lemma 4.66 (Generalized Lifting Lemma) Let C j be clauses and σ j ground substitutions for C j, 1 j n. If there is a resolution derivation (B i 1 i m) for C 1 σ 1,..., C n σ n, then there is a resolution derivation (B i 1 i m) for C 1,..., C n and a sequence (λ i 1 i m) of substitutions such that B i λ i = B i for all 1 i m. Proof Induction on the length l = m n of the derivation (B i 1 i m). IB l = 0: In this case n = m and the proposition follows with B i λ i = σ i for all 1 i n. IH Suppose the proposition holds for l. = C i and IS Let (B i 1 i m + 1) be a resolution derivation of length l + 1. Because of IH we find a resolution derivation (B i 1 i m) of length l for C 1,..., C n and a sequence (λ i 1 i m) of substitutions with B i λ i = B i for all 1 i m. ( ) 1st B m+1 is a factor Exercise 2nd B m+1 is a resolvent next slide First Order Logic (24th November 2008) 97

98 Proof Generalized Lifting Lemma (Cont.) Let B m+1 be the resolvent of B j and B k with j, k m. Because of ( ) we find B j and λ j with B j λ j = B j. Let B j be a new variant of B j. Then there is a substitution θ j with B j θ j = B j. Alltogether: B j = B j λ j = (B j θ j)λ j = B j (θ jλ j ). Analogously we find B k, λ k and θ k with B k = B k λ k = (B k θ k)λ k = B k (θ kλ k ). Because B j dom((θ j λ j ) V ar(b and B k are new variants, we conclude: j )) dom((θ kλ k ) V ar(b )) =. k Let σ = (θ j λ j ) V ar(b j ) (θ kλ k ) V ar(b k ). Hence we obtain: B j σ = B j and B k σ = B k. Because of the Lifting Lemma we find a resolvent B m+1 a substitution λ m+1 with B m+1 λ m+1 = B m+1. of B j and B k as well as Together with ( ) we obtain a resolution derivation (B i 1 i m + 1) and a sequence (λ i 1 i m + 1) with B i λ i = B i for all 1 i m + 1. An application of the induction theorem yields the desired result. qed First Order Logic (24th November 2008) 98

99 Example 1 Consider the clauses with [ p(w )], [p(f(x)), q(x)], [q(g(y )), r(y )], [r(z)] σ = {W f(g(a)), X g(a), Y a, Z a}. We obtain the following derivations: B 1 [ p(f(g(a)))] B 1 [ p(w )] B 2 [p(f(g(a))), q(g(a))] B 2 [p(f(x)), q(x)] B 3 [q(g(a)), r(a)] B 3 [q(g(y )), r(y )] B 4 [r(a)] B 4 [r(z)] B 5 [ q(g(a))] B 5 [ q(x 2 )] res(1,2) B 6 [ r(a)] B 6 [ r(y 3 )] res(3,5) B 7 [ ] B 7 [ ] res(4,6) First Order Logic (24th November 2008) 99

100 Example 2 Consider the clauses [p(a)], [ p(x), p(f(x))], [ p(y ), p(f(y ))], [ p(f(f(a)))] with σ = {X a, Y f(a)}. We obtain the derivations: B 1 [p(a)] B 1 [p(a)] B 2 [ p(a), p(f(a))] B 2 [ p(x), p(f(x))] B 3 [ p(f(a)), p(f(f(a)))] B 3 [ p(y ), p(f(y ))] B 4 [ p(f(f(a)))] B 4 [ p(f(f(a)))] B 5 [ p(a), p(f(f(a)))] B 5 [ p(x 1 ), p(f(f(x 1 )))] res(2,3) B 6 [p(f(f(a)))] B 6 [p(f(f(a)))] res(1,5) B 7 [ ] B 7 [ ] res(4,6) First Order Logic (24th November 2008) 100

101 Closed Formulas and Propositional Logic Let F be a generalized conjunction of ground-instantiated clauses. F = [p(a)], [ p(f(f(a)))], [ p(a), p(f(a))], [ p(f(a)), p(f(f(a)))] Let G be the set of ground atoms occurring in F. G = {p(a), p(f(a)), p(f(f(a)))} Let V be a sufficiently large set of propositional variables. V = {p 1, p 2, p 3 } We find a bijection between G and V. p(a) p 1, p(f(a)) p 2, p(f(f(a))) p 3 All propositional results are applicable to F. First Order Logic (24th November 2008) 101

102 The Resolution Theorem Theorem 4.67 (Resolution Theorem) Let F = C 1,..., C l be a sentence in clause form. F is unsatisfiable iff there is a resolution refutation for F. Proof Let (C i 1 i m) be a resolution refutation for F. Lemma 4.64: F C 1,..., C m. Because of C m = [ ] and Theorem 3.19 (unsatisfiability) we conclude F [ ]. Hence, F is unsatisfiable. First Order Logic (24th November 2008) 102

103 Proof of the Resolution Theorem (cont.) Suppose, F is unsatisfiable. Then, G = {C i σ 1 i l, σ ground substitution for C i } is unsatisfiable (Theorem 4.62). To each ground atom occurring in G we can assign a propositional variable such that any two atoms are mapped to different variables. Then, we find a finite subset {C 1 σ 1,..., C m σ m } G, which is propositionally unsatisfiable (Corollary 3.46). Then, we find a propositional resolution refutation for C 1 σ 1,..., C m σ m (Theorems 3.14 and 3.49). Then, we find a predicate logic resolution refutation for C 1,..., C m (Lemma 4.66). By construction each C j, 1 j m, is a clause occurring in F. Hence, we obtain a resolution refutation for F (by eliminating variants of {C 1,..., C m }). qed First Order Logic (24th November 2008) 103

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

3 Propositional Logic

3 Propositional Logic 3 Propositional Logic 3.1 Syntax 3.2 Semantics 3.3 Equivalence and Normal Forms 3.4 Proof Procedures 3.5 Properties Propositional Logic (25th October 2007) 1 3.1 Syntax Definition 3.0 An alphabet Σ consists

More information

First-Order Logic. Resolution

First-Order Logic. Resolution First-Order Logic Resolution 1 Resolution for predicate logic Gilmore s algorithm is correct and complete, but useless in practice. We upgrade resolution to make it work for predicate logic. 2 Recall:

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

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

Outline. Logic. Definition. Theorem (Gödel s Completeness Theorem) Summary of Previous Week. Undecidability. Unification

Outline. Logic. Definition. Theorem (Gödel s Completeness Theorem) Summary of Previous Week. Undecidability. Unification Logic Aart Middeldorp Vincent van Oostrom Franziska Rapp Christian Sternagel Department of Computer Science University of Innsbruck WS 2017/2018 AM (DCS @ UIBK) week 11 2/38 Definitions elimination x φ

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

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

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

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω 1 Preliminaries In this chapter we first give a summary of the basic notations, terminology and results which will be used in this thesis. The treatment here is reduced to a list of definitions. For the

More information

Resolution for Predicate Logic

Resolution for Predicate Logic Resolution for Predicate Logic The connection between general satisfiability and Herbrand satisfiability provides the basis for a refutational approach to first-order theorem proving. Validity of a first-order

More information

Automated Reasoning in First-Order Logic

Automated Reasoning in First-Order Logic Automated Reasoning in First-Order Logic Peter Baumgartner http://users.cecs.anu.edu.au/~baumgart/ 7/11/2011 Automated Reasoning in First-Order Logic... First-Order Logic Can express (mathematical) structures,

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

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

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

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

Example. Lemma. Proof Sketch. 1 let A be a formula that expresses that node t is reachable from s

Example. Lemma. Proof Sketch. 1 let A be a formula that expresses that node t is reachable from s Summary Summary Last Lecture Computational Logic Π 1 Γ, x : σ M : τ Γ λxm : σ τ Γ (λxm)n : τ Π 2 Γ N : τ = Π 1 [x\π 2 ] Γ M[x := N] Georg Moser Institute of Computer Science @ UIBK Winter 2012 the proof

More information

07 Equational Logic and Algebraic Reasoning

07 Equational Logic and Algebraic Reasoning CAS 701 Fall 2004 07 Equational Logic and Algebraic Reasoning Instructor: W. M. Farmer Revised: 17 November 2004 1 What is Equational Logic? Equational logic is first-order logic restricted to languages

More information

INF3170 / INF4171 Notes on Resolution

INF3170 / INF4171 Notes on Resolution INF3170 / INF4171 Notes on Resolution Andreas Nakkerud Autumn 2015 1 Introduction This is a short description of the Resolution calculus for propositional logic, and for first order logic. We will only

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

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

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

Computational Logic Automated Deduction Fundamentals

Computational Logic Automated Deduction Fundamentals Computational Logic Automated Deduction Fundamentals 1 Elements of First-Order Predicate Logic First Order Language: An alphabet consists of the following classes of symbols: 1. variables denoted by X,

More information

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

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/26) Computational Logic Davide Martinenghi Free University of Bozen-Bolzano Spring 2010 Computational Logic Davide Martinenghi (1/26) Propositional Logic - algorithms Complete calculi for deciding logical

More information

Closed Book Examination. Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. M.Sc. in Advanced Computer Science

Closed Book Examination. Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. M.Sc. in Advanced Computer Science Closed Book Examination COMP60121 Appendix: definition sheet (3 pages) Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE M.Sc. in Advanced Computer Science Automated Reasoning Tuesday 27 th

More information

1 Introduction to Predicate Resolution

1 Introduction to Predicate Resolution 1 Introduction to Predicate Resolution The resolution proof system for Predicate Logic operates, as in propositional case on sets of clauses and uses a resolution rule as the only rule of inference. The

More information

03 Review of First-Order Logic

03 Review of First-Order Logic CAS 734 Winter 2014 03 Review of First-Order Logic William M. Farmer Department of Computing and Software McMaster University 18 January 2014 What is First-Order Logic? First-order logic is the study of

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

Propositional and Predicate Logic - V

Propositional and Predicate Logic - V Propositional and Predicate Logic - V Petr Gregor KTIML MFF UK WS 2016/2017 Petr Gregor (KTIML MFF UK) Propositional and Predicate Logic - V WS 2016/2017 1 / 21 Formal proof systems Hilbert s calculus

More information

CMPS 217 Logic in Computer Science. Lecture #17

CMPS 217 Logic in Computer Science.   Lecture #17 CMPS 217 Logic in Computer Science https://courses.soe.ucsc.edu/courses/cmps217/spring13/01 Lecture #17 1 The Complexity of FO-Truth on a Structure Structure A Complexity of Th(A) Structure of the natural

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

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

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

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

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

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

Some Rewriting Systems as a Background of Proving Methods

Some Rewriting Systems as a Background of Proving Methods Some Rewriting Systems as a Background of Proving Methods Katalin Pásztor Varga Department of General Computer Science Eötvös Loránd University e-mail: pkata@ludens.elte.hu Magda Várterész Institute of

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

A Tableau Calculus for Minimal Modal Model Generation

A Tableau Calculus for Minimal Modal Model Generation M4M 2011 A Tableau Calculus for Minimal Modal Model Generation Fabio Papacchini 1 and Renate A. Schmidt 2 School of Computer Science, University of Manchester Abstract Model generation and minimal model

More information

SLD-Resolution And Logic Programming (PROLOG)

SLD-Resolution And Logic Programming (PROLOG) Chapter 9 SLD-Resolution And Logic Programming (PROLOG) 9.1 Introduction We have seen in Chapter 8 that the resolution method is a complete procedure for showing unsatisfiability. However, finding refutations

More information

3.17 Semantic Tableaux for First-Order Logic

3.17 Semantic Tableaux for First-Order Logic 3.17 Semantic Tableaux for First-Order Logic There are two ways to extend the tableau calculus to quantified formulas: using ground instantiation using free variables Tableaux with Ground Instantiation

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

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

Computational Logic Fundamentals (of Definite Programs): Syntax and Semantics

Computational Logic Fundamentals (of Definite Programs): Syntax and Semantics Computational Logic Fundamentals (of Definite Programs): Syntax and Semantics 1 Towards Logic Programming Conclusion: resolution is a complete and effective deduction mechanism using: Horn clauses (related

More information

ISTITUTO DI ANALISI DEI SISTEMI ED INFORMATICA

ISTITUTO DI ANALISI DEI SISTEMI ED INFORMATICA ISTITUTO DI ANALISI DEI SISTEMI ED INFORMATICA CONSIGLIO NAZIONALE DELLE RICERCHE A. Pettorossi, M. Proietti TOTALLY CORRECT LOGIC PROGRAM TRANSFORMATIONS VIA WELL-FOUNDED ANNOTATIONS R. 639 Febbraio 2006

More information

Propositional and Predicate Logic - IV

Propositional and Predicate Logic - IV Propositional and Predicate Logic - IV Petr Gregor KTIML MFF UK ZS 2015/2016 Petr Gregor (KTIML MFF UK) Propositional and Predicate Logic - IV ZS 2015/2016 1 / 19 Tableau method (from the previous lecture)

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

Logic for Computer Scientists

Logic for Computer Scientists Logic for Computer Scientists Pascal Hitzler http://www.pascal-hitzler.de CS 499/699 Lecture, Winter Quarter 2011 Wright State University, Dayton, OH, U.S.A. [final version: 03/10/2011] Contents 1 Propositional

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

Resolution for Predicate Logic

Resolution for Predicate Logic Logic and Proof Hilary 2016 James Worrell Resolution for Predicate Logic A serious drawback of the ground resolution procedure is that it requires looking ahead to predict which ground instances of clauses

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

Handout Proof Methods in Computer Science

Handout Proof Methods in Computer Science Handout Proof Methods in Computer Science Sebastiaan A. Terwijn Institute of Logic, Language and Computation University of Amsterdam Plantage Muidergracht 24 1018 TV Amsterdam the Netherlands terwijn@logic.at

More information

COMP9414: Artificial Intelligence First-Order Logic

COMP9414: Artificial Intelligence First-Order Logic COMP9414, Wednesday 13 April, 2005 First-Order Logic 2 COMP9414: Artificial Intelligence First-Order Logic Overview Syntax of First-Order Logic Semantics of First-Order Logic Conjunctive Normal Form Wayne

More information

06 From Propositional to Predicate Logic

06 From Propositional to Predicate Logic Martin Henz February 19, 2014 Generated on Wednesday 19 th February, 2014, 09:48 1 Syntax of Predicate Logic 2 3 4 5 6 Need for Richer Language Predicates Variables Functions 1 Syntax of Predicate Logic

More information

When describing some state of affairs in the real world we often use declarative 1 sentences

When describing some state of affairs in the real world we often use declarative 1 sentences Chapter 1 Preliminaries 1.1 Logic Formulas When describing some state of affairs in the real world we often use declarative 1 sentences like: (i) Every mother loves her children (ii) Mary is a mother and

More information

Logic Part I: Classical Logic and Its Semantics

Logic Part I: Classical Logic and Its Semantics Logic Part I: Classical Logic and Its Semantics Max Schäfer Formosan Summer School on Logic, Language, and Computation 2007 July 2, 2007 1 / 51 Principles of Classical Logic classical logic seeks to model

More information

Harmonious Logic: Craig s Interpolation Theorem and its Descendants. Solomon Feferman Stanford University

Harmonious Logic: Craig s Interpolation Theorem and its Descendants. Solomon Feferman Stanford University Harmonious Logic: Craig s Interpolation Theorem and its Descendants Solomon Feferman Stanford University http://math.stanford.edu/~feferman Interpolations Conference in Honor of William Craig 13 May 2007

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

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

First Order Logic (FOL)

First Order Logic (FOL) First Order Logic (FOL) Testing, Quality Assurance, and Maintenance Winter 2018 Prof. Arie Gurfinkel based on slides by Prof. Ruzica Piskac, Nikolaj Bjorner, and others References Chpater 2 of Logic for

More information

Cooperation of Background Reasoners in Theory Reasoning by Residue Sharing

Cooperation of Background Reasoners in Theory Reasoning by Residue Sharing Cooperation of Background Reasoners in Theory Reasoning by Residue Sharing Cesare Tinelli tinelli@cs.uiowa.edu Department of Computer Science The University of Iowa Report No. 02-03 May 2002 i Cooperation

More information

Superposition for Fixed Domains. Matthias Horbach and Christoph Weidenbach

Superposition for Fixed Domains. Matthias Horbach and Christoph Weidenbach Superposition for Fixed Domains Matthias Horbach and Christoph Weidenbach MPI I 2009 RG1 005 Oct. 2009 Authors Addresses Matthias Horbach and Christoph Weidenbach Max Planck Institute for Informatics Campus

More information

The predicate calculus is complete

The predicate calculus is complete The predicate calculus is complete Hans Halvorson The first thing we need to do is to precisify the inference rules UI and EE. To this end, we will use A(c) to denote a sentence containing the name c,

More information

Equational Logic. Chapter Syntax Terms and Term Algebras

Equational Logic. Chapter Syntax Terms and Term Algebras Chapter 2 Equational Logic 2.1 Syntax 2.1.1 Terms and Term Algebras The natural logic of algebra is equational logic, whose propositions are universally quantified identities between terms built up from

More information

Resolution for predicate logic

Resolution for predicate logic Resolution for predicate logic Gilmore s algorithm is correct, but useless in practice. We upgrade resolution to make it work for predicate logic. 1 Recall: resolution in propositional logic Resolution

More information

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Lecture Notes 1 Basic Concepts of Mathematics MATH 352 Lecture Notes 1 Basic Concepts of Mathematics MATH 352 Ivan Avramidi New Mexico Institute of Mining and Technology Socorro, NM 87801 June 3, 2004 Author: Ivan Avramidi; File: absmath.tex; Date: June 11,

More information

Definite Logic Programs

Definite Logic Programs Chapter 2 Definite Logic Programs 2.1 Definite Clauses The idea of logic programming is to use a computer for drawing conclusions from declarative descriptions. Such descriptions called logic programs

More information

CogSysI Lecture 8: Automated Theorem Proving

CogSysI Lecture 8: Automated Theorem Proving CogSysI Lecture 8: Automated Theorem Proving Intelligent Agents WS 2004/2005 Part II: Inference and Learning Automated Theorem Proving CogSysI Lecture 8: Automated Theorem Proving p. 200 Remember......

More information

Computational Logic. Standardization of Interpretations. Damiano Zanardini

Computational Logic. Standardization of Interpretations. Damiano Zanardini Computational Logic Standardization of Interpretations Damiano Zanardini UPM European Master in Computational Logic (EMCL) School of Computer Science Technical University of Madrid damiano@fi.upm.es Academic

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

Mathematical Logics. 12. Soundness and Completeness of tableaux reasoning in first order logic. Luciano Serafini

Mathematical Logics. 12. Soundness and Completeness of tableaux reasoning in first order logic. Luciano Serafini 12. Soundness and Completeness of tableaux reasoning in first order logic Fondazione Bruno Kessler, Trento, Italy November 14, 2013 Example of tableaux Example Consider the following formulas: (a) xyz(p(x,

More information

Logic. Knowledge Representation & Reasoning Mechanisms. Logic. Propositional Logic Predicate Logic (predicate Calculus) Automated Reasoning

Logic. Knowledge Representation & Reasoning Mechanisms. Logic. Propositional Logic Predicate Logic (predicate Calculus) Automated Reasoning Logic Knowledge Representation & Reasoning Mechanisms Logic Logic as KR Propositional Logic Predicate Logic (predicate Calculus) Automated Reasoning Logical inferences Resolution and Theorem-proving Logic

More information

Predicate Logic - Semantic Tableau

Predicate Logic - Semantic Tableau CS402, Spring 2016 Informal Construction of a Valid Formula Example 1 A valid formula: x(p(x) q(x)) ( xp(x) xq(x)) ( x(p(x) q(x)) ( xp(x) xq(x))) x(p(x) q(x)), ( xp(x) xq(x)) x(p(x) q(x)), xp(x), xq(x)

More information

Cut-Elimination and Quantification in Canonical Systems

Cut-Elimination and Quantification in Canonical Systems A. Zamansky A. Avron Cut-Elimination and Quantification in Canonical Systems Abstract. Canonical propositional Gentzen-type systems are systems which in addition to the standard axioms and structural rules

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

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

Cardinality and ordinal numbers

Cardinality and ordinal numbers Cardinality and ordinal numbers The cardinality A of a finite set A is simply the number of elements in it. When it comes to infinite sets, we no longer can speak of the number of elements in such a set.

More information

Cooperation of Background Reasoners in Theory Reasoning by Residue Sharing

Cooperation of Background Reasoners in Theory Reasoning by Residue Sharing Cooperation of Background Reasoners in Theory Reasoning by Residue Sharing Cesare Tinelli (tinelli@cs.uiowa.edu) Department of Computer Science The University of Iowa Iowa City, IA, USA Abstract. We propose

More information

Artificial Intelligence

Artificial Intelligence Jörg Hoffmann Artificial Intelligence Chapter 12: Predicate Logic Reasoning, Part II 1/56 Artificial Intelligence 12. Predicate Logic Reasoning, Part II: Reasoning And Now: How to Actually Think in Terms

More information

CHAPTER 2. FIRST ORDER LOGIC

CHAPTER 2. FIRST ORDER LOGIC CHAPTER 2. FIRST ORDER LOGIC 1. Introduction First order logic is a much richer system than sentential logic. Its interpretations include the usual structures of mathematics, and its sentences enable us

More information

6 Coalgebraic modalities via predicate liftings

6 Coalgebraic modalities via predicate liftings 6 Coalgebraic modalities via predicate liftings In this chapter we take an approach to coalgebraic modal logic where the modalities are in 1-1 correspondence with so-called predicate liftings for the functor

More information

Computational Logic. Recall of First-Order Logic. Damiano Zanardini

Computational Logic. Recall of First-Order Logic. Damiano Zanardini Computational Logic Recall of First-Order Logic Damiano Zanardini UPM European Master in Computational Logic (EMCL) School of Computer Science Technical University of Madrid damiano@fi.upm.es Academic

More information

Automated Reasoning (in First Order Logic) Andrei Voronkov. University of Manchester

Automated Reasoning (in First Order Logic) Andrei Voronkov. University of Manchester Automated Reasoning (in First Order Logic) Andrei Voronkov University of Manchester 1 Overview Automated reasoning in first-order logic. Completeness. Theory of Resolution and Redundancy. From Theory to

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

Predicate Calculus. Formal Methods in Verification of Computer Systems Jeremy Johnson

Predicate Calculus. Formal Methods in Verification of Computer Systems Jeremy Johnson Predicate Calculus Formal Methods in Verification of Computer Systems Jeremy Johnson Outline 1. Motivation 1. Variables, quantifiers and predicates 2. Syntax 1. Terms and formulas 2. Quantifiers, scope

More information

Classical Propositional Logic

Classical Propositional Logic The Language of A Henkin-style Proof for Natural Deduction January 16, 2013 The Language of A Henkin-style Proof for Natural Deduction Logic Logic is the science of inference. Given a body of information,

More information

7.5.2 Proof by Resolution

7.5.2 Proof by Resolution 137 7.5.2 Proof by Resolution The inference rules covered so far are sound Combined with any complete search algorithm they also constitute a complete inference algorithm However, removing any one inference

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

Version January Please send comments and corrections to

Version January Please send comments and corrections to Mathematical Logic for Computer Science Second revised edition, Springer-Verlag London, 2001 Answers to Exercises Mordechai Ben-Ari Department of Science Teaching Weizmann Institute of Science Rehovot

More information

Completeness in the Monadic Predicate Calculus. We have a system of eight rules of proof. Let's list them:

Completeness in the Monadic Predicate Calculus. We have a system of eight rules of proof. Let's list them: Completeness in the Monadic Predicate Calculus We have a system of eight rules of proof. Let's list them: PI At any stage of a derivation, you may write down a sentence φ with {φ} as its premiss set. TC

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

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

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

Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics Lecture notes in progress (27 March 2010)

Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics Lecture notes in progress (27 March 2010) http://math.sun.ac.za/amsc/sam Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics 2009-2010 Lecture notes in progress (27 March 2010) Contents 2009 Semester I: Elements 5 1. Cartesian product

More information

INTRODUCTION TO LOGIC

INTRODUCTION TO LOGIC INTRODUCTION TO LOGIC 6 Natural Deduction Volker Halbach There s nothing you can t prove if your outlook is only sufficiently limited. Dorothy L. Sayers http://www.philosophy.ox.ac.uk/lectures/ undergraduate_questionnaire

More information

Propositional and Predicate Logic. jean/gbooks/logic.html

Propositional and Predicate Logic.   jean/gbooks/logic.html CMSC 630 February 10, 2009 1 Propositional and Predicate Logic Sources J. Gallier. Logic for Computer Science, John Wiley and Sons, Hoboken NJ, 1986. 2003 revised edition available on line at http://www.cis.upenn.edu/

More information

Model Evolution with Equality Revised and Implemented

Model Evolution with Equality Revised and Implemented Model Evolution with Equality Revised and Implemented Peter Baumgartner 1 NICTA and The Australian National University, Canberra, Australia Björn Pelzer Institute for Computer Science, Universität Koblenz-Landau,

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, Winter Quarter 2012 Wright State University, Dayton, OH, U.S.A. [version: 03/01/2012] Contents 1 Propositional

More information