# Morphisms of affine schemes

## Constructors

### General constructors

`morphism`

— Method`morphism(X::AbsAffineScheme, Y::AbsAffineScheme, f::Vector{<:RingElem}; check::Bool=true)`

This method constructs a morphism from the scheme $X$ to the scheme $Y$. For this one has to specify the images of the coordinates (the generators of `ambient_coordinate_ring(Y)`

) under the pullback map $𝒪(Y) → 𝒪(X)$ as third argument.

Note that expensive checks can be turned off by setting `check=false`

.

**Examples**

```
julia> X = affine_space(QQ,3)
Affine space of dimension 3
over rational field
with coordinates [x1, x2, x3]
julia> Y = affine_space(QQ,3)
Affine space of dimension 3
over rational field
with coordinates [x1, x2, x3]
julia> morphism(X, Y, gens(OO(X)))
Affine scheme morphism
from [x1, x2, x3] affine 3-space over QQ
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> x1
x2 -> x2
x3 -> x3
```

### Special constructors

`identity_map`

— Method`identity_map(X::AbsAffineScheme{<:Any, <:MPolyRing})`

This method constructs the identity morphism from an affine scheme to itself.

**Examples**

```
julia> X = affine_space(QQ,3)
Affine space of dimension 3
over rational field
with coordinates [x1, x2, x3]
julia> identity_map(X)
Affine scheme morphism
from [x1, x2, x3] affine 3-space over QQ
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> x1
x2 -> x2
x3 -> x3
```

`inclusion_morphism`

— Method`inclusion_morphism(X::AbsAffineScheme, Y::AbsAffineScheme; check::Bool=true)`

Return the inclusion map from $X$ to $Y$.

**Examples**

```
julia> X = affine_space(QQ,3)
Affine space of dimension 3
over rational field
with coordinates [x1, x2, x3]
julia> R = OO(X)
Multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
julia> (x1,x2,x3) = gens(R)
3-element Vector{QQMPolyRingElem}:
x1
x2
x3
julia> Y = subscheme(X, x1)
Spectrum
of quotient
of multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
by ideal (x1)
julia> f = inclusion_morphism(Y, X)
Affine scheme morphism
from [x1, x2, x3] scheme(x1)
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> 0
x2 -> x2
x3 -> x3
julia> I = kernel(pullback(f)) # this is a way to obtain the ideal ``I ⊆ O(X)`` cutting out ``Y`` from ``X``.
Ideal generated by
x1
julia> base_ring(I) == OO(X)
true
```

`compose`

— Method`compose(f::AbsAffineSchemeMor, g::AbsAffineSchemeMor)`

This method computes the composition of two morphisms.

**Examples**

```
julia> X = affine_space(QQ,3)
Affine space of dimension 3
over rational field
with coordinates [x1, x2, x3]
julia> R = OO(X)
Multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
julia> (x1,x2,x3) = gens(R)
3-element Vector{QQMPolyRingElem}:
x1
x2
x3
julia> Y = subscheme(X, x1)
Spectrum
of quotient
of multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
by ideal (x1)
julia> m1 = inclusion_morphism(Y, X)
Affine scheme morphism
from [x1, x2, x3] scheme(x1)
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> 0
x2 -> x2
x3 -> x3
julia> m2 = identity_map(X)
Affine scheme morphism
from [x1, x2, x3] affine 3-space over QQ
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> x1
x2 -> x2
x3 -> x3
julia> m3 = identity_map(Y)
Affine scheme morphism
from [x1, x2, x3] scheme(x1)
to [x1, x2, x3] scheme(x1)
given by the pullback function
x1 -> 0
x2 -> x2
x3 -> x3
julia> compose(m3, compose(m1, m2)) == m1
true
```

`restrict`

— Method`restrict(f::AbsAffineSchemeMor, D::AbsAffineScheme, Z::AbsAffineScheme; check::Bool=true)`

