Top Banner
Mathematical Logic Part Two
190

Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Mar 13, 2018

Download

Documents

hoangnguyet
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Mathematical LogicPart Two

Page 2: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Recap from Last Time

Page 3: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Recap So Far

● A propositional variable is a variable that is either true or false.

● The propositional connectives are as follows:● Negation: ¬p● Conjunction: p ∧ q● Disjunction: p ∨ q● Implication: p → q● Biconditional: p ↔ q● True: ⊤● False: ⊥

Page 4: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Take out a sheet of paper!

Page 5: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

What's the truth table for the → connective?

Page 6: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

What's the negation of p → q?

Page 7: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

New Stuff!

Page 8: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

First-Order Logic

Page 9: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

What is First-Order Logic?

● First-order logic is a logical system for reasoning about properties of objects.

● Augments the logical connectives from propositional logic with● predicates that describe properties of

objects,● functions that map objects to one another,

and● quantifiers that allow us to reason about

multiple objects.

Page 10: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Some Examples

Page 11: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Likes(You, ComicBooks) ∨ Likes(You, GoodMovies) ∨ Likes(You, AwesomeWomenInTech) →

Likes(You, BlackPanther)

Learns(You, History) ∨ ForeverRepeats(You, History)

DrinksTooMuch(Me) ∧ IsAnIssue(That) ∧ IsOkay(Me)

Page 12: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Likes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka)

Learns(You, History) ∨ ForeverRepeats(You, History)

In(MyHeart, Havana) ∧ TookBackTo(Him, Me, EastAtlanta)

Page 13: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Likes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka)

Learns(You, History) ∨ ForeverRepeats(You, History)

In(MyHeart, Havana) ∧ TookBackTo(Him, Me, EastAtlanta)

Page 14: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Likes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka)

Learns(You, History) ∨ ForeverRepeats(You, History)

In(MyHeart, Havana) ∧ TookBackTo(Him, Me, EastAtlanta)

These blue terms are called constant symbols. Unlike

propositional variables, they refer to objects, not propositions.

These blue terms are called constant symbols. Unlike

propositional variables, they refer to objects, not propositions.

Page 15: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Likes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka)

Learns(You, History) ∨ ForeverRepeats(You, History)

In(MyHeart, Havana) ∧ TookBackTo(Him, Me, EastAtlanta)

Page 16: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Likes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka)

Learns(You, History) ∨ ForeverRepeats(You, History)

In(MyHeart, Havana) ∧ TookBackTo(Him, Me, EastAtlanta)

The red things that look like function calls are called

predicates. Predicates take objects as arguments and evaluate to true or false.

The red things that look like function calls are called

predicates. Predicates take objects as arguments and evaluate to true or false.

Page 17: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Likes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka)

Learns(You, History) ∨ ForeverRepeats(You, History)

In(MyHeart, Havana) ∧ TookBackTo(Him, Me, EastAtlanta)

Page 18: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Likes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka)

Learns(You, History) ∨ ForeverRepeats(You, History)

In(MyHeart, Havana) ∧ TookBackTo(Him, Me, EastAtlanta)

What remains are traditional propositional connectives. Because each predicate

evaluates to true or false, we can connect the truth values of predicates using normal

propositional connectives.

What remains are traditional propositional connectives. Because each predicate

evaluates to true or false, we can connect the truth values of predicates using normal

propositional connectives.

Page 19: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Reasoning about Objects

● To reason about objects, first-order logic uses predicates.● Examples:

Cute(Quokka)

Likes(DrLee, CS103)

Likes(DrLee, Quokka)

¬Cute(Mosquito)

¬Likes(DrLee, Mosquito)● Applying a predicate to arguments produces a proposition,

which is either true or false.● Typically, when you’re working in FOL, you’ll have a list of

predicates, what they stand for, and how many arguments they take. It’ll be given separately than the formulas you write.

Page 20: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

First-Order Sentences

● Sentences in first-order logic can be constructed from predicates applied to objects:

