Search in sources :

Example 1 with Builder

use of suite.lp.search.ProverBuilder.Builder in project suite by stupidsing.

the class LogicCompilerLevel2Test method test0.

// require tail recursion to work
@Test
public void test0() {
    RuleSet rs = Suite.getRuleSet(Suite.parse(// 
    "" + // 
    "member (.e, _) .e #" + // 
    "member (_, .tail) .e :- member .tail .e #" + // 
    "sum .a .b .c :- bound .a, bound .b, let .c (.a - .b) #" + // 
    "sum .a .b .c :- bound .a, bound .c, let .b (.a - .c) #" + // 
    "sum .a .b .c :- bound .b, bound .c, let .a (.b + .c) #"));
    Builder builder = CompiledProverBuilder.level2(new ProverConfig());
    Suite.evaluateLogic(builder, rs, "(), sink ()");
}
Also used : RuleSet(suite.lp.kb.RuleSet) Builder(suite.lp.search.ProverBuilder.Builder) CompiledProverBuilder(suite.lp.search.CompiledProverBuilder) ProverConfig(suite.lp.Configuration.ProverConfig) Test(org.junit.Test)

Example 2 with Builder

use of suite.lp.search.ProverBuilder.Builder in project suite by stupidsing.

the class RbTreeTest method test.

@Test
public void test() throws IOException {
    RuleSet rs = Suite.newRuleSet(List.of("auto.sl", "rbt.sl"));
    String gs = // 
    "" + // 
    "rbt-insert-list (6, 7, 8, 9, 10, 1, 2, 3, 4, 5,) ()/.t \n" + // 
    ", rbt-get .t 8" + ", rbt-member .t 4";
    for (Builder builder : List.of(new InterpretedProverBuilder(), new SewingProverBuilder2())) assertTrue(Suite.proveLogic(builder, rs, gs));
}
Also used : RuleSet(suite.lp.kb.RuleSet) InterpretedProverBuilder(suite.lp.search.InterpretedProverBuilder) InterpretedProverBuilder(suite.lp.search.InterpretedProverBuilder) Builder(suite.lp.search.ProverBuilder.Builder) SewingProverBuilder2(suite.lp.search.SewingProverBuilder2) Test(org.junit.Test)

Example 3 with Builder

use of suite.lp.search.ProverBuilder.Builder in project suite by stupidsing.

the class LogicCompilerLevel2Test method test1.

@Test
public void test1() throws IOException {
    RuleSet rs = Suite.newRuleSet(List.of("auto.sl"));
    Builder builder = CompiledProverBuilder.level2(new ProverConfig());
    Suite.evaluateLogic(builder, rs, "(), sink ()");
}
Also used : RuleSet(suite.lp.kb.RuleSet) Builder(suite.lp.search.ProverBuilder.Builder) CompiledProverBuilder(suite.lp.search.CompiledProverBuilder) ProverConfig(suite.lp.Configuration.ProverConfig) Test(org.junit.Test)

Example 4 with Builder

use of suite.lp.search.ProverBuilder.Builder in project suite by stupidsing.

the class CompileUtil method precompile.

public boolean precompile(String libraryName, ProverConfig pc) {
    System.out.println("Pre-compiling [" + libraryName + "]...");
    Builder builder = new SewingProverBuilder(pc);
    RuleSet rs = funCompilerRuleSet();
    boolean b = Suite.proveLogic(builder, rs, "fc-precompile-lib " + libraryName);
    if (b)
        System.out.println("Pre-compilation success [" + libraryName + "]");
    else
        System.out.println("Pre-compilation failed [" + libraryName + "]");
    return b;
}
Also used : RuleSet(suite.lp.kb.RuleSet) SewingProverBuilder(suite.lp.search.SewingProverBuilder) Builder(suite.lp.search.ProverBuilder.Builder) SewingProverBuilder(suite.lp.search.SewingProverBuilder)

Aggregations

RuleSet (suite.lp.kb.RuleSet)4 Builder (suite.lp.search.ProverBuilder.Builder)4 Test (org.junit.Test)3 ProverConfig (suite.lp.Configuration.ProverConfig)2 CompiledProverBuilder (suite.lp.search.CompiledProverBuilder)2 InterpretedProverBuilder (suite.lp.search.InterpretedProverBuilder)1 SewingProverBuilder (suite.lp.search.SewingProverBuilder)1 SewingProverBuilder2 (suite.lp.search.SewingProverBuilder2)1