(*Definition pred (n: nat): nat := match n with 0 => 0 | S n' => n' end.*)
Definition nof (n: nat) (_: natBelow n): nat := n.Fixpoint natBelow_rect (n: nat): forall nb: natBelow n, P nb :=
  match n with
  | 0 => fun nb => natBelow0_rect nb _
  | S x => fun nb =>
    match nb return (forall nb: natBelow (pred (nof nb)), P nb) -> P nb with
    | mkNatBelow 0 y => fun _ => Pz y
    | mkNatBelow (S z) y => fun U => Ps (U (mkNatBelow z y))
    end (@natBelow_rect x)
  end.Definition R (n: nat): natBelow n -> Type :=
  match n with
  | 0 => fun _ => False
  | S _ => @P _
  end.Definition natBelow_rect_S (n: nat) (nb: natBelow (S n)): P nb := natBelow_rect R Pz Ps nb.

(* Specifications: *)
Lemma val_Snb n (x: natBelow n): nb_val (Snb x) = S (nb_val x).
Lemma val_nb0 n: nb_val (nb0 n) = 0.
Lemma natBelow_S_inv (n: nat) (nb: natBelow (S n)): { nb': natBelow n | nb = Snb nb' } + { nb = nb0 n }.