(* 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.
intros.
simpl in |- *.
red in |- *.
intro x; case x; intro i; case i.
simpl in |- *.
auto with algebra.
intros.
simpl in |- *.
apply Refl.
Qed.
Hint Resolve Map_embed_cons: algebra.
auto with algebra.
Qed.
Hint Resolve cons_Map_embed: algebra.
simple induction n.
simpl in |- *.
red in |- *.
auto with algebra.
intros.
simpl in |- *.
red in |- *.
simpl in |- *.
intro i.
case i.
auto with algebra.
Qed.
Hint Resolve Map_embed_Seqtl: algebra.

Lemma Seqtl_Map_embed :
forall (E : Setoid) (A : part_set E) (n : Nat) (f : seq n A),
Seqtl (Map_embed f) =' Map_embed (Seqtl f) in seq _ _.