Local Open Scope logic.
(*Require Import tweetnacl20140427.split_array_lemmas.*)

(* Specifications: *)
Lemma Zlength_list_repeat' {A} n (v:A): Zlength (list_repeat n v) = Z.of_nat n.
Lemma map_cons_inv {A B} (f:A -> B) a l fT:
(f a:: fT) = map f l -> exists b T, l = b :: T /\ f a = f b /\ fT = map f T.
Lemma Byte_max_unsigned_Int_max_unsigned: Byte.max_unsigned < Int.max_unsigned.
unfold Byte.max_unsigned, Int.max_unsigned. simpl. omega. Qed.
Lemma force_lengthn_map {A B} (f:A->B) n: forall l d fd,
fd = f d ->
force_lengthn n (map f l) fd =
map f (force_lengthn n l d).
Lemma force_lengthn_mapN {A B} (f:A->B) n: forall l d fd,
(n < length l)%nat ->
force_lengthn n (map f l) fd =
map f (force_lengthn n l d).
Lemma In_force_lengthn {A} d u: forall n l, @In A u (force_lengthn n l d) -> In u l \/ u=d.
Lemma In_force_lengthn_n {A} d u: forall n l (L:(length l >=n)%nat), @In A u (force_lengthn n l d) -> In u l.
Lemma In_skipn {A} (u:A): forall n l, In u (skipn n l) -> In u l.
Lemma nth_force_lengthn':
forall (A : Type) (n i : nat) (xs : list A) (default d: A) (N: (n < length xs)%nat),
(0 <= i < n)%nat ->
@nth A i (@force_lengthn A n xs default) d = @nth A i xs d.
Lemma app_Znth1: forall (A : Type){d: Inhabitant A} (l l' : list A) (n :Z),
(n < Zlength l) -> Znth n (l ++ l') = Znth n l.
Lemma app_Znth2: forall (A : Type) {d: Inhabitant A}(l l' : list A) (n : Z),
(Zlength l <= n) -> Znth n (l ++ l') = Znth (n - Zlength l) l'.
Lemma nth_extensional {A}: forall l1 l2 (L:length l1 = length l2) (d:A)
(N: forall i, (0<=i<length l1)%nat -> nth i l1 d = nth i l2 d), l1=l2.