Definition get m k := option_map (fun i => snd (Znth i m (0, 0))) (index_of m k).Definition value_of e :=
  match e with
  | Load v => v
  | Store v => v
  | CAS r c w => if eq_dec r c then w else r
  end.Definition ordered_hist h := forall i j (Hi : 0 <= i < j) (Hj : j < Zlength h),
  (fst (Znth i h (O, Store (vint 0))) < fst (Znth j h (O, Store (vint 0))))%nat.

(* Specifications: *)
Lemma ordered_cons : forall t e h, ordered_hist ((t, e) :: h) -> Forall (fun x => let '(m, _) := x in t < m)%nat h /\ ordered_hist h.
Lemma ordered_last : forall t e h (Hordered : ordered_hist h) (Hin : In (t, e) h) (Ht : Forall (fun x => let '(m, _) := x in m <= t)%nat h), last h (O, Store (vint 0)) = (t, e).