and Structural Induction

Slides:



Advertisements
Similar presentations
Chapter Three: Closure Properties for Regular Languages
Advertisements

22C:19 Discrete Structures Induction and Recursion Spring 2014 Sukumar Ghosh.
22C:19 Discrete Structures Induction and Recursion Fall 2014 Sukumar Ghosh.
Recursive Definitions and Structural Induction
CPSC 668Set 10: Consensus with Byzantine Failures1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
CSE115/ENGR160 Discrete Mathematics 04/03/12 Ming-Hsuan Yang UC Merced 1.
Self-Reference - Induction Cmput Lecture 7 Department of Computing Science University of Alberta ©Duane Szafron 1999 Some code in this lecture is.
CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)
What is the best way to start? 1.Plug in n = 1. 2.Factor 6n 2 + 5n Let n be an integer. 4.Let n be an odd integer. 5.Let 6n 2 + 5n + 4 be an odd.
1 More Applications of the Pumping Lemma. 2 The Pumping Lemma: Given a infinite regular language there exists an integer for any string with length we.
1 Recitation 10. Induction Introduction. Induction is useful in proving properties of recursive algorithms, like their execution times. It is also the.
Chapter 10 Sequences, Induction, and Probability Copyright © 2014, 2010, 2007 Pearson Education, Inc Mathematical Induction.
Prof. Busch - LSU1 More Applications of the Pumping Lemma.
Copyright © 2007 Pearson Education, Inc. Slide 8-1.
22C:19 Discrete Math Induction and Recursion Fall 2011 Sukumar Ghosh.
Induction and recursion
Recursive Definitions and Structural Induction
Sequences and Series (T) Students will know the form of an Arithmetic sequence.  Arithmetic Sequence: There exists a common difference (d) between each.
CSE 311 Foundations of Computing I Lecture 15 Recursive Definitions and Structural Induction Autumn 2011 CSE 3111.
CSE 311 Foundations of Computing I Lecture 16 Recursively Defined Sets and Structural Induction Spring
Section 5.3. Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction.
Module #14: Recursion Rosen 5 th ed., §§ In this class, we will study recursion, one of the most important topics in computer science. In the last.
4.3 Recursive Definitions and Structural Induction Sometimes it is difficult to define an object explicitly. However, it may be easy to define this object.
Reading and Writing Mathematical Proofs Spring 2015 Lecture 4: Beyond Basic Induction.
Induction Proof. Well-ordering A set S is well ordered if every subset has a least element. [0, 1] is not well ordered since (0,1] has no least element.
Theory of Computation, Feodor F. Dragan, Kent State University 1 TheoryofComputation Spring, 2015 (Feodor F. Dragan) Department of Computer Science Kent.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
1 Recursive Definitions and Structural Induction CS 202 Epp section ??? Aaron Bloomfield.
Classifications LanguageGrammarAutomaton Regular, right- linear Right-linear, left-linear DFA, NFA Context-free PDA Context- sensitive LBA Recursively.
1Computer Sciences Department. Objectives Recurrences.  Substitution Method,  Recursion-tree method,  Master method.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
CSE 311: Foundations of Computing Fall 2013 Lecture 18: Structural induction, regular expressions.
Chapter 5 With Question/Answer Animations 1. Chapter Summary Mathematical Induction - Sec 5.1 Strong Induction and Well-Ordering - Sec 5.2 Lecture 18.
Section Recursion 2  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
1 Recursive Definitions and Structural Induction CS/APMA 202 Rosen section 3.4 Aaron Bloomfield.
Section Recursion  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
CSE 311 Foundations of Computing I Lecture 15 Strong Induction and Recursive Definitions Spring
Mathematical Induction. The Principle of Mathematical Induction Let S n be a statement involving the positive integer n. If 1.S 1 is true, and 2.the truth.
Recursive Definitions & Structural Induction: Selected Exercises
1 Mathematical Induction An inductive proof has three parts: –Basis case –Inductive hypothesis –Inductive step Related to recursive programming.
CS2210:0001Discrete Structures Induction and Recursion
Discrete Structures for Computer Science
Proofs, Recursion and Analysis of Algorithms
Mathematics for Computer Science MIT 6.042J/18.062J
Mathematics for Computer Science MIT 6.042J/18.062J
Computational Processes
Mathematics for Computer Science MIT 6.042J/18.062J
CS 154, Lecture 4: Limitations on DFAs (I),
Lecture 7 All-Pairs Shortest Paths
Asymptotics & Stirling’s Approximation
Asymptotics & Stirling’s Approximation
Mathematics for Computer Science MIT 6.042J/18.062J
Mathematics for Computer Science MIT 6.042J/18.062J
and Structural Induction II
Mathematics for Computer Science MIT 6.042J/18.062J
and Structural Induction II
and Structural Induction
and Structural Induction II
Mathematics for Computer Science MIT 6.042J/18.062J
and Structural Induction
Computational Processes
Asymptotics & Stirling’s Approximation
Mathematics for Computer Science MIT 6.042J/18.062J
Asymptotics & Stirling’s Approximation
Truth and Proof Math vs. Reality Propositions & Predicates
Asymptotics & Stirling’s Approximation
Math/CSE 1019: Discrete Mathematics for Computer Science Fall 2011
and Structural Induction
CSE 311 Foundations of Computing I
Presentation transcript:

