Hint Resolve regs_erasure_get regs_erasure_refl regs_erasure_set
: regs_erasure.
Notation the_ge := (@the_ge the_program).
(** ** Result about at_external, after_external and initial_core *)

(* Specifications: *)
Lemma get_extcall_arg_erase:
forall rs rs' m m' l v
(Hrs: regs_erasure rs rs')
(Hmem: mem_erasure m m')
(Harg: get_extcall_arg rs m l = Some v),
exists v',
get_extcall_arg rs' m' l = Some v' /\
val_erasure v v'.
Lemma get_extcall_arguments_erase:
forall rs rs' m m' ls vs
(Hrs: regs_erasure rs rs')
(Hmem: mem_erasure m m')
(Hargs: get_extcall_arguments rs m ls = Some vs),
exists vs',
get_extcall_arguments rs' m' ls = Some vs' /\
val_erasure_list vs vs'.
Lemma at_external_erase:
forall rs rs' m m' ef vs
(Herase: core_erasure (State rs m) (State rs' m'))
(Hmem_erase: mem_erasure m m')
(Hat_external: at_external the_ge (State rs m) = Some (ef, vs)),
exists vs',
at_external the_ge (State rs' m') = Some (ef, vs') /\
val_erasure_list vs vs'.
Lemma after_external_erase :
forall v v' c c' m m' c2
(HeraseCores: core_erasure c c')
(HeraseVal: optionval_erasure v v')
(HeraseMem: mem_erasure m m')
(Hafter_external: after_external the_ge v c m = Some c2),
exists (c2' : state),
after_external the_ge v' c' m' = Some c2' /\
core_erasure c2 c2'.
Lemma make_arguments_nil_erasure:
forall rs rs2 rs' m m2 m' locs
(Hregs: regs_erasure rs rs')
(Hmem: mem_erasure' m m')
(Hmake: make_arguments rs m locs [::] = Some (rs2, m2)),
exists rs2' m2',
make_arguments rs' m' locs [:: ] = Some (rs2', m2') /\
regs_erasure rs2 rs2' /\
mem_erasure' m2 m2'.
Lemma make_arguments_nil_locs:
forall rs rs2 rs' m m2 m' locs
(Hregs: regs_erasure rs rs')
(Hmem: mem_erasure' m m')
(Hmake: make_arguments rs m locs [::] = Some (rs2, m2)),
locs = [::].
Lemma make_arg_erasure:
forall rs rs' m m' r arg arg' rs2 m2
(Hregs: regs_erasure rs rs')
(Hmem: mem_erasure' m m')
(Hargs: val_erasure arg arg')
(Hmake: make_arg rs m r arg = Some (rs2, m2)),
exists rs2' m2',
make_arg rs' m' r arg' = Some (rs2', m2') /\
regs_erasure rs2 rs2' /\
mem_erasure' m2 m2'.
Lemma make_arguments_erasure:
forall rs rs2 rs' m m2 m' locs arg arg'
(Hregs: regs_erasure rs rs')
(Hmem: mem_erasure' m m')
(Hargs: val_erasure arg arg')
(Hmake: make_arguments rs m locs [:: arg] = Some (rs2, m2)),
exists rs2' m2',
make_arguments rs' m' locs [:: arg'] = Some (rs2', m2')/\
regs_erasure rs2 rs2' /\
mem_erasure' m2 m2'.
Lemma erasure_initial_core:
forall h v arg v' arg' c m m' m2
(Hv: val_erasure v v')
(Harg: val_erasure arg arg')
(Hmem: mem_erasure m m')
(Hinit: initial_core semSem h m c m2 v [:: arg]),
exists c' m2',
initial_core semSem h m' c' m2' v' [:: arg'] /\
core_erasure c c' /\
mem_erasure m2 (erasePerm m2').
Lemma halted_erase:
forall c c' h
(HeraseCores: core_erasure c c')
(Hhalted: halted semSem c h),
halted semSem c' h.
Lemma eval_testcond_erasure:
forall (c : testcond) rs rs'
(Hrs: regs_erasure rs rs'),
eval_testcond c rs <> None ->
eval_testcond c rs = eval_testcond c rs'.
Lemma eval_addrmode32_erase:
forall g a rs rs',
regs_erasure rs rs' ->
val_erasure (eval_addrmode32 g a rs) (eval_addrmode32 g a rs').
Lemma eval_addrmode_erase:
forall g a rs rs',
regs_erasure rs rs' ->
isPointer (eval_addrmode g a rs) ->
eval_addrmode g a rs = eval_addrmode g a rs'.
(* TODO: these two are duplicated, create a separate library for registers*)
Lemma regset_comm:
forall (rs: Pregmap.t val) r r' v,
(rs # r <- v) # r' <- v = (rs # r' <- v) # r <- v.
Lemma undef_regs_comm:
forall regs rs r,
undef_regs regs (rs # r <- Vundef) =
(undef_regs regs rs) # r <- Vundef.
Lemma regs_erasure_undef:
forall regs rs rs',
regs_erasure rs rs' ->
regs_erasure (undef_regs regs rs) (undef_regs regs rs').
Lemma regs_erasure_set_undef:
forall rs rs' r,
regs_erasure rs rs' ->
regs_erasure rs # r <- Vundef rs'.