Documentation

Mathlib.LinearAlgebra.QuadraticForm.Basic

Quadratic forms #

This file defines quadratic forms over a R-module M. A quadratic form on a commutative ring R is a map Q : M → R such that:

This notion generalizes to commutative semirings using the approach in [izhakian2016][] which requires that there be a (possibly non-unique) companion bilinear form B such that ∀ x y, Q (x + y) = Q x + Q y + B x y. Over a ring, this B is precisely QuadraticForm.polar Q.

To build a QuadraticForm from the polar axioms, use QuadraticForm.ofPolar.

Quadratic forms come with a scalar multiplication, (a • Q) x = Q (a • x) = a * a * Q x, and composition with linear maps f, Q.comp f x = Q (f x).

Main definitions #

Main statements #

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 form in the noncommutative setting would require substantial refactors from the current version, such that $Q(rm) = rQ(m)r^$ for some suitable conjugation $r^$.

The Zulip thread has some further discusion.

References #

Tags #

quadratic form, homogeneous polynomial, quadratic polynomial

def QuadraticForm.polar {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] (f : MR) (x : M) (y : M) :
R

Up to a factor 2, Q.polar is the associated bilinear form for a quadratic form Q.

Source of this name: https://en.wikipedia.org/wiki/Quadratic_form#Generalization

