linear_algebra.quadratic_form.dualMathlib.LinearAlgebra.QuadraticForm.Dual

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2023 Eric Wieser. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Eric Wieser
 -/
-import LinearAlgebra.QuadraticForm.Isometry
+import LinearAlgebra.QuadraticForm.IsometryEquiv
 import LinearAlgebra.QuadraticForm.Prod
 
 #align_import linear_algebra.quadratic_form.dual from "leanprover-community/mathlib"@"d11f435d4e34a6cea0a1797d6b625b0c170be845"
Diff
@@ -32,7 +32,7 @@ section Semiring
 
 variable [CommSemiring R] [AddCommMonoid M] [Module R M]
 
-#print BilinForm.dualProd /-
+#print LinearMap.dualProd /-
 /-- The symmetric bilinear form on `module.dual R M × M` defined as
 `B (f, x) (g, y) = f y + g x`. -/
 @[simps]
@@ -42,12 +42,12 @@ def dualProd : BilinForm R (Module.Dual R M × M) :=
         (LinearMap.fst R (Module.Dual R M) M) +
       ((LinearMap.applyₗ.comp (LinearMap.snd R (Module.Dual R M) M)).compl₂
           (LinearMap.fst R (Module.Dual R M) M)).flip
-#align bilin_form.dual_prod BilinForm.dualProd
+#align bilin_form.dual_prod LinearMap.dualProd
 -/
 
-#print BilinForm.isSymm_dualProd /-
+#print LinearMap.isSymm_dualProd /-
 theorem isSymm_dualProd : (dualProd R M).IsSymm := fun x y => add_comm _ _
-#align bilin_form.is_symm_dual_prod BilinForm.isSymm_dualProd
+#align bilin_form.is_symm_dual_prod LinearMap.isSymm_dualProd
 -/
 
 end Semiring
@@ -56,8 +56,8 @@ section Ring
 
 variable [CommRing R] [AddCommGroup M] [Module R M]
 
-#print BilinForm.nondenerate_dualProd /-
-theorem nondenerate_dualProd :
+#print LinearMap.separatingLeft_dualProd /-
+theorem separatingLeft_dualProd :
     (dualProd R M).Nondegenerate ↔ Function.Injective (Module.Dual.eval R M) := by
   classical
   rw [nondegenerate_iff_ker_eq_bot]
@@ -79,7 +79,7 @@ theorem nondenerate_dualProd :
   rw [this, LinearMap.coe_prodMap]
   refine' prod.map_injective.trans _
   exact and_iff_right Function.injective_id
-#align bilin_form.nondenerate_dual_prod BilinForm.nondenerate_dualProd
+#align bilin_form.nondenerate_dual_prod LinearMap.separatingLeft_dualProd
 -/
 
 end Ring
@@ -102,19 +102,19 @@ def dualProd : QuadraticForm R (Module.Dual R M × M)
     rw [Prod.smul_fst, Prod.smul_snd, LinearMap.smul_apply, LinearMap.map_smul, smul_eq_mul,
       smul_eq_mul, mul_assoc]
   exists_companion' :=
-    ⟨BilinForm.dualProd R M, fun p q => by
+    ⟨LinearMap.dualProd R M, fun p q => by
       rw [BilinForm.dualProd_apply, Prod.fst_add, Prod.snd_add, LinearMap.add_apply, map_add,
         map_add, add_right_comm _ (q.1 q.2), add_comm (q.1 p.2) (p.1 q.2), ← add_assoc, ←
         add_assoc]⟩
 #align quadratic_form.dual_prod QuadraticForm.dualProd
 -/
 
-#print BilinForm.dualProd.toQuadraticForm /-
+#print LinearMap.dualProd.toQuadraticForm /-
 @[simp]
-theorem BilinForm.dualProd.toQuadraticForm :
-    (BilinForm.dualProd R M).toQuadraticForm = 2 • dualProd R M :=
+theorem LinearMap.dualProd.toQuadraticForm :
+    (LinearMap.dualProd R M).toQuadraticForm = 2 • dualProd R M :=
   ext fun a => (two_nsmul _).symm
-#align bilin_form.dual_prod.to_quadratic_form BilinForm.dualProd.toQuadraticForm
+#align bilin_form.dual_prod.to_quadratic_form LinearMap.dualProd.toQuadraticForm
 -/
 
 variable {R M N}
Diff
@@ -58,7 +58,27 @@ variable [CommRing R] [AddCommGroup M] [Module R M]
 
 #print BilinForm.nondenerate_dualProd /-
 theorem nondenerate_dualProd :
