Repository navigation
Conversation
PR summary 937c0944a5Import changes for modified filesNo significant changes to the import graph Import changes for all files
Declarations diff
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 No changes to technical debt.You can run this locally as
|
470c053 to
68826e2
Compare
|
Could you explain somewhere what went wrong before and how this is now fixed? |
I added an explanation to the PR description, and a cross-reference to this PR in the test. |
|
Thanks! maintainer merge |
|
🚀 Pull request has been placed on the maintainer queue by JovanGerb. |
| `Mathlib.Tactic.Abel.eval` metaprogram. -/ | ||
| def isAtom (e : Expr) : Bool := | ||
| match e.getAppFnArgs with | ||
| | (``HAdd.hAdd, #[_, _, _, _, _, _]) |
There was a problem hiding this comment.
Here and in the remaining match-arms, why are you also enforcing that the number of arguments is what it is? Why not using
| | (``HAdd.hAdd, #[_, _, _, _, _, _]) | |
| | (``HAdd.hAdd, _) |
instead?
There was a problem hiding this comment.
The immediate reason is that this function is supposed to have the same expression-parsing structure as the above (more important) function Mathlib.Tactic.Abel.eval, and eval does it this way!
The reason (I suppose) why eval does it this way is that an HAdd.hAdd expression with fewer inputs, like @HAdd.hAdd Nat Nat Nat instHAdd x, i.e. fun y ↦ x + y, cannot be handled by the abel-normalization algorithm.
There was a problem hiding this comment.
Ah, I had not thought of partial applications, thanks!
bors merge
Fix the bug reported at https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/abel_nf.20bug/with/540086130. Context: when `abel_nf` runs on a statement `e`, it is supposed to run abelian-group-normalization only on subexpressions of `e` which would not be treated as atoms by the normalization algorithm. For example, in the statement `log (sin (x + y + y)) + log (sin (y + x + y)) = z` the normalization should be run - on `x + y + y` => `x + 2y` - on `y + x + y` => `x + 2y` - on `log (sin (x + 2y)) + log (sin (x + 2y))` => `2 log (sin (x + 2y))` but not on `x`, `y`, `z`, `sin (x + 2y)`, `log (sin (x + 2y))` or `2 log (sin (x + 2y)) = z`. This saves work, and also keeps the table of atoms smaller (e.g. in the above example `z`, `sin (x + 2y)` and `2 log (sin (x + 2y)) = z` never join the atoms table since they never appear as atomic subexpressions of abelian-group expressions). The issue fixed in this PR was that the atoms check was logically incorrect: instead of testing whether a subexpression `t` was non-atomic *before* normalizing it, we tested -- *after* normalizing it! -- whether its normalized form `t'` was non-atomic.
|
Pull request successfully merged into master. Build succeeded: |
abel_nf bugabel_nf bug
Fix the bug reported at https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/abel_nf.20bug/with/540086130. Context: when `abel_nf` runs on a statement `e`, it is supposed to run abelian-group-normalization only on subexpressions of `e` which would not be treated as atoms by the normalization algorithm. For example, in the statement `log (sin (x + y + y)) + log (sin (y + x + y)) = z` the normalization should be run - on `x + y + y` => `x + 2y` - on `y + x + y` => `x + 2y` - on `log (sin (x + 2y)) + log (sin (x + 2y))` => `2 log (sin (x + 2y))` but not on `x`, `y`, `z`, `sin (x + 2y)`, `log (sin (x + 2y))` or `2 log (sin (x + 2y)) = z`. This saves work, and also keeps the table of atoms smaller (e.g. in the above example `z`, `sin (x + 2y)` and `2 log (sin (x + 2y)) = z` never join the atoms table since they never appear as atomic subexpressions of abelian-group expressions). The issue fixed in this PR was that the atoms check was logically incorrect: instead of testing whether a subexpression `t` was non-atomic *before* normalizing it, we tested -- *after* normalizing it! -- whether its normalized form `t'` was non-atomic.
Fix the bug reported at https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/abel_nf.20bug/with/540086130. Context: when `abel_nf` runs on a statement `e`, it is supposed to run abelian-group-normalization only on subexpressions of `e` which would not be treated as atoms by the normalization algorithm. For example, in the statement `log (sin (x + y + y)) + log (sin (y + x + y)) = z` the normalization should be run - on `x + y + y` => `x + 2y` - on `y + x + y` => `x + 2y` - on `log (sin (x + 2y)) + log (sin (x + 2y))` => `2 log (sin (x + 2y))` but not on `x`, `y`, `z`, `sin (x + 2y)`, `log (sin (x + 2y))` or `2 log (sin (x + 2y)) = z`. This saves work, and also keeps the table of atoms smaller (e.g. in the above example `z`, `sin (x + 2y)` and `2 log (sin (x + 2y)) = z` never join the atoms table since they never appear as atomic subexpressions of abelian-group expressions). The issue fixed in this PR was that the atoms check was logically incorrect: instead of testing whether a subexpression `t` was non-atomic *before* normalizing it, we tested -- *after* normalizing it! -- whether its normalized form `t'` was non-atomic.
Fix the bug reported at https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/abel_nf.20bug/with/540086130.
Context: when
abel_nfruns on a statemente, it is supposed to run abelian-group-normalization only on subexpressions ofewhich would not be treated as atoms by the normalization algorithm. For example, in the statementlog (sin (x + y + y)) + log (sin (y + x + y)) = zthe normalization should be runx + y + y=>x + 2yy + x + y=>x + 2ylog (sin (x + 2y)) + log (sin (x + 2y))=>2 log (sin (x + 2y))but not on
x,y,z,sin (x + 2y),log (sin (x + 2y))or2 log (sin (x + 2y)) = z. This saves work, and also keeps the table of atoms smaller (e.g. in the above examplez,sin (x + 2y)and2 log (sin (x + 2y)) = znever join the atoms table since they never appear as atomic subexpressions of abelian-group expressions).The issue fixed in this PR was that the atoms check was logically incorrect: instead of testing whether a subexpression
twas non-atomic before normalizing it, we tested -- after normalizing it! -- whether its normalized formt'was non-atomic.