Section If.
Variable n : nat.
Variable sig : finType.
Variable pM1 : pTM sig bool n.
Variable F : finType.
Variable pM2 : pTM sig F n.
Variable pM3 : pTM sig F n.
Definition If := Switch pM1 (fun b => if b then pM2 else pM3).

(* Strong version. Usually not needed *)
Lemma If_TerminatesIn' R1 T1 T2 T3 :
pM1 ⊨ R1 ->
projT1 pM1 ↓ T1 ->
projT1 pM2 ↓ T2 ->
projT1 pM3 ↓ T3 ->
projT1 If ↓ (fun tin i => exists i1, T1 tin i1 /\
forall tout (b:bool),
R1 tin (b, tout) ->
if b then exists i2, 1 + i1 + i2 <= i /\ T2 tout i2
else exists i3, 1 + i1 + i3 <= i /\ T3 tout i3).