(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
Definition UNION (X : Typ1) (A : Rel X) (a : X) (z' z : opt X) :=
forall E : Prop,
(forall x x' : X,
eq (opt X) z' (some X x') -> eq (opt X) z (some X x) -> A x' x -> E) ->
(forall x x' : X,
eq (opt X) z' (some X x') -> eq (opt X) z (none X) -> A x' x -> A x a -> E) ->
E.
Proof
fun X A a x x' H E e _ =>
e x x' (eq_refl (opt X) (some X x')) (eq_refl (opt X) (some X x)) H.
Proof
fun X A a x x' H1 H2 E _ e =>
e x x' (eq_refl (opt X) (some X x')) (eq_refl (opt X) (none X)) H1 H2.

Lemma union_intro :
forall (X : Typ1) (A : Rel X) (a : X) (Y : Typ1) (B : Rel Y)
(b : Y) (Z : Typ1) (C : Rel Z) (c : Z),
ELT Y B b Z C c ->
ELT Z C c X A a -> ELT Y B b (opt X) (UNION X A a) (none X).