def test2(): D=Diagram() P1=Object(D,'P1') P1.latex='P_1' P2=Object(D,'P2') P1.latex='P_1' id1=Identity(P1) id2=Identity(P2) P1xP2=Object(D,'P1xP2') P1xP2.latex="P_1 \oplus P_2" idprod=Identity(P1xP2) i1=Morphism(P1,P1xP2,'i1') i2=Morphism(P2,P1xP2,'i2') CoProductProperty(i1,i2) B=Object(D,'B') C=Object(D,'C') pi=Morphism(B,C) f=Morphism(P1xP2,C) Epimorphism(pi) pi.latex=r"\pi" f.latex=r"\varphi" Projective(P1) Projective(P2) P1.gridpos=(0,0) P2.gridpos=(0,2) P1xP2.gridpos=(0,1) B.gridpos=(1,1) C.gridpos=(2,1) P1.latex='P_1' P2.latex='P_2' P1xP2.latex='P_1 \oplus P_2' B.latex='B' C.latex='C' SRM = SimpleRuleMaster(D,maxMorphisms=1) diagSequence=[] while(True): result=SRM(numberOfExtensions=10,verbose=False,printlatex=True) if (result==False): break diagSequence.append(result) print processDiagSequence(diagSequence) return D
def test(): '''tests projective property''' D=Diagram() P=Object(D,'P') B=Object(D,'B') C=Object(D,'C') pi=Morphism(B,C) f=Morphism(P,C) Epimorphism(pi) pi.latex=r"\pi" f.latex=r"\varphi" Projective(P) f=Morphism(P,B) SRM = SimpleRuleMaster(D) for i in xrange(10): SRM(verbose=True) return D
def test(): '''constructs and displays all products of two objects''' D = Diagram() X = Object(D,"X") Y = Object(D,"Y") f1 = Morphism(X,Y,"f1") f1.name="f1" f1.latex=r"\phi" rule=ExistProduct homs=HomomorphismIterator(rule.CD,D) ers=[] for hom in homs: ers.append(ExtensionRequest(rule,hom)) for ER in ers: ER.implement() return D