Defining a function without using Axiom of Choice I have a situation where I do not know if I need the axiom of choice:
Let $\mathcal{B}(\mathbb{R})$ be the collection of Borel measurable subsets of $\mathbb{R}$.
I have a (possibly non-Borel) subset $M \subseteq \mathbb{R}$
and a probability measure $P:\mathcal{B}(\mathbb{R})\rightarrow[0,1]$ with the property:
$$ P(A)=P(B) \quad \forall A, B \in \mathcal{B}(\mathbb{R}) \mbox{ such that $M\cap A = M\cap B$}  \quad (Eq. 1)$$
So I can group all sets in $\mathcal{B}(\mathbb{R})$ into equivalence
classes where $A$ and $B$ are equivalent if $M\cap A = M \cap B$. I want to condense $P$  to a function $g$ on equivalence classes.  Specifically, define
$$V = \{M\cap A: A \in \mathcal{B}(\mathbb{R})\}$$
Define $g:V\rightarrow[0,1]$ as follows:  For each $D \in V$, I can choose an $A \in \mathbb{B}(\mathbb{R})$ such that $M \cap A = D$, then I can define $g(D)=P(A)$. Formally, using the axiom of
choice, there is a choice function $c:V\rightarrow \mathcal{B}(\mathbb{R})$ such that $$c(D)\in \{A\in \mathcal{B}(\mathbb{R}):M\cap A=D\} \quad \forall D \in V$$
Then I define $g(D)=P(c(D))$. Notice by (Eq. 1) that this leads to the
same $g$ function regardless of my choice function $c(D)$.  In particular:
$$g(M\cap A) = P(A) \quad \forall A \in \mathcal{B}(\mathbb{R}) \quad (Eq. 2)$$
Question: Do I really need to use the Axiom of Choice when defining this g function?
I think that, due to (Eq. 2), I do not formally need the axiom of choice here. Perhaps I can simply define objects $(A,P[A])$ for all $A \in \mathcal{B}(\mathbb{R})$ and then simply "say" that I condense these objects according to equivalence classes, so that my function $g$ somehow emerges. However, it is often hard to know if I am inadvertently using the axiom of choice.

Edit: I guess I could just define the set $\{(M\cap A, P[A]) : A \in \mathcal{B}(\mathbb{R})\}$ and $g$ emerges...?
 A: You do not need the axiom of choice at all.
In general, suppose you have a set $S$ and an equivalence relation $\sim$ on $S$. Consider the canonical projection map $\pi : S \to S / {\sim}$. The only relevant property of this situation is: $$\forall y \in (S / {\sim}) \,\exists x \in S\,(\pi(x) = y \land \forall w \in S (\pi(w) = y \to w \sim x)).$$
Now suppose you have some function $f : S \to R$ such that for all $x, y \in S$, if $x \sim y$ then $f(x) = f(y)$. Then there exists a unique function $f’ : (S / {\sim}) \to R$ such that $f’ \circ \pi = f$.
To produce such an $f’$, we define the corresponding set of pairs $f’ = \{(\pi(x), f(x)) \mid x \in S\} \subseteq (S / {\sim}) \times R$. It’s easy to prove that $\forall x \in (S / {\sim})\,\exists! y \in R\, ((x, y) \in f’)$, so $f’$ does indeed give us the function we need. Uniqueness is equally straightforward.
This result is exactly what you require here, and it requires no choice whatsoever (though unless you take a non-standard approach, you will need at least countable choice to make the Borel $\sigma$-algebra work, since without countable choice, we can have $\mathbb{R}$ being a countable union of countable sets). In category-theoretic terms, the fact that quotients exist and have this property amounts to stating that the category of sets is exact (in the sense of Barr).
A: Contradicting my comment above, I think it is indeed possible to define $g$ without the axiom of choice, but using the
axiom of specification
(https://en.wikipedia.org/wiki/Axiom_schema_of_specification)
instead.
Consider the formula
$$
  \forall X \in V, \ \exists! \lambda \in  \mathbb R, \ \underbrace{\forall A \in \mathcal B(\mathbb R), \ (M\cap A= X \Rightarrow
P(A)=\lambda )}_{\textstyle \varphi (X, \lambda )}
  $$
Then the axiom os specification guarantees the existence of a function $g$ such that, for every $X$ in $V$, one has that
$\varphi (X, g(X))$, so $g(X)$ is what we expect it to be.
