predicate logic semantics
play

Predicate Logic: Semantics Alice Gao Lecture 13 CS 245 Logic and - PowerPoint PPT Presentation

Predicate Logic: Semantics Alice Gao Lecture 13 CS 245 Logic and Computation Fall 2019 1 / 35 Outline The Learning Goals Evaluating Terms and Formulas w/o Variables Evaluating Terms and Formulas w/o Bound Variables Evaluating Quantifjed


  1. Predicate Logic: Semantics Alice Gao Lecture 13 CS 245 Logic and Computation Fall 2019 1 / 35

  2. Outline The Learning Goals Evaluating Terms and Formulas w/o Variables Evaluating Terms and Formulas w/o Bound Variables Evaluating Quantifjed Formulas A few clarifjcations Satisfjable and Valid Revisiting the Learning Goals CS 245 Logic and Computation Fall 2019 2 / 35

  3. Learning goals By the end of this lecture, you should be able to: valid. CS 245 Logic and Computation Fall 2019 3 / 35 ▶ Defjne a valuation. ▶ Determine the value of a term given a valuation. ▶ Determine the truth value of a formula given a valuation. ▶ Give a valuation that makes a formula true or false. ▶ Determine and justify whether a formula is satisfjable and/or

  4. The Language of Predicate Logic returns an object of the domain. returns true or false. They describe properties of objects or relationships between objects. statement true? CS 245 Logic and Computation Fall 2019 4 / 35 ▶ Domain: a non-empty set of objects ▶ Individuals: concrete objects in the domain ▶ Functions: takes objects in the domain as arguments and ▶ Relations: takes objects in the domain as arguments and ▶ Variables: placeholders for concrete objects in the domain ▶ Quantifjers: for how many objects in the domain is the

  5. The semantics of a predicate formula Given a well-formed formula of predicate logic, does the formula evaluate to 0 or 1 in some context? Example: What does (𝐺(𝑏) ∨ 𝐻(𝑏, 𝑐)) mean? The symbols 𝐺, 𝐻, 𝑏 , and 𝑐 do not have intrinsic meanings. to give a meaning to a formula. In predicate logic, we need a valuation to give a meaning to a term or a formula. CS 245 Logic and Computation Fall 2019 5 / 35 In propositional logic, we need a truth valuation

  6. Valuation A valuation 𝑤 for our language ℒ consists of 1. A domain 𝐸 , ≈ 𝑤 = {⟨𝑦, 𝑦⟩}𝑦 ∈ 𝐸} ⊆ 𝐸 2 . CS 245 Logic and Computation Fall 2019 6 / 35 2. A meaning for each individual symbol, e.g. 𝑏 𝑤 ∈ 𝐸 , 3. A meaning for each free variable symbol, e.g. 𝑣 𝑤 ∈ 𝐸 , 4. A meaning for each relation symbol, e.g. 𝐺 𝑤 ⊆ 𝐸 𝑜 , 5. A meaning for each function symbol, e.g. 𝑔 𝑤 ∶ 𝐸 𝑛 → 𝐸 .

  7. A function symbol must be interpreted as a total function A function symbol 𝑔 must be interpreted as 𝑔 𝑤 (𝑒 𝑤 1 , ..., 𝑒 𝑤 𝑛 ) ∈ 𝐸 . CS 245 Logic and Computation Fall 2019 7 / 35 a function 𝑔 𝑤 that is total on the domain 𝐸 . 𝑔 𝑤 ∶ 𝐸 𝑛 → 𝐸 ▶ Any 𝑛 -tuple (𝑒 1 , ..., 𝑒 𝑛 ) ∈ 𝐸 𝑛 can be an input to 𝑔 𝑤 . ▶ For any legal 𝑛 -tuple (𝑒 1 , ..., 𝑒 𝑛 ) ∈ 𝐸 𝑛 ,

  8. CQ Which function is total? Which of the following functions is total? (A) 𝑕(𝑦, 𝑧) = 𝑦 − 𝑧 . 𝐸 = ℕ (natural numbers). (C) 𝑔(𝑦) = 𝑦 + 1 . 𝐸 = {1, 2, 3} . (D) 𝑔(1) = 2 , 𝑔(2) = 3 and 𝑔(3) = 3 . 𝐸 = {1, 2, 3} . (E) 𝑕(𝑦, 𝑧) = 𝑦 > 𝑧 . 𝐸 = ℤ (integers). CS 245 Logic and Computation Fall 2019 8 / 35 (B) 𝑔(𝑦) = √𝑦 . 𝐸 = ℤ (integers).

  9. Value of Terms Defjnition (Value of Terms) The value of terms of 𝑀 under valuation 𝑤 over domain 𝐸 is defjned by recursion: 1 , … , 𝑢 𝑤 𝑜 ) . CS 245 Logic and Computation Fall 2019 9 / 35 1. 𝑏 𝑤 ∈ 𝐸 . 2. 𝑣 𝑤 ∈ 𝐸 . 3. 𝑔(𝑢 1 , … , 𝑢 𝑜 ) 𝑤 = 𝑔 𝑤 (𝑢 𝑤

  10. The assignment override notation 3. 𝑣 𝑤(𝑣 1 /2)(𝑣 2 /1) Fall 2019 CS 245 Logic and Computation = ? 3 5. 𝑣 𝑤(𝑣 1 /2)(𝑣 2 /1) = ? 2 4. 𝑣 𝑤(𝑣 1 /2)(𝑣 2 /1) = ? 1 = ? 𝑤(𝑣/𝛽) keeps all the mappings in 𝑤 intact 2 2. 𝑣 𝑤(𝑣 1 /2) = ? 1 1. 𝑣 𝑤(𝑣 1 /2) Consider a valuation: 𝑣 𝑤 EXCEPT reassigning 𝑣 to 𝛽 ∈ 𝐸 . 10 / 35 1 = 3 , 𝑣 𝑤 2 = 3 , 𝑣 𝑤 3 = 1 . 𝐸 = {1, 2, 3} .

  11. True Value of Formulas Defjnition (Truth Value of Formulas) Fall 2019 CS 245 Logic and Computation where 𝑣 does not occur in 𝐵(𝑦) . where 𝑣 does not occur in 𝐵(𝑦) . 11 / 35 1 , … , 𝑢 𝑤 is defjned by recursion: The truth value of formulas of 𝑀 under valuation 𝑤 over domain 𝐸 1. 𝐺(𝑢 1 , … , 𝑢 𝑜 ) 𝑤 = 1 ifg ⟨𝑢 𝑤 𝑜 ⟩ ∈ 𝐺 𝑤 . 2. (¬𝐵) 𝑤 = 1 ifg 𝐵 𝑤 = 0 . 3. (𝐵 ∧ 𝐶) 𝑤 = 1 ifg 𝐵 𝑤 = 1 and 𝐶 𝑤 = 1 . 4. (𝐵 ∨ 𝐶) 𝑤 = 1 ifg 𝐵 𝑤 = 1 or 𝐶 𝑤 = 1 . 5. (𝐵 → 𝐶) 𝑤 = 1 ifg 𝐵 𝑤 = 0 or 𝐶 𝑤 = 1 . 6. (𝐵 ↔ 𝐶) 𝑤 = 1 ifg 𝐵 𝑤 = 𝐶 𝑤 . 7. (∀𝑦 𝐵(𝑦)) 𝑤 = 1 ifg for every 𝛽 ∈ 𝐸 , 𝐵(𝑣) 𝑤(𝑣/𝛽) = 1 , 8. (∃𝑦 𝐵(𝑦)) 𝑤 = 1 ifg there exists 𝛽 ∈ 𝐸 , 𝐵(𝑣) 𝑤(𝑣/𝛽) = 1 ,

  12. Our predicate logic language Our language of predicate logic: Individual symbols: 𝑏, 𝑐, 𝑑 . Free variable symbols: 𝑣, 𝑤, 𝑥 . Bound variable symbols: 𝑦, 𝑧, 𝑨 . Function symbols: 𝑔 is a unary function. 𝑕 is a binary function. Relation symbols: 𝐺 is a unary relation. 𝐻 is a binary relation. CS 245 Logic and Computation Fall 2019 12 / 35

  13. An example of a valuation Valuation 𝑤 : 𝑔 𝑤 : 𝑔 𝑤 (1) = 2, 𝑔 𝑤 (2) = 3, 𝑔 𝑤 (3) = 1 . 𝑕 𝑤 : 𝑕 𝑤 (𝑦, 𝑧) = ((𝑦 + 𝑧) mod 3) + 1 . 𝐻 𝑤 : 𝐻 𝑤 (𝑦, 𝑧) is true if and only if 𝑦 > 𝑧 . CS 245 Logic and Computation Fall 2019 13 / 35 ▶ Domain: 𝐸 = {1, 2, 3} . ▶ Individuals: 𝑏 𝑤 = 1 , 𝑐 𝑤 = 2 , 𝑑 𝑤 = 3 . ▶ Free variables: 𝑣 𝑤 = 3 , 𝑤 𝑤 = 2 , 𝑥 𝑤 = 1 . ▶ Functions: ▶ Relations: 𝐺 𝑤 : 𝐺 𝑤 (𝑦) is true if and only if 𝑦 > 5 .

  14. Another example of a valuation Valuation 𝑤 ′ : Fall 2019 CS 245 Logic and Computation 𝑧 . (Alice is older than Cate, who is older than Bob.) 𝐻 𝑤 : 𝐻 𝑤 (𝑦, 𝑧) is true ifg 𝑦 is older than or has the same age as Cate like chocolates whereas Bob dislikes chocolates.) there is a tie. 𝑕 𝑤 : 𝑕 𝑤 (𝑦, 𝑧) = the person with the longer name. return 𝑦 if 𝑔 𝑤 : 𝑔 𝑤 (𝐵𝑚𝑗𝑑𝑓) = 𝐵𝑚𝑗𝑑𝑓, 𝑔 𝑤 (𝐶𝑝𝑐) = 𝐷𝑏𝑢𝑓, 𝑔 𝑤 (𝐷𝑏𝑢𝑓) = 𝐶𝑝𝑐 . 14 / 35 ▶ Domain: 𝐸 = {𝐵𝑚𝑗𝑑𝑓, 𝐶𝑝𝑐, 𝐷𝑏𝑢𝑓} . ▶ Individuals: 𝑏 𝑤 = 𝐵𝑚𝑗𝑑𝑓 , 𝑐 𝑤 = 𝐶𝑝𝑐 , 𝑑 𝑤 = 𝐷𝑏𝑢𝑓 . ▶ Free variables: 𝑣 𝑤 = 𝐶𝑝𝑐 , 𝑤 𝑤 = 𝐵𝑚𝑗𝑑𝑓 , 𝑥 𝑤 = 𝐵𝑚𝑗𝑑𝑓 . ▶ Functions: ▶ Relations: 𝐺 𝑤 : 𝐺 𝑤 (𝑦) is true ifg the person likes chocolates. (Alice and

  15. Notation for functions and relations Consider the domain 𝐸 = {1, 2, 3} . Functions: Relations: CS 245 Logic and Computation Fall 2019 15 / 35 ▶ 𝑔 𝑤 is the identify function. 𝑔 𝑤 (𝑦) = 𝑦 . ▶ 𝑔 𝑤 (1) = 1 , 𝑔 𝑤 (2) = 2 and 𝑔 𝑤 (3) = 3 . ▶ 𝐻 𝑤 : 𝐻 𝑤 (𝑦, 𝑧) is true if and only if 𝑦 > 𝑧 . ▶ 𝐻 𝑤 = {⟨2, 1⟩, ⟨3, 1⟩, ⟨3, 2⟩}

  16. Outline The Learning Goals Evaluating Terms and Formulas w/o Variables Evaluating Terms and Formulas w/o Bound Variables Evaluating Quantifjed Formulas A few clarifjcations Satisfjable and Valid Revisiting the Learning Goals CS 245 Logic and Computation Fall 2019 16 / 35

  17. Evaluating terms and formulas w/o variables Evaluate these terms and formulas under the valuation 𝑤 . 𝑔(𝑔(𝑏)) , (𝐺(𝑏) ∨ 𝐻(𝑏, 𝑐)) . Valuation 𝑤 : 𝑔 𝑤 : 𝑔 𝑤 (1) = 2, 𝑔 𝑤 (2) = 3, 𝑔 𝑤 (3) = 1 . 𝑕 𝑤 : 𝑕 𝑤 (𝑦, 𝑧) = ((𝑦 + 𝑧) mod 3) + 1 . 𝐻 𝑤 : 𝐻 𝑤 (𝑦, 𝑧) is true if and only if 𝑦 > 𝑧 . CS 245 Logic and Computation Fall 2019 17 / 35 ▶ Domain: 𝐸 = {1, 2, 3} . ▶ Individuals: 𝑏 𝑤 = 1 , 𝑐 𝑤 = 2 , 𝑑 𝑤 = 3 . ▶ Free variables: 𝑣 𝑤 = 3 , 𝑤 𝑤 = 2 , 𝑥 𝑤 = 1 . ▶ Functions: ▶ Relations: 𝐺 𝑤 : 𝐺 𝑤 (𝑦) is true if and only if 𝑦 > 5 .

  18. Give a valuation that makes the formula true/false Complete the valuation 𝑤 such that Valuation 𝑤 : CS 245 Logic and Computation Fall 2019 18 / 35 (A) 𝐻(𝑏, 𝑔(𝑔(𝑏))) 𝑤 = 1 (B) 𝐻(𝑏, 𝑔(𝑔(𝑏))) 𝑤 = 0 ▶ Domain: 𝐸 = {1, 2, 3} . ▶ Individuals: 𝑏 𝑤 = ? , 𝑐 𝑤 = ? , 𝑑 𝑤 = ? . ▶ Functions: 𝑔 𝑤 ∶ ? , 𝑕 𝑤 ∶ ? ▶ Relations: 𝑄 𝑤 ∶ ? , 𝐻 𝑤 ∶ ?

  19. Outline The Learning Goals Evaluating Terms and Formulas w/o Variables Evaluating Terms and Formulas w/o Bound Variables Evaluating Quantifjed Formulas A few clarifjcations Satisfjable and Valid Revisiting the Learning Goals CS 245 Logic and Computation Fall 2019 19 / 35

  20. A valuation for interpreting free variables Valuation 𝑤 : 𝑔 𝑤 : 𝑔 𝑤 (1) = 2, 𝑔 𝑤 (2) = 3, 𝑔 𝑤 (3) = 1 . 𝑕 𝑤 : 𝑕 𝑤 (𝑦, 𝑧) = ((𝑦 + 𝑧) mod 3) + 1 . 𝐻 𝑤 : 𝐻 𝑤 (𝑦, 𝑧) is true if and only if 𝑦 > 𝑧 . CS 245 Logic and Computation Fall 2019 20 / 35 ▶ Domain: 𝐸 = {1, 2, 3} . ▶ Individuals: 𝑏 𝑤 = 1 , 𝑐 𝑤 = 2 , 𝑑 𝑤 = 3 . ▶ Free variables: 𝑣 𝑤 = 3 , 𝑤 𝑤 = 2 , 𝑥 𝑤 = 1 . ▶ Functions: ▶ Relations: 𝐺 𝑤 : 𝐺 𝑤 (𝑦) is true if and only if 𝑦 > 5 .

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