CSE 311 Foundations of Computing I

Slides:



Advertisements
Similar presentations
Recursive Definitions and Structural Induction
Advertisements

Introduction to CS Theory Lecture 2 – Discrete Math Revision Piotr Faliszewski
Induction and Recursion. Odd Powers Are Odd Fact: If m is odd and n is odd, then nm is odd. Proposition: for an odd number m, m k is odd for all non-negative.
10.1 CompSci 102© Michael Frank Today’s topics RecursionRecursion –Recursively defined functions –Recursively defined sets –Structural Induction Reading:
CSE115/ENGR160 Discrete Mathematics 04/03/12 Ming-Hsuan Yang UC Merced 1.
Recursive Definitions Rosen, 3.4. Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
CSE 321 Discrete Structures Winter 2008 Lecture 12 Induction.
CSE115/ENGR160 Discrete Mathematics 03/31/11
Costas Busch - RPI1 Mathematical Preliminaries. Costas Busch - RPI2 Mathematical Preliminaries Sets Functions Relations Graphs Proof Techniques.
Lecture Recursive Definitions. Fractals fractals are examples of images where the same elements is being recursively.
Courtesy Costas Busch - RPI1 Mathematical Preliminaries.
1 Section 3.4 Recursive Definitions. 2 Recursion Recursion is the process of defining an object in terms of itself Technique can be used to define sequences,
Induction and recursion
Recursive Definitions and Structural Induction
Discrete Mathematics CS 2610 March 26, 2009 Skip: structural induction generalized induction Skip section 4.5.
Induction and recursion
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 4 Induction and Recursion 歐亞書局.
Chapter 4: Induction and Recursion
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.
CSE 311 Foundations of Computing I Lecture 17 Structural Induction: Regular Expressions, Regular Languages Autumn 2011 CSE 3111.
Mathematical Preliminaries. Sets Functions Relations Graphs Proof Techniques.
Chapter 5 With Question/Answer Animations. Section 5.1.
CSE 311 Foundations of Computing I Lecture 17 Structural Induction Spring
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.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
1 Recursive Definitions and Structural Induction CS 202 Epp section ??? Aaron Bloomfield.
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
1 CMSC 341 Math Review. 2 Exponents Identities (X A ) B = X AB X A * X B = X A+B X A / X B = X A-B X A + X B  X A+B.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
CSE 311: Foundations of Computing Fall 2013 Lecture 18: Structural induction, regular expressions.
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
CSE 311 Foundations of Computing I Lecture 19 Recursive Definitions: Context-Free Grammars and Languages Autumn 2012 CSE
6/12/2016 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(2) Mathematical Induction & Recursion Dr.Saad Alabbad Department of.
Chapter 5 With Question/Answer Animations 1. Chapter Summary Mathematical Induction - Sec 5.1 Strong Induction and Well-Ordering - Sec 5.2 Lecture 18.
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
CSE 311 Foundations of Computing I Lecture 20 Context-Free Grammars and Languages Autumn 2012 CSE
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
(Proof By) Induction Recursion
Chapter 4: Induction and Recursion
CSE 311 Foundations of Computing I
CS2210:0001Discrete Structures Induction and Recursion
CSE 311 Foundations of Computing I
Induction and Recursion
CSE 311 Foundations of Computing I
Discrete Structures for Computer Science
Discrete Structures for Computer Science
CSE 311: Foundations of Computing
CSE 311 Foundations of Computing I
CSE 311: Foundations of Computing
CSCI-2400 Models of Computation.
CSE 321 Discrete Structures
CSE 321 Discrete Structures
CSE 321 Discrete Structures
Chapter 4 Induction and Recursion
CSE 321 Discrete Structures
CSE 311 Foundations of Computing I
Mathematical Induction
Math/CSE 1019: Discrete Mathematics for Computer Science Fall 2011
CSE 321 Discrete Structures
CSE 321 Discrete Structures
Chapter 4 (Part 2): Mathematical Reasoning, Induction & Recursion
CSE 321 Discrete Structures
CSE 311 Foundations of Computing I
CSE 311 Foundations of Computing I
Presentation transcript:

