Require Import Bool Arith List.
Require Import BellantoniCook.Lib BellantoniCook.Bitstring BellantoniCook.MultiPoly BellantoniCook.Cobham BellantoniCook.CobhamLib BellantoniCook.CobhamUnary BellantoniCook.BC BellantoniCook.BCLib BellantoniCook.BCUnary.

(*
Add n normal arguments and s safe argument at the beginnings
*)
Definition BC_dummies (n n0 s s0 : nat)(e : BC) : BC :=
  comp (n+n0) (s+s0) e (map (proj (n+n0) 0)      (seq n        n0))
                       (map (proj (n+n0) (s+s0)) (seq (n+n0+s) s0)).

Lemma dummies_inf : forall e n n0 s s0,
  arities e = ok_arities n0 s0 ->
  arities (BC_dummies n n0 s s0 e) = ok_arities (n + n0) (s + s0).
Proof.
(* Goal: forall (e : BC) (n n0 s s0 : nat) (_ : @eq Arities (arities e) (ok_arities n0 s0)), @eq Arities (arities (BC_dummies n n0 s s0 e)) (ok_arities (Init.Nat.add n n0) (Init.Nat.add s s0)) *)
destruct n0 as [ | n0]; simpl.

(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities O s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) | error_proj n0 n1 n2 => error_comp (error_proj n0 n1 n2) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn O) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) then ok_arities (Init.Nat.add n O) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) end (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0)) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
intros s s0 H.
(* Goal: @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) | error_proj n0 n1 n2 => error_comp (error_proj n0 n1 n2) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn O) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) then ok_arities (Init.Nat.add n O) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) end (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0)) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
rewrite H; simpl.
(* Goal: @eq Arities (if andb (andb (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0)))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) then ok_arities (Init.Nat.add n O) (Init.Nat.add s s0) else error_comp (ok_arities O s0) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0)))) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0)) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
rewrite map_length, seq_length, <- beq_nat_refl; simpl.
case_eq (forallb
      (fun se : BC => aeq (arities se) (ok_arities (n + 0) (s + s0)))
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
      (map (proj (n + 0) (s + s0)) (seq (n + 0 + s) s0))); intro H0; trivial.
