# Singular

#### D.4.8.9 Hom

Procedure from library `homolog.lib` (see homolog_lib).

Usage:
Hom(M,N,[any]); M,N=modules

Compute:
A presentation of Hom(M',N'), M'=coker(M), N'=coker(N) as follows: let
 ``` F1 --M-> F0 -->M' --> 0, G1 --N-> G0 --> N' --> 0 ```
be presentations of M' and N'. Consider
 ``` 0 0 |^ |^ 0 --> Hom(M',N') ----> Hom(F0,N') ----> Hom(F1,N') |^ |^ (A: induced by M) Hom(F0,G0) --A-> Hom(F1,G0) |^ |^ (B,C:induced by N) |C |B Hom(F0,G1) ----> Hom(F1,G1) ```
Let D=modulo(A,B) and Hom=modulo(D,C), then we have exact sequences
 ``` R^p --D-> Hom(F0,G0) --A-> Hom(F1,G0)/im(B), R^q -Hom-> R^p --D-> Hom(F0,G0)/im(C) --A-> Hom(F1,G0)/im(B). ```
Hence Hom presents Hom(M',N')

Return:
module Hom, a presentation of Hom(M',N'), resp., in case of 3 arguments, a list l (of size <=3):
 ``` - l[1] = Hom - l[2] = SB of Hom - l[3] = kbase of coker(Hom) (if finite dimensional, not 0), represented by elements in Hom(F0,G0) via mapping D ```

Display:
printlevel >=0: (affine) dimension of Hom (default)
printlevel >=1: D and C and kbase of coker(Hom) in Hom(F0,G0)
printlevel >=2: elements of kbase of coker(Hom) as matrix :F0-->G0

Note:
DISPLAY is as described only for a direct call of 'Hom'. Calling 'Hom' from another proc has the same effect as decreasing printlevel by 1.

Example:
 ```LIB "homolog.lib"; int p = printlevel; printlevel= 1; //in 'example proc' printlevel has to be increased by 1 ring r = 0,(x,y),dp; ideal i = x2-y3,xy; qring q = std(i); ideal i = fetch(r,i); module M = [-x,y],[-y2,x],[x3]; module H = Hom(M,i); ==> // dimension of Hom: 0 ==> // vdim of Hom: 5 ==> ==> // given F1 --M-> F0 -->M'--> 0 and G1 --N-> G0 -->N'--> 0, ==> // show D = ker( Hom(F0,G0) --> Hom(F1,G0)/im(Hom(F1,G1)->Hom(F1,G0)) ) ==> y,x, 0, ==> x,y2,x2 ==> // show C = im ( Hom(F0,G1) --> Hom(F0,G0) ) ==> -y3+x2,0, xy,0, ==> 0, -y3+x2,0, xy ==> print(H); ==> 0, x, 0,y2,0, ==> y, 0, 0,-x,x2, ==> -1,-1,x,0, 0 printlevel= 2; list L = Hom(M,i,1);""; ==> // dimension of Hom: 0 ==> // vdim of Hom: 5 ==> ==> // given F1 --M-> F0 -->M'--> 0 and G1 --N-> G0 -->N'--> 0, ==> // show D = ker( Hom(F0,G0) --> Hom(F1,G0)/im(Hom(F1,G1)->Hom(F1,G0)) ) ==> y,x, 0, ==> x,y2,x2 ==> // show C = im ( Hom(F0,G1) --> Hom(F0,G0) ) ==> -y3+x2,0, xy,0, ==> 0, -y3+x2,0, xy ==> ==> // element 1 of kbase of Hom in Hom(F0,G0) as matrix: F0-->G0: ==> y2,xy ==> // element 2 of kbase of Hom in Hom(F0,G0) as matrix: F0-->G0: ==> y,x ==> // element 3 of kbase of Hom in Hom(F0,G0) as matrix: F0-->G0: ==> x2,xy2 ==> // element 4 of kbase of Hom in Hom(F0,G0) as matrix: F0-->G0: ==> x,y2 ==> // element 5 of kbase of Hom in Hom(F0,G0) as matrix: F0-->G0: ==> 0,x2 ==> printlevel=1; ring s = 3,(x,y,z),(c,dp); ideal i = jacob(ideal(x2+y5+z4)); qring rq=std(i); matrix M[2][2]=xy,x3,5y,4z,x2; matrix N[3][2]=x2,x,y3,3xz,x2z,z; print(M); ==> xy,x3, ==> -y,z print(N); ==> x2, x, ==> y3, 0, ==> x2z,z list l=Hom(M,N,1); ==> // dimension of Hom: 0 ==> // vdim of Hom: 16 ==> ==> // given F1 --M-> F0 -->M'--> 0 and G1 --N-> G0 -->N'--> 0, ==> // show D = ker( Hom(F0,G0) --> Hom(F1,G0)/im(Hom(F1,G1)->Hom(F1,G0)) ) ==> 0,0, 0,0, 0, 0,0, 1, ==> 0,0, 0,0, 0, 0,y3z2,0, ==> 0,0, 0,0, 0, 1,0, 0, ==> 0,0, 0,y3,y2z2,0,0, 0, ==> 0,0, 1,0, 0, 0,0, 0, ==> z,y3,0,0, 0, 0,0, 0 ==> // show C = im ( Hom(F0,G1) --> Hom(F0,G0) ) ==> x2, 0, x,0, ==> 0, x2, 0,x, ==> y3, 0, 0,0, ==> 0, y3, 0,0, ==> x2z,0, z,0, ==> 0, x2z,0,z ==> ==> // columns of matrix are kbase of Hom in Hom(F0,G0) ==> 0, 0, 0, 0,0,0, 0, 0, 0, 0, 0, 0,0, 0,0,0, ==> 0, 0, 0, 0,0,0, 0, 0, 0, 0, 0, 0,0, 0,0,y3z2, ==> 0, 0, 0, 0,0,0, y2z2,yz2,z2,y2z,yz,z,y2,y,1,0, ==> 0, 0, 0, 0,0,y2z2,0, 0, 0, 0, 0, 0,0, 0,0,0, ==> 0, y3,y2,y,1,0, 0, 0, 0, 0, 0, 0,0, 0,0,0, ==> y3,0, 0, 0,0,0, 0, 0, 0, 0, 0, 0,0, 0,0,0 printlevel = p; ```