|
| 1 | +/- |
| 2 | +Copyright (c) 2024 Frédéric Dupuis. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Frédéric Dupuis |
| 5 | +-/ |
| 6 | + |
| 7 | +import Mathlib.Analysis.NormedSpace.Spectrum |
| 8 | +import Mathlib.Analysis.SpecialFunctions.Exponential |
| 9 | +import Mathlib.Topology.ContinuousFunction.FunctionalCalculus |
| 10 | + |
| 11 | +/-! |
| 12 | +# The exponential and logarithm based on the continuous functional calculus |
| 13 | +
|
| 14 | +This file defines the logarithm via the continuous functional calculus (CFC) and builds its API. |
| 15 | +This allows one to take logs of matrices, operators, elements of a C⋆-algebra, etc. |
| 16 | +
|
| 17 | +It also shows that exponentials defined via the continuous functional calculus are equal to |
| 18 | +`NormedSpace.exp` (defined via power series) whenever the former are not junk values. |
| 19 | +
|
| 20 | +## Main declarations |
| 21 | +
|
| 22 | ++ `CFC.log`: the real log function based on the CFC, i.e. `cfc Real.log` |
| 23 | ++ `CFC.exp_eq_normedSpace_exp`: exponentials based on the CFC are equal to exponentials based |
| 24 | + on power series. |
| 25 | ++ `CFC.log_exp` and `CFC.exp_log`: `CFC.log` and `NormedSpace.exp ℝ` are inverses of each other. |
| 26 | +
|
| 27 | +## Implementation notes |
| 28 | +
|
| 29 | +Since `cfc Real.exp` and `cfc Complex.exp` are strictly less general than `NormedSpace.exp` |
| 30 | +(defined via power series), we only give minimal API for these here in order to relate |
| 31 | +`NormedSpace.exp` to functions defined via the CFC. In particular, we don't give separate |
| 32 | +definitions for them. |
| 33 | +
|
| 34 | +## TODO |
| 35 | +
|
| 36 | ++ Show that `log (a * b) = log a + log b` whenever `a` and `b` commute (and the same for indexed |
| 37 | + products). |
| 38 | ++ Relate `CFC.log` to `rpow`, `zpow`, `sqrt`, `inv`. |
| 39 | +-/ |
| 40 | + |
| 41 | +open NormedSpace |
| 42 | + |
| 43 | +section general_exponential |
| 44 | +variable {𝕜 : Type*} {α : Type*} [RCLike 𝕜] [TopologicalSpace α] [CompactSpace α] |
| 45 | + |
| 46 | +lemma NormedSpace.exp_continuousMap_eq (f : C(α, 𝕜)) : |
| 47 | + exp 𝕜 f = (⟨exp 𝕜 ∘ f, exp_continuous.comp f.continuous⟩ : C(α, 𝕜)) := by |
| 48 | + ext a |
| 49 | + simp only [Function.comp_apply, NormedSpace.exp, FormalMultilinearSeries.sum] |
| 50 | + have h_sum := NormedSpace.expSeries_summable (𝕂 := 𝕜) f |
| 51 | + simp_rw [← ContinuousMap.tsum_apply h_sum a, NormedSpace.expSeries_apply_eq] |
| 52 | + simp [NormedSpace.exp_eq_tsum] |
| 53 | + |
| 54 | +end general_exponential |
| 55 | + |
| 56 | +namespace CFC |
| 57 | +section RCLikeNormed |
| 58 | + |
| 59 | +variable {𝕜 : Type*} {A : Type*} [RCLike 𝕜] {p : A → Prop} [PartialOrder A] [NormedRing A] |
| 60 | + [StarRing A] [StarOrderedRing A] [TopologicalRing A] [NormedAlgebra 𝕜 A] [CompleteSpace A] |
| 61 | + [ContinuousFunctionalCalculus 𝕜 p] |
| 62 | + [UniqueContinuousFunctionalCalculus 𝕜 A] |
| 63 | + |
| 64 | +lemma exp_eq_normedSpace_exp {a : A} (ha : p a := by cfc_tac) : |
| 65 | + cfc (exp 𝕜 : 𝕜 → 𝕜) a = exp 𝕜 a := by |
| 66 | + conv_rhs => rw [← cfc_id 𝕜 a ha, cfc_apply id a ha] |
| 67 | + have h := (cfcHom_closedEmbedding (R := 𝕜) (show p a from ha)).continuous |
| 68 | + have _ : ContinuousOn (exp 𝕜) (spectrum 𝕜 a) := exp_continuous.continuousOn |
| 69 | + simp_rw [← map_exp 𝕜 _ h, cfc_apply (exp 𝕜) a ha] |
| 70 | + congr 1 |
| 71 | + ext |
| 72 | + simp [exp_continuousMap_eq] |
| 73 | + |
| 74 | +end RCLikeNormed |
| 75 | + |
| 76 | +section RealNormed |
| 77 | + |
| 78 | +variable {A : Type*} {p : A → Prop} [PartialOrder A] [NormedRing A] [StarRing A] [StarOrderedRing A] |
| 79 | + [TopologicalRing A] [NormedAlgebra ℝ A] [CompleteSpace A] |
| 80 | + [ContinuousFunctionalCalculus ℝ p] |
| 81 | + [UniqueContinuousFunctionalCalculus ℝ A] |
| 82 | + |
| 83 | +lemma real_exp_eq_normedSpace_exp {a : A} (ha : p a := by cfc_tac) : |
| 84 | + cfc Real.exp a = exp ℝ a := |
| 85 | + Real.exp_eq_exp_ℝ ▸ exp_eq_normedSpace_exp ha |
| 86 | + |
| 87 | +end RealNormed |
| 88 | + |
| 89 | +section ComplexNormed |
| 90 | + |
| 91 | +variable {A : Type*} {p : A → Prop} [PartialOrder A] [NormedRing A] [StarRing A] [StarOrderedRing A] |
| 92 | + [TopologicalRing A] [NormedAlgebra ℂ A] [CompleteSpace A] |
| 93 | + [ContinuousFunctionalCalculus ℂ p] |
| 94 | + [UniqueContinuousFunctionalCalculus ℂ A] |
| 95 | + |
| 96 | +lemma complex_exp_eq_normedSpace_exp {a : A} (ha : p a := by cfc_tac) : |
| 97 | + cfc Complex.exp a = exp ℂ a := |
| 98 | + Complex.exp_eq_exp_ℂ ▸ exp_eq_normedSpace_exp ha |
| 99 | + |
| 100 | +end ComplexNormed |
| 101 | + |
| 102 | + |
| 103 | +section real_log |
| 104 | + |
| 105 | +open scoped ComplexOrder |
| 106 | + |
| 107 | +variable {A : Type*} [PartialOrder A] [NormedRing A] [StarRing A] [StarOrderedRing A] |
| 108 | + [TopologicalRing A] [NormedAlgebra ℝ A] [CompleteSpace A] |
| 109 | + [ContinuousFunctionalCalculus ℝ (IsSelfAdjoint : A → Prop)] |
| 110 | + [UniqueContinuousFunctionalCalculus ℝ A] |
| 111 | + |
| 112 | +/-- The real logarithm, defined via the continuous functional calculus. This can be used on |
| 113 | +matrices, operators on a Hilbert space, elements of a C⋆-algebra, etc. -/ |
| 114 | +noncomputable def log (a : A) : A := cfc Real.log a |
| 115 | + |
| 116 | +@[simp] |
| 117 | +protected lemma _root_.IsSelfAdjoint.log {a : A} : IsSelfAdjoint (log a) := cfc_predicate _ a |
| 118 | + |
| 119 | +lemma log_exp (a : A) (ha : IsSelfAdjoint a := by cfc_tac) : log (NormedSpace.exp ℝ a) = a := by |
| 120 | + have hcont : ContinuousOn Real.log (Real.exp '' spectrum ℝ a) := by fun_prop (disch := aesop) |
| 121 | + rw [log, ← real_exp_eq_normedSpace_exp, ← cfc_comp' Real.log Real.exp a hcont] |
| 122 | + simp [cfc_id' (R := ℝ) a] |
| 123 | + |
| 124 | +-- TODO: Relate the hypothesis to a notion of strict positivity |
| 125 | +lemma exp_log (a : A) (ha₂ : ∀ x ∈ spectrum ℝ a, 0 < x) (ha₁ : IsSelfAdjoint a := by cfc_tac) : |
| 126 | + NormedSpace.exp ℝ (log a) = a := by |
| 127 | + have ha₃ : ContinuousOn Real.log (spectrum ℝ a) := by |
| 128 | + have : ∀ x ∈ spectrum ℝ a, x ≠ 0 := by peel ha₂ with x hx h; exact h.ne' |
| 129 | + fun_prop (disch := assumption) |
| 130 | + rw [← real_exp_eq_normedSpace_exp .log, log, ← cfc_comp' Real.exp Real.log a (by fun_prop) ha₃] |
| 131 | + conv_rhs => rw [← cfc_id (R := ℝ) a ha₁] |
| 132 | + exact cfc_congr (Real.exp_log <| ha₂ · ·) |
| 133 | + |
| 134 | +@[simp] lemma log_zero : log (0 : A) = 0 := by simp [log] |
| 135 | + |
| 136 | +@[simp] lemma log_one : log (1 : A) = 0 := by simp [log] |
| 137 | + |
| 138 | +@[simp] |
| 139 | +lemma log_algebraMap {r : ℝ} : log (algebraMap ℝ A r) = algebraMap ℝ A (Real.log r) := by |
| 140 | + simp [log] |
| 141 | + |
| 142 | +-- TODO: Relate the hypothesis to a notion of strict positivity |
| 143 | +lemma log_smul {r : ℝ} (a : A) (ha₂ : ∀ x ∈ spectrum ℝ a, 0 < x) (hr : 0 < r) |
| 144 | + (ha₁ : IsSelfAdjoint a := by cfc_tac) : |
| 145 | + log (r • a) = algebraMap ℝ A (Real.log r) + log a := by |
| 146 | + have : ∀ x ∈ spectrum ℝ a, x ≠ 0 := by peel ha₂ with x hx h; exact h.ne' |
| 147 | + rw [log, ← cfc_smul_id (R := ℝ) r a, ← cfc_comp Real.log (r • ·) a, log] |
| 148 | + calc |
| 149 | + _ = cfc (fun z => Real.log r + Real.log z) a := |
| 150 | + cfc_congr (Real.log_mul hr.ne' <| ne_of_gt <| ha₂ · ·) |
| 151 | + _ = _ := by rw [cfc_const_add _ _ _] |
| 152 | + |
| 153 | +-- TODO: Relate the hypothesis to a notion of strict positivity |
| 154 | +lemma log_pow (n : ℕ) (a : A) (ha₂ : ∀ x ∈ spectrum ℝ a, 0 < x) |
| 155 | + (ha₁ : IsSelfAdjoint a := by cfc_tac) : log (a ^ n) = n • log a := by |
| 156 | + have : ∀ x ∈ spectrum ℝ a, x ≠ 0 := by peel ha₂ with x hx h; exact h.ne' |
| 157 | + have ha₂' : ContinuousOn Real.log (spectrum ℝ a) := by fun_prop (disch := assumption) |
| 158 | + have ha₂'' : ContinuousOn Real.log ((· ^ n) '' spectrum ℝ a) := by fun_prop (disch := aesop) |
| 159 | + rw [log, ← cfc_pow_id (R := ℝ) a n ha₁, ← cfc_comp' Real.log (· ^ n) a ha₂'', log] |
| 160 | + simp_rw [Real.log_pow, nsmul_eq_smul_cast ℝ n, cfc_const_mul (n : ℝ) Real.log a ha₂'] |
| 161 | + |
| 162 | +end real_log |
| 163 | +end CFC |
0 commit comments