public void SimpleDeMorgan() { // ! (q ∧ r) ----> !q ∨ !r var T = CNFify.Term.NewNot(CNFify.Term.NewAnd(q, r)); var result = CNFify.normalize(T); var expected = CNFify.Term.NewOr(CNFify.Term.NewNot(q), CNFify.Term.NewNot(r)); Assert.AreEqual(expected, result); }
public void InnerDistribution() { // a ∧ (p ∨ (q ∧ r)) ----> a ∧ (q ∨ p) ∧ (r ∨ p) var T = CNFify.Term.NewAnd(a, CNFify.Term.NewOr(p, CNFify.Term.NewAnd(q, r))); var result = CNFify.normalize(T); var expected = CNFify.Term.NewAnd(a, CNFify.Term.NewAnd(CNFify.Term.NewOr(p, q), CNFify.Term.NewOr(p, r))); Assert.AreEqual(expected, result); }
public void SimpleEquality() { // (a <=> b) ----> (a ∨ !b) ∧ (b ∨ !a) var T = CNFify.equal(a, b); var result = CNFify.normalize(T); var expected = CNFify.Term.NewAnd( CNFify.Term.NewOr(CNFify.Term.NewNot(a), b), CNFify.Term.NewOr(CNFify.Term.NewNot(b), a) ); Assert.AreEqual(expected, result); }
public void SimpleRemoveNotBImp() { // !(a <=> b) ----> (a ∨ b) ∧ (!b ∨ !a) var T = CNFify.Term.NewNot(CNFify.equal(a, b)); var result = CNFify.normalize(T); var expected = CNFify.Term.NewAnd( CNFify.Term.NewOr(b, a), CNFify.Term.NewOr(CNFify.Term.NewNot(a), CNFify.Term.NewNot(b)) ); Assert.AreEqual(expected, result); }