Definition trace_state_correct (trace : list (input * output)) (st : data) (st' : data) :=
  forall k,
    fst (interpret k (rev (inputs_with_key trace k)) (Map.find k st)) = Map.find k st'.Ltac vard_unfold :=
  unfold runHandler,
  getk,
  setk,
  delk,
  resp in *; monad_unfold.

Lemma trace_state_correct_trace_correct : forall st st' st'' trace t, trace_state_correct trace st st' -> trace_correct' st trace -> step_1 st' st'' t -> trace_correct' st (trace ++ t).