-
Notifications
You must be signed in to change notification settings - Fork 251
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
fix: fin bug in to_additive #1861
Conversation
b843027
to
58af617
Compare
Lean.Expr.replaceRec fun r e ↦ Id.run do | ||
if trace then | ||
dbg_trace s!"replacing at {e}" |
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.
I don't think it's a good idea to use dbg_trace
for logging. It doesn't use MessageData, and the output is not interleaved with the other trace messages (dbg_trace
just prints things to stdout).
We should either put this function in CoreM
or leave out the logging.
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.
Putting this function in CoreM
would require generalizing memoFix
to monads (which is used in Lean.Expr.replaceRec
), so that it memoizes the output value of a monad application. I don't know if that is doable, and more specifically, I don't know how to do that.
I find the dbg_trace
useful when debugging, and they will only ever fire with trace.to_additive_detail
set to true, which almost nobody ever does (and never happens on the master branch of mathlib). That said, if you think this bad, I'll remove the dbg_trace
(I could also put them behind a new option to_additive_debug
).
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.
Ah, I didn't realize it was only set with to_additive_detail
. I still don't think it's a good solution, but at least it's contained.
be05a34
to
58af617
Compare
I was very confused when merging this with master, since git would remove all my changes. |
I will close this PR now @gebner I will still change the |
Looks like #1848 has been merged while still having a "Blocked-by-other-PR" label. |
to_additive
heuristic was ported wrong (a conjunction in Lean 3 was ported to a disjunction in Lean 4)(fun x => α) (n + 1)
as a type that depends onNat
. This was causing at least one error.applyReplacementFun
(withdbg_trace
, since it's a pure function).additiveTestAux
, since it's currently still exponentially slower than necessary (though usually applied to only small terms).