# Homsets of finitely presented graded modules#

AUTHORS:

• Robert R. Bruner, Michael J. Catanzaro (2012): Initial version.

• Sverre Lunoee–Nielsen and Koen van Woerden (2019-11-29): Updated the original software to Sage version 8.9.

• Sverre Lunoee–Nielsen (2020-07-01): Refactored the code and added new documentation and tests.

class sage.modules.fp_graded.homspace.FPModuleHomspace(X, Y, category=None, base=None, check=True)#

Bases: `Homset`

Element#

alias of `FPModuleMorphism`

an_element(n=0)#

Create a homomorphism belonging to `self`.

INPUT:

• `n` – (default: 0) an integer degree

OUTPUT:

A module homomorphism of degree `n`.

EXAMPLES:

```sage: from sage.modules.fp_graded.module import FPModule
sage: A = SteenrodAlgebra(2)
sage: HZ = FPModule(A, [0], relations=[[Sq(1)]])

sage: Hom(HZ, HZ).an_element(3)
Module endomorphism of Finitely presented left module on 1 generator and 1 relation over mod 2 Steenrod algebra, milnor basis
Defn: g[0] |--> Sq(0,1)*g[0]
```
basis_elements(n)#

Return a basis for the free module of degree `n` morphisms.

INPUT:

• `n` – an integer degree

OUTPUT:

A basis for the set of all module homomorphisms of degree `n`.

EXAMPLES:

```sage: from sage.modules.fp_graded.module import FPModule
sage: A = SteenrodAlgebra(2)
sage: Hko = FPModule(A, [0], relations=[[Sq(2)], [Sq(1)]])

sage: Hom(Hko, Hko).basis_elements(21)
[Module endomorphism of Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis
Defn: g[0] |--> (Sq(0,0,3)+Sq(0,2,0,1))*g[0],
Module endomorphism of Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis
Defn: g[0] |--> Sq(8,2,1)*g[0]]
```
identity()#

Return the identity homomorphism.

EXAMPLES:

```sage: from sage.modules.fp_graded.module import FPModule
sage: A2 = SteenrodAlgebra(2, profile=(3,2,1))
sage: L = FPModule(A2, [2,3], [[Sq(2),Sq(1)], [0,Sq(2)]])

sage: one = Hom(L, L).identity(); one
Module endomorphism of Finitely presented left module on 2 generators and 2 relations over sub-Hopf algebra of mod 2 Steenrod algebra, milnor basis, profile function [3, 2, 1]
Defn: g[2] |--> g[2]
g[3] |--> g[3]

sage: e = L.an_element(5)
sage: e == one(e)
True
```

It is an error to call this function when the homset is not a set of endomorphisms:

```sage: F = FPModule(A2, [1,3])
sage: Hom(F,L).identity()
Traceback (most recent call last):
...
TypeError: this homspace does not consist of endomorphisms
```

An example with free graded modules:

```sage: A2 = SteenrodAlgebra(2, profile=(3,2,1))
sage: H = Hom(L, L)
sage: H.identity()
Module endomorphism of Free graded left module on 2 generators
over sub-Hopf algebra of mod 2 Steenrod algebra, milnor basis, profile function [3, 2, 1]
Defn: g[2] |--> g[2]
g[3] |--> g[3]
```
zero()#

Create the trivial homomorphism in `self`.

EXAMPLES:

```sage: from sage.modules.fp_graded.module import FPModule
sage: A2 = SteenrodAlgebra(2, profile=(3,2,1))
sage: F = FPModule(A2, [1,3])
sage: L = FPModule(A2, [2,3], [[Sq(2),Sq(1)], [0,Sq(2)]])

sage: z = Hom(F, L).zero()
sage: z(F.an_element(5))
0
sage: z(F.an_element(23))
0
```

Example with free modules:

```sage: A2 = SteenrodAlgebra(2, profile=(3,2,1))