Skip to content

Commit 2c602cc

Browse files
yuanyi-350ReemMelamed
authored andcommitted
refactor(NumberTheory): golf Mathlib/NumberTheory/ArithmeticFunction/Defs (leanprover-community#40072)
- golfs `ArithmeticFunction/Defs` by replacing explicit divisor-antidiagonal singleton arguments in the left-identity theorem and `mul_one` with direct `simp_all` calls using divisor map lemmas and `sum_eq_single` Extracted from leanprover-community#38144 [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)
1 parent 8338fc4 commit 2c602cc

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

  • Mathlib/NumberTheory/ArithmeticFunction

Mathlib/NumberTheory/ArithmeticFunction/Defs.lean

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,7 @@ theorem mul_smul' (f g : ArithmeticFunction R) (h : ArithmeticFunction M) :
262262

263263
theorem one_smul' (b : ArithmeticFunction M) : (1 : ArithmeticFunction R) • b = b := by
264264
ext x
265-
rw [smul_apply]
266-
by_cases x0 : x = 0
267-
· simp [x0]
268-
have h : {(1, x)} ⊆ divisorsAntidiagonal x := by simp [x0]
269-
rw [← sum_subset h]
270-
· simp
271-
intro y ymem ynotMem
272-
have y1ne : y.fst ≠ 1 := fun con => by simp_all [Prod.ext_iff]
273-
simp [y1ne]
265+
simp_all [← map_div_right_divisors, sum_eq_single 1]
274266

275267
end Module
276268

@@ -282,17 +274,7 @@ instance instMonoid : Monoid (ArithmeticFunction R) where
282274
one_mul := one_smul'
283275
mul_one f := by
284276
ext x
285-
rw [mul_apply]
286-
by_cases x0 : x = 0
287-
· simp [x0]
288-
have h : {(x, 1)} ⊆ divisorsAntidiagonal x := by simp [x0]
289-
rw [← sum_subset h]
290-
· simp
291-
intro ⟨y₁, y₂⟩ ymem ynotMem
292-
have y2ne : y₂ ≠ 1 := by
293-
intro con
294-
simp_all
295-
simp [y2ne]
277+
simp_all [← map_div_left_divisors, sum_eq_single 1]
296278
mul_assoc := mul_smul'
297279

298280
instance instSemiring : Semiring (ArithmeticFunction R) where

0 commit comments

Comments
 (0)