(* solve list equations *)
(* interpreted functions : Zlength app list_repeat / Zrepeat map sublist upd_Znth -> sublist Znth *)
Definition data_subsume {cs : compspecs} (t : type) (x y : reptype t) : Prop :=
forall sh p, data_at sh t x p |-- data_at sh t y p.
Ltac apply_list_ext :=
first
[ apply data_subsume_array_ext;
only 1, 2 : Zlength_solve
| match goal with |- @eq ?list_A _ _ =>
match eval compute in list_A with list ?A =>
apply (@Znth_eq_ext A ltac:(auto with typeclass_instances))
end
end;
only 1 : Zlength_solve
];
autorewrite with Zlength;
intros.

Lemma rangei_uni_app : forall {A : Type} {d : Inhabitant A} (lo hi : Z) (al bl : list A) (P : Z -> A -> Prop),
0 <= lo <= Zlength al /\ Zlength al <= hi <= Zlength al + Zlength bl ->
rangei_uni lo hi (al ++ bl) P ->
rangei_uni lo (Zlength al) al P /\
rangei_uni 0 (hi - Zlength al) bl (fun i => P (i + Zlength al)).