(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
(*                                                                      *)
(* Micromega: A reflexive tactic using the Positivstellensatz           *)
(*                                                                      *)
(*  Frédéric Besson (Irisa/Inria) 2006-2008                             *)
(*                                                                      *)
(************************************************************************)
Set Implicit Arguments.
Local Open Scope positive_scope.
Section S.
Variable D :Type.
Definition Env := positive -> D.
Definition jump (j:positive) (e:Env) := fun x => e (x+j).
Definition nth (n:positive) (e:Env) := e n.
Definition hd (e:Env) := nth 1 e.
Definition tail (e:Env) := jump 1 e.

Lemma nth_spec p l :
nth p l =
match p with
| xH => hd l
| xO p => nth p (jump p l)
| xI p => nth p (jump p (tail l))
end.