Cute(a) → Dikdik(a) ∨ Kitty(a) ∨ Puppy(a)

Succeeds(You) ↔ Practices(You)

x < 8 → x < 137

The less-than sign is just another predicate. Binary predicates are sometimes written in infix notation this

way.

The less-than sign is just another predicate. Binary predicates are sometimes written in infix notation this

way.

Numbers are not “built in” to first-order logic. They’re constant symbols just like

“You” and “a” above.

Numbers are not “built in” to first-order logic. They’re constant symbols just like

“You” and “a” above.

Page 21: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Equality

● First-order logic is equipped with a special predicate = that says whether two objects are equal to one another.

● Equality is a part of first-order logic, just as → and ¬ are.

● Examples:

TomMarvoloRiddle = LordVoldemort

MorningStar = EveningStar● Equality can only be applied to objects; to

state that two propositions are equal, use ↔.

Page 22: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Let's see some more examples.

Page 23: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

FavoriteMovieOf(You) ≠ FavoriteMovieOf(Date) ∧ StarOf(FavoriteMovieOf(You)) = StarOf(FavoriteMovieOf(Date))

Page 24: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

FavoriteMovieOf(You) ≠ FavoriteMovieOf(Date) ∧ StarOf(FavoriteMovieOf(You)) = StarOf(FavoriteMovieOf(Date))

Page 25: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

FavoriteMovieOf(You) ≠ FavoriteMovieOf(Date) ∧ StarOf(FavoriteMovieOf(You)) = StarOf(FavoriteMovieOf(Date))

Page 26: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

FavoriteMovieOf(You) ≠ FavoriteMovieOf(Date) ∧ StarOf(FavoriteMovieOf(You)) = StarOf(FavoriteMovieOf(Date))

Page 27: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

FavoriteMovieOf(You) ≠ FavoriteMovieOf(Date) ∧ StarOf(FavoriteMovieOf(You)) = StarOf(FavoriteMovieOf(Date))

These purple terms are functions. Functions take objects as input and produce objects as

output.

These purple terms are functions. Functions take objects as input and produce objects as

output.

Page 28: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

FavoriteMovieOf(You) ≠ FavoriteMovieOf(Date) ∧ StarOf(FavoriteMovieOf(You)) = StarOf(FavoriteMovieOf(Date))

Page 29: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

FavoriteMovieOf(You) ≠ FavoriteMovieOf(Date) ∧ StarOf(FavoriteMovieOf(You)) = StarOf(FavoriteMovieOf(Date))

Page 30: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

FavoriteMovieOf(You) ≠ FavoriteMovieOf(Date) ∧ StarOf(FavoriteMovieOf(You)) = StarOf(FavoriteMovieOf(Date))

Page 31: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Functions

● First-order logic allows functions that return objects associated with other objects.

● Examples:

ColorOf(Sky)

MedianOf(x, y, z)

x + y● As with predicates, functions can take in any

number of arguments, but always return a single value.

● Functions evaluate to objects, not propositions.

Page 32: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Objects and Predicates

● When working in first-order logic, be careful to keep objects (actual things) and predicates (true or false) separate.

● You cannot apply connectives to objects:

⚠ Venus → TheSun ⚠● You cannot apply functions to

propositions:

⚠ StarOf(IsRed(Sun) ∧ IsGreen(Mars)) ⚠● Ever get confused? Just ask!

Page 33: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Type-Checking Table

… operate on ... … and produce

Connectives(↔, ∧, etc.) …

Predicates(=, etc.) …

Functions …

propositions a proposition

a propositionobjects

objects an object

Page 34: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Type Inference

Answer at PollEv.com/cs103 ortext CS103 to 22333 once to join, then A, B, C, …, or H.

Answer at PollEv.com/cs103 ortext CS103 to 22333 once to join, then A, B, C, …, or H.

Consider the following formula in first-order logic:

R(y) → (S(x, y) = T(x))

Assuming that this formula is syntactically correct,which of R, S, and T are predicates and which are functions?

