use of suite.lp.kb.RuleSet in project suite by stupidsing.
the class ImportTest method testImport.
@Test
public void testImport() throws IOException {
RuleSet rs = Suite.newRuleSet(List.of("auto.sl"));
assertTrue(Suite.proveLogic(rs, "list"));
assertTrue(Suite.proveLogic(rs, "list repeat"));
}
use of suite.lp.kb.RuleSet in project suite by stupidsing.
the class ProverTest method testCut.
@Test
public void testCut() {
RuleSet rs = Suite.newRuleSet();
Suite.addRule(rs, "a :- !, fail");
Suite.addRule(rs, "a");
Suite.addRule(rs, "yes");
assertFalse(test(rs, "a"));
assertFalse(Suite.proveLogic(rs, "cut.begin .c, (nl, cut.end .c, fail; yes)"));
assertTrue(Suite.proveLogic(rs, "(cut.begin .c, nl, cut.end .c, fail); yes"));
}
use of suite.lp.kb.RuleSet in project suite by stupidsing.
the class ProverTest method testFindAll.
@Test
public void testFindAll() {
RuleSet rs = Suite.newRuleSet();
assertTrue(test(rs, "find.all .v (.v = a; .v = b; .v = c) .results, .results = (a, b, c,)"));
}
use of suite.lp.kb.RuleSet in project suite by stupidsing.
the class ProverTest method testMember.
@Test
public void testMember() {
RuleSet rs = Suite.newRuleSet();
Suite.addRule(rs, "mem ((.e, _), .e)");
Suite.addRule(rs, "mem ((_, .remains), .e) :- mem (.remains, .e)");
assertTrue(test(rs, "mem ((a, ), a)"));
assertTrue(test(rs, "mem ((a, b, c, ), .v)"));
assertTrue(test(rs, ".l = (1, 2, 3,), find.all .v (mem (.l, .v)) .l"));
assertFalse(test(rs, "mem ((a, b, c, ), d)"));
}
use of suite.lp.kb.RuleSet in project suite by stupidsing.
the class ProverTest method testProve.
@Test
public void testProve() {
RuleSet rs = Suite.newRuleSet();
Suite.addRule(rs, "a");
Suite.addRule(rs, "b");
Suite.addRule(rs, "c");
Suite.addRule(rs, "a b .v :- fail");
Suite.addRule(rs, "a b c");
Suite.addRule(rs, ".var is a man");
Suite.addRule(rs, "q :- once (not yes; yes)");
Suite.addRule(rs, "yes");
assertTrue(Suite.proveLogic(rs, ""));
assertTrue(Suite.proveLogic(rs, "a"));
assertTrue(Suite.proveLogic(rs, "a, b"));
assertTrue(Suite.proveLogic(rs, "a, b, c"));
assertTrue(Suite.proveLogic(rs, "a, fail; b"));
assertTrue(Suite.proveLogic(rs, "a b c"));
assertTrue(Suite.proveLogic(rs, "abc is a man"));
assertTrue(Suite.proveLogic(rs, ".v = a, .v = b; .v = c"));
assertTrue(Suite.proveLogic(rs, "[1, 2, 3] = [1, 2, 3]"));
assertTrue(Suite.proveLogic(rs, "q"));
assertFalse(Suite.proveLogic(rs, "fail"));
assertFalse(Suite.proveLogic(rs, "d"));
assertFalse(Suite.proveLogic(rs, "a, fail"));
assertFalse(Suite.proveLogic(rs, "fail, a"));
assertFalse(Suite.proveLogic(rs, "a b d"));
assertFalse(Suite.proveLogic(rs, "a = b"));
assertFalse(Suite.proveLogic(rs, ".v = a, .v = b"));
}
Aggregations