File: Mathlib/LinearAlgebra/QuadraticForm/Basic.lean

full_name: QuadraticMap.polar
code: /-- 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
-/
def polar (f : M → N) (x y : M) 
goal: N

full_name: QuadraticMap.map_add
code: protected theorem map_add (f : M → N) (x y : M) :
    f (x + y) = f x + f y + polar f x y 
goal: f (x + y) = f x + f y + QuadraticMap.polar f x y

full_name: QuadraticMap.polar_add
code: theorem polar_add (f g : M → N) (x y : M) : polar (f + g) x y = polar f x y + polar g x y 
goal: QuadraticMap.polar (f + g) x y = QuadraticMap.polar f x y + QuadraticMap.polar g x y

full_name: QuadraticMap.polar_neg
code: theorem polar_neg (f : M → N) (x y : M) : polar (-f) x y = -polar f x y 
goal: QuadraticMap.polar (-f) x y = -QuadraticMap.polar f x y

full_name: QuadraticMap.polar_smul
code: theorem polar_smul [Monoid S] [DistribMulAction S N] (f : M → N) (s : S) (x y : M) :
    polar (s • f) x y = s • polar f x y 
goal: QuadraticMap.polar (s • f) x y = s • QuadraticMap.polar f x y

full_name: QuadraticMap.polar_comm
code: theorem polar_comm (f : M → N) (x y : M) : polar f x y = polar f y x 
goal: QuadraticMap.polar f x y = QuadraticMap.polar f y x

