This is something I have been curious about and hopefully has a simple answer. Often when looking at proofs I will come upon a step that goes along the lines of "define y = ..." and then proceed to use the defined y to show some conclusion. For example in Euclids infinity of primes theorem
he defines " let k be the product of all the prime numbers less than n"
followed by "now let m = k + 1".
and proceeds to reason with these definitions to arrive at the desired results. My question is to what sort of constraints are there to defining new objects to a proof? I am aware of universal generalization rule which requires some restrictions in introducing an arbitrary constant as well well as the other quantifier rules of inference such as existential instantiation and so on. However this whole defining a variable does not seem to be any of these rules.
So at the end of the day can you simply define objects like this all willy nilly like? What sort of justification can you write for such a step? It seems problematic to me because I feel like you need to ensure the existence of such objects before you can introduce them like this, and in particular a step such as " let k be the product of all the prime numbers less than n" seems to define an object that has more meaning than simply a definition given by an equation that defines the object of previously defined terms (like "define m = k + 1").
So this begs the question of whether you can arbitrarily define objects that have unconfirmed properties. This does not seem right because then you could be reasoning with statements that are false but since you "defined" them without restriction you mistakenly inferred something that turns out to be false.
So long story short: what is this method known as formally and what sort of restrictions are associated with it?
It seems to me that you are looking for the $\exists$-Elimiantion rule of Natural Deduction.
See Ian Chiswell & Wilfrid Hodges, Mathematical Logic (2007), page 179 :
Thus, the rule for $\exists$-Elimination is formalized as follows :
In your example, taken from Euclid, Book IX,Prop.20 :
Provided that Euclid defines [Book VII, Def.11] :
and thus we know that there are prime numbers [$1$ is], Euclid makes the assumption :
Let $m$ be the least common multiple of all of them. Consider the number $m + 1$. If it’s prime, then there are at least $n + 1$ primes.
So suppose $m + 1$ is not prime. Then according to VII.31, some prime $g$ divides it. But $g$ cannot be any of the primes $a_1, a_2,\ldots, a_n$, since they all divide $m$ and do not divide $m + 1$. Therefore, there are at least $n + 1$ primes. Q.E.D.
The proof runs as follows :
let $a_1, a_2,\ldots, a_n$ primes; then $\exists x (x = lcm(a_1, a_2,\ldots, a_n))$ : this is $\exists x \phi$
let $k=lcm(a_1, a_2,\ldots, a_n)$ : this is $\phi[k/x]$
let $m=k+1$; clearly $m \ne a_1, a_2,\ldots, a_n$; if $m$ is a prime we are done;
otherwise, there is a prime $g$ which divides $m+1$ and $g \ne a_1, a_2,\ldots, a_n$.
In both case we have that :
The sentence $\chi$ does not contain $k$, and thus the conditions for $\exists$-E are satisfied and the conclusion holds.
Regarding the new example : "There is no largest real [or natural] number", we can "formalize" it as follows.
1) $\forall x(x < x+1)$ -- theorem of number theory
2) $x < x+1$ --- from 1) by $\forall$E
3) $\exists y(x < y)$ --- from 2) by $\exists$I
Thus, as you have noted, we do not need the existential elimination rule.
If you are searching for another example of "real life" use of $\exists$E, consider :
Proof :
1) assume : $a < b$ and : $b < c$ i.e. $\exists d(s(d)+a=b)$ and $(\exists e)(s(e)+b=c)$, where $s(x)$ is the successor function
2) assume for $\exists$E : $s(d)+a=b$ and $s(e)+b=c$
3) $(s(e)+s(d))+a=c$ --- by propety of equality
4) $s((s(e)+d))+a=c$ --- by recursive axiom for $+$ : $n+s(x)=s(n+x)$ and equality
5) $(\exists f)(s(f)+a=c)$ --- by $\exists$I i.e. $a < c$.
The last formula does not contain $d$ nor $e$; thus we can apply $\exists$E twice, discharging the "temporary" assumptions in 2), and we can conclude from 1) with :
Then, by $\to$I twice and tautological equivalence :