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

predicate logic semantics
SMART_READER_LITE
LIVE PREVIEW

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 / 36 Outline The Learning Goals Evaluating Terms and Formulas w/o Variables Evaluating Terms and Formulas w/o Bound Variables Evaluating Quantifjed


slide-1
SLIDE 1

Predicate Logic: Semantics

Alice Gao

Lecture 13

CS 245 Logic and Computation Fall 2019 1 / 36

slide-2
SLIDE 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 / 36

slide-3
SLIDE 3

Learning goals

By the end of this lecture, you should be able to:

▶ 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

valid.

CS 245 Logic and Computation Fall 2019 3 / 36

slide-4
SLIDE 4

The Language of Predicate Logic

▶ Domain: a non-empty set of objects ▶ Individuals: concrete objects in the domain ▶ Functions: takes objects in the domain as arguments and

returns an object of the domain.

▶ Relations: takes objects in the domain as arguments and

returns true or false. They describe properties of objects or relationships between objects.

▶ Variables: placeholders for concrete objects in the domain ▶ Quantifjers: for how many objects in the domain is the

statement true?

CS 245 Logic and Computation Fall 2019 4 / 36

slide-5
SLIDE 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. In propositional logic, we need a truth valuation 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 / 36

slide-6
SLIDE 6

Valuation

A valuation 𝑤 for our language ℒ consists of

  • 1. A domain 𝐸,
  • 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. 𝐺 𝑤 ⊆ 𝐸𝑜,

≈𝑤= {⟨𝑦, 𝑦⟩}𝑦 ∈ 𝐸} ⊆ 𝐸2.

  • 5. A meaning for each function symbol, e.g. 𝑔𝑤 ∶ 𝐸𝑛 → 𝐸.

CS 245 Logic and Computation Fall 2019 6 / 36

slide-7
SLIDE 7

A function symbol must be interpreted as a total function

A function symbol 𝑔 must be interpreted as a function 𝑔𝑤 that is total on the domain 𝐸. 𝑔𝑤 ∶ 𝐸𝑛 → 𝐸

▶ Any 𝑛-tuple (𝑒1, ..., 𝑒𝑛) ∈ 𝐸𝑛 can be an input to 𝑔𝑤. ▶ For any legal 𝑛-tuple (𝑒1, ..., 𝑒𝑛) ∈ 𝐸𝑛,

𝑔𝑤(𝑒𝑤

1, ..., 𝑒𝑤 𝑛) ∈ 𝐸.

CS 245 Logic and Computation Fall 2019 7 / 36

slide-8
SLIDE 8

CQ Which function is total?

Which of the following functions is total? (A) 𝑕(𝑦, 𝑧) = 𝑦 − 𝑧. 𝐸 = ℕ (natural numbers).

  • Incorrect. 1 - 2 = -1 is not a natural number.

(B) 𝑔(𝑦) = √𝑦. 𝐸 = ℤ (integers).

  • Incorrect. The square root of an integer may not be an integer

anymore. (C) 𝑔(𝑦) = 𝑦 + 1. 𝐸 = {1, 2, 3}.

  • Incorrect. 3 + 1 = 4 not in domain.

(D) 𝑔(1) = 2, 𝑔(2) = 3 and 𝑔(3) = 3. 𝐸 = {1, 2, 3}. Correct (E) 𝑕(𝑦, 𝑧) = 𝑦 > 𝑧. 𝐸 = ℤ (integers).

  • Incorrect. x > y produces true or false, not a domain element.

CS 245 Logic and Computation Fall 2019 8 / 36

slide-9
SLIDE 9

Value of Terms

Defjnition (Value of Terms)

The value of terms of 𝑀 under valuation 𝑤 over domain 𝐸 is defjned by recursion:

  • 1. 𝑏𝑤 ∈ 𝐸.
  • 2. 𝑣𝑤 ∈ 𝐸.
  • 3. 𝑔(𝑢1, … , 𝑢𝑜)𝑤 = 𝑔𝑤(𝑢𝑤

1, … , 𝑢𝑤 𝑜).

CS 245 Logic and Computation Fall 2019 9 / 36

slide-10
SLIDE 10

The assignment override notation

