(* * Copyright (c) 2009-2010, Andrew Appel, Robert Dockins and Aquinas Hobor. * *)
(* This file defines a series of lemmas for proving functions from the carrier set of one SA to the carrier set of another are join homomorphisms, and then shows that some simple properties of SA elems, like identity, comparability, etc., are preserved by join homs.  The idea is due to Rob. *)
(* Two-argument join homomorphisms *)
Section join_hom2.
Variables (A B C: Type)
(JA: Join A)
(JB: Join B)
(JC: Join C)
(f: A -> B -> C).
Definition join_hom2 := forall (a1 a2 a3: A)(b1 b2 b3: B),
join a1 a2 a3
-> join b1 b2 b3
-> join (f a1 b1) (f a2 b2) (f a3 b3).
(* Two-argument join homomorphisms with a dummy argument *)
Definition join_hom2' := forall (a1 a2 a3: A)(b1 b2 b3: B),
join a1 a2 a3
-> join (f a1 b1) (f a2 b2) (f a3 b3).
End join_hom2.
Arguments join_hom2 [A B C JA JB JC] _.
Arguments join_hom2' [A B C JA] _ _.

Lemma join_hom_sum_l
: join_hom (fun s: A+B =>
match s with
| inl x => inl _ (f x)
| inr y => inr _ y
end).