(* Goal: @eq Arities (error_comp (ok_arities O s0) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0)))) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0)) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
rewrite forallb_forall_conv in H0.
(* Goal: @eq Arities (error_comp (ok_arities O s0) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0)))) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0)) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
destruct H0 as (e' & H1 & H2).
(* Goal: @eq Arities (error_comp (ok_arities O s0) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0)))) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0)) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
rewrite in_map_iff in H1.
(* Goal: @eq Arities (error_comp (ok_arities O s0) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0)))) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0)) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
destruct H1 as (i & H3 & H4).
(* Goal: @eq Arities (error_comp (ok_arities O s0) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0)))) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0)) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
rewrite in_seq_iff in H4.
(* Goal: @eq Arities (error_comp (ok_arities O s0) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0)))) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0)) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
rewrite <- H3 in H2.
(* Goal: @eq Arities (error_comp (ok_arities O s0) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0)))) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0)) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
contradict H2; simpl.
(* Goal: not (@eq bool (aeq (if match Init.Nat.add (Init.Nat.add n O) (Init.Nat.add s s0) with | O => false | S m' => Nat.leb i m' end then ok_arities (Init.Nat.add n O) (Init.Nat.add s s0) else error_proj (Init.Nat.add n O) (Init.Nat.add s s0) i) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0))) false) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
case_eq (n + 0 + (s + s0)).
(* Goal: le x0 n0 *)
omega.
(* Goal: forall (n0 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n O) (Init.Nat.add s s0)) (S n0)), not (@eq bool (aeq (if Nat.leb i n0 then ok_arities (Init.Nat.add n O) (Init.Nat.add s s0) else error_proj (Init.Nat.add n O) (Init.Nat.add s s0) i) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0))) false) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
intros n0 H5.
(* Goal: not (@eq bool (aeq (if Nat.leb i n0 then ok_arities (Init.Nat.add n O) (Init.Nat.add s s0) else error_proj (Init.Nat.add n O) (Init.Nat.add s s0) i) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0))) false) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
case_eq (leb i n0); intro H6; simpl.
(* Goal: not (@eq bool (andb (Nat.eqb (Init.Nat.add n (S n0)) (Init.Nat.add n (S n0))) (Nat.eqb (Init.Nat.add s (S s0)) (Init.Nat.add s (S s0)))) false) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
do 2 rewrite <- beq_nat_refl.
(* Goal: not (@eq bool (andb true true) false) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
simpl; congruence.
(* Goal: le x0 n0 *)
rewrite leb_iff_conv in H6; omega.

(* Goal: @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) | error_proj n0 n1 n2 => error_comp (error_proj n0 n1 n2) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn O) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) then ok_arities (Init.Nat.add n O) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@nil Arities) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n O) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n O) s) s0))) end (ok_arities (Init.Nat.add n O) (Init.Nat.add s s0)) *)
(* Goal: forall (s s0 : nat) (_ : @eq Arities (arities e) (ok_arities (S n0) s0)), @eq Arities match arities e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | error_proj n1 n2 n3 => error_comp (error_proj n1 n2 n3) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (Nat.eqb hs (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0) else error_comp (ok_arities hn hs) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) (seq (Init.Nat.add (Init.Nat.add n (S n0)) s) s0))) end (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s s0)) *)
intros s [ | s0] H; simpl; rewrite H; simpl.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite map_length, seq_length, <- beq_nat_refl.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: not (@eq bool (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb i m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (n + S n0 + 0).
(* Goal: forall _ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) O, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H0.
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
contradict H0.
(* Goal: le x0 n0 *)
omega.
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intros n1 H0.
(* Goal: @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (leb n n1); intro H1.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: not (@eq bool (andb (Nat.eqb (Init.Nat.add n (S n0)) (Init.Nat.add n (S n0))) true) false) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite <- beq_nat_refl.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite leb_iff in H1.
case_eq (forallb (fun ne : BC => aeq (arities ne) (ok_arities (n + S n0) 0))
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
      (map (proj (n + S n0) 0) (seq (S n) n0))); intro H2.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: @eq Arities (if andb false true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite forallb_forall_conv in H2.
(* Goal: @eq Arities (if andb false true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
destruct H2 as (e' & H3 & H4).
(* Goal: @eq Arities (if andb false true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite in_map_iff in H3.
(* Goal: @eq Arities (if andb false true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
destruct H3 as (i & H5 & H6).
(* Goal: @eq Arities (if andb false true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite in_seq_iff in H6.
(* Goal: @eq Arities (if andb false true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite <- H5 in H4.
(* Goal: @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (S n1)), @eq Arities (if andb (aeq (if Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n1 then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n1 then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
contradict H4.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: not (@eq bool (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb i m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (n + S n0 + 0).
(* Goal: forall _ : @eq bool (Nat.leb i n2) true, not (@eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (Nat.leb i n2) false, not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
congruence.
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), not (@eq bool (aeq (if Nat.leb i n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intros n2 H7.
(* Goal: not (@eq bool (aeq (if Nat.leb i n2 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (leb i n2).
(* Goal: forall _ : @eq bool (Nat.leb i n2) true, not (@eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (Nat.leb i n2) false, not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intros _.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: not (@eq bool (andb (Nat.eqb (Init.Nat.add n (S n0)) (Init.Nat.add n (S n0))) true) false) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite <- beq_nat_refl.
(* Goal: not (@eq bool (andb true true) false) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
simpl; congruence.
(* Goal: forall _ : @eq bool (Nat.leb i n2) false, not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H8.
(* Goal: not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite leb_iff_conv in H8.
(* Goal: le x0 n0 *)
omega.
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite leb_iff_conv in H1.
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
contradict H1.
(* Goal: le x0 n0 *)
omega.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) true) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) true then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O) else error_comp (ok_arities (S n0) O) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@nil Arities)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s O)) *)
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (Nat.eqb s0 (@length BC (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb n m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
do 2 rewrite map_length, seq_length, <- beq_nat_refl.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: not (@eq bool (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb i m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (n + S n0 + 0).
(* Goal: forall _ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) O, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H0.
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
contradict H0.
(* Goal: le x0 n0 *)
omega.
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intros n1 H0.
(* Goal: @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (leb n n1).
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H1.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite leb_iff in H1.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (aeq (ok_arities (n + S n0) 0) (ok_arities (n + S n0) 0)).
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H2.
case_eq (forallb (fun ne : BC => aeq (arities ne) (ok_arities (n + S n0) 0))
      (map (proj (n + S n0) 0) (seq (S n) n0))).
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H3.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: not (@eq bool (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb i m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) i) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (n + S n0 + (s + S s0)).
(* Goal: forall _ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) O, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (S n1)), @eq Arities (if andb (aeq (if Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n1 then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n1 then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H4.
(* Goal: @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (S n1)), @eq Arities (if andb (aeq (if Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n1 then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n1 then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
contradict H4.
(* Goal: le x0 n0 *)
omega.
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (S n1)), @eq Arities (if andb (aeq (if Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n1 then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n1 then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intros n2 H4.
(* Goal: @eq Arities (if andb (aeq (if Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2 then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2 then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (leb (n + S n0 + s) n2).
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H5.
(* Goal: @eq Arities (if andb (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (aeq (ok_arities (n + S n0) (s + S s0)) (ok_arities (n + S n0) (s + S s0))).
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H6.
case_eq (forallb
      (fun se : BC => aeq (arities se) (ok_arities (n + S n0) (s + S s0)))
      (map (proj (n + S n0) (s + S s0)) (seq (S (n + S n0 + s)) s0))).
(* Goal: forall _ : @eq bool (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) false, @eq Arities (if andb true false then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H7.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: forall _ : @eq bool (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) false, @eq Arities (if andb true false then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H7.
(* Goal: @eq Arities (if andb true false then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite forallb_forall_conv in H7.
destruct H7 as (e'  & H8 & H9).
(* Goal: @eq Arities (if andb true false then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite in_map_iff in H8.
(* Goal: @eq Arities (if andb true false then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
destruct H8 as (i & H10 & H11).
(* Goal: @eq Arities (if andb true false then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite in_seq_iff in H11.
(* Goal: @eq Arities (if andb true false then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite <- H10 in H9.
(* Goal: @eq Arities (if andb true false then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
contradict H9.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: not (@eq bool (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb i m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) i) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (n + S n0 + (s + S s0)).
(* Goal: forall _ : @eq bool (Nat.leb i n2) true, not (@eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (Nat.leb i n2) false, not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
congruence.
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (S n1)), not (@eq bool (aeq (if Nat.leb i n1 then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) i) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intros n3 H12.
(* Goal: not (@eq bool (aeq (if Nat.leb i n3 then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) i) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (leb i n3).
(* Goal: forall _ : @eq bool (Nat.leb i n2) true, not (@eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (Nat.leb i n2) false, not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
congruence.
(* Goal: forall _ : @eq bool (Nat.leb i n3) false, not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) i) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H13.
(* Goal: not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) i) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite leb_iff_conv in H13.
(* Goal: le x0 n0 *)
omega.
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) false, @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H6.
(* Goal: @eq Arities (if andb false (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
contradict H6.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: not (@eq bool (andb (Nat.eqb (Init.Nat.add n (S n0)) (Init.Nat.add n (S n0))) (Nat.eqb (Init.Nat.add s (S s0)) (Init.Nat.add s (S s0)))) false) *)
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
do 2 rewrite <- beq_nat_refl.
(* Goal: not (@eq bool (andb true true) false) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
simpl; congruence.
(* Goal: forall _ : @eq bool (Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) n2) false, @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H5.
(* Goal: @eq Arities (if andb (aeq (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite leb_iff_conv in H5.
(* Goal: @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
contradict H5.
(* Goal: le x0 n0 *)
omega.
(* Goal: forall _ : @eq bool (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0))) false, @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H3.
(* Goal: @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite forallb_forall_conv in H3.
(* Goal: @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
destruct H3 as (e' & H4 & H5).
(* Goal: @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite in_map_iff in H4.
(* Goal: @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
destruct H4 as (i & H6 & H7).
(* Goal: @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite in_seq_iff in H7.
(* Goal: @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite <- H6 in H5.
(* Goal: @eq Arities (if andb (andb true false) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
contradict H5.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: not (@eq bool (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) O with | O => false | S m' => Nat.leb i m' end then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (n + S n0 + 0).
(* Goal: forall _ : @eq bool (Nat.leb i n2) true, not (@eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (Nat.leb i n2) false, not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
congruence.
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), not (@eq bool (aeq (if Nat.leb i n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intros n2 H8.
(* Goal: not (@eq bool (aeq (if Nat.leb i n2 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (leb i n2).
(* Goal: forall _ : @eq bool (Nat.leb i n2) true, not (@eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (Nat.leb i n2) false, not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
congruence.
(* Goal: forall _ : @eq bool (Nat.leb i n2) false, not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H9.
(* Goal: not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite leb_iff_conv in H9.
(* Goal: le x0 n0 *)
omega.
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H2.
(* Goal: @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
contradict H2.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: not (@eq bool (andb (Nat.eqb (Init.Nat.add n (S n0)) (Init.Nat.add n (S n0))) true) false) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite <- beq_nat_refl.
(* Goal: not (@eq bool (andb true true) false) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
simpl; congruence.
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H1.
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite leb_iff_conv in H1.
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
contradict H1.
(* Goal: le x0 n0 *)
omega.
Qed.

Lemma BC_dummies_correct : forall e n n0 s s0 nl sl,
  length nl = n + n0 ->
  length sl = s + s0 ->
  sem (BC_dummies n n0 s s0 e) nl sl = sem e (skipn n nl) (skipn s sl).
Proof.
intros e n n0 s s0 nl sl Hnl Hsl.
unfold BC_dummies.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
do 2 rewrite map_map.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
f_equal.

erewrite <- map_nth_seq.
instantiate (1:=n0).
induction (seq n n0).
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
simpl; trivial.
do 2 rewrite map_cons.
rewrite IHl.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
f_equal.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
case_eq (n+n0).
(* Goal: forall _ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) O, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H0.
rewrite H0 in Hnl.
apply length_nil in Hnl.
subst nl.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: le x0 n0 *)
replace (a-0) with a by omega.
case a.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intros n1 H0.
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (leb a n1); intro H1.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite leb_iff_conv in H1.
case_eq (a - S n1).
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H2.
rewrite nth_overflow.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: le x0 n0 *)
omega.
intros n2 H2.
rewrite nth_overflow.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: le x0 n0 *)
omega.
(* Goal: le x0 n0 *)
omega.

transitivity (skipn (n+n0+s) (nl++sl)).
erewrite <- map_nth_seq.
instantiate (1:=s0).
induction (seq (n + n0 + s) s0).
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
simpl; trivial.
do 2 rewrite map_cons.
rewrite IHl.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
f_equal.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
case_eq (n+n0).
(* Goal: forall _ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) O, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intro H0.
rewrite H0 in Hnl.
apply length_nil in Hnl.
subst nl.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: le x0 n0 *)
replace (a-0) with a by omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
intros n1 H0.
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (leb a n1); intro H1.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite leb_iff in H1.
rewrite app_nth1.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: le x0 n0 *)
omega.
(* Goal: @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
rewrite leb_iff_conv in H1.
rewrite app_nth2.
(* Goal: forall _ : @eq bool (Nat.leb i n2) true, not (@eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (Nat.leb i n2) false, not (@eq bool (aeq (error_proj (Init.Nat.add n (S n0)) O i) (ok_arities (Init.Nat.add n (S n0)) O)) false) *)
(* Goal: forall _ : @eq bool (aeq (ok_arities (Init.Nat.add n (S n0)) O) (ok_arities (Init.Nat.add n (S n0)) O)) false, @eq Arities (if andb (andb false (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (ok_arities (Init.Nat.add n (S n0)) O) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall _ : @eq bool (Nat.leb n n1) false, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
congruence.
(* Goal: le x0 n0 *)
omega.
rewrite app_length.
(* Goal: le x0 n0 *)
omega.
rewrite plus_comm, skipn_plus, <- Hnl, skipn_app.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
Qed.

Opaque BC_dummies.

Fixpoint rec_simulation sl (e : Cobham) : pol :=
  match e with
    | Zero => pcst sl 0
    | Proj i n => pcst sl 0
    | Succ b => pcst sl 0
    | Smash => (pplus (pplus (pproj sl 1) (pproj sl 1))
        (pplus (pcst sl 16) (pplus (pproj sl 0) (pcst sl 2)))) 
    | Rec g h0 h1 j => 
       let bf := poly_Cobham j in
        let ph := pplus (rec_simulation (S sl) h0)  (rec_simulation (S sl) h1) in
          let pg := rec_simulation (sl - 1) g in
            pplus (pcomp ph (pproj sl 0 :: bf :: (map (pproj sl) (seq 1 (sl - 1)))))
            (pplus (pshift pg) (pplus (pproj sl 0) (pcst sl 2)))
    | Comp n h l => 
      pplus (pcst sl 0)
      (pplus (pcomp (rec_simulation (length l) h)
        (map poly_Cobham l)) (pplusl (map (rec_simulation sl) l)))
  end.

  Lemma rec_simulation_arity : forall (e : Cobham) n,
    arity e = ok_arity n ->
    parity (rec_simulation n e) = n.
  Proof.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    apply Cobham_ind_inf; simpl; intros; trivial.
(* Goal: @eq nat (Init.Nat.max match Init.Nat.max (@fst nat (list mon) (poly_Cobham j)) (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map nat pol (pproj (S n)) (seq (S O) (Init.Nat.sub n O))))) with | O => S n | S m' => S (Init.Nat.max n m') end (S (Init.Nat.max (@fst nat (list mon) (rec_simulation (Init.Nat.sub n O) g)) (Init.Nat.max n n)))) (S n) *)
(* Goal: @eq nat (Init.Nat.max n (Init.Nat.max (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map Cobham pol poly_Cobham rl))) (@fst nat (list mon) (pplusl (@map Cobham pol (rec_simulation n) rl))))) n *)
    erewrite parity_poly_Cobham; eauto.
(* Goal: @eq nat (Init.Nat.max match Init.Nat.max (S n) (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map nat pol (pproj (S n)) (seq (S O) (Init.Nat.sub n O))))) with | O => S n | S m' => S (Init.Nat.max n m') end (S (Init.Nat.max (@fst nat (list mon) (rec_simulation (Init.Nat.sub n O) g)) (Init.Nat.max n n)))) (S n) *)
(* Goal: @eq nat (Init.Nat.max n (Init.Nat.max (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map Cobham pol poly_Cobham rl))) (@fst nat (list mon) (pplusl (@map Cobham pol (rec_simulation n) rl))))) n *)
    rewrite <- minus_n_O, H3.
(* Goal: @eq nat (Init.Nat.max match Init.Nat.max (S n) (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map nat pol (pproj (S n)) (seq (S O) n)))) with | O => S n | S m' => S (Init.Nat.max n m') end (S (Init.Nat.max n (Init.Nat.max n n)))) (S n) *)
(* Goal: @eq nat (Init.Nat.max n (Init.Nat.max (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map Cobham pol poly_Cobham rl))) (@fst nat (list mon) (pplusl (@map Cobham pol (rec_simulation n) rl))))) n *)
    repeat rewrite Nat.max_idempotent.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    rewrite max_r; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    rewrite max_l; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    rewrite max_l; trivial.
(* Goal: le (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map nat pol (pproj (S n)) (seq (S O) n)))) (S n) *)
(* Goal: @eq nat (Init.Nat.max n (Init.Nat.max (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map Cobham pol poly_Cobham rl))) (@fst nat (list mon) (pplusl (@map Cobham pol (rec_simulation n) rl))))) n *)
    apply maxl_map; intros.
(* Goal: @eq nat (@fst nat (list mon) x) (S n) *)
(* Goal: @eq nat (Init.Nat.max n (Init.Nat.max (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map Cobham pol poly_Cobham rl))) (@fst nat (list mon) (pplusl (@map Cobham pol (rec_simulation n) rl))))) n *)
    apply in_map_iff in H7.
(* Goal: @eq nat (@fst nat (list mon) x) (S n) *)
(* Goal: @eq nat (Init.Nat.max n (Init.Nat.max (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map Cobham pol poly_Cobham rl))) (@fst nat (list mon) (pplusl (@map Cobham pol (rec_simulation n) rl))))) n *)
    destruct H7 as (? & ? & ?); subst x.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    rewrite parity_pproj; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    rewrite max_l; trivial.
(* Goal: le (Init.Nat.max (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map Cobham pol poly_Cobham rl))) (@fst nat (list mon) (pplusl (@map Cobham pol (rec_simulation n) rl)))) n *)
    apply Nat.max_lub.
(* Goal: le (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map Cobham pol (rec_simulation n) rl))) n *)
    apply maxl_map.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
    intros.
(* Goal: pWF x *)
    apply in_map_iff in H3.
(* Goal: pWF x *)
    destruct H3 as (? & ? & ?); subst.
(* Goal: @eq nat (@fst nat (list mon) (poly_Cobham x0)) n *)
(* Goal: le (@fst nat (list mon) (pplusl (@map Cobham pol (rec_simulation n) rl))) n *)
    eapply parity_poly_Cobham; auto.
(* Goal: le (@fst nat (list mon) (pplusl (@map Cobham pol (rec_simulation n) rl))) n *)
    rewrite parity_pplusl.
(* Goal: le (maxl (@map (prod nat (list mon)) nat (@fst nat (list mon)) (@map Cobham pol (rec_simulation n) rl))) n *)
    apply maxl_map.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
    intros.
(* Goal: pWF x *)
    apply in_map_iff in H3.
(* Goal: pWF x *)
    destruct H3 as (? & ? & ?); subst.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
    auto.
Qed.

Lemma pWF_rec_simulation : forall (e : Cobham) n,
  arity e = ok_arity n ->
  pWF (rec_simulation n e).
Proof.
(* Goal: forall (e : Cobham) (n : nat) (_ : @eq Arity (arity e) (ok_arity n)), pWF (rec_simulation n e) *)
  apply Cobham_ind_inf; simpl; intros; trivial; try pWF.
(* Goal: pWF x *)
(* Goal: pWF (rec_simulation (Init.Nat.sub n O) g) *)
(* Goal: pWF x *)
(* Goal: pWF x *)
  simpl in H7; decompose [or] H7; subst; pWF.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
  eapply pWF_poly_Cobham; eauto.
(* Goal: pWF x *)
(* Goal: pWF (rec_simulation (Init.Nat.sub n O) g) *)
(* Goal: pWF x *)
(* Goal: pWF x *)
  apply in_map_iff in H9.
(* Goal: pWF x *)
(* Goal: pWF (rec_simulation (Init.Nat.sub n O) g) *)
(* Goal: pWF x *)
(* Goal: pWF x *)
  destruct H9 as (? & ? & ?); subst; pWF.
(* Goal: le x0 n0 *)
  apply in_seq_iff in H9; omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
  rewrite <- minus_n_O; trivial.
(* Goal: pWF x *)
  apply in_map_iff in H3.
(* Goal: pWF x *)
(* Goal: pWF x *)
  destruct H3 as (? & ? & ?); subst; pWF.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
  eapply pWF_poly_Cobham; simpl; auto.
(* Goal: pWF x *)
  apply in_map_iff in H3.
(* Goal: pWF x *)
  destruct H3 as (? & ? & ?); subst.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
  eapply H2; trivial.
Qed.

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].

 Lemma f'_cond_inf : arities f'_cond = ok_arities 2 (S sl).
 Proof.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
  simpl.
(* Goal: @eq Arities (if andb match sl with | O => false | S m' => Nat.eqb (Init.Nat.sub sl (S O)) m' end true then ok_arities (S (S O)) (S (Init.Nat.sub sl (S O))) else error_rec (ok_arities (S O) (S (Init.Nat.sub sl (S O)))) (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (ok_arities (S (S O)) sl) *)
  destruct sl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
  elim sl_not_zero; trivial.
(* Goal: @eq Arities match arities Y_e with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (ok_arities (S (S O)) O) (@cons Arities (ok_arities (S (S O)) O) (@nil Arities))) (@cons Arities (ok_arities (S (S O)) (S (S n))) (@nil Arities)) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (ok_arities (S (S O)) O) (@cons Arities (ok_arities (S (S O)) O) (@nil Arities))) (@cons Arities (ok_arities (S (S O)) (S (S n))) (@nil Arities)) | error_proj n0 n1 n2 => error_comp (error_proj n0 n1 n2) (@cons Arities (ok_arities (S (S O)) O) (@cons Arities (ok_arities (S (S O)) O) (@nil Arities))) (@cons Arities (ok_arities (S (S O)) (S (S n))) (@nil Arities)) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (S O))) (Nat.eqb hs (S O))) true) (andb (aeq (ok_arities (S (S O)) (S (S n))) (ok_arities (S (S O)) (S (S n)))) true) then ok_arities (S (S O)) (S (S n)) else error_comp (ok_arities hn hs) (@cons Arities (ok_arities (S (S O)) O) (@cons Arities (ok_arities (S (S O)) O) (@nil Arities))) (@cons Arities (ok_arities (S (S O)) (S (S n))) (@nil Arities)) end (ok_arities (S (S O)) (S (S n))) *)
  simpl; repeat (rewrite <- beq_nat_refl; simpl).
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
  trivial.
 Qed.

 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.

 Lemma f'_nil_inf : arities f'_nil = ok_arities 2 (S sl).
 Proof.
(* Goal: @eq Arities (arities f'_nil) (ok_arities (S (S O)) (S sl)) *)
   unfold f'_nil.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
   erewrite dummies_inf; eauto.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
   simpl.
(* Goal: @eq Arities (if andb match sl with | O => false | S m' => Nat.eqb (Init.Nat.sub sl (S O)) m' end true then ok_arities (S (S O)) (S (Init.Nat.sub sl (S O))) else error_rec (ok_arities (S O) (S (Init.Nat.sub sl (S O)))) (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (ok_arities (S (S O)) sl) *)
   destruct sl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
   elim sl_not_zero; trivial.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
   simpl.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
   f_equal.
(* Goal: le x0 n0 *)
   omega.
 Qed.

 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.

 Lemma f'_then_inf : arities f'_then = ok_arities 2 (S sl).
 Proof.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
   simpl.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
   rewrite h1_inf; simpl.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb (S (S O)) (S (S O))) (Nat.eqb sl (@length BC (@map nat BC (proj (S O) sl) (seq (S O) sl))))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) sl)) (@map nat BC (proj (S O) sl) (seq (S O) sl))) then ok_arities (S O) sl else error_comp (ok_arities (S (S O)) sl) (@cons Arities (ok_arities (S O) O) (@cons Arities (ok_arities (S O) O) (@nil Arities))) (@map BC Arities arities (@map nat BC (proj (S O) sl) (seq (S O) sl)))) (ok_arities (S O) sl) *)
   rewrite map_length, seq_length.
(* Goal: @eq Arities (if andb match sl with | O => false | S m' => Nat.eqb (Init.Nat.sub sl (S O)) m' end true then ok_arities (S (S O)) (S (Init.Nat.sub sl (S O))) else error_rec (ok_arities (S O) (S (Init.Nat.sub sl (S O)))) (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (ok_arities (S (S O)) sl) *)
   destruct sl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
   elim sl_not_zero; trivial.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
   simpl.
(* Goal: @eq Arities (if andb (Nat.eqb (Init.Nat.sub n O) n) true then ok_arities (S (S O)) (S (Init.Nat.sub n O)) else error_rec (ok_arities (S O) (S (Init.Nat.sub n O))) (ok_arities (S (S O)) (S (S n))) (ok_arities (S (S O)) (S (S n)))) (ok_arities (S (S O)) (S n)) *)
   rewrite <- minus_n_O.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb (S O) (S O)) (Nat.eqb (@length Cobham rl) (@length Cobham rl))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) n)) (@map Cobham BC (Cobham_to_BC' n) rl)) then ok_arities (S O) n else error_comp (ok_arities (S O) (@length Cobham rl)) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl))) (ok_arities (S O) n) *)
   repeat (rewrite <- beq_nat_refl; simpl).
   case_eq ( forallb (fun se : BC => aeq (arities se) (ok_arities 2 (S (S n))))
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
          (map (proj 2 (S (S n))) (seq 4 n))); intros; simpl; trivial.
(* Goal: @eq Arities (error_comp (ok_arities (S O) (@length Cobham rl)) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl))) (ok_arities (S O) n) *)
   elimtype False.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
   apply eq_true_false_abs in H; trivial.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
   eapply forallb_forall; intros.
(* Goal: @eq bool (aeq (arities x) (ok_arities (S O) sl)) true *)
    apply in_map_iff in H0.
(* Goal: @eq bool (aeq (arities x) (ok_arities (S O) sl)) true *)
    destruct H0 as (? & ? & ?).
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
    subst.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
    simpl.
(* Goal: @eq bool (aeq (if Nat.leb x0 sl then ok_arities (S O) sl else error_proj (S O) sl x0) (ok_arities (S O) sl)) true *)
    apply in_seq_iff in H1.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
    rewrite leb_correct; simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    rewrite <- beq_nat_refl; trivial.
(* Goal: le x0 n0 *)
    omega.
  Qed.

  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)))).
 
 Lemma f'_else_inf : arities f'_else = ok_arities 2 (S sl).
 Proof.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
   simpl.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
   rewrite h0_inf; simpl.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb (S (S O)) (S (S O))) (Nat.eqb sl (@length BC (@map nat BC (proj (S O) sl) (seq (S O) sl))))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) sl)) (@map nat BC (proj (S O) sl) (seq (S O) sl))) then ok_arities (S O) sl else error_comp (ok_arities (S (S O)) sl) (@cons Arities (ok_arities (S O) O) (@cons Arities (ok_arities (S O) O) (@nil Arities))) (@map BC Arities arities (@map nat BC (proj (S O) sl) (seq (S O) sl)))) (ok_arities (S O) sl) *)
   rewrite map_length, seq_length.
(* Goal: @eq Arities (if andb match sl with | O => false | S m' => Nat.eqb (Init.Nat.sub sl (S O)) m' end true then ok_arities (S (S O)) (S (Init.Nat.sub sl (S O))) else error_rec (ok_arities (S O) (S (Init.Nat.sub sl (S O)))) (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (ok_arities (S (S O)) sl) *)
   destruct sl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
   elim sl_not_zero; trivial.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
   simpl.
(* Goal: @eq Arities (if andb (Nat.eqb (Init.Nat.sub n O) n) true then ok_arities (S (S O)) (S (Init.Nat.sub n O)) else error_rec (ok_arities (S O) (S (Init.Nat.sub n O))) (ok_arities (S (S O)) (S (S n))) (ok_arities (S (S O)) (S (S n)))) (ok_arities (S (S O)) (S n)) *)
   rewrite <- minus_n_O.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb (S O) (S O)) (Nat.eqb (@length Cobham rl) (@length Cobham rl))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) n)) (@map Cobham BC (Cobham_to_BC' n) rl)) then ok_arities (S O) n else error_comp (ok_arities (S O) (@length Cobham rl)) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl))) (ok_arities (S O) n) *)
   repeat (rewrite <- beq_nat_refl; simpl).
   case_eq ( forallb (fun se : BC => aeq (arities se) (ok_arities 2 (S (S n))))
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
          (map (proj 2 (S (S n))) (seq 4 n))); intros; simpl; trivial.
(* Goal: @eq Arities (error_comp (ok_arities (S O) (@length Cobham rl)) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl))) (ok_arities (S O) n) *)
   elimtype False.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
   apply eq_true_false_abs in H; trivial.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
   eapply forallb_forall; intros.
(* Goal: @eq bool (aeq (arities x) (ok_arities (S O) sl)) true *)
    apply in_map_iff in H0.
(* Goal: @eq bool (aeq (arities x) (ok_arities (S O) sl)) true *)
    destruct H0 as (? & ? & ?).
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
    subst.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
    simpl.
(* Goal: @eq bool (aeq (if Nat.leb x0 sl then ok_arities (S O) sl else error_proj (S O) sl x0) (ok_arities (S O) sl)) true *)
    apply in_seq_iff in H1.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
    rewrite leb_correct; simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    rewrite <- beq_nat_refl; trivial.
(* Goal: le x0 n0 *)
    omega.
  Qed.

  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.
  Proof.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
    intros; simpl; auto.
  Qed.

  Lemma f'_inf : arities f' = ok_arities 2 sl.
  Proof.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
    simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    rewrite dummies_inf; trivial.
(* Goal: @eq Arities match (if andb (aeq (arities f'_cond) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_nil) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (arities f'_cond) (@cons Arities (arities f'_nil) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) with | error_rec a a0 a1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (error_rec a a0 a1) (if andb (aeq (arities f'_cond) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_nil) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (arities f'_cond) (@cons Arities (arities f'_nil) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) | error_comp a l l0 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (error_comp a l l0) (if andb (aeq (arities f'_cond) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_nil) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (arities f'_cond) (@cons Arities (arities f'_nil) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) | error_proj n n0 n1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (error_proj n n0 n1) (if andb (aeq (arities f'_cond) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_nil) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (arities f'_cond) (@cons Arities (arities f'_nil) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) | ok_arities h0n h0s => match (if andb (aeq (arities f'_cond) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_nil) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (arities f'_cond) (@cons Arities (arities f'_nil) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) with | error_rec a a0 a1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (error_rec a a0 a1) | error_comp a l l0 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (error_comp a l l0) | error_proj n n0 n1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (error_proj n n0 n1) | ok_arities h1n h1s => if andb (andb (andb match h0n with | O => false | S m' => Nat.eqb (Init.Nat.add O (S O)) m' end (Nat.eqb h0n h1n)) match h0s with | O => false | S m' => Nat.eqb (Init.Nat.add (S O) (Init.Nat.sub sl (S O))) m' end) (Nat.eqb h0s h1s) then ok_arities h0n (Init.Nat.add (S O) (Init.Nat.sub sl (S O))) else error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (ok_arities h1n h1s) end end (ok_arities (S (S O)) sl) *)
    rewrite f'_cond_inf.
(* Goal: @eq Arities match (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_nil) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_nil) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) with | error_rec a a0 a1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (error_rec a a0 a1) (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_nil) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_nil) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) | error_comp a l l0 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (error_comp a l l0) (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_nil) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_nil) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) | error_proj n n0 n1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (error_proj n n0 n1) (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_nil) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_nil) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) | ok_arities h0n h0s => match (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_nil) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_nil) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) with | error_rec a a0 a1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (error_rec a a0 a1) | error_comp a l l0 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (error_comp a l l0) | error_proj n n0 n1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (error_proj n n0 n1) | ok_arities h1n h1s => if andb (andb (andb match h0n with | O => false | S m' => Nat.eqb (Init.Nat.add O (S O)) m' end (Nat.eqb h0n h1n)) match h0s with | O => false | S m' => Nat.eqb (Init.Nat.add (S O) (Init.Nat.sub sl (S O))) m' end) (Nat.eqb h0s h1s) then ok_arities h0n (Init.Nat.add (S O) (Init.Nat.sub sl (S O))) else error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (ok_arities h1n h1s) end end (ok_arities (S (S O)) sl) *)
    rewrite f'_nil_inf.
(* Goal: @eq Arities match (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) with | error_rec a a0 a1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (error_rec a a0 a1) (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) | error_comp a l l0 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (error_comp a l l0) (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) | error_proj n n0 n1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (error_proj n n0 n1) (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) | ok_arities h0n h0s => match (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_then) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_then) (@cons Arities (arities f'_else) (@nil Arities)))))) with | error_rec a a0 a1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (error_rec a a0 a1) | error_comp a l l0 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (error_comp a l l0) | error_proj n n0 n1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (error_proj n n0 n1) | ok_arities h1n h1s => if andb (andb (andb match h0n with | O => false | S m' => Nat.eqb (Init.Nat.add O (S O)) m' end (Nat.eqb h0n h1n)) match h0s with | O => false | S m' => Nat.eqb (Init.Nat.add (S O) (Init.Nat.sub sl (S O))) m' end) (Nat.eqb h0s h1s) then ok_arities h0n (Init.Nat.add (S O) (Init.Nat.sub sl (S O))) else error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (ok_arities h1n h1s) end end (ok_arities (S (S O)) sl) *)
    rewrite f'_then_inf.
(* Goal: @eq Arities match (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_else) (@nil Arities)))))) with | error_rec a a0 a1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (error_rec a a0 a1) (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_else) (@nil Arities)))))) | error_comp a l l0 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (error_comp a l l0) (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_else) (@nil Arities)))))) | error_proj n n0 n1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (error_proj n n0 n1) (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_else) (@nil Arities)))))) | ok_arities h0n h0s => match (if andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (andb (aeq (arities f'_else) (ok_arities (S (S O)) (S sl))) true))) then ok_arities (S (S O)) (S sl) else error_comp (ok_arities O (S (S (S (S O))))) (@nil Arities) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (ok_arities (S (S O)) (S sl)) (@cons Arities (arities f'_else) (@nil Arities)))))) with | error_rec a a0 a1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (error_rec a a0 a1) | error_comp a l l0 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (error_comp a l l0) | error_proj n n0 n1 => error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (error_proj n n0 n1) | ok_arities h1n h1s => if andb (andb (andb match h0n with | O => false | S m' => Nat.eqb (Init.Nat.add O (S O)) m' end (Nat.eqb h0n h1n)) match h0s with | O => false | S m' => Nat.eqb (Init.Nat.add (S O) (Init.Nat.sub sl (S O))) m' end) (Nat.eqb h0s h1s) then ok_arities h0n (Init.Nat.add (S O) (Init.Nat.sub sl (S O))) else error_rec (ok_arities (Init.Nat.add O (S O)) (Init.Nat.add (S O) (Init.Nat.sub sl (S O)))) (ok_arities h0n h0s) (ok_arities h1n h1s) end end (ok_arities (S (S O)) sl) *)
    rewrite f'_else_inf.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
    simpl.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb (S O) (S O)) (Nat.eqb (@length Cobham rl) (@length Cobham rl))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) n)) (@map Cobham BC (Cobham_to_BC' n) rl)) then ok_arities (S O) n else error_comp (ok_arities (S O) (@length Cobham rl)) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl))) (ok_arities (S O) n) *)
    repeat (rewrite <- beq_nat_refl; simpl).
(* Goal: @eq Arities (if andb match sl with | O => false | S m' => Nat.eqb (Init.Nat.sub sl (S O)) m' end true then ok_arities (S (S O)) (S (Init.Nat.sub sl (S O))) else error_rec (ok_arities (S O) (S (Init.Nat.sub sl (S O)))) (ok_arities (S (S O)) (S sl)) (ok_arities (S (S O)) (S sl))) (ok_arities (S (S O)) sl) *)
    destruct sl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    elim sl_not_zero; trivial.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
    simpl.
(* Goal: @eq Arities (if andb (Nat.eqb (Init.Nat.sub n O) n) true then ok_arities (S (S O)) (S (Init.Nat.sub n O)) else error_rec (ok_arities (S O) (S (Init.Nat.sub n O))) (ok_arities (S (S O)) (S (S n))) (ok_arities (S (S O)) (S (S n)))) (ok_arities (S (S O)) (S n)) *)
    rewrite <- minus_n_O.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
    rewrite <- beq_nat_refl; simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    trivial.
  Qed.

  Definition f : BC :=
    comp 1 sl f' [proj 1 0 0; proj 1 0 0]
    (map (proj 1 sl) (seq 1 sl)).

  Opaque f'.

  Lemma f_inf : arities f = ok_arities 1 sl.
  Proof.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
    simpl.
(* Goal: @eq Arities match arities f' with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (ok_arities (S O) O) (@cons Arities (ok_arities (S O) O) (@nil Arities))) (@map BC Arities arities (@map nat BC (proj (S O) sl) (seq (S O) sl))) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (ok_arities (S O) O) (@cons Arities (ok_arities (S O) O) (@nil Arities))) (@map BC Arities arities (@map nat BC (proj (S O) sl) (seq (S O) sl))) | error_proj n n0 n1 => error_comp (error_proj n n0 n1) (@cons Arities (ok_arities (S O) O) (@cons Arities (ok_arities (S O) O) (@nil Arities))) (@map BC Arities arities (@map nat BC (proj (S O) sl) (seq (S O) sl))) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S (S O))) (Nat.eqb hs (@length BC (@map nat BC (proj (S O) sl) (seq (S O) sl))))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) sl)) (@map nat BC (proj (S O) sl) (seq (S O) sl))) then ok_arities (S O) sl else error_comp (ok_arities hn hs) (@cons Arities (ok_arities (S O) O) (@cons Arities (ok_arities (S O) O) (@nil Arities))) (@map BC Arities arities (@map nat BC (proj (S O) sl) (seq (S O) sl))) end (ok_arities (S O) sl) *)
    rewrite f'_inf.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb (S (S O)) (S (S O))) (Nat.eqb sl (@length BC (@map nat BC (proj (S O) sl) (seq (S O) sl))))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) sl)) (@map nat BC (proj (S O) sl) (seq (S O) sl))) then ok_arities (S O) sl else error_comp (ok_arities (S (S O)) sl) (@cons Arities (ok_arities (S O) O) (@cons Arities (ok_arities (S O) O) (@nil Arities))) (@map BC Arities arities (@map nat BC (proj (S O) sl) (seq (S O) sl)))) (ok_arities (S O) sl) *)
    rewrite map_length, seq_length.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb (S O) (S O)) (Nat.eqb (@length Cobham rl) (@length Cobham rl))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) n)) (@map Cobham BC (Cobham_to_BC' n) rl)) then ok_arities (S O) n else error_comp (ok_arities (S O) (@length Cobham rl)) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl))) (ok_arities (S O) n) *)
    repeat (rewrite <- beq_nat_refl; simpl).
    case_eq (forallb (fun se : BC => aeq (arities se) (ok_arities 1 sl))
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
         (map (proj 1 sl) (seq 1 sl))); intros.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    trivial.
(* Goal: @eq Arities (error_comp (ok_arities (S O) (@length Cobham rl)) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl))) (ok_arities (S O) n) *)
    elimtype False.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    apply eq_true_false_abs in H; trivial.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
    eapply forallb_forall; intros.
(* Goal: @eq bool (aeq (arities x) (ok_arities (S O) sl)) true *)
    apply in_map_iff in H0.
(* Goal: @eq bool (aeq (arities x) (ok_arities (S O) sl)) true *)
    destruct H0 as (? & ? & ?).
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
    subst.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
    simpl.
(* Goal: @eq bool (aeq (if Nat.leb x0 sl then ok_arities (S O) sl else error_proj (S O) sl x0) (ok_arities (S O) sl)) true *)
    apply in_seq_iff in H1.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
    rewrite leb_correct; simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    rewrite <- beq_nat_refl; trivial.
(* Goal: le x0 n0 *)
    omega.
  Qed.

  Variables g' h0' h1' cj : Cobham.

  Hypothesis g'_inf : arity g' = ok_arity (sl - 1).
  Hypothesis h0'_inf : arity h0' = ok_arity (S sl).
  Hypothesis h1'_inf : arity h1' = ok_arity (S sl).
  Hypothesis cj'_inf : arity cj = ok_arity sl.

  Hypothesis g_correct  : forall w xl, 
    length xl = (sl - 1) -> 
    peval (rec_simulation (sl - 1) g') (map (@length _) xl) <= length w ->
    Sem g' xl  = sem g [w] xl.

  Hypothesis h0_correct : forall w xl, 
    length xl = (S sl) -> 
    peval (rec_simulation (S sl) h0') (map (@length _) xl) <= length w ->
    Sem h0' xl = sem h0 [w] xl.

  Hypothesis h1_correct : forall w xl, 
    length xl = (S sl) -> 
    peval (rec_simulation (S sl) h1') (map (@length _) xl) <= length w ->
    Sem h1' xl = sem h1 [w] xl.

  Transparent f'_then f'_else f'_cond f' .

 Lemma f_correct : forall (w y u : bs) xl,
   peval
   (pcomp (pplus (rec_simulation (S sl) h0') (rec_simulation (S sl) h1'))
     (pproj (length (y :: xl)) 0
       :: poly_Cobham (Rec g' h0' h1' cj)
       :: map (pproj (length (y :: xl)))
       (seq 1 (length (y :: xl) - 1))))
   (map (@length _) (y :: xl)) +
   (peval (pshift (rec_simulation (sl - 1) g')) (map (@length _) (y :: xl)) +
     (nth 0 (map (@length _) (y :: xl)) 0 + 2)) <= length w ->
   rec_bounded (Rec g' h0' h1' cj) ->
   S (length xl) = sl ->
   length u <= length w ->
   length w - length u <= length y ->
   Sem (Rec g' h0' h1' cj) (Y u w y :: xl) =
   sem f' [u; w] (y :: xl).
Proof.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 simpl length in *; intros.
(* Goal: @eq nat (Init.Nat.mul (@length bool (sem (nat2BC ar O ar') nl (@nil (list bool)))) (Init.Nat.mul (@length bool (sem (poly_BC_pow ar xn) nl (@nil (list bool)))) (multl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) (@map pow BC (poly_BC_pow ar) xnl))))) (Init.Nat.mul ar' (Init.Nat.mul (peval_pow xn (@map (list bool) nat (@length bool) nl)) (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) xnl)))) *)
 simpl in H.

 assert (S (length y) < length w).
 eapply le_trans; [ | apply H].
(* Goal: le x0 n0 *)
 simpl; omega.

(* Goal: le x0 n0 *)
 assert (1 < length w - length y) by omega.

 induction u as [ | j z]; intros; simpl length in *.

(* Goal: le x0 n0 *)
 rewrite Y_skipn, skipn_nil; simpl; try omega.

 apply le_lt_eq_dec in H3; destruct H3.

 unfold f' in *.

 rewrite rec2_simpl,  <- rec2_sem_rec, <- IHz, I_Y_property; try omega; clear IHz.
 simpl Sem; unfold f'_then, f'_else, comp2Ss.
 rewrite cond_simpl_notnil.
 Opaque Y_e.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite Y_correct.
(* Goal: le x0 n0 *)
 rewrite I_Y_property; try omega.
 rewrite <- H1.

(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: @eq Arities (if andb (Nat.eqb (Init.Nat.sub n O) n) true then ok_arities (S (S O)) (S (Init.Nat.sub n O)) else error_rec (ok_arities (S O) (S (Init.Nat.sub n O))) (ok_arities (S (S O)) (S (S n))) (ok_arities (S (S O)) (S (S n)))) (ok_arities (S (S O)) (S n)) *)
 rewrite <- minus_n_O.

(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 case_eq (nth (length w - S (length z)) y false); intros.

(* Goal: le x0 n0 *)
 rewrite Y_correct; simpl; trivial; try omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 erewrite h1_correct; trivial.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 do 3 f_equal.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 clear H H1; induction xl; simpl; trivial.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite IHxl at 1; simpl.
 rewrite <- seq_shift with (start := 4), map_map.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 apply map_ext2; intros.
(* Goal: @eq (list bool) (sem (proj (S O) (@length (list bool) xl) a0) (@cons (list bool) w (@nil (list bool))) xl) (if Nat.leb (S a0) O then match a0 with | O => @nil bool | S m => @nil bool end else match Init.Nat.sub (S a0) (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) *)
 apply in_seq_iff in H.
 rewrite leb_correct_conv;[ simpl | omega].
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 do 4 (destruct a0; simpl;[ elimtype False; omega | ]); trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite <- H1; simpl; trivial.
 eapply le_trans; [ | apply H ].
 rewrite pcomp_correct, pplus_correct.
 apply le_trans with (peval (rec_simulation (S sl) h1')
     (map (fun p : pol => peval p (length y :: map (@length _) xl))
        (pproj (S (length xl)) 0
         :: poly_Cobham cj
            :: map (pproj (S (length xl))) (seq 1 (length xl - 0)))));[ | omega ].
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 apply peval_monotonic; simpl; intros.
 destruct i.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite pproj_correct; simpl.
 eapply le_trans.
(* Goal: le x0 n0 *)
 apply Y_le; omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite Y_refl; trivial.
 destruct i.
 rewrite <- map_cons.
 apply le_trans with (peval (poly_Cobham (Rec g' h0' h1' cj)) (map (@length _) ((Y z w y) :: xl))).
 eapply le_trans.
 2: apply poly_Cobham_correct.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl in *; trivial.

(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 apply peval_monotonic; intros; simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 destruct i; trivial.
 eapply le_trans.
(* Goal: le x0 n0 *)
 apply Y_le; omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite Y_refl; trivial.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
 match goal with [ |- ?a <= ?b] => assert (a = b) end.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
(* Goal: @eq Arities (if andb (Nat.eqb (Init.Nat.sub n O) n) true then ok_arities (S (S O)) (S (Init.Nat.sub n O)) else error_rec (ok_arities (S O) (S (Init.Nat.sub n O))) (ok_arities (S (S O)) (S (S n))) (ok_arities (S (S O)) (S (S n)))) (ok_arities (S (S O)) (S n)) *)
 rewrite <- minus_n_O.
 clear H H1.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 induction xl; simpl; trivial.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite pproj_correct; simpl.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
 rewrite IHxl, <- seq_shift with (start := 1), map_map.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 apply map_ext2; intros.
(* Goal: @eq (list bool) (sem (proj (S O) (@length (list bool) xl) a0) (@cons (list bool) w (@nil (list bool))) xl) (if Nat.leb (S a0) O then match a0 with | O => @nil bool | S m => @nil bool end else match Init.Nat.sub (S a0) (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) *)
 apply in_seq_iff in H.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 repeat rewrite pproj_correct; simpl.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 destruct a0; simpl.
(* Goal: le x0 n0 *)
 elimtype False; omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite IHxl at 1; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite H6; trivial.

(* Goal: le x0 n0 *)
 rewrite Y_correct; simpl; trivial; try omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 erewrite h0_correct; trivial.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 do 3 f_equal.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 clear H H1; induction xl; simpl; trivial.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite IHxl at 1; simpl.
 rewrite <- seq_shift with (start := 4), map_map.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 apply map_ext2; intros.
(* Goal: @eq (list bool) (sem (proj (S O) (@length (list bool) xl) a0) (@cons (list bool) w (@nil (list bool))) xl) (if Nat.leb (S a0) O then match a0 with | O => @nil bool | S m => @nil bool end else match Init.Nat.sub (S a0) (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) *)
 apply in_seq_iff in H.
 rewrite leb_correct_conv;[ simpl | omega].
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 do 4 (destruct a0; simpl;[ elimtype False; omega | ]); trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite <- H1; simpl; trivial.
 eapply le_trans; [ | apply H ].
 rewrite pcomp_correct, pplus_correct.
 apply le_trans with (peval (rec_simulation (S sl) h0')
     (map (fun p : pol => peval p (length y :: map (@length _) xl))
        (pproj (S (length xl)) 0
         :: poly_Cobham cj
            :: map (pproj (S (length xl))) (seq 1 (length xl - 0)))));[ | omega ].
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 apply peval_monotonic; simpl; intros.
 destruct i.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite pproj_correct; simpl.
 eapply le_trans.
(* Goal: le x0 n0 *)
 apply Y_le; omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite Y_refl; trivial.
 destruct i.
 rewrite <- map_cons.
 apply le_trans with (peval (poly_Cobham (Rec g' h0' h1' cj)) (map (@length _) ((Y z w y) :: xl))).
 eapply le_trans.
 2: apply poly_Cobham_correct.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl in *; trivial.

(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 apply peval_monotonic; intros; simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 destruct i; trivial.
 eapply le_trans.
(* Goal: le x0 n0 *)
 apply Y_le; omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite Y_refl; trivial.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
 match goal with [ |- ?a <= ?b] => assert (a = b) end.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
(* Goal: @eq Arities (if andb (Nat.eqb (Init.Nat.sub n O) n) true then ok_arities (S (S O)) (S (Init.Nat.sub n O)) else error_rec (ok_arities (S O) (S (Init.Nat.sub n O))) (ok_arities (S (S O)) (S (S n))) (ok_arities (S (S O)) (S (S n)))) (ok_arities (S (S O)) (S n)) *)
 rewrite <- minus_n_O.
 clear H H1.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 induction xl; simpl; trivial.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite pproj_correct; simpl.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
 rewrite IHxl, <- seq_shift with (start := 1), map_map.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 apply map_ext2; intros.
(* Goal: @eq (list bool) (sem (proj (S O) (@length (list bool) xl) a0) (@cons (list bool) w (@nil (list bool))) xl) (if Nat.leb (S a0) O then match a0 with | O => @nil bool | S m => @nil bool end else match Init.Nat.sub (S a0) (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) *)
 apply in_seq_iff in H.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 repeat rewrite pproj_correct; simpl.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 destruct a0; simpl.
(* Goal: le x0 n0 *)
 elimtype False; omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite IHxl at 1; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite H6; trivial.

 unfold f'_cond.
 Opaque lt_e P'_e.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite Y_correct.
 unfold Y, P.
 rewrite skipn_length.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 case_eq (skipn (length w - length (true :: z)) y); intros.
 apply skipn_nil_length in H3.
 apply lt_not_le in l.
(* Goal: le x0 n0 *)
 simpl in *; omega.
 case b; intro; discriminate.

 rewrite Y_skipn.
 rewrite skipn_nil.
(* Goal: le x0 n0 *)
 2: simpl in *; omega.
 simpl Sem.
 unfold f'.

(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite rec2_simpl.
 unfold comp2Ss.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite cond_simpl.
 unfold f'_cond.
 Opaque Y_e f'_then f'_else.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite Y_correct.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 unfold Y, P; rewrite skipn_length; trivial.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite skipn_nil.
(* Goal: le x0 n0 *)
 2:  simpl in *; omega.
 Transparent f'_nil.
(* Goal: @eq Arities (arities f'_nil) (ok_arities (S (S O)) (S sl)) *)
 unfold f'_nil.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 rewrite BC_dummies_correct; simpl; auto.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 eapply g_correct; simpl ; trivial.
(* Goal: le x0 n0 *)
 rewrite <- H1; omega.
 eapply le_trans; [ | apply H].
(* Goal: le x0 n0 *)
 rewrite pshift_correct; simpl; omega.
(* Goal: le x0 n0 *)
 rewrite <- H1; omega.  
Qed.

Opaque f'.

Lemma f'_eq_f w xl :
  length xl = sl ->
  sem f' [w;w] xl = sem f [w] xl.
Proof.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
  simpl; intros.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
  f_equal.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
  rewrite map_map.
(* Goal: @eq (list (list bool)) xl (@map nat (list bool) (fun x : nat => sem (proj (S O) sl x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) sl)) *)
  rewrite <- H; clear H.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
  induction xl; simpl; trivial.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
  f_equal.
(* Goal: @eq (list (list bool)) xl (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (seq (S (S O)) (@length (list bool) xl))) *)
  rewrite IHxl at 1.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (seq (S (S O)) (@length (list bool) xl))) *)
  rewrite <- seq_shift with (start := 1).
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
  rewrite map_map.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb (S x) O then match x with | O => @nil bool | S m => @nil bool end else match Init.Nat.sub (S x) (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (seq (S O) (@length (list bool) xl))) *)
  apply map_ext2.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
  intros.
(* Goal: @eq (list bool) (sem (proj (S O) (@length (list bool) xl) a0) (@cons (list bool) w (@nil (list bool))) xl) (if Nat.leb (S a0) O then match a0 with | O => @nil bool | S m => @nil bool end else match Init.Nat.sub (S a0) (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) *)
  apply in_seq_iff in H.
(* Goal: @eq (list bool) (sem (proj (S O) (@length (list bool) xl) a0) (@cons (list bool) w (@nil (list bool))) xl) (if Nat.leb (S a0) O then match a0 with | O => @nil bool | S m => @nil bool end else match Init.Nat.sub (S a0) (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) *)
  rewrite leb_correct_conv;[ | omega].
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
  simpl.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
  destruct a0; simpl.
(* Goal: le x0 n0 *)
  elimtype False; omega.
(* Goal: le x0 n0 *)
  f_equal; omega.
Qed.

End PredicativeNotationRecursion.

Definition f_smash' :=
  f 2 (proj 1 1 1)
  (comp 1 3 (succ false) nil [proj 1 3 2])
  (comp 1 3 (succ false) nil [proj 1 3 2]).

Lemma f_smash_inf : arities f_smash' = ok_arities 1 2.
Proof.
(* Goal: @eq Arities (arities f_smash') (ok_arities (S O) (S (S O))) *)
  unfold f_smash'.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
  erewrite f_inf; trivial.
(* Goal: le x0 n0 *)
  omega.
Qed.

Opaque f_smash'.

  Fixpoint Cobham_to_BC' sl (e : Cobham) : BC :=
    match e with
      | Zero => comp 1 sl zero nil nil
      | Proj n i => proj 1 sl (S i)
      | Succ b => comp 1 sl (succ b) nil [proj 1 sl 1]
      | Smash => f sl (one_e 1 1) 
        (BC_dummies 0 1 1 2 (comp 1 2 f_smash' [proj 1 0 0] [proj 1 2 2; proj 1 2 1]))
        (BC_dummies 0 1 1 2 (comp 1 2 f_smash' [proj 1 0 0] [proj 1 2 2; proj 1 2 1]))
      | Rec g' h0' h1' _ => 
        let g  := Cobham_to_BC' (sl - 1) g' in
          let h0 := Cobham_to_BC' (S sl) h0' in
            let h1 := Cobham_to_BC' (S sl) h1' in
              f sl g h0 h1
      | Comp n h l => comp 1 sl (Cobham_to_BC' (length l) h) 
        [proj 1 0 0] (map (Cobham_to_BC' sl) l)
    end.

  Opaque f.

  Lemma Cobham_to_BC'_inf : forall e sl,
    arity e = ok_arity sl ->     
    arities (Cobham_to_BC' sl e) = ok_arities 1 sl.
  Proof.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    apply Cobham_ind_inf; simpl; intros; trivial.
(* Goal: @eq Arities (if match n with | O => false | S m' => Nat.leb i m' end then ok_arities (S O) n else error_proj (S O) n (S i)) (ok_arities (S O) n) *)
(* Goal: @eq Arities (arities (f (S n) (Cobham_to_BC' (Init.Nat.sub n O) g) (Cobham_to_BC' (S (S n)) h0) (Cobham_to_BC' (S (S n)) h1))) (ok_arities (S O) (S n)) *)
(* Goal: @eq Arities match arities (Cobham_to_BC' (@length Cobham rl) h) with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) | error_proj n0 n1 n2 => error_comp (error_proj n0 n1 n2) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S O)) (Nat.eqb hs (@length BC (@map Cobham BC (Cobham_to_BC' n) rl)))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) n)) (@map Cobham BC (Cobham_to_BC' n) rl)) then ok_arities (S O) n else error_comp (ok_arities hn hs) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) end (ok_arities (S O) n) *)
    destruct n.
(* Goal: le x0 n0 *)
    contradict H; omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    case_eq (leb i n); intros; trivial.
(* Goal: @eq Arities (error_proj (S O) (S n) (S i)) (ok_arities (S O) (S n)) *)
(* Goal: @eq Arities (arities (f (S n) (Cobham_to_BC' (Init.Nat.sub n O) g) (Cobham_to_BC' (S (S n)) h0) (Cobham_to_BC' (S (S n)) h1))) (ok_arities (S O) (S n)) *)
(* Goal: @eq Arities match arities (Cobham_to_BC' (@length Cobham rl) h) with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) | error_proj n0 n1 n2 => error_comp (error_proj n0 n1 n2) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S O)) (Nat.eqb hs (@length BC (@map Cobham BC (Cobham_to_BC' n) rl)))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) n)) (@map Cobham BC (Cobham_to_BC' n) rl)) then ok_arities (S O) n else error_comp (ok_arities hn hs) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) end (ok_arities (S O) n) *)
    rewrite leb_iff_conv in H0.
(* Goal: le x0 n0 *)
    contradict H; omega.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
    erewrite f_inf; trivial; eauto.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    simpl; rewrite <- minus_n_O; trivial.

(* Goal: @eq Arities match arities (Cobham_to_BC' (@length Cobham rl) h) with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) | error_proj n0 n1 n2 => error_comp (error_proj n0 n1 n2) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S O)) (Nat.eqb hs (@length BC (@map Cobham BC (Cobham_to_BC' n) rl)))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) n)) (@map Cobham BC (Cobham_to_BC' n) rl)) then ok_arities (S O) n else error_comp (ok_arities hn hs) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) end (ok_arities (S O) n) *)
    rewrite H1.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n (@length BC (@map nat BC (proj n O) (seq O n)))) (Nat.eqb n (@length BC (@map nat BC (proj n O) (seq O n))))) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities n O)) (@map nat BC (proj n O) (seq O n)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n O)) (@map nat BC (proj n O) (seq O n))) then ok_arities n O else error_comp (ok_arities n n) (@map BC Arities arities (@map nat BC (proj n O) (seq O n))) (@map BC Arities arities (@map nat BC (proj n O) (seq O n)))) (ok_arities n O) *)
    rewrite map_length.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb (S O) (S O)) (Nat.eqb (@length Cobham rl) (@length Cobham rl))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) n)) (@map Cobham BC (Cobham_to_BC' n) rl)) then ok_arities (S O) n else error_comp (ok_arities (S O) (@length Cobham rl)) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl))) (ok_arities (S O) n) *)
    repeat (rewrite <- beq_nat_refl; simpl).
    case_eq (forallb (fun se : BC => aeq (arities se) 
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
      (ok_arities 1 n)) (map (Cobham_to_BC' n) rl)); intros; trivial.
(* Goal: @eq Arities (error_comp (ok_arities (S O) (@length Cobham rl)) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl))) (ok_arities (S O) n) *)
    elimtype False.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    apply eq_true_false_abs in H3; trivial.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
    eapply forallb_forall; intros.
(* Goal: @eq bool (aeq (arities x) (ok_arities (S O) n)) true *)
    apply in_map_iff in H4.
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
    destruct H4 as (? & ? & ?); subst.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
    rewrite H2; simpl; trivial.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
    rewrite <- beq_nat_refl; auto.
  Qed.

Opaque f'.

Definition smash'_e : BC :=
  rec2 (proj 0 1 0) (comp 1 2 (succ false) nil [proj 1 2 1]).

(*
Eval vm_compute in arities smash'_e.
*)

Lemma smash'_correct x y :
  sem smash'_e [x] [y] = smash' x y.
Proof.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 induction x; simpl in *; intros; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 case a; rewrite IHx; clear IHx; trivial.
Qed.

Opaque smash'_e.

Definition smash_e : BC :=
  rec2 (comp 1 0 (succ true) nil [zero_e 1 0])
       (comp 2 1 smash'_e [proj 2 0 1] [proj 2 1 2]).

(*
Eval vm_compute in arities smash_e.
*)

Lemma smash_correct x y :
  sem smash_e [x;y] nil = smash_bs x y.
Proof.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 induction x; simpl in *; intros; trivial.
(* Goal: @eq (list bool) (if a then sem smash'_e (@cons (list bool) y (@nil (list bool))) (@cons (list bool) (sem_rec (fun _ _ : list (list bool) => @cons bool true (@nil bool)) (fun vnl vsl : list (list bool) => sem smash'_e (@cons (list bool) (@nth (list bool) (S O) vnl (@nil bool)) (@nil (list bool))) (@cons (list bool) (@nth (list bool) O vsl (@nil bool)) (@nil (list bool)))) (fun vnl vsl : list (list bool) => sem smash'_e (@cons (list bool) (@nth (list bool) (S O) vnl (@nil bool)) (@nil (list bool))) (@cons (list bool) (@nth (list bool) O vsl (@nil bool)) (@nil (list bool)))) x (@cons (list bool) y (@nil (list bool))) (@nil (list bool))) (@nil (list bool))) else sem smash'_e (@cons (list bool) y (@nil (list bool))) (@cons (list bool) (sem_rec (fun _ _ : list (list bool) => @cons bool true (@nil bool)) (fun vnl vsl : list (list bool) => sem smash'_e (@cons (list bool) (@nth (list bool) (S O) vnl (@nil bool)) (@nil (list bool))) (@cons (list bool) (@nth (list bool) O vsl (@nil bool)) (@nil (list bool)))) (fun vnl vsl : list (list bool) => sem smash'_e (@cons (list bool) (@nth (list bool) (S O) vnl (@nil bool)) (@nil (list bool))) (@cons (list bool) (@nth (list bool) O vsl (@nil bool)) (@nil (list bool)))) x (@cons (list bool) y (@nil (list bool))) (@nil (list bool))) (@nil (list bool)))) (smash' y (smash_bs x y)) *)
 case a; rewrite IHx; clear IHx; apply smash'_correct.
Qed.

Transparent f.

Opaque Mult_e.
Opaque Plus_e.
Opaque App_e.
 
Lemma rec_simulation_correct : forall (e : Cobham) n,
  arity e = ok_arity n ->
  forall xl w,
  rec_bounded e ->
  length xl = n ->
  peval (rec_simulation n e) (map (@length _) xl) <= length w -> 
  Sem e xl = sem (Cobham_to_BC' n e) [w] xl.
Proof.
  refine (Cobham_ind_inf 
    (fun n e => forall (xl : list bs) (w : bs),
      rec_bounded e ->
      length xl = n ->
      peval (rec_simulation n e) (map (@length _) xl) <= length w ->
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
      Sem e xl = sem (Cobham_to_BC' n e) [w] xl) _ _ _ _ _ _ ); simpl; intros; trivial.

(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
  rewrite <- minus_n_O; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
  rewrite hd_nth_0; trivial.

 rewrite <- f_correct with
   (g' := Comp 1 (Succ true) nil)
   (h0' := Comp 3 (Rec (Proj 1 0) (Comp 3 (Succ false) [Proj 3 1]) (Comp 3 (Succ false) [Proj 3 1])
     App_e) [Proj 3 2; Proj 3 1] )
   (h1' := Comp 3 (Rec (Proj 1 0) (Comp 3 (Succ false) [Proj 3 1]) (Comp 3 (Succ false) [Proj 3 1])
     App_e) [Proj 3 2; Proj 3 1] )
   (cj := Comp 2 (Succ true) [Mult_e]); try discriminate.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite Y_refl, hd_nth_0, hd_nth_1.

(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 induction (nth 0 xl nil); simpl; trivial.

 case a.
 rewrite <- IHl; clear IHl.
 generalize (smash_bs l (nth 1 xl nil)).
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 induction (nth 1 xl nil); simpl; trivial; intros.
 rewrite <- IHl0.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 case a0; trivial.
 rewrite <- IHl; clear IHl.
 generalize (smash_bs l (nth 1 xl nil)).
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 induction (nth 1 xl nil); simpl; trivial; intros.
 rewrite <- IHl0.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 case a0; trivial.

(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 intros; simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 intros; simpl; trivial.
 destruct xl0 as [ | y xl0].
 simpl in H1; discriminate.
 destruct xl0 as [ | x0 xl0].
 simpl in H1; discriminate.
 destruct xl0 as [ | x1 xl0].
 simpl in H1; discriminate.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite BC_dummies_correct; simpl; trivial.
 Transparent f_smash'.
(* Goal: @eq Arities (arities f_smash') (ok_arities (S O) (S (S O))) *)
 unfold f_smash'.
 rewrite <- f'_eq_f; try discriminate.
 Opaque App_e.
 rewrite <- f_correct with 
 (g' := Proj 1 0)
 (h0' := Comp 3 (Succ false) [Proj 3 1])
 (h1' := Comp 3 (Succ false) [Proj 3 1])
 (cj := App_e); try discriminate.
(* Goal: le x0 n0 *)
 simpl; eauto; try omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite Y_refl; simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 intros; simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 intros; simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 intros; simpl; trivial.
(* Goal: @eq Arities (arities (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar ml)) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar ml))) (@snd nat (list mon) (@pair nat (list mon) ar ml))))) (ok_arities (@fst nat (list mon) (@pair nat (list mon) ar ml)) O) *)
 simpl in *.
 repeat rewrite pplus_correct in H3.
 repeat rewrite pcst_correct in H3.
 repeat rewrite pcomp_correct in H3.
 repeat rewrite pplus_correct in H3.
 repeat rewrite pshift_correct in H3.
 repeat rewrite pcst_correct in H3.
 repeat rewrite pproj_correct in H3.
 repeat rewrite pcomp_correct in H3.
 repeat rewrite pplus_correct in H3.
 repeat rewrite pcst_correct in H3.
 repeat rewrite pcomp_correct in H3.
 repeat rewrite pcst_correct in H3.
 simpl in H3.
 repeat rewrite pproj_correct in H3.
 simpl in H3.
(* Goal: le x0 n0 *)
 omega.
 repeat (split; trivial).
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 simpl; intros. 
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
 rewrite hd_nth_0.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 induction (nth 0 l nil); simpl.
 rewrite nth_S_tl.
 rewrite length_smash'.
(* Goal: le x0 n0 *)
 simpl; omega.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 case a; simpl.
 rewrite length_smash'.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: le x0 n0 *)
 omega.
 rewrite length_smash'.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: le x0 n0 *)
 omega.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 destruct l; simpl.
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 induction l; simpl.
 rewrite App_correct.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite hd_nth_0; trivial.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 case a; simpl.
 rewrite App_correct in *.
(* Goal: @eq Arities (arities (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar ml)) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar ml))) (@snd nat (list mon) (@pair nat (list mon) ar ml))))) (ok_arities (@fst nat (list mon) (@pair nat (list mon) ar ml)) O) *)
 simpl in *.
(* Goal: le x0 n0 *)
 omega.
 rewrite App_correct in *.
(* Goal: @eq Arities (arities (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar ml)) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar ml))) (@snd nat (list mon) (@pair nat (list mon) ar ml))))) (ok_arities (@fst nat (list mon) (@pair nat (list mon) ar ml)) O) *)
 simpl in *.
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 intros; simpl; trivial.
 destruct xl0 as [ | y xl0].
 simpl in H1; discriminate.
 destruct xl0 as [ | x0 xl0].
 simpl in H1; discriminate.
 destruct xl0 as [ | x1 xl0].
 simpl in H1; discriminate.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite BC_dummies_correct; simpl; trivial.
 Transparent f_smash'.
(* Goal: @eq Arities (arities f_smash') (ok_arities (S O) (S (S O))) *)
 unfold f_smash'.
 Opaque App_e.
 rewrite <- f_correct with 
 (g' := Proj 1 0)
 (h0' := Comp 3 (Succ false) [Proj 3 1])
 (h1' := Comp 3 (Succ false) [Proj 3 1])
 (cj := App_e); try discriminate.
(* Goal: le x0 n0 *)
 simpl; eauto; try omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite Y_refl; simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 intros; simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 intros; simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 intros; simpl; trivial.
(* Goal: @eq Arities (arities (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar ml)) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar ml))) (@snd nat (list mon) (@pair nat (list mon) ar ml))))) (ok_arities (@fst nat (list mon) (@pair nat (list mon) ar ml)) O) *)
 simpl in *.
 repeat rewrite pplus_correct in H3.
 repeat rewrite pcst_correct in H3.
 repeat rewrite pcomp_correct in H3.
 repeat rewrite pplus_correct in H3.
 repeat rewrite pshift_correct in H3.
 repeat rewrite pcst_correct in H3.
 repeat rewrite pproj_correct in H3.
 repeat rewrite pcomp_correct in H3.
 repeat rewrite pplus_correct in H3.
 repeat rewrite pcst_correct in H3.
 repeat rewrite pcomp_correct in H3.
 repeat rewrite pcst_correct in H3.
 simpl in H3.
 repeat rewrite pproj_correct in H3.
 simpl in H3.
(* Goal: le x0 n0 *)
 omega.
 repeat (split; trivial).
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 simpl; intros. 
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
 rewrite hd_nth_0.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 induction (nth 0 l nil); simpl.
 rewrite nth_S_tl.
 rewrite length_smash'.
(* Goal: le x0 n0 *)
 simpl; omega.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 case a; simpl.
 rewrite length_smash'.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: le x0 n0 *)
 omega.
 rewrite length_smash'.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: le x0 n0 *)
 omega.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 destruct l; simpl.
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 induction l; simpl.
 rewrite App_correct.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite hd_nth_0; trivial.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 case a; simpl.
 rewrite App_correct in *.
(* Goal: @eq Arities (arities (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar ml)) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar ml))) (@snd nat (list mon) (@pair nat (list mon) ar ml))))) (ok_arities (@fst nat (list mon) (@pair nat (list mon) ar ml)) O) *)
 simpl in *.
(* Goal: le x0 n0 *)
 omega.
 rewrite App_correct in *.
(* Goal: @eq Arities (arities (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar ml)) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar ml))) (@snd nat (list mon) (@pair nat (list mon) ar ml))))) (ok_arities (@fst nat (list mon) (@pair nat (list mon) ar ml)) O) *)
 simpl in *.
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: le x0 n0 *)
 omega.

 repeat rewrite pcomp_correct.
 repeat rewrite pplus_correct.
 simpl peval.
 repeat rewrite pplus_correct.
 repeat rewrite pcst_correct.
 repeat rewrite pcomp_correct.
 repeat rewrite pplus_correct.
 repeat rewrite pcomp_correct.
 repeat rewrite pplus_correct.
 repeat rewrite pcst_correct.
 repeat rewrite pcomp_correct.
 repeat rewrite pcst_correct.
 repeat rewrite pshift_correct.
 repeat rewrite pcst_correct.
 repeat rewrite pproj_correct.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 repeat rewrite pproj_correct.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 eapply le_trans with (2 := H1).
 repeat rewrite pplus_correct.
 repeat rewrite pcomp_correct.
 repeat rewrite pplus_correct.
 repeat rewrite pshift_correct.
 repeat rewrite pcst_correct.
 repeat rewrite pproj_correct.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 repeat rewrite pproj_correct.
 erewrite map_nth2.
 instantiate (1:=nil).
 erewrite map_nth2.
 instantiate (1:=nil).
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.

 repeat (split; trivial).

(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 intros; simpl.
 rewrite hd_nth_0.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 induction (nth 0 l nil); simpl.
 rewrite length_smash'.
 rewrite nth_S_tl.
(* Goal: le x0 n0 *)
 simpl; omega.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 case a; simpl.
 rewrite length_smash'.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: le x0 n0 *)
 omega.
 rewrite length_smash'.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: le x0 n0 *)
 omega.
 
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
 rewrite App_correct.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite app_length.
 rewrite length_smash'.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite hd_nth_0; trivial.
 rewrite length_smash.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite hd_nth_1.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 destruct l; simpl.
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 destruct l0; simpl.
(* Goal: le x0 n0 *)
 omega.
 rewrite plus_n_Sm.
 rewrite plus_comm.
 apply plus_le_compat_l.
 apply le_trans with ( S (S (length l * 1))).
(* Goal: le x0 n0 *)
 omega.
 apply le_n_S.
 apply le_n_S.
 apply mult_le_compat_l.
(* Goal: le x0 n0 *)
 omega.
 
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
 rewrite hd_nth_0.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 induction (nth 0 l nil); simpl.
 rewrite length_smash'.
 rewrite length_smash'.
(* Goal: le x0 n0 *)
 simpl; omega.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 case a; simpl.
 rewrite length_smash'.
 rewrite length_smash'.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite nth_S_tl.
 rewrite App_correct.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite app_length.
 rewrite length_smash'.
 rewrite length_smash.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 eapply le_trans.
 apply plus_le_compat_r.
 apply IHl0.
 rewrite length_smash'.
 rewrite length_smash'.
 rewrite length_smash.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: le x0 n0 *)
 omega.
 rewrite length_smash'.
 rewrite length_smash'.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite nth_S_tl.
 rewrite App_correct.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite app_length.
 rewrite length_smash'.
 rewrite length_smash.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 eapply le_trans.
 apply plus_le_compat_r.
 apply IHl0.
 rewrite length_smash'.
 rewrite length_smash'.
 rewrite length_smash.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: le x0 n0 *)
 omega.

(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite length_smash'.
 rewrite length_smash.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite hd_nth_0.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 induction (nth 0 l nil); simpl.
 rewrite nth_S_tl.
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 case a; simpl.
(* Goal: le x0 n0 *)
 omega.
(* Goal: le x0 n0 *)
 omega.

(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite App_correct.
 rewrite app_length.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 induction (hd nil l); simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite hd_nth_0; trivial.
(* Goal: le x0 n0 *)
 case a; simpl; omega.

(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite length_smash'.
 rewrite length_smash.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite hd_nth_0.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 induction (nth 0 l nil); simpl.
 rewrite nth_S_tl.
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 case a; simpl.
(* Goal: le x0 n0 *)
 omega.
(* Goal: le x0 n0 *)
 omega.

(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite App_correct.
 rewrite app_length.
 rewrite hd_nth_1.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 induction (hd nil l); simpl.
 rewrite nth_S_tl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: le x0 n0 *)
 case a; simpl; omega.

(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite Mult_correct.
 rewrite hd_nth_1.
 rewrite hd_nth_0.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 induction (nth 0 l nil); simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
 case a.
 rewrite nth_S_tl.
 rewrite plus_n_Sm.
 eapply le_trans.
 2: apply plus_le_compat_l.
 2: apply IHl0.
 clear IHl0.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 induction (nth 1 l nil); simpl; trivial.
(* Goal: le x0 n0 *)
 case a0; simpl; omega.
 rewrite nth_S_tl.
 rewrite plus_n_Sm.
 eapply le_trans.
 2: apply plus_le_compat_l.
 2: apply IHl0.
 clear IHl0.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 induction (nth 1 l nil); simpl; trivial.
(* Goal: le x0 n0 *)
 case a0; simpl; omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.
(* Goal: le x0 n0 *)
 omega.
(* Goal: le x0 n0 *)
 omega.

 destruct xl as [ | y xl].
 simpl in H9; discriminate.
 simpl hd; simpl tl.

 repeat rewrite pplus_correct in H9; 
   repeat rewrite pcst_correct in H9; 
     repeat rewrite pproj_correct in H9.

 assert (S (length y) < length w).
 eapply le_trans; [ | eauto].
(* Goal: le x0 n0 *)
 simpl; omega.

(* Goal: le x0 n0 *)
 assert (1 < length w - length y) by omega.
 simpl length.

 pattern y at 1.
 rewrite <- Y_refl with (x := w) (y := y).

 assert ( forall u, length u <= length w ->
   length (Y u w y) <= length (Y w w y)).
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
 repeat rewrite Y_skipn.
 repeat rewrite skipn_length.
(* Goal: le x0 n0 *)
 omega.

 intros; rewrite <- minus_n_O in *.

(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: le x0 n0 *)
 erewrite <- f_correct; simpl; eauto; try omega.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite map_map; simpl.
 rewrite <- seq_shift.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite <- seq_shift.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite map_nth_seq.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: le x0 n0 *)
 simpl in H8; omega.
 
 intros; rewrite <- minus_n_O in *.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 apply H3; auto; tauto.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 intros; apply H4; auto; tauto.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 intros; apply H5; auto; tauto.

(* Goal: @eq Arities (arities (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar ml)) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar ml))) (@snd nat (list mon) (@pair nat (list mon) ar ml))))) (ok_arities (@fst nat (list mon) (@pair nat (list mon) ar ml)) O) *)
 simpl in *.

 eapply le_trans.
 2: apply H9.

 repeat rewrite pcomp_correct.
 repeat rewrite pplus_correct.

(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
 injection H8; clear H8; intros; subst.
 apply plus_le_compat.
 apply plus_le_compat.

 apply peval_monotonic.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 intros; simpl.
 destruct i.
 repeat rewrite pproj_correct.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite map_map; simpl; trivial.
 destruct i.
 apply peval_monotonic.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 intros; simpl.
 destruct i.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite map_map; simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite map_map; simpl; trivial.
 rewrite <- seq_shift.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite <- seq_shift.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 match goal with [ |- ?a <= ?b] => assert (a = b) end. 
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
 clear.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 induction xl; simpl; trivial.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
 rewrite <- IHxl.
 rewrite <- seq_shift.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 rewrite H8; auto.
 match goal with [ |- ?a <= ?b] => assert (a = b) end. 
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite map_map; simpl.
 repeat rewrite <- seq_shift.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 repeat rewrite map_map; simpl.
(* Goal: @eq Arities (if andb (Nat.eqb (Init.Nat.sub n O) n) true then ok_arities (S (S O)) (S (Init.Nat.sub n O)) else error_rec (ok_arities (S O) (S (Init.Nat.sub n O))) (ok_arities (S (S O)) (S (S n))) (ok_arities (S (S O)) (S (S n)))) (ok_arities (S (S O)) (S n)) *)
 repeat rewrite <- minus_n_O.
 rewrite map_nth_seq.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 apply map_ext.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
 repeat rewrite pproj_correct.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 clear.
 revert a.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 induction xl; simpl; intros.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 destruct a0; trivial.
 rewrite <- seq_shift.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
 apply IHxl.
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 rewrite H8; auto.
 apply peval_monotonic.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 intros; simpl.
 destruct i.
 repeat rewrite pproj_correct.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite map_map; simpl; trivial.
 destruct i.
 apply peval_monotonic.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 intros; simpl.
 destruct i.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite map_map; simpl; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite map_map; simpl; trivial.
 rewrite <- seq_shift.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 rewrite <- seq_shift.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 match goal with [ |- ?a <= ?b] => assert (a = b) end. 
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
 clear.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 induction xl; simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
 rewrite <- IHxl.
 rewrite <- seq_shift.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 rewrite H8; auto.
 match goal with [ |- ?a <= ?b] => assert (a = b) end. 
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite map_map; simpl.
 repeat rewrite <- seq_shift.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 repeat rewrite map_map; simpl.
(* Goal: @eq Arities (if andb (Nat.eqb (Init.Nat.sub n O) n) true then ok_arities (S (S O)) (S (Init.Nat.sub n O)) else error_rec (ok_arities (S O) (S (Init.Nat.sub n O))) (ok_arities (S (S O)) (S (S n))) (ok_arities (S (S O)) (S (S n)))) (ok_arities (S (S O)) (S n)) *)
 repeat rewrite <- minus_n_O.
 rewrite map_nth_seq.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 apply map_ext.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
 repeat rewrite pproj_correct.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 clear.
 revert a.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 induction xl; simpl; intros.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 destruct a0; trivial.
 rewrite <- seq_shift.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
 apply IHxl.
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 rewrite H8; auto.
 rewrite pshift_correct.
 rewrite pshift_correct.
 apply plus_le_compat_r.
(* Goal: @eq Arities (if andb (Nat.eqb (Init.Nat.sub n O) n) true then ok_arities (S (S O)) (S (Init.Nat.sub n O)) else error_rec (ok_arities (S O) (S (Init.Nat.sub n O))) (ok_arities (S (S O)) (S (S n))) (ok_arities (S (S O)) (S (S n)))) (ok_arities (S (S O)) (S n)) *)
 rewrite <- minus_n_O.
 apply peval_monotonic.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 intros; simpl.
 match goal with [ |- ?a <= ?b] => assert (a = b) end. 
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite map_map; simpl.
 repeat rewrite <- seq_shift.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 repeat rewrite map_map; simpl.
 clear.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 induction xl; simpl; intros.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
 rewrite <- seq_shift.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
 rewrite <- H8.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n (@length BC (@map nat BC (proj n O) (seq O n)))) (Nat.eqb n (@length BC (@map nat BC (proj n O) (seq O n))))) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities n O)) (@map nat BC (proj n O) (seq O n)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n O)) (@map nat BC (proj n O) (seq O n))) then ok_arities n O else error_comp (ok_arities n n) (@map BC Arities arities (@map nat BC (proj n O) (seq O n))) (@map BC Arities arities (@map nat BC (proj n O) (seq O n)))) (ok_arities n O) *)
 rewrite map_length.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n (@length nat (seq O n))) (Nat.eqb n (@length nat (seq O n)))) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities n O)) (@map nat BC (proj n O) (seq O n)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n O)) (@map nat BC (proj n O) (seq O n))) then ok_arities n O else error_comp (ok_arities n n) (@map BC Arities arities (@map nat BC (proj n O) (seq O n))) (@map BC Arities arities (@map nat BC (proj n O) (seq O n)))) (ok_arities n O) *)
 rewrite seq_length.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.

 destruct H3.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 erewrite H1; eauto.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb (S x) O then match x with | O => @nil bool | S m => @nil bool end else match Init.Nat.sub (S x) (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (seq (S O) (@length (list bool) xl))) *)
 apply map_ext2.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 eapply H2; trivial.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 rewrite <- forall_andl in H6; auto.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 eapply le_trans with (2 := H5); simpl.
 repeat rewrite pplus_correct.
 repeat rewrite pcomp_correct.
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
 subst.
 eapply le_trans with (peval 
   (pplusl (map (rec_simulation (length xl)) rl)) (map (@length _) xl));[ | omega].
 rewrite pplusl_correct. 
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
 revert H7.
 clear.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 induction rl; simpl in *; intros.
 elim H7.
 destruct H7.
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
 subst.
(* Goal: le x0 n0 *)
 omega.
 eapply le_trans.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 apply IHrl; trivial.
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite map_length; trivial.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 eapply le_trans with (2 := H5); simpl.
 do 2 rewrite pplus_correct.
 rewrite pcomp_correct.
 rewrite pcst_correct.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
 apply le_plus_trans.
 apply peval_monotonic.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
 rewrite map_nth2 with (d := Zero).
 rewrite map_nth2 with (d := Zero).
 apply poly_Cobham_correct.
 revert H6; clear.
 revert i.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 induction rl; simpl; intros.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 case i; simpl; trivial.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 case i; simpl; intros.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 tauto.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 apply IHrl; tauto.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
Qed.

Definition concat := smash'_e.

Definition poly_BC_pow (ar:nat)(xn:pow) : BC :=
  multl_e ar (repeat (snd xn) (proj ar 0 (fst xn))).

Lemma poly_BC_pow_arities :
  forall ar xn, pWF_pow ar xn -> arities (poly_BC_pow ar xn) = ok_arities ar 0.
Proof.
(* Goal: forall (ar : nat) (xn : pow) (_ : pWF_pow ar xn), @eq Arities (arities (poly_BC_pow ar xn)) (ok_arities ar O) *)
unfold poly_BC_pow.
(* Goal: forall (ar : nat) (xn : mon) (_ : @andl pow (pWF_pow ar) (@snd nat (list pow) xn)), @eq Arities (arities (multl_e ar (@cons BC (nat2BC ar O (@fst nat (list pow) xn)) (@map pow BC (poly_BC_pow ar) (@snd nat (list pow) xn))))) (ok_arities ar O) *)
intros ar [x n] Hwf.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: @eq Arities (arities (multl_e ar (@repeat BC n (proj ar O x)))) (ok_arities ar O) *)
induction n as [ | n IH].
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: @eq Arities (arities (multl_e ar (@repeat BC (S n) (proj ar O x)))) (ok_arities ar O) *)
apply multl_arities.
(* Goal: @andl BC (fun e : BC => @eq Arities (arities e) (ok_arities ar O)) (@map mon BC (poly_BC_mon ar) ml) *)
rewrite <- forall_andl.
(* Goal: forall (x0 : BC) (_ : @In BC x0 (@repeat BC (S n) (proj ar O x))), @eq Arities (arities x0) (ok_arities ar O) *)
intros e H.
(* Goal: @eq Arities (arities e) (ok_arities ar O) *)
apply in_repeat_eq in H.
(* Goal: @eq Arities (arities e) (ok_arities ar O) *)
subst e.
(* Goal: @eq Arities (arities (proj ar O x)) (ok_arities ar O) *)
rewrite proj_arities.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: lt x (Init.Nat.add ar O) *)
auto with arith.
Qed.

Lemma poly_BC_pow_correct :
  forall ar xn nl, pWF_pow ar xn ->
  length (sem (poly_BC_pow ar xn) nl nil) = peval_pow xn (map (@length _) nl).
Proof.
unfold poly_BC_pow, peval_pow, pWF_pow.
intros ar [x n] nl Hwf.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
(* Goal: @eq nat (@length bool (sem (multl_e ar (@cons BC (nat2BC ar O (@fst nat (list pow) (@pair nat (list pow) ar' xnl))) (@map pow BC (poly_BC_pow ar) (@snd nat (list pow) (@pair nat (list pow) ar' xnl))))) nl (@nil (list bool)))) (Init.Nat.mul (@fst nat (list pow) (@pair nat (list pow) ar' xnl)) (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) (@snd nat (list pow) (@pair nat (list pow) ar' xnl))))) *)
rewrite multl_correct.
rewrite map_repeat.
rewrite multl_repeat_power.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
f_equal.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
simpl.
destruct ar as [ | ar].
(* Goal: le x0 n0 *)
omega.
(* Goal: forall _ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) O, @eq Arities (if andb (andb (aeq (error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
(* Goal: forall (n1 : nat) (_ : @eq nat (Init.Nat.add (Init.Nat.add n (S n0)) O) (S n1)), @eq Arities (if andb (andb (aeq (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (ok_arities (Init.Nat.add n (S n0)) O)) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities (Init.Nat.add n (S n0)) O)) (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (andb (aeq (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)))) (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0)))) then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_comp (ok_arities (S n0) (S s0)) (@cons Arities (if Nat.leb n n1 then ok_arities (Init.Nat.add n (S n0)) O else error_proj (Init.Nat.add n (S n0)) O n) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) O) (seq (S n) n0)))) (@cons Arities (if match Init.Nat.add (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) with | O => false | S m' => Nat.leb (Init.Nat.add (Init.Nat.add n (S n0)) s) m' end then ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) else error_proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0)) (Init.Nat.add (Init.Nat.add n (S n0)) s)) (@map BC Arities arities (@map nat BC (proj (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) (seq (S (Init.Nat.add (Init.Nat.add n (S n0)) s)) s0))))) (ok_arities (Init.Nat.add n (S n0)) (Init.Nat.add s (S s0))) *)
case_eq (leb x ar); intro H0.
apply leb_complete in H0.
erewrite map_nth2.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
apply leb_complete_conv in H0.
(* Goal: @eq nat (plusl (@map mon nat (fun x : mon => @length bool (sem (poly_BC_mon ar x) nl (@nil (list bool)))) (@cons mon m ml))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
simpl in Hwf.
(* Goal: le x0 n0 *)
omega.
Qed.

Opaque poly_BC_pow.

Definition poly_BC_mon (ar:nat)(m:mon) : BC :=
  multl_e ar (nat2BC ar 0 (fst m) :: map (poly_BC_pow ar) (snd m)).

Lemma poly_BC_mon_arities :
  forall ar xn, pWF_mon ar xn -> arities (poly_BC_mon ar xn) = ok_arities ar 0.
Proof.
(* Goal: forall (ar : nat) (xn : mon) (_ : pWF_mon ar xn), @eq Arities (arities (poly_BC_mon ar xn)) (ok_arities ar O) *)
unfold poly_BC_mon, pWF_mon.
(* Goal: forall (ar : nat) (xn : mon) (_ : @andl pow (pWF_pow ar) (@snd nat (list pow) xn)), @eq Arities (arities (multl_e ar (@cons BC (nat2BC ar O (@fst nat (list pow) xn)) (@map pow BC (poly_BC_pow ar) (@snd nat (list pow) xn))))) (ok_arities ar O) *)
intros ar [x n] Hwf.
(* Goal: @eq Arities (arities (multl_e ar (@cons BC (nat2BC ar O (@fst nat (list pow) (@pair nat (list pow) x n))) (@map pow BC (poly_BC_pow ar) (@snd nat (list pow) (@pair nat (list pow) x n)))))) (ok_arities ar O) *)
rewrite multl_arities.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: @eq Arities (arities (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar ml)) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar ml))) (@snd nat (list mon) (@pair nat (list mon) ar ml))))) (ok_arities (@fst nat (list mon) (@pair nat (list mon) ar ml)) O) *)
simpl in *.
(* Goal: and (@eq Arities (arities (nat2BC ar O x)) (ok_arities ar O)) (@andl BC (fun e : BC => @eq Arities (arities e) (ok_arities ar O)) (@map pow BC (poly_BC_pow ar) n)) *)
split.
(* Goal: @eq Arities (arities (nat2BC ar O x)) (ok_arities ar O) *)
(* Goal: @andl BC (fun e : BC => @eq Arities (arities e) (ok_arities ar O)) (@map pow BC (poly_BC_pow ar) n) *)
apply nat2BC_arities.
(* Goal: @andl BC (fun e : BC => @eq Arities (arities e) (ok_arities ar O)) (@map pow BC (poly_BC_pow ar) n) *)
rewrite <- forall_andl in *.
(* Goal: forall (x : BC) (_ : @In BC x (@map mon BC (poly_BC_mon ar) ml)), @eq Arities (arities x) (ok_arities ar O) *)
intros e He.
(* Goal: @eq Arities (arities e) (ok_arities ar O) *)
rewrite in_map_iff in He.
(* Goal: @eq Arities (arities e) (ok_arities ar O) *)
destruct He as [xn [H1 H2] ].
(* Goal: @eq Arities (arities e) (ok_arities ar O) *)
subst e.
(* Goal: @eq Arities (arities (poly_BC_pow ar xn)) (ok_arities ar O) *)
apply poly_BC_pow_arities.
(* Goal: pWF_mon ar m *)
apply Hwf.
(* Goal: @In mon m ml *)
exact H2.
Qed.

