Skip to content

Commit

Permalink
Merge pull request #225 from Ruben-VandeVelde/EulerProducts
Browse files Browse the repository at this point in the history
Drop dependency on EulerProducts
  • Loading branch information
AlexKontorovich authored Feb 6, 2025
2 parents ba1ba4c + 8e4b43c commit 257721b
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 14 deletions.
77 changes: 77 additions & 0 deletions PrimeNumberTheoremAnd/Auxiliary.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/-
Copyright (c) 2024 Michael Stoll. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Michael Stoll
-/
import Mathlib.Analysis.Complex.Positivity

/-!
### Auxiliary lemmas
-/

namespace Complex
-- see https://leanprover.zulipchat.com/#narrow/stream/217875-Is-there-code-for-X.3F/topic/Differentiability.20of.20the.20natural.20map.20.E2.84.9D.20.E2.86.92.20.E2.84.82/near/418095234

lemma hasDerivAt_ofReal (x : ℝ) : HasDerivAt ofReal 1 x :=
HasDerivAt.ofReal_comp <| hasDerivAt_id x

lemma deriv_ofReal (x : ℝ) : deriv ofReal x = 1 :=
(hasDerivAt_ofReal x).deriv

lemma differentiableAt_ofReal (x : ℝ) : DifferentiableAt ℝ ofReal x :=
(hasDerivAt_ofReal x).differentiableAt

lemma differentiable_ofReal : Differentiable ℝ ofReal :=
ofRealCLM.differentiable

end Complex

lemma DifferentiableAt.comp_ofReal {e : ℂ → ℂ} {z : ℝ} (hf : DifferentiableAt ℂ e z) :
DifferentiableAt ℝ (fun x : ℝ ↦ e x) z :=
hf.hasDerivAt.comp_ofReal.differentiableAt

lemma deriv.comp_ofReal {e : ℂ → ℂ} {z : ℝ} (hf : DifferentiableAt ℂ e z) :
deriv (fun x : ℝ ↦ e x) z = deriv e z :=
hf.hasDerivAt.comp_ofReal.deriv

lemma Differentiable.comp_ofReal {e : ℂ → ℂ} (h : Differentiable ℂ e) :
Differentiable ℝ (fun x : ℝ ↦ e x) :=
fun _ ↦ h.differentiableAt.comp_ofReal

lemma DifferentiableAt.ofReal_comp {z : ℝ} {f : ℝ → ℝ} (hf : DifferentiableAt ℝ f z) :
DifferentiableAt ℝ (fun (y : ℝ) ↦ (f y : ℂ)) z :=
hf.hasDerivAt.ofReal_comp.differentiableAt

lemma Differentiable.ofReal_comp {f : ℝ → ℝ} (hf : Differentiable ℝ f) :
Differentiable ℝ (fun (y : ℝ) ↦ (f y : ℂ)) :=
fun _ ↦ hf.differentiableAt.ofReal_comp

open Complex ContinuousLinearMap in
lemma HasDerivAt.of_hasDerivAt_ofReal_comp {z : ℝ} {f : ℝ → ℝ} {u : ℂ}
(hf : HasDerivAt (fun y ↦ (f y : ℂ)) u z) :
∃ u' : ℝ, u = u' ∧ HasDerivAt f u' z := by
lift u to ℝ
· have H := (imCLM.hasFDerivAt.comp z hf.hasFDerivAt).hasDerivAt.deriv
simp only [Function.comp_def, imCLM_apply, ofReal_im, deriv_const] at H
rwa [eq_comm, comp_apply, imCLM_apply, smulRight_apply, one_apply, one_smul] at H
refine ⟨u, rfl, ?_⟩
convert (reCLM.hasFDerivAt.comp z hf.hasFDerivAt).hasDerivAt
rw [comp_apply, smulRight_apply, one_apply, one_smul, reCLM_apply, ofReal_re]

lemma DifferentiableAt.ofReal_comp_iff {z : ℝ} {f : ℝ → ℝ} :
DifferentiableAt ℝ (fun (y : ℝ) ↦ (f y : ℂ)) z ↔ DifferentiableAt ℝ f z := by
refine ⟨fun H ↦ ?_, ofReal_comp⟩
obtain ⟨u, _, hu₂⟩ := H.hasDerivAt.of_hasDerivAt_ofReal_comp
exact HasDerivAt.differentiableAt hu₂

lemma Differentiable.ofReal_comp_iff {f : ℝ → ℝ} :
Differentiable ℝ (fun (y : ℝ) ↦ (f y : ℂ)) ↔ Differentiable ℝ f :=
forall_congr' fun _ ↦ DifferentiableAt.ofReal_comp_iff

lemma deriv.ofReal_comp {z : ℝ} {f : ℝ → ℝ} :
deriv (fun (y : ℝ) ↦ (f y : ℂ)) z = deriv f z := by
by_cases hf : DifferentiableAt ℝ f z
· exact hf.hasDerivAt.ofReal_comp.deriv
· have hf' := mt DifferentiableAt.ofReal_comp_iff.mp hf
rw [deriv_zero_of_not_differentiableAt hf, deriv_zero_of_not_differentiableAt hf',
Complex.ofReal_zero]
2 changes: 1 addition & 1 deletion PrimeNumberTheoremAnd/MellinCalculus.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import EulerProducts.Auxiliary
import PrimeNumberTheoremAnd.Auxiliary
import Mathlib.Analysis.MellinInversion
import PrimeNumberTheoremAnd.PerronFormula
import Mathlib.Algebra.GroupWithZero.Units.Basic
Expand Down
10 changes: 0 additions & 10 deletions lake-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@
"inputRev": "v4.14.0",
"inherited": false,
"configFile": "lakefile.lean"},
{"url": "https://github.com/MichaelStollBayreuth/EulerProducts.git",
"type": "git",
"subDir": null,
"scope": "",
"rev": "28f8a06a85b742a0233bd74d5e0dd1fec42cc320",
"name": "EulerProducts",
"manifestFile": "lake-manifest.json",
"inputRev": "28f8a06a",
"inherited": false,
"configFile": "lakefile.lean"},
{"url": "https://github.com/leanprover-community/mathlib4.git",
"type": "git",
"subDir": null,
Expand Down
3 changes: 0 additions & 3 deletions lakefile.lean
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,5 @@ lean_lib «PrimeNumberTheoremAnd»
require mathlib from git
"https://github.com/leanprover-community/mathlib4.git" @ "v4.14.0"

require EulerProducts from git
"https://github.com/MichaelStollBayreuth/EulerProducts.git" @ "28f8a06a"

meta if get_config? env = some "dev" then require «doc-gen4» from git
"https://github.com/leanprover/doc-gen4.git" @ "v4.14.0"

0 comments on commit 257721b

Please sign in to comment.