@@ -553,7 +553,7 @@ theorem comp_apply (Q : QuadraticForm R N) (f : M →ₗ[R] N) (x : M) : (Q.comp
553553
554554/-- Compose a quadratic form with a linear function on the left. -/
555555@ [simps (config := { simpRhs := true })]
556- def _root_.LinearMap.compQuadraticForm {S : Type *} [CommSemiring S] [Algebra S R] [Module S M]
556+ def _root_.LinearMap.compQuadraticForm [CommSemiring S] [Algebra S R] [Module S M]
557557 [IsScalarTower S R M] (f : R →ₗ[S] S) (Q : QuadraticForm R M) : QuadraticForm S M where
558558 toFun x := f (Q x)
559559 toFun_smul b x := by simp only [Q.map_smul_of_tower b x, f.map_smul, smul_eq_mul]
@@ -732,11 +732,6 @@ variable [Ring R] [AddCommGroup M] [Module R M]
732732
733733variable {B : BilinForm R M}
734734
735- theorem polar_to_quadratic_form (x y : M) : polar (fun x => B x x) x y = B x y + B y x := by
736- simp only [add_assoc, add_sub_cancel', add_right, polar, add_left_inj, add_neg_cancel_left,
737- add_left, sub_eq_add_neg _ (B y y), add_comm (B y x) _]
738- #align bilin_form.polar_to_quadratic_form BilinForm.polar_to_quadratic_form
739-
740735@[simp]
741736theorem toQuadraticForm_neg (B : BilinForm R M) : (-B).toQuadraticForm = -B.toQuadraticForm :=
742737 rfl
@@ -748,6 +743,24 @@ theorem toQuadraticForm_sub (B₁ B₂ : BilinForm R M) :
748743 rfl
749744#align bilin_form.to_quadratic_form_sub BilinForm.toQuadraticForm_sub
750745
746+ theorem polar_toQuadraticForm (x y : M) : polar (toQuadraticForm B) x y = B x y + B y x := by
747+ simp only [toQuadraticForm_apply, add_assoc, add_sub_cancel', add_right, polar, add_left_inj,
748+ add_neg_cancel_left, add_left, sub_eq_add_neg _ (B y y), add_comm (B y x) _]
749+ #align bilin_form.polar_to_quadratic_form BilinForm.polar_toQuadraticForm
750+
751+ theorem polarBilin_toQuadraticForm : polarBilin (toQuadraticForm B) = B + flip' B :=
752+ BilinForm.ext polar_toQuadraticForm
753+
754+ variable [CommRing S] [Algebra S R] [Module S M] [IsScalarTower S R M]
755+
756+ theorem _root_.LinearMap.compQuadraticForm_polar (f : R →ₗ[S] S) (Q : QuadraticForm R M) (x y : M) :
757+ polar (f.compQuadraticForm Q) x y = f (polar Q x y) := by
758+ simp [polar]
759+
760+ theorem _root_.LinearMap.compQuadraticForm_polarBilin (f : R →ₗ[S] S) (Q : QuadraticForm R M) :
761+ (f.compQuadraticForm Q).polarBilin = f.compBilinForm Q.polarBilin :=
762+ ext <| LinearMap.compQuadraticForm_polar _ _
763+
751764end Ring
752765
753766end BilinForm
@@ -771,18 +784,11 @@ where `S` is a commutative subring of `R`.
771784Over a commutative ring, use `QuadraticForm.associated`, which gives an `R`-linear map. Over a
772785general ring with no nontrivial distinguished commutative subring, use `QuadraticForm.associated'`,
773786which gives an additive homomorphism (or more precisely a `ℤ`-linear map.) -/
774- def associatedHom : QuadraticForm R M →ₗ[S] BilinForm R M where
775- toFun Q :=
776- (⟨⅟ 2 , fun x => (Commute.ofNat_right x 2 ).invOf_right⟩ : Submonoid.center R) • Q.polarBilin
777- map_add' Q Q' := by
778- ext
779- simp only [BilinForm.add_apply, BilinForm.smul_apply, coeFn_mk, polarBilin_apply, polar_add,
780- coeFn_add, smul_add]
781- map_smul' s Q := by
782- ext
783- -- porting note: added type annotations
784- simp only [RingHom.id_apply, polar_smul, smul_comm s (_ : Submonoid.center R) (_ : R),
785- polarBilin_apply, coeFn_mk, coeFn_smul, BilinForm.smul_apply]
787+ def associatedHom : QuadraticForm R M →ₗ[S] BilinForm R M :=
788+ (⟨⅟2 , Set.invOf_mem_center (Set.ofNat_mem_center _ _)⟩ : Submonoid.center R) •
789+ { toFun := polarBilin
790+ map_add' := fun _x _y => BilinForm.ext <| polar_add _ _
791+ map_smul' := fun _c _x => BilinForm.ext <| polar_smul _ _ }
786792#align quadratic_form.associated_hom QuadraticForm.associatedHom
787793
788794variable (Q : QuadraticForm R M)
@@ -792,6 +798,11 @@ theorem associated_apply (x y : M) : associatedHom S Q x y = ⅟ 2 * (Q (x + y)
792798 rfl
793799#align quadratic_form.associated_apply QuadraticForm.associated_apply
794800
801+ @[simp] theorem two_nsmul_associated : 2 • associatedHom S Q = Q.polarBilin := by
802+ ext
803+ dsimp
804+ rw [←smul_mul_assoc, two_nsmul, invOf_two_add_invOf_two, one_mul, polar]
805+
795806theorem associated_isSymm : (associatedHom S Q).IsSymm := fun x y => by
796807 simp only [associated_apply, add_comm, add_left_comm, sub_eq_add_neg, add_assoc]
797808#align quadratic_form.associated_is_symm QuadraticForm.associated_isSymm
@@ -805,7 +816,7 @@ theorem associated_comp {N : Type v} [AddCommGroup N] [Module R N] (f : N →ₗ
805816
806817theorem associated_toQuadraticForm (B : BilinForm R M) (x y : M) :
807818 associatedHom S B.toQuadraticForm x y = ⅟ 2 * (B x y + B y x) := by
808- simp only [associated_apply, ← polar_to_quadratic_form , polar, toQuadraticForm_apply ]
819+ simp only [associated_apply, ← polar_toQuadraticForm , polar]
809820#align quadratic_form.associated_to_quadratic_form QuadraticForm.associated_toQuadraticForm
810821
811822theorem associated_left_inverse (h : B₁.IsSymm) : associatedHom S B₁.toQuadraticForm = B₁ :=
@@ -859,7 +870,7 @@ end AssociatedHom
859870
860871section Associated
861872
862- variable [CommRing R₁] [AddCommGroup M] [Module R₁ M]
873+ variable [CommSemiring S] [ CommRing R₁] [AddCommGroup M] [Algebra S R₁ ] [Module R₁ M]
863874
864875variable [Invertible (2 : R₁)]
865876
@@ -871,6 +882,11 @@ abbrev associated : QuadraticForm R₁ M →ₗ[R₁] BilinForm R₁ M :=
871882 associatedHom R₁
872883#align quadratic_form.associated QuadraticForm.associated
873884
885+ variable (S) in
886+ theorem coe_associatedHom :
887+ ⇑(associatedHom S : QuadraticForm R₁ M →ₗ[S] BilinForm R₁ M) = associated :=
888+ rfl
889+
874890@[simp]
875891theorem associated_linMulLin (f g : M →ₗ[R₁] R₁) :
876892 associated (R₁ := R₁) (linMulLin f g) =
0 commit comments