CSCI-2200 FOUNDATIONS OF COMPUTER SCIENCE Spring 2019 2 - - PowerPoint PPT Presentation

csci 2200 foundations of computer science
SMART_READER_LITE
LIVE PREVIEW

CSCI-2200 FOUNDATIONS OF COMPUTER SCIENCE Spring 2019 2 - - PowerPoint PPT Presentation

1 CSCI-2200 FOUNDATIONS OF COMPUTER SCIENCE Spring 2019 2 Announcements Homework 2 is due Thursday, Jan. 31 at 11:59pm. Solutions to Homework 1 will be presented in recitation this week. 3 MATHEMATICAL PROOFS Sections 1.7 1.8


slide-1
SLIDE 1

CSCI-2200 FOUNDATIONS OF COMPUTER SCIENCE

Spring 2019

1

slide-2
SLIDE 2

Announcements

  • Homework 2 is due Thursday, Jan. 31 at 11:59pm.
  • Solutions to Homework 1 will be presented in recitation

this week.

2

slide-3
SLIDE 3

MATHEMATICAL PROOFS

Sections 1.7 – 1.8

3

slide-4
SLIDE 4

Recap - Proving Theorems

  • Many theorems have the form:
  • To prove them, we show that, where c is an arbitrary element of the

domain,

  • By universal generalization the truth of the original formula follows.
  • So, we must prove something of the form: prove p → q
  • Direct Proof: To prove p → q is true:
  • Assume that p is true.
  • Use rules of inference, axioms, and logical equivalences to

show that q must also be true.

  • Proof by Contraposition: To prove p → q is true,
  • Assume ¬q
  • Show ¬p is also true.

4

slide-5
SLIDE 5

Proof Strategies for proving p → q

  • Choose a method.

1.

First try a direct method of proof.

2.

If this does not work, try an indirect method (e.g., try to prove the contrapositive).

  • For whichever method you are trying, choose a strategy.

1.

First try forward reasoning. Start with the axioms and known theorems and construct a sequence of steps that end in the conclusion. Start with p and prove q, or start with ¬q and prove ¬p.

2.

If this doesn’t work, try backward reasoning. When trying to prove q, find a statement p that we can prove with the property p → q.

5

slide-6
SLIDE 6

Recap - Proof by Contradiction

Proof by Contradiction: (AKA reductio ad absurdum):

  • Suppose we want to prove that a proposition p is true.
  • First, assume that p is false (¬p is true).
  • Then, show that ¬p implies a contradiction, i.e.,

¬p → (r ∧ ¬r) for some proposition r.

  • This means that ¬p → F is true.
  • It follows that the contrapositive T→ p is true.
  • Therefore, p is true.

6

slide-7
SLIDE 7

Recap - Definitions

  • A real number r is rational if r = p/q for some integers p and q,

q ≠ 0, where p and q have no common factors other than 1.

  • It can also be written as r = k(p/q), where r is any positive

integer.

  • A real number that is not rational is called irrational.

7

slide-8
SLIDE 8

Recap – Predicate Logic

  • Theorem: The difference between any rational number

and any irrational number is irrational.

8

slide-9
SLIDE 9
  • Theorem: The difference between any rational number and any

irrational number is irrational.

9

slide-10
SLIDE 10
  • Theorem: The difference between any rational number

and any irrational number is irrational.

  • Corollary: The sum of a rational number and an irrational

number is irrational.

  • You can use this theorem and corollary in your homework.
  • What about this one?
  • Theorem: The product of a non-zero rational number and an

irrational number is irrational.

  • You may need to prove this for HW2.

10

slide-11
SLIDE 11

11

Give a proof by contradiction for “√2 is irrational”.

slide-12
SLIDE 12

What is wrong with this?

“Proof” that 1 = 2

12

slide-13
SLIDE 13

Theorems that are Biconditional Statements

  • To prove a theorem that is a biconditional statement, i.e., a

statement of the form p ↔ q, we show that p → q and q →p are both true.

  • Example Theorem: “If n is an integer, then n is odd if and only if

n2 is odd.”

  • Must prove both:

If n is odd, then n2 is odd. If n2 is odd, then n is odd.

  • Can use different proof methods for each conditional statement.

13

slide-14
SLIDE 14

Proof by Cases

  • To prove a conditional statement of the form:
  • Use the tautology
  • Each of the implications is a case.
  • You need to prove each of them.
  • Can use different proof method for each case (though try to avoid

this if you can)

14

slide-15
SLIDE 15

Example - Proof by Cases

  • Let a @ b = max{a, b}

If a ≥ b, a @ b = a. Otherwise a @ b = b.

  • Show that for all real numbers a, b, c

(a @b) @ c = a @ (b @ c) *This means the operation @ is associative.

  • Proof: Let a, b, and c be arbitrary real numbers.

Then one of the following 6 cases must hold.

1.

a ≥ b ≥ c

2.

a ≥ c ≥ b

3.

b ≥ a ≥c

4.

b ≥ c ≥a

5.

c ≥ a ≥ b

6.

c ≥ b ≥ a

15

slide-16
SLIDE 16
  • Show that for all real numbers a, b, c (a@b)@c = a@(b@c).

16

slide-17
SLIDE 17

Without Loss of Generality

  • Show that if x and y are integers and both xy and x+y are even,

then both x and y are even.

  • We will use a proof by contraposition.
  • What do we assume?
  • What do we want to prove?

17

slide-18
SLIDE 18
  • Show that if x and y are integers and both xy and x+y are even, then

both x and y are even.

18

slide-19
SLIDE 19
  • Show that if x and y are integers and both xy and x+y are even, then

both x and y are even.

19

slide-20
SLIDE 20

Without Loss of Generality

  • For the proof of “Show that if x and y are integers and both xy

and x+y are even, then both x and y are even.” We only cover the case where x is odd because the case where y is odd is similar. The phrase without loss of generality (w.l.o.g.) indicates this.

20

slide-21
SLIDE 21

A note about writing proofs….

  • If you are writing a direct proof, you do not not need to write

that the proof is a direct proof.

  • If you are using a different proof method, it is common to state

which proof method you are using at the beginning of the proof, e.g.,

  • “This is a proof by contradiction.”
  • “This is a proof by contraposition.”
  • “This is a proof by induction.”

21

slide-22
SLIDE 22

A note about writing proofs…

  • For a proof of p → q by contraposition, we write

something like… “This is a proof by contraposition. Assume ¬q is true. This implies that ¬p is also true. Therefore, if p is true, then q is true.”

22

Steps from ¬q to ¬p go here For this class, this sentence is optional

slide-23
SLIDE 23

Existence Proofs

  • Some theorems are of the form
  • E.g., “There is a positive integer that can be written as the sum of

cubes of two positive integers in two different ways:

  • Constructive existence proof:
  • Find an explicit value of c, for which P(c) is true.
  • Then is true by Existential Generalization (EG).
  • Proof: 1729 is such a number since

1729 = 103 + 93 = 123 + 1

23

slide-24
SLIDE 24

Nonconstructive Existence Proofs

  • In a nonconstructive existence proof:
  • We prove that a c exists that makes P(c) true, but we

don’t actually find what that c is.

  • One option: we assume no c exists for which P(c) is

true and derive a contradiction.

24

slide-25
SLIDE 25

Theorem: “There exist irrational numbers x and y such that xy is rational.”

25

slide-26
SLIDE 26

Good Problems to Review

  • Section 1.7: 9, 13, 15, 17b, 27
  • Section 1.8: 5, 7, 11, 15

26