𝑤(𝑣/𝛽) keeps all the mappings in 𝑤 intact EXCEPT reassigning 𝑣 to 𝛽 ∈ 𝐸. Consider a valuation: 𝑣𝑤

1 = 3, 𝑣𝑤 2 = 3, 𝑣𝑤 3 = 1. 𝐸 = {1, 2, 3}.

  • 1. 𝑣𝑤(𝑣1/2)

1

= ?

  • 2. 𝑣𝑤(𝑣1/2)

2

= ?

  • 3. 𝑣𝑤(𝑣1/2)(𝑣2/1)

1

= ?

  • 4. 𝑣𝑤(𝑣1/2)(𝑣2/1)

2

= ?

  • 5. 𝑣𝑤(𝑣1/2)(𝑣2/1)

3

= ? 𝑣𝑤(𝑣1/2)

1

= 2, 𝑣𝑤(𝑣1/2)

2

= 3 𝑣𝑤(𝑣1/2)(𝑣2/1)

1

= 2, 𝑣𝑤(𝑣1/2)(𝑣2/1)

2

= 1, 𝑣𝑤(𝑣1/2)(𝑣2/1)

3

= 1

CS 245 Logic and Computation Fall 2019 10 / 36

slide-11
SLIDE 11

True Value of Formulas

Defjnition (Truth Value of Formulas)

The truth value of formulas of 𝑀 under valuation 𝑤 over domain 𝐸 is defjned by recursion:

  • 1. 𝐺(𝑢1, … , 𝑢𝑜)𝑤 = 1 ifg ⟨𝑢𝑤

1, … , 𝑢𝑤 𝑜⟩ ∈ 𝐺 𝑤.

  • 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,

where 𝑣 does not occur in 𝐵(𝑦).

  • 8. (∃𝑦 𝐵(𝑦))𝑤 = 1 ifg there exists 𝛽 ∈ 𝐸, 𝐵(𝑣)𝑤(𝑣/𝛽) = 1,

where 𝑣 does not occur in 𝐵(𝑦).

CS 245 Logic and Computation Fall 2019 11 / 36

slide-12
SLIDE 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 / 36

slide-13
SLIDE 13

An example of a valuation

Valuation 𝑤:

▶ Domain: 𝐸 = {1, 2, 3}. ▶ Individuals: 𝑏𝑤 = 1, 𝑐𝑤 = 2, 𝑑𝑤 = 3. ▶ Free variables: 𝑣𝑤 = 3, 𝑤𝑤 = 2, 𝑥𝑤 = 1. ▶ Functions:

𝑔𝑤: 𝑔𝑤(1) = 2, 𝑔𝑤(2) = 3, 𝑔𝑤(3) = 1. 𝑕𝑤: 𝑕𝑤(𝑦, 𝑧) = ((𝑦 + 𝑧) mod 3) + 1.

▶ Relations:

𝐺 𝑤: 𝐺 𝑤(𝑦) is true if and only if 𝑦 > 5. 𝐻𝑤: 𝐻𝑤(𝑦, 𝑧) is true if and only if 𝑦 > 𝑧.

CS 245 Logic and Computation Fall 2019 13 / 36

slide-14
SLIDE 14

Another example of a valuation

Valuation 𝑤′:

▶ Domain: 𝐸 = {𝐵𝑚𝑗𝑑𝑓, 𝐶𝑝𝑐, 𝐷𝑏𝑢𝑓}. ▶ Individuals: 𝑏𝑤 = 𝐵𝑚𝑗𝑑𝑓, 𝑐𝑤 = 𝐶𝑝𝑐, 𝑑𝑤 = 𝐷𝑏𝑢𝑓. ▶ Free variables: 𝑣𝑤 = 𝐶𝑝𝑐, 𝑤𝑤 = 𝐵𝑚𝑗𝑑𝑓, 𝑥𝑤 = 𝐵𝑚𝑗𝑑𝑓. ▶ Functions:

𝑔𝑤: 𝑔𝑤(𝐵𝑚𝑗𝑑𝑓) = 𝐵𝑚𝑗𝑑𝑓, 𝑔𝑤(𝐶𝑝𝑐) = 𝐷𝑏𝑢𝑓, 𝑔𝑤(𝐷𝑏𝑢𝑓) = 𝐶𝑝𝑐. 𝑕𝑤: 𝑕𝑤(𝑦, 𝑧) = the person with the longer name. return 𝑦 if there is a tie.