full_name: QuadraticMap.polar_add_left_iff
code: /-- Auxiliary lemma to express bilinearity of `QuadraticMap.polar` without subtraction. -/
theorem polar_add_left_iff {f : M → N} {x x' y : M} :
    polar f (x + x') y = polar f x y + polar f x' y ↔
      f (x + x' + y) + (f x + f x' + f y) = f (x + x') + f (x' + y) + f (y + x) 
goal: QuadraticMap.polar f (x + x') y = QuadraticMap.polar f x y + QuadraticMap.polar f x' y ↔
  f (x + x' + y) + (f x + f x' + f y) = f (x + x') + f (x' + y) + f (y + x)

full_name: QuadraticMap.polar_comp
code: theorem polar_comp {F : Type*} [CommRing S] [FunLike F N S] [AddMonoidHomClass F N S]
    (f : M → N) (g : F) (x y : M) :
    polar (g ∘ f) x y = g (polar f x y) 
goal: QuadraticMap.polar (⇑g ∘ f) x y = g (QuadraticMap.polar f x y)

full_name: QuadraticMap.toFun_smul
code: /-- A quadratic map on a module.

For a more familiar constructor when `R` is a ring, see `QuadraticMap.ofPolar`. -/
structure QuadraticMap (R : Type u) (M : Type v) (N : Type w) [CommSemiring R] [AddCommMonoid M]
    [Module R M] [AddCommMonoid N] [Module R N] where
  toFun : M → N
  toFun_smul : ∀ (a : R) (x : M), toFun (a • x) = (a * a) • toFun x
  exists_companion' : ∃ B : BilinMap R M N, ∀ x y, toFun (x + y) = toFun x + toFun y + B x y
goal: self.toFun (a • x) = (a * a) • self.toFun x

full_name: QuadraticMap
code: /-- A quadratic map on a module.

For a more familiar constructor when `R` is a ring, see `QuadraticMap.ofPolar`. -/
structure QuadraticMap (R : Type u) (M : Type v) (N : Type w) [CommSemiring R] [AddCommMonoid M]
    [Module R M] [AddCommMonoid N] [Module R N] where
  toFun : M → N
  toFun_smul : ∀ (a : R) (x : M), toFun (a • x) = (a * a) • toFun x
  exists_companion' : ∃ B : BilinMap R M N, ∀ x y, toFun (x + y) = toFun x + toFun y + B x y
goal: Type (max v w)

full_name: QuadraticMap.toFun
code: /-- A quadratic map on a module.

For a more familiar constructor when `R` is a ring, see `QuadraticMap.ofPolar`. -/
structure QuadraticMap (R : Type u) (M : Type v) (N : Type w) [CommSemiring R] [AddCommMonoid M]
    [Module R M] [AddCommMonoid N] [Module R N] where
  toFun : M → N
  toFun_smul : ∀ (a : R) (x : M), toFun (a • x) = (a * a) • toFun x
  exists_companion' : ∃ B : BilinMap R M N, ∀ x y, toFun (x + y) = toFun x + toFun y + B x y
goal: M → N

full_name: QuadraticMap.exists_companion'
code: /-- A quadratic map on a module.

For a more familiar constructor when `R` is a ring, see `QuadraticMap.ofPolar`. -/
structure QuadraticMap (R : Type u) (M : Type v) (N : Type w) [CommSemiring R] [AddCommMonoid M]
    [Module R M] [AddCommMonoid N] [Module R N] where
  toFun : M → N
  toFun_smul : ∀ (a : R) (x : M), toFun (a • x) = (a * a) • toFun x
  exists_companion' : ∃ B : BilinMap R M N, ∀ x y, toFun (x + y) = toFun x + toFun y + B x y
goal: ∃ B, ∀ (x y : M), self.toFun (x + y) = self.toFun x + self.toFun y + (B x) y

full_name: QuadraticForm
code: /-- A quadratic form on a module. -/
abbrev QuadraticForm : Type _ 
goal: Type (max u v)

full_name: QuadraticMap.instFunLike
code: instance instFunLike : FunLike (QuadraticMap R M N) M N 
goal: FunLike (QuadraticMap R M N) M N

full_name: QuadraticMap.instCoeFunForall
code: /-- Helper instance for when there's too many metavariables to apply
`DFunLike.hasCoeToFun` directly. -/
instance : CoeFun (QuadraticMap R M N) fun _ => M → N 
goal: CoeFun (QuadraticMap R M N) fun x => M → N

full_name: QuadraticMap.toFun_eq_coe
code: /-- The `simp` normal form for a quadratic map is `DFunLike.coe`, not `toFun`. -/
@[simp]
theorem toFun_eq_coe : Q.toFun = ⇑Q 
goal: Q.toFun = ⇑Q

full_name: QuadraticMap.ext
code: @[ext]
theorem ext (H : ∀ x : M, Q x = Q' x) : Q = Q' 
goal: Q = Q'

full_name: QuadraticMap.congr_fun
code: theorem congr_fun (h : Q = Q') (x : M) : Q x = Q' x 
goal: Q x = Q' x

full_name: QuadraticMap.ext_iff
code: theorem ext_iff : Q = Q' ↔ ∀ x, Q x = Q' x 
goal: Q = Q' ↔ ∀ (x : M), Q x = Q' x

full_name: QuadraticMap.copy
code: /-- Copy of a `QuadraticMap` with a new `toFun` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (Q : QuadraticMap R M N) (Q' : M → N) (h : Q' = ⇑Q) : QuadraticMap R M N 
goal: QuadraticMap R M N

full_name: QuadraticMap.coe_copy
code: @[simp]
theorem coe_copy (Q : QuadraticMap R M N) (Q' : M → N) (h : Q' = ⇑Q) : ⇑(Q.copy Q' h) = Q' 
goal: ⇑(Q.copy Q' h) = Q'

full_name: QuadraticMap.copy_eq
code: theorem copy_eq (Q : QuadraticMap R M N) (Q' : M → N) (h : Q' = ⇑Q) : Q.copy Q' h = Q 
goal: Q.copy Q' h = Q

full_name: QuadraticMap.map_smul
code: theorem map_smul (a : R) (x : M) : Q (a • x) = (a * a) • Q x 
goal: Q (a • x) = (a * a) • Q x

full_name: QuadraticMap.exists_companion
code: theorem exists_companion : ∃ B : BilinMap R M N, ∀ x y, Q (x + y) = Q x + Q y + B x y 
goal: ∃ B, ∀ (x y : M), Q (x + y) = Q x + Q y + (B x) y

full_name: QuadraticMap.map_add_add_add_map
code: theorem map_add_add_add_map (x y z : M) :
    Q (x + y + z) + (Q x + Q y + Q z) = Q (x + y) + Q (y + z) + Q (z + x) 
goal: Q (x + y + z) + (Q x + Q y + Q z) = Q (x + y) + Q (y + z) + Q (z + x)

full_name: QuadraticMap.map_add_self
code: theorem map_add_self (x : M) : Q (x + x) = 4 • Q x 
goal: Q (x + x) = 4 • Q x

full_name: QuadraticMap.map_zero
code: protected theorem map_zero : Q 0 = 0 
goal: Q 0 = 0

full_name: QuadraticMap.zeroHomClass
code: instance zeroHomClass : ZeroHomClass (QuadraticMap R M N) M N 
goal: ZeroHomClass (QuadraticMap R M N) M N

full_name: QuadraticMap.map_smul_of_tower
code: theorem map_smul_of_tower [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M]
    [Module S N] [IsScalarTower S R N] (a : S)
    (x : M) : Q (a • x) = (a * a) • Q x 
goal: Q (a • x) = (a * a) • Q x

full_name: QuadraticMap.map_neg
code: @[simp]
theorem map_neg (x : M) : Q (-x) = Q x 
goal: Q (-x) = Q x

full_name: QuadraticMap.map_sub
code: theorem map_sub (x y : M) : Q (x - y) = Q (y - x) 
goal: Q (x - y) = Q (y - x)

full_name: QuadraticMap.polar_zero_left
code: @[simp]
theorem polar_zero_left (y : M) : polar Q 0 y = 0 
goal: QuadraticMap.polar (⇑Q) 0 y = 0

full_name: QuadraticMap.polar_add_left
code: @[simp]
theorem polar_add_left (x x' y : M) : polar Q (x + x') y = polar Q x y + polar Q x' y 
goal: QuadraticMap.polar (⇑Q) (x + x') y = QuadraticMap.polar (⇑Q) x y + QuadraticMap.polar (⇑Q) x' y

full_name: QuadraticMap.polar_smul_left
code: @[simp]
theorem polar_smul_left (a : R) (x y : M) : polar Q (a • x) y = a • polar Q x y 
goal: QuadraticMap.polar (⇑Q) (a • x) y = a • QuadraticMap.polar (⇑Q) x y

full_name: QuadraticMap.polar_neg_left
code: @[simp]
theorem polar_neg_left (x y : M) : polar Q (-x) y = -polar Q x y 
goal: QuadraticMap.polar (⇑Q) (-x) y = -QuadraticMap.polar (⇑Q) x y

full_name: QuadraticMap.polar_sub_left
code: @[simp]
theorem polar_sub_left (x x' y : M) : polar Q (x - x') y = polar Q x y - polar Q x' y 
goal: QuadraticMap.polar (⇑Q) (x - x') y = QuadraticMap.polar (⇑Q) x y - QuadraticMap.polar (⇑Q) x' y

full_name: QuadraticMap.polar_zero_right
code: @[simp]
theorem polar_zero_right (y : M) : polar Q y 0 = 0 
goal: QuadraticMap.polar (⇑Q) y 0 = 0

full_name: QuadraticMap.polar_add_right
code: @[simp]
theorem polar_add_right (x y y' : M) : polar Q x (y + y') = polar Q x y + polar Q x y' 
goal: QuadraticMap.polar (⇑Q) x (y + y') = QuadraticMap.polar (⇑Q) x y + QuadraticMap.polar (⇑Q) x y'

full_name: QuadraticMap.polar_smul_right
code: @[simp]
theorem polar_smul_right (a : R) (x y : M) : polar Q x (a • y) = a • polar Q x y 
goal: QuadraticMap.polar (⇑Q) x (a • y) = a • QuadraticMap.polar (⇑Q) x y

full_name: QuadraticMap.polar_neg_right
code: @[simp]
theorem polar_neg_right (x y : M) : polar Q x (-y) = -polar Q x y 
goal: QuadraticMap.polar (⇑Q) x (-y) = -QuadraticMap.polar (⇑Q) x y

full_name: QuadraticMap.polar_sub_right
code: @[simp]
theorem polar_sub_right (x y y' : M) : polar Q x (y - y') = polar Q x y - polar Q x y' 
goal: QuadraticMap.polar (⇑Q) x (y - y') = QuadraticMap.polar (⇑Q) x y - QuadraticMap.polar (⇑Q) x y'

full_name: QuadraticMap.polar_self
code: @[simp]
theorem polar_self (x : M) : polar Q x x = 2 • Q x 
goal: QuadraticMap.polar (⇑Q) x x = 2 • Q x

full_name: QuadraticMap.polarBilin_apply_apply
code: /-- `QuadraticMap.polar` as a bilinear map -/
@[simps!]
def polarBilin : BilinMap R M N 
goal: (Q.polarBilin m) y = QuadraticMap.polar (⇑Q) m y

full_name: QuadraticMap.polarBilin
code: /-- `QuadraticMap.polar` as a bilinear map -/
@[simps!]
def polarBilin : BilinMap R M N 
goal: LinearMap.BilinMap R M N

full_name: QuadraticMap.polar_smul_left_of_tower
code: @[simp]
theorem polar_smul_left_of_tower (a : S) (x y : M) : polar Q (a • x) y = a • polar Q x y 
goal: QuadraticMap.polar (⇑Q) (a • x) y = a • QuadraticMap.polar (⇑Q) x y

full_name: QuadraticMap.polar_smul_right_of_tower
code: @[simp]
theorem polar_smul_right_of_tower (a : S) (x y : M) : polar Q x (a • y) = a • polar Q x y 
goal: QuadraticMap.polar (⇑Q) x (a • y) = a • QuadraticMap.polar (⇑Q) x y

full_name: QuadraticMap.ofPolar_apply
code: /-- An alternative constructor to `QuadraticMap.mk`, for rings where `polar` can be used. -/
@[simps]
def ofPolar (toFun : M → N) (toFun_smul : ∀ (a : R) (x : M), toFun (a • x) = (a * a) • toFun x)
    (polar_add_left : ∀ x x' y : M, polar toFun (x + x') y = polar toFun x y + polar toFun x' y)
    (polar_smul_left : ∀ (a : R) (x y : M), polar toFun (a • x) y = a • polar toFun x y) :
    QuadraticMap R M N 
goal: ∀ (a : M), (QuadraticMap.ofPolar toFun toFun_smul polar_add_left polar_smul_left) a = toFun a

full_name: QuadraticMap.ofPolar
code: /-- An alternative constructor to `QuadraticMap.mk`, for rings where `polar` can be used. -/
@[simps]
def ofPolar (toFun : M → N) (toFun_smul : ∀ (a : R) (x : M), toFun (a • x) = (a * a) • toFun x)
    (polar_add_left : ∀ x x' y : M, polar toFun (x + x') y = polar toFun x y + polar toFun x' y)
    (polar_smul_left : ∀ (a : R) (x y : M), polar toFun (a • x) y = a • polar toFun x y) :
    QuadraticMap R M N 
goal: QuadraticMap R M N

full_name: QuadraticMap.choose_exists_companion
code: /-- In a ring the companion bilinear form is unique and equal to `QuadraticMap.polar`. -/
theorem choose_exists_companion : Q.exists_companion.choose = polarBilin Q 
goal: ⋯.choose = Q.polarBilin

full_name: QuadraticMap.map_sum
code: protected theorem map_sum {ι} [DecidableEq ι] (Q : QuadraticMap R M N) (s : Finset ι) (f : ι → M) :
    Q (∑ i ∈ s, f i) = ∑ i ∈ s, Q (f i) +
      ∑ ij in s.sym2.filter (¬ ·.IsDiag),
        Sym2.lift ⟨fun i j => polar Q (f i) (f j), fun _ _ => polar_comm _ _ _⟩ ij 
goal: Q (∑ i ∈ s, f i) =
  ∑ i ∈ s, Q (f i) +
    ∑ ij ∈ Finset.filter (fun x => ¬x.IsDiag) s.sym2, Sym2.lift ⟨fun i j => QuadraticMap.polar (⇑Q) (f i) (f j), ⋯⟩ ij

full_name: QuadraticMap.map_sum'
code: protected theorem map_sum' {ι} (Q : QuadraticMap R M N) (s : Finset ι) (f : ι → M) :
    Q (∑ i ∈ s, f i) =
      ∑ ij in s.sym2,
        Sym2.lift ⟨fun i j => polar Q (f i) (f j), fun _ _ => polar_comm _ _ _⟩ ij
      - ∑ i ∈ s, Q (f i) 
goal: Q (∑ i ∈ s, f i) = ∑ ij ∈ s.sym2, Sym2.lift ⟨fun i j => QuadraticMap.polar (⇑Q) (f i) (f j), ⋯⟩ ij - ∑ i ∈ s, Q (f i)

full_name: QuadraticMap.instSMul
code: /-- `QuadraticMap R M N` inherits the scalar action from any algebra over `R`.

This provides an `R`-action via `Algebra.id`. -/
instance : SMul S (QuadraticMap R M N) 
goal: SMul S (QuadraticMap R M N)

full_name: QuadraticMap.coeFn_smul
code: @[simp]
theorem coeFn_smul (a : S) (Q : QuadraticMap R M N) : ⇑(a • Q) = a • ⇑Q 
goal: ⇑(a • Q) = a • ⇑Q

full_name: QuadraticMap.smul_apply
code: @[simp]
theorem smul_apply (a : S) (Q : QuadraticMap R M N) (x : M) : (a • Q) x = a • Q x 
goal: (a • Q) x = a • Q x

full_name: QuadraticMap.instSMulCommClass
code: instance [SMulCommClass S T N] : SMulCommClass S T (QuadraticMap R M N) 
goal: SMulCommClass S T (QuadraticMap R M N)

full_name: QuadraticMap.instIsScalarTower
code: instance [SMul S T] [IsScalarTower S T N] : IsScalarTower S T (QuadraticMap R M N) 
goal: IsScalarTower S T (QuadraticMap R M N)

full_name: QuadraticMap.instZero
code: instance : Zero (QuadraticMap R M N) 
goal: Zero (QuadraticMap R M N)

full_name: QuadraticMap.coeFn_zero
code: @[simp]
theorem coeFn_zero : ⇑(0 : QuadraticMap R M N) = 0 
goal: ⇑0 = 0

full_name: QuadraticMap.zero_apply
code: @[simp]
theorem zero_apply (x : M) : (0 : QuadraticMap R M N) x = 0 
goal: 0 x = 0

full_name: QuadraticMap.instInhabited
code: instance : Inhabited (QuadraticMap R M N) 
goal: Inhabited (QuadraticMap R M N)

full_name: QuadraticMap.instAdd
code: instance : Add (QuadraticMap R M N) 
goal: Add (QuadraticMap R M N)

full_name: QuadraticMap.coeFn_add
code: @[simp]
theorem coeFn_add (Q Q' : QuadraticMap R M N) : ⇑(Q + Q') = Q + Q' 
goal: ⇑(Q + Q') = ⇑Q + ⇑Q'

full_name: QuadraticMap.add_apply
code: @[simp]
theorem add_apply (Q Q' : QuadraticMap R M N) (x : M) : (Q + Q') x = Q x + Q' x 
goal: (Q + Q') x = Q x + Q' x

full_name: QuadraticMap.instAddCommMonoid
code: instance : AddCommMonoid (QuadraticMap R M N) 
goal: AddCommMonoid (QuadraticMap R M N)

full_name: QuadraticMap.coeFnAddMonoidHom_apply
code: /-- `@CoeFn (QuadraticMap R M)` as an `AddMonoidHom`.

This API mirrors `AddMonoidHom.coeFn`. -/
@[simps apply]
def coeFnAddMonoidHom : QuadraticMap R M N →+ M → N 
goal: ∀ (a : QuadraticMap R M N) (a_1 : M), QuadraticMap.coeFnAddMonoidHom a a_1 = a a_1

full_name: QuadraticMap.coeFnAddMonoidHom
code: /-- `@CoeFn (QuadraticMap R M)` as an `AddMonoidHom`.

This API mirrors `AddMonoidHom.coeFn`. -/
@[simps apply]
def coeFnAddMonoidHom : QuadraticMap R M N →+ M → N 
goal: QuadraticMap R M N →+ M → N

full_name: QuadraticMap.evalAddMonoidHom_apply
code: /-- Evaluation on a particular element of the module `M` is an additive map on quadratic maps. -/
@[simps! apply]
def evalAddMonoidHom (m : M) : QuadraticMap R M N →+ N 
goal: ∀ (a : QuadraticMap R M N), (QuadraticMap.evalAddMonoidHom m) a = a m

full_name: QuadraticMap.evalAddMonoidHom
code: /-- Evaluation on a particular element of the module `M` is an additive map on quadratic maps. -/
@[simps! apply]
def evalAddMonoidHom (m : M) : QuadraticMap R M N →+ N 
goal: QuadraticMap R M N →+ N

full_name: QuadraticMap.coeFn_sum
code: @[simp]
theorem coeFn_sum {ι : Type*} (Q : ι → QuadraticMap R M N) (s : Finset ι) :
    ⇑(∑ i ∈ s, Q i) = ∑ i ∈ s, ⇑(Q i) 
goal: ⇑(∑ i ∈ s, Q i) = ∑ i ∈ s, ⇑(Q i)

full_name: QuadraticMap.sum_apply
code: @[simp]
theorem sum_apply {ι : Type*} (Q : ι → QuadraticMap R M N) (s : Finset ι) (x : M) :
    (∑ i ∈ s, Q i) x = ∑ i ∈ s, Q i x 
goal: (∑ i ∈ s, Q i) x = ∑ i ∈ s, (Q i) x

full_name: QuadraticMap.instDistribMulActionOfSMulCommClass
code: instance [Monoid S] [DistribMulAction S N] [SMulCommClass S R N] :
    DistribMulAction S (QuadraticMap R M N) 
goal: DistribMulAction S (QuadraticMap R M N)

full_name: QuadraticMap.instModuleOfSMulCommClass
code: instance [Semiring S] [Module S N] [SMulCommClass S R N] :
    Module S (QuadraticMap R M N) 
goal: Module S (QuadraticMap R M N)

full_name: QuadraticMap.instNeg
code: instance : Neg (QuadraticMap R M N) 
goal: Neg (QuadraticMap R M N)

full_name: QuadraticMap.coeFn_neg
code: @[simp]
theorem coeFn_neg (Q : QuadraticMap R M N) : ⇑(-Q) = -Q 
goal: ⇑(-Q) = -⇑Q

full_name: QuadraticMap.neg_apply
code: @[simp]
theorem neg_apply (Q : QuadraticMap R M N) (x : M) : (-Q) x = -Q x 
goal: (-Q) x = -Q x

full_name: QuadraticMap.instSub
code: instance : Sub (QuadraticMap R M N) 
goal: Sub (QuadraticMap R M N)

full_name: QuadraticMap.coeFn_sub
code: @[simp]
theorem coeFn_sub (Q Q' : QuadraticMap R M N) : ⇑(Q - Q') = Q - Q' 
goal: ⇑(Q - Q') = ⇑Q - ⇑Q'

full_name: QuadraticMap.sub_apply
code: @[simp]
theorem sub_apply (Q Q' : QuadraticMap R M N) (x : M) : (Q - Q') x = Q x - Q' x 
goal: (Q - Q') x = Q x - Q' x

full_name: QuadraticMap.instAddCommGroup
code: instance : AddCommGroup (QuadraticMap R M N) 
goal: AddCommGroup (QuadraticMap R M N)

full_name: QuadraticMap.restrictScalars
code: /-- 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. -/
@[simps!]
def restrictScalars (Q : QuadraticMap R M N) : QuadraticMap S M N 
goal: QuadraticMap S M N

full_name: QuadraticMap.restrictScalars_apply
code: /-- 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. -/
@[simps!]
def restrictScalars (Q : QuadraticMap R M N) : QuadraticMap S M N 
goal: Q.restrictScalars x = Q x

full_name: QuadraticMap.comp
code: /-- Compose the quadratic map with a linear function on the right. -/
def comp (Q : QuadraticMap R N P) (f : M →ₗ[R] N) : QuadraticMap R M P 
goal: QuadraticMap R M P

full_name: QuadraticMap.comp_apply
code: @[simp]
theorem comp_apply (Q : QuadraticMap R N P) (f : M →ₗ[R] N) (x : M) : (Q.comp f) x = Q (f x) 
goal: (Q.comp f) x = Q (f x)

full_name: LinearMap.compQuadraticMap
code: /-- Compose a quadratic map with a linear function on the left. -/
@[simps (config := { simpRhs := true })]
def _root_.LinearMap.compQuadraticMap (f : N →ₗ[R] P) (Q : QuadraticMap R M N) :
    QuadraticMap R M P 
goal: QuadraticMap R M P

full_name: LinearMap.compQuadraticMap_apply
code: /-- Compose a quadratic map with a linear function on the left. -/
@[simps (config := { simpRhs := true })]
def _root_.LinearMap.compQuadraticMap (f : N →ₗ[R] P) (Q : QuadraticMap R M N) :
    QuadraticMap R M P 
goal: (f.compQuadraticMap Q) x = f (Q x)

full_name: LinearMap.compQuadraticMap'_apply
code: /-- Compose a quadratic map with a linear function on the left. -/
@[simps! (config := { simpRhs := true })]
def _root_.LinearMap.compQuadraticMap' [CommSemiring S] [Algebra S R] [Module S N] [Module S M]
    [IsScalarTower S R N] [IsScalarTower S R M] [Module S P]
    (f : N →ₗ[S] P) (Q : QuadraticMap R M N) : QuadraticMap S M P 
goal: (f.compQuadraticMap' Q) x = f (Q x)

full_name: LinearMap.compQuadraticMap'
code: /-- Compose a quadratic map with a linear function on the left. -/
@[simps! (config := { simpRhs := true })]
def _root_.LinearMap.compQuadraticMap' [CommSemiring S] [Algebra S R] [Module S N] [Module S M]
    [IsScalarTower S R N] [IsScalarTower S R M] [Module S P]
    (f : N →ₗ[S] P) (Q : QuadraticMap R M N) : QuadraticMap S M P 
goal: QuadraticMap S M P

full_name: QuadraticMap.linMulLin
code: /-- The product of linear forms is a quadratic form. -/
def linMulLin (f g : M →ₗ[R] A) : QuadraticMap R M A 
goal: QuadraticMap R M A

full_name: QuadraticMap.linMulLin_apply
code: @[simp]
theorem linMulLin_apply (f g : M →ₗ[R] A) (x) : linMulLin f g x = f x * g x 
goal: (QuadraticMap.linMulLin f g) x = f x * g x

full_name: QuadraticMap.add_linMulLin
code: @[simp]
theorem add_linMulLin (f g h : M →ₗ[R] A) : linMulLin (f + g) h = linMulLin f h + linMulLin g h 
goal: QuadraticMap.linMulLin (f + g) h = QuadraticMap.linMulLin f h + QuadraticMap.linMulLin g h

full_name: QuadraticMap.linMulLin_add
code: @[simp]
theorem linMulLin_add (f g h : M →ₗ[R] A) : linMulLin f (g + h) = linMulLin f g + linMulLin f h 
goal: QuadraticMap.linMulLin f (g + h) = QuadraticMap.linMulLin f g + QuadraticMap.linMulLin f h

full_name: QuadraticMap.linMulLin_comp
code: @[simp]
theorem linMulLin_comp (f g : M →ₗ[R] A) (h : N' →ₗ[R] M) :
    (linMulLin f g).comp h = linMulLin (f.comp h) (g.comp h) 
goal: (QuadraticMap.linMulLin f g).comp h = QuadraticMap.linMulLin (f ∘ₗ h) (g ∘ₗ h)

full_name: QuadraticMap.sq_apply
code: /-- `sq` is the quadratic form mapping the vector `x : A` to `x * x` -/
@[simps!]
def sq : QuadraticMap R A A 
goal: QuadraticMap.sq a = a * a

full_name: QuadraticMap.sq
code: /-- `sq` is the quadratic form mapping the vector `x : A` to `x * x` -/
@[simps!]
def sq : QuadraticMap R A A 
goal: QuadraticMap R A A

full_name: QuadraticMap.proj
code: /-- `proj i j` is the quadratic form mapping the vector `x : n → R` to `x i * x j` -/
def proj (i j : n) : QuadraticMap R (n → A) A 
goal: QuadraticMap R (n → A) A

full_name: QuadraticMap.proj_apply
code: @[simp]
theorem proj_apply (i j : n) (x : n → A) : proj (R := R) i j x = x i * x j 
goal: (QuadraticMap.proj i j) x = x i * x j

full_name: LinearMap.BilinMap.toQuadraticMap
code: /-- A bilinear map gives a quadratic map by applying the argument twice. -/
def toQuadraticMap (B : BilinMap R M N) : QuadraticMap R M N 
goal: QuadraticMap R M N

full_name: LinearMap.BilinMap.toQuadraticMap_apply
code: @[simp]
theorem toQuadraticMap_apply (B : BilinMap R M N) (x : M) : B.toQuadraticMap x = B x x 
goal: B.toQuadraticMap x = (B x) x

full_name: LinearMap.BilinMap.toQuadraticMap_comp_same
code: theorem toQuadraticMap_comp_same (B : BilinMap R M N) (f : N' →ₗ[R] M) :
    BilinMap.toQuadraticMap (B.compl₁₂ f f) = B.toQuadraticMap.comp f 
goal: LinearMap.BilinMap.toQuadraticMap (LinearMap.compl₁₂ B f f) = B.toQuadraticMap.comp f

full_name: LinearMap.BilinMap.toQuadraticMap_zero
code: @[simp]
theorem toQuadraticMap_zero : (0 : BilinMap R M N).toQuadraticMap = 0 
goal: LinearMap.BilinMap.toQuadraticMap 0 = 0

full_name: LinearMap.BilinMap.toQuadraticMap_add
code: @[simp]
theorem toQuadraticMap_add (B₁ B₂ : BilinMap R M N) :
    (B₁ + B₂).toQuadraticMap = B₁.toQuadraticMap + B₂.toQuadraticMap 
goal: (B₁ + B₂).toQuadraticMap = B₁.toQuadraticMap + B₂.toQuadraticMap

full_name: LinearMap.BilinMap.toQuadraticMap_smul
code: @[simp]
theorem toQuadraticMap_smul [Monoid S] [DistribMulAction S N] [SMulCommClass S R N]
    [SMulCommClass R S N] (a : S)
    (B : BilinMap R M N) : (a • B).toQuadraticMap = a • B.toQuadraticMap 
goal: (a • B).toQuadraticMap = a • B.toQuadraticMap

full_name: LinearMap.BilinMap.toQuadraticMapAddMonoidHom
code: /-- `LinearMap.BilinForm.toQuadraticMap` as an additive homomorphism -/
@[simps]
def toQuadraticMapAddMonoidHom : (BilinMap R M N) →+ QuadraticMap R M N 
goal: LinearMap.BilinMap R M N →+ QuadraticMap R M N

full_name: LinearMap.BilinMap.toQuadraticMapAddMonoidHom_apply
code: /-- `LinearMap.BilinForm.toQuadraticMap` as an additive homomorphism -/
@[simps]
def toQuadraticMapAddMonoidHom : (BilinMap R M N) →+ QuadraticMap R M N 
goal: (LinearMap.BilinMap.toQuadraticMapAddMonoidHom R M) B = B.toQuadraticMap

full_name: LinearMap.BilinMap.toQuadraticMapLinearMap_apply_apply
code: /-- `LinearMap.BilinForm.toQuadraticMap` as a linear map -/
@[simps!]
def toQuadraticMapLinearMap [Semiring S] [Module S N] [SMulCommClass S R N] [SMulCommClass R S N] :
    (BilinMap R M N) →ₗ[S] QuadraticMap R M N 
goal: ((LinearMap.BilinMap.toQuadraticMapLinearMap S R M) B) x = (B x) x

full_name: LinearMap.BilinMap.toQuadraticMapLinearMap
code: /-- `LinearMap.BilinForm.toQuadraticMap` as a linear map -/
@[simps!]
def toQuadraticMapLinearMap [Semiring S] [Module S N] [SMulCommClass S R N] [SMulCommClass R S N] :
    (BilinMap R M N) →ₗ[S] QuadraticMap R M N 
goal: LinearMap.BilinMap R M N →ₗ[S] QuadraticMap R M N

full_name: LinearMap.BilinMap.toQuadraticMap_list_sum
code: @[simp]
theorem toQuadraticMap_list_sum (B : List (BilinMap R M N)) :
    B.sum.toQuadraticMap = (B.map toQuadraticMap).sum 
goal: B.sum.toQuadraticMap = (List.map LinearMap.BilinMap.toQuadraticMap B).sum

full_name: LinearMap.BilinMap.toQuadraticMap_multiset_sum
code: @[simp]
theorem toQuadraticMap_multiset_sum (B : Multiset (BilinMap R M N)) :
    B.sum.toQuadraticMap = (B.map toQuadraticMap).sum 
goal: B.sum.toQuadraticMap = (Multiset.map LinearMap.BilinMap.toQuadraticMap B).sum

full_name: LinearMap.BilinMap.toQuadraticMap_sum
code: @[simp]
theorem toQuadraticMap_sum {ι : Type*} (s : Finset ι) (B : ι → (BilinMap R M N)) :
    (∑ i ∈ s, B i).toQuadraticMap = ∑ i ∈ s, (B i).toQuadraticMap 
goal: (∑ i ∈ s, B i).toQuadraticMap = ∑ i ∈ s, (B i).toQuadraticMap

full_name: LinearMap.BilinMap.toQuadraticMap_eq_zero
code: @[simp]
theorem toQuadraticMap_eq_zero {B : BilinMap R M N} :
    B.toQuadraticMap = 0 ↔ B.IsAlt 
goal: B.toQuadraticMap = 0 ↔ LinearMap.IsAlt B

full_name: LinearMap.BilinMap.toQuadraticMap_neg
code: @[simp]
theorem toQuadraticMap_neg (B : BilinMap R M N) : (-B).toQuadraticMap = -B.toQuadraticMap 
goal: (-B).toQuadraticMap = -B.toQuadraticMap

full_name: LinearMap.BilinMap.toQuadraticMap_sub
code: @[simp]
theorem toQuadraticMap_sub (B₁ B₂ : BilinMap R M N) :
    (B₁ - B₂).toQuadraticMap = B₁.toQuadraticMap - B₂.toQuadraticMap 
goal: (B₁ - B₂).toQuadraticMap = B₁.toQuadraticMap - B₂.toQuadraticMap

full_name: LinearMap.BilinMap.polar_toQuadraticMap
code: theorem polar_toQuadraticMap (x y : M) : polar (toQuadraticMap B) x y = B x y + B y x 
goal: QuadraticMap.polar (⇑B.toQuadraticMap) x y = (B x) y + (B y) x

full_name: LinearMap.BilinMap.polarBilin_toQuadraticMap
code: theorem polarBilin_toQuadraticMap : polarBilin (toQuadraticMap B) = B + flip B 
goal: B.toQuadraticMap.polarBilin = B + LinearMap.flip B

full_name: QuadraticMap.toQuadraticMap_polarBilin
code: @[simp] theorem _root_.QuadraticMap.toQuadraticMap_polarBilin (Q : QuadraticMap R M N) :
    toQuadraticMap (polarBilin Q) = 2 • Q 
goal: Q.polarBilin.toQuadraticMap = 2 • Q

full_name: QuadraticMap.polarBilin_injective
code: theorem _root_.QuadraticMap.polarBilin_injective (h : IsUnit (2 : R)) :
    Function.Injective (polarBilin : QuadraticMap R M N → _) 
goal: Function.Injective QuadraticMap.polarBilin

full_name: QuadraticMap.polarBilin_comp
code: theorem _root_.QuadraticMap.polarBilin_comp (Q : QuadraticMap R N' N) (f : M →ₗ[R] N') :
    polarBilin (Q.comp f) = LinearMap.compl₁₂ (polarBilin Q) f f 
goal: (Q.comp f).polarBilin = LinearMap.compl₁₂ Q.polarBilin f f

full_name: LinearMap.compQuadraticMap_polar
code: theorem _root_.LinearMap.compQuadraticMap_polar [CommSemiring S] [Algebra S R] [Module S N]
    [Module S N'] [IsScalarTower S R N] [Module S M] [IsScalarTower S R M] (f : N →ₗ[S] N')
    (Q : QuadraticMap R M N) (x y : M) : polar (f.compQuadraticMap' Q) x y = f (polar Q x y) 
goal: QuadraticMap.polar (⇑(f.compQuadraticMap' Q)) x y = f (QuadraticMap.polar (⇑Q) x y)

full_name: LinearMap.compQuadraticMap_polarBilin
code: theorem _root_.LinearMap.compQuadraticMap_polarBilin (f : N →ₗ[R] N') (Q : QuadraticMap R M N) :
    (f.compQuadraticMap' Q).polarBilin = Q.polarBilin.compr₂ f 
goal: (f.compQuadraticMap' Q).polarBilin = LinearMap.compr₂ Q.polarBilin f

full_name: QuadraticMap.associatedHom
code: /-- `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.) -/
def associatedHom : QuadraticMap R M N →ₗ[S] (BilinMap R M N) 
goal: QuadraticMap R M N →ₗ[S] LinearMap.BilinMap R M N

full_name: QuadraticMap.associated_apply
code: @[simp]
theorem associated_apply (x y : M) : associatedHom S Q x y = ⅟ (2 : R) • (Q (x + y) - Q x - Q y) 
goal: (((QuadraticMap.associatedHom S) Q) x) y = ⅟2 • (Q (x + y) - Q x - Q y)

full_name: QuadraticMap.two_nsmul_associated
code: @[simp] theorem two_nsmul_associated : 2 • associatedHom S Q = Q.polarBilin 
goal: 2 • (QuadraticMap.associatedHom S) Q = Q.polarBilin

full_name: QuadraticMap.associated_isSymm
code: theorem associated_isSymm (Q : QuadraticMap R M R) : (associatedHom S Q).IsSymm 
goal: LinearMap.IsSymm ((QuadraticMap.associatedHom S) Q)

full_name: QuadraticMap.associated_comp
code: @[simp]
theorem associated_comp {N' : Type*} [AddCommGroup N'] [Module R N'] (f : N' →ₗ[R] M) :
    associatedHom S (Q.comp f) = (associatedHom S Q).compl₁₂ f f 
goal: (QuadraticMap.associatedHom S) (Q.comp f) = LinearMap.compl₁₂ ((QuadraticMap.associatedHom S) Q) f f

full_name: QuadraticMap.associated_toQuadraticMap
code: theorem associated_toQuadraticMap (B : BilinMap R M R) (x y : M) :
    associatedHom S B.toQuadraticMap x y = ⅟ (2 : R) • (B x y + B y x) 
goal: (((QuadraticMap.associatedHom S) B.toQuadraticMap) x) y = ⅟2 • ((B x) y + (B y) x)

full_name: QuadraticMap.associated_left_inverse
code: theorem associated_left_inverse (h : B₁.IsSymm) : associatedHom S B₁.toQuadraticMap = B₁ 
goal: (QuadraticMap.associatedHom S) B₁.toQuadraticMap = B₁

full_name: QuadraticMap.associated_eq_self_apply
code: theorem associated_eq_self_apply (x : M) : associatedHom S Q x x = Q x 
goal: (((QuadraticMap.associatedHom S) Q) x) x = Q x

full_name: QuadraticMap.toQuadraticMap_associated
code: theorem toQuadraticMap_associated : (associatedHom S Q).toQuadraticMap = Q 
goal: ((QuadraticMap.associatedHom S) Q).toQuadraticMap = Q

full_name: QuadraticMap.associated_rightInverse
code: theorem associated_rightInverse :
    Function.RightInverse (associatedHom S) (BilinMap.toQuadraticMap : _ → QuadraticMap R M R) 
goal: Function.RightInverse (⇑(QuadraticMap.associatedHom S)) LinearMap.BilinMap.toQuadraticMap

full_name: QuadraticMap.associated'
code: /-- `associated'` is the `ℤ`-linear map that sends a quadratic form on a module `M` over `R` to its
associated symmetric bilinear form. -/
abbrev associated' : QuadraticMap R M R →ₗ[ℤ] BilinMap R M R 
goal: QuadraticMap R M R →ₗ[ℤ] LinearMap.BilinMap R M R

full_name: QuadraticMap.canLift
code: /-- Symmetric bilinear forms can be lifted to quadratic forms -/
instance canLift :
    CanLift (BilinMap R M R) (QuadraticForm R M) (associatedHom ℕ) LinearMap.IsSymm 
goal: CanLift (LinearMap.BilinMap R M R) (QuadraticForm R M) (⇑(QuadraticMap.associatedHom ℕ)) LinearMap.IsSymm

full_name: QuadraticMap.exists_quadraticForm_ne_zero
code: /-- 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`. -/
theorem exists_quadraticForm_ne_zero {Q : QuadraticForm R M}
    -- Porting note: added implicit argument
    (hB₁ : associated' (R := R) Q ≠ 0) :
    ∃ x, Q x ≠ 0 
goal: ∃ x, Q x ≠ 0

full_name: QuadraticMap.associated
code: /-- `associated` is the linear map that sends a quadratic map over a commutative ring to its
associated symmetric bilinear map. -/
abbrev associated : QuadraticMap R M N →ₗ[R] BilinMap R M N 
goal: QuadraticMap R M N →ₗ[R] LinearMap.BilinMap R M N

full_name: QuadraticMap.coe_associatedHom
code: theorem coe_associatedHom :
    ⇑(associatedHom S : QuadraticMap R M N →ₗ[S] BilinMap R M N) = associated 
goal: ⇑(QuadraticMap.associatedHom S) = ⇑QuadraticMap.associated

full_name: QuadraticMap.associated_linMulLin
code: @[simp]
theorem associated_linMulLin (f g : M →ₗ[R] R) :
    associated (R := R) (linMulLin f g) =
      ⅟ (2 : R) • ((mul R R).compl₁₂ f g + (mul R R).compl₁₂ g f) 
goal: QuadraticMap.associated (QuadraticMap.linMulLin f g) =
  ⅟2 • ((LinearMap.mul R R).compl₁₂ f g + (LinearMap.mul R R).compl₁₂ g f)

full_name: QuadraticMap.associated_sq
code: @[simp]
lemma associated_sq : associated (R := R) sq = mul R R 
goal: QuadraticMap.associated QuadraticMap.sq = LinearMap.mul R R

full_name: QuadraticMap.IsOrtho
code: /-- The proposition that two elements of a quadratic map space are orthogonal. -/
def IsOrtho (Q : QuadraticMap R M N) (x y : M) : Prop 
goal: Prop

full_name: QuadraticMap.isOrtho_def
code: theorem isOrtho_def {Q : QuadraticMap R M N} {x y : M} : Q.IsOrtho x y ↔ Q (x + y) = Q x + Q y 
goal: Q.IsOrtho x y ↔ Q (x + y) = Q x + Q y

full_name: QuadraticMap.IsOrtho.all
code: theorem IsOrtho.all (x y : M) : IsOrtho (0 : QuadraticMap R M N) x y 
goal: QuadraticMap.IsOrtho 0 x y

full_name: QuadraticMap.IsOrtho.zero_left
code: theorem IsOrtho.zero_left (x : M) : IsOrtho Q (0 : M) x 
goal: Q.IsOrtho 0 x

full_name: QuadraticMap.IsOrtho.zero_right
code: theorem IsOrtho.zero_right (x : M) : IsOrtho Q x (0 : M) 
goal: Q.IsOrtho x 0

full_name: QuadraticMap.ne_zero_of_not_isOrtho_self
code: theorem ne_zero_of_not_isOrtho_self {Q : QuadraticMap R M N} (x : M) (hx₁ : ¬Q.IsOrtho x x) :
    x ≠ 0 
goal: x ≠ 0

full_name: QuadraticMap.isOrtho_comm
code: theorem isOrtho_comm {x y : M} : IsOrtho Q x y ↔ IsOrtho Q y x 
goal: Q.IsOrtho x y ↔ Q.IsOrtho y x

full_name: LinearMap.BilinForm.toQuadraticMap_isOrtho
code: theorem _root_.LinearMap.BilinForm.toQuadraticMap_isOrtho [IsCancelAdd R]
    [NoZeroDivisors R] [CharZero R] {B : BilinMap R M R} {x y : M} (h : B.IsSymm) :
    B.toQuadraticMap.IsOrtho x y ↔ B.IsOrtho x y 
goal: B.toQuadraticMap.IsOrtho x y ↔ LinearMap.IsOrtho B x y

full_name: QuadraticMap.isOrtho_polarBilin
code: @[simp]
theorem isOrtho_polarBilin {x y : M} : Q.polarBilin.IsOrtho x y ↔ IsOrtho Q x y 
goal: LinearMap.IsOrtho Q.polarBilin x y ↔ Q.IsOrtho x y

full_name: QuadraticMap.IsOrtho.polar_eq_zero
code: theorem IsOrtho.polar_eq_zero {x y : M} (h : IsOrtho Q x y) : polar Q x y = 0 
goal: QuadraticMap.polar (⇑Q) x y = 0

full_name: QuadraticMap.associated_isOrtho
code: @[simp]
theorem associated_isOrtho [Invertible (2 : R)] {x y : M} :
    Q.associated.IsOrtho x y ↔ Q.IsOrtho x y 
goal: LinearMap.IsOrtho (QuadraticMap.associated Q) x y ↔ Q.IsOrtho x y

full_name: QuadraticMap.Anisotropic
code: /-- An anisotropic quadratic map is zero only on zero vectors. -/
def Anisotropic (Q : QuadraticMap R M N) : Prop 
goal: Prop

full_name: QuadraticMap.not_anisotropic_iff_exists
code: theorem not_anisotropic_iff_exists (Q : QuadraticMap R M N) :
    ¬Anisotropic Q ↔ ∃ x, x ≠ 0 ∧ Q x = 0 
goal: ¬Q.Anisotropic ↔ ∃ x, x ≠ 0 ∧ Q x = 0

full_name: QuadraticMap.Anisotropic.eq_zero_iff
code: theorem Anisotropic.eq_zero_iff {Q : QuadraticMap R M N} (h : Anisotropic Q) {x : M} :
    Q x = 0 ↔ x = 0 
goal: Q x = 0 ↔ x = 0

full_name: QuadraticMap.separatingLeft_of_anisotropic
code: /-- The associated bilinear form of an anisotropic quadratic form is nondegenerate. -/
theorem separatingLeft_of_anisotropic [Invertible (2 : R)] (Q : QuadraticMap R M R)
    (hB : Q.Anisotropic) :
    -- Porting note: added implicit argument
    (QuadraticMap.associated' (R := R) Q).SeparatingLeft 
goal: LinearMap.SeparatingLeft (QuadraticMap.associated' Q)

full_name: QuadraticMap.PosDef
code: /-- A positive definite quadratic form is positive on nonzero vectors. -/
def PosDef (Q₂ : QuadraticMap R₂ M N) : Prop 
goal: Prop

full_name: QuadraticMap.PosDef.smul
code: theorem PosDef.smul {R} [LinearOrderedCommRing R] [Module R M] [Module R N] [PosSMulStrictMono R N]
    {Q : QuadraticMap R M N} (h : PosDef Q) {a : R} (a_pos : 0 < a) : PosDef (a • Q) 
goal: (a • Q).PosDef

full_name: QuadraticMap.PosDef.nonneg
code: theorem PosDef.nonneg {Q : QuadraticMap R₂ M N} (hQ : PosDef Q) (x : M) : 0 ≤ Q x 
goal: 0 ≤ Q x

full_name: QuadraticMap.PosDef.anisotropic
code: theorem PosDef.anisotropic {Q : QuadraticMap R₂ M N} (hQ : Q.PosDef) : Q.Anisotropic 
goal: Q.Anisotropic

full_name: QuadraticMap.posDef_of_nonneg
code: theorem posDef_of_nonneg {Q : QuadraticMap R₂ M N} (h : ∀ x, 0 ≤ Q x) (h0 : Q.Anisotropic) :
    PosDef Q 
goal: Q.PosDef

full_name: QuadraticMap.posDef_iff_nonneg
code: theorem posDef_iff_nonneg {Q : QuadraticMap R₂ M N} : PosDef Q ↔ (∀ x, 0 ≤ Q x) ∧ Q.Anisotropic 
goal: Q.PosDef ↔ (∀ (x : M), 0 ≤ Q x) ∧ Q.Anisotropic

full_name: QuadraticMap.PosDef.add
code: theorem PosDef.add (Q Q' : QuadraticMap R₂ M N) (hQ : PosDef Q) (hQ' : PosDef Q') :
    PosDef (Q + Q') 
goal: (Q + Q').PosDef

full_name: QuadraticMap.linMulLinSelfPosDef
code: theorem linMulLinSelfPosDef {R} [LinearOrderedCommRing R] [Module R M] [LinearOrderedSemiring A]
    [ExistsAddOfLE A] [Module R A] [SMulCommClass R A A] [IsScalarTower R A A] (f : M →ₗ[R] A)
    (hf : LinearMap.ker f = ⊥) : PosDef (linMulLin (A := A) f f) 
goal: (QuadraticMap.linMulLin f f).PosDef

full_name: Matrix.toQuadraticMap'
code: /-- `M.toQuadraticMap'` is the map `fun x ↦ row x * M * col x` as a quadratic form. -/
def Matrix.toQuadraticMap' (M : Matrix n n R) : QuadraticMap R (n → R) R 
goal: QuadraticMap R (n → R) R

full_name: QuadraticMap.toMatrix'
code: /-- A matrix representation of the quadratic form. -/
def QuadraticMap.toMatrix' (Q : QuadraticMap R (n → R) R) : Matrix n n R 
goal: Matrix n n R

full_name: QuadraticMap.toMatrix'_smul
code: theorem QuadraticMap.toMatrix'_smul (a : R) (Q : QuadraticMap R (n → R) R) :
    (a • Q).toMatrix' = a • Q.toMatrix' 
goal: (a • Q).toMatrix' = a • Q.toMatrix'

full_name: QuadraticMap.isSymm_toMatrix'
code: theorem QuadraticMap.isSymm_toMatrix' (Q : QuadraticMap R (n → R) R) : Q.toMatrix'.IsSymm 
goal: Q.toMatrix'.IsSymm

full_name: QuadraticMap.toMatrix'_comp
code: @[simp]
theorem toMatrix'_comp (Q : QuadraticMap R (m → R) R) (f : (n → R) →ₗ[R] m → R) :
    (Q.comp f).toMatrix' = (LinearMap.toMatrix' f)ᵀ * Q.toMatrix' * (LinearMap.toMatrix' f) 
goal: (Q.comp f).toMatrix' = (LinearMap.toMatrix' f).transpose * Q.toMatrix' * LinearMap.toMatrix' f

full_name: QuadraticMap.discr
code: /-- The discriminant of a quadratic form generalizes the discriminant of a quadratic polynomial. -/
def discr (Q : QuadraticMap R (n → R) R) : R 
goal: R

full_name: QuadraticMap.discr_smul
code: theorem discr_smul (a : R) : (a • Q).discr = a ^ Fintype.card n * Q.discr 
goal: (a • Q).discr = a ^ Fintype.card n * Q.discr

full_name: QuadraticMap.discr_comp
code: theorem discr_comp (f : (n → R) →ₗ[R] n → R) :
    (Q.comp f).discr = f.toMatrix'.det * f.toMatrix'.det * Q.discr 
goal: (Q.comp f).discr = (LinearMap.toMatrix' f).det * (LinearMap.toMatrix' f).det * Q.discr

full_name: LinearMap.BilinForm.separatingLeft_of_anisotropic
code: /--
A bilinear form is separating left if the quadratic form it is associated with is anisotropic.
-/
theorem separatingLeft_of_anisotropic {B : BilinForm R M} (hB : B.toQuadraticMap.Anisotropic) :
    B.SeparatingLeft 
goal: LinearMap.SeparatingLeft B

full_name: LinearMap.BilinForm.exists_bilinForm_self_ne_zero
code: /-- 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`. -/
theorem exists_bilinForm_self_ne_zero [htwo : Invertible (2 : R)] {B : BilinForm R M}
    (hB₁ : B ≠ 0) (hB₂ : B.IsSymm) : ∃ x, ¬B.IsOrtho x x 
goal: ∃ x, ¬LinearMap.IsOrtho B x x

full_name: LinearMap.BilinForm.exists_orthogonal_basis
code: /-- 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`. -/
theorem exists_orthogonal_basis [hK : Invertible (2 : K)] {B : LinearMap.BilinForm K V}
    (hB₂ : B.IsSymm) : ∃ v : Basis (Fin (finrank K V)) K V, B.IsOrthoᵢ v 
goal: ∃ v, LinearMap.IsOrthoᵢ B ⇑v

full_name: QuadraticMap.basisRepr
code: /-- Given a quadratic map `Q` and a basis, `basisRepr` is the basis representation of `Q`. -/
noncomputable def basisRepr [Finite ι] (Q : QuadraticMap R M N) (v : Basis ι R M) :
    QuadraticMap R (ι → R) N 
goal: QuadraticMap R (ι → R) N

full_name: QuadraticMap.basisRepr_apply
code: @[simp]
theorem basisRepr_apply [Fintype ι] {v : Basis ι R M} (Q : QuadraticMap R M N) (w : ι → R) :
    Q.basisRepr v w = Q (∑ i : ι, w i • v i) 
goal: (Q.basisRepr v) w = Q (∑ i : ι, w i • v i)

full_name: QuadraticMap.weightedSumSquares
code: /-- 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. -/
def weightedSumSquares [Monoid S] [DistribMulAction S R] [SMulCommClass S R R] (w : ι → S) :
    QuadraticMap R (ι → R) R 
goal: QuadraticMap R (ι → R) R

full_name: QuadraticMap.weightedSumSquares_apply
code: @[simp]
theorem weightedSumSquares_apply [Monoid S] [DistribMulAction S R] [SMulCommClass S R R]
    (w : ι → S) (v : ι → R) :
    weightedSumSquares R w v = ∑ i : ι, w i • (v i * v i) 
goal: (QuadraticMap.weightedSumSquares R w) v = ∑ i : ι, w i • (v i * v i)

full_name: QuadraticMap.basisRepr_eq_of_iIsOrtho
code: /-- On an orthogonal basis, the basis representation of `Q` is just a sum of squares. -/
theorem basisRepr_eq_of_iIsOrtho {R M} [CommRing R] [AddCommGroup M] [Module R M]
    [Invertible (2 : R)] (Q : QuadraticMap R M R) (v : Basis ι R M)
    (hv₂ : (associated (R := R) Q).IsOrthoᵢ v) :
    Q.basisRepr v = weightedSumSquares _ fun i => Q (v i) 
goal: Q.basisRepr v = QuadraticMap.weightedSumSquares R fun i => Q (v i)