Search in sources :

Example 31 with RuleSet

use of suite.lp.kb.RuleSet in project suite by stupidsing.

the class CompiledProverBuilder method build.

@Override
public Fun<Node, Finder> build(RuleSet ruleSet) {
    Node rules = Suite.getRules(ruleSet);
    return goal -> {
        Node code = compile(Suite.substitute(".0 >> .1", rules, goal));
        return (source, sink) -> {
            ProverConfig proverConfig1 = new ProverConfig(ruleSet, proverConfig);
            proverConfig1.setSource(source);
            proverConfig1.setSink(sink);
            try (InstructionExecutor executor = new LogicInstructionExecutor(code, proverConfig1)) {
                executor.execute();
            }
        };
    };
}
Also used : Suite(suite.Suite) InstructionExecutor(suite.instructionexecutor.InstructionExecutor) LogUtil(suite.os.LogUtil) Finder(suite.lp.search.ProverBuilder.Finder) LogicInstructionExecutor(suite.instructionexecutor.LogicInstructionExecutor) Builder(suite.lp.search.ProverBuilder.Builder) RuleSet(suite.lp.kb.RuleSet) Fun(suite.util.FunUtil.Fun) ProverConfig(suite.lp.Configuration.ProverConfig) Node(suite.node.Node) Node(suite.node.Node) InstructionExecutor(suite.instructionexecutor.InstructionExecutor) LogicInstructionExecutor(suite.instructionexecutor.LogicInstructionExecutor) ProverConfig(suite.lp.Configuration.ProverConfig) LogicInstructionExecutor(suite.instructionexecutor.LogicInstructionExecutor)

Example 32 with RuleSet

use of suite.lp.kb.RuleSet in project suite by stupidsing.

the class InterpretedProverBuilder method build.

@Override
public Fun<Node, Finder> build(RuleSet ruleSet) {
    return goal -> {
        Node goal1 = SewingGeneralizerImpl.generalize(goal);
        return (source, sink) -> {
            ProverConfig proverConfig1 = new ProverConfig(ruleSet, proverConfig);
            proverConfig1.setSource(source);
            proverConfig1.setSink(sink);
            new Prover(proverConfig1).elaborate(goal1);
        };
    };
}
Also used : Prover(suite.lp.doer.Prover) SewingGeneralizerImpl(suite.lp.sewing.impl.SewingGeneralizerImpl) Finder(suite.lp.search.ProverBuilder.Finder) Builder(suite.lp.search.ProverBuilder.Builder) RuleSet(suite.lp.kb.RuleSet) Fun(suite.util.FunUtil.Fun) ProverConfig(suite.lp.Configuration.ProverConfig) Node(suite.node.Node) Node(suite.node.Node) ProverConfig(suite.lp.Configuration.ProverConfig) Prover(suite.lp.doer.Prover)

Example 33 with RuleSet

use of suite.lp.kb.RuleSet 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)

Example 34 with RuleSet

use of suite.lp.kb.RuleSet in project suite by stupidsing.

the class Suite method getRuleSet.

public static RuleSet getRuleSet(Node node) {
    RuleSet rs = newRuleSet();
    importUtil.importFrom(rs, node);
    return rs;
}
Also used : RuleSet(suite.lp.kb.RuleSet)

Aggregations

RuleSet (suite.lp.kb.RuleSet)34 Test (org.junit.Test)25 ProverConfig (suite.lp.Configuration.ProverConfig)12 Node (suite.node.Node)9 ProverFactory (suite.lp.doer.ProverFactory)7 Builder (suite.lp.search.ProverBuilder.Builder)7 SewingProverImpl (suite.lp.sewing.impl.SewingProverImpl)7 Finder (suite.lp.search.ProverBuilder.Finder)6 Fun (suite.util.FunUtil.Fun)4 CompiledProverBuilder (suite.lp.search.CompiledProverBuilder)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Suite (suite.Suite)2 Prove_ (suite.lp.doer.ProverFactory.Prove_)2 Source (suite.util.FunUtil.Source)2 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Collectors (java.util.stream.Collectors)1 Pattern (suite.BindArrayUtil.Pattern)1