(* 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*{ extras :  restrict.v }%*)
Set Implicit Arguments.
Unset Strict Implicit.
Require Export const.
Require Export pointwise.
Require Export distinct.
(** - Restriction of a sequence to its prefixes... not used anywhere any more *)
Definition restricted_seq :
forall (S : Setoid) (N : Nat) (f : seq N S) (M : Nat) (leMN : M <= N),
seq M S.
intros.
simpl in |- *.
apply
(Build_Map
(Ap:=fun mM : fin M =>
f
match mM with
| Build_finiteT m ltmM =>
Build_finiteT (lt_le_trans _ _ _ ltmM leMN)
end)).
red in |- *.
intros.
destruct x.
destruct y.
apply Ap_comp; auto with algebra.
Defined.
intros.
simpl in |- *.
red in |- *.
simpl in |- *.
destruct x.
apply Ap_comp; auto with algebra.
Qed.
Hint Resolve restricted_comp: algebra.
intros.
simpl in |- *.
red in |- *.
intro i.
unfold restricted_seq in |- *.
unfold const_map in |- *.
simpl in |- *.
apply Refl.
Qed.
Hint Resolve const_map_restricted: algebra.

Lemma restricted_seq_preserves_distinct :
forall (A : Setoid) (n m : Nat) (v : seq n A) (H : m <= n),
distinct v -> distinct (restricted_seq v H).