Skip to content

feat(Analysis): StdSimplex is a MetricSpace - #40176

Closed
YaelDillies wants to merge 2 commits into
leanprover-community:masterfrom
YaelDillies:std_simplex_metric_space
Closed

YaelDillies wants to merge 2 commits into
leanprover-community:masterfrom
YaelDillies:std_simplex_metric_space

Conversation

@YaelDillies

@YaelDillies YaelDillies commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Endow the standard simplex over a metric space with the L^1 metric.


Open in Gitpod

@YaelDillies YaelDillies added WIP Work in progress t-analysis Analysis (normed *, calculus) labels Jun 3, 2026
@github-actions

github-actions Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

PR summary 9c3916f568

Import changes exceeding 2%

% File
+19.27% Mathlib.Analysis.Convex.MetricSpace

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Analysis.Convex.MetricSpace 1552 1851 +299 (+19.27%)
Import changes for all files
Files Import difference
Mathlib.Analysis.Convex.MetricSpace 299

Declarations diff (regex)

+ dist_def
+ edist_def
+ instMetricSpace
+ instPseudoMetricSpace
+ instance [MetricSpace R] : MetricSpace (StdSimplex R I)
+ instance [PseudoMetricSpace R] : PseudoMetricSpace (StdSimplex R I)
+ nndist_def
+ nndist_induced
+ weights_injective
++ instEMetricSpace
++ instPseudoEMetricSpace
- instance [EMetricSpace X] : EMetricSpace (WithLp p <| ι →₀ X)
- instance [MetricSpace X] : MetricSpace (WithLp p <| ι →₀ X)
- instance [PseudoEMetricSpace X] : PseudoEMetricSpace (WithLp p <| ι →₀ X)
- instance [PseudoMetricSpace X] : PseudoMetricSpace (WithLp p <| ι →₀ X)

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

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

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 9c3916f).

  • +13 new declarations
  • −4 removed declarations
+Convexity.StdSimplex.dist_def
+Convexity.StdSimplex.edist_def
+Convexity.StdSimplex.instEMetricSpace
+Convexity.StdSimplex.instMetricSpace
+Convexity.StdSimplex.instPseudoEMetricSpace
+Convexity.StdSimplex.instPseudoMetricSpace
+Convexity.StdSimplex.nndist_def
+Convexity.StdSimplex.weights_injective
+Finsupp.instEMetricSpace
-Finsupp.instEMetricSpaceWithLpOfNNReal
+Finsupp.instMetricSpace
-Finsupp.instMetricSpaceWithLpOfNNReal
+Finsupp.instPseudoEMetricSpace
-Finsupp.instPseudoEMetricSpaceWithLpOfNNReal
+Finsupp.instPseudoMetricSpace
-Finsupp.instPseudoMetricSpaceWithLpOfNNReal
+nndist_induced

No changes to strong technical debt.

No changes to weak technical debt.

Current commit 9c3916f568
Reference commit 0f320b07b2

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.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).

@YaelDillies
YaelDillies force-pushed the std_simplex_metric_space branch from 9c51b4c to d2d9164 Compare June 4, 2026 07:49
@YaelDillies YaelDillies added blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) and removed WIP Work in progress labels Jun 4, 2026
@YaelDillies
YaelDillies temporarily deployed to cache-upload-forks June 4, 2026 08:20 — with GitHub Actions Inactive
@YaelDillies
YaelDillies force-pushed the std_simplex_metric_space branch from d2d9164 to e5840ab Compare June 4, 2026 08:51
@YaelDillies
YaelDillies temporarily deployed to cache-upload-forks June 4, 2026 09:12 — with GitHub Actions Inactive
@mathlib-dependent-issues mathlib-dependent-issues Bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Jun 27, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

@YaelDillies
YaelDillies force-pushed the std_simplex_metric_space branch from e5840ab to 9c3916f Compare June 27, 2026 14:31
@github-actions github-actions Bot added the large-import Automatically added label for PRs with a significant increase in transitive imports label Jun 27, 2026

@j-loreaux j-loreaux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It could be nice to add some characterization of the dist for a few special cases, e.g., dist (single x) (single y) = if x = y then 0 else 2.

Comment on lines +295 to +298
noncomputable instance instPseudoEMetricSpace [PseudoEMetricSpace R] :
PseudoEMetricSpace (StdSimplex R I) :=
.induced (WithLp.toLp (1 : ℝ≥0) ∘ weights) <|
have : Fact ((1 : ℝ≥0) ≤ 1) := ⟨le_rfl⟩; inferInstance

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Somewhere (at least in the PR description and the module documentation, but probably also on this instance itself), there should be a discussion of both what metric is the one equipped for StdSimplex and also why it is the one we should prefer. Surely, this one is natural, but it's worth the documentation.

@j-loreaux j-loreaux added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Jul 17, 2026
@YaelDillies

Copy link
Copy Markdown
Contributor Author

Since Joël is working on barycentric subdivision and this was my only application for this PR, I will close it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. large-import Automatically added label for PRs with a significant increase in transitive imports t-analysis Analysis (normed *, calculus)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants