Definition data :=
  Map.t string.Definition beq_key (k1 k2 : key) :=
  if string_dec k1 k2 then true else false.Definition setk k v : GenHandler1 data unit := modify (fun db => Map.add k v db).Definition delk k : GenHandler1 data unit := modify (fun db => Map.remove k db).Definition resp k v old : GenHandler1 data output :=
  write_output (Response k v old).Definition runHandler (h : input -> GenHandler1 data output)
           (inp : input) (d : data) : output * data :=
  runGenHandler1 d (h inp).Definition VarDHandler := runHandler VarDHandler'.Definition init_map := Map.empty string.Instance vard_base_params : BaseParams :=
  {
    data := data ;
    input := input ;
    output := output
  }.Instance vard_one_node_params : OneNodeParams _ :=
  {
    init := init_map ;
    handler := VarDHandler
  }.Definition input_key (i : input) : key :=
  match i with
    | Get k => k
    | Put k _ => k
    | Del k => k
    | CAS k _ _ => k
    | CAD k _ => k
  end.Definition operate (op : input) (curr : option value) :=
  match op with
    | Get _ => (curr, curr)
    | Put _ v => (Some v, curr)
    | Del _ => (None, curr)
    | CAS _ v v' => if val_eq_dec curr v then (Some v', curr) else (curr, curr)
    | CAD _ v => if val_eq_dec curr (Some v) then (None, curr) else (curr, curr)
  end.Definition inputs_with_key (trace : list (input * output)) (k : key) : list input :=
  filterMap (fun ev => if key_eq_dec k (input_key (fst ev)) then
                            Some (fst ev)
                          else
                            None)
            trace.

(* Specifications: *)
Lemma trace_correct'_trace_correct : forall trace, trace_correct' init trace -> trace_correct trace.