0% found this document useful (0 votes)
10 views

Lecture 4 (Predicates and Quantifiers)

The document discusses predicates and quantifiers in logic, explaining the difference between propositions (which are definitively true or false) and predicates (which can vary based on variables). It covers how to convert predicates into propositions through assignment and quantification, as well as the use of universal, existential, and uniqueness quantifiers. Additionally, it addresses the importance of variable domains, negating quantifiers, and nested quantifiers in logical statements.

Uploaded by

simoncheng
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Lecture 4 (Predicates and Quantifiers)

The document discusses predicates and quantifiers in logic, explaining the difference between propositions (which are definitively true or false) and predicates (which can vary based on variables). It covers how to convert predicates into propositions through assignment and quantification, as well as the use of universal, existential, and uniqueness quantifiers. Additionally, it addresses the importance of variable domains, negating quantifiers, and nested quantifiers in logical statements.

Uploaded by

simoncheng
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 36

Predicates and

Quantifiers

CS131 Fall 24
Preethi Narayanan
Propositions are true or false
• We are in Boston
• 3 > 17
• 11 and 29 are both prime
Predicates could be true or could be false
• Under what circumstances could a logical statement be either
true or false?
• If it contains a variable
• A predicate aka propositional function is a logical statement
whose truth value is a function of one or more variables
• In other words, a function with a True or False output
Predicates
• We are in c
• c = Boston
• c = Albuquerque, New Mexico
• x > 17
• x=3
• x = 20
• p1 and p2 are both prime
• p1 = 11, p2 = 29
• p1 = 5, p2 = 6
How to write it
• Let P(x) be a propositional function (aka predicate) dependent
on the variable x.
• We can also have predicates dependent on multiple variables
• Ex: Q(y, z)
• We need to define our variable domain:
• x is a city
• x is an animal
• x is an integer (x ℤ)
• If S is a set, x S means that x is a member of the set S
Turning predicates into propositions
P(x) is a predicate. How do we make it a proposition?
1. Assignment: P(7) is true or false
• (as long as 7 is within our variable domain)
Quantified statements
• “All students in this room like cats”
• “There is a student in this room that likes cats”
• “There is exactly one student in this room that likes cats”
Universal Quantification ()

Read as “for all”

• For all integers x, x2 >0


Existential Quantification ()

Read as “there exists”

• There exists an integer x such that x is greater than 5


Uniqueness Quantifier ()
• How do we say:
“There is exactly one integer x such that x2 + 3 = 7?”
• We actually don’t have the machinery to express that yet
• We will use the ! symbol to denote uniqueness
• ! is pronounced “bang”
• Is true?
• is true
Quantifiers and logical operations
• For all () is a giant “and”
• True if they’re all true

• There exists () is a giant “or”


• True if at least one of them is true
Precedence
• Quantifiers “bind more tightly” than logical operators
• should be read

• correct

• incorrect
Turning predicates into propositions
P(x) is a predicate. How do we make it a proposition?
1. Assignment: P(7) is true or false
• (as long as 7 is within our variable domain)
2. Quantification:
• is true or false
• is true or false
• is true or false
Question:
Which of the following are universally quantified (multiple correct
answers)

A) ∀x in N: (x + 1) in N
B) Everyone on the Celtics is over 6' tall
C) I had a sandwich for lunch
D) ∃x in N: x / 5 in Q
E) It's raining somewhere
Question:
Which of the following are existentially quantified (multiple correct
answers)

A) There exists a purple cow


B) At least one original ipad still works
C) All Athenians are mortal
D) ∃r in R: r in Q
Problem
P(x) is a predicate. How do we make it a proposition?
1. Assignment: P(7) is true or false
• (as long as 7 is within our variable domain)
2. Quantification:
• is true or false
• is true or false
• is true or false
What about ?
Free vs Bound Variables

Proposition

Predicate
Free vs Bound Variables

Bound

Bound Free
Turning predicates into propositions
P(x) is a predicate. How do we make it a proposition?
1. Assignment: P(7) is true or false
• (as long as 7 is within our variable domain)
2. Quantify the predicate such that there are no free variables
Alternatively, quantify the predicate such that all variables are bound
• is true or false
• is true or false
• is true or false
• is true or false
Variable Domains
• A variable can only take values from a specified set
• That set is called the variable’s domain
• e.g. the domain of Propositional variables is {T, F}
• Domains matter!
• x – 1 0 is true for all x + but not for all x
Restricting Variable Domains
• How do I restrict a predicates domain?

