Mathematics for Computer Science - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Mathematics for Computer Science

Description:

(P Q) ( Q Pbut not: (P Q) (Q P) Tautologies represent proof methods (P Q) ( P Q) (P Q) ... More tautologies (& proof methods) P : P is a tautology: P is always true ... – PowerPoint PPT presentation

Number of Views:947
Avg rating:3.0/5.0
Slides: 21
Provided by: leonvand
Category:

less

Transcript and Presenter's Notes

Title: Mathematics for Computer Science


1
Mathematics for Computer Science
  • Lecture 3 More proofs
  • Leon van der Torre

2
Slides
  • Slides can be found on the internet
  • These slides are based on MIT open courseware,
    by S. Devadas and E. Lehmann

BECS - Bachelor of Engineering in Computer
Science
3
Book
  • Rod Haggarty,
  • Discrete Mathematics for Computing
  • Diskrete Mathematik für Informatiker

4
Additional reading
  • Rosen, Kenneth H. Discrete Mathematics and its
    Applications, Fourth Edition, McGraw-Hill, Inc.,
    New York, 1999.
  • Velleman, Daniel J. How to prove it A Structured
    Approach, Cambridge University Press, Cambridge,
    England, 1994.

5
Tautologies
  • P P is a tautology P is always true
  • (P ? Q) ? (Q ? P)
  • P ? (Q ? R) ? (P ? Q) ? R
  • P ? (Q ? R) ? (P ? Q) ? (P ? R)
  • (P ? P) ? P
  • ??P ? P
  • ? (P ? Q) ? ?P ? ?Q

6
Rehearsal Are these saying the same?
  • If I am hungry (P) , then I am grumpy (Q).
  • If I am not grumpy, then I am not hungry.
  • (P ? Q) ? (?Q ? ?P)

7
Rehearsal are these saying the same?
  • If I am hungry (P) , then I am grumpy (Q).
  • If I am grumpy, then I am hungry.
  • not (P ? Q) ? (Q ? P)

8
Rehearsal proving an implication (2)
  • Write, We prove the contrapositive and then
    state the contrapositive.
  • Proceed as in Method 1.
  • Example If r is irrational, then vr is also
    irrational.
  • Exercise If m2 is even, then m is even
  • (P ? Q) ? (?Q ? ?P) but not (P ? Q) ? (Q ? P)

9
Tautologies represent proof methods
  • (P ? Q) ? (?P ? Q)
  • (P ? Q) ? (?Q ? ?P)
  • ? (P ? Q) ? (P ? ?Q)
  • (P ? Q ? R) ? (P ? ?Q ? R)
  • (P ? Q ? R) ? (P ? R) ? (Q ? R)
  • (P ? Q ? R) ? (P ? Q) ? (P ? R)

10
Reasoning backward?
  • (ab)/2 vab
  • ab 2vab
  • (ab)2 4ab
  • a22abb2 4ab
  • a2-2abb2 0
  • (a-b)2 0
  • Whats wrong with this proof?

11
Rehearsal If and only if
  • P if and only if Q P and Q logically
    equivalent
  • That is, either both are true or both are false.
  • x2 - 4  0 if and only if x 2
  • Doesnt arise in ordinary speech, abbreviated
    iff.

12
Rehearsal Are these saying the same?
  • These two statements together
  • If I am grumpy, then I am hungry.
  • If I am hungry, then I am grumpy.
  • I am grumpy if and only if I am hungry.
  • (P ? Q) ? (P ? Q) ? (Q ? P)

13
Proving an If and Only If (1)
  • Prove each statement implies the other
  • Write, We prove P implies Q and vice-versa.
  • Write, First, we show P implies Q. Do this by
    one of the methods discussed last week.
  • Write, Now, we show Q implies P. Again, do this
    by one of the methods.
  • Example Let A, B and C be sets, then
  • A ? (B ? C) (A ? B) ? (A ? C)

14
Proving an If and Only If (2)
  • Construct a Chain of Iffs
  • Write, We construct a chain of if-and-only-if
    implications.
  • Prove P is equivalent to a second statement which
    is equivalent to a third statement and so forth
    until you reach Q.
  • Example The standard deviation of a sequence of
    values is 0 iff all values are equal to the mean

15
More tautologies ( proof methods)
  • P P is a tautology P is always true
  • ?P ? (P ? Q)
  • P ? (P ? Q) ? Q
  • (P ? Q) ? ?Q ? ?P
  • (P ? Q) ? (Q ? R) ? (P ? R)
  • (P ? Q ) ? (?P ? R) ? Q ? R

16
Proof by contradiction
  • (?P ? Q) ? ?Q ? P when Q is contradiction
  • To prove a proposition P by contradiction
  • Write, We use proof by contradiction.
  • Write, Suppose P is false.
  • Deduce a logical contradiction.
  • Write, This is a contradiction. Therefore,
    P must be true.
  • Example. v2 is irrational.
  • Example. primes is infinite

17
Proof by case analysis
  • (P ? R) ? (Q ? R) ? (P ? Q ? R)
  • Write, We use case analysis
  • Identify a sequence of conditions, at least one
    of which must hold.
  • For each condition
  • State the condition
  • Prove P assuming that the condition holds
  • Example there exist irrational numbers p and q
    such that p to power q is rational.

18
Proofs in programming language Prolog
  • Represent formulas as sets of clauses
  • Remove implications
  • Move ? directly in front of variables
  • Use distribution of ? over ?
  • Use resolution to derive contradiction
  • (P ? Q ) ? (?P ? R) ? Q ? R

19
Conversion to CNF
  • B1,1 ? (P1,2 ? P2,1)
  • Eliminate ?, replacing a ? ß with (a ? ß)?(ß ?
    a).
  • (B1,1 ? (P1,2 ? P2,1)) ? ((P1,2 ? P2,1) ? B1,1)
  • 2. Eliminate ?, replacing a ? ß with ?a? ß.
  • (?B1,1 ? P1,2 ? P2,1) ? (?(P1,2 ? P2,1) ? B1,1)
  • 3. Move ? inwards using de Morgan's rules and
    double-negation
  • (?B1,1 ? P1,2 ? P2,1) ? ((?P1,2 ? ?P2,1) ? B1,1)
  • 4. Apply distributivity law (? over ?) and
    flatten
  • (?B1,1 ? P1,2 ? P2,1) ? (?P1,2 ? B1,1) ? (?P2,1 ?
    B1,1)

20
Resolution example
  • KB (B1,1 ? (P1,2? P2,1)) ?? B1,1
  • a ?P1,2

21
Homework
  • Read chapter 1 2
  • Before next Monday Hand in your answers for
    problem 5 and 6
  • (Score will be taken into account for first
    midterm test.)
Write a Comment
User Comments (0)
About PowerShow.com