(* 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                               *)
(*                                                                          *)
(****************************************************************************)
(*                               Relations.v                                *)
(****************************************************************************)
(*              Formal Language Theory                                      *)
(*                                                                          *)
(*              Judicael Courant - Jean-Christophe Filliatre                *)
(*                                                                          *)
(*              Developped in V5.8  June-July 1993                          *)
(*              Ported     to V5.10 October 1994                            *)
(****************************************************************************)
(*Resultats sur les relations sur un Set,*)
(*copie de THEORIES/RELATIONS/Relations.v*)
(*ou l'on a remplace Type par Set et ou l'on definit le predicat Rstar_inv *)
Section Relations.
(* Properties of a binary relation R on type A *)
Variable A : Set.
Variable R : A -> A -> Prop.
(* Definition of the reflexive-transitive closure R* of R *)
(* Smallest reflexive P containing R o P *)
Definition Rstar (x y : A) :=
forall P : A -> A -> Prop,
(forall u : A, P u u) ->
(forall u v w : A, R u v -> P v w -> P u w) -> P x y.

(* Specifications: *)
Theorem Rstar_reflexive : forall x : A, Rstar x x.
Proof
fun (x : A) (P : A -> A -> Prop) (h1 : forall u : A, P u u)
(h2 : forall u v w : A, R u v -> P v w -> P u w) =>
h1 x.
Theorem Rstar_R : forall x y z : A, R x y -> Rstar y z -> Rstar x z.
Proof
fun (x y z : A) (t1 : R x y) (t2 : Rstar y z) (P : A -> A -> Prop)
(h1 : forall u : A, P u u)
(h2 : forall u v w : A, R u v -> P v w -> P u w) =>
h2 x y z t1 (t2 P h1 h2).