def testDDStructureDelta(self): # Construct type DD structures, and test whether d^2 = 0 holds. # PMC on both sides are genus 1 split PMC. pmc = splitPMC(1) # Strand algebra corresponding to pmc. alg = pmc.getAlgebra() # Initialize type DD structure over field F_2, with (left-left) action # by the genus 1 strand algebra. Intend to make this type DD bimodule # for identity. ddstr1 = SimpleDDStructure(F2, alg, alg) # Initialize the list of generators to add to ddstr1. # The generators have "complementary" idempotents. However, since the # PMCs are in opposite direction on both sides, the vector specifying # idempotents are the same. idems = {"x" : ([0], [0]), "y" : ([1], [1])} gens = {} for name, (idem1, idem2) in idems.items(): gens[name] = SimpleDDGenerator( ddstr1, Idempotent(pmc, idem1), Idempotent(pmc, idem2), name) ddstr1.addGenerator(gens[name]) # Now add delta ddstr1.addDelta(gens["x"], gens["y"], pmc.sd([(0, 1)]), pmc.sd([(2, 3)]), 1) ddstr1.addDelta(gens["y"], gens["x"], pmc.sd([(1, 2)]), pmc.sd([(1, 2)]), 1) ddstr1.addDelta(gens["x"], gens["y"], pmc.sd([(2, 3)]), pmc.sd([(0, 1)]), 1) # This already satisfies d^2 = 0 self.assertTrue(ddstr1.testDelta()) # However, one more arrow to finish the bimodule ddstr1.addDelta(gens["x"], gens["y"], pmc.sd([(0, 3)]), pmc.sd([(0, 3)]), 1) # This is now the identity bimodule, of course satisfying d^2 = 0. self.assertTrue(ddstr1.testDelta()) # Second example, showing failure of testDelta() ddstr2 = SimpleDDStructure(F2, alg, alg) # Add the same generators as before gens = {} for name, (idem1, idem2) in idems.items(): gens[name] = SimpleDDGenerator( ddstr2, Idempotent(pmc, idem1), Idempotent(pmc, idem2), name) ddstr2.addGenerator(gens[name]) # Now add delta ddstr2.addDelta(gens["x"], gens["y"], pmc.sd([(0, 1)]), pmc.sd([(0, 1)]), 1) ddstr2.addDelta(gens["y"], gens["x"], pmc.sd([(1, 2)]), pmc.sd([(1, 2)]), 1) # Prints the type DD structure. Note the code already checks that # idempotent matches in all added arrows (throws an error if they don't # match). print ddstr2 # However, testDelta() fails. Prints a term in d^2(x). self.assertFalse(ddstr2.testDelta())
def testHochchild(self): pmc = splitPMC(1) alg = MinusStrandAlgebra(F2, pmc) ddstr = SimpleDDStructure(F2, alg, alg) # Initialize the list of generators to add to ddstr1. idems = {"x" : ([0], [0]), "y" : ([1], [1])} gens = {} for name, (idem1, idem2) in idems.items(): gens[name] = SimpleDDGenerator( ddstr, Idempotent(pmc, idem1), Idempotent(pmc, idem2), name) ddstr.addGenerator(gens[name]) # Now add delta ddstr.addDelta(gens["x"], gens["y"], minusSD(pmc, [(0, 1)]), minusSD(pmc, [(2, 3)]), 1) ddstr.addDelta(gens["y"], gens["x"], minusSD(pmc, [(1, 2)]), minusSD(pmc, [(1, 2)]), 1) ddstr.addDelta(gens["x"], gens["y"], minusSD(pmc, [(2, 3)]), minusSD(pmc, [(0, 1)]), 1) ddstr.addDelta(gens["y"], gens["x"], minusSD(pmc, [(3, 0)]), minusSD(pmc, [(3, 0)]), 1) print ddstr self.assertTrue(ddstr.testDelta()) dstr = ddstr.toDStructure() print dstr self.assertTrue(dstr.testDelta()) hochchild = dstr.morToD(dstr) print hochchild hochchild.simplify(find_homology_basis = True) print len(hochchild) meaning_len = [len(gen.prev_meaning) for gen in hochchild.getGenerators()] for gen in hochchild.getGenerators(): print gen.prev_meaning
def getAdmissibleDDStructure(self): """Returns the type DD structure corresponding to the Heegaard diagram created by a finger move of the beta circle to the right. """ alg1 = self.start_pmc.getAlgebra(mult_one = True) alg2 = alg1 ddstr = SimpleDDStructure(F2, alg1, alg2) # Add generators for the non-admissible case - that is, those generators # that do not contain the two intersections created by the finger move. original_idems = self._getIdems() for i in range(len(original_idems)): left_idem, right_idem = original_idems[i] ddstr.addGenerator( SimpleDDGenerator(ddstr, left_idem, right_idem, "0_%d" % i)) # Now add the new generators. These just correspond to the complementary # idempotents with c_pair on the left, repeated twice. left_idems = [idem for idem in self.start_pmc.getIdempotents() if self.c_pair in idem] for i in range(len(left_idems)): left_idem = left_idems[i] right_idem = left_idem.opp().comp() ddstr.addGenerator( SimpleDDGenerator(ddstr, left_idem, right_idem, "1_%d" % i)) ddstr.addGenerator( SimpleDDGenerator(ddstr, left_idem, right_idem, "2_%d" % i)) gen_set = [] for i in range(3): gen_set.append([gen for gen in ddstr.getGenerators() if gen.name[:1] == "%d" % i]) # Enumerate the non-special chords (those that do not dependent on the # idempotent. See the functions themselves for the format of all_chords. if self.is_degenerate: all_chords = self._getAdmissibleNonSpecialChordsDegenerate() else: all_chords = self._getAdmissibleNonSpecialChords() for i, j in itertools.product(range(3), range(3)): all_chords[i][j] = [self._StrandsFromChords(chord1, chord2) for chord1, chord2 in all_chords[i][j]] # Now we emulate the logic in ddstructure.DDStrFromChords, except we # distinguish between ''classes'' of generators, by the first character # of the name of the generator. for i, j in itertools.product(range(3), range(3)): for x, y in itertools.product(gen_set[i], gen_set[j]): for l_chord, r_chord in all_chords[i][j]: if l_chord.idemCompatible(x.idem1, y.idem1) and \ r_chord.idemCompatible(x.idem2, y.idem2): ddstr.addDelta(x, y, StrandDiagram(alg1, x.idem1, l_chord), StrandDiagram(alg2, x.idem2, r_chord), 1) # Special handling for these. From class 2 to class 1, add only if the # c-pair is occupied on the left side (and not on the right). # Non-degenerate cases only. sp_chords = [] if not self.is_degenerate: for x in range(0, self.c1): for y in range(self.c2+1, self.n): sp_chords.append(([(x, y)], [(x, self.u), (self.u, y)])) sp_chords.append(([(x, y)], [(x, self.d), (self.d, y)])) sp_chords.append(([(x, self.d), (self.u, y)], [(x, self.d), (self.u, y)])) sp_chords = [self._StrandsFromChords(chord1, chord2) for chord1, chord2 in sp_chords] for x, y in itertools.product(gen_set[2], gen_set[1]): for l_chord, r_chord in sp_chords: if self.c_pair in x.idem1 and \ l_chord.idemCompatible(x.idem1, y.idem1) and \ r_chord.idemCompatible(x.idem2, y.idem2): assert self.c_pair not in x.idem2.opp() and \ self.c_pair in y.idem1 and \ self.c_pair not in y.idem2.opp() ddstr.addDelta(x, y, StrandDiagram(alg1, x.idem1, l_chord), StrandDiagram(alg2, x.idem2, r_chord), 1) assert ddstr.testDelta() return ddstr