2024-12-20 15:27:06 +01:00
|
|
|
|
import Mathlib.Analysis.SpecialFunctions.Log.Basic
|
2024-12-19 16:10:51 +01:00
|
|
|
|
|
|
|
|
|
open Real
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
noncomputable def logpos : ℝ → ℝ := fun r ↦ max 0 (log r)
|
|
|
|
|
|
2024-12-20 15:27:06 +01:00
|
|
|
|
notation "log⁺" => logpos
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
theorem loglogpos {r : ℝ} : log r = log⁺ r - log⁺ r⁻¹ := by
|
2024-12-19 16:10:51 +01:00
|
|
|
|
unfold logpos
|
|
|
|
|
rw [log_inv]
|
|
|
|
|
by_cases h : 0 ≤ log r
|
|
|
|
|
· simp [h]
|
|
|
|
|
· simp at h
|
|
|
|
|
have : 0 ≤ -log r := Left.nonneg_neg_iff.2 (le_of_lt h)
|
|
|
|
|
simp [h, this]
|
|
|
|
|
exact neg_nonneg.mp this
|
|
|
|
|
|
|
|
|
|
|
2024-12-20 15:27:06 +01:00
|
|
|
|
theorem logpos_norm {r : ℝ} : log⁺ r = 2⁻¹ * (log r + ‖log r‖) := by
|
2024-12-19 16:10:51 +01:00
|
|
|
|
by_cases hr : 0 ≤ log r
|
|
|
|
|
· rw [norm_of_nonneg hr]
|
|
|
|
|
have : logpos r = log r := by
|
|
|
|
|
unfold logpos
|
|
|
|
|
simp [hr]
|
|
|
|
|
rw [this]
|
|
|
|
|
ring
|
|
|
|
|
· rw [norm_of_nonpos (le_of_not_ge hr)]
|
|
|
|
|
have : logpos r = 0 := by
|
|
|
|
|
unfold logpos
|
|
|
|
|
simp
|
|
|
|
|
exact le_of_not_ge hr
|
|
|
|
|
rw [this]
|
|
|
|
|
ring
|
2024-12-20 15:27:06 +01:00
|
|
|
|
|
|
|
|
|
-- WANT: logpos is even and continuous
|
|
|
|
|
-- WANT: Inequalities
|