Problems with quotient modules (AbstractAlgebra)

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.

julia> preimage(h, gens(Q)[1])
(0, 1, 0)

julia> preimage(h, gens(Q)[2])
(0, 0, 1)

so these two elements (more precisely the images of these two elements) is “the” basis of Q = F/<s>. Now if you take the element (2, 3, 4) and reduce modulo s, you get (0, -1, -2), which has coordinates (-1, -2) with respect to the basis of Q. (Here reducing means substracting 2*s).

Thanks again for your new contribution. I need some time to read, assimilate and possibly understand it. For now things are not clear.
I’ll write later, hopefully to say that everything is OK.

OK I’ve got it.
I was blocked by the word ‘preimage’ in French we use instead ‘antecedent’ (which is before).
I understand your example now I will try with a plane for S, consequently Q should be a straight line.
I come back to you after achievement

I think I have it now here’s a second example :

using AbstractAlgebra

F = FreeModule(ZZ, 3)
@show F
v=F([1,2,3])
w=F([1,1,0])
@show v
S,f=sub(F,[v,w])
@show S
@show f
Q, h = quo(F, S)
@show gens(Q)
t=F([1,1,1])
n=Q(t)
@show n
u=preimage(h,gen(Q,1))
@show u

we get 1 for n given that u=(0,0,1) and reducing t by t-w which incidentally is exactly u.
The thing is that any strict subspace cannot contain all the canonical base and you can take as preimages a certain number of them (according dimensions and respective positions). Simply the rule of such choice is not explicit.
Thanks again for your time and attention.