90 likes | 301 Views
Discrete Structures. Chapter 5: Sequences, Mathematical Induction, and Recursion 5.9 General Recursive Definitions and Structural Induction. Recursively Defined Sets. A recursive definition for a set consists of the following three components:
E N D
Discrete Structures Chapter 5: Sequences, Mathematical Induction, and Recursion 5.9 General Recursive Definitions and Structural Induction 5.9 General Recursive Definitions and Structural Induction
Recursively Defined Sets • A recursive definition for a set consists of the following three components: • BASE: A statement that certain objects belong to a set. • RECURSION: A collection of rules indicating how to form new set objects from those already known to be in a set. • RESTRICTION: A statement that no objects belong to the set other than those coming from I and II. 5.9 General Recursive Definitions and Structural Induction
Example – pg. 334 # 1b. • Consider the set of Boolean expressions defined below. Give derivations showing that ((p q) ~((p ~s) r)) is a Boolean expression over the English alphabet {a, b, c, …, x, y, z}. I. BASE: Each symbol of the alphabet is a Boolean expression. II. RECURSION: If P and Q are Boolean expressions, then so are (a) (P Q) and (b) (P Q) and (c) ~P. III. RESTRICTION: There are no Boolean expression over the alphabet other than those obtained from Iand II. 5.9 General Recursive Definitions and Structural Induction
Definitions Let S be a finite set with at least one element. • String over S A string over S is a finite sequence of elements from S. • Characters The elements of S are called characters of the string. • Length The length of a string is the number of characters it contains. • Null String over S The null strong over Sis defined to be the string with no characters. It is usually denoted by e and is said to have length 0. 5.9 General Recursive Definitions and Structural Induction
Definition • Structural Induction When a set has been defined recursively, a version of mathematical induction, called structural induction, can be used to prove that every object in the set satisfies a given property. 5.9 General Recursive Definitions and Structural Induction
Structural Induction for Recursively Defined Sets Let S be a set that has been defined recursively, and consider a property that objects in S may or may not satisfy. To prove that every object in S satisfies the property: 1. Show that each object in the BASE for S satisfies the property; 2. Show that for each rule in the RECURSION, if the rule is applied to the objects in S that satisfy the property, then the objects defined by the rule also satisfy the property. Because no objects other than those obtained through the BASE and RECURSION conditions are contained in S, it must be the case that every object in S satisfies the property. 5.9 General Recursive Definitions and Structural Induction
Example – pg. 334 # 8 Define a set S recursively as follows: • BASE: 1 S, 2 S, 3 S, 4 S, 5 S, 6 S, 7 S, 8 S, 9 S, • RECURSION: If s S and t S, a. s0 S b. st S • RESTRICTION: Nothing is in S other than objects defined in I and II above. • Use structural induction to prove that no string in S represents an integer with a leading zero. 5.9 General Recursive Definitions and Structural Induction
Examples – pg. 335 • Give a recursive definition for the set of all strings of 0’s and 1’s for which all the 0’s precede all the 1’s. • Give a recursive definition for the set of all strings of a’s and b’s that contain an odd number of a’s. 5.9 General Recursive Definitions and Structural Induction