(* * Copyright (c) 2009-2011, Andrew Appel, Robert Dockins and Aquinas Hobor. * *)
(* A portion of this file was developed by Le Xuan Bach *)
Definition midObj {A} {JA: Join A} (a : A) : Prop := ~identity a /\ ~ full a.
Definition ijoinable A {JA: Join A} : Type := {sh : A & midObj sh}.
Definition ijoin {A} {JA: Join A} (j1 j2 j3 : ijoinable A) : Prop :=
match (j1, j2, j3) with
(existT _ t1 _, existT _ t2 _, existT _ t3 _) => join t1 t2 t3
end.
Proof with auto.
intros.
icase j1; icase j2; icase j3.
red in H; red.
apply join_comm...
Qed.
Proof with auto.
intros.
icase a; icase b; icase c; icase d; icase e.
unfold ijoin in *.
destruct (join_assoc H H0) as [f [? ?]].
assert ((~identity f) /\ (~full f)).
unfold midObj in *.
split.
intro.
generalize (split_identity _ _ H1 H3); intro.
tauto.
intro.
specialize ( H3 x). spec H3. exists x3...
specialize ( H3 f x3 H2). subst x3.
apply unit_identity in H2.
tauto.
exists (existT midObj f H3).
split...
Qed.
Proof with auto.
intros.
icase a; icase a'; icase b; icase c.
unfold ijoin in *.
apply existT_ext.
eapply join_canc; eauto.
Qed.

Lemma ijoin_identity1 {A}  {JA: Join A}{PA: Perm_alg A}{SA: Sep_alg A}{CA: Disj_alg A}: forall a b,
ijoin a b b ->
False.