(* 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 :  modify\_seq.v }%*)
(** - if $v=\langle v_0...v_i...v_{n-1}\rangle$ then (modify v i a) = $\langle v_0...a...v_{n-1}\rangle$ *)
Set Implicit Arguments.
Unset Strict Implicit.
Require Export conshdtl.
(** %\label{modifyseq}% *)
Definition modify_seq :
forall (A : Setoid) (n : Nat), seq n A -> fin n -> A -> seq n A.
induction n.
intros.
auto.
intros.
destruct X0.
destruct index as [| n0].
exact (X1;; Seqtl X).
exact (head X;; IHn (Seqtl X) (Build_finiteT (lt_S_n _ _ in_range_prf)) X1).
Defined.

Lemma modify_comp :
forall (A : Setoid) (n : Nat) (a a' : A) (v v' : seq n A) (i i' : fin n),
a =' a' in _ ->
v =' v' in _ -> i =' i' in _ -> modify_seq v i a =' modify_seq v' i' a' in _.