and Structural Induction Mathematics for Computer Science MIT 6.042J/18.062J Recursive Definitions and Structural Induction Copyright © Albert Meyer, 2002. Prof. Albert Meyer & Dr. Radhika Nagpal

Build something from a simpler version of the same thing: Recursive Definitions Build something from a simpler version of the same thing: Base case(s) that don’t depend on anything else Induction (Construction) case(s) that depend on simpler cases

Example Definition: set E Define set E  Z, recursively: 0  E Base Case

Example Definition: set E Define set E  Z, recursively: 0  E Base Case E : 0

Example Definition: set E Define set E  Z, recursively: 0  E Base Case If n  E, then n + 2  E Induction case If n  E, then -n  E Induction case E : 0 , 0+2

Example Definition: set E Define set E  Z, recursively: 0  E If n  E, then n + 2  E If n  E, then -n  E E : 0, 2, 2+2 , (2+2)+2

Example Definition: set E Define set E  Z, recursively: 0  E If n  E, then n + 2  E If n  E, then -n  E E : 0, 2, 4, 6, … All even numbers Also, -2, -4, -6, …

Example Definition: set E So, E contains the even integers

Example Definition: set E So, E contains the even integers Anything Else?

Example Definition: set E So, E contains the even integers Anything Else? No!

Recursive Definition: Extremal Clause So, E contains the even integers Anything Else? No! 0  E If n  E, then n + 2  E If n  E, then -n  E

Recursive Definition: Extremal Clause So, E contains the even integers Anything Else? No! 0  E If n  E, then n + 2  E If n  E, then -n  E Implicit part of recursive definition: THAT’S ALL!

Example Definition: set E So E is exactly: The Even Integers

Define set of strings, S  {a, b}* Another Example Define set of strings, S  {a, b}* l  S, (the empty string) If x, y  S, then the following are in S: axb bxa xy

Proof by Structural Induction on S Lemma: Every x in S has an equal number of a’s and b’s.

Structural Induction on S Proof: Let EQ ::= {strings with equal # of a’s and b’s} P(s) ::= s  S  s  EQ

Structural Induction on S Proof: Let EQ ::= {strings with equal # of a’s and b’s} P(s) ::= s  S  s  EQ Base Case: s = l. 0 a’s and 0 b’s. OK

Structural Induction on S Inductive Step: Assume: P(x) and P(y) To Prove: P(axb), P(bxa), and P(xy)

Structural Induction on S Inductive Step: Assume: P(x) and P(y) To Prove: P(axb), P(bxa), and P(xy) Case 1: axb has k + 1 a’s and b’s if x has k of each. OK

Structural Induction on S Inductive Step: Assume: P(x) and P(y) To Prove: P(axb), P(bxa), and P(xy) Case 2: bxa SAME

Structural Induction on S Inductive Step: Assume: P(x) and P(y) To Prove: P(axb), P(bxa), and P(xy) Case 3: xy has kx + ky of each. OK

Theorem: S = EQ Show by strong induction on length of string in EQ. Proof in Notes 5.

In-Class Problem Problem 1

Recursive Data Types Rooted Binary Trees

Defined recursively as follows: A single node r is in T: Rooted Binary Trees Defined recursively as follows: A single node r is in T:

t t t t’ Rooted Binary Trees If t, t’ are RBTs, then the following are RBTs Makeleft(t) t Makeright(t) t Makeboth(t,t’) t t’

A Rooted Binary Tree Example