////////////////////////////////////////////////////////////////////////////////// public static bool tryUnify(Variable lv1, FunctionApplicationFormula fa2, Substitution s) { Debug.Assert(lv1.type.isEquivalent(fa2.type)); Debug.Assert(!s.hasMap(lv1.variable)); if (fa2.freeVariables.Contains(lv1.variable)) //occurrence check { return(false); } s.composeWith(new Substitution(lv1.variable, fa2)); return(true); }
internal static string polish(FunctionApplicationFormula fa, IDictionary <string, string> vm) { var result = polish(fa.function); if (fa.args.Count() > 0) { result = "(" + result; foreach (var a in fa.args) { result += " " + polish(a, vm); } result += ")"; } return(result); }
////////////////////////////////////////////////////////////////////////////////// public static bool tryUnify(FunctionApplicationFormula fa1, FunctionApplicationFormula fa2, Substitution s) { Debug.Assert(fa1.type.isEquivalent(fa2.type)); if (fa1.function != fa2.function) { return(false); } var i = 0; while (i < fa1.subTerms.Count()) { if (tryUnify(fa1.subTerms[i], fa2.subTerms[i], s)) { i++; } else { return(false); } } return(true); }
protected void makeOriginalTerm(FunctionApplicationFormula fa, IDictionary <FunctionApplicationFormula, GTI> termMap) { #region precondition #if DEBUG Debug.Assert(universe.inScope(fa.function)); foreach (var arg in fa.args) { var afa = arg.asFunctionApplication; Debug.Assert(termMap.ContainsKey(afa)); } #endif #endregion precondition var gttGTIs = (from tt in fa.args select termMap[tt.asFunctionApplication]).ToArray(); var gttd = makeGTT(gttGTIs); var gtti = gttd.gtti; var f = fa.function; var gtd = mapGFA(f, gttd); var gti = gtd.gti; setGoalGTI(gtd.gti); setOriginalGTI(gti); termMap[fa] = gti; Debug.Assert(getGTD(gti).depth == originalDepth); }
public ITerm visit(FunctionApplicationFormula t) { return(t); }