Hi everybody !
Here’s the ‘coercions’ paragraph of the ‘modules’ chapter of AbstractAlgebra package doc.
https://nemocas.github.io/AbstractAlgebra.jl/dev/module/
Coercions
Given a module M and an element n of a module N, it is possible to coerce n into M using the notation M(n) in certain circumstances.
In particular the element n will be automatically coerced along any canonical injection of a submodule map and along any canonical projection of a quotient map. There must be a path from N to M along such maps.
Examples
F = FreeModule(ZZ, 3)
S1, f = sub(F, [rand(F, -10:10)])
S, g = sub(F, [rand(F, -10:10)])
Q, h = quo(F, S)
m = rand(S1, -10:10)
n = Q(m)
I cannot say that it is perfectly clear, so I decided to write a few lines of code to make it clear (at least for me…)
Here is this test code :
using AbstractAlgebra
F = FreeModule(ZZ, 3)
@show F
v=F([1,2,3])
@show v
S,f=sub(F,[v])
@show S
@show f
w=S([ZZ(2)]) # S([2]) not accepted !!!
@show w
w1=f(w)
@show w1
Q, h = quo(F, S)
@show gens(Q) # shows canonical basis of z^2
v1=F([2,3,4])
n=Q(v1)
@show n
here’s the output :
F = Free module of rank 3 over Integers
v = (1, 2, 3)
S = Submodule over Integers with 1 generator and no relations
f = Module homomorphism with
Domain: Submodule over Integers with 1 generator and no relations
Codomain: F
w = (2)
w1 = (2, 4, 6)
gens(Q) = AbstractAlgebra.Generic.QuotientModuleElem{BigInt}[(1, 0), (0, 1)]
n = (-1, -2)
Of course if I take for w1 any multiple of (1,2,3) result for n will be logically (0,0) . Of course a pair is expected since the rank of the quotient is 2 BUT here I took on purpose (1,1,1)+(1,2,3) so that the image by h of w1 is the same as that of (1,1,1).
How to explain this result (-1,-2). As far as I know the quotient is isomorphic to any supplementary subspace of S, but there’s no canonical basis for this.
Can anybody explain to me where this (-1,-2) comes from ?
Thank you.