Definition relation_mul {A: Type} (R0 R1: relation A) (x y: A) := exists z, R0 x z /\ R1 z y.Fixpoint relation_power {A: Type} (n: nat) (R: relation A) :=
  match n with
  | O => eq
  | S n0 => relation_mul R (relation_power n0 R)
  end.Fixpoint partial_fun_power {A: Type} (n: nat) (f: A -> option A) (x: A) :=
  match n with
  | O => Some x
  | S n0 => match f x with
            | Some fx => partial_fun_power n0 f fx
            | None => None
            end
  end.

(* Specifications: *)
Lemma laterR_power_age: forall {A:Type} {agA:ageable A} (x y: A), laterR x y <-> (exists n, relation_power (S n) age x y).
Lemma necR_power_age: forall {A:Type} {agA:ageable A} (x y: A), necR x y <-> (exists n, relation_power n age x y).
Lemma power_age_age1: forall {A:Type} {agA:ageable A} n x y, relation_power n age x y <-> partial_fun_power n age1 x = Some y.
Lemma power_age1_level_small: forall {A:Type} {agA:ageable A} n x, partial_fun_power n age1 x = None <-> level x < n.
Lemma power_age_core: forall {A:Type} {agA:ageable A} {JA: Join A} {PA: Perm_alg A} {SaA: Sep_alg A} {XA: Age_alg A} (x y: A) n, relation_power n age x y -> relation_power n age (core x) (core y).
Lemma power_age_core_eq: forall {A:Type} {agA:ageable A} {JA: Join A} {PA: Perm_alg A} {SaA: Sep_alg A} {XA: Age_alg A} (x x' y y': A) n, relation_power n age x x' -> relation_power n age y y' -> core x = core y -> core x' = core y'.
Lemma levelS_age {A: Type} {agA: ageable A} : forall (x:A) n, S n = level x -> exists y, age x y /\ n = level y.
Lemma clos_refl_trans_addone: forall (A : Type) (R : relation A) (x y z: A), R x y -> clos_refl_trans A R y z -> clos_refl_trans A R x z.
Lemma necR_same_level: forall {A:Type} {agA:ageable A} (x y x': A), necR x x' -> level x = level y -> exists y', (necR y y' /\ level x' = level y').
Lemma laterR_same_level: forall {A:Type} {agA:ageable A} (x y x': A), laterR x x' -> level x = level y -> exists y', (laterR y y' /\ level x' = level y').
Lemma power_age_parallel: forall {A:Type} {agA:ageable A} (x x' y: A) n, level x = level y -> relation_power n age x x' -> exists y', relation_power n age y y'.
Lemma power_age_parallel': forall {A:Type} {agA:ageable A} {JA: Join A} {PA: Perm_alg A} {SaA: Sep_alg A} {XA: Age_alg A} (x x' y: A) n, core x = core y -> relation_power n age x x' -> exists y', relation_power n age y y' /\ core x' = core y'.