(* 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                                                     *)
(* Contribution to the Coq Library   V6.3 (July 1999)                    *)
(****************************************************************************)
(*                 The Calculus of Inductive Constructions                  *)
(*                                                                          *)
(*                                Projet Coq                                *)
(*                                                                          *)
(*                     INRIA                        ENS-CNRS                *)
(*              Rocquencourt                        Lyon                    *)
(*                                                                          *)
(*                                Coq V5.10                                 *)
(*                              Nov 25th 1994                               *)
(*                                                                          *)
(****************************************************************************)
(*                               Ensf_disj.v                                *)
(****************************************************************************)
(*              Formal Language Theory                                      *)
(*                                                                          *)
(*              Judicael Courant - Jean-Christophe Filliatre                *)
(*                                                                          *)
(*              Developped in V5.8  June-July 1993                          *)
(*              Ported     to V5.10 October 1994                            *)
(****************************************************************************)
(*									*)
(*  UNION DISJOINTE 							*)
(*    L'union disjointe de A et B est definie comme l'ensemble des 	*)
(*    des couples (x,zero) pour x dans A et (x,un) pour x dans B	*)
(*    Pour cela on definit 2 fonctions injgauche : x->(x,zero) et	*)
(*    injdroite : x->(x,un) et on fait l'union de (map injgauche A)	*)
(*    et de (map injdroite B).						*)
(*									*)
Definition injgauche (e : Elt) : Elt := couple e zero.
Definition injdroite (e : Elt) : Elt := couple e un.
Definition union_disj (e f : Ensf) : Ensf :=
union (map injgauche e) (map injdroite f).
intros.
cut (exists y : Elt, dans y e /\ x = injgauche y).
2: apply dans_map; auto.
intro Ht; elim Ht; clear Ht.
intros y Ht; elim Ht; clear Ht.
intros.
unfold injgauche in H1.
replace (first x) with y; auto.
symmetry  in |- *.
replace y with (first (couple y zero)); auto.
apply (f_equal (A:=Elt) (B:=Elt)); auto.
Qed.
intros.
cut (exists y : Elt, dans y e /\ x = injdroite y).
2: apply dans_map; auto.
intro Ht; elim Ht; clear Ht.
intros y Ht; elim Ht; clear Ht.
intros.
unfold injdroite in H1.
replace (first x) with y; auto.
symmetry  in |- *.
replace y with (first (couple y un)); auto.
apply (f_equal (A:=Elt) (B:=Elt)); auto.
Qed.

Lemma absurd_injg_injd :
forall (x : Elt) (e f : Ensf),
dans x (map injgauche e) -> ~ dans x (map injdroite f).