Skip to content

feat(Topology): implement delaborators for non-standard topology notation#31425

Open
robertmaxton42 wants to merge 32 commits intoleanprover-community:masterfrom
robertmaxton42:delab_isFoo_of
Open

feat(Topology): implement delaborators for non-standard topology notation#31425
robertmaxton42 wants to merge 32 commits intoleanprover-community:masterfrom
robertmaxton42:delab_isFoo_of

Conversation

@robertmaxton42
Copy link
Copy Markdown
Collaborator

Add delaborators for unary and binary notation related to non-standard topologies in the TopologicalSpace namespace.


Open in Gitpod

Added delaborators for unary and binary notation related to non-standard topologies in the TopologicalSpace namespace.
@github-actions github-actions bot added the t-topology Topological spaces, uniform spaces, metric spaces, filters label Nov 9, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 9, 2025

PR summary 2ff88851d5

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Util.DelabNonCanonical (new file) 52

Declarations diff

+ Lean.Meta.isCanonicalInstance
+ delabBinary
+ delabCheckingCanonical
+ delabUnary
+ synthesis

You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/reporting/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 the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

Comment thread Mathlib/Topology/Defs/Basic.lean Outdated
@eric-wieser
Copy link
Copy Markdown
Member

Probably this should have a test file

Comment thread Mathlib/Topology/Defs/Basic.lean Outdated
Comment thread Mathlib/Topology/Defs/Basic.lean Outdated
@kckennylau kckennylau added the awaiting-author A reviewer has asked the author a question or requested changes. label Nov 9, 2025
Comment thread Mathlib/Topology/Defs/Basic.lean Outdated
Comment on lines +220 to +221
assertNonCanonical 0 2 <|> assertNonCanonical 1 3
let instDα ← withNaryArg 2 delab
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the withNaryArg 2 delab can also be extracted to the assertNonCanonical function as the output.

Copy link
Copy Markdown
Collaborator Author

@robertmaxton42 robertmaxton42 Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, doing that means that we commit to failing if this particular instance is non-canonical -- I don't think we can use <|> anymore, so behavior changes from NAND (not both canonical, at least one is non-canonical) to NOR (neither is canonical, succeeds only if both are non-canonical).

Everything else looks reasonable, though, so I'll try and bundle up a next iteration with it, thanks!

EDIT: Hmmm... Actually, this can still work, we just have to return the result unconditionally and just flag whether or not it was canonical.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Also, the resulting assertNonCanonical is no longer bound to TopologicalSpace and belongs somewhere more general; suggestions?)

Comment thread Mathlib/Topology/Defs/Basic.lean Outdated
Comment thread Mathlib/Topology/Defs/Basic.lean Outdated
Comment thread Mathlib/Topology/Defs/Basic.lean Outdated
Comment thread Mathlib/Topology/Defs/Basic.lean Outdated
@grunweg grunweg changed the title feat (Topology) : implement delaborators for non-standard topology notation feat(Topology) : implement delaborators for non-standard topology notation Nov 19, 2025
Add tests for induced and coinduced properties in topology.
Updated ProofWidgets version to v0.0.80.
@github-actions github-actions bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 20, 2025
@github-actions github-actions bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 20, 2025
@robertmaxton42 robertmaxton42 removed the awaiting-author A reviewer has asked the author a question or requested changes. label Nov 20, 2025
@@ -0,0 +1,33 @@
import Mathlib.Topology.Order
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not Mathlib.Topology.Defs.Basic?

Copy link
Copy Markdown
Collaborator

@kckennylau kckennylau Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, it's because of the bug right (might be worth explaining this in a comment too)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Though actually, now that I think about it... while most topologies are hard to implement without importing a bunch of Set lemmas, the discrete topology probably is doable.

Also, I could just fill in the proofs with sorries. Do you think that's better or worse than a bigger export?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in general you can do whatever you want in tests, even using axioms.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What bug are we talking about?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

synthInstance and friends don't work properly in #check, #guard_target when used with opaque typeclass assumptions/variable definitions; we need an actual concrete type with an actual concrete canonical instance in order to make a linter that checks what we want, and it's actually kinda hard to make a TopologicalSpace instance without importing a whole bunch of the Set API anyway. At which point, we might as well just import Mathlib.Topology.Order, which among other things gives us the discrete topology on any type.

Comment thread MathlibTest/Delab/TopologicalSpace.lean Outdated
Copy link
Copy Markdown
Contributor

@j-loreaux j-loreaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eric-wieser is there anything else you want to happen here? I would like to get this across the line soon.

Comment thread MathlibTest/Delab/TopologicalSpace.lean Outdated
@j-loreaux j-loreaux added the awaiting-author A reviewer has asked the author a question or requested changes. label Mar 17, 2026
@robertmaxton42 robertmaxton42 removed the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 3, 2026
Comment thread Mathlib/Util/DelabNonCanonical.lean Outdated
@j-loreaux
Copy link
Copy Markdown
Contributor

maintainer merge

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

🚀 Pull request has been placed on the maintainer queue by j-loreaux.

@mathlib-triage mathlib-triage bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Apr 7, 2026
Comment thread Mathlib/Util/DelabNonCanonical.lean Outdated
@Vierkantor
Copy link
Copy Markdown
Contributor

bors d=@eric-wieser

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Apr 15, 2026

✌️ eric-wieser can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@mathlib-triage mathlib-triage bot added delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). t-topology Topological spaces, uniform spaces, metric spaces, filters

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants