syntax of predicate logic
play

Syntax of Predicate Logic Syntax of Predicate Logic 1/25 The - PowerPoint PPT Presentation

Syntax of Predicate Logic Syntax of Predicate Logic 1/25 The Language of Predicate Logic object of the domain. or false. They describe properties of objects or relationships between objects. true? Syntax of Predicate Logic 2/25 Domain:


  1. Syntax of Predicate Logic Syntax of Predicate Logic 1/25

  2. The Language of Predicate Logic object of the domain. or false. They describe properties of objects or relationships between objects. true? Syntax of Predicate Logic 2/25 • 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 • Predicates: takes objects in the domain as arguments and returns true • Quantifjers: for how many objects in the domain is the statement

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

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

  5. The Language of Predicate Logic 5. Symbols Syntax of Predicate Logic number of arguments required. For example, ‘(’, ‘)’, and ‘,’ Punctuation: 7. ∀ and ∃ Quantifjers: 6. ¬ , ∧ , ∨ , → , and ↔ The seven kinds of symbols: Connectives: 𝑄 , 𝑅 , … 𝑄 1 , 𝑄 2 , …, 𝑅 1 , 𝑅 2 , … Predicate symbols. 4. Usually 𝑔, 𝑕, ℎ, … 𝑔 1 , 𝑔 2 , … , 𝑕 1 , 𝑕 2 , … Function symbols. 3. Variables. 2. Constant symbols. 1. 5/25 Usually 𝑑, 𝑒, 𝑑 1 , 𝑑 2 , … , 𝑒 1 , 𝑒 2 … Usually 𝑦, 𝑧, 𝑨, … 𝑦 1 , 𝑦 2 , … , 𝑧 1 , 𝑧 2 … Function symbols and predicate symbols have an assigned arity —the • 𝑔 (1) : 𝑔 is a unary function. • 𝑄 (2) : 𝑄 is a binary predicate.

  6. Two kinds of expressions In predicate logic, we need to consider two kinds of expressions: Syntax of Predicate Logic Terms and Formulas 6/25 • those that refer to an object of the domain, called terms , and • those that can have a truth value, called formulas .

  7. Terms Each term refers to an object of the domain. We defjne the set of terms inductively as follows. 1. Each constant symbol is an atomic term. 2. Each variable is an atomic term. instead of 𝑔(𝑢 1 , 𝑢 2 ) .) 4. Nothing else is a term. Syntax of Predicate Logic Terms and Formulas 7/25 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 )

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

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

  10. Well-Formed Predicate Logic Formulas We defjne the set of well-formed formulas of predicate logic inductively as follows. 1. 𝑄(𝑢 1 , … , 𝑢 𝑜 ) is an atomic formula if 𝑄 is an 𝑜 -ary predicate symbol 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 and each 𝑢 𝑗 is a term ( 1 ≤ 𝑗 ≤ 𝑜 ).

  11. Determine whether a formula is well-formed 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 𝑛 is a constant and 𝑦 and 𝑧 are variables. 𝑄 (2) and 𝑅 (2) are binary predicates. 𝑔 (1) is a unary function.

  12. Determine whether a formula is well-formed Things to consider: predicates ? Syntax of Predicate Logic Terms and Formulas 12/25 • Are there enough brackets ? Are the brackets in the right places ? • Is each unary/binary connective applied to the right number of • Does every function have the right number and type of arguments? • Does every predicate have the right number and type of arguments?

  13. Comparing the Defjnitions of WFFs Let’s compare and contrast the defjnitions of WFFs for propositional and predicate logic. the defjnition of WFF for propositional logic? 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 • Which parts of the two defjnitions are the same ? • The defjnition 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 defjnition of WFF for predicate logic compared to • If we were to prove that every WFF for predicate logic has a property

  14. Parse Trees of Predicate Logic Formulas New elements in the parse tree: connective negation. each of the terms 𝑢 1 , 𝑢 2 , … , 𝑢 𝑜 . each of the terms 𝑢 1 , 𝑢 2 , … , 𝑢 𝑜 . Example 1: (∀𝑦 (𝑄(𝑦) ∧ 𝑅(𝑦))) → (¬(𝑄(𝑔(𝑦, 𝑧)) ∨ 𝑅(𝑧))) Example 2: (∀𝑦 ((𝑄(𝑦) ∧ 𝑅(𝑦)) → (¬(𝑄(𝑔(𝑦, 𝑧)) ∨ 𝑅(𝑧))))) Syntax of Predicate Logic Terms and Formulas 14/25 • Quantifjers ∀𝑦 and ∃𝑧 has one subtree, similar to the unary • A predicate 𝑄(𝑢 1 , 𝑢 2 , … , 𝑢 𝑜 ) has a node labelled 𝑄 with a sub-tree for • A function 𝑔(𝑢 1 , 𝑢 2 , … , 𝑢 𝑜 ) has a node labelled 𝑔 with a sub-tree for

  15. 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: free variable by an object in the domain. to evaluate the formula. and how to replace a free variable with an object in the domain . Syntax of Predicate Logic Free and Bound Variables 15/25 • A variable may be free . To evaluate the formula, we need to replace a • A variable may be bound by a quantifjer . The quantifjer tells us how We need to understand how to determine whether a variable is free/bound

  16. Free and Bound Variables some quantifjer of the same variable. Otherwise the occurrence of this variable is free . occurrence of the variable separately. bound. Syntax of Predicate Logic Free and Bound Variables 16/25 In a formula (∀𝑦 𝛽) or (∃𝑦 𝛽) , the scope of a quantifjer is the formula 𝛽 . A quantifjer binds its variable within its scope. An occurrence of a variable in a formula is bound if it lies in the scope of • If a variable occurs multiple times, we need to consider each • The variable symbol immediately after ∃ or ∀ is neither free nor A formula with no free variables is called a closed formula or sentence .

  17. 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 quantifjer for this variable or we reach the root of the tree. variable is bound . 5. If we reached the root of the tree which is not a quantifjer for the variable , this occurrence of the variable is free . Example 1: (∀𝑦 (𝑄(𝑦) ∧ 𝑅(𝑦))) → (¬(𝑄(𝑔(𝑦, 𝑧)) ∨ 𝑅(𝑧))) Example 2: (∀𝑦 ((𝑄(𝑦) ∧ 𝑅(𝑦)) → (¬(𝑄(𝑔(𝑦, 𝑧)) ∨ 𝑅(𝑧))))) Syntax of Predicate Logic Free and Bound Variables 17/25 4. If we encountered a quantifjer for the variable , this occurrence of the

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend