Section Update2.
Variables A B : Type.
Hypothesis A_eq_dec : forall x y : A, {x = y} + {x <> y}.
Proof using.
unfold update2.
intros.
break_if; intuition congruence.
Qed.
Proof using.
unfold update2.
intros.
break_if; intuition congruence.
Qed.
Proof using.
unfold update2.
intros.
break_if; intuition congruence.
Qed.
Proof using.
unfold update2.
intros. break_if; intuition congruence.
Qed.
Proof using.
intros. subst.
unfold update2.
break_if; intuition congruence.
Qed.
Proof using.
intros. subst.
unfold update2.
break_if; intuition congruence.
Qed.
Proof using.
intros.
rewrite update2_eq; auto.
Qed.
Proof using.
intros.
do 2 (apply functional_extensionality; intros).
apply update2_nop.
Qed.
Proof using.
intros.
subst.
apply update2_nop_ext.
Qed.
Proof using.
intros.
do 2 (apply functional_extensionality; intros).
destruct (A_eq_dec x x0);
destruct (A_eq_dec y x1).
- repeat rewrite update2_eq; auto.
- repeat rewrite update2_diff2; auto.
- repeat rewrite update2_diff1; auto.
- repeat rewrite update2_diff1; auto.
Qed.
End Update2.

Lemma update2_fun_comm :
forall A B C A_eq_dec (f : B -> C) (st : A -> A -> B) x y v x' y',
f (update2 A_eq_dec st x y v x' y') = update2 A_eq_dec (fun x y => f (st x y)) x y (f v) x' y'.