math / data /lean /OAI /Probability /InvariantIsing /Arrays /NSpinTensorPairPaths.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
15.5 kB
import OAI.Probability.InvariantIsing.Arrays.NSpinTensorPairConditioning
import OAI.Probability.InvariantIsing.Arrays.OverlapBounds
namespace OAI
/-! Actual bounded spin pair tests under the published marked-path law. -/
noncomputable section
open MeasureTheory ProbabilityTheory IsingPerceptron
open scoped BigOperators ENNReal NNReal
namespace InvariantIsing
abbrev TensorPairPathData {N m k : β„•} (I : Fin m β†’ Finset (Fin N))
(degree : Fin k β†’ Fin m β†’ β„•) (n : β„•) :=
(SpinTensorIndex I degree β†’ ℝ) Γ—
(Fin n β†’ (SpinTensorIndex I degree β†’ ℝ) Γ— (SpinTensorIndex I degree β†’ ℝ))
def tensorPairPathState {N m k : β„•} (I : Fin m β†’ Finset (Fin N))
(degree : Fin k β†’ Fin m β†’ β„•) (n : β„•) (p : TensorPairPathData I degree n) (j : Fin 2) :
SpinTensorIndex I degree β†’ ℝ :=
p.1 + βˆ‘ i, if j = 0 then (p.2 i).1 else (p.2 i).2
lemma measurable_tensorPairPathState {N m k : β„•} (I : Fin m β†’ Finset (Fin N))
(degree : Fin k β†’ Fin m β†’ β„•) (n : β„•) (j : Fin 2) :
Measurable (fun p => tensorPairPathState I degree n p j) := by
have hm (i : Fin n) : Measurable (fun p : TensorPairPathData I degree n =>
if j = 0 then (p.2 i).1 else (p.2 i).2) := by
split_ifs
Β· exact ((measurable_pi_apply i).comp measurable_snd).fst
Β· exact ((measurable_pi_apply i).comp measurable_snd).snd
exact measurable_fst.add (Finset.measurable_sum _ fun i _ => hm i)
private lemma measurable_tensorPairSpinMeasures {N m k : β„•}
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) :
Measurable (fun p : TensorPairPathData I degree n => Measure.pi (fun j : Fin 2 =>
gibbsProbability (uniformSpinPrior N : Measure (Spin N))
(tensorSpinBaseEnergy eig U c I degree amplitude (tensorPairPathState I degree n p j)))) := by
have hΞ½ (j : Fin 2) : Measurable (fun p : TensorPairPathData I degree n =>
gibbsProbability (uniformSpinPrior N : Measure (Spin N))
(tensorSpinBaseEnergy eig U c I degree amplitude (tensorPairPathState I degree n p j))) := by
let H : TensorPairPathData I degree n Γ— Spin N β†’ ℝ := fun p =>
tensorSpinBaseEnergy eig U c I degree amplitude (tensorPairPathState I degree n p.1 j) p.2
have hH : Measurable H := by
apply measurable_from_prod_countable_left
intro Οƒ
have hm := (measurable_pi_apply Οƒ).comp
((measurable_spinTensorEnergyMark U I degree amplitude).comp
(measurable_tensorPairPathState I degree n j))
exact hm.const_add (rotatedEnergy eig U Οƒ + fieldEnergy c Οƒ)
exact measurable_gibbsProbability
(Ξ½ := fun _ : TensorPairPathData I degree n => (uniformSpinPrior N : Measure (Spin N)))
(H := H) measurable_const hH
apply Measure.measurable_of_measurable_coe
intro s hs
have he (p : TensorPairPathData I degree n) :
(Measure.pi (fun j : Fin 2 => gibbsProbability (uniformSpinPrior N : Measure (Spin N))
(tensorSpinBaseEnergy eig U c I degree amplitude (tensorPairPathState I degree n p j)))) s =
βˆ‘' Οƒ : Fin 2 β†’ Spin N,
(∏ j : Fin 2, gibbsProbability (uniformSpinPrior N : Measure (Spin N))
(tensorSpinBaseEnergy eig U c I degree amplitude (tensorPairPathState I degree n p j)) {Οƒ j}) *
Measure.dirac Οƒ s := by
rw [← Measure.sum_smul_dirac (Measure.pi _), Measure.sum_apply _ hs]
simp only [Measure.smul_apply, smul_eq_mul, Measure.pi_singleton]
simp_rw [he]
apply Measurable.tsum
intro Οƒ
exact (Finset.measurable_prod _ fun j _ =>
(Measure.measurable_coe (measurableSet_singleton _)).comp (hΞ½ j)).mul_const _
def tensorPairPathSpinKernel {N m k : β„•}
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) : Kernel (TensorPairPathData I degree n) (Fin 2 β†’ Spin N) :=
⟨fun p => Measure.pi (fun j : Fin 2 =>
gibbsProbability (uniformSpinPrior N : Measure (Spin N))
(tensorSpinBaseEnergy eig U c I degree amplitude (tensorPairPathState I degree n p j))),
measurable_tensorPairSpinMeasures eig U c I degree amplitude n⟩
instance tensorPairPathSpinKernel_markov {N m k : β„•}
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) : IsMarkovKernel (tensorPairPathSpinKernel eig U c I degree amplitude n) :=
⟨fun _ => inferInstanceAs (IsProbabilityMeasure (Measure.pi _))⟩
def tensorPairPathSpinMean {N m k : β„•}
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) (p : TensorPairPathData I degree n) (D : (Fin 2 β†’ Spin N) β†’ ℝ) : ℝ :=
∫ Οƒ, D Οƒ βˆ‚tensorPairPathSpinKernel eig U c I degree amplitude n p
lemma measurable_tensorPairPathSpinMean {N m k : β„•}
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) (D : (Fin 2 β†’ Spin N) β†’ ℝ) :
Measurable (fun p => tensorPairPathSpinMean eig U c I degree amplitude n p D) := by
have hm : Measurable (fun p : TensorPairPathData I degree n Γ— (Fin 2 β†’ Spin N) => D p.2) :=
(measurable_of_countable D).comp measurable_snd
exact (hm.stronglyMeasurable.integral_kernel_prod_right'
(ΞΊ := tensorPairPathSpinKernel eig U c I degree amplitude n)).measurable
lemma tensorPairPathSpinMean_abs_le {N m k : β„•}
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) (p : TensorPairPathData I degree n) (D : (Fin 2 β†’ Spin N) β†’ ℝ)
{C : ℝ} (hD : βˆ€ Οƒ, |D Οƒ| ≀ C) :
|tensorPairPathSpinMean eig U c I degree amplitude n p D| ≀ C :=
abs_integral_le_const_of_bound (measurable_of_countable D) hD
def tensorPairSpinPathPayoff {N m k : β„•}
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) (ψ : β„• β†’ ℝ) (D : (Fin 2 β†’ Spin N) β†’ ℝ)
(p : (SpinTensorIndex I degree β†’ ℝ) Γ—
(β„• Γ— (Fin n β†’ (SpinTensorIndex I degree β†’ ℝ) Γ— (SpinTensorIndex I degree β†’ ℝ)))) : ℝ :=
ψ p.2.1 * tensorPairPathSpinMean eig U c I degree amplitude n (p.1, p.2.2) D
lemma measurable_tensorPairSpinPathPayoff {N m k : β„•}
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) (ψ : β„• β†’ ℝ) (D : (Fin 2 β†’ Spin N) β†’ ℝ) :
Measurable (tensorPairSpinPathPayoff eig U c I degree amplitude n ψ D) :=
((measurable_of_countable ψ).comp measurable_snd.fst).mul
((measurable_tensorPairPathSpinMean eig U c I degree amplitude n D).comp
(measurable_fst.prodMk measurable_snd.snd))
lemma tensorPairSpinPathPayoff_abs_le {N m k : β„•}
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) (ψ : β„• β†’ ℝ) (D : (Fin 2 β†’ Spin N) β†’ ℝ)
{B C : ℝ} (hB : 0 ≀ B) (hψ : βˆ€ d, |ψ d| ≀ B) (hD : βˆ€ Οƒ, |D Οƒ| ≀ C)
(p : (SpinTensorIndex I degree β†’ ℝ) Γ—
(β„• Γ— (Fin n β†’ (SpinTensorIndex I degree β†’ ℝ) Γ— (SpinTensorIndex I degree β†’ ℝ)))) :
|tensorPairSpinPathPayoff eig U c I degree amplitude n ψ D p| ≀ B * C := by
rw [tensorPairSpinPathPayoff, abs_mul]
exact mul_le_mul (hψ _) (tensorPairPathSpinMean_abs_le eig U c I degree amplitude n _ D hD)
(abs_nonneg _) hB
private lemma tensorPairPathState_edges {N m k : β„•}
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•)
(n : β„•) (z : SpinTensorIndex I degree β†’ ℝ) (p : TensorCoordinateData I degree n)
(Ξ± : Fin 2 β†’ LabeledLeaf n) (j : Fin 2) :
tensorPairPathState I degree n
(z, fun i => (p.2 (edgeAt n (Ξ± 0) i), p.2 (edgeAt n (Ξ± 1) i))) j =
labeledEnergy n (markForestOfCoords (SpinTensorIndex I degree β†’ ℝ) n p.2) (Ξ± j) z := by
funext a
rw [labeledEnergy_edge_sum]
fin_cases j <;> simp [tensorPairPathState, Pi.add_apply, Finset.sum_apply]
private lemma tensorPairPathSpinKernel_edges {N m k : β„•}
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) (z : SpinTensorIndex I degree β†’ ℝ) (p : TensorCoordinateData I degree n)
(Ξ± : Fin 2 β†’ LabeledLeaf n) :
tensorPairPathSpinKernel eig U c I degree amplitude n
(z, fun i => (p.2 (edgeAt n (Ξ± 0) i), p.2 (edgeAt n (Ξ± 1) i))) =
spinLeafPairResidualKernel (tensorLeafSpinHamiltonian eig U c I degree amplitude n z p) Ξ± := by
change Measure.pi _ = Measure.pi _
congr 1
funext j
rw [tensorPairPathState_edges]
rfl
def tensorSpinPairAverage {N m k : β„•}
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) (b : β„• β†’ ℝ) (v : β„• β†’ SpinTensorIndex I degree β†’ ℝβ‰₯0)
(z : SpinTensorIndex I degree β†’ ℝ) (ψ : β„• β†’ ℝ) (D : (Fin 2 β†’ Spin N) β†’ ℝ) : ℝ :=
∫ p : TensorCoordinateData I degree n,
referenceReplicaMean ((uniformSpinPrior N : Measure (Spin N)).prod (labeledLeafLaw n p.1))
(tensorLeafSpinHamiltonian eig U c I degree amplitude n z p)
(fun x : Fin 2 β†’ Spin N Γ— LabeledLeaf n =>
ψ (labeledCommonDepth n (x 0).2 (x 1).2) * D (fun j => (x j).1))
βˆ‚tensorCoordinateLaw I degree n b v
theorem tensorSpinPairAverage_eq_tiltedPath {N m k : β„•} (hN : 0 < N)
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) (b : β„• β†’ ℝ) (v : β„• β†’ SpinTensorIndex I degree β†’ ℝβ‰₯0)
(hb : CascadeExponents n b) (z : SpinTensorIndex I degree β†’ ℝ)
(ψ : β„• β†’ ℝ) (D : (Fin 2 β†’ Spin N) β†’ ℝ)
{B C : ℝ} (hB : 0 ≀ B) (hψ : βˆ€ d, |ψ d| ≀ B) (hD : βˆ€ Οƒ, |D Οƒ| ≀ C) :
tensorSpinPairAverage eig U c I degree amplitude n b v z ψ D =
tensorTiltedPairPathMean eig U c I degree amplitude n b v z
(fun q => tensorPairSpinPathPayoff eig U c I degree amplitude n ψ D (z, q)) := by
apply integral_congr_ae
filter_upwards [tensorLeafSpinPair_conditioning_ae hN eig U c I degree amplitude n b v hb z] with p hp
let D' := fun x : Fin 2 β†’ Spin N Γ— LabeledLeaf n =>
ψ (labeledCommonDepth n (x 0).2 (x 1).2) * D (fun j => (x j).1)
have hD' : βˆ€ x, |D' x| ≀ B * C := by
intro x
dsimp only [D']
rw [abs_mul]
exact mul_le_mul (hψ _) (hD _) (abs_nonneg _) hB
rw [hp D' ⟨B * C, hD'⟩]
congr 1
funext Ξ±
dsimp only [tensorPairSpinPathPayoff, tensorPairPathSpinMean]
rw [tensorPairPathSpinKernel_edges]
rw [← integral_const_mul]
rfl
/-- The actual spin/leaf pair expectation is a Markov ancestor-path
expectation conditional only on the precise published cascade input. -/
theorem tensorSpinPair_markov_identity (hpub : PanchenkoTalagrandTensorPairInput)
{N m k : β„•} (hN : 0 < N)
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) (b : β„• β†’ ℝ) (v : β„• β†’ SpinTensorIndex I degree β†’ ℝβ‰₯0)
(hb : CascadeExponents n b) (z : SpinTensorIndex I degree β†’ ℝ)
(ψ : β„• β†’ ℝ) (D : (Fin 2 β†’ Spin N) β†’ ℝ)
{B C : ℝ} (hB : 0 ≀ B) (hψ : βˆ€ d, |ψ d| ≀ B) (hD : βˆ€ Οƒ, |D Οƒ| ≀ C) :
tensorSpinPairAverage eig U c I degree amplitude n b v z ψ D =
∫ Ξ± : β„• β†’ LabeledLeaf n,
tensorAncestorPairPathMean eig U c I degree amplitude n b v
(labeledCommonDepth n (Ξ± 0) (Ξ± 1)) n 0 z z
(fun w => tensorPairSpinPathPayoff eig U c I degree amplitude n ψ D
(z, labeledCommonDepth n (Ξ± 0) (Ξ± 1), w))
βˆ‚cascadeReplicaLaw n b := by
rw [tensorSpinPairAverage_eq_tiltedPath hN eig U c I degree amplitude n b v hb z ψ D hB hψ hD]
apply hpub N m k hN eig U c I degree amplitude n b v hb z
· exact (measurable_tensorPairSpinPathPayoff eig U c I degree amplitude n ψ D).comp
(measurable_const.prodMk measurable_id)
· exact ⟨B * C, fun p => tensorPairSpinPathPayoff_abs_le eig U c I degree amplitude n ψ D hB hψ hD (z, p)⟩
theorem tensorProjectedOverlap_markov_identity (hpub : PanchenkoTalagrandTensorPairInput)
{N m k : β„•} (hN : 0 < N)
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) (b : β„• β†’ ℝ) (v : β„• β†’ SpinTensorIndex I degree β†’ ℝβ‰₯0)
(hb : CascadeExponents n b) (z : SpinTensorIndex I degree β†’ ℝ)
(J : Finset (Fin N)) (ψ : β„• β†’ ℝ) {B : ℝ} (hB : 0 ≀ B) (hψ : βˆ€ d, |ψ d| ≀ B) :
tensorSpinPairAverage eig U c I degree amplitude n b v z ψ
(fun Οƒ => projectedOverlap U J (Οƒ 0) (Οƒ 1)) =
∫ Ξ± : β„• β†’ LabeledLeaf n,
tensorAncestorPairPathMean eig U c I degree amplitude n b v
(labeledCommonDepth n (Ξ± 0) (Ξ± 1)) n 0 z z
(fun w => tensorPairSpinPathPayoff eig U c I degree amplitude n ψ
(fun Οƒ => projectedOverlap U J (Οƒ 0) (Οƒ 1))
(z, labeledCommonDepth n (Ξ± 0) (Ξ± 1), w))
βˆ‚cascadeReplicaLaw n b :=
tensorSpinPair_markov_identity hpub hN eig U c I degree amplitude n b v hb z ψ _ hB hψ
(fun Οƒ => projectedOverlap_abs_le_one U J (Οƒ 0) (Οƒ 1))
/-- The root Gaussian retains its original law and is averaged after the
conditional spin/ancestor-path identity. -/
theorem tensorRootedSpinPair_markov_identity (hpub : PanchenkoTalagrandTensorPairInput)
{N m k : β„•} (hN : 0 < N)
(eig : Fin N β†’ ℝ) (U : Rotation N) (c : Fin N β†’ ℝ)
(I : Fin m β†’ Finset (Fin N)) (degree : Fin k β†’ Fin m β†’ β„•) (amplitude : Fin k β†’ ℝ)
(n : β„•) (b : β„• β†’ ℝ) (v : β„• β†’ SpinTensorIndex I degree β†’ ℝβ‰₯0)
(hb : CascadeExponents n b) (ψ : β„• β†’ ℝ) (D : (Fin 2 β†’ Spin N) β†’ ℝ)
{B C : ℝ} (hB : 0 ≀ B) (hψ : βˆ€ d, |ψ d| ≀ B) (hD : βˆ€ Οƒ, |D Οƒ| ≀ C) :
(∫ z, tensorSpinPairAverage eig U c I degree amplitude n b (fun i => v (i + 1)) z ψ D
βˆ‚(tensorGaussianLaw I degree (v 0) : Measure (SpinTensorIndex I degree β†’ ℝ))) =
∫ z, ∫ Ξ± : β„• β†’ LabeledLeaf n,
tensorAncestorPairPathMean eig U c I degree amplitude n b (fun i => v (i + 1))
(labeledCommonDepth n (Ξ± 0) (Ξ± 1)) n 0 z z
(fun w => tensorPairSpinPathPayoff eig U c I degree amplitude n ψ D
(z, labeledCommonDepth n (Ξ± 0) (Ξ± 1), w))
βˆ‚cascadeReplicaLaw n b
βˆ‚(tensorGaussianLaw I degree (v 0) : Measure (SpinTensorIndex I degree β†’ ℝ)) := by
exact integral_congr_ae (ae_of_all _ fun z => tensorSpinPair_markov_identity hpub hN eig U c I degree
amplitude n b (fun i => v (i + 1)) hb z ψ D hB hψ hD)
end InvariantIsing
end
end OAI