@@ -382,7 +382,7 @@ variable [CommSemiring R] [AddCommMonoid M] [Module R M]
382
382
section SMul
383
383
384
384
variable [Monoid S] [Monoid T] [DistribMulAction S R] [DistribMulAction T R]
385
- variable [SMulCommClass R S R] [SMulCommClass S R R ] [SMulCommClass T R R] [SMulCommClass R T R]
385
+ variable [SMulCommClass S R R ] [SMulCommClass T R R]
386
386
387
387
/-- `QuadraticForm R M` inherits the scalar action from any algebra over `R`.
388
388
@@ -393,6 +393,7 @@ instance : SMul S (QuadraticForm R M) :=
393
393
toFun_smul := fun b x => by rw [Pi.smul_apply, map_smul, Pi.smul_apply, mul_smul_comm]
394
394
exists_companion' :=
395
395
let ⟨B, h⟩ := Q.exists_companion
396
+ letI := SMulCommClass.symm S R R
396
397
⟨a • B, by simp [h]⟩ }⟩
397
398
398
399
@[simp]
@@ -486,7 +487,7 @@ theorem sum_apply {ι : Type*} (Q : ι → QuadraticForm R M) (s : Finset ι) (x
486
487
487
488
end Sum
488
489
489
- instance [Monoid S] [DistribMulAction S R] [SMulCommClass S R R] [SMulCommClass R S R] :
490
+ instance [Monoid S] [DistribMulAction S R] [SMulCommClass S R R] :
490
491
DistribMulAction S (QuadraticForm R M) where
491
492
mul_smul a b Q := ext fun x => by simp only [smul_apply, mul_smul]
492
493
one_smul Q := ext fun x => by simp only [QuadraticForm.smul_apply, one_smul]
@@ -497,7 +498,7 @@ instance [Monoid S] [DistribMulAction S R] [SMulCommClass S R R] [SMulCommClass
497
498
ext
498
499
simp only [zero_apply, smul_apply, smul_zero]
499
500
500
- instance [Semiring S] [Module S R] [SMulCommClass S R R] [SMulCommClass R S R] :
501
+ instance [Semiring S] [Module S R] [SMulCommClass S R R] :
501
502
Module S (QuadraticForm R M) where
502
503
zero_smul Q := by
503
504
ext
@@ -577,9 +578,8 @@ def _root_.LinearMap.compQuadraticForm [CommSemiring S] [Algebra S R] [Module S
577
578
toFun_smul b x := by simp only [Q.map_smul_of_tower b x, f.map_smul, smul_eq_mul]
578
579
exists_companion' :=
579
580
let ⟨B, h⟩ := Q.exists_companion
580
- ⟨(LinearMap.restrictScalars S (LinearMap.restrictScalars S B.flip).flip).compr₂ f, fun x y => by
581
- simp_rw [h, f.map_add]
582
- rfl⟩
581
+ ⟨(B.restrictScalars₁₂ S).compr₂ f, fun x y => by
582
+ simp_rw [h, f.map_add, LinearMap.compr₂_apply, LinearMap.restrictScalars₁₂_apply_apply]⟩
583
583
#align linear_map.comp_quadratic_form LinearMap.compQuadraticForm
584
584
585
585
end Comp
@@ -595,9 +595,9 @@ def linMulLin (f g : M →ₗ[R] R) : QuadraticForm R M where
595
595
simp only [smul_eq_mul, RingHom.id_apply, Pi.mul_apply, LinearMap.map_smulₛₗ]
596
596
ring
597
597
exists_companion' :=
598
- ⟨LinearMap.linMulLin f g + LinearMap.linMulLin g f, fun x y => by
599
- simp only [Pi.mul_apply, map_add, LinearMap.linMulLin , LinearMap.add_apply ,
600
- LinearMap.mk₂_apply ]
598
+ ⟨( LinearMap.mul R R).compl₁₂ f g + ( LinearMap.mul R R).compl₁₂ g f, fun x y => by
599
+ simp only [Pi.mul_apply, map_add, LinearMap.compl₁₂_apply , LinearMap.mul_apply' ,
600
+ LinearMap.add_apply ]
601
601
ring_nf⟩
602
602
#align quadratic_form.lin_mul_lin QuadraticForm.linMulLin
603
603
@@ -664,7 +664,7 @@ section Semiring
664
664
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
665
665
666
666
/-- A bilinear map into `R` gives a quadratic form by applying the argument twice. -/
667
- def _root_.LinearMap.toQuadraticForm (B: M →ₗ[R] M →ₗ[R] R) : QuadraticForm R M where
667
+ def _root_.LinearMap.toQuadraticForm (B : M →ₗ[R] M →ₗ[R] R) : QuadraticForm R M where
668
668
toFun x := B x x
669
669
toFun_smul a x := by
670
670
simp only [SMulHomClass.map_smul, LinearMap.smul_apply, smul_eq_mul, mul_assoc]
@@ -702,7 +702,7 @@ theorem toQuadraticForm_add (B₁ B₂ : BilinForm R M) :
702
702
703
703
@[simp]
704
704
theorem toQuadraticForm_smul [Monoid S] [DistribMulAction S R] [SMulCommClass S R R]
705
- [SMulCommClass R S R] (a : S) (B : BilinForm R M) :
705
+ (a : S) (B : BilinForm R M) :
706
706
(a • B).toQuadraticForm = a • B.toQuadraticForm :=
707
707
rfl
708
708
#align bilin_form.to_quadratic_form_smul BilinForm.toQuadraticForm_smul
@@ -721,7 +721,7 @@ def toQuadraticFormAddMonoidHom : BilinForm R M →+ QuadraticForm R M where
721
721
722
722
/-- `BilinForm.toQuadraticForm` as a linear map -/
723
723
@[simps!]
724
- def toQuadraticFormLinearMap [Semiring S] [Module S R] [SMulCommClass S R R] [SMulCommClass R S R] :
724
+ def toQuadraticFormLinearMap [Semiring S] [Module S R] [SMulCommClass S R R] :
725
725
BilinForm R M →ₗ[S] QuadraticForm R M where
726
726
toFun := toQuadraticForm
727
727
map_smul' := toQuadraticForm_smul
@@ -1292,16 +1292,16 @@ variable (R)
1292
1292
1293
1293
The weights are applied using `•`; typically this definition is used either with `S = R` or
1294
1294
`[Algebra S R]`, although this is stated more generally. -/
1295
- def weightedSumSquares [Monoid S] [DistribMulAction S R] [SMulCommClass S R R] [SMulCommClass R S R]
1296
- (w : ι → S) : QuadraticForm R (ι → R) :=
1295
+ def weightedSumSquares [Monoid S] [DistribMulAction S R] [SMulCommClass S R R] (w : ι → S) :
1296
+ QuadraticForm R (ι → R) :=
1297
1297
∑ i : ι, w i • proj i i
1298
1298
#align quadratic_form.weighted_sum_squares QuadraticForm.weightedSumSquares
1299
1299
1300
1300
end
1301
1301
1302
1302
@[simp]
1303
1303
theorem weightedSumSquares_apply [Monoid S] [DistribMulAction S R] [SMulCommClass S R R]
1304
- [SMulCommClass R S R] (w : ι → S) (v : ι → R) :
1304
+ (w : ι → S) (v : ι → R) :
1305
1305
weightedSumSquares R w v = ∑ i : ι, w i • (v i * v i) :=
1306
1306
QuadraticForm.sum_apply _ _ _
1307
1307
#align quadratic_form.weighted_sum_squares_apply QuadraticForm.weightedSumSquares_apply
0 commit comments