1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall

Similar documents
CSE 20 DISCRETE MATH WINTER

Cardinality of Sets. Washington University Math Circle 10/30/2016

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Winter

Recursive Definitions Structural Induction Recursive Algorithms

Announcements. CS243: Discrete Structures. Strong Induction and Recursively Defined Structures. Review. Example (review) Example (review), cont.

Functions. How is this definition written in symbolic logic notation?

Mathematical Induction

Slides for Faculty Oxford University Press All rights reserved.

Functions. Def. Let A and B be sets. A function f from A to B is an assignment of exactly one element of B to each element of A.

Functions 2/1/2017. Exercises. Exercises. Exercises. and the following mathematical appetizer is about. Functions. Functions

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

2/18/14. Uses for Discrete Math in Computer Science. What is discrete? Why Study Discrete Math? Sets and Functions (Rosen, Sections 2.1,2.2, 2.

Recall our recursive multiply algorithm:

Outline. Introduction. 2 Proof of Correctness. 3 Final Notes. Precondition P 1 : Inputs include

CSC Discrete Math I, Spring Sets

Encoding/Decoding and Lower Bound for Sorting

Recursion and Structural Induction

COT 3100 Spring 2010 Midterm 2

Lamé s Theorem. Strings. Recursively Defined Sets and Structures. Recursively Defined Sets and Structures

Discrete Mathematics Lecture 4. Harper Langston New York University

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

Fall Recursion and induction. Stephen Brookes. Lecture 4

Cardinality Lectures

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

Lecture 3.4: Recursive Algorithms

3. Determine whether f is a function from the set of all bit strings to the set of integers if

Recursion defining an object (or function, algorithm, etc.) in terms of itself. Recursion can be used to define sequences

CS250: Discrete Math for Computer Science. L20: Complete Induction and Proof of Euler s Characterization of Eulerian-Walks

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 10 Notes. Class URL:

Infinity and Uncountability. Countable Countably infinite. Enumeration

Indicate the option which most accurately completes the sentence.

Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets

Inference rule for Induction

Recursion defining an object (or function, algorithm, etc.) in terms of itself. Recursion can be used to define sequences

Let A(x) be x is an element of A, and B(x) be x is an element of B.

Lecture 6,

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

Verifying Safety Property of Lustre Programs: Temporal Induction

Functions and Sequences Rosen, Secs. 2.3, 2.4

Solutions to the Second Midterm Exam

Chapter Summary. Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms

1. (15 points) Solve the decanting problem for containers of sizes 199 and 179; that is find integers x and y satisfying.

Solution : a) C(18, 1)C(325, 1) = 5850 b) C(18, 1) + C(325, 1) = 343

Func%ons (Math) Func%on Defini%ons. Func%ons (Computer Sciences) Func%on = mappings or transforma%ons Math examples:

It is important that you show your work. There are 134 points available on this test.

The Big Picture. Chapter 3

Discrete Structures. Fall Homework3

Computer Science 236 Fall Nov. 11, 2010

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

ASSIGNMENT 4 SOLUTIONS

Recursively Defined Functions

Binomial Coefficient Identities and Encoding/Decoding

Johns Hopkins Math Tournament Proof Round: Point Set Topology

SET DEFINITION 1 elements members

CS1800 Discrete Structures Final Version A

CS228 - Basic Counting and the Pigeonhole Principle

AXIOMS FOR THE INTEGERS

Solutions to Homework 10

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

ALGORITHMS ALGORITHMS ALGORITHMS ALGORITHMS ALGORITHMS ALGORITHMS. Reference: Discrete Math by Rosen

CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010

9.5 Equivalence Relations

Induction and Recursion. CMPS/MATH 2170: Discrete Mathematics

Searching Algorithms/Time Analysis

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8

Mathematical Induction

Chapter 3. Set Theory. 3.1 What is a Set?

Comparing sizes of sets

Extra Practice Problems 2

Discrete Mathematics. Kruskal, order, sorting, induction

