Repository navigation
Conversation
PR summary 3e97beff8aImport changes exceeding 2%
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Tactic.Push | 80 | 82 | +2 (+2.50%) |
| Mathlib.Tactic.NormNum.Core | 230 | 232 | +2 (+0.87%) |
| Mathlib.Tactic.Abel | 417 | 419 | +2 (+0.48%) |
| Mathlib.Tactic.Ring.RingNF | 494 | 496 | +2 (+0.40%) |
| Mathlib.Analysis.Convex.Piecewise | 1058 | 1060 | +2 (+0.19%) |
| Mathlib.Tactic.ReduceModChar | 1328 | 1330 | +2 (+0.15%) |
Import changes for all files
| Files | Import difference |
|---|---|
| There are 6238 files with changed transitive imports taking up over 268856 characters: this is too many to display! | |
You can run scripts/import_trans_difference.sh all locally to see the whole output. |
Declarations diff
+ Lean.Elab.Tactic.withNondepPropLocation
+ inductive_proof
+ test
+ transformAtLocalDecl
+ transformAtLocation
+ transformAtNondepPropLocation
+ transformAtTarget
- abelNFLocalDecl
- abelNFTarget
- normNumAt
- pushNegLocalDecl
- pushNegTarget
- ringNFLocalDecl
- ringNFTarget
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).
|
This PR looks really nice. I can hopefully take a detailed look on Tuesday or Wednesday. |
| /-- Use `abel_nf` to rewrite the main goal. -/ | ||
| def abelNFTarget (s : IO.Ref AtomM.State) (cfg : AbelNF.Config) : TacticM Unit := withMainContext do | ||
| let goal ← getMainGoal | ||
| let tgt ← withReducible goal.getType' |
There was a problem hiding this comment.
Flagging for a final look: the new code does instantiateMVars (instead of withReducible).
| * `simplifyTarget`: true if the target is selected in the location argument | ||
| * `useSimp`: true if we used `norm_num` instead of `norm_num1` | ||
| -/ | ||
| def normNumAt (g : MVarId) (ctx : Simp.Context) (fvarIdsToSimp : Array FVarId) |
There was a problem hiding this comment.
This change looks broadly fine, but I don't feel confident signing off on all of it. Another pair of eyes would be appreciated.
|
I just finished a detailed review: 90% of the PR are straightforward; for the last 10%, I'd need another pair of eyes. (I asked a bunch of naive questions above.) @fldutchmann If you're in the office tomorrow, would you like to look over this together? On a higher level, this deduplication is really nice (and, one may argue, long overdue). Thanks a lot for doing this often-invisible work! |
grunweg
left a comment
There was a problem hiding this comment.
Making progress clarifying the review comments; to be continued!
|
Side note: the new file should import |
Co-authored-by: Eric Wieser <[email protected]>
|
I notice that the idiom |
There's an alternative spelling, |
| /-- A metaprogram whose input is an expression `e` and whose output is a new expression `e'`, | ||
| together with a proof that `e = e'`. | ||
|
|
||
| The metaprogram may optionally depend on `ctx`, a `Simp.Context`; if it does, then when the | ||
| metaprogram is run on a local hypothesis `h`, the context `ctx` will be modified to forget `h`. -/ | ||
| inductive SimprocLike | ||
| /-- Default case: a metaprogram which does not depend on a `Simp.Context`. -/ | ||
| | noContext (m : Expr → MetaM Simp.Result) | ||
| /-- A metaprogram which depends on a `Simp.Context`. In this case we must also provide the | ||
| `Simp.Context` to use it with; this will be modified at each hypothesis `h` to forget `h`. -/ | ||
| | withContext (ctx : Simp.Context) (m : Simp.Context → Expr → MetaM Simp.Result) |
There was a problem hiding this comment.
Why have this inductive? Why not just always carry the context, and either the callers can pass a function that ignores the context, or provide a constructor that does that for you?
There was a problem hiding this comment.
I'm not too worried here, so don't change if you think it's best. But it feels strange to me, and if this could be sorted out cleanly I'd aspire to upstreaming this.
|
bors merge |
Many metaprograms have the following general structure: the input is an expression `e` and the output is a new expression `e'`, together with a proof that `e = e'`. Such a metaprogram produces a variety of tactics: it may be used to modify the goal, a specified hypothesis, or (via `Tactic.Location`) a combination of these. Roughly the same code for this is repeated throughout the library, for the tactics `ring_nf`, `abel_nf`, `norm_num`, `push_neg` and `reduce_mod_char`; possibly it originates from the `ring_nf` version, #552. This PR extracts this repeated code to stand-alone functions `Mathlib.Util.AtLocation` and `Mathlib.Util.AtNondepPropLocation`.
|
Pull request successfully merged into master. Build succeeded: |
|
I'm not sure whether this is an intended consequence, but this PR broke proofs such as the following: import Mathlib.Tactic
example (h : 0 = 1) (h2 : 0 = 2) : False := by
norm_num at h h2 -- error: No goals to be solved
-- slightly more realistic example
example {x : Nat} (hx : x < 2) (h : x = 1) (h2 : x = 2) : False := by
interval_cases x <;> norm_num at h h2 -- error: No goals to be solvedIt seems that if |
…ity#27562) Many metaprograms have the following general structure: the input is an expression `e` and the output is a new expression `e'`, together with a proof that `e = e'`. Such a metaprogram produces a variety of tactics: it may be used to modify the goal, a specified hypothesis, or (via `Tactic.Location`) a combination of these. Roughly the same code for this is repeated throughout the library, for the tactics `ring_nf`, `abel_nf`, `norm_num`, `push_neg` and `reduce_mod_char`; possibly it originates from the `ring_nf` version, leanprover-community#552. This PR extracts this repeated code to stand-alone functions `Mathlib.Util.AtLocation` and `Mathlib.Util.AtNondepPropLocation`.
|
@dwrensha Oops! On the one hand, yes, this is unintended. On the other hand, given that the logic is this easy to mess up, it's probably all the better that we standardize it in a single function ... Do you mind opening an issue? I'll try to get to it soon, unless someone else does -- a quick impression is that maybe this requires moving away from the implementation on top of Another question: what should be done if the tactic fails at one of the specified hypotheses, but also closes the goal (by reducing to |
|
I expect the import Mathlib.Tactic
example (h : 0 = 1) (h2 : 0 = 2) : False := by
simp at h h2
-- slightly more realistic example
example {x : Nat} (hx : x < 2) (h : x = 1) (h2 : x = 2) : False := by
interval_cases x <;> simp at h h2I'll open an issue. |
…ity#27562) Many metaprograms have the following general structure: the input is an expression `e` and the output is a new expression `e'`, together with a proof that `e = e'`. Such a metaprogram produces a variety of tactics: it may be used to modify the goal, a specified hypothesis, or (via `Tactic.Location`) a combination of these. Roughly the same code for this is repeated throughout the library, for the tactics `ring_nf`, `abel_nf`, `norm_num`, `push_neg` and `reduce_mod_char`; possibly it originates from the `ring_nf` version, leanprover-community#552. This PR extracts this repeated code to stand-alone functions `Mathlib.Util.AtLocation` and `Mathlib.Util.AtNondepPropLocation`.
…ity#27562) Many metaprograms have the following general structure: the input is an expression `e` and the output is a new expression `e'`, together with a proof that `e = e'`. Such a metaprogram produces a variety of tactics: it may be used to modify the goal, a specified hypothesis, or (via `Tactic.Location`) a combination of these. Roughly the same code for this is repeated throughout the library, for the tactics `ring_nf`, `abel_nf`, `norm_num`, `push_neg` and `reduce_mod_char`; possibly it originates from the `ring_nf` version, leanprover-community#552. This PR extracts this repeated code to stand-alone functions `Mathlib.Util.AtLocation` and `Mathlib.Util.AtNondepPropLocation`.
…ity#27562) Many metaprograms have the following general structure: the input is an expression `e` and the output is a new expression `e'`, together with a proof that `e = e'`. Such a metaprogram produces a variety of tactics: it may be used to modify the goal, a specified hypothesis, or (via `Tactic.Location`) a combination of these. Roughly the same code for this is repeated throughout the library, for the tactics `ring_nf`, `abel_nf`, `norm_num`, `push_neg` and `reduce_mod_char`; possibly it originates from the `ring_nf` version, leanprover-community#552. This PR extracts this repeated code to stand-alone functions `Mathlib.Util.AtLocation` and `Mathlib.Util.AtNondepPropLocation`.
Many metaprograms have the following general structure: the input is an expression
eand the output is a new expressione', together with a proof thate = e'. Such a metaprogram produces a variety of tactics: it may be used to modify the goal, a specified hypothesis, or (viaTactic.Location) a combination of these.Roughly the same code for this is repeated throughout the library, for the tactics
ring_nf,abel_nf,norm_num,push_negandreduce_mod_char; possibly it originates from thering_nfversion, #552.This PR extracts this repeated code to stand-alone functions
Mathlib.Util.AtLocationandMathlib.Util.AtNondepPropLocation.