Definition t_lookup (m : total_map) x := 
  let (m, d) := m in
  match lookup m x with
  | Some v => v
  | None => d
  end.

(* Specifications: *)
Lemma t_update_eq : forall (m: total_map) x v, t_lookup (t_update m x v) x = v.
Theorem t_update_neq : forall v x1 x2 (m : total_map), x1 <> x2 -> t_lookup (t_update m x1 v) x2 = t_lookup m x2.
Lemma t_update_shadow : forall (m: total_map) v1 v2 x, t_update (t_update m x v1) x v2 = t_update m x v2.
Lemma beq_idP : forall x y, reflect (x = y) (beq_id x y).
Theorem t_update_same : forall x (m : total_map), t_update m x (t_lookup m x) = m.
Theorem t_update_permute : forall v1 v2 x1 x2 (m : total_map), x2 <> x1 -> (t_update (t_update m x2 v2) x1 v1) = (t_update (t_update m x1 v1) x2 v2).