Buckets:
| import OAI.Probability.InvariantIsing.Arrays.TensorLeafCoefficients | |
| namespace OAI | |
| /-! The manuscript's linear enrichment and monomial tree variance increments. -/ | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory IsingPerceptron | |
| open scoped BigOperators NNReal | |
| namespace InvariantIsing | |
| def varianceIncrement (q : ℕ → ℝ) (i : ℕ) : ℝ≥0 := (pathIncrement q i).toNNReal | |
| lemma varianceIncrement_coe {q : ℕ → ℝ} (hq : Monotone q) (h0 : 0 ≤ q 0) (i : ℕ) : | |
| (varianceIncrement q i : ℝ) = pathIncrement q i := | |
| Real.coe_toNNReal _ (pathIncrement_nonneg hq h0 i) | |
| lemma varianceIncrement_sum {q : ℕ → ℝ} (hq : Monotone q) (h0 : 0 ≤ q 0) (n : ℕ) : | |
| (∑ i : Fin (n + 1), (varianceIncrement q i : ℝ)) = q n := by | |
| simp_rw [varianceIncrement_coe hq h0] | |
| rw [Fin.sum_univ_eq_sum_range, pathIncrement_sum] | |
| /-- The root has variance `h 0`; each child adds the next field increment. | |
| For a tree monomial of degree zero the entire variance is at the root. -/ | |
| def tensorPathProfile {N m k : ℕ} (I : Fin m → Finset (Fin N)) | |
| (degree : Fin k → Fin m → ℕ) (n : ℕ) (treeDegree : Fin k → ℕ) | |
| (h : ℕ → ℝ) (i : ℕ) : SpinTensorIndex I degree → ℝ≥0 := | |
| tensorVarianceProfile I degree (varianceIncrement h i) | |
| (fun j => varianceIncrement (monomialPath n (treeDegree j)) i) | |
| private lemma prefixPath_weighted_sum (q : ℕ → ℝ) (n d : ℕ) (hd : d ≤ n) (c : ℝ) : | |
| (∑ i : Fin (n + 1), if i.1 ≤ d then pathIncrement q i * c else 0) = q d * c := by | |
| calc | |
| _ = (∑ i : Fin (n + 1), if i.1 ≤ d then pathIncrement q i else 0) * c := by | |
| rw [Finset.sum_mul] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| split_ifs <;> simp | |
| _ = _ := by rw [pathIncrement_prefix q n d hd] | |
| private lemma prefixPath_linear_monomials {k : ℕ} (h : ℕ → ℝ) | |
| (q : Fin k → ℕ → ℝ) (n d : ℕ) (hd : d ≤ n) (a : ℝ) (b : Fin k → ℝ) : | |
| (∑ i : Fin (n + 1), if i.1 ≤ d then | |
| pathIncrement h i * a + ∑ j, pathIncrement (q j) i * b j else 0) = | |
| h d * a + ∑ j, q j d * b j := by | |
| calc | |
| _ = (∑ i : Fin (n + 1), ((if i.1 ≤ d then pathIncrement h i * a else 0) + | |
| ∑ j, if i.1 ≤ d then pathIncrement (q j) i * b j else 0)) := by | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| split_ifs <;> simp | |
| _ = _ := by | |
| rw [Finset.sum_add_distrib, prefixPath_weighted_sum h n d hd a, Finset.sum_comm] | |
| congr 1 | |
| apply Finset.sum_congr rfl | |
| intro j _ | |
| exact prefixPath_weighted_sum (q j) n d hd (b j) | |
| /-- The tensor mark model with these increments has exactly the paper's | |
| linear field covariance plus the displayed joint spectral/tree monomials. -/ | |
| theorem tensorPathProfile_covariance {N m k : ℕ} (U : Rotation N) | |
| (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) | |
| (n : ℕ) (treeDegree : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) | |
| (x y : Spin N × LabeledLeaf n) : | |
| cylinderCross (tensorLeafCoefficients U I degree amplitude n | |
| (fun i => tensorPathProfile I degree n treeDegree h i) x) | |
| (tensorLeafCoefficients U I degree amplitude n | |
| (fun i => tensorPathProfile I degree n treeDegree h i) y) = | |
| h (labeledCommonDepth n x.2 y.2) * (∑ a, spinValue (x.1 a) * spinValue (y.1 a)) + | |
| ∑ j, amplitude j ^ 2 * (∏ a, projectedOverlap U (I a) x.1 y.1 ^ degree j a) * | |
| treeOverlap n x.2 y.2 ^ treeDegree j := by | |
| rw [tensorLeafCoefficients_cross] | |
| simp_rw [tensorPathProfile, spinTensorFeature_covariance, varianceIncrement_coe hh h0, | |
| varianceIncrement_coe (monomialPath_monotone n _) (monomialPath_nonneg n _ 0)] | |
| have he := prefixPath_linear_monomials h (fun j => monomialPath n (treeDegree j)) n | |
| (labeledCommonDepth n x.2 y.2) (labeledCommonDepth_le n x.2 y.2) | |
| (∑ a, spinValue (x.1 a) * spinValue (y.1 a)) | |
| (fun j => amplitude j ^ 2 * ∏ a, projectedOverlap U (I a) x.1 y.1 ^ degree j a) | |
| simp_rw [mul_assoc] at he ⊢ | |
| rw [he] | |
| congr 1 | |
| apply Finset.sum_congr rfl | |
| intro j _ | |
| simp only [monomialPath, treeOverlap] | |
| ring | |
| lemma monomialVarianceIncrement_sum_le (n : ℕ) (r : ℕ) : | |
| (∑ i : Fin (n + 1), (varianceIncrement (monomialPath n r) i : ℝ)) ≤ 1 := by | |
| rw [varianceIncrement_sum (monomialPath_monotone n r) (monomialPath_nonneg n r 0)] | |
| exact monomialPath_diag_le_one n r | |
| lemma tensorPathProfile_variance_cap {N m k : ℕ} (U : Rotation N) | |
| (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) | |
| (n : ℕ) (treeDegree : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) | |
| (x : Spin N × LabeledLeaf n) : | |
| (tensorLeafCoefficients U I degree amplitude n | |
| (fun i => tensorPathProfile I degree n treeDegree h i) x).sum (fun _ c => c ^ 2) ≤ | |
| h n * N + ∑ j, amplitude j ^ 2 := by | |
| have hc := tensorLeafCoefficients_variance_le U I degree amplitude n | |
| (fun i => varianceIncrement h i) | |
| (fun i j => varianceIncrement (monomialPath n (treeDegree j)) i) x | |
| refine hc.trans ?_ | |
| rw [Finset.sum_add_distrib, ← Finset.sum_mul, varianceIncrement_sum hh h0, | |
| Finset.sum_comm] | |
| apply add_le_add le_rfl | |
| apply Finset.sum_le_sum | |
| intro j _ | |
| rw [← Finset.sum_mul] | |
| exact (mul_le_mul_of_nonneg_right (monomialVarianceIncrement_sum_le n (treeDegree j)) | |
| (sq_nonneg (amplitude j))).trans_eq (one_mul _) | |
| /-- The sum over all tree levels contributes no extra factor of depth | |
| to the Gaussian rotation modulus. -/ | |
| lemma tensorPathProfile_rotation_cap {m k : ℕ} (degree : Fin k → Fin m → ℕ) | |
| (amplitude : Fin k → ℝ) (n : ℕ) (treeDegree : Fin k → ℕ) : | |
| (∑ i : Fin (n + 1), ∑ j, (varianceIncrement (monomialPath n (treeDegree j)) i : ℝ) * | |
| amplitude j ^ 2 * ∑ a, (degree j a : ℝ)) ≤ | |
| ∑ j, amplitude j ^ 2 * ∑ a, (degree j a : ℝ) := by | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_le_sum | |
| intro j _ | |
| simp_rw [mul_assoc] | |
| rw [← Finset.sum_mul] | |
| exact (mul_le_mul_of_nonneg_right (monomialVarianceIncrement_sum_le n (treeDegree j)) | |
| (mul_nonneg (sq_nonneg _) (Finset.sum_nonneg fun _ _ => Nat.cast_nonneg _))).trans_eq (one_mul _) | |
| end InvariantIsing | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 6.23 kB
- Xet hash:
- dbebd53838ece1598832e4f6794ca0cbc08cc321781460bb2b7c73456724c087
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.