predicate logic introduction and translations
play

Predicate Logic: Introduction and Translations Alice Gao Lecture - PowerPoint PPT Presentation

Predicate Logic: Introduction and Translations Alice Gao Lecture 10 CS 245 Logic and Computation Fall 2019 1 / 28 Outline Learning goals Introduction and Motivation Elements of Predicate Logic Translating between English and Predicate


  1. Predicate Logic: Introduction and Translations Alice Gao Lecture 10 CS 245 Logic and Computation Fall 2019 1 / 28

  2. Outline Learning goals Introduction and Motivation Elements of Predicate Logic Translating between English and Predicate Logic Interpreting the Quantifjers At least, at most, and exactly Revisiting the learning goals CS 245 Logic and Computation Fall 2019 2 / 28

  3. Learning goals By the end of this lecture, you should be able to (Introduction to Predicate Logic) predicate logic but cannot be modeled using propositional logic. (Translations) CS 245 Logic and Computation Fall 2019 3 / 28 ▶ Give examples of English sentences that can be modeled using ▶ Translate an English sentence into a predicate formula. ▶ Translate a predicate formula into an English sentence.

  4. What can’t we express using propositional logic? Can we express the following ideas using propositional logic? not married to Leon. CS 245 Logic and Computation Fall 2019 4 / 28 ▶ Translate this sentence: Alice is married to Jay and Alice is ▶ Translate this sentence: Every bear likes honey. ▶ Defjne what it means for a natural number to be prime.

  5. What can’t we express using propositional logic? A few things that are diffjcult to express using propositional logic: Alice is not married to Leon. to be prime. We can use predicate logic (fjrst-order logic) to express all of these. CS 245 Logic and Computation Fall 2019 5 / 28 ▶ Relationships among individuals: Alice is married to Jay and ▶ Generalizing patterns: Every bear likes honey. ▶ Infjnite domains: Defjne what it means for a natural number

  6. Would you really use predicate logic? Examples of predicate logic in CS245 so far: 1. Every well-formed formula has an equal number of left and right brackets. 2. For every truth valuation t, if all the premises are true under t, then the conclusion is true under t. 3. If there does not exist a natural deduction proof from the premises to the conclusion, then the premises do not semantically entail the conclusion. CS 245 Logic and Computation Fall 2019 6 / 28

  7. Would you really use predicate logic? there is no path via references from any Fall 2019 CS 245 Logic and Computation equal to the age of every other person in the table. 4. Database query: select a person whose age is greater than or collection... variable in scope to any meomry location available for garbage 3. Java example: Examples of predicate logic in Computer Science: constant 𝑑 > 0 . at least 𝑑𝑜 log 𝑜 comparisons to sort 𝑜 values, for some 2. Algorithms: in the worst case, every comparison sort requires node 𝑂 is smaller than the key stored at 𝑂 . Every key stored in the left subtree of a 1. Data Structure: 7 / 28

  8. Elements of predicate logic Predicate logic generalizes propositional logic. New things in predicate logic: CS 245 Logic and Computation Fall 2019 8 / 28 ▶ Domains ▶ Predicates ▶ Quantifjers

  9. Domains A domain is a non-empty set of objects. It is a world that our statement is situated within. Examples of domains: natural numbers, people, animals, etc. Why is it important to specify a domain? The same statement can have difgerent truth values in difgerent domains. Consider this statement: There exists a number whose square is 2 . true or false? or false? CS 245 Logic and Computation Fall 2019 9 / 28 ▶ If our domain is the set of natural numbers, is this statement ▶ If our domain is the set of real numbers, is this statement true

  10. Objects in a domain Constants: concrete objects in the domain Variables: placeholders for concrete objects, e.g. x, y, z. A variable lets us refer to an object without specifying which particular object it is. CS 245 Logic and Computation Fall 2019 10 / 28 ▶ Natural numbers: 0, 6, 100, ... ▶ Alice, Bob, Eve, ... ▶ Animals: Winnie the Pooh, Micky Mouse, Simba, ...

  11. Predicates Examples: Fall 2019 CS 245 Logic and Computation predicate/relation) A predicate represents 11 / 28 any number of arguments. constants and/or variables as inputs and outputs 1 / 0 . It can have Think of a predicate as a special type of function which takes ▶ a property of an individual, or ▶ a relationship among mulitple individuals. ▶ Defjne 𝑀(𝑦) to mean “x is a lecturer”. (unary predicate) ▶ Alice is a lecturer: 𝑀(𝐵𝑚𝑗𝑑𝑓) ▶ Micky Mouse is not a lecturer: (¬𝑀(𝑁𝑗𝑑𝑙𝑧𝑁𝑝𝑣𝑡𝑓)) ▶ 𝑧 is a lecturer: 𝑀(𝑧) ▶ Defjne 𝑍 (𝑦, 𝑧) to mean “x is younger than y”. (binary ▶ Alex is younger than Sam: 𝑍 (𝐵𝑚𝑓𝑦, 𝑇𝑏𝑛) ▶ 𝑏 is younger than 𝑐 : 𝑍 (𝑏, 𝑐)

  12. Quantifjers For how many objects in the domain is the statement true? object in the domain. more objects in the domain. CS 245 Logic and Computation Fall 2019 12 / 28 ▶ The universal quantifjer ∀ : the statement is true for every ▶ The existential quantifjer ∃ : the statement is true for one or

  13. CQ Translating English into Predicate Logic Let the domain be the set of animals. 𝐼(𝑦) means that 𝑦 likes honey. 𝐶(𝑦) means that 𝑦 is a bear. Consider the following translations of English sentences into predicate logic formulas. Are the translations correct? 1. At least one animal likes honey. (∃𝑦 𝐼(𝑦)) . 2. Not every animal likes honey. (¬(∀𝑦 𝐼(𝑦))) . (A) Both are correct. (B) 1 is correct and 2 is wrong. (C) 1 is wrong and 2 is correct. (D) Both are wrong. CS 245 Logic and Computation Fall 2019 13 / 28

  14. Translating English into Predicate Logic Translate the following sentences into predicate logic. 1. All animals like honey. 2. At least one animal likes honey. 3. Not every animal likes honey. 4. No animal likes honey. Let the domain be the set of animals. 𝐼(𝑦) means that 𝑦 likes honey. 𝐶(𝑦) means that 𝑦 is a bear. CS 245 Logic and Computation Fall 2019 14 / 28

  15. Translating English into Predicate Logic Translate the following sentences into predicate logic. 5. No animal dislikes honey. 6. Not every animal dislikes honey. 7. Some animal dislikes honey. 8. Every animal dislikes honey. Let the domain be the set of animals. 𝐼(𝑦) means that 𝑦 likes honey. 𝐶(𝑦) means that 𝑦 is a bear. CS 245 Logic and Computation Fall 2019 15 / 28

  16. CQ Translating English into Predicate Logic Consider this sentence: every bear likes honey. Which one is the correct translation into predicate logic? (A) (∀𝑦 (𝐶(𝑦) ∧ 𝐼(𝑦))) (B) (∀𝑦 (𝐶(𝑦) ∨ 𝐼(𝑦))) (C) (∀𝑦 (𝐶(𝑦) → 𝐼(𝑦))) (D) (∀𝑦 (𝐼(𝑦) → 𝐶(𝑦))) Let the domain be the set of animals. 𝐼(𝑦) means that 𝑦 likes honey. 𝐶(𝑦) means that 𝑦 is a bear. CS 245 Logic and Computation Fall 2019 16 / 28

  17. CQ Translating English into Predicate Logic Consider this sentence: some bear likes honey. Which one is the correct translation into predicate logic? (A) (∃𝑦 (𝐶(𝑦) ∧ 𝐼(𝑦))) (B) (∃𝑦 (𝐶(𝑦) ∨ 𝐼(𝑦))) (C) (∃𝑦 (𝐶(𝑦) → 𝐼(𝑦))) (D) (∃𝑦 (𝐼(𝑦) → 𝐶(𝑦))) Let the domain be the set of animals. 𝐼(𝑦) means that 𝑦 likes honey. 𝐶(𝑦) means that 𝑦 is a bear. CS 245 Logic and Computation Fall 2019 17 / 28

  18. Multiple Quantifjers Let the domain be the set of people. Let 𝑀(𝑦, 𝑧) mean that person 𝑦 likes person 𝑧 . Translate the following formulas into English. 1. (∀𝑦 (∀𝑧 𝑀(𝑦, 𝑧))) 2. (∃𝑦 (∃𝑧 𝑀(𝑦, 𝑧))) 3. (∀𝑦 (∃𝑧 𝑀(𝑦, 𝑧))) 4. (∃𝑧 (∀𝑦 𝑀(𝑦, 𝑧))) CS 245 Logic and Computation Fall 2019 18 / 28

  19. CQ Translations Let the domain contain the set of all students and courses. Defjne the following predicates: 𝑇(𝑦) : 𝑦 is a student. 𝐷(𝑧) : 𝑧 is a course. 𝑈(𝑦, 𝑧) : student 𝑦 has taken course 𝑧 . Translate the sentence “every student has taken some course.” into a predicate formula. Let 𝑦 refer to a student and let 𝑧 refer to a course. What quantifjers should we use for 𝑦 and 𝑧 ? (A) ∀𝑦 and ∀𝑧 (B) ∀𝑦 and ∃𝑧 (C) ∃𝑦 and ∀𝑧 (D) ∃𝑦 and ∃𝑧 CS 245 Logic and Computation Fall 2019 19 / 28

  20. CQ Translations Let the domain contain the set of all students and courses. Defjne the following predicates: 𝑇(𝑦) : 𝑦 is a student. 𝐷(𝑧) : 𝑧 is a course. 𝑈(𝑦, 𝑧) : student 𝑦 has taken course 𝑧 . Translate the sentence “every student has taken some course.” into a predicate formula. Which of the following is a correct translation? (A) (∀𝑦 (𝑇(𝑦) → (∃𝑧 (𝐷(𝑧) → 𝑈(𝑦, 𝑧))))) (B) (∀𝑦 (𝑇(𝑦) → (∃𝑧 (𝐷(𝑧) ∧ 𝑈(𝑦, 𝑧))))) (C) (∀𝑦 (𝑇(𝑦) ∧ (∃𝑧 (𝐷(𝑧) → 𝑈(𝑦, 𝑧))))) (D) (∀𝑦 (𝑇(𝑦) ∧ (∃𝑧 (𝐷(𝑧) ∧ 𝑈(𝑦, 𝑧))))) CS 245 Logic and Computation Fall 2019 20 / 28

  21. CQ Translations Let the domain contain the set of all students and courses. Defjne the following predicates: 𝑇(𝑦) : 𝑦 is a student. 𝐷(𝑧) : 𝑧 is a course. 𝑈(𝑦, 𝑧) : student 𝑦 has taken course 𝑧 . Translate the sentence “some student has not taken any course.” into a predicate formula. Let 𝑦 refer to a student and let 𝑧 refer to a course. What quantifjers should we use for 𝑦 and 𝑧 ? (A) ∀𝑦 and ∀𝑧 (B) ∀𝑦 and ∃𝑧 (C) ∃𝑦 and ∀𝑧 (D) ∃𝑦 and ∃𝑧 CS 245 Logic and Computation Fall 2019 21 / 28

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