(* 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                               *)
(*                                                                          *)
(****************************************************************************)
(****************************************************************************)
(*                               Reduction.v                                *)
(*                                                                          *)
(*                                Gerard Huet                               *)
(*                                                                          *)
(* Developed in V5.8  January 1993                                          *)
(* Ported    to V5.10 January 1995                                          *)
(****************************************************************************)
(* Beta reduction *)
Inductive red1 : lambda -> lambda -> Prop :=
| beta : forall M N : lambda, red1 (App (Abs M) N) (subst N M)
| abs_red : forall M N : lambda, red1 M N -> red1 (Abs M) (Abs N)
| app_red_l :
forall M1 N1 : lambda,
red1 M1 N1 -> forall M2 : lambda, red1 (App M1 M2) (App N1 M2)
| app_red_r :
forall M2 N2 : lambda,
red1 M2 N2 -> forall M1 : lambda, red1 (App M1 M2) (App M1 N2).
(* Transitive closure of red1 *)
Inductive red : lambda -> lambda -> Prop :=
| one_step_red : forall M N : lambda, red1 M N -> red M N
| refl_red : forall M : lambda, red M M
| trans_red : forall M N P : lambda, red M N -> red N P -> red M P.
(* Parallel beta reduction *)
Inductive par_red1 : lambda -> lambda -> Prop :=
| par_beta :
forall M M' : lambda,
par_red1 M M' ->
forall N N' : lambda,
par_red1 N N' -> par_red1 (App (Abs M) N) (subst N' M')
| ref_par_red : forall n : nat, par_red1 (Ref n) (Ref n)
| abs_par_red :
forall M M' : lambda, par_red1 M M' -> par_red1 (Abs M) (Abs M')
| app_par_red :
forall M M' : lambda,
par_red1 M M' ->
forall N N' : lambda, par_red1 N N' -> par_red1 (App M N) (App M' N').
Hint Resolve par_beta ref_par_red abs_par_red app_par_red.
Hint Resolve refl_par_red1.
(* Multi-step parallel beta reduction *)
Inductive par_red : lambda -> lambda -> Prop :=
| one_step_par_red : forall M N : lambda, par_red1 M N -> par_red M N
| trans_par_red :
forall M N P : lambda, par_red M N -> par_red N P -> par_red M P.
(* Equivalence between reduction and parallel reduction *)

Lemma red_par_red : forall M N : lambda, red M N -> par_red M N.