Definition unstratify (n:nat) (p:sinv n) : predicate := fun w =>
    match w with (existT _ nw w',e) =>
      match decompose_nat nw n with
        | inleft (existT _ m Hm) => snd (floor m (S nw) (eq_rect  n _ p (m + S nw) Hm)) (w', e)
        | inright H => T_bot
      end
    end.Definition proof_irr_nat := eq_proofs_unicity dec_eq_nat.

(* Specifications: *)
Lemma floor_shuffle: forall (m1 n : nat) (p1 : sinv (m1 + S n)) (H1 : (m1 + S n) = (S m1 + n)), floor (S m1) n (eq_rect (m1 + S n) sinv p1 (S m1 + n) H1) = fst (floor m1 (S n) p1).
Lemma stratify_unstratify_more : forall n m1 m2 p1 p2, floor m1 n p1 = floor m2 n p2 -> (stratify n oo unstratify (m1+n)) p1 = (stratify n oo unstratify (m2+n)) p2.
Lemma stratify_unstratify : forall n, stratify n oo unstratify n = id (sinv n).
Lemma unstratify_stratify1 : forall n (p:predicate) w, leT ((unstratify n oo stratify n) p w) (p w).
Lemma unstratify_stratify2 : forall n p w, projT1 (fst w) < n -> leT (p w) ((unstratify n oo stratify n) p w).
Lemma unstratify_stratify3 : forall n (p:predicate) w, projT1 (fst w) >= n -> leT ((unstratify n oo stratify n) p w) T_bot.