private IQTree liftBindingFromLiftedChildren(ImmutableList<IQTree> liftedChildren, VariableGenerator variableGenerator,
                                                 IQProperties currentIQProperties) {

        /*
         * Cannot lift anything if some children do not have a construction node
         */
        if (liftedChildren.stream()
                .anyMatch(c -> !(c.getRootNode() instanceof ConstructionNode)))
            return iqFactory.createNaryIQTree(this, liftedChildren, currentIQProperties.declareLifted());

        ImmutableSubstitution<ImmutableTerm> mergedSubstitution = mergeChildSubstitutions(
                    projectedVariables,
                    liftedChildren.stream()
                            .map(c -> (ConstructionNode) c.getRootNode())
                            .map(ConstructionNode::getSubstitution)
                            .collect(ImmutableCollectors.toList()),
                    variableGenerator);

        if (mergedSubstitution.isEmpty()) {
            return iqFactory.createNaryIQTree(this, liftedChildren, currentIQProperties.declareLifted());
        }
        ConstructionNode newRootNode = iqFactory.createConstructionNode(projectedVariables, mergedSubstitution);

        ImmutableSet<Variable> unionVariables = newRootNode.getChildVariables();
        UnionNode newUnionNode = iqFactory.createUnionNode(unionVariables);

        NaryIQTree unionIQ = iqFactory.createNaryIQTree(newUnionNode,
                liftedChildren.stream()
                        .map(c -> (UnaryIQTree) c)
                        .map(c -> updateChild(c, mergedSubstitution, unionVariables))
                        .collect(ImmutableCollectors.toList()));

        return iqFactory.createUnaryIQTree(newRootNode, unionIQ);
    }
private IQTree liftBindingFromLiftedChildren ( ImmutableList < IQTree > liftedChildren , VariableGenerator variableGenerator , IQProperties currentIQProperties ) { if ( liftedChildren . stream ( ) . anyMatch ( c -> ! ( c . getRootNode ( ) instanceof ConstructionNode ) ) ) return iqFactory . createNaryIQTree ( this , liftedChildren , currentIQProperties . declareLifted ( ) ) ; ImmutableSubstitution < ImmutableTerm > mergedSubstitution = mergeChildSubstitutions ( projectedVariables , liftedChildren . stream ( ) . map ( c -> ( ConstructionNode ) c . getRootNode ( ) ) . map ( ConstructionNode :: getSubstitution ) . collect ( ImmutableCollectors . toList ( ) ) , variableGenerator ) ; if ( mergedSubstitution . isEmpty ( ) ) { return iqFactory . createNaryIQTree ( this , liftedChildren , currentIQProperties . declareLifted ( ) ) ; } ConstructionNode newRootNode = iqFactory . createConstructionNode ( projectedVariables , mergedSubstitution ) ; ImmutableSet < Variable > unionVariables = newRootNode . getChildVariables ( ) ; UnionNode newUnionNode = iqFactory . createUnionNode ( unionVariables ) ; NaryIQTree unionIQ = iqFactory . createNaryIQTree ( newUnionNode , liftedChildren . stream ( ) . map ( c -> ( UnaryIQTree ) c ) . map ( c -> updateChild ( c , mergedSubstitution , unionVariables ) ) . collect ( ImmutableCollectors . toList ( ) ) ) ; return iqFactory . createUnaryIQTree ( newRootNode , unionIQ ) ; }
Has at least two children