Esempio n. 1
0
        public CNF2State(PredicateApplication pa, bool p)
            : this(new[] { new Clause(pa, p) }, new Clause[0])
        {
            Debug.Assert(!pa.isTrue);
//            var nc = new Clause(pa, p);
//            pClauses[nc.ToString()] = nc;
        }
Esempio n. 2
0
 public Clause(PredicateApplication f, bool p)
     : this(
         p ? new[] { f } : new PredicateApplication[0],
         !p ? new[] { f } : new PredicateApplication[0],
         new EqualityFormula[0],
         new EqualityFormula[0]
         )
 {
 }
Esempio n. 3
0
 public PAInstance(Clause clause, int position)
 {
     Debug.Assert(position < clause.literals.Count);
     Debug.Assert(clause.literals[position].f is PredicateApplication);
     this.clause   = clause;
     this.position = position;
     pa            = clause.literals[position].f as PredicateApplication;
     polarity      = clause.literals[position].polarity;
 }
        public TypePredicateInstance(Clause clause, int atomIndex, int termIndex)
        {
            Debug.Assert(atomIndex >= 0 && atomIndex < clause.literals.Count);
            var atom = clause.literals[atomIndex];
            var pa   = atom.f as PredicateApplication;

            Debug.Assert(pa != null);
            Debug.Assert(termIndex >= 0 && termIndex < pa.args.Count());
            this.clause          = clause;
            this.atomIndex       = atomIndex;
            this.termIndex       = termIndex;
            predicateApplication = pa;
            term = pa.args[termIndex];
        }
Esempio n. 5
0
        internal static string polish(PredicateApplication f, IDictionary <string, string> vm)
        {
            var result = polish(f.predicate);

            if (f.args.Count() > 0)
            {
                result = "(" + result;
                foreach (var a in f.args)
                {
                    result += " " + polish(a, vm);
                }
                result += ")";
            }
            return(result);
        }
Esempio n. 6
0
 //////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////
 private static bool tryUnify(PredicateApplication pa1, PredicateApplication pa2, Substitution s)
 {
     if (pa1.predicate != pa2.predicate)
     {
         return(false);
     }
     Debug.Assert(pa1.args.Count() == pa2.args.Count());
     for (var i = 0; i < pa1.args.Count(); i++)
     {
         if (!tryUnify(pa1.args[i], pa2.args[i], s))
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 7
0
        private HashSet <PAInstance> getSet(PredicateApplication pa, bool polarity)
        {
            HashSet <PAInstance> list;

            if (pa.ffreeVariables.Count == 0)
            {
                list = polarity ? pgPAInstances : ngPAInstances;
            }
            else if (polarity)
            {
                list = pnPAInstances;
            }
            else
            {
                list = nnPAInstances;
            }
            return(list);
        }
Esempio n. 8
0
 public IFormula visit(PredicateApplication f)
 {
     return(f);
 }
Esempio n. 9
0
 public IFormula visit(PredicateApplication f)
 {
     return(new Not(f));
 }