Skip to content

[Merged by Bors] - refactor(AlgebraicTopology): redefine the topological simplex using the convexity API - #28893

Closed
joelriou wants to merge 883 commits into
leanprover-community:masterfrom
joelriou:refactor-topological-simplex2
Closed

joelriou wants to merge 883 commits into
leanprover-community:masterfrom
joelriou:refactor-topological-simplex2

Conversation

@joelriou

@joelriou joelriou commented Aug 25, 2025 •

Copy link
Copy Markdown
Contributor

Before this PR, the n-dimensional topological simplex (in the AlgebraicTopology hierarchy) was defined as a subtype of Fin (n + 1) → ℝ≥0, which did not interact well with the convexity API which assumes the ambient type is a vector space. In this PR, we redefine the topological simplex functor (as a cosimplicial object in TopCat) using the already existing stdSimplex from Analysis.Convex.


Open in Gitpod

@github-actions github-actions Bot added the large-import Automatically added label for PRs with a significant increase in transitive imports label Aug 25, 2025
@github-actions

github-actions Bot commented Aug 25, 2025 •

Copy link
Copy Markdown

PR summary c55dac52f6

Import changes exceeding 2%

% File
+11.59% Mathlib.AlgebraicTopology.SingularSet
+13.11% Mathlib.AlgebraicTopology.TopologicalSimplex

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.AlgebraicTopology.TopologicalSimplex 1335 1510 +175 (+13.11%)
Mathlib.AlgebraicTopology.SingularSet 1381 1541 +160 (+11.59%)
Mathlib.Analysis.Convex.StdSimplex 1363 1370 +7 (+0.51%)
Import changes for all files
Files Import difference
6 files Mathlib.Analysis.Calculus.TangentCone Mathlib.Analysis.Convex.Gauge Mathlib.Analysis.Convex.StdSimplex Mathlib.Analysis.Convex.Topology Mathlib.Analysis.RCLike.TangentCone Mathlib.Topology.Algebra.AsymptoticCone
7
Mathlib.AlgebraicTopology.SingularHomology.Basic 145
Mathlib.AlgebraicTopology.SingularSet 160
Mathlib.AlgebraicTopology.TopologicalSimplex 175

Declarations diff

+ add_eq_one
+ concreteCategoryHom_id
+ eq_one_of_unique
+ instance (n : SimplexCategory) : Nonempty (toTop.{u}.obj n) := inferInstanceAs (Nonempty (ULift _))
+ instance (n : SimplexCategory) : Nonempty (toTop₀.obj n) := by dsimp; infer_instance
+ instance (n : SimplexCategory) : PathConnectedSpace (toTop.{u}.obj n)
+ instance (n : SimplexCategory) : PathConnectedSpace (toTop₀.obj n) := by dsimp; infer_instance
+ instance : Unique (toTop.{u}.obj ⦋0⦌) := inferInstanceAs (Unique (ULift _))
+ instance : Unique (toTop₀.obj ⦋0⦌) := inferInstanceAs (Unique (stdSimplex ℝ (Fin 1)))
+ instance [Nonempty X] : Nonempty (stdSimplex S X) := by
+ instance [Nonempty ι] : PathConnectedSpace (stdSimplex ℝ ι)
+ instance [Nontrivial S] [Nontrivial X] : Nontrivial (stdSimplex S X)
+ instance [Subsingleton X] : Subsingleton (stdSimplex S X)
+ instance [Unique X] : Unique (stdSimplex S X)
+ isPathConnected_stdSimplex
+ vertex_injective
- instance (x : SimplexCategory) : CoeFun x.toTopObj fun _ => ToType x → ℝ≥0
- instance (x : SimplexCategory) : Nonempty x.toTopObj
- instance (x : SimplexCategory) : PathConnectedSpace x.toTopObj := by
- instance : Unique ⦋0⦌.toTopObj

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

@joelriou joelriou added the t-algebraic-topology Algebraic topology label Aug 25, 2025
@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Aug 25, 2025
@mathlib4-merge-conflict-bot mathlib4-merge-conflict-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 Aug 29, 2025
@mathlib4-merge-conflict-bot

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@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 Aug 30, 2025
@joelriou joelriou added the t-convex-geometry Affine geometry, cones, simplices label Aug 30, 2025
urkud and others added 20 commits October 2, 2025 14:22
…et'` (leanprover-community#29793)

`mem_closure_iff_of_fintype` is a corollary of `mem_closure_range_iff_of_fintype`, when we have a `s : Set M` with a `Fintype s` instance on it. `mem_closure_finset'` is a special case of `mem_closure_iff_of_fintype` when we have a `Finset`.

