Example 2
Given a string eโฮฃโ
For example, e=xyz+xy+x()รท
we define:
- vr(e) be the number of occurrences of variables in e
- For example, vr(xyz+xy+x()รท)=6
- op(e) be the number of occurrences operators in e
- For example, op(xyz+xy+x()รท)=3
We define P(e):vr(e)=op(e)+1
Prove that โeโE,P(e)
Base Case
Consider 3 cases:
- e=x
- e=y
- e=z
Then, notice that for all cases vr(e)=1=0+1=op(e)+1
Induction Step
Let e1โ,e2โโE
Suppose P(e1โ),P(e2โ) Induction Hypothesis
Then, given four cases:
- e1โ+e2โ
- Note that vr(e1โ+e2โ)=vr(e1โ)+vr(e2โ)+1=op(e1โ)+op(e2โ)+2โนvr(e1โ+e2โ)=op(e1โ+e2โ)+1
- e1โโe2โ
- Note that vr(e1โโe2โ)=vr(e1โ)+vr(e2โ)+1=op(e1โ)+op(e2โ)+2โนvr(e1โ+e2โ)=op(e1โโe2โ)+1
- e1โรe2โ
- Note that vr(e1โรe2โ)=vr(e1โ)+vr(e2โ)+1=op(e1โ)+op(e2โ)+2โนvr(e1โ+e2โ)=op(e1โรe2โ)+1
- e1โรทe2โ
- Note that vr(e1โรทe2โ)=vr(e1โ)+vr(e2โ)+1=op(e1โ)+op(e2โ)+2โนvr(e1โ+e2โ)=op(e1โรทe2โ)+1
Thus, we get โeโE,P(e)