Definition update {A B : Type} (A_eq_dec : forall x y : A, {x = y} + {x <> y}) st h (v : B) := 
  fun nm => if A_eq_dec nm h then v else st nm.

(* Specifications: *)
Lemma update_diff : forall (sigma : A -> B) x v y, x <> y -> update A_eq_dec sigma x v y = sigma y.
Lemma update_nop : forall (sigma : A -> B) x y, update A_eq_dec sigma x (sigma x) y = sigma y.
Lemma update_eq : forall (sigma : A -> B) x y v, x = y -> update A_eq_dec sigma x v y = v.
Lemma update_same : forall (sigma : A -> B) x v, update A_eq_dec sigma x v x = v.
Lemma update_nop_ext : forall (sigma : A -> B) h, update A_eq_dec sigma h (sigma h) = sigma.
Lemma update_nop_ext' : forall (sigma : A -> B) y v, sigma y = v -> update A_eq_dec sigma y v = sigma.
Lemma update_overwrite : forall (sigma : A -> B) h st st', update A_eq_dec (update A_eq_dec sigma h st) h st' = update A_eq_dec sigma h st'.
Lemma update_fun_comm : forall A B C A_eq_dec (f : B -> C) (st : A -> B) y v x, f (update A_eq_dec st y v x) = update A_eq_dec (fun x => f (st x)) y (f v) x.