def test_smallMerge(self): zero = symbolify.Branch().branchOff(0,True) one = symbolify.Branch().branchOff(0,False).branchOff(1,True) two = symbolify.Branch().branchOff(0,False).branchOff(1,False).branchOff(2,True) either = Context([zero, one, two]) self.assertEqual(len(either.cnf), 3) self.assertEqual(len(either.cnf[0]), 1) self.assertEqual(len(either.cnf[1]), 1) self.assertEqual(len(either.cnf[2]), 1)
def test_completeMerge(self): for L in range(3, 8): base = [] for i in range(1 << L): temp = symbolify.Branch() for j in range(L): temp = temp.branchOff(j, i & (1 << j)) base.append(temp) self.assertTrue(Context(base).isTrivial())
def test_basicBranching(self): base = symbolify.Branch().branchOff(0, True) left = Context([base.branchOff(1, True)]) right = Context([base.branchOff(1, False)]) self.assertFalse(left.isCompatibleWith(right)) imp, rel = left.implies(Context([base])) self.assertTrue(imp) self.assertEqual(len(rel.cnf), 1) self.assertEqual(len(rel.cnf[0]), 1) self.assertEqual(rel.cnf[0][1], True)
def test_bigMerge(self): #currently takes ~2 seconds on my machine base = [] L = 8 for i in range(1 << L): temp = symbolify.Branch() for j in range(L): temp = temp.branchOff(j, i & (1 << j)) base.append(temp) self.assertTrue(Context(base).isTrivial())