Hypothesis rec_spec:
forall fe' (L: (size_fenv fe' < size_fenv fe)%nat) ctx f s x s' i c,
rec fe' L ctx f s = R x s' i ->
fenv_agree fe' ->
Ple (ctx.(dpc) + max_pc_function f) s.(st_nextnode) ->
ctx.(mreg) = max_reg_function f ->
Ple (Pos.add ctx.(dreg) ctx.(mreg)) s.(st_nextreg) ->
ctx.(mstk) >= 0 ->
ctx.(mstk) = Z.max (fn_stacksize f) 0 ->
(min_alignment (fn_stacksize f) | ctx.(dstk)) ->
ctx.(dstk) >= 0 ->
s'.(st_stksize) <= stacksize ->
(forall pc, Ple ctx.(dpc) pc -> Plt pc s'.(st_nextnode) -> c!pc = s'.(st_code)!pc) ->
tr_funbody ctx f c.
Remark min_alignment_pos:
forall sz, min_alignment sz > 0.
Ltac inv_incr :=
match goal with
| [ H: sincr _ _ |- _ ] => destruct H; inv_incr
| _ => idtac
end.

(* Specifications: *)
Lemma expand_instr_spec:
forall ctx pc instr s x s' i c,
expand_instr fe rec ctx pc instr s = R x s' i ->
(forall r, instr_defs instr = Some r -> Ple r ctx.(mreg)) ->
Plt (spc ctx pc) s.(st_nextnode) ->
Ple (ctx.(dreg) + ctx.(mreg)) s.(st_nextreg) ->
ctx.(mstk) >= 0 -> ctx.(dstk) >= 0 ->
s'.(st_stksize) <= stacksize ->
(forall pc', Ple s.(st_nextnode) pc' -> Plt pc' s'.(st_nextnode) -> c!pc' = s'.(st_code)!pc') ->
c!(spc ctx pc) = s'.(st_code)!(spc ctx pc) ->
tr_instr ctx pc instr c.
Lemma iter_expand_instr_spec:
forall ctx l s x s' i c,
mlist_iter2 (expand_instr fe rec ctx) l s = R x s' i ->
list_norepet (List.map (@fst _ _) l) ->
(forall pc instr r, In (pc, instr) l -> instr_defs instr = Some r -> Ple r ctx.(mreg)) ->
(forall pc instr, In (pc, instr) l -> Plt (spc ctx pc) s.(st_nextnode)) ->
Ple (ctx.(dreg) + ctx.(mreg)) s.(st_nextreg) ->
ctx.(mstk) >= 0 -> ctx.(dstk) >= 0 ->
s'.(st_stksize) <= stacksize ->
(forall pc', Ple s.(st_nextnode) pc' -> Plt pc' s'.(st_nextnode) -> c!pc' = s'.(st_code)!pc') ->
(forall pc instr, In (pc, instr) l -> c!(spc ctx pc) = s'.(st_code)!(spc ctx pc)) ->
forall pc instr, In (pc, instr) l -> tr_instr ctx pc instr c.
Lemma expand_cfg_rec_spec:
forall ctx f s x s' i c,
expand_cfg_rec fe rec ctx f s = R x s' i ->
Ple (ctx.(dpc) + max_pc_function f) s.(st_nextnode) ->
ctx.(mreg) = max_reg_function f ->
Ple (ctx.(dreg) + ctx.(mreg)) s.(st_nextreg) ->
ctx.(mstk) >= 0 ->
ctx.(mstk) = Z.max (fn_stacksize f) 0 ->
(min_alignment (fn_stacksize f) | ctx.(dstk)) ->
ctx.(dstk) >= 0 ->
s'.(st_stksize) <= stacksize ->
(forall pc', Ple ctx.(dpc) pc' -> Plt pc' s'.(st_nextnode) -> c!pc' = s'.(st_code)!pc') ->
tr_funbody ctx f c.