Lecture 10: Predicate Logic and Its Language

Similar documents
Ling 130 Notes: Predicate Logic and Natural Deduction

06 From Propositional to Predicate Logic

Introduction to Sets and Logic (MATH 1190)

Predicate Logic: Syntax

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

Introduction to Metalogic

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

CHAPTER 2. FIRST ORDER LOGIC

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

Predicate Logic - Introduction

Lecture 4: Proposition, Connectives and Truth Tables

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

Lecture 13: Soundness, Completeness and Compactness

Final Exam (100 points)

Herbrand Theorem, Equality, and Compactness

Predicate Calculus - Syntax

Exercises for the Logic Course

Predicate Logic: Sematics Part 1

Classical First-Order Logic

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

Propositional Logic Not Enough

Classical First-Order Logic

Formal (Natural) Deduction for Predicate Calculus

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

Section Summary. Predicate logic Quantifiers. Negating Quantifiers. Translating English to Logic. Universal Quantifier Existential Quantifier

Automated Reasoning Lecture 5: First-Order Logic

Introduction to first-order logic:

Introduction to Metalogic 1

First Order Logic (FOL) 1 znj/dm2017

Predicate Calculus. CS 270 Math Foundations of Computer Science Jeremy Johnson

03 Review of First-Order Logic

Predicate Calculus - Semantics 1/4

Denote John by j and Smith by s, is a bachelor by predicate letter B. The statements (1) and (2) may be written as B(j) and B(s).

Logic for Computer Science - Week 2 The Syntax of Propositional Logic

Proposi'onal Logic Not Enough

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

THE LANGUAGE OF FIRST-ORDER LOGIC (FOL) Sec2 Sec1(1-16)

15414/614 Optional Lecture 3: Predicate Logic

Section Summary. Predicate logic Quantifiers. Negating Quantifiers. Translating English to Logic. Universal Quantifier Existential Quantifier

Contents 1. Examples of structures A. Graphs B. Partial and linear orderings C. Fields D. The natural numbers...

Quantifiers and Functions in Intuitionistic Logic

Introduction to Predicate Logic Part 1. Professor Anita Wasilewska Lecture Notes (1)

Logical Structures in Natural Language: First order Logic (FoL)

Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies

DERIVATIONS IN SYMBOLIC LOGIC I

PHIL 50 INTRODUCTION TO LOGIC 1 FREE AND BOUND VARIABLES MARCELLO DI BELLO STANFORD UNIVERSITY DERIVATIONS IN PREDICATE LOGIC WEEK #8

G52DOA - Derivation of Algorithms Predicate Logic

Section 2.1: Introduction to the Logic of Quantified Statements

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

SKETCHY NOTES FOR WEEKS 7 AND 8

First-order logic Syntax and semantics

Between proof theory and model theory Three traditions in logic: Syntactic (formal deduction)

Characterizing First Order Logic

This is logically equivalent to the conjunction of the positive assertion Minimal Arithmetic and Representability

UC Berkeley, Philosophy 142, Spring 2016 John MacFarlane Philosophy 142

COMP 409: Logic Homework 5

Handout: Proof of the completeness theorem

Mathematical Logic. Reasoning in First Order Logic. Chiara Ghidini. FBK-IRST, Trento, Italy

CMPS 217 Logic in Computer Science. Lecture #17

Theorem. For every positive integer n, the sum of the positive integers from 1 to n is n(n+1)

Notes on Propositional and First-Order Logic (CPSC 229 Class Notes, January )

Proseminar on Semantic Theory Fall 2013 Ling 720 First Order (Predicate) Logic: Syntax and Natural Deduction 1

Proseminar on Semantic Theory Fall 2013 Ling 720 Propositional Logic: Syntax and Natural Deduction 1

MCS-236: Graph Theory Handout #A4 San Skulrattanakulchai Gustavus Adolphus College Sep 15, Methods of Proof

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

Propositional Logic: Syntax

Automata theory. An algorithmic approach. Lecture Notes. Javier Esparza

First-Order Logic. Chapter INTRODUCTION

SYMBOLIC LOGIC UNIT 10: SINGULAR SENTENCES

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

Section Summary. Section 1.5 9/9/2014

Logics with Counting. Ian Pratt-Hartmann School of Computer Science University of Manchester Manchester M13 9PL, UK

Logic: The Big Picture

COMP2411 Lecture 10: Propositional Logic Programming. Note: This material is not covered in the book. Resolution Applied to Horn Clauses

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

CHAPTER 0: BACKGROUND (SPRING 2009 DRAFT)

