The field of rational functions #
This file defines the field RatFunc K
of rational functions over a field K
,
and shows it is the field of fractions of K[X]
.
Main definitions #
Working with rational functions as polynomials:
RatFunc.instField
provides a field structureRatFunc.C
is the constant polynomialRatFunc.X
is the indeterminateRatFunc.eval
evaluates a rational function given a value for the indeterminate You can useIsFractionRing
API to treatRatFunc
as the field of fractions of polynomials:
algebraMap K[X] (RatFunc K)
maps polynomials to rational functionsIsFractionRing.algEquiv
maps other fields of fractions ofK[X]
toRatFunc K
, in particular:FractionRing.algEquiv K[X] (RatFunc K)
maps the generic field of fraction construction toRatFunc K
. Combine this withAlgEquiv.restrictScalars
to change theFractionRing K[X] ≃ₐ[K[X]] RatFunc K
toFractionRing K[X] ≃ₐ[K] RatFunc K
.
Working with rational functions as fractions:
RatFunc.num
andRatFunc.denom
give the numerator and denominator. These values are chosen to be coprime and such thatRatFunc.denom
is monic.
Embedding of rational functions into Laurent series, provided as a coercion, utilizing
the underlying RatFunc.coeAlgHom
.
Lifting homomorphisms of polynomials to other types, by mapping and dividing, as long as the homomorphism retains the non-zero-divisor property:
RatFunc.liftMonoidWithZeroHom
lifts aK[X] →*₀ G₀
to aRatFunc K →*₀ G₀
, where[CommRing K] [CommGroupWithZero G₀]
RatFunc.liftRingHom
lifts aK[X] →+* L
to aRatFunc K →+* L
, where[CommRing K] [Field L]
RatFunc.liftAlgHom
lifts aK[X] →ₐ[S] L
to aRatFunc K →ₐ[S] L
, where[CommRing K] [Field L] [CommSemiring S] [Algebra S K[X]] [Algebra S L]
This is satisfied by injective homs. We also have lifting homomorphisms of polynomials to other polynomials, with the same condition on retaining the non-zero-divisor property across the map:RatFunc.map
liftsK[X] →* R[X]
when[CommRing K] [CommRing R]
RatFunc.mapRingHom
liftsK[X] →+* R[X]
when[CommRing K] [CommRing R]
RatFunc.mapAlgHom
liftsK[X] →ₐ[S] R[X]
when[CommRing K] [IsDomain K] [CommRing R] [IsDomain R]
We also have a set of recursion and induction principles:
RatFunc.liftOn
: define a function by mapping a fraction of polynomialsp/q
tof p q
, iff
is well-defined in the sense thatp/q = p'/q' → f p q = f p' q'
.RatFunc.liftOn'
: define a function by mapping a fraction of polynomialsp/q
tof p q
, iff
is well-defined in the sense thatf (a * p) (a * q) = f p' q'
.RatFunc.induction_on
: ifP
holds onp / q
for all polynomialsp q
, thenP
holds on all rational functions
We define the degree of a rational function, with values in ℤ
:
intDegree
is the degree of a rational function, defined as the difference between thenatDegree
of its numerator and thenatDegree
of its denominator. In particular,intDegree 0 = 0
.
Implementation notes #
To provide good API encapsulation and speed up unification problems,
RatFunc
is defined as a structure, and all operations are @[irreducible] def
s
We need a couple of maps to set up the Field
and IsFractionRing
structure,
namely RatFunc.ofFractionRing
, RatFunc.toFractionRing
, RatFunc.mk
and
RatFunc.toFractionRingRingEquiv
.
All these maps get simp
ed to bundled morphisms like algebraMap K[X] (RatFunc K)
and IsLocalization.algEquiv
.
There are separate lifts and maps of homomorphisms, to provide routes of lifting even when the codomain is not a field or even an integral domain.
References #
- [Kleiman, Misconceptions about $K_X$][kleiman1979]
- https://freedommathdance.blogspot.com/2012/11/misconceptions-about-kx.html
- https://stacks.math.columbia.edu/tag/01X1
- ofFractionRing :: (
- toFractionRing : FractionRing (Polynomial K)
- )
RatFunc K
is K(X)
, the field of rational functions over K
.
The inclusion of polynomials into RatFunc
is algebraMap K[X] (RatFunc K)
,
the maps between RatFunc K
and another field of fractions of K[X]
,
especially FractionRing K[X]
, are given by IsLocalization.algEquiv
.
Instances For
Non-dependent recursion principle for RatFunc K
:
To construct a term of P : Sort*
out of x : RatFunc K
,
it suffices to provide a constructor f : Π (p q : K[X]), P
and a proof that f p q = f p' q'
for all p q p' q'
such that q' * p = q * p'
where
both q
and q'
are not zero divisors, stated as q ∉ K[X]⁰
, q' ∉ K[X]⁰
.
If considering K
as an integral domain, this is the same as saying that
we construct a value of P
for such elements of RatFunc K
by setting
liftOn (p / q) f _ = f p q
.
When [IsDomain K]
, one can use RatFunc.liftOn'
, which has the stronger requirement
of ∀ {p q a : K[X]} (hq : q ≠ 0) (ha : a ≠ 0), f (a * p) (a * q) = f p q)
.
Instances For
RatFunc.mk (p q : K[X])
is p / q
as a rational function.
If q = 0
, then mk
returns 0.
This is an auxiliary definition used to define an Algebra
structure on RatFunc
;
the simp
normal form of mk p q
is algebraMap _ _ p / algebraMap _ _ q
.
Instances For
Non-dependent recursion principle for RatFunc K
: if f p q : P
for all p q
,
such that f (a * p) (a * q) = f p q
, then we can find a value of P
for all elements of RatFunc K
by setting lift_on' (p / q) f _ = f p q
.
The value of f p 0
for any p
is never used and in principle this may be anything,
although many usages of lift_on'
assume f p 0 = f 0 1
.
Instances For
Induction principle for RatFunc K
: if f p q : P (RatFunc.mk p q)
for all p q
,
then P
holds on all elements of RatFunc K
.
See also induction_on
, which is a recursion principle defined in terms of algebraMap
.
Defining the field structure #
The zero rational function.
Instances For
The multiplicative unit of rational functions.
Instances For
Scalar multiplication of rational functions.
Instances For
RatFunc K
is isomorphic to the field of fractions of K[X]
, as rings.
This is an auxiliary definition; simp
-normal form is IsLocalization.algEquiv
.
Instances For
Solve equations for RatFunc K
by working in FractionRing K[X]
.
Instances For
Solve equations for RatFunc K
by applying RatFunc.induction_on
.
Instances For
RatFunc K
is a commutative monoid.
This is an intermediate step on the way to the full instance RatFunc.instCommRing
.
Instances For
RatFunc K
is an additive commutative group.
This is an intermediate step on the way to the full instance RatFunc.instCommRing
.
Instances For
Lift a monoid homomorphism that maps polynomials φ : R[X] →* S[X]
to a RatFunc R →* RatFunc S
,
on the condition that φ
maps non zero divisors to non zero divisors,
by mapping both the numerator and denominator and quotienting them.
Instances For
Lift a ring homomorphism that maps polynomials φ : R[X] →+* S[X]
to a RatFunc R →+* RatFunc S
,
on the condition that φ
maps non zero divisors to non zero divisors,
by mapping both the numerator and denominator and quotienting them.
Instances For
Lift a monoid with zero homomorphism R[X] →*₀ G₀
to a RatFunc R →*₀ G₀
on the condition that φ
maps non zero divisors to non zero divisors,
by mapping both the numerator and denominator and quotienting them.
Instances For
Lift an injective ring homomorphism R[X] →+* L
to a RatFunc R →+* L
by mapping both the numerator and denominator and quotienting them.
Instances For
RatFunc
as field of fractions of Polynomial
#
Lift an algebra homomorphism that maps polynomials φ : K[X] →ₐ[S] R[X]
to a RatFunc K →ₐ[S] RatFunc R
,
on the condition that φ
maps non zero divisors to non zero divisors,
by mapping both the numerator and denominator and quotienting them.
Instances For
Lift an injective algebra homomorphism K[X] →ₐ[S] L
to a RatFunc K →ₐ[S] L
by mapping both the numerator and denominator and quotienting them.
Instances For
RatFunc K
is the field of fractions of the polynomials over K
.
Induction principle for RatFunc K
: if f p q : P (p / q)
for all p q : K[X]
,
then P
holds on all elements of RatFunc K
.
See also induction_on'
, which is a recursion principle defined in terms of RatFunc.mk
.
Numerator and denominator #
RatFunc.numDenom
are numerator and denominator of a rational function over a field,
normalized such that the denominator is monic.
Instances For
RatFunc.num
is the numerator of a rational function,
normalized such that the denominator is monic.
Instances For
A version of num_div_dvd
with the LHS in simp normal form
RatFunc.denom
is the denominator of a rational function,
normalized such that it is monic.
Instances For
Evaluate a rational function p
given a ring hom f
from the scalar field
to the target and a value x
for the variable in the target.
Fractions are reduced by clearing common denominators before evaluating:
eval id 1 ((X^2 - 1) / (X - 1)) = eval id 1 (X + 1) = 2
, not 0 / 0 = 0
.
Instances For
eval
is an additive homomorphism except when a denominator evaluates to 0
.
Counterexample: eval _ 1 (X / (X-1)) + eval _ 1 (-1 / (X-1)) = 0
... ≠ 1 = eval _ 1 ((X-1) / (X-1))
.
See also RatFunc.eval₂_denom_ne_zero
to make the hypotheses simpler but less general.
eval
is a multiplicative homomorphism except when a denominator evaluates to 0
.
Counterexample: eval _ 0 X * eval _ 0 (1/X) = 0 ≠ 1 = eval _ 0 1 = eval _ 0 (X * 1/X)
.
See also RatFunc.eval₂_denom_ne_zero
to make the hypotheses simpler but less general.
The coercion RatFunc F → LaurentSeries F
as bundled alg hom.
Instances For
The coercion RatFunc F → LaurentSeries F
as a function.
This is the implementation of coeToLaurentSeries
.