I am currently learning about first order logic, and as an exercise was asked to provide free and bound variables in the following formula:
$$(\exists x P(y,y) \implies \exists y P(y,z))$$
I'm currently confused on the following: the term $P(y,y)$ clearly has $y$ as a free variable, while $\exists y P(y,z)$ clearly has it as a bound variable.
From definition, it should be that in the formula above, $y, x$ are both bounded and $z$ is free. However, this does not convey that if I were to do a "change of variables" to $(\exists x P(k, k) \implies \exists y P(y,z))$, then $x, y$ would be bound and $k, z$ would be free, which means that the number of free variables actually changed for formulas that are actually "equivalent" (since both $P(y,y)$ and $P(k,k)$ are referring to a constant, rather than a variable).
I am also having trouble understanding what the full parenthetization of this expression would be: $(\exists x (P(y,y) \implies (\exists y P(y,z))))$ or $((\exists x P(y,y)) \implies (\exists y P(y,z)))$. Both would a priori be valid, and even though it doesn't really change anything in this case (since $x$ is not mentioned within the formula that is being quantified), I'm curious.