A. R is a predicate, S is a predicate, and T is a predicate.B. R is a predicate, S is a predicate, and T is a function.C. R is a predicate, S is a function, and T is a predicate.D. R is a predicate, S is a function, and T is a function.E. R is a function, S is a predicate, and T is a predicate.F. R is a function, S is a predicate, and T is a function.G. R is a function, S is a function, and T is a predicate.H. R is a function, S is a function, and T is a function.

Consider the following formula in first-order logic:

R(y) → (S(x, y) = T(x))

Assuming that this formula is syntactically correct,which of R, S, and T are predicates and which are functions?

A. R is a predicate, S is a predicate, and T is a predicate.B. R is a predicate, S is a predicate, and T is a function.C. R is a predicate, S is a function, and T is a predicate.D. R is a predicate, S is a function, and T is a function.E. R is a function, S is a predicate, and T is a predicate.F. R is a function, S is a predicate, and T is a function.G. R is a function, S is a function, and T is a predicate.H. R is a function, S is a function, and T is a function.

Page 35: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

One last (and major) change

Page 36: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Some muggle is intelligent.

Page 37: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Some muggle is intelligent.

∃m. (Muggle(m) ∧ Intelligent(m))

Page 38: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

∃ is the existential quantifier and says “for some choice of m,

the following is true.”

∃ is the existential quantifier and says “for some choice of m,

the following is true.”

Some muggle is intelligent.

∃m. (Muggle(m) ∧ Intelligent(m))

Page 39: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

● A statement of the form

∃x. some-formula

is true if, for some choice of x, the statement some-formula is true when that x is plugged into it.

● Examples:

∃x. (Even(x) ∧ Prime(x))

∃x. (TallerThan(x, me) ∧ LighterThan(x, me))

(∃w. Will(w)) → (∃x. Way(x))

Page 40: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 41: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 42: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 43: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 44: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 45: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 46: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 47: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Since Smiling(x) is true for some choice of x, this

statement evaluates to true.

Since Smiling(x) is true for some choice of x, this

statement evaluates to true.

Page 48: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Since Smiling(x) is true for some choice of x, this

statement evaluates to true.

Since Smiling(x) is true for some choice of x, this

statement evaluates to true.

Page 49: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 50: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 51: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 52: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 53: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 54: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 55: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Page 56: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Since Smiling(x) is not true for any choice of x, this

statement evaluates to false.

Since Smiling(x) is not true for any choice of x, this

statement evaluates to false.

Page 57: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

∃x. Smiling(x)

Since Smiling(x) is not true for any choice of x, this

statement evaluates to false.

Since Smiling(x) is not true for any choice of x, this

statement evaluates to false.

Page 58: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

Answer at PollEv.com/cs103 ortext CS103 to 22333 once to join, then A, B, or C.

Answer at PollEv.com/cs103 ortext CS103 to 22333 once to join, then A, B, or C.

In this world, thisfirst-order logicstatement is…

A. … true.B. … false.C. … neither true nor false.

In this world, thisfirst-order logicstatement is…

A. … true.B. … false.C. … neither true nor false.

(∃x. Smiling(x)) → (∃y. WearingHat(y))

Page 59: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

(∃x. Smiling(x)) → (∃y. WearingHat(y))

Page 60: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

(∃x. Smiling(x)) → (∃y. WearingHat(y))

Is this part of the statement true or

false?

Is this part of the statement true or

false?

Page 61: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

(∃x. Smiling(x)) → (∃y. WearingHat(y))

Is this part of the statement true or

false?

Is this part of the statement true or

false?

Page 62: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

(∃x. Smiling(x)) → (∃y. WearingHat(y))

Is this part of the statement true or

false?

Is this part of the statement true or

false?

Page 63: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

(∃x. Smiling(x)) → (∃y. WearingHat(y))

Is this part of the statement true or

false?

Is this part of the statement true or

false?

Page 64: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

(∃x. Smiling(x)) → (∃y. WearingHat(y))

Is this overall statement true or

false?

Is this overall statement true or

