(************************************************************************)
(*         *      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)         *)
(************************************************************************)
Require Export List.
Set Implicit Arguments.
Local Open Scope positive_scope.
Section MakeBinList.
Variable A : Type.
Variable default : A.
Fixpoint jump (p:positive) (l:list A) {struct p} : list A :=
match p with
| xH => tl l
| xO p => jump p (jump p l)
| xI p  => jump p (jump p (tl l))
end.
Fixpoint nth (p:positive) (l:list A) {struct p} : A:=
match p with
| xH => hd default l
| xO p => nth p (jump p l)
| xI p => nth p (jump p (tl l))
end.

Lemma jump_add : forall i j l,
jump (i + j) l = jump i (jump j l).