Package stanfordlogic.prover

Examples of stanfordlogic.prover.Fact


       
        AbstractReasoner r = new BasicReasoner(kb_, new ArrayList<Implication>(), parser_ );
       
        //  Now see if we can get *all* answers
        GdlList questionList = parser_.parse("succ ?x ?y");
        Fact question = VariableFact.fromList(questionList);
       
        List<GroundFact> answers = getAllAnswers( r,question);
        assertEquals( 3, answers.size() );
       
        assertEquals( new GroundFact(symbolTable_, "succ", "1", "2"), answers.get(0) );
View Full Code Here


        AbstractReasoner r = new BasicReasoner(kb_, rules, parser_);
       
        GdlList facts = parser_.parse("(true (cell 1 1 b))(true (cell 1 2 b))(true (cell 1 3 b))(true (cell 2 1 b))(true (cell 2 2 b))(true (cell 2 3 b))(true (cell 3 1 b))(true (cell 3 2 b))(true (cell 3 3 b))(true (control xplayer))");
        addFacts(facts);
       
        Fact f = getAnAnswer( r, Fact.fromExpression( parser_.parse("terminal") ) );
        assertNull(f);
       
//        kb_.clear();
//        facts = parser_
//                .parse( "(true (cell 1 1 x)) (true (cell 1 2 o)) (true (cell 1 3 x)) (true (cell 2 1 o)) (true (cell 2 2 x)) (true (cell 2 2 x)) (true (cell 2 3 o)) (true (cell 3 1 b)) (true (cell 3 2 b)) (true (cell 3 3 b))" );
View Full Code Here

        addFacts(facts);
       
        // Get all next facts
        GroundFact does = GroundFact.fromExpression( parser_.parse("does xplayer noop") );
        GroundFact does2 = GroundFact.fromExpression( parser_.parse("does oplayer (mark 2 3)") );
        Fact question = VariableFact.fromExpression( parser_.parse("next ?x") );
       
        KnowledgeBase kb = new BasicKB();
       
        kb.setTrue(does);
        kb.setTrue(does2);
View Full Code Here

        staticKb.loadWithFacts(info.getAllGrounds());
       
        AbstractReasoner r = new BasicReasoner(staticKb, info.getIndexedRules(), parser_);
       
       
        Fact initQuestion = Fact.fromExpression(parser_.parse("init ?x"));
       
        // Compute the initial state
        List<GroundFact> inits = r.getAllAnswers(initQuestion);
       
        KnowledgeBase currentState = new BasicKB();
View Full Code Here

    {
        for (GroundFact move : moves) {
            kb.setTrue(move);
        }
       
        Fact nextQuestion = Fact.fromExpression(parser_.parse("next ?x"));
       
        ProofContext context = new ProofContext(kb, parser_);
       
        List<GroundFact> nexts = r.getAllAnswers(nextQuestion, context);
       
View Full Code Here

       
        KnowledgeBase volatileKb = new BasicKB();
       
        AbstractReasoner reasoner = new BasicReasoner(staticKb, rules, parser_);
       
        Fact question = VariableFact.fromList( parser_.parse("init ?x") );
       
        ProofContext context = new ProofContext(volatileKb, parser_);
       
        List<GroundFact> init = reasoner.getAllAnswers( question, context );
       
View Full Code Here

       
        KnowledgeBase volatileKb = new BasicKB();
       
        AbstractReasoner reasoner = new BasicReasoner(staticKb, rules, parser_);
       
        Fact question = VariableFact.fromList( parser_.parse("init ?x") );
       
        ProofContext context = new ProofContext(volatileKb, parser_);
       
        List<GroundFact> init = reasoner.getAllAnswers( question, context );
       
View Full Code Here

        assertEquals(t, s.getMapping(v2) );
    }
   
    public void testFunctionVarMapping()
    {
        Fact f1 = makeFact("legal ?x");
       
        TermFunction tf = getTermFunction("mark ?y ?z");
       
        TermVariable varX = getVariable("?x");
        TermVariable varY = getVariable("?y");
        TermVariable varZ = getVariable("?z");
       
        Substitution s = new Substitution();
        s.addMapping(varX, tf);
        s.addMapping(varY, getTermObject("1"));
        s.addMapping(varZ, getTermObject("2"));
       
       
        Fact result = (Fact) f1.applySubstitution(s);
       
        assertEquals( makeFact("legal (mark 1 2)"), result );
    }
View Full Code Here

    public void testEqualsMvr()
    {
        String s1 = "count 1 1 ?var11583106 ?var11583106";
        String s2 = "count 1 1 ?var11580908 ?var11580909";
       
        Fact f1 = Fact.fromExpression( parser_.parse(s1) );
        Fact f2 = Fact.fromExpression( parser_.parse(s2) );
       
        // Make sure f1 can't map to f2
        assertFalse(f1.canMapVariables(f2));
       
        // But, that f2 can map to f1
        assertTrue(f2.canMapVariables(f1));
    }
View Full Code Here

    private Implication examineRule(GdlList rule)
    {
        // First element is the IMPLIEDBY token; ignore it.

        // Second element is the head of the rule. It's a relation (fact).
        Fact head = (Fact) examineRelation(rule.getElement(1));
       
        // Everything thereafter are the antecedent relations.
        Expression [] conjuncts = new Expression[rule.getArity()-1];
       
        // Create the conjunct list
View Full Code Here

TOP

Related Classes of stanfordlogic.prover.Fact

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.