Two-Step Subgroup Test using Subset Product

Theorem
Let $G$ be a group.

Let $\varnothing \subset H \subseteq G$ be a non-empty subset of $G$.

Then $H$ is a subgroup of $G$ iff:
 * $H H \subseteq H$
 * $H^{-1} \subseteq H$

Proof
This is a reformulation of the Two-Step Subgroup Test in terms of subset product.

Let $H$ is a subgroup of $G$.

Then $H$ is closed, and Magma Subset Product with Self gives that $H H \subseteq H$.

Also, $g \in H^{-1} \implies \exists h \in H: g = h^{-1} \implies g \in H$, so $H^{-1} \subseteq H$.

Now suppose that:


 * $H H \subseteq H$
 * $H^{-1} \subseteq H$

From the definition of subset product:
 * $\forall x, y \in H: x y \in H$
 * $\forall x \in H^{-1}: x^{-1} \in H$

So by the Two-Step Subgroup Test, $H$ is a subgroup of $G$.