End KNOT__MIXVARIANT_HERED_PROP.
Module Knot_CoContraVariantHeredTOthRel
(KI': KNOT_INPUT__COCONTRAVARIANT_HERED_T_OTH_REL):
KNOT__COCONTRAVARIANT_HERED_T_OTH_REL with Module KI:=KI'.
Module KI:=KI'.
Module Input.
Definition F : functor :=
CoContraVariantBiFunctor_MixVariantFunctor KI.F.
Definition other := KI.other.
Definition Rel (A: Type): F A -> F A -> Prop :=
KI.Rel A A.
Definition Rel_fmap (A B: Type): forall (f1: A->B) (f2:B->A) x y,
Rel A x y ->
Rel B (fmap F f1 f2 x) (fmap F f1 f2 y) :=
KI.Rel_fmap A B B A.
Definition Rel_refl (A: Type): forall x, Rel A x x :=
KI.Rel_refl A A.
Definition Rel_trans (A: Type): forall x y z,
Rel A x y -> Rel A y z -> Rel A x z :=
KI.Rel_trans A A.
Definition ORel: other -> other -> Prop := KI.ORel.
Definition ORel_refl := KI.ORel_refl.
Definition ORel_trans := KI.ORel_trans.
Definition T := KI.T.
Definition T_bot := KI.T_bot.
Definition T_rel := KI.T_rel.
Definition T_rel_bot := KI.T_rel_bot.
Definition T_rel_refl := KI.T_rel_refl.
Definition T_rel_trans := KI.T_rel_trans.
End Input.
Module K := knot_full_variant.Knot_MixVariantHeredTOthRel(Input).
Definition knot: Type := K.knot.
Definition ageable_knot: ageable knot := K.ageable_knot.
Existing Instance ageable_knot.
Definition hered : (knot * KI.other -> KI.T) -> Prop := K.hered.
Definition predicate := { p:knot * KI.other -> KI.T | hered p }.
Definition squash : (nat * KI.F predicate predicate) -> knot := K.squash.
Definition unsquash : knot -> (nat * KI.F predicate predicate) := K.unsquash.
Definition approx : nat -> predicate -> predicate := K.approx.
Definition squash_unsquash : forall k:knot, squash (unsquash k) = k
:= K.squash_unsquash.
Definition unsquash_squash : forall (n:nat) (f:KI.F predicate predicate),
unsquash (squash (n,f)) =
(n, CoContraVariantBiFunctor.fmap KI.F (approx n) (approx n) f)
:= K.unsquash_squash.
Definition approx_spec : forall n p ko,
proj1_sig (approx n p) ko =
if (le_gt_dec n (level (fst ko))) then KI.T_bot else proj1_sig p ko
:= K.approx_spec.
Definition knot_rel (k1 k2:knot) :=
let (n,f) := unsquash k1 in
let (n',f') := unsquash k2 in
n = n' /\ KI.Rel predicate predicate f f'.
Definition knot_age1 : forall k:knot,
age1 k =
match unsquash k with
| (O,_) => None
| (S n,x) => Some (squash (n,x))
end
:= K.knot_age1.
Definition knot_level : forall k:knot,
level k = fst (unsquash k)
:= K.knot_level.
Definition hered_spec : forall p,
hered p =
(forall k k' k'' o o',
clos_refl_trans _ age k k' ->
knot_rel  k' k'' ->
KI.ORel o o' ->
KI.T_rel (p (k,o)) (p (k'',o')))
:= K.hered_spec.
End Knot_CoContraVariantHeredTOthRel.
Module KnotLemmas_CoContraVariantHeredTOthRel
(K: KNOT__COCONTRAVARIANT_HERED_T_OTH_REL).

(* Specifications: *)
Lemma unsquash_inj : forall k1 k2,
unsquash k1 = unsquash k2 ->
k1 = k2.