Exemple #1
0
 def testIdentityDDLocal(self):
     splitting = PMCSplitting(linearPMC(2), [(1, 4)])
     local_pmc = splitting.local_pmc
     id_local = identityDALocal(local_pmc)
     extended_id = ExtendedDAStructure(id_local, splitting, splitting)
     id_dd = extended_id.tensorDD(identityDD(linearPMC(2)))
     self.assertTrue(id_dd.compareDDStructures(identityDD(linearPMC(2))))
Exemple #2
0
    def testTensorDoubleDD(self):
        dd_id = identityDD(splitPMC(1))
        self.assertTrue(computeDATensorDD(dd_id, dd_id).testDelta())
        dd_id2 = identityDD(splitPMC(2))
        self.assertTrue(computeDATensorDD(dd_id2, dd_id2).testDelta())

        def composeSlides(start_pmc, slides):
            cur_dd = Arcslide(start_pmc, *slides[0]).getDDStructure()
            for slide in slides[1:]:
                next_dd = Arcslide(
                    cur_dd.algebra2.pmc.opp(), *slide).getDDStructure()
                cur_dd = computeDATensorDD(cur_dd, next_dd)
                cur_dd.simplify()
                cur_dd.reindex()
            return cur_dd

        tests = [(splitPMC(1), [(0,1),(3,2)], 2),
                 (PMC([(0,3),(1,6),(2,4),(5,7)]), [(2,1),(6,5),(4,3)], 6)]
        for start_pmc, slides, result in tests:
            composed_dd = composeSlides(start_pmc, slides)
            self.assertEqual(len(composed_dd), result)
            composed_dd.checkGrading()
            if DEFAULT_GRADING == SMALL_GRADING:
                ref_gr = composed_dd.grading.values()[0]
                for gen, gr in composed_dd.grading.items():
                    self.assertEqual(gr, ref_gr)
Exemple #3
0
 def testTensorDDandD(self):
     d1 = zeroTypeD(1)
     d2 = zeroTypeDAdm(1)
     d3 = zeroTypeD(2)
     dd_id = identityDD(splitPMC(1))
     dd_id2 = identityDD(splitPMC(2))
     dd_slide1 = Arcslide(splitPMC(1), 0, 1).getDDStructure()
     dstr1 = computeDATensorD(dd_id, d1)
     dstr2 = computeDATensorD(dd_id, d2)
     dstr3 = computeDATensorD(dd_slide1, d1)
     dstr4 = computeDATensorD(dd_id2, d3)
Exemple #4
0
 def testGrading(self):
     d1 = zeroTypeD(1)
     d2 = infTypeD(1)
     dd_id = identityDD(splitPMC(1))
     cx = computeATensorD(d1.dual(), d2)
     dstr1 = computeDATensorD(dd_id, d1)
     dstr2 = computeATensorDD(d1, dd_id)
Exemple #5
0
 def testOverslideAgreesWithDD(self):
     # This is not guaranteed (since there is choice involved in type DD for
     # overslides, but appears to work
     slides_to_test = [
         # General overslides down
         Arcslide(splitPMC(1), 3, 2),
         Arcslide(splitPMC(2), 3, 2),
         Arcslide(splitPMC(2), 4, 3),
         Arcslide(splitPMC(2), 7, 6),
         Arcslide(linearPMC(2), 3, 2),
         Arcslide(linearPMC(2), 5, 4),
         Arcslide(linearPMC(2), 7, 6),
         Arcslide(antipodalPMC(2), 5, 4),
         Arcslide(antipodalPMC(2), 6, 5),
         Arcslide(antipodalPMC(2), 7, 6),
         # General overslides up
         Arcslide(splitPMC(1), 0, 1),
         Arcslide(splitPMC(2), 0, 1),
         Arcslide(splitPMC(2), 3, 4),
         Arcslide(splitPMC(2), 4, 5),
         Arcslide(linearPMC(2), 0, 1),
         Arcslide(linearPMC(2), 2, 3),
         Arcslide(linearPMC(2), 4, 5),
         Arcslide(antipodalPMC(2), 0, 1),
         Arcslide(antipodalPMC(2), 1, 2),
         Arcslide(antipodalPMC(2), 2, 3),
     ]
     for slide in slides_to_test:
         dastr = ArcslideDA(slide)
         ddstr = dastr.tensorDD(identityDD(slide.end_pmc))
         ori_ddstr = slide.getDDStructure()
         self.assertTrue(ddstr.compareDDStructures(ori_ddstr))
