public static HereditaryProperty merge2(final HereditaryProperty a, final HereditaryProperty b) {
        return new HereditaryProperty() {
            @Override
            public Collection<Permutation> getBasis() {
                throw new UnsupportedOperationException("Not supported yet.");
            }

            @Override
            public Collection<Permutation> getBasisTo(int n) {
                throw new UnsupportedOperationException("Not supported yet.");
            }

            @Override
            public boolean isSatisfiedBy(Permutation p) {
                return isSatisfiedBy(p.elements);
            }

            @Override
            public boolean isSatisfiedBy(int[] values) {
                int n = values.length;
                if (n > 31) {
                    throw new UnsupportedOperationException("Not supported on sequences of length 32 or greater");
                }
                if (!a.isSatisfiedBy(new int[]{0})) {
                    return b.isSatisfiedBy(values);
                }
                if (!b.isSatisfiedBy(new int[]{0})) {
                    return a.isSatisfiedBy(values);
                }
                HashSet<Integer> thisLevel = new HashSet<Integer>();
                for (int i = 0; i < values.length; i++) {
                    thisLevel.add(1 << i);
                }
                int k = 2;
                while (!thisLevel.isEmpty() && k < values.length) {
                    for(int[] c : new Combinations(values.length, k)) {
                       HashSet<Integer> nextLevel = new HashSet<Integer>();
                       int cCode = testCombination(c, thisLevel);
                       if (cCode > 0) nextLevel.add(cCode);
                    }
                }
                return false;
            }

            private int testCombination(int[] c, HashSet<Integer> thisLevel) {
                int cCode = 0;
                for(int i : c) cCode += (1 << i);
                
                
                return cCode;
            }
        };
    }