FOLParser parser = new FOLParser(domain);
// Example
// {~p(a,b),q(c)}
Clause psi = new Clause();
psi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(C)"));
// {~p(x,y)}
Clause phi = new Clause();
phi.addNegativeLiteral((Predicate) parser.parse("P(x,y)"));
Assert.assertTrue(phi.subsumes(psi));
// Non-Example
// {~p(x,b),q(x)}
psi = new Clause();
psi.addNegativeLiteral((Predicate) parser.parse("P(x,B)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(x)"));
// {~p(a,y)}
phi = new Clause();
phi.addNegativeLiteral((Predicate) parser.parse("P(A,y)"));
// Reason for Non-Example:
// {p(b,b)}
// {~q(b)}
Assert.assertFalse(phi.subsumes(psi));
//
// Additional Examples
// Non-Example
// {~p(x,b),q(z)}
psi = new Clause();
psi.addNegativeLiteral((Predicate) parser.parse("P(x,B)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(z)"));
// {~p(a,y)}
phi = new Clause();
phi.addNegativeLiteral((Predicate) parser.parse("P(A,y)"));
Assert.assertFalse(phi.subsumes(psi));
// Example
// {~p(a,b),~p(w,z),q(c)}
psi = new Clause();
psi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(w,z)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(C)"));
// {~p(x,y),~p(a,b)}
phi = new Clause();
phi.addNegativeLiteral((Predicate) parser.parse("P(x,y)"));
phi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
Assert.assertTrue(phi.subsumes(psi));
// Non-Example
// {~p(v,b),~p(w,z),q(c)}
psi = new Clause();
psi.addNegativeLiteral((Predicate) parser.parse("P(v,B)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(w,z)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(C)"));
// {~p(x,y),~p(a,b)}
phi = new Clause();
phi.addNegativeLiteral((Predicate) parser.parse("P(x,y)"));
phi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
Assert.assertFalse(phi.subsumes(psi));
// Example
// {~p(a,b),~p(c,d),~p(e,f),~p(g,h),~p(i,j),q(c)}
psi = new Clause();
psi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(C,D)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(E,F)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(G,H)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(I,J)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(C)"));
// {~p(i,j)}
phi = new Clause();
phi.addNegativeLiteral((Predicate) parser.parse("P(I,J)"));
Assert.assertTrue(phi.subsumes(psi));
// Example
// {~p(a,b),~p(c,d),~p(e,f),q(c)}
psi = new Clause();
psi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(C,D)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(E,F)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(C)"));
// {~p(e,f),~p(a,b),~p(c,d)}
phi = new Clause();
phi.addNegativeLiteral((Predicate) parser.parse("P(E,F)"));
phi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
phi.addNegativeLiteral((Predicate) parser.parse("P(C,D)"));
Assert.assertTrue(phi.subsumes(psi));
// Example
// {~p(a,b),~p(c,d),~p(e,f),~p(g,h),~p(i,j),q(c)}
psi = new Clause();
psi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(C,D)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(E,F)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(G,H)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(I,J)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(C)"));
// {~p(i,j),~p(c,d)}
phi = new Clause();
phi.addNegativeLiteral((Predicate) parser.parse("P(I,J)"));
phi.addNegativeLiteral((Predicate) parser.parse("P(C,D)"));
Assert.assertTrue(phi.subsumes(psi));
// Non-Example
// {~p(a,b),~p(x,d),~p(e,f),~p(g,h),~p(i,j),q(c)}
psi = new Clause();
psi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(x,D)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(E,F)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(G,H)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(I,J)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(C)"));
// {~p(i,j),~p(c,d)}
phi = new Clause();
phi.addNegativeLiteral((Predicate) parser.parse("P(I,J)"));
phi.addNegativeLiteral((Predicate) parser.parse("P(C,D)"));
Assert.assertFalse(phi.subsumes(psi));
// Example
// {~p(a,b),~p(c,d),~p(e,f),~p(g,h),~p(i,j),q(c)}
psi = new Clause();
psi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(C,D)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(E,F)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(G,H)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(I,J)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(C)"));
// {~p(i,j),~p(a,x)}
phi = new Clause();
phi.addNegativeLiteral((Predicate) parser.parse("P(I,J)"));
phi.addNegativeLiteral((Predicate) parser.parse("P(A,x)"));
Assert.assertTrue(phi.subsumes(psi));
// Example
// {~p(a,b),~p(c,d),~p(e,f),~p(g,h),~p(i,j),q(a,b),q(c,d),q(e,f)}
psi = new Clause();
psi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(C,D)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(E,F)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(G,H)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(I,J)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(A,B)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(C,D)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(E,F)"));
// {~p(i,j),~p(a,b),q(e,f),q(a,b)}
phi = new Clause();
phi.addNegativeLiteral((Predicate) parser.parse("P(I,J)"));
phi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
phi.addPositiveLiteral((Predicate) parser.parse("Q(E,F)"));
phi.addPositiveLiteral((Predicate) parser.parse("Q(A,B)"));
Assert.assertTrue(phi.subsumes(psi));
// Non-Example
// {~p(a,b),~p(c,d),~p(e,f),~p(g,h),~p(i,j),q(a,b),q(c,d),q(e,f)}
psi = new Clause();
psi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(C,D)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(E,F)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(G,H)"));
psi.addNegativeLiteral((Predicate) parser.parse("P(I,J)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(A,B)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(C,D)"));
psi.addPositiveLiteral((Predicate) parser.parse("Q(E,F)"));
// {~p(i,j),~p(a,b),q(e,f),q(a,b)}
phi = new Clause();
phi.addNegativeLiteral((Predicate) parser.parse("P(I,J)"));
phi.addNegativeLiteral((Predicate) parser.parse("P(A,B)"));
phi.addPositiveLiteral((Predicate) parser.parse("Q(E,A)"));
phi.addPositiveLiteral((Predicate) parser.parse("Q(A,B)"));
Assert.assertFalse(phi.subsumes(psi));
}