Top Banner
CS322 Week 2 - Wednesday
32

Week 2 - Wednesday. What did we talk about last time? Arguments Digital logic circuits Predicate logic Universal quantifier Existential quantifier.

Dec 31, 2015

Download

Documents

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: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

CS322Week 2 - Wednesday

Page 2: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Last time

What did we talk about last time? Arguments Digital logic circuits Predicate logic

Universal quantifier Existential quantifier

Page 3: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Questions?

Page 4: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Logical warmup

Four men are standing in front of a firing-squad

#1 and #3 are wearing black hats #2 and #4 are wearing white hats They are all facing the same direction with

a wall between #3 and #4 Thus,

#1 sees #2 and #3 #2 sees #3 #3 and #4 see no one

The men are told that two white hats and two black hats are being worn

The men can go if one man says what color hat he's wearing

No talking is allowed, with the exception of a man announcing what color hat he's wearing.

Are they set free? If so, how?

1

3

2

4

Page 5: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Digital Logic Review

Page 6: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Common gates

The following gates have the same function as the logical operators with the same names:

NOT gate:

AND gate:

OR gate:

Page 7: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Digital logic exercises

Build an OR circuit using only AND and NOT gates

Build a bidirectional implication circuit using AND, OR, and NOT gates

Page 8: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Predicate Logic

Page 9: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Universal quantification

The universal quantifier means “for all” The statement “All DJ’s are mad ill” can

be written more formally as: x D, M(x)

Where D is the set of DJ’s and M(x) denotes that x is mad ill

Notation: P(x) Q(x) means, for predicates P(x) and

Q(x) with domain D: x D, P(x) Q(x)

Page 10: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Existential quantification

The universal quantifier means “there exists”

The statement “Some emcee can bust a rhyme” can be written more formally as:

y E, B(y) Where E is the set of emcees and B(y)

denotes that y can bust a rhyme

Page 11: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Quantified examples

Consider the following: S(x) means that x is a square R(x) means that x is a rectangle H(x) means that x is a rhombus P is the set of all polygons

Which of the following is true: x P, S(x) R(x) x P, R(x) S(x) x P, R(x) H(x) S(x) x P, R(x) ~S(x) x P, ~R(x) H(x) x P, R(x) ~S(x) x P, ~H(x) S(x)

Page 12: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

More quantified examples

Convert the following statements in English into quantified statements of predicate logic Every son is a descendant Every person is a son or a daughter There is someone who is not a

descendant Every parent is a son or a daughter There is a descendant who is not a son

Page 13: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Tarski’s World

Tarski’s World provides an easy framework for testing knowledge of quantifiers

The following notation is used: Triangle(x) means “x is a triangle” Blue(y) means “y is blue” RightOf(x, y) means “x is to the right of

y (but not necessarily on the same row)”

Page 14: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Tarski’s World Example

Are the following statements true or false? t, Triangle(t) Blue(t) x, Blue(x) Triangle(x) y such that Square(y) RightOf(d, y) z such that Square(z) Gray(z)

a

c

g

b

d

f

i

k

e

h

j

Page 15: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Negating Quantifiers and Multiple QuantifiersStudent Lecture

Page 16: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Negating quantified statements

When doing a negation, negate the predicate and change the universal quantifier to existential or vice versa

Formally: ~(x, P(x)) x, ~P(x) ~(x, P(x)) x, ~P(x)

Thus, the negation of "Every dragon breathes fire" is "There is one dragon that does not breathe fire"

Page 17: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Negation example

Argue the following: "Every unicorn has five legs"

First, let's write the statement formally Let U(x) be "x is a unicorn" Let F(x) be "x has five legs" x, U(x) F(x)

Its negation is x, ~(U(x) F(x)) We can rewrite this as x, U(x) ~F(x)

Informally, this is "There is a unicorn which does not have five legs"

Clearly, this is false If the negation is false, the statement must be true

Page 18: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Vacuously true

The previous slide gives an example of a statement which is vacuously true

When we talk about "all things" and there's nothing there, we can say anything we want

Page 19: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Conditionals

Recall: Statement: p q Contrapositive:~q ~p Converse:q p Inverse: ~p ~q

These can be extended to universal statements: Statement: x, P(x) Q(x) Contrapositive: x, ~Q(x) ~P(x) Converse: x, Q(x) P(x) Inverse: x, ~P(x) ~Q(x)

Similar properties relating a statement equating a statement to its contrapositive (but not to its converse and inverse) apply

Page 20: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Necessary and sufficient

The ideas of necessary and sufficient are meaningful for universally quantified statements as well:

x, P(x) is a sufficient condition for Q(x) means x, P(x) Q(x)

x, P(x) is a necessary condition for Q(x) means x, Q(x) P(x)

Page 21: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Multiple Quantifiers

Page 22: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Multiple quantifiers

So far, we have not had too much trouble converting informal statements of predicate logic into formal statements and vice versa

Many statements with multiple quantifiers in formal statements can be ambiguous in English

Example: “There is a person supervising every

detail of the production process.”

Page 23: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Example

“There is a person supervising every detail of the production process.”

What are the two ways that this could be written formally? Let D be the set of all details of the production

process Let P be the set of all people Let S(x,y) mean “x supervises y”

x D, y P such that S(x,y)

y P, x D such that S(x,y)

Page 24: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Mechanics

Intuitively, we imagine that corresponding “actions” happen in the same order as the quantifiers

The action for x A is something like, “pick any x from A you want”

Since a “for all” must work on everything, it doesn’t matter which you pick

The action for y B is something like, “find some y from B”

Since a “there exists” only needs one to work, you should try to find the one that matches

Page 25: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Tarski’s World Example

Is the following statement true? “For all blue items x, there is a green item y with the

same shape.” Write the statement formally. Reverse the order of the quantifiers. Does its truth

value change?

a

c

g

b

d

f

i

k

e

h

j

Page 26: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Practice

Given the formal statements with multiple quantifiers for each of the following: There is someone for everyone. All roads lead to some city. Someone in this class is smarter than

everyone else. There is no largest prime number.

Page 27: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Negating multiply quantified statements

The rules don’t change Simply switch every to and every

to Then negate the predicate Write the following formally:

“Every rose has a thorn” Now, negate the formal version Convert the formal version back to

informal

Page 28: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Changing quantifier order As show before, changing the order of

quantifiers can change the truth of the whole statement

However, it does not necessarily Furthermore, quantifiers of the same type

are commutative: You can reorder a sequence of quantifiers

however you want The same goes for Once they start overlapping, however, you

can’t be sure anymore

Page 29: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Quiz

Page 30: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Upcoming

Page 31: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Next time…

Arguments with quantifiers

Page 32: Week 2 - Wednesday.  What did we talk about last time?  Arguments  Digital logic circuits  Predicate logic  Universal quantifier  Existential quantifier.

Reminders

Keep reading Chapter 2 Assignment 1 is due Friday at

midnight