/*
         * The method Skolemize performs best-effort skolemization of the input expression expr.
         * If polarity == Polarity.Negative, a quantifier F embedded in expr is skolemized
         * provided it can be proved that F is a forall quantifier in the NNF version of expr.
         * If polarity == Polarity.Positive, a quantifier F embedded in expr is skolemized
         * provided it can be proved that F is an exists quantifier in the NNF version of expr.
         *
         * Factorization is performed on the resulting expression.
         */
        public static VCExpr Skolemize(QuantifierInstantiationEngine qiEngine, Polarity polarity, VCExpr vcExpr)
        {
            var skolemizer     = new Skolemizer(qiEngine, polarity, vcExpr);
            var skolemizedExpr = skolemizer.Mutate(vcExpr, true);

            return(Factorizer.Factorize(qiEngine, QuantifierCollector.Flip(polarity), skolemizedExpr));
        }
        public static HashSet <VCExprQuantifier> CollectQuantifiers(VCExpr vcExpr, Polarity polarity)
        {
            var visitor = new QuantifierCollector();

            visitor.Traverse(vcExpr, polarity);
            return(visitor.quantifiers);
        }
 private Factorizer(QuantifierInstantiationEngine qiEngine, Polarity polarity, VCExpr vcExpr) : base(qiEngine.vcExprGen)
 {
     this.qiEngine    = qiEngine;
     this.quantifiers = QuantifierCollector.CollectQuantifiers(vcExpr, polarity);
 }
 private Skolemizer(QuantifierInstantiationEngine qiEngine, Polarity polarity, VCExpr vcExpr) : base(qiEngine.vcExprGen)
 {
     this.qiEngine    = qiEngine;
     this.quantifiers = QuantifierCollector.CollectQuantifiers(vcExpr, polarity);
     this.bound       = new Dictionary <VCExprVar, VCExpr>();
 }