Section Correctness.
(** A peephole optimizer is correct if it replaces an instruction with a semantically equivalent sequence of instructions. *)
Definition ph_correct (ph : peephole_optimization) :=
forall (i:instr),
@eq_asm_denotations_EQ Exit unit _ (fun _ => denote_instr i) (fun _ => denote_list (ph i)).

Lemma ph_blk_append_correct : forall (ph : peephole_optimization) (H : ph_correct ph)
lbl1 lbl2 b1 b2 i,
(@eq_asm_denotations_EQ Exit (fin lbl1) (fin lbl2) (fun _ => denote_bk b1) (fun _ => denote_bk b2)) ->
(@eq_asm_denotations_EQ Exit (fin lbl1) (fin lbl2)
(fun _ => denote_instr i ;; denote_bk b1)
(fun _ => denote_bk (blk_append (ph i) b2))).