Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit d403cad

Browse files
committed
chore(linear_algebra/quadratic_form/basic): remove redundant fields (#14246)
This renames `quadratic_form.mk_left` to `quadratic_form.mk` by removing the redundant fields in the structure, as the proof of `mk_left` didn't actually use the fact the ring was commutative as it claimed to in the docstring. The only reason we could possibly want these is if addition were non-commutative, which seems extremely unlikely.
1 parent 218d66a commit d403cad

File tree

1 file changed

+24
-66
lines changed

1 file changed

+24
-66
lines changed

src/linear_algebra/quadratic_form/basic.lean

Lines changed: 24 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,15 @@ end quadratic_form
9090
variables [module R M] [module R₁ M]
9191

9292
open quadratic_form
93-
/-- A quadratic form over a module. -/
93+
/-- A quadratic form over a module.
94+
95+
Note we only need the left lemmas about `quadratic_form.polar` as the right lemmas follow from
96+
`quadratic_form.polar_comm`. -/
9497
structure quadratic_form (R : Type u) (M : Type v) [ring R] [add_comm_group M] [module R M] :=
9598
(to_fun : M → R)
9699
(to_fun_smul : ∀ (a : R) (x : M), to_fun (a • x) = a * a * to_fun x)
97100
(polar_add_left' : ∀ (x x' y : M), polar to_fun (x + x') y = polar to_fun x y + polar to_fun x' y)
98101
(polar_smul_left' : ∀ (a : R) (x y : M), polar to_fun (a • x) y = a • polar to_fun x y)
99-
(polar_add_right' : ∀ (x y y' : M), polar to_fun x (y + y') = polar to_fun x y + polar to_fun x y')
100-
(polar_smul_right' : ∀ (a : R) (x y : M), polar to_fun x (a • y) = a • polar to_fun x y)
101102

102103
namespace quadratic_form
103104

@@ -163,12 +164,12 @@ by simp only [add_zero, polar, quadratic_form.map_zero, sub_self]
163164
@[simp]
164165
lemma polar_add_right (x y y' : M) :
165166
polar Q x (y + y') = polar Q x y + polar Q x y' :=
166-
Q.polar_add_right' x y y'
167+
by rw [polar_comm Q x, polar_comm Q x, polar_comm Q x, polar_add_left]
167168

168169
@[simp]
169170
lemma polar_smul_right (a : R) (x y : M) :
170171
polar Q x (a • y) = a * polar Q x y :=
171-
Q.polar_smul_right' a x y
172+
by rw [polar_comm Q x, polar_comm Q x, polar_smul_left]
172173

173174
@[simp]
174175
lemma polar_neg_right (x y : M) :
@@ -222,9 +223,7 @@ protected def copy (Q : quadratic_form R M) (Q' : M → R) (h : Q' = ⇑Q) : qua
222223
{ to_fun := Q',
223224
to_fun_smul := h.symm ▸ Q.to_fun_smul,
224225
polar_add_left' := h.symm ▸ Q.polar_add_left',
225-
polar_smul_left' := h.symm ▸ Q.polar_smul_left',
226-
polar_add_right' := h.symm ▸ Q.polar_add_right',
227-
polar_smul_right' := h.symm ▸ Q.polar_smul_right' }
226+
polar_smul_left' := h.symm ▸ Q.polar_smul_left' }
228227

229228
section has_scalar
230229

@@ -240,10 +239,6 @@ instance : has_scalar S (quadratic_form R M) :=
240239
polar_add_left' := λ x x' y, by simp only [polar_smul, polar_add_left, smul_add],
241240
polar_smul_left' := λ b x y, begin
242241
simp only [polar_smul, polar_smul_left, ←mul_smul_comm, smul_eq_mul],
243-
end,
244-
polar_add_right' := λ x y y', by simp only [polar_smul, polar_add_right, smul_add],
245-
polar_smul_right' := λ b x y, begin
246-
simp only [polar_smul, polar_smul_right, ←mul_smul_comm, smul_eq_mul],
247242
end } ⟩
248243

249244
@[simp] lemma coe_fn_smul (a : S) (Q : quadratic_form R M) : ⇑(a • Q) = a • Q := rfl
@@ -257,9 +252,7 @@ instance : has_zero (quadratic_form R M) :=
257252
⟨ { to_fun := λ x, 0,
258253
to_fun_smul := λ a x, by simp only [mul_zero],
259254
polar_add_left' := λ x x' y, by simp only [add_zero, polar, sub_self],
260-
polar_smul_left' := λ a x y, by simp only [polar, smul_zero, sub_self],
261-
polar_add_right' := λ x y y', by simp only [add_zero, polar, sub_self],
262-
polar_smul_right' := λ a x y, by simp only [polar, smul_zero, sub_self]} ⟩
255+
polar_smul_left' := λ a x y, by simp only [polar, smul_zero, sub_self] } ⟩
263256

264257
@[simp] lemma coe_fn_zero : ⇑(0 : quadratic_form R M) = 0 := rfl
265258

@@ -275,11 +268,7 @@ instance : has_add (quadratic_form R M) :=
275268
polar_add_left' := λ x x' y,
276269
by simp only [polar_add, polar_add_left, add_assoc, add_left_comm],
277270
polar_smul_left' := λ a x y,
278-
by simp only [polar_add, smul_eq_mul, mul_add, polar_smul_left],
279-
polar_add_right' := λ x y y',
280-
by simp only [polar_add, polar_add_right, add_assoc, add_left_comm],
281-
polar_smul_right' := λ a x y,
282-
by simp only [polar_add, smul_eq_mul, mul_add, polar_smul_right] } ⟩
271+
by simp only [polar_add, smul_eq_mul, mul_add, polar_smul_left], } ⟩
283272

284273
@[simp] lemma coe_fn_add (Q Q' : quadratic_form R M) : ⇑(Q + Q') = Q + Q' := rfl
285274

@@ -293,11 +282,7 @@ instance : has_neg (quadratic_form R M) :=
293282
polar_add_left' := λ x x' y,
294283
by simp only [polar_neg, polar_add_left, neg_add],
295284
polar_smul_left' := λ a x y,
296-
by simp only [polar_neg, polar_smul_left, mul_neg, smul_eq_mul],
297-
polar_add_right' := λ x y y',
298-
by simp only [polar_neg, polar_add_right, neg_add],
299-
polar_smul_right' := λ a x y,
300-
by simp only [polar_neg, polar_smul_right, mul_neg, smul_eq_mul] } ⟩
285+
by simp only [polar_neg, polar_smul_left, mul_neg, smul_eq_mul], } ⟩
301286