• Example:
• y the set of all dogs, but y is not a golden retriever
• x , but x > 0

• It depends on the quantifier you’re working with


Use for the Universal Quantifier ()
• x – 1 0 is true for all x > 0, x
• For all x if x > 0, then x – 1 0

• Why not “For all x x > 0 and x – 1 0”?


• is false
• Not all x are greater than 0!
• Using allows us to ignore the cases that we don’t care about
Use ∧ for the Existential Quantifier (∃)
There is an integer x greater than 0 such that x 2 + 3 = 7.

(x > 0) ∧ (x2 + 3 = 7)

• Why not
“There exists an integer x such that if x > 0, then x 2 + 3 = 7 ”?
• (x > 0) (x2 + 3 = 7) is true (in the wrong cases)
• F F is true
Example
x ∈ BU students
E(x): x is enrolled in the class
T(x): x took the test
1. Someone who is enrolled in the class took the test.

2. All students enrolled in the class took the test.


Question:
x ∈ BU students
E(x): x is enrolled in the class
T(x): x took the test

How would we write "Everyone who took the test is enrolled in the
class." ?

A) ∀x ∈ BU students: (T(x) ⋀ E(x))


B) ∀x ∈ BU students: (T(x) → E(x))
C) ∃x ∈ BU students: (T(x) ⋀ E(x))
D) ∃x ∈ BU students: (T(x) → E(x))
Question:
x ∈ BU students
E(x): x is enrolled in the class
T(x): x took the test

How would we write "At least one student who is enrolled in the class
did not take the test." ?

A) ∀x ∈ BU students: (E(x) ∧ ¬T(x))


B) ∃x ∈ BU students: (E(x) ∧ T(x))
C) ∃x ∈ BU students: (E(x) ∧ ¬T(x))
D) ∃x ∈ BU students: (E(x) →¬T(x))
Negating Quantifiers
• What does it mean for something to not always be true?
• There exists one instance where it’s false
• What does it mean for there not to be an instance where
something is true?
• That it’s always false
Quantifiers and logical operations
• For all is a giant “and”
• True if they’re all true

• There exists is a giant “or”


• True if at least one of them is true

• So what does it mean to negate them?


De Morgan’s Laws for quantified statements
Example
x ∈ patients
P(x): x was given the placebo
D(x): x was given the medication
M(x): x had migraines
Negate: every patient was given the medication or the placebo or
both.
Question:
x ∈ patients
P(x): x was given the placebo
D(x): x was given the medication
M(x): x had migraines

Negate: “There is a patient who took the medication and had migraines.”

A) Every patient was not given the medication.


B) There was a patient who was not given the medication and had migraines.
C) Every patient did not get the medication or did not have migraines or both.
Nested Quantifiers
“There is a seat for every student.”

S(x, y): “x is y’s seat”

How would we write this?


Nested Quantifiers
The order of your quantifiers matter!

∀x ∈ ℤ, ∃y ∈ ℤ : x > y

∃y ∈ ℤ, ∀x ∈ ℤ : x > y
Nested Quantifiers
Ex: F(x, y): x is friends with y

• ∀x ∈ people ∀y ∈ people: F(x, y)

• ∀x ∈ people ∃y ∈ people: F(x, y)

• ∃x ∈ people ∀y ∈ people: F(x, y)

• ∃x ∈ people ∃y ∈ people: F(x, y)


Question:
Which is true when x and y are integers?

A) ∀x ∈ ℤ, ∃y ∈ ℤ : x + y = 0
B) ∃y ∈ ℤ, ∀x ∈ ℤ : x + y = 0
C) Both are true
Question:
Express “every integer has a prime factor” using quantifiers and
the predicate P(x, y): “y is a prime factor of x”.

A) ∀x ∈ ℤ, ∃y ∈ ℤ: P(x, y)
B) ∃x ∈ ℤ, ∀y ∈ ℤ: P(x, y)
C) Both work

You might also like