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.

Lemma behavior_improves_trans: forall beh1 beh2 beh3, behavior_improves beh1 beh2 -> behavior_improves beh2 beh3 -> behavior_improves beh1 beh3.