(Materials drawn from Chapter 2 in: “Michael Huth and Mark Ryan. Logic in Computer Science: Modelling and Reasoning about Systems, 2nd Ed., Cambridge University Press, 2006.”) Nguyen An Khuong, Huynh Tuong Nguyen Faculty of Computer Science and Engineering University of Technology, VNUHCM Contents 1 Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences 2 Semantics of Predicate Logic 3 Soundness and Completeness of Predicate Logic 4 Undecidability of Predicate Logic 5 Compactness of Predicate Calculus
Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Chapter Predicate Logic Discrete Mathematics II Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language (Materials drawn from Chapter in: Proof Theory of Predicate Logic Quantifier Equivalences “Michael Huth and Mark Ryan Logic in Computer Science: Modelling and Reasoning about Systems, 2nd Ed., Cambridge University Press, 2006.”) Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Faculty of Computer Science and Engineering University of Technology, VNU-HCM Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.1 Contents Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Semantics of Predicate Logic Predicate Logic as Formal Language Proof Theory of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.2 Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Soundness and Completeness of Predicate Logic Proof Theory of Predicate Logic Quantifier Equivalences Undecidability of Predicate Logic Compactness of Predicate Calculus Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.3 More Declarative Sentences Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen • Propositional logic can easily handle simple declarative statements such as: Example Student Hung enrolled in DMII • Propositional logic can also handle combinations of such statements such as: Example Student Hung enrolled in Tutorial 1, and student Cuong is enrolled in Tutorial • But: How about statements with “there exists ” or “every ” or “among ”? Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.4 What is needed? Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Example Every student is younger than some instructor What is this statement about? • Being a student • Being an instructor • Being younger than somebody else These are properties of elements of a set of objects We express them in predicate logic using predicates Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.5 Predicates Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Example Contents Every student is younger than some instructor Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language • S(An) could denote that An is a student • I(Binh) could denote that Binh is an instructor • Y (An, Binh) could denote that An is younger than Binh Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.6 The Need for Variables Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Example Every student is younger than some instructor We use the predicate S to denote student-hood How we express “every student”? Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences We need variables that can stand for constant values, and a quantifier symbol that denotes “every” Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.7 The Need for Variables Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Example Contents Every student is younger than some instructor Using variables and quantifiers, we can write: Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language ∀x(S(x) → (∃y(I(y) ∧ Y (x, y)))) Proof Theory of Predicate Logic Quantifier Equivalences Literally: For every x, if x is a student, then there is some y such that y is an instructor and x is younger than y Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.8 Predicate Logic Another Example Nguyen An Khuong, Huynh Tuong Nguyen English Not all birds can fly Contents Predicate Logic: Motivation, Syntax, Proof Theory Predicates B(x): x is a bird F (x): x can fly Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences The sentence in predicate logic ¬(∀x(B(x) → F (x))) Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.9 A Third Example Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen English Every girl is younger than her mother Contents Predicates G(x): x is a girl M (x, y): y is x’s mother Y (x, y): x is younger than y Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic The sentence in predicate logic ∀x∀y(G(x) ∧ M (x, y) → Y (x, y)) Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.10 Predicate Logic Central Result of Natural Deduction Nguyen An Khuong, Huynh Tuong Nguyen Contents φ1 , , φn |= ψ iff Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language φ1 , , φ n ψ Proof Theory of Predicate Logic Quantifier Equivalences proven by Kurt Găodel, in 1929 in his doctoral dissertation Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.59 Recall: Decidability Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Decision problems A decision problem is a question in some formal system with a yes-or-no answer Decidability Decision problems for which there is an algorithm that returns “yes” whenever the answer to the problem is “yes”, and that returns “no” whenever the answer to the problem is “no”, are called decidable Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Decidability of satisfiability Soundness and Completeness of Predicate Logic The question, whether a given propositional formula is satisifiable, is decidable Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.60 Undecidability of Predicate Logic Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Theorem The decision problem of validity in predicate logic is undecidable: no program exists which, given any language in predicate logic and any formula φ in that language, decides whether |= φ Proof • Establish that the Post Correspondence Problem (PCP) is undecidable (here only as sketch) • Translate an arbitrary PCP, say C, to a formula φ • Establish that |= φ holds if and only if C has a solution • Conclude that validity of pred logic formulas is undecidable Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.61 Post Correspondence Problem Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Informally Can we line up copies of the cards such that the top row spells out the same sequence as the bottom row? Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Formally Given a finite sequence of pairs (s1 , t1 ), (s2 , t2 ), , (sk , tk ) such that all si and ti are binary strings of positive length, is there a sequence of indices i1 , i2 , , in with n ≥ such that the concatenations si1 si2 sin and ti1 ti2 tin are equal? Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.62 Undecidability of Post Correspondence Problem Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Turing machines Basic abstract symbol-manipulating devices that can simulate in prinicple any computer algorithm The input is a string of symbols on a tape, and the machine “accepts” the input string, if it reaches one of a number of accepting states Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Termination of Programs is Undecidable It is undecidable, whether program with input terminates Proof idea For a Turing machine with a given input, construct a PCP such that a solution of the PCP exists if and only if the Turing machine accepts the solution Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.63 Translate Post Correspondence Problem to Formula Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Bits as Functions Represent bits and by functions f0 and f1 Contents Predicate Logic: Motivation, Syntax, Proof Theory Strings as Terms Need for Richer Language Represent the empty string by a constant e The string b1 b2 bl corresponds to the term fbl (fbl−1 (fb2 (fb1 (e))) ) Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.64 Predicate Logic Towards a Formula for a PCP Nguyen An Khuong, Huynh Tuong Nguyen Let C be the problem s1 t1 s2 t2 sk tk Idea P (s, t) holds iff there is a sequence of indices (i1 , i2 , , im ) such that s is si1 si2 sim and t is ti1 ti2 tim Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.65 Predicate Logic The Formula φ Nguyen An Khuong, Huynh Tuong Nguyen φ = φ1 ∧ φ2 → φ3 , where Contents k φ1 = Predicate Logic: Motivation, Syntax, Proof Theory P (fsi (e), fti (e)) i=1 Need for Richer Language Predicate Logic as Formal Language k φ2 = ∀v∀w(P (v, w) → P (fsi (v), fti (w))) i=1 φ3 = ∃zP (z, z) Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.66 Undecidability of Predicate Logic Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen So Far Post correspondence problem is undecidable Constructed φC for Post correspondence problem C To Show |= φC holds if and only if C has a solution Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Proof Proof via construction of φC Formally construct an interpretation of strings and show that whenever there is a solution, the formula φC holds and vice versa Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.67 Summary of Undecidability Proof Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Theorem The decision problem of validity in predicate logic is undecidable: no program exists which, given any language in predicate logic and any formula φ in that language, decides whether |= φ Proof • Establish that the Post Correspondence Problem (PCP) is undecidable • Translate an arbitrary PCP, say C, to a formula φ • Establish that |= φ holds if and only if C has a solution • Conclude that validity of pred logic formulas is undecidable Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.68 Compactness Theorem Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Contents Let Γ be a set of sentences of predicate logic If all finite subsets of Γ are satisfiable, then Γ is satisfiable Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.69 Proof of Compactness Theorem Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Assume Γ is not satisfiable We thus have Γ |= ⊥ Via completeness, we have Γ ⊥ The proof is finite, thus only uses a finite subset ∆ ⊂ Γ of premises Thus, ∆ ⊥, and ∆ |= ⊥ via soundness Contents Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.70 Reachability not Expressible in Predicate Logic Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Contents There is no predicate logic formula φG,u,v with u and v as its only free variables and R as its only predicate symbol, such that φG,u,v holds iff there is a path from u to v in G Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.71 Lă owenheim-Skolem Theorem Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Contents Let ψ be a sentence of predicate logic such that for any natural number n ≥ there is a model of ψ with at least n elements Then ψ has a model with infinitely many elements Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.72 Homeworks and Next Week Plan? Predicate Logic Nguyen An Khuong, Huynh Tuong Nguyen Homeworks It is recommended that you should as much as you can ALL marked exercises in [2, Sect 2.8] (notice that sample solutions for these exercises are available in [3]) For this lecture, the following are recommended exercises [2]: Contents • 2.1: 1a); 2a) • 2.2: Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language • 2.3: 1a); 1b); 6a); 6b); 6c); 7b); 9b); 9c); 13d) • 2.4: 2); 3); 11a); 11c); 12e); 12f); 12h); 12k) • 2.5: 1c); 1e) All HW of this lecture should be written in LATEX, submitted via SAKAI, due: March 15, 2015 Next Weeks? • Exercises Session; • Applications of FoL Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Compactness of Predicate Calculus Homeworks and Next Week Plan? 2.73