use of nars.op.prolog.PrologCore in project narchy by automenta.
the class PrologCoreTest method testPrologCoreDerivedTransitive2.
@Test
public void testPrologCoreDerivedTransitive2() throws Narsese.NarseseException {
NAR n = NARS.tmp();
PrologCore p = new PrologCore(n);
n.input("a:b.");
n.input("b:c.");
n.input("c:d.");
n.input("d:e.");
n.input("e:f.");
n.run(1);
n.input("a:f?");
// expect true
n.run(1);
n.input("a:?x?");
// expect true
n.run(1);
}
use of nars.op.prolog.PrologCore in project narchy by automenta.
the class PrologCoreTest method testPrologShell.
@Test
public void testPrologShell() throws MalformedGoalException {
NAR n = NARS.tmp();
PrologCore p = new PrologCore(n);
try {
p.input(new Theory(PrologCoreTest.class.getClassLoader().getResource("shell.prolog").openStream()));
} catch (InvalidTheoryException | IOException e) {
e.printStackTrace();
}
p.solve("do(help).");
}
use of nars.op.prolog.PrologCore in project narchy by automenta.
the class PrologCoreTest method testPrologCoreImplToRule.
@Test
public void testPrologCoreImplToRule() throws Narsese.NarseseException {
NAR n = NARS.tmp(1);
n.log();
Param.DEBUG = true;
PrologCore p = new PrologCore(n);
n.input("f(x,y).");
n.input("(f($x,$y)==>g($y,$x)).");
n.run(1);
n.input("g(x,y)?");
n.input("g(y,x)?");
n.run(1);
assertEquals(1f, n.beliefTruth("g(y,x)", ETERNAL).freq());
assertNull(n.beliefTruth("g(x,y)", ETERNAL));
}
Aggregations