Definition reptype_gen: type -> (sigT (fun x => x)) :=
  type_func (fun _ => (sigT (fun x => x)))
  (fun t =>
     match t with
     | Tint => existT (fun x => x) val Vundef
     | Tstruct _ => existT (fun x => x) unit tt
     end)
  (fun id TVs => existT (fun x => x) (list_prod_sigT_type (decay TVs)) (list_prod_sigT_value (decay TVs))).Definition reptype t: Type := match reptype_gen t with existT t _ => t end.Definition default_val t: reptype t :=
  match reptype_gen t as tv
    return match tv with existT t _ => t end
  with existT t v => v end.

Lemma reptype_gen_eq: forall t, reptype_gen t = match t with | Tstruct id => existT (fun x => x) (list_prod_sigT_type (map reptype_gen (map (fun it => field_type (fst it) (co_members (get_co id))) (co_members (get_co id))))) (list_prod_sigT_value (map reptype_gen (map (fun it => field_type (fst it) (co_members (get_co id))) (co_members (get_co id))))) | Tint => existT (fun x => x) val Vundef end.