public TypeEqualityInstance(Clause clause, int atomIndex)
 {
     Debug.Assert(atomIndex >= 0 && atomIndex < clause.literals.Count);
     this.clause    = clause;
     this.atomIndex = atomIndex;
     equality       = clause.literals[atomIndex].f as EqualityFormula;
 }
Example #2
0
 public CNF2State(EqualityFormula eq, bool p)
 {
     if (!eq.isTrue)
     {
         var nc = new Clause(eq, p);
         pClauses[nc.ToString()] = nc;
     }
 }
Example #3
0
 public IFormula visit(EqualityFormula f)
 {
     if (f.t1.Equals(f.t2))
     {
         return(new True());
     }
     return(f);
 }
Example #4
0
 public Clause(EqualityFormula f, bool p)
     : this(
         new PredicateApplication[0],
         new PredicateApplication[0],
         p ? new[] { f } : new EqualityFormula[0],
         !p ? new[] { f } : new EqualityFormula[0]
         )
 {
 }
Example #5
0
 //////////////////////////////////////////////////////////////////////////////////////////
 private static bool tryUnify(EqualityFormula eq1, EqualityFormula eq2, Substitution s)
 {
     Debug.Assert(eq1.t1.type.isEquivalent(eq2.t1.type));
     //record substitution as has to check both ways
     s.push();
     if (tryUnify(eq1.t1, eq2.t1, s) && tryUnify(eq1.t2, eq2.t2, s))
     {
         return(true);
     }
     s.pop();
     return(tryUnify(eq1.t1, eq2.t2, s) && tryUnify(eq1.t2, eq2.t1, s));
 }
Example #6
0
 public IFormula visit(EqualityFormula f)
 {
     return(f);
 }
Example #7
0
 public IFormula visit(EqualityFormula f)
 {
     return(new Not(f));
 }
Example #8
0
 internal static string polish(EqualityFormula f, IDictionary <string, string> vm)
 {
     return("(= " + polish(f.t1, vm) + " " + polish(f.t2, vm) + ")");
 }