Exemple #6
0
 def testAATensorDD1(self):
     pmc = splitPMC(2)
     aa_graph = getTypeAAGraph(pmc)
     ddstr1 = identityDD(pmc)
     dd_graph1 = TypeDDGraph(ddstr1, 1)
     dastr1 = aa_graph.tensorAAandDD(dd_graph1)
     self.assertTrue(dastr1.testDelta())
Exemple #7
0
 def testAntiBraidAgreesWithDDShort(self):
     for genus, c_pair in [(2, 0), (3, 0), (2, 3)]:
         dastr = AntiBraidDA(genus, c_pair)
         ddstr = dastr.tensorDD(identityDD(dastr.pmc))
         ddstr.simplify()
         ori_ddstr = AntiBraid(genus, c_pair).getDDStructure()
         self.assertTrue(ddstr.compareDDStructures(ori_ddstr))
Exemple #8
0
 def testRightCobordismDA(self):
     for genus, c_pair in [(2, 0), (2, 1), (2, 2), (2, 3),
                           (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5)]:
         c = Cobordism(genus, c_pair, RIGHT)
         c_da = CobordismDARight(c)
         ddstr = c_da.tensorDD(identityDD(c.end_pmc))
         ddstr.simplify()
         ori_ddstr = c.getDDStructure()
         self.assertTrue(ddstr.compareDDStructures(ori_ddstr))
Exemple #9
0
 def testLeftCobordismDA(self):
     for genus, c_pair in [(2, 0), (2, 1), (2, 2), (2, 3),
                           (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5)]:
         c = Cobordism(genus, c_pair, LEFT)
         c_da = CobordismDALeft(c)
         dastr = c_da.toSimpleDAStructure()
         self.assertTrue(dastr.testDelta())
         ddstr = dastr.tensorDD(identityDD(c.end_pmc))
         ori_ddstr = c.getDDStructure()
         self.assertTrue(ddstr.compareDDStructures(ori_ddstr))
Exemple #10
0
    def testDehnSurgeryAgreesWithDDShort(self):
        for genus, c_pair, orientation in [(2, 0, NEG), (2, 0, POS), (2, 3, POS)]:
            ds = DehnSurgeryDA(genus, c_pair, orientation)
            dastr = ds.getMappingCone()
            ddstr = dastr.tensorDD(identityDD(dastr.algebra1.pmc))
            ddstr.simplify(cancellation_constraint=lambda x, y: (x.filtration == y.filtration))

            ori_mor = DehnSurgery(genus, c_pair, orientation).getMorphism()
            ori_mor_cx = ori_mor.getElt().parent
            ori_ddstr = ori_mor_cx.getMappingCone(ori_mor)
            self.assertTrue(ddstr.compareDDStructures(ori_ddstr))
Exemple #11
0
    def testDDTensorAA(self):
        pmc = splitPMC(1)
        aa_graph = getTypeAAGraph(pmc)
        ddstr1 = identityDD(pmc)
        dd_graph1 = TypeDDGraph(ddstr1, 2)
        dastr1 = aa_graph.tensorDDandAA(dd_graph1)
        self.assertTrue(dastr1.testDelta())

        ddstr2 = Arcslide(pmc, 0, 1).getDDStructure()
        dd_graph2 = TypeDDGraph(ddstr2, 2)
        dastr2 = aa_graph.tensorDDandAA(dd_graph2)
        self.assertTrue(dastr2.testDelta())
