Definition value_fits: forall t, reptype t -> Prop :=
  type_func (fun t => reptype t -> Prop)
    (fun t v =>
       if type_is_volatile t then True else tc_val' t (repinject t v))
    (fun t n a P v => Zlength (unfold_reptype v) =  Z.max 0 n /\ Forall P (unfold_reptype v))
    (fun id a P v => struct_value_fits_aux (co_members (get_co id)) (co_members (get_co id)) P (unfold_reptype v))
    (fun id a P v => union_value_fits_aux (co_members (get_co id)) (co_members (get_co id)) P (unfold_reptype v)).

Lemma value_fits_eq: forall t v, value_fits t v = match t as t0 return (reptype t0 -> Prop) with | Tarray t' n a => fun v0 : reptype (Tarray t' n a) => (fun v1 : list (reptype t') => Zlength v1 = Z.max 0 n /\ Forall (value_fits t') v1) (unfold_reptype v0) | Tstruct i a => fun v0 : reptype (Tstruct i a) => struct_Prop (co_members (get_co i)) (fun it : ident * type => value_fits (field_type (fst it) (co_members (get_co i)))) (unfold_reptype v0) | Tunion i a => fun v0 : reptype (Tunion i a) => union_Prop (co_members (get_co i)) (fun it : ident * type => value_fits (field_type (fst it) (co_members (get_co i)))) (unfold_reptype v0) | t0 => fun v0: reptype t0 => (if type_is_volatile t0 then True else tc_val' t0 (repinject t0 v0)) end v.