Lecture 11 CS 1813 – Discrete Mathematics

Slides:



Advertisements
Similar presentations
Functional Programming Lecture 13 - induction on lists.
Advertisements

Discrete Math Methods of proof 1.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 3 CS 1813 – Discrete Mathematics Truth Inference and the Logical Way.
So far we have learned about:
EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 12 Number theory Mathematical induction Proof by induction Examples.
TR1413: Discrete Mathematics For Computer Science Lecture 1: Mathematical System.
Discrete Mathematics, Part II CSE 2353 Fall 2007 Margaret H. Dunham Department of Computer Science and Engineering Southern Methodist University Some slides.
Mathematical Induction. F(1) = 1; F(n+1) = F(n) + (2n+1) for n≥ F(n) n F(n) =n 2 for all n ≥ 1 Prove it!
Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag.
CSNB143 – Discrete Structure Topic 5 – Induction Part I.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 18 CS 1813 – Discrete Mathematics Loops Without Invariants Are Like.
Copyright © Peter Cappello Mathematical Induction Goals Explain & illustrate construction of proofs of a variety of theorems using mathematical induction.
March 3, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1Arguments Just like a rule of inference, an argument consists of one or more.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 10 CS 1813 – Discrete Mathematics Quantify What? Reasoning with Predicates.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 7 CS 1813 – Discrete Mathematics Equational Reasoning Back to the Future:
1.1 Introduction to Inductive and Deductive Reasoning
Methods of Proof Dr. Yasir Ali. Proof A (logical) proof of a statement is a finite sequence of statements (called the steps of the proof) leading from.
CS 285- Discrete Mathematics Lecture 4. Section 1.3 Predicate logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 19 CS 1813 – Discrete Mathematics Trees and Inductive Definitions.
CS104:Discrete Structures Chapter 2: Proof Techniques.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 14 CS 1813 – Discrete Mathematics A Little Bit of Set Theory.
Mathematical Induction Thinking Skill: Develop Confidence in Reason Warm Up: Find the k+1 term (P k+1 ) 1) 2)
Mathematical Induction 1. 2 Suppose we have a sequence of propositions which we would like to prove: P (0), P (1), P (2), P (3), P (4), … P (n), … We.
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 17 CS 1813 – Discrete Mathematics How Does It Work in the Real World?
Mathematical Induction EECS 203: Discrete Mathematics Lecture 11 Spring
Chapter 1 Logic and proofs
1 Section 4.4 Inductive Proof What do we believe about nonempty subsets of N? Since  N, <  is well-founded, and in fact it is linear, it follows that.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 CS 1813 – Discrete Mathematics Review of Predicate Calculus Set Theory Inductive.
Chapter 1 Logic and Proof.
CSE15 Discrete Mathematics 03/22/17
Chapter 4 (Part 1): Induction & Recursion
COT 3100, Spring 2001 Applications of Discrete Structures
Methods of proof Section 1.6 & 1.7 Wednesday, June 20, 2018
Advanced Algorithms Analysis and Design
Chapter 3 The Real Numbers.
Predicate Calculus Validity
Methods of Proof A mathematical theorem is usually of the form pq
CSNB 143 Discrete Mathematical Structures
Lecture 15 CS 1813 – Discrete Mathematics
CS 1813 – Discrete Mathematics
Lecture 12 CS 1813 – Discrete Mathematics
Lecture 6 CS 1813 – Discrete Mathematics
Lecture 13 CS 1813 – Discrete Mathematics
CS 1813 – Discrete Mathematics
The Foundations: Logic and Proofs
CS201: Data Structures and Discrete Mathematics I
Lecture 16 CS 1813 – Discrete Mathematics
Quizzes CS 1813 – Discrete Mathematics
Mathematical Reasoning
Lecture 9 CS 1813 – Discrete Mathematics
CMSC Discrete Structures
Applied Discrete Mathematics Week 2: Proofs
CS 220: Discrete Structures and their Applications
First Order Logic Rosen Lecture 3: Sept 11, 12.
Mathematical Induction I
MA/CSSE 474 More Math Review Theory of Computation
Lecture 5 CS 1813 – Discrete Mathematics
Lecture 1.3: Predicate Logic
Lecture 3.1: Mathematical Induction
Follow me for a walk through...
Lecture 8 CS 1813 – Discrete Mathematics
Advanced Analysis of Algorithms
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Mathematical Reasoning
1.1 Introduction to Inductive and Deductive Reasoning
Mathematical Induction
Follow me for a walk through...
Lecture 3.1: Mathematical Induction
Lecture 1.3: Predicate Logic
Presentation transcript:

