# Duals and Injectives

If $k$ is the base ring for the algebra $A$ then the $k$-dual $\hbox{Hom}_k(M,k)$ for a right module $M$ over $A$ is a right module over the opposite algebra $OA$ of $A$. Furthermore, the dual of a projective $OA$-module is an injective $A$-module and the dual of a projective $OA$-resolution of a module $M$ is an $A$-injective resolution of the dual of $M$.

## `Dual(M): ModAlg -> ModAlg`

Given a module $M$ defined over a basic algebra $M$, this function returns the dual of $M$ as a module over the opposite of the algebra of $M$. Note that the opposite of the algebra of $M$ is created if it does not already exist.

## `BaseChangeMatrix(A): AlgBas -> ModAlg`

Given a basic algebra $A$ that has opposite algebra $O$, the function creates the change of basis matrix $B$ from the vector space of $A$ to the vector space of $O$, so that if $x$, $y$ are in $A$ then $(xy)B$ is the same as $(yB)(xB) \in O$.

## Injective Modules

Injective hulls, and injective resolutions of a module are computed by taking the projective cover or projective resolution of the dual module over the opposite algebra and then again taking the dual to retrieve modules or complexes over the original algebra. If the opposite algebra of the module has not been computed then it will be created in the evaluation of any of the injective module functions.

### `InjectiveModule(B, i): AlgBas, RngIntElt -> ModAlg`

The $i^{th}$ injective module of the algebra $B$.

### `InjectiveHull(M): ModAlg -> ModAlg, ModMatFldElt, SeqEnum[ModMatFldElt], SeqEnum[ModMatFldElt], SeqEnum[RngIntElt]`

The injective hull of the module $M$ is the injective module $I$ of minimal dimension such that there is an inclusion $\iota: M \rightarrow I$. The function returns $I$, $\iota$, the sequences of inclusions and projections from and to the indecomposable injective summands of $I$, and the type of $I$ as a sequence $T := [t_1 \ldots, t_s]$ where $I$ has $t_1$ summands of type  1, $t_2$ of type  2, etc.

### `InjectiveResolution(M, n): ModAlg, RngIntElt -> ModCpx, ModMatFldElt`

The complex giving the minimal injective resolution of the module $M$ together with the inclusion homomorphism from $M$ into its injective hull. Note that homomorphisms go from left to right so that the kernel of the first homomorphism in the complex is $M$. The function computes the compact injective resolution and creates the complex of the injective resolution from that.

### `CompactInjectiveResolution(M, n): ModAlg, RngIntElt -> Rec`

A minimal injective resolution for the module $M$ out to $n$ steps in compact form together with the coaugmentation map ($M \rightarrow I_0$). The compact form of the resolution is a list of the minimal pieces of information needed to reconstruct the boundary maps in the resolution. That is, the boundary map ($I_{i-1} \xrightarrow{\partial_i} I_i$) is recorded as a matrix whose entries are the images of the generators for indecomposable injective modules making up $I_{i-1}$ in the indecomposable projective modules making up $I_i$. The actual return of the function is the compact projective resolution of the dual module of $M$ over the opposite algebra of the algebra of $M$. The return is a record with the fields:

**(a)**
The list of isomorphism types of the injective modules in the resolution, each given as a sequence of integers giving the number of direct summands of each indecomposable injective in the module (field name `BettiNumbers`).

**(b)**
The record of the boundary maps (field name `ResolutionRecord`).

**(c)**
The module $M$ (field name `Module`).

**(d)**
The coaugmentation map (field name `CoaugmentationMap`).

**(e)**
The type of the resolution, whether projective or injective (field name `Typ`).

### `InjectiveSyzygyModule(M, n): ModAlg, RngIntElt -> ModAlg`

The $n^{th}$ injective-syzygy module of $M$. The module is constructed from the compact injective resolution of $M$. The compact resolution is constructed if it does not already exist.

### `SimpleCohomologyDimensions(M): ModAlg -> SeqEnum`