This method restricts the domain of the morphism $f$ to $D$ and its codomain to $Z$.

**Examples**

```
julia> X = affine_space(QQ,3)
Affine space of dimension 3
over rational field
with coordinates [x1, x2, x3]
julia> R = OO(X)
Multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
julia> (x1,x2,x3) = gens(R)
3-element Vector{QQMPolyRingElem}:
x1
x2
x3
julia> Y = subscheme(X, x1)
Spectrum
of quotient
of multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
by ideal (x1)
julia> restrict(identity_map(X), Y, Y) == identity_map(Y)
true
```

`restrict(f::SchemeMor, U::Scheme, V::Scheme; check::Bool=true)`

Return the restriction $g: U → V$ of $f$ to $U$ and $V$.

## Attributes

### General attributes

`domain`

— Method`domain(f::AbsAffineSchemeMor)`

On a morphism $f : X → Y$ of affine schemes, this returns $X$.

**Examples**

```
julia> Y = affine_space(QQ,3)
Affine space of dimension 3
over rational field
with coordinates [x1, x2, x3]
julia> R = OO(Y)
Multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
julia> (x1,x2,x3) = gens(R)
3-element Vector{QQMPolyRingElem}:
x1
x2
x3
julia> X = subscheme(Y, x1)
Spectrum
of quotient
of multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
by ideal (x1)
julia> f = inclusion_morphism(X, Y)
Affine scheme morphism
from [x1, x2, x3] scheme(x1)
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> 0
x2 -> x2
x3 -> x3
julia> domain(f)
Spectrum
of quotient
of multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
by ideal (x1)
```

`codomain`

— Method`codomain(f::AbsAffineSchemeMor)`

On a morphism $f : X → Y$ of affine schemes, this returns $Y$.

**Examples**

```
julia> Y = affine_space(QQ,3)
Affine space of dimension 3
over rational field
with coordinates [x1, x2, x3]
julia> R = OO(Y)
Multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
julia> (x1,x2,x3) = gens(R)
3-element Vector{QQMPolyRingElem}:
x1
x2
x3
julia> X = subscheme(Y, x1)
Spectrum
of quotient
of multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
by ideal (x1)
julia> f = inclusion_morphism(X, Y)
Affine scheme morphism
from [x1, x2, x3] scheme(x1)
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> 0
x2 -> x2
x3 -> x3
julia> codomain(f)
Affine space of dimension 3
over rational field
with coordinates [x1, x2, x3]
```

`pullback`

— Method`pullback(f::AbsAffineSchemeMor)`

On a morphism $f : X → Y$ of affine schemes $X = Spec(S)$ and $Y = Spec(R)$, this returns the ring homomorphism $f^* : R → S$.

**Examples**

```
julia> Y = affine_space(QQ,3)
Affine space of dimension 3
over rational field
with coordinates [x1, x2, x3]
julia> R = OO(Y)
Multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
julia> (x1,x2,x3) = gens(R)
3-element Vector{QQMPolyRingElem}:
x1
x2
x3
julia> X = subscheme(Y, x1)
Spectrum
of quotient
of multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
by ideal (x1)
julia> pullback(inclusion_morphism(X, Y))
Ring homomorphism
from multivariate polynomial ring in 3 variables over QQ
to quotient of multivariate polynomial ring by ideal (x1)
defined by
x1 -> 0
x2 -> x2
x3 -> x3
```

`graph`

— Method`graph(f::AbsAffineSchemeMor)`

Return the graph of $f : X → Y$ as a subscheme of $X×Y$ as well as the two projections to $X$ and $Y$.

**Examples**

