(** Commutation between [find_label] and compilation *)
Section FIND_LABEL.
Variable lbl: label.
Variable cenv: compilenv.
Variable cs: callstack.

Lemma transl_find_label:
forall s k xenv ts tk,
transl_stmt cenv xenv s = OK ts ->
match_cont k tk cenv xenv cs ->
match Csharpminor.find_label lbl s k with
| None => find_label lbl ts tk = None
| Some(s', k') =>
exists ts', exists tk', exists xenv',
find_label lbl ts tk = Some(ts', tk')
/\ transl_stmt cenv xenv' s' = OK ts'
/\ match_cont k' tk' cenv xenv' cs
end
with transl_lblstmt_find_label:
forall ls xenv body k ts tk tk1,
transl_lblstmt cenv (switch_env ls xenv) ls body = OK ts ->
match_cont k tk cenv xenv cs ->
transl_lblstmt_cont cenv xenv ls tk tk1 ->
find_label lbl body tk1 = None ->
match Csharpminor.find_label_ls lbl ls k with
| None => find_label lbl ts tk = None
| Some(s', k') =>
exists ts', exists tk', exists xenv',
find_label lbl ts tk = Some(ts', tk')
/\ transl_stmt cenv xenv' s' = OK ts'
/\ match_cont k' tk' cenv xenv' cs
end.