Download data/lean/OAI/Probability/InvariantIsing/Arrays/NSpinTensorRetained.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 18.4 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/InvariantIsing/Arrays/NSpinTensorRetained.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/InvariantIsing/Arrays/NSpinTensorRetained.lean
-
curl -L -o NSpinTensorRetained.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/InvariantIsing/Arrays/NSpinTensorRetained.lean
18.4 kB
| import OAI.Probability.InvariantIsing.Arrays.NSpinTensorLabeled | |
| import OAI.Probability.InvariantIsing.Fields.CascadeTilt | |
| namespace OAI | |
| /-! The actual finite tensor terminal induces ancestor-dependent retained mark transitions. -/ | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory IsingPerceptron | |
| open scoped BigOperators NNReal ENNReal | |
| namespace InvariantIsing | |
| def tensorCascadeBackward {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) (i : β) : | |
| (SpinTensorIndex I degree β β) β β := | |
| backwardValue n b (fun j => tensorGaussianLaw I degree (v j)) (fun _ p => p.1 + p.2) | |
| (spinTensorTerminal eig U c I degree amplitude) i | |
| def tensorCascadeStopped {N m k : β} (I : Fin m β Finset (Fin N)) | |
| (degree : Fin k β Fin m β β) (n : β) : | |
| β β ((SpinTensorIndex I degree β β) Γ (SpinTensorIndex I degree β β)) β | |
| (SpinTensorIndex I degree β β) := stoppedUpdate n (fun _ p => p.1 + p.2) | |
| def tensorCascadeMultiplier {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) (i : β) | |
| (p : (SpinTensorIndex I degree β β) Γ (SpinTensorIndex I degree β β)) : β := | |
| Real.exp (tensorCascadeBackward eig U c I degree amplitude n b v (i + 1) | |
| (tensorCascadeStopped I degree n i p) - | |
| tensorCascadeBackward eig U c I degree amplitude n b v i p.1) | |
| lemma measurable_tensorCascadeBackward {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) (i : β) : | |
| Measurable (tensorCascadeBackward eig U c I degree amplitude n b v i) := | |
| measurable_backwardValue n b (fun j => tensorGaussianLaw I degree (v j)) | |
| (fun _ => measurable_fst.add measurable_snd) | |
| (measurable_spinTensorTerminal eig U c I degree amplitude) i | |
| lemma measurable_tensorCascadeStopped {N m k : β} (I : Fin m β Finset (Fin N)) | |
| (degree : Fin k β Fin m β β) (n i : β) : | |
| Measurable (tensorCascadeStopped I degree n i) := | |
| measurable_stoppedUpdate n (fun _ => measurable_fst.add measurable_snd) i | |
| lemma measurable_tensorCascadeMultiplier {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) (i : β) : | |
| Measurable (tensorCascadeMultiplier eig U c I degree amplitude n b v i) := | |
| (((measurable_tensorCascadeBackward eig U c I degree amplitude n b v (i + 1)).comp | |
| (measurable_tensorCascadeStopped I degree n i)).sub | |
| ((measurable_tensorCascadeBackward eig U c I degree amplitude n b v i).comp measurable_fst)).exp | |
| lemma tensorCascadeMultiplier_pos {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) (i : β) | |
| (z a : SpinTensorIndex I degree β β) : | |
| 0 < tensorCascadeMultiplier eig U c I degree amplitude n b v i (z, a) := Real.exp_pos _ | |
| /-- Each transition is normalized at its own cascade exponent, for every | |
| ancestor state. The terminal is the actual finite Ising log partition. -/ | |
| lemma tensorCascadeMultiplier_moment {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) (i : β) (z : SpinTensorIndex I degree β β) : | |
| (β«β» a, ENNReal.ofReal (tensorCascadeMultiplier eig U c I degree amplitude n b v i (z, a) ^ b i) | |
| β(tensorGaussianLaw I degree (v i) : Measure (SpinTensorIndex I degree β β))) = 1 := by | |
| have hadm := backwardValue_linearGrowth_moments n b | |
| (fun j => tensorGaussianLaw I degree (v j)) | |
| (fun j _ => tensorGaussianLaw_moments hN I degree (v j)) | |
| (measurable_spinTensorTerminal eig U c I degree amplitude) | |
| (spinTensorTerminal_linearGrowth eig U c I degree amplitude) (fun j hj => (hb.1 j hj).1) | |
| exact backwardValue_multiplier_moment_admissible n b | |
| (fun j => tensorGaussianLaw I degree (v j)) (fun _ p => p.1 + p.2) | |
| (spinTensorTerminal eig U c I degree amplitude) (fun j hj => (hb.1 j hj).1) hadm i z | |
| private lemma measurable_tensorAncestorMarkMeasure {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) (i : β) : | |
| Measurable (fun z => (tensorGaussianLaw I degree (v i) : Measure (SpinTensorIndex I degree β β)).withDensity | |
| (fun a => ENNReal.ofReal (tensorCascadeMultiplier eig U c I degree amplitude n b v i (z, a) ^ b i))) := by | |
| let Ξ½ := fun _ : SpinTensorIndex I degree β β => | |
| (tensorGaussianLaw I degree (v i) : Measure (SpinTensorIndex I degree β β)) | |
| let W := fun p : (SpinTensorIndex I degree β β) Γ (SpinTensorIndex I degree β β) => | |
| ENNReal.ofReal (tensorCascadeMultiplier eig U c I degree amplitude n b v i p ^ b i) | |
| have hW : Measurable W := | |
| ((measurable_tensorCascadeMultiplier eig U c I degree amplitude n b v i).pow_const (b i)).ennreal_ofReal | |
| exact measurable_random_withDensity (Ξ½ := Ξ½) (W := W) measurable_const hW | |
| /-- The ancestor-dependent mark transition, with density `c_i(z,a)^b_i`. -/ | |
| def tensorAncestorMarkKernel {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) (i : β) : | |
| Kernel (SpinTensorIndex I degree β β) (SpinTensorIndex I degree β β) := | |
| β¨fun z => (tensorGaussianLaw I degree (v i) : Measure (SpinTensorIndex I degree β β)).withDensity | |
| (fun a => ENNReal.ofReal (tensorCascadeMultiplier eig U c I degree amplitude n b v i (z, a) ^ b i)), | |
| measurable_tensorAncestorMarkMeasure eig U c I degree amplitude n b v iβ© | |
| theorem tensorAncestorMarkKernel_markov {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) (i : β) : | |
| IsMarkovKernel (tensorAncestorMarkKernel eig U c I degree amplitude n b v i) := by | |
| constructor | |
| intro z | |
| constructor | |
| change ((tensorGaussianLaw I degree (v i) : Measure (SpinTensorIndex I degree β β)).withDensity | |
| (fun a => ENNReal.ofReal (tensorCascadeMultiplier eig U c I degree amplitude n b v i (z, a) ^ b i))) Set.univ = 1 | |
| rw [withDensity_apply _ MeasurableSet.univ, setLIntegral_univ] | |
| exact tensorCascadeMultiplier_moment hN eig U c I degree amplitude n b v hb i z | |
| lemma tensorAncestorMarkKernel_density {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) | |
| (i : β) (hi : i < n) (z : SpinTensorIndex I degree β β) : | |
| tensorAncestorMarkKernel eig U c I degree amplitude n b v i z = | |
| (tensorGaussianLaw I degree (v i) : Measure (SpinTensorIndex I degree β β)).withDensity | |
| (fun a => ENNReal.ofReal (Real.exp (b i * | |
| (tensorCascadeBackward eig U c I degree amplitude n b v (i + 1) (z + a) - | |
| tensorCascadeBackward eig U c I degree amplitude n b v i z)))) := by | |
| change Measure.withDensity _ _ = _ | |
| congr 1 | |
| funext a | |
| simp only [tensorCascadeMultiplier, tensorCascadeStopped, stoppedUpdate, hi, ite_true, β Real.exp_mul] | |
| rw [mul_comm] | |
| def tensorRetainedCascade {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 β β) : | |
| NoiseTree (SpinTensorIndex I degree β β) n β NoiseTree (SpinTensorIndex I degree β β) n := | |
| noiseTreeKeep n b (fun i => tensorGaussianLaw I degree (v i)) | |
| (tensorCascadeMultiplier eig U c I degree amplitude n b v) (tensorCascadeStopped I degree n) z | |
| lemma measurable_tensorRetainedCascade {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 β β) : | |
| Measurable (tensorRetainedCascade eig U c I degree amplitude n b v z) := | |
| (measurable_noiseTreeKeep n b (fun i => tensorGaussianLaw I degree (v i)) | |
| (measurable_tensorCascadeMultiplier eig U c I degree amplitude n b v) | |
| (measurable_tensorCascadeStopped I degree n)).comp (measurable_const.prodMk measurable_id) | |
| /-- Forgetting the retained marks gives exactly the original raw cascade law. -/ | |
| theorem tensorRetainedCascade_forget_law {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 β β) : | |
| (tensorCascadeLaw I degree n b v).map | |
| (fun T => noiseTreeForget (SpinTensorIndex I degree β β) n | |
| (tensorRetainedCascade eig U c I degree amplitude n b v z T)) = rawCascadeLaw n b := by | |
| have he : (fun T => noiseTreeForget (SpinTensorIndex I degree β β) n | |
| (tensorRetainedCascade eig U c I degree amplitude n b v z T)) = | |
| noiseTreeDisplace n b (fun i => tensorGaussianLaw I degree (v i)) | |
| (tensorCascadeMultiplier eig U c I degree amplitude n b v) (tensorCascadeStopped I degree n) z := by | |
| funext T | |
| exact noiseTreeKeep_forget n b (fun i => tensorGaussianLaw I degree (v i)) | |
| (measurable_tensorCascadeMultiplier eig U c I degree amplitude n b v) | |
| (measurable_tensorCascadeStopped I degree n) z T | |
| rw [he] | |
| exact noiseTreeDisplace_law n b (fun i => tensorGaussianLaw I degree (v i)) | |
| (measurable_tensorCascadeMultiplier eig U c I degree amplitude n b v) | |
| (measurable_tensorCascadeStopped I degree n) | |
| (tensorCascadeMultiplier_pos eig U c I degree amplitude n b v) | |
| (tensorCascadeMultiplier_moment hN eig U c I degree amplitude n b v hb) z | |
| /-- The retained tree has the actual ancestor-dependent root mark kernel. | |
| The descendant is transformed at the updated ancestor state; it is not | |
| replaced by an independent level tilt. -/ | |
| theorem tensorRetainedCascade_law_succ {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 + 1) b) (z : SpinTensorIndex I degree β β) : | |
| letI := tensorAncestorMarkKernel_markov hN eig U c I degree amplitude (n + 1) b v hb 0 | |
| let ΞΌ := fun i => tensorGaussianLaw I degree (v i) | |
| let ct := tensorCascadeMultiplier eig U c I degree amplitude (n + 1) b v | |
| let ut := tensorCascadeStopped I degree (n + 1) | |
| let P := (noiseCascadeLaw (SpinTensorIndex I degree β β) n | |
| (fun i => b (i + 1)) (fun i => ΞΌ (i + 1)) : Measure (NoiseTree (SpinTensorIndex I degree β β) n)) | |
| let G := fun p : (SpinTensorIndex I degree β β) Γ NoiseTree (SpinTensorIndex I degree β β) n => | |
| (p.1, noiseTreeKeep n (fun i => b (i + 1)) (fun i => ΞΌ (i + 1)) | |
| (fun i => ct (i + 1)) (fun i => ut (i + 1)) (ut 0 (z, p.1)) p.2) | |
| (tensorCascadeLaw I degree (n + 1) b v).map | |
| (tensorRetainedCascade eig U c I degree amplitude (n + 1) b v z) = | |
| poissonLaw ((powerIntensity (b 0)).prod | |
| (((tensorAncestorMarkKernel eig U c I degree amplitude (n + 1) b v 0 z).prod P).map G)) := by | |
| let := tensorAncestorMarkKernel_markov hN eig U c I degree amplitude (n + 1) b v hb 0 | |
| intro ΞΌ ct ut P G | |
| have h := noiseTreeKeep_law_succ n b ΞΌ | |
| (measurable_tensorCascadeMultiplier eig U c I degree amplitude (n + 1) b v) | |
| (measurable_tensorCascadeStopped I degree (n + 1)) | |
| (tensorCascadeMultiplier_pos eig U c I degree amplitude (n + 1) b v) z | |
| have hd : Measurable (fun a : SpinTensorIndex I degree β β => ENNReal.ofReal (ct 0 (z, a) ^ b 0)) := | |
| (((measurable_tensorCascadeMultiplier eig U c I degree amplitude (n + 1) b v 0).comp | |
| (measurable_const.prodMk measurable_id)).pow_const (b 0)).ennreal_ofReal | |
| change (tensorCascadeLaw I degree (n + 1) b v).map | |
| (tensorRetainedCascade eig U c I degree amplitude (n + 1) b v z) = | |
| poissonLaw ((powerIntensity (b 0)).prod | |
| ((((ΞΌ 0 : Measure (SpinTensorIndex I degree β β)).withDensity | |
| (fun a => ENNReal.ofReal (ct 0 (z, a) ^ b 0))).prod P).map G)) | |
| apply h.trans | |
| apply poissonLaw_congr | |
| exact congrArg (fun Q => (powerIntensity (b 0)).prod (Q.map G)) | |
| (prod_withDensity_left (Ξ½ := P) hd).symm | |
| private lemma tensorLeafTerminal_last {N m k : β} | |
| (I : Fin m β Finset (Fin N)) (degree : Fin k β Fin m β β) | |
| (n : β) (X : β β (SpinTensorIndex I degree β β) β β) | |
| (u : β β ((SpinTensorIndex I degree β β) Γ (SpinTensorIndex I degree β β)) β | |
| (SpinTensorIndex I degree β β)) (F : (SpinTensorIndex I degree β β) β β) | |
| (hX : X n = F) (hu : β i < n, u i = fun p => p.1 + p.2) | |
| (z : SpinTensorIndex I degree β β) (leaf : NoiseLeaf (SpinTensorIndex I degree β β) n) : | |
| noiseLeafTerminal n X u z leaf = F (tensorLeafState I degree n z leaf) := by | |
| induction n generalizing X u z with | |
| | zero => simpa only [noiseLeafTerminal, tensorLeafState] using congrFun hX z | |
| | succ n ih => | |
| rw [noiseLeafTerminal, hu 0 (by omega)] | |
| exact ih (fun i => X (i + 1)) (fun i => u (i + 1)) | |
| (by simpa only [Nat.add_comm] using hX) (fun i hi => hu (i + 1) (by omega)) | |
| (z + leaf.2.1) leaf.2.2 | |
| def tensorTerminalLeafLaw {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 β β) (T : NoiseTree (SpinTensorIndex I degree β β) n) : | |
| Measure (NoiseLeaf (SpinTensorIndex I degree β β) n) := | |
| normalizeMass ((noiseLeafKernel (SpinTensorIndex I degree β β) n T).withDensity | |
| (fun leaf => ENNReal.ofReal (Real.exp | |
| (spinTensorTerminal eig U c I degree amplitude (tensorLeafState I degree n z leaf))))) | |
| lemma tensorTerminalLeafLaw_eq_backward {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 β β) (T : NoiseTree (SpinTensorIndex I degree β β) n) : | |
| tensorTerminalLeafLaw eig U c I degree amplitude n z T = | |
| noiseTerminalGibbsLaw n (tensorCascadeBackward eig U c I degree amplitude n b v) | |
| (tensorCascadeStopped I degree n) z T := by | |
| have hX : tensorCascadeBackward eig U c I degree amplitude n b v n = | |
| spinTensorTerminal eig U c I degree amplitude := | |
| backwardValue_terminal n b (fun i => tensorGaussianLaw I degree (v i)) | |
| (fun _ p => p.1 + p.2) (spinTensorTerminal eig U c I degree amplitude) (le_refl n) | |
| have hu : β i < n, tensorCascadeStopped I degree n i = fun p => p.1 + p.2 := by | |
| intro i hi | |
| funext p | |
| simp only [tensorCascadeStopped, stoppedUpdate, hi, ite_true] | |
| unfold tensorTerminalLeafLaw noiseTerminalGibbsLaw | |
| congr 2 | |
| funext leaf | |
| rw [tensorLeafTerminal_last I degree n _ _ _ hX hu] | |
| /-- Sampling after the actual terminal tilt is transported to ordinary | |
| sampling from the retained marked tree, with every mark kept. -/ | |
| theorem tensorTerminalLeafLaw_keep_ae {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 β β) : | |
| βα΅ T βtensorCascadeLaw I degree n b v, | |
| (tensorTerminalLeafLaw eig U c I degree amplitude n z T).map | |
| (noiseLeafKeep n (tensorCascadeMultiplier eig U c I degree amplitude n b v) | |
| (tensorCascadeStopped I degree n) z) = | |
| noiseLeafKernel (SpinTensorIndex I degree β β) n | |
| (tensorRetainedCascade eig U c I degree amplitude n b v z T) := by | |
| have hr := noiseGibbsRegular_ae n b hb (fun i => tensorGaussianLaw I degree (v i)) | |
| (measurable_tensorCascadeMultiplier eig U c I degree amplitude n b v) | |
| (measurable_tensorCascadeStopped I degree n) | |
| (tensorCascadeMultiplier_pos eig U c I degree amplitude n b v) | |
| (tensorCascadeMultiplier_moment hN eig U c I degree amplitude n b v hb) z | |
| filter_upwards [hr] with T hT | |
| rw [tensorTerminalLeafLaw_eq_backward eig U c I degree amplitude n b v] | |
| exact noiseTerminalGibbsLaw_keep n b (fun i => tensorGaussianLaw I degree (v i)) | |
| (measurable_tensorCascadeBackward eig U c I degree amplitude n b v) | |
| (measurable_tensorCascadeStopped I degree n) z T hT | |
| end InvariantIsing | |
| end | |
| end OAI | |