Equations
Instances For
    theorem QuadraticForm.polar_add {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] (f : MR) (g : MR) (x : M) (y : M) :
    theorem QuadraticForm.polar_neg {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] (f : MR) (x : M) (y : M) :
    theorem QuadraticForm.polar_smul {S : Type u_1} {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Monoid S] [DistribMulAction S R] (f : MR) (s : S) (x : M) (y : M) :
    theorem QuadraticForm.polar_comm {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] (f : MR) (x : M) (y : M) :
    theorem QuadraticForm.polar_add_left_iff {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] {f : MR} {x : M} {x' : M} {y : M} :
    QuadraticForm.polar f (x + x') y = QuadraticForm.polar f x y + QuadraticForm.polar f x' y f (x + x' + y) + (f x + f x' + f y) = f (x + x') + f (x' + y) + f (y + x)

    Auxiliary lemma to express bilinearity of QuadraticForm.polar without subtraction.

    theorem QuadraticForm.polar_comp {S : Type u_1} {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] {F : Type u_6} [CommRing S] [FunLike F R S] [AddMonoidHomClass F R S] (f : MR) (g : F) (x : M) (y : M) :
    structure QuadraticForm (R : Type u) (M : Type v) [CommSemiring R] [AddCommMonoid M] [Module R M] :
    Type (max u v)

    A quadratic form over a module.

    For a more familiar constructor when R is a ring, see QuadraticForm.ofPolar.

    • toFun : MR
    • toFun_smul : ∀ (a : R) (x : M), self.toFun (a x) = a * a * self.toFun x
    • exists_companion' : ∃ (B : LinearMap.BilinForm R M), ∀ (x y : M), self.toFun (x + y) = self.toFun x + self.toFun y + (B x) y
    Instances For
      instance QuadraticForm.instFunLike {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] :
      Equations
      • QuadraticForm.instFunLike = { coe := QuadraticForm.toFun, coe_injective' := }
      instance QuadraticForm.instCoeFunQuadraticFormForAll {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] :
      CoeFun (QuadraticForm R M) fun (x : QuadraticForm R M) => MR

      Helper instance for when there's too many metavariables to apply DFunLike.hasCoeToFun directly.

      Equations
      • QuadraticForm.instCoeFunQuadraticFormForAll = { coe := DFunLike.coe }
      @[simp]
      theorem QuadraticForm.toFun_eq_coe {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) :
      Q.toFun = Q

      The simp normal form for a quadratic form is DFunLike.coe, not toFun.

      theorem QuadraticForm.ext {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {Q : QuadraticForm R M} {Q' : QuadraticForm R M} (H : ∀ (x : M), Q x = Q' x) :
      Q = Q'
      theorem QuadraticForm.congr_fun {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {Q : QuadraticForm R M} {Q' : QuadraticForm R M} (h : Q = Q') (x : M) :
      Q x = Q' x
      theorem QuadraticForm.ext_iff {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {Q : QuadraticForm R M} {Q' : QuadraticForm R M} :
      Q = Q' ∀ (x : M), Q x = Q' x
      def QuadraticForm.copy {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) (Q' : MR) (h : Q' = Q) :

      Copy of a QuadraticForm with a new toFun equal to the old one. Useful to fix definitional equalities.

      Equations
      Instances For
        @[simp]
        theorem QuadraticForm.coe_copy {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) (Q' : MR) (h : Q' = Q) :
        (QuadraticForm.copy Q Q' h) = Q'
        theorem QuadraticForm.copy_eq {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) (Q' : MR) (h : Q' = Q) :
        theorem QuadraticForm.map_smul {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) (a : R) (x : M) :
        Q (a x) = a * a * Q x
        theorem QuadraticForm.exists_companion {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) :
        ∃ (B : LinearMap.BilinForm R M), ∀ (x y : M), Q (x + y) = Q x + Q y + (B x) y
        theorem QuadraticForm.map_add_add_add_map {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) (x : M) (y : M) (z : M) :
        Q (x + y + z) + (Q x + Q y + Q z) = Q (x + y) + Q (y + z) + Q (z + x)
        theorem QuadraticForm.map_add_self {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) (x : M) :
        Q (x + x) = 4 * Q x
        theorem QuadraticForm.map_zero {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) :
        Q 0 = 0
        instance QuadraticForm.zeroHomClass {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] :
        Equations
        • =
        theorem QuadraticForm.map_smul_of_tower {S : Type u_1} {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M] (a : S) (x : M) :
        Q (a x) = (a * a) Q x
        @[simp]
        theorem QuadraticForm.map_neg {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (x : M) :
        Q (-x) = Q x
        theorem QuadraticForm.map_sub {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (x : M) (y : M) :
        Q (x - y) = Q (y - x)
        @[simp]
        theorem QuadraticForm.polar_zero_left {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (y : M) :
        QuadraticForm.polar (Q) 0 y = 0
        @[simp]
        theorem QuadraticForm.polar_add_left {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (x : M) (x' : M) (y : M) :
        QuadraticForm.polar (Q) (x + x') y = QuadraticForm.polar (Q) x y + QuadraticForm.polar (Q) x' y
        @[simp]
        theorem QuadraticForm.polar_smul_left {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (a : R) (x : M) (y : M) :
        QuadraticForm.polar (Q) (a x) y = a * QuadraticForm.polar (Q) x y
        @[simp]
        theorem QuadraticForm.polar_neg_left {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (x : M) (y : M) :
        @[simp]
        theorem QuadraticForm.polar_sub_left {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (x : M) (x' : M) (y : M) :
        QuadraticForm.polar (Q) (x - x') y = QuadraticForm.polar (Q) x y - QuadraticForm.polar (Q) x' y
        @[simp]
        theorem QuadraticForm.polar_zero_right {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (y : M) :
        QuadraticForm.polar (Q) y 0 = 0
        @[simp]
        theorem QuadraticForm.polar_add_right {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (x : M) (y : M) (y' : M) :
        QuadraticForm.polar (Q) x (y + y') = QuadraticForm.polar (Q) x y + QuadraticForm.polar (Q) x y'
        @[simp]
        theorem QuadraticForm.polar_smul_right {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (a : R) (x : M) (y : M) :
        QuadraticForm.polar (Q) x (a y) = a * QuadraticForm.polar (Q) x y
        @[simp]
        theorem QuadraticForm.polar_neg_right {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (x : M) (y : M) :
        @[simp]
        theorem QuadraticForm.polar_sub_right {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (x : M) (y : M) (y' : M) :
        QuadraticForm.polar (Q) x (y - y') = QuadraticForm.polar (Q) x y - QuadraticForm.polar (Q) x y'
        @[simp]
        theorem QuadraticForm.polar_self {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (x : M) :
        QuadraticForm.polar (Q) x x = 2 * Q x
        @[simp]
        theorem QuadraticForm.polarBilin_apply_apply {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (m : M) (y : M) :
        def QuadraticForm.polarBilin {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) :

        QuadraticForm.polar as a bilinear map

        Equations
        Instances For
          @[simp]
          theorem QuadraticForm.polar_smul_left_of_tower {S : Type u_1} {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M] (a : S) (x : M) (y : M) :
          QuadraticForm.polar (Q) (a x) y = a QuadraticForm.polar (Q) x y
          @[simp]
          theorem QuadraticForm.polar_smul_right_of_tower {S : Type u_1} {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M] (a : S) (x : M) (y : M) :
          QuadraticForm.polar (Q) x (a y) = a QuadraticForm.polar (Q) x y
          @[simp]
          theorem QuadraticForm.ofPolar_apply {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (toFun : MR) (toFun_smul : ∀ (a : R) (x : M), toFun (a x) = a * a * toFun x) (polar_add_left : ∀ (x x' y : M), QuadraticForm.polar toFun (x + x') y = QuadraticForm.polar toFun x y + QuadraticForm.polar toFun x' y) (polar_smul_left : ∀ (a : R) (x y : M), QuadraticForm.polar toFun (a x) y = a QuadraticForm.polar toFun x y) :
          ∀ (a : M), (QuadraticForm.ofPolar toFun toFun_smul polar_add_left polar_smul_left) a = toFun a
          def QuadraticForm.ofPolar {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (toFun : MR) (toFun_smul : ∀ (a : R) (x : M), toFun (a x) = a * a * toFun x) (polar_add_left : ∀ (x x' y : M), QuadraticForm.polar toFun (x + x') y = QuadraticForm.polar toFun x y + QuadraticForm.polar toFun x' y) (polar_smul_left : ∀ (a : R) (x y : M), QuadraticForm.polar toFun (a x) y = a QuadraticForm.polar toFun x y) :

          An alternative constructor to QuadraticForm.mk, for rings where polar can be used.

          Equations
          • QuadraticForm.ofPolar toFun toFun_smul polar_add_left polar_smul_left = { toFun := toFun, toFun_smul := toFun_smul, exists_companion' := }
          Instances For

            In a ring the companion bilinear form is unique and equal to QuadraticForm.polar.

            instance QuadraticForm.instSMulQuadraticForm {S : Type u_1} {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] [Monoid S] [DistribMulAction S R] [SMulCommClass S R R] :

            QuadraticForm R M inherits the scalar action from any algebra over R.

            This provides an R-action via Algebra.id.

            Equations
            • QuadraticForm.instSMulQuadraticForm = { smul := fun (a : S) (Q : QuadraticForm R M) => { toFun := a Q, toFun_smul := , exists_companion' := } }
            @[simp]
            theorem QuadraticForm.coeFn_smul {S : Type u_1} {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] [Monoid S] [DistribMulAction S R] [SMulCommClass S R R] (a : S) (Q : QuadraticForm R M) :
            (a Q) = a Q
            @[simp]
            theorem QuadraticForm.smul_apply {S : Type u_1} {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] [Monoid S] [DistribMulAction S R] [SMulCommClass S R R] (a : S) (Q : QuadraticForm R M) (x : M) :
            (a Q) x = a Q x
            Equations
            • QuadraticForm.instZeroQuadraticForm = { zero := { toFun := fun (x : M) => 0, toFun_smul := , exists_companion' := } }
            @[simp]
            theorem QuadraticForm.coeFn_zero {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] :
            0 = 0
            @[simp]
            theorem QuadraticForm.zero_apply {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (x : M) :
            0 x = 0
            Equations
            • QuadraticForm.instInhabitedQuadraticForm = { default := 0 }
            Equations
            • QuadraticForm.instAddQuadraticForm = { add := fun (Q Q' : QuadraticForm R M) => { toFun := Q + Q', toFun_smul := , exists_companion' := } }
            @[simp]
            theorem QuadraticForm.coeFn_add {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) (Q' : QuadraticForm R M) :
            (Q + Q') = Q + Q'
            @[simp]
            theorem QuadraticForm.add_apply {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) (Q' : QuadraticForm R M) (x : M) :
            (Q + Q') x = Q x + Q' x
            Equations
            @[simp]
            theorem QuadraticForm.coeFnAddMonoidHom_apply {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] :
            ∀ (a : QuadraticForm R M) (a_1 : M), QuadraticForm.coeFnAddMonoidHom a a_1 = a a_1
            def QuadraticForm.coeFnAddMonoidHom {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] :
            QuadraticForm R M →+ MR

            @CoeFn (QuadraticForm R M) as an AddMonoidHom.

            This API mirrors AddMonoidHom.coeFn.

            Equations
            • QuadraticForm.coeFnAddMonoidHom = { toZeroHom := { toFun := DFunLike.coe, map_zero' := }, map_add' := }
            Instances For
              @[simp]
              theorem QuadraticForm.evalAddMonoidHom_apply {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (m : M) :
              def QuadraticForm.evalAddMonoidHom {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (m : M) :

              Evaluation on a particular element of the module M is an additive map over quadratic forms.

              Equations
              Instances For
                @[simp]
                theorem QuadraticForm.coeFn_sum {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {ι : Type u_6} (Q : ιQuadraticForm R M) (s : Finset ι) :
                (Finset.sum s fun (i : ι) => Q i) = Finset.sum s fun (i : ι) => (Q i)
                @[simp]
                theorem QuadraticForm.sum_apply {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {ι : Type u_6} (Q : ιQuadraticForm R M) (s : Finset ι) (x : M) :
                (Finset.sum s fun (i : ι) => Q i) x = Finset.sum s fun (i : ι) => (Q i) x
                Equations
                • QuadraticForm.instDistribMulActionQuadraticFormToAddMonoidInstAddCommMonoidQuadraticForm = DistribMulAction.mk
                Equations
                • QuadraticForm.instModuleQuadraticFormInstAddCommMonoidQuadraticForm = Module.mk
                Equations
                • QuadraticForm.instNegQuadraticFormToCommSemiringToAddCommMonoid = { neg := fun (Q : QuadraticForm R M) => { toFun := -Q, toFun_smul := , exists_companion' := } }
                @[simp]
                theorem QuadraticForm.coeFn_neg {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) :
                (-Q) = -Q
                @[simp]
                theorem QuadraticForm.neg_apply {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (x : M) :
                (-Q) x = -Q x
                Equations
                @[simp]
                theorem QuadraticForm.coeFn_sub {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (Q' : QuadraticForm R M) :
                (Q - Q') = Q - Q'
                @[simp]
                theorem QuadraticForm.sub_apply {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (Q : QuadraticForm R M) (Q' : QuadraticForm R M) (x : M) :
                (Q - Q') x = Q x - Q' x
                Equations
                def QuadraticForm.comp {R : Type u_3} {M : Type u_4} {N : Type u_5} [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N] (Q : QuadraticForm R N) (f : M →ₗ[R] N) :

                Compose the quadratic form with a linear function.

                Equations
                • QuadraticForm.comp Q f = { toFun := fun (x : M) => Q (f x), toFun_smul := , exists_companion' := }
                Instances For
                  @[simp]
                  theorem QuadraticForm.comp_apply {R : Type u_3} {M : Type u_4} {N : Type u_5} [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N] (Q : QuadraticForm R N) (f : M →ₗ[R] N) (x : M) :
                  (QuadraticForm.comp Q f) x = Q (f x)
                  @[simp]
                  theorem LinearMap.compQuadraticForm_apply {S : Type u_1} {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M] (f : R →ₗ[S] S) (Q : QuadraticForm R M) (x : M) :
                  def LinearMap.compQuadraticForm {S : Type u_1} {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M] (f : R →ₗ[S] S) (Q : QuadraticForm R M) :

                  Compose a quadratic form with a linear function on the left.

                  Equations
                  Instances For
                    def QuadraticForm.linMulLin {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (f : M →ₗ[R] R) (g : M →ₗ[R] R) :

                    The product of linear forms is a quadratic form.

                    Equations
                    Instances For
                      @[simp]
                      theorem QuadraticForm.linMulLin_apply {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (f : M →ₗ[R] R) (g : M →ₗ[R] R) (x : M) :
                      (QuadraticForm.linMulLin f g) x = f x * g x
                      @[simp]
                      @[simp]
                      @[simp]
                      theorem QuadraticForm.linMulLin_comp {R : Type u_3} {M : Type u_4} {N : Type u_5} [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N] (f : M →ₗ[R] R) (g : M →ₗ[R] R) (h : N →ₗ[R] M) :
                      @[simp]
                      theorem QuadraticForm.sq_apply {R : Type u_3} [CommSemiring R] (a : R) :
                      QuadraticForm.sq a = a * a

                      sq is the quadratic form mapping the vector x : R to x * x

                      Equations
                      Instances For
                        def QuadraticForm.proj {R : Type u_3} [CommSemiring R] {n : Type u_6} (i : n) (j : n) :
                        QuadraticForm R (nR)

                        proj i j is the quadratic form mapping the vector x : n → R to x i * x j

                        Equations
                        Instances For
                          @[simp]
                          theorem QuadraticForm.proj_apply {R : Type u_3} [CommSemiring R] {n : Type u_6} (i : n) (j : n) (x : nR) :
                          (QuadraticForm.proj i j) x = x i * x j

                          Associated bilinear forms #

                          Over a commutative ring with an inverse of 2, the theory of quadratic forms is basically identical to that of symmetric bilinear forms. The map from quadratic forms to bilinear forms giving this identification is called the associated quadratic form.

                          A bilinear map into R gives a quadratic form by applying the argument twice.

                          Equations
                          Instances For

                            LinearMap.BilinForm.toQuadraticForm as an additive homomorphism

                            Equations
                            Instances For
                              @[simp]

                              LinearMap.BilinForm.toQuadraticForm as a linear map

                              Equations
                              Instances For
                                @[simp]
                                theorem LinearMap.BilinForm.toQuadraticForm_list_sum {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (B : List (LinearMap.BilinForm R M)) :
                                LinearMap.BilinForm.toQuadraticForm (List.sum B) = List.sum (List.map LinearMap.BilinForm.toQuadraticForm B)
                                @[simp]
                                theorem LinearMap.BilinForm.toQuadraticForm_sum {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {ι : Type u_6} (s : Finset ι) (B : ιLinearMap.BilinForm R M) :
                                theorem LinearMap.BilinForm.polar_toQuadraticForm {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] {B : LinearMap.BilinForm R M} (x : M) (y : M) :
                                theorem QuadraticForm.polarBilin_injective {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] (h : IsUnit 2) :
                                Function.Injective QuadraticForm.polarBilin
                                theorem LinearMap.BilinForm.compQuadraticForm_polar {S : Type u_1} {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] [CommRing S] [Algebra S R] [Module S M] [IsScalarTower S R M] (f : R →ₗ[S] S) (Q : QuadraticForm R M) (x : M) (y : M) :

                                associatedHom is the map that sends a quadratic form on a module M over R to its associated symmetric bilinear form. 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 QuadraticForm.associated, which gives an R-linear map. Over a general ring with no nontrivial distinguished commutative subring, use QuadraticForm.associated', which gives an additive homomorphism (or more precisely a -linear map.)

                                Equations
                                Instances For
                                  @[simp]
                                  theorem QuadraticForm.associated_apply (S : Type u_1) {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] [CommSemiring S] [Algebra S R] [Invertible 2] (Q : QuadraticForm R M) (x : M) (y : M) :
                                  (((QuadraticForm.associatedHom S) Q) x) y = 2 * (Q (x + y) - Q x - Q y)
                                  theorem QuadraticForm.associated_toQuadraticForm (S : Type u_1) {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] [CommSemiring S] [Algebra S R] [Invertible 2] (B : LinearMap.BilinForm R M) (x : M) (y : M) :
                                  theorem QuadraticForm.associated_eq_self_apply (S : Type u_1) {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] [CommSemiring S] [Algebra S R] [Invertible 2] (Q : QuadraticForm R M) (x : M) :
                                  (((QuadraticForm.associatedHom S) Q) x) x = Q x
                                  theorem QuadraticForm.associated_rightInverse (S : Type u_1) {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] [CommSemiring S] [Algebra S R] [Invertible 2] :
                                  Function.RightInverse ((QuadraticForm.associatedHom S)) LinearMap.BilinForm.toQuadraticForm
                                  @[inline, reducible]

                                  associated' is the -linear map that sends a quadratic form on a module M over R to its associated symmetric bilinear form.

                                  Equations
                                  Instances For
                                    instance QuadraticForm.canLift {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] [Invertible 2] :

                                    Symmetric bilinear forms can be lifted to quadratic forms

                                    Equations
                                    • =
                                    theorem QuadraticForm.exists_quadraticForm_ne_zero {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] [Invertible 2] {Q : QuadraticForm R M} (hB₁ : QuadraticForm.associated' Q 0) :
                                    ∃ (x : M), Q x 0

                                    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.

                                    @[inline, reducible]

                                    associated is the linear map that sends a quadratic form over a commutative ring to its associated symmetric bilinear form.

                                    Equations
                                    Instances For
                                      theorem QuadraticForm.coe_associatedHom (S : Type u_1) {R : Type u_3} {M : Type u_4} [CommSemiring S] [CommRing R] [AddCommGroup M] [Algebra S R] [Module R M] [Invertible 2] :
                                      (QuadraticForm.associatedHom S) = QuadraticForm.associated
                                      @[simp]
                                      theorem QuadraticForm.associated_linMulLin {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] [Invertible 2] (f : M →ₗ[R] R) (g : M →ₗ[R] R) :
                                      @[simp]
                                      theorem QuadraticForm.associated_sq {R : Type u_3} [CommRing R] [Invertible 2] :
                                      QuadraticForm.associated QuadraticForm.sq = LinearMap.mul R R

                                      Orthogonality #

                                      def QuadraticForm.IsOrtho {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) (x : M) (y : M) :

                                      The proposition that two elements of a quadratic form space are orthogonal.

                                      Equations
                                      Instances For
                                        theorem QuadraticForm.isOrtho_def {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {Q : QuadraticForm R M} {x : M} {y : M} :
                                        QuadraticForm.IsOrtho Q x y Q (x + y) = Q x + Q y
                                        theorem QuadraticForm.IsOrtho.all {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (x : M) (y : M) :
                                        theorem QuadraticForm.IsOrtho.zero_left {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {Q : QuadraticForm R M} (x : M) :
                                        theorem QuadraticForm.IsOrtho.zero_right {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {Q : QuadraticForm R M} (x : M) :
                                        theorem QuadraticForm.ne_zero_of_not_isOrtho_self {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {Q : QuadraticForm R M} (x : M) (hx₁ : ¬QuadraticForm.IsOrtho Q x x) :
                                        x 0
                                        theorem QuadraticForm.isOrtho_comm {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {Q : QuadraticForm R M} {x : M} {y : M} :
                                        theorem QuadraticForm.IsOrtho.symm {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {Q : QuadraticForm R M} {x : M} {y : M} :

                                        Alias of the forward direction of QuadraticForm.isOrtho_comm.

                                        @[simp]
                                        theorem QuadraticForm.IsOrtho.polar_eq_zero {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] {Q : QuadraticForm R M} {x : M} {y : M} (h : QuadraticForm.IsOrtho Q x y) :
                                        QuadraticForm.polar (Q) x y = 0
                                        @[simp]
                                        theorem QuadraticForm.associated_isOrtho {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] {Q : QuadraticForm R M} [Invertible 2] {x : M} {y : M} :
                                        LinearMap.IsOrtho (QuadraticForm.associated Q) x y QuadraticForm.IsOrtho Q x y
                                        def QuadraticForm.Anisotropic {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] (Q : QuadraticForm R M) :

                                        An anisotropic quadratic form is zero only on zero vectors.

                                        Equations
                                        Instances For
                                          theorem QuadraticForm.Anisotropic.eq_zero_iff {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {Q : QuadraticForm R M} (h : QuadraticForm.Anisotropic Q) {x : M} :
                                          Q x = 0 x = 0
                                          theorem QuadraticForm.separatingLeft_of_anisotropic {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] [Invertible 2] (Q : QuadraticForm R M) (hB : QuadraticForm.Anisotropic Q) :
                                          LinearMap.SeparatingLeft (QuadraticForm.associated' Q)

                                          The associated bilinear form of an anisotropic quadratic form is nondegenerate.

                                          def QuadraticForm.PosDef {M : Type u_4} {R₂ : Type u} [OrderedCommRing R₂] [AddCommMonoid M] [Module R₂ M] (Q₂ : QuadraticForm R₂ M) :

                                          A positive definite quadratic form is positive on nonzero vectors.

                                          Equations
                                          Instances For
                                            theorem QuadraticForm.PosDef.smul {M : Type u_4} [AddCommMonoid M] {R : Type u_6} [LinearOrderedCommRing R] [Module R M] {Q : QuadraticForm R M} (h : QuadraticForm.PosDef Q) {a : R} (a_pos : 0 < a) :
                                            theorem QuadraticForm.PosDef.nonneg {M : Type u_4} {R₂ : Type u} [OrderedCommRing R₂] [AddCommMonoid M] [Module R₂ M] {Q : QuadraticForm R₂ M} (hQ : QuadraticForm.PosDef Q) (x : M) :
                                            0 Q x
                                            theorem QuadraticForm.posDef_of_nonneg {M : Type u_4} {R₂ : Type u} [OrderedCommRing R₂] [AddCommMonoid M] [Module R₂ M] {Q : QuadraticForm R₂ M} (h : ∀ (x : M), 0 Q x) (h0 : QuadraticForm.Anisotropic Q) :
                                            theorem QuadraticForm.posDef_iff_nonneg {M : Type u_4} {R₂ : Type u} [OrderedCommRing R₂] [AddCommMonoid M] [Module R₂ M] {Q : QuadraticForm R₂ M} :
                                            theorem QuadraticForm.PosDef.add {M : Type u_4} {R₂ : Type u} [OrderedCommRing R₂] [AddCommMonoid M] [Module R₂ M] (Q : QuadraticForm R₂ M) (Q' : QuadraticForm R₂ M) (hQ : QuadraticForm.PosDef Q) (hQ' : QuadraticForm.PosDef Q') :

                                            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.

                                            def Matrix.toQuadraticForm' {R : Type u_3} {n : Type w} [Fintype n] [DecidableEq n] [CommRing R] (M : Matrix n n R) :
                                            QuadraticForm R (nR)

                                            M.toQuadraticForm' is the map fun x ↦ col x * M * row x as a quadratic form.

                                            Equations
                                            Instances For
                                              def QuadraticForm.toMatrix' {R : Type u_3} {n : Type w} [Fintype n] [DecidableEq n] [CommRing R] [Invertible 2] (Q : QuadraticForm R (nR)) :
                                              Matrix n n R

                                              A matrix representation of the quadratic form.

                                              Equations
                                              Instances For
                                                @[simp]
                                                theorem QuadraticForm.toMatrix'_comp {R : Type u_3} {n : Type w} [Fintype n] [CommRing R] [DecidableEq n] [Invertible 2] {m : Type w} [DecidableEq m] [Fintype m] (Q : QuadraticForm R (mR)) (f : (nR) →ₗ[R] mR) :
                                                QuadraticForm.toMatrix' (QuadraticForm.comp Q f) = Matrix.transpose (LinearMap.toMatrix' f) * QuadraticForm.toMatrix' Q * LinearMap.toMatrix' f
                                                def QuadraticForm.discr {R : Type u_3} {n : Type w} [Fintype n] [CommRing R] [DecidableEq n] [Invertible 2] (Q : QuadraticForm R (nR)) :
                                                R

                                                The discriminant of a quadratic form generalizes the discriminant of a quadratic polynomial.

                                                Equations
                                                Instances For
                                                  theorem QuadraticForm.discr_comp {R : Type u_3} {n : Type w} [Fintype n] [CommRing R] [DecidableEq n] [Invertible 2] {Q : QuadraticForm R (nR)} (f : (nR) →ₗ[R] nR) :
                                                  QuadraticForm.discr (QuadraticForm.comp Q f) = Matrix.det (LinearMap.toMatrix' f) * Matrix.det (LinearMap.toMatrix' f) * QuadraticForm.discr Q

                                                  A bilinear form is separating left if the quadratic form it is associated with is anisotropic.

                                                  theorem LinearMap.BilinForm.exists_bilinForm_self_ne_zero {R : Type u_3} {M : Type u_4} [CommRing R] [AddCommGroup M] [Module R M] [htwo : Invertible 2] {B : LinearMap.BilinForm R M} (hB₁ : B 0) (hB₂ : LinearMap.IsSymm B) :
                                                  ∃ (x : M), ¬LinearMap.IsOrtho B x x

                                                  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.

                                                  noncomputable def QuadraticForm.basisRepr {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {ι : Type u_6} [Finite ι] (Q : QuadraticForm R M) (v : Basis ι R M) :
                                                  QuadraticForm R (ιR)

                                                  Given a quadratic form Q and a basis, basisRepr is the basis representation of Q.

                                                  Equations
                                                  Instances For
                                                    @[simp]
                                                    theorem QuadraticForm.basisRepr_apply {R : Type u_3} {M : Type u_4} [CommSemiring R] [AddCommMonoid M] [Module R M] {ι : Type u_6} [Fintype ι] {v : Basis ι R M} (Q : QuadraticForm R M) (w : ιR) :
                                                    (QuadraticForm.basisRepr Q v) w = Q (Finset.sum Finset.univ fun (i : ι) => w i v i)
                                                    def QuadraticForm.weightedSumSquares {S : Type u_1} (R : Type u_3) [CommSemiring R] {ι : Type u_6} [Fintype ι] [Monoid S] [DistribMulAction S R] [SMulCommClass S R R] (w : ιS) :
                                                    QuadraticForm R (ιR)

                                                    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
                                                    Instances For
                                                      @[simp]
                                                      theorem QuadraticForm.weightedSumSquares_apply {S : Type u_1} {R : Type u_3} [CommSemiring R] {ι : Type u_6} [Fintype ι] [Monoid S] [DistribMulAction S R] [SMulCommClass S R R] (w : ιS) (v : ιR) :
                                                      (QuadraticForm.weightedSumSquares R w) v = Finset.sum Finset.univ fun (i : ι) => w i (v i * v i)
                                                      theorem QuadraticForm.basisRepr_eq_of_iIsOrtho {ι : Type u_6} [Fintype ι] {R : Type u_7} {M : Type u_8} [CommRing R] [AddCommGroup M] [Module R M] [Invertible 2] (Q : QuadraticForm R M) (v : Basis ι R M) (hv₂ : LinearMap.IsOrthoᵢ (QuadraticForm.associated Q) v) :

                                                      On an orthogonal basis, the basis representation of Q is just a sum of squares.