Section PredicativeNotationRecursion.
Variable sl : nat. (* sl = |x| *)
Hypothesis sl_not_zero : sl <> 0.
Definition comp2n h ln ls := comp 2 0 h ln ls.
Definition comp2s h ln ls := comp 2 sl h ln ls.
Definition comp2Ss h ln ls := comp 2 (S sl) h ln ls.
Definition comp2SSs h ln ls := comp 2 (S (S sl)) h ln ls.
Definition proj2n i := proj 2 0 i.
Definition proj2s i := proj 2 sl i.
Definition proj2Ss i := proj 2 (S sl) i.
Definition proj2SSs i := proj 2 (S (S sl)) i.
Definition f'_cond := comp2Ss Y_e
[comp2n (succ true) nil [proj2n 0];
proj2n 1]
[proj2Ss 3].
Opaque f'_cond.
Variables g : BC.
Hypothesis g_inf  : arities g = ok_arities 1 (sl - 1).
Definition f'_nil := BC_dummies 1 1 2 (sl - 1) g.
Opaque f'_nil.
Variable h0 h1 : BC.
Hypothesis h0_inf : arities h0 = ok_arities 1 (S sl).
Hypothesis h1_inf : arities h1 = ok_arities 1 (S sl).
Definition f'_then :=
comp2Ss h1 [proj2n 1]
([comp2Ss Y_e [proj2n 0; proj2n 1] [proj2Ss 3];
proj2Ss 2 ] ++ (map (proj 2 (S sl)) (seq 4 (sl - 1)))).
Transparent P_e Y_e.
Opaque f'_then.
Definition f'_else :=
comp2Ss h0 [proj2n 1]
([comp2Ss Y_e [proj2n 0; proj2n 1] [proj2Ss 3];
proj2Ss 2 ] ++ (map (proj 2 (S sl)) (seq 4 (sl - 1)))).
Opaque f'_else.
Definition f' : BC :=
rec2 (BC_dummies 0 1 1 (sl - 1) g)
(comp2Ss cond nil [f'_cond; f'_nil; f'_then; f'_else] ).

Lemma cond_simpl: forall (n s : nat) (fn fc ft ff : BC) (l1 l2 : list bs),
sem (comp n s cond nil [fc; fn; ft; ff]) l1 l2 =
match sem fc l1 l2 with
| nil => sem fn l1 l2
| true :: _ => sem ft l1 l2
| false :: _ => sem ff l1 l2
end.