use of nars.op.prolog.PrologCore in project narchy by automenta.
the class PrologCoreTest method testPrologCoreDerivedTransitive.
@Test
public void testPrologCoreDerivedTransitive() throws Narsese.NarseseException {
NAR n = NARS.tmp();
PrologCore p = new PrologCore(n);
n.input("a:b.");
n.input("b:c.");
n.run(1);
n.input("a:c?");
// expect true
n.run(1);
n.input("a:d?");
// expect false
n.run(1);
}
use of nars.op.prolog.PrologCore in project narchy by automenta.
the class PrologCoreTest method testPrologCoreQuestionTruthAnswer.
@Test
public void testPrologCoreQuestionTruthAnswer() throws Narsese.NarseseException {
NAR n = NARS.tmp();
PrologCore p = new PrologCore(n);
n.input("a:b.");
n.input("a:c.");
n.input("(--, c:d).");
n.run(1);
n.input("a:b?");
// expect true
n.run(1);
n.input("c:d?");
// expect false
n.run(1);
n.input("a:?x?");
// expect true with 2 answers
n.run(1);
}
use of nars.op.prolog.PrologCore in project narchy by automenta.
the class PrologCoreTest method testConjunction3.
@Test
public void testConjunction3() throws Narsese.NarseseException {
NAR n = NARS.tmp();
PrologCore p = new PrologCore(n);
n.input("(&&,a,b,c).");
n.run(1);
assertTrue(p.isTrue("'&&'(a,b,c)."));
assertTrue(p.isTrue("a,b,c."));
// assertTrue(p.isTrue("','(a,','(b,c))."));
}
use of nars.op.prolog.PrologCore in project narchy by automenta.
the class PrologCoreTest method testPrologCoreBeliefAssertion.
@Test
public void testPrologCoreBeliefAssertion() throws Narsese.NarseseException {
NAR n = NARS.tmp();
PrologCore p = new PrologCore(n);
n.input("a:b.");
n.input("(--, c:d).");
n.run(1);
assertTrue(p.isTrue("'-->'(b,a)."));
assertFalse(p.isTrue("'-->'(a,b)."));
assertTrue(p.isTrue("'--'('-->'(d,c))."));
assertFalse(p.isTrue("'-->'(d,c)."));
}
use of nars.op.prolog.PrologCore in project narchy by automenta.
the class PrologCoreTest method testConjunction3b.
@Test
public void testConjunction3b() throws Exception {
NAR n = NARS.tmp();
Param.DEBUG = true;
PrologCore p = new PrologCore(n);
n.believe("x:a");
assertTrue(p.isTrue("'-->'(a,x)."));
assertFalse(p.isTrue("'-->'(a,y)."));
n.believe("y:b");
n.believe("z:c", false);
n.run(1);
assertTrue(p.isTrue("'-->'(a,x), '-->'(b,y)."));
assertTrue(p.isTrue("'-->'(a,x), '-->'(b,y), '--'('-->'(c,z))."));
assertFalse(p.isTrue("'-->'(a,x), '-->'(b,y), '-->'(c,z)."));
// assertTrue(p.isTrue("','(a,','(b,c))."));
}
Aggregations