1. Chapter 1, # 1: Prove that for all sets A, B, C, the formula

Overview. A mathema5cal proof technique Proves statements about natural numbers 0,1,2,... (or more generally, induc+vely defined objects) Merge Sort

Warmup Problem. Describe how structural induction differs from our MATH 135 notion of induction. 1/25

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan

Today. Types of graphs. Complete Graphs. Trees. Hypercubes.

CSE 21 Spring 2016 Homework 4 Answer Key

10/9/17. Using recursion to define objects. CS 220: Discrete Structures and their Applications

Trees and Tree Encodings

CS 173 [A]: Discrete Structures, Fall 2012 Homework 8 Solutions

Generell Topologi. Richard Williamson. May 6, 2013

Introduction II. Sets. Terminology III. Definition. Definition. Definition. Example

CS525 Winter 2012 \ Class Assignment #2 Preparation

II (Sorting and) Order Statistics

William Linz 1 Department of Mathematics, Texas A&M University, College Station, Texas

Recursion. What is Recursion? Simple Example. Repeatedly Reduce the Problem Into Smaller Problems to Solve the Big Problem

Handout 9: Imperative Programs and State

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

CSCI 136 Data Structures & Advanced Programming. Lecture 9 Fall 2018 Instructors: Bills

ESc101 : Fundamental of Computing

Math Introduction to Advanced Mathematics

Normal Forms for CFG s. Eliminating Useless Variables Removing Epsilon Removing Unit Productions Chomsky Normal Form

Discrete mathematics , Fall Instructor: prof. János Pach

CMPSCI 250: Introduction to Computation. Lecture #1: Things, Sets and Strings David Mix Barrington 22 January 2014

Section 1.7 Sequences, Summations Cardinality of Infinite Sets

Fundamental mathematical techniques reviewed: Mathematical induction Recursion. Typically taught in courses such as Calculus and Discrete Mathematics.

CS70 - Lecture 6. Graphs: Coloring; Special Graphs. 1. Review of L5 2. Planar Five Color Theorem 3. Special Graphs:

Where are we? Compiler. translating source code (C or Java) Programs to assembly language And linking your code to Library code

1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time:

Basic Counting Principles: The Product Rule

Transcription:

CSE 20 https://goo.gl/forms/1o 1KOd17RMoURxjn2 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/

Today's learning goals Explain the steps in a proof by mathematical and/or structural induction Use a recursive definition of a set to determine the elements of the set Write a recursive definition of a given set Use structural induction to prove properties of a recursively defined set Define functions from N to R using recursive definitions

Mathematical induction Rosen p. 311 To show that some statement P(k) is true about all nonnegative integers k, 1. Show that it s true about 0 i.e. P(0) 2. Show Hence conclude P(1),

Mathematical induction* Rosen p. 311 To show that some statement P(k) is true about all nonnegative integers k >= b, 1. Show that it s true about b i.e. P(b) 2. Show Hence conclude P(b+1),

Sizes of (finite) sets If S is a set with exactly n distinct elements, with n a nonnegative integer, then S is finite set and S = n. { } = 0 { 1 } = 1 { 1,1,2,3,8/4} = 3 For A, B finite sets: if A has size n, then the power set of A has size 2 n. An infinite set is a set that is not finite

Recursive definitions, part 1 Rosen Sec 5.3 To specify a function, we need to specify its 1. domain input 2. codomain type of outputs 3. assignment / rule formula, table of values, induction Rosen p. 138

Recursive definitions, part 1 Rosen Sec 5.3 For functions f: N X - define by a (closed-form) formula f(0) f(1) f(2) f(3) f(4) 1. domain N 2. codomain X 3. assignment / rule formula, table of values, induction

Recursive definitions, part 1 Rosen Sec 5.3 For functions f: N X - define by a (closed-form) formula Sequences are functions too! f(0) f(1) f(2) f(3) f(4) a 0 a 1 a 2 a 3 a 4 1. domain N 2. codomain X 3. assignment / rule formula, table of values, induction

