End CENV.
Arguments reptype' {cs} t / .
Global Notation REPTYPE t :=
match t return Type with
| Tvoid
| Tfunction _ _ _ => unit
| Tint _ _ _
| Tlong _ _
| Tfloat _ _
| Tpointer _ _ => val
| Tarray t0 _ _ => list (reptype t0)
| Tstruct id _ => reptype_structlist (co_members (get_co id))
| Tunion id _ => reptype_unionlist (co_members (get_co id))
end.
Tactic Notation "unfold_repinj" :=
repeat match goal with |- context [repinj ?T] =>
let x := fresh "x" in set (x := repinj T);
lazy beta iota zeta delta in x; subst x; lazy beta
end.
Tactic Notation "unfold_repinj" constr(T) :=
match goal with |- context [repinj T] =>
let x := fresh "x" in set (x := repinj T);
lazy beta iota zeta delta in x; subst x; lazy beta
end.
(* Too expensive to do "pattern (repinj T V)", this can blow up. Tactic Notation "unfold_repinj" constr(T) constr(V) := pattern (repinj T V); unfold_repinj' T. *)

Lemma reptype_change_composite {cs_from cs_to} {CCE: change_composite_env cs_from cs_to}: forall (t: type),
cs_preserve_type cs_from cs_to (coeq _ _) t = true ->
@reptype cs_from t = @reptype cs_to t.