▶ Relations:

𝐺 𝑤: 𝐺 𝑤(𝑦) is true ifg the person likes chocolates. (Alice and Cate like chocolates whereas Bob dislikes chocolates.) 𝐻𝑤: 𝐻𝑤(𝑦, 𝑧) is true ifg 𝑦 is older than or has the same age as 𝑧. (Alice is older than Cate, who is older than Bob.)

CS 245 Logic and Computation Fall 2019 14 / 36

slide-15
SLIDE 15

Notation for functions and relations

Consider the domain 𝐸 = {1, 2, 3}. Functions:

▶ 𝑔𝑤 is the identify function. 𝑔𝑤(𝑦) = 𝑦. ▶ 𝑔𝑤(1) = 1, 𝑔𝑤(2) = 2 and 𝑔𝑤(3) = 3.

Relations:

▶ 𝐻𝑤: 𝐻𝑤(𝑦, 𝑧) is true if and only if 𝑦 > 𝑧. ▶ 𝐻𝑤 = {⟨2, 1⟩, ⟨3, 1⟩, ⟨3, 2⟩}

CS 245 Logic and Computation Fall 2019 15 / 36

slide-16
SLIDE 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 / 36

slide-17
SLIDE 17

Evaluating terms and formulas w/o variables

Evaluate these terms and formulas under the valuation 𝑤. 𝑔(𝑔(𝑏)), (𝐺(𝑏) ∨ 𝐻(𝑏, 𝑐)). Valuation 𝑤:

▶ Domain: 𝐸 = {1, 2, 3}. ▶ Individuals: 𝑏𝑤 = 1, 𝑐𝑤 = 2, 𝑑𝑤 = 3. ▶ Free variables: 𝑣𝑤 = 3, 𝑤𝑤 = 2, 𝑥𝑤 = 1. ▶ Functions:

𝑔𝑤: 𝑔𝑤(1) = 2, 𝑔𝑤(2) = 3, 𝑔𝑤(3) = 1. 𝑕𝑤: 𝑕𝑤(𝑦, 𝑧) = ((𝑦 + 𝑧) mod 3) + 1.

▶ Relations:

𝐺 𝑤: 𝐺 𝑤(𝑦) is true if and only if 𝑦 > 5. 𝐻𝑤: 𝐻𝑤(𝑦, 𝑧) is true if and only if 𝑦 > 𝑧. 𝑔(𝑔(𝑏))𝑤 = ?, 𝑏𝑤 = 1, 𝑔𝑤(𝑏𝑤) = 2, 𝑔𝑤(𝑔𝑤(𝑏𝑤)) = 3 (𝐺(𝑏) ∨ 𝐻(𝑏, 𝑐))𝑤 = ?, 𝐺(𝑏)𝑤 = 0, 𝐻(𝑏, 𝑐)𝑤 = 0, (𝐺(𝑏) ∨ 𝐻(𝑏, 𝑐))𝑤 = 0

CS 245 Logic and Computation Fall 2019 17 / 36

slide-18
SLIDE 18

Give a valuation that makes the formula true/false

Complete the valuation 𝑤 such that (A) 𝐻(𝑏, 𝑔(𝑔(𝑏)))𝑤 = 1 (B) 𝐻(𝑏, 𝑔(𝑔(𝑏)))𝑤 = 0 Valuation 𝑤:

▶ Domain: 𝐸 = {1, 2, 3}. ▶ Individuals: 𝑏𝑤 = ?, 𝑐𝑤 = ?, 𝑑𝑤 = ?. ▶ Functions: 𝑔𝑤 ∶ ?, 𝑕𝑤 ∶ ? ▶ Relations: 𝑄 𝑤 ∶ ?, 𝐻𝑤 ∶ ?

𝑏𝑤 = 1 𝑔𝑤 is the identity function. To make the formula true, make sure ⟨1, 1⟩ ∈ 𝐻. To make the formula false, make sure ⟨1, 1⟩ ∉ 𝐻. If 𝐻𝑤 = ∅, the formula is false. If 𝐻𝑤 contains all possible tuples, the formula is true.

CS 245 Logic and Computation Fall 2019 18 / 36

