Can a neural network learn "a == b" and "a != b" relationship, with limited data? For example, I have the following feature set:
{a:1, b:1} -> 1
{a:2, b:2} -> 1
{a:3, b:3} -> 1

{a:1, b:2} -> 0
{a:4, b:6} -> 0
{a:3, b:5} -> 0

And some more data points.
I don't give features like a == b or a != b.
Can a neutral network get the following logic?
(a == b)  ->  1
(a != b)  ->  0

Assume I give inputs like
{a:123, b:123}
{a:666, b:668}

The model never sees inputs such as 123 or 666 before.

You function can be represented as:
$$f(x,y) = \lim_{n\to+\infty}(\sigma(1/|x-y|))^n$$
A good approximation can be obtained with a large $n$.
A neural network can approximate further that function. In fact, depending on what you consider a neural network to be, the function itself is already a neural network with special activation functions.
