Week 1 - Friday. What did we talk about last time? Tautologies Contradictions Laws of Boolean...

36
CS322 Week 1 - Friday

Transcript of Week 1 - Friday. What did we talk about last time? Tautologies Contradictions Laws of Boolean...

CS322Week 1 - Friday

Last time

What did we talk about last time? Tautologies Contradictions Laws of Boolean algebra Implications

Inverses Converses Bidirectional

Questions?

Logical warmup

For Diwali, Mr. Patel's five daughters gave each other books as presents.

Each presented four books and each received four books, but no two girls divided her books in the same way.

That is, only one gave two books to one sister and two to another. Bharat gave all her books to Abhilasha; Chandra gave three to Esha.

Who gave how many books to whom?

Necessary and sufficient

One note about implications and wording them: p is a sufficient condition for q means p q p is a necessary condition for q means q p

This nomenclature is a touch counterintuitive Think of it this way:

p q means that p is enough to get you q, but there might be other things that will get you q

q p means that, since you automatically get p when you've got q, there's no way to have q without p

Arguments

Arguments

An argument is a list of statements (called premises) followed by a single statement (called a conclusion)

Whenever all of the premises are true, the conclusion must also be true, in order to make the argument valid

Examples

Are the following arguments valid? p q ~r (premise) q p r (premise) p q (conclusion)

p (q r) (premise) ~r (premise) p q (conclusion)

Common argument tools

Modus ponens is a valid argument of the following form: p q p q

Modus tollens is a contrapositive reworking of the argument, which is also valid: p q ~q ~p

Give verbal examples of each We call these short valid arguments rules of

inference

Generalization

The following are also valid rules of inference: p p q

q p q

English example: “If pigs can fly, then pigs can fly or swans can breakdance.”

Specialization

The following are also valid rules of inference: p q p

p q q

English example: “If the beat is out of control and the bassline just won’t stop, then the beat is out of control.”

Conjunction

The following is also a valid rule of inference: p q p q

English example: “If the beat is out of control and the bassline just won’t stop, then the beat is out of control and the bassline just won’t stop.”

Elimination

The following are also valid rules of inference: p q ~q p

p q ~p q

English example: “If you’re playing it cool or I’m maxing and relaxing, and you’re not playing it cool, then I’m maxing and relaxing.”

Transitivity

The following is also a valid rule of inference: p q q r p r

English example: “If you call my mom ugly I will call my brother, and if I call my brother he will beat you up, then if you call my mom ugly my brother will beat you up.”

Division into cases

The following is also a valid rule of inference: p q p r q r r

English example: “If am fat or sassy, and being fat implies that I will give you trouble, and being sassy implies that I will give you trouble, then I will give you trouble.”

Contradiction Rule

The following is also a valid rule of inference: ~p c p

English example: “If my water is at absolute zero then the universe does not exist, thus my water must not be at absolute zero.”

Fallacies

A fallacy is an argument that is not valid

It could mean that the conclusion is not true in only a single case in the truth table

But, if the conclusion is ever false whenever all the premises are true, the argument is a fallacy

Most arguments presented by politicians are fallacies for one reason or another

Common fallacies

Converse error If Joe sings a sad song, then Joe will

make it better. Joes makes it better. Conclusion: Joe sings a sad song.

FALLACY Inverse error

If you eat too much, you will get sick. You are not eating too much. Conclusion: You will not get sick.

FALLACY

Digital Logic Circuits

Digital logic circuits

Digital logic circuits are the foundation of all computer hardware

Circuits are built out of components called gates

A gate has one or more inputs and an output

Gates model Boolean operations Usually, in digital logic, we use a 1

for true and a 0 for false

Common gates

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

NOT gate:

AND gate:

OR gate:

Example

Draw the digital logic circuit corresponding to:

(p ~q) ~(p r)

What’s the corresponding truth table?

Predicate Logic

Student Lecture: Universal and Existential Quantifiers

Predicates

A predicate is a sentence with a fixed number of variables that becomes a statement when specific values are substituted for to the variables

The domain gives all the possible values that can be substituted

The truth set of a predicate P(x) are those elements of the domain that make P(x) true when they are substituted

Predicate examples

Let P(x) be “x has had 4 wisdom teeth removed”

What is the truth set if the domain is the people in this classroom?

Let Q(n) be “n is divisible by exactly itself and 1”

What is the truth set if the domain is the set of positive integers Z+?

A note about sets

We will frequently be referring to various sets of numbers in this class

Some typical notation used for these sets:

Some authors use Z+ to refer to non-negative integers and only N for the natural numbers

Symbol

Set Examples

R Real numbers Virtually everything that isn’t imaginary

Z Integers {…, -2, -1, 0, 1, 2,…}

Z- Negative integers {-1, -2, -3, …}

Z+ Positive integers {1, 2, 3, …}

N Natural numbers {1, 2, 3, …}

Q Rational numbers a/b where a,b Z and b 0

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

Universal quantification examples

Let S = {1, 2, 3, 4, 5} Show that the following statement is

true: x S, x2 ≥ x

Show that the following statement is false: x R, x2 ≥ x

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

Existential quantification examples

Let S = {2, 4, 6, 8} Show that the following statement is

false: x S, 1/x = x

Show that the following statement is true: x Z, 1/x = x

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)”

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

Upcoming

Next time…

Negating quantifications Multiple quantifications

Reminders

Keep reading Chapter 3 Start working on Assignment 1

Due next Friday