(**** tactics for value_fits  ****)

(* Specifications: *)
Lemma value_fits_Tstruct:
forall {cs: compspecs} t (v: reptype t) i a m v2 r,
t = Tstruct i a ->
m = co_members (get_co i)  ->
JMeq (@unfold_reptype cs t v) v2 ->
r =struct_Prop m
(fun it => value_fits (field_type (fst it) m))  v2 ->
value_fits t v = r.
Lemma value_fits_Tunion:
forall {cs: compspecs} t (v: reptype t) i a m v2 r,
t = Tunion i a ->
m = co_members (get_co i)  ->
JMeq (@unfold_reptype cs t v) v2 ->
r =union_Prop m
(fun it => value_fits (field_type (fst it) m))  v2 ->
value_fits t v = r.
Lemma value_fits_by_value_defined:
forall {cs: compspecs} t t' v r,
type_is_by_value t = true ->
repinject t v <> Vundef  ->
t = t' ->
(r = if type_is_volatile t' then True
else tc_val t' (repinject t v)) ->
value_fits t v = r.
Lemma value_fits_by_value_Vundef:
forall {cs: compspecs} t v,
type_is_by_value t = true ->
repinject t v = Vundef  ->
value_fits t v = True.
Lemma value_fits_by_value:
forall {cs: compspecs} t t' v r,
type_is_by_value t = true ->
t = t' ->
(r = if type_is_volatile t then True
else tc_val' t' (repinject t v)) ->
value_fits t v = r.
Lemma value_fits_Tarray:
forall {cs: compspecs} t (v: reptype t) t' n a
(v' : list (reptype t')) r,
t = (Tarray t' n a) ->
JMeq (unfold_reptype v) v' ->
n >= 0 ->
r = (Zlength v' = n /\ Forall (value_fits t') v') ->
value_fits t v =r.