public bool TestConflict(Substitution subs, SubstitutionSet set, out bool canAdd) { canAdd = true; Constraint c; if (!m_constraints.TryGetValue(subs.Variable, out c)) { return(false); } Name G1 = c.Value; Name G2; if (subs.SubValue.Value.IsVariable) { if (c.EquivalentVariables.Contains(subs.SubValue.Value)) { canAdd = false; return(false); } Constraint c2; if (!m_constraints.TryGetValue(subs.SubValue.Value, out c2)) { return(false); } if (c.Value == null || c2.Value == null) { return(false); } G2 = c2.Value; } else { if (G1 == null) { return(false); } canAdd = false; G2 = subs.SubValue.Value; return(!G1.Equals(G2)); //Conflict!!! } G1 = G1.MakeGround(set); G2 = G2.MakeGround(set); return(!G1.Equals(G2)); //Conflict!!! }