use of suite.lp.sewing.impl.SewingGeneralizerImpl in project suite by stupidsing.
the class Rule method newClause.
public synchronized Node newClause(Node query, Node cut) {
if (sewingGeneralizer == null) {
sewingGeneralizer = new SewingGeneralizerImpl();
headFun = sewingGeneralizer.generalizer(head);
tailFun = sewingGeneralizer.generalizer(tail);
cutIndex = sewingGeneralizer.mapper().computeIndex(ProverConstant.cut);
}
Env env = sewingGeneralizer.mapper().env();
env.refs[cutIndex].bound(cut);
return //
Tree.of(//
TermOp.AND___, //
Tree.of(//
TermOp.EQUAL_, //
query, //
headFun.apply(env)), tailFun.apply(env));
}
use of suite.lp.sewing.impl.SewingGeneralizerImpl in project suite by stupidsing.
the class GeneralizerFactoryTest method test.
private void test(String pattern, String match) {
for (GeneralizerFactory gf : new GeneralizerFactory[] { new CompileGeneralizerImpl(), new SewingGeneralizerImpl() }) {
Generalize_ p = gf.generalizer(Suite.parse(pattern));
assertTrue(Binder.bind(p.apply(gf.mapper().env()), Suite.parse(match), new Trail()));
}
}
Aggregations