openAI-math-dataset / lean /OAI /Analysis /CoulombIonization /Fermionic /WeightedCoreStatistics.lean
roseking's picture
Add lean source and binary files (part 16)
159357f verified
Raw History Blame Contribute Delete
8.44 kB
11
def rawWeightedCount {N : ℕ} (f : Space → ℝ) (x : Configuration N) : ℝ := ∑ i, f (x i)
12
lemma rawWeightedCount_nonneg {N : ℕ} {f : Space → ℝ} (hf : ∀ z, 0 ≤ f z)
    (x : Configuration N) : 0 ≤ rawWeightedCount f x := Finset.sum_nonneg (fun i _ => hf (x i))
14
lemma rawWeightedCount_le {N : ℕ} {f : Space → ℝ} {A : ℝ} (hf : ∀ z, f z ≤ A)
    (x : Configuration N) : rawWeightedCount f x ≤ N*A := by
proof · 2 lines
  calc _ ≤ ∑ _i : Fin N, A := Finset.sum_le_sum (fun i _ => hf (x i))
       _ = _ := by simp
18
lemma rawWeightedCount_measurable {N : ℕ} {f : Space → ℝ} (hf : Measurable f) :
    Measurable (rawWeightedCount (N := N) f) :=
proof · 1 line
  Finset.measurable_sum _ (fun i _ => hf.comp (measurable_pi_apply i))
21
lemma rawWeightedCount_cutCore_le {N : ℕ} {f : Space → ℝ} (hf : ∀ z, 0 ≤ f z)
    (c : Fin N → Fin 2) (x : Configuration N) :
    rawWeightedCount f (cutCorePositions c x) ≤ rawWeightedCount f x := by
proof · 6 lines
  rw [rawWeightedCount,sum_cutCorePositions c x f]
  apply Finset.sum_le_sum
  intro i _
  split_ifs
  · exact le_rfl
  · exact hf _
31
def rawWeightedMoment {N : ℕ} (psi : FormVector N) (f : Space → ℝ) : ℝ :=
body · 1 line
  rawFormPair psi (fun x => rawWeightedCount f x^2)
33
lemma rawWeightedMoment_nonneg {N : ℕ} (psi : FormVector N) (f : Space → ℝ) :
    0 ≤ rawWeightedMoment psi f :=
proof · 1 line
  Finset.sum_nonneg (fun _ _ => integral_nonneg (fun _ => mul_nonneg (sq_nonneg _) (sq_nonneg _)))
36
lemma rawWeightedMoment_eq_integral {N : ℕ} {psi : FormVector N} (hpsi : SobolevVector psi)
    {f : Space → ℝ} (hm : Measurable f) (hn : ∀ z, 0 ≤ f z) {A : ℝ} (hb : ∀ z, f z ≤ A) :
    rawWeightedMoment psi f = ∫ x, rawWeightedCount f x^2 ∂formRawLaw psi :=
proof · 2 lines
  rawFormPair_eq_integral hpsi ((rawWeightedCount_measurable hm).pow_const 2)
    (fun x => norm_sq_le_of_nonneg (rawWeightedCount_nonneg hn x) (rawWeightedCount_le hb x))
41
lemma rawWeightedMoment_coreSlice_integrable {N M : ℕ} {psi : FormVector (N+M)}
    (hpsi : SobolevVector psi) {f : Space → ℝ} (hm : Measurable f) (hn : ∀ z, 0 ≤ f z)
    {A : ℝ} (hb : ∀ z, f z ≤ A) (t : Spins M) :
    Integrable (fun v => rawWeightedMoment (coreSlice psi t v) f) :=
proof · 2 lines
  rawFormPair_coreSlice_integrable hpsi ((rawWeightedCount_measurable hm).pow_const 2)
    (fun x => norm_sq_le_of_nonneg (rawWeightedCount_nonneg hn x) (rawWeightedCount_le hb x)) t
