Find the intersection of the power set and a list of sets
<p>Given a large arbitrary set S, and a list of sets S_n, find all of the sets in S_n that are subsets of S.</p>

<p>In other words, the intersection of the PowerSet(S) and S_n.</p>

<p>Are there any Java libraries to do this kind of math quickly?  The list of sets S_n will be relatively small, at most a few hundred, and those sets will contain at most 10 items. However, the arbitrary sets (determined at runtime) may have as many as 20 items (out of a set of 1000) and thus has a huge power set.</p>

<p>I'm looking for a way, perhaps doing some type of offline computation, to do this determination on the fly very quickly (50 ms or less).</p>

<p>Example:
S = { 1, 2, 3 }</p>

<p>S_n = [ { 1 }, { 1, 2 }, { 5, 4, 6 } ]</p>

<p>Result = [ { 1 }, { 1, 2 } ]</p>
