Section update.
Variables A B : Type.
Hypothesis A_eq_dec : forall x y : A, {x = y} + {x <> y}.
Proof using.
unfold update.
intros.
break_if; congruence.
Qed.
Proof using.
unfold update.
intros. break_if; congruence.
Qed.
Proof using.
intros. subst.
unfold update.
break_if; congruence.
Qed.
Proof using.
intros.
rewrite update_eq; auto.
Qed.
Proof using.
intros.
apply functional_extensionality.
intros.
apply update_nop.
Qed.
Proof using.
intros.
subst.
apply update_nop_ext.
Qed.
Proof using.
intros.
apply functional_extensionality.
intros. destruct (A_eq_dec h x).
- repeat rewrite update_eq; auto.
- repeat rewrite update_diff; auto.
Qed.
End update.

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.