0% found this document useful (0 votes)
39 views35 pages

Lec13 Pred Semantics Nosol

The document discusses predicate logic semantics and how to evaluate terms and formulas given a valuation. It defines what a valuation is and how to determine the value of terms and truth value of formulas under a valuation. It also discusses how to determine if a formula is satisfiable or valid.

Uploaded by

Karus Insania
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views35 pages

Lec13 Pred Semantics Nosol

The document discusses predicate logic semantics and how to evaluate terms and formulas given a valuation. It defines what a valuation is and how to determine the value of terms and truth value of formulas under a valuation. It also discusses how to determine if a formula is satisfiable or valid.

Uploaded by

Karus Insania
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

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 Quantified Formulas

A few clarifications

Satisfiable and Valid

Revisiting the Learning Goals

CS 245 Logic and Computation Fall 2019 2 / 35


Learning goals

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


▶ Define 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 satisfiable and/or
valid.

CS 245 Logic and Computation Fall 2019 3 / 35


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
▶ Quantifiers: for how many objects in the domain is the
statement true?

CS 245 Logic and Computation Fall 2019 4 / 35


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 / 35


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 / 35


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 / 35


CQ Which function is total?

Which of the following functions is total?

(A) 𝑔(𝑥, 𝑦) = 𝑥 − 𝑦. 𝐷 = ℕ (natural numbers).



(B) 𝑓(𝑥) = 𝑥. 𝐷 = ℤ (integers).
(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


Value of Terms

Definition (Value of Terms)


The value of terms of 𝐿 under valuation 𝑣 over domain 𝐷 is
defined by recursion:
1. 𝑎𝑣 ∈ 𝐷.
2. 𝑢𝑣 ∈ 𝐷.
3. 𝑓(𝑡1 , … , 𝑡𝑛 )𝑣 = 𝑓 𝑣 (𝑡𝑣 𝑣
1 , … , 𝑡𝑛 ).

CS 245 Logic and Computation Fall 2019 9 / 35


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 /2)
1. 𝑢1 =?
𝑣(𝑢 /2)
2. 𝑢2 1 = ?
𝑣(𝑢 /2)(𝑢2 /1)
3. 𝑢1 1 =?
𝑣(𝑢 /2)(𝑢2 /1)
4. 𝑢2 1 =?
𝑣(𝑢 /2)(𝑢2 /1)
5. 𝑢3 1 =?

CS 245 Logic and Computation Fall 2019 10 / 35


True Value of Formulas

Definition (Truth Value of Formulas)


The truth value of formulas of 𝐿 under valuation 𝑣 over domain 𝐷
is defined by recursion:
1. 𝐹 (𝑡1 , … , 𝑡𝑛 )𝑣 = 1 iff ⟨𝑡𝑣 𝑣 𝑣
1 , … , 𝑡𝑛 ⟩ ∈ 𝐹 .
2. (¬𝐴)𝑣 = 1 iff 𝐴𝑣 = 0.
3. (𝐴 ∧ 𝐵)𝑣 = 1 iff 𝐴𝑣 = 1 and 𝐵𝑣 = 1.
4. (𝐴 ∨ 𝐵)𝑣 = 1 iff 𝐴𝑣 = 1 or 𝐵𝑣 = 1.
5. (𝐴 → 𝐵)𝑣 = 1 iff 𝐴𝑣 = 0 or 𝐵𝑣 = 1.
6. (𝐴 ↔ 𝐵)𝑣 = 1 iff 𝐴𝑣 = 𝐵𝑣 .
7. (∀𝑥 𝐴(𝑥))𝑣 = 1 iff for every 𝛼 ∈ 𝐷, 𝐴(𝑢)𝑣(𝑢/𝛼) = 1,
where 𝑢 does not occur in 𝐴(𝑥).
8. (∃𝑥 𝐴(𝑥))𝑣 = 1 iff there exists 𝛼 ∈ 𝐷, 𝐴(𝑢)𝑣(𝑢/𝛼) = 1,
where 𝑢 does not occur in 𝐴(𝑥).

