Beruflich Dokumente
Kultur Dokumente
Obaid Ullah 2
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.
Obaid Ullah 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.
Obaid Ullah 4
Obaid Ullah 6
Example
Obaid Ullah 8
Example
Obaid Ullah 10
Example
Arithmetic Expressions
Σ = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, +, −, ∗, /, (, )}
Obaid Ullah 12
(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.
Obaid Ullah 13
Recursive Definition of AE
Obaid Ullah 14
Obaid Ullah 16
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 /.
Obaid Ullah 18
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).
Obaid Ullah 19
Obaid Ullah 20
Propositional Calculus
Σ = {¬, →, (, ), a, b, c, d, ...}
p→
→p
p) → p(