Repository navigation
Conversation
PR summary c9e5385874Import changes exceeding 2%
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.NumberTheory.ArithmeticFunction | 969 | 1121 | +152 (+15.69%) |
Import changes for all files
| Files | Import difference |
|---|---|
Mathlib.NumberTheory.VonMangoldt |
20 |
Mathlib.NumberTheory.EulerProduct.Basic Mathlib.NumberTheory.TsumDivsorsAntidiagonal |
31 |
Mathlib.Algebra.Order.Antidiag.Nat |
146 |
Mathlib.NumberTheory.SelbergSieve |
151 |
Mathlib.NumberTheory.ArithmeticFunction |
152 |
Declarations diff
+ coe_id_mul_moebius_eq_coe_totient
+ isMultiplicative_totient
+ moebius_mul_coe_id_eq_coe_totient
+ totient
+ totient_apply
+ totient_mul_zeta
+ zeta_mul_totient
You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>The doc-module for script/declarations_diff.sh contains some details about this script.
No changes to technical debt.
You can run this locally as
./scripts/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
b-mehta
left a comment
There was a problem hiding this comment.
In my opinion, we shouldn't make two versions of this function, instead we should re-define Nat.totient to be an ArithmeticFunction. But I'd like to hear what others think about this too, since that could be an intrusive change. @eric-wieser, perhaps?
| def totient : ArithmeticFunction ℕ := | ||
| ⟨fun n => n.totient, by simp⟩ |
There was a problem hiding this comment.
May as well skip simp here:
| def totient : ArithmeticFunction ℕ := | |
| ⟨fun n => n.totient, by simp⟩ | |
| @[simps] | |
| def totient : ArithmeticFunction ℕ where | |
| toFun := Nat.totient | |
| map_zero' := Nat.totient_zero |
There was a problem hiding this comment.
Sure! I'll change the definition as above, except tagging it with [@simp]. See comments below.
| /-- Fall back to `Nat.totient`. | ||
| Added as a `simp` lemma so that `simp` can make use of the existing lemmas for `Nat.totient`. -/ | ||
| @[simp] | ||
| theorem totient_apply {n : ℕ} : ϕ n = n.totient := rfl |
There was a problem hiding this comment.
This can be deleted with my @[simps] above
There was a problem hiding this comment.
Apologize that I'm not so familiar with @[simps], but seemingly this approach changes the behavior of simp? Try this minimal example:
import Mathlib.NumberTheory.ArithmeticFunction
import Mathlib.Data.Nat.Totient
namespace ArithmeticFunction
open Nat
@[simps]
def totient : ArithmeticFunction ℕ where
toFun := Nat.totient
map_zero' := Nat.totient_zero
#check totient_apply
theorem totient_one : totient 1 = 1 := by
simp -- `simp` made no progress
end ArithmeticFunctionOn my side only simp [totient_apply 1] works. This is not desired, right? Previously a single simp closes the goal.
Not sure why this happens, but having an explicit [@simp] xxx_apply is a common practice in ArithmeticFunction.lean. I would suggest following the original style for the time being? (maybe replacing these [@simp] xxx_apply with @[simps] in another pull request)
My take is usually that the definition should be unbundled, and then the bundled versions should unfold to it; meaning the approach in this PR seems reasonable. |
I think I'm not seeing the advantage of having the unbundled version around at all here, since they both take the same assumptions (none) |
|
@eric-wieser @b-mehta Can you get to an agreement here? |
|
I think it definitely makes sense to have the totient as an |
|
Fun fact: the identities |
|
maintainer merge |
|
🚀 Pull request has been placed on the maintainer queue by MichaelStollBayreuth. |
|
How bad would be, in terms of imports, removing |
I might not have sufficient knowledge to give a firm answer. Nevertheless, currently
But around 30+ files are calling |
Those are not a real problems, but currently |
|
This pull request has conflicts, please merge |
|
Hi @sun123zxy, I've opened #46097 on the same topic without realising this PR existed. Are you still working on this PR? If so, I'm happy to close mine, but otherwise, would you mind if continued with #46097? |
|
Hi @xroblot, Glad to hear that someone is working on this again! This PR is really outdated now, will close it right away. |
This wraps the Euler's totient function
Nat.totientinto a newArithmeticFunctionϕ, with some basic identities such asϕ * ζ = idandμ * id = ϕ.We use the notation
ϕto distinguish fromNat.totient's notationφ, however this might be controversial. Suggestions are welcome!