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.

(* Specifications: *)
Lemma In_field_type: forall it m,
members_no_replicate m = true ->
In it m ->
field_type (fst it) m = snd it.
Lemma members_spec_change_composite'' {cs_from cs_to} {CCE: change_composite_env cs_from cs_to}: forall id,
match (coeq cs_from cs_to) ! id with
| Some b => test_aux cs_from cs_to b id
| None => false
end = true ->
forall i, cs_preserve_type cs_from cs_to (coeq _ _) (field_type i (co_members (get_co id))) = true.
Lemma members_spec_change_composite {cs_from cs_to} {CCE: change_composite_env cs_from cs_to}: forall id,
match (coeq cs_from cs_to) ! id with
| Some b => test_aux cs_from cs_to b id
| None => false
end = true ->
Forall (fun it => cs_preserve_type cs_from cs_to (coeq _ _) (field_type (fst it) (co_members (get_co id))) = true) (co_members (get_co id)).
(* 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)).
Lemma field_offset_next_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_next (@cenv_cs cs_from) i (co_members (get_co id)) (co_sizeof (@get_co cs_from id)) =
field_offset_next (@cenv_cs cs_to) i (co_members (get_co id)) (co_sizeof (@get_co cs_to id)).