
Syntax of Predicate Logic Syntax of Predicate Logic 1/25 The Language of Predicate Logic • Domain: a non-empty set of objects • Constants: concrete objects in the domain • Variables: placeholders for concrete objects in the domain • Functions: takes objects in the domain as arguments and returns an object of the domain. • Predicates: takes objects in the domain as arguments and returns true or false. They describe properties of objects or relationships between objects. • Quantifiers: for how many objects in the domain is the statement true? Syntax of Predicate Logic 2/25 A question on functions Consider two translations of the sentence “every child is younger than its mother.” 1. (∀푥 (∀푦 ((퐶ℎ푖푙푑(푥) ∧ 푀표푡ℎ푒푟(푦, 푥)) → 푌 표푢푛푔푒푟(푥, 푦)))) 2. (∀푥 (퐶ℎ푖푙푑(푥) → 푌 표푢푛푔푒푟(푥, 푚표푡ℎ푒푟(푥)))) Which of the following is the best answer? a. Both are wrong. b. 1 is correct and 2 is wrong. c. 2 is correct and 1 is wrong. d. Both are correct. 1 is better. e. Both are correct. 2 is better. The domain is the set of people. 퐶ℎ푖푙푑(푥) means 푥 is a child. 푀표푡ℎ푒푟(푥, 푦) means 푥 is 푦’s mother. 푌 표푢푛푔푒푟(푥, 푦) means 푥 is younger than 푦. 푚표푡ℎ푒푟(푥) returns 푥’s mother. Syntax of Predicate Logic 3/25 Functions Using functions allows us to avoid ugly/inelegant predicate logic formulas. Try translating the following sentence with and without functions. “Andy and Paul have the same maternal grandmother.” Syntax of Predicate Logic 4/25 The Language of Predicate Logic The seven kinds of symbols: 1. Constant symbols. Usually 푐, 푑, 푐1, 푐2, … , 푑1, 푑2 … 2. Variables. Usually 푥, 푦, 푧, … 푥1, 푥2, … , 푦1, 푦2 … 3. Function symbols. Usually 푓, 푔, ℎ, … 푓1, 푓2, … , 푔1, 푔2,… 4. Predicate symbols. 푃 , 푄,…푃1, 푃2, …, 푄1, 푄2,… 5. Connectives: ¬, ∧, ∨, →, and ↔ 6. Quantifiers: ∀ and ∃ 7. Punctuation: ‘(’, ‘)’, and ‘,’ Function symbols and predicate symbols have an assigned arity—the number of arguments required. For example, • 푓(1): 푓 is a unary function. • 푃 (2): 푃 is a binary predicate. Syntax of Predicate Logic Symbols 5/25 Two kinds of expressions In predicate logic, we need to consider two kinds of expressions: • those that refer to an object of the domain, called terms, and • those that can have a truth value, called formulas. Syntax of Predicate Logic Terms and Formulas 6/25 Terms Each term refers to an object of the domain. We define the set of terms inductively as follows. 1. Each constant symbol is an atomic term. 2. Each variable is an atomic term. 3. 푓(푡1, … , 푡푛) is a term if 푡1, … , 푡푛 are terms and 푓 is an 푛-ary function symbol. (If 푓 is a binary function symbol, then we may write (푡1 푓 푡2) instead of 푓(푡1, 푡2).) 4. Nothing else is a term. Syntax of Predicate Logic Terms and Formulas 7/25 Which expressions are terms? A term refers to an object of the domain. Which of the following expressions is a term? a. 푔(푑, 푑) b. 푃 (푓(푥, 푦), 푑) c. 푓(푥, 푔(푦, 푧), 푑) d. 푔(푥, 푓(푦, 푧), 푑) Let 푑 be a constant symbol. Let 푃 be a predicate symbol with 2 arguments. Let 푓 be a function symbol with 2 arguments and 푔 be a function symbol with 3 arguments. Let 푥, 푦, and 푧 be variable symbols. Syntax of Predicate Logic Terms and Formulas 8/25 Is this a term? True or False: The expression (2 − 푓(푥)) + (푦 ∗ 푥) is a term. a. True b. False c. Not enough information to tell The domain is the set of integers. +, − and ∗ are binary functions. 푓 is a unary function. 푥 and 푦 are variables and 2 is a constant. Syntax of Predicate Logic Terms and Formulas 9/25 Well-Formed Predicate Logic Formulas We define the set of well-formed formulas of predicate logic inductively as follows. 1. 푃 (푡1, … , 푡푛) is an atomic formula if 푃 is an 푛-ary predicate symbol and each 푡푖 is a term (1 ≤ 푖 ≤ 푛). 2. (¬훼) is a formula if 훼 is a formula. 3. (훼 ⋆ 훽) is a formula if 훼 and 훽 are formulas and ⋆ is a binary connective symbol. 4. Each of (∀푥 훼) and (∃푥 훼) is a formula if 훼 is a formula and 푥 is a variable. 5. Nothing else is a formula. Syntax of Predicate Logic Terms and Formulas 10/25 Determine whether a formula is well-formed 푚 is a constant and 푥 and 푦 are variables. 푃 (2) and 푄(2) are binary predicates. 푓(1) is a unary function. Which of the following is a well-formed predicate logic formula? a. (푓(푥) → 푃 (푥, 푦)) b. ∀푦 푃 (푚, 푓(푦)) c. 푃 (푥, 푦) → 푄(푄(푥)) d. 푄(푚, 푓(푚)) e. 푃 (푚, 푓(푄(푥, 푦))) Syntax of Predicate Logic Terms and Formulas 11/25 Determine whether a formula is well-formed Things to consider: • Are there enough brackets? Are the brackets in the right places? • Is each unary/binary connective applied to the right number of predicates? • Does every function have the right number and type of arguments? • Does every predicate have the right number and type of arguments? Syntax of Predicate Logic Terms and Formulas 12/25 Comparing the Definitions of WFFs Let’s compare and contrast the definitions of WFFs for propositional and predicate logic. • Which parts of the two definitions are the same? • The definition of WFF for propositional logic says that a propositional variable is an atomic WFF. Is this still the case for predicate logic? • What is new in the definition of WFF for predicate logic compared to the definition of WFF for propositional logic? • If we were to prove that every WFF for predicate logic has a property P by structural induction, what does the proof look like? What are the base case(s) and what are the cases in the induction step? Syntax of Predicate Logic Terms and Formulas 13/25 Parse Trees of Predicate Logic Formulas New elements in the parse tree: • Quantifiers ∀푥 and ∃푦 has one subtree, similar to the unary connective negation. • A predicate 푃 (푡1, 푡2, … , 푡푛) has a node labelled 푃 with a sub-tree for each of the terms 푡1, 푡2, … , 푡푛. • A function 푓(푡1, 푡2, … , 푡푛) has a node labelled 푓 with a sub-tree for each of the terms 푡1, 푡2, … , 푡푛. Example 1: (∀푥 (푃 (푥) ∧ 푄(푥))) → (¬(푃 (푓(푥, 푦)) ∨ 푄(푦))) Example 2: (∀푥 ((푃 (푥) ∧ 푄(푥)) → (¬(푃 (푓(푥, 푦)) ∨ 푄(푦))))) Syntax of Predicate Logic Terms and Formulas 14/25 Evaluating a Formula To evaluate the truth value of a formula, we need to replace the variables by concrete objects in the domain. However, we don’t necessarily have to perform this substitution for every variable. There are two types of variables in a formula: • A variable may be free. To evaluate the formula, we need to replace a free variable by an object in the domain. • A variable may be bound by a quantifier. The quantifier tells us how to evaluate the formula. We need to understand how to determine whether a variable is free/bound and how to replace a free variable with an object in the domain. Syntax of Predicate Logic Free and Bound Variables 15/25 Free and Bound Variables In a formula (∀푥 훼) or (∃푥 훼), the scope of a quantifier is the formula 훼. A quantifier binds its variable within its scope. An occurrence of a variable in a formula is bound if it lies in the scope of some quantifier of the same variable. Otherwise the occurrence ofthis variable is free. • If a variable occurs multiple times, we need to consider each occurrence of the variable separately. • The variable symbol immediately after ∃ or ∀ is neither free nor bound. A formula with no free variables is called a closed formula or sentence. Syntax of Predicate Logic Free and Bound Variables 16/25 Determine whether a variable is free or bound Determine whether a variable is free or bound using a parse tree. 1. Draw the parse tree for the formula. 2. Choose the leaf node for an occurrence of a variable. 3. Walk up the tree. Stop as soon as we encounter a quantifier for this variable or we reach the root of the tree. 4. If we encountered a quantifier for the variable, this occurrence of the variable is bound. 5. If we reached the root of the tree which is not a quantifier for the variable, this occurrence of the variable is free. Example 1: (∀푥 (푃 (푥) ∧ 푄(푥))) → (¬(푃 (푓(푥, 푦)) ∨ 푄(푦))) Example 2: (∀푥 ((푃 (푥) ∧ 푄(푥)) → (¬(푃 (푓(푥, 푦)) ∨ 푄(푦))))) Syntax of Predicate Logic Free and Bound Variables 17/25 Substitution When writing natural deduction proofs in predicate logic, it is often useful to replace a variable in a formula with a term. Suppose that the following sentences are true: (∀푥 (Fish(푥) → Swim(푥))) (1) Fish(Nemo) (2) To conclude that Nemo can swim, we need to replace every occurence of the variable x in the implication Fish(푥) → Swim(푥) by the term Nemo. This gives us (Fish(Nemo) → Swim(Nemo)) (3) By modus ponens on (2) and (3), we conclude that Swim(Nemo). Formally, we use substitution to refer to the process of replacing 푥 by Nemo in the formula ∀푥 Fish(푥) → Swim(푥). Syntax of Predicate Logic Substitution 18/25 Substitution Intuitively, 훼[푡/푥] answers the question, “What happens to 훼 if 푥 has the value specified by term 푡?” For a variable 푥, a term 푡, and a formula 훼, 훼[푡/푥] denotes the resulting formula by replacing each free occurrence of 푥 in 훼 with 푡.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages25 Page
-
File Size-