Section Join.
Variable A B Z : Type.
Variable retr1 : Retract A Z.
Variable retr2 : Retract B Z.
Local Arguments Retr_f {_ _} (Retract).
Local Arguments Retr_g {_ _} (Retract).
Definition retract_join_f s :=
match s with
| inl a => Retr_f retr1 a
| inr b => Retr_f retr2 b
end.
Definition retract_join_g z :=
match Retr_g retr1 z with
| Some a => Some (inl a)
| None =>
match Retr_g retr2 z with
| Some b => Some (inr b)
| None => None
end
end.
Hypothesis disjoint : forall (a : A) (b : B), Retr_f _ a <> Retr_f _ b.

Lemma retract_join : retract retract_join_f retract_join_g.