@@ -40,3 +40,117 @@ assert(f \\ h == g)
4040assert ((f\\h) * f == h)
4141assert (g // h == 0 ) -- does it always happen that this is zero if lift can't occur? Probably not
4242assert (h \\ f == 0 )
43+
44+
45+ -- tests which show that the "Reflexive" strategy doesn't always work
46+ S = QQ [x_0,x_1,x_2] -- / sum(3, i -> x_i^3)
47+ a = x_0 + x_1
48+ b = x_0^2-x_0* x_1+ x_1^2
49+ A = matrix {{x_2, a}, {b, -x_2^2}}
50+ B = matrix {{x_2^2, a}, {b, -x_2}}
51+
52+ f = map (S^2 / a, S^2 / a, A * B)
53+ f' = map (S^2 / a, S^2, A * B)
54+ g = map (S^2 / a, S^2, A)
55+ h = map (S^2 / a, S^2 / a, B)
56+ assert all ({f', f, g, h}, isWellDefined )
57+
58+ -- f does not factor through g without a remainder
59+ assert not isSubset (image homomorphism ' f, image Hom (source f, g))
60+
61+ -- here is the example
62+ q = f // g
63+ assert (isWellDefined q and q == 0 )
64+
65+ q = quotient (f, g, Strategy => Default )
66+ assert (isWellDefined q and q == 0 )
67+
68+ -- the Reflexive strategy is not applicable here
69+ assert try ( quotient (f, g, Strategy => " Reflexive" ); false ) else true
70+
71+ -- but f' does (left) factor through g
72+ assert isSubset (image homomorphism ' f, image Hom (g, target f))
73+
74+ q = g \\ f'
75+ assert isWellDefined q
76+ assert (f' == q * g)
77+ assert (h == q)
78+
79+ q = quotient '(f', g, Strategy => Default )
80+ assert isWellDefined q
81+ assert (f' == q * g)
82+ assert (h == q)
83+
84+ assert try ( quotient '(f', g, Strategy => " Reflexive" ); false ) else true
85+
86+
87+ -- this is an example where the improved "Reflexive" strategy works
88+ f = homomorphism random Hom (image (A | B), S^2)
89+ g = homomorphism random Hom (image (B | A), S^2)
90+ h = homomorphism random Hom (image (A | B), image (B | A))
91+ f = g * h
92+ assert all ({f, g}, isWellDefined )
93+
94+ -- f factors through g without a remainder
95+ assert isSubset (image homomorphism ' f, image Hom (source f, g))
96+
97+ -- here is the example
98+ q = f // g
99+ assert (isWellDefined q and f == g * q)
100+
101+ q = quotient (f, g, Strategy => Default )
102+ assert (isWellDefined q and f == g * q)
103+
104+
105+ -- this is an example where the improved "Reflexive" strategy works
106+ R = ZZ/2 [x,y,z,w]
107+ g = matrix {{x, x+ y+ z}, {x+ y+ z, z}}
108+ f = g * matrix {{y^2}, {z^2}}
109+ f = inducedMap (target f / (x+ y+ z), source f / (x+ y+ z), f)
110+ g = inducedMap (target g / (x+ y+ z), source g, g)
111+ isWellDefined f
112+ isWellDefined g
113+
114+ -- f does not factor through g without a remainder
115+ assert not isSubset (image homomorphism ' f, image Hom (source f, g))
116+
117+ q = quotient (f, g, Strategy => Default )
118+ assert (isWellDefined q and q == 0 )
119+
120+ assert try ( quotient (f, g, Strategy => " Reflexive" ); false ) else true
121+
122+ -- --
123+ clearAll
124+ B = QQ [a..d]
125+ f = prune map (B^1, image (map (B^{{-2}, 3 :{-3}}, B^{{-3}, 3 :{-4}, {-3}, 3 :{-4}, {-3}, 3 :{-4}, {-3}, 3 :{-4}}, {{a, 0 , 0 , 0 , b, 0 , 0 , 0 , c, 0 , 0 , 0 , d, 0 , 0 , 0 }, {0, a, 0 , 0 , 0 , b, 0 , 0 , 0 , c, 0 , 0 , 0 , d, 0 , 0 }, {0, 0 , a, 0 , 0 , 0 , b, 0 , 0 , 0 , c, 0 , 0 , 0 , d, 0 }, {0, 0 , 0 , a, 0 , 0 , 0 , b, 0 , 0 , 0 , c, 0 , 0 , 0 , d}})),{{a* b* c-a^2* d, a* b^3-a^3* c, a^2* c^2-a* b^2* d, a* c^3-a* b* d^2, b^2* c-a* b* d, b^4-a^2* b* c, a* b* c^2-b^3* d, b* c^3-b^2* d^2, b* c^2-a* c* d, b^3* c-a^2* c^2, a* c^3-b^2* c* d, c^4-b* c* d^2, b* c* d-a* d^2, b^3* d-a^2* c* d, a* c^2* d-b^2* d^2, c^3* d-b* d^3}})
126+ g = prune map (B^1, image (map (B^1, B^{4:{-1}}, {{a, b, c, d}})), {{a, b, c, d}})
127+ assert isSubset (image homomorphism ' f, image Hom (source f, g))
128+ elapsedTime assert (f == g * quotient (f, g, Strategy => Default ))
129+ elapsedTime assert (f == g * quotient (f, g, Strategy => " Reflexive" ))
130+
131+ -- --
132+ S = QQ [x]
133+ f = random (S^1/x, S^1/x^3)
134+ g = random (S^1/x, S^1/x^2)
135+ elapsedTime assert (f == g * quotient (f, g, Strategy => Default ))
136+ elapsedTime assert (f == g * quotient (f, g, Strategy => " Reflexive" ))
137+
138+ -- --
139+ S = QQ [x,y];
140+ M = coker matrix {{x,y},{-y,x}};
141+ g = random (M, M)
142+ f = g * random (M, M)
143+ q = quotient (f, g, Strategy => " Reflexive" )
144+ assert (isWellDefined q and f == g * q)
145+
146+ -- --
147+ S = QQ [x,y,z]
148+ M = S^{-2}
149+ N = S^{-3}
150+ P = truncate (3, S^1)
151+ h = homomorphism random (3, Hom (P, N))
152+ g = homomorphism random (0, Hom (N, M))
153+ f = g * h
154+ assert all ({f, g, h}, isWellDefined )
155+ q = quotient (f, g, Strategy => " Reflexive" )
156+ assert (isWellDefined q and f == g * q)
0 commit comments