End KNOT_FULL_LEMMAS.
Module KnotFull
(KI': KNOT_INPUT__MIXVARIANT_HERED_T_OTH_REL)
(KO': KNOT_FULL_OUTPUT with Module KI := KI'):
KNOT_FULL with Module KI := KI' with Module KO:=KO'.
Module KI:=KI'.
Module KO:=KO'.
Definition knot: Type := KO.K0.knot.
Definition ageable_knot : ageable knot := KO.K0.ageable_knot.
Existing Instance ageable_knot.
Definition predicate: Type := KO.predicate.
Definition squash : (nat * KI.F predicate) -> knot :=
fun k => KO.K0.squash
(fst k, fmap KI.F (bij_f _ _ KO.pkp) (bij_g _ _ KO.pkp) (snd k)).
Definition unsquash : knot -> (nat * KI.F predicate) :=
fun k => let (n, f) := KO.K0.unsquash k in
(n, fmap KI.F (bij_g _ _ KO.pkp) (bij_f _ _ KO.pkp) f).
Definition approx : nat -> predicate -> predicate :=
fun n => (bij_g _ _ KO.pkp) oo KO.K0.approx n oo (bij_f _ _ KO.pkp).

(* Specifications: *)
Lemma squash_unsquash : forall k:knot, squash (unsquash k) = k.
Lemma unsquash_squash : forall (n:nat) (f:KI.F predicate),
unsquash (squash (n,f)) = (n, fmap KI.F (approx n) (approx n) f).
Lemma approx_spec : forall n p ko,
proj1_sig (bij_f _ _ KO.pkp (approx n p)) ko =
if (le_gt_dec n (level (fst ko)))
then KI.T_bot
else proj1_sig (bij_f _ _ KO.pkp p) ko.
Lemma knot_age1 : forall k:knot,
age1 k =
match unsquash k with
| (O,_) => None
| (S n,x) => Some (squash (n,x))
end.
Lemma knot_level: forall k:knot, level k = fst (unsquash k).
Definition knot_rel (k1 k2:knot) :=
let (n,f) := unsquash k1 in
let (n',f') := unsquash k2 in
n = n' /\ KI.Rel predicate f f'.
Lemma knot_rel_spec: forall k1 k2: knot,
knot_rel k1 k2 = KO.K0.knot_rel k1 k2.