slide-19
SLIDE 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 / 36

slide-20
SLIDE 20

A valuation for interpreting free variables

Valuation 𝑤:

▶ Domain: 𝐸 = {1, 2, 3}. ▶ Individuals: 𝑏𝑤 = 1, 𝑐𝑤 = 2, 𝑑𝑤 = 3. ▶ Free variables: 𝑣𝑤 = 3, 𝑤𝑤 = 2, 𝑥𝑤 = 1. ▶ Functions:

𝑔𝑤: 𝑔𝑤(1) = 2, 𝑔𝑤(2) = 3, 𝑔𝑤(3) = 1. 𝑕𝑤: 𝑕𝑤(𝑦, 𝑧) = ((𝑦 + 𝑧) mod 3) + 1.

▶ Relations:

𝐺 𝑤: 𝐺 𝑤(𝑦) is true if and only if 𝑦 > 5. 𝐻𝑤: 𝐻𝑤(𝑦, 𝑧) is true if and only if 𝑦 > 𝑧.

CS 245 Logic and Computation Fall 2019 20 / 36

slide-21
SLIDE 21

Evaluating terms & formulas w/o bound variables

Evaluate these terms and formulas under the valuation 𝑤. 𝑕(𝑣, 𝑔(𝑐)), 𝐻(𝑏, 𝑔(𝑔(𝑣))). Valuation 𝑤:

▶ Domain: 𝐸 = {1, 2, 3}. ▶ Individuals: 𝑏𝑤 = 1, 𝑐𝑤 = 2, 𝑑𝑤 = 3. ▶ Free variables: 𝑣𝑤 = 3, 𝑤𝑤 = 2, 𝑥𝑤 = 1. ▶ Functions:

𝑔𝑤: 𝑔𝑤(1) = 2, 𝑔𝑤(2) = 3, 𝑔𝑤(3) = 1. 𝑕𝑤: 𝑕𝑤(𝑦, 𝑧) = ((𝑦 + 𝑧) mod 3) + 1.

▶ Relations:

𝐺 𝑤: 𝐺 𝑤(𝑦) is true if and only if 𝑦 > 5. 𝐻𝑤: 𝐻𝑤(𝑦, 𝑧) is true if and only if 𝑦 > 𝑧. 𝑕(𝑣, 𝑔(𝑐))𝑤 = 1. 𝐻(𝑏, 𝑔(𝑔(𝑣)))𝑤 = 0.

CS 245 Logic and Computation Fall 2019 21 / 36

slide-22
SLIDE 22

Give a valuation that makes the formula true/false

Complete a valuation such that (A) 𝐻(𝑏, 𝑔(𝑔(𝑣)))𝑤 = 1 (B) 𝐻(𝑏, 𝑔(𝑔(𝑣)))𝑤 = 0 Valuation 𝑤:

▶ Domain: 𝐸 = {1, 2, 3}. ▶ Individuals: 𝑏𝑤 = ?, 𝑐𝑤 = ?, 𝑑𝑤 = ?. ▶ Free variables: 𝑣𝑤 = ?, 𝑣𝑤 = ? 𝑣𝑤 = ?. ▶ Functions: 𝑔𝑤 ∶ ?, 𝑕𝑤 ∶ ? ▶ Relations: 𝑄 𝑤 ∶ ?, 𝐻𝑤 ∶ ?

𝑣𝑤 = 1. 𝑔𝑤 is the identity function. 𝑏𝑤 = 1. To make 𝐻 true, let ⟨1, 1⟩ ∈ 𝐻𝑤. To make 𝐻 true, let ⟨1, 1⟩ ∉ 𝐻𝑤.

CS 245 Logic and Computation Fall 2019 22 / 36

slide-23
SLIDE 23

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 23 / 36

slide-24
SLIDE 24

Evaluate quantifjed formulas under a valuation

Evaluate these formulas under the valuation 𝑤. (A) (∀𝑦 (∃𝑧 𝐻(𝑦, 𝑧))) (B) (∃𝑦 (∀𝑧 𝐻(𝑦, 𝑧))) Valuation 𝑤:

▶ Domain: 𝐸 = {1, 2, 3}. ▶ Relations: 𝐻𝑤 = {⟨1, 2⟩, ⟨3, 1⟩, ⟨2, 3⟩}.

