Definition lastCP {T:Type} {n:nat} (cp : cartesianPower T (S n)) : T.
Definition tailCPbis {T:Type} {n:nat} m1 m2 (cp : cartesianPower T m1) :
(S (S n)) = m1 -> (S n) = m2 -> (cartesianPower T m2).
Definition consTailCP {T:Type} {n:nat} (cp : cartesianPower T n) (t : T) : (cartesianPower T (S n)).
Definition CPToList {T:Type} {n:nat} (cp : cartesianPower T n) : list T.
Definition nthCP {T:Type} {m:nat} (n : nat) (cp : cartesianPower T m) (Default : T) := nth (n-1) (CPToList cp) Default.
Definition ListToCP {T : Type} (l : list T) (Default : T) : cartesianPower T (length l).
Definition fixLastCP {T:Type} {n:nat} (appPred : cartesianPower T (S (S n)) -> Prop) (t : T) : cartesianPower T (S n) -> Prop.
Definition app {T:Type} {n:nat} (pred : arity T n) (cp : cartesianPower T n) : Prop.
Definition app_1_n {T:Type} {n:nat} (pred : arity T (S n)) (x : T) (cp : cartesianPower T n) : Prop.
Definition app_2_n {T:Type} {n:nat} (pred : arity T (S (S n))) (x1 x2 : T) (cp : cartesianPower T n) : Prop.

Lemma app_2_n_app_eq {T:Type} {n:nat} :
forall (pred : arity T (S (S (S n)))) (x1 x2 : T)
(cpp : cartesianPower T (S n)) (cpt : cartesianPower T (S (S (S n)))),
headCP cpt = x1 -> headCP (tailCP cpt) = x2 -> tailCP (tailCP cpt) = cpp ->
(app pred cpt <-> app_2_n pred x1 x2 cpp).