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

Commit fb41da9

Browse files
committed
feat(algebra/module/basic): turn implications into iffs (#11937)
* Turn the following implications into `iff`, rename them accordingly, and make the type arguments explicit (`M` has to be explicit when using it in `rw`, otherwise one will have unsolved type-class arguments) ``` eq_zero_of_two_nsmul_eq_zero -> two_nsmul_eq_zero eq_zero_of_eq_neg -> self_eq_neg ne_neg_of_ne_zero -> self_ne_neg ``` * Also add two variants * Generalize `ne_neg_iff_ne_zero` to work in modules over a ring
1 parent 0929387 commit fb41da9

File tree

3 files changed

+17
-24
lines changed

3 files changed

+17
-24
lines changed

src/algebra/module/basic.lean

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,8 @@ include R
521521
lemma nat.no_zero_smul_divisors : no_zero_smul_divisors ℕ M :=
522522
by { intros c x, rw [nsmul_eq_smul_cast R, smul_eq_zero], simp }⟩
523523

524-
variables {M}
525-
526-
lemma eq_zero_of_two_nsmul_eq_zero {v : M} (hv : 2 • v = 0) : v = 0 :=
527-
by haveI := nat.no_zero_smul_divisors R M;
528-
exact (smul_eq_zero.mp hv).resolve_left (by norm_num)
524+
@[simp] lemma two_nsmul_eq_zero {v : M} : 2 • v = 0 ↔ v = 0 :=
525+
by { haveI := nat.no_zero_smul_divisors R M, norm_num [smul_eq_zero] }
529526

530527
end nat
531528

@@ -559,15 +556,20 @@ end smul_injective
559556

560557
section nat
561558

562-
variables (R) [no_zero_smul_divisors R M] [char_zero R]
559+
variables (R M) [no_zero_smul_divisors R M] [char_zero R]
563560
include R
564561

565-
lemma eq_zero_of_eq_neg {v : M} (hv : v = - v) : v = 0 :=
566-
begin
567-
refine eq_zero_of_two_nsmul_eq_zero R _,
568-
rw two_smul,
569-
exact add_eq_zero_iff_eq_neg.mpr hv
570-
end
562+
lemma self_eq_neg {v : M} : v = - v ↔ v = 0 :=
563+
by rw [← two_nsmul_eq_zero R M, two_smul, add_eq_zero_iff_eq_neg]
564+
565+
lemma neg_eq_self {v : M} : - v = v ↔ v = 0 :=
566+
by rw [eq_comm, self_eq_neg R M]
567+
568+
lemma self_ne_neg {v : M} : v ≠ -v ↔ v ≠ 0 :=
569+
(self_eq_neg R M).not
570+
571+
lemma neg_ne_self {v : M} : -v ≠ v ↔ v ≠ 0 :=
572+
(neg_eq_self R M).not
571573

572574
end nat
573575

@@ -589,15 +591,6 @@ lemma smul_left_injective {x : M} (hx : x ≠ 0) :
589591

590592
end smul_injective
591593

592-
section nat
593-
594-
variables [char_zero R]
595-
596-
lemma ne_neg_of_ne_zero [no_zero_divisors R] {v : R} (hv : v ≠ 0) : v ≠ -v :=
597-
λ h, hv (eq_zero_of_eq_neg R h)
598-
599-
end nat
600-
601594
end module
602595

603596
section division_ring

src/analysis/normed_space/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ def homeomorph_unit_ball {E : Type*} [semi_normed_group E] [normed_space ℝ E]
674674
variables (α)
675675

676676
lemma ne_neg_of_mem_sphere [char_zero α] {r : ℝ} (hr : r ≠ 0) (x : sphere (0:E) r) : x ≠ - x :=
677-
λ h, ne_zero_of_mem_sphere hr x (eq_zero_of_eq_neg α (by { conv_lhs {rw h}, simp }))
677+
λ h, ne_zero_of_mem_sphere hr x ((self_eq_neg α _).mp (by { conv_lhs {rw h}, simp }))
678678

679679
lemma ne_neg_of_mem_unit_sphere [char_zero α] (x : sphere (0:E) 1) : x ≠ - x :=
680680
ne_neg_of_mem_sphere α one_ne_zero x

src/measure_theory/integral/bochner.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,15 +1331,15 @@ to a left-invariant measure is 0. -/
13311331
lemma integral_zero_of_mul_left_eq_neg [is_mul_left_invariant μ] {f : G → E} {g : G}
13321332
(hf' : ∀ x, f (g * x) = - f x) :
13331333
∫ x, f x ∂μ = 0 :=
1334-
by { refine eq_zero_of_eq_neg_, simp_rw [← integral_neg, ← hf', integral_mul_left_eq_self] }
1334+
by simp_rw [← self_eq_negE, ← integral_neg, ← hf', integral_mul_left_eq_self]
13351335

13361336
/-- If some right-translate of a function negates it, then the integral of the function with respect
13371337
to a right-invariant measure is 0. -/
13381338
@[to_additive]
13391339
lemma integral_zero_of_mul_right_eq_neg [is_mul_right_invariant μ] {f : G → E} {g : G}
13401340
(hf' : ∀ x, f (x * g) = - f x) :
13411341
∫ x, f x ∂μ = 0 :=
1342-
by { refine eq_zero_of_eq_neg_, simp_rw [← integral_neg, ← hf', integral_mul_right_eq_self] }
1342+
by simp_rw [← self_eq_negE, ← integral_neg, ← hf', integral_mul_right_eq_self]
13431343

13441344
end group
13451345

0 commit comments

Comments
 (0)