Package stanfordlogic.prover

Examples of stanfordlogic.prover.Fact


     * Test method for 'camembert.prover.Unifier.mgu(Fact, Fact)'
     */
    public void testBasicMgu()
    {
        GdlList l1, l2;
        Fact f1, f2;
        Substitution sigma;
       
       
        l1 = parser_.parse("foo baz bar");
        l2 = parser_.parse("foo baz bar");
        f1 = VariableFact.fromList(l1);
        f2 = GroundFact.fromList(l2);
       
        sigma = Unifier.mgu(f1, f2);
        assertNotNull(sigma);
        assertEquals(0, sigma.numMappings());
       
       
        l1 = parser_.parse("foo ?x bar");
        l2 = parser_.parse("foo baz bar");
        f1 = VariableFact.fromList(l1);
        f2 = GroundFact.fromList(l2);
       
        sigma = Unifier.mgu( f1, f2 );
        assertNotNull(sigma);
        assertEquals( f2.getTerm( 0 ),
                sigma.getMapping( (TermVariable) f1.getTerm( 0 ) ) );
        assertEquals(1, sigma.numMappings());
       
       
        l1 = parser_.parse("foo ?x ?x");
        l2 = parser_.parse("foo baz ?y");
        f1 = VariableFact.fromList(l1);
        f2 = VariableFact.fromList(l2);
       
        sigma = Unifier.mgu(f1,f2);
        assertNotNull(sigma);
        assertEquals( f2.getTerm(0), sigma.getMapping( (TermVariable) f1.getTerm(0)) );
        assertEquals( f2.getTerm(0), sigma.getMapping( (TermVariable) f1.getTerm(1)) );
        assertEquals( f2.getTerm(0), sigma.getMapping( (TermVariable) f2.getTerm(1)) );
        assertEquals(2, sigma.numMappings());
    }
View Full Code Here


    }
   
    public void testFunctionMgu()
    {
        GdlList l1, l2;
        Fact f1, f2;
        Substitution sigma;
       
        l1 = parser_.parse("foo (f a b)");
        l2 = parser_.parse("foo ?x");
        f1 = GroundFact.fromList(l1);
        f2 = VariableFact.fromList(l2);
       
        sigma = Unifier.mgu(f1, f2);
        assertNotNull(sigma);
        assertEquals( f1.getTerm(0), sigma.getMapping( (TermVariable) f2.getTerm(0)) );
        assertEquals(1, sigma.numMappings());
    }
View Full Code Here

    }
   
    public void testBadMgu()
    {
        GdlList l1, l2;
        Fact f1, f2;
        Substitution sigma;
       
        // Now try one that will fail
        l1 = parser_.parse("foo ?x ?x");
        l2 = parser_.parse("foo bar baz");
View Full Code Here

    }

    public void testDifferentFunctions()
    {
        GdlList l1, l2;
        Fact f1, f2;
        Substitution sigma;
       
        l1 = parser_.parse("foo ?x ?x");
        l2 = parser_.parse("toto bar baz");
        f1 = VariableFact.fromList(l1);
View Full Code Here

    }
   
    public void testDifferentArity()
    {
        GdlList l1, l2;
        Fact f1, f2;
        Substitution sigma;
       
        l1 = parser_.parse("foo ?x ?y");
        l2 = parser_.parse("foo ?x ?y bar");
        f1 = VariableFact.fromList(l1);
View Full Code Here

    }
   
    public void testIdenticalFunction()
    {
        GdlList l1, l2;
        Fact f1, f2;
        Substitution sigma;
       
        l1 = parser_.parse("foo ?x");
        l2 = parser_.parse("foo ?x");
        f1 = VariableFact.fromList(l1);
View Full Code Here

    }
   
    public void testIdenticalVariables()
    {
        GdlList l1, l2;
        Fact f1, f2;
        Substitution sigma;
       
        l1 = parser_.parse("foo ?x ?x");
        l2 = parser_.parse("foo ?x ?x");
        f1 = VariableFact.fromList(l1);
View Full Code Here

    }
   
    public void testIdenticalVariableNames()
    {
        GdlList l1, l2;
        Fact f1, f2;
        Substitution sigma;
       
        l1 = parser_.parse("foo ?x ?y");
        l2 = parser_.parse("foo ?y ?y");
        f1 = VariableFact.fromList(l1);
View Full Code Here

    }
   
    public void testRecursiveSub()
    {
        GdlList l1, l2;
        Fact f1, f2;
        Substitution sigma;
       
        l1 = parser_.parse("foo ?x ?x ?z");
        l2 = parser_.parse("foo  a ?y ?y");
        f1 = VariableFact.fromList(l1);
View Full Code Here

       
        AbstractReasoner r = new BasicReasoner(kb_, new ArrayList<Implication>(), parser_ );
       
        // See if we can get just one answer
        GdlList questionList = parser_.parse("succ ?x 2");
        Fact question = VariableFact.fromList(questionList);
       
        GroundFact answer = getAnAnswer( r, question );
        assertEquals( new GroundFact(symbolTable_, "succ", "1", "2"), answer);
       
        questionList = parser_.parse("succ ?x 2");
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.