Recursive definitions, part 1 Rosen Sec 5.3 For functions f: N X - define by a (closed-form) formula or Basis step: Specify the value of the function at 0 Recursive step: Give a rule for finding its value at an integer from its values at smaller integers Which of the following functions / sequences have recursive definitions? A. n! D. B. 2 n C. 2, -8, 32, -128, 512, E. All of the above.

Recursive definitions, part 2 Rosen Sec 5.3 n! 0! = 1, n! = n (n-1)! for n > 0. 2 n 2 0 = 1, 2 n = 2 (2 n-1 ) for n > 0. 2, -8, 32, -128, 512, a 0 = 2, a n = -4 a n-1 for n > 0.,, and for n>1.

Extra mathematical induction practice n 2 < n! for all n greater than or equal to

Recursive definitions, part 2 Rosen Sec 5.3 Define a set S by { } { x P(x) } Recursive definition: Basis step Specify initial collection of elements. Recursive step Provide rules for forming new elements in the set from those already known to be in the set.

Example: { x x is an int, x > 3}

Recursive definitions, part 2 Rosen Sec 5.3 Let S be the subset of the set of integers defined recursively by Basis step: Recursive step: If, then. What's an equivalent description of this set? A. All positive multiples of 2. B. All positive even integers. C. All positive odd integers. D. All integers. E. None of the above.

Recursive definitions, part 2 Rosen Sec 5.3 page 349 The set of bit strings {0,1} * is defined recursively by Basis step: where is the empty string. Recursive step: If, then and. Also known as binary sequences

Recursive definitions, part 2 Rosen Sec 5.3 page 349 The set of bit strings {0,1} * is defined recursively by Basis step: where is the empty string. Recursive step: If, then and. Which of the following are not bit strings? A. B. 1 C. 000 D. 010101 E. 101100111000111100001111100000111 Also known as binary sequences

Recursive definitions in CS Strings encode integers, everything else Data structures linked lists, trees, graphs How do we prove a fact is true about all strings?

Structural induction Rosen p. 354 To show that some statement P(k) is true about all elements of a recursively defined set S, 1. Show that it's true for each element specified in the basis step to be part of S. 2. Show that if it's true for each of the elements used to construct new elements in recursive step, then it holds for these new elements.

Structural induction, example Rosen Sec 5.3 Define the subset S of the set of all bit strings, {0,1} *, by Basis step: where is the empty string. Recursive step: If, then each of

Structural induction, example Rosen Sec 5.3 Define the subset S of the set of all bit strings, {0,1} *, by Basis step: where is the empty string. Recursive step: If, then each of Claim: Every element in S has an equal number of 0s and 1s.

Structural induction, example Rosen Sec 5.3 Define the subset S of the set of all bit strings, {0,1} *, by Basis step: where is the empty string. Recursive step: If, then each of Claim: Every element in S has an equal number of 0s and 1s. Proof: Basis step WTS that empty string has equal # of 0s and 1s Recursive step Let w be an arbitrary element of S. Assume, as the IH that w has equal # of 0s and 1s. WTS that 10w, 01w each have equal # of 0s, 1s.

Recursive definitions, part 3 Rosen Sec 5.3 Define a function f: S X by specifying f(a) when a is in the basis collection of elements of S giving a formula for computing f(x) when x is built from other elements a 1, a 2 etc. based on values of f(a 1 ), f(a 2 ), etc. 1. domain S, a recursively defined set 2. codomain X 3. assignment / rule recursively defined

Recursive definitions, part 3 Rosen Sec 5.3 Define a function f: S X by specifying f(a) when a is in the basis collection of elements of S giving a formula for computing f(x) when x is built from other elements a 1, a 2 etc. based on values of f(a 1 ), f(a 2 ), etc. Example: how do you define the length function l: {0,1}* N?

Reminders Office hours may be shifted check Google calendar HW5 due Saturday night Next class: more applications + variants of induction