-    (dualProd R M).Nondegenerate ↔ Function.Injective (Module.Dual.eval R M) := by classical
+    (dualProd R M).Nondegenerate ↔ Function.Injective (Module.Dual.eval R M) := by
+  classical
+  rw [nondegenerate_iff_ker_eq_bot]
+  rw [LinearMap.ker_eq_bot]
+  let e := LinearEquiv.prodComm R _ _ ≪≫ₗ Module.dualProdDualEquivDual R (Module.Dual R M) M
+  let h_d := e.symm.to_linear_map.comp (dual_prod R M).toLin
+  refine' (Function.Injective.of_comp_iff e.symm.injective (dual_prod R M).toLin).symm.trans _
+  rw [← LinearEquiv.coe_toLinearMap, ← LinearMap.coe_comp]
+  change Function.Injective h_d ↔ _
+  have : h_d = LinearMap.prodMap LinearMap.id (Module.Dual.eval R M) :=
+    by
+    refine' LinearMap.ext fun x => Prod.ext _ _
+    · ext
+      dsimp [h_d, Module.Dual.eval, LinearEquiv.prodComm]
+      simp
+    · ext
+      dsimp [h_d, Module.Dual.eval, LinearEquiv.prodComm]
+      simp
+  rw [this, LinearMap.coe_prodMap]
+  refine' prod.map_injective.trans _
+  exact and_iff_right Function.injective_id
 #align bilin_form.nondenerate_dual_prod BilinForm.nondenerate_dualProd
 -/
 
Diff
@@ -58,27 +58,7 @@ variable [CommRing R] [AddCommGroup M] [Module R M]
 
 #print BilinForm.nondenerate_dualProd /-
 theorem nondenerate_dualProd :
-    (dualProd R M).Nondegenerate ↔ Function.Injective (Module.Dual.eval R M) := by
-  classical
-  rw [nondegenerate_iff_ker_eq_bot]
-  rw [LinearMap.ker_eq_bot]
-  let e := LinearEquiv.prodComm R _ _ ≪≫ₗ Module.dualProdDualEquivDual R (Module.Dual R M) M
-  let h_d := e.symm.to_linear_map.comp (dual_prod R M).toLin
-  refine' (Function.Injective.of_comp_iff e.symm.injective (dual_prod R M).toLin).symm.trans _
-  rw [← LinearEquiv.coe_toLinearMap, ← LinearMap.coe_comp]
-  change Function.Injective h_d ↔ _
-  have : h_d = LinearMap.prodMap LinearMap.id (Module.Dual.eval R M) :=
-    by
-    refine' LinearMap.ext fun x => Prod.ext _ _
-    · ext
-      dsimp [h_d, Module.Dual.eval, LinearEquiv.prodComm]
-      simp
-    · ext
-      dsimp [h_d, Module.Dual.eval, LinearEquiv.prodComm]
-      simp
-  rw [this, LinearMap.coe_prodMap]
-  refine' prod.map_injective.trans _
-  exact and_iff_right Function.injective_id
+    (dualProd R M).Nondegenerate ↔ Function.Injective (Module.Dual.eval R M) := by classical
 #align bilin_form.nondenerate_dual_prod BilinForm.nondenerate_dualProd
 -/
 
Diff
@@ -125,7 +125,7 @@ variable {R M N}
 def dualProdIsometry (f : M ≃ₗ[R] N) : (dualProd R M).IsometryEquiv (dualProd R N)
     where
   toLinearEquiv := f.dualMap.symm.Prod f
-  map_app' x := FunLike.congr_arg x.fst <| f.symm_apply_apply _
+  map_app' x := DFunLike.congr_arg x.fst <| f.symm_apply_apply _
 #align quadratic_form.dual_prod_isometry QuadraticForm.dualProdIsometry
 -/
 
