public ArrayList<Expression> GenIfExp (int size) {
        ArrayList<Expression> expset = new ArrayList<Expression>();
        int max_branch_size = 6;
        for (int i = 1; i <= max_branch_size; i++) {
            for (int j = 1; j <= Math.min(size - 2 - i, max_branch_size); j++) {
                int k = size - 1 - i - j;
                for (Expression exp1 : GenExp(false, i)) {
                    if (exp1.hasX) {
                        for (Expression exp2 : GenExp(false, j)) {
                            for (Expression exp3 : GenExp(false, k)) {
                                if (exp2 != exp3) {
                                    expset.add(if0(exp1, exp2, exp3));
                                }
                            }
                        }
                    }
                }
            }
        }
        return expset;
    }