Introduction to Logic in Computer Science: Autumn 2007

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

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

First-Order Predicate Logic. First-Order Logic 153/467

LINDSTRÖM S THEOREM SALMAN SIDDIQI

CONTENTS. Appendix C: Gothic Alphabet 109

Introduction to Logic in Computer Science: Autumn 2006

Philosophy 240 Symbolic Logic Russell Marcus Hamilton College Fall 2014

Comp487/587 - Boolean Formulas

Section Summary. Predicates Variables Quantifiers. Negating Quantifiers. Translating English to Logic Logic Programming (optional)

Introduction to Model Theory

STRATEGIES OF PROBLEM SOLVING

Predicates, Quantifiers and Nested Quantifiers

Incomplete version for students of easllc2012 only. 6.6 The Model Existence Game 99

A MODEL-THEORETIC PROOF OF HILBERT S NULLSTELLENSATZ

Predicate Logic. 1 Predicate Logic Symbolization

Math 4606, Summer 2004: Inductive sets, N, the Peano Axioms, Recursive Sequences Page 1 of 10

Finite and Algorithmic Model Theory II: Automata-Based Methods

Discrete Structures for Computer Science

Practice Test III, Math 314, Spring 2016

Axiomatic set theory. Chapter Why axiomatic set theory?

1 Introduction to Predicate Resolution

List of errors in and suggested modifications for First-Order Modal Logic Melvin Fitting and Richard L. Mendelsohn August 11, 2013

Logic. Propositional Logic: Syntax. Wffs

Transcription:

Discrete Mathematics (II) Spring 2017 Lecture 10: Predicate Logic and Its Language Lecturer: Yi Li 1 Predicates and Quantifiers In this action, we show you why a richer language should be introduced than propositional language, PL in brief. 1.1 Expressive power of PL As we learned in the first half semester, propositional logic can express and, or, not, imply, and if and only if. Consider the following example: Example 1. If Socrates is a man then Socrates is mortal. solution. This is a declarative statement. And we know it is true. It can be divided into two parts or two proposition letters. 1. A: Socrates is a man. 2. B: Socrates is mortal. Then we can represent the previous statement as A B. According to our deduction rules, if A is true, then we know B is true. In the last class, we had learned how to apply proposition logic to find suspect of a murder case. Chip design is based on small part of proposition logic. And we also use proposition logic to prove k-colorable graph, any set is able to be totally ordered, and könig lemma. They are hard to prove in their original domain. But once it is transformed into proposition logic form, it is easy to prove by applying compactness theorem. 1.2 Limits of PL Proposition logic is powerful. However there are some cases which it cannot describe. Let s consider the following example. Example 2. Given two statements: All men are mortal and Socrates is a man. What can we do? Solution. We all know the following statement holding, Socrates is mortal. If they are formalized as two propositions, nothing can be implied. Because we cannot express the relationship between Socrates and all men. It means simple way of proposition logic can not represent this statement. 1

Remark 1. We are wondering why propositional language fails here? 1. There is no relation between P and Q. 2. is/in relationship can not be expressed by PL. 3. Similarly, there are there exists..., all..., among..., and only.... The conclusion is that a richer language other than PL is needed to overwhelm the difficulties just faced. Solution(Continue). However, the statements can be abstracted further like 1. P : All As have property B. 2. Q: C is one of As. Follow this way, we could find a solution. 1.3 Predicates and quantifiers In last section, we still leave some unsolved cases, for example, how to express all. Consider the following example. Example 3. Consider a simple sentence, every student is younger than some instructor. Solution. It is a declarative statement, which can be expressed by a proposition letter, say P. Remark 2. However, the statement can not be expressed clearly by just a proposition. 1. It means being a students, being a instructor and being younger than somebody else. 2. P fails to reflect the finer logic structure of it. Solution(Continue). Consider a special instance of this statement. Suppose Andy is a student and Paul is a instructor. Let s introduce some predicates,which asserts something has some property. Now we have 1. S(Andy): Andy is a student. 2. I(P aul):paul is an instructor. 3. Y (Andy, P aul): Andy is younger than Paul. With these propositions, we can represent an instance of our statement. 2

