# 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()
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
```

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
```

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
```

AUTHORS:

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

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

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()
sage: p.valuation_ring()
Valuation ring at Place (x, x*y)
```
place()#

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()
sage: R = p.valuation_ring()
sage: p == R.place()
True
```
residue_field(name=None)#

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()
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
```