```
julia> Y = affine_space(QQ,3)
Affine space of dimension 3
over rational field
with coordinates [x1, x2, x3]
julia> R = OO(Y)
Multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
julia> (x1,x2,x3) = gens(R)
3-element Vector{QQMPolyRingElem}:
x1
x2
x3
julia> X = subscheme(Y, x1)
Spectrum
of quotient
of multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
by ideal (x1)
julia> f = inclusion_morphism(X, Y)
Affine scheme morphism
from [x1, x2, x3] scheme(x1)
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> 0
x2 -> x2
x3 -> x3
julia> graph(f)
(scheme(x1, -x1, x2 - x2, x3 - x3), Hom: scheme(x1, -x1, x2 - x2, x3 - x3) -> scheme(x1), Hom: scheme(x1, -x1, x2 - x2, x3 - x3) -> affine 3-space over QQ with coordinates [x1, x2, x3])
```

`graph(TropC::TropicalCurve{minOrMax,false})`

Return the graph of an abstract tropical curve `TropC`

. Same as `polyhedral_complex(tc)`

.

### Special attributes

In addition to the standard getters and methods for instances of `AffineSchemeMor`

, we also have

`image_ideal`

— Method`image_ideal(f::ClosedEmbedding)`

For a closed embedding $f : X → Y$ of affine schemes $X = Spec(S)$ into $Y = Spec(R)$ such that $S ≅ R/I$ via $f$ for some ideal $I ⊂ R$ this returns $I$.

### Undocumented

The following functions do exist but are currently undocumented:

`underlying_morphism`

,`complement_ideal`

,`complement_scheme`

,`preimage`

,`inverse`

,- various type getters.

## Properties

`is_isomorphism`

— Method`is_isomorphism(f::AbsAffineSchemeMor)`

This method checks if a morphism is an isomorphism.

`is_inverse_of`

— Method`is_inverse_of(f::AbsAffineSchemeMor, g::AbsAffineSchemeMor)`

This method checks if a morphism $f$ is the inverse of a morphism $g$.

`is_identity_map`

— Method`is_identity_map(f::AbsAffineSchemeMor)`

This method checks if a morphism is the identity map.

**Examples**

```
julia> X = affine_space(QQ,3)
Affine space of dimension 3
over rational field
with coordinates [x1, x2, x3]
julia> R = OO(X)
Multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
julia> (x1,x2,x3) = gens(R)
3-element Vector{QQMPolyRingElem}:
x1
x2
x3
julia> Y = subscheme(X, x1)
Spectrum
of quotient
of multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
by ideal (x1)
julia> is_identity_map(inclusion_morphism(Y, X))
false
```

## Methods

`fiber_product`

— Method`fiber_product(f::AbsAffineSchemeMor, g::AbsAffineSchemeMor)`

For morphisms $f : X → Z$ and $g : Y → Z$ return the fiber product $X×Y$ over $Z$ together with its two canonical projections.

Whenever you have another set of maps `a: W → X`

and `b : W → Y`

forming a commutative square with `f`

and `g`

, you can use `induced_map_to_fiber_product`

to create the resulting map `W → X×Y`

.

`product`

— Method`product(X::AbsAffineScheme, Y::AbsAffineScheme)`

Return a triple $(X×Y, p₁, p₂)$ consisting of the product $X×Y$ over the common base ring $𝕜$ and the two projections $p₁ : X×Y → X$ and $p₂ : X×Y → Y$.

`simplify`

— Method`simplify(X::AbsAffineScheme{<:Field})`

Given an affine scheme $X$ with coordinate ring $R = 𝕜[x₁,…,xₙ]/I$ (or a localization thereof), use `Singular`

's `elimpart`

to try to eliminate variables $xᵢ$ to arrive at a simpler presentation $R ≅ R' = 𝕜[y₁,…,yₘ]/J$ for some ideal $J$; return a `SimplifiedAffineScheme`

$Y$ with $X$ as its `original`

.

***Note:*** The `ambient_coordinate_ring`

of the output `Y`

will be different from the one of `X`

and hence the two schemes will not compare using `==`

.

This function is part of the experimental code in Oscar. Please read here for more details.