Remark 3. Examining the instance and sentence in detail, we worry about: 1. There are many instances. Too many symbols are needed. 2. How about every/all and some? Solution(Continue). We introduce new concepts: 1. Variable, which can represent any students or instructors. 2. Quantifiers: (a) means there is, which is called existential quantifier. (b) means for all, which is called universal quantifiers. Now it can be written as x(s(x) y(i(y) Y (x, y))). As we pointed out in class, this sentence could be interpreted as there is an instructor who is elder than all students. The logic expression should be written as another one, which is left as an exercise. Example 4. Consider this sentence Bobby s father can beat up the father of any other kid on the block. Solution. Here the point is that how to express the connection between child and father. Function is proper than predicate because a child can determine his father. Let 1. K(x): x is a child on the block and b means Bobby. 2. f(x): x s father, 3. B(x, y): x can beat up y, We have x(k(x) ( (x = b) B(f(b), f(x)))). To enhance the expressive power of PL, we introduce the following symbols. predicates variables constants functions universal quantifier:, for all. 3

existential quantifier:, there exists Now, we expand our language as following: Definition 1 (Language). A language L consists of the following disjoint sets of distinct primitive symbols: 1. Variables: x, y, x 0, x 1,..., y 0, y 1,... (an infinite set) 2. Constants: c, d, c 0, d 0,... (any set of them). 3. Connectives:,,,, 4. Quantifiers:, 5. Predicate symbols: P, Q, R, P 1, P 2,... 6. Function symbols: f, g, h, f 0, f 1,... 7. Punctuation: the comma, and (right and left) parentheses ), ( As predicate is the most important one, it is called predicate logic. It is named first order logic together with proposition logic. In the latter, we will show you that proposition logic can be embedded into predicate logic. In another word, proposition logic is a subset of predicate logic. 1.4 Conclusion In this section, we show some limits of PL and introduce some new tools to overwhelm the troubles. Finally, we extend PL to predicated logic to express much finer statement. This is a typical pattern. In practice, we program code based on existing code other than from scratch. For example, we modify existing data structure or inherit a class by introducing new member and methods. It is important don t try to build your own wheels unless there is no choice. 2 Predicate Logic Language In previous section, predicates, variables, constants, functions and quantifiers are introduced to enhance the capability of logic to express much rich sentences. In this lecture, we will discuss the form of predicate logic in the view of point of syntax. 2.1 Term To formalize the examples shown to introduce predicate logic, we define the following definitions. Term includes constant, variable, and function. As function can be nested, a very complicated term could be constructed. Definition 2 (Term). Terms. 4

1. Every variable is a term 2. Every constants symbol is a term. 3. If f is an n-ary function symbol ( n = 1, 2,... ) and t 1,..., t n are terms, then f(t 1,..., t n ) is also a term. Definition 3 (Ground term). Terms with no variables are called variable-free terms or ground terms. Definition 4 (Atomic formula). An atomic formula is an expression of the form R(t 1,..., t n ) where R is an n-ary predicate symbol and t 1,..., t n are terms. Definition 5 (Formula). Formula is recursively defined: 1. Every atomic formula is a formula. 2. If α, β are formulas, then so are (α β), (α β), (α β), ( α), (α β). 3. If v is a variable and α is a formula, then (( v)α) and (( v)α) are also formulas. With predicate logic, many mathematical statement can be formalized. example. Consider the following Example 5. Let the domain consist of all relational numbers Q. Again φ(x, y) = (x < y), f(x, y) = x + y, g(x, y) = x y and a = 0, b = 1, c = 2 are constants. 1. (φ(x, y) φ(y, z)) 2. (( y)(φ(x, y) φ(y, z))) 3. (( x)(φ(x, z) (( y)(φ(x, y) φ(y, z)))) 4. (( x)(( y)(φ(x, y) (φ(x, g(f(x, y), c)) φ(g(f(x, y), c), y))))) 5. φ(y, f(y, y)) 2.2 Formula Formula is a sequence of symbols of predicated language formed following a specific rules. Similar to proposition logic, we here also introduce subformula to further investigate formula. Definition 6 (Subformula). A subformula of a formula φ is a consecutive sequence of symbols from φ which is itself a formula. Consider the following example. Example 6. Given an formula ((( x)(φ(x) ϕ(x, y))) (( z)σ(z))). 1. Is (( x)φ(x)) a subformula? 5

2. Is σ(x) a subformula? 3. (( x)(φ(x) ϕ(x, y))), (( z)σ(z)),φ(x), ϕ(x, y), and σ(z) all are subformulas. Here, we should pay attention to consecutive. Otherwise, we could take some subsequence wrong as a subformula. Obviously, the first one is not a subformula for it is not a consecutive sub-sequence of the given formula. However, the second one is something special, which depends how rigorous you apply definition. Let s consider the following examples. Example 7. Given the following formulas: 1. ((( x)φ(x, y)) (( x)ψ(x))) 2. ((( x)φ(x, y)) ψ(x)) We have observed that some variable x has relation with a quantifier ( x) or ( x). In order to discuss the relation between variables and quantifiers, we have the following definition. Definition 7 (Occurrence). An occurrence of a variable v in a formula φ is bound if there is a subformula ψ of φ containing that occurrence of v such that ψ begins with (( v) or (( v). An occurrence of v in φ is free if it is not bound. Here, we should pay attention to each occurrence in the definition. Definition 8. A variable v is said to occur free in φ if it has at least one free occurrence there. However, if we say a variable is free if it take place free once. Consider the following examples: Example 8. Given a formula: 1. (( y)(( x)φ(x, y)) ψ(x)) It is obvious that x is free for the first occurrence is bound and the second is free. We have some special formulas. Consider the following example. Example 9. Please observe the following formulas: 1. (( y)(( x)φ(x, y)) ( z)ψ(z)) 2. (( x)((( y)r(x, y)) (( y)t (x, y))). 3. φ(c 0, c 1 ) We can find a common feature that there is no free occurrence of any variable. Definition 9. A sentence of predicate logic is a formula with no free occurrences of any variable. 6

In the most of cases, we only discuss sentences. Contrary to sentence, we have another form of special formulas. Definition 10. An open formula is a formula without quantifiers. Consider the following example. Example 10. 1. All atomic formulas: ϕ(x), R(x, y)... 2. (R(x, y) ϕ(x)). 3. R(c 0, c 1 ). In some case, we may substitute a variable with another term. Definition 11 (Substitution(Instantiation)). If φ is a formula and v a variable, we write φ(v) to denote the fact that v occurs free in φ. 1. If t is a term, then φ(t), or if we wish to be more explicit, φ(v/t), is the result of substituting ( or instantiating) t for all free occurrences of v in φ. We call φ(t) an instance of φ. 2. If φ(t) contains no free variables, we call it a ground instance of φ. Consider the following example. Example 11. Given a formula (( x)r(x, y)) (( y)s(x, y)), 1. It is denoted as φ(x, y). 2. φ(x/s, y/t) = (( x)r(x, t)) (( y)s(s, y)). 3. φ(x/c, y/d) = (( x)r(x, d)) (( y)s(c, y)). Generally, we have the following rules. Example 12. The recursive definition of φ(x/t) with substitution t 0. The recursive definition of t 0 to x in t. 1. t is a constant, t[x/t 0 ] = t 2. t is a variable, 3. t = g(t 1, t 2,..., t k ), t[x/t 0 ] = { t 0 if t = x t o.w. (t x) t[x/t 0 ] = g(t 1 [x/t 0 ], t 2 [x/t 0 ],..., t k [x/t 0 ]) 4. φ(x, y) is an atomic formula, φ[x/t 0 ] = φ(t 0, y) 5. φ = ψ, φ[x/t 0 ] = ψ[x/t 0 ] 7

6. φ = φ 1 φ 2, φ[x/t 0 ] = φ 1 [x/t 0 ] φ 2 [x/t 0 ] 7. φ(x, y) = Q z ψ(x, y, z), φ[x/t 0 ] = { φ, x = z Q z (ψ[x/t 0 ]), x z Consider the following substitution. Example 13. Given a formula φ(x) = ( y)(x+y = 0) and s(x) = x+1. Consider the substitution φ(x/s(y)). We just assume that both variables are integers. It is obvious that it is wrong after substitution. However, some substitution is not correct in the point of view of semantic. We have the following definition. Definition 12. If the term t contains an occurrence of some variable x (which is necessarily free in t) we say that t is substitutable for the free variable v in φ(v) if all occurrences of x in t remain free in φ(v/t). Consider the following example. Example 14. Let φ(x) = ((( y)r(x, y)) (( z) Q(x, z))). 1. If t = f(w, u), then we have φ(t) = φ(x/t) = ((( y)r(f(w, u), y)) (( z) Q(f(w, u), z))). 2. If t = g(y, s(y)), it is not substitutable for x in φ(x). Proposition 13. If a term s is an initial segment of a term t, s t, then s = t. Theorem 14 (Unique readability for terms). Every term s is either a variable or constant symbol or of the form f(s 1,..., s n ) in which case f, n and the s i for 1 i n are all unique determined. Proposition 15. If a formula α is an initial segment of a formula γ, α γ, then α = γ. Theorem 16 (Unique readability for formulas). Each formula ϕ is a precisely one of the following forms: an atomic formula, (α β), (α β), (α β), ( α), (α β). Moreover, the relevant components of ϕ as displayed in each of these formula are uniquely determined. 2.3 Formation tree Definition 17. 1. Term formation trees are ordered, finitely branching tree T labeled with terms satisfying the following conditions: (a) The leaves of T are labeled with variables of constant symbols. (b) Each nonleaf node of T is labeled with a term of the form f(t 1,..., t n ). (c) A node of T that is labeled with a term of the form f(t 1,..., t n ) has exactly n immediate successors in the tree. They are labeled in (lexicographic) order with t 1,..., t n. 2. A term formation tree is associated with the term with which its root node is labeled. 8

Proposition 18. Every term t has a unique formation tree associated with it. Proposition 19. The ground terms are those terms whose formation trees have no variables on their leaves. Definition 20. The atomic formula auxiliary formation trees are the labeled, ordered, finitely branching trees of depth one whose root node is labeled with an atomic formula. If the root node of such a tree is labeled with an n-ary relation R(t 1,..., t n ), then it has n immediate successor which are labeled in order with the terms t 1,..., t n. Definition 21. The atomic formula formation trees are the finitely branching, labeled, ordered trees gotten from the auxiliary trees by attaching at each leaf labeled with a term the rest of the formation tree associated with t. Such a tree is associated with the atomic formula with which its root is labeled. Proposition 22. Every atomic formula is associated with a unique formation tree. Definition 23. The formula auxiliary formation trees are the labeled, ordered, binary branching trees T such that 1. The leaves of T are labeled with atomic formulas. 2. If σ is a nonleaf node of T with one immediate successor σ 0 labeled with a formula φ, then σ is labeled with φ, vφ, or vφ for some variable v. 3. If σ is a nonleaf node with two immediate successors, σ 0 and σ 1 labeled with formulas φ and ψ, then σ is labeled with φ ψ, φ ψ, φ ψ, φ ψ. Definition 24. 1. The formula formation trees are the ordered, labeled trees gotten from the auxiliary ones by attaching to each leaf labeled with an atomic formula the rest of its associated formation tree. Each such tree is again associated with the formula with which its root is labeled. 2. The depth of a formula is the depth of the associated auxiliary formation tree. Proposition 25. Every formula is associated with a unique(auxiliary) formation tree. Proposition 26. The subformulas of a formula φ are the labels of the nodes of the auxiliary formation tree associated with φ. Proposition 27. 1. The occurrences of a variable v in a formula φ are in one-one correspondence with the leaves of the associated formation tree that are labeled with v. We may also refer to the appropriate leaf labeled with v as the occurrence of v in φ. 2. An occurrence of the variable v in φ is bound if there is a formula ϕ beginning with (( v) or (( v) which is the label of a node above the corresponding leaf of the formation tree for φ labeled with v. Proposition 28. If φ is a formula and v a variable, then φ(v/t) is the formula associated with the formation tree gotten by replacing each leaf in the tree for φ(v) which is labeled with a free occurrence of v with the formation tree associated with t and propagating this change through the tree. Proposition 29. The term t is substitutable for v in φ(v) if all occurrences of x in t remain free in φ(t), i.e., any leaf in the formation tree for t which is a free occurrence of a variable x remains in every location in which it appears in the formation tree described in Definition 3.8. 9

2.4 Parsing Algorithm With help of formation tree, we could parse a formula in a relative way. As the definition is an expansion of definition of proposition by introducing variable, function, predicates, and quantifiers. Correspondingly, we can also extend parsing algorithm of proposition to recognize a formula in a direct approach. We first introduce a parsing subroutine for a general term and a atomic formula in the same way. And we then extend proposition s parsing algorithm to recognize a general formula, which is left as an exercise. Exercises 1. Translate the following into predicates formulas: (a) Neither a nor b is a member of every set. (b) If horse are animals, then heads of horse are heads of animals. (c) If some trains are late then all trains are late. (d) There is no set of which every set is a member. 2. Assume that we have a language with the following parameters: N, intended to mean is a number ; I, intended to mean is interesting ; <, intended to mean is less than. Give Translate them back to English. 3. Ex 2(c, e, f)/ page 88 4. Ex 3/ page 88 ( x)(n(x) (I(x) ( y)(n(y) (I(y) (x < y))))). 5. Given formulas in Ex 2 (e),(f) on page 88. Which occurrences of variables are free? Which are bound? 6. Ex 5(b, c)/ page 88. 7. Ex 2(d, e)/ page 94. 8. Ex 13/ page 95. 9. Design an algorithm to make a substitution. 10. Augment parsing algorithm for proposition logic to recognize a formula of predicate logic. Here, we assume that predicates, functions, variables, and constants are represented by a single symbol. 10