In Principles of Mathematical Analysis, trying to prove that $\sqrt{2}$ is irrational, we can read:
Let $A$ be the set of all positive rationals $p$ such that $p^2<2$ and let B consist of all positive rationals $p$ such that $p^2>2$. We shall show that A contains no largest number and B contains no smallest.
I don't understand what this is proving. If I replace $p^2<2$ with $p^2<4$, I can prove that A contains no largest number as well. Surely, this does not prove that $\sqrt{4}$ is irrational.
What am I missing? Is this an erratum and we should read $p^2\leq 2$ instead of $p^2<2$?
The first part of the argument proves that $p^2=2$ is impossible but you have failed to prove that $p^2=4$ is impossible. Arguments build on previous statements so you can't evaluate a claim in isolation without considering the previous results.
In the section you reference they are trying to demonstrate that the rationals have gaps because $A$ has no greatest element, $B$ has no least element and we already know that $\sqrt{2}$ is irrational. This is meant to motivate the construction of the real numbers using Dedekind cuts.