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))");
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)
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());
// 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());
// 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());