week 4 - friday. what did we talk about last time? floor and ceiling proof by contradiction

38
CS322 Week 4 - Friday

Upload: katrina-farmer

Post on 18-Jan-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

CS322Week 4 - Friday

Page 2: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Last time

What did we talk about last time? Floor and ceiling Proof by contradiction

Page 3: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Questions?

Page 4: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Logical warmup By their nature, manticores lie every

Monday, Tuesday and Wednesday and the other days speak the truth

However, unicorns lie on Thursdays, Fridays and Saturdays and speak the truth the other days of the week

A manticore and a unicorn meet and have the following conversation:Manticore: Yesterday I was lying.Unicorn: So was I.

On which day did they meet?

Page 5: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Indirect Proof

Page 6: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Proof by contradiction

The most common form of indirect proof is a proof by contradiction

In such a proof, you begin by assuming the negation of the conclusion

Then, you show that doing so leads to a logical impossibility

Thus, the assumption must be false and the conclusion true

Page 7: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Example

Theorem: x, y Z+, x2 – y2 1Proof by contradiction: Assume

there is such a pair of integers

Page 8: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Two Classic Results

Page 9: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Square root of 2 is irrational

1. Suppose is rational2. = m/n, where m,n Z, n 0 and

m and n have no common factors3. 2 = m2/n2

4. 2n2 = m2

5. 2k = m2, k Z6. m = 2a, a Z

7. 2n2 = (2a)2 = 4a2

8. n2 = 2a2

9. n = 2b, b Z10. 2|m and 2|n

11. is irrational

QED

1. Negation of conclusion2. Definition of rational

3. Squaring both sides4. Transitivity5. Square of integer is integer6. Even x2 implies even x

(Proof on p. 202)7. Substitution8. Transitivity9. Even x2 implies even x10. Conjunction of 6 and 9,

contradiction11. By contradiction in 10,

supposition is false

Theorem: is irrationalProof by contradiction:

2

22

2

Page 10: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Proposition 4.7.3 Claim: Proof by contradiction:1. Suppose such that

2. 3. 4. 15. 1

6. 7. Contradiction

8. Negation of conclusion

9. Definition of divides10.Definition of divides11.Subtraction12.Substitution13.Distributive law14.Definition of divides15.Since 1 and -1 are the only

integers that divide 116.Definition of prime17.Statement 8 and statement 9

are negations of each other18.By contradiction at statement

10QED

Page 11: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Infinitude of primes

1. Suppose there is a finite list of all primes: p1, p2, p3, …, pn

2. Let N = p1p2p3…pn + 1, N Z

3. pk | N where pk is a prime4. pk | p1p2p3…pn + 15. p1p2p3…pn = pk(p1p2p3…pk-1pk+1…pn)6. p1p2p3…pn = pkP, P Z7. pk | p1p2p3…pn

8. pk does not divide p1p2p3…pn + 19. pk does and does not divide p1p2p3…

pn + 110. There are an infinite number of primes

QED

1. Negation of conclusion

2. Product and sum of integers is an integer

3. Theorem 4.3.4, p. 1744. Substitution5. Commutativity6. Product of integers is

integer7. Definition of divides8. Proposition from last slide9. Conjunction of 4 and 8,

contradiction10. By contradiction in 9,

supposition is false

Theorem: There are an infinite number of primesProof by contradiction:

Page 12: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

A few notes about indirect proof Don't combine direct proofs and

indirect proofs You're either looking for a

contradiction or not Proving the contrapositive directly is

equivalent to a proof by contradiction

Page 13: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Propositional Logic Review

Page 14: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Propositional logic

Statements AND, OR, NOT, IMPLIES Truth tables Logical equivalence De Morgan's laws Tautologies and contradictions

Page 15: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Laws of Boolean algebraName Law DualCommutative p q q p p q q pAssociative (p q) r p (q r) (p q) r p (q r)Distributive p (q r) (p q) (p

r)p (q r) (p q) (p r)

