Transcript Slide 1
Discrete Structures
Chapter 5: Sequences, Mathematical Induction, and
Recursion
5.9 General Recursive Definitions and Structural Induction
Erickson
5.9 General Recursive Definitions and
Structural Induction
1
Recursively Defined Sets
• A recursive definition for a set consists of the following
three components:
I.
BASE: A statement that certain objects belong to a
set.
II. RECURSION: A collection of rules indicating how to
form new set objects from those already known
to be in a set.
III. RESTRICTION: A statement that no objects belong to
the set other than those coming from I and II.
Erickson
5.9 General Recursive Definitions and
Structural Induction
2
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.
Erickson
5.9 General Recursive Definitions and
Structural Induction
3
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 S is defined to be the string with no characters. It is
usually denoted by e and is said to have length 0.
Erickson
5.9 General Recursive Definitions and
Structural Induction
4
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.
Erickson
5.9 General Recursive Definitions and
Structural Induction
5
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.
Erickson
5.9 General Recursive Definitions and
Structural Induction
6
Example – pg. 334 # 8
Define a set S recursively as follows:
I. BASE: 1 S, 2 S, 3 S, 4 S, 5 S,
6 S, 7 S, 8 S, 9 S,
II. RECURSION: If s S and t S,
a. s0 S
b. st S
III. 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.
Erickson
5.9 General Recursive Definitions and
Structural Induction
7
Examples – pg. 335
16.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.
17.Give a recursive definition for the set of all
strings of a’s and b’s that contain an odd
number of a’s.
Erickson
5.9 General Recursive Definitions and
Structural Induction
8