-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: port Mathlib 3's Nat.factors
norm_num extension to a simproc
#15420
base: master
Are you sure you want to change the base?
Conversation
ccce0b1
to
3ad9f80
Compare
PR summary 3da8b59516Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
Nat.factors
norm_num extension from Mathlib 3Nat.factors
norm_num extension to a simproc
8a9e35c
to
5ebced1
Compare
8343d39
to
16ed74f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add more inline comments in the meta code? It would help maintainability
Mathlib/Tactic/NormNum/Factors.lean
Outdated
theorem FactorsHelper.same {n m : ℕ} (a : ℕ) {l : List ℕ} | ||
(h : IsNat (a * m) n) (H : FactorsHelper m a l) : | ||
FactorsHelper n a (a :: l) := fun pa => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theorem FactorsHelper.same {n m : ℕ} (a : ℕ) {l : List ℕ} | |
(h : IsNat (a * m) n) (H : FactorsHelper m a l) : | |
FactorsHelper n a (a :: l) := fun pa => | |
theorem FactorsHelper.cons_self {n m : ℕ} (a : ℕ) {l : List ℕ} | |
(h : IsNat (a * m) n) (H : FactorsHelper m a l) : | |
FactorsHelper n a (a :: l) := fun pa => |
maybe?
Mathlib/Tactic/NormNum/Factors.lean
Outdated
FactorsHelper n a (a :: l) := fun pa => | ||
H.cons_of_le _ h le_rfl (Nat.prime_def_minFac.1 pa).2 pa | ||
|
||
theorem FactorsHelper.same_singleton (a : ℕ) : FactorsHelper a a [a] := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the same logic, this would be
theorem FactorsHelper.same_singleton (a : ℕ) : FactorsHelper a a [a] := | |
theorem FactorsHelper.singleton_self (a : ℕ) : FactorsHelper a a [a] := |
Mathlib/Tactic/NormNum/Factors.lean
Outdated
let ⟨hn0⟩ ← if h : 0 < n then pure <| PLift.up h else | ||
throwError m!"{n'} must be positive" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we give up on computing primeFactorsList 0
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the aux
function, which expects the 0
and 1
cases to already have been dispatched, such that a
can be chosen as a prime less than n
.
I'll make it private to make this a little more clear.
This is a partial attempt at #15410, porting #8009