(* 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                                                     *)
Set Implicit Arguments.
Unset Strict Implicit.
Require Export Parts2.
(** Title "Restrictions, inverse images." *)
Section Restrictions1.
Variable E F : Setoid.
Variable f : MAP E F.
Definition restrict : forall A : part_set E, MAP A F.
intros A; try assumption.
apply (Build_Map (Ap:=fun x : A => f (A x))).
red in |- *.
intros x y; try assumption.
elim y.
elim x.
simpl in |- *; auto with algebra.
Defined.

Lemma restrict_prop :
forall (A : part_set E) (x : E) (p : in_part x A),
Equal (restrict A (Build_subtype (subtype_elt:=x) p)) (f x).