48
lemma sum_cutCore_weightedMoment_le {N : ℕ} {psi : FormVector N} (hpsi : SobolevVector psi)
    (p : Fin 2 → SmoothMultiplier spaceDirections) (hp : ∀ x, ∑ a, (p a).value x^2 = 1)
    {f : Space → ℝ} (hm : Measurable f) (hn : ∀ z, 0 ≤ f z) {A : ℝ} (hb : ∀ z, f z ≤ A) :
    (∑ c : Fin N → Fin 2, coreLawAverage (orderedCutForm p hp psi c)
      (fun phi => rawWeightedMoment phi f)) ≤ rawWeightedMoment psi f := by
proof · 15 lines
  simp only [rawWeightedMoment]
  simp_rw [cutCore_rawFormPair p hp hpsi _ ((rawWeightedCount_measurable hm).pow_const 2)
    (fun x => norm_sq_le_of_nonneg (rawWeightedCount_nonneg hn x) (rawWeightedCount_le hb x))]
  rw [rawFormPair_eq_integral hpsi ((rawWeightedCount_measurable hm).pow_const 2)
    (fun x => norm_sq_le_of_nonneg (rawWeightedCount_nonneg hn x) (rawWeightedCount_le hb x))]
  change spatialCutExpectation p hp psi (fun c x => rawWeightedCount f (cutCorePositions c x)^2) ≤ _
  apply spatialCutExpectation_le_raw p hp hpsi
    (fun c => ((rawWeightedCount_measurable hm).comp (cutCorePositions_measurable c)).pow_const 2)
    (A := ((N:ℝ)*A)^2)
    (fun c x => norm_sq_le_of_nonneg (rawWeightedCount_nonneg hn _)
      ((rawWeightedCount_cutCore_le hn c x).trans (rawWeightedCount_le hb x)))
    ((rawWeightedCount_measurable hm).pow_const 2) (B := ((N:ℝ)*A)^2)
    (fun x => norm_sq_le_of_nonneg (rawWeightedCount_nonneg hn _) (rawWeightedCount_le hb _))
  intro c x _
  exact pow_le_pow_left₀ (rawWeightedCount_nonneg hn _) (rawWeightedCount_cutCore_le hn c x) 2
69
lemma nextCoreObservation_weighted_statistic_integrable {N M : ℕ} {psi : FormVector (N+M)}
    (hpsi : SobolevVector psi) (p : Fin 2 → SmoothMultiplier spaceDirections)
    (hp : ∀ x, ∑ a, (p a).value x^2 = 1) (c : Fin N → Fin 2)
    {f : Space → ℝ} (hm : Measurable f) (hn : ∀ z, 0 ≤ f z) {A : ℝ} (hb : ∀ z, f z ≤ A) (t : Spins M) :
    Integrable (fun v => coreLawAverage (orderedCutForm p hp (coreSlice psi t v) c)
      (fun phi => rawWeightedMoment phi f)) :=
proof · 2 lines
  nextCoreObservation_statistic_integrable psi p hp c (fun phi => rawWeightedMoment phi f)
    (fun s => rawWeightedMoment_coreSlice_integrable (nextCoreObservation_sobolev hpsi p hp c) hm hn hb s) t
78
theorem sum_nextCoreObservation_weightedMoment_le {N M : ℕ} {psi : FormVector (N+M)}
    (hpsi : SobolevVector psi) (p : Fin 2 → SmoothMultiplier spaceDirections)
    (hp : ∀ x, ∑ a, (p a).value x^2 = 1)
    {f : Space → ℝ} (hm : Measurable f) (hn : ∀ z, 0 ≤ f z) {A : ℝ} (hb : ∀ z, f z ≤ A) :
    (∑ c : Fin N → Fin 2, coreLawAverage (nextCoreObservation p hp psi c)
      (fun phi => rawWeightedMoment phi f)) ≤ coreLawAverage psi (fun phi => rawWeightedMoment phi f) := by
