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 11 CS 245 Logic and Computation Fall 2019 1 / 37 Outline Learning goals Introduction and Motivation Elements of Predicate Logic Translating between English and Predicate


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

  2. Outline Learning goals Introduction and Motivation Elements of Predicate Logic Translating between English and Predicate Logic Interpreting the Quantifjers Why do we need functions? A Summary of Translation Idioms At least, at most, and exactly Revisiting the learning goals CS 245 Logic and Computation Fall 2019 2 / 37

  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 / 37 ▶ 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. Outline Learning goals Introduction and Motivation Elements of Predicate Logic Translating between English and Predicate Logic Revisiting the learning goals CS 245 Logic and Computation Fall 2019 4 / 37

  5. Translate the following argument into propositional logic Consider the argument below. 1. Every human is mortal. 2. Socrates is a human. From these two sentences, one should be able to conclude that 3. Socrates is mortal. In propositional logic, how would you express this argument? CS 245 Logic and Computation Fall 2019 5 / 37

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

  7. 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. If there does not exist a formal deduction proof from the premises to the conclusion, then the premises do not logically imply the conclusion. 3. There exists a truth valuation 𝑢 such that CS 245 Logic and Computation Fall 2019 7 / 37 for every 𝐵 ∈ Σ , 𝐵 𝑢 = 1 .

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

  9. Outline Learning goals Introduction and Motivation Elements of Predicate Logic Translating between English and Predicate Logic Revisiting the learning goals CS 245 Logic and Computation Fall 2019 9 / 37

  10. Elements of predicate logic Predicate logic generalizes propositional logic. New things in predicate logic: CS 245 Logic and Computation Fall 2019 10 / 37 ▶ Domains ▶ Relations ▶ Quantifjers

  11. Domains A domain is Examples: natural numbers, people, animals, etc. Why is it important to specify a domain? domains. Is this sentence true when the domain is ℕ ? ℝ ? CS 245 Logic and Computation Fall 2019 11 / 37 ▶ a non-empty set of objects/individuals. ▶ a world that our statement is situated within. ▶ A statement can have difgerent truth values in difgerent ▶ There exists a number whose square is 2 .

  12. Objects in a domain Individuals: concrete objects in the domain Variables: placeholders for concrete objects. CS 245 Logic and Computation Fall 2019 12 / 37 ▶ Natural numbers: 0, 6, 100, ... ▶ Alice, Bob, Eve, ... ▶ Animals: Winnie the Pooh, Micky Mouse, Simba, ... ▶ e.g. 𝑣 , 𝑤 , 𝑥 , 𝑦 , 𝑧 , 𝑨 . ▶ refers to an object without specifying a particular object.

  13. Relations A relation represents Fall 2019 CS 245 Logic and Computation predicate) 13 / 37 Examples: inputs and outputs 1 / 0 ▶ a property of an individual, or ▶ a relationship among multiple individuals. ▶ a n-ary function which takes constants and/or variables as ▶ Defjne 𝑇(𝑦) to mean “ 𝑦 is a student”. (unary predicate) ▶ Bob is a student: 𝑇(𝐶𝑝𝑐) ▶ Micky Mouse is not a student: (¬𝑇( Micky Mouse )) ▶ 𝑣 is a student: 𝑇(𝑣) ▶ Defjne 𝑍 (𝑦, 𝑧) to mean “ 𝑦 is younger than 𝑧 ”. (binary ▶ Alex is younger than Sam: 𝑍 ( Alex , Sam ) ▶ 𝑣 is younger than 𝑤 : 𝑍 (𝑣, 𝑤)

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

  15. Outline Learning goals Introduction and Motivation Elements of Predicate Logic Translating between English and Predicate Logic Interpreting the Quantifjers Why do we need functions? A Summary of Translation Idioms At least, at most, and exactly Revisiting the learning goals CS 245 Logic and Computation Fall 2019 15 / 37

  16. CQ Translating English into Predicate Logic Let the domain be the set of animals. 𝐼(𝑦) means that 𝑦 likes honey. 𝐶(𝑦) means that 𝑦 is a bear. Are the following 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 16 / 37

  17. Translating English into Predicate Logic Let the domain be the set of animals. 𝐼(𝑦) means that 𝑦 likes honey. 𝐶(𝑦) means that 𝑦 is a bear. 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. CS 245 Logic and Computation Fall 2019 17 / 37

  18. Translating English into Predicate Logic Let the domain be the set of animals. 𝐼(𝑦) means that 𝑦 likes honey. 𝐶(𝑦) means that 𝑦 is a bear. 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. CS 245 Logic and Computation Fall 2019 18 / 37

  19. 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 19 / 37

  20. CQ Translating English into Predicate Logic Consider this sentence: Some bear likes honey. (At least one 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 20 / 37

  21. 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 21 / 37

  22. CQ Translations 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 ∃𝑧 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 𝑧 . CS 245 Logic and Computation Fall 2019 22 / 37

  23. CQ Translations 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) ∀𝑦 (𝑇(𝑦) ∧ (∃𝑧 𝐷(𝑧) ∧ 𝑈(𝑦, 𝑧))) 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 𝑧 . CS 245 Logic and Computation Fall 2019 23 / 37

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