Professional Documents
Culture Documents
Chapter 3
Chapter 3
Thomas Tran 1
Introduction
• The reason that it is called recursive is that one of the rules used to
define the set mentions the set itself, as we shall see in the following
examples.
CSI3104 - Dr. Thomas Tran 3
Example
• Rule 2: If x is in EV EN , then so is x + 2.
• Rule 3: The only elements in the set EV EN are those that can be
produced from the two rules above.
• Note we just state Rule 3 here once only, and it will be tacitly
presumed in all recursive definitions.
Example
Example
Example
Arithmetic Expressions
Σ = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, +, −, ∗, /, (, )}
(3 + 5) + 6) 2(/8 + 9) (3 + (4−)8)
• Are there more rules? The substrings // and ∗/ are also forbidden.
Are there still more?
• The most natural way of defining a valid AE is by using a recursive
definition, rather than a long list of forbidden substrings.
CSI3104 - Dr. Thomas Tran 13
Recursive Definition of AE
Theorem 2
Theorem 3
• Any arithmetic expression formed by Rule 2 must begin and end with
parentheses or begin with a minus sign, so an expression beginning
or ending with the / symbol cannot be introduced into AE by Rule 2.
• If x does not begin with a / and y does not end with a /, then any AE
formed by any clause in Rule 3 will not begin or end with a /.
Theorem 4
• Suppose that there were some arithmetic expressions that contain the
substring //. Let w be the shortest of these expressions.
• We know that w must be formed by some sequence of applications of
Rule 1, 2, and 3. Our question is: Which was the last rule used in the
production of w? We shall show that it must have been Rule 3(iv).
CSI3104 - Dr. Thomas Tran 19
Propositional Calculus
Σ = {¬, →, (, ), a, b, c, d, ...}
p→
→p
p) → p(