(* 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                                                     *)
(** %\subsection*{ support :  Map\_embed.v }%*)
Set Implicit Arguments.
Unset Strict Implicit.
Require Export concat.
(** - Any element of $A\subset E$ is of course also an element of $E$ itself. Map_embed takes setoid functions $X\to A$ to setoid functions $X\to E$ by embedding  %\label{Mapembed}% *)
Definition Map_embed :
forall (X E : Setoid) (A : part_set E) (f : Map X A), MAP X E.
intros.
apply (Build_Map (Ap:=fun n : X => A (f n))).
red in |- *.
intros x y.
case f.
intros.
red in Map_compatible_prf.
generalize Map_compatible_prf.
intro H0.
generalize (H0 x y).
intros.
simpl in |- *.
apply H1.
assumption.
Defined.
intros.
unfold Map_embed in |- *; simpl in |- *; red in |- *; simpl in |- *.
intuition.
Qed.
Hint Resolve Map_embed_comp: algebra.

Lemma Map_embed_cons :
forall (E : Setoid) (A : part_set E) (a : A) (n : Nat) (f : seq n A),
Map_embed (a;; f) =' subtype_elt a;; Map_embed f in seq _ _.