CS 245 Logic and Computation Fall 2019 11 / 35


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


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 / 35


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 iff the person likes chocolates. (Alice and
Cate like chocolates whereas Bob dislikes chocolates.)
𝐺𝑣 : 𝐺𝑣 (𝑥, 𝑦) is true iff 𝑥 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 / 35


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 / 35


Outline

The Learning Goals

Evaluating Terms and Formulas w/o Variables

Evaluating Terms and Formulas w/o Bound Variables

Evaluating Quantified Formulas

A few clarifications

Satisfiable and Valid

Revisiting the Learning Goals

CS 245 Logic and Computation Fall 2019 16 / 35


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 𝑥 > 𝑦.

CS 245 Logic and Computation Fall 2019 17 / 35


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: 𝑃 𝑣 ∶ ?, 𝐺𝑣 ∶ ?

CS 245 Logic and Computation Fall 2019 18 / 35


Outline

The Learning Goals

Evaluating Terms and Formulas w/o Variables

Evaluating Terms and Formulas w/o Bound Variables

Evaluating Quantified Formulas

A few clarifications

Satisfiable and Valid

Revisiting the Learning Goals

CS 245 Logic and Computation Fall 2019 19 / 35


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 / 35


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 𝑥 > 𝑦.

CS 245 Logic and Computation Fall 2019 21 / 35


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: 𝑃 𝑣 ∶ ?, 𝐺𝑣 ∶ ?

CS 245 Logic and Computation Fall 2019 22 / 35


Outline

The Learning Goals

Evaluating Terms and Formulas w/o Variables

Evaluating Terms and Formulas w/o Bound Variables

Evaluating Quantified Formulas

A few clarifications

Satisfiable and Valid

Revisiting the Learning Goals

CS 245 Logic and Computation Fall 2019 23 / 35


Evaluate quantified 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 / 35


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}.
▶ ...

CS 245 Logic and Computation Fall 2019 25 / 35


Outline

The Learning Goals

Evaluating Terms and Formulas w/o Variables

Evaluating Terms and Formulas w/o Bound Variables

Evaluating Quantified Formulas

A few clarifications

Satisfiable and Valid

Revisiting the Learning Goals

CS 245 Logic and Computation Fall 2019 26 / 35


Difference 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 27 / 35


Difference 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 quantifiers.

CS 245 Logic and Computation Fall 2019 28 / 35


Outline

The Learning Goals

Evaluating Terms and Formulas w/o Variables

Evaluating Terms and Formulas w/o Bound Variables

Evaluating Quantified Formulas

A few clarifications

Satisfiable and Valid

Revisiting the Learning Goals

CS 245 Logic and Computation Fall 2019 29 / 35


Satisfiable and Valid

A formula 𝐴 is satisfiable:

there exists a valuation 𝑣, 𝐴𝑣 = 1.

A formula 𝐴 is valid:

for every valuation 𝑣, 𝐴𝑣 = 1.

Most predicate formulas are satisfiable but not valid


because we have a great deal of freedom to choose the valuation.

CS 245 Logic and Computation Fall 2019 30 / 35


Proving that a formula is satisfiable or not

Is the following formula satisfiable? If it’s satisfiable, give a


valuation that satisfies it. If it’s not satisfiable, give a proof.

(∃𝑥 𝐹 (𝑥)) → (∀𝑥 𝐹 (𝑥))

CS 245 Logic and Computation Fall 2019 31 / 35


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?

▶ How do I prove that a formula is valid?

CS 245 Logic and Computation Fall 2019 32 / 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.

(∀𝑥 𝐹 (𝑥)) → (∃𝑥 𝐹 (𝑥))

CS 245 Logic and Computation Fall 2019 33 / 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.

(∃𝑥 𝐹 (𝑥)) → (∀𝑥 𝐹 (𝑥))

CS 245 Logic and Computation Fall 2019 34 / 35


Revisiting the learning goals

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


▶ Define 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 satisfiable and/or
valid.

CS 245 Logic and Computation Fall 2019 35 / 35

You might also like