(** * Relational specification of compilation *)

Definition match_if {A: Type} (flag: unit -> bool) (R: A -> A -> Prop): A -> A -> Prop :=
  if flag tt then R else eq.

Lemma partial_if_match: forall (A: Type) (flag: unit -> bool) (f: A -> res A) (rel: A -> A -> Prop) (prog tprog: A), (forall p tp, f p = OK tp -> rel p tp) -> partial_if flag f prog = OK tprog -> match_if flag rel prog tprog.