Require Export VST.msl.iter_sepcon.
Require Export VST.concurrency.semax_conc_pred.
Require Export VST.concurrency.semax_conc.
Require Export VST.floyd.proofauto.
Require Export VST.floyd.sublist.
(* general list lemmas *)
Notation vint z := (Vint (Int.repr z)).
Notation vptrofs z := (Vptrofs (Ptrofs.repr z)).
Hint Resolve repable_0.
Definition complete MAX l := l ++ repeat (vptrofs 0) (Z.to_nat MAX - length l).
Definition remove_at {A} i (l : list A) := firstn i l ++ skipn (S i) l.
Open Scope logic.
Definition rotate {A} (l : list A) n m := sublist (m - n) (Zlength l) l ++
sublist 0 (m - n) l.
(* Lemma Znth_indep : forall {A} i (l : list A) d d', 0 <= i < Zlength l -> Znth i l d = Znth i l d'. *)
Fixpoint upto n :=
match n with
| O => []
| S n' => 0 :: map Z.succ (upto n')
end.
Opaque Z.of_nat.
(* Lemma Znth_map' : forall {A B} i (f : A -> B) al b, Znth i (map f al) (f b) = f (Znth i al b). *)
Transparent Z.of_nat.
Hint Resolve incl_nil.
Definition nil_dec {A} (l : list A) : {l = []} + {l <> []}.
Arguments eq_dec _ _ _ _ : simpl never.

Lemma list_Znth_eq' : forall {A} {d: Inhabitant A} (l1 l2 : list A)
(Hlen : Zlength l1 = Zlength l2)
(Heq : forall j, 0 <= j < Zlength l1 -> Znth j l1 = Znth j l2), l1 = l2.