def get_edge_image(self,item): if self.edgeMap.has_key(item): return self.edgeMap[item] elif len(item.Composition)>1: iterator = item.iterComposingMorphisms() morphi = self.edgeMap[next(iterator)] if isMorphismZero(morphi): return GiveZeroMorphism(self.nodeMap[item.source],self.nodeMap[item.target]).equivalenceClass() for atomic in iterator: #inefficient #it just got even more inefficient atomicimage = self.edgeMap[atomic] if isMorphismZero(atomicimage): return GiveZeroMorphism(self.nodeMap[item.source],self.nodeMap[item.target]).equivalenceClass() morphi = morphi.compose(atomicimage) return morphi elif isinstance(item,Identity): return getIdentity(self.edgeMap[item.source])
def implement(self): '''carry out the pushout of the Extension Meta-Diagram''' #Extend hom to a lift of the extension to the main Diagram lift = self.hom*self.rule.partialInverse #inefficient for obj in self.rule.newObjects: try: names=[] for s in obj.namescheme[1]: obj_item = self.charDiag[s] if isinstance(obj_item,Object): names.append(self.hom[self.charDiag[s]].name) else:#morphism names.append(self.hom.get_edge_image(self.charDiag[s]).representative.name) newname=obj.namescheme[0].format(*names) newobj = Object(self.mainDiag,newname) #try naming according to scheme except: try: newobj=Object(self.mainDiag,self.mainDiag.giveName(mode=newname)) #append a number to name if this failed except: newobj = Object(self.mainDiag) #give a generic name if everything fails latexlist=[] try: for s in obj.latexscheme[1]: try: try: latexlist.append(self.hom[self.charDiag[s]].latex) except: latexlist.append(self.hom[self.charDiag[s]].name) except: try: latexlist.append(self.hom.edgeMap[self.charDiag.Morphisms[s]].latex) except: latexlist.append(self.hom.edgeMap[self.charDiag.Morphisms[s]].name) newobj.latex=obj.latexscheme[0].format(*latexlist) #set LaTeX display string except: newobj.latex=newobj.name lift.set_node_image(obj,newobj) for morphi in self.rule.newMorphisms: source = lift[morphi.source] target = lift[morphi.target] if isinstance(morphi,Identity): newmorphi = getIdentity(source) elif isMorphismZero(morphi): newmorphi = GiveZeroMorphism(source,target) else: newmorphi = Morphism(source,target) #do not implement nameschemes for morphisms for now latexlist=[] try: for s in morphi.latexscheme[1]: try: try: latexlist.append(self.hom[self.charDiag[s]].latex) except: latexlist.append(self.hom[self.charDiag[s]].name) except: try: latexlist.append(self.hom.edgeMap[self.charDiag[s]].representative.latex) except: latexlist.append(self.hom.edgeMap[self.charDiag[s]].representative.name) newmorphi.latex=morphi.latexscheme[0].format(*latexlist) #set LaTeX display string except: pass lift.set_edge_image(morphi,self.mainDiag.CommutativityQuotient.get_edge_image(newmorphi)) #compose characteristic homomorphism of property with lift to get #characteristic homomorphism in the extended main Diagram #for commutativity classes, just choose an arbitrary section for prop in self.rule.newProperties: prop.push_forward(lift)
def get_edge_image(self,item): res = Homomorphism.get_edge_image(self,item) if res is not None: return res if isinstance(item,Identity): return getIdentity(self.edgeMap[item.source])