Section stratifies.
Variable Q:knot * other -> Prop.
Variable HQ:hereditary ko_age Q.
Fixpoint stratifies (n:nat) : sinv n -> Prop :=
match n as n' return sinv n' -> Prop with
| 0 => fun _ => True
| S n' => fun (p:sinv (S n')) =>
stratifies n' (fst (proj1_sig p)) /\
forall (k:F (sinv n')) (o:other), snd (proj1_sig p) (k,o) <-> Q (existT (F oo sinv) n' k,o)
end.
Definition stratify (n:nat) : { x:sinv n | stratifies n x }.
End stratifies.
Definition unstratify (n:nat) (p:sinv n) : knot * other -> Prop := fun w =>
match w with (existT _ nw w',o) =>
match decompose_nat nw n with
| inleft (existT _ m Hm) => snd (proj1_sig (floor m (S nw) (eq_rect  n _ p (m + S nw) Hm))) (w',o)
| inright H => False
end
end.

Lemma stratifies_unstratify_more :
forall (n m1 m2:nat) (p1:sinv (m1+n)) (p2:sinv (m2+n)),
floor m1 n p1 = floor m2 n p2 ->
(stratifies (unstratify (m1+n) p1) n (floor m1 n p1) ->
stratifies (unstratify (m2+n) p2) n (floor m2 n p2)).