CSE 311 Foundations of Computing I Lecture 17 Recursive Definitions and Structural Induction Autumn 2012 Autumn 2012 CSE 311

Announcements Reading assignments Homework 6 posted Today: 5.3 7th Edition 4.3 6th Edition 3.4 5th Edition (not all there) Homework 6 posted Midterm Friday, Nov 2 Closed book, closed notes Practice midterm available on the Web Extra office hours Thursday (midterm review) 3:30 pm, Dan Suciu, Gowen 201 4:30 pm, Richard Anderson, Gowen 201 Autumn 2012 CSE 311

Highlights from last lecture Strong Induction Strong Induction proof layout: By induction we will show that P(n) is true for every n≥0 Base Case: Prove P(0) Inductive Hypothesis: Assume that for some arbitrary integer k ≥ 0, P(j) is true for every j from 0 to k Inductive Step: Prove that P(k+1) is true using Inductive Hypothesis that P(j) is true for all values  k Conclusion: Result follows by induction P(0)  k ((P(0)  P(1)  P(2)  …  P(k))  P(k+1))   n P(n) Autumn 2012 CSE 311

Fibonacci Numbers f0 = 0; f1 = 1; fn = fn-1 + fn-2 Autumn 2012 CSE 311

Bounding the Fibonacci Numbers Theorem: 2n/2-1  fn for n  1 Base cases: 21/2 -1  1 = f1; 22/2-1 = 1 = f2 Inductive step: Assume that for some k  2, P(1), P(2), . . .,P(K) fk+1 = fk + fk-1  2k/2-1 + 2(k-1)/2 – 1 > 2(k-1)/2-1 + 2(k-1)/2 – 1 = 2∙2(k-1)/2-1 = 2(k+1)/2 – 1 Autumn 2012 CSE 311

Recursive Definitions of Sets Basis step: 0  S Recursive step: if x  S, then x + 2  S Exclusion rule: Every element in S follows from basis steps and a finite number of recursive steps Autumn 2012 CSE 311

Recursive definitions of sets Basis: 6  S; 15  S; Recursive: if x, y  S, then x + y  S; Basis: [1, 1, 0]  S, [0, 1, 1]  S; Recursive: if [x, y, z]  S,  in R, then [ x,  y,  z]  S if [x1, y1, z1], [x2, y2, z2]  S then [x1 + x2, y1 + y2, z1 + z2]  S Powers of 3 Autumn 2012 CSE 311

Recursive Definitions of Sets: General Form Basis step: Some specific elements are in S Recursive step: Given some existing named elements in S some new objects constructed from these named elements are also in S. Exclusion rule: Every element in S follows from basis steps and a finite number of recursive steps Autumn 2012 CSE 311

Strings An alphabet  is any finite set of characters. The set * of strings over the alphabet  is defined by Basis:   * ( is the empty string) Recursive: if w  *, x  , then wx  * Autumn 2012 CSE 311

Palindromes Palindromes are strings that are the same backwards and forwards Basis:  is a palindrome and any a ∈  is a palindrome Recursive step: If p is a palindrome then apa is a palindrome for every a ∈  Autumn 2012 CSE 311

All binary strings with no 1’s before 0’s Autumn 2012 CSE 311

Function definitions on recursively defined sets len () = 0; len (wa) = 1 + len(w); for w  *, a   Reversal: R =  (wa)R = awR for w  *, a   Concatenation: x •  = x for x  * x • wa = (x • w)a for x, w  *, a   Autumn 2012 CSE 311

Rooted Binary trees Basis: • is a rooted binary tree Recursive Step: If and are rooted binary trees then so is: T2 T1 T2 T1 Autumn 2012 CSE 311

Functions defined on rooted binary trees size(•)=1 size( ) = 1+size(T1)+size(T2) height(•)=0 height( )=1+max{height(T1),height(T2)} T1 T2 T1 T2 Autumn 2012 CSE 311