(* Age [x] to the level [k] (meaningul when [k <= level x] *)
Definition age_to k {A} `{agA : ageable A} (x : A) : A := age_by (level x - k) x.

(* Specifications: *)
Lemma level_age_to k {A} `{agA : ageable A} x : k <= level x -> level (age_to k x) = k.
Lemma age_to_lt k {A} `{agA : ageable A} (x : A) : k < level x -> exists y, age x y /\ age_to k x = age_to k y.
Lemma age_to_ge k {A} `{agA : ageable A} (x : A) : k >= level x -> age_to k x = x.
Lemma age_to_eq k {A} `{agA : ageable A} (x : A) : k = level x -> age_to k x = x.
Lemma age_age_to n {A} `{agA : ageable A} x y : level x = S n -> age x y -> age_to n x = y.
Lemma age_by_ind {A} `{agA : ageable A} (P : A -> Prop) : (forall x y, age x y -> P x -> P y) -> forall x n, P x -> P (age_by n x).
Lemma age_to_ind {A} `{agA : ageable A} (P : A -> Prop) : (forall x y, age x y -> P x -> P y) -> forall x n, P x -> P (age_to n x).
Lemma age_to_ind_refined n {A} `{agA : ageable A} (P : A -> Prop) : (forall x y, age x y -> n <= level y -> P x -> P y) -> forall x, P x -> P (age_to n x).
Lemma iter_iter n m {A} f (x : A) : Nat.iter n f (Nat.iter m f x) = Nat.iter (n + m) f x.
Lemma age_by_age_by n m {A} `{agA : ageable A} (x : A) : age_by n (age_by m x) = age_by (n + m) x.
Lemma age_by_ind_opp {A} `{agA : ageable A} (P : A -> Prop) : (forall x y, age x y -> P y -> P x) -> forall x n, P (age_by n x) -> P x.
Lemma age_to_ind_opp {A} `{agA : ageable A} (P : A -> Prop) : (forall x y, age x y -> P y -> P x) -> forall x n, P (age_to n x) -> P x.
Lemma rewrite_age_to {A} `{agA : ageable A} (P : A -> Prop) : (forall x y, age x y -> P x <-> P y) -> forall x n, P x <-> P (age_to n x).
Lemma level_age_to_le k {A} `{agA : ageable A} x : level (age_to k x) <= level x.
Lemma level_age_to_le' k {A} `{agA : ageable A} x : level (age_to k x) <= k.
Lemma age_by_necR {A} `{agA : ageable A} n x : necR x (age_by n x).
Lemma age_to_necR {A} `{agA : ageable A} n x : necR x (age_to n x).
Lemma necR_age_by {A} `{agA : ageable A} x x' : necR x x' -> x' = age_by (level x - level x') x.
Lemma necR_age_to {A} `{agA : ageable A} x x' : necR x x' -> x' = age_to (level x') x.
Lemma necR_age_by_iff {A} `{agA : ageable A} x x' : necR x x' <-> x' = age_by (level x - level x') x.
Lemma necR_age_to_iff {A} `{agA : ageable A} x x' : necR x x' <-> x' = age_to (level x') x.
Lemma age_to_pred {A} `{agA : ageable A} (P : pred A) x n : app_pred P x -> app_pred P (age_to n x).
Lemma age_by_pred {A} `{agA : ageable A} (P : pred A) x n : app_pred P x -> app_pred P (age_by n x).
Lemma pred_age1' {A} `{agA : ageable A} (R : pred A) x : app_pred R x -> app_pred R (age1' x).
Lemma age_by_age_by_pred {A} `{agA : ageable A} (P : pred A) x n1 n2 : le n1 n2 -> app_pred P (age_by n1 x) -> app_pred P (age_by n2 x).