Lemma poly_BC_mon_correct :
    forall ar m nl, pWF_mon ar m ->
  length (sem (poly_BC_mon ar m) nl nil) = peval_mon m (map (@length _) nl).
Proof.
(* Goal: forall (ar : nat) (m : mon) (nl : list (list bool)) (_ : pWF_mon ar m), @eq nat (@length bool (sem (poly_BC_mon ar m) nl (@nil (list bool)))) (peval_mon m (@map (list bool) nat (@length bool) nl)) *)
unfold poly_BC_mon, peval_mon, pWF_mon.
(* Goal: forall (ar : nat) (m : mon) (nl : list (list bool)) (_ : @andl pow (pWF_pow ar) (@snd nat (list pow) m)), @eq nat (@length bool (sem (multl_e ar (@cons BC (nat2BC ar O (@fst nat (list pow) m)) (@map pow BC (poly_BC_pow ar) (@snd nat (list pow) m)))) nl (@nil (list bool)))) (Init.Nat.mul (@fst nat (list pow) m) (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) (@snd nat (list pow) m)))) *)
intros ar [ar' xnl] nl H.
(* Goal: @eq nat (@length bool (sem (multl_e ar (@cons BC (nat2BC ar O (@fst nat (list pow) (@pair nat (list pow) ar' xnl))) (@map pow BC (poly_BC_pow ar) (@snd nat (list pow) (@pair nat (list pow) ar' xnl))))) nl (@nil (list bool)))) (Init.Nat.mul (@fst nat (list pow) (@pair nat (list pow) ar' xnl)) (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) (@snd nat (list pow) (@pair nat (list pow) ar' xnl))))) *)
rewrite multl_correct.
(* Goal: @eq Arities (arities (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar ml)) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar ml))) (@snd nat (list mon) (@pair nat (list mon) ar ml))))) (ok_arities (@fst nat (list mon) (@pair nat (list mon) ar ml)) O) *)
simpl in *.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
induction xnl as [ | xn xnl IH ]; simpl.
(* Goal: @eq nat (Init.Nat.mul (@length bool (sem (nat2BC ar O ar') nl (@nil (list bool)))) (S O)) (Init.Nat.mul ar' (S O)) *)
(* Goal: @eq nat (Init.Nat.mul (@length bool (sem (nat2BC ar O ar') nl (@nil (list bool)))) (Init.Nat.mul (@length bool (sem (poly_BC_pow ar xn) nl (@nil (list bool)))) (multl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) (@map pow BC (poly_BC_pow ar) xnl))))) (Init.Nat.mul ar' (Init.Nat.mul (peval_pow xn (@map (list bool) nat (@length bool) nl)) (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) xnl)))) *)
rewrite nat2BC_correct.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: @eq nat (Init.Nat.mul (@length bool (sem (nat2BC ar O ar') nl (@nil (list bool)))) (Init.Nat.mul (@length bool (sem (poly_BC_pow ar xn) nl (@nil (list bool)))) (multl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) (@map pow BC (poly_BC_pow ar) xnl))))) (Init.Nat.mul ar' (Init.Nat.mul (peval_pow xn (@map (list bool) nat (@length bool) nl)) (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) xnl)))) *)
simpl in H.
(* Goal: @eq nat (Init.Nat.mul (@length bool (sem (nat2BC ar O ar') nl (@nil (list bool)))) (Init.Nat.mul (@length bool (sem (poly_BC_pow ar xn) nl (@nil (list bool)))) (multl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) (@map pow BC (poly_BC_pow ar) xnl))))) (Init.Nat.mul ar' (Init.Nat.mul (peval_pow xn (@map (list bool) nat (@length bool) nl)) (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) xnl)))) *)
rewrite nat2BC_correct, poly_BC_pow_correct.
(* Goal: @eq nat (Init.Nat.mul ar' (Init.Nat.mul (peval_pow xn (@map (list bool) nat (@length bool) nl)) (multl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) (@map pow BC (poly_BC_pow ar) xnl))))) (Init.Nat.mul ar' (Init.Nat.mul (peval_pow xn (@map (list bool) nat (@length bool) nl)) (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) xnl)))) *)
(* Goal: pWF_pow ar xn *)
rewrite nat2BC_correct in IH.
(* Goal: @eq nat (Init.Nat.mul ar' (Init.Nat.mul (peval_pow xn (@map (list bool) nat (@length bool) nl)) (multl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) (@map pow BC (poly_BC_pow ar) xnl))))) (Init.Nat.mul ar' (Init.Nat.mul (peval_pow xn (@map (list bool) nat (@length bool) nl)) (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) xnl)))) *)
(* Goal: pWF_pow ar xn *)
rewrite (mult_comm (peval_pow _ _)).
(* Goal: @eq nat (Init.Nat.mul ar' (Nat.mul (multl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) (@map pow BC (poly_BC_pow ar) xnl))) (peval_pow xn (@map (list bool) nat (@length bool) nl)))) (Init.Nat.mul ar' (Init.Nat.mul (peval_pow xn (@map (list bool) nat (@length bool) nl)) (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) xnl)))) *)
(* Goal: pWF_pow ar xn *)
rewrite mult_assoc.
(* Goal: @eq nat (Nat.mul (Nat.mul ar' (multl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) (@map pow BC (poly_BC_pow ar) xnl)))) (peval_pow xn (@map (list bool) nat (@length bool) nl))) (Init.Nat.mul ar' (Init.Nat.mul (peval_pow xn (@map (list bool) nat (@length bool) nl)) (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) xnl)))) *)
(* Goal: pWF_pow ar xn *)
rewrite IH.
(* Goal: @eq nat (Nat.mul (Init.Nat.mul ar' (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) xnl))) (peval_pow xn (@map (list bool) nat (@length bool) nl))) (Init.Nat.mul ar' (Init.Nat.mul (peval_pow xn (@map (list bool) nat (@length bool) nl)) (multl (@map pow nat (fun x : pow => peval_pow x (@map (list bool) nat (@length bool) nl)) xnl)))) *)
(* Goal: @andl pow (pWF_pow ar) xnl *)
(* Goal: pWF_pow ar xn *)
ring.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
tauto.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
tauto.
Qed.

Definition poly_BC (p : pol) : BC :=
  plusl_e (fst p) (map (poly_BC_mon (fst p)) (snd p)).

Lemma poly_BC_arities :
  forall p, pWF p -> arities (poly_BC p) = ok_arities (parity p) 0.
Proof.
(* Goal: forall (p : pol) (nl : list (list bool)) (_ : pWF p), @eq nat (@length bool (sem (poly_BC p) nl (@nil (list bool)))) (peval p (@map (list bool) nat (@length bool) nl)) *)
unfold poly_BC, pWF, pWF'.
(* Goal: forall (p : pol) (_ : @andl mon (pWF_mon (@fst nat (list mon) p)) (@snd nat (list mon) p)), @eq Arities (arities (plusl_e (@fst nat (list mon) p) (@map mon BC (poly_BC_mon (@fst nat (list mon) p)) (@snd nat (list mon) p)))) (ok_arities (@fst nat (list mon) p) O) *)
intros [ar ml] Hwf.
(* Goal: @eq Arities (arities (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar ml)) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar ml))) (@snd nat (list mon) (@pair nat (list mon) ar ml))))) (ok_arities (@fst nat (list mon) (@pair nat (list mon) ar ml)) O) *)
simpl in *.
(* Goal: @eq Arities (arities (plusl_e ar (@map mon BC (poly_BC_mon ar) ml))) (ok_arities ar O) *)
rewrite plusl_arities.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
trivial.
(* Goal: @andl BC (fun e : BC => @eq Arities (arities e) (ok_arities ar O)) (@map mon BC (poly_BC_mon ar) ml) *)
rewrite <- forall_andl in Hwf.
(* Goal: @andl BC (fun e : BC => @eq Arities (arities e) (ok_arities ar O)) (@map mon BC (poly_BC_mon ar) ml) *)
rewrite <- forall_andl.
(* Goal: forall (x : BC) (_ : @In BC x (@map mon BC (poly_BC_mon ar) ml)), @eq Arities (arities x) (ok_arities ar O) *)
intros e He.
(* Goal: @eq Arities (arities e) (ok_arities ar O) *)
rewrite in_map_iff in He.
(* Goal: @eq Arities (arities e) (ok_arities ar O) *)
destruct He as [m [H1 H2] ].
(* Goal: @eq Arities (arities e) (ok_arities ar O) *)
subst e.
(* Goal: @eq Arities (arities (poly_BC_mon ar m)) (ok_arities ar O) *)
apply poly_BC_mon_arities.
(* Goal: pWF_mon ar m *)
apply Hwf.
(* Goal: @In mon m ml *)
exact H2.
Qed.