@@ -138,7 +138,7 @@ def dualProdProdIsometry : (dualProd R (M × N)).IsometryEquiv ((dualProd R M).P
     (Module.dualProdDualEquivDual R M N).symm.Prod (LinearEquiv.refl R (M × N)) ≪≫ₗ
       LinearEquiv.prodProdProdComm R _ _ M N
   map_app' m :=
-    (m.fst.map_add _ _).symm.trans <| FunLike.congr_arg m.fst <| Prod.ext (add_zero _) (zero_add _)
+    (m.fst.map_add _ _).symm.trans <| DFunLike.congr_arg m.fst <| Prod.ext (add_zero _) (zero_add _)
 #align quadratic_form.dual_prod_prod_isometry QuadraticForm.dualProdProdIsometry
 -/
 
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2023 Eric Wieser. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Eric Wieser
 -/
-import Mathbin.LinearAlgebra.QuadraticForm.Isometry
-import Mathbin.LinearAlgebra.QuadraticForm.Prod
+import LinearAlgebra.QuadraticForm.Isometry
+import LinearAlgebra.QuadraticForm.Prod
 
 #align_import linear_algebra.quadratic_form.dual from "leanprover-community/mathlib"@"d11f435d4e34a6cea0a1797d6b625b0c170be845"
 
Diff
@@ -150,7 +150,6 @@ variable [CommRing R] [AddCommGroup M] [Module R M]
 
 variable {R M}
 
-#print QuadraticForm.toDualProd /-
 /-- The isometry sending `(Q.prod $ -Q)` to `(quadratic_form.dual_prod R M)`.
 
 This is `σ` from Proposition 4.8, page 84 of
@@ -161,19 +160,16 @@ def toDualProd (Q : QuadraticForm R M) [Invertible (2 : R)] : M × M →ₗ[R] M
   LinearMap.prod
     (Q.Associated.toLin.comp (LinearMap.fst _ _ _) + Q.Associated.toLin.comp (LinearMap.snd _ _ _))
     (LinearMap.fst _ _ _ - LinearMap.snd _ _ _)
-#align quadratic_form.to_dual_prod QuadraticForm.toDualProd
--/
+#align quadratic_form.to_dual_prod QuadraticForm.toDualProdₓ
 
-#print QuadraticForm.toDualProd_isometry /-
-theorem toDualProd_isometry [Invertible (2 : R)] (Q : QuadraticForm R M) (x : M × M) :
+theorem QuadraticForm.Isometry.map_app [Invertible (2 : R)] (Q : QuadraticForm R M) (x : M × M) :
     QuadraticForm.dualProd R M (toDualProd Q x) = (Q.Prod <| -Q) x :=
   by
   dsimp only [to_dual_prod, Associated, associated_hom]
   dsimp
   simp [polar_comm _ x.1 x.2, ← sub_add, mul_sub, sub_mul, smul_sub, Submonoid.smul_def, ←
     sub_eq_add_neg (Q x.1) (Q x.2)]
-#align quadratic_form.to_dual_prod_isometry QuadraticForm.toDualProd_isometry
--/
+#align quadratic_form.to_dual_prod_isometry QuadraticForm.Isometry.map_appₓ
 
 -- TODO: show that `to_dual_prod` is an equivalence
 end Ring
Diff
@@ -32,6 +32,7 @@ section Semiring
 
 variable [CommSemiring R] [AddCommMonoid M] [Module R M]
 
+#print BilinForm.dualProd /-
 /-- The symmetric bilinear form on `module.dual R M × M` defined as
 `B (f, x) (g, y) = f y + g x`. -/
 @[simps]
@@ -42,9 +43,12 @@ def dualProd : BilinForm R (Module.Dual R M × M) :=
       ((LinearMap.applyₗ.comp (LinearMap.snd R (Module.Dual R M) M)).compl₂
           (LinearMap.fst R (Module.Dual R M) M)).flip
 #align bilin_form.dual_prod BilinForm.dualProd
+-/
 
+#print BilinForm.isSymm_dualProd /-
 theorem isSymm_dualProd : (dualProd R M).IsSymm := fun x y => add_comm _ _
 #align bilin_form.is_symm_dual_prod BilinForm.isSymm_dualProd
+-/
 
 end Semiring
 
@@ -52,6 +56,7 @@ section Ring
 
 variable [CommRing R] [AddCommGroup M] [Module R M]
 
+#print BilinForm.nondenerate_dualProd /-
 theorem nondenerate_dualProd :
     (dualProd R M).Nondegenerate ↔ Function.Injective (Module.Dual.eval R M) := by
   classical
@@ -75,6 +80,7 @@ theorem nondenerate_dualProd :
   refine' prod.map_injective.trans _
   exact and_iff_right Function.injective_id
 #align bilin_form.nondenerate_dual_prod BilinForm.nondenerate_dualProd
+-/
 
 end Ring
 
@@ -86,6 +92,7 @@ section Semiring
 
 variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N]
 
+#print QuadraticForm.dualProd /-
 /-- The quadratic form on `module.dual R M × M` defined as `Q (f, x) = f x`. -/
 @[simps]
 def dualProd : QuadraticForm R (Module.Dual R M × M)
@@ -100,15 +107,19 @@ def dualProd : QuadraticForm R (Module.Dual R M × M)
         map_add, add_right_comm _ (q.1 q.2), add_comm (q.1 p.2) (p.1 q.2), ← add_assoc, ←
         add_assoc]⟩
 #align quadratic_form.dual_prod QuadraticForm.dualProd
+-/
 
+#print BilinForm.dualProd.toQuadraticForm /-
 @[simp]
 theorem BilinForm.dualProd.toQuadraticForm :
     (BilinForm.dualProd R M).toQuadraticForm = 2 • dualProd R M :=
   ext fun a => (two_nsmul _).symm
 #align bilin_form.dual_prod.to_quadratic_form BilinForm.dualProd.toQuadraticForm
+-/
 
 variable {R M N}
 
+#print QuadraticForm.dualProdIsometry /-
 /-- Any module isomorphism induces a quadratic isomorphism between the corresponding `dual_prod.` -/
 @[simps]
 def dualProdIsometry (f : M ≃ₗ[R] N) : (dualProd R M).IsometryEquiv (dualProd R N)
