Generating set-cum-membership test-based black-box group algorithm for normality testing

Idea and outline
For each $$a \in A$$ and $$b \in B$$, check that $$aba^{-1} \in H$$ and $$a^{-1}ba \in H$$.

Note that when $$G$$ is finite, it suffices to check that for each $$a \in A$$ and $$b \in B$$, $$aba^{-1} \in H$$.