(* 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 :  concat.v }%*)
(** - concatenation of sequences, denoted by "++" (Haskell notation) plus some preliminary lemmas *)
Set Implicit Arguments.
Unset Strict Implicit.
Require Export conshdtl.
Section MAIN.
Variable A : Setoid.
(** %\label{concat}% *)
Definition concat :
forall (n m : Nat) (f : seq n A) (g : seq m A), seq (n + m) A.
simple induction n.
simpl in |- *.
intros.
exact g.
intros.
simpl in |- *.
exact (f (Build_finiteT (lt_O_Sn n0));; X _ (Seqtl f) g).
(* ie. (concat (f0 :: (Seqtl f) g)) = f0 :: (concat (Seqtl f) g) *)
Defined.
Infix "++" := concat (at level 60, right associativity).

(* Specifications: *)
Lemma concat_comp :
forall (n m : Nat) (f f' : seq n A) (g g' : seq m A),
f =' f' in _ -> g =' g' in _ -> f ++ g =' f' ++ g' in _.