(* 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.
(************* range_form *********************)
Ltac apply_in lem H :=
apply lem in H.
Ltac apply_in_hyps' lem :=
repeat match goal with
| H : ?T |- _ => apply lem in H; let n := numgoals in guard n = 1
end.
Tactic Notation "apply_in_hyps" uconstr(lem) := apply_in_hyps' lem.
Ltac apply_in_hyps_with_Zlength_solve lem :=
repeat match goal with
| H : _ |- _ => apply -> lem in H; [idtac | Zlength_solve ..]
end.
Ltac apply_in_hyps_with_Zlength_solve_destruct lem :=
repeat match goal with
| H : _ |- _ => apply -> lem in H; [destruct H | Zlength_solve ..]
end.

Lemma not_In_range_uni_iff : forall {A : Type} {d : Inhabitant A} (x : A) (l : list A),
~ In x l <-> range_uni 0 (Zlength l) l (fun e => e <> x).