(*****************************)

(* Specifications: *)
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 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'.