Lecture 11 CS 1813 – Discrete Mathematics Lecture 12 - CS 1813 Discrete Math, University of Oklahoma 1/2/2019 Lecture 11 CS 1813 – Discrete Mathematics Algebra Every Which Way Boolean Algebra Predicate Algebra Software Algebra CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Algebraic Laws of Predicate Calculus Lecture 12 - CS 1813 Discrete Math, University of Oklahoma 1/2/2019 Algebraic Laws of Predicate Calculus x not free in q (x. P(x))  (y. Q(y)) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) y not in f(x) (x. f(x)) = (y. f(y)) {R} (x. f(x)) = (y. f(y)) {R} CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Equational Reasoning with Predicates Lecture 12 - CS 1813 Discrete Math, University of Oklahoma 1/2/2019 Equational Reasoning with Predicates Theorem IX ( (x. P(x))  (y. Q(y)) ) = (x. y. P(x)  Q(y) ) Proof of Theorem IX (x. P(x))  (x. Q(x)) = ((x. P(x)))  (x. Q(x)) {implication} = (x. P(x))  (x. Q(x)) {3.6} = x. ( (P(x))  (x. Q(x)) ) {3.10} = x. ( (x. Q(x))  (P(x)) ) { comm} = x. ( (y. Q(y))  (P(x)) ) {R} = x. y. ( Q(y)  (P(x)) ) {3.10} = x. y. ( (P(x))  Q(y) ) { comm} = x. y. ( P(x)  Q(y) ) {implication} qed CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Equational Reasoning about Software Lecture 12 - CS 1813 Discrete Math, University of Oklahoma 1/2/2019 Equational Reasoning about Software Algebraic laws of sequence construction (x: []) = [x] -- :[] (xs  [ ] ) = (x. ys. xs = (x: ys) ) -- (:) Informally ( x : [x1, x2, …] ) = [x, x1, x2, …] -- (: …) Sequence length – an inductive definition length(x: xs) = 1 + length xs (length).: length[ ] = 0 (length).[] Theorem (len0). xs::[a]. length xs  0 We are going to accept this theorem without proof Think of it as axiomatic CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Zero Length Means Empty Lecture 12 - CS 1813 Discrete Math, University of Oklahoma Zero Length Means Empty 1/2/2019 length :: [a] -> Int length(x: xs) = 1 + length xs (length).: length[ ] = 0 (length).[] Theorem (len 0  [ ]). length xs = 0  xs = [ ] Proof, part 1 (): xs = [ ]  length xs = 0 length xs = length [ ] assumption: xs = [ ] = 0 (length).[] Proof, part 2 (): xs  [ ]  length xs  0 (contrapositive) = length(x: ys) (:) - (x. ys. xs = (x: ys)) = 1 + length ys (length).:  1 + 0 (len0) = 1 2nd grade arith  0 2nd grade arith Corollary (:len). length xs  0  xs  [ ]  x. ys. (xs = (x: ys))  ((length xs) = ((length ys) + 1)) We’ll use this theorem many, many times CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Reasoning about Inductive Equations Lecture 12 - CS 1813 Discrete Math, University of Oklahoma 1/2/2019 Reasoning about Inductive Equations sum :: Num a => [a] -> a Two equations any good sum function should satisfy sum(x: xs) = x + sum xs (sum).: sum[ ] = 0 (sum).[] Pleasant surprise These two equations are enough to completely define sum Just use equational reasoning sum[7, 19, -12] = sum(7: [19, -12]) (:) = 7 + sum([19, -12]) (sum).: = 7 + sum(19: [-12]) (:) = 7 + (19 + sum([-12])) (sum).: = 7 + (19 + sum(-12: [ ])) (:) = 7 + (19 +((-12) + sum[ ])) (sum).: = 7 + (19 + ((-12) + 0)) (sum).[] = 14 2nd-grade arithmetic CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

