1 / 98

Intelligent Systems

Intelligent Systems. Lecture III – xx 2009 Predicate Logic Dieter Fensel and Dumitru Roman. Where are we?. Outline. Motivation Technical Solution Formulas, Models, Tableaux Deductive Systems Resolution Illustration by Larger Examples Extensions Summary References

Download Presentation

Intelligent Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Intelligent Systems Lecture III – xx 2009Predicate Logic Dieter Fensel and Dumitru Roman

  2. Where are we?

  3. Outline • Motivation • Technical Solution • Formulas, Models, Tableaux • Deductive Systems • Resolution • Illustration by Larger Examples • Extensions • Summary • References Note: Most of the content of this lecture is based on Chapters 5-7 of the book Mathematical Logic for Computer Science (by Mordechai Ben-Ari)http://www.springer.com/computer/foundations/book/978-1-85233-319-5

  4. MOTIVATION 4

  5. Predicate logic • Propositional logic is not expressive enough • Suppose we want to capture the knowledge that Anyone standing in the rain will get wet. and then use this knowledge. For example, suppose we also learn that Jan is standing in the rain. • We'd like to conclude that Jan will get wet. But each of these sentences would just be a represented by some proposition, say P, Q and R. What relationship is there between these propositions? We can say P /\ Q → R Then, given P /\ Q, we could indeed conclude R. But now, suppose we were told Pat is standing in the rain. • We'd like to be able to conclude that Pat will get wet, but nothing we have stated so far will help us do this • The problem is that we aren't able to represent any of the details of these propositions. It's the internal structure of these propositions that make the reasoning valid. But in propositional calculus we don't have anything else to talk about besides propositions! • A more expressive logic is needed • Predicate logic (occasionally referred to as First-order logic)

  6. TECHNICAL SOLUTION 6

  7. Predicate Logic – Overview • All the logical machinery – formulas, interpretations, proofs, etc. – that was developed for the propositional logic (see previous lecture) can be applied to predicates • The presence of a domain upon which predicates are interpreted considerably complicates the technical details but not the basic concepts • Syntax • Predicate symbols are used to represent relations (functions from a domain to truth values) • Quantifiers allow a purely syntactical expression of the statement that the relation represented by the predicate is true for some or all elements of the domain • Semantics • An interpretation consists of a domain and an assignment of relations to the predicate letters • The semantics of the Boolean operators remains unchanged, but the evaluation of the truth value of the formula must take the quantifiers into account

  8. Predicate Logic – Overview (cont’) • Semantic tableaux • The systematic search for a model is potentially infinite because the domains like the integers are infinite • The construction of a tableau may not terminate, so there is no decision procedure for satisfiability in the predicate logic, however, if a tableau happens to close, the formula is unsatisfiable, conversely, a systematic tableau for an unsatisfiable formula will close • There are Gentzen and Hilbert deductive systems which are sound and complete • A valid formula is provable and we can construct a proof of the formula using tableaux, but given an arbitrary formula we cannot decide if it is valid and hence provable

  9. Predicate Logic – Overview (cont’) • The syntax of predicate logic is extended with function symbols that are interpreted as functions on the domain • The predicate logic with function symbols is used in the resolution procedure • There are canonical interpretations called Herbrand interpretations • If a formula has a model, it has a model which is an Herbrand interpretation, so to check satisfiablity, it is sufficient to check if there is a Herbrand model for a formula

  10. Predicate Logic – Formulas, Models, Tableaux • Relations and Predicates • Predicate Formulas • Interpretations • Equivalence and Substitution • Semantic Tableaux • Finite and Infinite Models • Undecidability of the Predicate Logic

  11. Relations and Predicates • The axioms and theorems of mathematics are defined on arbitrary sets such as the set of integers • We need to be able to write and manipulate logical formulas that contain relations on values from arbitrary sets • The predicate logic extends the propositional logic with predicate symbols that are interpreted as relations on a domain • Let R be an n-ary relation on a domain D, i.e. R is a subset Dn.A relation can be represented by a Boolean-valued function R: Dn → {T,F}, by mapping an n-tuple to T iff it is included in the relation: R(d1,…,dn) = T iff in R(d1,…,dn) in R

  12. Predicate Formulas • Predicate (relation) symbols • Constant symbols • Variables • BNF Grammar for Predicate Formulas:

  13. Predicate Formulas (cont’) • Examples: • Suppose A is a predicate formula. An occurrence of a variable x in A is a free variable of A if it is not within the scope of any quantifier A variable which is not free is said to be bound • Examples:

  14. Interpretations • Let U be a set of formulas such that {p1, p2, . . . , pm} are all predicate symbols appearing in U and {a1, a2, . . . , ak} are all constant symbols appearing in U. An interpretationI of U is a tripe I = (D, {R1,…,Rm}, {d1,…,dk}) where • D is a non-empty set (domain of I) • Ri is an assignment of an ni-ary relation on D to the ni-ary predicate symbol pi • di is an assignment of an element of D to the constant ai

  15. Interpretations (cont’) • Example: Consider the formula Some of its possible interpretations are: “For every natural number x, 0 ≤ x.” “For every natural number x, 1|x.” “For every string x over alphabet {0, 1}, empty string is a substring of x.” “For every vertex x of G, (a, x) is an edge in G.”

  16. Interpretations (cont’) • Suppose I is an interpretation for a predicate formula A. An assignment is a function which assigns a value in the domain D to any variable appearing in the formula A • Suppose A is formula, I an interpretation for A, and σI an assignment. We define vσI(A), the truth value of A under σI, inductively: (a) If A = p(c1, c2,…, cn) is an atomic formula, where each ciis either a variable xj or a constant symbol aj, then (b) vσI(¬A) = ¬vσI (A) (c) vσI(A1 /\ A2) = vσI (A1) /\ vσI (A2) (d) vσI(A1 \/ A2) = vσI (A1) \/ vσI (A2) (e) (f)

  17. Interpretations (cont’) • Theorem: If A is a closed formula, then vσI(A) does not depend on σI. In that case, we write vI(A). • Theorem: Let A' = A(x1, x2, . . . , xn) be a non-closed formula and let I be an interpretation. Then: (a) vσI(A) = T for assignment σI iff (b) vσI(A) = T for all assignments σI iff

  18. Interpretations (cont’) • A closed formula A is true in I, or I is a modelfor A, if vI(A) = T I |= A • A closed formula A is satisfiable if, for some interpretation I, I |= A • A is valid if, for all interpretations I, I |= A • A is unsatisfiable if it is not satisfiable, and falsifiable if it is not valid

  19. Interpretations (cont’) • Examples:

  20. Equivalence and Substitution • Suppose A1,A2 are two closed formulas. If, for all interpretations I vI(A1) = vI(A2) we say that A1 and A2 are equivalent, and we write A1 ≡ A2 • Suppose U is a set of closed formulas, and A a closed formula U |= A means that, in all interpretations I in which all formulas from U are true, we also have vI(A) = T • Examples:

  21. Equivalence and Substitution (cont’) • Theorem: A ≡ B iff |= A ↔ B U |= A iff |= A1 /\ A2 /\ ... /\ An → A • Examples of valid formulas:

  22. Semantic Tableaux • Recall that a tableaux is systematic search for a counter example • Example: We will try to show that is a valid formula. We consider its negation and try to show that it is unsatisfiable.

  23. Semantic Tableaux (cont’) • Semantic tableaux for :

  24. Semantic Tableaux (cont’) • Example: Now, consider the formula which is satisfiable but not valid (so its negation should also be satisfiable). Semantic tableaux (we obtain a closed tableau for a satisfiable formula):

  25. Semantic Tableaux (cont’) • Question:What went wrong in the previous example? • The same constant a was used twice to eliminate two distinct existential quantifiers • We were forced to use the same constant since, once we eliminated the universal quantifier in we replaced it with a and were forced to work with that constant exclusively from that point on • Solution:We will not delete universal quantifiers from nodes of the tableau; instead, we introduce some instance of that variable but keep writing the universal quantifier. E.g.

  26. Semantic Tableaux (cont’) • Using these guidelines, if a tableau for the formula from the previous example is correctly constructed, one branch ends with the open leaf In fact, this leaf gives a model for this satisfiable formula; the domain is D = {a, b} and the unary relations are subsets p = {a}, q = {b} (This is what we will be defined as an Herbrand model for this formula later on in this lecture)

  27. Semantic Tableaux (cont’) • Example: Consider the formulas Check whether A = A1 /\ A2 /\ A3 is a satisfiable formula and, if so, find one model for A.Solution:First construct a semantic tableau for the formula:

  28. Semantic Tableaux (cont’) • The tableau in the previous example does not terminate; namely, every time an universal or an existential quantifier is dropped, a new constant symbol ai can be introduced, to get an infinite sequence of constants: a1, a2,…, an,… The formula does have an obvious infinite model: I = (N, {<}) Furthermore, one can prove, using the formulas A2 and A3 (see the proof of Theorem 5.24 in the textbook) that every model of A = A1 /\ A2 /\ A3 must be infinite. So, the tableau construction effectively produces a “generic” infinite model for A. • One major difference in comparison with semantic tableaux for propositional logic is (as seen in the previous example) that a tableau of a predicate formula may not terminate • The reason for this anomaly is that, in propositional logic, nodes of a tableau simplify in terms of the formula complexity. In predicate logic, this is not the case, since we can never eliminate universal quantifiers

  29. Semantic Tableaux - Algorithm for Semantic Tableaux • As in propositional case, we generalize the rules into two cases, γ-rules for universal formulas and δ-rules for existential formulas: • A literalis a closed atomic formula p(a1, a2,…, an) or thenegation of such a formula • Algorithm for construction of a semantic tableau: Input:A predicate formulaA Output:Semantic tableau T for A; all branches are eitherinfinite, or finite with leaves marked × (closed) or o (open). A semantic tableau is a tree T each node of which will be labeled with a set of formulas. T is built as follows.

  30. Semantic Tableaux - Algorithm for Semantic Tableaux (cont’) (1) Initially, T is a single node, labeled {A} (2) We build the tableau inductively by choosing an unmarked leaf l, labeled U(l), and applying one of the following rules: • If U(l) is a set of literals and γ-formulas containing a pair of complementary literals {p(a1, a2,…, an), ¬p(a1, a2,…, an)}, mark it as closed (×) • If U(l) is not a set of literals, choose a formula A in U(l) which is not a literal: • α- and β-rules are applied just as in propositional logic • If A is a γ-formula, add a new node l', a child of l, and label it U(l') = U(l) U {γ(a)} where a is a constant appearing in U(l). If U(l) consists of literals and γ -formulas only, mark it × or o, depending on whether there is a set of complementary literals. • If A is a δ-formula, create a new node l' as a child of l and label it U(l') = (U(l) − {A}) U {δ(a)} where a is some constant that does not appear in U(l).

  31. Semantic Tableaux - Algorithm for Semantic Tableaux (cont’) • A branch in T is closed if it terminates in a leaf marked ×. Otherwise, it is open. • Theorem (Soundness): Suppose A is a predicate formula and T its semantic tableau. If T closes, then A is unsatisfiable. • Theorem (Completeness): Suppose A is a valid formula. Then, the systematic semantic tableau for A terminates and is closed.(Note: see section 5.5 in the textbook for a detailed description of systematic semantic tableau)

  32. Finite and Infinite Models • Theorem (Löwenheim): If a formula is satisfiable, then it is satisfiable in a countable model • Theorem (Löwenheim - Skolem): If a countable set of predicate formulas is satisfiable, then it is satisfiable in a countable model • Theorem (Compactness Theorem): Let U be a countable set of formulas. If all finite subsets of U are satisfiable, then so is U

  33. Undecidability of the Predicate Logic • Church, building on the work of Turing, proved that there is no decision procedure for validity in predicate logic • Turing machines can be viewed as devices which compute functions on natural numbers; i.e. given a Turing machine T, we can associate to it a function fT : N → N so that fT(n) = m if T halts with the tape consisting of m 1’s when started on the tape with the input of n consecutive 1’s. If T never halts on the input of n consecutive 1’s, then fT(n) is undefined • Theorem (Church): It is undecidable whether a Turing machine, started on a blank tape, will halt • In other words, it is undecidable, given a Turing machine T, whether fT (0) is defined

  34. Undecidability of the Predicate Logic (cont’) • Two-register machine (or, a Minsky machine) M consists of a pair of registers (x, y) which can store natural numbers, and a program P = {L0, L1,…, Ln}, which is a sequential list of instructions. Ln is always the command “halt”, and for 0 ≤ i < n, Li has one of the two forms • r := r + 1, for r in {x, y} • if r = 0 then go to Lj else r := r − 1, for r in {x, y}, 0 ≤ j ≤ n • Execution of M: sequence of states sk = (Li , x, y) where Li is the current instruction during the execution, and x,y are current contents of the two registers. • Initial state: s0 = (L0,m, 0), for some m • If sk = (Ln, x, y), for some k then M halts and y = f (m) is computed by M • Theorem: For every Turing machine T that computes f : N → N, a two-register machine M can be constructed which computes the same function. • Corollary: It is undecidable whether, given a two-register machine M, whether fM(0) exists or not

  35. Undecidability of the Predicate Logic (cont’) • Theorem (Church): Validity in predicate calculus is undecidable Sketch of the Proof: To each two-register machine M, we associate a predicate formula SM such that M halts when started at (L0, 0, 0)  |= SM We use the language: • Binary relations: pi (x, y) (i = 0, 1,…, n) • Unary function: s(x) • Constant symbol: a Intended interpretation: • pi (x, y): M is at the state (Li, x, y) • s(x): successor function s(x) = x + 1 • a: a = 0

  36. Undecidability of the Predicate Logic (cont’) Finally, define SM says the following: if a machine with the program P = {L0, L1, . . . , Ln} is started at the initial state (L0, 0, 0), then the computation will halt with the values at the registers being (z1, z2), for some natural numbers z1, z2Siis defined by cases of the instruction Li : Since the Halting Problem for two-register machines is undecidable, it is impossible to verify algorithmically whether |= SM or not.

  37. Predicate Calculus: Deductive Systems • Gentzen System G • Hilbert System H

  38. Gentzen System G • As in propositional logic, Gentzen proof system is based on the reversal of a semantic tableau for a formula • Example: Prove that Solution: start by constructing a tableau for the negation :

  39. Deductive System G • Axioms: Any set of formulas U containing a complementary pair of literals • Rules: α- and β-rules are the same as in propositional logic, plus where and a is an arbitrary constant. • Theorem (Soundness and Completeness) Let U be a set of formulas. There is a Gentzen proof for U if and only if there is a closed semantic tableau for U.

  40. Deductive System G • Example: The proof in G for is

  41. Hilbert System H • Axioms: The three axioms for the Hilbert system in propositional logic, plus • Axiom 4. • Axiom 5. assuming x is not free in A • Rules of Inference: Modus Ponens, plus (Generalization:)

  42. Hilbert System H (cont’) • There is a problem with the Generalization Rule if it is not being used judiciously; consider the following derivation in the set N with the unary predicate even(x): 1. even(2) ├ even(2) Assumption 2. even(2) ├ even(x) Gen. Rule 1 We derived a wrong conclusion that every natural number is even, starting from the true assumption that 2 is even. What went wrong? Answer: We should not be able to generalize based on a constant included in the assumptions. Namely, assumptions may contain very specific facts and not simply general logical truths. The Generalization Rule must be modified as follows (and with the modification the deduction rule can be further defined)

  43. Hilbert System H (cont’) • Generalization Rule: provided a does notappear in U. • Deduction Rule: • Theorem (Soundness and Completeness): Hilbert proof system H for predicate logic is sound and complete. • Axiom 4 and MP justify the following derived rule (Specification Rule): for any constant a.

  44. Some relevant theorems and proofs in H • Theorem: Proof: • Theorem: Proof:

  45. Some relevant theorems and proofs in H (cont’) • Theorem: Proof: • This proves a more general version of the Generalization Rule:

  46. Some relevant theorems and proofs in H (cont’) • Theorem: Proof: • Theorem: Proof:

  47. Resolution • Functions and Terms • Clausal Form • Herbrand Models • Herbrand’s Theorem • Ground Resolution • Substitutions • Unification • General Resolution

  48. Functions and Terms • We will now allow the language for predicate logic to contain function symbols; they will be interpreted as functions (of appropriate arity) in the domain of an interpretation • Example: Consider the formula p(x, y) → p(x, f (y)) where p is a binary predicate symbol, and f is a unary function symbol; two possible interpretations of this formula • I1 = (N, {<}, {succ(x)}), where succ(x) = x + 1 • I2 = ({0, 1}*, {substr}, {f }), where the relation substr(w1,w2) means that w1 is a substring of w2, and f(w) = w0, is the function appending 0 to the right end of word w

  49. Functions and Terms (cont’) • Terms: Suppose then • Suppose a, b are constant symbols, p a binary predicate symbol, f is a binary function symbol, and g a unary function symbol • Examples of terms: a, g(a), f (x, y), f (x, g(a)), f (f (a, x), b), f (f (x, y), f (b, g(a))),… • Examples of atomic formulas: p(a, a), p(f (x, y), g(y)), p(g(b), f (a, g(a))),…

  50. Functions and Terms (cont’) • A term or atom is ground if it contains no variables; a formula is ground if it has no quantifiers and no variables • A' is a ground instance of a quantifier-free formula A if it can be obtained from A by substituting ground terms for free variables • Examples: • Examples of ground terms: f(a, a), g(b), f(f (a, b), g(a)),… • Examples of ground formulas: ¬p(a, a), p(f (a, b), b) → p(a, a),… • The formula ¬p(f(a, b), b) \/ p(a, f(a, a)) is a ground instance of the formula ¬p(f(x, b), y) \/ p(x, f(x, x))

More Related