Exemple #12
0
 def testSimpleCobordismDA(self):
     for pmc, insert_pos in [
             (splitPMC(1), 3),
             (splitPMC(1), 1),
     ]:
         c_da = SimpleCobordismDA(pmc, insert_pos)
         dastr = c_da.toSimpleDAStructure()
         self.assertTrue(dastr.testDelta())
         ddstr = dastr.tensorDD(identityDD(c_da.end_pmc))
         ddstr.simplify()
         ddstr.reindex()
         self.assertEquals(len(ddstr.getGenerators()), 2)
         self.assertEquals(
             sorted(len(gen.delta()) for gen in ddstr.getGenerators()),
             [2, 6])
Exemple #13
0
    def slideSeq(self, start_pmc, slides):
        # Given a sequence of arcslides tau_1, ... tau_n specified by the
        # starting PMC of tau_1 and a list of (b1, c1), compute:
        # CFDA(tau_1) * ... CFDA(tau_n) * CFDD(Id).
        assert len(slides) > 0
        slides_da = []
        for b1, c1 in slides:
            # Find the list CFDA(tau_i)
            slides_da.append(ArcslideDA(Arcslide(start_pmc, b1, c1)))
            start_pmc = slides_da[-1].pmc2

        dd = identityDD(slides_da[-1].pmc2)
        for slide_da in reversed(slides_da):
            dd = slide_da.tensorDD(dd)
            dd.reindex()
            dd.simplify()
        return dd
Exemple #14
0
 def testUnderslideAgreesWithDD(self):
     slides_to_test = [
         # Short underslides down
         Arcslide(splitPMC(1), 1, 0),
         Arcslide(linearPMC(2), 6, 5),
         Arcslide(PMC([(0, 2), (1, 6), (3, 5), (4, 7)]), 1, 0),
         # General underslides down
         Arcslide(antipodalPMC(2), 1, 0),
         Arcslide(PMC([(0, 2), (1, 4), (3, 6), (5, 7)]), 4, 3),
         # Short underslides up
         Arcslide(splitPMC(1), 1, 2),
         Arcslide(linearPMC(2), 1, 2),
         Arcslide(PMC([(0, 2), (1, 6), (3, 5), (4, 7)]), 4, 5),
         # General underslides up
         Arcslide(antipodalPMC(2), 6, 7),
         Arcslide(PMC([(0, 3), (1, 6), (2, 4), (5, 7)]), 2, 3),
     ]
     for slide in slides_to_test:
         dastr = ArcslideDA(slide)
         ddstr = dastr.tensorDD(identityDD(slide.end_pmc))
         ori_ddstr = slide.getDDStructure()
         self.assertTrue(ddstr.compareDDStructures(ori_ddstr))
Exemple #15
0
 def testTensorDandDD(self):
     d1 = zeroTypeD(1)
     dd_id = identityDD(splitPMC(1))
     dstr1 = computeATensorDD(d1, dd_id)
