I have a question regarding the following proof that shows that every group of prime order is cyclic.
$\textbf{Proof:}$ Let $p$ be prime and $G$ be a group such that $|G|=p$. Then contains more than one element. Let $g\in G$ such that $g\neq 1$. Then $\langle g\rangle$ contains more than one element. Since $\langle g\rangle\leqslant G$, by Lagrange's theorem, $|\langle g\rangle|$ divides $p$. Since $|\langle g\rangle|>1$ and $|\langle g\rangle|$ divides a prime, $|\langle g\rangle|=p=|G|$. Hence, $\langle g\rangle=G$. It follows that $G$ is cyclic.$\blacksquare$
My question is regarding this statement: $|\langle g\rangle|=p=|G|$. Hence, $\langle g\rangle=G$.
Why this statement is true? We can find a lot example different groups with same orders.
$\Bbb Z_4$ and Klein $4$-group have same order but different.
$\langle(123)\rangle\neq \langle(124)\rangle$ in $A_4$ but both are prime order $3$.
Could it be set theory property. Let $A$ and $B$ be two sets such that $|A|=|B|$. If $A\subset B$ then $A=B$.