# Valuation rings of function fields#

A valuation ring of a function field is associated with a place of the function field. The valuation ring consists of all elements of the function field that have nonnegative valuation at the place.

EXAMPLES:

```sage: K.<x> = FunctionField(GF(2)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)
sage: p = L.places_finite()[0]
sage: p
Place (x, x*y)
sage: R = p.valuation_ring()
sage: R
Valuation ring at Place (x, x*y)
sage: R.place() == p
True
```
```>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)
>>> p = L.places_finite()[Integer(0)]
>>> p
Place (x, x*y)
>>> R = p.valuation_ring()
>>> R
Valuation ring at Place (x, x*y)
>>> R.place() == p
True
```

Thus any nonzero element or its inverse of the function field lies in the valuation ring, as shown in the following example:

```sage: f = y/(1+y)
sage: f in R
True
sage: f not in R
False
sage: f.valuation(p)
0
```
```>>> from sage.all import *
>>> f = y/(Integer(1)+y)
>>> f in R
True
>>> f not in R
False
>>> f.valuation(p)
0
```

The residue field at the place is defined as the quotient ring of the valuation ring modulo its unique maximal ideal. The method `residue_field()` of the valuation ring returns an extension field of the constant base field, isomorphic to the residue field, along with lifting and evaluation homomorphisms:

```sage: k,phi,psi = R.residue_field()
sage: k
Finite Field of size 2
sage: phi
Ring morphism:
From: Finite Field of size 2
To:   Valuation ring at Place (x, x*y)
sage: psi
Ring morphism:
From: Valuation ring at Place (x, x*y)
To:   Finite Field of size 2
sage: psi(f) in k
True
```
```>>> from sage.all import *
>>> k,phi,psi = R.residue_field()
>>> k
Finite Field of size 2
>>> phi
Ring morphism:
From: Finite Field of size 2
To:   Valuation ring at Place (x, x*y)
>>> psi
Ring morphism:
From: Valuation ring at Place (x, x*y)
To:   Finite Field of size 2
>>> psi(f) in k
True
```

AUTHORS:

• Kwankyu Lee (2017-04-30): initial version

class sage.rings.function_field.valuation_ring.FunctionFieldValuationRing(field, place, category=None)[source]#

Base class for valuation rings of function fields.

INPUT:

• `field` – function field

• `place` – place of the function field

EXAMPLES:

```sage: K.<x> = FunctionField(GF(2)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)
sage: p = L.places_finite()[0]
sage: p.valuation_ring()
Valuation ring at Place (x, x*y)
```
```>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)
>>> p = L.places_finite()[Integer(0)]
>>> p.valuation_ring()
Valuation ring at Place (x, x*y)
```
place()[source]#

Return the place associated with the valuation ring.

EXAMPLES:

```sage: K.<x> = FunctionField(GF(2)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)
sage: p = L.places_finite()[0]
sage: R = p.valuation_ring()
sage: p == R.place()
True
```
```>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)
>>> p = L.places_finite()[Integer(0)]
>>> R = p.valuation_ring()
>>> p == R.place()
True
```
residue_field(name=None)[source]#

Return the residue field of the valuation ring together with the maps from and to it.

INPUT:

• `name` – string; name of the generator of the field

OUTPUT:

• a field isomorphic to the residue field

• a ring homomorphism from the valuation ring to the field

• a ring homomorphism from the field to the valuation ring

EXAMPLES:

```sage: K.<x> = FunctionField(GF(2)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^2 + Y + x + 1/x)
sage: p = L.places_finite()[0]
sage: R = p.valuation_ring()
sage: k, fr_k, to_k = R.residue_field()
sage: k
Finite Field of size 2
sage: fr_k
Ring morphism:
From: Finite Field of size 2
To:   Valuation ring at Place (x, x*y)
sage: to_k
Ring morphism:
From: Valuation ring at Place (x, x*y)
To:   Finite Field of size 2
sage: to_k(1/y)
0
sage: to_k(y/(1+y))
1
```
```>>> from sage.all import *
>>> K = FunctionField(GF(Integer(2)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(2) + Y + x + Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)
>>> p = L.places_finite()[Integer(0)]
>>> R = p.valuation_ring()
>>> k, fr_k, to_k = R.residue_field()
>>> k
Finite Field of size 2
>>> fr_k
Ring morphism:
From: Finite Field of size 2
To:   Valuation ring at Place (x, x*y)
>>> to_k
Ring morphism:
From: Valuation ring at Place (x, x*y)
To:   Finite Field of size 2
>>> to_k(Integer(1)/y)
0
>>> to_k(y/(Integer(1)+y))
1
```