|
| 1 | +from sage.misc.lazy_attribute import lazy_attribute |
| 2 | + |
| 3 | +from sage.categories.modules import Modules |
| 4 | +from sage.categories.category_types import Category_over_base_ring |
| 5 | +from sage.categories.homsets import Homsets |
| 6 | +from sage.rings.polynomial.ore_polynomial_ring import OrePolynomialRing |
| 7 | + |
| 8 | + |
| 9 | +class OreModules(Category_over_base_ring): |
| 10 | + r""" |
| 11 | + Category of Ore modules. |
| 12 | + """ |
| 13 | + @staticmethod |
| 14 | + def __classcall_private__(cls, ring, twist): |
| 15 | + r""" |
| 16 | + Normalize the input and call the init function. |
| 17 | +
|
| 18 | + INPUT: |
| 19 | +
|
| 20 | + - ``ring`` -- a commutative ring, the base ring of |
| 21 | + the Ore modules |
| 22 | +
|
| 23 | + - ``twist`` -- a twisting morphism/derivation or a |
| 24 | + Ore polynomial ring |
| 25 | +
|
| 26 | + TESTS:: |
| 27 | +
|
| 28 | + sage: from sage.categories.ore_modules import OreModules |
| 29 | + sage: K.<a> = GF(5^3) |
| 30 | + sage: Frob = K.frobenius_endomorphism() |
| 31 | + sage: cat = OreModules(K, Frob) |
| 32 | + sage: cat |
| 33 | + Category of Ore modules over Finite Field in a of size 5^3 twisted by a |--> a^5 |
| 34 | +
|
| 35 | + sage: S = cat.ore_ring('y') |
| 36 | + sage: cat is OreModules(K, S) |
| 37 | + True |
| 38 | + """ |
| 39 | + if isinstance(twist, OrePolynomialRing): |
| 40 | + ore = twist.change_var('x') |
| 41 | + if ore.base_ring() is not ring: |
| 42 | + raise ValueError("base rings do not match") |
| 43 | + else: |
| 44 | + ore = OrePolynomialRing(ring, twist, names='x', polcast=False) |
| 45 | + return cls.__classcall__(cls, ore) |
| 46 | + |
| 47 | + def __init__(self, ore): |
| 48 | + r""" |
| 49 | + Initialize this category. |
| 50 | +
|
| 51 | + TESTS:: |
| 52 | +
|
| 53 | + sage: from sage.categories.ore_modules import OreModules |
| 54 | + sage: K.<a> = GF(5^3) |
| 55 | + sage: Frob = K.frobenius_endomorphism() |
| 56 | + sage: cat = OreModules(K, Frob) |
| 57 | +
|
| 58 | + sage: TestSuite(cat).run() |
| 59 | + """ |
| 60 | + base = ore.base_ring() |
| 61 | + Category_over_base_ring.__init__(self, base) |
| 62 | + self._ore = ore |
| 63 | + |
| 64 | + def __reduce__(self): |
| 65 | + r""" |
| 66 | + Return the arguments which were used to create this instance. |
| 67 | +
|
| 68 | + This method is needed for pickling. |
| 69 | +
|
| 70 | + TESTS:: |
| 71 | +
|
| 72 | + sage: from sage.categories.ore_modules import OreModules |
| 73 | + sage: K.<a> = GF(5^3) |
| 74 | + sage: Frob = K.frobenius_endomorphism() |
| 75 | + sage: cat = OreModules(K, Frob) |
| 76 | + sage: cat2 = loads(dumps(cat)) # indirect doctest |
| 77 | + sage: cat is cat2 |
| 78 | + True |
| 79 | + """ |
| 80 | + return OreModules, (self.base_ring(), self._ore) |
| 81 | + |
| 82 | + def super_categories(self): |
| 83 | + r""" |
| 84 | + Return the immediate super categories of this category. |
| 85 | +
|
| 86 | + EXAMPLES:: |
| 87 | +
|
| 88 | + sage: from sage.categories.ore_modules import OreModules |
| 89 | + sage: K.<a> = GF(5^3) |
| 90 | + sage: Frob = K.frobenius_endomorphism() |
| 91 | + sage: cat = OreModules(K, Frob) |
| 92 | + sage: cat.super_categories() |
| 93 | + [Category of vector spaces over Finite Field in a of size 5^3] |
| 94 | + """ |
| 95 | + return [Modules(self.base())] |
| 96 | + |
| 97 | + def _repr_object_names(self): |
| 98 | + r""" |
| 99 | + Return a string representation naming the objects |
| 100 | + in this category. |
| 101 | +
|
| 102 | + EXAMPLES:: |
| 103 | +
|
| 104 | + sage: from sage.categories.ore_modules import OreModules |
| 105 | + sage: K.<a> = GF(5^3) |
| 106 | + sage: Frob = K.frobenius_endomorphism() |
| 107 | + sage: cat = OreModules(K, Frob) |
| 108 | + sage: cat._repr_object_names() |
| 109 | + 'Ore modules over Finite Field in a of size 5^3 twisted by a |--> a^5' |
| 110 | + """ |
| 111 | + return "Ore modules over %s %s" % (self.base_ring(), self._ore._repr_twist()) |
| 112 | + |
| 113 | + def ore_ring(self, var='x'): |
| 114 | + r""" |
| 115 | + Return the underlying Ore polynomial ring. |
| 116 | +
|
| 117 | + INPUT: |
| 118 | +
|
| 119 | + - ``var`` (default; ``x``) -- the variable name |
| 120 | +
|
| 121 | + EXAMPLES:: |
| 122 | +
|
| 123 | + sage: from sage.categories.ore_modules import OreModules |
| 124 | + sage: K.<a> = GF(5^3) |
| 125 | + sage: Frob = K.frobenius_endomorphism() |
| 126 | + sage: cat = OreModules(K, Frob) |
| 127 | + sage: cat.ore_ring() |
| 128 | + Ore Polynomial Ring in x over Finite Field in a of size 5^3 twisted by a |--> a^5 |
| 129 | +
|
| 130 | + sage: cat.ore_ring('y') |
| 131 | + Ore Polynomial Ring in y over Finite Field in a of size 5^3 twisted by a |--> a^5 |
| 132 | + """ |
| 133 | + return self._ore.change_var(var) |
| 134 | + |
| 135 | + def twisting_morphism(self): |
| 136 | + r""" |
| 137 | + Return the underlying twisting morphism. |
| 138 | +
|
| 139 | + EXAMPLES:: |
| 140 | +
|
| 141 | + sage: from sage.categories.ore_modules import OreModules |
| 142 | + sage: K.<a> = GF(5^3) |
| 143 | + sage: Frob = K.frobenius_endomorphism() |
| 144 | + sage: cat = OreModules(K, Frob) |
| 145 | + sage: cat.twisting_morphism() |
| 146 | + Frobenius endomorphism a |--> a^5 on Finite Field in a of size 5^3 |
| 147 | +
|
| 148 | + If the twising morphism is the identity, nothing is returned:: |
| 149 | +
|
| 150 | + sage: R.<t> = QQ[] |
| 151 | + sage: d = R.derivation() |
| 152 | + sage: cat = OreModules(R, d) |
| 153 | + sage: cat.twisting_morphism() |
| 154 | + """ |
| 155 | + return self._ore.twisting_morphism() |
| 156 | + |
| 157 | + def twisting_derivation(self): |
| 158 | + r""" |
| 159 | + Return the underlying twisting derivation. |
| 160 | +
|
| 161 | + EXAMPLES:: |
| 162 | +
|
| 163 | + sage: from sage.categories.ore_modules import OreModules |
| 164 | + sage: R.<t> = QQ[] |
| 165 | + sage: d = R.derivation() |
| 166 | + sage: cat = OreModules(R, d) |
| 167 | + sage: cat.twisting_derivation() |
| 168 | + d/dt |
| 169 | +
|
| 170 | + If the twising derivation is zero, nothing is returned:: |
| 171 | +
|
| 172 | + sage: K.<a> = GF(5^3) |
| 173 | + sage: Frob = K.frobenius_endomorphism() |
| 174 | + sage: cat = OreModules(K, Frob) |
| 175 | + sage: cat.twisting_derivation() |
| 176 | + """ |
| 177 | + return self._ore.twisting_derivation() |
0 commit comments