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 peephole_optimization_correct : forall A B (ph : peephole_optimization) (H : ph_correct ph),
optimization_correct A B (peephole_optimize_asm ph).