Function level' (x:A) { wf (fun x y => @age A ag y x)  x } : nat :=
(*  Function level' (x:A) { wf (transp _ (@age A ag)) x } : nat := *)
    match age1 x with
    | None => 0
    | Some x' => S (level' x')
    end.

(* Specifications: *)
Theorem level_level' : forall x:A, level x = level' x.
Lemma levelS_age1 {A} `{ageable A} : forall (x:A) n, level x = S n -> exists y, age1 x = Some y.
Lemma age1_levelS {A} `{ageable A} : forall (x y:A), age1 x = Some y -> exists n, level x = S n.
Lemma age1_level0_absurd {A} `{ageable A} : forall (x y:A), age1 x = Some y -> level x = 0 -> False.
Lemma age1None_levelS_absurd {A} `{ageable A} : forall (x:A) n, age1 x = None -> level x = S n -> False.
Lemma Rt_Rft : forall x y, Rt x y -> Rft x y.
Lemma Rt_Rft_trans : forall x y z, Rt x y -> Rft y z -> Rt x z.
Lemma Rft_Rt_trans : forall x y z, Rft x y -> Rt y z -> Rt x z.
Lemma transpose_clos_trans : forall A R x y, clos_trans A (transp A R) x y <-> transp A (clos_trans A R) x y.