CS 245 Logic and Computation Fall 2019 24 / 36

slide-25
SLIDE 25

(A) (∀𝑦 (∃𝑧 𝐻(𝑦, 𝑧))) (B) (∃𝑦 (∀𝑧 𝐻(𝑦, 𝑧))) ⟨𝑣𝑤(𝑣/1)(𝑥/2), 𝑥𝑤(𝑣/1)(𝑥/2)⟩ = ⟨1, 2⟩ ∈ 𝐻𝑤, ⟨𝑣𝑤(𝑣/3)(𝑥/1), 𝑥𝑤(𝑣/3)(𝑥/1)⟩ = ⟨3, 1⟩ ∈ 𝐻𝑤, ⟨𝑣𝑤(𝑣/2)(𝑥/3), 𝑥𝑤(𝑣/2)(𝑥/3)⟩ = ⟨2, 3⟩ ∈ 𝐻𝑤, Therefore, (∀𝑦 (∃𝑧 𝐻(𝑦, 𝑧)))𝑤 = 1. ⟨𝑣𝑤(𝑣/1)(𝑥/1), 𝑥𝑤(𝑣/1)(𝑥/1)⟩ = ⟨1, 1⟩ ∉ 𝐻𝑤, ⟨𝑣𝑤(𝑣/3)(𝑥/2), 𝑥𝑤(𝑣/3)(𝑥/2)⟩ = ⟨3, 2⟩ ∉ 𝐻𝑤, ⟨𝑣𝑤(𝑣/2)(𝑥/1), 𝑥𝑤(𝑣/2)(𝑥/1)⟩ = ⟨2, 1⟩ ∉ 𝐻𝑤, Therefore, (∃𝑦 (∀𝑧 𝐻(𝑦, 𝑧)))𝑤 = 0.

CS 245 Logic and Computation Fall 2019 25 / 36

slide-26
SLIDE 26

Give a valuation that makes the formula true/false

Complete the valuation 𝑤 to make the following formula true/false. (When satisfying the formula, try making 𝐻𝑤 as small as possible.) (A) (∀𝑧 (∃𝑦 𝐻(𝑦, 𝑧))) (B) (∃𝑧 (∀𝑦 𝐻(𝑦, 𝑧))) Valuation 𝑤:

▶ Domain: 𝐸 = {1, 2, 3}. ▶ ...

(A) 𝐻𝑤 = {⟨1, 1⟩, ⟨1, 2⟩, ⟨1, 3⟩} makes the formula true. (B) 𝐻𝑤 = {⟨1, 1⟩, ⟨2, 1⟩, ⟨3, 1⟩} makes the formula true.

CS 245 Logic and Computation Fall 2019 26 / 36

slide-27
SLIDE 27

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 27 / 36

slide-28
SLIDE 28

Difgerence between Individual and Free Variable Symbols

Let our domain be the set of people. Let the predicate 𝑀(𝑣) be true if 𝑣 likes chocolates. Let 𝑏 be an individual symbol referring to Alice.

▶ 𝑀(𝑏)

This formula only contains individual symbols. Since 𝑏 refers to Alice, the truth value of this formula is already determined (It’s true because Alice likes chocolates =).

▶ 𝑀(𝑣)

This formula only contains free variable symbols. We do not know the truth value of this formula because 𝑣 can refer to any person in the domain. We need to assign 𝑣 to a particular person because we can determine whether this formula is true or false.

CS 245 Logic and Computation Fall 2019 28 / 36

slide-29
SLIDE 29

Difgerence between Free and Bound Variables

Let our domain be the set of integers.

▶ 𝑣 + 𝑣 = 𝑤

The variables are free. We do not know the truth value of this formula until we assign the free variables to elements of the domain.

▶ ∀𝑦 ∀𝑧 (𝑦 + 𝑦 = 𝑧)

The variables are bound. We know the truth value of this formula because the meanings of the variables are given by the quantifjers.

CS 245 Logic and Computation Fall 2019 29 / 36

slide-30
SLIDE 30

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 30 / 36

slide-31
SLIDE 31

Satisfjable and Valid

