mathlib4 review helperopen PRs by @themathqueen on leanprover-community/mathlib4

← queue

#42311 chore(Analysis/Convex/Extreme): semilinearize image_extremePoints

awaiting-author merge-conflict t-analysis CI success merge conflict

+50 −16 · 2 files · 5 commits · head 8a00c31 · updated 93 days ago · Files changed on GitHub

In plain words

Generalises "a linear equivalence maps extreme points to extreme points" (image_extremePoints) from linear to semilinear equivalences, and drops the ordered-ring / additive-group assumptions it carried. To do so it adds semilinear versions of "a linear map sends segments (closed and open) onto segments", where the ring homomorphism must preserve nonnegativity (resp. positivity). The old linear statements become one-line specialisations; the affine image_segment / image_openSegment only get shorter proofs.

Transcriptions are drafted with an LLM from the diff and are a reading aid, not a verified statement: the Lean code is the reference.

PR description

The semilinear cases need (hσ : ∀ a, 0 ≤ σ a ↔ 0 ≤ a) for the ring morphism σ, which I've added as an autoparam (by simp).


![Open in Gitpod](gitpod.io/from-referrer/)

Conversation on GitHub 2
github-actions[bot] · comment · 2026-07-31
PR summary 8a00c31293
Import changes for modified files

No significant changes to the import graph

<details><summary>Import changes for all files</summary>

|Files|Import difference| |-|-|

</details>


<details><summary>

Declarations diff (regex)

</summary>

+ linear_image_openSegment + linear_image_segment + semilinear_image_extremePoints + semilinear_image_openSegment + semilinear_image_segment <details> <summary>You can run this locally as follows</summary>

## 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>

</details>

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

</details>

Declarations diff (Lean)

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

  • +5 new declarations
  • −0 removed declarations
+linear_image_openSegment
+linear_image_segment
+semilinear_image_extremePoints
+semilinear_image_openSegment
+semilinear_image_segment

No changes to strong technical debt.

No changes to weak technical debt.

Current commit 8a00c31293 Reference commit f4570dc2f3

This script lives in the undefined 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).
mathlib-merge-conflicts[bot] · comment · 2026-09-03

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

Mathlib/Analysis/Convex/Extreme.lean +12 −9

theorem extremePoints_pi (s : ∀ i, Set (M i)) :
232end OrderedSemiring
lemma semilinear_image_extremePoints newL234–241
234lemma semilinear_image_extremePoints {L 𝕜' : Type*} [Semiring 𝕜] [PartialOrder 𝕜] [Semiring 𝕜']
themathqueen · 2026-07-31

maybe another name could be image_extremePointsₛₗ (same goes for the rest)

