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)
.
Equations
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
.
Equations
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
.
Equations
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.
Equations
Instances For
Addition of rational functions.
Equations
Instances For
Subtraction of rational functions.
Equations
Instances For
Additive inverse of a rational function.
Equations
Instances For
The multiplicative unit of rational functions.
Equations
Instances For
Multiplication of rational functions.
Equations
Instances For
Division of rational functions.
Equations
Instances For
Multiplicative inverse of a rational function.
Equations
Instances For
Scalar multiplication of rational functions.
Equations
Instances For
Equations
- RatFunc.instSMulRatFunc = { smul := RatFunc.smul }
Equations
- One or more equations did not get rendered due to their size.
Equations
- RatFunc.instInhabitedRatFunc K = { default := 0 }
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
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Solve equations for RatFunc K
by working in FractionRing K[X]
.
Equations
- RatFunc.tacticFrac_tac = Lean.ParserDescr.node `RatFunc.tacticFrac_tac 1024 (Lean.ParserDescr.nonReservedSymbol "frac_tac" false)
Instances For
Solve equations for RatFunc K
by applying RatFunc.induction_on
.
Equations
- RatFunc.tacticSmul_tac = Lean.ParserDescr.node `RatFunc.tacticSmul_tac 1024 (Lean.ParserDescr.nonReservedSymbol "smul_tac" false)
Instances For
RatFunc K
is a commutative monoid.
This is an intermediate step on the way to the full instance RatFunc.instCommRing
.
Equations
- RatFunc.instCommMonoid K = CommMonoid.mk (_ : ∀ (a b : RatFunc K), a * b = b * a)
Instances For
RatFunc K
is an additive commutative group.
This is an intermediate step on the way to the full instance RatFunc.instCommRing
.
Equations
- RatFunc.instAddCommGroup K = AddCommGroup.mk (_ : ∀ (a b : RatFunc K), a + b = b + a)
Instances For
Equations
- RatFunc.instCommRing K = let src := RatFunc.instCommMonoid K; let src_1 := RatFunc.instAddCommGroup K; CommRing.mk (_ : ∀ (a b : RatFunc K), a * b = b * a)
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.
Equations
- One or more equations did not get rendered due to their size.
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.
Equations
- One or more equations did not get rendered due to their size.
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.
Equations
- One or more equations did not get rendered due to their size.
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.
Equations
- One or more equations did not get rendered due to their size.
Instances For
RatFunc
as field of fractions of Polynomial
#
Equations
- One or more equations did not get rendered due to their size.
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.
Equations
- One or more equations did not get rendered due to their size.
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.
Equations
- One or more equations did not get rendered due to their size.
Instances For
RatFunc K
is the field of fractions of the polynomials over K
.
Equations
- One or more equations did not get rendered due to their size.
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.
Equations
- One or more equations did not get rendered due to their size.
Instances For
RatFunc.num
is the numerator of a rational function,
normalized such that the denominator is monic.
Equations
- RatFunc.num x = (RatFunc.numDenom x).fst
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.
Equations
- RatFunc.denom x = (RatFunc.numDenom x).snd
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
.
Equations
- RatFunc.eval f a p = Polynomial.eval₂ f a (RatFunc.num p) / Polynomial.eval₂ f a (RatFunc.denom p)
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.
intDegree x
is the degree of the rational function x
, defined as the difference between
the natDegree
of its numerator and the natDegree
of its denominator. In particular,
intDegree 0 = 0
.
Equations
- RatFunc.intDegree x = ↑(Polynomial.natDegree (RatFunc.num x)) - ↑(Polynomial.natDegree (RatFunc.denom x))
Instances For
The coercion RatFunc F → LaurentSeries F
as bundled alg hom.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The coercion RatFunc F → LaurentSeries F
as a function.
This is the implementation of coeToLaurentSeries
.
Equations
- RatFunc.coeToLaurentSeries_fun = ↑(RatFunc.coeAlgHom F)
Instances For
Equations
- RatFunc.coeToLaurentSeries = { coe := RatFunc.coeToLaurentSeries_fun }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.