Also add `mem_span_iff_of_fintype` for `Submodule`.

Thanks for the [discussion in Zulip](https://leanprover.zulipchat.com/#narrow/channel/217875-Is-there-code-for-X.3F/topic/.60Finset.2Euniv_eq_attach.60.20for.20.60Set.2EtoFinset.60).
…, a, b]` (leanprover-community#29344)

This PR changes the side condition used in theorems about `Sphere.power` to be `p ∈ line[ℝ, a, b]`. This is symmetric in `a` and `b`, and more general than the current condition.

TODO (in this PR?): add some basic lemmas about `p ∈ line[ℝ, a, b]`.

TODO (in another PR): prove the power theorems about `Sphere.secondInter`, which is more general in the sense that it also includes the case where `a` and `b` coincide, and then `p` is on the tangent line.
…r-community#29804)

This PR adjusts the definition of the weight k slash action on modular forms to include an absolute-value sign, which makes some formulae slightly nicer later on.

It also removes some junk accidentally left in the definition of a `SlashAction`. The definition originally required it to have some linearity property, which was removed in a PR several months ago; but the constructor still takes a useless extra type argument `γ` (originally, the ring that the action is linear over) which should have been removed in that PR but wasn't.
leanprover-community#29782)

`ring` handles ℕ-scalar multiplication; it seems like an accidental omission that it doesn't handle ℤ-scalar multiplication. This PR adds that feature. Everything is directly adapted from the ℕ case.

A notable use case for this feature: often `abel_nf` output contains ℤ-scalar multiplication, so it's important that this can be handled if needed in subsequent `ring` calls.
…ean` (leanprover-community#29811)

The file `Grp/Injective.lean` contained an injectivity result for `AddCircle`, but this is immediately derived from existing instances. It used to have a much more complex proof. Since `AddCircle` brings with it a whole bunch of analysis and topology imports that we don't need for this algebraic theory, this saves us a couple hundred transitive imports.

Also, clean up the module docs to reflect the current situation.

I have moved the instance to a test file, to ensure it remains accessible even after future refactors.

This import was spotted in the same PR run as leanprover-community#29808, but does not change the top-level directory import structure in the same way.

Co-authored-by: Anne C.A. Baanen <[email protected]>
Note that `grind` often will not instantiate equational lemmas that are not fully applied, so we need to split some theorems into versions for `simp` and versions for `grind`.

Moves:
- sup_eq_union -> sup_eq_union'
- inf_eq_inter -> inf_eq_inter'
We define restricted power series over a normed ring R, and show they form a ring when R has the ultrametric property
<NEWLINE>
This is an update of [leanprover-community#23338](leanprover-community#23338) to meet new expectations of PRs from forks.

Co-authored-by: Riccardo Brasca <[email protected]>
Golf a lemma from the proof of the Jordan-von Neumann theorem (parallelogram law characterization for Hilbert spaces).
…munity#29859)

Cherry-picked from leanprover-community#24163.
It is useful for the proof of `tangentConeAt_closure`
for the pending new definition of `tangentConeAt`.
…ups (leanprover-community#29869)

Since the continuous linear maps are defined for topological vector spaces, we can generalize `ContinuousLinearMap.extend` so that the dense subspace is not a normed space anymore.
…of_lt'` (leanprover-community#27257)

I only need `lineMap_le_lineMap_iff_of_lt'`. The other lemmas are added for completeness.
This is a compilation of (1) some observations by @PatrickMassot and (2) some lemmas written by @AntoineChambert-Loir and I for a specific application, which turned out to have a nice proof using (1). The most interesting results are:
- `isClosedMap_iff_kernImage`: a map is closed iff the [Set.kernImage](https://leanprover-community.github.io/mathlib4_docs/Mathlib/Data/Set/Operations.html#Set.kernImage) of any ***open set*** is open (+ similar result for open maps)
- `isClosedMap_iff_comap_nhds_le`: as a consequence, the map `f` is closed iff for any `y`, one has `comap f (𝓝 y) ≤ 𝓝ˢ (f ⁻¹' {y})` (with equality if `f` is also continuous)
- `IsClosedMap.eventually_nhds_fiber` is a restatement of this in `eventually` terms: assuming `f` is closed, if some property holds in the neighborhood of the fiber at `y₀`, then it holds on the fiber at `y` for all `y` close enough to `y₀`.

Co-authored-by: Antoine Chambert-Loir <[email protected]>
Co-authored-by: Patrick Massot <[email protected]>
…in an extension (leanprover-community#27105)

This PR just puts together all the results that were already there to deduce:
```lean
 map (algebraMap S R) p = ∏ P ∈ p.primesOver R, P ^ p.ramificationIdx (algebraMap S R) P
```
for `p` a maximal ideal of a ring `S` and `R` an extension of `S` that is a Dedekind ring. 

Note. There is a significant import increase in the file `RingTheory.DedekindDomain.Factorization`. However, this file is almost a leaf file so this increase only affects a limited number of files. If the increase is too big, a new file, say `RingTheory.DedekindDomain.PrimeSplitting`, can be added instead.
mathlib-bors Bot pushed a commit that referenced this pull request Oct 4, 2025
When `f : X → Y` is a map between finite types, and `S` is an ordered semiring, we define the maps `stdSimplex.map f : stdSimplex S X → stdSimplex S Y`. In the case `S := ℝ`, we show that these maps are continuous. In a future PR #28893, the definition of the topological simplex in `AlgebraicTopology` shall be refactored.
@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Oct 4, 2025
@mathlib4-dependent-issues-bot

Copy link
Copy Markdown

@mathlib4-merge-conflict-bot mathlib4-merge-conflict-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 Oct 4, 2025
@mathlib4-merge-conflict-bot

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@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 Oct 4, 2025
mitchell-horner pushed a commit to mitchell-horner/mathlib4 that referenced this pull request Oct 6, 2025
…ver-community#28891)

When `f : X → Y` is a map between finite types, and `S` is an ordered semiring, we define the maps `stdSimplex.map f : stdSimplex S X → stdSimplex S Y`. In the case `S := ℝ`, we show that these maps are continuous. In a future PR leanprover-community#28893, the definition of the topological simplex in `AlgebraicTopology` shall be refactored.
@robin-carlier

Copy link
Copy Markdown
Contributor

thanks! Looks good to me and clearly an improvement of the API. Proofs and usage of the defs look fine but since I’m not super familiar with the convex part of the library, a quick second look would be appreciated.

maintainer merge?

@github-actions

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by robin-carlier.

@ghost ghost added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Oct 11, 2025
Jlh18 pushed a commit to Jlh18/mathlib4 that referenced this pull request Oct 14, 2025
…ver-community#28891)

When `f : X → Y` is a map between finite types, and `S` is an ordered semiring, we define the maps `stdSimplex.map f : stdSimplex S X → stdSimplex S Y`. In the case `S := ℝ`, we show that these maps are continuous. In a future PR leanprover-community#28893, the definition of the topological simplex in `AlgebraicTopology` shall be refactored.
@sgouezel

Copy link
Copy Markdown
Contributor

bors d+

@mathlib-bors

mathlib-bors Bot commented Oct 28, 2025

Copy link
Copy Markdown
Contributor

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

@ghost ghost 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 Oct 28, 2025
@joelriou

Copy link
Copy Markdown
Contributor Author

Thanks!

bors merge

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Oct 28, 2025
mathlib-bors Bot pushed a commit that referenced this pull request Oct 28, 2025
…he convexity API (#28893)

Before this PR, the n-dimensional topological simplex (in the `AlgebraicTopology` hierarchy) was defined as a subtype of `Fin (n + 1) → ℝ≥0`, which did not interact well with the convexity API which assumes the ambient type is a vector space. In this PR, we redefine the topological simplex functor (as a cosimplicial object in `TopCat`) using the already existing `stdSimplex` from `Analysis.Convex`.

Co-authored-by: Stefan Kebekus <[email protected]>
Co-authored-by: Robin Carlier <[email protected]>
Co-authored-by: Weiyi Wang <[email protected]>
Co-authored-by: Sebastien Gouezel <[email protected]>
Co-authored-by: Xavier Roblot <[email protected]>
Co-authored-by: Salvatore Mercuri <[email protected]>
Co-authored-by: Junyan Xu <[email protected]>
Co-authored-by: Jeremy Tan Jie Rui <[email protected]>
Co-authored-by: Bryan Gin-ge Chen <[email protected]>
Co-authored-by: Bolton Bailey <[email protected]>
Co-authored-by: Violeta Hernández <[email protected]>
Co-authored-by: staroperator <[email protected]>
Co-authored-by: Rémy Degenne <[email protected]>
Co-authored-by: grunweg <[email protected]>
Co-authored-by: Ben Eltschig <[email protected]>
Co-authored-by: Yury Kudryashov <[email protected]>
Co-authored-by: Christian Merten <[email protected]>
Co-authored-by: euprunin <[email protected]>
Co-authored-by: Michael Rothgang <[email protected]>
Co-authored-by: Chris Birkbeck <[email protected]>
Co-authored-by: Hannah Scholz <[email protected]>
Co-authored-by: Lawrence Wu <[email protected]>
Co-authored-by: Yizheng Zhu <[email protected]>
@mathlib-bors

mathlib-bors Bot commented Oct 28, 2025

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title refactor(AlgebraicTopology): redefine the topological simplex using the convexity API [Merged by Bors] - refactor(AlgebraicTopology): redefine the topological simplex using the convexity API Oct 28, 2025
@mathlib-bors mathlib-bors Bot closed this Oct 28, 2025
BeibeiX0 pushed a commit to BeibeiX0/mathlib4 that referenced this pull request Nov 7, 2025
…ver-community#28891)

When `f : X → Y` is a map between finite types, and `S` is an ordered semiring, we define the maps `stdSimplex.map f : stdSimplex S X → stdSimplex S Y`. In the case `S := ℝ`, we show that these maps are continuous. In a future PR leanprover-community#28893, the definition of the topological simplex in `AlgebraicTopology` shall be refactored.
BeibeiX0 pushed a commit to BeibeiX0/mathlib4 that referenced this pull request Nov 7, 2025
…he convexity API (leanprover-community#28893)

Before this PR, the n-dimensional topological simplex (in the `AlgebraicTopology` hierarchy) was defined as a subtype of `Fin (n + 1) → ℝ≥0`, which did not interact well with the convexity API which assumes the ambient type is a vector space. In this PR, we redefine the topological simplex functor (as a cosimplicial object in `TopCat`) using the already existing `stdSimplex` from `Analysis.Convex`.

Co-authored-by: Stefan Kebekus <[email protected]>
Co-authored-by: Robin Carlier <[email protected]>
Co-authored-by: Weiyi Wang <[email protected]>
Co-authored-by: Sebastien Gouezel <[email protected]>
Co-authored-by: Xavier Roblot <[email protected]>
Co-authored-by: Salvatore Mercuri <[email protected]>
Co-authored-by: Junyan Xu <[email protected]>
Co-authored-by: Jeremy Tan Jie Rui <[email protected]>
Co-authored-by: Bryan Gin-ge Chen <[email protected]>
Co-authored-by: Bolton Bailey <[email protected]>
Co-authored-by: Violeta Hernández <[email protected]>
Co-authored-by: staroperator <[email protected]>
Co-authored-by: Rémy Degenne <[email protected]>
Co-authored-by: grunweg <[email protected]>
Co-authored-by: Ben Eltschig <[email protected]>
Co-authored-by: Yury Kudryashov <[email protected]>
Co-authored-by: Christian Merten <[email protected]>
Co-authored-by: euprunin <[email protected]>
Co-authored-by: Michael Rothgang <[email protected]>
Co-authored-by: Chris Birkbeck <[email protected]>
Co-authored-by: Hannah Scholz <[email protected]>
Co-authored-by: Lawrence Wu <[email protected]>
Co-authored-by: Yizheng Zhu <[email protected]>
mathlib-bors Bot pushed a commit that referenced this pull request Sep 2, 2026
…StdSimplex` instead of `stdSimplex` (#42181)

Before #28893, the topological simplex (used for the definition of singular homology) was defined as a subtype of `Fin (n + 1) → ℝ≥0` which did not interact well with the convexity API which at the time required working with subtypes of vector spaces. Since #28893, we relied on `stdSimplex` which was a subtype of `Fin (n + 1) → ℝ` in order to use the convexity API. Since #31984, the convexity API allows to work with convex spaces not necessarily embedded in vector spaces and we have the new definition of `StdSimplex`, on which a topology was set up in #42131. This PR deprecates `stdSimplex` in favour of `StdSimplex`.
joelriou added a commit to joelriou/mathlib4 that referenced this pull request Sep 5, 2026
…StdSimplex` instead of `stdSimplex` (leanprover-community#42181)

Before leanprover-community#28893, the topological simplex (used for the definition of singular homology) was defined as a subtype of `Fin (n + 1) → ℝ≥0` which did not interact well with the convexity API which at the time required working with subtypes of vector spaces. Since leanprover-community#28893, we relied on `stdSimplex` which was a subtype of `Fin (n + 1) → ℝ` in order to use the convexity API. Since leanprover-community#31984, the convexity API allows to work with convex spaces not necessarily embedded in vector spaces and we have the new definition of `StdSimplex`, on which a topology was set up in leanprover-community#42131. This PR deprecates `stdSimplex` in favour of `StdSimplex`.
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). large-import Automatically added label for PRs with a significant increase in transitive imports ready-to-merge This PR has been sent to bors. t-algebraic-topology Algebraic topology t-convex-geometry Affine geometry, cones, simplices

Projects

None yet

Development

Successfully merging this pull request may close these issues.