false?

Page 65: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Existential Quantifier

(∃x. Smiling(x)) → (∃y. WearingHat(y))

Is this overall statement true or

false?

Is this overall statement true or

false?

Page 66: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

∃x. Smiling(x)

Fun with Edge Cases

Page 67: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

∃x. Smiling(x)

Fun with Edge Cases

Existentially-quantified statements are false in an empty world, since it’s not possible to

choose an object!

Existentially-quantified statements are false in an empty world, since it’s not possible to

choose an object!

Page 68: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Some Technical Details

Page 69: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Variables and Quantifiers

● Each quantifier has two parts:● the variable that is introduced, and● the statement that's being quantified.

● The variable introduced is scoped just to the statement being quantified.

(∃x. Loves(You, x)) ∧ (∃y. Loves(y, You))

Page 70: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Variables and Quantifiers

● Each quantifier has two parts:● the variable that is introduced, and● the statement that's being quantified.

● The variable introduced is scoped just to the statement being quantified.

(∃x. Loves(You, x)) ∧ (∃y. Loves(y, You))

The variable x just lives here.

The variable x just lives here.

The variable y just lives here.

The variable y just lives here.

Page 71: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Variables and Quantifiers

● Each quantifier has two parts:● the variable that is introduced, and● the statement that's being quantified.

● The variable introduced is scoped just to the statement being quantified.

(∃x. Loves(You, x)) ∧ (∃y. Loves(y, You))

Page 72: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Variables and Quantifiers

● Each quantifier has two parts:● the variable that is introduced, and● the statement that's being quantified.

● The variable introduced is scoped just to the statement being quantified.

(∃x. Loves(You, x)) ∧ (∃x. Loves(x, You))

Page 73: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Variables and Quantifiers

● Each quantifier has two parts:● the variable that is introduced, and● the statement that's being quantified.

● The variable introduced is scoped just to the statement being quantified.

(∃x. Loves(You, x)) ∧ (∃x. Loves(x, You))

The variable x just lives here.

The variable x just lives here.

A different variable, also named x, just lives here.

A different variable, also named x, just lives here.

Page 74: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Operator Precedence (Again)

● When writing out a formula in first-order logic, quantifiers have precedence just below ¬.

● The statement

∃x. P(x) ∧ R(x) ∧ Q(x)

is parsed like this:

(∃x. P(x)) ∧ (R(x) ∧ Q(x))● This is syntactically invalid because the variable x is

out of scope in the back half of the formula.

● To ensure that x is properly quantified, explicitly put parentheses around the region you want to quantify:

∃x. (P(x) ∧ R(x) ∧ Q(x))

Page 75: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

“For any natural number n,n is even iff n2 is even”

Page 76: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

“For any natural number n,n is even iff n2 is even”

∀n. (n ∈ ℕ → (Even(n) ↔ Even(n2)))

Page 77: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

“For any natural number n,n is even iff n2 is even”

∀n. (n ∈ ℕ → (Even(n) ↔ Even(n2)))

∀ is the universal quantifier and says “for any choice of n, the

following is true.”

∀ is the universal quantifier and says “for any choice of n, the

following is true.”

Page 78: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

● A statement of the form

∀x. some-formula

is true if, for every choice of x, the statement some-formula is true when x is plugged into it.

● Examples:

∀p. (Puppy(p) → Cute(p))

∀m. (IsMillennial(m) → IsSpecial(m))

Tallest(SultanKösen) →∀x. (SultanKösen ≠ x → ShorterThan(x, SultanKösen))

Page 79: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Page 80: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Page 81: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Page 82: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Page 83: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Page 84: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Page 85: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Page 86: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Since Smiling(x) is true for every choice of x, this

statement evaluates to true.

Since Smiling(x) is true for every choice of x, this

statement evaluates to true.

Page 87: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Since Smiling(x) is true for every choice of x, this

statement evaluates to true.

Since Smiling(x) is true for every choice of x, this

statement evaluates to true.

