Download lean/OAI/Analysis/FreeEntropy/ComplexPolynomialFunctions.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 7.75 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/0aba1cd41414e6bcbc4f3bf823e08849f9affc19/lean/OAI/Analysis/FreeEntropy/ComplexPolynomialFunctions.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset@0aba1cd41414e6bcbc4f3bf823e08849f9affc19/lean/OAI/Analysis/FreeEntropy/ComplexPolynomialFunctions.lean
-
curl -L -o ComplexPolynomialFunctions.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/0aba1cd41414e6bcbc4f3bf823e08849f9affc19/lean/OAI/Analysis/FreeEntropy/ComplexPolynomialFunctions.lean
7.75 kB
Lean 4 · 23
declarations statementsfull
def IsComplexPolynomial (f : (ι → ℝ) → ℂ) : Prop := body · 1 line
IsRealPolynomial (fun x => (f x).re) ∧ IsRealPolynomial (fun x => (f x).im) def complexCoordinateDerivative (f : (ι → ℝ) → ℂ) (i : ι) (x : ι → ℝ) : ℂ := body · 1 line
deriv (fun t => f (Function.update x i t)) (x i) theorem complex_integral_re {Ω : Type u2} [MeasurableSpace Ω] {μ : Measure Ω} {f : Ω → ℂ}
(hf : Integrable f μ) : (∫ x, f x ∂μ).re = ∫ x, (f x).re ∂μ := (integral_re hf).symm theorem complex_integral_im {Ω : Type u3} [MeasurableSpace Ω] {μ : Measure Ω} {f : Ω → ℂ}
(hf : Integrable f μ) : (∫ x, f x ∂μ).im = ∫ x, (f x).im ∂μ := (integral_im hf).symm theorem const (z : ℂ) : IsComplexPolynomial (fun _ : ι → ℝ => z) := proof · 1 line
⟨IsRealPolynomial.const _,IsRealPolynomial.const _⟩ theorem ofReal {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) :
IsComplexPolynomial (fun x => (f x : ℂ)) := by proof · 1 line
exact ⟨hf, IsRealPolynomial.const 0⟩ theorem coord (i : ι) : IsComplexPolynomial (fun x : ι → ℝ => (x i : ℂ)) := ofReal (IsRealPolynomial.coord i) theorem add {f g : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (hg : IsComplexPolynomial g) :
IsComplexPolynomial (fun x => f x+g x) := ⟨hf.1.add hg.1,hf.2.add hg.2⟩ theorem sub {f g : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (hg : IsComplexPolynomial g) :
IsComplexPolynomial (fun x => f x-g x) := ⟨hf.1.sub hg.1,hf.2.sub hg.2⟩ theorem mul {f g : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (hg : IsComplexPolynomial g) :
IsComplexPolynomial (fun x => f x*g x) := proof · 1 line
⟨(hf.1.mul hg.1).sub (hf.2.mul hg.2),(hf.1.mul hg.2).add (hf.2.mul hg.1)⟩ theorem const_mul {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (z : ℂ) :
IsComplexPolynomial (fun x => z*f x) := (const z).mul hf theorem mul_const {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (z : ℂ) :
IsComplexPolynomial (fun x => f x*z) := hf.mul (const z) theorem finset_sum {κ : Type u4} (s : Finset κ) {f : κ → (ι → ℝ) → ℂ}
(hf : ∀ k ∈ s, IsComplexPolynomial (f k)) : IsComplexPolynomial (fun x => ∑ k ∈ s, f k x) := by proof · 3 lines
constructor
· simpa using IsRealPolynomial.finset_sum s (fun k hk => (hf k hk).1)
· simpa using IsRealPolynomial.finset_sum s (fun k hk => (hf k hk).2) theorem continuous {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) : Continuous f := by proof · 4 lines
have hc := (Complex.continuous_ofReal.comp hf.1.continuous).add ((Complex.continuous_ofReal.comp hf.2.continuous).mul (continuous_const (y := Complex.I)))
convert hc using 1
funext x
exact (Complex.re_add_im (f x)).symm theorem integrable {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) : Integrable f (productGaussian ι) := by proof · 4 lines
have hi := hf.1.integrable.ofReal.add (hf.2.integrable.ofReal.mul_const Complex.I)
convert hi using 1 ; try rfl
funext x
exact (Complex.re_add_im (f x)).symm theorem normSq {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) :
IsRealPolynomial (fun x => Complex.normSq (f x)) := by proof · 1 line
simpa only [Complex.normSq_apply, pow_two] using (hf.1.pow 2).add (hf.2.pow 2) theorem norm_sq {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) :
IsRealPolynomial (fun x => ‖f x‖^2) := by simpa only [Complex.sq_norm] using hf.normSq theorem hasCoordinateDeriv {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (i : ι) (x : ι → ℝ) :
HasDerivAt (fun t => f (Function.update x i t))
((coordinateDerivative (fun y => (f y).re) i x : ℂ) +
(coordinateDerivative (fun y => (f y).im) i x : ℂ)*Complex.I) (x i) := by proof · 4 lines
have hd := (hf.1.hasDerivAt i x).ofReal_comp.add ((hf.2.hasDerivAt i x).ofReal_comp.mul_const Complex.I)
convert hd using 1 ; try rfl
funext t
exact (Complex.re_add_im (f (Function.update x i t))).symm theorem coordinateDerivative_eq {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (i : ι) (x : ι → ℝ) :
complexCoordinateDerivative f i x =
(coordinateDerivative (fun y => (f y).re) i x : ℂ) +
(coordinateDerivative (fun y => (f y).im) i x : ℂ)*Complex.I := proof · 1 line
(hf.hasCoordinateDeriv i x).deriv
theorem derivative {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (i : ι) :
IsComplexPolynomial (complexCoordinateDerivative f i) := by proof · 6 lines
have he : complexCoordinateDerivative f i = fun x =>
(coordinateDerivative (fun y => (f y).re) i x : ℂ) +
(coordinateDerivative (fun y => (f y).im) i x : ℂ)*Complex.I := by
funext x; exact hf.coordinateDerivative_eq i x
rw [he]
exact (ofReal (hf.1.derivative i)).add ((ofReal (hf.2.derivative i)).mul_const Complex.I) theorem hasDerivAt {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (i : ι) (x : ι → ℝ) :
HasDerivAt (fun t => f (Function.update x i t)) (complexCoordinateDerivative f i x) (x i) := by proof · 2 lines
rw [hf.coordinateDerivative_eq] exact hf.hasCoordinateDeriv i x
theorem stein {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (i : ι) :
(∫ x, (x i : ℂ)*f x ∂productGaussian ι) = ∫ x, complexCoordinateDerivative f i x ∂productGaussian ι := by proof · 9 lines
have hi := ((coord i).mul hf).integrable
have hd := (hf.derivative i).integrable
apply Complex.ext
· rw [complex_integral_re hi, complex_integral_re hd]
simpa only [Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero,
hf.coordinateDerivative_eq, Complex.add_re, Complex.mul_re, Complex.I_re, Complex.I_im, mul_zero, zero_add, add_zero] using hf.1.stein i
· rw [complex_integral_im hi, complex_integral_im hd]
simpa only [Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, zero_mul, add_zero,
hf.coordinateDerivative_eq, Complex.add_im, Complex.I_re, Complex.I_im, mul_one, mul_zero, zero_add] using hf.2.stein i theorem poincare {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) :
(∫ x, ‖f x-∫ y, f y ∂productGaussian ι‖^2 ∂productGaussian ι) ≤
∑ i, ∫ x, ‖complexCoordinateDerivative f i x‖^2 ∂productGaussian ι := by proof · 22 lines
have hi := hf.integrable
have hnorm (z : ℂ) : ‖z‖^2 = z.re^2+z.im^2 := by rw [Complex.sq_norm]; simp only [Complex.normSq_apply,pow_two]
have hr := ((hf.1.sub (IsRealPolynomial.const (∫ y, (f y).re ∂productGaussian ι))).pow 2).integrable
have hm := ((hf.2.sub (IsRealPolynomial.const (∫ y, (f y).im ∂productGaussian ι))).pow 2).integrable
have he : (∫ x, ‖f x-∫ y, f y ∂productGaussian ι‖^2 ∂productGaussian ι) =
(∫ x, ((f x).re-∫ y, (f y).re ∂productGaussian ι)^2 ∂productGaussian ι) +
∫ x, ((f x).im-∫ y, (f y).im ∂productGaussian ι)^2 ∂productGaussian ι := by
simp only [hnorm, Complex.sub_re, Complex.sub_im, complex_integral_re hi, complex_integral_im hi]
exact integral_add hr hm
rw [he]
calc
_ ≤ (∑ i, ∫ x, (coordinateDerivative (fun y => (f y).re) i x)^2 ∂productGaussian ι) +
∑ i, ∫ x, (coordinateDerivative (fun y => (f y).im) i x)^2 ∂productGaussian ι :=
add_le_add hf.1.poincare hf.2.poincare
_ = _ := by
rw [← sum_add_distrib]
apply sum_congr rfl
intro i hi
rw [← integral_add ((hf.1.derivative i).pow 2).integrable ((hf.2.derivative i).pow 2).integrable]
apply integral_congr_ae
filter_upwards [] with x
simp [hnorm, hf.coordinateDerivative_eq]Outline
- def
IsComplexPolynomial11 - def
complexCoordinateDerivative13 - theorem
complex_integral_re15 - theorem
complex_integral_im17 - theorem
const20 - theorem
ofReal22 - theorem
coord25 - theorem
add26 - theorem
sub28 - theorem
mul30 - theorem
const_mul33 - theorem
mul_const35 - theorem
finset_sum37 - theorem
continuous42 - theorem
integrable47 - theorem
normSq52 - theorem
norm_sq55 - theorem
hasCoordinateDeriv57 - theorem
coordinateDerivative_eq65 - theorem
derivative70 - theorem
hasDerivAt78 - theorem
stein82 - theorem
poincare93