Examples of convertToCNF()


Examples of aima.core.logic.fol.CNFConverter.convertToCNF()

    // Ew.Ex.Ey.Ez.(r(x,y) & q(x,w,z))
    origSentence = parser
        .parse("NOT(EXISTS w4 (EXISTS x4 (EXISTS y4 ( EXISTS z4 (R(x4, y4) AND Q(x4, w4, z4))))))");

    cnf = cnfConv.convertToCNF(origSentence);

    Assert.assertEquals("[~Q(x4,w4,z4), ~R(x4,y4)]", cnf.toString());
  }

  @Test
View Full Code Here

Examples of aima.core.logic.fol.CNFConverter.convertToCNF()

    FOLParser parser = new FOLParser(domain);
    CNFConverter cnfConv = new CNFConverter(parser);

    // cheat(x,y) => f(x,y)
    Sentence def1 = parser.parse("(Cheat(x,y) => F(x,y))");
    CNF cnfDef1 = cnfConv.convertToCNF(def1);

    Assert.assertEquals("[~Cheat(x,y), F(x,y)]", cnfDef1.toString());

    // extra(x,y) | knows(x) => a(x,y)
    Sentence def2 = parser.parse("((Extra(x,y) OR Knows(x)) => A(x,y))");
View Full Code Here

Examples of aima.core.logic.fol.CNFConverter.convertToCNF()

    Assert.assertEquals("[~Cheat(x,y), F(x,y)]", cnfDef1.toString());

    // extra(x,y) | knows(x) => a(x,y)
    Sentence def2 = parser.parse("((Extra(x,y) OR Knows(x)) => A(x,y))");
    CNF cnfDef2 = cnfConv.convertToCNF(def2);

    Assert.assertEquals("[~Extra(x,y), A(x,y)],[~Knows(x), A(x,y)]",
        cnfDef2.toString());

    // f(x,y) & f(x,z) & diff(y,z) <=> probation(x)
View Full Code Here

Examples of aima.core.logic.fol.CNFConverter.convertToCNF()

        cnfDef2.toString());

    // f(x,y) & f(x,z) & diff(y,z) <=> probation(x)
    Sentence def3 = parser
        .parse("(((NOT(((F(x,y) AND F(x,z)) AND Diff(y,z)))) OR Probation(x)) AND (((F(x,y) AND F(x,z)) AND Diff(y,z)) OR NOT(Probation(x))))");
    CNF cnfDef3 = cnfConv.convertToCNF(def3);

    Assert.assertEquals(
        "[~Diff(y,z), ~F(x,y), ~F(x,z), Probation(x)],[~Probation(x), F(x,y)],[~Probation(x), F(x,z)],[~Probation(x), Diff(y,z)]",
        cnfDef3.toString());
View Full Code Here

Examples of aima.core.logic.fol.CNFConverter.convertToCNF()

        cnfDef3.toString());

    // a(x,y) & a(x,z) & diff(y,z) <=> award(x)
    Sentence def4 = parser
        .parse("(((NOT(((A(x,y) AND A(x,z)) AND Diff(y,z)))) OR Award(x)) AND (((A(x,y) AND A(x,z)) AND Diff(y,z)) OR NOT(Award(x))))");
    CNF cnfDef4 = cnfConv.convertToCNF(def4);

    Assert.assertEquals(
        "[~A(x,y), ~A(x,z), ~Diff(y,z), Award(x)],[~Award(x), A(x,y)],[~Award(x), A(x,z)],[~Award(x), Diff(y,z)]",
        cnfDef4.toString());
View Full Code Here

Examples of aima.core.logic.fol.CNFConverter.convertToCNF()

        cnfDef4.toString());

    // f(x,y) <=> ~a(x,y)
    Sentence def5 = parser
        .parse("( ( NOT(F(x,y)) OR NOT(A(x,y))) AND ( F(x,y) OR NOT(NOT(A(x,y))) ) )");
    CNF cnfDef5 = cnfConv.convertToCNF(def5);

    Assert.assertEquals("[~A(x,y), ~F(x,y)],[A(x,y), F(x,y)]",
        cnfDef5.toString());
  }
View Full Code Here

Examples of aima.core.logic.fol.CNFConverter.convertToCNF()

    CNFConverter cnfConv = new CNFConverter(parser);

    // ~(((~p or ~q) => ~(p or q)) => r)
    Sentence sent = parser
        .parse("NOT(((((NOT(P(A)) OR NOT(Q(A)))) => NOT((P(A) OR Q(A)))) => R(A)))");
    CNF cnf = cnfConv.convertToCNF(sent);

    Assert.assertEquals(
        "[~P(A), P(A)],[~P(A), Q(A)],[~Q(A), P(A)],[~Q(A), Q(A)],[~R(A)]",
        cnf.toString());
  }
View Full Code Here

Examples of aima.core.logic.fol.CNFConverter.convertToCNF()

    CNFConverter cnfConv = new CNFConverter(parser);

    // Base Case:
    Sentence sent = parser
        .parse("NOT(FORALL x (FORALL y (Equal(Plus(Plus(x,y),ZERO), Plus(x,Plus(y,ZERO))))))");
    CNF cnf = cnfConv.convertToCNF(sent);
    Assert.assertEquals(
        "[~Equal(Plus(Plus(SC0,SC1),ZERO),Plus(SC0,Plus(SC1,ZERO)))]",
        cnf.toString());

    // Instance of Induction Axion Scmema
View Full Code Here

Examples of aima.core.logic.fol.CNFConverter.convertToCNF()

            + "Equal(Plus(Plus(x,y),Plus(z,ONE)), Plus(x,Plus(y,Plus(z,ONE))))"
            + "))))" + ")" + " => "
            + "FORALL x (FORALL y (FORALL z("
            + "Equal(Plus(Plus(x,y),z), Plus(x,Plus(y,z)))"
            + "))))");
    cnf = cnfConv.convertToCNF(sent);
    Assert.assertEquals(
        "[~Equal(Plus(Plus(A,B),ZERO),Plus(A,Plus(B,ZERO))), Equal(Plus(Plus(q0,q1),q2),Plus(q0,Plus(q1,q2))), Equal(Plus(Plus(SC2,SC3),SC4),Plus(SC2,Plus(SC3,SC4)))],[~Equal(Plus(Plus(A,B),ZERO),Plus(A,Plus(B,ZERO))), ~Equal(Plus(Plus(SC2,SC3),Plus(SC4,ONE)),Plus(SC2,Plus(SC3,Plus(SC4,ONE)))), Equal(Plus(Plus(q0,q1),q2),Plus(q0,Plus(q1,q2)))]",
        cnf.toString());

    // Goal
View Full Code Here

Examples of aima.core.logic.fol.CNFConverter.convertToCNF()

        cnf.toString());

    // Goal
    sent = parser
        .parse("NOT(FORALL x (FORALL y (FORALL z (Equal(Plus(Plus(x,y),z), Plus(x,Plus(y,z)))))))");
    cnf = cnfConv.convertToCNF(sent);
    Assert.assertEquals(
        "[~Equal(Plus(Plus(SC5,SC6),SC7),Plus(SC5,Plus(SC6,SC7)))]",
        cnf.toString());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.