A formula 𝐵 is satisfjable: there exists a valuation 𝑤, 𝐵𝑤 = 1. A formula 𝐵 is valid: for every valuation 𝑤, 𝐵𝑤 = 1. Most predicate formulas are satisfjable but not valid because we have a great deal of freedom to choose the valuation.

CS 245 Logic and Computation Fall 2019 31 / 36

slide-32
SLIDE 32

Proving that a formula is satisfjable or not

Is the following formula satisfjable? If it’s satisfjable, give a valuation that satisfjes it. If it’s not satisfjable, give a proof. (∃𝑦 𝐺(𝑦)) → (∀𝑦 𝐺(𝑦)) Answer: This formula is satisfjable. Proof: Consider the valuation: 𝐸 = {1, 2}, and 𝐺 𝑤 = ∅. Since 𝐺 𝑤 = ∅, 𝐺(𝑣)𝑤(𝑣/𝛽) = 0 for every 𝛽 ∈ 𝐸. Thus, (∃𝑦 𝐺(𝑦))𝑤 = 0 and ((∃𝑦 𝐺(𝑦)) → (∀𝑦 𝐺(𝑦)))𝑤 = 1. Here is another valuation that works: 𝐸 = {1, 2} and 𝐺 𝑤 = {1, 2}.

CS 245 Logic and Computation Fall 2019 32 / 36

slide-33
SLIDE 33

Proving that a formula is valid/not valid

Is the following formula valid? If it’s valid, give a proof. If it’s not valid, give a counterexample. (∀𝑦 𝐺(𝑦)) → (∃𝑦 𝐺(𝑦))

▶ Determine whether the formula is valid or not. ▶ How do I prove that a formula is NOT valid?

Find a valuation under which the formula is false. In this case, fjnd a valuation under which ∀𝑦 𝐺(𝑦) is true and ∃𝑦 𝐺(𝑦) is false.

▶ How do I prove that a formula is valid?

Consider any valuation. Prove that the formula must be true. In this case, consider any valuation 𝑤 under which ∀𝑦 𝐺(𝑦) is

  • true. Show that ∃𝑦 𝐺(𝑦) is also true under 𝑤.

CS 245 Logic and Computation Fall 2019 33 / 36

slide-34
SLIDE 34

Proving that a formula is valid or not

Is the following formula valid? If it’s valid, give a proof. If it’s not valid, give a counterexample. (∀𝑦 𝐺(𝑦)) → (∃𝑦 𝐺(𝑦)) Answer: This formula is valid. Proof: We prove this by contradiction. Assume that there is a valuation 𝑤 such that (∀𝑦𝐺(𝑦))𝑤 = 1 and (∃𝑦𝐺(𝑦))𝑤 = 0. Form 𝐺(𝑣) from 𝐺(𝑦), 𝑣 not occurring in 𝐺(𝑦). Since (∀𝑦𝐺(𝑦))𝑤 = 1, then for every 𝛽 ∈ 𝐸, 𝐺(𝑣)𝑤(𝑣/𝛽) = 1. (1) Since (∃𝑦𝐺(𝑦))𝑤 = 0, then there exists 𝛽 ∈ 𝐸, 𝐺(𝑣)𝑤(𝑣/𝛽) = 0, which contradicts (1). QED

CS 245 Logic and Computation Fall 2019 34 / 36

slide-35
SLIDE 35

Proving that a formula is valid or not

Is the following formula valid? If it’s valid, give a proof. If it’s not valid, give a counterexample. (∃𝑦 𝐺(𝑦)) → (∀𝑦 𝐺(𝑦)) Answer: This formula is not valid. Proof: Consider the valuation below.

▶ 𝐸 = {1, 2} ▶ 𝐺 𝑤 = {1}

Since 1 ∈ 𝐺 𝑤, 𝐺(𝑣)𝑤(𝑣/1) = 1. Thus, (∃𝑦 𝐺(𝑦))𝑤 = 1. Since 2 ∉ 𝐺 𝑤, 𝐺(𝑣)𝑤(𝑣/2) = 0. Thus. (∀𝑦 𝐺(𝑦))𝑤 = 0.

CS 245 Logic and Computation Fall 2019 35 / 36

slide-36
SLIDE 36

Revisiting the learning goals

By the end of this lecture, you should be able to:

▶ 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

valid.

CS 245 Logic and Computation Fall 2019 36 / 36