Skip to content

Commit d723d48

Browse files
committed
feat: basic lemmas about convexity over NNReal (#31887)
1 parent 4e3dee5 commit d723d48

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,7 @@ public import Mathlib.Analysis.Convex.KreinMilman
17071707
public import Mathlib.Analysis.Convex.LinearIsometry
17081708
public import Mathlib.Analysis.Convex.Measure
17091709
public import Mathlib.Analysis.Convex.Mul
1710+
public import Mathlib.Analysis.Convex.NNReal
17101711
public import Mathlib.Analysis.Convex.PartitionOfUnity
17111712
public import Mathlib.Analysis.Convex.PathConnected
17121713
public import Mathlib.Analysis.Convex.Piecewise
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/-
2+
Copyright (c) 2025 Anatole Dedecker. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Anatole Dedecker
5+
-/
6+
module
7+
8+
public import Mathlib.Analysis.Convex.Basic
9+
public import Mathlib.Data.NNReal.Basic
10+
11+
/-!
12+
# Specific lemmas about convexity over `ℝ≥0`
13+
14+
This file collects some specific results about convexity over the ring `ℝ≥0`.
15+
Expand as needed.
16+
-/
17+
18+
@[expose] public section
19+
20+
open Set
21+
open scoped NNReal
22+
23+
namespace NNReal
24+
25+
protected lemma Icc_subset_segment {x y : ℝ≥0} :
26+
Icc x y ⊆ segment ℝ≥0 x y :=
27+
Nonneg.Icc_subset_segment
28+
29+
protected lemma segment_eq_Icc {x y : ℝ≥0} (hxy : x ≤ y) :
30+
segment ℝ≥0 x y = Icc x y :=
31+
Nonneg.segment_eq_Icc hxy
32+
33+
protected lemma segment_eq_uIcc {x y : ℝ≥0} :
34+
segment ℝ≥0 x y = uIcc x y :=
35+
Nonneg.segment_eq_uIcc
36+
37+
protected lemma convex_iff {M : Type*} [AddCommMonoid M] [Module ℝ M] {s : Set M} :
38+
Convex ℝ≥0 s ↔ Convex ℝ s := by
39+
refine ⟨fun H ↦ ?_, Convex.lift ℝ≥0
40+
intro _ hx _ hy a b ha hb hab
41+
exact H hx hy (a := ⟨a, ha⟩) (b := ⟨b, hb⟩) (zero_le _) (zero_le _) (by ext; simpa)
42+
43+
end NNReal

Mathlib/Analysis/Convex/Segment.lean

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Authors: Alexander Bentkamp, Yury Kudryashov, Yaël Dillies
55
-/
66
module
77

8+
public import Mathlib.Algebra.Order.Nonneg.Ring
89
public import Mathlib.LinearAlgebra.AffineSpace.Midpoint
910
public import Mathlib.LinearAlgebra.LinearIndependent.Lemmas
1011
public import Mathlib.LinearAlgebra.Ray
@@ -575,6 +576,30 @@ theorem Convex.mem_Ico (h : x < y) :
575576

576577
end LinearOrderedField
577578

579+
namespace Nonneg
580+
581+
variable [Field 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜] {x y z : 𝕜}
582+
583+
protected lemma Icc_subset_segment {x y : {t : 𝕜 // 0 ≤ t}} :
584+
Icc x y ⊆ segment {t : 𝕜 // 0 ≤ t} x y := by
585+
intro a ⟨hxa, hay⟩
586+
rw [← Subtype.coe_le_coe] at hxa hay
587+
rcases Icc_subset_segment ⟨hxa, hay⟩ with ⟨t₁, t₂, t₁_nonneg, t₂_nonneg, t_add, hta⟩
588+
refine ⟨⟨t₁, t₁_nonneg⟩, ⟨t₂, t₂_nonneg⟩, zero_le _, zero_le _, ?_, ?_⟩ <;>
589+
ext <;> simpa
590+
591+
protected lemma segment_eq_Icc {x y : {t : 𝕜 // 0 ≤ t}} (hxy : x ≤ y) :
592+
segment {t : 𝕜 // 0 ≤ t} x y = Icc x y := by
593+
refine subset_antisymm (segment_subset_Icc hxy) Nonneg.Icc_subset_segment
594+
595+
protected lemma segment_eq_uIcc {x y : {t : 𝕜 // 0 ≤ t}} :
596+
segment {t : 𝕜 // 0 ≤ t} x y = uIcc x y := by
597+
rcases le_total x y with h | h
598+
· simp [h, Nonneg.segment_eq_Icc]
599+
· simp [h, segment_symm _ x y, Nonneg.segment_eq_Icc]
600+
601+
end Nonneg
602+
578603
namespace Prod
579604

580605
variable [Semiring 𝕜] [PartialOrder 𝕜] [AddCommMonoid E] [AddCommMonoid F] [Module 𝕜 E] [Module 𝕜 F]

0 commit comments

Comments
 (0)