Exemple #16
0
    def getMorphism(self, is_admissible = False):
        id_dd = identityDD(self.start_pmc)
        anti_braid = AntiBraid(self.genus, self.c_pair)
        if not is_admissible:
            ab_dd = anti_braid.getDDStructure()
        else:
            ab_dd = anti_braid.getAdmissibleDDStructure()

        if self.orientation == NEG:
            source = id_dd
            target = ab_dd
        else:
            source = ab_dd
            target = id_dd

        morphism_cx = MorDDtoDDComplex(F2, source, target)

        all_chords = []
        for chord_type in self._getChordsList():
            all_chords.extend(chord_type())
        all_chords = [self._StrandsFromChords(chord1, chord2) for
                      chord1, chord2 in all_chords]

        morphism = E0
        alg = self.start_pmc.getAlgebra()
        assert alg.mult_one is True  # not prepared for the other case
        tensor_alg = TensorDGAlgebra((alg, alg))
        # Similar to method in DDStrFromChords
        for x in source.getGenerators():
            for y in target.getGenerators():
                for l_chord, r_chord in all_chords:
                    if l_chord.idemCompatible(x.idem1, y.idem1) and \
                       r_chord.idemCompatible(x.idem2, y.idem2):
                        a1 = StrandDiagram(alg, x.idem1, l_chord)
                        a2 = StrandDiagram(alg, x.idem2, r_chord)
                        coeff = TensorGenerator((a1, a2), tensor_alg)
                        morphism += 1*MorDDtoDDGenerator(
                            morphism_cx, x, coeff, y)

        if not is_admissible:
            return morphism

        # Additional chords to / from the new generators in the admissible
        # case.
        new_chords = []
        for i in range(2):
            new_chords.append([])

        if self.orientation == NEG:
            new_chords[0].append(
                ([(self.c2-1, self.c2)], [(self.c2-1, self.c2)]))
            if not self.is_degenerate:
                new_chords[0].append(
                    ([(self.c2-2, self.c2)], [(self.c2-2, self.c2)]))
            for y in range(self.c2+1, self.n):
                new_chords[0].append(([(self.c2-1, y)], [(self.c2-1, y)]))
                if not self.is_degenerate:
                    new_chords[0].append(([(self.c2-2, y)], [(self.c2-2, y)]))
                for x in range(0, self.c1):
                    new_chords[0].append(
                        ([(x, self.c1), (self.c2, y)], [(x, y)]))
            for x in range(0, self.c1):
                new_chords[1].append(([(x, self.c1)], [(x, self.c2)]))
        else:  # self.orientation == POS
            new_chords[1].append(
                ([(self.c1, self.c1+1)], [(self.c1, self.c1+1)]))
            if not self.is_degenerate:
                new_chords[1].append(
                    ([(self.c1, self.c1+2)], [(self.c1, self.c1+2)]))
            for x in range(0, self.c1):
                new_chords[1].append(([(x, self.c1+1)], [(x, self.c1+1)]))
                if not self.is_degenerate:
                    new_chords[1].append(([(x, self.c1+2)], [(x, self.c1+2)]))
                for y in range(self.c2+1, self.n):
                    new_chords[1].append(
                        ([(x, self.c1), (self.c2, y)], [(x, y)]))
            for x in range(self.c2+1, self.n):
                new_chords[0].append(([(self.c2, x)], [(self.c1, x)]))

        for i in range(2):
            new_chords[i] = [self._StrandsFromChords(chord1, chord2) for
                             chord1, chord2 in new_chords[i]]
            if self.orientation == NEG:
                source_gen = source.getGenerators()
                target_gen = [gen for gen in target.getGenerators()
                              if gen.name[0] == "%d" % (i+1)]
            else:  # self.orientation == POS
                source_gen = [gen for gen in source.getGenerators()
                              if gen.name[0] == "%d" % (i+1)]
                target_gen = target.getGenerators()
            for x, y in itertools.product(source_gen, target_gen):
                if self.orientation == NEG and self.c_pair not in y.idem1:
                    continue
                for l_chord, r_chord in new_chords[i]:
                    if l_chord.idemCompatible(x.idem1, y.idem1) and \
                       r_chord.idemCompatible(x.idem2, y.idem2):
                        a1 = StrandDiagram(alg, x.idem1, l_chord)
                        a2 = StrandDiagram(alg, x.idem2, r_chord)
                        coeff = TensorGenerator((a1, a2), tensor_alg)
                        morphism += 1*MorDDtoDDGenerator(
                            morphism_cx, x, coeff, y)
        return morphism
Exemple #17
0
 def testBuildTypeDDGraph(self):
     graph1 = TypeDDGraph(identityDD(splitPMC(1)), 2)