But What About sum[x1, x2, … xn]? Lecture 12 - CS 1813 Discrete Math, University of Oklahoma 1/2/2019 But What About sum[x1, x2, … xn]? Theorem proved sum[7, 19, -12] = 14 Theorem that could have been proved with essentially the same argument Universe of discourse for addends: a is a type of class Num x1, x2, x3 :: a . sum[x1, x2, x3] = x1 + (x2 + (x3 + 0)) Theorem that should be proved nN. Note: N = {0, 1, 2 …} xk :: a . sum[x1, x2, … xn] = x1+ (x2 + (x3 + … (xn-1 + (xn + 0)) …)) For any fixed value of n, reason as before Proof will have 2n+1 steps But, we want to prove it for all possible values of n, not just those for which we have time to do a proofs with 2n+1 steps Conclusion Relying on a new proof for each n is not good enough Must find a better way CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

The Principle of Mathematical Induction Lecture 12 - CS 1813 Discrete Math, University of Oklahoma 1/2/2019 The Principle of Mathematical Induction Universe of discourse: N = {0, 1, 2, …} Predicate P P(n) is a proposition whenever nN Want to prove: nN. P(n) That is, to prove that the proposition P(n) is True for all natural numbers n Principle of Induction Prove: P(0) Prove: nN. P(n)  P(n+1) Conclude: nN. P(n) THE SINGLE MOST IMPORTANT CONCEPT YOU WILL LEARN THIS YEAR, NEXT YEAR, OR THE YEAR AFTER THAT principle of induction This is a subtle idea. Only P(0) is proven directly. The rest gives a template for constructing a proof of P(1) . . . or P(1000) CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Lecture 12 - CS 1813 Discrete Math, University of Oklahoma 1/2/2019 sum works! P(0) n.P(n)P(n+1) {Ind} n. P(n) Induction Principle of Induction Prove: P(0) Prove: P(n)  P(n+1), n arbitrary Conclude: nN. P(n) Define P(n) to be the following proposition sum[x1, x2, … xn] = x1+ (x2 + (x3 + … (xn-1 + (xn + 0)) …)) What about P(0)? P(0) says this: sum[ ] = 0 True because that is what the equation (sum).0 says Now prove the implication P(n)  P(n+1) The implication is always True when P(n) is False So, we only need to prove that P(n+1) is True when P(n) is True CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Lecture 12 - CS 1813 Discrete Math, University of Oklahoma 1/2/2019 Coup de Grâce P(n +1) is the proposition sum[x1, x2, … xn+1] = x1+ (x2 + (x3 + … (xn + (xn+1 + 0)) …)) sum[x1, x2, … xn+1] = sum(x1 : [x2, … xn+1]) (: …) = x1 + (sum[x2, … xn+1]) (sum).: = x1 + (x2 + (x3 + … (xn + (xn+1 + 0)) …)) P(n) That is sum[x1, x2, … xn+1] = x1 + (x2 + (x3 + … (xn + (xn+1 + 0)) …)) But, that is exactly what P(n+1) says This proves the implication P(n)  P(n+1) Conclude nN. P(n) — by the Principle of Induction That is: nN. sum[x1, x2, … xn] = x1+ (x2 + (x3 + … (xn-1 + (xn + 0)) …)) qed CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Lecture 12 - CS 1813 Discrete Math, University of Oklahoma 1/2/2019 End of Lecture CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page