-
Notifications
You must be signed in to change notification settings - Fork 371
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: extensible push_neg
tactic
#21769
base: master
Are you sure you want to change the base?
Conversation
PR summary 5f04d0c9deImport changes exceeding 2%
|
File | Base Count | Head Count | Change |
---|---|---|---|
Mathlib.Tactic.PushNeg | 62 | 0 | -62 (-100.00%) |
Mathlib.Tactic.Contrapose | 63 | 45 | -18 (-28.57%) |
Mathlib.Tactic.ByContra | 64 | 46 | -18 (-28.12%) |
Mathlib.Logic.IsEmpty | 71 | 75 | +4 (+5.63%) |
Mathlib.Algebra.Group.Pi.Basic | 114 | 118 | +4 (+3.51%) |
Mathlib.Tactic.Common | 240 | 238 | -2 (-0.83%) |
Import changes for all files
Files | Import difference |
---|---|
There are 5462 files with changed transitive imports taking up over 230695 characters: this is too many to display! | |
You can run scripts/import_trans_difference.sh all locally to see the whole output. |
Declarations diff
+ Head
+ Head.isHeadOf
+ PushSimpConfig
+ elabHead
+ elabPush
+ elabPushConv
+ nonempty_iff_empty_ne'
+ not_finite
+ not_imp
+ not_not
+ pushCore
+ pushStep
++ nonempty_iff_empty_ne
+-+ not_iff
- elabPushNegConv
- empty_ne_eq_nonempty
- ne_empty_eq_nonempty
- not_ge_eq
- not_gt_eq
- not_implies_eq
- not_le_eq
- not_lt_eq
- not_ne_eq
- not_nonempty_eq
- not_not_eq
- not_or_eq
- pushNegCore
- transformNegationStep
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
relative
value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolute
value is therelative
value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
Thanks a lot for starting this discussion! I for one believe a |
push_neg
replace ¬Finite
with Infinite
push_neg
tactic
push_neg
tacticpush_neg
tactic
This was started by point (3) of https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Possible.20improvements.20to.20Lean.2FMathlib/near/499085779
To be able to use
push_neg
more generally, this PR reimplements the tactic so that it is extensible. So, users can tag lemmas to be used bypush_neg
.This PR tags lemmas concerning empty/nonempty, subsingleton/nontrivial, and finite/infinite to be used in
push_neg
.Additionally, the tactic is extended to be able to push any constant that you want to push, and
push_neg
is now a macro forpush Not
. So far, I've tried to add lemmas for pushingReal.log
. I could imagine it could also be used forReal.exp
,pow
,mul
,smul
, or evenSet.mem
. (theSet.mem
lemmas are mostly tagged with@[simp]
already, butpush_mem
could be more readable thansimp
ordsimp
). Or a combination of pushingNot
andSet.compl
could be useful.The implementation is with the
simp
infrastructure, but instead of using post lemmas, like insimp
,push
usespre
lemmas, so we rewrite each expression before its subterms are rewritten. This is a more efficient way to "push" constants recursively. Most lemmas are added via the@[push]
attribute, but a few cases require some special handling, so they are implemented "by hand" in a simproc that is tried after thepush
lemmas.For example the simproc simplifies
¬∀ n, p
⇨∃ n, ¬p
, but, this is overridden by thepush
lemma that rewrites¬(p → q)
⇨p ∧ ¬q
(which doesn't apply at every forall)