302287
@[simp] lemma coe_fn_neg (Q : quadratic_form R M) : ⇑(-Q) = -Q := rfl
303288

@@ -374,13 +359,7 @@ def comp (Q : quadratic_form R N) (f : M →ₗ[R] N) :
374359
simp only [polar, f.map_add],
375360
polar_smul_left' := λ a x y,
376361
by convert polar_smul_left a (f x) (f y) using 1;
377-
simp only [polar, f.map_smul, f.map_add, smul_eq_mul],
378-
polar_add_right' := λ x y y',
379-
by convert polar_add_right (f x) (f y) (f y') using 1;
380-
simp only [polar, f.map_add],
381-
polar_smul_right' := λ a x y,
382-
by convert polar_smul_right a (f x) (f y) using 1;
383-
simp only [polar, f.map_smul, f.map_add, smul_eq_mul] }
362+
simp only [polar, f.map_smul, f.map_add, smul_eq_mul], }
384363

385364
@[simp] lemma comp_apply (Q : quadratic_form R N) (f : M →ₗ[R] N) (x : M) :
386365
(Q.comp f) x = Q (f x) := rfl
@@ -395,38 +374,21 @@ def _root_.linear_map.comp_quadratic_form {S : Type*}
395374
to_fun_smul := λ b x, by rw [function.comp_apply, Q.map_smul_of_tower b x, f.map_smul,
396375
smul_eq_mul],
397376
polar_add_left' := λ x x' y, by simp only [polar_comp, f.map_add, polar_add_left],
398-
polar_smul_left' := λ b x y, by simp only [polar_comp, f.map_smul, polar_smul_left_of_tower],
399-
polar_add_right' := λ x y y', by simp only [polar_comp, f.map_add, polar_add_right],
400-
polar_smul_right' := λ b x y, by simp only [polar_comp, f.map_smul, polar_smul_right_of_tower], }
377+
polar_smul_left' := λ b x y, by simp only [polar_comp, f.map_smul, polar_smul_left_of_tower], }
401378

