Definition reptype_gen {cs: compspecs} : type -> (sigT (fun x => x)) :=
type_func (fun _ => (sigT (fun x => x)))
(fun t =>
if (type_is_by_value t)
then existT (fun x => x) val Vundef
else existT (fun x => x) unit tt)
(fun t n a TV => existT (fun x => x) (list (projT1 TV)) (list_repeat (Z.to_nat n) (projT2 TV)))
(fun id a TVs => existT (fun x => x) (compact_prod_sigT_type (decay TVs)) (compact_prod_sigT_value (decay TVs)))
(fun id a TVs => existT (fun x => x) (compact_sum_sigT_type (decay TVs)) (compact_sum_sigT_value (decay TVs))).
Definition reptype {cs: compspecs} t: Type := match reptype_gen t with existT t _ => t end.
Definition default_val {cs: compspecs} t: reptype t :=
match reptype_gen t as tv
return match tv with existT t _ => t end
with existT t v => v end.
Instance Inhabitant_reptype {cs: compspecs} (t: type) : Inhabitant (reptype t) := default_val t.
Section CENV.
Context {cs: compspecs}.

Lemma fold_reptype_JMeq: forall t v,
JMeq (fold_reptype v : reptype t) v.