Page 88: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Page 89: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Page 90: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Page 91: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Page 92: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Since Smiling(x) is false for this choice

x, this statement evaluates to false.

Since Smiling(x) is false for this choice

x, this statement evaluates to false.

Page 93: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

∀x. Smiling(x)

Since Smiling(x) is false for this choice

x, this statement evaluates to false.

Since Smiling(x) is false for this choice

x, this statement evaluates to false.

Page 94: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

(∀x. Smiling(x)) → (∀y. WearingHat(y))

Page 95: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

(∀x. Smiling(x)) → (∀y. WearingHat(y))

Page 96: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

(∀x. Smiling(x)) → (∀y. WearingHat(y))

Is this part of the statement true or

false?

Is this part of the statement true or

false?

Page 97: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

(∀x. Smiling(x)) → (∀y. WearingHat(y))

Is this part of the statement true or

false?

Is this part of the statement true or

false?

Page 98: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

(∀x. Smiling(x)) → (∀y. WearingHat(y))

Is this part of the statement true or

false?

Is this part of the statement true or

false?

Page 99: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

(∀x. Smiling(x)) → (∀y. WearingHat(y))

Is this part of the statement true or

false?

Is this part of the statement true or

false?

Page 100: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

(∀x. Smiling(x)) → (∀y. WearingHat(y))

Is this overall statement true or

false in this scenario?

Is this overall statement true or

false in this scenario?

Page 101: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

The Universal Quantifier

(∀x. Smiling(x)) → (∀y. WearingHat(y))

Is this overall statement true or

false in this scenario?

Is this overall statement true or

false in this scenario?

Page 102: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

∀x. Smiling(x)

Fun with Edge Cases

Page 103: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

∀x. Smiling(x)

Fun with Edge Cases

Universally-quantified statements are vacuously true

in empty worlds.

Universally-quantified statements are vacuously true

in empty worlds.

Page 104: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Time-Out for Announcements!

Page 105: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Problem Set One

● Problem Set One is due Friday at 2:30PM.● Want to use your late days? You can submit up to

2:30PM on Sunday.● Remember that late days are 24-hour extensions, so

submitting on Sunday would use two late days.● Problem Set Two goes out Friday.

● Checkpoint assignment is due next Monday at 2:30PM.● Remaining problems are due next Friday at 2:30PM.● Play around with propositional and first-order logic and

sharpen your proof-writing skills!

Page 106: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Back to CS103!

Page 107: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Translating into First-Order Logic

Page 108: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Translating Into Logic

● First-order logic is an excellent tool for manipulating definitions and theorems to learn more about them.

● Need to take a negation? Translate your statement into FOL, negate it, then translate it back.

● Want to prove something by contrapositive? Translate your implication into FOL, take the contrapositive, then translate it back.

Page 109: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Translating Into Logic

● Translating statements into first-order logic is a lot more difficult than it looks.

● There are a lot of nuances that come up when translating into first-order logic.

● We'll cover examples of both good and bad translations into logic so that you can learn what to watch for.

● We'll also show lots of examples of translations so that you can see the process that goes into it.

Page 110: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Using the predicates

- Puppy(p), which states that p is a puppy, and - Cute(x), which states that x is cute,

write a sentence in first-order logic that means “all puppies are cute.”

Answer at PollEv.com/cs103 ortext CS103 to 22333 once to join, then A, B, C, D, E, or F.

Answer at PollEv.com/cs103 ortext CS103 to 22333 once to join, then A, B, C, D, E, or F.

Which of these first-order logic statements is a proper translation?

A. ∃p. (Puppy(p) ∧ Cute(p))B. ∃p. (Puppy(p) → Cute(p))C. ∀p. (Puppy(p) ∧ Cute(p))D. ∀p. (Puppy(p) → Cute(p))E. More than one of these.F. None of these.

Which of these first-order logic statements is a proper translation?

A. ∃p. (Puppy(p) ∧ Cute(p))B. ∃p. (Puppy(p) → Cute(p))C. ∀p. (Puppy(p) ∧ Cute(p))D. ∀p. (Puppy(p) → Cute(p))E. More than one of these.F. None of these.