235 [PartialOrder 𝕜'] [AddCommMonoid E] [Module 𝕜 E] [AddCommMonoid F] [Module 𝕜' F]
236 {σ : 𝕜 →+* 𝕜'} {σ' : 𝕜' →+* 𝕜} [RingHomInvPair σ σ'] [RingHomInvPair σ' σ] [EquivLike L E F]
237 [SemilinearEquivClass L σ E F] (f : L) (s : Set E) (hσ : ∀ a : 𝕜, 0 < σ a ↔ 0 < a := by simp) :
238 f '' extremePoints 𝕜 s = extremePoints 𝕜' (f '' s) := by
239 ext b
240 obtain ⟨a, rfl⟩ := EquivLike.surjective f b
241 simp [mem_extremePoints, ← semilinear_image_openSegment f _ _ hσ]
243section OrderedRing
−variable {L : Type*} [Ring 𝕜] [PartialOrder 𝕜] [IsOrderedRing 𝕜]
− [AddCommGroup E] [Module 𝕜 E] [AddCommGroup F] [Module 𝕜 F]
244variable {L : Type*} [Semiring 𝕜] [PartialOrder 𝕜]
245 [AddCommMonoid E] [Module 𝕜 E] [AddCommMonoid F] [Module 𝕜 F]
246 [EquivLike L E F] [LinearEquivClass L 𝕜 E F]
lemma image_extremePoints changedL248–249
248lemma image_extremePoints (f : L) (s : Set E) :
− f '' extremePoints 𝕜 s = extremePoints 𝕜 (f '' s) := by
− ext b
− obtain ⟨a, rfl⟩ := EquivLike.surjective f b
− have : ∀ x y, f '' openSegment 𝕜 x y = openSegment 𝕜 (f x) (f y) :=
− image_openSegment _ (LinearMapClass.linearMap f).toAffineMap
− simp only [mem_extremePoints, (EquivLike.surjective f).forall,
− (EquivLike.injective f).mem_set_image, (EquivLike.injective f).eq_iff, ← this]
249 f '' extremePoints 𝕜 s = extremePoints 𝕜 (f '' s) := semilinear_image_extremePoints f s
251end OrderedRing

Mathlib/Analysis/Convex/Segment.lean +38 −7

theorem lineMap_mem_segment (a b : E) {t : 𝕜} (ht : t ∈ Icc 0 1) :
238 AffineMap.lineMap a b t ∈ [a -[𝕜] b] :=
239 segment_eq_image_lineMap 𝕜 a b ▸ mem_image_of_mem _ ht
241section
242variable {𝕜 𝕜' L E F G L' : Type*} [Semiring 𝕜] [PartialOrder 𝕜] [Semiring 𝕜'] [PartialOrder 𝕜']
243 [AddCommMonoid E] [AddCommMonoid F] [Module 𝕜 E] [Module 𝕜' F] [AddCommMonoid G] [Module 𝕜 G]
244 {σ : 𝕜 →+* 𝕜'} {σ' : 𝕜' →+* 𝕜} [FunLike L E F] [SemilinearMapClass L σ E F]
245 [FunLike L' E G] [LinearMapClass L' 𝕜 E G]
theorem semilinear_image_segment newL247–255
247theorem semilinear_image_segment [RingHomInvPair σ σ'] (f : L) (x y : E)
248 (hσ : ∀ a, 0 ≤ σ a ↔ 0 ≤ a := by simp) :
249 f '' [x -[𝕜] y] = [f x -[𝕜'] f y] := by
250 simp only [subset_antisymm_iff, segment_subset_iff, image_subset_iff, mem_image]
251 simp only [segment, preimage_ofPred_eq, mem_ofPred_eq, map_add, exists_and_left]
252 refine ⟨fun a b ha hb hab ↦ ⟨σ a, by simpa [hσ], σ b, ?_⟩, fun a b ha hb hab ↦ ?_⟩
253 · simpa [← map_add, ← map_smulₛₗ, hab, hσ]
254 · refine ⟨σ' a • x + σ' b • y, ⟨σ' a, by simpa [← hσ], σ' b, ?_⟩, by simp [map_smulₛₗ]⟩
255 simpa [← hσ, ← map_add, hab]
theorem semilinear_image_openSegment newL257–265
257theorem semilinear_image_openSegment [RingHomInvPair σ σ'] (f : L) (x y : E)
258 (hσ : ∀ a, 0 < σ a ↔ 0 < a := by simp) :
259 f '' openSegment 𝕜 x y = openSegment 𝕜' (f x) (f y) := by
260 simp only [subset_antisymm_iff, openSegment_subset_iff, image_subset_iff, mem_image]
261 simp only [openSegment, preimage_ofPred_eq, mem_ofPred_eq, map_add, exists_and_left]
262 refine ⟨fun a b ha hb hab ↦ ⟨σ a, by simpa [hσ], σ b, ?_⟩, fun a b ha hb hab ↦ ?_⟩
263 · simpa [← map_add, ← map_smulₛₗ, hab, hσ]
264 · refine ⟨σ' a • x + σ' b • y, ⟨σ' a, by simpa [← hσ], σ' b, ?_⟩, by simp [map_smulₛₗ]⟩
265 simpa [← hσ, ← map_add, hab]
theorem linear_image_segment newL267–268
267@[simp] theorem linear_image_segment (f : L') (a b : E) :
268 f '' [a -[𝕜] b] = [f a -[𝕜] f b] := semilinear_image_segment _ _ _
theorem linear_image_openSegment newL270–271
270@[simp] theorem linear_image_openSegment (f : L') (a b : E) :
271 f '' openSegment 𝕜 a b = openSegment 𝕜 (f a) (f b) := semilinear_image_openSegment _ _ _
273end
theorem image_segment changedL275–277
275@[simp]
−theorem image_segment (f : E →ᵃ[𝕜] F) (a b : E) : f '' [a -[𝕜] b] = [f a -[𝕜] f b] :=
− Set.ext fun x => by
− simp_rw [segment_eq_image_lineMap, mem_image, exists_exists_and_eq_and, AffineMap.apply_lineMap]
276theorem image_segment (f : E →ᵃ[𝕜] F) (a b : E) : f '' [a -[𝕜] b] = [f a -[𝕜] f b] := by
277 simp [segment_eq_image_lineMap, image_image]
theorem image_openSegment changedL279–282
279@[simp]
280theorem image_openSegment (f : E →ᵃ[𝕜] F) (a b : E) :
− f '' openSegment 𝕜 a b = openSegment 𝕜 (f a) (f b) :=
− Set.ext fun x => by
− simp_rw [openSegment_eq_image_lineMap, mem_image, exists_exists_and_eq_and,
− AffineMap.apply_lineMap]
281 f '' openSegment 𝕜 a b = openSegment 𝕜 (f a) (f b) := by
282 simp [openSegment_eq_image_lineMap, image_image]
284@[simp]
285theorem vadd_segment [AddTorsor G E] [VAddCommClass G E E] (a : G) (b c : E) :
0/8 declarations checked

Your review, as Markdown

Paste it as a comment or a review on the PR. Line links to the head commit unfold into code snippets on GitHub.