(1) S_0 = ∅
(2) S_{i+1} = {true, false, 0}
∪ {succ t1, pred t1, iszero t1 | t1 in Si}
∪ {if t1 then t2 else t3 | t1, t2, t3 in S_i}
(3) S = ⋃ {S_i} (starting with i = 0)$
This is a way of describing the language inductively using a set builder notation. Each larger indexed S
will contain sub-terms of smaller indexed S
terms. Let's work it out to give you an idea.
We know that S_0
is an empty set so it doesn't contain any terms. S_1
is a set of constants.
S_1 = {true, false, 0}
By putting i = 1 in equation (2) we can generate S_2
S_2 = {true, false, 0}
∪ {succ t1, pred t1, iszero t1 | t1 in S_1}
∪ {if t1 then t2 else t3 | t1, t2, t3 in S_1}
So S_2
would be a set containing terms:
S_2 = { true, false, 0,
succ true, pred true, iszero true, succ false, pred false,
iszero false, succ zero, pred zero, iszero zero,
if true then true else true, if true then true else t3 false,
if true then true else t3 zero, if true then false else t3 true,
..., if false then zero else zero, if zero then zero else zero}
Notice, the sub-terms of terms in S_2 can only be terms from S_1 i.e. constants. Hence there will only be one occurrence of succ, pred, iszero and if.
S_3
will contain the terms such that terms of S_2
and S_1
are its sub-terms. So it can have 1 or 2 occurrences of succ, pred, iszero and if.
Essentially you can think of t1
as a hole in the S_{i+1}
template where
you can plug in S_{i}
terms. Finally, the complete language S
is the union of all such S_i terms.