Definition app_2_n {T:Type} {n:nat} (pred : arity T (S (S n))) (x1 x2 : T) (cp : cartesianPower T n) : Prop.

(* Specifications: *)
Lemma app_2_n_app_default {T:Type} {n:nat} :
forall (pred : arity T (S (S n))) (x1 x2 : T)
(cpp Default : cartesianPower T n) (cpt : cartesianPower T (S (S n))),
app_2_n pred x1 x2 cpp -> headCP cpt = x1 ->
headCP (tailCP cpt) = x2 ->
tailDefaultCP (tailCP cpt) Default = cpp ->
app pred cpt.
Lemma app_app_2_n {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)))),
app pred cpt -> headCP cpt = x1 -> headCP (tailCP cpt) = x2 -> tailCP (tailCP cpt) = cpp ->
app_2_n pred x1 x2 cpp.
Lemma app_app_2_n_default {T:Type} {n:nat} :
forall (pred : arity T (S (S n))) (x1 x2 : T)
(cpp Default : cartesianPower T n) (cpt : cartesianPower T (S (S n))),
app pred cpt -> headCP cpt = x1 -> headCP (tailCP cpt) = x2 -> tailDefaultCP (tailCP cpt) Default = cpp ->
app_2_n pred x1 x2 cpp.
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).
Lemma PermOKAux {T : Type} {m : nat} :
forall (appPred : (cartesianPower T (S (S m))) -> Prop) n,
(forall (A : T) (X : cartesianPower T (S m)), appPred (consHeadCP A X) -> appPred (consTailCP X A)) ->
(forall (X : cartesianPower T (S (S m))),
appPred X -> appPred (circPermNCP n X)).
Lemma PermOK {T : Type} {n : nat} :
forall (cp1 cp2 : cartesianPower T (S (S n))) (appPred : (cartesianPower T (S (S n))) -> Prop),
(forall (A : T) (X : cartesianPower T (S n)),
appPred (consHeadCP A X) -> appPred (consTailCP X A)) ->
(forall (A B : T) (X : cartesianPower T n),
appPred (consHeadCP A (consHeadCP B X)) -> appPred (consHeadCP B (consHeadCP A X))) ->
appPred cp1 ->
Permutation.Permutation (CPToList cp1) (CPToList cp2) ->
appPred cp2.
Lemma lengthNilOK {A : Type} : forall (l : list A),
length l = 0 -> l = nil.
Lemma NoDupOK {A : Type} : forall (l l' : list A),
incl l l' ->
length l = length l' ->
NoDup l ->
Permutation.Permutation l l'.
Lemma NoDup_dec {A : Type} : forall (l : list A),
(forall x y : A, {x = y} + {x <> y}) ->
NoDup l \/ ~ NoDup l.
Lemma NotNoDupDup {A : Type} : forall (l : list A),
(forall x y : A, {x = y} + {x <> y}) ->
~ NoDup l->
exists e l1 l2, l = l1 ++ e :: l2 /\ In e (l1 ++ l2).