Page 111: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

All puppies are cute!

∀x. (Puppy(x) ∧ Cute(x))

Page 112: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

All puppies are cute!

∀x. (Puppy(x) ∧ Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 113: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

All puppies are cute!

∀x. (Puppy(x) ∧ Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 114: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

All puppies are cute!

∀x. (Puppy(x) ∧ Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 115: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

All puppies are cute!

∀x. (Puppy(x) ∧ Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 116: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

All puppies are cute!

∀x. (Puppy(x) ∧ Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 117: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

All puppies are cute!

∀x. (Puppy(x) ∧ Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 118: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

All puppies are cute!

∀x. (Puppy(x) ∧ Cute(x))

A statement of the form

∀x. something

is true only when something is true for every choice of x.

A statement of the form

∀x. something

is true only when something is true for every choice of x.

Page 119: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

All puppies are cute!

∀x. (Puppy(x) ∧ Cute(x))

A statement of the form

∀x. something

is true only when something is true for every choice of x.

A statement of the form

∀x. something

is true only when something is true for every choice of x.

Page 120: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

All puppies are cute!

∀x. (Puppy(x) ∧ Cute(x))

Page 121: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

All puppies are cute!

∀x. (Puppy(x) ∧ Cute(x))

This first-order statement is false even though the English statement is true. Therefore, it can't be a correct translation.

This first-order statement is false even though the English statement is true. Therefore, it can't be a correct translation.

Page 122: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

All puppies are cute!

∀x. (Puppy(x) ∧ Cute(x))

The issue here is that this statement asserts that

everything is a puppy. That's too strong of a claim to make.

The issue here is that this statement asserts that

everything is a puppy. That's too strong of a claim to make.

Page 123: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

Page 124: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 125: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 126: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 127: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 128: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 129: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 130: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 131: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 132: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 133: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 134: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 135: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 136: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 137: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 138: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 139: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 140: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 141: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 142: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 143: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 144: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 145: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

This should work for any choice of x,

including things that aren't puppies.

This should work for any choice of x,

including things that aren't puppies.

Page 146: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

Page 147: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

A statement of the form

∀x. something

is true only when something is true for every choice of x.

A statement of the form

∀x. something

is true only when something is true for every choice of x.

Page 148: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Better Translation

All puppies are cute!

∀x. (Puppy(x) → Cute(x))

A statement of the form

∀x. something

is true only when something is true for every choice of x.

A statement of the form

∀x. something

is true only when something is true for every choice of x.

Page 149: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

“All P's are Q's”

translates as

∀x. (P(x) → Q(x))

Page 150: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Useful Intuition:

Universally-quantified statements are true unless there's a counterexample.

∀x. (P(x) → Q(x))

If x is a counterexample, it must have property P but not have

property Q.

If x is a counterexample, it must have property P but not have

property Q.

Page 151: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Using the predicates

- Blobfish(b), which states that b is a blobfish, and - Cute(x), which states that x is cute,

write a sentence in first-order logic that means “some blobfish is cute.”

Page 152: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Using the predicates

- Blobfish(b), which states that b is a blobfish, and - Cute(x), which states that x is cute,

write a sentence in first-order logic that means “some blobfish is cute.”

Answer at PollEv.com/cs103 ortext CS103 to 22333 once to join, then A, B, C, D, E, or F.

Answer at PollEv.com/cs103 ortext CS103 to 22333 once to join, then A, B, C, D, E, or F.

Which of these first-order logic statements is a proper translation?

A. ∃b. (Blobfish(b) ∧ Cute(b))B. ∃b. (Blobfish(b) → Cute(b))C. ∀b. (Blobfish(b) ∧ Cute(b))D. ∀b. (Blobfish(b) → Cute(b))E. More than one of these.F. None of these.

Which of these first-order logic statements is a proper translation?

A. ∃b. (Blobfish(b) ∧ Cute(b))B. ∃b. (Blobfish(b) → Cute(b))C. ∀b. (Blobfish(b) ∧ Cute(b))D. ∀b. (Blobfish(b) → Cute(b))E. More than one of these.F. None of these.

Page 153: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

Some blobfish is cute.

∃x. (Blobfish(x) → Cute(x))

Page 154: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

Some blobfish is cute.

∃x. (Blobfish(x) → Cute(x))

Page 155: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

Some blobfish is cute.

∃x. (Blobfish(x) → Cute(x))

Page 156: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

Some blobfish is cute.

∃x. (Blobfish(x) → Cute(x))

Page 157: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

Some blobfish is cute.

∃x. (Blobfish(x) → Cute(x))

Page 158: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

Some blobfish is cute.

∃x. (Blobfish(x) → Cute(x))

Page 159: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

Some blobfish is cute.

∃x. (Blobfish(x) → Cute(x))

A statement of the form

∃x. something

is true only when something is true for

at least one choice of x.

A statement of the form

∃x. something

is true only when something is true for

at least one choice of x.

Page 160: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

Some blobfish is cute.

∃x. (Blobfish(x) → Cute(x))

A statement of the form

∃x. something

is true only when something is true for

at least one choice of x.

A statement of the form

∃x. something

is true only when something is true for

at least one choice of x.

Page 161: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

Some blobfish is cute.

∃x. (Blobfish(x) → Cute(x))

Page 162: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

Some blobfish is cute.

∃x. (Blobfish(x) → Cute(x))

This first-order statement is true even though the English statement is false. Therefore,

it can't be a correct translation.

This first-order statement is true even though the English statement is false. Therefore,

it can't be a correct translation.

Page 163: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

An Incorrect Translation

Some blobfish is cute.

∃x. (Blobfish(x) → Cute(x))

The issue here is that implications are true whenever the antecedent

is false. This statement “accidentally” is true because of

what happens when x isn't a blobfish.

The issue here is that implications are true whenever the antecedent

is false. This statement “accidentally” is true because of

what happens when x isn't a blobfish.

Page 164: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 165: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 166: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 167: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 168: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 169: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 170: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 171: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 172: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 173: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 174: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 175: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 176: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 177: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 178: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 179: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 180: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 181: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 182: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 183: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 184: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

Page 185: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

A statement of the form

∃x. something

is true only when something is true for

at least one choice of x.

A statement of the form

∃x. something

is true only when something is true for

at least one choice of x.

Page 186: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

A Correct Translation

Some blobfish is cute.

∃x. (Blobfish(x) ∧ Cute(x))

A statement of the form

∃x. something

is true only when something is true for

at least one choice of x.

A statement of the form

∃x. something

is true only when something is true for

at least one choice of x.

Page 187: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

“Some P is a Q”

translates as

∃x. (P(x) ∧ Q(x))

Page 188: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Useful Intuition:

Existentially-quantified statements are false unless there's a positive example.

∃x. (P(x) ∧ Q(x))

If x is an example, it must have property P on top of property Q.

If x is an example, it must have property P on top of property Q.

Page 189: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Good Pairings

● The ∀ quantifier usually is paired with →.

∀x. (P(x) → Q(x))● The ∃ quantifier usually is paired with ∧.

∃x. (P(x) ∧ Q(x))● In the case of ∀, the → connective prevents the

statement from being false when speaking about some object you don't care about.

● In the case of ∃, the ∧ connective prevents the statement from being true when speaking about some object you don't care about.

Page 190: Mathematical Logic - Stanford Universityweb.stanford.edu/class/cs103/lectures/04/Slides04.pdfLikes(You, Eggs) ∧ Likes(You, Tomato) → Likes(You, Shakshuka) Learns(You, History)

Next Time

● First-Order Translations● How do we translate from English into first-order logic?

● Quantifier Orderings● How do you select the order of quantifiers in first-order

logic formulas?● Negating Formulas

● How do you mechanically determine the negation of a first-order formula?

● Expressing Uniqueness● How do we say there’s just one object of a certain type?