Repository navigation
[Merged by Bors] - refactor(Data): make Set a one-field structure - #41506
YaelDillies wants to merge 8 commits into
Conversation
PR summary 7dd11309c0Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
| Current number | Change | Type (strong) |
|---|---|---|
| 4065 | -1 | backward.defeqAttrib.useBackward |
| 4236 | 2 | backward.isDefEq.respectTransparency |
| 494 | -1 | erw |
| 384 | -1 | adaptation notes |
| 8 | 1 | disabled deprecation lints |
Current commit 7dd11309c0
Reference commit 8d91c72b65
This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py 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).
|
Note that this basically takes over #39211. |
9c730e8 to
3b040e4
Compare
a0428f8 to
18bdab6
Compare
0773904 to
ee61bd8
Compare
|
This pull request has conflicts, please merge |
|
This pull request has conflicts, please merge |
|
This pull request has conflicts, please merge |
cd1dc78 to
b93f6c1
Compare
|
This pull request has conflicts, please merge |
1 similar comment
|
This pull request has conflicts, please merge |
JovanGerb
left a comment
There was a problem hiding this comment.
Thanks a lot for making this PR! I went through all the changes, and have just one small comment.
|
!radar |
|
Benchmark results for 28e880d against 18dc857 are in. There are significant results. @tb65536
Large changes (31✅, 7🟥)
Medium changes (73✅, 63🟥)
Small changes (83✅, 189🟥)
|
|
maintainer merge |
|
🚀 Pull request has been placed on the maintainer queue by JovanGerb. |
|
This pull request has conflicts, please merge |
|
This pull request has conflicts, please merge |
Vierkantor
left a comment
There was a problem hiding this comment.
There are some unfortunate regressions but most of the worst ones are easy enough to fix. And a lot of very small annoyances like broken grind or needing to specify more implicit parameters, which I don't think we should block this PR over.
Looks good with these suggestions. 🎉
| -/ | ||
| def toNat (p : Set α) : Set ℕ := | ||
| { n | p ((Encodable.decode (α := α) n).getD default) } | ||
| { n | (Encodable.decode (α := α) n).getD default ∈ p } |
There was a problem hiding this comment.
This file has a lot of positive changes, nice work!
There was a problem hiding this comment.
In fact, I meant to split it out to a separate PR but forgot, whoops! I have already split out all other big removals of defeq abuse removed (which is why the remaining diff doesn't look so glorious), but I guess there is little point splitting this out now that you have reviewed the PR? Up to you
|
The changes look good, and everything builds, so let's get this merged 🎉 bors r+ |
|
Pull request successfully merged into master. Build succeeded: |
|
A note for anyone who finds proofs that the kernel refuses after this change. Since The kernel behaviour is older than this PR, and leanprover/lean4#16613 reports it with a import Mathlib.Data.Set.Defs
open Lean Meta Elab Term
/-- Reducing `big n` needs `2 ^ n`. -/
def big (n : Nat) : Set Nat := if 2 ^ n = 0 then {a | a = 1} else {a | a = 0}
/-- `small` unfolds to `big (2 ^ 32)` in one delta step. -/
def small : Set Nat := big (2 ^ 32)
/-- Elaborate a statement `∀ xs, P → Q` and add the theorem `fun xs h => h` with `addDecl`, so
that only the kernel checks that `P` and `Q` are definitionally equal. -/
elab "#add_identity_theorem " name:ident " : " stmt:term : command =>
Command.liftTermElabM do
let type ← elabType stmt
synthesizeSyntheticMVarsNoPostponing
let type ← instantiateMVars type
let value ← forallTelescope type fun xs _ => mkLambdaFVars xs xs.back!
addDecl (.thmDecl { name := name.getId, levelParams := [], type, value })
-- Accepted before mathlib4#41506, rejected after it: "(kernel) the kernel refused to evaluate
-- `Nat.pow` because its second argument does not fit in a 32-bit unsigned integer".
#add_identity_theorem membership : ∀ a : Nat, a ∈ small → a ∈ big (2 ^ 32)
-- Accepted before and after mathlib4#41506.
#add_identity_theorem equality : ∀ P : Set Nat → Prop, P small → P (big (2 ^ 32))Results:
The two runs also differ in the Lean version. The upstream issue shows the same kernel results on We found this in VCVio, where 🤖 Generated with Claude Code |
Replace
with
Generated by Claude Opus. Painfully reviewed and improved line-by-line by myself.
Fix #10941
Assisted-by: Claude Opus 4.8
noncomputable#41446setOftoSet.ofPred#41507EventuallyEqonSet#41533Set α := α → Prop#42169noncomputable#42170setOftoSet.ofPred#42172Codisjoint,IsCompl#42173EventuallyConstonSet#43114ClassanabbrevforSet ZFSet#43467See previous attempt at #39211