Repository navigation
Conversation
PR summary c3ca893bb5Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
| Current number | Change | Type (weak) |
|---|---|---|
| exposed public sections | 5074 | 1 |
Current commit c3ca893bb5
Reference commit fd634dd297
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).
|
This pull request has conflicts, please merge |
774f433 to
58c0f07
Compare
6f2f6d2 to
b74fc24
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a formal definition of simplex volume in Euclidean geometry and proves it agrees with the appropriate measure-theoretic volume; also introduces supporting lemmas about simplex closed interiors and affine subspace shifts.
Changes:
- Add
Affine.Simplex.volumeand prove it matches Euclidean Hausdorff / Lebesgue volume ofclosedInterior. - Add lemmas relating barycentric coordinates to
AffineSubspace.shiftand derive simplex cross-section/intersection results. - Add a convenience lemma
nonempty_closedInteriorand wire new volume modules intoMathlib.lean.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| Mathlib/LinearAlgebra/AffineSpace/Simplex/Basic.lean | Adds nonempty_closedInterior for simplices. |
| Mathlib/LinearAlgebra/AffineSpace/AffineSubspace/Shift.lean | Adds shift/barycentric coordinate lemmas and simplex cross-section results; changes imports. |
| Mathlib/Geometry/Euclidean/Volume/MeasureSimplex.lean | New file proving Simplex.volume equals measure-theoretic volume of closedInterior. |
| Mathlib/Geometry/Euclidean/Volume/Def.lean | New file defining Affine.Simplex.volume. |
| Mathlib/Geometry/Euclidean/Volume/Basic.lean | New file adding derived volume lemmas (volume_eq, invariances, positivity, positivity extension). |
| Mathlib.lean | Exposes new volume modules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1bdefb3 to
6b48fc3
Compare
3efd5d5 to
0a53dcc
Compare
…36018) This shows that the intersection of `AffineSubspace.shift` of the base of a simplex and the interior of the simplex is a smaller simplex. This is preparing to calculate the volume of a simplex by integrating this cross-section. Part of #37910. Co-authored-by: Junyan Xu <[email protected]>
0a53dcc to
d23ab7b
Compare
d23ab7b to
9cc4c89
Compare
… of the simplex (leanprover-community#43054) Extracted from leanprover-community#37910. This sets up affine geometry lemma for calculating the volume. The leaf lemma in this PR is `Affine.Simplex.closedInterior_inter_affineSubspaceMk'_lineMap_altitudeFoot`, which says that {cross section parallel to the base} and {cross section perpendicular to the altitude} is the same
bjbraams
left a comment
There was a problem hiding this comment.
This PR #37910 is a valuable contribution to Mathlib and I strongly support its adoption. Pending adoption I am already relying on one of the key theorems of the PR: the euclideanHausdorffMeasure_eq_lintegral. (This is in a project that involves measures on the standard simplex; see the code https://github.com/bjbraams/lean-codes/blob/main/StdSimplexMeasure/EuclideanCrossSection.lean.) I could use the code from #37910 without any change.
CoolRmal
left a comment
There was a problem hiding this comment.
I think it makes sense to add the following lemmas to finishEuclideanGeometry.euclideanHausdorffMeasure_eq_lintegral_of_subset.
/-- Two affine subspaces constructed from points and the same direction are equal if and only if
the difference of the points lies in that direction. -/
theorem mk'_eq_mk'_iff {p q : P} {s : Submodule k V} :
mk' p s = mk' q s ↔ p -ᵥ q ∈ s := sorry
lemma comap_mk' (f : P₁ →ᵃ[k] P₂) (p : P₁) (s : Submodule k V₂) :
(mk' (f p) s).comap f = mk' p (s.comap f.linear) := by
aesop
/-- The preimage of `mk' p K` under the inclusion of an affine subspace `s`, for a submodule `K`
containing `s.directionᗮ`, is `mk'` of the orthogonal projection of `p` and the preimage of `K`. -/
theorem comap_subtype_mk' (s : AffineSubspace 𝕜 P) [Nonempty s]
[s.direction.HasOrthogonalProjection] (p : P) {K : Submodule 𝕜 V} (hK : s.directionᗮ ≤ K) :
comap s.subtype (mk' p K) = mk' (orthogonalProjection s p) (K.comap s.direction.subtype) := sorry
/-- The orthogonal projection of `w +ᵥ p`, for `w` in the direction of the subspace, is `w +ᵥ` the
orthogonal projection of `p`. -/
theorem orthogonalProjection_vadd (s : AffineSubspace 𝕜 P) [Nonempty s]
[s.direction.HasOrthogonalProjection] (w : s.direction) (p : P) :
orthogonalProjection s ((w : V) +ᵥ p) = w +ᵥ orthogonalProjection s p := sorry
I think they can then be used to give a better proof of euclideanHausdorffMeasure_eq_lintegral_of_subset. The theorem is proved by pulling t ⊆ s back to s along the inclusion and applying the ambient-space formula euclideanHausdorffMeasure_eq_lintegral inside s, with base point orthogonalProjection s p and direction vector ⟨v, hvs⟩. The integrand this produces is the measure of t ∩ H' where H' is a hyperplane in s, while the target integrand uses the hyperplane H = mk' (x • v +ᵥ p) (ℝ ∙ v)ᗮ of the ambient space. So the whole proof reduces to one geometric identity: H' = comap s.subtype H, i.e. H meets s exactly in H'.
comap_subtype_mk' applies with K = (ℝ ∙ v)ᗮ, whose hypothesis s.directionᗮ ≤ (ℝ ∙ v)ᗮ follows from v ∈ s.direction by Submodule.orthogonal_le. This turns comap s.subtype H into an mk' in s.
theorem EuclideanGeometry.euclideanHausdorffMeasure_eq_lintegral_of_subset (p : P) {v : V}
(hv : v ≠ 0) {t : Set P} (ht : MeasurableSet t) {s : AffineSubspace ℝ P} (hvs : v ∈ s.direction)
(hts : t ⊆ s) [FiniteDimensional ℝ s.direction] :
μHE[finrank ℝ s.direction] t = ‖v‖ₑ * ∫⁻ (x : ℝ),
μHE[finrank ℝ s.direction - 1] (t ∩ mk' (x • v +ᵥ p) (ℝ ∙ v)ᗮ) := by
have : Nonempty s := (s.nonempty_iff_ne_bot.mpr fun h ↦ hv (by simpa [h] using hvs)).to_subtype
let v' : s.direction := ⟨v, hvs⟩
rw [← s.euclideanHausdorffMeasure_preimage_coe_of_subset _ hts,
euclideanHausdorffMeasure_eq_lintegral (orthogonalProjection s p)
(show v' ≠ 0 by simpa [v'] using hv) (ht.preimage measurable_subtype_coe)]
congr 1
refine lintegral_congr fun x ↦ ?_
suffices mk' (x • v' +ᵥ orthogonalProjection s p) (ℝ ∙ v')ᗮ
= comap s.subtype (mk' (x • v +ᵥ p) (ℝ ∙ v)ᗮ) from by
simp [this, ← Set.preimage_inter,
s.euclideanHausdorffMeasure_preimage_coe_of_subset _ (Set.inter_subset_left.trans hts)]
rw [comap_subtype_mk' s _
(Submodule.orthogonal_le ((Submodule.span_singleton_le_iff_mem _ _).mpr hvs))]
congr 1
· exact (orthogonalProjection_vadd s (x • v') p).symm
· ext w
simp [Submodule.mem_orthogonal_singleton_iff_inner_right, v']
|
Thanks for the suggestions! I have applied them |
|
maintainer merge |
|
🚀 Pull request has been placed on the maintainer queue by CoolRmal. |
Co-authored-by: Yongxi (Aaron) Lin <[email protected]>
| s.isClosed_closedInterior.measurableSet | ||
|
|
||
| /-- The volume of the cross-section is scaled from the base because of homothety -/ | ||
| private theorem measure_cross_section (s : Simplex ℝ P (n + 1)) (i : Fin (n + 2)) : |
There was a problem hiding this comment.
Do these cross sections show up elsewhere? Should there be a dedicated definition, and should the result be public instead of private?
There was a problem hiding this comment.
I can turn this theorem public (originally a lot of things in this PR were private and this one is more like a left over). As for a new definition, I think a proper definition, if we want one, should promote this cross section object to an Affine.Simplex. I am not very motivated to write another set of API at the moment... how about I leave a TODO note here in the code comment?
There was a problem hiding this comment.
I have updated the doc & theorem visibility. Let me know what you think. If there is a push for a new definition, I can do it in the following days
-awaiting-author
There was a problem hiding this comment.
Oh, and if the new definition is needed, maybe we can slice off other parts from the PR and merge those first? The following files are unaffecrted
- Mathlib/Geometry/Euclidean/Projection.lean
- Mathlib/Geometry/Euclidean/Volume/Measure.lean
- Mathlib/LinearAlgebra/AffineSpace/AffineSubspace/Basic.lean
- Mathlib/LinearAlgebra/AffineSpace/AffineSubspace/Defs.lean
Not sure if the slice bot support multiple files. If not, I can manually make one
There was a problem hiding this comment.
@wwylele Thanks for the updates! This looks good to me now. If cross sections are added later, then we can refactor.
Thanks again 🎉
bors merge
|
-awaiting-author |
|
I find it very strange the level of difficulty this PR has in getting merged. Is everything okay ?? Like it's a bit bizarre to me this is happening , as valuable as my exiled opinion is to you all..lovely people. |
This defines the volume of a simplex in Euclidean geometry, and shows that it agrees with measure theory. It also adds the basic set of lemmas (base-and-height formula, reindex, positivity, map, and restrict). Further properties of the volume will be in future PRs. Three new file s are introduced and organized in the following dependency chain: Def.lean -> MeasureSimplex.Lean -> Basic.lean The Def.lean file has the definition only. MeasureSimplex.lean pulls in measure theory. Basic.lean publicly imports Def.lean, and privately imports MeasureSimplex.lean. When a downstream file imports Basic.lean, the measure theory part is not exposed and all properties of the volume is provided.
|
Pull request successfully merged into master. Build succeeded: |
…7910) This defines the volume of a simplex in Euclidean geometry, and shows that it agrees with measure theory. It also adds the basic set of lemmas (base-and-height formula, reindex, positivity, map, and restrict). Further properties of the volume will be in future PRs. Three new file s are introduced and organized in the following dependency chain: Def.lean -> MeasureSimplex.Lean -> Basic.lean The Def.lean file has the definition only. MeasureSimplex.lean pulls in measure theory. Basic.lean publicly imports Def.lean, and privately imports MeasureSimplex.lean. When a downstream file imports Basic.lean, the measure theory part is not exposed and all properties of the volume is provided.
This defines the volume of a simplex in Euclidean geometry, and shows that it agrees with measure theory. It also adds the basic set of lemmas (base-and-height formula, reindex, positivity, map, and restrict). Further properties of the volume will be in future PRs.
Three new file s are introduced and organized in the following dependency chain:
Def.lean -> MeasureSimplex.Lean -> Basic.lean
The Def.lean file has the definition only. MeasureSimplex.lean pulls in measure theory. Basic.lean publicly imports Def.lean, and privately imports MeasureSimplex.lean. When a downstream file imports Basic.lean, the measure theory part is not exposed and all properties of the volume is provided.