| < Free Open Study > |
|
If
if t1 then t2 else t3 →* v,
then either t1 →* true and t2 →* v or t1 →* false and t3 →* v. Moreover, the evaluation sequences for t1 and t2 or t3 are strictly shorter than the given evaluation sequence. (And similarly for the other term constructors.)
Proof: By induction on the length of the given evaluation sequence. Since a condition is not a value, there must be at least one step of evaluation. Proceed by case analysis on the final rule used in this step (note that it must be one of the If rules).
Case E-IF: |
|
By the induction hypothesis, either and t2 →* v or and t3 →* v. Adding the initial step to the derivation of or yields the desired result. It is easy to check that the resulting evaluation sequences are shorter than the original.
Case E-IFTRUE: | if true then t2 else t2 → t2 →* v |
Immediate.
Case E-IFFALSE: | if false then t2 else t2 →t3 →* v |
Immediate.
| < Free Open Study > |
|