# Algebra Homomorphisms

Singular.jl allows the creation of algebra homomorphisms of Singular polynomial rings over Nemo/Singular coefficient rings.

The default algebra homomorphism type in Singular.jl is the Singular `SAlgHom`

type.

Additionally, a special type for the identity homomorphism has been implemented. The type in Singular.jl for the latter is `SIdAlgHom`

.

All algebra homomorphism types belong directly to the abstract type `AbstractAlgebraHomomorphism{T}`

.

## Algebra Homomorphism functionality

### Constructors

Given two Singular polynomial rings $R$ and $S$ over the same base ring, the following constructors are available for creating algebra homomorphisms.

`Singular.AlgebraHomomorphism`

— Method`AlgebraHomomorphism(D::PolyRing, C::PolyRing, V::Vector)`

Constructs an algebra homomorphism $f: D \to C$, where the $i$-th variable of $D$ is mapped to the $i$-th entry of $V$. $D$ and $C$ must be polynomial rings over the same base ring.

`Singular.IdentityAlgebraHomomorphism`

— Method`IdentityAlgebraHomomorphism(R::PolyRing)`

Constructs the canonical identity algebra homomorphism $id: D \to D$, where the $i$-th variable of $D$ is mapped to itself.

**Examples**

```
L = FiniteField(3, 2, String("a"))
R, (x, y, z, w) = PolynomialRing(L[1], ["x", "y", "z", "w"];
ordering=:negdegrevlex)
S, (a, b, c) = PolynomialRing(L[1], ["a", "b", "c"];
ordering=:degrevlex)
V = [a, a + b^2, b - c, c + b]
f = AlgebraHomomorphism(R, S, V)
```

### Operating on objects

It is possible to act on polynomials and ideals via algebra homomorphisms.

**Examples**

```
R, (x, y, z, w) = PolynomialRing(Nemo.ZZ, ["x", "y", "z", "w"];
ordering=:negdegrevlex)
S, (a, b, c) = PolynomialRing(Nemo.ZZ, ["a", "b", "c"];
ordering=:degrevlex)
V = [a, a + b^2, b - c, c + b]
f = AlgebraHomomorphism(R, S, V)
id = IdentityAlgebraHomomorphism(S)
J = Ideal(R, [x, y^3])
p = x + y^3 + z*w
K = f(J)
q = f(p)
```

### Composition

`AbstractAlgebra.compose`

— Method```
compose(f::AbstractAlgebra.Map(Singular.SAlgHom),
g::AbstractAlgebra.Map(Singular.SAlgHom))
```

Returns an algebra homomorphism $h: domain(f) \to codomain(g)$, where $h = g(f)$.

A short command for the composition of $f$ and $g$ is `f*g`

, which is the same as `compose(f, g)`

.

**Examples**

```
R, (x, y, z, w) = PolynomialRing(QQ, ["x", "y", "z", "w"];
ordering=:negdegrevlex)
S, (a, b, c) = PolynomialRing(QQ, ["a", "b", "c"];
ordering=:degrevlex)
V = [a, a + b^2, b - c, c + b]
W = [x^2, x + y + z, z*y]
f = AlgebraHomomorphism(R, S, V)
g = AlgebraHomomorphism(S, R, W)
idR = IdentityAlgebraHomomorphism(R)
h1 = f*g
h2 = idR*f
h3 = g*idR
h4 = idR*idR
```

### Preimages

`AbstractAlgebra.preimage`

— Method`preimage(f::AbstractAlgebra.Map(SAlgHom), I::sideal)`

Returns the preimage of the ideal $I$ under the algebra homomorphism $f$.

`AbstractAlgebra.preimage`

— Method`preimage(f::AbstractAlgebra.Map(SIdAlgHom), I::sideal)`

Returns the preimage of the ideal $I$ under the identity algebra homomorphism.

`AbstractAlgebra.kernel`

— Method`kernel(f::AbstractAlgebra.Map(SIdAlgHom))`

Returns the kernel of the identity algebra homomorphism.

`AbstractAlgebra.kernel`

— Method`kernel(f::AbstractAlgebra.Map(SAlgHom))`

Returns the kernel of the algebra homomorphism $f$.

**Examples**

```
R, (x, y, z, w) = PolynomialRing(QQ, ["x", "y", "z", "w"];
ordering=:negdegrevlex)
S, (a, b, c) = PolynomialRing(QQ, ["a", "b", "c"];
ordering=:degrevlex)
I = Ideal(S, [a, a + b^2, b - c, c + b])
f = SAlgebraHomomorphism(R, S, gens(I))
idS = IdentityAlgebraHomomorphism(S)
P1 = preimage(f, I)
P2 = preimage(idS, I)
K1 = kernel(f)
K2 = preimage(idS)
```