The sequence of sequences of dimensions of the cohomology groups $\hbox{Ext}^j(S_i,M)$ for simple modules $S_i$ and module $M$, to the extent that they have been computed.

### `Example: Opposite (ex-51e2ac)`

We create the basic algebra of a quiver over a field with 8 elements. The quiver has two nodes and three arrows, going from node 1 to node 2, from 2 to 1 and from 1 to 1. The relations are given in the sequence `rrr`.

```magma
> ff := GF(8);
> FA<e1,e2,a,b,c> := FreeAlgebra(ff,5);
> rrr := [a*b*a*b*a, c*c*c*c, a*b*c - c*a*b];
> B := BasicAlgebra(FA,rrr,2,[<1,2>,<2,1>,<1,1>]);
> B;
Basic algebra of dimension 41 over GF(2^3)
Number of projective modules: 2
Number of generators: 5
> DimensionsOfProjectiveModules(B);
[ 20, 21 ]
> DimensionsOfInjectiveModules(B);
[ 24, 17 ]
> P1 := ProjectiveModule(B,1);
> Socle(P1);
AModule of dimension 1 over GF(2^3)

```

We consider the injective resolution of the first projective module.

```magma
> time in1 := CompactInjectiveResolution(P1,10);
reverse trees
Time: 3.850

```

Note that part of the time was required to create the opposite algebra of `B`.

```magma
> SimpleCohomologyDimensions(P1);
[
    [ 1, 0 ],
    [ 0, 4 ],
    [ 4, 0 ],
    [ 4, 0 ],
    [ 4, 0 ],
    [ 4, 0 ],
    [ 4, 0 ],
    [ 4, 0 ],
    [ 4, 0 ],
    [ 4, 0 ]
]

```

The injective resolution appears to be periodic. Now we look at a module constructed from the resolution.

```magma
> M := InjectiveSyzygyModule(P1,6);
> M;
AModule M of dimension 64 over GF(2^3)

```

Consider the space of endomorphisms of M.

```magma
> hh := AHom(M,M);
> hh;
KMatrixSpace of 64 by 64 matrices and dimension 128 over GF(2^3)
> [Rank(hh.i): i in [1 .. Dimension(hh)]];
[ 16, 16, 16, 16, 12, 12, 12, 12, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 6, 6, 4, 4, 4,
4, 4, 4, 4, 4, 2, 2, 2, 2, 4, 8, 12, 16, 16, 12, 8, 4, 8, 4, 12, 16, 4, 8, 12,
16, 16, 16, 16, 16, 2, 4, 6, 8, 8, 6, 4, 2, 4, 2, 6, 8, 2, 4, 6, 8, 12, 12, 12,
12, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 16,
16, 16, 16, 12, 12, 12, 12, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 6, 6, 4, 4, 4, 4, 4,
4, 4, 4, 2, 2, 2, 2 ]

```

Note that no generator of the endomorphism ring has rank more than 16. This would indicate that the module is decomposable since the identity map must be a sum of homomorphisms of smaller rank.

How can we produce a decomposition? One method is the following.

```magma
> vv := Random(hh);
> Rank(vv);
64
> vv*vv eq vv;
false
> [Rank(vv*vv-u*vv):u in ff];
[ 60, 64, 64, 64, 64, 64, 64, 64 ]
> [u:u in ff];
[ 1, ff.1, ff.1^2, ff.1^3, ff.1^4, ff.1^5, ff.1^6, 0 ]
> Rank(vv*vv - vv);
60
> U := vv*vv - vv;
> Rank(U);
60
> Rank(U*U);
56
> Rank(U*U*U);
52
> Rank(U*U*U*U);
48
> Rank(U*U*U*U*U);
48
> Rank(U*U*U*U*U*U);
48
> T := U*U*U*U;
> N1 := Kernel(T);
> N2 := Image(T);
> Dimension(N1);
16
> Dimension(N2);
48
> Dimension(N1+N2);
64

```

So the sum of `N1` and `N2` must be all of `M` and by counting dimensions, it must be a direct sum.
