(* 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.
intros.
case (decide_fin j i); auto.
intro.
case H2; auto.
generalize H0.
elim P.
simpl in |- *.
unfold pred_compatible in |- *.
intros.
apply Pred_compatible_prf with (v i); auto with algebra.
Qed.
intros.
case (decide_before j i); auto.
Qed.
intros.
case (decide_after j i); auto.
Qed.
intros.
case (decide_before j i); auto.
Qed.

Lemma seq_properties_split_after_notafter :
forall (A : Setoid) (n : nat) (v : seq n A) (i : fin n) (P : A -> Prop),
(forall j : fin n, after j i -> P (v j)) ->
(forall j : fin n, notafter j i -> P (v j)) -> forall j : fin n, P (v j).