Hint Resolve @join_joins @join_joins' @join_join_sub @join_join_sub'.
Definition nonidentity {A} `{Perm_alg A} (a: A) := ~(identity a).

(* Specifications: *)
(** If [a] is a subelement of [b], their units are equal. *)
Lemma join_sub_units_eq {A} {J: Join A}{PA: Perm_alg A}{SA: Sep_alg A}{CA: Disj_alg A} :
forall {a b} ea eb,
join_sub a b ->
unit_for ea a ->
unit_for eb b ->
ea = eb.
Lemma unit_core{A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}{CA: Disj_alg A}:
forall {a}, unit_for a a -> a = (core a).
(** A unit for an element is a unit for itself (is idempotent). *)
Lemma unit_self_unit {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}{CA: Disj_alg A} :
forall a ea,   unit_for ea a ->  unit_for ea ea.
(** If a joins with b, then their units are equal. *)
Lemma joins_units_eq {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}{CA: Disj_alg A}:
forall {a b} ea eb,
joins a b ->
unit_for ea a ->
unit_for eb b ->
ea  = eb.
(** The existence of identity elements. *)
Lemma join_ex_identities {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall a,
{e : A & identity e /\ joins e a}.
(** If something is an identity and it joins with an element then it is a unit for that element. *)
Lemma identity_unit {A} `{HA: Perm_alg A}: forall e a,
identity e ->
joins e a ->
unit_for e a.
Lemma identity_unit' {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}:
forall a,  identity a -> unit_for a a.
(** Identities are exactly units for themselves (are idempotent).*)
Lemma identity_unit_equiv {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}{CA: Disj_alg A}:
forall a,  identity a <-> unit_for a a.
(** Joinable identities are unique. *)
Lemma identities_unique {A} `{HA: Perm_alg A} :
forall e1 e2,  identity e1 ->  identity e2 ->  joins e1 e2 ->  e1 = e2.
Lemma split_identity{A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}:
forall a b c, join a b c -> identity c -> identity a.
(* The contrapositive of split_identity *)
Lemma join_nonidentity {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall a b c,
nonidentity a -> join a b c -> nonidentity c.
Lemma join_sub_antisym {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}: forall x y,
join_sub x y ->
join_sub y x ->
x = y.
(** This lemma uses the full power of self_join and eliminates both N and Z. *)
Lemma join_sub_joins_identity {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}{DS: Disj_alg A}: forall a b,
join_sub a b -> joins a b -> identity a.
(** Sometimes it is useful to use a negative form of the previous lemma *)
Lemma join_overlap {A} {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}{DS: Disj_alg A}: forall a b,
join_sub a b -> nonidentity a -> overlap a b.