proof · 16 lines
  have ht (c : Fin N → Fin 2) := coreLawAverage_next psi p hp c
    (fun phi => rawWeightedMoment phi f)
    (fun s => rawWeightedMoment_coreSlice_integrable (nextCoreObservation_sobolev hpsi p hp c) hm hn hb s)
  simp_rw [ht]
  rw [Finset.sum_comm]
  change (∑ t : Spins M, ∑ c : Fin N → Fin 2, ∫ v,
    coreLawAverage (orderedCutForm p hp (coreSlice psi t v) c) (fun phi => rawWeightedMoment phi f)) ≤
    ∑ t : Spins M, ∫ v, rawWeightedMoment (coreSlice psi t v) f
  apply Finset.sum_le_sum
  intro t _
  have hi := fun c (_ : c ∈ (Finset.univ : Finset (Fin N → Fin 2))) =>
    nextCoreObservation_weighted_statistic_integrable hpsi p hp c hm hn hb t
  rw [←integral_finsetSum _ hi]
  apply integral_mono_ae (integrable_finsetSum _ hi) (rawWeightedMoment_coreSlice_integrable hpsi hm hn hb t)
  filter_upwards [hpsi.ae_coreSlice t] with v hv
  exact sum_cutCore_weightedMoment_le hv p hp hm hn hb
102
 def weightedMoment (G : CoreObservationGraph) (f : Space → ℝ) : ℝ :=
body · 1 line
    coreLawAverage G.vector (fun phi => rawWeightedMoment phi f)
104
 lemma observe_weightedMoment (G : CoreObservationGraph) (p : Fin 2 → SmoothMultiplier spaceDirections)
    (hp : ∀ x, ∑ a, (p a).value x^2 = 1)
    {f : Space → ℝ} (hm : Measurable f) (hn : ∀ z, 0 ≤ f z) {A : ℝ} (hb : ∀ z, f z ≤ A) :
    (∑ c : Fin G.coreSize → Fin 2, (G.observe p hp c).weightedMoment f) ≤ G.weightedMoment f :=
proof · 1 line
  sum_nextCoreObservation_weightedMoment_le G.sobolev p hp hm hn hb
111
 def weightedMoment (E : CoreObservationEnsemble) (f : Space → ℝ) : ℝ :=
body · 1 line
   ∑ i, (E.graph i).weightedMoment f
113
 lemma initial_weightedMoment {N : ℕ} (psi : FormVector N) (hpsi : SobolevFermion psi) (f : Space → ℝ) :
   (initial psi hpsi).weightedMoment f = rawWeightedMoment psi f := by
proof · 2 lines
   change (∑ _i : Unit, coreLawAverage (M := 0) psi (fun phi => rawWeightedMoment phi f)) = _
   simp [coreLawAverage_empty]
117
 lemma observe_weightedMoment (E : CoreObservationEnsemble) (p : Fin 2 → SmoothMultiplier spaceDirections)
    (hp : ∀ x, ∑ a, (p a).value x^2 = 1)
    {f : Space → ℝ} (hm : Measurable f) (hn : ∀ z, 0 ≤ f z) {A : ℝ} (hb : ∀ z, f z ≤ A) :
    (E.observe p hp).weightedMoment f ≤ E.weightedMoment f := by
proof · 4 lines
   change (∑ ic : Σ i : E.Branch, Fin (E.graph i).coreSize → Fin 2,
     ((E.graph ic.1).observe p hp ic.2).weightedMoment f) ≤ _
   rw [Fintype.sum_sigma]
   exact Finset.sum_le_sum (fun i _ => (E.graph i).observe_weightedMoment p hp hm hn hb)
125
 lemma observeCells_weightedMoment (E : CoreObservationEnsemble) (ys : List Space)
    {f : Space → ℝ} (hm : Measurable f) (hn : ∀ z, 0 ≤ f z) {A : ℝ} (hb : ∀ z, f z ≤ A) :
    (E.observeCells ys).weightedMoment f ≤ E.weightedMoment f := by
proof · 9 lines
   classical
   induction ys generalizing E with
   | nil => exact le_rfl
   | cons y ys ih =>
     apply (ih _).trans
     unfold observeCell
     split_ifs
     · exact le_rfl
     · exact observe_weightedMoment E _ _ hm hn hb