Identity p t p p c pNegation p ~p t p ~p cDouble Negative ~(~p) p Idempotent p p p p p pUniversal Bound p t t p c cDe Morgan’s ~(p q) ~p ~q ~(p q) ~p ~qAbsorption p (p q) p p (p q) pNegations of t and c

~t c ~c t

Page 16: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Implications

Can be used to write an if-then statement

Contrapositive is logically equivalent Inverse and converse are not

(though they are logically equivalent to each other)

Biconditional: p q q p

Page 17: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Arguments A series of premises and a conclusion Using the premises and rules of inference, an argument

is valid if and only if you can show the conclusion Rules of inference:

Modus Ponens Modus Tollens Generalization Specialization Conjunction Elimination Transitivity Division into cases Contradiction rule

Page 18: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Digital logic The following gates have the same function as

the logical operators with the same names:

NOT gate:

AND gate:

OR gate:

Page 19: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Predicate Logic Review

Page 20: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

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

Page 21: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

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 everythingZ 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

Page 22: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Quantifiers 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

The existential 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 23: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

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 24: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Vacuously true

Any statement with a universal quantifier whose domain is the empty set is vacuously true

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

"All mythological creatures are real." Every single one of the (of which

there are none) is real

Page 25: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

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 26: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Necessary and sufficient p is a sufficient condition for q means p

q p is a necessary condition for q means q

p

These come over into universal conditional 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 27: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Multiple quantifiers With multiple quantifiers, 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 28: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Negating or changing multiple quantifiers For negation,

Simply switch every to and every to Then negate the predicate

Changing the order of quantifiers can change the truth of the whole statement but does not always

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 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Quantification in arguments Universal instantiation: If a property is true

for everything in a domain (universal quantifier), it is true for any specific thing in the domain

Universal modus ponens: x, P(x) Q(x) P(a) for some particular a Q(a)

Universal modus tollens: x, P(x) Q(x) ~Q(a) for some particular a ~P(a)

Page 30: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Proofs Review

Page 31: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Proving existential statements and disproving universal ones

To prove x D P(x) we need to find at least one element of D that makes P(x) true

To disprove x D, P(x) Q(x), we need to find an x that makes P(x) true and Q(x) false

Page 32: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Proving universal statements If the domain is finite, we can use the method of

exhaustion, by simply trying every element Otherwise, we can use a direct proof

1. Express the statement to be proved in the form x D, if P(x) then Q(x)

2. Suppose that x is some specific (but arbitrarily chosen) element of D for which P(x) is true

3. Show that the conclusion Q(x) is true by using definitions, other theorems, and the rules for logical inference

Direct proofs should start with the word Proof, end with the word QED, and have a justification next to every step in the argument

For proofs with cases, number each case clearly and show that you have proved the conclusion for all possible cases

Page 33: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Definitions If n is an integer, then:

n is even k Z n = 2k n is odd k Z n = 2k + 1

If n is an integer where n > 1, then: n is prime r Z+, s Z+, if n = rs, then r = 1 or s = 1 n is composite r Z+, s Z+ n = rs and r 1 and s 1

r is rational a, b Z r = a/b and b 0 For n, d Z,

n is divisible by d k Z n = dk For any real number x, the floor of x, written x, is defined as

follows: x = the unique integer n such that n ≤ x < n + 1

For any real number x, the ceiling of x, written x, is defined as follows: x = the unique integer n such that n – 1 < x ≤ n

Page 34: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Theorems Unique factorization theorem: For any

integer n > 1, there exist a positive integer k, distinct prime numbers p1, p2, …, pk, and positive integers e1, e2, …, ek such that

Quotient remainder theorem: For any integer n and any positive integer d, there exist unique integers q and r such that n = dq + r and 0 ≤ r < d

kek

eee ppppn ...321321

Page 35: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Proof practice

Theorem: for all odd integers n,

Page 36: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Upcoming

Page 37: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Next time…

Exam 1!

Page 38: Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction

Reminders

Exam 1 is Monday in class!