Let $S_n$ be the set of all permutations that act on $1...n$. You are given a subset $P\subseteq S_n$, and you are to compute the size of the set $G(P) \subseteq S_n$, where $G(P)$ meets the following requirements:
- $G(P)$ contains the identity permutation,
- $P \subseteq G(P)$,
- $G(P)$ is closed under taking inverses and multiplications (if $a, b \in G(P)$, then $ab \in G(P)$, if $a \in G(P)$, then $a^{-1} \in G(P)$),
- $G(P)$ is a minimal possible set that meets requirements 1,2 and 3.
Is there a method or algorithm that can solve this?