Definition in_map: forall {A B : Type} (f : A -> B) (l : list A) (x : A),
In x l -> In (f x) (map f l) :=
fun (A B : Type) (f : A -> B) (l : list A) =>
list_ind (fun l0 : list A => forall x : A, In x l0 -> In (f x) (map f l0))
(fun (x : A) (H : In x nil) => H)
(fun (a : A) (l0 : list A)
(IHl : forall x : A, In x l0 -> In (f x) (map f l0)) (x : A)
(H : In x (a :: l0)) =>
or_ind
(fun H0 : a = x =>
or_introl (eq_ind_r (fun a0 : A => f a0 = f x) eq_refl H0))
(fun H0 : In x l0 =>
or_intror
((fun H1 : In x l0 -> In (f x) (map f l0) =>
(fun H2 : In (f x) (map f l0) => H2) (H1 H0)) (IHl x))) H) l.

(* TODO: we have already proved a related field_offset lemma in veric/change_compspecs.v. But it seems not clear how to use that in an elegant way. *)
Lemma field_offset_change_composite {cs_from cs_to} {CCE: change_composite_env cs_from cs_to}: forall id i,
match (coeq cs_from cs_to) ! id with
| Some b => test_aux cs_from cs_to b id
| None => false
end = true ->
field_offset (@cenv_cs cs_from) i (co_members (@get_co cs_to id)) =
field_offset (@cenv_cs cs_to) i (co_members (@get_co cs_to id)).