(* 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)                    *)
Require Export Sets.
Require Export Axioms.
Require Export Omega.
Definition ord : forall E E' : Ens, INC E' E -> Prop.
simple induction E.
intros A f HR.
intros E' i.
apply and.
exact (forall a : A, IN (f a) E' -> HR a (f a) (INC_refl (f a))).
exact
(forall (a : A) (e : Ens),
IN (f a) E' -> forall p : INC e (f a), HR a e p -> IN e E').
Defined.
simple induction E.
intros A f HR.
simpl in |- *.
intros E' E'' I' I'' e.
simple induction 1.
intros o1 o2.
clear H.
split.
auto with zfc.
intros; apply o1.
apply IN_sound_right with E''; auto with zfc.
intros.
apply IN_sound_right with E'; auto with zfc.
apply (o2 a) with (p := p).
apply IN_sound_right with E''; auto with zfc.
auto with zfc.
Qed.
simple induction E; intros A f HR; simple induction E'; intros A' f' HR'.
intros e E'' p p'.
elim e; intros e1 e2.
split.
intros o.
elim o; intros o1 o2.
simpl in |- *.
split.
intros a' i.
elim (e2 a'); intros a eq.
cut (INC (f' a') (f a)).
intros inc.
elim (HR a (f' a') eq (f' a') inc (INC_refl (f' a'))).
intros h1 h2.
auto with zfc.
apply h1.
apply ord_ext with (f a) (INC_refl (f a)).
auto with zfc.
auto with zfc.
apply o1.
apply IN_sound_left with (f' a'); auto with zfc.
auto with zfc.
intros a' E0 i inc.
intros or.
elim (e2 a'); intros a eq.
cut (INC E0 (f a)).
intros inc0.
apply (o2 a E0) with inc0.
apply IN_sound_left with (f' a'); auto with zfc.
elim (HR a (f' a')) with (E'' := E0) (p := inc0) (p' := inc).
intros h1 h2.
auto with zfc.
auto with zfc.
apply INC_sound_right with (f' a'); auto with zfc.
intros o; elim o; intros o1 o2.
split.
intros a i.
elim (e1 a); intros a' eq.
cut (INC (f a) (f' a')); auto with zfc.
cut (INC (f' a') (f a)); auto with zfc.
intros inc1 inc2.
elim (HR a (f' a')) with (E'' := f a) (p := INC_refl (f a)) (p' := inc2).
intros h1 h2.
apply h2.
apply ord_ext with (E' := f' a') (p' := INC_refl (f' a')).
auto with zfc.
auto with zfc.
apply o1.
apply IN_sound_left with (f a); auto with zfc.
auto with zfc.
intros a E0 i inc ord0.
elim (e1 a); intros a' eq.
cut (INC E0 (f' a')).
intros inc0.
apply (o2 a') with (p := inc0).
apply IN_sound_left with (f a); auto with zfc.
elim (HR a (f' a') eq E0 inc inc0).
intros h1 h2.
auto with zfc.
apply INC_sound_right with (f a); auto with zfc.
Qed.
Definition Ord (E : Ens) := ord E E (INC_refl E).

Lemma Ord_sound : forall E E' : Ens, EQ E E' -> Ord E -> Ord E'.