Definition age1_list {A} `{ageable A} := list_forall2 age.

(* Specifications: *)
Lemma age1_list_join {A} {JA: Join A}{PA: Perm_alg A}{agA: ageable A}{AgeA: Age_alg A}: forall l (phi phi' phi2: A), age phi phi' -> list_join phi l phi2 -> exists l', exists phi2', age1_list l l' /\ age phi2 phi2' /\ list_join phi' l' phi2'.
Lemma age1_list_join2 {A} {JA: Join A}{PA: Perm_alg A}{agA: ageable A}{AgeA: Age_alg A}: forall (l: list A) phi phi2 phi2', age1 phi2 = Some phi2' -> list_join phi l phi2 -> exists l', exists phi', age1 phi = Some phi' /\ age1_list l l' /\ list_join phi' l' phi2'.
Lemma list_join_split_nth {A}{JA: Join A}{PA: Perm_alg A}: forall n (l: list A) phin phi phia phib phi2, nth_error l n = Some phin -> list_join phi l phi2 -> join phib phia phin -> exists phic, exists l', replace l n phib = Some l' /\ join phi phia phic /\ list_join phic l' phi2.
Lemma list_join_join_nth {A} {JA: Join A}{PA: Perm_alg A}: forall n (l: list A) phin phi phia phib phi2, nth_error l n = Some phin -> list_join phi l phi2 -> join phi2 phia phib -> exists phic, exists l', join phin phia phic /\ replace l n phic = Some l' /\ list_join phi l' phib.
Lemma list_join_comparable {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall (phi1: A) l phi2, list_join phi1 l phi2 -> comparable phi1 phi2.
Lemma join_comparable' {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall phi1 phi2 phi3: A, join phi1 phi2 phi3 -> comparable phi2 phi3.
Lemma join_comparable2' {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall phi1 phi2 phi3: A, join phi1 phi2 phi3 -> comparable phi2 phi1.
Lemma list_join_comparable' {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall (phi1: A) l phi2, list_join phi1 l phi2 -> comparable phi2 phi1.
Lemma join_comparable'' {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall phi1 phi2 phi3: A, join phi1 phi2 phi3 -> comparable phi3 phi2.
Lemma join_comparable''' {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall phi1 phi2 phi3: A, join phi1 phi2 phi3 -> comparable phi3 phi1.
Lemma joins_comparable {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall phi1 phi2: A, joins phi1 phi2 -> comparable phi1 phi2.
Lemma joins_comparable2 {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall phi1 phi2: A, joins phi2 phi1 -> comparable phi1 phi2.
Lemma join_sub_comparable {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall phi1 phi2: A, join_sub phi1 phi2 -> comparable phi1 phi2.
Lemma join_sub_comparable2 {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall phi1 phi2: A, join_sub phi2 phi1 -> comparable phi1 phi2.
Lemma eq_comparable {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall phi1 phi2: A, phi1=phi2 -> comparable phi1 phi2.
Lemma eq_comparable2 {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall phi1 phi2: A, phi2=phi1 -> comparable phi1 phi2.
Lemma ageN_join {A} {JA: Join A}{PA: Perm_alg A}{agA: ageable A}{AgeA: Age_alg A}: forall n (w1 w2 w3 w1': A), join w1 w2 w3 -> ageN n w1 = Some w1' -> exists w2', exists w3', ageN n w2 = Some w2' /\ ageN n w3 = Some w3' /\ join w1' w2' w3'.
Lemma ageN_join2 {A} {JA: Join A}{PA: Perm_alg A}{agA: ageable A}{AgeA: Age_alg A}: forall n (w1 w2 w3 w3': A), join w1 w2 w3 -> ageN n w3 = Some w3' -> exists w1', exists w2', ageN n w1 = Some w1' /\ ageN n w2 = Some w2' /\ join w1' w2' w3'.
Lemma ageN_comparable {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}{agA: ageable A}{AgeA: Age_alg A}: forall n (w1 w2 w1' w2': A), ageN n w1 = Some w1' -> ageN n w2 = Some w2' -> comparable w1 w2 -> comparable w1' w2'.
Lemma join_unage {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}{agA: ageable A}{AgeA: Age_alg A}: forall (phi3 phi1' phi2' phi3': A), age1 phi3 = Some phi3' -> join phi1' phi2' phi3' -> exists phi1, exists phi2, join phi1 phi2 phi3 /\ age1 phi1 = Some phi1' /\ age1 phi2 = Some phi2'.
Lemma join_unage' {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}{agA: ageable A}{AgeA: Age_alg A}: forall phi1 phi1' phi2' phi3' : A, age1 phi1 = Some phi1' -> join phi1' phi2' phi3' -> exists phi2, exists phi3, join phi1 phi2 phi3 /\ age1 phi2 = Some phi2' /\ age1 phi3 = Some phi3'.
Lemma unageN' {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}{agA: ageable A}{AgeA: Age_alg A}: forall n (phi1 phi1' phi2' phi3' : A), ageN n phi1 = Some phi1' -> join phi1' phi2' phi3' -> exists phi2, exists phi3, join phi1 phi2 phi3 /\ ageN n phi2 = Some phi2' /\ ageN n phi3 = Some phi3'.