(* 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                               *)
(*                                                                          *)
(****************************************************************************)
(*                           sur_les_relations.v                            *)
(****************************************************************************)
(*****************************************************************************)
(*          Projet Coq  - Calculus of Inductive Constructions V5.8           *)
(*****************************************************************************)
(*                                                                           *)
(*      Meta-theory of the explicit substitution calculus lambda-env         *)
(*      Amokrane Saibi                                                       *)
(*                                                                           *)
(*      September 1993                                                       *)
(*                                                                           *)
(*****************************************************************************)
(*  Generalites sur les relations  *)
(**************)
(* Relations  *)
(**************)
Section Rels.
Variable A : Set.
(* R* fermeture reflexive-transitive d une relation binaire R *)
Inductive explicit_star (R : A -> A -> Prop) : A -> A -> Prop :=
| star_refl : forall x : A, explicit_star R x x
| star_trans1 :
forall x y z : A, R x y -> explicit_star R y z -> explicit_star R x z.
(* composition de deux relations *)
Inductive explicit_comp_rel (R1 R2 : A -> A -> Prop) : A -> A -> Prop :=
comp_2rel :
forall x y z : A, R1 x y -> R2 y z -> explicit_comp_rel R1 R2 x z.
(* R+ frmeture transitive de R *)
Inductive explicit_rel_plus (R : A -> A -> Prop) : A -> A -> Prop :=
| relplus_1step : forall x y : A, R x y -> explicit_rel_plus R x y
| relplus_trans1 :
forall x y z : A,
R x y -> explicit_rel_plus R y z -> explicit_rel_plus R x z.
End Rels.
Hint Resolve star_refl.
Hint Resolve relplus_1step.
Notation star := (explicit_star _) (only parsing).
(* <Warning> : Syntax is discontinued *)
Notation comp_rel := (explicit_comp_rel _) (only parsing).
(* <Warning> : Syntax is discontinued *)
Notation rel_plus := (explicit_rel_plus _) (only parsing).
(* <Warning> : Syntax is discontinued *)
(**************)
(* proprietes *)
Section rels_prop.
Variable A : Set.
Variable R : A -> A -> Prop.
(* R confluente *)
Definition confluence_en (x : A) :=
forall y z : A,
explicit_star _ R x y ->
explicit_star _ R x z ->
exists u : A, explicit_star _ R y u /\ explicit_star _ R z u.
Definition explicit_confluence := forall x : A, confluence_en x.
(* R localement confluente *)
Definition local_confluence_en (x : A) :=
forall y z : A,
R x y ->
R x z -> exists u : A, explicit_star _ R y u /\ explicit_star _ R z u.
Definition explicit_local_confluence := forall x : A, local_confluence_en x.
(* R fortement confluente *)
Definition strong_confluence_en (x : A) :=
forall y z : A, R x y -> R x z -> exists u : A, R y u /\ R z u.
Definition explicit_strong_confluence := forall x : A, strong_confluence_en x.
End rels_prop.
Notation confluence := (explicit_confluence _) (only parsing).
(* <Warning> : Syntax is discontinued *)
Notation local_confluence := (explicit_local_confluence _) (only parsing).
(* <Warning> : Syntax is discontinued *)
Notation strong_confluence := (explicit_strong_confluence _) (only parsing).
(* <Warning> : Syntax is discontinued *)
(* inclusion de relations binaires, R1 inclus dans R2: R1 incl R2*)
Definition explicit_inclus (A : Set) (R1 R2 : A -> A -> Prop) :=
forall x y : A, R1 x y -> R2 x y.
Notation inclus := (explicit_inclus _) (only parsing).
(* <Warning> : Syntax is discontinued *)
Section relations_noetherian.
Variable U : Set.
Variable R : U -> U -> Prop.
(* Sets as characteristic predicates over universe U *)
Definition a_set := U -> Prop.
(* A is a subset of B *)
Definition sub (A B : a_set) := forall x : U, A x -> B x.
(* The full universe *)
Definition universal (A : a_set) := forall x : U, A x.
(* Adjoint map *)
Definition adjoint (A : a_set) : a_set := fun x : U => sub (R x) A.
Definition hereditary (A : a_set) := sub (adjoint A) A.
(*  i.e  (hereditary A) <-> (x:A)(sub (R x) A)->(A x) *)
Definition explicit_noetherian :=
forall A : a_set, hereditary A -> universal A.
End relations_noetherian.
Notation noetherian := (explicit_noetherian _) (only parsing).
(* <Warning> : Syntax is discontinued *)
(**********************)
(* quelques resultats *)
(* sur le Ex *)
Goal
forall (A : Set) (P Q : A -> Prop),
(exists u : A, P u /\ Q u) -> exists u : A, Q u /\ P u.
simple induction 1; intros u1 H1.
elim H1; intros H2 H3.
exists u1; split; assumption.
Save Ex_PQ.
Hint Resolve Ex_PQ.
(* sur les constructions de relations *)

Lemma star_trans :
forall (A : Set) (R : A -> A -> Prop) (x y z : A),
explicit_star _ R x y -> explicit_star _ R y z -> explicit_star _ R x z.