Lemma poly_BC_correct :
  forall p nl, pWF p ->
    length (sem (poly_BC p) nl nil) = peval p (map (@length _) nl).
Proof.
(* Goal: forall (p : pol) (nl : list (list bool)) (_ : pWF p), @eq nat (@length bool (sem (poly_BC p) nl (@nil (list bool)))) (peval p (@map (list bool) nat (@length bool) nl)) *)
  unfold poly_BC, pWF, pWF'.
(* Goal: forall (p : pol) (nl : list (list bool)) (_ : @andl mon (pWF_mon (@fst nat (list mon) p)) (@snd nat (list mon) p)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) p) (@map mon BC (poly_BC_mon (@fst nat (list mon) p)) (@snd nat (list mon) p))) nl (@nil (list bool)))) (peval p (@map (list bool) nat (@length bool) nl)) *)
  intros [ar ml] nl Hwf.
(* Goal: @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar ml)) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar ml))) (@snd nat (list mon) (@pair nat (list mon) ar ml)))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar ml) (@map (list bool) nat (@length bool) nl)) *)
  induction ml as [ | m ml IH].
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
  trivial.
(* Goal: @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
  generalize plusl_correct.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
  intros.
(* Goal: @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
  rewrite H in *.
(* Goal: @eq nat (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
  rewrite map_map in *.
(* Goal: @eq nat (plusl (@map mon nat (fun x : mon => @length bool (sem (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) x) nl (@nil (list bool)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
  simpl fst in *.
(* Goal: @eq nat (plusl (@map mon nat (fun x : mon => @length bool (sem (poly_BC_mon ar x) nl (@nil (list bool)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
  simpl snd in *.
(* Goal: @eq nat (plusl (@map mon nat (fun x : mon => @length bool (sem (poly_BC_mon ar x) nl (@nil (list bool)))) (@cons mon m ml))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
  simpl in Hwf.
(* Goal: @eq nat (plusl (@map mon nat (fun x : mon => @length bool (sem (poly_BC_mon ar x) nl (@nil (list bool)))) (@cons mon m ml))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
  rewrite map_cons, plusl_cons, IH.
  generalize  poly_BC_mon_correct.
(* Goal: forall _ : forall (ar : nat) (m : mon) (nl : list (list bool)) (_ : pWF_mon ar m), @eq nat (@length bool (sem (poly_BC_mon ar m) nl (@nil (list bool)))) (peval_mon m (@map (list bool) nat (@length bool) nl)), @eq nat (Init.Nat.add (@length bool (sem (poly_BC_mon ar m) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar ml) (@map (list bool) nat (@length bool) nl))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
(* Goal: @andl mon (pWF_mon ar) ml *)
  intros; rewrite H0.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
  trivial.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
  tauto.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
  tauto.
Qed.

Definition Cobham_to_BC'' n e :=
  comp n n (Cobham_to_BC' n e) [poly_BC (rec_simulation n e)] 
  (map (proj n n) (seq n n)).

Lemma Cobham_to_BC''_inf : forall e n,
  arity e = ok_arity n ->
  arities (Cobham_to_BC'' n e) = ok_arities n n.
Proof.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 intros; simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 erewrite Cobham_to_BC'_inf; simpl; trivial.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n (@length BC (@map nat BC (proj n O) (seq O n)))) (Nat.eqb n (@length BC (@map nat BC (proj n O) (seq O n))))) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities n O)) (@map nat BC (proj n O) (seq O n)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n O)) (@map nat BC (proj n O) (seq O n))) then ok_arities n O else error_comp (ok_arities n n) (@map BC Arities arities (@map nat BC (proj n O) (seq O n))) (@map BC Arities arities (@map nat BC (proj n O) (seq O n)))) (ok_arities n O) *)
 rewrite map_length.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n (@length nat (seq O n))) (Nat.eqb n (@length nat (seq O n)))) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities n O)) (@map nat BC (proj n O) (seq O n)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n O)) (@map nat BC (proj n O) (seq O n))) then ok_arities n O else error_comp (ok_arities n n) (@map BC Arities arities (@map nat BC (proj n O) (seq O n))) (@map BC Arities arities (@map nat BC (proj n O) (seq O n)))) (ok_arities n O) *)
 rewrite seq_length.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite <- beq_nat_refl; simpl.
(* Goal: @eq Arities (if andb (andb (aeq (arities (poly_BC (rec_simulation n e))) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (arities (poly_BC (rec_simulation n e))) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
 erewrite poly_BC_arities.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite rec_simulation_arity; trivial.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite <- beq_nat_refl; simpl.
 case_eq ( forallb (fun se : BC => aeq (arities se) (ok_arities n n))
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
         (map (proj n n) (seq n n)) ); intros.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: @eq Arities (error_comp (ok_arities n n) (@map BC Arities arities (@map nat BC (proj n O) (seq O n))) (@map BC Arities arities (@map nat BC (proj n O) (seq O n)))) (ok_arities n O) *)
 elimtype False; apply eq_true_false_abs with (2 := H0).
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 rewrite forallb_forall; intros.
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
 apply in_map_iff in H1.
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
 destruct H1 as (? & ? & ?).
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
 subst.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.
(* Goal: @eq bool (aeq (if match Init.Nat.add n O with | O => false | S m' => Nat.leb x0 m' end then ok_arities n O else error_proj n O x0) (ok_arities n O)) true *)
 apply in_seq_iff in H2.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 case_eq (n + n); intros.
(* Goal: le x0 n0 *)
 elimtype False; omega.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite leb_correct; simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite <- beq_nat_refl; simpl; trivial.
(* Goal: le x0 n0 *)
 omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 apply pWF_rec_simulation; trivial.
Qed.

Lemma seq_map : forall A len start (f : nat -> A),
  map (fun x => f x) (seq start len) = map (fun x => f (x + start)) (seq 0 len).
Proof.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 induction len; simpl; intros.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
 repeat rewrite <- seq_shift.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 repeat rewrite map_map.
(* Goal: @eq (list A) (@map nat A (fun x : nat => f0 (S x)) (seq start len)) (@map nat A (fun x : nat => f0 (Init.Nat.add (S x) start)) (seq O len)) *)
 apply IHlen.
Qed.

Lemma Cobham_to_BC''_correct : forall e xl n,
  rec_bounded e ->
  arity e = ok_arity n ->
  length xl = n ->
  Sem e xl = sem (Cobham_to_BC'' n e) xl xl.
Proof.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 intros; unfold Cobham_to_BC''; simpl.
(* Goal: @eq nat (@fst nat (list mon) (rec_simulation n x0)) n *)
 erewrite rec_simulation_correct; eauto.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
 rewrite seq_map.
 assert (forall k, n <= k -> sem (proj n n k) xl xl =  nth (k - n) xl nil) .
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 intros.
(* Goal: @eq Arities (if match n with | O => false | S m' => Nat.leb i m' end then ok_arities (S O) n else error_proj (S O) n (S i)) (ok_arities (S O) n) *)
(* Goal: @eq Arities (arities (f (S n) (Cobham_to_BC' (Init.Nat.sub n O) g) (Cobham_to_BC' (S (S n)) h0) (Cobham_to_BC' (S (S n)) h1))) (ok_arities (S O) (S n)) *)
(* Goal: @eq Arities match arities (Cobham_to_BC' (@length Cobham rl) h) with | error_rec a a0 a1 => error_comp (error_rec a a0 a1) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) | error_comp a l l0 => error_comp (error_comp a l l0) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) | error_proj n0 n1 n2 => error_comp (error_proj n0 n1 n2) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) | ok_arities hn hs => if andb (andb (andb (Nat.eqb hn (S O)) (Nat.eqb hs (@length BC (@map Cobham BC (Cobham_to_BC' n) rl)))) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities (S O) n)) (@map Cobham BC (Cobham_to_BC' n) rl)) then ok_arities (S O) n else error_comp (ok_arities hn hs) (@cons Arities (ok_arities (S O) O) (@nil Arities)) (@map BC Arities arities (@map Cobham BC (Cobham_to_BC' n) rl)) end (ok_arities (S O) n) *)
 destruct n.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
 rewrite leb_correct_conv.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 trivial.
(* Goal: le x0 n0 *)
 omega.
 transitivity ( map (fun x : nat => nth x xl nil) (seq 0 n) ).
 rewrite map_nth_seq.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.
(* Goal: le x0 n0 *)
 omega.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 apply map_ext2; intros.
 rewrite H2.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 f_equal.
(* Goal: le x0 n0 *)
 omega.
(* Goal: le x0 n0 *)
 apply in_seq_iff in H3; omega.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite poly_BC_correct; trivial.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 apply pWF_rec_simulation; trivial.
Qed.

Opaque Cobham_to_BC''.

Definition Cobham_to_BC n e :=
  comp n 0 (Cobham_to_BC'' n e) 
  (map (proj n 0) (seq 0 n))
  (map (proj n 0) (seq 0 n)).

Lemma Cobham_to_BC_inf : forall e n,
  arity e = ok_arity n ->
  arities (Cobham_to_BC n e) = ok_arities n 0.
Proof.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 intros; simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 erewrite Cobham_to_BC''_inf; simpl; trivial.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n (@length BC (@map nat BC (proj n O) (seq O n)))) (Nat.eqb n (@length BC (@map nat BC (proj n O) (seq O n))))) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities n O)) (@map nat BC (proj n O) (seq O n)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n O)) (@map nat BC (proj n O) (seq O n))) then ok_arities n O else error_comp (ok_arities n n) (@map BC Arities arities (@map nat BC (proj n O) (seq O n))) (@map BC Arities arities (@map nat BC (proj n O) (seq O n)))) (ok_arities n O) *)
 rewrite map_length.
(* Goal: @eq Arities (if andb (andb (andb (Nat.eqb n (@length nat (seq O n))) (Nat.eqb n (@length nat (seq O n)))) (@forallb BC (fun ne : BC => aeq (arities ne) (ok_arities n O)) (@map nat BC (proj n O) (seq O n)))) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n O)) (@map nat BC (proj n O) (seq O n))) then ok_arities n O else error_comp (ok_arities n n) (@map BC Arities arities (@map nat BC (proj n O) (seq O n))) (@map BC Arities arities (@map nat BC (proj n O) (seq O n)))) (ok_arities n O) *)
 rewrite seq_length.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite <- beq_nat_refl; simpl.
 case_eq (  forallb (fun ne : BC => aeq (arities ne) (ok_arities n 0))
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
         (map (proj n 0) (seq 0 n)) ); intros; simpl; trivial.
(* Goal: @eq Arities (error_comp (ok_arities n n) (@map BC Arities arities (@map nat BC (proj n O) (seq O n))) (@map BC Arities arities (@map nat BC (proj n O) (seq O n)))) (ok_arities n O) *)
 elimtype False; apply eq_true_false_abs with (2 := H0).
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 rewrite forallb_forall; intros.
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
 apply in_map_iff in H1.
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
 destruct H1 as (? & ? & ?).
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
 subst.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.
(* Goal: @eq bool (aeq (if match Init.Nat.add n O with | O => false | S m' => Nat.leb x0 m' end then ok_arities n O else error_proj n O x0) (ok_arities n O)) true *)
 apply in_seq_iff in H2.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 case_eq (n + 0); intros.
(* Goal: le x0 n0 *)
 elimtype False; omega.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 rewrite leb_correct; simpl.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite <- beq_nat_refl; simpl; trivial.
(* Goal: le x0 n0 *)
 omega.
Qed.

Lemma Cobham_to_BC_correct : forall e xl n,
  rec_bounded e ->
  arity e = ok_arity n ->
  length xl = n ->
  Sem e xl = sem (Cobham_to_BC n e) xl nil.
Proof.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 intros; unfold Cobham_to_BC; simpl.
(* Goal: @eq bool (aeq (arities x) (ok_arities n O)) true *)
 subst.
 etransitivity.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 apply Cobham_to_BC''_correct; try trivial; try rewrite Nat.add_0_r; trivial.
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 try rewrite Nat.add_0_r;f_equal.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
 transitivity ( map (fun x : nat => nth x xl nil) (seq 0 (length xl)) ).
 rewrite map_nth_seq.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.
(* Goal: le x0 n0 *)
 omega.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 apply map_ext2; intros.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 destruct (length xl).
 simpl in H1; elim H1.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite leb_correct; trivial.
(* Goal: le x0 n0 *)
 apply in_seq_iff in H1; omega.
(* Goal: @eq (list (list bool)) (@map nat (list bool) (fun x : nat => sem (proj (S O) (@length (list bool) xl) x) (@cons (list bool) w (@nil (list bool))) xl) (seq (S O) (@length (list bool) xl))) (@map nat (list bool) (fun x : nat => if Nat.leb x O then match x with | O => w | S (O as m) => @nil bool | S (S m0 as m) => @nil bool end else match Init.Nat.sub x (S O) with | O => a | S m => @nth (list bool) m xl (@nil bool) end) (@map nat nat S (seq (S O) (@length (list bool) xl)))) *)
 rewrite map_map.
 transitivity ( map (fun x : nat => nth x xl nil) (seq 0 (length xl)) ).
 rewrite map_nth_seq.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 simpl; trivial.
(* Goal: le x0 n0 *)
 omega.
(* Goal: forall _ : forall (n : nat) (nl : list (list bool)) (el : list BC), @eq nat (@length bool (sem (plusl_e n el) nl (@nil (list bool)))) (plusl (@map BC nat (fun e : BC => @length bool (sem e nl (@nil (list bool)))) el)), @eq nat (@length bool (sem (plusl_e (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))) (@map mon BC (poly_BC_mon (@fst nat (list mon) (@pair nat (list mon) ar (@cons mon m ml)))) (@snd nat (list mon) (@pair nat (list mon) ar (@cons mon m ml))))) nl (@nil (list bool)))) (peval (@pair nat (list mon) ar (@cons mon m ml)) (@map (list bool) nat (@length bool) nl)) *)
 apply map_ext2; intros.
(* Goal: @eq Arities (if andb (andb (aeq (ok_arities n O) (ok_arities n O)) true) (@forallb BC (fun se : BC => aeq (arities se) (ok_arities n n)) (@map nat BC (proj n n) (seq n n))) then ok_arities n n else error_comp (ok_arities (S O) n) (@cons Arities (ok_arities n O) (@nil Arities)) (@map BC Arities arities (@map nat BC (proj n n) (seq n n)))) (ok_arities n n) *)
(* Goal: pWF (rec_simulation n e) *)
 simpl.
 destruct (length xl).
 simpl in H1; elim H1.
(* Goal: @eq (list A) (@nil A) (@nil A) *)
(* Goal: @eq (list A) (@cons A (f0 start) (@map nat A (fun x : nat => f0 x) (seq (S start) len))) (@cons A (f0 start) (@map nat A (fun x : nat => f0 (Init.Nat.add x start)) (seq (S O) len))) *)
 rewrite leb_correct; trivial.
(* Goal: le x0 n0 *)
 apply in_seq_iff in H1; omega.
Qed.
