(* 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 :  before\_after.v }%*)
Set Implicit Arguments.
Unset Strict Implicit.
Require Export omit_facts.
(** - Some stuff I thought would be useful some day but wasn't *)
Definition before (N N' : nat) (i : fin N) (j : fin N') := index i < index j.
Definition after (N N' : nat) (i : fin N) (j : fin N') := index i > index j.
Definition notbefore (N N' : nat) (i : fin N) (j : fin N') :=
index i = index j \/ after i j.
Definition notafter (N N' : nat) (i : fin N) (j : fin N') :=
before i j \/ index i = index j.
simpl in |- *.
unfold before, after in |- *.
intros.
case i; case i'.
simpl in |- *.
intros x l x0 l0.
clear l0 l i' i N N'.
induction  x as [| x Hrecx]; induction  x0 as [| x0 Hrecx0];
unfold gt in |- *; auto with arith.
case Hrecx.
auto with arith.
intro.
unfold gt in |- *; case H.
intro; left.
rewrite H0.
auto.
unfold gt in |- *.
intro.
right.
case H0.
auto.
intros.
cut (S x < S m \/ S x = S m).
intro.
case H2.
auto.
auto.
left.
auto with arith.
Qed.
unfold notbefore in |- *.
apply decide_fin.
Qed.
unfold notafter in |- *.
intros.
case (decide_before i j).
auto.
unfold notbefore in |- *.
tauto.
Qed.

Lemma seq_properties_split_before_eq_after :
forall (A : Setoid) (n : nat) (v : seq n A) (i : fin n) (P : Predicate A),
(forall j : fin n, before j i -> Pred_fun P (v j)) ->
Pred_fun P (v i) ->
(forall j : fin n, after j i -> Pred_fun P (v j)) ->
forall j : fin n, Pred_fun P (v j).