Fixpoint extendr {A} (l : list A) ls :=
match l, ls with
| x :: xs, y :: ys => (y ++ [x]) :: extendr xs ys
| _, _ => ls
end.

(* Specifications: *)
Lemma Zlength_extendr : forall {A} (l : list A) ls, Zlength (extendr l ls) = Zlength ls.
Lemma Znth_extendr_in : forall {A}{d: Inhabitant A}  (l : list A) ls i, 0 <= i < Zlength l -> Zlength l <= Zlength ls ->
Znth i (extendr l ls) = Znth i ls ++ [Znth i l].
Lemma Znth_extendr_ge : forall {A}{d: Inhabitant A}  (l : list A) ls i, Zlength l <= i ->
Znth i (extendr l ls) = Znth i ls.
Lemma list_join_eq : forall (b : list share) a c c'
(Hc : sepalg_list.list_join a b c) (Hc' : sepalg_list.list_join a b c'), c = c'.
Lemma readable_share_list_join : forall sh shs sh', sepalg_list.list_join sh shs sh' ->
readable_share sh \/ Exists readable_share shs -> readable_share sh'.
Lemma sublist_0_cons' : forall {A} i j (x : A) l, i <= 0 -> j > i -> sublist i j (x :: l) =
x :: sublist i (j - 1) l.
Lemma sublist_combine : forall {A B} (l1 : list A) (l2 : list B) i j,
sublist i j (combine l1 l2) = combine (sublist i j l1) (sublist i j l2).
Lemma extend_nil : forall {A} (l : list A), extend l [] = [].
Lemma extend_cons : forall {A} (l : list A) l1 ls, extend l (l1 :: ls) =
match l with [] => l1 :: ls | a :: l' => (a :: l1) :: extend l' ls end.
Lemma sublist_extend : forall {A} (l : list A) ls i j,
sublist i j (extend l ls) = extend (sublist i j l) (sublist i j ls).
Lemma extendr_nil : forall {A} (l : list A), extendr l [] = [].
Lemma extendr_cons : forall {A} (l : list A) l1 ls, extendr l (l1 :: ls) =
match l with [] => l1 :: ls | a :: l' => (l1 ++ [a]) :: extendr l' ls end.
Lemma sublist_extendr : forall {A} (l : list A) ls i j,
sublist i j (extendr l ls) = extendr (sublist i j l) (sublist i j ls).
Lemma sublist_over : forall {A} (l : list A) i j, Zlength l <= i -> sublist i j l = [].
Lemma make_tycontext_s_distinct : forall a l (Ha : In a l) (Hdistinct : NoDup (map fst l)),
(make_tycontext_s l) ! (fst a) = Some (snd a).
Lemma lookup_distinct : forall {A B} (f : A -> B) a l t (Ha : In a l) (Hdistinct : NoDup (map fst l)),
(fold_right (fun v : ident * A => PTree.set (fst v) (f (snd v))) t l) ! (fst a) =
Some (f (snd a)).
Lemma lookup_out : forall {A B} (f : A -> B) a l t (Ha : ~In a (map fst l)),
(fold_right (fun v : ident * A => PTree.set (fst v) (f (snd v))) t l) ! a = t ! a.
Lemma data_at__eq : forall {cs : compspecs} sh t p, data_at_ sh t p = data_at sh t (default_val t) p.
Lemma func_tycontext_sub : forall f V G A V2 G2 (HV : incl V V2) (HG : incl G G2)
(Hdistinct : NoDup (map fst V2 ++ map fst G2)),
tycontext_sub (func_tycontext f V G A) (func_tycontext f V2 G2 A).
(* This lets us use a library as a client. *)
Lemma semax_body_mono : forall V G {cs : compspecs} f s V2 G2
(HV : incl V V2) (HG : incl G G2) (Hdistinct : NoDup (map fst V2 ++ map fst G2)),
semax_body V G f s -> semax_body V2 G2 f s.