@@ -116,7 +127,9 @@ def dualProdIsometry (f : M ≃ₗ[R] N) : (dualProd R M).IsometryEquiv (dualPro
   toLinearEquiv := f.dualMap.symm.Prod f
   map_app' x := FunLike.congr_arg x.fst <| f.symm_apply_apply _
 #align quadratic_form.dual_prod_isometry QuadraticForm.dualProdIsometry
+-/
 
+#print QuadraticForm.dualProdProdIsometry /-
 /-- `quadratic_form.dual_prod` commutes (isometrically) with `quadratic_form.prod`. -/
 @[simps]
 def dualProdProdIsometry : (dualProd R (M × N)).IsometryEquiv ((dualProd R M).Prod (dualProd R N))
@@ -127,6 +140,7 @@ def dualProdProdIsometry : (dualProd R (M × N)).IsometryEquiv ((dualProd R M).P
   map_app' m :=
     (m.fst.map_add _ _).symm.trans <| FunLike.congr_arg m.fst <| Prod.ext (add_zero _) (zero_add _)
 #align quadratic_form.dual_prod_prod_isometry QuadraticForm.dualProdProdIsometry
+-/
 
 end Semiring
 
@@ -136,6 +150,7 @@ variable [CommRing R] [AddCommGroup M] [Module R M]
 
 variable {R M}
 
+#print QuadraticForm.toDualProd /-
 /-- The isometry sending `(Q.prod $ -Q)` to `(quadratic_form.dual_prod R M)`.
 
 This is `σ` from Proposition 4.8, page 84 of
@@ -147,7 +162,9 @@ def toDualProd (Q : QuadraticForm R M) [Invertible (2 : R)] : M × M →ₗ[R] M
     (Q.Associated.toLin.comp (LinearMap.fst _ _ _) + Q.Associated.toLin.comp (LinearMap.snd _ _ _))
     (LinearMap.fst _ _ _ - LinearMap.snd _ _ _)
 #align quadratic_form.to_dual_prod QuadraticForm.toDualProd
+-/
 
+#print QuadraticForm.toDualProd_isometry /-
 theorem toDualProd_isometry [Invertible (2 : R)] (Q : QuadraticForm R M) (x : M × M) :
     QuadraticForm.dualProd R M (toDualProd Q x) = (Q.Prod <| -Q) x :=
   by
@@ -156,6 +173,7 @@ theorem toDualProd_isometry [Invertible (2 : R)] (Q : QuadraticForm R M) (x : M
   simp [polar_comm _ x.1 x.2, ← sub_add, mul_sub, sub_mul, smul_sub, Submonoid.smul_def, ←
     sub_eq_add_neg (Q x.1) (Q x.2)]
 #align quadratic_form.to_dual_prod_isometry QuadraticForm.toDualProd_isometry
+-/
 
 -- TODO: show that `to_dual_prod` is an equivalence
 end Ring
Diff
@@ -111,7 +111,7 @@ variable {R M N}
 
 /-- Any module isomorphism induces a quadratic isomorphism between the corresponding `dual_prod.` -/
 @[simps]
-def dualProdIsometry (f : M ≃ₗ[R] N) : (dualProd R M).Isometry (dualProd R N)
+def dualProdIsometry (f : M ≃ₗ[R] N) : (dualProd R M).IsometryEquiv (dualProd R N)
     where
   toLinearEquiv := f.dualMap.symm.Prod f
   map_app' x := FunLike.congr_arg x.fst <| f.symm_apply_apply _
@@ -119,7 +119,7 @@ def dualProdIsometry (f : M ≃ₗ[R] N) : (dualProd R M).Isometry (dualProd R N
 
 /-- `quadratic_form.dual_prod` commutes (isometrically) with `quadratic_form.prod`. -/
 @[simps]
-def dualProdProdIsometry : (dualProd R (M × N)).Isometry ((dualProd R M).Prod (dualProd R N))
+def dualProdProdIsometry : (dualProd R (M × N)).IsometryEquiv ((dualProd R M).Prod (dualProd R N))
     where
   toLinearEquiv :=
     (Module.dualProdDualEquivDual R M N).symm.Prod (LinearEquiv.refl R (M × N)) ≪≫ₗ

Changes in mathlib4

mathlib3
mathlib4
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -129,7 +129,6 @@ end Semiring
 section Ring
 
 variable [CommRing R] [AddCommGroup M] [Module R M]
-
 variable {R M}
 
 /-- The isometry sending `(Q.prod <| -Q)` to `(QuadraticForm.dualProd R M)`.
chore: tidy various files (#11135)
Diff
@@ -145,9 +145,11 @@ def toDualProd (Q : QuadraticForm R M) [Invertible (2 : R)] :
     (LinearMap.fst _ _ _ - LinearMap.snd _ _ _)
   map_app' x := by
     dsimp only [associated, associatedHom]
-    dsimp
-    -- Porting note: added `()` around `Submonoid.smul_def`
-    simp [polar_comm _ x.1 x.2, ← sub_add, mul_sub, sub_mul, smul_sub, (Submonoid.smul_def), ←
+    dsimp only [LinearMap.smul_apply, LinearMap.coe_mk, AddHom.coe_mk, AddHom.toFun_eq_coe,
+      LinearMap.coe_toAddHom, LinearMap.prod_apply, Pi.prod, LinearMap.add_apply,
+      LinearMap.coe_comp, Function.comp_apply, LinearMap.fst_apply, LinearMap.snd_apply,
+      LinearMap.sub_apply, dualProd_apply, polarBilin_apply_apply, prod_apply, neg_apply]
+    simp [polar_comm _ x.1 x.2, ← sub_add, mul_sub, sub_mul, smul_sub, Submonoid.smul_def, ←
       sub_eq_add_neg (Q x.1) (Q x.2)]
 #align quadratic_form.to_dual_prod QuadraticForm.toDualProdₓ
 
style: homogenise porting notes (#11145)

Homogenises porting notes via capitalisation and addition of whitespace.

It makes the following changes:

  • converts "--porting note" into "-- Porting note";
  • converts "porting note" into "Porting note".
Diff
@@ -87,12 +87,12 @@ variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Modu
 def dualProd : QuadraticForm R (Module.Dual R M × M) where
   toFun p := p.1 p.2
   toFun_smul a p := by
-    dsimp only  -- porting note: added
+    dsimp only  -- Porting note: added
     rw [Prod.smul_fst, Prod.smul_snd, LinearMap.smul_apply, LinearMap.map_smul, smul_eq_mul,
       smul_eq_mul, mul_assoc]
   exists_companion' :=
     ⟨LinearMap.dualProd R M, fun p q => by
-      dsimp only  -- porting note: added
+      dsimp only  -- Porting note: added
       rw [LinearMap.dualProd_apply_apply, Prod.fst_add, Prod.snd_add, LinearMap.add_apply, map_add,
         map_add, add_right_comm _ (q.1 q.2), add_comm (q.1 p.2) (p.1 q.2), ← add_assoc, ←
         add_assoc]⟩
@@ -146,7 +146,7 @@ def toDualProd (Q : QuadraticForm R M) [Invertible (2 : R)] :
   map_app' x := by
     dsimp only [associated, associatedHom]
     dsimp
-    -- porting note: added `()` around `Submonoid.smul_def`
+    -- Porting note: added `()` around `Submonoid.smul_def`
     simp [polar_comm _ x.1 x.2, ← sub_add, mul_sub, sub_mul, smul_sub, (Submonoid.smul_def), ←
       sub_eq_add_neg (Q x.1) (Q x.2)]
 #align quadratic_form.to_dual_prod QuadraticForm.toDualProdₓ
chore: prepare Lean version bump with explicit simp (#10999)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -62,10 +62,10 @@ theorem separatingLeft_dualProd :
   have : h_d = prodMap id (Module.Dual.eval R M) := by
     refine' ext fun x => Prod.ext _ _
     · ext
-      dsimp [Module.Dual.eval, LinearEquiv.prodComm]
+      dsimp [e, h_d, Module.Dual.eval, LinearEquiv.prodComm]
       simp
     · ext
-      dsimp [Module.Dual.eval, LinearEquiv.prodComm]
+      dsimp [e, h_d, Module.Dual.eval, LinearEquiv.prodComm]
       simp
   rw [this, coe_prodMap]
   refine' Prod.map_injective.trans _
refactor(LinearAlgebra/QuadraticForm): Replace BilinForm with a scalar valued bi LinearMap (#10238)

Following on from #10097, which converted the companion of a quadratic form with a bilinear map, this PR replaces a number of results about quadratic forms and bilinear forms with results about quadratic forms and scalar valued bilinear maps. The long term aim is to be able to consider quadratic maps.

The main change is to LinearAlgebra/QuadraticForm/Basic, but this necessitates changes throughout LinearAlgebra/QuadraticForm/. Minor changes are also required elsewhere:

  • LinearAlgebra/CliffordAlgebra/
  • LinearAlgebra/Matrix/PosDef
  • LinearAlgebra/SesquilinearForm
  • A number of additional results about tensor products and linear maps are also required.

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Christopher Hoskin <christopher.hoskin@overleaf.com>

Diff
@@ -5,6 +5,7 @@ Authors: Eric Wieser
 -/
 import Mathlib.LinearAlgebra.QuadraticForm.IsometryEquiv
 import Mathlib.LinearAlgebra.QuadraticForm.Prod
+import Mathlib.LinearAlgebra.Dual
 
 #align_import linear_algebra.quadratic_form.dual from "leanprover-community/mathlib"@"d11f435d4e34a6cea0a1797d6b625b0c170be845"
 
@@ -34,7 +35,7 @@ variable [CommSemiring R] [AddCommMonoid M] [Module R M]
 /-- The symmetric bilinear form on `Module.Dual R M × M` defined as
 `B (f, x) (g, y) = f y + g x`. -/
 @[simps!]
-def dualProd : (Module.Dual R M × M) →ₗ[R] (Module.Dual R M × M) →ₗ[R] R :=
+def dualProd : LinearMap.BilinForm R (Module.Dual R M × M) :=
     (applyₗ.comp (snd R (Module.Dual R M) M)).compl₂ (fst R (Module.Dual R M) M) +
       ((applyₗ.comp (snd R (Module.Dual R M) M)).compl₂ (fst R (Module.Dual R M) M)).flip
 #align bilin_form.dual_prod LinearMap.dualProd
@@ -140,7 +141,7 @@ This is `σ` from Proposition 4.8, page 84 of
 def toDualProd (Q : QuadraticForm R M) [Invertible (2 : R)] :
     (Q.prod <| -Q) →qᵢ QuadraticForm.dualProd R M where
   toLinearMap := LinearMap.prod
-    (Q.associated.toLin.comp (LinearMap.fst _ _ _) + Q.associated.toLin.comp (LinearMap.snd _ _ _))
+    (Q.associated.comp (LinearMap.fst _ _ _) + Q.associated.comp (LinearMap.snd _ _ _))
     (LinearMap.fst _ _ _ - LinearMap.snd _ _ _)
   map_app' x := by
     dsimp only [associated, associatedHom]
refactor(LinearAlgebra/QuadraticForm/Basic): Use bilinear maps for the companion (#10097)

This PR replaces the companion (B : BilinForm R M) of a quadratic form with a bilinear map (B : M →ₗ[R] M →ₗ[R] R).

This is intended as a baby step towards generalising quadratic forms to quadratic maps. In the future we could allow for companion bilinear or even sesquilinear maps into an R-module.

Co-authored-by: Christopher Hoskin <mans0954@users.noreply.github.com> Co-authored-by: Christopher Hoskin <christopher.hoskin@overleaf.com>

Diff
@@ -13,7 +13,7 @@ import Mathlib.LinearAlgebra.QuadraticForm.Prod
 
 ## Main definitions
 
-* `BilinForm.dualProd R M`, the bilinear form on `(f, x) : Module.Dual R M × M` defined as
+* `LinearMap.dualProd R M`, the bilinear form on `(f, x) : Module.Dual R M × M` defined as
   `f x`.
 * `QuadraticForm.dualProd R M`, the quadratic form on `(f, x) : Module.Dual R M × M` defined as
   `f x`.
@@ -25,7 +25,7 @@ import Mathlib.LinearAlgebra.QuadraticForm.Prod
 
 variable (R M N : Type*)
 
-namespace BilinForm
+namespace LinearMap
 
 section Semiring
 
@@ -34,16 +34,13 @@ variable [CommSemiring R] [AddCommMonoid M] [Module R M]
 /-- The symmetric bilinear form on `Module.Dual R M × M` defined as
 `B (f, x) (g, y) = f y + g x`. -/
 @[simps!]
-def dualProd : BilinForm R (Module.Dual R M × M) :=
-  LinearMap.toBilin <|
-    (LinearMap.applyₗ.comp (LinearMap.snd R (Module.Dual R M) M)).compl₂
-        (LinearMap.fst R (Module.Dual R M) M) +
-      ((LinearMap.applyₗ.comp (LinearMap.snd R (Module.Dual R M) M)).compl₂
-          (LinearMap.fst R (Module.Dual R M) M)).flip
-#align bilin_form.dual_prod BilinForm.dualProd
+def dualProd : (Module.Dual R M × M) →ₗ[R] (Module.Dual R M × M) →ₗ[R] R :=
+    (applyₗ.comp (snd R (Module.Dual R M) M)).compl₂ (fst R (Module.Dual R M) M) +
+      ((applyₗ.comp (snd R (Module.Dual R M) M)).compl₂ (fst R (Module.Dual R M) M)).flip
+#align bilin_form.dual_prod LinearMap.dualProd
 
 theorem isSymm_dualProd : (dualProd R M).IsSymm := fun _x _y => add_comm _ _
-#align bilin_form.is_symm_dual_prod BilinForm.isSymm_dualProd
+#align bilin_form.is_symm_dual_prod LinearMap.isSymm_dualProd
 
 end Semiring
 
@@ -51,33 +48,32 @@ section Ring
 
 variable [CommRing R] [AddCommGroup M] [Module R M]
 
-theorem nondenerate_dualProd :
-    (dualProd R M).Nondegenerate ↔ Function.Injective (Module.Dual.eval R M) := by
+theorem separatingLeft_dualProd :
+    (dualProd R M).SeparatingLeft ↔ Function.Injective (Module.Dual.eval R M) := by
   classical
-  rw [nondegenerate_iff_ker_eq_bot]
-  rw [LinearMap.ker_eq_bot]
+  rw [separatingLeft_iff_ker_eq_bot, ker_eq_bot]
   let e := LinearEquiv.prodComm R _ _ ≪≫ₗ Module.dualProdDualEquivDual R (Module.Dual R M) M
-  let h_d := e.symm.toLinearMap.comp (BilinForm.toLin <| dualProd R M)
+  let h_d := e.symm.toLinearMap.comp (dualProd R M)
   refine' (Function.Injective.of_comp_iff e.symm.injective
-    (BilinForm.toLin <| dualProd R M)).symm.trans _
-  rw [← LinearEquiv.coe_toLinearMap, ← LinearMap.coe_comp]
+    (dualProd R M)).symm.trans _
+  rw [← LinearEquiv.coe_toLinearMap, ← coe_comp]
   change Function.Injective h_d ↔ _
-  have : h_d = LinearMap.prodMap LinearMap.id (Module.Dual.eval R M) := by
-    refine' LinearMap.ext fun x => Prod.ext _ _
+  have : h_d = prodMap id (Module.Dual.eval R M) := by
+    refine' ext fun x => Prod.ext _ _
     · ext
       dsimp [Module.Dual.eval, LinearEquiv.prodComm]
       simp
     · ext
       dsimp [Module.Dual.eval, LinearEquiv.prodComm]
       simp
-  rw [this, LinearMap.coe_prodMap]
+  rw [this, coe_prodMap]
   refine' Prod.map_injective.trans _
   exact and_iff_right Function.injective_id
-#align bilin_form.nondenerate_dual_prod BilinForm.nondenerate_dualProd
+#align bilin_form.nondenerate_dual_prod LinearMap.separatingLeft_dualProd
 
 end Ring
 
-end BilinForm
+end LinearMap
 
 namespace QuadraticForm
 
@@ -94,18 +90,18 @@ def dualProd : QuadraticForm R (Module.Dual R M × M) where
     rw [Prod.smul_fst, Prod.smul_snd, LinearMap.smul_apply, LinearMap.map_smul, smul_eq_mul,
       smul_eq_mul, mul_assoc]
   exists_companion' :=
-    ⟨BilinForm.dualProd R M, fun p q => by
+    ⟨LinearMap.dualProd R M, fun p q => by
       dsimp only  -- porting note: added
-      rw [BilinForm.dualProd_apply, Prod.fst_add, Prod.snd_add, LinearMap.add_apply, map_add,
+      rw [LinearMap.dualProd_apply_apply, Prod.fst_add, Prod.snd_add, LinearMap.add_apply, map_add,
         map_add, add_right_comm _ (q.1 q.2), add_comm (q.1 p.2) (p.1 q.2), ← add_assoc, ←
         add_assoc]⟩
 #align quadratic_form.dual_prod QuadraticForm.dualProd
 
 @[simp]
-theorem _root_.BilinForm.dualProd.toQuadraticForm :
-    (BilinForm.dualProd R M).toQuadraticForm = 2 • dualProd R M :=
+theorem _root_.LinearMap.dualProd.toQuadraticForm :
+    (LinearMap.dualProd R M).toQuadraticForm = 2 • dualProd R M :=
   ext fun _a => (two_nsmul _).symm
-#align bilin_form.dual_prod.to_quadratic_form BilinForm.dualProd.toQuadraticForm
+#align bilin_form.dual_prod.to_quadratic_form LinearMap.dualProd.toQuadraticForm
 
 variable {R M N}
 
chore(*): rename FunLike to DFunLike (#9785)

This prepares for the introduction of a non-dependent synonym of FunLike, which helps a lot with keeping #8386 readable.

This is entirely search-and-replace in 680197f combined with manual fixes in 4145626, e900597 and b8428f8. The commands that generated this change:

sed -i 's/\bFunLike\b/DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoFunLike\b/toDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/import Mathlib.Data.DFunLike/import Mathlib.Data.FunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bHom_FunLike\b/Hom_DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean     
sed -i 's/\binstFunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bfunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoo many metavariables to apply `fun_like.has_coe_to_fun`/too many metavariables to apply `DFunLike.hasCoeToFun`/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean

Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -113,7 +113,7 @@ variable {R M N}
 @[simps!]
 def dualProdIsometry (f : M ≃ₗ[R] N) : (dualProd R M).IsometryEquiv (dualProd R N) where
   toLinearEquiv := f.dualMap.symm.prod f
-  map_app' x := FunLike.congr_arg x.fst <| f.symm_apply_apply _
+  map_app' x := DFunLike.congr_arg x.fst <| f.symm_apply_apply _
 #align quadratic_form.dual_prod_isometry QuadraticForm.dualProdIsometry
 
 /-- `QuadraticForm.dualProd` commutes (isometrically) with `QuadraticForm.prod`. -/
@@ -124,7 +124,7 @@ def dualProdProdIsometry : (dualProd R (M × N)).IsometryEquiv ((dualProd R M).p
     (Module.dualProdDualEquivDual R M N).symm.prod (LinearEquiv.refl R (M × N)) ≪≫ₗ
       LinearEquiv.prodProdProdComm R _ _ M N
   map_app' m :=
-    (m.fst.map_add _ _).symm.trans <| FunLike.congr_arg m.fst <| Prod.ext (add_zero _) (zero_add _)
+    (m.fst.map_add _ _).symm.trans <| DFunLike.congr_arg m.fst <| Prod.ext (add_zero _) (zero_add _)
 #align quadratic_form.dual_prod_prod_isometry QuadraticForm.dualProdProdIsometry
 
 end Semiring
chore(*): replace $ with <| (#9319)

See Zulip thread for the discussion.

Diff
@@ -135,7 +135,7 @@ variable [CommRing R] [AddCommGroup M] [Module R M]
 
 variable {R M}
 
-/-- The isometry sending `(Q.prod $ -Q)` to `(QuadraticForm.dualProd R M)`.
+/-- The isometry sending `(Q.prod <| -Q)` to `(QuadraticForm.dualProd R M)`.
 
 This is `σ` from Proposition 4.8, page 84 of
 [*Hermitian K-Theory and Geometric Applications*][hyman1973]; though we swap the order of the pairs.
chore: exactly 4 spaces in subsequent lines for def (#7321)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -142,7 +142,7 @@ This is `σ` from Proposition 4.8, page 84 of
 -/
 @[simps!]
 def toDualProd (Q : QuadraticForm R M) [Invertible (2 : R)] :
-  (Q.prod <| -Q) →qᵢ QuadraticForm.dualProd R M where
+    (Q.prod <| -Q) →qᵢ QuadraticForm.dualProd R M where
   toLinearMap := LinearMap.prod
     (Q.associated.toLin.comp (LinearMap.fst _ _ _) + Q.associated.toLin.comp (LinearMap.snd _ _ _))
     (LinearMap.fst _ _ _ - LinearMap.snd _ _ _)
feat(LinearAlgebra/QuadraticForm): add QuadraticForm.Isometry (#6984)

Also use it to tidy the API of CliffordAlgebra.map.

Diff
@@ -17,9 +17,8 @@ import Mathlib.LinearAlgebra.QuadraticForm.Prod
   `f x`.
 * `QuadraticForm.dualProd R M`, the quadratic form on `(f, x) : Module.Dual R M × M` defined as
   `f x`.
-* `QuadraticForm.toDualProd : M × M →ₗ[R] Module.Dual R M × M` a form-preserving map from
-  `(Q.prod $ -Q)` to `QuadraticForm.dualProd R M`. Note that we do not have the morphism
-  version of `QuadraticForm.IsometryEquiv`, so for now this is stated without full bundling.
+* `QuadraticForm.toDualProd : (Q.prod <| -Q) →qᵢ QuadraticForm.dualProd R M` a form-preserving map
+  from `(Q.prod <| -Q)` to `QuadraticForm.dualProd R M`.
 
 -/
 
@@ -142,22 +141,25 @@ This is `σ` from Proposition 4.8, page 84 of
 [*Hermitian K-Theory and Geometric Applications*][hyman1973]; though we swap the order of the pairs.
 -/
 @[simps!]
-def toDualProd (Q : QuadraticForm R M) [Invertible (2 : R)] : M × M →ₗ[R] Module.Dual R M × M :=
-  LinearMap.prod
+def toDualProd (Q : QuadraticForm R M) [Invertible (2 : R)] :
+  (Q.prod <| -Q) →qᵢ QuadraticForm.dualProd R M where
+  toLinearMap := LinearMap.prod
     (Q.associated.toLin.comp (LinearMap.fst _ _ _) + Q.associated.toLin.comp (LinearMap.snd _ _ _))
     (LinearMap.fst _ _ _ - LinearMap.snd _ _ _)
-#align quadratic_form.to_dual_prod QuadraticForm.toDualProd
-
-theorem toDualProd_isometry [Invertible (2 : R)] (Q : QuadraticForm R M) (x : M × M) :
-    QuadraticForm.dualProd R M (toDualProd Q x) = (Q.prod <| -Q) x := by
-  dsimp only [toDualProd, associated, associatedHom]
-  dsimp
-  -- porting note: added `()` around `Submonoid.smul_def`
-  simp [polar_comm _ x.1 x.2, ← sub_add, mul_sub, sub_mul, smul_sub, (Submonoid.smul_def), ←
-    sub_eq_add_neg (Q x.1) (Q x.2)]
-#align quadratic_form.to_dual_prod_isometry QuadraticForm.toDualProd_isometry
-
--- TODO: show that `toDualProd` is an equivalence
+  map_app' x := by
+    dsimp only [associated, associatedHom]
+    dsimp
+    -- porting note: added `()` around `Submonoid.smul_def`
+    simp [polar_comm _ x.1 x.2, ← sub_add, mul_sub, sub_mul, smul_sub, (Submonoid.smul_def), ←
+      sub_eq_add_neg (Q x.1) (Q x.2)]
+#align quadratic_form.to_dual_prod QuadraticForm.toDualProdₓ
+
+#align quadratic_form.to_dual_prod_isometry QuadraticForm.Isometry.map_appₓ
+
+/-!
+TODO: show that `QuadraticForm.toDualProd` is an `QuadraticForm.IsometryEquiv`
+-/
+
 end Ring
 
 end QuadraticForm
feat: port LinearAlgebra.QuadraticForm.Dual (#6885)

Dependencies 10 + 627

628 files ported (98.4%)
265274 lines ported (98.7%)
Show graph

The unported dependencies are