Definition behavior_prefix (t: trace) (beh: program_behavior) : Prop :=
exists beh', beh = behavior_app t beh'.
Definition behavior_improves (beh1 beh2: program_behavior) : Prop :=
beh1 = beh2 \/ exists t, beh1 = Goes_wrong t /\ behavior_prefix t beh2.

(* Specifications: *)
Lemma behavior_improves_refl:
forall beh, behavior_improves beh beh.
Lemma behavior_improves_trans:
forall beh1 beh2 beh3,
behavior_improves beh1 beh2 -> behavior_improves beh2 beh3 ->
behavior_improves beh1 beh3.
Lemma behavior_improves_bot:
forall beh, behavior_improves (Goes_wrong E0) beh.
Lemma behavior_improves_app:
forall t beh1 beh2,
behavior_improves beh1 beh2 ->
behavior_improves (behavior_app t beh1) (behavior_app t beh2).