402379
end comp
403380

404381
section comm_ring
405382

406-
/-- Create a quadratic form in a commutative ring by proving only one side of the bilinearity. -/
407-
def mk_left (f : M → R₁)
408-
(to_fun_smul : ∀ a x, f (a • x) = a * a * f x)
409-
(polar_add_left : ∀ x x' y, polar f (x + x') y = polar f x y + polar f x' y)
410-
(polar_smul_left : ∀ a x y, polar f (a • x) y = a * polar f x y) :
411-
quadratic_form R₁ M :=
412-
{ to_fun := f,
413-
to_fun_smul := to_fun_smul,
414-
polar_add_left' := polar_add_left,
415-
polar_smul_left' := polar_smul_left,
416-
polar_add_right' :=
417-
λ x y y', by rw [polar_comm, polar_add_left, polar_comm f y x, polar_comm f y' x],
418-
polar_smul_right' :=
419-
λ a x y, by rw [polar_comm, polar_smul_left, polar_comm f y x, smul_eq_mul] }
420-
421383
/-- The product of linear forms is a quadratic form. -/
422384
def lin_mul_lin (f g : M →ₗ[R₁] R₁) : quadratic_form R₁ M :=
423-
mk_left (f * g)
424-
(λ a x,
425-
by { simp only [smul_eq_mul, ring_hom.id_apply, pi.mul_apply, linear_map.map_smulₛₗ], ring })
426-
(λ x x' y, by { simp only [polar, pi.mul_apply, linear_map.map_add], ring })
427-
(λ a x y, begin
428-
simp only [polar, pi.mul_apply, linear_map.map_add, linear_map.map_smul, smul_eq_mul], ring
429-
end)
385+
{ to_fun := f * g,
386+
to_fun_smul := λ a x,
387+
by { simp only [smul_eq_mul, ring_hom.id_apply, pi.mul_apply, linear_map.map_smulₛₗ], ring },
388+
polar_add_left' := λ x x' y, by { simp only [polar, pi.mul_apply, linear_map.map_add], ring },
389+
polar_smul_left' := λ a x y, begin
390+
simp only [polar, pi.mul_apply, linear_map.map_add, linear_map.map_smul, smul_eq_mul], ring
391+
end }
430392

431393
@[simp]
432394
lemma lin_mul_lin_apply (f g : M →ₗ[R₁] R₁) (x) : lin_mul_lin f g x = f x * g x := rfl
@@ -486,16 +448,12 @@ by { simp only [add_assoc, add_sub_cancel', add_right, polar, add_left_inj, add_
486448

487449
/-- A bilinear form gives a quadratic form by applying the argument twice. -/
488450
def to_quadratic_form (B : bilin_form R M) : quadratic_form R M :=
489-
⟨ λ x, B x x,
490-
λ a x, by simp only [mul_assoc, smul_right, smul_left],
491-
λ x x' y, by simp only [add_assoc, add_right, add_left_inj, polar_to_quadratic_form, add_left,
492-
add_left_comm],
493-
λ a x y, by simp only [smul_add, add_left_inj, polar_to_quadratic_form,
494-
smul_right, smul_eq_mul, smul_left, smul_right, mul_add],
495-
λ x y y', by simp only [add_assoc, add_right, add_left_inj,
451+
{ to_fun := λ x, B x x,
452+
to_fun_smul := λ a x, by simp only [mul_assoc, smul_right, smul_left],
453+
polar_add_left' := λ x x' y, by simp only [add_assoc, add_right, add_left_inj,
496454
polar_to_quadratic_form, add_left, add_left_comm],
497-
λ a x y, by simp only [smul_add, add_left_inj, polar_to_quadratic_form,
498-
smul_right, smul_eq_mul, smul_left, smul_right, mul_add]
455+
polar_smul_left' := λ a x y, by simp only [smul_add, add_left_inj, polar_to_quadratic_form,
456+
smul_right, smul_eq_mul, smul_left, smul_right, mul_add] }
499457

500458
@[simp] lemma to_quadratic_form_apply (B : bilin_form R M) (x : M) :
501459
B.to_quadratic_form x = B x x :=

0 commit comments

Comments
 (0)