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)).
(* concrete optimizations --------------------------------------------------- *)
Definition simple (i:instr) : list instr :=
match i with
| Imov dest (Oreg src) =>
if Nat.eqb dest src then [] else [i]
| _ => [i]
end.

Lemma simple_correct : ph_correct simple.