Definition squash (x:nat * F predicate) : knot :=
match x with (n,y) => existT (F oo sinv) n (fmap F (stratify n) y) end.
Definition unsquash (x:knot) : (nat * F predicate) :=
match x with existT _ n y => (n, fmap F (unstratify n) y) end.
Definition def_knot_level (k:knot) := fst (unsquash k).
Definition def_knot_age1 (k:knot) : option knot :=
match unsquash k with
| (O,_) => None
| (S n,x) => Some (squash (n,x))
end.
Definition def_knot_unage (k:knot) : knot :=
match unsquash k with
| (n,x) => squash (S n,x)
end.
Definition approx (n:nat) (p:predicate) : predicate :=
fun w => if le_gt_dec n (def_knot_level (fst w)) then T_bot else p w.

(* Specifications: *)
Lemma squash_unsquash : forall x, squash (unsquash x) = x.
Lemma unsquash_squash : forall n x', unsquash (squash (n,x')) = (n,fmap F (approx n) x').
Lemma unsquash_inj : forall k1 k2,
unsquash k1 = unsquash k2 ->
k1 = k2.