# Can First Order Logic identify that two variables are the same object?

Supposed I defined:

$Px$ = $x$ is a person

$Lxy$ = $x$ loves $y$

And I expressed that everyone loves someone:

$$(∀x)(Px \implies (∃y)(Py ∧ Lxy))$$

However I want to formally exclude narcissists who love themselves eg. "everyone loves someone who is not themselves". A trivial way is to define:

$Sxy$ = $x$ is the same way as $y$ (... specifying the truth values as the diagonal of the table...)

Then state:

$$(∀x)(Px \implies (∃y)(Py ∧ \neg Sxy ∧ Lxy))$$

I'm wondering if there is a better way than this to identify shared identity between quantified variables in inner expressions?

• We have already a symbol for "is the same as"; it is $=$... – Mauro ALLEGRANZA Apr 24 '15 at 6:08
• So is it valid in predicate logic to say .... (x = y) when x and y are quantified variables? I am unaware of this. To clarify - we are testing for two variables to be the same object - not for two formulas to have the same truth value. – Brendan Hill Apr 24 '15 at 10:57
• Yes; we can have first order logic with equality, and this is enough for your purpose... – Mauro ALLEGRANZA Apr 24 '15 at 11:04

In first order logic, equality is typically used to denote equality of objects, where equivalence of formulas is typically denoted by two way arrows ($\leftrightarrow$). This is to clarify an apparent misconception in the comments.
So, as was stated in the comments, you could use first order logic with equality. You, however, do not need equality to denote that two objects are the same, at least in the sense that they have identical behaviour. Doing this is different for any given signature, so I will express that $x=y$ in the signature you give. I am using the signature you give without $S$, as it is not necesary to introduce new nonlogical symbols.
$x=y:\;\;\; (z)( (Px\leftrightarrow Py) \wedge (Lxz\leftrightarrow Lyz) \wedge (Lzx\leftrightarrow Lzy) )$
So, you basically just assert that $x$ and $y$ relate to all other elements and to themselves in the exact same way. Thus $x$ and $y$ behave the same, and this has the same consequences as using first order logic with equality, but without adding equality to your list of nonlogical symbols.