Quadratic maps #
This file defines quadratic maps on an R
-module M
, taking values in an R
-module N
.
An N
-valued quadratic map on a module M
over a commutative ring R
is a map Q : M → N
such
that:
QuadraticMap.map_smul
:Q (a • x) = (a * a) • Q x
QuadraticMap.polar_add_left
,QuadraticMap.polar_add_right
,QuadraticMap.polar_smul_left
,QuadraticMap.polar_smul_right
: the mapQuadraticMap.polar Q := fun x y ↦ Q (x + y) - Q x - Q y
is bilinear.
This notion generalizes to commutative semirings using the approach in [izhakian2016][] which
requires that there be a (possibly non-unique) companion bilinear map B
such that
∀ x y, Q (x + y) = Q x + Q y + B x y
. Over a ring, this B
is precisely QuadraticMap.polar Q
.
To build a QuadraticMap
from the polar
axioms, use QuadraticMap.ofPolar
.
Quadratic maps come with a scalar multiplication, (a • Q) x = a • Q x
,
and composition with linear maps f
, Q.comp f x = Q (f x)
.
Main definitions #
QuadraticMap.ofPolar
: a more familiar constructor that works on ringsQuadraticMap.associated
: associated bilinear mapQuadraticMap.PosDef
: positive definite quadratic mapsQuadraticMap.Anisotropic
: anisotropic quadratic mapsQuadraticMap.discr
: discriminant of a quadratic mapQuadraticMap.IsOrtho
: orthogonality of vectors with respect to a quadratic map.
Main statements #
QuadraticMap.associated_left_inverse
,QuadraticMap.associated_rightInverse
: in a commutative ring where 2 has an inverse, there is a correspondence between quadratic maps and symmetric bilinear formsLinearMap.BilinForm.exists_orthogonal_basis
: There exists an orthogonal basis with respect to any nondegenerate, symmetric bilinear mapB
.
Notation #
In this file, the variable R
is used when a CommSemiring
structure is available.
The variable S
is used when R
itself has a •
action.
Implementation notes #
While the definition and many results make sense if we drop commutativity assumptions,
the correct definition of a quadratic maps in the noncommutative setting would require
substantial refactors from the current version, such that
The Zulip thread has some further discussion.
References #
- https://en.wikipedia.org/wiki/Quadratic_form
- https://en.wikipedia.org/wiki/Discriminant#Quadratic_forms
Tags #
quadratic map, homogeneous polynomial, quadratic polynomial
Up to a factor 2, Q.polar
is the associated bilinear map for a quadratic map Q
.
Source of this name: https://en.wikipedia.org/wiki/Quadratic_form#Generalization
Equations
- QuadraticMap.polar f x y = f (x + y) - f x - f y
Auxiliary lemma to express bilinearity of QuadraticMap.polar
without subtraction.
A quadratic map on a module.
For a more familiar constructor when R
is a ring, see QuadraticMap.ofPolar
.
- toFun : M → N
- exists_companion' : ∃ (B : LinearMap.BilinMap R M N), ∀ (x y : M), self.toFun (x + y) = self.toFun x + self.toFun y + (B x) y
A quadratic form on a module.
Equations
- QuadraticForm R M = QuadraticMap R M R
Equations
- QuadraticMap.instFunLike = { coe := QuadraticMap.toFun, coe_injective' := ⋯ }
Helper instance for when there's too many metavariables to apply
DFunLike.hasCoeToFun
directly.
Equations
- QuadraticMap.instCoeFunForall = { coe := DFunLike.coe }
The simp
normal form for a quadratic map is DFunLike.coe
, not toFun
.
Copy of a QuadraticMap
with a new toFun
equal to the old one. Useful to fix definitional
equalities.
Equations
- Q.copy Q' h = { toFun := Q', toFun_smul := ⋯, exists_companion' := ⋯ }
Equations
- ⋯ = ⋯
QuadraticMap.polar
as a bilinear map
Equations
- Q.polarBilin = LinearMap.mk₂ R (QuadraticMap.polar ⇑Q) ⋯ ⋯ ⋯ ⋯
An alternative constructor to QuadraticMap.mk
, for rings where polar
can be used.
Equations
- QuadraticMap.ofPolar toFun toFun_smul polar_add_left polar_smul_left = { toFun := toFun, toFun_smul := toFun_smul, exists_companion' := ⋯ }
In a ring the companion bilinear form is unique and equal to QuadraticMap.polar
.
QuadraticMap R M N
inherits the scalar action from any algebra over R
.
This provides an R
-action via Algebra.id
.
Equations
- QuadraticMap.instSMul = { smul := fun (a : S) (Q : QuadraticMap R M N) => { toFun := a • ⇑Q, toFun_smul := ⋯, exists_companion' := ⋯ } }
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- QuadraticMap.instZero = { zero := { toFun := fun (x : M) => 0, toFun_smul := ⋯, exists_companion' := ⋯ } }
Equations
- QuadraticMap.instInhabited = { default := 0 }
Equations
- QuadraticMap.instAdd = { add := fun (Q Q' : QuadraticMap R M N) => { toFun := ⇑Q + ⇑Q', toFun_smul := ⋯, exists_companion' := ⋯ } }
Equations
- QuadraticMap.instAddCommMonoid = Function.Injective.addCommMonoid (fun (f : QuadraticMap R M N) => ⇑f) ⋯ ⋯ ⋯ ⋯
@CoeFn (QuadraticMap R M)
as an AddMonoidHom
.
This API mirrors AddMonoidHom.coeFn
.
Equations
- QuadraticMap.coeFnAddMonoidHom = { toFun := DFunLike.coe, map_zero' := ⋯, map_add' := ⋯ }
Evaluation on a particular element of the module M
is an additive map on quadratic maps.
Equations
- QuadraticMap.evalAddMonoidHom m = (Pi.evalAddMonoidHom (fun (a : M) => N) m).comp QuadraticMap.coeFnAddMonoidHom
Equations
- QuadraticMap.instDistribMulActionOfSMulCommClass = DistribMulAction.mk ⋯ ⋯
Equations
- QuadraticMap.instNeg = { neg := fun (Q : QuadraticMap R M N) => { toFun := -⇑Q, toFun_smul := ⋯, exists_companion' := ⋯ } }
Equations
- QuadraticMap.instSub = { sub := fun (Q Q' : QuadraticMap R M N) => (Q + -Q').copy (⇑Q - ⇑Q') ⋯ }
Equations
- QuadraticMap.instAddCommGroup = Function.Injective.addCommGroup (fun (f : QuadraticMap R M N) => ⇑f) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
If B : M → N → Pₗ
is R
-S
bilinear and R'
and S'
are compatible scalar multiplications,
then the restriction of scalars is a R'
-S'
bilinear map.
Equations
- Q.restrictScalars = { toFun := fun (x : M) => Q x, toFun_smul := ⋯, exists_companion' := ⋯ }
Compose the quadratic map with a linear function on the right.
Equations
- Q.comp f = { toFun := fun (x : M) => Q (f x), toFun_smul := ⋯, exists_companion' := ⋯ }
Compose a quadratic map with a linear function on the left.
Equations
- f.compQuadraticMap Q = { toFun := fun (x : M) => f (Q x), toFun_smul := ⋯, exists_companion' := ⋯ }
Compose a quadratic map with a linear function on the left.
Equations
- f.compQuadraticMap' Q = f.compQuadraticMap Q.restrictScalars
The product of linear forms is a quadratic form.
Equations
- QuadraticMap.linMulLin f g = { toFun := ⇑f * ⇑g, toFun_smul := ⋯, exists_companion' := ⋯ }
sq
is the quadratic form mapping the vector x : A
to x * x
Equations
- QuadraticMap.sq = QuadraticMap.linMulLin LinearMap.id LinearMap.id
proj i j
is the quadratic form mapping the vector x : n → R
to x i * x j
Equations
Associated bilinear maps #
Over a commutative ring with an inverse of 2, the theory of quadratic maps is
basically identical to that of symmetric bilinear maps. The map from quadratic
maps to bilinear maps giving this identification is called the QuadraticMap.associated
quadratic map.
A bilinear map gives a quadratic map by applying the argument twice.
Equations
- B.toQuadraticMap = { toFun := fun (x : M) => (B x) x, toFun_smul := ⋯, exists_companion' := ⋯ }
LinearMap.BilinForm.toQuadraticMap
as an additive homomorphism
Equations
- LinearMap.BilinMap.toQuadraticMapAddMonoidHom R M = { toFun := LinearMap.BilinMap.toQuadraticMap, map_zero' := ⋯, map_add' := ⋯ }
LinearMap.BilinForm.toQuadraticMap
as a linear map
Equations
- LinearMap.BilinMap.toQuadraticMapLinearMap S R M = { toFun := LinearMap.BilinMap.toQuadraticMap, map_add' := ⋯, map_smul' := ⋯ }
associatedHom
is the map that sends a quadratic map on a module M
over R
to its
associated symmetric bilinear map. As provided here, this has the structure of an S
-linear map
where S
is a commutative subring of R
.
Over a commutative ring, use QuadraticMap.associated
, which gives an R
-linear map. Over a
general ring with no nontrivial distinguished commutative subring, use QuadraticMap.associated'
,
which gives an additive homomorphism (or more precisely a ℤ
-linear map.)
Equations
- QuadraticMap.associatedHom S = ⟨⅟2, ⋯⟩ • { toFun := QuadraticMap.polarBilin, map_add' := ⋯, map_smul' := ⋯ }
associated'
is the ℤ
-linear map that sends a quadratic form on a module M
over R
to its
associated symmetric bilinear form.
Equations
- QuadraticMap.associated' = QuadraticMap.associatedHom ℤ
Symmetric bilinear forms can be lifted to quadratic forms
Equations
- ⋯ = ⋯
There exists a non-null vector with respect to any quadratic form Q
whose associated
bilinear form is non-zero, i.e. there exists x
such that Q x ≠ 0
.
associated
is the linear map that sends a quadratic map over a commutative ring to its
associated symmetric bilinear map.
Equations
- QuadraticMap.associated = QuadraticMap.associatedHom R
Orthogonality #
The proposition that two elements of a quadratic map space are orthogonal.
Alias of the forward direction of QuadraticMap.isOrtho_comm
.
An anisotropic quadratic map is zero only on zero vectors.
The associated bilinear form of an anisotropic quadratic form is nondegenerate.
A positive definite quadratic form is positive on nonzero vectors.
Quadratic forms and matrices #
Connect quadratic forms and matrices, in order to explicitly compute with them. The convention is twos out, so there might be a factor 2⁻¹ in the entries of the matrix. The determinant of the matrix is the discriminant of the quadratic form.
M.toQuadraticMap'
is the map fun x ↦ row x * M * col x
as a quadratic form.
Equations
- M.toQuadraticMap' = LinearMap.BilinMap.toQuadraticMap ((Matrix.toLinearMap₂' R) M)
A matrix representation of the quadratic form.
Equations
- Q.toMatrix' = (LinearMap.toMatrix₂' R) (QuadraticMap.associated Q)
The discriminant of a quadratic form generalizes the discriminant of a quadratic polynomial.
Equations
- Q.discr = Q.toMatrix'.det
A bilinear form is separating left if the quadratic form it is associated with is anisotropic.
There exists a non-null vector with respect to any symmetric, nonzero bilinear form B
on a module M
over a ring R
with invertible 2
, i.e. there exists some
x : M
such that B x x ≠ 0
.
Given a symmetric bilinear form B
on some vector space V
over a field K
in which 2
is invertible, there exists an orthogonal basis with respect to B
.
Given a quadratic map Q
and a basis, basisRepr
is the basis representation of Q
.
Equations
- Q.basisRepr v = Q.comp ↑v.equivFun.symm
The weighted sum of squares with respect to some weight as a quadratic form.
The weights are applied using •
; typically this definition is used either with S = R
or
[Algebra S R]
, although this is stated more generally.
Equations
- QuadraticMap.weightedSumSquares R w = ∑ i : ι, w i • QuadraticMap.proj i i
On an orthogonal basis, the basis representation of Q
is just a sum of squares.