I want to be able to prove that for all functions f, that $a = b \to f(a) = f(b)$. That this is true is obvious, but I'm not sure how to formally prove it using only the rules of inference in first-order logic (using natural deduction). I'm guessing I need to reference a formal definition for a function, where $f \subset A \times B$ and satisfies:
$$ (\forall x \in A)(\exists y \in B)((x,y) \in f \wedge (\forall z \in B)((x,z) \in f\to y=z))$$
However, I don't have any clue where to begin with this. Can anyone help? Please only give hints/answers using natural deduction as the deductive system.
To prove it in set theory, we need some definitions and some basic results :
equality between (Kuratowski) pairs :
definition of domain of a relation:
We cannot prove the formula in your question as is, due to the fact that not all functions are total.
We have to rewrite it as :
We need also to formalize the abbreviation $f(x)$; form the definition of function we have:
Thus, we are licensed to write :
Now for the proof :
1) $a \in \mathcal D f$ --- assumed [a]
2) $a=b$ --- assumed [b]
3) $\langle a, f(a) \rangle \in f$ --- from 1) and abbreviation
4) $\langle b, f(b) \rangle \in f$ --- from 2) and 3)
5) $\langle a, f(b) \rangle \in f$ --- from 2) and 4).
Note : the above steps are substitutions of terms into formulae. The formula is : $\{ a, \{a, f(a) \} \} \in f$ and we use the equality axiom :
Form the definition of function, by instantiation (or : $\forall$-elim) :
6) $\langle a,f(a) \rangle \in f \land \langle a,f(b) \rangle \in f \to f(a) = f(b)$.
7) $f(a) = f(b)$ --- from 6), 3) and 5) by modus ponens twice.
Thus, discharging assumptions [a] and [b] by Deduction Th (or : $\to$-intro) :
The conclusion (for every $a$ ...) follows by generalization (or : $\forall$-intro).