mathematical logic - stanford...
TRANSCRIPT
![Page 1: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/1.jpg)
Mathematical LogicPart Two
Problem Set Three due in the box up front.
Problem Set Three due in the box up front.
![Page 2: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/2.jpg)
First-Order Logic
![Page 3: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/3.jpg)
The Universe of First-Order Logic
Venus
The Morning Star
The Evening Star
The Sun
The Moon
![Page 4: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/4.jpg)
First-Order Logic
● In first-order logic, each variable refers to some object in a set called the domain of discourse.
● Some objects may have multiple names.● Some objects may have no name at all.
VenusThe Morning
Star
The Evening Star
![Page 5: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/5.jpg)
Propositional vs. First-Order Logic
● Because propositional variables are either true or false, we can directly apply connectives to them.
p → q ¬p ↔ q ∧ r ● Because first-order variables refer to
arbitrary objects, it does not make sense to apply connectives to them.
Venus → Sun 137 ↔ ¬42● This is not C!
![Page 6: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/6.jpg)
Reasoning about Objects
● To reason about objects, first-order logic uses predicates.
● Examples:● NowOpen(USGovernment)● FinallyTalking(House, Senate)
● Predicates can take any number of arguments, but each predicate has a fixed number of arguments (called its arity)
● Applying a predicate to arguments produces a proposition, which is either true or false.
![Page 7: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/7.jpg)
First-Order Sentences
● Sentences in first-order logic can be constructed from predicates applied to objects:
LikesToEat(V, M) ∧ Near(V, M) → WillEat(V, M)
Cute(t) → Dikdik(t) ∨ Kitty(t) ∨ Puppy(t)
x < 8 → x < 137
The notation x < 8 is just a shorthand for something like LessThan(x, 8). Binary predicates in math are often
written like this, but symbols like < are not a part of first-order logic.
The notation x < 8 is just a shorthand for something like LessThan(x, 8). Binary predicates in math are often
written like this, but symbols like < are not a part of first-order logic.
![Page 8: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/8.jpg)
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:
MorningStar = EveningStar
Voldemort = TomMarvoloRiddle● Equality can only be applied to objects; to see
if propositions are equal, use ↔.
![Page 9: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/9.jpg)
For notational simplicity, define ≠ as
x ≠ y ≡ ¬(x = y)
![Page 10: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/10.jpg)
Expanding First-Order Logic
x < 8 ∧ y < 8 → x + y < 16
Why is this allowed?
![Page 11: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/11.jpg)
Functions
● First-order logic allows functions that return objects associated with other objects.
● Examples:
x + y
LengthOf(path)
MedianOf(x, y, z)● As with predicates, functions can take in any number of
arguments, but each function has a fixed arity.● Functions evaluate to objects, not propositions.● There is no syntactic way to distinguish functions and
predicates; you'll have to look at how they're used.
![Page 12: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/12.jpg)
How would we translate the statement
“For any natural number n,n is even iff n2 is even”
into first-order logic?
![Page 13: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/13.jpg)
Quantifiers
● The biggest change from propositional logic to first-order logic is the use of quantifiers.
● A quantifier is a statement that expresses that some property is true for some or all choices that could be made.
● Useful for statements like “for every action, there is an equal and opposite reaction.”
![Page 14: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/14.jpg)
“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 15: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/15.jpg)
The Universal Quantifier
● A statement of the form ∀x. ψ asserts that for every choice of x in our domain, ψ is true.
● Examples:
∀v. (Puppy(v) → Cute(v))
∀n. (n ∈ ℕ → (Even(n) ↔ ¬Odd(n)))
Tallest(x) → ∀y. (x ≠ y → IsShorterThan(y, x))
![Page 16: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/16.jpg)
∃ 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 muggles are intelligent.
∃m. (Muggle(m) ∧ Intelligent(m))
![Page 17: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/17.jpg)
The Existential Quantifier
● A statement of the form ∃x. ψ asserts that for some choice of x in our domain, ψ is true.
● Examples:
∃x. (Even(x) ∧ Prime(x))
∃x. (TallerThan(x, me) ∧ LighterThan(x, me))
(∃x. Appreciates(x, me)) → Happy(me)
![Page 18: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/18.jpg)
Operator Precedence (Again)
● When writing out a formula in first-order logic, the quantifiers ∀ and ∃ have precedence just below ¬.
● Thus
∀x. P(x) ∨ R(x) → Q(x)
is interpreted as
((∀x. P(x)) ∨ R(x)) → Q(x)
rather than
∀x. ((P(x) ∨ R(x)) → Q(x))
![Page 19: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/19.jpg)
Translating into First-Order Logic
![Page 20: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/20.jpg)
A Bad 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 21: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/21.jpg)
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 22: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/22.jpg)
“Whenever P(x), then Q(x)”
translates as
∀x. (P(x) → Q(x))
![Page 23: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/23.jpg)
Another Bad Translation
Some blobfish is cute.
∃x. (Blobfish(x) → Cute(x))
![Page 24: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/24.jpg)
Another Bad Translation
Some blobfish is cute.
∃x. (Blobfish(x) → Cute(x))
What happens if
1. The above statement is false, but2. x refers to a cute puppy?
What happens if
1. The above statement is false, but2. x refers to a cute puppy?
![Page 25: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/25.jpg)
A Better Translation
Some blobfish is cute.
∃x. (Blobfish(x) ∧ Cute(x))
What happens if
1. The above statement is false, but2. x refers to a cute puppy?
What happens if
1. The above statement is false, but2. x refers to a cute puppy?
![Page 26: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/26.jpg)
“There is some P(x) where Q(x)”
translates as
∃x. (P(x) ∧ Q(x))
![Page 27: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/27.jpg)
The Takeaway Point
● Be careful when translating statements into first-order logic!
● ∀ is usually paired with →.● Sometimes paired with ↔.
● ∃ is usually paired with ∧.
![Page 28: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/28.jpg)
Time-Out For Announcements
![Page 29: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/29.jpg)
Friday Four Square!Today at 4:15PM at Gates
![Page 30: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/30.jpg)
Problem Set Four
● Problem Set Four released today.● Checkpoint due on Monday.● Rest of the assignment due Friday.● Explore functions, cardinality,
diagonalization, and logic!
![Page 31: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/31.jpg)
Your Questions
![Page 32: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/32.jpg)
What material is covered on the midterm?Is it open-notes?
![Page 33: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/33.jpg)
Hey Keith, how did you first getinterested in math/computer science?Your enthusiasm is infectious but also
somewhat curious.
![Page 34: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/34.jpg)
Back to Logic!
![Page 35: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/35.jpg)
Combining Quantifiers
● Most interesting statements in first-order logic require a combination of quantifiers.
● Example: “Everyone loves someone else.”
∀p. (Person(p) → ∃q. (Person(q) ∧ p ≠ q ∧ Loves(p, q)))
For every person,there is some person
who isn't themthat they love.
![Page 36: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/36.jpg)
Combining Quantifiers
● Most interesting statements in first-order logic require a combination of quantifiers.
● Example: “There is someone everyone else loves.”
∃p. (Person(p) ∧ ∀q. (Person(q) ∧ p ≠ q → Loves(q, p)))
There is some personwho everyone
who isn't themloves.
![Page 37: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/37.jpg)
For Comparison
∃p. (Person(p) ∧ ∀q. (Person(q) ∧ p ≠ q → Loves(q, p)))
There is some personwho everyone
who isn't themloves.
∀p. (Person(p) → ∃q. (Person(q) ∧ p ≠ q ∧ Loves(p, q)))
For every person,there is some person
who isn't themthat they love.
![Page 38: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/38.jpg)
Everyone Loves Someone Else
![Page 39: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/39.jpg)
There is Someone Everyone Else Loves
![Page 40: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/40.jpg)
Everyone Loves Someone Else andThere is Someone Everyone Else Loves
![Page 41: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/41.jpg)
∃p. (Person(p) ∧ ∀q. (Person(q) ∧ p ≠ q → Loves(q, p)))
There is some personwho everyone
who isn't themloves.
∀p. (Person(p) → ∃q. (Person(q) ∧ p ≠ q ∧ Loves(p, q)))
For every person,there is some person
who isn't themthat they love.
∧
![Page 42: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/42.jpg)
The statement
∀x. ∃y. P(x, y)
means “For any choice of x, there is some choice of y (possibly dependent on
x) where P(x, y) holds.”
![Page 43: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/43.jpg)
The statement
∃y. ∀x. P(x, y)
means “There is some choice of y wherefor any choice of x, P(x, y) holds.”
![Page 44: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/44.jpg)
Order matters when mixing existential and universal quantifiers!
![Page 45: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/45.jpg)
Quantifying Over Sets
● The notation
∀x ∈ S. P(x)
means “for any element x of set S, P(x) holds.”● This is not technically a part of first-order
logic; it is a shorthand for
∀x. (x ∈ S → P(x))● How might we encode this concept?
∃x ∈ S. P(x)
Answer: ∃x. (x ∈ S ∧ P(x)).Note the use of instead of ∧ →
here.
Note the use of instead of ∧ →
here.
![Page 46: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/46.jpg)
Quantifying Over Sets
● The syntax
∀x ∈ S. φ
∃x ∈ S. φ
is allowed for quantifying over sets.● In CS103, please do not use variants of this
syntax.● Please don't do things like this:
∀x with P(x). Q(x)
∀y such that P(y) ∧ Q(y). R(y).
![Page 47: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/47.jpg)
Translating into First-Order Logic
● First-order logic has great expressive power and is often used to formally encode mathematical definitions.
● Let's go provide rigorous definitions for the terms we've been using so far.
![Page 48: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/48.jpg)
Set Theory
“Two sets are equal iff they contain the same elements.”
∀S. (Set(S) → ∀T. (Set(T) →
(S = T ↔ ∀x. (x ∈ S ↔ x ∈ T))
Many statements asserting a general claim is true are implicitly
universally quantified.
Many statements asserting a general claim is true are implicitly
universally quantified.
![Page 49: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/49.jpg)
Set Theory
“The union of two sets is the set containing all elements of both sets.”
∀S. (Set(S) →∀T. (Set(T) →
∀x. (x ∈ S ∪ T ↔ x ∈ S ∨ x ∈ T))
)
![Page 50: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/50.jpg)
Relations
“R is a reflexive relation over A.”
∀a ∈ A. aRa
![Page 51: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/51.jpg)
Relations
“R is a symmetric relation over A.”
∀a ∈ A. ∀b ∈ A. (aRb → bRa)
![Page 52: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/52.jpg)
Relations
“R is an antisymmetric relation over A.”
∀a ∈ A. ∀b ∈ A. (aRb ∧ bRa → a = b)
![Page 53: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/53.jpg)
Relations
“R is a transitive relation over A.”
∀a ∈ A. ∀b ∈ A. ∀c ∈ A. (aRb ∧ bRc → aRc)
![Page 54: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/54.jpg)
Negating Quantifiers
● We spent much of Wednesday's lecture discussing how to negate propositional constructs.
● How do we negate quantifiers?
![Page 55: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/55.jpg)
An Extremely Important Table
For any choice of x,P(x)
For some choice of x,¬P(x)
When is this true? When is this false?
For some choice of x,P(x)
For any choice of x,¬P(x)
For any choice of x,¬P(x)
For some choice of x,P(x)
For some choice of x,¬P(x)
For any choice of x,P(x)
∀x. P(x)
∃x. P(x)
∀x. ¬P(x)
∃x. ¬P(x)
![Page 56: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/56.jpg)
An Extremely Important Table
For any choice of x,P(x) ∃x. ¬P(x)
When is this true? When is this false?
For some choice of x,P(x) ∀x. ¬P(x)
For any choice of x,¬P(x) ∃x. P(x)
For some choice of x,¬P(x) ∀x. P(x)
∀x. P(x)
∃x. P(x)
∀x. ¬P(x)
∃x. ¬P(x)
![Page 57: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/57.jpg)
Negating First-Order Statements
● Use the equivalences
¬∀x. φ ≡ ∃x. ¬φ
¬∃x. φ ≡ ∀x. ¬φ
to negate quantifiers.● Mechanically:
● Push the negation across the quantifier.● Change the quantifier from ∀ to ∃ or vice-versa.
● Use techniques from propositional logic to negate connectives.
![Page 58: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/58.jpg)
Analyzing Relations
“R is a binary relation over set A that is not reflexive”
¬∀a ∈ A. aRa∃a ∈ A. ¬aRa
“Some a ∈ A is not related to itself by R.”
![Page 59: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/59.jpg)
Analyzing Relations
“R is a binary relation over A that is not antisymmetric”
¬∀x ∈ A. ∀y ∈ A. (xRy ∧ yRx → x = y)∃x ∈ A. ¬∀y ∈ A. (xRy ∧ yRx → x = y)∃x ∈ A. ∃y ∈ A. ¬(xRy ∧ yRx → x = y)
∃x ∈ A. ∃y ∈ A. (xRy ∧ yRx ∧ ¬(x = y))∃x ∈ A. ∃y ∈ A. (xRy ∧ yRx ∧ x ≠ y)
“Some x ∈ A and y ∈ A are related to one another by R, but are not equal”
![Page 60: Mathematical Logic - Stanford Universityweb.stanford.edu/.../cs/cs103/cs103.1142/lectures/11/Small11.pdfMathematical Logic Part Two Problem Set Three due in the box up front. ... x](https://reader035.vdocuments.us/reader035/viewer/2022062908/5ace0f437f8b9ab10a8e56d5/html5/thumbnails/60.jpg)
Next Time
● Formal Languages● What is the mathematical definition of a
problem?
● Finite Automata● What does a mathematical model of a
computer look like?