internal override void AddFact( BoolExpr <DomainConstraint <BoolLiteral, Constant> > fact) { base.AddFact(fact); this._kbSize += fact.CountTerms(); if (this._implications == null) { return; } this.CacheFact(fact); }
internal bool IsSatisfiable( BoolExpr <DomainConstraint <BoolLiteral, Constant> > expression) { ConversionContext <DomainConstraint <BoolLiteral, Constant> > conversionContext = IdentifierService <DomainConstraint <BoolLiteral, Constant> > .Instance.CreateConversionContext(); Converter <DomainConstraint <BoolLiteral, Constant> > converter = new Converter <DomainConstraint <BoolLiteral, Constant> >(expression, conversionContext); if (converter.Vertex.IsZero()) { return(false); } if (this.KbExpression.ExprType == ExprType.True) { return(true); } int num = expression.CountTerms() + this._kbSize; BoolExpr <DomainConstraint <BoolLiteral, Constant> > expr1 = converter.Dnf.Expr; BoolExpr <DomainConstraint <BoolLiteral, Constant> > boolExpr = this._chase.Chase(FragmentQueryKBChaseSupport.Normalizer.ToNnfAndSplitRange(FragmentQueryKBChaseSupport.Normalizer.EstimateNnfAndSplitTermCount(expr1) > FragmentQueryKBChaseSupport.Normalizer.EstimateNnfAndSplitTermCount(expression) ? expression : expr1)); BoolExpr <DomainConstraint <BoolLiteral, Constant> > expr2; if (boolExpr.CountTerms() + this.ResidueSize > num) { expr2 = (BoolExpr <DomainConstraint <BoolLiteral, Constant> >) new AndExpr <DomainConstraint <BoolLiteral, Constant> >(new BoolExpr <DomainConstraint <BoolLiteral, Constant> >[2] { this.KbExpression, expression }); } else { expr2 = (BoolExpr <DomainConstraint <BoolLiteral, Constant> >) new AndExpr <DomainConstraint <BoolLiteral, Constant> >((IEnumerable <BoolExpr <DomainConstraint <BoolLiteral, Constant> > >) new List <BoolExpr <DomainConstraint <BoolLiteral, Constant> > >(this.ResidueInternal) { boolExpr }); conversionContext = IdentifierService <DomainConstraint <BoolLiteral, Constant> > .Instance.CreateConversionContext(); } return(!new Converter <DomainConstraint <BoolLiteral, Constant> >(expr2, conversionContext).Vertex.IsZero()); }