Add lean source and binary files (part 7)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- lean/OAI/Algebra/DepthFive/FourPathTrace.lean +164 -0
- lean/OAI/Algebra/DepthFive/FractionRounding.lean +119 -0
- lean/OAI/Algebra/DepthFive/GateCardinality.lean +33 -0
- lean/OAI/Algebra/DepthFive/GateSums.lean +108 -0
- lean/OAI/Algebra/DepthFive/HighDegreeWeights.lean +143 -0
- lean/OAI/Algebra/DepthFive/Homogeneity.lean +86 -0
- lean/OAI/Algebra/DepthFive/HomogeneousSpaceDimension.lean +62 -0
- lean/OAI/Algebra/DepthFive/ImmBidegree.lean +46 -0
- lean/OAI/Algebra/DepthFive/ImmBlocks.lean +48 -0
- lean/OAI/Algebra/DepthFive/ImmCompatibleTrace.lean +62 -0
- lean/OAI/Algebra/DepthFive/ImmDegree.lean +166 -0
- lean/OAI/Algebra/DepthFive/ImmFiniteMatrix.lean +190 -0
- lean/OAI/Algebra/DepthFive/ImmFirstMomentBound.lean +59 -0
- lean/OAI/Algebra/DepthFive/ImmFirstMomentParameters.lean +64 -0
- lean/OAI/Algebra/DepthFive/ImmFirstTrace.lean +129 -0
- lean/OAI/Algebra/DepthFive/ImmFockMatrix.lean +161 -0
- lean/OAI/Algebra/DepthFive/ImmMap.lean +34 -0
- lean/OAI/Algebra/DepthFive/ImmOperatorPaths.lean +190 -0
- lean/OAI/Algebra/DepthFive/ImmPairingCompatibility.lean +50 -0
- lean/OAI/Algebra/DepthFive/ImmPairingReindex.lean +61 -0
- lean/OAI/Algebra/DepthFive/ImmPathCompatibility.lean +51 -0
- lean/OAI/Algebra/DepthFive/ImmPathShifts.lean +73 -0
- lean/OAI/Algebra/DepthFive/ImmProfileCompatibility.lean +38 -0
- lean/OAI/Algebra/DepthFive/ImmSecondLocalBound.lean +49 -0
- lean/OAI/Algebra/DepthFive/ImmSecondMomentParameters.lean +79 -0
- lean/OAI/Algebra/DepthFive/ImmSecondTrace.lean +184 -0
- lean/OAI/Algebra/DepthFive/IndependentCoordinates.lean +322 -0
- lean/OAI/Algebra/DepthFive/IndexedCircuit.lean +99 -0
- lean/OAI/Algebra/DepthFive/IndexedCircuitValue.lean +86 -0
- lean/OAI/Algebra/DepthFive/Infrastructure.lean +13 -0
- lean/OAI/Algebra/DepthFive/IntegerRank.lean +89 -0
- lean/OAI/Algebra/DepthFive/IntermediateDimension.lean +141 -0
- lean/OAI/Algebra/DepthFive/IntermediateFactorization.lean +176 -0
- lean/OAI/Algebra/DepthFive/InvalidOccupation.lean +80 -0
- lean/OAI/Algebra/DepthFive/IsolatedFlip.lean +257 -0
- lean/OAI/Algebra/DepthFive/IsolatedWeight.lean +380 -0
- lean/OAI/Algebra/DepthFive/IteratedDerivative.lean +56 -0
- lean/OAI/Algebra/DepthFive/LayeredFourPath.lean +114 -0
- lean/OAI/Algebra/DepthFive/LocalFactorialExpansion.lean +124 -0
- lean/OAI/Algebra/DepthFive/LocalMomentPairing.lean +75 -0
- lean/OAI/Algebra/DepthFive/LocalMomentPolynomials.lean +174 -0
- lean/OAI/Algebra/DepthFive/LocalMomentWeights.lean +107 -0
- lean/OAI/Algebra/DepthFive/LocalOccupationAverage.lean +122 -0
- lean/OAI/Algebra/DepthFive/LocalProductAverage.lean +104 -0
- lean/OAI/Algebra/DepthFive/LowDegreeWeights.lean +123 -0
- lean/OAI/Algebra/DepthFive/LowerAsymptotics.lean +80 -0
- lean/OAI/Algebra/DepthFive/LowerBoundAssembly.lean +67 -0
- lean/OAI/Algebra/DepthFive/LowerCircuit.lean +8 -0
- lean/OAI/Algebra/DepthFive/LowerInfrastructure.lean +16 -0
- lean/OAI/Algebra/DepthFive/LowerMoments.lean +18 -0
lean/OAI/Algebra/DepthFive/FourPathTrace.lean
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.TraceComplexification
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
/-! Elimination of the second source index in the four-path trace formula. -/
|
| 6 |
+
|
| 7 |
+
noncomputable section
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
|
| 10 |
+
namespace Problem335
|
| 11 |
+
|
| 12 |
+
variable {I P G : Type*} [Fintype I] [AddCommGroup G] [DecidableEq G]
|
| 13 |
+
|
| 14 |
+
/-- Extending finite source weights by zero gives the unique weight at a
|
| 15 |
+
specified occupation vector; this lemma also handles invalid occupations. -/
|
| 16 |
+
theorem sum_source_eq_zeroExtend {I : Type u_1} {G : Type u_3}
|
| 17 |
+
[Fintype I] [AddCommGroup G] [DecidableEq G] (occupation : I → G)
|
| 18 |
+
(hinj : Function.Injective occupation) (weight : I → ℝ) (x : G) :
|
| 19 |
+
(∑ k, if occupation k = x then weight k else 0) =
|
| 20 |
+
Function.extend occupation weight (fun _ => 0) x := by
|
| 21 |
+
classical
|
| 22 |
+
by_cases hx : ∃ k, occupation k = x
|
| 23 |
+
· obtain ⟨k, rfl⟩ := hx
|
| 24 |
+
rw [hinj.extend_apply]
|
| 25 |
+
simp [hinj.eq_iff]
|
| 26 |
+
· rw [Function.extend_apply' _ _ _ hx]
|
| 27 |
+
apply Finset.sum_eq_zero
|
| 28 |
+
intro k hk
|
| 29 |
+
simp [show occupation k ≠ x from fun h => hx ⟨k, h⟩]
|
| 30 |
+
|
| 31 |
+
/-- The second source in a compatible four-path term is uniquely determined.
|
| 32 |
+
The zero extension records absent (invalid) source occupations exactly. -/
|
| 33 |
+
theorem fourPath_eliminate_source (occupation : I → G)
|
| 34 |
+
(hinj : Function.Injective occupation) (wq ws : I → ℝ)
|
| 35 |
+
(M ep eq er es : G) (A C : ℝ) :
|
| 36 |
+
(∑ k, if M + ep = occupation k + eq ∧ M + er = occupation k + es then
|
| 37 |
+
A * wq k * C * ws k else 0) =
|
| 38 |
+
if ep - eq = er - es then
|
| 39 |
+
A * Function.extend occupation wq (fun _ => 0) (M + ep - eq) * C *
|
| 40 |
+
Function.extend occupation ws (fun _ => 0) (M + ep - eq)
|
| 41 |
+
else 0 := by
|
| 42 |
+
classical
|
| 43 |
+
let x := M + ep - eq
|
| 44 |
+
have hfirst (k : I) : M + ep = occupation k + eq ↔ occupation k = x := by
|
| 45 |
+
dsimp [x]
|
| 46 |
+
constructor
|
| 47 |
+
· intro h
|
| 48 |
+
exact (eq_sub_iff_add_eq).2 h.symm
|
| 49 |
+
· intro h
|
| 50 |
+
exact ((eq_sub_iff_add_eq).1 h).symm
|
| 51 |
+
have hsecond : M + er = x + es ↔ ep - eq = er - es := by
|
| 52 |
+
have hx : x + es = M + ((ep - eq) + es) := by dsimp [x]; abel
|
| 53 |
+
rw [hx, add_left_cancel_iff, eq_comm, ← eq_sub_iff_add_eq]
|
| 54 |
+
by_cases hx : ∃ k, occupation k = x
|
| 55 |
+
· obtain ⟨k, hk⟩ := hx
|
| 56 |
+
have heq (l : I) : M + ep = occupation l + eq ↔ l = k := by
|
| 57 |
+
rw [hfirst, ← hk, hinj.eq_iff]
|
| 58 |
+
have hsec : M + er = occupation k + es ↔ ep - eq = er - es := by
|
| 59 |
+
rw [hk]
|
| 60 |
+
exact hsecond
|
| 61 |
+
change _ = if ep - eq = er - es then
|
| 62 |
+
A * Function.extend occupation wq (fun _ => 0) x * C *
|
| 63 |
+
Function.extend occupation ws (fun _ => 0) x else 0
|
| 64 |
+
rw [← hk, hinj.extend_apply, hinj.extend_apply]
|
| 65 |
+
rw [Finset.sum_eq_single k]
|
| 66 |
+
· simp [heq, hsec]
|
| 67 |
+
· intro l hl hlk
|
| 68 |
+
simp [heq, hlk]
|
| 69 |
+
· simp
|
| 70 |
+
· have hzq := Function.extend_apply' (f := occupation) wq (fun _ => (0 : ℝ)) x hx
|
| 71 |
+
change _ = if ep - eq = er - es then
|
| 72 |
+
A * Function.extend occupation wq (fun _ => 0) x * C *
|
| 73 |
+
Function.extend occupation ws (fun _ => 0) x else 0
|
| 74 |
+
rw [hzq]
|
| 75 |
+
simp only [mul_zero, zero_mul, ite_self]
|
| 76 |
+
apply Finset.sum_eq_zero
|
| 77 |
+
intro k hk
|
| 78 |
+
have hne : occupation k ≠ x := fun h => hx ⟨k, h⟩
|
| 79 |
+
simp [hfirst, hne]
|
| 80 |
+
|
| 81 |
+
/-- The full four-path sum with the second source eliminated and invalid
|
| 82 |
+
source occupations retained through zero extension. -/
|
| 83 |
+
theorem fourPath_sum_eliminate_source [Fintype P]
|
| 84 |
+
(occupation : I → G) (hinj : Function.Injective occupation)
|
| 85 |
+
(eps : P → G) (weight : I → P → ℝ) :
|
| 86 |
+
(∑ i, ∑ k, ∑ p, ∑ q, ∑ r, ∑ s,
|
| 87 |
+
if occupation i + eps p = occupation k + eps q ∧
|
| 88 |
+
occupation i + eps r = occupation k + eps s then
|
| 89 |
+
weight i p * weight k q * weight i r * weight k s else 0) =
|
| 90 |
+
∑ i, ∑ p, ∑ q, ∑ r, ∑ s,
|
| 91 |
+
if eps p - eps q = eps r - eps s then
|
| 92 |
+
weight i p * Function.extend occupation (fun k => weight k q) (fun _ => 0)
|
| 93 |
+
(occupation i + eps p - eps q) * weight i r *
|
| 94 |
+
Function.extend occupation (fun k => weight k s) (fun _ => 0)
|
| 95 |
+
(occupation i + eps p - eps q) else 0 := by
|
| 96 |
+
classical
|
| 97 |
+
apply Finset.sum_congr rfl
|
| 98 |
+
intro i hi
|
| 99 |
+
rw [Finset.sum_comm]
|
| 100 |
+
apply Finset.sum_congr rfl
|
| 101 |
+
intro p hp
|
| 102 |
+
rw [Finset.sum_comm]
|
| 103 |
+
apply Finset.sum_congr rfl
|
| 104 |
+
intro q hq
|
| 105 |
+
rw [Finset.sum_comm]
|
| 106 |
+
apply Finset.sum_congr rfl
|
| 107 |
+
intro r hr
|
| 108 |
+
rw [Finset.sum_comm]
|
| 109 |
+
apply Finset.sum_congr rfl
|
| 110 |
+
intro s hs
|
| 111 |
+
exact fourPath_eliminate_source occupation hinj (fun k => weight k q)
|
| 112 |
+
(fun k => weight k s) (occupation i) (eps p) (eps q) (eps r) (eps s)
|
| 113 |
+
(weight i p) (weight i r)
|
| 114 |
+
|
| 115 |
+
/-- The complex four-path trace with its second source removed. The signed
|
| 116 |
+
shift identity is required only for nonzero path weights, so invalid-path
|
| 117 |
+
fallback target indices do not affect the identity. -/
|
| 118 |
+
theorem complex_path_second_trace_eliminate_source
|
| 119 |
+
{J : Type*} [Fintype J] [Fintype P] [DecidableEq I] [DecidableEq J]
|
| 120 |
+
(occupation : I → G) (hinj : Function.Injective occupation)
|
| 121 |
+
(targetOccupation : J → G) (htarget : Function.Injective targetOccupation)
|
| 122 |
+
(eps : P → G) (shift : I → P → J) (weight : I → P → ℝ)
|
| 123 |
+
(hshift : ∀ i p, weight i p ≠ 0 →
|
| 124 |
+
targetOccupation (shift i p) = occupation i + eps p) :
|
| 125 |
+
let A := pathShiftMatrix shift (fun i p => (weight i p : ℂ))
|
| 126 |
+
((A.conjTranspose * A) ^ 2).trace.re =
|
| 127 |
+
∑ i, ∑ p, ∑ q, ∑ r, ∑ s,
|
| 128 |
+
if eps p - eps q = eps r - eps s then
|
| 129 |
+
weight i p * Function.extend occupation (fun k => weight k q) (fun _ => 0)
|
| 130 |
+
(occupation i + eps p - eps q) * weight i r *
|
| 131 |
+
Function.extend occupation (fun k => weight k s) (fun _ => 0)
|
| 132 |
+
(occupation i + eps p - eps q) else 0 := by
|
| 133 |
+
classical
|
| 134 |
+
dsimp
|
| 135 |
+
rw [complex_path_second_trace_four_paths, ← fourPath_sum_eliminate_source occupation hinj]
|
| 136 |
+
apply Finset.sum_congr rfl
|
| 137 |
+
intro i hi
|
| 138 |
+
apply Finset.sum_congr rfl
|
| 139 |
+
intro k hk
|
| 140 |
+
apply Finset.sum_congr rfl
|
| 141 |
+
intro p hp
|
| 142 |
+
apply Finset.sum_congr rfl
|
| 143 |
+
intro q hq
|
| 144 |
+
apply Finset.sum_congr rfl
|
| 145 |
+
intro r hr
|
| 146 |
+
apply Finset.sum_congr rfl
|
| 147 |
+
intro s hs
|
| 148 |
+
by_cases hz : weight i p * weight k q * weight i r * weight k s = 0
|
| 149 |
+
· simp [hz]
|
| 150 |
+
· have hp' : weight i p ≠ 0 := by intro h; simp [h] at hz
|
| 151 |
+
have hq' : weight k q ≠ 0 := by intro h; simp [h] at hz
|
| 152 |
+
have hr' : weight i r ≠ 0 := by intro h; simp [h] at hz
|
| 153 |
+
have hs' : weight k s ≠ 0 := by intro h; simp [h] at hz
|
| 154 |
+
have h₁ : shift i p = shift k q ↔ occupation i + eps p = occupation k + eps q := by
|
| 155 |
+
rw [← htarget.eq_iff, hshift i p hp', hshift k q hq']
|
| 156 |
+
have h₂ : shift i r = shift k s ↔ occupation i + eps r = occupation k + eps s := by
|
| 157 |
+
rw [← htarget.eq_iff, hshift i r hr', hshift k s hs']
|
| 158 |
+
simp only [h₁, h₂]
|
| 159 |
+
|
| 160 |
+
end Problem335
|
| 161 |
+
|
| 162 |
+
end
|
| 163 |
+
|
| 164 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/FractionRounding.lean
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Problem335
|
| 7 |
+
|
| 8 |
+
/-- Quantitative monotonicity of the fraction used in the rounded rank parameters. -/
|
| 9 |
+
theorem fraction_rounding_ratio_bounds {x v a : ℝ} (hx : 0 < x) (hv : 0 < v)
|
| 10 |
+
(hxa : x ≤ a) (hax : a ≤ x + 1) :
|
| 11 |
+
1 ≤ (a / (a + v)) / (x / (x + v)) ∧
|
| 12 |
+
(a / (a + v)) / (x / (x + v)) ≤ 1 + 1 / x := by
|
| 13 |
+
have ha : 0 < a := lt_of_lt_of_le hx hxa
|
| 14 |
+
have hxv : 0 < x + v := add_pos hx hv
|
| 15 |
+
have hav : 0 < a + v := add_pos ha hv
|
| 16 |
+
have hratio : (a / (a + v)) / (x / (x + v)) =
|
| 17 |
+
a * (x + v) / (x * (a + v)) := by field_simp
|
| 18 |
+
rw [hratio]
|
| 19 |
+
constructor
|
| 20 |
+
· apply (le_div_iff₀ (mul_pos hx hav)).mpr
|
| 21 |
+
nlinarith
|
| 22 |
+
· apply (div_le_iff₀ (mul_pos hx hav)).mpr
|
| 23 |
+
have hxne : x ≠ 0 := ne_of_gt hx
|
| 24 |
+
field_simp
|
| 25 |
+
nlinarith
|
| 26 |
+
|
| 27 |
+
/-- Rounding upward by at most one changes the logarithm by at most `1/x`. -/
|
| 28 |
+
theorem fraction_rounding_log_bounds {x v a : ℝ} (hx : 0 < x) (hv : 0 < v)
|
| 29 |
+
(hxa : x ≤ a) (hax : a ≤ x + 1) :
|
| 30 |
+
0 ≤ Real.log ((a / (a + v)) / (x / (x + v))) ∧
|
| 31 |
+
Real.log ((a / (a + v)) / (x / (x + v))) ≤ 1 / x := by
|
| 32 |
+
obtain ⟨hlo, hhi⟩ := fraction_rounding_ratio_bounds hx hv hxa hax
|
| 33 |
+
constructor
|
| 34 |
+
· exact Real.log_nonneg hlo
|
| 35 |
+
· have hpos : 0 < (a / (a + v)) / (x / (x + v)) := lt_of_lt_of_le zero_lt_one hlo
|
| 36 |
+
have hlog := Real.log_le_sub_one_of_pos hpos
|
| 37 |
+
linarith
|
| 38 |
+
|
| 39 |
+
/-- Once the unrounded value is at least one, the logarithmic loss is `2/a`. -/
|
| 40 |
+
theorem fraction_rounding_log_le_two_div {x v a : ℝ} (hx : 1 ≤ x) (hv : 0 < v)
|
| 41 |
+
(hxa : x ≤ a) (hax : a ≤ x + 1) :
|
| 42 |
+
Real.log ((a / (a + v)) / (x / (x + v))) ≤ 2 / a := by
|
| 43 |
+
have hxpos : 0 < x := zero_lt_one.trans_le hx
|
| 44 |
+
have hapos : 0 < a := hxpos.trans_le hxa
|
| 45 |
+
apply (fraction_rounding_log_bounds hxpos hv hxa hax).2.trans
|
| 46 |
+
apply (div_le_div_iff₀ hxpos hapos).mpr
|
| 47 |
+
nlinarith
|
| 48 |
+
|
| 49 |
+
/-- Equivalent multiplicative exponential form of the rounding estimate. -/
|
| 50 |
+
theorem fraction_rounding_bounds {x v a : ℝ} (hx : 0 < x) (hv : 0 < v)
|
| 51 |
+
(hxa : x ≤ a) (hax : a ≤ x + 1) :
|
| 52 |
+
x / (x + v) ≤ a / (a + v) ∧
|
| 53 |
+
a / (a + v) ≤ x / (x + v) * Real.exp (1 / x) := by
|
| 54 |
+
have hbase : 0 < x / (x + v) := div_pos hx (add_pos hx hv)
|
| 55 |
+
obtain ⟨hlo, hhi⟩ := fraction_rounding_ratio_bounds hx hv hxa hax
|
| 56 |
+
constructor
|
| 57 |
+
· exact (one_le_div hbase).mp hlo
|
| 58 |
+
· have hexp : 1 + 1 / x ≤ Real.exp (1 / x) := by
|
| 59 |
+
simpa [add_comm] using Real.add_one_le_exp (1 / x)
|
| 60 |
+
have hratio := hhi.trans hexp
|
| 61 |
+
exact (div_le_iff₀ hbase).mp hratio |>.trans_eq (mul_comm _ _)
|
| 62 |
+
|
| 63 |
+
/-- The ceiling specialization used for both parameters `a` and `b`. -/
|
| 64 |
+
theorem fraction_natCeil_log_bounds {x v : ℝ} (hx : 0 < x) (hv : 0 < v) :
|
| 65 |
+
0 ≤ Real.log (((⌈x⌉₊ : ℝ) / ((⌈x⌉₊ : ℝ) + v)) / (x / (x + v))) ∧
|
| 66 |
+
Real.log (((⌈x⌉₊ : ℝ) / ((⌈x⌉₊ : ℝ) + v)) / (x / (x + v))) ≤ 1 / x := by
|
| 67 |
+
apply fraction_rounding_log_bounds hx hv
|
| 68 |
+
· exact Nat.le_ceil x
|
| 69 |
+
· exact le_of_lt (Nat.ceil_lt_add_one (le_of_lt hx))
|
| 70 |
+
|
| 71 |
+
/-- The first rank parameter has ideal fraction `1/s`; here `s = sqrt n`. -/
|
| 72 |
+
theorem fraction_natCeil_inverse_bounds {s v : ℝ} (hs : 1 < s) (hv : 0 < v) :
|
| 73 |
+
let a : ℝ := ⌈v / (s - 1)⌉₊
|
| 74 |
+
1 / s ≤ a / (a + v) ∧
|
| 75 |
+
a / (a + v) ≤ 1 / s * Real.exp ((s - 1) / v) := by
|
| 76 |
+
have hsm : 0 < s - 1 := sub_pos.mpr hs
|
| 77 |
+
have hx : 0 < v / (s - 1) := div_pos hv hsm
|
| 78 |
+
have hbase : (v / (s - 1)) / (v / (s - 1) + v) = 1 / s := by
|
| 79 |
+
field_simp
|
| 80 |
+
ring
|
| 81 |
+
have hinv : 1 / (v / (s - 1)) = (s - 1) / v := by
|
| 82 |
+
rw [one_div_div]
|
| 83 |
+
have h := fraction_rounding_bounds hx hv (Nat.le_ceil _) (le_of_lt (Nat.ceil_lt_add_one hx.le))
|
| 84 |
+
simpa only [hbase, hinv] using h
|
| 85 |
+
|
| 86 |
+
/-- The first rounded parameter has reciprocal at most its ideal reciprocal. -/
|
| 87 |
+
theorem fraction_natCeil_reciprocal_le {s v : ℝ} (hs : 1 < s) (hv : 0 < v) :
|
| 88 |
+
let a : ℝ := ⌈v / (s - 1)⌉₊
|
| 89 |
+
(a / (a + v))⁻¹ ≤ s := by
|
| 90 |
+
dsimp
|
| 91 |
+
have h := (fraction_natCeil_inverse_bounds hs hv).1
|
| 92 |
+
have hspos : 0 < s := zero_lt_one.trans hs
|
| 93 |
+
have hpos : 0 < (⌈v / (s - 1)⌉₊ : ℝ) / ((⌈v / (s - 1)⌉₊ : ℝ) + v) :=
|
| 94 |
+
lt_of_lt_of_le (one_div_pos.mpr hspos) h
|
| 95 |
+
rw [inv_eq_one_div]
|
| 96 |
+
apply (div_le_iff₀ hpos).mpr
|
| 97 |
+
nlinarith [(div_le_iff₀ hspos).mp h]
|
| 98 |
+
|
| 99 |
+
/-- The second rank parameter is rounded from a prescribed target fraction `p`. -/
|
| 100 |
+
theorem fraction_natCeil_target_bounds {p v : ℝ} (hp : 0 < p) (hp1 : p < 1)
|
| 101 |
+
(hv : 0 < v) :
|
| 102 |
+
let b : ℝ := ⌈v * p / (1 - p)⌉₊
|
| 103 |
+
p ≤ b / (b + v) ∧
|
| 104 |
+
b / (b + v) ≤ p * Real.exp ((1 - p) / (v * p)) := by
|
| 105 |
+
have hpm : 0 < 1 - p := sub_pos.mpr hp1
|
| 106 |
+
have hx : 0 < v * p / (1 - p) := div_pos (mul_pos hv hp) hpm
|
| 107 |
+
have hbase : (v * p / (1 - p)) / (v * p / (1 - p) + v) = p := by
|
| 108 |
+
field_simp
|
| 109 |
+
ring
|
| 110 |
+
have hinv : 1 / (v * p / (1 - p)) = (1 - p) / (v * p) := by
|
| 111 |
+
rw [one_div_div]
|
| 112 |
+
have h := fraction_rounding_bounds hx hv (Nat.le_ceil _) (le_of_lt (Nat.ceil_lt_add_one hx.le))
|
| 113 |
+
simpa only [hbase, hinv] using h
|
| 114 |
+
|
| 115 |
+
end Problem335
|
| 116 |
+
|
| 117 |
+
end
|
| 118 |
+
|
| 119 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/GateCardinality.lean
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.Basic
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
namespace Problem335
|
| 6 |
+
|
| 7 |
+
/-- The numerical size estimate used after instantiating the block circuit. -/
|
| 8 |
+
theorem circuitSize_le_block_bound {K : Type*} [CommSemiring K] {n r t : ℕ}
|
| 9 |
+
(c : Depth5Circuit K n)
|
| 10 |
+
(hleaf : c.leafCount ≤ n ^ 3)
|
| 11 |
+
(hbottom : c.bottomCount ≤ n ^ 3)
|
| 12 |
+
(hlower : c.lowerCount ≤ r * n ^ (t + 1))
|
| 13 |
+
(hmiddle : c.middleCount ≤ r * n ^ 2)
|
| 14 |
+
(hupper : c.upperCount ≤ n ^ (r - 1)) :
|
| 15 |
+
circuitSize c ≤ 2 * n ^ 3 + r * n ^ 2 + r * n ^ (t + 1) +
|
| 16 |
+
n ^ (r - 1) + 1 := by
|
| 17 |
+
unfold circuitSize
|
| 18 |
+
omega
|
| 19 |
+
|
| 20 |
+
/-- Specialization of the block count to the precise upper gate bound. -/
|
| 21 |
+
theorem circuitSize_le_upperGateBound {K : Type*} [CommSemiring K] {n : ℕ}
|
| 22 |
+
(c : Depth5Circuit K n)
|
| 23 |
+
(hleaf : c.leafCount ≤ n ^ 3)
|
| 24 |
+
(hbottom : c.bottomCount ≤ n ^ 3)
|
| 25 |
+
(hlower : c.lowerCount ≤ ceilDiv n (ceilSqrt n) * n ^ (ceilSqrt n + 1))
|
| 26 |
+
(hmiddle : c.middleCount ≤ ceilDiv n (ceilSqrt n) * n ^ 2)
|
| 27 |
+
(hupper : c.upperCount ≤ n ^ (ceilDiv n (ceilSqrt n) - 1)) :
|
| 28 |
+
circuitSize c ≤ upperGateBound n := by
|
| 29 |
+
exact circuitSize_le_block_bound c hleaf hbottom hlower hmiddle hupper
|
| 30 |
+
|
| 31 |
+
end Problem335
|
| 32 |
+
|
| 33 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/GateSums.lean
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.Basic
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
|
| 9 |
+
namespace Problem335
|
| 10 |
+
|
| 11 |
+
/-- The combined coefficient of all wires from a fixed predecessor.
|
| 12 |
+
Wire multiplicity is absorbed into this coefficient, not charged as gates. -/
|
| 13 |
+
def gateCoefficient {K ι : Type*} [AddCommMonoid K] [DecidableEq ι]
|
| 14 |
+
(inputs : List (K × ι)) (i : ι) : K :=
|
| 15 |
+
(inputs.map (fun entry => if entry.2 = i then entry.1 else 0)).sum
|
| 16 |
+
|
| 17 |
+
@[simp] theorem gateCoefficient_nil {K ι : Type*} [AddCommMonoid K] [DecidableEq ι]
|
| 18 |
+
(i : ι) : gateCoefficient ([] : List (K × ι)) i = 0 := by
|
| 19 |
+
simp [gateCoefficient]
|
| 20 |
+
|
| 21 |
+
@[simp] theorem gateCoefficient_cons {K ι : Type*} [AddCommMonoid K] [DecidableEq ι]
|
| 22 |
+
(entry : K × ι) (inputs : List (K × ι)) (i : ι) :
|
| 23 |
+
gateCoefficient (entry :: inputs) i =
|
| 24 |
+
(if entry.2 = i then entry.1 else 0) + gateCoefficient inputs i := by
|
| 25 |
+
simp [gateCoefficient]
|
| 26 |
+
|
| 27 |
+
/-- Any finite list of weighted inputs can be regrouped over its finite gate type. -/
|
| 28 |
+
theorem list_weighted_sum_eq_sum {K R ι : Type*} [Semiring K] [Semiring R]
|
| 29 |
+
[Fintype ι] [DecidableEq ι] (f : K →+* R) (value : ι → R)
|
| 30 |
+
(inputs : List (K × ι)) :
|
| 31 |
+
(inputs.map (fun entry => f entry.1 * value entry.2)).sum =
|
| 32 |
+
∑ i, f (gateCoefficient inputs i) * value i := by
|
| 33 |
+
induction inputs with
|
| 34 |
+
| nil => simp
|
| 35 |
+
| cons entry inputs ih =>
|
| 36 |
+
simp only [List.map_cons, List.sum_cons, gateCoefficient_cons,
|
| 37 |
+
map_add, add_mul, Finset.sum_add_distrib]
|
| 38 |
+
rw [← ih]
|
| 39 |
+
congr 1
|
| 40 |
+
simp [apply_ite, ite_mul]
|
| 41 |
+
|
| 42 |
+
/-- A combined coefficient vanishes if its predecessor does not occur. -/
|
| 43 |
+
theorem gateCoefficient_eq_zero_of_not_mem {K ι : Type*}
|
| 44 |
+
[AddCommMonoid K] [DecidableEq ι] (inputs : List (K × ι)) (i : ι)
|
| 45 |
+
(h : ∀ entry ∈ inputs, entry.2 ≠ i) : gateCoefficient inputs i = 0 := by
|
| 46 |
+
unfold gateCoefficient
|
| 47 |
+
apply List.sum_eq_zero
|
| 48 |
+
intro x hx
|
| 49 |
+
obtain ⟨entry, hentry, rfl⟩ := List.mem_map.mp hx
|
| 50 |
+
simp [h entry hentry]
|
| 51 |
+
|
| 52 |
+
/-- A nonzero combined coefficient must come from an actual wire. -/
|
| 53 |
+
theorem exists_mem_of_gateCoefficient_ne_zero {K ι : Type*}
|
| 54 |
+
[AddCommMonoid K] [DecidableEq ι] (inputs : List (K × ι)) (i : ι)
|
| 55 |
+
(h : gateCoefficient inputs i ≠ 0) : ∃ entry ∈ inputs, entry.2 = i := by
|
| 56 |
+
by_contra hn
|
| 57 |
+
apply h
|
| 58 |
+
apply gateCoefficient_eq_zero_of_not_mem
|
| 59 |
+
intro entry hentry heq
|
| 60 |
+
exact hn ⟨entry, hentry, heq⟩
|
| 61 |
+
|
| 62 |
+
theorem bottomValue_eq_sum {K : Type*} [CommSemiring K] {n : ℕ}
|
| 63 |
+
(c : Depth5Circuit K n) (i : Fin c.bottomCount) :
|
| 64 |
+
bottomValue c i = ∑ j : Fin c.leafCount,
|
| 65 |
+
MvPolynomial.C (gateCoefficient (c.bottomInputs i) j) * d5LeafValue (c.leaves j) := by
|
| 66 |
+
exact list_weighted_sum_eq_sum MvPolynomial.C (fun j => d5LeafValue (c.leaves j)) _
|
| 67 |
+
|
| 68 |
+
theorem middleValue_eq_sum {K : Type*} [CommSemiring K] {n : ℕ}
|
| 69 |
+
(c : Depth5Circuit K n) (i : Fin c.middleCount) :
|
| 70 |
+
middleValue c i = ∑ j : Fin c.lowerCount,
|
| 71 |
+
MvPolynomial.C (gateCoefficient (c.middleInputs i) j) * lowerValue c j := by
|
| 72 |
+
exact list_weighted_sum_eq_sum MvPolynomial.C (lowerValue c) _
|
| 73 |
+
|
| 74 |
+
theorem circuitValue_eq_sum {K : Type*} [CommSemiring K] {n : ℕ}
|
| 75 |
+
(c : Depth5Circuit K n) :
|
| 76 |
+
circuitValue c = ∑ j : Fin c.upperCount,
|
| 77 |
+
MvPolynomial.C (gateCoefficient c.outputInputs j) * upperValue c j := by
|
| 78 |
+
exact list_weighted_sum_eq_sum MvPolynomial.C (upperValue c) _
|
| 79 |
+
|
| 80 |
+
/-- Aggregating wires preserves the bottom homogeneous-degree constraint. -/
|
| 81 |
+
theorem bottomDegree_of_gateCoefficient_ne_zero {K : Type*} [CommSemiring K] {n : ℕ}
|
| 82 |
+
(c : Depth5Circuit K n) (i : Fin c.bottomCount) (j : Fin c.leafCount)
|
| 83 |
+
(h : gateCoefficient (c.bottomInputs i) j ≠ 0) :
|
| 84 |
+
d5LeafDegree (c.leaves j) = c.bottomDegree i := by
|
| 85 |
+
obtain ⟨entry, hentry, heq⟩ := exists_mem_of_gateCoefficient_ne_zero _ _ h
|
| 86 |
+
simpa [heq] using c.bottomHomogeneous i entry hentry
|
| 87 |
+
|
| 88 |
+
/-- Aggregating wires preserves the middle homogeneous-degree constraint. -/
|
| 89 |
+
theorem middleDegree_of_gateCoefficient_ne_zero {K : Type*} [CommSemiring K] {n : ℕ}
|
| 90 |
+
(c : Depth5Circuit K n) (i : Fin c.middleCount) (j : Fin c.lowerCount)
|
| 91 |
+
(h : gateCoefficient (c.middleInputs i) j ≠ 0) :
|
| 92 |
+
((c.lowerInputs j).map c.bottomDegree).sum = c.middleDegree i := by
|
| 93 |
+
obtain ⟨entry, hentry, heq⟩ := exists_mem_of_gateCoefficient_ne_zero _ _ h
|
| 94 |
+
simpa [heq] using c.middleHomogeneous i entry hentry
|
| 95 |
+
|
| 96 |
+
/-- Aggregating wires preserves the output homogeneous-degree constraint. -/
|
| 97 |
+
theorem outputDegree_of_gateCoefficient_ne_zero {K : Type*} [CommSemiring K] {n : ℕ}
|
| 98 |
+
(c : Depth5Circuit K n) (j : Fin c.upperCount)
|
| 99 |
+
(h : gateCoefficient c.outputInputs j ≠ 0) :
|
| 100 |
+
((c.upperInputs j).map c.middleDegree).sum = c.outputDegree := by
|
| 101 |
+
obtain ⟨entry, hentry, heq⟩ := exists_mem_of_gateCoefficient_ne_zero _ _ h
|
| 102 |
+
simpa [heq] using c.outputHomogeneous entry hentry
|
| 103 |
+
|
| 104 |
+
end Problem335
|
| 105 |
+
|
| 106 |
+
end
|
| 107 |
+
|
| 108 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/HighDegreeWeights.lean
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ProductCost
|
| 2 |
+
import OAI.Algebra.DepthFive.LowDegreeWeights
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
|
| 9 |
+
namespace Problem335
|
| 10 |
+
|
| 11 |
+
/-- Remaining unexpanded factors cost at most one factor of five per large
|
| 12 |
+
occurrence, and a total exponential error for the low occurrences. -/
|
| 13 |
+
theorem remaining_degreeWeight_product_bound {ι : Type*} (I : Finset ι)
|
| 14 |
+
(e : ι → ℕ) {n s q : ℝ} (hn : 0 < n) (hs : 0 < s)
|
| 15 |
+
(hshi : s ≤ Real.sqrt n) (hq : 0 < q) (hqhalf : q ≤ 1 / 2)
|
| 16 |
+
(hqsqrt : q ≤ 2 / Real.sqrt n)
|
| 17 |
+
(hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1)
|
| 18 |
+
(he : ∀ i ∈ I, 0 < e i) (hsum : (∑ i ∈ I, (e i : ℝ)) ≤ n) :
|
| 19 |
+
(∏ i ∈ I, degreeWeight q (1 / 2 - s / (2 * n)) (e i)) ≤
|
| 20 |
+
(5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n) := by
|
| 21 |
+
classical
|
| 22 |
+
have hq1 : q ≤ 1 := by linarith
|
| 23 |
+
have ht : 0 < n / (4 * s) := by positivity
|
| 24 |
+
have hcorr : (∑ i ∈ I with (e i : ℝ) < n / (4 * s),
|
| 25 |
+
q ^ (1 - s * e i / n)) ≤ 6 * Real.sqrt n := by
|
| 26 |
+
apply sum_small_degree_corrections_le
|
| 27 |
+
(I.filter (fun i => (e i : ℝ) < n / (4 * s))) n s q
|
| 28 |
+
(fun i => (e i : ℝ)) hn hs.le hshi hq hq1 hqsqrt
|
| 29 |
+
· intro i hi
|
| 30 |
+
exact_mod_cast he i (Finset.mem_filter.mp hi).1
|
| 31 |
+
· intro i hi
|
| 32 |
+
obtain ⟨hI, hlow⟩ := Finset.mem_filter.mp hi
|
| 33 |
+
obtain ⟨_, h⟩ := low_degree_offset hn hs (he i hI) hlow
|
| 34 |
+
have hid : s * e i / n = 2 * (s * e i / (2 * n)) := by ring
|
| 35 |
+
rw [hid]
|
| 36 |
+
linarith
|
| 37 |
+
· exact (Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _)
|
| 38 |
+
(fun i _ _ => Nat.cast_nonneg (e i))).trans hsum
|
| 39 |
+
have herr : (∑ i ∈ I with (e i : ℝ) < n / (4 * s),
|
| 40 |
+
4 * q ^ (1 - s * e i / n)) ≤ 24 * Real.sqrt n := by
|
| 41 |
+
rw [← Finset.mul_sum]
|
| 42 |
+
linarith
|
| 43 |
+
have hlow : ∀ i ∈ I, (e i : ℝ) < n / (4 * s) →
|
| 44 |
+
degreeWeight q (1 / 2 - s / (2 * n)) (e i) ≤
|
| 45 |
+
Real.exp (4 * q ^ (1 - s * e i / n)) := by
|
| 46 |
+
intro i hi hlow
|
| 47 |
+
have hw := low_degreeWeight_le_with_correction hn hs hq hqhalf hqsmall
|
| 48 |
+
(he i hi) hlow
|
| 49 |
+
have hd : 0 ≤ degreeDistance n s (e i) := nearestIntegerDistance_nonneg _
|
| 50 |
+
have hp : q ^ (degreeDistance n s (e i) / 2) ≤ 1 :=
|
| 51 |
+
Real.rpow_le_one hq.le hq1 (by positivity)
|
| 52 |
+
exact hw.trans (by
|
| 53 |
+
simpa only [one_mul] using mul_le_mul_of_nonneg_right hp
|
| 54 |
+
(Real.exp_pos (4 * q ^ (1 - s * e i / n))).le)
|
| 55 |
+
have h := prod_high_low_cost_le_rpow I
|
| 56 |
+
(fun i => degreeWeight q (1 / 2 - s / (2 * n)) (e i))
|
| 57 |
+
(fun i => 4 * q ^ (1 - s * e i / n)) (fun i => (e i : ℝ))
|
| 58 |
+
(n / (4 * s)) 5 (24 * Real.sqrt n) n ht
|
| 59 |
+
(fun i _ => degreeWeight_nonneg hq.le _ _) (by norm_num)
|
| 60 |
+
(fun i _ => Nat.cast_nonneg (e i)) hsum
|
| 61 |
+
(fun i _ _ => degreeWeight_le_five hq hqhalf _ _) hlow herr
|
| 62 |
+
have hdiv : n / (n / (4 * s)) = 4 * s := by
|
| 63 |
+
field_simp
|
| 64 |
+
simpa only [hdiv] using h
|
| 65 |
+
|
| 66 |
+
/-- The actual factor weights in the one-high case obey the strong power
|
| 67 |
+
saving required by the homogeneous depth-five circuit rank argument. -/
|
| 68 |
+
theorem high_degreeWeight_product_bound {ι : Type*} (I : Finset ι)
|
| 69 |
+
(e : ι → ℕ) (d : ℕ) {n s q : ℝ} (hn : 1 ≤ n) (hs : 0 < s)
|
| 70 |
+
(hshi : s ≤ Real.sqrt n) (hq : 0 < q) (hqhalf : q ≤ 1 / 2)
|
| 71 |
+
(hqsqrt : q ≤ 2 / Real.sqrt n) (hqpow : q ≤ n ^ (-(2 : ℝ) / 5))
|
| 72 |
+
(hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1)
|
| 73 |
+
(hlam : (3 : ℝ) / 8 ≤ 1 / 2 - s / (2 * n))
|
| 74 |
+
(htone : 1 < n / (4 * s)) (hd : n / (4 * s) ≤ (d : ℝ))
|
| 75 |
+
(he : ∀ i ∈ I, 0 < e i) (hsum : (∑ i ∈ I, (e i : ℝ)) ≤ n) :
|
| 76 |
+
degreeWeight q (1 / 2 - s / (2 * n)) 1 ^ d *
|
| 77 |
+
(∏ i ∈ I, degreeWeight q (1 / 2 - s / (2 * n)) (e i)) ≤
|
| 78 |
+
(5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n) *
|
| 79 |
+
n ^ (-(3 * Real.sqrt n) / 160) := by
|
| 80 |
+
have hn0 : 0 < n := by linarith
|
| 81 |
+
have hq1 : q ≤ 1 := by linarith
|
| 82 |
+
have hdist : degreeDistance n s 1 = 1 / 2 - s / (2 * n) := by
|
| 83 |
+
simpa using degreeDistance_odd hn0 hs (by decide : 0 < (1 : ℕ))
|
| 84 |
+
(by simpa using htone) (by decide : Odd (1 : ℕ))
|
| 85 |
+
have hlinear : degreeWeight q (1 / 2 - s / (2 * n)) 1 ≤
|
| 86 |
+
q ^ ((1 / 2 - s / (2 * n)) / 2) := by
|
| 87 |
+
simpa only [hdist] using low_odd_degreeWeight_le hn0 hs hq hqhalf hqsmall
|
| 88 |
+
(by decide : 0 < (1 : ℕ)) (by simpa using htone) (by decide : Odd (1 : ℕ))
|
| 89 |
+
have hlinpow := linear_factor_cost_power_le
|
| 90 |
+
(degreeWeight q (1 / 2 - s / (2 * n)) 1) q
|
| 91 |
+
(1 / 2 - s / (2 * n)) (n / (4 * s)) d
|
| 92 |
+
(degreeWeight_nonneg hq.le _ _) hq hq1 (by linarith) hlinear hd
|
| 93 |
+
have hprod := remaining_degreeWeight_product_bound I e hn0 hs hshi hq
|
| 94 |
+
hqhalf hqsqrt hqsmall he hsum
|
| 95 |
+
have ht : Real.sqrt n / 4 ≤ n / (4 * s) := by
|
| 96 |
+
apply (le_div_iff₀ (by positivity : 0 < 4 * s)).mpr
|
| 97 |
+
have hm := mul_le_mul_of_nonneg_left hshi (Real.sqrt_nonneg n)
|
| 98 |
+
nlinarith [Real.sq_sqrt hn0.le]
|
| 99 |
+
have hpower := one_high_power_saving n q (1 / 2 - s / (2 * n))
|
| 100 |
+
(n / (4 * s)) hn hq.le hqpow hlam ht
|
| 101 |
+
calc
|
| 102 |
+
_ ≤ q ^ ((1 / 2 - s / (2 * n)) * (n / (4 * s)) / 2) *
|
| 103 |
+
((5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n)) :=
|
| 104 |
+
mul_le_mul hlinpow hprod
|
| 105 |
+
(Finset.prod_nonneg (fun i _ => degreeWeight_nonneg hq.le _ _))
|
| 106 |
+
(Real.rpow_nonneg hq.le _)
|
| 107 |
+
_ ≤ n ^ (-(3 * Real.sqrt n) / 160) *
|
| 108 |
+
((5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n)) :=
|
| 109 |
+
mul_le_mul_of_nonneg_right hpower (by positivity)
|
| 110 |
+
_ = _ := by ring
|
| 111 |
+
|
| 112 |
+
/-- The circuit interface only assumes `n ≥ 64`: the required slope and
|
| 113 |
+
threshold bounds follow from `s ≤ sqrt n`. This adapter reconciles the
|
| 114 |
+
canonical high-weight estimate with the circuit product interface. -/
|
| 115 |
+
theorem expanded_degreeWeight_product_bound {ι : Type*} (I : Finset ι) (e : ι → ℕ)
|
| 116 |
+
(d : ℕ) {n s q : ℝ} (hn : 64 ≤ n) (hs : 0 < s) (hshi : s ≤ Real.sqrt n)
|
| 117 |
+
(hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsqrt : q ≤ 2 / Real.sqrt n)
|
| 118 |
+
(hqpow : q ≤ n ^ (-(2 / 5 : ℝ))) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1)
|
| 119 |
+
(he : ∀ i ∈ I, 0 < e i) (hsum : ∑ i ∈ I, (e i : ℝ) ≤ n)
|
| 120 |
+
(hd : n / (4 * s) ≤ (d : ℝ)) :
|
| 121 |
+
(degreeWeight q (1 / 2 - s / (2 * n)) 1) ^ d *
|
| 122 |
+
(∏ i ∈ I, degreeWeight q (1 / 2 - s / (2 * n)) (e i)) ≤
|
| 123 |
+
(5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n) *
|
| 124 |
+
n ^ (-(3 * Real.sqrt n / 160)) := by
|
| 125 |
+
have hn0 : 0 < n := by linarith
|
| 126 |
+
have hsq := Real.sq_sqrt hn0.le
|
| 127 |
+
have hsqrt := Real.sqrt_nonneg n
|
| 128 |
+
have hsqrt8 : 8 ≤ Real.sqrt n := by nlinarith
|
| 129 |
+
have ht : Real.sqrt n / 4 ≤ n / (4 * s) := by
|
| 130 |
+
apply (le_div_iff₀ (by positivity : 0 < 4 * s)).mpr
|
| 131 |
+
nlinarith [mul_le_mul_of_nonneg_left hshi hsqrt]
|
| 132 |
+
have hdiv : s / (2 * n) ≤ 1 / 8 := by
|
| 133 |
+
apply (div_le_iff₀ (by positivity : 0 < 2 * n)).mpr
|
| 134 |
+
nlinarith
|
| 135 |
+
simpa only [neg_div] using high_degreeWeight_product_bound I e d
|
| 136 |
+
(by linarith) hs hshi hq hqhalf hqsqrt (by simpa only [neg_div] using hqpow)
|
| 137 |
+
hqsmall (by linarith) (by linarith) hd he hsum
|
| 138 |
+
|
| 139 |
+
end Problem335
|
| 140 |
+
|
| 141 |
+
end
|
| 142 |
+
|
| 143 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/Homogeneity.lean
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.Basic
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
namespace Problem335
|
| 8 |
+
|
| 9 |
+
universe u v w
|
| 10 |
+
|
| 11 |
+
/-- Homogeneity is preserved by a list sum, including the empty sum. -/
|
| 12 |
+
theorem isHomogeneous_list_sum {K : Type u} [CommSemiring K]
|
| 13 |
+
{σ : Type v} {ι : Type w} (l : List ι) (f : ι → MvPolynomial σ K) (d : ℕ)
|
| 14 |
+
(h : ∀ i ∈ l, (f i).IsHomogeneous d) :
|
| 15 |
+
(l.map f).sum.IsHomogeneous d := by
|
| 16 |
+
induction l with
|
| 17 |
+
| nil => simpa using MvPolynomial.isHomogeneous_zero σ K d
|
| 18 |
+
| cons a l ih =>
|
| 19 |
+
simp only [List.map_cons, List.sum_cons]
|
| 20 |
+
exact (h a (by simp)).add (ih (fun i hi => h i (by simp [hi])))
|
| 21 |
+
|
| 22 |
+
/-- A product's formal degree is the sum of its factors' formal degrees. -/
|
| 23 |
+
theorem isHomogeneous_list_prod {K : Type u} [CommSemiring K]
|
| 24 |
+
{σ : Type v} {ι : Type w} (l : List ι) (f : ι → MvPolynomial σ K) (d : ι → ℕ)
|
| 25 |
+
(h : ∀ i ∈ l, (f i).IsHomogeneous (d i)) :
|
| 26 |
+
(l.map f).prod.IsHomogeneous (l.map d).sum := by
|
| 27 |
+
induction l with
|
| 28 |
+
| nil => simpa using MvPolynomial.isHomogeneous_one (σ := σ) K
|
| 29 |
+
| cons a l ih =>
|
| 30 |
+
simp only [List.map_cons, List.prod_cons, List.sum_cons]
|
| 31 |
+
exact (h a (by simp)).mul (ih (fun i hi => h i (by simp [hi])))
|
| 32 |
+
|
| 33 |
+
theorem d5LeafValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ}
|
| 34 |
+
(x : D5Leaf K n) : (d5LeafValue x).IsHomogeneous (d5LeafDegree x) := by
|
| 35 |
+
cases x with
|
| 36 |
+
| scalar a => exact MvPolynomial.isHomogeneous_C _ a
|
| 37 |
+
| «variable» i => exact MvPolynomial.isHomogeneous_X K i
|
| 38 |
+
|
| 39 |
+
theorem bottomValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ}
|
| 40 |
+
(c : Depth5Circuit K n) (i : Fin c.bottomCount) :
|
| 41 |
+
(bottomValue c i).IsHomogeneous (c.bottomDegree i) := by
|
| 42 |
+
unfold bottomValue
|
| 43 |
+
apply isHomogeneous_list_sum
|
| 44 |
+
intro entry hentry
|
| 45 |
+
rw [← c.bottomHomogeneous i entry hentry]
|
| 46 |
+
exact (d5LeafValue_isHomogeneous (c.leaves entry.2)).C_mul entry.1
|
| 47 |
+
|
| 48 |
+
theorem lowerValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ}
|
| 49 |
+
(c : Depth5Circuit K n) (i : Fin c.lowerCount) :
|
| 50 |
+
(lowerValue c i).IsHomogeneous ((c.lowerInputs i).map c.bottomDegree).sum := by
|
| 51 |
+
unfold lowerValue
|
| 52 |
+
apply isHomogeneous_list_prod
|
| 53 |
+
intro j _
|
| 54 |
+
exact bottomValue_isHomogeneous c j
|
| 55 |
+
|
| 56 |
+
theorem middleValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ}
|
| 57 |
+
(c : Depth5Circuit K n) (i : Fin c.middleCount) :
|
| 58 |
+
(middleValue c i).IsHomogeneous (c.middleDegree i) := by
|
| 59 |
+
unfold middleValue
|
| 60 |
+
apply isHomogeneous_list_sum
|
| 61 |
+
intro entry hentry
|
| 62 |
+
rw [← c.middleHomogeneous i entry hentry]
|
| 63 |
+
exact (lowerValue_isHomogeneous c entry.2).C_mul entry.1
|
| 64 |
+
|
| 65 |
+
theorem upperValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ}
|
| 66 |
+
(c : Depth5Circuit K n) (i : Fin c.upperCount) :
|
| 67 |
+
(upperValue c i).IsHomogeneous ((c.upperInputs i).map c.middleDegree).sum := by
|
| 68 |
+
unfold upperValue
|
| 69 |
+
apply isHomogeneous_list_prod
|
| 70 |
+
intro j _
|
| 71 |
+
exact middleValue_isHomogeneous c j
|
| 72 |
+
|
| 73 |
+
theorem circuitValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ}
|
| 74 |
+
(c : Depth5Circuit K n) :
|
| 75 |
+
(circuitValue c).IsHomogeneous c.outputDegree := by
|
| 76 |
+
unfold circuitValue
|
| 77 |
+
apply isHomogeneous_list_sum
|
| 78 |
+
intro entry hentry
|
| 79 |
+
rw [← c.outputHomogeneous entry hentry]
|
| 80 |
+
exact (upperValue_isHomogeneous c entry.2).C_mul entry.1
|
| 81 |
+
|
| 82 |
+
end Problem335
|
| 83 |
+
|
| 84 |
+
end
|
| 85 |
+
|
| 86 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/HomogeneousSpaceDimension.lean
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
namespace Problem335
|
| 8 |
+
|
| 9 |
+
universe u v w
|
| 10 |
+
|
| 11 |
+
/-- Degree-exact exponent vectors are multisets of the indicated cardinality. -/
|
| 12 |
+
def degreeExponentsEquivSym (σ : Type u) (d : ℕ) :
|
| 13 |
+
{ m : σ →₀ ℕ // m.degree = d } ≃ Sym σ d := by
|
| 14 |
+
classical
|
| 15 |
+
exact (Sym.equivNatSum σ d).symm
|
| 16 |
+
|
| 17 |
+
/-- The number of monomials of total degree `d`. -/
|
| 18 |
+
theorem card_degree_exponents (σ : Type u) [Fintype σ] (d : ℕ) :
|
| 19 |
+
Nat.card { m : σ →₀ ℕ // m.degree = d } =
|
| 20 |
+
Nat.multichoose (Fintype.card σ) d := by
|
| 21 |
+
rw [Nat.card_congr (degreeExponentsEquivSym σ d)]
|
| 22 |
+
simpa only [Nat.card_eq_fintype_card] using Sym.natCard_sym_eq_multichoose (α := σ) d
|
| 23 |
+
|
| 24 |
+
/-- Homogeneous polynomial spaces in finitely many variables are finite modules. -/
|
| 25 |
+
instance homogeneousSubmodule_finite (K : Type u) [CommSemiring K]
|
| 26 |
+
(σ : Type v) [Finite σ] (d : ℕ) :
|
| 27 |
+
Module.Finite K (MvPolynomial.homogeneousSubmodule σ K d) :=
|
| 28 |
+
Module.Finite.of_fg (MvPolynomial.homogeneousSubmodule_fg σ K d)
|
| 29 |
+
|
| 30 |
+
/-- Exact dimension of the homogeneous polynomial space. -/
|
| 31 |
+
theorem homogeneousSubmodule_finrank (K : Type u) [Field K]
|
| 32 |
+
(σ : Type v) [Fintype σ] (d : ℕ) :
|
| 33 |
+
Module.finrank K (MvPolynomial.homogeneousSubmodule σ K d) =
|
| 34 |
+
Nat.multichoose (Fintype.card σ) d := by
|
| 35 |
+
rw [MvPolynomial.homogeneousSubmodule_eq_finsupp_supported]
|
| 36 |
+
change Module.finrank K (MvPolynomial.restrictSupport K {m : σ →₀ ℕ | m.degree = d}) = _
|
| 37 |
+
rw [Module.finrank_eq_nat_card_basis (MvPolynomial.basisRestrictSupport K _)]
|
| 38 |
+
exact card_degree_exponents σ d
|
| 39 |
+
|
| 40 |
+
/-- The usual stars-and-bars presentation of homogeneous dimension. -/
|
| 41 |
+
theorem homogeneousSubmodule_finrank_choose (K : Type u) [Field K]
|
| 42 |
+
(σ : Type v) [Fintype σ] (d : ℕ) :
|
| 43 |
+
Module.finrank K (MvPolynomial.homogeneousSubmodule σ K d) =
|
| 44 |
+
Nat.choose (Fintype.card σ + d - 1) d := by
|
| 45 |
+
rw [homogeneousSubmodule_finrank, Nat.multichoose_eq]
|
| 46 |
+
|
| 47 |
+
/-- Dimension of the separate-variable source/intermediate spaces used by the rank measure. -/
|
| 48 |
+
theorem homogeneousTensor_finrank (K : Type u) [Field K]
|
| 49 |
+
(σ : Type v) [Fintype σ] (τ : Type w) [Fintype τ] (a b : ℕ) :
|
| 50 |
+
Module.finrank K (TensorProduct K
|
| 51 |
+
(MvPolynomial.homogeneousSubmodule σ K a)
|
| 52 |
+
(MvPolynomial.homogeneousSubmodule τ K b)) =
|
| 53 |
+
Nat.choose (Fintype.card σ + a - 1) a *
|
| 54 |
+
Nat.choose (Fintype.card τ + b - 1) b := by
|
| 55 |
+
rw [Module.finrank_tensorProduct, homogeneousSubmodule_finrank_choose,
|
| 56 |
+
homogeneousSubmodule_finrank_choose]
|
| 57 |
+
|
| 58 |
+
end Problem335
|
| 59 |
+
|
| 60 |
+
end
|
| 61 |
+
|
| 62 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmBidegree.lean
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmDegree
|
| 2 |
+
import OAI.Algebra.DepthFive.OperatorRank
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
|
| 9 |
+
namespace Problem335
|
| 10 |
+
|
| 11 |
+
/-- With a layerwise partition, IMM is already in the selected bidegree. -/
|
| 12 |
+
theorem imm_mem_bidegreeSubmodule (K : Type*) [CommSemiring K] (n : ℕ)
|
| 13 |
+
(side : Fin n → Bool) :
|
| 14 |
+
imm K n ∈ bidegreeSubmodule (fun x => side x.1)
|
| 15 |
+
(Finset.univ.filter (fun t => side t = true)).card
|
| 16 |
+
(Finset.univ.filter (fun t => side t = false)).card := by
|
| 17 |
+
classical
|
| 18 |
+
have h := imm_isWeightedHomogeneous K n (bidegreeWeight side)
|
| 19 |
+
have hs : (∑ t, bidegreeWeight side t) =
|
| 20 |
+
((Finset.univ.filter (fun t => side t = true)).card,
|
| 21 |
+
(Finset.univ.filter (fun t => side t = false)).card) := by
|
| 22 |
+
apply Prod.ext
|
| 23 |
+
· simp only [Prod.fst_sum, Finset.card_filter]
|
| 24 |
+
apply Finset.sum_congr rfl
|
| 25 |
+
intro t ht
|
| 26 |
+
cases hs : side t <;> simp [bidegreeWeight, hs]
|
| 27 |
+
· simp only [Prod.snd_sum, Finset.card_filter]
|
| 28 |
+
apply Finset.sum_congr rfl
|
| 29 |
+
intro t ht
|
| 30 |
+
cases hs : side t <;> simp [bidegreeWeight, hs]
|
| 31 |
+
rw [hs] at h
|
| 32 |
+
exact h
|
| 33 |
+
|
| 34 |
+
/-- A bidegree projection does not change IMM when the selected index is its layer count. -/
|
| 35 |
+
theorem bidegreeComponent_imm (K : Type*) [CommSemiring K] (n : ℕ)
|
| 36 |
+
(side : Fin n → Bool) :
|
| 37 |
+
bidegreeComponent (fun x => side x.1)
|
| 38 |
+
(Finset.univ.filter (fun t => side t = true)).card
|
| 39 |
+
(Finset.univ.filter (fun t => side t = false)).card (imm K n) = imm K n :=
|
| 40 |
+
bidegreeComponent_eq_self (imm_mem_bidegreeSubmodule K n side)
|
| 41 |
+
|
| 42 |
+
end Problem335
|
| 43 |
+
|
| 44 |
+
end
|
| 45 |
+
|
| 46 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmBlocks.lean
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.Basic
|
| 2 |
+
import OAI.Algebra.DepthFive.MatrixPaths
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
|
| 8 |
+
namespace Problem335
|
| 9 |
+
|
| 10 |
+
variable {K : Type*} [CommSemiring K] {n : ℕ}
|
| 11 |
+
|
| 12 |
+
/-- Each block of layer labels represents the product of its matrices. -/
|
| 13 |
+
def immBlock (K : Type*) [CommSemiring K] (n : ℕ) (labels : List (Fin n)) :
|
| 14 |
+
Matrix (Fin n) (Fin n) (MvPolynomial (Fin n × Fin n × Fin n) K) :=
|
| 15 |
+
(labels.map (immLayer K n)).prod
|
| 16 |
+
|
| 17 |
+
/-- Regrouping consecutive layers does not change the iterated matrix product. -/
|
| 18 |
+
theorem imm_eq_blocks_prod (hn : 0 < n) (blocks : List (List (Fin n)))
|
| 19 |
+
(hblocks : blocks.flatten = List.finRange n) :
|
| 20 |
+
imm K n = ((blocks.map (immBlock K n)).prod) ⟨0, hn⟩ ⟨0, hn⟩ := by
|
| 21 |
+
have hm : (blocks.map (fun b : List (Fin n) => b.map (immLayer K n))).flatten =
|
| 22 |
+
(List.finRange n).map (immLayer K n) := by
|
| 23 |
+
rw [← List.map_flatten, hblocks]
|
| 24 |
+
have hp : (blocks.map (immBlock K n)).prod =
|
| 25 |
+
((List.finRange n).map (immLayer K n)).prod := by
|
| 26 |
+
change (blocks.map (fun b : List (Fin n) => (b.map (immLayer K n)).prod)).prod = _
|
| 27 |
+
simpa only [List.prod_flatten, List.map_map, Function.comp_def] using
|
| 28 |
+
congrArg List.prod hm
|
| 29 |
+
rw [hp]
|
| 30 |
+
simp only [imm, dite_eq_left hn, List.ofFn_eq_map]
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
/-- The outer path expansion of the block matrices computes `imm`. -/
|
| 34 |
+
theorem imm_eq_blocks_path_sum (hn : 0 < n) (blocks : List (List (Fin n)))
|
| 35 |
+
(hblocks : blocks.flatten = List.finRange n) :
|
| 36 |
+
imm K n =
|
| 37 |
+
((matrixEntryPaths (List.finRange blocks.length) (⟨0, hn⟩ : Fin n) ⟨0, hn⟩).map
|
| 38 |
+
(fun p => (p.map (fun e =>
|
| 39 |
+
immBlock K n (blocks.get e.1) e.2.1 e.2.2)).prod)).sum := by
|
| 40 |
+
rw [matrixEntryPaths_sum_prod (fun j : Fin blocks.length => immBlock K n (blocks.get j))]
|
| 41 |
+
rw [imm_eq_blocks_prod hn blocks hblocks]
|
| 42 |
+
simp [← List.ofFn_eq_map]
|
| 43 |
+
|
| 44 |
+
end Problem335
|
| 45 |
+
|
| 46 |
+
end
|
| 47 |
+
|
| 48 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmCompatibleTrace.lean
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmSecondLocalBound
|
| 2 |
+
import OAI.Algebra.DepthFive.ImmPairingReindex
|
| 3 |
+
import OAI.Algebra.DepthFive.ImmProfileCompatibility
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
noncomputable section
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
namespace Problem335
|
| 10 |
+
|
| 11 |
+
private def totalImmProfile (n : ℕ)
|
| 12 |
+
(P : List (Fin n × Fin n × Fin n)) : Fin n → Fin n × Fin n :=
|
| 13 |
+
if h : P.map Prod.fst = List.finRange n then edgeProfile P h else fun t => (t, t)
|
| 14 |
+
|
| 15 |
+
private theorem totalImmProfile_get (n : ℕ) (hn : 0 < n)
|
| 16 |
+
(p : Fin (immPaths n hn).length) :
|
| 17 |
+
totalImmProfile n ((immPaths n hn).get p) = FockLayerProfile.immProfile n hn p := by
|
| 18 |
+
simp only [totalImmProfile, dite_eq_left (immPaths_labels n hn _ (List.get_mem _ p)),
|
| 19 |
+
FockLayerProfile.immProfile]
|
| 20 |
+
|
| 21 |
+
private theorem totalImmProfile_internal (d : ℕ) (p : Fin d → Fin (d + 1)) :
|
| 22 |
+
totalImmProfile (d + 1) (immInternalPathEdges d p) = immInternalCoordinate d p := by
|
| 23 |
+
funext t
|
| 24 |
+
simp only [totalImmProfile, dite_eq_left (immInternalPathEdges_labels d p),
|
| 25 |
+
edgeProfile_immInternalPathEdges]
|
| 26 |
+
|
| 27 |
+
/-- The actual second trace is bounded by the compatible endpoint-path local
|
| 28 |
+
occupation sum, with one source sum and no remaining representation hypotheses. -/
|
| 29 |
+
theorem immNormalizedMatrix_second_trace_le_compatible
|
| 30 |
+
(d : ℕ) (side : Fin (d + 1) → Bool) (a b : ℕ) :
|
| 31 |
+
let A := immNormalizedMatrix (d + 1) side a b
|
| 32 |
+
((A.conjTranspose * A) ^ 2).trace.re ≤
|
| 33 |
+
∑ M : ImmSourceIndex (d + 1) side a b,
|
| 34 |
+
∑ x : {x : Fin d → Pairings.Labels (Fin (d + 1)) // MomentPairing.Compatible 0 x},
|
| 35 |
+
∏ t : Fin (d + 1), LocalMoments.localPolynomial (side t)
|
| 36 |
+
(fun y => M.1 (t, y)) (MomentPairing.layerLabels 0 x.1 t).p
|
| 37 |
+
(MomentPairing.layerLabels 0 x.1 t).q
|
| 38 |
+
(MomentPairing.layerLabels 0 x.1 t).r := by
|
| 39 |
+
classical
|
| 40 |
+
refine (immNormalizedMatrix_second_trace_le_localPolynomial_sum
|
| 41 |
+
(d + 1) (Nat.succ_pos d) side a b).trans_eq ?_
|
| 42 |
+
apply Finset.sum_congr rfl
|
| 43 |
+
intro M hM
|
| 44 |
+
have h := sum_four_immPaths_compatible_eq d side
|
| 45 |
+
(fun P Q R _ => ∏ t : Fin (d + 1), LocalMoments.localPolynomial (side t)
|
| 46 |
+
(fun y => M.1 (t, y)) (totalImmProfile (d + 1) P t)
|
| 47 |
+
(totalImmProfile (d + 1) Q t) (totalImmProfile (d + 1) R t))
|
| 48 |
+
simp only [totalImmProfile_get, totalImmProfile_internal] at h
|
| 49 |
+
convert h using 1
|
| 50 |
+
· rfl
|
| 51 |
+
· apply Finset.sum_congr rfl
|
| 52 |
+
intro x hx
|
| 53 |
+
apply Finset.prod_congr rfl
|
| 54 |
+
intro t ht
|
| 55 |
+
rw [show x.1 = (fun i => ⟨(x.1 i).p, (x.1 i).q, (x.1 i).r, (x.1 i).s⟩) from rfl,
|
| 56 |
+
layerLabels_immInternalCoordinate]
|
| 57 |
+
|
| 58 |
+
end Problem335
|
| 59 |
+
|
| 60 |
+
end
|
| 61 |
+
|
| 62 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmDegree.lean
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.Basic
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
|
| 8 |
+
namespace Problem335
|
| 9 |
+
|
| 10 |
+
variable {K : Type*} [CommSemiring K]
|
| 11 |
+
|
| 12 |
+
/-- A product of matrices whose entries are linear is homogeneous in its length. -/
|
| 13 |
+
theorem matrix_list_prod_isHomogeneous {σ ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 14 |
+
(L : List (Matrix ι ι (MvPolynomial σ K)))
|
| 15 |
+
(hL : ∀ A ∈ L, ∀ i j, (A i j).IsHomogeneous 1) (i j : ι) :
|
| 16 |
+
(L.prod i j).IsHomogeneous L.length := by
|
| 17 |
+
induction L generalizing i j with
|
| 18 |
+
| nil =>
|
| 19 |
+
simp only [List.prod_nil, List.length_nil, Matrix.one_apply]
|
| 20 |
+
split_ifs
|
| 21 |
+
· exact MvPolynomial.isHomogeneous_one σ K
|
| 22 |
+
· exact MvPolynomial.isHomogeneous_zero σ K 0
|
| 23 |
+
| cons A L ih =>
|
| 24 |
+
simp only [List.prod_cons, List.length_cons, Matrix.mul_apply]
|
| 25 |
+
apply MvPolynomial.IsHomogeneous.sum
|
| 26 |
+
intro k hk
|
| 27 |
+
simpa only [Nat.add_comm] using
|
| 28 |
+
(hL A (List.mem_cons_self) i k).mul
|
| 29 |
+
(ih (fun B hB => hL B (List.mem_cons_of_mem A hB)) k j)
|
| 30 |
+
|
| 31 |
+
/-- The iterated matrix multiplication polynomial has its expected degree. -/
|
| 32 |
+
theorem imm_isHomogeneous (K : Type*) [CommSemiring K] (n : ℕ) :
|
| 33 |
+
(imm K n).IsHomogeneous n := by
|
| 34 |
+
classical
|
| 35 |
+
unfold imm
|
| 36 |
+
split_ifs with hn
|
| 37 |
+
· simpa only [List.length_ofFn] using
|
| 38 |
+
matrix_list_prod_isHomogeneous (List.ofFn (fun t : Fin n => immLayer K n t))
|
| 39 |
+
(by
|
| 40 |
+
intro A hA i j
|
| 41 |
+
obtain ⟨t, rfl⟩ := List.mem_ofFn.mp hA
|
| 42 |
+
exact MvPolynomial.isHomogeneous_X K (t, i, j))
|
| 43 |
+
(⟨0, hn⟩ : Fin n) (⟨0, hn⟩ : Fin n)
|
| 44 |
+
· exact MvPolynomial.isHomogeneous_zero _ _ _
|
| 45 |
+
|
| 46 |
+
/-- Matrix multiplication adds weighted degrees, including repeated layer occurrences. -/
|
| 47 |
+
theorem matrix_list_map_prod_isWeightedHomogeneous {σ ι τ M : Type*}
|
| 48 |
+
[Fintype ι] [DecidableEq ι] [AddCommMonoid M]
|
| 49 |
+
(w : σ → M) (A : τ → Matrix ι ι (MvPolynomial σ K)) (d : τ → M)
|
| 50 |
+
(L : List τ) (hA : ∀ t ∈ L, ∀ i j, (A t i j).IsWeightedHomogeneous w (d t))
|
| 51 |
+
(i j : ι) :
|
| 52 |
+
((L.map A).prod i j).IsWeightedHomogeneous w (L.map d).sum := by
|
| 53 |
+
induction L generalizing i j with
|
| 54 |
+
| nil =>
|
| 55 |
+
simp only [List.map_nil, List.prod_nil, List.sum_nil, Matrix.one_apply]
|
| 56 |
+
split_ifs
|
| 57 |
+
· exact MvPolynomial.isWeightedHomogeneous_one K w
|
| 58 |
+
· exact MvPolynomial.isWeightedHomogeneous_zero K w 0
|
| 59 |
+
| cons t L ih =>
|
| 60 |
+
simp only [List.map_cons, List.prod_cons, List.sum_cons, Matrix.mul_apply]
|
| 61 |
+
apply MvPolynomial.IsWeightedHomogeneous.sum
|
| 62 |
+
intro k hk
|
| 63 |
+
exact (hA t List.mem_cons_self i k).mul
|
| 64 |
+
(ih (fun s hs => hA s (List.mem_cons_of_mem t hs)) k j)
|
| 65 |
+
|
| 66 |
+
/-- Every monomial of IMM uses each matrix layer once, expressed with arbitrary additive weights. -/
|
| 67 |
+
theorem imm_isWeightedHomogeneous (K : Type*) [CommSemiring K] (n : ℕ)
|
| 68 |
+
{M : Type*} [AddCommMonoid M] (w : Fin n → M) :
|
| 69 |
+
(imm K n).IsWeightedHomogeneous (fun x => w x.1) (∑ t, w t) := by
|
| 70 |
+
classical
|
| 71 |
+
unfold imm
|
| 72 |
+
split_ifs with hn
|
| 73 |
+
· simpa only [← List.ofFn_eq_map, List.sum_ofFn] using
|
| 74 |
+
matrix_list_map_prod_isWeightedHomogeneous
|
| 75 |
+
(fun x : Fin n × Fin n × Fin n => w x.1) (immLayer K n) w (List.finRange n)
|
| 76 |
+
(fun t ht i j => MvPolynomial.isWeightedHomogeneous_X K _ (t, i, j))
|
| 77 |
+
(⟨0, hn⟩ : Fin n) (⟨0, hn⟩ : Fin n)
|
| 78 |
+
· exact MvPolynomial.isWeightedHomogeneous_zero _ _ _
|
| 79 |
+
|
| 80 |
+
/-- The degree in any selected collection of matrix layers is its cardinality. -/
|
| 81 |
+
theorem imm_layers_isWeightedHomogeneous (K : Type*) [CommSemiring K] (n : ℕ)
|
| 82 |
+
(s : Finset (Fin n)) :
|
| 83 |
+
(imm K n).IsWeightedHomogeneous (fun x => if x.1 ∈ s then 1 else 0) s.card := by
|
| 84 |
+
classical
|
| 85 |
+
simpa using imm_isWeightedHomogeneous K n (fun t => if t ∈ s then (1 : ℕ) else 0)
|
| 86 |
+
|
| 87 |
+
/-- A support monomial has degree exactly one in each individual matrix layer. -/
|
| 88 |
+
theorem imm_support_layer_weight (K : Type*) [CommSemiring K] (n : ℕ)
|
| 89 |
+
(t : Fin n) {d : (Fin n × Fin n × Fin n) →₀ ℕ} (hd : d ∈ (imm K n).support) :
|
| 90 |
+
Finsupp.weight (fun x : Fin n × Fin n × Fin n => if x.1 = t then (1 : ℕ) else 0) d = 1 := by
|
| 91 |
+
classical
|
| 92 |
+
simpa using
|
| 93 |
+
(imm_isWeightedHomogeneous K n (fun s => if s = t then (1 : ℕ) else 0))
|
| 94 |
+
(MvPolynomial.mem_support_iff.mp hd)
|
| 95 |
+
|
| 96 |
+
/-- IMM is multilinear in every matrix-entry variable. -/
|
| 97 |
+
theorem imm_degreeOf_le_one (K : Type*) [CommSemiring K] (n : ℕ)
|
| 98 |
+
(x : Fin n × Fin n × Fin n) : (imm K n).degreeOf x ≤ 1 := by
|
| 99 |
+
classical
|
| 100 |
+
apply MvPolynomial.degreeOf_le_iff.mpr
|
| 101 |
+
intro d hd
|
| 102 |
+
have hdeg := imm_support_layer_weight K n x.1 hd
|
| 103 |
+
rw [Finsupp.weight_apply, Finsupp.sum] at hdeg
|
| 104 |
+
by_cases hx : d x = 0
|
| 105 |
+
· simp [hx]
|
| 106 |
+
· calc
|
| 107 |
+
d x = d x • (if x.1 = x.1 then (1 : ℕ) else 0) := by simp
|
| 108 |
+
_ ≤ ∑ y ∈ d.support, d y • (if y.1 = x.1 then (1 : ℕ) else 0) :=
|
| 109 |
+
Finset.single_le_sum (f := fun y => d y • (if y.1 = x.1 then (1 : ℕ) else 0))
|
| 110 |
+
(fun y hy => Nat.zero_le _) (Finsupp.mem_support_iff.mpr hx)
|
| 111 |
+
_ = 1 := hdeg
|
| 112 |
+
|
| 113 |
+
/-- Evaluation assigning every matrix layer the identity matrix. -/
|
| 114 |
+
def immIdentityEvaluation (K : Type*) [CommSemiring K] (n : ℕ) :
|
| 115 |
+
MvPolynomial (Fin n × Fin n × Fin n) K →+* K :=
|
| 116 |
+
MvPolynomial.eval (fun x => if x.2.1 = x.2.2 then 1 else 0)
|
| 117 |
+
|
| 118 |
+
@[simp] theorem immIdentityEvaluation_layer (n : ℕ) (t : Fin n) :
|
| 119 |
+
(immIdentityEvaluation K n).mapMatrix (immLayer K n t) = 1 := by
|
| 120 |
+
classical
|
| 121 |
+
ext i j
|
| 122 |
+
simp [immIdentityEvaluation, immLayer, Matrix.one_apply]
|
| 123 |
+
|
| 124 |
+
/-- Evaluation at identity matrices sends any product of variable layers to the identity. -/
|
| 125 |
+
theorem immIdentityEvaluation_layers (n : ℕ) (L : List (Fin n)) :
|
| 126 |
+
(immIdentityEvaluation K n).mapMatrix ((L.map (immLayer K n)).prod) = 1 := by
|
| 127 |
+
classical
|
| 128 |
+
rw [map_list_prod, List.map_map]
|
| 129 |
+
simp only [Function.comp_def, immIdentityEvaluation_layer]
|
| 130 |
+
simp
|
| 131 |
+
|
| 132 |
+
@[simp] theorem immIdentityEvaluation_imm (n : ℕ) (hn : 0 < n) :
|
| 133 |
+
immIdentityEvaluation K n (imm K n) = 1 := by
|
| 134 |
+
classical
|
| 135 |
+
unfold imm
|
| 136 |
+
simp only [dite_eq_left hn]
|
| 137 |
+
have h : (immIdentityEvaluation K n).mapMatrix
|
| 138 |
+
(List.ofFn (fun t : Fin n => immLayer K n t)).prod = 1 := by
|
| 139 |
+
rw [map_list_prod, List.map_ofFn]
|
| 140 |
+
simp only [Function.comp_def, immIdentityEvaluation_layer]
|
| 141 |
+
simp
|
| 142 |
+
exact congrArg (fun A : Matrix (Fin n) (Fin n) K =>
|
| 143 |
+
A ⟨0, hn⟩ ⟨0, hn⟩) h
|
| 144 |
+
|
| 145 |
+
/-- IMM does not vanish over any nontrivial coefficient semiring when its size is positive. -/
|
| 146 |
+
theorem imm_ne_zero (K : Type*) [CommSemiring K] [Nontrivial K] (n : ℕ) (hn : 0 < n) :
|
| 147 |
+
imm K n ≠ 0 := by
|
| 148 |
+
intro h
|
| 149 |
+
have he := immIdentityEvaluation_imm (K := K) n hn
|
| 150 |
+
rw [h, map_zero] at he
|
| 151 |
+
exact zero_ne_one he
|
| 152 |
+
|
| 153 |
+
/-- The total degree of IMM is the number of matrix layers. -/
|
| 154 |
+
theorem imm_totalDegree (K : Type*) [CommSemiring K] [Nontrivial K] (n : ℕ) :
|
| 155 |
+
(imm K n).totalDegree = n := by
|
| 156 |
+
by_cases hn : 0 < n
|
| 157 |
+
· exact (imm_isHomogeneous K n).totalDegree (imm_ne_zero K n hn)
|
| 158 |
+
· have hn0 : n = 0 := Nat.eq_zero_of_not_pos hn
|
| 159 |
+
subst n
|
| 160 |
+
simp [imm]
|
| 161 |
+
|
| 162 |
+
end Problem335
|
| 163 |
+
|
| 164 |
+
end
|
| 165 |
+
|
| 166 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmFiniteMatrix.lean
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.FiniteOperator
|
| 2 |
+
import OAI.Algebra.DepthFive.ImmFockMatrix
|
| 3 |
+
import OAI.Algebra.DepthFive.FockBidegreeBasis
|
| 4 |
+
import OAI.Algebra.DepthFive.TraceExpansion
|
| 5 |
+
import OAI.Algebra.DepthFive.PathInjectivity
|
| 6 |
+
|
| 7 |
+
namespace OAI
|
| 8 |
+
|
| 9 |
+
noncomputable section
|
| 10 |
+
open scoped BigOperators
|
| 11 |
+
|
| 12 |
+
namespace Problem335
|
| 13 |
+
|
| 14 |
+
/-- The number of derivative layers in a layerwise partition. -/
|
| 15 |
+
def immLayerVCount {n : ℕ} (side : Fin n → Bool) : ℕ :=
|
| 16 |
+
(Finset.univ.filter (fun t => side t = true)).card
|
| 17 |
+
|
| 18 |
+
/-- The number of multiplication layers in a layerwise partition. -/
|
| 19 |
+
def immLayerUCount {n : ℕ} (side : Fin n → Bool) : ℕ :=
|
| 20 |
+
(Finset.univ.filter (fun t => side t = false)).card
|
| 21 |
+
|
| 22 |
+
/-- Source exponent vectors for the finite IMM operator. -/
|
| 23 |
+
abbrev ImmSourceIndex (n : ℕ) (side : Fin n → Bool) (a b : ℕ) :=
|
| 24 |
+
BidegreeIndex (fun x : Fin n × Fin n × Fin n => side x.1) a b
|
| 25 |
+
|
| 26 |
+
/-- Target exponent vectors for the finite IMM operator. -/
|
| 27 |
+
abbrev ImmTargetIndex (n : ℕ) (side : Fin n → Bool) (a b : ℕ) :=
|
| 28 |
+
BidegreeIndex (fun x : Fin n × Fin n × Fin n => side x.1)
|
| 29 |
+
(a - immLayerVCount side) (b + immLayerUCount side)
|
| 30 |
+
|
| 31 |
+
/-- The actual finite IMM map written in factorial-normalized source and target bases. -/
|
| 32 |
+
def immNormalizedMatrix (n : ℕ) (side : Fin n → Bool) (a b : ℕ) :
|
| 33 |
+
Matrix (ImmTargetIndex n side a b) (ImmSourceIndex n side a b) ℂ :=
|
| 34 |
+
LinearMap.toMatrix
|
| 35 |
+
(bidegreeComplexFockBasis (σ := Fin n × Fin n × Fin n) (fun x => side x.1) a b)
|
| 36 |
+
(bidegreeComplexFockBasis (σ := Fin n × Fin n × Fin n) (fun x => side x.1)
|
| 37 |
+
(a - immLayerVCount side) (b + immLayerUCount side))
|
| 38 |
+
(finiteMixedOperator (K := ℂ) (σ := Fin n × Fin n × Fin n) (fun x => side x.1) a b
|
| 39 |
+
(immLayerVCount side) (immLayerUCount side) (imm ℂ n))
|
| 40 |
+
|
| 41 |
+
/-- Each finite normalized matrix entry is exactly the weighted sum of its IMM path shifts. -/
|
| 42 |
+
theorem immNormalizedMatrix_apply (n : ℕ) (hn : 0 < n) (side : Fin n → Bool)
|
| 43 |
+
(a b : ℕ) (e : ImmTargetIndex n side a b) (d : ImmSourceIndex n side a b) :
|
| 44 |
+
immNormalizedMatrix n side a b e d =
|
| 45 |
+
∑ p : Fin (immPaths n hn).length,
|
| 46 |
+
if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1
|
| 47 |
+
then (immPathAmplitude n hn (fun x => side x.1) d.1 p : ℂ) else 0 := by
|
| 48 |
+
classical
|
| 49 |
+
unfold immNormalizedMatrix
|
| 50 |
+
rw [LinearMap.toMatrix_apply, bidegreeComplexFockBasis_repr]
|
| 51 |
+
change (Real.sqrt (multiFactorial e.1 : ℝ) : ℂ) *
|
| 52 |
+
(mixedOperator (fun x => side x.1)
|
| 53 |
+
(bidegreeComponent (fun x => side x.1) (immLayerVCount side) (immLayerUCount side)
|
| 54 |
+
(imm ℂ n))
|
| 55 |
+
((bidegreeComplexFockBasis (σ := Fin n × Fin n × Fin n)
|
| 56 |
+
(fun x => side x.1) a b d) : MvPolynomial (Fin n × Fin n × Fin n) ℂ)).coeff e.1 = _
|
| 57 |
+
rw [bidegreeComplexFockBasis_apply]
|
| 58 |
+
simp only [immLayerVCount, immLayerUCount, bidegreeComponent_imm]
|
| 59 |
+
rw [← complexFockBasis_repr]
|
| 60 |
+
exact complexFockBasis_repr_mixedOperator_imm n hn (fun x => side x.1) d.1 e.1
|
| 61 |
+
|
| 62 |
+
/-- The finite normalized matrix computes exactly the manuscript's rank measure. -/
|
| 63 |
+
theorem immNormalizedMatrix_rank (n : ℕ) (side : Fin n → Bool) (a b : ℕ) :
|
| 64 |
+
(immNormalizedMatrix n side a b).rank =
|
| 65 |
+
bidegreeRank (fun x => side x.1) a b
|
| 66 |
+
(immLayerVCount side) (immLayerUCount side) (imm ℂ n) := by
|
| 67 |
+
rw [immNormalizedMatrix, ← RankMeasure.mapRank_eq_matrixRank, finiteMixedOperator_rank]
|
| 68 |
+
|
| 69 |
+
/-- The genuine target occupation, with an irrelevant fallback for zero-amplitude paths. -/
|
| 70 |
+
def immTargetShift (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ)
|
| 71 |
+
[Nonempty (ImmTargetIndex n side a b)]
|
| 72 |
+
(d : ImmSourceIndex n side a b) (p : Fin (immPaths n hn).length) :
|
| 73 |
+
ImmTargetIndex n side a b := by
|
| 74 |
+
classical
|
| 75 |
+
exact if h : Finsupp.weight (bidegreeWeight (fun x => side x.1))
|
| 76 |
+
(immPathOccupation n hn (fun x => side x.1) d.1 p) =
|
| 77 |
+
(a - immLayerVCount side, b + immLayerUCount side)
|
| 78 |
+
then ⟨_, h⟩ else Classical.choice inferInstance
|
| 79 |
+
|
| 80 |
+
/-- Nonzero paths never use the arbitrary fallback index. -/
|
| 81 |
+
theorem immTargetShift_val_of_amplitude_ne_zero (n : ℕ) (hn : 0 < n)
|
| 82 |
+
(side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)]
|
| 83 |
+
(d : ImmSourceIndex n side a b) (p : Fin (immPaths n hn).length)
|
| 84 |
+
(hp : immPathAmplitude n hn (fun x => side x.1) d.1 p ≠ 0) :
|
| 85 |
+
(immTargetShift n hn side a b d p).1 =
|
| 86 |
+
immPathOccupation n hn (fun x => side x.1) d.1 p := by
|
| 87 |
+
have h := immPathOccupation_bidegree_of_amplitude_ne_zero n hn side a b d.1 d.2 p hp
|
| 88 |
+
unfold immTargetShift
|
| 89 |
+
split_ifs with hdegree
|
| 90 |
+
· rfl
|
| 91 |
+
· exact False.elim (hdegree h)
|
| 92 |
+
|
| 93 |
+
/-- The actual normalized IMM matrix is the finite weighted path-shift matrix. -/
|
| 94 |
+
theorem immNormalizedMatrix_eq_pathShiftMatrix (n : ℕ) (hn : 0 < n)
|
| 95 |
+
(side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)] :
|
| 96 |
+
immNormalizedMatrix n side a b =
|
| 97 |
+
pathShiftMatrix (immTargetShift n hn side a b)
|
| 98 |
+
(fun d p => (immPathAmplitude n hn (fun x => side x.1) d.1 p : ℂ)) := by
|
| 99 |
+
classical
|
| 100 |
+
ext e d
|
| 101 |
+
rw [immNormalizedMatrix_apply n hn side a b e d]
|
| 102 |
+
unfold pathShiftMatrix
|
| 103 |
+
apply Finset.sum_congr rfl
|
| 104 |
+
intro p hp
|
| 105 |
+
by_cases ha : immPathAmplitude n hn (fun x => side x.1) d.1 p = 0
|
| 106 |
+
· simp [ha]
|
| 107 |
+
· have hs := immTargetShift_val_of_amplitude_ne_zero n hn side a b d p ha
|
| 108 |
+
have he : immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 ↔
|
| 109 |
+
immTargetShift n hn side a b d p = e := by
|
| 110 |
+
rw [Subtype.ext_iff, hs]
|
| 111 |
+
simp only [he]
|
| 112 |
+
|
| 113 |
+
/-- Distinct nonzero path contributions cannot reach the same occupation vector. -/
|
| 114 |
+
theorem immPathOccupation_injective_of_nonzero (n : ℕ) (hn : 0 < n)
|
| 115 |
+
(side : Fin n → Bool) (d : (Fin n × Fin n × Fin n) →₀ ℕ)
|
| 116 |
+
(p q : Fin (immPaths n hn).length)
|
| 117 |
+
(hp : immPathAmplitude n hn (fun x => side x.1) d p ≠ 0)
|
| 118 |
+
(hq : immPathAmplitude n hn (fun x => side x.1) d q ≠ 0)
|
| 119 |
+
(heq : immPathOccupation n hn (fun x => side x.1) d p =
|
| 120 |
+
immPathOccupation n hn (fun x => side x.1) d q) : p = q := by
|
| 121 |
+
have hsp := signedOccupation_path_of_amplitude_ne_zero (fun x : Fin n × Fin n × Fin n => side x.1)
|
| 122 |
+
((immPaths n hn).get p) (immPaths_nodup n hn _ (List.get_mem _ p)) d hp
|
| 123 |
+
have hsq := signedOccupation_path_of_amplitude_ne_zero (fun x : Fin n × Fin n × Fin n => side x.1)
|
| 124 |
+
((immPaths n hn).get q) (immPaths_nodup n hn _ (List.get_mem _ q)) d hq
|
| 125 |
+
have hs := congrArg signedOccupation heq
|
| 126 |
+
change signedOccupation (pathOccupation _ _ _) =
|
| 127 |
+
signedOccupation (pathOccupation _ _ _) at hs
|
| 128 |
+
rw [hsp, hsq] at hs
|
| 129 |
+
have hshift := add_left_cancel hs
|
| 130 |
+
apply immPaths_get_injective n hn
|
| 131 |
+
apply edgeListShift_injective_of_labels side (List.finRange n) (List.nodup_finRange n)
|
| 132 |
+
_ _ (immPaths_labels n hn _ (List.get_mem _ p))
|
| 133 |
+
(immPaths_labels n hn _ (List.get_mem _ q))
|
| 134 |
+
simpa only [edgeListShift_eq_sum, occupationShift] using hshift
|
| 135 |
+
|
| 136 |
+
/-- Any collision of distinct finite shifts has a zero-amplitude contribution. -/
|
| 137 |
+
theorem immTargetShift_collision_zero (n : ℕ) (hn : 0 < n)
|
| 138 |
+
(side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)]
|
| 139 |
+
(d : ImmSourceIndex n side a b) (p q : Fin (immPaths n hn).length)
|
| 140 |
+
(hpq : p ≠ q) (hs : immTargetShift n hn side a b d p =
|
| 141 |
+
immTargetShift n hn side a b d q) :
|
| 142 |
+
immPathAmplitude n hn (fun x => side x.1) d.1 p = 0 ∨
|
| 143 |
+
immPathAmplitude n hn (fun x => side x.1) d.1 q = 0 := by
|
| 144 |
+
by_cases hp : immPathAmplitude n hn (fun x => side x.1) d.1 p = 0
|
| 145 |
+
· exact Or.inl hp
|
| 146 |
+
by_cases hq : immPathAmplitude n hn (fun x => side x.1) d.1 q = 0
|
| 147 |
+
· exact Or.inr hq
|
| 148 |
+
apply False.elim
|
| 149 |
+
apply hpq
|
| 150 |
+
apply immPathOccupation_injective_of_nonzero n hn side d.1 p q hp hq
|
| 151 |
+
have hv := congrArg Subtype.val hs
|
| 152 |
+
simpa only [immTargetShift_val_of_amplitude_ne_zero n hn side a b d p hp,
|
| 153 |
+
immTargetShift_val_of_amplitude_ne_zero n hn side a b d q hq] using hv
|
| 154 |
+
|
| 155 |
+
/-- All entries of the normalized IMM operator are real, so adjoint equals transpose. -/
|
| 156 |
+
theorem immNormalizedMatrix_conjTranspose (n : ℕ) (hn : 0 < n)
|
| 157 |
+
(side : Fin n → Bool) (a b : ℕ) :
|
| 158 |
+
(immNormalizedMatrix n side a b).conjTranspose =
|
| 159 |
+
(immNormalizedMatrix n side a b).transpose := by
|
| 160 |
+
classical
|
| 161 |
+
ext d e
|
| 162 |
+
simp only [Matrix.conjTranspose_apply, Matrix.transpose_apply,
|
| 163 |
+
immNormalizedMatrix_apply n hn side a b]
|
| 164 |
+
simp only [star_sum]
|
| 165 |
+
apply Finset.sum_congr rfl
|
| 166 |
+
intro p hp
|
| 167 |
+
split_ifs <;> simp
|
| 168 |
+
|
| 169 |
+
/-- The first Gram trace of the actual IMM operator is its total path occupation mass. -/
|
| 170 |
+
theorem immNormalizedMatrix_first_trace (n : ℕ) (hn : 0 < n)
|
| 171 |
+
(side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)] :
|
| 172 |
+
Matrix.trace ((immNormalizedMatrix n side a b).conjTranspose *
|
| 173 |
+
immNormalizedMatrix n side a b) =
|
| 174 |
+
∑ d : ImmSourceIndex n side a b, ∑ p : Fin (immPaths n hn).length,
|
| 175 |
+
((immPathAmplitude n hn (fun x => side x.1) d.1 p) ^ 2 : ℝ) := by
|
| 176 |
+
classical
|
| 177 |
+
rw [immNormalizedMatrix_conjTranspose n hn side a b,
|
| 178 |
+
immNormalizedMatrix_eq_pathShiftMatrix n hn side a b,
|
| 179 |
+
pathShiftMatrix_first_trace]
|
| 180 |
+
· simp
|
| 181 |
+
· intro d p q hpq hs
|
| 182 |
+
rcases immTargetShift_collision_zero n hn side a b d p q hpq hs with hp | hq
|
| 183 |
+
· simp [hp]
|
| 184 |
+
· simp [hq]
|
| 185 |
+
|
| 186 |
+
end Problem335
|
| 187 |
+
|
| 188 |
+
end
|
| 189 |
+
|
| 190 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmFirstMomentBound.lean
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmFirstTrace
|
| 2 |
+
import OAI.Algebra.DepthFive.PathMassLowerBound
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators Matrix
|
| 8 |
+
|
| 9 |
+
namespace Problem335
|
| 10 |
+
|
| 11 |
+
/-- The independent geometric benchmark for one IMM path. -/
|
| 12 |
+
def immFirstMomentMean (n : ℕ) (side : Fin n → Bool) (a b : ℕ) : ℝ :=
|
| 13 |
+
((a : ℝ) / Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = true}) ^
|
| 14 |
+
immLayerVCount side *
|
| 15 |
+
(1 + (b : ℝ) / Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = false}) ^
|
| 16 |
+
immLayerUCount side
|
| 17 |
+
|
| 18 |
+
/-- The explicit finite-size occupation loss, before parameter specialization. -/
|
| 19 |
+
def immFirstMomentLoss (n : ℕ) (side : Fin n → Bool) (a b : ℕ) : ℝ :=
|
| 20 |
+
(immLayerVCount side : ℝ) ^ 2 / a +
|
| 21 |
+
(immLayerVCount side : ℝ) ^ 2 /
|
| 22 |
+
(2 * Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = true}) +
|
| 23 |
+
(immLayerUCount side : ℝ) ^ 2 / b +
|
| 24 |
+
(immLayerUCount side : ℝ) ^ 2 /
|
| 25 |
+
(2 * Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = false})
|
| 26 |
+
|
| 27 |
+
/-- First-moment lower bound for the actual finite normalized IMM matrix.
|
| 28 |
+
The only hypotheses are positive occupation totals, nonempty variable groups,
|
| 29 |
+
and the elementary order range required by the occupation ratio estimate. -/
|
| 30 |
+
theorem immNormalizedMatrix_first_moment_lower
|
| 31 |
+
(n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ)
|
| 32 |
+
[Nonempty {x : Fin n × Fin n × Fin n // side x.1 = true}]
|
| 33 |
+
[Nonempty {x : Fin n × Fin n × Fin n // side x.1 = false}]
|
| 34 |
+
(ha : 0 < a) (hb : 0 < b)
|
| 35 |
+
(hk : 2 * immLayerVCount side ≤ a) (hm : 2 * immLayerUCount side ≤ b) :
|
| 36 |
+
(Fintype.card (ImmSourceIndex n side a b) : ℝ) * (n : ℝ) ^ (n - 1) *
|
| 37 |
+
(Real.exp (-immFirstMomentLoss n side a b) * immFirstMomentMean n side a b) ≤
|
| 38 |
+
((immNormalizedMatrix n side a b).conjTranspose *
|
| 39 |
+
immNormalizedMatrix n side a b).trace.re := by
|
| 40 |
+
classical
|
| 41 |
+
apply immNormalizedMatrix_first_trace_lower_of_average n hn side a b
|
| 42 |
+
intro p
|
| 43 |
+
have h := immPath_source_mass_lower n hn side a b ((immPaths n hn).get p)
|
| 44 |
+
(List.get_mem _ p) ha hb hk hm
|
| 45 |
+
change _ ≤ (∑ d : ImmSourceIndex n side a b,
|
| 46 |
+
immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2) /
|
| 47 |
+
(Fintype.card (ImmSourceIndex n side a b) : ℝ) at h
|
| 48 |
+
convert h using 1
|
| 49 |
+
apply congrArg₂ (fun x y : ℝ => x * y)
|
| 50 |
+
· apply congrArg Real.exp
|
| 51 |
+
dsimp [immFirstMomentLoss, immLayerVCount, immLayerUCount]
|
| 52 |
+
ring
|
| 53 |
+
· rfl
|
| 54 |
+
|
| 55 |
+
end Problem335
|
| 56 |
+
|
| 57 |
+
end
|
| 58 |
+
|
| 59 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmFirstMomentParameters.lean
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmFirstTrace
|
| 2 |
+
import OAI.Algebra.DepthFive.PathMassParameters
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators Matrix
|
| 8 |
+
|
| 9 |
+
namespace Problem335
|
| 10 |
+
|
| 11 |
+
open LowerParameters
|
| 12 |
+
|
| 13 |
+
/-- The first trace of the actual finite normalized IMM matrix at the canonical
|
| 14 |
+
occupation parameters. The path-count and geometric scale agree with the second
|
| 15 |
+
moment normalization; there are no auxiliary matrix-identity hypotheses. -/
|
| 16 |
+
theorem immNormalizedMatrix_first_moment_lower_parameters {n : ℕ} (hn : 16 ≤ n)
|
| 17 |
+
(side : Fin n → Bool) (hk : immLayerVCount side = k n)
|
| 18 |
+
(hm : immLayerUCount side = m n) :
|
| 19 |
+
(Fintype.card (ImmSourceIndex n side (a n) (b n)) : ℝ) *
|
| 20 |
+
((n : ℝ) ^ (n - 1) *
|
| 21 |
+
(((a n : ℝ) / v n) ^ k n * (1 + (b n : ℝ) / u n) ^ m n)) *
|
| 22 |
+
Real.exp (-64 / Real.sqrt (n : ℝ)) ≤
|
| 23 |
+
((immNormalizedMatrix n side (a n) (b n)).conjTranspose *
|
| 24 |
+
immNormalizedMatrix n side (a n) (b n)).trace.re := by
|
| 25 |
+
classical
|
| 26 |
+
have h := immNormalizedMatrix_first_trace_lower_of_average n (by omega)
|
| 27 |
+
side (a n) (b n)
|
| 28 |
+
(Real.exp (-64 / Real.sqrt (n : ℝ)) *
|
| 29 |
+
(((a n : ℝ) / v n) ^ k n * (1 + (b n : ℝ) / u n) ^ m n)) (by
|
| 30 |
+
intro p
|
| 31 |
+
have hpath := immPath_source_mass_lower_parameters hn side hk hm
|
| 32 |
+
((immPaths n (by omega)).get p) (List.get_mem _ p)
|
| 33 |
+
change _ ≤ (∑ d : ImmSourceIndex n side (a n) (b n),
|
| 34 |
+
immPathAmplitude n (by omega) (fun x => side x.1) d.1 p ^ 2) /
|
| 35 |
+
(Fintype.card (ImmSourceIndex n side (a n) (b n)) : ℝ) at hpath
|
| 36 |
+
exact hpath)
|
| 37 |
+
simpa only [mul_assoc, mul_left_comm, mul_comm] using h
|
| 38 |
+
|
| 39 |
+
/-- A weaker square-root-exponential version is convenient for the final
|
| 40 |
+
rank lower bound, whose constant absorbs both trace losses. -/
|
| 41 |
+
theorem immNormalizedMatrix_first_moment_lower_sqrt {n : ℕ} (hn : 16 ≤ n)
|
| 42 |
+
(side : Fin n → Bool) (hk : immLayerVCount side = k n)
|
| 43 |
+
(hm : immLayerUCount side = m n) :
|
| 44 |
+
(Fintype.card (ImmSourceIndex n side (a n) (b n)) : ℝ) *
|
| 45 |
+
((n : ℝ) ^ (n - 1) *
|
| 46 |
+
(((a n : ℝ) / v n) ^ k n * (1 + (b n : ℝ) / u n) ^ m n)) *
|
| 47 |
+
Real.exp (-64 * Real.sqrt (n : ℝ)) ≤
|
| 48 |
+
((immNormalizedMatrix n side (a n) (b n)).conjTranspose *
|
| 49 |
+
immNormalizedMatrix n side (a n) (b n)).trace.re := by
|
| 50 |
+
have hs := sqrt_ge_four hn
|
| 51 |
+
have hspos : 0 < Real.sqrt (n : ℝ) := by linarith
|
| 52 |
+
have hexp : Real.exp (-64 * Real.sqrt (n : ℝ)) ≤
|
| 53 |
+
Real.exp (-64 / Real.sqrt (n : ℝ)) := by
|
| 54 |
+
apply Real.exp_le_exp.mpr
|
| 55 |
+
apply (le_div_iff₀ hspos).mpr
|
| 56 |
+
nlinarith [sq_nonneg (Real.sqrt (n : ℝ) - 1)]
|
| 57 |
+
exact (mul_le_mul_of_nonneg_left hexp (by positivity)).trans
|
| 58 |
+
(immNormalizedMatrix_first_moment_lower_parameters hn side hk hm)
|
| 59 |
+
|
| 60 |
+
end Problem335
|
| 61 |
+
|
| 62 |
+
end
|
| 63 |
+
|
| 64 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmFirstTrace.lean
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmFiniteMatrix
|
| 2 |
+
import OAI.Algebra.DepthFive.FirstTraceNonnegative
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators Matrix
|
| 8 |
+
|
| 9 |
+
namespace Problem335
|
| 10 |
+
|
| 11 |
+
/-- The real, nonnegative matrix underlying the actual normalized IMM map. -/
|
| 12 |
+
def immRealNormalizedMatrix (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) :
|
| 13 |
+
Matrix (ImmTargetIndex n side a b) (ImmSourceIndex n side a b) ℝ := by
|
| 14 |
+
classical
|
| 15 |
+
exact fun e d => ∑ p : Fin (immPaths n hn).length,
|
| 16 |
+
if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1
|
| 17 |
+
then immPathAmplitude n hn (fun x => side x.1) d.1 p else 0
|
| 18 |
+
|
| 19 |
+
theorem immNormalizedMatrix_eq_map_real (n : ℕ) (hn : 0 < n)
|
| 20 |
+
(side : Fin n → Bool) (a b : ℕ) :
|
| 21 |
+
immNormalizedMatrix n side a b =
|
| 22 |
+
(immRealNormalizedMatrix n hn side a b).map Complex.ofReal := by
|
| 23 |
+
classical
|
| 24 |
+
ext e d
|
| 25 |
+
rw [immNormalizedMatrix_apply n hn]
|
| 26 |
+
simp only [Matrix.map_apply, immRealNormalizedMatrix, Complex.ofReal_sum]
|
| 27 |
+
apply Finset.sum_congr rfl
|
| 28 |
+
intro p hp
|
| 29 |
+
split_ifs <;> simp
|
| 30 |
+
|
| 31 |
+
/-- Every nonzero path amplitude occurs in exactly one genuine target row.
|
| 32 |
+
Zero-amplitude paths need no artificial target-row choice. -/
|
| 33 |
+
theorem immPathAmplitude_sq_sum_target (n : ℕ) (hn : 0 < n)
|
| 34 |
+
(side : Fin n → Bool) (a b : ℕ) (d : ImmSourceIndex n side a b)
|
| 35 |
+
(p : Fin (immPaths n hn).length) :
|
| 36 |
+
(∑ e : ImmTargetIndex n side a b,
|
| 37 |
+
(if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1
|
| 38 |
+
then immPathAmplitude n hn (fun x => side x.1) d.1 p else 0) ^ 2) =
|
| 39 |
+
immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2 := by
|
| 40 |
+
classical
|
| 41 |
+
by_cases hw : immPathAmplitude n hn (fun x => side x.1) d.1 p = 0
|
| 42 |
+
· simp [hw]
|
| 43 |
+
let e : ImmTargetIndex n side a b :=
|
| 44 |
+
⟨immPathOccupation n hn (fun x => side x.1) d.1 p,
|
| 45 |
+
immPathOccupation_bidegree_of_amplitude_ne_zero n hn side a b d.1 d.2 p hw⟩
|
| 46 |
+
rw [Finset.sum_eq_single e]
|
| 47 |
+
· simp [e]
|
| 48 |
+
· intro e' he' hne
|
| 49 |
+
have hocc : immPathOccupation n hn (fun x => side x.1) d.1 p ≠ e'.1 := by
|
| 50 |
+
intro heq
|
| 51 |
+
apply hne
|
| 52 |
+
exact Subtype.ext heq.symm
|
| 53 |
+
simp [hocc]
|
| 54 |
+
· simp
|
| 55 |
+
|
| 56 |
+
/-- Actual normalized IMM first trace dominates the total occupation mass.
|
| 57 |
+
Nonnegative coefficients make path-collision analysis unnecessary for this
|
| 58 |
+
lower bound. All sources and targets are the genuine finite bidegree spaces. -/
|
| 59 |
+
theorem immNormalizedMatrix_first_trace_lower (n : ℕ) (hn : 0 < n)
|
| 60 |
+
(side : Fin n → Bool) (a b : ℕ) :
|
| 61 |
+
(∑ d : ImmSourceIndex n side a b, ∑ p : Fin (immPaths n hn).length,
|
| 62 |
+
immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2) ≤
|
| 63 |
+
((immNormalizedMatrix n side a b).conjTranspose *
|
| 64 |
+
immNormalizedMatrix n side a b).trace.re := by
|
| 65 |
+
classical
|
| 66 |
+
rw [immNormalizedMatrix_eq_map_real n hn, complexify_first_trace,
|
| 67 |
+
trace_transpose_mul_self]
|
| 68 |
+
apply Finset.sum_le_sum
|
| 69 |
+
intro d hd
|
| 70 |
+
calc
|
| 71 |
+
_ = ∑ p : Fin (immPaths n hn).length, ∑ e : ImmTargetIndex n side a b,
|
| 72 |
+
(if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1
|
| 73 |
+
then immPathAmplitude n hn (fun x => side x.1) d.1 p else 0) ^ 2 := by
|
| 74 |
+
apply Finset.sum_congr rfl
|
| 75 |
+
intro p hp
|
| 76 |
+
exact (immPathAmplitude_sq_sum_target n hn side a b d p).symm
|
| 77 |
+
_ = ∑ e : ImmTargetIndex n side a b, ∑ p : Fin (immPaths n hn).length,
|
| 78 |
+
(if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1
|
| 79 |
+
then immPathAmplitude n hn (fun x => side x.1) d.1 p else 0) ^ 2 :=
|
| 80 |
+
Finset.sum_comm
|
| 81 |
+
_ ≤ _ := by
|
| 82 |
+
apply Finset.sum_le_sum
|
| 83 |
+
intro e he
|
| 84 |
+
apply Finset.sum_sq_le_sq_sum_of_nonneg
|
| 85 |
+
intro p hp
|
| 86 |
+
split_ifs
|
| 87 |
+
· exact immPathAmplitude_nonneg n hn _ d.1 p
|
| 88 |
+
· exact le_rfl
|
| 89 |
+
|
| 90 |
+
/-- Uniform actual-source occupation averages lift to the normalized IMM
|
| 91 |
+
first trace with exactly `n^(n-1)` endpoint paths. -/
|
| 92 |
+
theorem immNormalizedMatrix_first_trace_lower_of_average
|
| 93 |
+
(n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) (L : ℝ)
|
| 94 |
+
(hmean : ∀ p : Fin (immPaths n hn).length,
|
| 95 |
+
L ≤ (∑ d : ImmSourceIndex n side a b,
|
| 96 |
+
immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2) /
|
| 97 |
+
(Fintype.card (ImmSourceIndex n side a b) : ℝ)) :
|
| 98 |
+
(Fintype.card (ImmSourceIndex n side a b) : ℝ) * (n : ℝ) ^ (n - 1) * L ≤
|
| 99 |
+
((immNormalizedMatrix n side a b).conjTranspose *
|
| 100 |
+
immNormalizedMatrix n side a b).trace.re := by
|
| 101 |
+
classical
|
| 102 |
+
have hsum (p : Fin (immPaths n hn).length) :
|
| 103 |
+
(Fintype.card (ImmSourceIndex n side a b) : ℝ) * L ≤
|
| 104 |
+
∑ d : ImmSourceIndex n side a b,
|
| 105 |
+
immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2 := by
|
| 106 |
+
by_cases hz : Fintype.card (ImmSourceIndex n side a b) = 0
|
| 107 |
+
· simp only [hz, Nat.cast_zero, zero_mul]
|
| 108 |
+
exact Finset.sum_nonneg (fun d _ => sq_nonneg _)
|
| 109 |
+
· have hpos : (0 : ℝ) < Fintype.card (ImmSourceIndex n side a b) := by
|
| 110 |
+
exact_mod_cast Nat.pos_of_ne_zero hz
|
| 111 |
+
simpa only [mul_comm] using (le_div_iff₀ hpos).mp (hmean p)
|
| 112 |
+
calc
|
| 113 |
+
_ = ∑ p : Fin (immPaths n hn).length,
|
| 114 |
+
(Fintype.card (ImmSourceIndex n side a b) : ℝ) * L := by
|
| 115 |
+
simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin,
|
| 116 |
+
immPaths_length, nsmul_eq_mul, Nat.cast_pow]
|
| 117 |
+
ring
|
| 118 |
+
_ ≤ ∑ p : Fin (immPaths n hn).length, ∑ d : ImmSourceIndex n side a b,
|
| 119 |
+
immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2 :=
|
| 120 |
+
Finset.sum_le_sum (fun p _ => hsum p)
|
| 121 |
+
_ = ∑ d : ImmSourceIndex n side a b, ∑ p : Fin (immPaths n hn).length,
|
| 122 |
+
immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2 := Finset.sum_comm
|
| 123 |
+
_ ≤ _ := immNormalizedMatrix_first_trace_lower n hn side a b
|
| 124 |
+
|
| 125 |
+
end Problem335
|
| 126 |
+
|
| 127 |
+
end
|
| 128 |
+
|
| 129 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmFockMatrix.lean
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmOperatorPaths
|
| 2 |
+
import OAI.Algebra.DepthFive.FockPaths
|
| 3 |
+
import OAI.Algebra.DepthFive.ImmBidegree
|
| 4 |
+
import OAI.Algebra.DepthFive.FiniteOperator
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
noncomputable section
|
| 9 |
+
open scoped BigOperators
|
| 10 |
+
|
| 11 |
+
namespace Problem335
|
| 12 |
+
|
| 13 |
+
/-- The normalized coefficient contributed by one endpoint path of IMM. -/
|
| 14 |
+
def immPathAmplitude (n : ℕ) (hn : 0 < n)
|
| 15 |
+
(isV : (Fin n × Fin n × Fin n) → Bool)
|
| 16 |
+
(d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) : ℝ :=
|
| 17 |
+
(((immPaths n hn).get p).map (occupationAmplitude isV d)).prod
|
| 18 |
+
|
| 19 |
+
/-- The final occupation vector of one path operator. -/
|
| 20 |
+
def immPathOccupation (n : ℕ) (hn : 0 < n)
|
| 21 |
+
(isV : (Fin n × Fin n × Fin n) → Bool)
|
| 22 |
+
(d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) :
|
| 23 |
+
(Fin n × Fin n × Fin n) →₀ ℕ :=
|
| 24 |
+
pathOccupation isV ((immPaths n hn).get p) d
|
| 25 |
+
|
| 26 |
+
theorem immPathAmplitude_nonneg (n : ℕ) (hn : 0 < n)
|
| 27 |
+
(isV : (Fin n × Fin n × Fin n) → Bool)
|
| 28 |
+
(d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) :
|
| 29 |
+
0 ≤ immPathAmplitude n hn isV d p := by
|
| 30 |
+
apply List.prod_nonneg
|
| 31 |
+
intro x hx
|
| 32 |
+
obtain ⟨i, hi, rfl⟩ := List.mem_map.mp hx
|
| 33 |
+
exact occupationAmplitude_nonneg isV d i
|
| 34 |
+
|
| 35 |
+
/-- The actual IMM operator on a normalized monomial is the sum of its sparse path actions. -/
|
| 36 |
+
theorem mixedOperator_imm_complexFockMonomial (n : ℕ) (hn : 0 < n)
|
| 37 |
+
(isV : (Fin n × Fin n × Fin n) → Bool)
|
| 38 |
+
(d : (Fin n × Fin n × Fin n) →₀ ℕ) :
|
| 39 |
+
mixedOperator isV (imm ℂ n) (complexFockMonomial d) =
|
| 40 |
+
∑ p : Fin (immPaths n hn).length,
|
| 41 |
+
(immPathAmplitude n hn isV d p : ℂ) •
|
| 42 |
+
complexFockMonomial (immPathOccupation n hn isV d p) := by
|
| 43 |
+
rw [mixedOperator_imm_apply_eq_sum_paths n hn isV]
|
| 44 |
+
apply Finset.sum_congr rfl
|
| 45 |
+
intro p hp
|
| 46 |
+
have h := mixedOperator_path_complexFockMonomial isV ((immPaths n hn).get p)
|
| 47 |
+
(immPaths_nodup n hn _ (List.get_mem _ p)) d
|
| 48 |
+
simpa only [map_list_prod, List.map_map, Function.comp_def, mixedOperator_X,
|
| 49 |
+
immPathAmplitude, immPathOccupation] using h
|
| 50 |
+
|
| 51 |
+
/-- Normalized matrix entries of the actual IMM operator are weighted path-shift counts. -/
|
| 52 |
+
theorem complexFockBasis_repr_mixedOperator_imm (n : ℕ) (hn : 0 < n)
|
| 53 |
+
(isV : (Fin n × Fin n × Fin n) → Bool)
|
| 54 |
+
(d e : (Fin n × Fin n × Fin n) →₀ ℕ) :
|
| 55 |
+
complexFockBasis.repr (mixedOperator isV (imm ℂ n) (complexFockMonomial d)) e =
|
| 56 |
+
∑ p : Fin (immPaths n hn).length,
|
| 57 |
+
if immPathOccupation n hn isV d p = e then (immPathAmplitude n hn isV d p : ℂ)
|
| 58 |
+
else 0 := by
|
| 59 |
+
classical
|
| 60 |
+
rw [mixedOperator_imm_complexFockMonomial n hn isV]
|
| 61 |
+
simp only [map_sum, map_smul, Finsupp.finsetSum_apply, Finsupp.smul_apply]
|
| 62 |
+
apply Finset.sum_congr rfl
|
| 63 |
+
intro p hp
|
| 64 |
+
rw [← complexFockBasis_apply, Module.Basis.repr_self]
|
| 65 |
+
simp [Finsupp.single_apply]
|
| 66 |
+
|
| 67 |
+
/-- A product of variables has the sum of their assigned weighted degrees. -/
|
| 68 |
+
theorem variable_list_product_isWeightedHomogeneous {K σ M : Type*}
|
| 69 |
+
[CommSemiring K] [AddCommMonoid M] (w : σ → M) (l : List σ) :
|
| 70 |
+
((l.map (MvPolynomial.X : σ → MvPolynomial σ K)).prod).IsWeightedHomogeneous
|
| 71 |
+
w (l.map w).sum := by
|
| 72 |
+
induction l with
|
| 73 |
+
| nil => simpa using MvPolynomial.isWeightedHomogeneous_one K w
|
| 74 |
+
| cons x l ih =>
|
| 75 |
+
simpa only [List.map_cons, List.prod_cons, List.sum_cons] using
|
| 76 |
+
(MvPolynomial.isWeightedHomogeneous_X K w x).mul ih
|
| 77 |
+
|
| 78 |
+
/-- The path monomials all have the same layerwise bidegree as IMM. -/
|
| 79 |
+
theorem immPath_product_mem_bidegreeSubmodule (K : Type*) [CommSemiring K]
|
| 80 |
+
(n : ℕ) (hn : 0 < n) (side : Fin n → Bool)
|
| 81 |
+
(p : Fin (immPaths n hn).length) :
|
| 82 |
+
((((immPaths n hn).get p).map (MvPolynomial.X (R := K))).prod) ∈
|
| 83 |
+
bidegreeSubmodule (fun x => side x.1)
|
| 84 |
+
(Finset.univ.filter (fun t => side t = true)).card
|
| 85 |
+
(Finset.univ.filter (fun t => side t = false)).card := by
|
| 86 |
+
have h := variable_list_product_isWeightedHomogeneous (K := K)
|
| 87 |
+
(fun x : Fin n × Fin n × Fin n => bidegreeWeight side x.1) ((immPaths n hn).get p)
|
| 88 |
+
have hl := immPaths_labels n hn _ (List.get_mem _ p)
|
| 89 |
+
have hs := congrArg (fun l : List (Fin n) => (l.map (bidegreeWeight side)).sum) hl
|
| 90 |
+
simp only [List.map_map, Function.comp_def, ← List.ofFn_eq_map, List.sum_ofFn] at hs
|
| 91 |
+
rw [hs] at h
|
| 92 |
+
have he : (∑ t, bidegreeWeight side t) =
|
| 93 |
+
((Finset.univ.filter (fun t => side t = true)).card,
|
| 94 |
+
(Finset.univ.filter (fun t => side t = false)).card) := by
|
| 95 |
+
apply Prod.ext
|
| 96 |
+
· simp only [Prod.fst_sum, Finset.card_filter]
|
| 97 |
+
apply Finset.sum_congr rfl
|
| 98 |
+
intro t ht
|
| 99 |
+
cases ht' : side t <;> simp [bidegreeWeight, ht']
|
| 100 |
+
· simp only [Prod.snd_sum, Finset.card_filter]
|
| 101 |
+
apply Finset.sum_congr rfl
|
| 102 |
+
intro t ht
|
| 103 |
+
cases ht' : side t <;> simp [bidegreeWeight, ht']
|
| 104 |
+
rw [he] at h
|
| 105 |
+
exact h
|
| 106 |
+
|
| 107 |
+
/-- A nonzero scalar multiple of a normalized monomial determines its weighted degree. -/
|
| 108 |
+
theorem weight_eq_of_complexFockMonomial_smul_mem {σ M : Type*}
|
| 109 |
+
[Fintype σ] [DecidableEq σ] [AddCommMonoid M]
|
| 110 |
+
(w : σ → M) (d : σ →₀ ℕ) (a : M) (c : ℂ) (hc : c ≠ 0)
|
| 111 |
+
(h : (c • complexFockMonomial d).IsWeightedHomogeneous w a) :
|
| 112 |
+
Finsupp.weight w d = a := by
|
| 113 |
+
apply h (d := d)
|
| 114 |
+
rw [MvPolynomial.coeff_smul, complexFockMonomial_eq, MvPolynomial.coeff_monomial]
|
| 115 |
+
simp only [smul_eq_mul]
|
| 116 |
+
apply mul_ne_zero hc
|
| 117 |
+
exact inv_ne_zero (by exact_mod_cast (sqrt_multiFactorial_pos d).ne')
|
| 118 |
+
|
| 119 |
+
/-- A nonzero path amplitude guarantees that its occupation lies in the genuine target bidegree. -/
|
| 120 |
+
theorem immPathOccupation_bidegree_of_amplitude_ne_zero (n : ℕ) (hn : 0 < n)
|
| 121 |
+
(side : Fin n → Bool) (a b : ℕ)
|
| 122 |
+
(d : (Fin n × Fin n × Fin n) →₀ ℕ)
|
| 123 |
+
(hd : Finsupp.weight (bidegreeWeight (fun x => side x.1)) d = (a, b))
|
| 124 |
+
(p : Fin (immPaths n hn).length)
|
| 125 |
+
(hp : immPathAmplitude n hn (fun x => side x.1) d p ≠ 0) :
|
| 126 |
+
Finsupp.weight (bidegreeWeight (fun x => side x.1))
|
| 127 |
+
(immPathOccupation n hn (fun x => side x.1) d p) =
|
| 128 |
+
(a - (Finset.univ.filter (fun t => side t = true)).card,
|
| 129 |
+
b + (Finset.univ.filter (fun t => side t = false)).card) := by
|
| 130 |
+
have hinput : complexFockMonomial d ∈
|
| 131 |
+
bidegreeSubmodule (fun x => side x.1) a b := by
|
| 132 |
+
rw [complexFockMonomial_eq]
|
| 133 |
+
exact MvPolynomial.isWeightedHomogeneous_monomial _ _ _ hd
|
| 134 |
+
have hpoly := immPath_product_mem_bidegreeSubmodule ℂ n hn side p
|
| 135 |
+
have hout := mixedOperator_mem_bidegreeSubmodule_all (K := ℂ)
|
| 136 |
+
(σ := Fin n × Fin n × Fin n)
|
| 137 |
+
(q := (((immPaths n hn).get p).map (MvPolynomial.X (R := ℂ))).prod)
|
| 138 |
+
(p := complexFockMonomial d)
|
| 139 |
+
(k := (Finset.univ.filter (fun t => side t = true)).card)
|
| 140 |
+
(m := (Finset.univ.filter (fun t => side t = false)).card)
|
| 141 |
+
(a := a) (b := b) (fun x => side x.1) hpoly hinput
|
| 142 |
+
have hact := mixedOperator_path_complexFockMonomial (fun x => side x.1)
|
| 143 |
+
((immPaths n hn).get p) (immPaths_nodup n hn _ (List.get_mem _ p)) d
|
| 144 |
+
rw [hact] at hout
|
| 145 |
+
exact weight_eq_of_complexFockMonomial_smul_mem _ _ _ _
|
| 146 |
+
(by exact_mod_cast hp) hout
|
| 147 |
+
|
| 148 |
+
/-- Squared path amplitudes are the occupation monomials occurring in the moment calculation. -/
|
| 149 |
+
theorem immPathAmplitude_sq (n : ℕ) (hn : 0 < n)
|
| 150 |
+
(isV : (Fin n × Fin n × Fin n) → Bool)
|
| 151 |
+
(d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) :
|
| 152 |
+
(immPathAmplitude n hn isV d p) ^ 2 =
|
| 153 |
+
(((immPaths n hn).get p).map
|
| 154 |
+
(fun i => if isV i then (d i : ℝ) else (d i : ℝ) + 1)).prod :=
|
| 155 |
+
pathAmplitude_sq isV _ d
|
| 156 |
+
|
| 157 |
+
end Problem335
|
| 158 |
+
|
| 159 |
+
end
|
| 160 |
+
|
| 161 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmMap.lean
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.Basic
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
universe u v
|
| 7 |
+
|
| 8 |
+
namespace Problem335
|
| 9 |
+
|
| 10 |
+
/-- Iterated matrix multiplication commutes with change of coefficient semiring. -/
|
| 11 |
+
@[simp] theorem map_imm {K : Type u} {L : Type v} [CommSemiring K] [CommSemiring L]
|
| 12 |
+
(f : K →+* L) (n : ℕ) : MvPolynomial.map f (imm K n) = imm L n := by
|
| 13 |
+
classical
|
| 14 |
+
by_cases hn : 0 < n
|
| 15 |
+
· simp only [imm, dite_eq_left hn]
|
| 16 |
+
let F := (MvPolynomial.map (σ := Fin n × Fin n × Fin n) f).mapMatrix (m := Fin n)
|
| 17 |
+
have h := F.map_list_prod (List.ofFn (fun t : Fin n => immLayer K n t))
|
| 18 |
+
have hm : (List.ofFn (fun t : Fin n => immLayer K n t)).map F =
|
| 19 |
+
List.ofFn (fun t : Fin n => immLayer L n t) := by
|
| 20 |
+
simp only [List.map_ofFn]
|
| 21 |
+
congr 1
|
| 22 |
+
funext t i j
|
| 23 |
+
simp [F, immLayer]
|
| 24 |
+
change F (List.ofFn (fun t : Fin n => immLayer K n t)).prod =
|
| 25 |
+
((List.ofFn (fun t : Fin n => immLayer K n t)).map F).prod at h
|
| 26 |
+
rw [hm] at h
|
| 27 |
+
exact congrArg (fun M => M ⟨0, hn⟩ ⟨0, hn⟩) h
|
| 28 |
+
· simp [imm, hn]
|
| 29 |
+
|
| 30 |
+
end Problem335
|
| 31 |
+
|
| 32 |
+
end
|
| 33 |
+
|
| 34 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmOperatorPaths.lean
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.Basic
|
| 2 |
+
import OAI.Algebra.DepthFive.MatrixPaths
|
| 3 |
+
import OAI.Algebra.DepthFive.MixedOperator
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
noncomputable section
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
|
| 10 |
+
namespace Problem335
|
| 11 |
+
|
| 12 |
+
open MvPolynomial
|
| 13 |
+
|
| 14 |
+
/-- Enumerating labelled matrix paths never repeats an edge list. -/
|
| 15 |
+
private theorem immOperatorPaths_enumeration_nodup {σ ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 16 |
+
(labels : List σ) (i j : ι) : (matrixEntryPaths labels i j).Nodup := by
|
| 17 |
+
induction labels generalizing i with
|
| 18 |
+
| nil => by_cases hij : i = j <;> simp [matrixEntryPaths, hij]
|
| 19 |
+
| cons t ts ih =>
|
| 20 |
+
cases ts with
|
| 21 |
+
| nil => simp [matrixEntryPaths]
|
| 22 |
+
| cons u us =>
|
| 23 |
+
rw [matrixEntryPaths, List.nodup_flatMap]
|
| 24 |
+
constructor
|
| 25 |
+
· intro k hk
|
| 26 |
+
exact List.Nodup.map (fun p q h => (List.cons.inj h).2) (ih k)
|
| 27 |
+
· apply (Finset.nodup_toList _).pairwise_of_forall_ne
|
| 28 |
+
intro a ha b hb hab p hp hq
|
| 29 |
+
obtain ⟨q, hq', rfl⟩ := List.mem_map.mp hp
|
| 30 |
+
obtain ⟨r, hr, heq⟩ := List.mem_map.mp hq
|
| 31 |
+
simp only [List.cons.injEq, Prod.mk.injEq] at heq
|
| 32 |
+
exact hab heq.1.2.2.symm
|
| 33 |
+
|
| 34 |
+
/-- The canonical labelled paths contributing to the endpoint IMM entry. -/
|
| 35 |
+
def immPaths (n : ℕ) (hn : 0 < n) : List (List (Fin n × Fin n × Fin n)) :=
|
| 36 |
+
matrixEntryPaths (List.finRange n) ⟨0, hn⟩ ⟨0, hn⟩
|
| 37 |
+
|
| 38 |
+
/-- Every IMM path uses exactly one coordinate in each layer, in layer order. -/
|
| 39 |
+
theorem immPaths_labels (n : ℕ) (hn : 0 < n)
|
| 40 |
+
(p : List (Fin n × Fin n × Fin n)) (hp : p ∈ immPaths n hn) :
|
| 41 |
+
p.map Prod.fst = List.finRange n :=
|
| 42 |
+
matrixEntryPaths_labels _ _ _ _ hp
|
| 43 |
+
|
| 44 |
+
/-- Distinct path indices select distinct edge lists. -/
|
| 45 |
+
theorem immPaths_get_injective (n : ℕ) (hn : 0 < n) :
|
| 46 |
+
Function.Injective (immPaths n hn).get := by
|
| 47 |
+
apply List.nodup_iff_injective_get.mp
|
| 48 |
+
exact immOperatorPaths_enumeration_nodup _ _ _
|
| 49 |
+
|
| 50 |
+
/-- The number of endpoint paths is `n^(n-1)`. -/
|
| 51 |
+
theorem immPaths_length (n : ℕ) (hn : 0 < n) :
|
| 52 |
+
(immPaths n hn).length = n ^ (n - 1) := by
|
| 53 |
+
unfold immPaths
|
| 54 |
+
rw [matrixEntryPaths_length _ (by simpa using (Nat.ne_of_gt hn))]
|
| 55 |
+
simp
|
| 56 |
+
|
| 57 |
+
variable {K : Type*} [CommSemiring K]
|
| 58 |
+
|
| 59 |
+
/-- The endpoint IMM polynomial is the sum of its labelled path monomials. -/
|
| 60 |
+
theorem imm_eq_sum_path_products (n : ℕ) (hn : 0 < n) :
|
| 61 |
+
imm K n = ((immPaths n hn).map fun p => (p.map (X (R := K))).prod).sum := by
|
| 62 |
+
have h := matrixEntryPaths_sum_prod (immLayer K n) (List.finRange n)
|
| 63 |
+
(⟨0, hn⟩ : Fin n) (⟨0, hn⟩ : Fin n)
|
| 64 |
+
simp only [imm, dite_eq_left hn, List.ofFn_eq_map]
|
| 65 |
+
exact h.symm
|
| 66 |
+
|
| 67 |
+
/-- The full IMM polynomial operator is a sum of products of its edge operators. -/
|
| 68 |
+
theorem mixedOperator_imm_eq_sum_paths (n : ℕ) (hn : 0 < n)
|
| 69 |
+
(isV : (Fin n × Fin n × Fin n) → Bool) :
|
| 70 |
+
mixedOperator (K := K) isV (imm K n) =
|
| 71 |
+
((immPaths n hn).map fun p =>
|
| 72 |
+
(p.map (variableOperator (K := K) isV)).prod).sum := by
|
| 73 |
+
rw [imm_eq_sum_path_products n hn, map_list_sum]
|
| 74 |
+
simp only [List.map_map, Function.comp_def, map_list_prod, mixedOperator_X]
|
| 75 |
+
|
| 76 |
+
/-- Each individual IMM path contains no repeated variable. -/
|
| 77 |
+
theorem immPaths_nodup (n : ℕ) (hn : 0 < n)
|
| 78 |
+
(p : List (Fin n × Fin n × Fin n)) (hp : p ∈ immPaths n hn) : p.Nodup := by
|
| 79 |
+
apply List.Nodup.of_map Prod.fst
|
| 80 |
+
rw [immPaths_labels n hn p hp]
|
| 81 |
+
exact List.nodup_finRange n
|
| 82 |
+
|
| 83 |
+
/-- The operator expansion indexed by the finite type of paths. -/
|
| 84 |
+
theorem mixedOperator_imm_eq_sum_paths_fin (n : ℕ) (hn : 0 < n)
|
| 85 |
+
(isV : (Fin n × Fin n × Fin n) → Bool) :
|
| 86 |
+
mixedOperator (K := K) isV (imm K n) =
|
| 87 |
+
∑ p : Fin (immPaths n hn).length,
|
| 88 |
+
(((immPaths n hn).get p).map (variableOperator (K := K) isV)).prod := by
|
| 89 |
+
rw [mixedOperator_imm_eq_sum_paths n hn isV]
|
| 90 |
+
symm
|
| 91 |
+
simpa only [List.get_eq_getElem] using
|
| 92 |
+
(Fin.sum_univ_fun_getElem (immPaths n hn)
|
| 93 |
+
(fun p => (p.map (variableOperator (K := K) isV)).prod))
|
| 94 |
+
|
| 95 |
+
/-- Applying the IMM operator is the sum of its individual path actions. -/
|
| 96 |
+
theorem mixedOperator_imm_apply_eq_sum_paths (n : ℕ) (hn : 0 < n)
|
| 97 |
+
(isV : (Fin n × Fin n × Fin n) → Bool)
|
| 98 |
+
(f : MvPolynomial (Fin n × Fin n × Fin n) K) :
|
| 99 |
+
mixedOperator isV (imm K n) f =
|
| 100 |
+
∑ p : Fin (immPaths n hn).length,
|
| 101 |
+
((((immPaths n hn).get p).map (variableOperator isV)).prod) f := by
|
| 102 |
+
rw [mixedOperator_imm_eq_sum_paths_fin n hn isV, LinearMap.sum_apply]
|
| 103 |
+
|
| 104 |
+
/-- Coefficients of the IMM operator are finite sums of path coefficients. -/
|
| 105 |
+
theorem coeff_mixedOperator_imm_eq_sum_paths (n : ℕ) (hn : 0 < n)
|
| 106 |
+
(isV : (Fin n × Fin n × Fin n) → Bool)
|
| 107 |
+
(f : MvPolynomial (Fin n × Fin n × Fin n) K)
|
| 108 |
+
(d : (Fin n × Fin n × Fin n) →₀ ℕ) :
|
| 109 |
+
(mixedOperator isV (imm K n) f).coeff d =
|
| 110 |
+
∑ p : Fin (immPaths n hn).length,
|
| 111 |
+
(((((immPaths n hn).get p).map (variableOperator isV)).prod) f).coeff d := by
|
| 112 |
+
rw [mixedOperator_imm_apply_eq_sum_paths n hn isV f, coeff_sum]
|
| 113 |
+
|
| 114 |
+
/-- Extend internal vertex choices by the two fixed endpoint vertices. -/
|
| 115 |
+
def immInternalPathVertices (d : ℕ) (p : Fin d → Fin (d + 1)) :
|
| 116 |
+
Fin (d + 2) → Fin (d + 1) :=
|
| 117 |
+
Fin.cons (α := fun _ => Fin (d + 1)) 0 (Fin.snoc p 0)
|
| 118 |
+
|
| 119 |
+
/-- The edge list associated to the tuple of internal vertices. -/
|
| 120 |
+
def immInternalPathEdges (d : ℕ) (p : Fin d → Fin (d + 1)) :
|
| 121 |
+
List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) :=
|
| 122 |
+
List.ofFn fun t : Fin (d + 1) =>
|
| 123 |
+
(t, Fin.cons (α := fun _ => Fin (d + 1)) 0 p t,
|
| 124 |
+
Fin.snoc (α := fun _ => Fin (d + 1)) p 0 t)
|
| 125 |
+
|
| 126 |
+
@[simp] theorem immInternalPathVertices_start (d : ℕ) (p : Fin d → Fin (d + 1)) :
|
| 127 |
+
immInternalPathVertices d p 0 = 0 := by
|
| 128 |
+
simp [immInternalPathVertices]
|
| 129 |
+
|
| 130 |
+
@[simp] theorem immInternalPathVertices_end (d : ℕ) (p : Fin d → Fin (d + 1)) :
|
| 131 |
+
immInternalPathVertices d p (Fin.last (d + 1)) = 0 := by
|
| 132 |
+
simp [immInternalPathVertices]
|
| 133 |
+
|
| 134 |
+
@[simp] theorem immInternalPathVertices_castSucc (d : ℕ)
|
| 135 |
+
(p : Fin d → Fin (d + 1)) (t : Fin (d + 1)) :
|
| 136 |
+
immInternalPathVertices d p t.castSucc =
|
| 137 |
+
Fin.cons (α := fun _ => Fin (d + 1)) 0 p t := by
|
| 138 |
+
simp [immInternalPathVertices, Fin.cons_snoc_eq_snoc_cons]
|
| 139 |
+
|
| 140 |
+
@[simp] theorem immInternalPathVertices_succ (d : ℕ)
|
| 141 |
+
(p : Fin d → Fin (d + 1)) (t : Fin (d + 1)) :
|
| 142 |
+
immInternalPathVertices d p t.succ =
|
| 143 |
+
Fin.snoc (α := fun _ => Fin (d + 1)) p 0 t := by
|
| 144 |
+
simp [immInternalPathVertices]
|
| 145 |
+
|
| 146 |
+
/-- Extending by endpoints does not identify different internal paths. -/
|
| 147 |
+
theorem immInternalPathVertices_injective (d : ℕ) :
|
| 148 |
+
Function.Injective (immInternalPathVertices d) := by
|
| 149 |
+
intro p q h
|
| 150 |
+
funext t
|
| 151 |
+
have hh := congrFun h t.castSucc.succ
|
| 152 |
+
simpa [immInternalPathVertices] using hh
|
| 153 |
+
|
| 154 |
+
/-- The edge list has every layer as its first coordinate, exactly once. -/
|
| 155 |
+
theorem immInternalPathEdges_labels (d : ℕ) (p : Fin d → Fin (d + 1)) :
|
| 156 |
+
(immInternalPathEdges d p).map Prod.fst = List.finRange (d + 1) := by
|
| 157 |
+
rw [immInternalPathEdges, List.map_ofFn]
|
| 158 |
+
exact List.ofFn_id _
|
| 159 |
+
|
| 160 |
+
/-- Internal-vertex edge lists have no repeated variable. -/
|
| 161 |
+
theorem immInternalPathEdges_nodup (d : ℕ) (p : Fin d → Fin (d + 1)) :
|
| 162 |
+
(immInternalPathEdges d p).Nodup := by
|
| 163 |
+
apply List.Nodup.of_map Prod.fst
|
| 164 |
+
rw [immInternalPathEdges_labels]
|
| 165 |
+
exact List.nodup_finRange _
|
| 166 |
+
|
| 167 |
+
/-- The IMM expansion using the canonical tuple of internal vertices. -/
|
| 168 |
+
theorem imm_succ_eq_sum_internal_paths (d : ℕ) :
|
| 169 |
+
imm K (d + 1) = ∑ p : Fin d → Fin (d + 1),
|
| 170 |
+
((immInternalPathEdges d p).map (X (R := K))).prod := by
|
| 171 |
+
simp only [imm, Nat.succ_pos, dite_eq_left]
|
| 172 |
+
rw [matrix_ofFn_prod_eq_sum_paths]
|
| 173 |
+
simp [immInternalPathEdges, List.map_ofFn, Function.comp_def, immLayer]
|
| 174 |
+
|
| 175 |
+
/-- The actual IMM operator as a sum over internal vertex tuples. -/
|
| 176 |
+
theorem mixedOperator_imm_succ_eq_sum_internal_paths (d : ℕ)
|
| 177 |
+
(isV : (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) → Bool) :
|
| 178 |
+
mixedOperator (K := K) isV (imm K (d + 1)) =
|
| 179 |
+
∑ p : Fin d → Fin (d + 1),
|
| 180 |
+
((immInternalPathEdges d p).map (variableOperator (K := K) isV)).prod := by
|
| 181 |
+
rw [imm_succ_eq_sum_internal_paths d, map_sum]
|
| 182 |
+
apply Finset.sum_congr rfl
|
| 183 |
+
intro p hp
|
| 184 |
+
simp only [map_list_prod, List.map_map, Function.comp_def, mixedOperator_X]
|
| 185 |
+
|
| 186 |
+
end Problem335
|
| 187 |
+
|
| 188 |
+
end
|
| 189 |
+
|
| 190 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmPairingCompatibility.lean
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmPathCompatibility
|
| 2 |
+
import OAI.Algebra.DepthFive.SecondMomentPairing
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
|
| 8 |
+
namespace Problem335
|
| 9 |
+
|
| 10 |
+
/-- Closing the four internal IMM paths gives the canonical endpoint-fixed labels. -/
|
| 11 |
+
theorem closePaths_immInternalPathVertices (d : ℕ)
|
| 12 |
+
(p q r s : Fin d → Fin (d + 1)) (t : Fin (d + 2)) :
|
| 13 |
+
Pairings.closePaths 0 (fun i => ⟨p i, q i, r i, s i⟩) t =
|
| 14 |
+
(⟨immInternalPathVertices d p t, immInternalPathVertices d q t,
|
| 15 |
+
immInternalPathVertices d r t, immInternalPathVertices d s t⟩ :
|
| 16 |
+
Pairings.Labels (Fin (d + 1))) := by
|
| 17 |
+
refine Fin.cases ?_ (fun i => ?_) t
|
| 18 |
+
· rfl
|
| 19 |
+
· refine Fin.lastCases ?_ (fun j => ?_) i
|
| 20 |
+
· simp only [Fin.succ_last, Pairings.closePaths_last, immInternalPathVertices_end]
|
| 21 |
+
rfl
|
| 22 |
+
· simp [Pairings.closePaths, immInternalPathVertices]
|
| 23 |
+
|
| 24 |
+
/-- Layer labels used in the relaxed pairing sum are the actual four IMM coordinates. -/
|
| 25 |
+
theorem layerLabels_immInternalCoordinate (d : ℕ)
|
| 26 |
+
(p q r s : Fin d → Fin (d + 1)) (t : Fin (d + 1)) :
|
| 27 |
+
MomentPairing.layerLabels 0 (fun i => ⟨p i, q i, r i, s i⟩) t =
|
| 28 |
+
(⟨immInternalCoordinate d p t, immInternalCoordinate d q t,
|
| 29 |
+
immInternalCoordinate d r t, immInternalCoordinate d s t⟩ :
|
| 30 |
+
Pairings.Labels (Fin (d + 1) × Fin (d + 1))) := by
|
| 31 |
+
simp only [MomentPairing.layerLabels, closePaths_immInternalPathVertices]
|
| 32 |
+
rfl
|
| 33 |
+
|
| 34 |
+
/-- The actual four-path shift constraint is exactly the compatibility predicate
|
| 35 |
+
used by the weighted exact-to-relaxed pairing inequality. -/
|
| 36 |
+
theorem immInternalPath_shift_sub_eq_iff_compatible (d : ℕ)
|
| 37 |
+
(side : Fin (d + 1) → Bool) (p q r s : Fin d → Fin (d + 1)) :
|
| 38 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d p) -
|
| 39 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d q) =
|
| 40 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d r) -
|
| 41 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d s) ↔
|
| 42 |
+
MomentPairing.Compatible 0 (fun i => ⟨p i, q i, r i, s i⟩) := by
|
| 43 |
+
rw [immInternalPath_shift_sub_eq_iff]
|
| 44 |
+
simp only [MomentPairing.Compatible, layerLabels_immInternalCoordinate]
|
| 45 |
+
|
| 46 |
+
end Problem335
|
| 47 |
+
|
| 48 |
+
end
|
| 49 |
+
|
| 50 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmPairingReindex.lean
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.MatrixPathPairings
|
| 2 |
+
import OAI.Algebra.DepthFive.ImmPairingCompatibility
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
namespace Problem335
|
| 9 |
+
|
| 10 |
+
/-- Filtered four-path IMM sums are exactly the compatible internal-label sums. -/
|
| 11 |
+
theorem sum_four_immPaths_compatible_eq {A : Type*} [AddCommMonoid A] (d : ℕ)
|
| 12 |
+
(side : Fin (d + 1) → Bool)
|
| 13 |
+
(f : List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) →
|
| 14 |
+
List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) →
|
| 15 |
+
List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) →
|
| 16 |
+
List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) → A) :
|
| 17 |
+
let paths := immPaths (d + 1) (Nat.succ_pos d)
|
| 18 |
+
(∑ p : Fin paths.length, ∑ q : Fin paths.length,
|
| 19 |
+
∑ r : Fin paths.length, ∑ s : Fin paths.length,
|
| 20 |
+
let P := paths.get p
|
| 21 |
+
let Q := paths.get q
|
| 22 |
+
let R := paths.get r
|
| 23 |
+
let S := paths.get s
|
| 24 |
+
if occupationShift (fun e => side e.1) P - occupationShift (fun e => side e.1) Q =
|
| 25 |
+
occupationShift (fun e => side e.1) R - occupationShift (fun e => side e.1) S
|
| 26 |
+
then f P Q R S else 0) =
|
| 27 |
+
∑ x : {x : Fin d → Pairings.Labels (Fin (d + 1)) // MomentPairing.Compatible 0 x},
|
| 28 |
+
f (immInternalPathEdges d (fun t => (x.1 t).p))
|
| 29 |
+
(immInternalPathEdges d (fun t => (x.1 t).q))
|
| 30 |
+
(immInternalPathEdges d (fun t => (x.1 t).r))
|
| 31 |
+
(immInternalPathEdges d (fun t => (x.1 t).s)) := by
|
| 32 |
+
classical
|
| 33 |
+
dsimp only
|
| 34 |
+
have hp : immPaths (d + 1) (Nat.succ_pos d) =
|
| 35 |
+
matrixEntryPaths (List.ofFn (id : Fin (d + 1) → Fin (d + 1))) 0 0 := by
|
| 36 |
+
rw [List.ofFn_id]
|
| 37 |
+
rfl
|
| 38 |
+
rw [hp]
|
| 39 |
+
rw [Pairings.sum_four_matrixEntryPaths_eq d (id : Fin (d + 1) → Fin (d + 1)) 0
|
| 40 |
+
(fun P Q R S => if occupationShift (fun e => side e.1) P -
|
| 41 |
+
occupationShift (fun e => side e.1) Q =
|
| 42 |
+
occupationShift (fun e => side e.1) R - occupationShift (fun e => side e.1) S
|
| 43 |
+
then f P Q R S else 0)]
|
| 44 |
+
change (∑ x : Fin d → Pairings.Labels (Fin (d + 1)),
|
| 45 |
+
if occupationShift (fun e => side e.1) (immInternalPathEdges d (fun t => (x t).p)) -
|
| 46 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d (fun t => (x t).q)) =
|
| 47 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d (fun t => (x t).r)) -
|
| 48 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d (fun t => (x t).s))
|
| 49 |
+
then f (immInternalPathEdges d (fun t => (x t).p))
|
| 50 |
+
(immInternalPathEdges d (fun t => (x t).q))
|
| 51 |
+
(immInternalPathEdges d (fun t => (x t).r))
|
| 52 |
+
(immInternalPathEdges d (fun t => (x t).s)) else 0) = _
|
| 53 |
+
simp only [immInternalPath_shift_sub_eq_iff_compatible]
|
| 54 |
+
rw [← Finset.sum_filter]
|
| 55 |
+
exact Finset.sum_subtype _ (by simp) _
|
| 56 |
+
|
| 57 |
+
end Problem335
|
| 58 |
+
|
| 59 |
+
end
|
| 60 |
+
|
| 61 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmPathCompatibility.lean
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmPathShifts
|
| 2 |
+
import OAI.Algebra.DepthFive.Pairings
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
|
| 8 |
+
namespace Problem335
|
| 9 |
+
|
| 10 |
+
/-- The coordinate in one layer of a genuine endpoint-fixed internal path. -/
|
| 11 |
+
def immInternalCoordinate (d : ℕ) (p : Fin d → Fin (d + 1))
|
| 12 |
+
(t : Fin (d + 1)) : Fin (d + 1) × Fin (d + 1) :=
|
| 13 |
+
(immInternalPathVertices d p t.castSucc, immInternalPathVertices d p t.succ)
|
| 14 |
+
|
| 15 |
+
/-- Four genuine IMM path shifts are compatible exactly when their coordinate
|
| 16 |
+
vectors are compatible separately in each layer. -/
|
| 17 |
+
theorem immInternalPath_shift_sub_eq_iff (d : ℕ) (side : Fin (d + 1) → Bool)
|
| 18 |
+
(p q r s : Fin d → Fin (d + 1)) :
|
| 19 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d p) -
|
| 20 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d q) =
|
| 21 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d r) -
|
| 22 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d s) ↔
|
| 23 |
+
∀ t, Finsupp.single (immInternalCoordinate d p t) (1 : ℤ) -
|
| 24 |
+
Finsupp.single (immInternalCoordinate d q t) 1 =
|
| 25 |
+
Finsupp.single (immInternalCoordinate d r t) 1 -
|
| 26 |
+
Finsupp.single (immInternalCoordinate d s t) 1 := by
|
| 27 |
+
simp only [occupationShift_immInternalPathEdges]
|
| 28 |
+
exact pathShift_sub_eq_iff _ (fun t => by cases side t <;> norm_num) _ _ _ _
|
| 29 |
+
|
| 30 |
+
/-- The exact normal/diagonal pairing alternative for genuine IMM paths.
|
| 31 |
+
The all-equal case is assigned only to the normal alternative. -/
|
| 32 |
+
theorem immInternalPath_shift_sub_eq_iff_pairings (d : ℕ)
|
| 33 |
+
(side : Fin (d + 1) → Bool) (p q r s : Fin d → Fin (d + 1)) :
|
| 34 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d p) -
|
| 35 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d q) =
|
| 36 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d r) -
|
| 37 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d s) ↔
|
| 38 |
+
∀ t,
|
| 39 |
+
(immInternalCoordinate d p t = immInternalCoordinate d q t ∧
|
| 40 |
+
immInternalCoordinate d r t = immInternalCoordinate d s t) ∨
|
| 41 |
+
(immInternalCoordinate d p t = immInternalCoordinate d r t ∧
|
| 42 |
+
immInternalCoordinate d q t = immInternalCoordinate d s t ∧
|
| 43 |
+
immInternalCoordinate d p t ≠ immInternalCoordinate d q t) := by
|
| 44 |
+
rw [immInternalPath_shift_sub_eq_iff]
|
| 45 |
+
exact forall_congr' fun t => Pairings.coordinate_difference_eq_iff_exclusive _ _ _ _
|
| 46 |
+
|
| 47 |
+
end Problem335
|
| 48 |
+
|
| 49 |
+
end
|
| 50 |
+
|
| 51 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmPathShifts.lean
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmOperatorPaths
|
| 2 |
+
import OAI.Algebra.DepthFive.FockPaths
|
| 3 |
+
import OAI.Algebra.DepthFive.PathShifts
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
noncomputable section
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
|
| 10 |
+
namespace Problem335
|
| 11 |
+
|
| 12 |
+
/-- The signed creation/annihilation shift of the actual IMM edge list is
|
| 13 |
+
exactly the layered vertex-path shift. -/
|
| 14 |
+
theorem occupationShift_immInternalPathEdges (d : ℕ) (side : Fin (d + 1) → Bool)
|
| 15 |
+
(p : Fin d → Fin (d + 1)) :
|
| 16 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d p) =
|
| 17 |
+
pathShift (fun t => if side t then (-1 : ℤ) else 1)
|
| 18 |
+
(immInternalPathVertices d p) := by
|
| 19 |
+
simp only [occupationShift, immInternalPathEdges, List.map_ofFn,
|
| 20 |
+
List.sum_ofFn, Function.comp_def, pathShift,
|
| 21 |
+
immInternalPathVertices_castSucc, immInternalPathVertices_succ]
|
| 22 |
+
|
| 23 |
+
/-- Different IMM paths have different signed occupation shifts. -/
|
| 24 |
+
theorem occupationShift_immInternalPathEdges_injective (d : ℕ)
|
| 25 |
+
(side : Fin (d + 1) → Bool) :
|
| 26 |
+
Function.Injective (fun p : Fin d → Fin (d + 1) =>
|
| 27 |
+
occupationShift (fun e => side e.1) (immInternalPathEdges d p)) := by
|
| 28 |
+
intro p q hpq
|
| 29 |
+
dsimp only at hpq
|
| 30 |
+
rw [occupationShift_immInternalPathEdges, occupationShift_immInternalPathEdges] at hpq
|
| 31 |
+
apply immInternalPathVertices_injective d
|
| 32 |
+
apply pathShift_injective (Nat.succ_pos d) _ (fun t => ?_) hpq
|
| 33 |
+
cases side t <;> norm_num
|
| 34 |
+
|
| 35 |
+
/-- Nonzero normalized IMM path actions cannot collide at a natural occupation. -/
|
| 36 |
+
theorem immInternalPath_target_injective_of_amplitudes_ne_zero (d : ℕ)
|
| 37 |
+
(side : Fin (d + 1) → Bool)
|
| 38 |
+
(M : (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) →₀ ℕ)
|
| 39 |
+
(p q : Fin d → Fin (d + 1))
|
| 40 |
+
(hp : ((immInternalPathEdges d p).map
|
| 41 |
+
(occupationAmplitude (fun e => side e.1) M)).prod ≠ 0)
|
| 42 |
+
(hq : ((immInternalPathEdges d q).map
|
| 43 |
+
(occupationAmplitude (fun e => side e.1) M)).prod ≠ 0)
|
| 44 |
+
(heq : pathOccupation (fun e => side e.1) (immInternalPathEdges d p) M =
|
| 45 |
+
pathOccupation (fun e => side e.1) (immInternalPathEdges d q) M) : p = q := by
|
| 46 |
+
apply occupationShift_immInternalPathEdges_injective d side
|
| 47 |
+
apply add_left_cancel (a := signedOccupation M)
|
| 48 |
+
rw [← signedOccupation_path_of_amplitude_ne_zero _ _
|
| 49 |
+
(immInternalPathEdges_nodup d p) M hp,
|
| 50 |
+
← signedOccupation_path_of_amplitude_ne_zero _ _
|
| 51 |
+
(immInternalPathEdges_nodup d q) M hq, heq]
|
| 52 |
+
|
| 53 |
+
/-- The collision-zero hypothesis of the first-trace expansion for genuine IMM paths. -/
|
| 54 |
+
theorem immInternalPath_collision_zero (d : ℕ) (side : Fin (d + 1) → Bool)
|
| 55 |
+
(M : (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) →₀ ℕ)
|
| 56 |
+
(p q : Fin d → Fin (d + 1)) (hpq : p ≠ q)
|
| 57 |
+
(heq : pathOccupation (fun e => side e.1) (immInternalPathEdges d p) M =
|
| 58 |
+
pathOccupation (fun e => side e.1) (immInternalPathEdges d q) M) :
|
| 59 |
+
((immInternalPathEdges d p).map (occupationAmplitude (fun e => side e.1) M)).prod *
|
| 60 |
+
((immInternalPathEdges d q).map (occupationAmplitude (fun e => side e.1) M)).prod = 0 := by
|
| 61 |
+
by_cases hp : ((immInternalPathEdges d p).map
|
| 62 |
+
(occupationAmplitude (fun e => side e.1) M)).prod = 0
|
| 63 |
+
· simp [hp]
|
| 64 |
+
by_cases hq : ((immInternalPathEdges d q).map
|
| 65 |
+
(occupationAmplitude (fun e => side e.1) M)).prod = 0
|
| 66 |
+
· simp [hq]
|
| 67 |
+
exact (hpq (immInternalPath_target_injective_of_amplitudes_ne_zero d side M p q hp hq heq)).elim
|
| 68 |
+
|
| 69 |
+
end Problem335
|
| 70 |
+
|
| 71 |
+
end
|
| 72 |
+
|
| 73 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmProfileCompatibility.lean
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.PathInjectivity
|
| 2 |
+
import OAI.Algebra.DepthFive.ImmPairingCompatibility
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Problem335
|
| 8 |
+
|
| 9 |
+
/-- The list-based layer profile of an actual internal IMM path is its vertex coordinate. -/
|
| 10 |
+
@[simp] theorem edgeProfile_immInternalPathEdges (d : ℕ)
|
| 11 |
+
(p : Fin d → Fin (d + 1)) (t : Fin (d + 1)) :
|
| 12 |
+
edgeProfile (immInternalPathEdges d p) (immInternalPathEdges_labels d p) t =
|
| 13 |
+
immInternalCoordinate d p t := by
|
| 14 |
+
simp only [edgeProfile, immInternalPathEdges, List.getElem_ofFn,
|
| 15 |
+
immInternalCoordinate, immInternalPathVertices_castSucc, immInternalPathVertices_succ]
|
| 16 |
+
|
| 17 |
+
/-- All four list profiles agree with the layer labels defining pairing weights. -/
|
| 18 |
+
theorem layerLabels_eq_immPathProfiles (d : ℕ)
|
| 19 |
+
(x : Fin d → Pairings.Labels (Fin (d + 1))) (t : Fin (d + 1)) :
|
| 20 |
+
MomentPairing.layerLabels 0 x t =
|
| 21 |
+
(⟨edgeProfile (immInternalPathEdges d (fun i => (x i).p))
|
| 22 |
+
(immInternalPathEdges_labels d _) t,
|
| 23 |
+
edgeProfile (immInternalPathEdges d (fun i => (x i).q))
|
| 24 |
+
(immInternalPathEdges_labels d _) t,
|
| 25 |
+
edgeProfile (immInternalPathEdges d (fun i => (x i).r))
|
| 26 |
+
(immInternalPathEdges_labels d _) t,
|
| 27 |
+
edgeProfile (immInternalPathEdges d (fun i => (x i).s))
|
| 28 |
+
(immInternalPathEdges_labels d _) t⟩ :
|
| 29 |
+
Pairings.Labels (Fin (d + 1) × Fin (d + 1))) := by
|
| 30 |
+
simpa only [edgeProfile_immInternalPathEdges] using
|
| 31 |
+
layerLabels_immInternalCoordinate d (fun i => (x i).p) (fun i => (x i).q)
|
| 32 |
+
(fun i => (x i).r) (fun i => (x i).s) t
|
| 33 |
+
|
| 34 |
+
end Problem335
|
| 35 |
+
|
| 36 |
+
end
|
| 37 |
+
|
| 38 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmSecondLocalBound.lean
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmSecondTrace
|
| 2 |
+
import OAI.Algebra.DepthFive.FockLayerProfile
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
|
| 9 |
+
namespace Problem335
|
| 10 |
+
|
| 11 |
+
/-- The actual finite normalized IMM second trace is bounded by the sum
|
| 12 |
+
of the compatible local occupation-polynomial products. This has no
|
| 13 |
+
source-validity, moment, or nonempty-index assumptions. -/
|
| 14 |
+
theorem immNormalizedMatrix_second_trace_le_localPolynomial_sum
|
| 15 |
+
(n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) :
|
| 16 |
+
let A := immNormalizedMatrix n side a b
|
| 17 |
+
let eps := immPathSignedShift n hn (fun x => side x.1)
|
| 18 |
+
((A.conjTranspose * A) ^ 2).trace.re ≤
|
| 19 |
+
∑ d : ImmSourceIndex n side a b, ∑ p, ∑ q, ∑ r, ∑ s,
|
| 20 |
+
if eps p - eps q = eps r - eps s then
|
| 21 |
+
∏ t : Fin n, LocalMoments.localPolynomial (side t) (fun x => d.1 (t, x))
|
| 22 |
+
(FockLayerProfile.immProfile n hn p t)
|
| 23 |
+
(FockLayerProfile.immProfile n hn q t)
|
| 24 |
+
(FockLayerProfile.immProfile n hn r t)
|
| 25 |
+
else 0 := by
|
| 26 |
+
classical
|
| 27 |
+
dsimp only
|
| 28 |
+
rw [immNormalizedMatrix_second_trace n hn side a b]
|
| 29 |
+
apply Finset.sum_le_sum
|
| 30 |
+
intro d hd
|
| 31 |
+
apply Finset.sum_le_sum
|
| 32 |
+
intro p hp
|
| 33 |
+
apply Finset.sum_le_sum
|
| 34 |
+
intro q hq
|
| 35 |
+
apply Finset.sum_le_sum
|
| 36 |
+
intro r hr
|
| 37 |
+
apply Finset.sum_le_sum
|
| 38 |
+
intro s hs
|
| 39 |
+
split_ifs with hmatch
|
| 40 |
+
· exact FockLayerProfile.imm_zeroExtended_amplitude_four_le_local_product
|
| 41 |
+
n hn side (fun d : ImmSourceIndex n side a b => d.1)
|
| 42 |
+
Subtype.val_injective d p q r s hmatch
|
| 43 |
+
· exact le_rfl
|
| 44 |
+
|
| 45 |
+
end Problem335
|
| 46 |
+
|
| 47 |
+
end
|
| 48 |
+
|
| 49 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmSecondMomentParameters.lean
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmCompatibleTrace
|
| 2 |
+
import OAI.Algebra.DepthFive.BidegreeLocalProductAverage
|
| 3 |
+
import OAI.Algebra.DepthFive.PairingAverageCardinality
|
| 4 |
+
import OAI.Algebra.DepthFive.PairingOccupationAverage
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
noncomputable section
|
| 9 |
+
open scoped BigOperators
|
| 10 |
+
|
| 11 |
+
namespace Problem335
|
| 12 |
+
open Pairings MomentPairing
|
| 13 |
+
|
| 14 |
+
private theorem source_bound
|
| 15 |
+
(L : ℕ) (side : Fin (L + 1) → Bool)
|
| 16 |
+
[Nonempty {x : Fin (L + 1) × (Fin (L + 1) × Fin (L + 1)) // side x.1 = true}]
|
| 17 |
+
[Nonempty {x : Fin (L + 1) × (Fin (L + 1) × Fin (L + 1)) // ¬ side x.1 = true}]
|
| 18 |
+
(a b : ℕ) (ha : 0 < a) :
|
| 19 |
+
(∑ M : ImmSourceIndex (L + 1) side a b,
|
| 20 |
+
∑ x : {x : Fin L → Labels (Fin (L + 1)) // Compatible 0 x},
|
| 21 |
+
∏ t : Fin (L + 1), LocalMoments.localPolynomial (side t)
|
| 22 |
+
(fun y => M.1 (t, y)) (MomentPairing.layerLabels 0 x.1 t).p
|
| 23 |
+
(MomentPairing.layerLabels 0 x.1 t).q (MomentPairing.layerLabels 0 x.1 t).r) ≤
|
| 24 |
+
(Fintype.card (ImmSourceIndex (L + 1) side a b) : ℝ) *
|
| 25 |
+
pathMean side (layerMeanV (Fin (L + 1)) side a)
|
| 26 |
+
(layerMeanU (Fin (L + 1)) side b) ^ 2 *
|
| 27 |
+
∑ τ : Fin (L + 1) → Kind,
|
| 28 |
+
∑ x : RelaxedPaths (Fin (L + 1)) 0 τ,
|
| 29 |
+
pathWeight side
|
| 30 |
+
(layerMeanV (Fin (L + 1)) side a /
|
| 31 |
+
(layerMeanV (Fin (L + 1)) side a + 1))
|
| 32 |
+
(layerMeanU (Fin (L + 1)) side b /
|
| 33 |
+
(layerMeanU (Fin (L + 1)) side b + 1)) 0 τ x.1 := by
|
| 34 |
+
classical
|
| 35 |
+
have hA : 0 < layerMeanV (Fin (L + 1)) side a := by
|
| 36 |
+
unfold layerMeanV
|
| 37 |
+
exact div_pos (by exact_mod_cast ha) (by exact_mod_cast Fintype.card_pos)
|
| 38 |
+
have hB : 0 ≤ layerMeanU (Fin (L + 1)) side b := by
|
| 39 |
+
unfold layerMeanU
|
| 40 |
+
positivity
|
| 41 |
+
apply sum_sources_local_moments_le_of_average
|
| 42 |
+
(ι := ImmSourceIndex (L + 1) side a b) (γ := Fin (L + 1)) (L := L) side hA hB 0
|
| 43 |
+
(fun M : ImmSourceIndex (L + 1) side a b => fun x =>
|
| 44 |
+
∏ t : Fin (L + 1), LocalMoments.localPolynomial (side t)
|
| 45 |
+
(fun y => M.1 (t, y)) (MomentPairing.layerLabels 0 x t).p
|
| 46 |
+
(MomentPairing.layerLabels 0 x t).q (MomentPairing.layerLabels 0 x t).r)
|
| 47 |
+
intro x _
|
| 48 |
+
simpa only [layerMeanV, layerMeanU] using
|
| 49 |
+
LocalMoments.bidegree_average_layered_localProduct_le side a b Finset.univ
|
| 50 |
+
(fun t => (MomentPairing.layerLabels 0 x t).p) (fun t => (MomentPairing.layerLabels 0 x t).q)
|
| 51 |
+
(fun t => (MomentPairing.layerLabels 0 x t).r)
|
| 52 |
+
|
| 53 |
+
/-- The actual finite IMM second trace is bounded by the relaxed pairing sum,
|
| 54 |
+
with precisely one source dimension and the square of the path mean. -/
|
| 55 |
+
theorem immNormalizedMatrix_second_moment_le_relaxed
|
| 56 |
+
(L : ℕ) (side : Fin (L + 1) → Bool)
|
| 57 |
+
[Nonempty {x : Fin (L + 1) × (Fin (L + 1) × Fin (L + 1)) // side x.1 = true}]
|
| 58 |
+
[Nonempty {x : Fin (L + 1) × (Fin (L + 1) × Fin (L + 1)) // ¬ side x.1 = true}]
|
| 59 |
+
(a b : ℕ) (ha : 0 < a) :
|
| 60 |
+
let A := immNormalizedMatrix (L + 1) side a b
|
| 61 |
+
((A.conjTranspose * A) ^ 2).trace.re ≤
|
| 62 |
+
(Fintype.card (ImmSourceIndex (L + 1) side a b) : ℝ) *
|
| 63 |
+
pathMean side (layerMeanV (Fin (L + 1)) side a)
|
| 64 |
+
(layerMeanU (Fin (L + 1)) side b) ^ 2 *
|
| 65 |
+
∑ τ : Fin (L + 1) → Kind,
|
| 66 |
+
∑ x : RelaxedPaths (Fin (L + 1)) 0 τ,
|
| 67 |
+
pathWeight side
|
| 68 |
+
(layerMeanV (Fin (L + 1)) side a /
|
| 69 |
+
(layerMeanV (Fin (L + 1)) side a + 1))
|
| 70 |
+
(layerMeanU (Fin (L + 1)) side b /
|
| 71 |
+
(layerMeanU (Fin (L + 1)) side b + 1)) 0 τ x.1 := by
|
| 72 |
+
exact (immNormalizedMatrix_second_trace_le_compatible L side a b).trans
|
| 73 |
+
(source_bound L side a b ha)
|
| 74 |
+
|
| 75 |
+
end Problem335
|
| 76 |
+
|
| 77 |
+
end
|
| 78 |
+
|
| 79 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/ImmSecondTrace.lean
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmFiniteMatrix
|
| 2 |
+
import OAI.Algebra.DepthFive.FourPathTrace
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! The second trace identity for the actual IMM operator in normalized
|
| 7 |
+
monomial coordinates. Invalid path actions have zero amplitude, so their
|
| 8 |
+
chosen finite target index does not enter the trace. -/
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
|
| 13 |
+
namespace Problem335
|
| 14 |
+
|
| 15 |
+
/-- The signed exponent displacement of an actual IMM path. -/
|
| 16 |
+
def immPathSignedShift (n : ℕ) (hn : 0 < n)
|
| 17 |
+
(isV : (Fin n × Fin n × Fin n) → Bool)
|
| 18 |
+
(p : Fin (immPaths n hn).length) : (Fin n × Fin n × Fin n) →₀ ℤ :=
|
| 19 |
+
occupationShift isV ((immPaths n hn).get p)
|
| 20 |
+
|
| 21 |
+
/-- Every nonzero actual path action has its prescribed signed displacement. -/
|
| 22 |
+
theorem signedOccupation_immPathOccupation (n : ℕ) (hn : 0 < n)
|
| 23 |
+
(isV : (Fin n × Fin n × Fin n) → Bool)
|
| 24 |
+
(d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length)
|
| 25 |
+
(hamp : immPathAmplitude n hn isV d p ≠ 0) :
|
| 26 |
+
signedOccupation (immPathOccupation n hn isV d p) =
|
| 27 |
+
signedOccupation d + immPathSignedShift n hn isV p := by
|
| 28 |
+
exact signedOccupation_path_of_amplitude_ne_zero isV ((immPaths n hn).get p)
|
| 29 |
+
(immPaths_nodup n hn _ (List.get_mem _ p)) d hamp
|
| 30 |
+
|
| 31 |
+
/-- A finite submatrix of the genuine normalized IMM operator. -/
|
| 32 |
+
def immCoefficientMatrix {I J : Type*} (n : ℕ)
|
| 33 |
+
(isV : (Fin n × Fin n × Fin n) → Bool)
|
| 34 |
+
(source : I → (Fin n × Fin n × Fin n) →₀ ℕ)
|
| 35 |
+
(target : J → (Fin n × Fin n × Fin n) →₀ ℕ) : Matrix J I ℂ :=
|
| 36 |
+
fun j i => complexFockBasis.repr
|
| 37 |
+
(mixedOperator isV (imm ℂ n) (complexFockMonomial (source i))) (target j)
|
| 38 |
+
|
| 39 |
+
/-- The finite normalized coefficient matrix is the actual weighted path matrix
|
| 40 |
+
whenever all nonzero path actions are represented in its target coordinates. -/
|
| 41 |
+
theorem immCoefficientMatrix_eq_pathShiftMatrix {I J : Type*}
|
| 42 |
+
[Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J]
|
| 43 |
+
(n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool)
|
| 44 |
+
(source : I → (Fin n × Fin n × Fin n) →₀ ℕ)
|
| 45 |
+
(target : J → (Fin n × Fin n × Fin n) →₀ ℕ)
|
| 46 |
+
(htarget : Function.Injective target)
|
| 47 |
+
(shift : I → Fin (immPaths n hn).length → J)
|
| 48 |
+
(hshift : ∀ i p, immPathAmplitude n hn isV (source i) p ≠ 0 →
|
| 49 |
+
target (shift i p) = immPathOccupation n hn isV (source i) p) :
|
| 50 |
+
immCoefficientMatrix n isV source target =
|
| 51 |
+
pathShiftMatrix shift (fun i p => (immPathAmplitude n hn isV (source i) p : ℂ)) := by
|
| 52 |
+
classical
|
| 53 |
+
ext j i
|
| 54 |
+
change complexFockBasis.repr
|
| 55 |
+
(mixedOperator isV (imm ℂ n) (complexFockMonomial (source i))) (target j) = _
|
| 56 |
+
rw [complexFockBasis_repr_mixedOperator_imm n hn isV]
|
| 57 |
+
unfold pathShiftMatrix
|
| 58 |
+
apply Finset.sum_congr rfl
|
| 59 |
+
intro p hp
|
| 60 |
+
by_cases hz : immPathAmplitude n hn isV (source i) p = 0
|
| 61 |
+
· simp [hz]
|
| 62 |
+
· simp only [← hshift i p hz, htarget.eq_iff]
|
| 63 |
+
|
| 64 |
+
/-- Source-eliminated second trace for the genuine finite IMM coefficient
|
| 65 |
+
matrix. The only coordinate hypothesis says that nonzero path actions stay
|
| 66 |
+
in the chosen target basis; no trace or moment formula is assumed. -/
|
| 67 |
+
theorem immCoefficientMatrix_second_trace {I J : Type*}
|
| 68 |
+
[Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J]
|
| 69 |
+
(n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool)
|
| 70 |
+
(source : I → (Fin n × Fin n × Fin n) →₀ ℕ)
|
| 71 |
+
(hsource : Function.Injective source)
|
| 72 |
+
(target : J → (Fin n × Fin n × Fin n) →₀ ℕ)
|
| 73 |
+
(htarget : Function.Injective target)
|
| 74 |
+
(shift : I → Fin (immPaths n hn).length → J)
|
| 75 |
+
(hshift : ∀ i p, immPathAmplitude n hn isV (source i) p ≠ 0 →
|
| 76 |
+
target (shift i p) = immPathOccupation n hn isV (source i) p) :
|
| 77 |
+
let A := immCoefficientMatrix n isV source target
|
| 78 |
+
let occupation := fun i => signedOccupation (source i)
|
| 79 |
+
let eps := immPathSignedShift n hn isV
|
| 80 |
+
let weight := fun i p => immPathAmplitude n hn isV (source i) p
|
| 81 |
+
((A.conjTranspose * A) ^ 2).trace.re =
|
| 82 |
+
∑ i, ∑ p, ∑ q, ∑ r, ∑ s,
|
| 83 |
+
if eps p - eps q = eps r - eps s then
|
| 84 |
+
weight i p * Function.extend occupation (fun k => weight k q) (fun _ => 0)
|
| 85 |
+
(occupation i + eps p - eps q) * weight i r *
|
| 86 |
+
Function.extend occupation (fun k => weight k s) (fun _ => 0)
|
| 87 |
+
(occupation i + eps p - eps q) else 0 := by
|
| 88 |
+
classical
|
| 89 |
+
dsimp only
|
| 90 |
+
rw [immCoefficientMatrix_eq_pathShiftMatrix n hn isV source target htarget shift hshift]
|
| 91 |
+
apply complex_path_second_trace_eliminate_source
|
| 92 |
+
(fun i => signedOccupation (source i)) (signedOccupation_injective.comp hsource)
|
| 93 |
+
(fun j => signedOccupation (target j)) (signedOccupation_injective.comp htarget)
|
| 94 |
+
intro i p hp
|
| 95 |
+
rw [hshift i p hp]
|
| 96 |
+
exact signedOccupation_immPathOccupation n hn isV (source i) p hp
|
| 97 |
+
|
| 98 |
+
/-- A finite target index for each path. The fallback is used only for a
|
| 99 |
+
zero-amplitude path, and is therefore invisible in the operator matrix. -/
|
| 100 |
+
def immFinitePathShift (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ)
|
| 101 |
+
(e0 : ImmTargetIndex n side a b) (d : ImmSourceIndex n side a b)
|
| 102 |
+
(p : Fin (immPaths n hn).length) : ImmTargetIndex n side a b := by
|
| 103 |
+
classical
|
| 104 |
+
exact if h : immPathAmplitude n hn (fun x => side x.1) d.1 p ≠ 0 then
|
| 105 |
+
⟨immPathOccupation n hn (fun x => side x.1) d.1 p,
|
| 106 |
+
immPathOccupation_bidegree_of_amplitude_ne_zero n hn side a b d.1 d.2 p h⟩
|
| 107 |
+
else e0
|
| 108 |
+
|
| 109 |
+
theorem immFinitePathShift_val_of_amplitude_ne_zero
|
| 110 |
+
(n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ)
|
| 111 |
+
(e0 : ImmTargetIndex n side a b) (d : ImmSourceIndex n side a b)
|
| 112 |
+
(p : Fin (immPaths n hn).length)
|
| 113 |
+
(hp : immPathAmplitude n hn (fun x => side x.1) d.1 p ≠ 0) :
|
| 114 |
+
(immFinitePathShift n hn side a b e0 d p).1 =
|
| 115 |
+
immPathOccupation n hn (fun x => side x.1) d.1 p := by
|
| 116 |
+
simp only [immFinitePathShift, dite_eq_left hp]
|
| 117 |
+
|
| 118 |
+
/-- The finite normalized operator matrix is the indicated submatrix of its
|
| 119 |
+
ambient normalized monomial coefficients. -/
|
| 120 |
+
theorem immNormalizedMatrix_eq_immCoefficientMatrix
|
| 121 |
+
(n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) :
|
| 122 |
+
immNormalizedMatrix n side a b =
|
| 123 |
+
immCoefficientMatrix n (fun x => side x.1)
|
| 124 |
+
(fun d : ImmSourceIndex n side a b => d.1)
|
| 125 |
+
(fun e : ImmTargetIndex n side a b => e.1) := by
|
| 126 |
+
classical
|
| 127 |
+
ext e d
|
| 128 |
+
rw [immNormalizedMatrix_apply n hn side a b]
|
| 129 |
+
exact (complexFockBasis_repr_mixedOperator_imm n hn (fun x => side x.1) d.1 e.1).symm
|
| 130 |
+
|
| 131 |
+
/-- The actual finite IMM matrix has a weighted finite-path representation. -/
|
| 132 |
+
theorem immNormalizedMatrix_eq_pathShiftMatrix_of_fallback
|
| 133 |
+
(n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ)
|
| 134 |
+
(e0 : ImmTargetIndex n side a b) :
|
| 135 |
+
immNormalizedMatrix n side a b =
|
| 136 |
+
pathShiftMatrix (immFinitePathShift n hn side a b e0)
|
| 137 |
+
(fun d p => (immPathAmplitude n hn (fun x => side x.1) d.1 p : ℂ)) := by
|
| 138 |
+
classical
|
| 139 |
+
rw [immNormalizedMatrix_eq_immCoefficientMatrix n hn side a b]
|
| 140 |
+
exact immCoefficientMatrix_eq_pathShiftMatrix n hn (fun x => side x.1)
|
| 141 |
+
_ _ Subtype.val_injective _
|
| 142 |
+
(immFinitePathShift_val_of_amplitude_ne_zero n hn side a b e0)
|
| 143 |
+
|
| 144 |
+
/-- Exact source-eliminated second trace of the genuine finite IMM operator.
|
| 145 |
+
This includes an empty target space: then every path amplitude vanishes.
|
| 146 |
+
There are no trace, closure, or nonempty-index assumptions in the statement. -/
|
| 147 |
+
theorem immNormalizedMatrix_second_trace
|
| 148 |
+
(n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) :
|
| 149 |
+
let A := immNormalizedMatrix n side a b
|
| 150 |
+
let occupation := fun d : ImmSourceIndex n side a b => signedOccupation d.1
|
| 151 |
+
let eps := immPathSignedShift n hn (fun x => side x.1)
|
| 152 |
+
let weight := fun (d : ImmSourceIndex n side a b) p =>
|
| 153 |
+
immPathAmplitude n hn (fun x => side x.1) d.1 p
|
| 154 |
+
((A.conjTranspose * A) ^ 2).trace.re =
|
| 155 |
+
∑ d, ∑ p, ∑ q, ∑ r, ∑ s,
|
| 156 |
+
if eps p - eps q = eps r - eps s then
|
| 157 |
+
weight d p * Function.extend occupation (fun k => weight k q) (fun _ => 0)
|
| 158 |
+
(occupation d + eps p - eps q) * weight d r *
|
| 159 |
+
Function.extend occupation (fun k => weight k s) (fun _ => 0)
|
| 160 |
+
(occupation d + eps p - eps q) else 0 := by
|
| 161 |
+
classical
|
| 162 |
+
rcases isEmpty_or_nonempty (ImmTargetIndex n side a b) with h | h
|
| 163 |
+
· let := h
|
| 164 |
+
have hA : immNormalizedMatrix n side a b = 0 := Subsingleton.elim _ _
|
| 165 |
+
have hz (d : ImmSourceIndex n side a b) (p : Fin (immPaths n hn).length) :
|
| 166 |
+
immPathAmplitude n hn (fun x => side x.1) d.1 p = 0 := by
|
| 167 |
+
by_contra hp
|
| 168 |
+
exact isEmptyElim (⟨immPathOccupation n hn (fun x => side x.1) d.1 p,
|
| 169 |
+
immPathOccupation_bidegree_of_amplitude_ne_zero n hn side a b d.1 d.2 p hp⟩ :
|
| 170 |
+
ImmTargetIndex n side a b)
|
| 171 |
+
simp [hA, hz]
|
| 172 |
+
· obtain ⟨e0⟩ := h
|
| 173 |
+
dsimp only
|
| 174 |
+
rw [immNormalizedMatrix_eq_immCoefficientMatrix n hn side a b]
|
| 175 |
+
exact immCoefficientMatrix_second_trace n hn (fun x => side x.1)
|
| 176 |
+
_ Subtype.val_injective _ Subtype.val_injective
|
| 177 |
+
(immFinitePathShift n hn side a b e0)
|
| 178 |
+
(immFinitePathShift_val_of_amplitude_ne_zero n hn side a b e0)
|
| 179 |
+
|
| 180 |
+
end Problem335
|
| 181 |
+
|
| 182 |
+
end
|
| 183 |
+
|
| 184 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/IndependentCoordinates.lean
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
|
| 8 |
+
namespace Problem335
|
| 9 |
+
namespace IndependentCoordinates
|
| 10 |
+
|
| 11 |
+
/-- The uniform average on a finite type, with value zero on an empty type. -/
|
| 12 |
+
def average {α : Type*} [Fintype α] (f : α → ℝ) : ℝ :=
|
| 13 |
+
(∑ x, f x) / Fintype.card α
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
/-- Uniform finite averages are unchanged by relabeling. -/
|
| 17 |
+
theorem average_equiv {α β : Type*} [Fintype α] [Fintype β]
|
| 18 |
+
(e : α ≃ β) (f : β → ℝ) : average (fun x => f (e x)) = average f := by
|
| 19 |
+
simp only [average, e.sum_comp, Fintype.card_congr e]
|
| 20 |
+
|
| 21 |
+
/-- Independent coordinates factor the average of a product. -/
|
| 22 |
+
theorem average_prod {ι : Type*} [Fintype ι] [DecidableEq ι] {α : ι → Type*}
|
| 23 |
+
[∀ i, Fintype (α i)] (f : ∀ i, α i → ℝ) :
|
| 24 |
+
average (fun x : ∀ i, α i => ∏ i, f i (x i)) = ∏ i, average (f i) := by
|
| 25 |
+
classical
|
| 26 |
+
simp only [average, Fintype.card_pi, Nat.cast_prod, Finset.prod_div_distrib]
|
| 27 |
+
congr 1
|
| 28 |
+
exact (Fintype.prod_sum f).symm
|
| 29 |
+
|
| 30 |
+
/-- Reorganize coordinates into the fibers of a grouping function. -/
|
| 31 |
+
def fiberAssignmentEquiv {σ ι α : Type*} (group : σ → ι) :
|
| 32 |
+
(σ → α) ≃ (∀ i, {s // group s = i} → α) :=
|
| 33 |
+
(Equiv.piCongrLeft (fun _ : σ => α) (Equiv.sigmaFiberEquiv group)).symm.trans
|
| 34 |
+
(Equiv.piCurry (fun _ _ => α))
|
| 35 |
+
|
| 36 |
+
@[simp] theorem fiberAssignmentEquiv_apply {σ ι α : Type*} (group : σ → ι)
|
| 37 |
+
(x : σ → α) (i : ι) (s : {s // group s = i}) :
|
| 38 |
+
fiberAssignmentEquiv group x i s = x s := rfl
|
| 39 |
+
|
| 40 |
+
/-- Factors on disjoint groups of coordinates have independent uniform averages.
|
| 41 |
+
An unused group can be included with its factor set equal to one. -/
|
| 42 |
+
theorem average_grouped_prod {σ ι α : Type*}
|
| 43 |
+
[Fintype σ] [Fintype ι] [Fintype α] [DecidableEq σ] [DecidableEq ι]
|
| 44 |
+
(group : σ → ι) (f : ∀ i, ({s // group s = i} → α) → ℝ) :
|
| 45 |
+
average (fun x : σ → α => ∏ i, f i (fun s => x s)) =
|
| 46 |
+
∏ i, average (f i) := by
|
| 47 |
+
calc
|
| 48 |
+
_ = average (fun x : ∀ i, ({s // group s = i} → α) => ∏ i, f i (x i)) :=
|
| 49 |
+
average_equiv (fiberAssignmentEquiv group) _
|
| 50 |
+
_ = _ := average_prod f
|
| 51 |
+
|
| 52 |
+
/-- One independent pair of uniform labels agrees with probability `1 / card α`. -/
|
| 53 |
+
theorem average_pair_eq {α : Type*} [Fintype α] [DecidableEq α] :
|
| 54 |
+
average (fun x : α × α => if x.1 = x.2 then (1 : ℝ) else 0) =
|
| 55 |
+
(Fintype.card α : ℝ)⁻¹ := by
|
| 56 |
+
rw [average, Fintype.sum_prod_type]
|
| 57 |
+
simp only [Finset.sum_ite_eq, Finset.mem_univ, ite_true, Finset.sum_const,
|
| 58 |
+
Finset.card_univ, nsmul_eq_mul, mul_one, Fintype.card_prod, Nat.cast_mul]
|
| 59 |
+
by_cases h : (Fintype.card α : ℝ) = 0
|
| 60 |
+
· simp [h]
|
| 61 |
+
· field_simp
|
| 62 |
+
|
| 63 |
+
theorem average_add {α : Type*} [Fintype α] (f g : α → ℝ) :
|
| 64 |
+
average (fun x => f x + g x) = average f + average g := by
|
| 65 |
+
simp [average, Finset.sum_add_distrib, add_div]
|
| 66 |
+
|
| 67 |
+
theorem average_const {α : Type*} [Fintype α] [Nonempty α] (c : ℝ) :
|
| 68 |
+
average (fun _ : α => c) = c := by
|
| 69 |
+
simp [average, Fintype.card_ne_zero]
|
| 70 |
+
|
| 71 |
+
theorem average_const_mul {α : Type*} [Fintype α] (c : ℝ) (f : α → ℝ) :
|
| 72 |
+
average (fun x => c * f x) = c * average f := by
|
| 73 |
+
simp [average, ← Finset.mul_sum, mul_div_assoc]
|
| 74 |
+
|
| 75 |
+
/-- The indicator that two labels agree. -/
|
| 76 |
+
def pairEq {α : Type*} [DecidableEq α] (x : α × α) : ℝ :=
|
| 77 |
+
if x.1 = x.2 then 1 else 0
|
| 78 |
+
|
| 79 |
+
/-- Simultaneous agreement of `card κ` independent label pairs. -/
|
| 80 |
+
def allPairsEq {κ α : Type*} [Fintype κ] [DecidableEq α]
|
| 81 |
+
(x : κ → α × α) : ℝ := ∏ i, pairEq (x i)
|
| 82 |
+
|
| 83 |
+
theorem average_allPairsEq {κ α : Type*} [Fintype κ] [Fintype α]
|
| 84 |
+
[DecidableEq κ] [DecidableEq α] :
|
| 85 |
+
average (allPairsEq (κ := κ) (α := α)) =
|
| 86 |
+
(Fintype.card α : ℝ)⁻¹ ^ Fintype.card κ := by
|
| 87 |
+
rw [show allPairsEq (κ := κ) (α := α) =
|
| 88 |
+
(fun x : κ → α × α => ∏ i, pairEq (x i)) from rfl, average_prod]
|
| 89 |
+
simp only [Finset.prod_const, Finset.card_univ]
|
| 90 |
+
exact congrArg (fun z : ℝ => z ^ Fintype.card κ) (average_pair_eq (α := α))
|
| 91 |
+
|
| 92 |
+
theorem average_equality_correction {κ α : Type*} [Fintype κ] [Fintype α]
|
| 93 |
+
[DecidableEq κ] [DecidableEq α] [Nonempty α] (c : ℝ) :
|
| 94 |
+
average (fun x : κ → α × α => 1 + c * allPairsEq x) =
|
| 95 |
+
1 + c * (Fintype.card α : ℝ)⁻¹ ^ Fintype.card κ := by
|
| 96 |
+
rw [average_add, average_const, average_const_mul, average_allPairsEq]
|
| 97 |
+
|
| 98 |
+
/-- The precise independence identity used for nonadjacent derivative layers.
|
| 99 |
+
The fibers of `group` are the disjoint sets of free endpoints of those layers. -/
|
| 100 |
+
theorem average_grouped_equality_corrections {σ ι α : Type*}
|
| 101 |
+
[Fintype σ] [Fintype ι] [Fintype α]
|
| 102 |
+
[DecidableEq σ] [DecidableEq ι] [DecidableEq α] [Nonempty α]
|
| 103 |
+
(group : σ → ι) (c : ι → ℝ) :
|
| 104 |
+
average (fun x : σ → α × α =>
|
| 105 |
+
∏ i, (1 + c i * allPairsEq (fun s : {s // group s = i} => x s))) =
|
| 106 |
+
∏ i, (1 + c i * (Fintype.card α : ℝ)⁻¹ ^ Fintype.card {s // group s = i}) := by
|
| 107 |
+
rw [average_grouped_prod group
|
| 108 |
+
(fun i x => 1 + c i * allPairsEq x)]
|
| 109 |
+
congr 1
|
| 110 |
+
ext i
|
| 111 |
+
exact average_equality_correction (c i)
|
| 112 |
+
|
| 113 |
+
/-- Coordinates assigned to `none` are unused and integrate out. -/
|
| 114 |
+
theorem average_selected_grouped_prod {σ ι α : Type*}
|
| 115 |
+
[Fintype σ] [Fintype ι] [Fintype α] [Nonempty α]
|
| 116 |
+
[DecidableEq σ] [DecidableEq ι]
|
| 117 |
+
(group : σ → Option ι)
|
| 118 |
+
(f : ∀ i, ({s // group s = some i} → α) → ℝ) :
|
| 119 |
+
average (fun x : σ → α => ∏ i, f i (fun s => x s)) =
|
| 120 |
+
∏ i, average (f i) := by
|
| 121 |
+
let F : ∀ o : Option ι, ({s // group s = o} → α) → ℝ := fun o =>
|
| 122 |
+
match o with
|
| 123 |
+
| none => fun _ => 1
|
| 124 |
+
| some i => f i
|
| 125 |
+
have h := average_grouped_prod group F
|
| 126 |
+
simpa only [Fintype.prod_option, F, one_mul, average_const] using h
|
| 127 |
+
|
| 128 |
+
/-- Equality corrections for selected disjoint endpoint groups. Other vertices
|
| 129 |
+
may be assigned to `none`, and their choices do not affect the expectation. -/
|
| 130 |
+
theorem average_selected_equality_corrections {σ ι α : Type*}
|
| 131 |
+
[Fintype σ] [Fintype ι] [Fintype α]
|
| 132 |
+
[DecidableEq σ] [DecidableEq ι] [DecidableEq α] [Nonempty α]
|
| 133 |
+
(group : σ → Option ι) (c : ι → ℝ) :
|
| 134 |
+
average (fun x : σ → α × α =>
|
| 135 |
+
∏ i, (1 + c i * allPairsEq (fun s : {s // group s = some i} => x s))) =
|
| 136 |
+
∏ i, (1 + c i * (Fintype.card α : ℝ)⁻¹ ^
|
| 137 |
+
Fintype.card {s // group s = some i}) := by
|
| 138 |
+
rw [average_selected_grouped_prod group
|
| 139 |
+
(fun i x => 1 + c i * allPairsEq x)]
|
| 140 |
+
congr 1
|
| 141 |
+
ext i
|
| 142 |
+
exact average_equality_correction (c i)
|
| 143 |
+
|
| 144 |
+
/-- Extra independent coordinates that do not appear in the integrand cancel. -/
|
| 145 |
+
theorem average_ignore_right {α β : Type*} [Fintype α] [Fintype β]
|
| 146 |
+
[Nonempty β] (f : α → ℝ) :
|
| 147 |
+
average (fun x : α × β => f x.1) = average f := by
|
| 148 |
+
rw [average, Fintype.sum_prod_type]
|
| 149 |
+
simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul,
|
| 150 |
+
← Finset.mul_sum, Fintype.card_prod, Nat.cast_mul, average]
|
| 151 |
+
have hβ : (Fintype.card β : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero
|
| 152 |
+
by_cases hα : (Fintype.card α : ℝ) = 0
|
| 153 |
+
· simp [hα]
|
| 154 |
+
· field_simp
|
| 155 |
+
|
| 156 |
+
/-- Split all assignments into their values on an embedded coordinate set and
|
| 157 |
+
on its complement. -/
|
| 158 |
+
def restrictAssignmentEquiv {σ τ α : Type*} (j : τ → σ)
|
| 159 |
+
(hj : Function.Injective j) :
|
| 160 |
+
(σ → α) ≃ (τ → α) × ({s // s ∉ Set.range j} → α) := by
|
| 161 |
+
classical
|
| 162 |
+
let e : τ ⊕ {s // s ∉ Set.range j} ≃ σ :=
|
| 163 |
+
((Equiv.ofInjective j hj).sumCongr (Equiv.refl _)).trans
|
| 164 |
+
(Equiv.sumCompl (fun s => s ∈ Set.range j))
|
| 165 |
+
exact (Equiv.piCongrLeft (fun _ : σ => α) e).symm.trans
|
| 166 |
+
(Equiv.sumPiEquivProdPi (fun _ => α))
|
| 167 |
+
|
| 168 |
+
@[simp] theorem restrictAssignmentEquiv_fst {σ τ α : Type*} (j : τ → σ)
|
| 169 |
+
(hj : Function.Injective j) (x : σ → α) (t : τ) :
|
| 170 |
+
(restrictAssignmentEquiv j hj x).1 t = x (j t) := rfl
|
| 171 |
+
|
| 172 |
+
/-- Uniform assignments restrict uniformly to any subset of coordinates. -/
|
| 173 |
+
theorem average_precomp_injective {σ τ α : Type*}
|
| 174 |
+
[Fintype σ] [Fintype τ] [Fintype α] [Nonempty α]
|
| 175 |
+
[DecidableEq σ] [DecidableEq τ]
|
| 176 |
+
(j : τ → σ) (hj : Function.Injective j) (f : (τ → α) → ℝ) :
|
| 177 |
+
average (fun x : σ → α => f (fun t => x (j t))) = average f := by
|
| 178 |
+
classical
|
| 179 |
+
calc
|
| 180 |
+
_ = average (fun x : (τ → α) × ({s // s ∉ Set.range j} → α) => f x.1) :=
|
| 181 |
+
average_equiv (restrictAssignmentEquiv j hj) _
|
| 182 |
+
_ = _ := average_ignore_right f
|
| 183 |
+
|
| 184 |
+
/-- A sigma-indexed family of labels is the product of its fiber families. -/
|
| 185 |
+
theorem average_sigma_prod {ι α : Type*} {κ : ι → Type*}
|
| 186 |
+
[Fintype ι] [Fintype α] [∀ i, Fintype (κ i)]
|
| 187 |
+
[DecidableEq ι] [∀ i, DecidableEq (κ i)]
|
| 188 |
+
(f : ∀ i, (κ i → α) → ℝ) :
|
| 189 |
+
average (fun x : (Σ i, κ i) → α => ∏ i, f i (fun t => x ⟨i, t⟩)) =
|
| 190 |
+
∏ i, average (f i) := by
|
| 191 |
+
let e := Equiv.piCurry (α := ι) (β := κ) (fun _ _ => α)
|
| 192 |
+
have h := average_equiv e (fun x : ∀ i, κ i → α => ∏ i, f i (x i))
|
| 193 |
+
change average (fun x : (Σ i, κ i) → α => ∏ i, f i (fun t => x ⟨i, t⟩)) = _ at h
|
| 194 |
+
exact h.trans (average_prod f)
|
| 195 |
+
|
| 196 |
+
/-- Finite factors on an injectively embedded disjoint family of coordinates
|
| 197 |
+
factor under uniform averaging. -/
|
| 198 |
+
theorem average_embedded_prod {σ ι α : Type*} {κ : ι → Type*}
|
| 199 |
+
[Fintype σ] [Fintype ι] [Fintype α] [∀ i, Fintype (κ i)] [Nonempty α]
|
| 200 |
+
[DecidableEq σ] [DecidableEq ι] [∀ i, DecidableEq (κ i)]
|
| 201 |
+
(j : ∀ i, κ i → σ) (hj : Function.Injective (Sigma.uncurry j))
|
| 202 |
+
(f : ∀ i, (κ i → α) → ℝ) :
|
| 203 |
+
average (fun x : σ → α => ∏ i, f i (fun t => x (j i t))) =
|
| 204 |
+
∏ i, average (f i) := by
|
| 205 |
+
have h := average_precomp_injective (Sigma.uncurry j) hj
|
| 206 |
+
(fun x : (Σ i, κ i) → α => ∏ i, f i (fun t => x ⟨i, t⟩))
|
| 207 |
+
exact h.trans (average_sigma_prod f)
|
| 208 |
+
|
| 209 |
+
/-- Pairwise disjoint subsets give an injective family of coordinate inclusions. -/
|
| 210 |
+
theorem sigma_val_injective {σ ι : Type*} (s : ι → Finset σ)
|
| 211 |
+
(hs : Pairwise (fun i j => Disjoint (s i) (s j))) :
|
| 212 |
+
Function.Injective (fun x : Σ i, s i => (x.2 : σ)) := by
|
| 213 |
+
rintro ⟨i, x⟩ ⟨j, y⟩ hxy
|
| 214 |
+
change (x : σ) = (y : σ) at hxy
|
| 215 |
+
have hij : i = j := by
|
| 216 |
+
by_contra hne
|
| 217 |
+
exact (Finset.disjoint_left.mp (hs hne)) x.property (hxy.symm ▸ y.property)
|
| 218 |
+
subst j
|
| 219 |
+
have h : x = y := Subtype.ext hxy
|
| 220 |
+
subst y
|
| 221 |
+
rfl
|
| 222 |
+
|
| 223 |
+
/-- Factors depending on pairwise disjoint finite coordinate sets are independent. -/
|
| 224 |
+
theorem average_disjoint_finset_prod {σ ι α : Type*}
|
| 225 |
+
[Fintype σ] [Fintype ι] [Fintype α] [Nonempty α]
|
| 226 |
+
[DecidableEq σ] [DecidableEq ι]
|
| 227 |
+
(s : ι → Finset σ) (hs : Pairwise (fun i j => Disjoint (s i) (s j)))
|
| 228 |
+
(f : ∀ i, (s i → α) → ℝ) :
|
| 229 |
+
average (fun x : σ → α => ∏ i, f i (fun t => x t)) =
|
| 230 |
+
∏ i, average (f i) := by
|
| 231 |
+
exact average_embedded_prod (fun i (t : s i) => (t : σ))
|
| 232 |
+
(sigma_val_injective s hs) f
|
| 233 |
+
|
| 234 |
+
/-- The endpoint-coincidence average for pairwise disjoint free-endpoint sets. -/
|
| 235 |
+
theorem average_disjoint_equality_corrections {σ ι α : Type*}
|
| 236 |
+
[Fintype σ] [Fintype ι] [Fintype α]
|
| 237 |
+
[DecidableEq σ] [DecidableEq ι] [DecidableEq α] [Nonempty α]
|
| 238 |
+
(s : ι → Finset σ) (hs : Pairwise (fun i j => Disjoint (s i) (s j)))
|
| 239 |
+
(c : ι → ℝ) :
|
| 240 |
+
average (fun x : σ → α × α =>
|
| 241 |
+
∏ i, (1 + c i * allPairsEq (fun t : s i => x t))) =
|
| 242 |
+
∏ i, (1 + c i * (Fintype.card α : ℝ)⁻¹ ^ (s i).card) := by
|
| 243 |
+
rw [average_disjoint_finset_prod s hs
|
| 244 |
+
(fun i x => 1 + c i * allPairsEq x)]
|
| 245 |
+
apply Finset.prod_congr rfl
|
| 246 |
+
intro i _
|
| 247 |
+
simpa only [Fintype.card_coe] using
|
| 248 |
+
(average_equality_correction (κ := s i) (α := α) (c i))
|
| 249 |
+
|
| 250 |
+
/-- Dependent-coordinate version of restriction to an embedded coordinate set. -/
|
| 251 |
+
def restrictDependentAssignmentEquiv {σ τ : Type*} (β : σ → Type*)
|
| 252 |
+
(j : τ → σ) (hj : Function.Injective j) :
|
| 253 |
+
(∀ s, β s) ≃ (∀ t, β (j t)) × (∀ s : {s // s ∉ Set.range j}, β s) := by
|
| 254 |
+
classical
|
| 255 |
+
let e : τ ⊕ {s // s ∉ Set.range j} ≃ σ :=
|
| 256 |
+
((Equiv.ofInjective j hj).sumCongr (Equiv.refl _)).trans
|
| 257 |
+
(Equiv.sumCompl (fun s => s ∈ Set.range j))
|
| 258 |
+
exact (Equiv.piCongrLeft β e).symm.trans
|
| 259 |
+
(Equiv.sumPiEquivProdPi (fun z => β (e z)))
|
| 260 |
+
|
| 261 |
+
@[simp] theorem restrictDependentAssignmentEquiv_fst {σ τ : Type*}
|
| 262 |
+
(β : σ → Type*) (j : τ → σ) (hj : Function.Injective j)
|
| 263 |
+
(x : ∀ s, β s) (t : τ) :
|
| 264 |
+
(restrictDependentAssignmentEquiv β j hj x).1 t = x (j t) := rfl
|
| 265 |
+
|
| 266 |
+
/-- Marginals of a uniform finite product are uniform, allowing different
|
| 267 |
+
coordinate types at different vertices. -/
|
| 268 |
+
theorem average_precomp_injective_dependent {σ τ : Type*} {β : σ → Type*}
|
| 269 |
+
[Fintype σ] [Fintype τ] [∀ s, Fintype (β s)] [∀ s, Nonempty (β s)]
|
| 270 |
+
[DecidableEq σ] [DecidableEq τ]
|
| 271 |
+
(j : τ → σ) (hj : Function.Injective j) (f : (∀ t, β (j t)) → ℝ) :
|
| 272 |
+
average (fun x : ∀ s, β s => f (fun t => x (j t))) = average f := by
|
| 273 |
+
classical
|
| 274 |
+
calc
|
| 275 |
+
_ = average (fun x : (∀ t, β (j t)) ×
|
| 276 |
+
(∀ s : {s // s ∉ Set.range j}, β s) => f x.1) :=
|
| 277 |
+
average_equiv (restrictDependentAssignmentEquiv β j hj) _
|
| 278 |
+
_ = _ := average_ignore_right f
|
| 279 |
+
|
| 280 |
+
theorem average_sigma_prod_dependent {ι : Type*} {κ : ι → Type*}
|
| 281 |
+
{β : (Σ i, κ i) → Type*}
|
| 282 |
+
[Fintype ι] [∀ i, Fintype (κ i)] [∀ s, Fintype (β s)]
|
| 283 |
+
[DecidableEq ι] [∀ i, DecidableEq (κ i)]
|
| 284 |
+
(f : ∀ i, (∀ t : κ i, β ⟨i,t⟩) → ℝ) :
|
| 285 |
+
average (fun x : ∀ s, β s => ∏ i, f i (fun t => x ⟨i,t⟩)) =
|
| 286 |
+
∏ i, average (f i) := by
|
| 287 |
+
let e := Equiv.piCurry (fun i (t : κ i) => β ⟨i,t⟩)
|
| 288 |
+
have h := average_equiv e (fun x : ∀ i, ∀ t : κ i, β ⟨i,t⟩ => ∏ i, f i (x i))
|
| 289 |
+
change average (fun x : ∀ s, β s => ∏ i, f i (fun t => x ⟨i,t⟩)) = _ at h
|
| 290 |
+
exact h.trans (average_prod f)
|
| 291 |
+
|
| 292 |
+
theorem average_embedded_prod_dependent {σ ι : Type*} {κ : ι → Type*}
|
| 293 |
+
{β : σ → Type*}
|
| 294 |
+
[Fintype σ] [Fintype ι] [∀ i, Fintype (κ i)]
|
| 295 |
+
[∀ s, Fintype (β s)] [∀ s, Nonempty (β s)]
|
| 296 |
+
[DecidableEq σ] [DecidableEq ι] [∀ i, DecidableEq (κ i)]
|
| 297 |
+
(j : ∀ i, κ i → σ) (hj : Function.Injective (Sigma.uncurry j))
|
| 298 |
+
(f : ∀ i, (∀ t : κ i, β (j i t)) → ℝ) :
|
| 299 |
+
average (fun x : ∀ s, β s => ∏ i, f i (fun t => x (j i t))) =
|
| 300 |
+
∏ i, average (f i) := by
|
| 301 |
+
have h := average_precomp_injective_dependent (β := β) (Sigma.uncurry j) hj
|
| 302 |
+
(fun x : ∀ s : Σ i, κ i, β (j s.1 s.2) => ∏ i, f i (fun t => x ⟨i,t⟩))
|
| 303 |
+
exact h.trans (average_sigma_prod_dependent
|
| 304 |
+
(β := fun s : Σ i, κ i => β (j s.1 s.2)) f)
|
| 305 |
+
|
| 306 |
+
/-- Disjoint coordinate families remain independent when vertex alphabets vary. -/
|
| 307 |
+
theorem average_disjoint_finset_prod_dependent {σ ι : Type*} {β : σ → Type*}
|
| 308 |
+
[Fintype σ] [Fintype ι] [∀ s, Fintype (β s)] [∀ s, Nonempty (β s)]
|
| 309 |
+
[DecidableEq σ] [DecidableEq ι]
|
| 310 |
+
(s : ι → Finset σ) (hs : Pairwise (fun i j => Disjoint (s i) (s j)))
|
| 311 |
+
(f : ∀ i, (∀ t : s i, β t) → ℝ) :
|
| 312 |
+
average (fun x : ∀ s, β s => ∏ i, f i (fun t => x t)) =
|
| 313 |
+
∏ i, average (f i) := by
|
| 314 |
+
exact average_embedded_prod_dependent (fun i (t : s i) => (t : σ))
|
| 315 |
+
(sigma_val_injective s hs) f
|
| 316 |
+
|
| 317 |
+
end IndependentCoordinates
|
| 318 |
+
end Problem335
|
| 319 |
+
|
| 320 |
+
end
|
| 321 |
+
|
| 322 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/IndexedCircuit.lean
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.Basic
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
namespace Problem335
|
| 8 |
+
|
| 9 |
+
/-- A depth-five circuit whose gates are indexed by arbitrary finite types.
|
| 10 |
+
This representation is convenient for products, sums, and path-indexed gates;
|
| 11 |
+
`toDepth5Circuit` transports it to the qualified circuit representation. -/
|
| 12 |
+
structure IndexedDepth5Circuit (K : Type*) [CommSemiring K] (n : ℕ)
|
| 13 |
+
(L B P M U : Type*) where
|
| 14 |
+
leaves : L → D5Leaf K n
|
| 15 |
+
bottomInputs : B → List (K × L)
|
| 16 |
+
bottomDegree : B → ℕ
|
| 17 |
+
bottomHomogeneous :
|
| 18 |
+
∀ i entry, entry ∈ bottomInputs i → d5LeafDegree (leaves entry.2) = bottomDegree i
|
| 19 |
+
bottomEmpty :
|
| 20 |
+
∀ i, bottomInputs i = [] → bottomDegree i = 0
|
| 21 |
+
lowerInputs : P → List B
|
| 22 |
+
middleInputs : M → List (K × P)
|
| 23 |
+
middleDegree : M → ℕ
|
| 24 |
+
middleHomogeneous :
|
| 25 |
+
∀ i entry, entry ∈ middleInputs i →
|
| 26 |
+
((lowerInputs entry.2).map bottomDegree).sum = middleDegree i
|
| 27 |
+
middleEmpty :
|
| 28 |
+
∀ i, middleInputs i = [] → middleDegree i = 0
|
| 29 |
+
upperInputs : U → List M
|
| 30 |
+
outputInputs : List (K × U)
|
| 31 |
+
outputDegree : ℕ
|
| 32 |
+
outputHomogeneous :
|
| 33 |
+
∀ entry, entry ∈ outputInputs →
|
| 34 |
+
((upperInputs entry.2).map middleDegree).sum = outputDegree
|
| 35 |
+
outputEmpty : outputInputs = [] → outputDegree = 0
|
| 36 |
+
|
| 37 |
+
namespace IndexedDepth5Circuit
|
| 38 |
+
|
| 39 |
+
variable {K : Type*} [CommSemiring K] {n : ℕ}
|
| 40 |
+
variable {L B P M U : Type*}
|
| 41 |
+
variable [Fintype L] [Fintype B] [Fintype P] [Fintype M] [Fintype U]
|
| 42 |
+
|
| 43 |
+
/-- Relabel each finite gate type by `Fin` without changing any wire or degree. -/
|
| 44 |
+
def toDepth5Circuit (c : IndexedDepth5Circuit K n L B P M U) : Depth5Circuit K n where
|
| 45 |
+
leafCount := Fintype.card L
|
| 46 |
+
leaves i := c.leaves ((Fintype.equivFin L).symm i)
|
| 47 |
+
bottomCount := Fintype.card B
|
| 48 |
+
bottomInputs i := (c.bottomInputs ((Fintype.equivFin B).symm i)).map
|
| 49 |
+
(fun e => (e.1, Fintype.equivFin L e.2))
|
| 50 |
+
bottomDegree i := c.bottomDegree ((Fintype.equivFin B).symm i)
|
| 51 |
+
bottomHomogeneous := by
|
| 52 |
+
intro i entry h
|
| 53 |
+
obtain ⟨e, he, rfl⟩ := List.mem_map.mp h
|
| 54 |
+
simpa using c.bottomHomogeneous ((Fintype.equivFin B).symm i) e he
|
| 55 |
+
bottomEmpty := by
|
| 56 |
+
intro i h
|
| 57 |
+
exact c.bottomEmpty _ (List.map_eq_nil_iff.mp h)
|
| 58 |
+
lowerCount := Fintype.card P
|
| 59 |
+
lowerInputs i := (c.lowerInputs ((Fintype.equivFin P).symm i)).map (Fintype.equivFin B)
|
| 60 |
+
middleCount := Fintype.card M
|
| 61 |
+
middleInputs i := (c.middleInputs ((Fintype.equivFin M).symm i)).map
|
| 62 |
+
(fun e => (e.1, Fintype.equivFin P e.2))
|
| 63 |
+
middleDegree i := c.middleDegree ((Fintype.equivFin M).symm i)
|
| 64 |
+
middleHomogeneous := by
|
| 65 |
+
intro i entry h
|
| 66 |
+
obtain ⟨e, he, rfl⟩ := List.mem_map.mp h
|
| 67 |
+
simpa [List.map_map, Function.comp_def] using
|
| 68 |
+
c.middleHomogeneous ((Fintype.equivFin M).symm i) e he
|
| 69 |
+
middleEmpty := by
|
| 70 |
+
intro i h
|
| 71 |
+
exact c.middleEmpty _ (List.map_eq_nil_iff.mp h)
|
| 72 |
+
upperCount := Fintype.card U
|
| 73 |
+
upperInputs i := (c.upperInputs ((Fintype.equivFin U).symm i)).map (Fintype.equivFin M)
|
| 74 |
+
outputInputs := c.outputInputs.map (fun e => (e.1, Fintype.equivFin U e.2))
|
| 75 |
+
outputDegree := c.outputDegree
|
| 76 |
+
outputHomogeneous := by
|
| 77 |
+
intro entry h
|
| 78 |
+
obtain ⟨e, he, rfl⟩ := List.mem_map.mp h
|
| 79 |
+
simpa [List.map_map, Function.comp_def] using c.outputHomogeneous e he
|
| 80 |
+
outputEmpty := by
|
| 81 |
+
intro h
|
| 82 |
+
exact c.outputEmpty (List.map_eq_nil_iff.mp h)
|
| 83 |
+
|
| 84 |
+
@[simp] theorem circuitSize_toDepth5Circuit
|
| 85 |
+
(c : IndexedDepth5Circuit K n L B P M U) :
|
| 86 |
+
circuitSize c.toDepth5Circuit =
|
| 87 |
+
Fintype.card L + Fintype.card B + Fintype.card P +
|
| 88 |
+
Fintype.card M + Fintype.card U + 1 := rfl
|
| 89 |
+
|
| 90 |
+
@[simp] theorem outputDegree_toDepth5Circuit
|
| 91 |
+
(c : IndexedDepth5Circuit K n L B P M U) :
|
| 92 |
+
c.toDepth5Circuit.outputDegree = c.outputDegree := rfl
|
| 93 |
+
|
| 94 |
+
end IndexedDepth5Circuit
|
| 95 |
+
end Problem335
|
| 96 |
+
|
| 97 |
+
end
|
| 98 |
+
|
| 99 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/IndexedCircuitValue.lean
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.IndexedCircuit
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
namespace Problem335
|
| 8 |
+
namespace IndexedDepth5Circuit
|
| 9 |
+
|
| 10 |
+
variable {K : Type*} [CommSemiring K] {n : ℕ}
|
| 11 |
+
variable {L B P M U : Type*}
|
| 12 |
+
|
| 13 |
+
/-- Value of a bottom gate before relabelling the gate types. -/
|
| 14 |
+
def bottomValue (c : IndexedDepth5Circuit K n L B P M U) (i : B) :
|
| 15 |
+
MvPolynomial (Fin n × Fin n × Fin n) K :=
|
| 16 |
+
((c.bottomInputs i).map (fun entry =>
|
| 17 |
+
MvPolynomial.C entry.1 * d5LeafValue (c.leaves entry.2))).sum
|
| 18 |
+
|
| 19 |
+
/-- Value of a lower product gate before relabelling the gate types. -/
|
| 20 |
+
def lowerValue (c : IndexedDepth5Circuit K n L B P M U) (i : P) :
|
| 21 |
+
MvPolynomial (Fin n × Fin n × Fin n) K :=
|
| 22 |
+
((c.lowerInputs i).map (fun j => bottomValue c j)).prod
|
| 23 |
+
|
| 24 |
+
/-- Value of a middle sum gate before relabelling the gate types. -/
|
| 25 |
+
def middleValue (c : IndexedDepth5Circuit K n L B P M U) (i : M) :
|
| 26 |
+
MvPolynomial (Fin n × Fin n × Fin n) K :=
|
| 27 |
+
((c.middleInputs i).map (fun entry =>
|
| 28 |
+
MvPolynomial.C entry.1 * lowerValue c entry.2)).sum
|
| 29 |
+
|
| 30 |
+
/-- Value of an upper product gate before relabelling the gate types. -/
|
| 31 |
+
def upperValue (c : IndexedDepth5Circuit K n L B P M U) (i : U) :
|
| 32 |
+
MvPolynomial (Fin n × Fin n × Fin n) K :=
|
| 33 |
+
((c.upperInputs i).map (fun j => middleValue c j)).prod
|
| 34 |
+
|
| 35 |
+
/-- Polynomial computed by a circuit indexed by arbitrary finite types. -/
|
| 36 |
+
def circuitValue (c : IndexedDepth5Circuit K n L B P M U) :
|
| 37 |
+
MvPolynomial (Fin n × Fin n × Fin n) K :=
|
| 38 |
+
(c.outputInputs.map (fun entry =>
|
| 39 |
+
MvPolynomial.C entry.1 * upperValue c entry.2)).sum
|
| 40 |
+
|
| 41 |
+
variable [Fintype L] [Fintype B] [Fintype P] [Fintype M] [Fintype U]
|
| 42 |
+
|
| 43 |
+
@[simp] theorem bottomValue_toDepth5Circuit
|
| 44 |
+
(c : IndexedDepth5Circuit K n L B P M U) (i : Fin (Fintype.card B)) :
|
| 45 |
+
Problem335.bottomValue c.toDepth5Circuit i =
|
| 46 |
+
c.bottomValue ((Fintype.equivFin B).symm i) := by
|
| 47 |
+
simp [Problem335.bottomValue, toDepth5Circuit, bottomValue,
|
| 48 |
+
List.map_map, Function.comp_def]
|
| 49 |
+
|
| 50 |
+
@[simp] theorem lowerValue_toDepth5Circuit
|
| 51 |
+
(c : IndexedDepth5Circuit K n L B P M U) (i : Fin (Fintype.card P)) :
|
| 52 |
+
Problem335.lowerValue c.toDepth5Circuit i =
|
| 53 |
+
c.lowerValue ((Fintype.equivFin P).symm i) := by
|
| 54 |
+
simp [Problem335.lowerValue, lowerValue, toDepth5Circuit,
|
| 55 |
+
List.map_map, Function.comp_def, Problem335.bottomValue, bottomValue]
|
| 56 |
+
|
| 57 |
+
@[simp] theorem middleValue_toDepth5Circuit
|
| 58 |
+
(c : IndexedDepth5Circuit K n L B P M U) (i : Fin (Fintype.card M)) :
|
| 59 |
+
Problem335.middleValue c.toDepth5Circuit i =
|
| 60 |
+
c.middleValue ((Fintype.equivFin M).symm i) := by
|
| 61 |
+
simp [Problem335.middleValue, middleValue, toDepth5Circuit,
|
| 62 |
+
List.map_map, Function.comp_def, Problem335.lowerValue, lowerValue,
|
| 63 |
+
Problem335.bottomValue, bottomValue]
|
| 64 |
+
|
| 65 |
+
@[simp] theorem upperValue_toDepth5Circuit
|
| 66 |
+
(c : IndexedDepth5Circuit K n L B P M U) (i : Fin (Fintype.card U)) :
|
| 67 |
+
Problem335.upperValue c.toDepth5Circuit i =
|
| 68 |
+
c.upperValue ((Fintype.equivFin U).symm i) := by
|
| 69 |
+
simp [Problem335.upperValue, upperValue, toDepth5Circuit,
|
| 70 |
+
List.map_map, Function.comp_def, Problem335.middleValue, middleValue,
|
| 71 |
+
Problem335.lowerValue, lowerValue, Problem335.bottomValue, bottomValue]
|
| 72 |
+
|
| 73 |
+
@[simp] theorem circuitValue_toDepth5Circuit
|
| 74 |
+
(c : IndexedDepth5Circuit K n L B P M U) :
|
| 75 |
+
Problem335.circuitValue c.toDepth5Circuit = c.circuitValue := by
|
| 76 |
+
simp [Problem335.circuitValue, circuitValue, toDepth5Circuit,
|
| 77 |
+
List.map_map, Function.comp_def, Problem335.upperValue, upperValue,
|
| 78 |
+
Problem335.middleValue, middleValue, Problem335.lowerValue, lowerValue,
|
| 79 |
+
Problem335.bottomValue, bottomValue]
|
| 80 |
+
|
| 81 |
+
end IndexedDepth5Circuit
|
| 82 |
+
end Problem335
|
| 83 |
+
|
| 84 |
+
end
|
| 85 |
+
|
| 86 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/Infrastructure.lean
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.UpperConstruction
|
| 2 |
+
import OAI.Algebra.DepthFive.UpperBoundArithmetic
|
| 3 |
+
import OAI.Algebra.DepthFive.CharacteristicZeroTransfer
|
| 4 |
+
import OAI.Algebra.DepthFive.LowerInfrastructure
|
| 5 |
+
import OAI.Algebra.DepthFive.ParameterGrowth
|
| 6 |
+
import OAI.Algebra.DepthFive.ParameterCutoff
|
| 7 |
+
import OAI.Algebra.DepthFive.BetaRefinements
|
| 8 |
+
import OAI.Algebra.DepthFive.LowerMoments
|
| 9 |
+
import OAI.Algebra.DepthFive.LowerCircuit
|
| 10 |
+
import OAI.Algebra.DepthFive.WordInfrastructure
|
| 11 |
+
import OAI.Algebra.DepthFive.MomentAssemblyInterfaces
|
| 12 |
+
|
| 13 |
+
/-! Circuit constructions, field transfer, and rank estimates. -/
|
lean/OAI/Algebra/DepthFive/IntegerRank.lean
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
namespace Problem335
|
| 8 |
+
|
| 9 |
+
open Module Submodule
|
| 10 |
+
|
| 11 |
+
universe u v w x
|
| 12 |
+
|
| 13 |
+
/-- Comparing all finite column families compares matrix ranks. -/
|
| 14 |
+
theorem matrix_rank_le_of_independent_imp
|
| 15 |
+
{m : Type u} {n : Type v} [Fintype m] [Fintype n]
|
| 16 |
+
{K : Type w} {L : Type x} [Field K] [Field L]
|
| 17 |
+
(A : Matrix m n K) (B : Matrix m n L)
|
| 18 |
+
(h : ∀ (r : ℕ) (f : Fin r → n), LinearIndependent K (A.col ∘ f) →
|
| 19 |
+
LinearIndependent L (B.col ∘ f)) : A.rank ≤ B.rank := by
|
| 20 |
+
classical
|
| 21 |
+
obtain ⟨p, hp, hspan, hli⟩ :=
|
| 22 |
+
Submodule.exists_fun_fin_finrank_span_eq K (Set.range A.col)
|
| 23 |
+
choose f hf using hp
|
| 24 |
+
have heq : A.col ∘ f = p := funext hf
|
| 25 |
+
have hli' : LinearIndependent L (B.col ∘ f) := h _ f (heq.symm ▸ hli)
|
| 26 |
+
rw [A.rank_eq_finrank_span_cols, B.rank_eq_finrank_span_cols]
|
| 27 |
+
have hsub : Set.range (B.col ∘ f) ⊆ Set.range B.col := by
|
| 28 |
+
rintro _ ⟨i, rfl⟩
|
| 29 |
+
exact ⟨f i, rfl⟩
|
| 30 |
+
calc
|
| 31 |
+
finrank K (span K (Set.range A.col)) =
|
| 32 |
+
finrank L (span L (Set.range (B.col ∘ f))) := by
|
| 33 |
+
simp [finrank_span_eq_card hli']
|
| 34 |
+
_ ≤ finrank L (span L (Set.range B.col)) :=
|
| 35 |
+
Submodule.finrank_mono (Submodule.span_mono hsub)
|
| 36 |
+
|
| 37 |
+
/-- Matrices with the same finite-column dependence relations have equal ranks. -/
|
| 38 |
+
theorem matrix_rank_eq_of_independent_iff
|
| 39 |
+
{m : Type u} {n : Type v} [Fintype m] [Fintype n]
|
| 40 |
+
{K : Type w} {L : Type x} [Field K] [Field L]
|
| 41 |
+
(A : Matrix m n K) (B : Matrix m n L)
|
| 42 |
+
(h : ∀ (r : ℕ) (f : Fin r → n), LinearIndependent K (A.col ∘ f) ↔
|
| 43 |
+
LinearIndependent L (B.col ∘ f)) : A.rank = B.rank := by
|
| 44 |
+
exact le_antisymm
|
| 45 |
+
(matrix_rank_le_of_independent_imp A B (fun r f => (h r f).mp))
|
| 46 |
+
(matrix_rank_le_of_independent_imp B A (fun r f => (h r f).mpr))
|
| 47 |
+
|
| 48 |
+
/-- Extending an integral coefficient matrix to either of two faithful field
|
| 49 |
+
extensions gives the same rank. The fields need not embed into each other. -/
|
| 50 |
+
theorem matrix_rank_algebraMap_eq
|
| 51 |
+
{m : Type u} {n : Type v} [Fintype m] [Fintype n]
|
| 52 |
+
{R K L : Type*} [CommRing R] [Field K] [Field L]
|
| 53 |
+
[Algebra R K] [Algebra R L] [FaithfulSMul R K] [FaithfulSMul R L]
|
| 54 |
+
(A : Matrix m n R) :
|
| 55 |
+
(A.map (algebraMap R K)).rank = (A.map (algebraMap R L)).rank := by
|
| 56 |
+
apply matrix_rank_eq_of_independent_iff
|
| 57 |
+
intro r f
|
| 58 |
+
change LinearIndependent K (fun i => algebraMap R K ∘ A.col (f i)) ↔
|
| 59 |
+
LinearIndependent L (fun i => algebraMap R L ∘ A.col (f i))
|
| 60 |
+
rw [linearIndependent_algebraMap_comp_iff, linearIndependent_algebraMap_comp_iff]
|
| 61 |
+
|
| 62 |
+
/-- A field embedding preserves the rank of a finite rectangular matrix. -/
|
| 63 |
+
theorem matrix_rank_map
|
| 64 |
+
{m : Type u} {n : Type v} [Fintype m] [Fintype n]
|
| 65 |
+
{F K : Type*} [Field F] [Field K] (f : F →+* K) (A : Matrix m n F) :
|
| 66 |
+
(A.map f).rank = A.rank := by
|
| 67 |
+
let : Algebra F K := f.toAlgebra
|
| 68 |
+
simpa only [RingHom.algebraMap_toAlgebra, Algebra.algebraMap_self, RingHom.coe_id, Matrix.map_id] using (matrix_rank_algebraMap_eq (K := K) (L := F) A)
|
| 69 |
+
|
| 70 |
+
/-- Integer matrices have the same rank over any two characteristic-zero fields. -/
|
| 71 |
+
theorem integer_matrix_rank_eq
|
| 72 |
+
{m : Type u} {n : Type v} [Fintype m] [Fintype n]
|
| 73 |
+
(K L : Type*) [Field K] [CharZero K] [Field L] [CharZero L]
|
| 74 |
+
(A : Matrix m n ℤ) :
|
| 75 |
+
(A.map (Int.castRingHom K)).rank = (A.map (Int.castRingHom L)).rank := by
|
| 76 |
+
exact matrix_rank_algebraMap_eq A
|
| 77 |
+
|
| 78 |
+
/-- The characteristic-zero rank-transfer step used in the lower bound. -/
|
| 79 |
+
theorem integer_matrix_rank_eq_complex
|
| 80 |
+
{m : Type u} {n : Type v} [Fintype m] [Fintype n]
|
| 81 |
+
(K : Type*) [Field K] [CharZero K] (A : Matrix m n ℤ) :
|
| 82 |
+
(A.map (Int.castRingHom K)).rank = (A.map (Int.castRingHom ℂ)).rank := by
|
| 83 |
+
exact integer_matrix_rank_eq K ℂ A
|
| 84 |
+
|
| 85 |
+
end Problem335
|
| 86 |
+
|
| 87 |
+
end
|
| 88 |
+
|
| 89 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/IntermediateDimension.lean
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.DimensionCorrection
|
| 2 |
+
import OAI.Algebra.DepthFive.DegreeDiscrepancy
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
|
| 9 |
+
namespace Problem335
|
| 10 |
+
|
| 11 |
+
/-- Factors applied first in the intermediate-space argument. -/
|
| 12 |
+
def positiveBidegreeSet {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) : Finset ι := by
|
| 13 |
+
classical
|
| 14 |
+
exact s.filter (fun j => 0 < (i j : ℝ) - lam * e j)
|
| 15 |
+
|
| 16 |
+
/-- Total differentiation degree of the first group of factors. -/
|
| 17 |
+
def positiveBidegreeV {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) : ℕ :=
|
| 18 |
+
∑ j ∈ positiveBidegreeSet s e i lam, i j
|
| 19 |
+
|
| 20 |
+
/-- Total multiplication degree of the first group of factors. -/
|
| 21 |
+
def positiveBidegreeU {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) : ℕ :=
|
| 22 |
+
∑ j ∈ positiveBidegreeSet s e i lam, (e j - i j)
|
| 23 |
+
|
| 24 |
+
theorem positiveBidegreeV_le {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) :
|
| 25 |
+
positiveBidegreeV s e i lam ≤ ∑ j ∈ s, i j := by
|
| 26 |
+
classical
|
| 27 |
+
exact Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _)
|
| 28 |
+
(fun _ _ _ => Nat.zero_le _)
|
| 29 |
+
|
| 30 |
+
theorem positiveBidegreeU_le {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ)
|
| 31 |
+
(hie : ∀ j ∈ s, i j ≤ e j) :
|
| 32 |
+
positiveBidegreeU s e i lam ≤ (∑ j ∈ s, e j) - ∑ j ∈ s, i j := by
|
| 33 |
+
classical
|
| 34 |
+
calc
|
| 35 |
+
_ ≤ ∑ j ∈ s, (e j - i j) :=
|
| 36 |
+
Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _)
|
| 37 |
+
(fun _ _ _ => Nat.zero_le _)
|
| 38 |
+
_ = _ := Finset.sum_tsub_distrib s hie
|
| 39 |
+
|
| 40 |
+
/-- Natural bidegree assignments give exactly the discrepancy-weight product. -/
|
| 41 |
+
theorem positiveBidegree_rpow {ι : Type*} (s : Finset ι) (e i : ι → ℕ)
|
| 42 |
+
(ρ lam α : ℝ) (hα : 0 < α) (hie : ∀ j ∈ s, i j ≤ e j)
|
| 43 |
+
(hlam : (1 + ρ) * lam = ρ)
|
| 44 |
+
(hbalance : lam * (∑ j ∈ s, e j : ℕ) = (∑ j ∈ s, i j : ℕ)) :
|
| 45 |
+
α ^ ((positiveBidegreeV s e i lam : ℝ) - ρ * positiveBidegreeU s e i lam) =
|
| 46 |
+
∏ j ∈ s, (α ^ ((1 + ρ) / 2)) ^ |(i j : ℝ) - lam * e j| := by
|
| 47 |
+
classical
|
| 48 |
+
have hzero : ∑ j ∈ s, ((i j : ℝ) - lam * e j) = 0 := by
|
| 49 |
+
rw [Finset.sum_sub_distrib, ← Finset.mul_sum]
|
| 50 |
+
norm_cast at hbalance ⊢
|
| 51 |
+
exact sub_eq_zero.mpr hbalance.symm
|
| 52 |
+
have hcast : (positiveBidegreeU s e i lam : ℝ) =
|
| 53 |
+
∑ j ∈ s.filter (fun j => 0 < (i j : ℝ) - lam * e j), ((e j : ℝ) - i j) := by
|
| 54 |
+
unfold positiveBidegreeU positiveBidegreeSet
|
| 55 |
+
push_cast
|
| 56 |
+
apply Finset.sum_congr rfl
|
| 57 |
+
intro j hj
|
| 58 |
+
exact Nat.cast_sub (hie j (Finset.mem_filter.mp hj).1)
|
| 59 |
+
rw [hcast]
|
| 60 |
+
simp only [positiveBidegreeV, positiveBidegreeSet, Nat.cast_sum]
|
| 61 |
+
exact positive_bidegree_rpow s (fun j => (e j : ℝ)) (fun j => (i j : ℝ))
|
| 62 |
+
ρ lam α hα hlam hzero
|
| 63 |
+
|
| 64 |
+
/-- The intermediate space associated to an admissible natural bidegree
|
| 65 |
+
assignment is bounded by its product of discrepancy weights. -/
|
| 66 |
+
theorem intermediate_dimension_le_weight_product {ι : Type*} (s : Finset ι)
|
| 67 |
+
(e i : ι → ℕ) (k n v u a b : ℕ) (ρ lam : ℝ)
|
| 68 |
+
(hie : ∀ j ∈ s, i j ≤ e j)
|
| 69 |
+
(he : ∑ j ∈ s, e j = n) (hi : ∑ j ∈ s, i j = k)
|
| 70 |
+
(hproportion : lam * n = k) (hlam : (1 + ρ) * lam = ρ)
|
| 71 |
+
(hv : 1 ≤ v) (hu : 1 ≤ u) (ha : 0 < a) (hb : 0 < b)
|
| 72 |
+
(hka : k ≤ a) (hbudget : 2 * k ≤ a + v)
|
| 73 |
+
(hbalance : ((a : ℝ) / ((a : ℝ) + v)) ^ ρ ≤
|
| 74 |
+
(b : ℝ) / ((b : ℝ) + u)) :
|
| 75 |
+
(homogeneousDim v (a - positiveBidegreeV s e i lam) : ℝ) *
|
| 76 |
+
homogeneousDim u (b + positiveBidegreeU s e i lam) ≤
|
| 77 |
+
2 * ((homogeneousDim v a : ℝ) * homogeneousDim u b) *
|
| 78 |
+
∏ j ∈ s, (((a : ℝ) / ((a : ℝ) + v)) ^ ((1 + ρ) / 2)) ^
|
| 79 |
+
|(i j : ℝ) - lam * e j| := by
|
| 80 |
+
have hVk : positiveBidegreeV s e i lam ≤ k := by
|
| 81 |
+
simpa only [hi] using positiveBidegreeV_le s e i lam
|
| 82 |
+
have hVa : positiveBidegreeV s e i lam ≤ a := hVk.trans hka
|
| 83 |
+
have hVbudget : 2 * positiveBidegreeV s e i lam ≤ a + v := by omega
|
| 84 |
+
have hα : 0 < (a : ℝ) / ((a : ℝ) + v) := by positivity
|
| 85 |
+
have hprop : lam * (∑ j ∈ s, e j : ℕ) = (∑ j ∈ s, i j : ℕ) := by
|
| 86 |
+
rw [he, hi]
|
| 87 |
+
exact hproportion
|
| 88 |
+
have h := intermediate_dimension_le_balanced
|
| 89 |
+
(I := positiveBidegreeV s e i lam) (J := positiveBidegreeU s e i lam)
|
| 90 |
+
hv hu ha hb hVa hVbudget ρ hbalance
|
| 91 |
+
rw [positiveBidegree_rpow s e i ρ lam _ hα hie hlam hprop] at h
|
| 92 |
+
exact h
|
| 93 |
+
|
| 94 |
+
/-- Summing intermediate dimensions over the admissible bidegrees gives the
|
| 95 |
+
numerical product bound used after rank subadditivity. -/
|
| 96 |
+
theorem sum_intermediate_dimensions_le_weight_product {ι : Type*}
|
| 97 |
+
[Fintype ι] [DecidableEq ι] (e : ι → ℕ) (k n v u a b : ℕ) (ρ lam : ℝ)
|
| 98 |
+
(he : ∑ j, e j = n) (hproportion : lam * n = k)
|
| 99 |
+
(hlam : (1 + ρ) * lam = ρ)
|
| 100 |
+
(hv : 1 ≤ v) (hu : 1 ≤ u) (ha : 0 < a) (hb : 0 < b)
|
| 101 |
+
(hka : k ≤ a) (hbudget : 2 * k ≤ a + v)
|
| 102 |
+
(hbalance : ((a : ℝ) / ((a : ℝ) + v)) ^ ρ ≤
|
| 103 |
+
(b : ℝ) / ((b : ℝ) + u)) :
|
| 104 |
+
(∑ i ∈ (Fintype.piFinset (fun j => Finset.range (e j + 1))).filter
|
| 105 |
+
(fun i => ∑ j, i j = k),
|
| 106 |
+
(homogeneousDim v (a - positiveBidegreeV Finset.univ e i lam) : ℝ) *
|
| 107 |
+
homogeneousDim u (b + positiveBidegreeU Finset.univ e i lam)) ≤
|
| 108 |
+
2 * ((homogeneousDim v a : ℝ) * homogeneousDim u b) *
|
| 109 |
+
∏ j, degreeWeight (((a : ℝ) / ((a : ℝ) + v)) ^ ((1 + ρ) / 2)) lam (e j) := by
|
| 110 |
+
classical
|
| 111 |
+
let α : ℝ := (a : ℝ) / ((a : ℝ) + v)
|
| 112 |
+
let q : ℝ := α ^ ((1 + ρ) / 2)
|
| 113 |
+
let D : ℝ := (homogeneousDim v a : ℝ) * homogeneousDim u b
|
| 114 |
+
let A := (Fintype.piFinset (fun j => Finset.range (e j + 1))).filter
|
| 115 |
+
(fun i => ∑ j, i j = k)
|
| 116 |
+
have hα : 0 ≤ α := by dsimp [α]; positivity
|
| 117 |
+
change (∑ i ∈ A, _) ≤ 2 * D * ∏ j, degreeWeight q lam (e j)
|
| 118 |
+
calc
|
| 119 |
+
_ ≤ ∑ i ∈ A, 2 * D * ∏ j, q ^ |(i j : ℝ) - lam * e j| := by
|
| 120 |
+
apply Finset.sum_le_sum
|
| 121 |
+
intro i hi
|
| 122 |
+
have hiA := Finset.mem_filter.mp hi
|
| 123 |
+
have hie : ∀ j ∈ (Finset.univ : Finset ι), i j ≤ e j := by
|
| 124 |
+
intro j _
|
| 125 |
+
have hj := Fintype.mem_piFinset.mp hiA.1 j
|
| 126 |
+
exact Nat.le_of_lt_succ (Finset.mem_range.mp hj)
|
| 127 |
+
exact intermediate_dimension_le_weight_product Finset.univ e i k n v u a b ρ lam
|
| 128 |
+
hie he hiA.2 hproportion hlam hv hu ha hb hka hbudget hbalance
|
| 129 |
+
_ = 2 * D * ∑ i ∈ A, ∏ j, q ^ |(i j : ℝ) - lam * e j| := by
|
| 130 |
+
rw [Finset.mul_sum]
|
| 131 |
+
_ ≤ 2 * D * ∏ j, degreeWeight q lam (e j) := by
|
| 132 |
+
apply mul_le_mul_of_nonneg_left
|
| 133 |
+
· exact bidegree_weight_sum_le e k q lam (Real.rpow_nonneg hα _)
|
| 134 |
+
· dsimp [D]
|
| 135 |
+
positivity
|
| 136 |
+
|
| 137 |
+
end Problem335
|
| 138 |
+
|
| 139 |
+
end
|
| 140 |
+
|
| 141 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/IntermediateFactorization.lean
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.MixedOperator
|
| 2 |
+
import OAI.Algebra.DepthFive.OperatorRank
|
| 3 |
+
import OAI.Algebra.DepthFive.MixedOperatorBidegree
|
| 4 |
+
import OAI.Algebra.DepthFive.RankMeasure
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
/-! Factorization of mixed operators through intermediate bidegree spaces.
|
| 9 |
+
The codomain is initially the full polynomial space. Restricting it to a
|
| 10 |
+
bidegree submodule leaves the range dimension unchanged, as proved below. -/
|
| 11 |
+
|
| 12 |
+
noncomputable section
|
| 13 |
+
open scoped BigOperators
|
| 14 |
+
|
| 15 |
+
namespace Problem335
|
| 16 |
+
|
| 17 |
+
variable {σ K : Type*} [Field K]
|
| 18 |
+
|
| 19 |
+
/-- The full operator restricted to a finite-bidegree source, as a linear
|
| 20 |
+
family in the polynomial defining the operator. -/
|
| 21 |
+
def sourceMixedOperator (isV : σ → Bool) (a b : ℕ) :
|
| 22 |
+
MvPolynomial σ K →ₗ[K]
|
| 23 |
+
(bidegreeSubmodule (K := K) isV a b →ₗ[K] MvPolynomial σ K) where
|
| 24 |
+
toFun p := (mixedOperator isV p).comp (bidegreeSubmodule isV a b).subtype
|
| 25 |
+
map_add' p q := by
|
| 26 |
+
ext f
|
| 27 |
+
simp
|
| 28 |
+
map_smul' c p := by
|
| 29 |
+
ext f
|
| 30 |
+
simp
|
| 31 |
+
|
| 32 |
+
@[simp] theorem sourceMixedOperator_apply (isV : σ → Bool) (a b : ℕ)
|
| 33 |
+
(p : MvPolynomial σ K) (f : bidegreeSubmodule (K := K) isV a b) :
|
| 34 |
+
sourceMixedOperator isV a b p f = mixedOperator isV p (f : MvPolynomial σ K) := rfl
|
| 35 |
+
|
| 36 |
+
/-- The operator for `p` maps the source into the proposed intermediate space. -/
|
| 37 |
+
def intermediateStart (isV : σ → Bool) (a b c d : ℕ)
|
| 38 |
+
(p : MvPolynomial σ K)
|
| 39 |
+
(h : ∀ f : bidegreeSubmodule (K := K) isV a b,
|
| 40 |
+
mixedOperator isV p (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) :
|
| 41 |
+
bidegreeSubmodule (K := K) isV a b →ₗ[K] bidegreeSubmodule (K := K) isV c d :=
|
| 42 |
+
LinearMap.codRestrict _ (sourceMixedOperator isV a b p) h
|
| 43 |
+
|
| 44 |
+
/-- Factorization is an equality of actual linear maps, not merely a rank
|
| 45 |
+
inequality. The rightmost polynomial factor operates first. -/
|
| 46 |
+
theorem sourceMixedOperator_mul_factorization (isV : σ → Bool) (a b c d : ℕ)
|
| 47 |
+
(p q : MvPolynomial σ K)
|
| 48 |
+
(h : ∀ f : bidegreeSubmodule (K := K) isV a b,
|
| 49 |
+
mixedOperator isV p (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) :
|
| 50 |
+
sourceMixedOperator isV a b (q * p) =
|
| 51 |
+
(sourceMixedOperator isV c d q).comp
|
| 52 |
+
(intermediateStart isV a b c d p h) := by
|
| 53 |
+
apply LinearMap.ext
|
| 54 |
+
intro f
|
| 55 |
+
exact mixedOperator_mul_apply isV q p f
|
| 56 |
+
|
| 57 |
+
/-- Any factorization through an intermediate bidegree space bounds rank by
|
| 58 |
+
that space's dimension. -/
|
| 59 |
+
theorem sourceMixedOperator_mul_rank_le [Finite σ]
|
| 60 |
+
(isV : σ → Bool) (a b c d : ℕ) (p q : MvPolynomial σ K)
|
| 61 |
+
(h : ∀ f : bidegreeSubmodule (K := K) isV a b,
|
| 62 |
+
mixedOperator isV p (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) :
|
| 63 |
+
RankMeasure.mapRank (sourceMixedOperator isV a b (q * p)) ≤
|
| 64 |
+
Module.finrank K (bidegreeSubmodule (K := K) isV c d) := by
|
| 65 |
+
rw [sourceMixedOperator_mul_factorization isV a b c d p q h]
|
| 66 |
+
exact RankMeasure.mapRank_factor_le _ _
|
| 67 |
+
|
| 68 |
+
/-- The bidegree of a selected subproduct is the sum of the selected
|
| 69 |
+
bidegrees, with no condition on the unselected factors. -/
|
| 70 |
+
theorem selected_bidegree_product_mem {ι : Type*} (s : Finset ι)
|
| 71 |
+
(selected : ι → Prop) [DecidablePred selected]
|
| 72 |
+
(Q : ι → MvPolynomial σ K) (i j : ι → ℕ) (isV : σ → Bool)
|
| 73 |
+
(hQ : ∀ l ∈ s, Q l ∈ bidegreeSubmodule isV (i l) (j l)) :
|
| 74 |
+
(∏ l ∈ s.filter selected, Q l) ∈
|
| 75 |
+
bidegreeSubmodule isV (∑ l ∈ s.filter selected, i l)
|
| 76 |
+
(∑ l ∈ s.filter selected, j l) := by
|
| 77 |
+
have hp := MvPolynomial.IsWeightedHomogeneous.prod (s.filter selected) Q
|
| 78 |
+
(fun l => (i l, j l)) (w := bidegreeWeight isV)
|
| 79 |
+
(fun l hl => hQ l (Finset.mem_filter.mp hl).1)
|
| 80 |
+
rw [← prod_mk_sum] at hp
|
| 81 |
+
exact hp
|
| 82 |
+
|
| 83 |
+
/-- In a commutative polynomial product, any chosen group of factors can be
|
| 84 |
+
applied first. In the product-rank proof this group consists of the factors
|
| 85 |
+
with positive proportional bidegree discrepancy. -/
|
| 86 |
+
theorem sourceMixedOperator_prod_rank_le [Finite σ] {ι : Type*}
|
| 87 |
+
(s : Finset ι) (selected : ι → Prop) [DecidablePred selected]
|
| 88 |
+
(Q : ι → MvPolynomial σ K) (isV : σ → Bool) (a b c d : ℕ)
|
| 89 |
+
(h : ∀ f : bidegreeSubmodule (K := K) isV a b,
|
| 90 |
+
mixedOperator isV (∏ j ∈ s.filter selected, Q j) (f : MvPolynomial σ K) ∈
|
| 91 |
+
bidegreeSubmodule isV c d) :
|
| 92 |
+
RankMeasure.mapRank (sourceMixedOperator isV a b (∏ j ∈ s, Q j)) ≤
|
| 93 |
+
Module.finrank K (bidegreeSubmodule (K := K) isV c d) := by
|
| 94 |
+
classical
|
| 95 |
+
rw [← Finset.prod_filter_mul_prod_filter_not s selected Q, mul_comm]
|
| 96 |
+
exact sourceMixedOperator_mul_rank_le isV a b c d _ _ h
|
| 97 |
+
|
| 98 |
+
/-- A selected homogeneous subproduct gives the actual intermediate dimension
|
| 99 |
+
bound. Only its total derivative degree needs to fit inside the source. -/
|
| 100 |
+
theorem sourceMixedOperator_homogeneous_prod_rank_le [Finite σ] {ι : Type*}
|
| 101 |
+
(s : Finset ι) (selected : ι → Prop) [DecidablePred selected]
|
| 102 |
+
(Q : ι → MvPolynomial σ K) (i j : ι → ℕ) (isV : σ → Bool) (a b : ℕ)
|
| 103 |
+
(hQ : ∀ l ∈ s, Q l ∈ bidegreeSubmodule isV (i l) (j l))
|
| 104 |
+
(hi : (∑ l ∈ s.filter selected, i l) ≤ a) :
|
| 105 |
+
RankMeasure.mapRank (sourceMixedOperator isV a b (∏ l ∈ s, Q l)) ≤
|
| 106 |
+
Module.finrank K (bidegreeSubmodule (K := K) isV
|
| 107 |
+
(a - ∑ l ∈ s.filter selected, i l)
|
| 108 |
+
(b + ∑ l ∈ s.filter selected, j l)) := by
|
| 109 |
+
apply sourceMixedOperator_prod_rank_le s selected Q isV a b
|
| 110 |
+
intro f
|
| 111 |
+
exact mixedOperator_mem_bidegreeSubmodule isV hi
|
| 112 |
+
(selected_bidegree_product_mem s selected Q i j isV hQ) f.property
|
| 113 |
+
|
| 114 |
+
/-- Specialization to the component product belonging to one bidegree
|
| 115 |
+
assignment. This is the geometric rank estimate used before summing over
|
| 116 |
+
assignments in the product-rank lemma. -/
|
| 117 |
+
theorem sourceMixedOperator_component_prod_rank_le [Finite σ] {ι : Type*}
|
| 118 |
+
(s : Finset ι) (selected : ι → Prop) [DecidablePred selected]
|
| 119 |
+
(Q : ι → MvPolynomial σ K) (e i : ι → ℕ) (isV : σ → Bool) (a b : ℕ)
|
| 120 |
+
(hi : (∑ l ∈ s.filter selected, i l) ≤ a) :
|
| 121 |
+
RankMeasure.mapRank (sourceMixedOperator isV a b
|
| 122 |
+
(∏ l ∈ s, bidegreeComponent isV (i l) (e l - i l) (Q l))) ≤
|
| 123 |
+
Module.finrank K (bidegreeSubmodule (K := K) isV
|
| 124 |
+
(a - ∑ l ∈ s.filter selected, i l)
|
| 125 |
+
(b + ∑ l ∈ s.filter selected, (e l - i l))) := by
|
| 126 |
+
exact sourceMixedOperator_homogeneous_prod_rank_le s selected
|
| 127 |
+
(fun l => bidegreeComponent isV (i l) (e l - i l) (Q l))
|
| 128 |
+
i (fun l => e l - i l) isV a b
|
| 129 |
+
(fun l _ => bidegreeComponent_mem isV (i l) (e l - i l) (Q l)) hi
|
| 130 |
+
|
| 131 |
+
/-- A total derivative-degree bound suffices for every selection of factors.
|
| 132 |
+
This version is convenient for constrained assignments whose degrees sum to `k`. -/
|
| 133 |
+
theorem sourceMixedOperator_component_prod_rank_le_of_sum_le [Finite σ]
|
| 134 |
+
{ι : Type*} (s : Finset ι) (selected : ι → Prop) [DecidablePred selected]
|
| 135 |
+
(Q : ι → MvPolynomial σ K) (e i : ι → ℕ) (isV : σ → Bool) (a b : ℕ)
|
| 136 |
+
(hi : (∑ l ∈ s, i l) ≤ a) :
|
| 137 |
+
RankMeasure.mapRank (sourceMixedOperator isV a b
|
| 138 |
+
(∏ l ∈ s, bidegreeComponent isV (i l) (e l - i l) (Q l))) ≤
|
| 139 |
+
Module.finrank K (bidegreeSubmodule (K := K) isV
|
| 140 |
+
(a - ∑ l ∈ s.filter selected, i l)
|
| 141 |
+
(b + ∑ l ∈ s.filter selected, (e l - i l))) := by
|
| 142 |
+
apply sourceMixedOperator_component_prod_rank_le s selected Q e i isV a b
|
| 143 |
+
exact (Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _)
|
| 144 |
+
(fun _ _ _ => Nat.zero_le _)).trans hi
|
| 145 |
+
|
| 146 |
+
/-- Passing from a fixed-bidegree codomain to the full polynomial codomain
|
| 147 |
+
does not alter the dimension of the range. -/
|
| 148 |
+
theorem mapRank_subtype_comp {V : Type*} [AddCommGroup V] [Module K V]
|
| 149 |
+
(Z : Submodule K (MvPolynomial σ K)) (f : V →ₗ[K] Z) :
|
| 150 |
+
RankMeasure.mapRank (Z.subtype.comp f) = RankMeasure.mapRank f := by
|
| 151 |
+
unfold RankMeasure.mapRank
|
| 152 |
+
rw [LinearMap.range_comp]
|
| 153 |
+
exact Submodule.finrank_map_subtype_eq Z f.range
|
| 154 |
+
|
| 155 |
+
/-- Consequently a codomain-restricted mixed operator and its source-only
|
| 156 |
+
restriction have exactly the same rank. -/
|
| 157 |
+
theorem sourceMixedOperator_codRestrict_rank (isV : σ → Bool) (a b c d : ℕ)
|
| 158 |
+
(p : MvPolynomial σ K)
|
| 159 |
+
(h : ∀ f : bidegreeSubmodule (K := K) isV a b,
|
| 160 |
+
mixedOperator isV p (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) :
|
| 161 |
+
RankMeasure.mapRank (intermediateStart isV a b c d p h) =
|
| 162 |
+
RankMeasure.mapRank (sourceMixedOperator isV a b p) := by
|
| 163 |
+
have heq : (bidegreeSubmodule (K := K) isV c d).subtype.comp
|
| 164 |
+
(intermediateStart isV a b c d p h) =
|
| 165 |
+
sourceMixedOperator isV a b p := by
|
| 166 |
+
apply LinearMap.ext
|
| 167 |
+
intro f
|
| 168 |
+
rfl
|
| 169 |
+
rw [← heq]
|
| 170 |
+
exact (mapRank_subtype_comp _ _).symm
|
| 171 |
+
|
| 172 |
+
end Problem335
|
| 173 |
+
|
| 174 |
+
end
|
| 175 |
+
|
| 176 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/InvalidOccupation.lean
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.FourPathLocal
|
| 2 |
+
import OAI.Algebra.DepthFive.ShiftedOccupation
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
|
| 9 |
+
namespace Problem335
|
| 10 |
+
namespace LocalMoments
|
| 11 |
+
|
| 12 |
+
def operatorSign (derivative : Bool) : ℤ := if derivative then -1 else 1
|
| 13 |
+
|
| 14 |
+
/-- An invalid shifted coordinate forces the relevant local table factor to vanish. -/
|
| 15 |
+
lemma localPolynomial_zero_of_negative {σ : Type*} [DecidableEq σ]
|
| 16 |
+
(derivative : Bool) (M : σ → ℕ) (p q r x : σ)
|
| 17 |
+
(hneg : (M x : ℤ) + operatorSign derivative *
|
| 18 |
+
((if x = p then 1 else 0) - (if x = q then 1 else 0)) < 0) :
|
| 19 |
+
localPolynomial derivative M p q r = 0 := by
|
| 20 |
+
by_cases hpq : p = q
|
| 21 |
+
· subst q
|
| 22 |
+
simp at hneg
|
| 23 |
+
omega
|
| 24 |
+
· cases derivative
|
| 25 |
+
· have hMq : M q = 0 := by
|
| 26 |
+
by_cases hxq : x = q
|
| 27 |
+
· subst x
|
| 28 |
+
simp [operatorSign, Ne.symm hpq] at hneg
|
| 29 |
+
omega
|
| 30 |
+
· by_cases hxp : x = p
|
| 31 |
+
· subst x
|
| 32 |
+
simp [operatorSign, hpq] at hneg
|
| 33 |
+
omega
|
| 34 |
+
· simp [operatorSign, hxp, hxq] at hneg
|
| 35 |
+
omega
|
| 36 |
+
simp [localPolynomial, hpq, hMq]
|
| 37 |
+
· have hMp : M p = 0 := by
|
| 38 |
+
by_cases hxp : x = p
|
| 39 |
+
· subst x
|
| 40 |
+
simp [operatorSign, hpq] at hneg
|
| 41 |
+
omega
|
| 42 |
+
· by_cases hxq : x = q
|
| 43 |
+
· subst x
|
| 44 |
+
simp [operatorSign, Ne.symm hpq] at hneg
|
| 45 |
+
omega
|
| 46 |
+
· simp [operatorSign, hxp, hxq] at hneg
|
| 47 |
+
omega
|
| 48 |
+
simp [localPolynomial, hpq, hMp]
|
| 49 |
+
|
| 50 |
+
/-- An invalid source in any layer annihilates the complete four-path table product. -/
|
| 51 |
+
lemma localPolynomial_product_zero_of_negative {ι σ : Type*}
|
| 52 |
+
[DecidableEq σ] (layers : Finset ι) (derivative : ι → Bool)
|
| 53 |
+
(M : ι × σ → ℕ) (p q r : ι → σ) (t : ι) (a : σ)
|
| 54 |
+
(ht : t ∈ layers)
|
| 55 |
+
(hneg : ShiftedOccupation.signedSource M (operatorSign ∘ derivative) p q (t, a) < 0) :
|
| 56 |
+
(∏ j ∈ layers, localPolynomial (derivative j) (fun b => M (j, b)) (p j) (q j) (r j)) = 0 := by
|
| 57 |
+
apply Finset.prod_eq_zero ht
|
| 58 |
+
apply localPolynomial_zero_of_negative (derivative t) (fun b => M (t, b))
|
| 59 |
+
(p t) (q t) (r t) a
|
| 60 |
+
exact hneg
|
| 61 |
+
|
| 62 |
+
/-- The global table vanishes whenever no natural shifted source exists. -/
|
| 63 |
+
lemma localPolynomial_product_zero_of_no_source {ι σ : Type*}
|
| 64 |
+
[Fintype ι] [DecidableEq σ] (derivative : ι → Bool)
|
| 65 |
+
(M : ι × σ → ℕ) (p q r : ι → σ)
|
| 66 |
+
(hbad : ¬ ∃ N : ι × σ → ℕ, ∀ x, (N x : ℤ) =
|
| 67 |
+
ShiftedOccupation.signedSource M (operatorSign ∘ derivative) p q x) :
|
| 68 |
+
(∏ j : ι, localPolynomial (derivative j) (fun b => M (j, b)) (p j) (q j) (r j)) = 0 := by
|
| 69 |
+
rw [ShiftedOccupation.exists_source_iff] at hbad
|
| 70 |
+
push Not at hbad
|
| 71 |
+
obtain ⟨⟨t, a⟩, hneg⟩ := hbad
|
| 72 |
+
exact localPolynomial_product_zero_of_negative Finset.univ derivative M p q r t a
|
| 73 |
+
(Finset.mem_univ _) hneg
|
| 74 |
+
|
| 75 |
+
end LocalMoments
|
| 76 |
+
end Problem335
|
| 77 |
+
|
| 78 |
+
end
|
| 79 |
+
|
| 80 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/IsolatedFlip.lean
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
/-!
|
| 6 |
+
Canonical removal of isolated positions in an independent set.
|
| 7 |
+
|
| 8 |
+
The value `true` denotes the D type from the manuscript. The set `S`
|
| 9 |
+
contains the positions allowed to flip (interior V layers), and `R a b`
|
| 10 |
+
means that `b` is a neighbor of `a`. Independence is the only property
|
| 11 |
+
of the path graph needed for the fiber calculation.
|
| 12 |
+
-/
|
| 13 |
+
|
| 14 |
+
noncomputable section
|
| 15 |
+
|
| 16 |
+
open scoped BigOperators
|
| 17 |
+
|
| 18 |
+
namespace Problem335.IsolatedFlip
|
| 19 |
+
|
| 20 |
+
variable {α : Type*} [Fintype α] [DecidableEq α]
|
| 21 |
+
|
| 22 |
+
def eligible (S : Finset α) (R : α → α → Prop) (w : α → Bool) : Finset α := by
|
| 23 |
+
classical
|
| 24 |
+
exact S.filter (fun a => ∀ b, R a b → w b = true)
|
| 25 |
+
|
| 26 |
+
def flip (S : Finset α) (R : α → α → Prop) (w : α → Bool) (a : α) : Bool := by
|
| 27 |
+
classical
|
| 28 |
+
exact if a ∈ eligible S R w then true else w a
|
| 29 |
+
|
| 30 |
+
def unset (w : α → Bool) (T : Finset α) (a : α) : Bool :=
|
| 31 |
+
if a ∈ T then false else w a
|
| 32 |
+
|
| 33 |
+
def removed (S : Finset α) (R : α → α → Prop) (w : α → Bool) : Finset α := by
|
| 34 |
+
classical
|
| 35 |
+
exact (eligible S R w).filter (fun a => w a = false)
|
| 36 |
+
|
| 37 |
+
@[simp] theorem mem_eligible {α : Type u_1} [Fintype α] [DecidableEq α]
|
| 38 |
+
{S : Finset α} {R : α → α → Prop}
|
| 39 |
+
{w : α → Bool} {a : α} :
|
| 40 |
+
a ∈ eligible S R w ↔ a ∈ S ∧ ∀ b, R a b → w b = true := by
|
| 41 |
+
classical
|
| 42 |
+
simp [eligible]
|
| 43 |
+
|
| 44 |
+
theorem eligible_subset (S : Finset α) (R : α → α → Prop) (w : α → Bool) :
|
| 45 |
+
eligible S R w ⊆ S := by
|
| 46 |
+
intro a ha
|
| 47 |
+
exact (mem_eligible.mp ha).1
|
| 48 |
+
|
| 49 |
+
theorem flip_eq_of_not_mem {S : Finset α} {R : α → α → Prop}
|
| 50 |
+
{w : α → Bool} {a : α} (ha : a ∉ S) : flip S R w a = w a := by
|
| 51 |
+
classical
|
| 52 |
+
have h : a ∉ eligible S R w := fun h => ha (eligible_subset S R w h)
|
| 53 |
+
simp [flip, h]
|
| 54 |
+
|
| 55 |
+
theorem eligible_congr {S : Finset α} {R : α → α → Prop}
|
| 56 |
+
(hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S)
|
| 57 |
+
{w z : α → Bool} (h : ∀ a, a ∉ S → w a = z a) :
|
| 58 |
+
eligible S R w = eligible S R z := by
|
| 59 |
+
ext a
|
| 60 |
+
simp only [mem_eligible]
|
| 61 |
+
constructor
|
| 62 |
+
· rintro ⟨ha, hw⟩
|
| 63 |
+
refine ⟨ha, ?_⟩
|
| 64 |
+
intro b hab
|
| 65 |
+
rw [← h b (hS a ha b hab)]
|
| 66 |
+
exact hw b hab
|
| 67 |
+
· rintro ⟨ha, hz⟩
|
| 68 |
+
refine ⟨ha, ?_⟩
|
| 69 |
+
intro b hab
|
| 70 |
+
rw [h b (hS a ha b hab)]
|
| 71 |
+
exact hz b hab
|
| 72 |
+
|
| 73 |
+
theorem eligible_flip {S : Finset α} {R : α → α → Prop}
|
| 74 |
+
(hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) (w : α → Bool) :
|
| 75 |
+
eligible S R (flip S R w) = eligible S R w := by
|
| 76 |
+
apply eligible_congr hS
|
| 77 |
+
intro a ha
|
| 78 |
+
exact flip_eq_of_not_mem ha
|
| 79 |
+
|
| 80 |
+
theorem flip_idempotent {S : Finset α} {R : α → α → Prop}
|
| 81 |
+
(hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) (w : α → Bool) :
|
| 82 |
+
flip S R (flip S R w) = flip S R w := by
|
| 83 |
+
classical
|
| 84 |
+
funext a
|
| 85 |
+
simp only [flip, eligible_flip hS]
|
| 86 |
+
split_ifs <;> rfl
|
| 87 |
+
|
| 88 |
+
theorem eligible_unset {S : Finset α} {R : α → α → Prop}
|
| 89 |
+
(hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S)
|
| 90 |
+
(w : α → Bool) {T : Finset α} (hT : T ⊆ S) :
|
| 91 |
+
eligible S R (unset w T) = eligible S R w := by
|
| 92 |
+
apply eligible_congr hS
|
| 93 |
+
intro a ha
|
| 94 |
+
have hn : a ∉ T := fun ht => ha (hT ht)
|
| 95 |
+
simp [unset, hn]
|
| 96 |
+
|
| 97 |
+
theorem flip_unset {S : Finset α} {R : α → α → Prop}
|
| 98 |
+
(hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S)
|
| 99 |
+
{w : α → Bool} (hw : flip S R w = w)
|
| 100 |
+
{T : Finset α} (hT : T ⊆ eligible S R w) :
|
| 101 |
+
flip S R (unset w T) = w := by
|
| 102 |
+
classical
|
| 103 |
+
have he := eligible_unset hS w (hT.trans (eligible_subset S R w))
|
| 104 |
+
funext a
|
| 105 |
+
have hw' := congrFun hw a
|
| 106 |
+
simp only [flip, he] at hw' ⊢
|
| 107 |
+
by_cases ha : a ∈ eligible S R w
|
| 108 |
+
· simpa [ha] using hw'
|
| 109 |
+
· have hn : a ∉ T := fun ht => ha (hT ht)
|
| 110 |
+
simp [ha, unset, hn]
|
| 111 |
+
|
| 112 |
+
theorem removed_subset {α : Type u_1} [Fintype α] [DecidableEq α]
|
| 113 |
+
(S : Finset α) (R : α → α → Prop) (w : α → Bool) :
|
| 114 |
+
removed S R w ⊆ eligible S R w := by
|
| 115 |
+
classical
|
| 116 |
+
exact Finset.filter_subset _ _
|
| 117 |
+
|
| 118 |
+
theorem unset_flip_removed (S : Finset α) (R : α → α → Prop)
|
| 119 |
+
(w : α → Bool) : unset (flip S R w) (removed S R w) = w := by
|
| 120 |
+
classical
|
| 121 |
+
funext a
|
| 122 |
+
by_cases ha : a ∈ eligible S R w
|
| 123 |
+
· cases hw : w a <;> simp [unset, removed, flip, ha, hw]
|
| 124 |
+
· simp [unset, removed, flip, ha]
|
| 125 |
+
|
| 126 |
+
theorem removed_unset {S : Finset α} {R : α → α → Prop}
|
| 127 |
+
(hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S)
|
| 128 |
+
{w : α → Bool} (hw : flip S R w = w)
|
| 129 |
+
{T : Finset α} (hT : T ⊆ eligible S R w) :
|
| 130 |
+
removed S R (unset w T) = T := by
|
| 131 |
+
classical
|
| 132 |
+
have he := eligible_unset hS w (hT.trans (eligible_subset S R w))
|
| 133 |
+
ext a
|
| 134 |
+
simp only [removed, Finset.mem_filter, he]
|
| 135 |
+
constructor
|
| 136 |
+
· rintro ⟨ha, hz⟩
|
| 137 |
+
by_contra hn
|
| 138 |
+
have hw' := congrFun hw a
|
| 139 |
+
simp [flip, ha] at hw'
|
| 140 |
+
simp [unset, hn, hw'] at hz
|
| 141 |
+
· intro ha
|
| 142 |
+
exact ⟨hT ha, by simp [unset, ha]⟩
|
| 143 |
+
|
| 144 |
+
/-! Each fiber of the canonicalization is exactly a powerset. -/
|
| 145 |
+
|
| 146 |
+
def fiberEquiv {S : Finset α} {R : α → α → Prop}
|
| 147 |
+
(hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S)
|
| 148 |
+
(w : α → Bool) (hw : flip S R w = w) :
|
| 149 |
+
{z : α → Bool // flip S R z = w} ≃
|
| 150 |
+
{T : Finset α // T ⊆ eligible S R w} where
|
| 151 |
+
toFun z := ⟨removed S R z, by
|
| 152 |
+
have he : eligible S R z = eligible S R w := by
|
| 153 |
+
exact (eligible_flip hS z).symm.trans (congrArg (eligible S R) z.property)
|
| 154 |
+
rw [← he]
|
| 155 |
+
exact removed_subset S R z⟩
|
| 156 |
+
invFun T := ⟨unset w T, flip_unset hS hw T.property⟩
|
| 157 |
+
left_inv z := by
|
| 158 |
+
apply Subtype.ext
|
| 159 |
+
change unset w (removed S R z) = z
|
| 160 |
+
exact (congrArg (fun q => unset q (removed S R z)) z.property.symm).trans
|
| 161 |
+
(unset_flip_removed S R z)
|
| 162 |
+
right_inv T := by
|
| 163 |
+
apply Subtype.ext
|
| 164 |
+
exact removed_unset hS hw T.property
|
| 165 |
+
|
| 166 |
+
theorem fiber_card {S : Finset α} {R : α → α → Prop}
|
| 167 |
+
(hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S)
|
| 168 |
+
(w : α → Bool) (hw : flip S R w = w) :
|
| 169 |
+
Fintype.card {z : α → Bool // flip S R z = w} =
|
| 170 |
+
2 ^ (eligible S R w).card := by
|
| 171 |
+
classical
|
| 172 |
+
rw [Fintype.card_congr (fiberEquiv hS w hw)]
|
| 173 |
+
simpa only [Finset.mem_powerset] using
|
| 174 |
+
(Fintype.card_coe (eligible S R w).powerset).trans (Finset.card_powerset _)
|
| 175 |
+
|
| 176 |
+
theorem fiber_sum_pow {S : Finset α} {R : α → α → Prop}
|
| 177 |
+
(hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S)
|
| 178 |
+
(w : α → Bool) (hw : flip S R w = w)
|
| 179 |
+
{K : Type*} [CommSemiring K] (c : K) :
|
| 180 |
+
(∑ z : {z : α → Bool // flip S R z = w},
|
| 181 |
+
c ^ (removed S R z).card) = (1 + c) ^ (eligible S R w).card := by
|
| 182 |
+
classical
|
| 183 |
+
calc
|
| 184 |
+
_ = ∑ T : {T : Finset α // T ⊆ eligible S R w}, c ^ T.val.card :=
|
| 185 |
+
Fintype.sum_equiv (fiberEquiv hS w hw) _ _ (fun _ => rfl)
|
| 186 |
+
_ = ∑ T ∈ (eligible S R w).powerset, c ^ T.card :=
|
| 187 |
+
(Finset.sum_subtype (p := fun T : Finset α => T ⊆ eligible S R w)
|
| 188 |
+
(eligible S R w).powerset (fun _ => Finset.mem_powerset)
|
| 189 |
+
(fun T => c ^ T.card)).symm
|
| 190 |
+
_ = _ := by
|
| 191 |
+
simpa [Finset.prod_const, add_comm] using
|
| 192 |
+
(Finset.prod_add_one (f := fun _ : α => c) (eligible S R w)).symm
|
| 193 |
+
|
| 194 |
+
theorem fiber_weight_sum {S : Finset α} {R : α → α → Prop}
|
| 195 |
+
(hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S)
|
| 196 |
+
(w : α → Bool) (hw : flip S R w = w)
|
| 197 |
+
{K : Type*} [CommSemiring K] (c : K) (W : (α → Bool) → K)
|
| 198 |
+
(hW : ∀ z, flip S R z = w → W z = W w * c ^ (removed S R z).card) :
|
| 199 |
+
(∑ z : {z : α → Bool // flip S R z = w}, W z) =
|
| 200 |
+
W w * (1 + c) ^ (eligible S R w).card := by
|
| 201 |
+
classical
|
| 202 |
+
calc
|
| 203 |
+
_ = ∑ z : {z : α → Bool // flip S R z = w},
|
| 204 |
+
W w * c ^ (removed S R z).card :=
|
| 205 |
+
Finset.sum_congr rfl (fun z _ => hW z z.property)
|
| 206 |
+
_ = W w * ∑ z : {z : α → Bool // flip S R z = w},
|
| 207 |
+
c ^ (removed S R z).card := (Finset.mul_sum _ _ _).symm
|
| 208 |
+
_ = _ := by rw [fiber_sum_pow hS w hw]
|
| 209 |
+
|
| 210 |
+
theorem total_weight_sum {S : Finset α} {R : α → α → Prop}
|
| 211 |
+
(hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S)
|
| 212 |
+
{K : Type*} [CommSemiring K] (c : K) (W : (α → Bool) → K)
|
| 213 |
+
(hW : ∀ z, W z = W (flip S R z) * c ^ (removed S R z).card) :
|
| 214 |
+
(∑ z, W z) = ∑ w ∈ Finset.univ.filter (fun w => flip S R w = w),
|
| 215 |
+
W w * (1 + c) ^ (eligible S R w).card := by
|
| 216 |
+
classical
|
| 217 |
+
rw [Finset.sum_filter]
|
| 218 |
+
calc
|
| 219 |
+
_ = ∑ w, ∑ z : {z : α → Bool // flip S R z = w}, W z :=
|
| 220 |
+
(Fintype.sum_fiberwise (flip S R) W).symm
|
| 221 |
+
_ = _ := by
|
| 222 |
+
apply Finset.sum_congr rfl
|
| 223 |
+
intro w _
|
| 224 |
+
by_cases hw : flip S R w = w
|
| 225 |
+
· rw [ite_eq_left hw]
|
| 226 |
+
apply fiber_weight_sum hS w hw c W
|
| 227 |
+
intro z hz
|
| 228 |
+
simpa only [hz] using hW z
|
| 229 |
+
· rw [ite_eq_right hw]
|
| 230 |
+
have hempty : IsEmpty {z : α → Bool // flip S R z = w} := by
|
| 231 |
+
refine ⟨fun z => hw ?_⟩
|
| 232 |
+
exact (congrArg (flip S R) z.property.symm).trans
|
| 233 |
+
((flip_idempotent hS z).trans z.property)
|
| 234 |
+
let := hempty
|
| 235 |
+
simp
|
| 236 |
+
|
| 237 |
+
theorem correction_removal {S : Finset α} {R : α → α → Prop}
|
| 238 |
+
(hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S)
|
| 239 |
+
(c : ℝ) (hc : 0 ≤ c) (W : (α → Bool) → ℝ)
|
| 240 |
+
(hWnonneg : ∀ z, 0 ≤ W z)
|
| 241 |
+
(hW : ∀ z, W z = W (flip S R z) * c ^ (removed S R z).card) :
|
| 242 |
+
(∑ z, W z) ≤ (1 + c) ^ S.card *
|
| 243 |
+
∑ w ∈ Finset.univ.filter (fun w => flip S R w = w), W w := by
|
| 244 |
+
classical
|
| 245 |
+
rw [total_weight_sum hS c W hW, Finset.mul_sum]
|
| 246 |
+
apply Finset.sum_le_sum
|
| 247 |
+
intro w _
|
| 248 |
+
rw [mul_comm ((1 + c) ^ S.card)]
|
| 249 |
+
exact mul_le_mul_of_nonneg_left
|
| 250 |
+
(pow_le_pow_right₀ (by linarith : 1 ≤ 1 + c)
|
| 251 |
+
(Finset.card_le_card (eligible_subset S R w))) (hWnonneg w)
|
| 252 |
+
|
| 253 |
+
end Problem335.IsolatedFlip
|
| 254 |
+
|
| 255 |
+
end
|
| 256 |
+
|
| 257 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/IsolatedWeight.lean
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.IsolatedFlip
|
| 2 |
+
import OAI.Algebra.DepthFive.SwitchRestoration
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
|
| 9 |
+
namespace Problem335.IsolatedWeight
|
| 10 |
+
|
| 11 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 12 |
+
|
| 13 |
+
/-- Internal neighboring positions of the same normal (false) type. -/
|
| 14 |
+
def falseNeighbors (R : ι → ι → Prop) (w : ι → Bool) (i : ι) : Finset ι := by
|
| 15 |
+
classical
|
| 16 |
+
exact Finset.univ.filter (fun j => R i j ∧ w j = false)
|
| 17 |
+
|
| 18 |
+
/-- The coincidence correction factors at the normal V positions. -/
|
| 19 |
+
def correction (V : Finset ι) (R : ι → ι → Prop) (A x : ℝ)
|
| 20 |
+
(w : ι → Bool) : ℝ := by
|
| 21 |
+
classical
|
| 22 |
+
exact ∏ i ∈ V.filter (fun i => w i = false),
|
| 23 |
+
(1 + A * x ^ (falseNeighbors R w i).card)
|
| 24 |
+
|
| 25 |
+
/-- Restoring any subset of an independent V set does not change the
|
| 26 |
+
neighbors of any V position. Endpoints are allowed in V. -/
|
| 27 |
+
theorem falseNeighbors_unset {V T : Finset ι} {R : ι → ι → Prop}
|
| 28 |
+
(hT : T ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V)
|
| 29 |
+
(w : ι → Bool) {i : ι} (hi : i ∈ V) :
|
| 30 |
+
falseNeighbors R (IsolatedFlip.unset w T) i = falseNeighbors R w i := by
|
| 31 |
+
classical
|
| 32 |
+
ext j
|
| 33 |
+
by_cases hr : R i j
|
| 34 |
+
· have hj : j ∉ T := fun ht => hV i hi j hr (hT ht)
|
| 35 |
+
simp [falseNeighbors, IsolatedFlip.unset, hr, hj]
|
| 36 |
+
· simp [falseNeighbors, hr]
|
| 37 |
+
|
| 38 |
+
omit [DecidableEq ι] in
|
| 39 |
+
theorem falseNeighbors_eq_empty {R : ι → ι → Prop} {w : ι → Bool} {i : ι}
|
| 40 |
+
(h : ∀ j, R i j → w j = true) : falseNeighbors R w i = ∅ := by
|
| 41 |
+
classical
|
| 42 |
+
apply Finset.eq_empty_iff_forall_notMem.mpr
|
| 43 |
+
intro j hj
|
| 44 |
+
have hh := Finset.mem_filter.mp hj
|
| 45 |
+
have heq := h j hh.2.1
|
| 46 |
+
simp only [heq, Bool.true_eq_false] at hh
|
| 47 |
+
exact hh.2.2
|
| 48 |
+
|
| 49 |
+
omit [Fintype ι] in
|
| 50 |
+
/-- The normal V positions after restoration consist of the old normal
|
| 51 |
+
positions together with the restored subset. -/
|
| 52 |
+
theorem falseVertices_unset {V T : Finset ι} (hT : T ⊆ V)
|
| 53 |
+
(w : ι → Bool) :
|
| 54 |
+
(V.filter fun i => IsolatedFlip.unset w T i = false) =
|
| 55 |
+
(V.filter fun i => w i = false) ∪ T := by
|
| 56 |
+
classical
|
| 57 |
+
ext i
|
| 58 |
+
by_cases hi : i ∈ T
|
| 59 |
+
· simp [IsolatedFlip.unset, hi, hT hi]
|
| 60 |
+
· simp [IsolatedFlip.unset, hi]
|
| 61 |
+
|
| 62 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 63 |
+
theorem falseVertices_disjoint {V T : Finset ι} (w : ι → Bool)
|
| 64 |
+
(hw : ∀ i ∈ T, w i = true) :
|
| 65 |
+
Disjoint (V.filter fun i => w i = false) T := by
|
| 66 |
+
classical
|
| 67 |
+
apply Finset.disjoint_left.mpr
|
| 68 |
+
intro i hi ht
|
| 69 |
+
have hf := (Finset.mem_filter.mp hi).2
|
| 70 |
+
have ht := hw i ht
|
| 71 |
+
simp only [ht, Bool.true_eq_false] at hf
|
| 72 |
+
|
| 73 |
+
/-- The exact local correction-product factor in the isolated-position flip.
|
| 74 |
+
Every restored position has no normal neighbors, and hence contributes `1+A`. -/
|
| 75 |
+
theorem correction_unset {V T : Finset ι} {R : ι → ι → Prop}
|
| 76 |
+
(hT : T ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V)
|
| 77 |
+
(w : ι → Bool) (hw : ∀ i ∈ T, w i = true)
|
| 78 |
+
(hnear : ∀ i ∈ T, ∀ j, R i j → w j = true) (A x : ℝ) :
|
| 79 |
+
correction V R A x (IsolatedFlip.unset w T) =
|
| 80 |
+
correction V R A x w * (1 + A) ^ T.card := by
|
| 81 |
+
classical
|
| 82 |
+
unfold correction
|
| 83 |
+
rw [falseVertices_unset hT w, Finset.prod_union (falseVertices_disjoint w hw)]
|
| 84 |
+
congr 1
|
| 85 |
+
· apply Finset.prod_congr rfl
|
| 86 |
+
intro i hi
|
| 87 |
+
rw [falseNeighbors_unset hT hV w (Finset.mem_filter.mp hi).1]
|
| 88 |
+
· calc
|
| 89 |
+
_ = ∏ _i ∈ T, (1 + A) := by
|
| 90 |
+
apply Finset.prod_congr rfl
|
| 91 |
+
intro i hi
|
| 92 |
+
rw [falseNeighbors_unset hT hV w (hT hi),
|
| 93 |
+
falseNeighbors_eq_empty (hnear i hi)]
|
| 94 |
+
simp
|
| 95 |
+
_ = (1 + A) ^ T.card := by simp
|
| 96 |
+
|
| 97 |
+
/-- True positions in the complementary variable group are unchanged. -/
|
| 98 |
+
theorem complement_trueVertices_unset {V T : Finset ι} (hT : T ⊆ V)
|
| 99 |
+
(w : ι → Bool) :
|
| 100 |
+
((Finset.univ \ V).filter fun i => IsolatedFlip.unset w T i = true) =
|
| 101 |
+
((Finset.univ \ V).filter fun i => w i = true) := by
|
| 102 |
+
classical
|
| 103 |
+
ext i
|
| 104 |
+
by_cases hi : i ∈ V
|
| 105 |
+
· simp [hi]
|
| 106 |
+
· have hit : i ∉ T := fun ht => hi (hT ht)
|
| 107 |
+
simp [IsolatedFlip.unset, hi, hit]
|
| 108 |
+
|
| 109 |
+
/-- The actual weighted word summand, with `A = alpha⁻¹`, `B = beta`,
|
| 110 |
+
and `x = n⁻¹`. The relation records internal adjacency. -/
|
| 111 |
+
def weight (edges : Finset (ι × ι)) (V : Finset ι) (R : ι → ι → Prop)
|
| 112 |
+
(A B x : ℝ) (w : ι → Bool) : ℝ := by
|
| 113 |
+
classical
|
| 114 |
+
exact x ^ SwitchRestoration.switchCount edges w *
|
| 115 |
+
A ^ (V.filter fun i => w i = true).card *
|
| 116 |
+
B ^ ((Finset.univ \ V).filter fun i => w i = true).card *
|
| 117 |
+
correction V R A x w
|
| 118 |
+
|
| 119 |
+
/-- Exact isolated-flip weight identity given the switch-count increment.
|
| 120 |
+
The switch increment is supplied by `switchCount_restore_eq_add_twice_card`.
|
| 121 |
+
No bound or positivity is needed except nonvanishing of the D-layer weight. -/
|
| 122 |
+
theorem weight_unset {edges : Finset (ι × ι)} {V T : Finset ι}
|
| 123 |
+
{R : ι → ι → Prop} (hT : T ⊆ V)
|
| 124 |
+
(hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V)
|
| 125 |
+
(w : ι → Bool) (hw : ∀ i ∈ T, w i = true)
|
| 126 |
+
(hnear : ∀ i ∈ T, ∀ j, R i j → w j = true)
|
| 127 |
+
(hswitch : SwitchRestoration.switchCount edges (IsolatedFlip.unset w T) =
|
| 128 |
+
SwitchRestoration.switchCount edges w + 2 * T.card)
|
| 129 |
+
{A : ℝ} (hA : A ≠ 0) (B x : ℝ) :
|
| 130 |
+
weight edges V R A B x (IsolatedFlip.unset w T) =
|
| 131 |
+
weight edges V R A B x w * (x ^ 2 * (1 + A) / A) ^ T.card := by
|
| 132 |
+
classical
|
| 133 |
+
have hcount := SwitchRestoration.trueVertices_restore_card_add V T w hT hw
|
| 134 |
+
change (V.filter fun i => IsolatedFlip.unset w T i = true).card + T.card =
|
| 135 |
+
(V.filter fun i => w i = true).card at hcount
|
| 136 |
+
unfold weight
|
| 137 |
+
rw [hswitch, complement_trueVertices_unset hT w,
|
| 138 |
+
correction_unset hT hV w hw hnear A x, ← hcount]
|
| 139 |
+
simp only [pow_add, pow_mul, mul_pow, div_pow]
|
| 140 |
+
field_simp
|
| 141 |
+
|
| 142 |
+
/-- The isolated-flip identity for the actual word weight. Only interior
|
| 143 |
+
positions (of edge degree two) may flip, while V may also contain endpoints. -/
|
| 144 |
+
theorem weight_flip {edges : Finset (ι × ι)} {V S : Finset ι}
|
| 145 |
+
{R : ι → ι → Prop} (hS : S ⊆ V)
|
| 146 |
+
(hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V)
|
| 147 |
+
(hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1)
|
| 148 |
+
(hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2)
|
| 149 |
+
{A : ℝ} (hA : A ≠ 0) (B x : ℝ) (w : ι → Bool) :
|
| 150 |
+
weight edges V R A B x w =
|
| 151 |
+
weight edges V R A B x (IsolatedFlip.flip S R w) *
|
| 152 |
+
(x ^ 2 * (1 + A) / A) ^ (IsolatedFlip.removed S R w).card := by
|
| 153 |
+
classical
|
| 154 |
+
let T := IsolatedFlip.removed S R w
|
| 155 |
+
let y := IsolatedFlip.flip S R w
|
| 156 |
+
have hTe : T ⊆ IsolatedFlip.eligible S R w := IsolatedFlip.removed_subset S R w
|
| 157 |
+
have hTS : T ⊆ S := hTe.trans (IsolatedFlip.eligible_subset S R w)
|
| 158 |
+
have hTV : T ⊆ V := hTS.trans hS
|
| 159 |
+
have hy : ∀ i ∈ T, y i = true := by
|
| 160 |
+
intro i hi
|
| 161 |
+
simp only [y, IsolatedFlip.flip, ite_eq_left (hTe hi)]
|
| 162 |
+
have hnear : ∀ i ∈ T, ∀ j, R i j → y j = true := by
|
| 163 |
+
intro i hi j hij
|
| 164 |
+
have hwj := (IsolatedFlip.mem_eligible.mp (hTe hi)).2 j hij
|
| 165 |
+
simp [y, IsolatedFlip.flip, hwj]
|
| 166 |
+
have hsw : SwitchRestoration.switchCount edges (IsolatedFlip.unset y T) =
|
| 167 |
+
SwitchRestoration.switchCount edges y + 2 * T.card := by
|
| 168 |
+
apply SwitchRestoration.switchCount_restore_eq_add_twice_card
|
| 169 |
+
· intro e he h
|
| 170 |
+
rcases h with h | h
|
| 171 |
+
· exact ⟨hy _ h, hnear _ h _ (hR e he).1⟩
|
| 172 |
+
· exact ⟨hnear _ h _ (hR e he).2, hy _ h⟩
|
| 173 |
+
· intro e he h
|
| 174 |
+
exact hV e.1 (hTV h.1) e.2 (hR e he).1 (hTV h.2)
|
| 175 |
+
· intro i hi
|
| 176 |
+
exact hdegree i (hTS hi)
|
| 177 |
+
have h := weight_unset hTV hV y hy hnear hsw hA B x
|
| 178 |
+
simpa only [y, T, IsolatedFlip.unset_flip_removed] using h
|
| 179 |
+
|
| 180 |
+
/-- Nonnegative parameters give a nonnegative word weight. -/
|
| 181 |
+
theorem weight_nonneg (edges : Finset (ι × ι)) (V : Finset ι)
|
| 182 |
+
(R : ι → ι → Prop) {A B x : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x)
|
| 183 |
+
(w : ι → Bool) : 0 ≤ weight edges V R A B x w := by
|
| 184 |
+
classical
|
| 185 |
+
unfold weight correction
|
| 186 |
+
positivity
|
| 187 |
+
|
| 188 |
+
/-- Summing the exact word-weight identity over the fibers removes all
|
| 189 |
+
isolated positions at a multiplicative cost `(1+x²(1+A)/A)^|S|`. -/
|
| 190 |
+
theorem sum_weight_le_fixed {edges : Finset (ι × ι)} {V S : Finset ι}
|
| 191 |
+
{R : ι → ι → Prop} (hS : S ⊆ V)
|
| 192 |
+
(hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V)
|
| 193 |
+
(hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1)
|
| 194 |
+
(hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2)
|
| 195 |
+
{A B x : ℝ} (hA : 0 < A) (hB : 0 ≤ B) (hx : 0 ≤ x) :
|
| 196 |
+
(∑ w : ι → Bool, weight edges V R A B x w) ≤
|
| 197 |
+
(1 + x ^ 2 * (1 + A) / A) ^ S.card *
|
| 198 |
+
∑ w ∈ Finset.univ.filter (fun w => IsolatedFlip.flip S R w = w),
|
| 199 |
+
weight edges V R A B x w := by
|
| 200 |
+
classical
|
| 201 |
+
apply IsolatedFlip.correction_removal
|
| 202 |
+
· intro i hi j hij hj
|
| 203 |
+
exact hV i (hS hi) j hij (hS hj)
|
| 204 |
+
· positivity
|
| 205 |
+
· exact weight_nonneg edges V R hA.le hB hx
|
| 206 |
+
· exact weight_flip hS hV hR hdegree hA.ne' B x
|
| 207 |
+
|
| 208 |
+
/-- A normal position in the flip set of a fixed word has at least one
|
| 209 |
+
normal neighbor: otherwise the canonical flip would change it. -/
|
| 210 |
+
theorem falseNeighbors_card_pos_of_fixed {S : Finset ι} {R : ι → ι → Prop}
|
| 211 |
+
{w : ι → Bool} (hw : IsolatedFlip.flip S R w = w)
|
| 212 |
+
{i : ι} (hi : i ∈ S) (hwi : w i = false) :
|
| 213 |
+
0 < (falseNeighbors R w i).card := by
|
| 214 |
+
classical
|
| 215 |
+
have hn : ¬ ∀ j, R i j → w j = true := by
|
| 216 |
+
intro h
|
| 217 |
+
have he : i ∈ IsolatedFlip.eligible S R w := IsolatedFlip.mem_eligible.mpr ⟨hi, h⟩
|
| 218 |
+
have hh := congrFun hw i
|
| 219 |
+
simp [IsolatedFlip.flip, he, hwi] at hh
|
| 220 |
+
push Not at hn
|
| 221 |
+
obtain ⟨j, hij, hj⟩ := hn
|
| 222 |
+
have hwj : w j = false := by cases h : w j <;> simp_all
|
| 223 |
+
exact Finset.card_pos.mpr ⟨j, by simp [falseNeighbors, hij, hwj]⟩
|
| 224 |
+
|
| 225 |
+
/-- The coincidence correction of a word with no isolated eligible position.
|
| 226 |
+
The exceptional positions `V \ S` include the external endpoint. -/
|
| 227 |
+
theorem correction_le_of_fixed {V S : Finset ι} {R : ι → ι → Prop}
|
| 228 |
+
(hS : S ⊆ V) {w : ι → Bool} (hw : IsolatedFlip.flip S R w = w)
|
| 229 |
+
{A x : ℝ} (hA : 0 ≤ A) (hx : 0 ≤ x) (hx1 : x ≤ 1) :
|
| 230 |
+
correction V R A x w ≤
|
| 231 |
+
(1 + A * x) ^ S.card * (1 + A) ^ (V \ S).card := by
|
| 232 |
+
classical
|
| 233 |
+
unfold correction
|
| 234 |
+
rw [Finset.prod_filter]
|
| 235 |
+
calc
|
| 236 |
+
_ ≤ ∏ i ∈ V, if i ∈ S then 1 + A * x else 1 + A := by
|
| 237 |
+
apply Finset.prod_le_prod₀
|
| 238 |
+
· intro i hi
|
| 239 |
+
split_ifs <;> positivity
|
| 240 |
+
· intro i hi
|
| 241 |
+
by_cases his : i ∈ S <;> by_cases hwi : w i = false
|
| 242 |
+
· simp only [ite_eq_left his, ite_eq_left hwi]
|
| 243 |
+
have hc := falseNeighbors_card_pos_of_fixed hw his hwi
|
| 244 |
+
have hp : x ^ (falseNeighbors R w i).card ≤ x := by
|
| 245 |
+
simpa using pow_le_pow_of_le_one hx hx1 (show 1 ≤ (falseNeighbors R w i).card by omega)
|
| 246 |
+
linarith [mul_le_mul_of_nonneg_left hp hA]
|
| 247 |
+
· simp only [ite_eq_left his, ite_eq_right hwi]
|
| 248 |
+
nlinarith [mul_nonneg hA hx]
|
| 249 |
+
· simp only [ite_eq_right his, ite_eq_left hwi]
|
| 250 |
+
have hp : x ^ (falseNeighbors R w i).card ≤ 1 := pow_le_one₀ hx hx1
|
| 251 |
+
nlinarith
|
| 252 |
+
· simp only [ite_eq_right his, ite_eq_right hwi]
|
| 253 |
+
linarith
|
| 254 |
+
_ = (1 + A * x) ^ S.card * (1 + A) ^ (V \ S).card := by
|
| 255 |
+
rw [Finset.prod_ite]
|
| 256 |
+
have hmem : V.filter (fun i => i ∈ S) = S := by
|
| 257 |
+
ext i
|
| 258 |
+
simp only [Finset.mem_filter]
|
| 259 |
+
exact ⟨fun h => h.2, fun h => ⟨hS h, h⟩⟩
|
| 260 |
+
have hnot : V.filter (fun i => ¬ i ∈ S) = V \ S := by
|
| 261 |
+
ext i
|
| 262 |
+
simp
|
| 263 |
+
rw [hmem, hnot]
|
| 264 |
+
simp
|
| 265 |
+
|
| 266 |
+
/-- With at most one exceptional V endpoint, the fixed-word correction has
|
| 267 |
+
the exact uniform bound used in the manuscript. -/
|
| 268 |
+
theorem correction_le_endpoint_bound {V S : Finset ι} {R : ι → ι → Prop}
|
| 269 |
+
(hS : S ⊆ V) (hend : (V \ S).card ≤ 1)
|
| 270 |
+
{w : ι → Bool} (hw : IsolatedFlip.flip S R w = w)
|
| 271 |
+
{A x : ℝ} (hA : 0 ≤ A) (hx : 0 ≤ x) (hx1 : x ≤ 1) :
|
| 272 |
+
correction V R A x w ≤ (1 + A) * (1 + A * x) ^ V.card := by
|
| 273 |
+
have hpow : (1 + A * x) ^ S.card ≤ (1 + A * x) ^ V.card :=
|
| 274 |
+
pow_le_pow_right₀ (by nlinarith) (Finset.card_le_card hS)
|
| 275 |
+
have hendpow : (1 + A) ^ (V \ S).card ≤ 1 + A := by
|
| 276 |
+
simpa using pow_le_pow_right₀ (by linarith : 1 ≤ 1 + A) hend
|
| 277 |
+
calc
|
| 278 |
+
correction V R A x w ≤ (1 + A * x) ^ S.card * (1 + A) ^ (V \ S).card :=
|
| 279 |
+
correction_le_of_fixed hS hw hA hx hx1
|
| 280 |
+
_ ≤ (1 + A * x) ^ V.card * (1 + A) :=
|
| 281 |
+
mul_le_mul hpow hendpow (by positivity) (by positivity)
|
| 282 |
+
_ = (1 + A) * (1 + A * x) ^ V.card := mul_comm _ _
|
| 283 |
+
|
| 284 |
+
/-- The word summand without coincidence corrections. -/
|
| 285 |
+
def baseWeight (edges : Finset (ι × ι)) (V : Finset ι) (A B x : ℝ)
|
| 286 |
+
(w : ι → Bool) : ℝ :=
|
| 287 |
+
x ^ SwitchRestoration.switchCount edges w *
|
| 288 |
+
A ^ (V.filter fun i => w i = true).card *
|
| 289 |
+
B ^ ((Finset.univ \ V).filter fun i => w i = true).card
|
| 290 |
+
|
| 291 |
+
theorem weight_eq_baseWeight (edges : Finset (ι × ι)) (V : Finset ι)
|
| 292 |
+
(R : ι → ι → Prop) (A B x : ℝ) (w : ι → Bool) :
|
| 293 |
+
weight edges V R A B x w = baseWeight edges V A B x w * correction V R A x w := rfl
|
| 294 |
+
|
| 295 |
+
theorem baseWeight_nonneg (edges : Finset (ι × ι)) (V : Finset ι)
|
| 296 |
+
{A B x : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (w : ι → Bool) :
|
| 297 |
+
0 ≤ baseWeight edges V A B x w := by
|
| 298 |
+
unfold baseWeight
|
| 299 |
+
positivity
|
| 300 |
+
|
| 301 |
+
/-- Complete isolated-position correction removal, including the exceptional
|
| 302 |
+
endpoint factor and enlargement of the fixed-word sum to all words. -/
|
| 303 |
+
theorem sum_weight_le_uncorrected {edges : Finset (ι × ι)} {V S : Finset ι}
|
| 304 |
+
{R : ι → ι → Prop} (hS : S ⊆ V)
|
| 305 |
+
(hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V)
|
| 306 |
+
(hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1)
|
| 307 |
+
(hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2)
|
| 308 |
+
(hend : (V \ S).card ≤ 1)
|
| 309 |
+
{A B x : ℝ} (hA : 0 < A) (hB : 0 ≤ B) (hx : 0 ≤ x) (hx1 : x ≤ 1) :
|
| 310 |
+
(∑ w : ι → Bool, weight edges V R A B x w) ≤
|
| 311 |
+
(1 + x ^ 2 * (1 + A) / A) ^ S.card *
|
| 312 |
+
(1 + A) * (1 + A * x) ^ V.card *
|
| 313 |
+
∑ w : ι → Bool, baseWeight edges V A B x w := by
|
| 314 |
+
classical
|
| 315 |
+
let fixed := Finset.univ.filter (fun w => IsolatedFlip.flip S R w = w)
|
| 316 |
+
let C := (1 + A) * (1 + A * x) ^ V.card
|
| 317 |
+
have hC : 0 ≤ C := by dsimp [C]; positivity
|
| 318 |
+
have hsum : (∑ w ∈ fixed, weight edges V R A B x w) ≤
|
| 319 |
+
C * ∑ w : ι → Bool, baseWeight edges V A B x w := by
|
| 320 |
+
calc
|
| 321 |
+
_ ≤ ∑ w ∈ fixed, C * baseWeight edges V A B x w := by
|
| 322 |
+
apply Finset.sum_le_sum
|
| 323 |
+
intro w hw
|
| 324 |
+
rw [weight_eq_baseWeight, mul_comm C]
|
| 325 |
+
exact mul_le_mul_of_nonneg_left
|
| 326 |
+
(correction_le_endpoint_bound hS hend (Finset.mem_filter.mp hw).2 hA.le hx hx1)
|
| 327 |
+
(baseWeight_nonneg edges V hA.le hB hx w)
|
| 328 |
+
_ = C * ∑ w ∈ fixed, baseWeight edges V A B x w := (Finset.mul_sum _ _ _).symm
|
| 329 |
+
_ ≤ C * ∑ w : ι → Bool, baseWeight edges V A B x w := by
|
| 330 |
+
apply mul_le_mul_of_nonneg_left _ hC
|
| 331 |
+
apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _)
|
| 332 |
+
intro w hw hn
|
| 333 |
+
exact baseWeight_nonneg edges V hA.le hB hx w
|
| 334 |
+
calc
|
| 335 |
+
_ ≤ (1 + x ^ 2 * (1 + A) / A) ^ S.card *
|
| 336 |
+
∑ w ∈ fixed, weight edges V R A B x w :=
|
| 337 |
+
sum_weight_le_fixed hS hV hR hdegree hA hB hx
|
| 338 |
+
_ ≤ (1 + x ^ 2 * (1 + A) / A) ^ S.card *
|
| 339 |
+
(C * ∑ w : ι → Bool, baseWeight edges V A B x w) :=
|
| 340 |
+
mul_le_mul_of_nonneg_left hsum (by positivity)
|
| 341 |
+
_ = _ := by dsimp [C]; ring
|
| 342 |
+
|
| 343 |
+
/-- The uniform correction-removal inequality in the form used by the
|
| 344 |
+
word-sum estimate: `A ≥ 1` bounds the flip cost by `1+2*x²`. -/
|
| 345 |
+
theorem sum_weight_le_uniform_uncorrected {edges : Finset (ι × ι)} {V S : Finset ι}
|
| 346 |
+
{R : ι → ι → Prop} (hS : S ⊆ V)
|
| 347 |
+
(hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V)
|
| 348 |
+
(hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1)
|
| 349 |
+
(hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2)
|
| 350 |
+
(hend : (V \ S).card ≤ 1)
|
| 351 |
+
{A B x : ℝ} (hA : 1 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (hx1 : x ≤ 1) :
|
| 352 |
+
(∑ w : ι → Bool, weight edges V R A B x w) ≤
|
| 353 |
+
(1 + 2 * x ^ 2) ^ V.card * (1 + A) * (1 + A * x) ^ V.card *
|
| 354 |
+
∑ w : ι → Bool, baseWeight edges V A B x w := by
|
| 355 |
+
classical
|
| 356 |
+
have hAp : 0 < A := by linarith
|
| 357 |
+
have hfrac : (1 + A) / A ≤ 2 := (div_le_iff₀ hAp).mpr (by linarith)
|
| 358 |
+
have hc : x ^ 2 * (1 + A) / A ≤ 2 * x ^ 2 := by
|
| 359 |
+
rw [mul_div_assoc]
|
| 360 |
+
simpa only [mul_comm (x ^ 2) 2] using mul_le_mul_of_nonneg_left hfrac (sq_nonneg x)
|
| 361 |
+
have hF : (1 + x ^ 2 * (1 + A) / A) ^ S.card ≤
|
| 362 |
+
(1 + 2 * x ^ 2) ^ V.card := by
|
| 363 |
+
calc
|
| 364 |
+
_ ≤ (1 + 2 * x ^ 2) ^ S.card :=
|
| 365 |
+
pow_le_pow_left₀ (by positivity) (by linarith) S.card
|
| 366 |
+
_ ≤ (1 + 2 * x ^ 2) ^ V.card :=
|
| 367 |
+
pow_le_pow_right₀ (by nlinarith [sq_nonneg x]) (Finset.card_le_card hS)
|
| 368 |
+
have hZ : 0 ≤ ∑ w : ι → Bool, baseWeight edges V A B x w :=
|
| 369 |
+
Finset.sum_nonneg (fun w _ => baseWeight_nonneg edges V hAp.le hB hx w)
|
| 370 |
+
refine (sum_weight_le_uncorrected hS hV hR hdegree hend hAp hB hx hx1).trans ?_
|
| 371 |
+
have h := mul_le_mul_of_nonneg_right hF
|
| 372 |
+
(show 0 ≤ (1 + A) * (1 + A * x) ^ V.card *
|
| 373 |
+
∑ w : ι → Bool, baseWeight edges V A B x w by positivity)
|
| 374 |
+
simpa only [mul_assoc] using h
|
| 375 |
+
|
| 376 |
+
end Problem335.IsolatedWeight
|
| 377 |
+
|
| 378 |
+
end
|
| 379 |
+
|
| 380 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/IteratedDerivative.lean
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
namespace Problem335
|
| 8 |
+
|
| 9 |
+
open MvPolynomial
|
| 10 |
+
|
| 11 |
+
variable {K σ : Type*} [CommSemiring K]
|
| 12 |
+
|
| 13 |
+
/-- Repeated partial differentiation acts by a falling factorial on each monomial. -/
|
| 14 |
+
theorem iterate_pderiv_monomial (i : σ) (r : ℕ) (d : σ →₀ ℕ) (a : K) :
|
| 15 |
+
(pderiv i)^[r] (monomial d a) =
|
| 16 |
+
monomial (d - Finsupp.single i r) (a * (d i).descFactorial r) := by
|
| 17 |
+
classical
|
| 18 |
+
induction r with
|
| 19 |
+
| zero => simp
|
| 20 |
+
| succ r ih =>
|
| 21 |
+
rw [Function.iterate_succ_apply', ih, pderiv_monomial,
|
| 22 |
+
Nat.descFactorial_succ]
|
| 23 |
+
simp only [Finsupp.tsub_apply, Finsupp.single_eq_same, Nat.cast_mul]
|
| 24 |
+
rw [show d - Finsupp.single i r - Finsupp.single i 1 =
|
| 25 |
+
d - Finsupp.single i (r + 1) by rw [tsub_tsub, Finsupp.single_add]]
|
| 26 |
+
congr 1
|
| 27 |
+
ring
|
| 28 |
+
|
| 29 |
+
/-- Derivatives beyond a monomial's exponent vanish, in any characteristic. -/
|
| 30 |
+
theorem iterate_pderiv_monomial_eq_zero (i : σ) (r : ℕ) (d : σ →₀ ℕ)
|
| 31 |
+
(a : K) (h : d i < r) :
|
| 32 |
+
(pderiv i)^[r] (monomial d a) = 0 := by
|
| 33 |
+
rw [iterate_pderiv_monomial, Nat.descFactorial_eq_zero_iff_lt.mpr h]
|
| 34 |
+
simp
|
| 35 |
+
|
| 36 |
+
/-- Coefficients of a repeated derivative are shifted coefficients times a rising factorial. -/
|
| 37 |
+
theorem coeff_iterate_pderiv (i : σ) (r : ℕ) (p : MvPolynomial σ K)
|
| 38 |
+
(m : σ →₀ ℕ) :
|
| 39 |
+
((pderiv i)^[r] p).coeff m =
|
| 40 |
+
p.coeff (m + Finsupp.single i r) * (m i + 1).ascFactorial r := by
|
| 41 |
+
classical
|
| 42 |
+
induction r generalizing p with
|
| 43 |
+
| zero => simp
|
| 44 |
+
| succ r ih =>
|
| 45 |
+
rw [Function.iterate_succ_apply, ih, coeff_pderiv, Nat.ascFactorial_succ]
|
| 46 |
+
simp only [Finsupp.add_apply, Finsupp.single_eq_same, Nat.cast_mul]
|
| 47 |
+
rw [show m + Finsupp.single i r + Finsupp.single i 1 =
|
| 48 |
+
m + Finsupp.single i (r + 1) by rw [add_assoc, ← Finsupp.single_add]]
|
| 49 |
+
push_cast
|
| 50 |
+
ring
|
| 51 |
+
|
| 52 |
+
end Problem335
|
| 53 |
+
|
| 54 |
+
end
|
| 55 |
+
|
| 56 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/LayeredFourPath.lean
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.FourPathLocal
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
|
| 8 |
+
namespace Problem335
|
| 9 |
+
namespace LayeredFourPath
|
| 10 |
+
|
| 11 |
+
/-- Signed occupations, retaining the layer coordinate explicitly. -/
|
| 12 |
+
def signedOccupation {T σ : Type*} (M : T → σ → ℕ) : T → σ → ℤ :=
|
| 13 |
+
fun t x => M t x
|
| 14 |
+
|
| 15 |
+
/-- Every path chooses exactly one coordinate in every layer. -/
|
| 16 |
+
def signedShift {T σ : Type*} [DecidableEq σ]
|
| 17 |
+
(side : T → Bool) (p : T → σ) : T → σ → ℤ :=
|
| 18 |
+
fun t x => (if side t then -1 else 1) * (Finsupp.single (p t) (1 : ℤ)) x
|
| 19 |
+
|
| 20 |
+
/-- The Fock coefficient of a layered path. -/
|
| 21 |
+
def amplitude {T σ : Type*} [Fintype T]
|
| 22 |
+
(side : T → Bool) (M : T → σ → ℕ) (p : T → σ) : ℝ :=
|
| 23 |
+
∏ t, LocalMoments.coefficient (side t) (M t (p t))
|
| 24 |
+
|
| 25 |
+
/-- Compatibility of global signed shifts gives the local pairing identity at every layer. -/
|
| 26 |
+
theorem coordinate_matching_of_signedShift {T σ : Type*} [DecidableEq σ]
|
| 27 |
+
(side : T → Bool) (p q r s : T → σ)
|
| 28 |
+
(h : signedShift side p - signedShift side q =
|
| 29 |
+
signedShift side r - signedShift side s) (t : T) :
|
| 30 |
+
Finsupp.single (p t) (1 : ℤ) - Finsupp.single (q t) 1 =
|
| 31 |
+
Finsupp.single (r t) 1 - Finsupp.single (s t) 1 := by
|
| 32 |
+
ext x
|
| 33 |
+
have hx := congrArg (fun f : T → σ → ℤ => f t x) h
|
| 34 |
+
change (Finsupp.single (p t) (1 : ℤ)) x - (Finsupp.single (q t) 1) x =
|
| 35 |
+
(Finsupp.single (r t) 1) x - (Finsupp.single (s t) 1) x
|
| 36 |
+
cases ht : side t <;> simp [signedShift, ht] at hx <;> omega
|
| 37 |
+
|
| 38 |
+
/-- An actual shifted source automatically satisfies the local occupation relation. -/
|
| 39 |
+
theorem local_shift_of_signedOccupation {T σ : Type*} [DecidableEq σ]
|
| 40 |
+
(side : T → Bool) (M M' : T → σ → ℕ) (p q : T → σ)
|
| 41 |
+
(h : signedOccupation M' =
|
| 42 |
+
signedOccupation M + signedShift side p - signedShift side q) (t : T) :
|
| 43 |
+
LocalMoments.ShiftRelation (side t) (M t) (M' t) (p t) (q t) := by
|
| 44 |
+
intro x
|
| 45 |
+
have hx := congrArg (fun f : T → σ → ℤ => f t x) h
|
| 46 |
+
change (M' t x : ℤ) = (M t x : ℤ) +
|
| 47 |
+
(if side t then -1 else 1) * (Finsupp.single (p t) (1 : ℤ)) x -
|
| 48 |
+
(if side t then -1 else 1) * (Finsupp.single (q t) (1 : ℤ)) x at hx
|
| 49 |
+
rw [Finsupp.sub_apply]
|
| 50 |
+
rw [hx]
|
| 51 |
+
ring
|
| 52 |
+
|
| 53 |
+
/-- The entire valid four-path coefficient is the product of the local occupation table. -/
|
| 54 |
+
theorem amplitude_four_eq_local_product {T σ : Type*} [Fintype T] [DecidableEq σ]
|
| 55 |
+
(side : T → Bool) (M M' : T → σ → ℕ) (p q r s : T → σ)
|
| 56 |
+
(hmatch : signedShift side p - signedShift side q =
|
| 57 |
+
signedShift side r - signedShift side s)
|
| 58 |
+
(hshift : signedOccupation M' =
|
| 59 |
+
signedOccupation M + signedShift side p - signedShift side q) :
|
| 60 |
+
amplitude side M p * amplitude side M' q * amplitude side M r * amplitude side M' s =
|
| 61 |
+
∏ t, LocalMoments.localPolynomial (side t) (M t) (p t) (q t) (r t) := by
|
| 62 |
+
exact LocalMoments.four_path_products_eq_localPolynomial_product Finset.univ
|
| 63 |
+
side M M' p q r s
|
| 64 |
+
(fun t _ => coordinate_matching_of_signedShift side p q r s hmatch t)
|
| 65 |
+
(fun t _ => local_shift_of_signedOccupation side M M' p q hshift t)
|
| 66 |
+
|
| 67 |
+
/-- Lift the valid-source identity to a zero extension. Missing shifted source occupations
|
| 68 |
+
contribute zero, so an upper estimate needs no source-validity-closure hypothesis. -/
|
| 69 |
+
theorem zeroExtended_amplitude_four_le_local_product
|
| 70 |
+
{I T σ : Type*} [Fintype T] [DecidableEq σ]
|
| 71 |
+
(side : T → Bool) (M : I → T → σ → ℕ)
|
| 72 |
+
(hinj : Function.Injective (fun i => signedOccupation (M i)))
|
| 73 |
+
(i : I) (p q r s : T → σ)
|
| 74 |
+
(hmatch : signedShift side p - signedShift side q =
|
| 75 |
+
signedShift side r - signedShift side s) :
|
| 76 |
+
amplitude side (M i) p *
|
| 77 |
+
Function.extend (fun k => signedOccupation (M k))
|
| 78 |
+
(fun k => amplitude side (M k) q) (fun _ => 0)
|
| 79 |
+
(signedOccupation (M i) + signedShift side p - signedShift side q) *
|
| 80 |
+
amplitude side (M i) r *
|
| 81 |
+
Function.extend (fun k => signedOccupation (M k))
|
| 82 |
+
(fun k => amplitude side (M k) s) (fun _ => 0)
|
| 83 |
+
(signedOccupation (M i) + signedShift side p - signedShift side q) ≤
|
| 84 |
+
∏ t, LocalMoments.localPolynomial (side t) (M i t) (p t) (q t) (r t) := by
|
| 85 |
+
classical
|
| 86 |
+
let x := signedOccupation (M i) + signedShift side p - signedShift side q
|
| 87 |
+
by_cases hx : ∃ k, signedOccupation (M k) = x
|
| 88 |
+
· obtain ⟨k, hk⟩ := hx
|
| 89 |
+
change amplitude side (M i) p *
|
| 90 |
+
Function.extend (fun k => signedOccupation (M k))
|
| 91 |
+
(fun k => amplitude side (M k) q) (fun _ => 0) x *
|
| 92 |
+
amplitude side (M i) r *
|
| 93 |
+
Function.extend (fun k => signedOccupation (M k))
|
| 94 |
+
(fun k => amplitude side (M k) s) (fun _ => 0) x ≤ _
|
| 95 |
+
rw [← hk, hinj.extend_apply, hinj.extend_apply]
|
| 96 |
+
exact (amplitude_four_eq_local_product side (M i) (M k) p q r s hmatch hk).le
|
| 97 |
+
· have hz := Function.extend_apply' (f := fun k => signedOccupation (M k))
|
| 98 |
+
(fun k => amplitude side (M k) q) (fun _ => (0 : ℝ)) x hx
|
| 99 |
+
change amplitude side (M i) p *
|
| 100 |
+
Function.extend (fun k => signedOccupation (M k))
|
| 101 |
+
(fun k => amplitude side (M k) q) (fun _ => 0) x *
|
| 102 |
+
amplitude side (M i) r *
|
| 103 |
+
Function.extend (fun k => signedOccupation (M k))
|
| 104 |
+
(fun k => amplitude side (M k) s) (fun _ => 0) x ≤ _
|
| 105 |
+
rw [hz]
|
| 106 |
+
simp only [mul_zero, zero_mul]
|
| 107 |
+
exact Finset.prod_nonneg (fun t _ => LocalMoments.localPolynomial_nonneg _ _ _ _ _)
|
| 108 |
+
|
| 109 |
+
end LayeredFourPath
|
| 110 |
+
end Problem335
|
| 111 |
+
|
| 112 |
+
end
|
| 113 |
+
|
| 114 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/LocalFactorialExpansion.lean
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.FactorialPositive
|
| 2 |
+
import OAI.Algebra.DepthFive.FourPathLocal
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! The actual local four-path table has bounded nonnegative factorial expansions. -/
|
| 7 |
+
namespace Problem335
|
| 8 |
+
|
| 9 |
+
open scoped BigOperators
|
| 10 |
+
|
| 11 |
+
namespace FactorialExpansion
|
| 12 |
+
|
| 13 |
+
variable {σ : Type*} [Fintype σ]
|
| 14 |
+
|
| 15 |
+
/-- Enlarge the permitted support and total-order bound. -/
|
| 16 |
+
def weaken {f : (σ → ℕ) → ℕ} {S T : Finset σ} {D E : ℕ}
|
| 17 |
+
(F : FactorialExpansion f S D) (hS : S ⊆ T) (hD : D ≤ E) :
|
| 18 |
+
FactorialExpansion f T E where
|
| 19 |
+
Index := F.Index
|
| 20 |
+
indexFintype := F.indexFintype
|
| 21 |
+
coeff := F.coeff
|
| 22 |
+
degree := F.degree
|
| 23 |
+
order_le := fun j => (F.order_le j).trans hD
|
| 24 |
+
supported := fun j i hi => F.supported j i (fun h => hi (hS h))
|
| 25 |
+
eval_eq := F.eval_eq
|
| 26 |
+
|
| 27 |
+
end FactorialExpansion
|
| 28 |
+
|
| 29 |
+
namespace LocalMoments
|
| 30 |
+
|
| 31 |
+
variable {σ : Type*} [DecidableEq σ]
|
| 32 |
+
|
| 33 |
+
/-- Natural-valued version of the exact local table. -/
|
| 34 |
+
def localPolynomialNat (derivative : Bool) (M : σ → ℕ) (p q r : σ) : ℕ :=
|
| 35 |
+
if p = q then
|
| 36 |
+
if derivative then M p * M r else (M p + 1) * (M r + 1)
|
| 37 |
+
else if derivative then M p * (M q + 1) else (M p + 1) * M q
|
| 38 |
+
|
| 39 |
+
@[simp] theorem localPolynomialNat_cast (derivative : Bool) (M : σ → ℕ) (p q r : σ) :
|
| 40 |
+
(localPolynomialNat derivative M p q r : ℝ) = localPolynomial derivative M p q r := by
|
| 41 |
+
cases derivative <;> by_cases h : p = q <;> simp [localPolynomialNat, localPolynomial, mass, h]
|
| 42 |
+
|
| 43 |
+
/-- All branches of the local four-path table have total factorial order at most two.
|
| 44 |
+
The normal branch includes coincident coordinates and their first-order corrections. -/
|
| 45 |
+
def localPolynomialExpansion [Fintype σ] (derivative : Bool) (p q r : σ) :
|
| 46 |
+
FactorialExpansion (fun M => localPolynomialNat derivative M p q r) {p, q, r} 2 := by
|
| 47 |
+
have hpr : ({p, r} : Finset σ) ⊆ {p, q, r} := by
|
| 48 |
+
intro i hi
|
| 49 |
+
simp only [Finset.mem_insert, Finset.mem_singleton] at *
|
| 50 |
+
tauto
|
| 51 |
+
have hpq : ({p, q} : Finset σ) ⊆ {p, q, r} := by
|
| 52 |
+
intro i hi
|
| 53 |
+
simp only [Finset.mem_insert, Finset.mem_singleton] at *
|
| 54 |
+
tauto
|
| 55 |
+
cases derivative
|
| 56 |
+
· by_cases h : p = q
|
| 57 |
+
· exact (FactorialExpansion.normalMultiplication p r).reframe
|
| 58 |
+
(by intro M; simp [localPolynomialNat, h]) hpr (le_refl 2)
|
| 59 |
+
· exact (FactorialExpansion.distinctMultiplication p q h).reframe
|
| 60 |
+
(by intro M; simp [localPolynomialNat, h]) hpq (le_refl 2)
|
| 61 |
+
· by_cases h : p = q
|
| 62 |
+
· exact (FactorialExpansion.normalDerivative p r).reframe
|
| 63 |
+
(by intro M; simp [localPolynomialNat, h]) hpr (le_refl 2)
|
| 64 |
+
· exact (FactorialExpansion.distinctDerivative p q h).reframe
|
| 65 |
+
(by intro M; simp [localPolynomialNat, h]) hpq (le_refl 2)
|
| 66 |
+
|
| 67 |
+
/-- The natural polynomial for a finite set of layers. -/
|
| 68 |
+
def localProductNat {ι : Type*} (layers : Finset ι) (derivative : ι → Bool)
|
| 69 |
+
(p q r : ι → σ) (M : σ → ℕ) : ℕ :=
|
| 70 |
+
∏ t ∈ layers, localPolynomialNat (derivative t) M (p t) (q t) (r t)
|
| 71 |
+
|
| 72 |
+
@[simp] theorem localProductNat_cast {ι : Type*} (layers : Finset ι)
|
| 73 |
+
(derivative : ι → Bool) (p q r : ι → σ) (M : σ → ℕ) :
|
| 74 |
+
(localProductNat layers derivative p q r M : ℝ) =
|
| 75 |
+
∏ t ∈ layers, localPolynomial (derivative t) M (p t) (q t) (r t) := by
|
| 76 |
+
simp [localProductNat]
|
| 77 |
+
|
| 78 |
+
/-- This finite product is the exact nonnegative factorial expansion required
|
| 79 |
+
by the occupation-moment comparison, rather than an assumed positivity property. -/
|
| 80 |
+
theorem localProduct_expansion {ι : Type*} [Fintype σ] (layers : Finset ι)
|
| 81 |
+
(derivative : ι → Bool) (p q r : ι → σ)
|
| 82 |
+
(hdis : (layers : Set ι).Pairwise fun i j =>
|
| 83 |
+
Disjoint ({p i, q i, r i} : Finset σ) {p j, q j, r j}) :
|
| 84 |
+
Nonempty (FactorialExpansion (localProductNat layers derivative p q r)
|
| 85 |
+
(layers.biUnion fun i => {p i, q i, r i}) (2 * layers.card)) := by
|
| 86 |
+
have h := FactorialExpansion.nonempty_prod layers
|
| 87 |
+
(fun i M => localPolynomialNat (derivative i) M (p i) (q i) (r i))
|
| 88 |
+
(fun i => {p i, q i, r i}) (fun _ => 2)
|
| 89 |
+
(fun i => localPolynomialExpansion (derivative i) (p i) (q i) (r i)) hdis
|
| 90 |
+
convert h using 1
|
| 91 |
+
simp [Nat.mul_comm]
|
| 92 |
+
congr 1
|
| 93 |
+
|
| 94 |
+
/-- Layer-labelled coordinates automatically have disjoint local supports. -/
|
| 95 |
+
theorem layered_support_disjoint {ι κ : Type*} [DecidableEq ι] [DecidableEq κ]
|
| 96 |
+
(layers : Finset ι) (p q r : ι → κ) :
|
| 97 |
+
(layers : Set ι).Pairwise fun i j =>
|
| 98 |
+
Disjoint ({(i, p i), (i, q i), (i, r i)} : Finset (ι × κ))
|
| 99 |
+
{(j, p j), (j, q j), (j, r j)} := by
|
| 100 |
+
intro i hi j hj hij
|
| 101 |
+
apply Finset.disjoint_left.mpr
|
| 102 |
+
intro x hx hy
|
| 103 |
+
have hx' : x.1 = i := by
|
| 104 |
+
simp only [Finset.mem_insert, Finset.mem_singleton] at hx
|
| 105 |
+
rcases hx with h | h | h <;> simp [h]
|
| 106 |
+
have hy' : x.1 = j := by
|
| 107 |
+
simp only [Finset.mem_insert, Finset.mem_singleton] at hy
|
| 108 |
+
rcases hy with h | h | h <;> simp [h]
|
| 109 |
+
exact hij (hx'.symm.trans hy')
|
| 110 |
+
|
| 111 |
+
/-- Specialization to the actual matrix-layer coordinate shape. -/
|
| 112 |
+
theorem layered_localProduct_expansion {ι κ : Type*}
|
| 113 |
+
[Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ]
|
| 114 |
+
(layers : Finset ι) (derivative : ι → Bool) (p q r : ι → κ) :
|
| 115 |
+
Nonempty (FactorialExpansion
|
| 116 |
+
(localProductNat layers derivative (fun i => (i, p i))
|
| 117 |
+
(fun i => (i, q i)) (fun i => (i, r i)))
|
| 118 |
+
(layers.biUnion fun i => {(i, p i), (i, q i), (i, r i)}) (2 * layers.card)) :=
|
| 119 |
+
localProduct_expansion layers derivative _ _ _ (layered_support_disjoint layers p q r)
|
| 120 |
+
|
| 121 |
+
end LocalMoments
|
| 122 |
+
end Problem335
|
| 123 |
+
|
| 124 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/LocalMomentPairing.lean
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.SecondMomentNormalization
|
| 2 |
+
import OAI.Algebra.DepthFive.FactorialGeometricValue
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! The actual geometric local table agrees with the canonical pairing
|
| 7 |
+
normalization, including coincident coordinates in the normal class. -/
|
| 8 |
+
|
| 9 |
+
noncomputable section
|
| 10 |
+
open scoped BigOperators
|
| 11 |
+
|
| 12 |
+
namespace Problem335.MomentPairing
|
| 13 |
+
|
| 14 |
+
open Pairings
|
| 15 |
+
|
| 16 |
+
theorem localGeometricMass_eq_moment {γ : Type*} [DecidableEq γ]
|
| 17 |
+
(side : Bool) (A B : ℝ) (x : Labels γ) :
|
| 18 |
+
LocalMoments.localGeometricMass side (if side then A else B) x.p x.q x.r =
|
| 19 |
+
LocalMomentWeights.moment side (isDiagonal (classifyLayer x))
|
| 20 |
+
(coincides x) A B := by
|
| 21 |
+
classical
|
| 22 |
+
cases side <;> by_cases hpq : x.p = x.q <;>
|
| 23 |
+
simp [LocalMoments.localGeometricMass, LocalMoments.normalGeometricMass,
|
| 24 |
+
LocalMoments.diagonalGeometricMass, LocalMomentWeights.moment,
|
| 25 |
+
classifyLayer, isDiagonal, coincides, hpq]
|
| 26 |
+
|
| 27 |
+
/-- No compatibility assumption is needed for this algebraic identity: the
|
| 28 |
+
canonical class always chooses the normal branch precisely when `p=q`. -/
|
| 29 |
+
theorem prod_localGeometricMass_eq {γ : Type*} [DecidableEq γ] {L : ℕ}
|
| 30 |
+
(side : Fin (L + 1) → Bool) (A B : ℝ)
|
| 31 |
+
(endpoint : γ) (x : Fin L → Labels γ) :
|
| 32 |
+
(∏ t, LocalMoments.localGeometricMass (side t) (if side t then A else B)
|
| 33 |
+
(layerLabels endpoint x t).p (layerLabels endpoint x t).q
|
| 34 |
+
(layerLabels endpoint x t).r) =
|
| 35 |
+
pathGeometricMoment side A B endpoint (classifyWord endpoint x) x := by
|
| 36 |
+
unfold pathGeometricMoment classifyWord
|
| 37 |
+
apply Finset.prod_congr rfl
|
| 38 |
+
intro t _
|
| 39 |
+
exact localGeometricMass_eq_moment _ _ _ _
|
| 40 |
+
|
| 41 |
+
theorem prod_localGeometricMass_eq_normalized {γ : Type*} [DecidableEq γ] {L : ℕ}
|
| 42 |
+
(side : Fin (L + 1) → Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B)
|
| 43 |
+
(endpoint : γ) (x : Fin L → Labels γ) :
|
| 44 |
+
(∏ t, LocalMoments.localGeometricMass (side t) (if side t then A else B)
|
| 45 |
+
(layerLabels endpoint x t).p (layerLabels endpoint x t).q
|
| 46 |
+
(layerLabels endpoint x t).r) =
|
| 47 |
+
pathMean side A B ^ 2 * pathWeight side (A / (A + 1)) (B / (B + 1))
|
| 48 |
+
endpoint (classifyWord endpoint x) x := by
|
| 49 |
+
rw [prod_localGeometricMass_eq, pathGeometricMoment_eq side hA hB]
|
| 50 |
+
|
| 51 |
+
/-- Concrete input interface for occupation averaging: the geometric RHS is
|
| 52 |
+
the actual local polynomial table, rather than an assumed pairing weight. -/
|
| 53 |
+
theorem sum_sources_local_moments_le {ι γ : Type*} [Fintype ι]
|
| 54 |
+
[Fintype γ] [DecidableEq γ] {L : ℕ}
|
| 55 |
+
(side : Fin (L + 1) → Bool) {A B D : ℝ}
|
| 56 |
+
(hA : 0 < A) (hB : 0 ≤ B) (hD : 0 ≤ D) (endpoint : γ)
|
| 57 |
+
(C : ι → (Fin L → Labels γ) → ℝ)
|
| 58 |
+
(hexpect : ∀ x, Compatible endpoint x →
|
| 59 |
+
(∑ i, C i x) ≤ D *
|
| 60 |
+
∏ t, LocalMoments.localGeometricMass (side t) (if side t then A else B)
|
| 61 |
+
(layerLabels endpoint x t).p (layerLabels endpoint x t).q
|
| 62 |
+
(layerLabels endpoint x t).r) :
|
| 63 |
+
(∑ i, ∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, C i x.1) ≤
|
| 64 |
+
D * pathMean side A B ^ 2 *
|
| 65 |
+
∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ,
|
| 66 |
+
pathWeight side (A / (A + 1)) (B / (B + 1)) endpoint τ x.1 := by
|
| 67 |
+
apply sum_sources_compatible_le side hA hB hD endpoint C
|
| 68 |
+
intro x hx
|
| 69 |
+
simpa only [prod_localGeometricMass_eq] using hexpect x hx
|
| 70 |
+
|
| 71 |
+
end Problem335.MomentPairing
|
| 72 |
+
|
| 73 |
+
end
|
| 74 |
+
|
| 75 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/LocalMomentPolynomials.lean
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
|
| 8 |
+
namespace Problem335
|
| 9 |
+
namespace LocalMoments
|
| 10 |
+
|
| 11 |
+
/-- Squared local Fock coefficient, with `true` denoting differentiation. -/
|
| 12 |
+
def mass (derivative : Bool) (z : ℕ) : ℝ :=
|
| 13 |
+
if derivative then z else z + 1
|
| 14 |
+
|
| 15 |
+
def coefficient (derivative : Bool) (z : ℕ) : ℝ :=
|
| 16 |
+
Real.sqrt (mass derivative z)
|
| 17 |
+
|
| 18 |
+
lemma mass_nonneg (derivative : Bool) (z : ℕ) : 0 ≤ mass derivative z := by
|
| 19 |
+
cases derivative <;> dsimp [mass]
|
| 20 |
+
all_goals positivity
|
| 21 |
+
|
| 22 |
+
@[simp] lemma coefficient_sq (derivative : Bool) (z : ℕ) :
|
| 23 |
+
coefficient derivative z ^ 2 = mass derivative z :=
|
| 24 |
+
Real.sq_sqrt (mass_nonneg derivative z)
|
| 25 |
+
|
| 26 |
+
/-- One layer's four factors in the second trace. -/
|
| 27 |
+
def fourCoefficient (derivative : Bool) (a b c d : ℕ) : ℝ :=
|
| 28 |
+
coefficient derivative a * coefficient derivative b *
|
| 29 |
+
coefficient derivative c * coefficient derivative d
|
| 30 |
+
|
| 31 |
+
/-- The normal pairing has zero occupation shift. -/
|
| 32 |
+
lemma normal_fourCoefficient (derivative : Bool) (a b : ℕ) :
|
| 33 |
+
fourCoefficient derivative a a b b = mass derivative a * mass derivative b := by
|
| 34 |
+
calc
|
| 35 |
+
_ = coefficient derivative a ^ 2 * coefficient derivative b ^ 2 := by
|
| 36 |
+
unfold fourCoefficient
|
| 37 |
+
ring
|
| 38 |
+
_ = _ := by rw [coefficient_sq, coefficient_sq]
|
| 39 |
+
|
| 40 |
+
/-- Differentiating diagonal pairing: the second path receives one occupation. -/
|
| 41 |
+
lemma derivative_diagonal_fourCoefficient (a b : ℕ) :
|
| 42 |
+
fourCoefficient true a (b + 1) a (b + 1) = (a : ℝ) * ((b : ℝ) + 1) := by
|
| 43 |
+
calc
|
| 44 |
+
_ = coefficient true a ^ 2 * coefficient true (b + 1) ^ 2 := by
|
| 45 |
+
unfold fourCoefficient
|
| 46 |
+
ring
|
| 47 |
+
_ = _ := by simp [mass]
|
| 48 |
+
|
| 49 |
+
/-- Multiplying diagonal pairing, expressed without natural subtraction. -/
|
| 50 |
+
lemma multiplication_diagonal_fourCoefficient (a b : ℕ) :
|
| 51 |
+
fourCoefficient false a b a b = ((a : ℝ) + 1) * ((b : ℝ) + 1) := by
|
| 52 |
+
calc
|
| 53 |
+
_ = coefficient false a ^ 2 * coefficient false b ^ 2 := by
|
| 54 |
+
unfold fourCoefficient
|
| 55 |
+
ring
|
| 56 |
+
_ = _ := by simp [mass]
|
| 57 |
+
|
| 58 |
+
lemma multiplication_diagonal_fourCoefficient_pred (a b : ℕ) (hb : 0 < b) :
|
| 59 |
+
fourCoefficient false a (b - 1) a (b - 1) = ((a : ℝ) + 1) * (b : ℝ) := by
|
| 60 |
+
rw [multiplication_diagonal_fourCoefficient]
|
| 61 |
+
have h : (b - 1 : ℕ) + 1 = b := by omega
|
| 62 |
+
have hr := congrArg (fun n : ℕ => (n : ℝ)) h
|
| 63 |
+
push_cast at hr
|
| 64 |
+
rw [hr]
|
| 65 |
+
|
| 66 |
+
/-- The unavailable differentiation contribution vanishes identically. -/
|
| 67 |
+
@[simp] lemma derivative_invalid (b : ℕ) :
|
| 68 |
+
(0 : ℝ) * ((b : ℝ) + 1) = 0 := zero_mul _
|
| 69 |
+
|
| 70 |
+
/-- If the multiplication shift would create a negative source occupation,
|
| 71 |
+
its table contribution is zero. -/
|
| 72 |
+
@[simp] lemma multiplication_invalid (a : ℕ) :
|
| 73 |
+
((a : ℝ) + 1) * (0 : ℝ) = 0 := mul_zero _
|
| 74 |
+
|
| 75 |
+
/-- Move the four path products into a product of local four-factor entries. -/
|
| 76 |
+
lemma four_products_eq_product {ι : Type*} (s : Finset ι)
|
| 77 |
+
(derivative : ι → Bool) (a b c d : ι → ℕ) :
|
| 78 |
+
(∏ i ∈ s, coefficient (derivative i) (a i)) *
|
| 79 |
+
(∏ i ∈ s, coefficient (derivative i) (b i)) *
|
| 80 |
+
(∏ i ∈ s, coefficient (derivative i) (c i)) *
|
| 81 |
+
(∏ i ∈ s, coefficient (derivative i) (d i)) =
|
| 82 |
+
∏ i ∈ s, fourCoefficient (derivative i) (a i) (b i) (c i) (d i) := by
|
| 83 |
+
simp only [fourCoefficient, Finset.prod_mul_distrib]
|
| 84 |
+
|
| 85 |
+
/-- Version of the normal pairing usable with occupation functions. -/
|
| 86 |
+
lemma normal_layer {σ : Type*} (derivative : Bool) (M M' : σ → ℕ) (i j : σ)
|
| 87 |
+
(hi : M' i = M i) (hj : M' j = M j) :
|
| 88 |
+
fourCoefficient derivative (M i) (M' i) (M j) (M' j) =
|
| 89 |
+
mass derivative (M i) * mass derivative (M j) := by
|
| 90 |
+
rw [hi, hj, normal_fourCoefficient]
|
| 91 |
+
|
| 92 |
+
lemma derivative_diagonal_layer {σ : Type*} (M M' : σ → ℕ) (i j : σ)
|
| 93 |
+
(hj : M' j = M j + 1) :
|
| 94 |
+
fourCoefficient true (M i) (M' j) (M i) (M' j) =
|
| 95 |
+
(M i : ℝ) * ((M j : ℝ) + 1) := by
|
| 96 |
+
rw [hj, derivative_diagonal_fourCoefficient]
|
| 97 |
+
|
| 98 |
+
lemma multiplication_diagonal_layer {σ : Type*} (M M' : σ → ℕ) (i j : σ)
|
| 99 |
+
(hj : M' j + 1 = M j) :
|
| 100 |
+
fourCoefficient false (M i) (M' j) (M i) (M' j) =
|
| 101 |
+
((M i : ℝ) + 1) * (M j : ℝ) := by
|
| 102 |
+
rw [multiplication_diagonal_fourCoefficient]
|
| 103 |
+
have hr := congrArg (fun n : ℕ => (n : ℝ)) hj
|
| 104 |
+
push_cast at hr
|
| 105 |
+
rw [hr]
|
| 106 |
+
|
| 107 |
+
/-- The multiplying diagonal term, extended by zero when its backward shift is invalid. -/
|
| 108 |
+
def multiplicationDiagonalTerm (a b : ℕ) : ℝ :=
|
| 109 |
+
if b = 0 then 0 else fourCoefficient false a (b - 1) a (b - 1)
|
| 110 |
+
|
| 111 |
+
lemma multiplicationDiagonalTerm_eq (a b : ℕ) :
|
| 112 |
+
multiplicationDiagonalTerm a b = ((a : ℝ) + 1) * (b : ℝ) := by
|
| 113 |
+
by_cases hb : b = 0
|
| 114 |
+
· simp [multiplicationDiagonalTerm, hb]
|
| 115 |
+
· simp only [multiplicationDiagonalTerm, hb, ↓reduceIte]
|
| 116 |
+
exact multiplication_diagonal_fourCoefficient_pred a b (Nat.pos_of_ne_zero hb)
|
| 117 |
+
|
| 118 |
+
lemma square_fallingFactorial (z : ℕ) :
|
| 119 |
+
(z : ℝ)^2 = (z.descFactorial 2 : ℝ) + (z : ℝ) := by
|
| 120 |
+
cases z with
|
| 121 |
+
| zero => norm_num
|
| 122 |
+
| succ z => simp [Nat.descFactorial_succ]; ring
|
| 123 |
+
|
| 124 |
+
lemma successor_square_fallingFactorial (z : ℕ) :
|
| 125 |
+
((z : ℝ) + 1)^2 = (z.descFactorial 2 : ℝ) + 3 * (z : ℝ) + 1 := by
|
| 126 |
+
rw [show ((z : ℝ) + 1)^2 = (z : ℝ)^2 + 2 * z + 1 by ring,
|
| 127 |
+
square_fallingFactorial]
|
| 128 |
+
ring
|
| 129 |
+
|
| 130 |
+
/-- Geometric first/second-moment input, before normalization, for normal pairings. -/
|
| 131 |
+
def normalGeometricMass (derivative : Bool) (G : ℝ) (collision : Bool) : ℝ :=
|
| 132 |
+
if derivative then
|
| 133 |
+
if collision then 2 * G^2 + G else G^2
|
| 134 |
+
else
|
| 135 |
+
if collision then 2 * G^2 + 3 * G + 1 else (G + 1)^2
|
| 136 |
+
|
| 137 |
+
def diagonalGeometricMass (G : ℝ) : ℝ := G * (G + 1)
|
| 138 |
+
|
| 139 |
+
lemma derivative_normal_weight (G : ℝ) (hG : 0 < G) (collision : Bool) :
|
| 140 |
+
normalGeometricMass true G collision / G^2 =
|
| 141 |
+
1 + (G / (G + 1))⁻¹ * (if collision then 1 else 0) := by
|
| 142 |
+
have h0 : G ≠ 0 := ne_of_gt hG
|
| 143 |
+
have h1 : G + 1 ≠ 0 := ne_of_gt (by linarith)
|
| 144 |
+
cases collision <;> simp [normalGeometricMass, h0]
|
| 145 |
+
all_goals field_simp
|
| 146 |
+
all_goals ring
|
| 147 |
+
|
| 148 |
+
lemma multiplication_normal_weight (G : ℝ) (hG : 0 ≤ G) (collision : Bool) :
|
| 149 |
+
normalGeometricMass false G collision / (G + 1)^2 =
|
| 150 |
+
1 + (G / (G + 1)) * (if collision then 1 else 0) := by
|
| 151 |
+
have h1 : G + 1 ≠ 0 := ne_of_gt (by linarith)
|
| 152 |
+
cases collision <;> simp [normalGeometricMass, h1]
|
| 153 |
+
all_goals field_simp
|
| 154 |
+
all_goals ring
|
| 155 |
+
|
| 156 |
+
lemma derivative_diagonal_weight (G : ℝ) (hG : 0 < G) :
|
| 157 |
+
diagonalGeometricMass G / G^2 = (G / (G + 1))⁻¹ := by
|
| 158 |
+
have h0 : G ≠ 0 := ne_of_gt hG
|
| 159 |
+
have h1 : G + 1 ≠ 0 := ne_of_gt (by linarith)
|
| 160 |
+
unfold diagonalGeometricMass
|
| 161 |
+
field_simp
|
| 162 |
+
|
| 163 |
+
lemma multiplication_diagonal_weight (G : ℝ) (hG : 0 ≤ G) :
|
| 164 |
+
diagonalGeometricMass G / (G + 1)^2 = G / (G + 1) := by
|
| 165 |
+
have h1 : G + 1 ≠ 0 := ne_of_gt (by linarith)
|
| 166 |
+
unfold diagonalGeometricMass
|
| 167 |
+
field_simp
|
| 168 |
+
|
| 169 |
+
end LocalMoments
|
| 170 |
+
end Problem335
|
| 171 |
+
|
| 172 |
+
end
|
| 173 |
+
|
| 174 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/LocalMomentWeights.lean
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
/-! Normalization of the local geometric occupation moments in the four-path
|
| 6 |
+
trace expansion. Missing derivative occupations are handled by local-polynomial
|
| 7 |
+
identities, preserving the repeated-coordinate second moment rather than
|
| 8 |
+
treating it as a product of independent moments. -/
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
|
| 13 |
+
namespace Problem335.LocalMomentWeights
|
| 14 |
+
|
| 15 |
+
/-- `isD` denotes the nonzero-difference pairing. `same` is relevant only in
|
| 16 |
+
its complementary pairing, where the two selected coordinates may coincide. -/
|
| 17 |
+
def moment (isV isD same : Bool) (A B : ℝ) : ℝ :=
|
| 18 |
+
if isV then
|
| 19 |
+
if isD then A * (A + 1) else if same then 2 * A ^ 2 + A else A ^ 2
|
| 20 |
+
else
|
| 21 |
+
if isD then B * (B + 1) else if same then 2 * B ^ 2 + 3 * B + 1
|
| 22 |
+
else (B + 1) ^ 2
|
| 23 |
+
|
| 24 |
+
/-- The square of the first-moment factor at a layer. -/
|
| 25 |
+
def scale (isV : Bool) (A B : ℝ) : ℝ :=
|
| 26 |
+
if isV then A ^ 2 else (B + 1) ^ 2
|
| 27 |
+
|
| 28 |
+
/-- The exact local weights after division by the first-moment square. -/
|
| 29 |
+
def weight (isV isD same : Bool) (alpha beta : ℝ) : ℝ :=
|
| 30 |
+
if isV then
|
| 31 |
+
if isD then alpha⁻¹ else 1 + if same then alpha⁻¹ else 0
|
| 32 |
+
else
|
| 33 |
+
if isD then beta else 1 + if same then beta else 0
|
| 34 |
+
|
| 35 |
+
lemma scale_pos (isV : Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) :
|
| 36 |
+
0 < scale isV A B := by
|
| 37 |
+
cases isV <;> simp only [scale, Bool.false_eq_true, ↓reduceIte] <;> positivity
|
| 38 |
+
|
| 39 |
+
lemma weight_nonneg (isV isD same : Bool) {alpha beta : ℝ}
|
| 40 |
+
(ha : 0 < alpha) (hb : 0 ≤ beta) : 0 ≤ weight isV isD same alpha beta := by
|
| 41 |
+
cases isV <;> cases isD <;> cases same <;> simp [weight] <;> positivity
|
| 42 |
+
|
| 43 |
+
/-- Repeated-coordinate geometric second moments give the additional term
|
| 44 |
+
`alpha⁻¹` or `beta` exactly. -/
|
| 45 |
+
theorem moment_eq_scale_mul_weight (isV isD same : Bool) {A B : ℝ}
|
| 46 |
+
(hA : 0 < A) (hB : 0 ≤ B) :
|
| 47 |
+
moment isV isD same A B =
|
| 48 |
+
scale isV A B * weight isV isD same (A / (A + 1)) (B / (B + 1)) := by
|
| 49 |
+
have hA0 : A ≠ 0 := ne_of_gt hA
|
| 50 |
+
have hAp : A + 1 ≠ 0 := by linarith
|
| 51 |
+
have hBp : B + 1 ≠ 0 := by linarith
|
| 52 |
+
cases isV <;> cases isD <;> cases same <;>
|
| 53 |
+
simp [moment, scale, weight] <;> field_simp <;> ring
|
| 54 |
+
|
| 55 |
+
lemma moment_div_scale (isV isD same : Bool) {A B : ℝ}
|
| 56 |
+
(hA : 0 < A) (hB : 0 ≤ B) :
|
| 57 |
+
moment isV isD same A B / scale isV A B =
|
| 58 |
+
weight isV isD same (A / (A + 1)) (B / (B + 1)) := by
|
| 59 |
+
rw [moment_eq_scale_mul_weight _ _ _ hA hB]
|
| 60 |
+
exact mul_div_cancel_left₀ _ (scale_pos isV hA hB).ne'
|
| 61 |
+
|
| 62 |
+
/-- The normalized means agree with the original degree/cardinality ratios. -/
|
| 63 |
+
lemma mean_ratio {a v : ℝ} (hv : 0 < v) (ha : 0 ≤ a) :
|
| 64 |
+
(a / v) / (a / v + 1) = a / (a + v) := by
|
| 65 |
+
have hv0 : v ≠ 0 := ne_of_gt hv
|
| 66 |
+
have hap : a + v ≠ 0 := by linarith
|
| 67 |
+
field_simp
|
| 68 |
+
|
| 69 |
+
/-- A pointwise normalization can be factored out of the entire layer product. -/
|
| 70 |
+
theorem prod_moment_eq {ι : Type*} (s : Finset ι)
|
| 71 |
+
(isV isD same : ι → Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) :
|
| 72 |
+
(∏ i ∈ s, moment (isV i) (isD i) (same i) A B) =
|
| 73 |
+
(∏ i ∈ s, scale (isV i) A B) *
|
| 74 |
+
∏ i ∈ s, weight (isV i) (isD i) (same i) (A / (A + 1)) (B / (B + 1)) := by
|
| 75 |
+
simp_rw [moment_eq_scale_mul_weight _ _ _ hA hB]
|
| 76 |
+
exact Finset.prod_mul_distrib
|
| 77 |
+
|
| 78 |
+
/-- The product of the local normalization factors is exactly `mu^2`. -/
|
| 79 |
+
theorem prod_scale_eq {ι : Type*} (s : Finset ι) (isV : ι → Bool) (A B : ℝ) :
|
| 80 |
+
(∏ i ∈ s, scale (isV i) A B) =
|
| 81 |
+
(A ^ (s.filter (fun i => isV i = true)).card *
|
| 82 |
+
(B + 1) ^ (s.filter (fun i => isV i = false)).card) ^ 2 := by
|
| 83 |
+
classical
|
| 84 |
+
simp only [scale]
|
| 85 |
+
rw [Finset.prod_ite]
|
| 86 |
+
simp only [Finset.prod_const]
|
| 87 |
+
have hfilter : s.filter (fun i => ¬isV i = true) =
|
| 88 |
+
s.filter (fun i => isV i = false) := by
|
| 89 |
+
ext i
|
| 90 |
+
cases isV i <;> simp
|
| 91 |
+
rw [hfilter, mul_pow]
|
| 92 |
+
congr 1 <;> rw [← pow_mul, ← pow_mul] <;> congr 1 <;> omega
|
| 93 |
+
|
| 94 |
+
/-- Full local-weight normalization for a fixed four-path pairing pattern. -/
|
| 95 |
+
theorem prod_moment_eq_mu_sq_mul {ι : Type*} (s : Finset ι)
|
| 96 |
+
(isV isD same : ι → Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) :
|
| 97 |
+
(∏ i ∈ s, moment (isV i) (isD i) (same i) A B) =
|
| 98 |
+
(A ^ (s.filter (fun i => isV i = true)).card *
|
| 99 |
+
(B + 1) ^ (s.filter (fun i => isV i = false)).card) ^ 2 *
|
| 100 |
+
∏ i ∈ s, weight (isV i) (isD i) (same i) (A / (A + 1)) (B / (B + 1)) := by
|
| 101 |
+
rw [prod_moment_eq s isV isD same hA hB, prod_scale_eq]
|
| 102 |
+
|
| 103 |
+
end Problem335.LocalMomentWeights
|
| 104 |
+
|
| 105 |
+
end
|
| 106 |
+
|
| 107 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/LocalOccupationAverage.lean
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.FactorialPositive
|
| 2 |
+
import OAI.Algebra.DepthFive.OccupationExpansion
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
|
| 9 |
+
namespace Problem335
|
| 10 |
+
|
| 11 |
+
variable {σ : Type*} [Fintype σ]
|
| 12 |
+
|
| 13 |
+
/-- Reassemble two occupation vectors on the complementary variable classes. -/
|
| 14 |
+
def joinOccupation (side : σ → Bool)
|
| 15 |
+
(M : {i // side i = true} → ℕ) (N : {i // ¬ side i = true} → ℕ) : σ → ℕ :=
|
| 16 |
+
fun i => if h : side i = true then M ⟨i, h⟩ else N ⟨i, h⟩
|
| 17 |
+
|
| 18 |
+
omit [Fintype σ] in
|
| 19 |
+
@[simp] theorem joinOccupation_true (side : σ → Bool)
|
| 20 |
+
(M : {i // side i = true} → ℕ) (N : {i // ¬ side i = true} → ℕ)
|
| 21 |
+
(i : {i // side i = true}) : joinOccupation side M N i = M i := by
|
| 22 |
+
simp [joinOccupation, i.property]
|
| 23 |
+
|
| 24 |
+
omit [Fintype σ] in
|
| 25 |
+
@[simp] theorem joinOccupation_false (side : σ → Bool)
|
| 26 |
+
(M : {i // side i = true} → ℕ) (N : {i // ¬ side i = true} → ℕ)
|
| 27 |
+
(i : {i // ¬ side i = true}) : joinOccupation side M N i = N i := by
|
| 28 |
+
simp [joinOccupation, i.property]
|
| 29 |
+
|
| 30 |
+
theorem factorialMonomial_joinOccupation (side : σ → Bool) (d : σ → ℕ)
|
| 31 |
+
(M : {i // side i = true} → ℕ) (N : {i // ¬ side i = true} → ℕ) :
|
| 32 |
+
factorialMonomial d (joinOccupation side M N) =
|
| 33 |
+
(∏ i, (M i).descFactorial (d i)) * (∏ i, (N i).descFactorial (d i)) := by
|
| 34 |
+
classical
|
| 35 |
+
unfold factorialMonomial
|
| 36 |
+
rw [← Fintype.prod_subtype_mul_prod_subtype (fun i => side i = true)]
|
| 37 |
+
simp
|
| 38 |
+
|
| 39 |
+
variable [DecidableEq σ]
|
| 40 |
+
|
| 41 |
+
/-- The actual finite uniform average, not an assumed moment functional. -/
|
| 42 |
+
def partitionCompositionMean (side : σ → Bool) (f : (σ → ℕ) → ℝ) (a b : ℕ) : ℝ := by
|
| 43 |
+
classical
|
| 44 |
+
exact (∑ M ∈ Finset.finsuppAntidiag (Finset.univ : Finset {i // side i = true}) a,
|
| 45 |
+
(∑ N ∈ Finset.finsuppAntidiag (Finset.univ : Finset {i // ¬ side i = true}) b,
|
| 46 |
+
f (joinOccupation side M N)) /
|
| 47 |
+
(Finset.finsuppAntidiag (Finset.univ : Finset {i // ¬ side i = true}) b).card) /
|
| 48 |
+
(Finset.finsuppAntidiag (Finset.univ : Finset {i // side i = true}) a).card
|
| 49 |
+
|
| 50 |
+
namespace FactorialExpansion
|
| 51 |
+
variable {f : (σ → ℕ) → ℕ} {S : Finset σ} {D : ℕ}
|
| 52 |
+
|
| 53 |
+
theorem partitionCompositionMean_eq (F : FactorialExpansion f S D)
|
| 54 |
+
(side : σ → Bool) (a b : ℕ) :
|
| 55 |
+
Problem335.partitionCompositionMean side (fun M => (f M : ℝ)) a b =
|
| 56 |
+
twoGroupCompositionExpansionMean Finset.univ (fun j => (F.coeff j : ℝ))
|
| 57 |
+
(fun j (i : {i // side i = true}) => F.degree j i)
|
| 58 |
+
(fun j (i : {i // ¬ side i = true}) => F.degree j i) a b := by
|
| 59 |
+
classical
|
| 60 |
+
unfold Problem335.partitionCompositionMean twoGroupCompositionExpansionMean
|
| 61 |
+
compositionExpansionMean factorialExpansionValue
|
| 62 |
+
apply congrArg (fun x : ℝ => x / _)
|
| 63 |
+
apply Finset.sum_congr rfl
|
| 64 |
+
intro M hM
|
| 65 |
+
apply congrArg (fun x : ℝ => x / _)
|
| 66 |
+
apply Finset.sum_congr rfl
|
| 67 |
+
intro N hN
|
| 68 |
+
dsimp only
|
| 69 |
+
rw [F.eval_real]
|
| 70 |
+
apply Finset.sum_congr rfl
|
| 71 |
+
intro j hj
|
| 72 |
+
rw [factorialMonomial_joinOccupation]
|
| 73 |
+
push_cast
|
| 74 |
+
ring
|
| 75 |
+
|
| 76 |
+
omit [DecidableEq σ] in
|
| 77 |
+
/-- The two means give one coordinate-wise geometric factorial monomial. -/
|
| 78 |
+
theorem partition_geometric_monomial (side : σ → Bool) (d : σ → ℕ) (A B : ℝ) :
|
| 79 |
+
(∏ i, (d i).factorial * (if side i = true then A else B) ^ d i : ℝ) =
|
| 80 |
+
(∏ i : {i // side i = true}, ((d i).factorial : ℝ)) *
|
| 81 |
+
(∏ i : {i // ¬ side i = true}, ((d i).factorial : ℝ)) *
|
| 82 |
+
(A ^ (∑ i : {i // side i = true}, d i) *
|
| 83 |
+
B ^ (∑ i : {i // ¬ side i = true}, d i)) := by
|
| 84 |
+
classical
|
| 85 |
+
rw [← Fintype.prod_subtype_mul_prod_subtype (fun i => side i = true)]
|
| 86 |
+
have hV (i : {i // side i = true}) : (if side i = true then A else B) = A :=
|
| 87 |
+
ite_eq_left i.property
|
| 88 |
+
have hU (i : {i // ¬ side i = true}) : (if side i = true then A else B) = B :=
|
| 89 |
+
ite_eq_right i.property
|
| 90 |
+
simp_rw [hV, hU]
|
| 91 |
+
simp only [Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum]
|
| 92 |
+
ring
|
| 93 |
+
|
| 94 |
+
/-- Upper occupation comparison for every concrete nonnegative factorial expansion.
|
| 95 |
+
No total-order restriction is necessary for this upper bound. -/
|
| 96 |
+
theorem partitionCompositionMean_le (F : FactorialExpansion f S D)
|
| 97 |
+
(side : σ → Bool) [Nonempty {i // side i = true}] [Nonempty {i // ¬ side i = true}]
|
| 98 |
+
(a b : ℕ) :
|
| 99 |
+
Problem335.partitionCompositionMean side (fun M => (f M : ℝ)) a b ≤
|
| 100 |
+
∑ j, (F.coeff j : ℝ) * ∏ i, ((F.degree j i).factorial : ℝ) *
|
| 101 |
+
(if side i = true then (a : ℝ) / Fintype.card {i // side i = true}
|
| 102 |
+
else (b : ℝ) / Fintype.card {i // ¬ side i = true}) ^ F.degree j i := by
|
| 103 |
+
classical
|
| 104 |
+
rw [F.partitionCompositionMean_eq]
|
| 105 |
+
have h := twoGroupCompositionExpansionMean_le_geometric Finset.univ
|
| 106 |
+
(fun j => (F.coeff j : ℝ))
|
| 107 |
+
(fun j (i : {i // side i = true}) => F.degree j i)
|
| 108 |
+
(fun j (i : {i // ¬ side i = true}) => F.degree j i) a b
|
| 109 |
+
(by intro j hj; positivity)
|
| 110 |
+
refine h.trans_eq ?_
|
| 111 |
+
unfold twoGroupGeometricExpansionValue
|
| 112 |
+
apply Finset.sum_congr rfl
|
| 113 |
+
intro j hj
|
| 114 |
+
rw [partition_geometric_monomial]
|
| 115 |
+
ring
|
| 116 |
+
|
| 117 |
+
end FactorialExpansion
|
| 118 |
+
end Problem335
|
| 119 |
+
|
| 120 |
+
end
|
| 121 |
+
|
| 122 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/LocalProductAverage.lean
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.LocalOccupationAverage
|
| 2 |
+
import OAI.Algebra.DepthFive.FactorialGeometricValue
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
|
| 9 |
+
namespace Problem335
|
| 10 |
+
namespace LocalMoments
|
| 11 |
+
|
| 12 |
+
variable {σ ι : Type*} [Fintype σ] [DecidableEq σ]
|
| 13 |
+
|
| 14 |
+
/-- The actual occupation average of the full local four-path table is bounded
|
| 15 |
+
by the product of its independent geometric local moments. -/
|
| 16 |
+
theorem partitionCompositionMean_localProduct_le
|
| 17 |
+
(side : σ → Bool) [Nonempty {i // side i = true}] [Nonempty {i // ¬ side i = true}]
|
| 18 |
+
(a b : ℕ) (layers : Finset ι) (derivative : ι → Bool) (p q r : ι → σ)
|
| 19 |
+
(hp : ∀ t ∈ layers, side (p t) = derivative t)
|
| 20 |
+
(hq : ∀ t ∈ layers, side (q t) = derivative t)
|
| 21 |
+
(hr : ∀ t ∈ layers, side (r t) = derivative t)
|
| 22 |
+
(hdis : (layers : Set ι).Pairwise fun i j =>
|
| 23 |
+
Disjoint ({p i, q i, r i} : Finset σ) {p j, q j, r j}) :
|
| 24 |
+
partitionCompositionMean side
|
| 25 |
+
(fun M => ∏ t ∈ layers, localPolynomial (derivative t) M (p t) (q t) (r t)) a b ≤
|
| 26 |
+
∏ t ∈ layers, localGeometricMass (derivative t)
|
| 27 |
+
(if derivative t = true then (a : ℝ) / Fintype.card {i // side i = true}
|
| 28 |
+
else (b : ℝ) / Fintype.card {i // ¬ side i = true}) (p t) (q t) (r t) := by
|
| 29 |
+
classical
|
| 30 |
+
let G : σ → ℝ := fun i =>
|
| 31 |
+
if side i = true then (a : ℝ) / Fintype.card {i // side i = true}
|
| 32 |
+
else (b : ℝ) / Fintype.card {i // ¬ side i = true}
|
| 33 |
+
let g : ι → ℝ := fun t =>
|
| 34 |
+
if derivative t = true then (a : ℝ) / Fintype.card {i // side i = true}
|
| 35 |
+
else (b : ℝ) / Fintype.card {i // ¬ side i = true}
|
| 36 |
+
obtain ⟨F, hF⟩ := exists_localProduct_geometricValue_of_eq layers derivative p q r G g
|
| 37 |
+
(by intro t ht; simp only [G, g, hp t ht])
|
| 38 |
+
(by intro t ht; simp only [G, g, hq t ht])
|
| 39 |
+
(by intro t ht; simp only [G, g, hr t ht]) hdis
|
| 40 |
+
have hmean := F.partitionCompositionMean_le side a b
|
| 41 |
+
change partitionCompositionMean side
|
| 42 |
+
(fun M => (localProductNat layers derivative p q r M : ℝ)) a b ≤ F.geometricValue G at hmean
|
| 43 |
+
rw [hF] at hmean
|
| 44 |
+
simpa only [localProductNat_cast] using hmean
|
| 45 |
+
|
| 46 |
+
/-- Specialization to the matrix-layer coordinate shape: disjoint supports and
|
| 47 |
+
the common local mean are automatic, not additional analytic assumptions. -/
|
| 48 |
+
theorem partitionCompositionMean_layered_localProduct_le
|
| 49 |
+
{κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ]
|
| 50 |
+
(derivative : ι → Bool)
|
| 51 |
+
[Nonempty {x : ι × κ // derivative x.1 = true}]
|
| 52 |
+
[Nonempty {x : ι × κ // ¬ derivative x.1 = true}]
|
| 53 |
+
(a b : ℕ) (layers : Finset ι) (p q r : ι → κ) :
|
| 54 |
+
partitionCompositionMean (fun x : ι × κ => derivative x.1)
|
| 55 |
+
(fun M => ∏ t ∈ layers, localPolynomial (derivative t) M
|
| 56 |
+
(t, p t) (t, q t) (t, r t)) a b ≤
|
| 57 |
+
∏ t ∈ layers, localGeometricMass (derivative t)
|
| 58 |
+
(if derivative t = true then
|
| 59 |
+
(a : ℝ) / Fintype.card {x : ι × κ // derivative x.1 = true}
|
| 60 |
+
else (b : ℝ) / Fintype.card {x : ι × κ // ¬ derivative x.1 = true})
|
| 61 |
+
(t, p t) (t, q t) (t, r t) := by
|
| 62 |
+
apply partitionCompositionMean_localProduct_le (fun x : ι × κ => derivative x.1)
|
| 63 |
+
a b layers derivative (fun t => (t, p t)) (fun t => (t, q t)) (fun t => (t, r t))
|
| 64 |
+
· intros; rfl
|
| 65 |
+
· intros; rfl
|
| 66 |
+
· intros; rfl
|
| 67 |
+
· exact layered_support_disjoint layers p q r
|
| 68 |
+
|
| 69 |
+
/-- Coordinate-form conversion to the local table used in the four-path identity. -/
|
| 70 |
+
@[simp] theorem localPolynomial_layered {κ : Type*} [DecidableEq ι] [DecidableEq κ]
|
| 71 |
+
(d : Bool) (M : ι × κ → ℕ) (t : ι) (p q r : κ) :
|
| 72 |
+
localPolynomial d M (t, p) (t, q) (t, r) =
|
| 73 |
+
localPolynomial d (fun x => M (t, x)) p q r := by
|
| 74 |
+
simp [localPolynomial]
|
| 75 |
+
|
| 76 |
+
@[simp] theorem localGeometricMass_layered {κ : Type*} [DecidableEq ι] [DecidableEq κ]
|
| 77 |
+
(d : Bool) (G : ℝ) (t : ι) (p q r : κ) :
|
| 78 |
+
localGeometricMass d G (t, p) (t, q) (t, r) = localGeometricMass d G p q r := by
|
| 79 |
+
simp [localGeometricMass]
|
| 80 |
+
|
| 81 |
+
/-- Row-restriction presentation matching the actual four-path local table directly. -/
|
| 82 |
+
theorem partitionCompositionMean_layered_restrict_le
|
| 83 |
+
{κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ]
|
| 84 |
+
(derivative : ι → Bool)
|
| 85 |
+
[Nonempty {x : ι × κ // derivative x.1 = true}]
|
| 86 |
+
[Nonempty {x : ι × κ // ¬ derivative x.1 = true}]
|
| 87 |
+
(a b : ℕ) (layers : Finset ι) (p q r : ι → κ) :
|
| 88 |
+
partitionCompositionMean (fun x : ι × κ => derivative x.1)
|
| 89 |
+
(fun M => ∏ t ∈ layers, localPolynomial (derivative t) (fun x => M (t, x))
|
| 90 |
+
(p t) (q t) (r t)) a b ≤
|
| 91 |
+
∏ t ∈ layers, localGeometricMass (derivative t)
|
| 92 |
+
(if derivative t = true then
|
| 93 |
+
(a : ℝ) / Fintype.card {x : ι × κ // derivative x.1 = true}
|
| 94 |
+
else (b : ℝ) / Fintype.card {x : ι × κ // ¬ derivative x.1 = true})
|
| 95 |
+
(p t) (q t) (r t) := by
|
| 96 |
+
simpa only [localPolynomial_layered, localGeometricMass_layered] using
|
| 97 |
+
partitionCompositionMean_layered_localProduct_le derivative a b layers p q r
|
| 98 |
+
|
| 99 |
+
end LocalMoments
|
| 100 |
+
end Problem335
|
| 101 |
+
|
| 102 |
+
end
|
| 103 |
+
|
| 104 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/LowDegreeWeights.lean
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.DegreeWeight
|
| 2 |
+
import OAI.Algebra.DepthFive.DegreeProductBounds
|
| 3 |
+
import OAI.Algebra.DepthFive.SmallDegreeCorrections
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
noncomputable section
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
namespace Problem335
|
| 10 |
+
|
| 11 |
+
lemma degreeWeight_nonneg {q : ℝ} (hq : 0 ≤ q) (lam : ℝ) (e : ℕ) :
|
| 12 |
+
0 ≤ degreeWeight q lam e :=
|
| 13 |
+
Finset.sum_nonneg (fun _ _ => Real.rpow_nonneg hq _)
|
| 14 |
+
|
| 15 |
+
lemma degreeWeight_le_five_mul_distance {q : ℝ} (hq : 0 < q) (hqhalf : q ≤ 1 / 2)
|
| 16 |
+
(lam : ℝ) (e : ℕ) :
|
| 17 |
+
degreeWeight q lam e ≤ 5 * q ^ nearestIntegerDistance (lam * e) := by
|
| 18 |
+
have hq1 : q ≤ 1 := by linarith
|
| 19 |
+
have hd := nearestIntegerDistance_le_half (lam * e)
|
| 20 |
+
have htail := Real.rpow_le_one hq.le hq1
|
| 21 |
+
(show 0 ≤ 1 - 2 * nearestIntegerDistance (lam * e) by linarith)
|
| 22 |
+
calc
|
| 23 |
+
degreeWeight q lam e ≤ q ^ nearestIntegerDistance (lam * e) *
|
| 24 |
+
(1 + 4 * q ^ (1 - 2 * nearestIntegerDistance (lam * e))) :=
|
| 25 |
+
degreeWeight_le_nearest hq hqhalf lam e
|
| 26 |
+
_ ≤ q ^ nearestIntegerDistance (lam * e) * 5 :=
|
| 27 |
+
mul_le_mul_of_nonneg_left (by linarith) (Real.rpow_nonneg hq.le _)
|
| 28 |
+
_ = _ := mul_comm _ _
|
| 29 |
+
|
| 30 |
+
lemma low_odd_degreeWeight_le {n s q : ℝ} (hn : 0 < n) (hs : 0 < s)
|
| 31 |
+
(hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1)
|
| 32 |
+
{e : ℕ} (he : 0 < e) (helow : (e : ℝ) < n / (4 * s)) (hodd : Odd e) :
|
| 33 |
+
degreeWeight q (1 / 2 - s / (2 * n)) e ≤ q ^ (degreeDistance n s e / 2) := by
|
| 34 |
+
have hq1 : q ≤ 1 := by linarith
|
| 35 |
+
have hd := degreeDistance_odd_ge hn hs he helow hodd
|
| 36 |
+
have hp : q ^ (degreeDistance n s e / 2) ≤ q ^ ((3 : ℝ) / 16) :=
|
| 37 |
+
Real.rpow_le_rpow_of_exponent_ge hq hq1 (by linarith)
|
| 38 |
+
have hp5 : 5 * q ^ (degreeDistance n s e / 2) ≤ 1 :=
|
| 39 |
+
(mul_le_mul_of_nonneg_left hp (by norm_num)).trans hqsmall
|
| 40 |
+
have hbound := degreeWeight_le_five_mul_distance hq hqhalf (1 / 2 - s / (2 * n)) e
|
| 41 |
+
change degreeWeight q (1 / 2 - s / (2 * n)) e ≤ 5 * q ^ degreeDistance n s e at hbound
|
| 42 |
+
calc
|
| 43 |
+
degreeWeight q (1 / 2 - s / (2 * n)) e ≤ 5 * q ^ degreeDistance n s e := hbound
|
| 44 |
+
_ = (5 * q ^ (degreeDistance n s e / 2)) * q ^ (degreeDistance n s e / 2) := by
|
| 45 |
+
rw [mul_assoc, ← Real.rpow_add hq]
|
| 46 |
+
congr 2
|
| 47 |
+
ring
|
| 48 |
+
_ ≤ 1 * q ^ (degreeDistance n s e / 2) :=
|
| 49 |
+
mul_le_mul_of_nonneg_right hp5 (Real.rpow_nonneg hq.le _)
|
| 50 |
+
_ = _ := one_mul _
|
| 51 |
+
|
| 52 |
+
lemma low_even_degreeWeight_le {n s q : ℝ} (hn : 0 < n) (hs : 0 < s)
|
| 53 |
+
(hq : 0 < q) (hqhalf : q ≤ 1 / 2)
|
| 54 |
+
{e : ℕ} (he : 0 < e) (helow : (e : ℝ) < n / (4 * s)) (heven : Even e) :
|
| 55 |
+
degreeWeight q (1 / 2 - s / (2 * n)) e ≤
|
| 56 |
+
q ^ degreeDistance n s e * Real.exp (4 * q ^ (1 - s * e / n)) := by
|
| 57 |
+
have hbound := degreeWeight_le_nearest hq hqhalf (1 / 2 - s / (2 * n)) e
|
| 58 |
+
change degreeWeight q (1 / 2 - s / (2 * n)) e ≤ q ^ degreeDistance n s e *
|
| 59 |
+
(1 + 4 * q ^ (1 - 2 * degreeDistance n s e)) at hbound
|
| 60 |
+
have hexponent : 1 - 2 * degreeDistance n s e = 1 - s * e / n := by
|
| 61 |
+
rw [degreeDistance_even hn hs he helow heven]
|
| 62 |
+
ring
|
| 63 |
+
rw [hexponent] at hbound
|
| 64 |
+
exact hbound.trans (mul_le_mul_of_nonneg_left
|
| 65 |
+
(by linarith [Real.add_one_le_exp (4 * q ^ (1 - s * e / n))])
|
| 66 |
+
(Real.rpow_nonneg hq.le _))
|
| 67 |
+
|
| 68 |
+
lemma low_degreeWeight_le_with_correction {n s q : ℝ} (hn : 0 < n) (hs : 0 < s)
|
| 69 |
+
(hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1)
|
| 70 |
+
{e : ℕ} (he : 0 < e) (helow : (e : ℝ) < n / (4 * s)) :
|
| 71 |
+
degreeWeight q (1 / 2 - s / (2 * n)) e ≤
|
| 72 |
+
q ^ (degreeDistance n s e / 2) * Real.exp (4 * q ^ (1 - s * e / n)) := by
|
| 73 |
+
have hq1 : q ≤ 1 := by linarith
|
| 74 |
+
rcases Nat.even_or_odd e with heven | hodd
|
| 75 |
+
· refine (low_even_degreeWeight_le hn hs hq hqhalf he helow heven).trans ?_
|
| 76 |
+
apply mul_le_mul_of_nonneg_right _ (Real.exp_pos _).le
|
| 77 |
+
apply Real.rpow_le_rpow_of_exponent_ge hq hq1
|
| 78 |
+
have hd : 0 ≤ degreeDistance n s e := nearestIntegerDistance_nonneg _
|
| 79 |
+
linarith
|
| 80 |
+
· refine (low_odd_degreeWeight_le hn hs hq hqhalf hqsmall he helow hodd).trans ?_
|
| 81 |
+
have hexp : 1 ≤ Real.exp (4 * q ^ (1 - s * e / n)) :=
|
| 82 |
+
Real.one_le_exp_iff.mpr (by positivity)
|
| 83 |
+
simpa only [mul_one] using mul_le_mul_of_nonneg_left hexp
|
| 84 |
+
(Real.rpow_nonneg hq.le (degreeDistance n s e / 2))
|
| 85 |
+
|
| 86 |
+
/-- The actual factor weights, rather than hypothetical costs, give the
|
| 87 |
+
all-low product saving in the circuit argument. -/
|
| 88 |
+
theorem low_degreeWeight_product_bound {ι : Type*} (I : Finset ι) (e : ι → ℕ)
|
| 89 |
+
{n s q : ℝ} (hn : 1 ≤ n) (hs : 0 < s)
|
| 90 |
+
(hslo : Real.sqrt n / 2 ≤ s) (hshi : s ≤ Real.sqrt n)
|
| 91 |
+
(hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsqrt : q ≤ 2 / Real.sqrt n)
|
| 92 |
+
(hqpow : q ≤ n ^ (-(2 / 5 : ℝ))) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1)
|
| 93 |
+
(he : ∀ i ∈ I, 0 < e i) (helow : ∀ i ∈ I, (e i : ℝ) < n / (4 * s))
|
| 94 |
+
(hsum : ∑ i ∈ I, (e i : ℝ) = n) :
|
| 95 |
+
(∏ i ∈ I, degreeWeight q (1 / 2 - s / (2 * n)) (e i)) ≤
|
| 96 |
+
Real.exp (24 * Real.sqrt n) * n ^ (-Real.sqrt n / 20) := by
|
| 97 |
+
have hn0 : 0 < n := by linarith
|
| 98 |
+
have hq1 : q ≤ 1 := by linarith
|
| 99 |
+
have hcorr : (∑ i ∈ I, q ^ (1 - s * e i / n)) ≤ 6 * Real.sqrt n := by
|
| 100 |
+
apply sum_small_degree_corrections_le I n s q (fun i => (e i : ℝ))
|
| 101 |
+
hn0 hs.le hshi hq hq1 hqsqrt
|
| 102 |
+
· intro i hi
|
| 103 |
+
exact_mod_cast he i hi
|
| 104 |
+
· intro i hi
|
| 105 |
+
obtain ⟨_, h⟩ := low_degree_offset hn0 hs (he i hi) (helow i hi)
|
| 106 |
+
have hid : s * e i / n = 2 * (s * e i / (2 * n)) := by ring
|
| 107 |
+
rw [hid]
|
| 108 |
+
linarith
|
| 109 |
+
· exact hsum.le
|
| 110 |
+
apply all_low_degree_product_bound I e
|
| 111 |
+
(fun i => degreeWeight q (1 / 2 - s / (2 * n)) (e i))
|
| 112 |
+
(fun i => 4 * q ^ (1 - s * e i / n)) hn hs hslo hq hq1 hqpow he helow hsum
|
| 113 |
+
· exact fun i _ => degreeWeight_nonneg hq.le _ _
|
| 114 |
+
· exact fun i hi => low_degreeWeight_le_with_correction hn0 hs hq hqhalf hqsmall
|
| 115 |
+
(he i hi) (helow i hi)
|
| 116 |
+
· rw [← Finset.mul_sum]
|
| 117 |
+
linarith
|
| 118 |
+
|
| 119 |
+
end Problem335
|
| 120 |
+
|
| 121 |
+
end
|
| 122 |
+
|
| 123 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/LowerAsymptotics.lean
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
namespace Problem335
|
| 8 |
+
|
| 9 |
+
open Filter
|
| 10 |
+
|
| 11 |
+
/-- The numerical comparison in the lower-bound argument, with an explicit
|
| 12 |
+
sufficient logarithmic threshold. No algebraic complexity hypotheses enter here. -/
|
| 13 |
+
theorem size_lower_bound_of_rank_bounds
|
| 14 |
+
(x S D R C₁ C₂ : ℝ)
|
| 15 |
+
(hx : 1 ≤ x) (hS : 0 ≤ S) (hD : 0 < D)
|
| 16 |
+
(hlog : 400 * (|C₁| + |C₂| + 1) ≤ Real.log x)
|
| 17 |
+
(hlower : D * Real.exp (-C₁ * Real.sqrt x) ≤ R)
|
| 18 |
+
(hupper : R ≤ 2 * S ^ 2 * D * Real.exp (C₂ * Real.sqrt x) *
|
| 19 |
+
x ^ (-Real.sqrt x / 100)) :
|
| 20 |
+
x ^ (Real.sqrt x / 400) ≤ S := by
|
| 21 |
+
have hxpos : 0 < x := lt_of_lt_of_le zero_lt_one hx
|
| 22 |
+
have hbounds := hlower.trans hupper
|
| 23 |
+
have hleftpos : 0 < D * Real.exp (-C₁ * Real.sqrt x) :=
|
| 24 |
+
mul_pos hD (Real.exp_pos _)
|
| 25 |
+
have hSpos : 0 < S := by
|
| 26 |
+
by_contra h
|
| 27 |
+
have hzero : S = 0 := le_antisymm (le_of_not_gt h) hS
|
| 28 |
+
simp only [hzero, zero_pow (by decide : 2 ≠ 0), mul_zero, zero_mul] at hbounds
|
| 29 |
+
exact (not_le_of_gt hleftpos) hbounds
|
| 30 |
+
have hlogs := Real.log_le_log hleftpos hbounds
|
| 31 |
+
have hDne : D ≠ 0 := ne_of_gt hD
|
| 32 |
+
have hSne : S ≠ 0 := ne_of_gt hSpos
|
| 33 |
+
simp [Real.log_mul, Real.log_pow, Real.log_rpow hxpos,
|
| 34 |
+
hDne, hSne, ne_of_gt (Real.rpow_pos_of_pos hxpos (-Real.sqrt x / 100))] at hlogs
|
| 35 |
+
have hsqrt : 1 ≤ Real.sqrt x := Real.one_le_sqrt.mpr hx
|
| 36 |
+
have hlogtwo : Real.log 2 ≤ 1 := by
|
| 37 |
+
have := Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 2)
|
| 38 |
+
norm_num at this ⊢
|
| 39 |
+
exact this
|
| 40 |
+
have habs₁ := le_abs_self C₁
|
| 41 |
+
have habs₂ := le_abs_self C₂
|
| 42 |
+
have hnonneg₁ := abs_nonneg C₁
|
| 43 |
+
have hnonneg₂ := abs_nonneg C₂
|
| 44 |
+
have hslack : C₁ + C₂ + 1 ≤ Real.log x / 400 := by linarith
|
| 45 |
+
have hslackmul := mul_le_mul_of_nonneg_right hslack (Real.sqrt_nonneg x)
|
| 46 |
+
have hlognonneg : 0 ≤ Real.log x := Real.log_nonneg hx
|
| 47 |
+
have htarget : Real.sqrt x / 400 * Real.log x ≤ Real.log S := by
|
| 48 |
+
nlinarith
|
| 49 |
+
apply (Real.log_le_log_iff (Real.rpow_pos_of_pos hxpos _) hSpos).mp
|
| 50 |
+
rw [Real.log_rpow hxpos]
|
| 51 |
+
exact htarget
|
| 52 |
+
|
| 53 |
+
/-- Fixed exponential losses can be absorbed uniformly into the power saving.
|
| 54 |
+
The threshold is independent of `S`, `D`, and the rank value `R`. -/
|
| 55 |
+
theorem eventual_size_lower_bound_of_rank_bounds (C₁ C₂ : ℝ) :
|
| 56 |
+
∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n → ∀ S D R : ℝ,
|
| 57 |
+
0 ≤ S → 0 < D →
|
| 58 |
+
D * Real.exp (-C₁ * Real.sqrt (n : ℝ)) ≤ R →
|
| 59 |
+
R ≤ 2 * S ^ 2 * D * Real.exp (C₂ * Real.sqrt (n : ℝ)) *
|
| 60 |
+
(n : ℝ) ^ (-Real.sqrt (n : ℝ) / 100) →
|
| 61 |
+
(n : ℝ) ^ (Real.sqrt (n : ℝ) / 400) ≤ S := by
|
| 62 |
+
have hcast : Tendsto (fun n : ℕ => (n : ℝ)) atTop atTop :=
|
| 63 |
+
tendsto_natCast_atTop_atTop
|
| 64 |
+
have hlog := Real.tendsto_log_atTop.comp hcast
|
| 65 |
+
have hone : ∀ᶠ n : ℕ in atTop, (1 : ℝ) ≤ n :=
|
| 66 |
+
hcast.eventually (eventually_ge_atTop 1)
|
| 67 |
+
have hlarge : ∀ᶠ n : ℕ in atTop,
|
| 68 |
+
400 * (|C₁| + |C₂| + 1) ≤ Real.log (n : ℝ) :=
|
| 69 |
+
hlog.eventually (eventually_ge_atTop _)
|
| 70 |
+
obtain ⟨n₀, hn₀⟩ := eventually_atTop.mp (hone.and hlarge)
|
| 71 |
+
refine ⟨n₀, ?_⟩
|
| 72 |
+
intro n hn S D R hS hD hlower hupper
|
| 73 |
+
exact size_lower_bound_of_rank_bounds (n : ℝ) S D R C₁ C₂
|
| 74 |
+
(hn₀ n hn).1 hS hD (hn₀ n hn).2 hlower hupper
|
| 75 |
+
|
| 76 |
+
end Problem335
|
| 77 |
+
|
| 78 |
+
end
|
| 79 |
+
|
| 80 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/LowerBoundAssembly.lean
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ActualCircuitRank
|
| 2 |
+
import OAI.Algebra.DepthFive.ActualImmRank
|
| 3 |
+
import OAI.Algebra.DepthFive.LowerAsymptotics
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
/-! Circuit-size lower bounds from eventual rank and second-trace estimates
|
| 8 |
+
for the normalized IMM matrix. -/
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
|
| 12 |
+
namespace Problem335
|
| 13 |
+
|
| 14 |
+
open LowerParameters
|
| 15 |
+
|
| 16 |
+
/-- An eventual lower bound for the configured IMM rank, together with the
|
| 17 |
+
proved circuit upper bound, gives the exact complex circuit-size conclusion. -/
|
| 18 |
+
theorem complex_depth_five_lower_bound_of_eventual_rank_lower (C : ℝ)
|
| 19 |
+
(hlower : ∀ᶠ n : ℕ in Filter.atTop,
|
| 20 |
+
rankDimension n * Real.exp (-C * Real.sqrt (n : ℝ)) ≤
|
| 21 |
+
rankData n (imm ℂ n)) :
|
| 22 |
+
∃ n0 : ℕ, ∀ n : ℕ, n0 ≤ n → ∀ c : Depth5Circuit ℂ n,
|
| 23 |
+
circuitValue c = imm ℂ n →
|
| 24 |
+
(n : ℝ) ^ (Real.sqrt (n : ℝ) / 400) ≤ (circuitSize c : ℝ) := by
|
| 25 |
+
obtain ⟨Nlower, hNlower⟩ := Filter.eventually_atTop.mp hlower
|
| 26 |
+
obtain ⟨Nupper, hNupper⟩ := exists_rankData_circuit_upper_cutoff
|
| 27 |
+
obtain ⟨Nnumeric, hNnumeric⟩ :=
|
| 28 |
+
eventual_size_lower_bound_of_rank_bounds C (24 + 4 * Real.log 5)
|
| 29 |
+
refine ⟨max 4 (max Nlower (max Nupper Nnumeric)), ?_⟩
|
| 30 |
+
intro n hn c hc
|
| 31 |
+
have hn4 : 4 ≤ n := (le_max_left _ _).trans hn
|
| 32 |
+
have hnlo : Nlower ≤ n :=
|
| 33 |
+
(le_max_left _ _).trans ((le_max_right _ _).trans hn)
|
| 34 |
+
have hnup : Nupper ≤ n :=
|
| 35 |
+
(le_max_left _ _).trans
|
| 36 |
+
((le_max_right _ _).trans ((le_max_right _ _).trans hn))
|
| 37 |
+
have hnnum : Nnumeric ≤ n :=
|
| 38 |
+
(le_max_right _ _).trans
|
| 39 |
+
((le_max_right _ _).trans ((le_max_right _ _).trans hn))
|
| 40 |
+
apply hNnumeric n hnnum (circuitSize c) (rankDimension n)
|
| 41 |
+
(rankData n (imm ℂ n)) (Nat.cast_nonneg _) (rankDimension_pos hn4)
|
| 42 |
+
(hNlower n hnlo)
|
| 43 |
+
simpa only [hc] using hNupper n hnup c hc
|
| 44 |
+
|
| 45 |
+
/-- The second-trace bound, together with the first-trace and circuit
|
| 46 |
+
estimates, implies the complex circuit-size lower bound. -/
|
| 47 |
+
theorem complex_depth_five_lower_bound_of_eventual_second_trace (C : ℝ)
|
| 48 |
+
(hsecond : ∀ᶠ n : ℕ in Filter.atTop, ∀ hn : 16 ≤ n,
|
| 49 |
+
(((immNormalizedMatrix n
|
| 50 |
+
(balancedLayer (Nat.le_trans (by decide : 4 ≤ 16) hn)) (a n) (b n)).conjTranspose *
|
| 51 |
+
immNormalizedMatrix n
|
| 52 |
+
(balancedLayer (Nat.le_trans (by decide : 4 ≤ 16) hn)) (a n) (b n)) ^ 2).trace.re ≤
|
| 53 |
+
rankDimension n * rankMomentScale n ^ 2 *
|
| 54 |
+
Real.exp (C * Real.sqrt (n : ℝ))) :
|
| 55 |
+
∃ n0 : ℕ, ∀ n : ℕ, n0 ≤ n → ∀ c : Depth5Circuit ℂ n,
|
| 56 |
+
circuitValue c = imm ℂ n →
|
| 57 |
+
(n : ℝ) ^ (Real.sqrt (n : ℝ) / 400) ≤ (circuitSize c : ℝ) := by
|
| 58 |
+
apply complex_depth_five_lower_bound_of_eventual_rank_lower (128 + C)
|
| 59 |
+
filter_upwards [hsecond, Filter.eventually_ge_atTop 16] with n hn hlarge
|
| 60 |
+
simpa only [neg_mul] using
|
| 61 |
+
rankData_imm_lower_of_second_trace_bound hlarge C (hn hlarge)
|
| 62 |
+
|
| 63 |
+
end Problem335
|
| 64 |
+
|
| 65 |
+
end
|
| 66 |
+
|
| 67 |
+
end OAI
|
lean/OAI/Algebra/DepthFive/LowerCircuit.lean
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ActualProductRank
|
| 2 |
+
import OAI.Algebra.DepthFive.CircuitOutputDegree
|
| 3 |
+
import OAI.Algebra.DepthFive.ActualWeightParameters
|
| 4 |
+
import OAI.Algebra.DepthFive.ActualCircuitRank
|
| 5 |
+
|
| 6 |
+
/-! The actual mixed-product rank estimate and its depth-five circuit
|
| 7 |
+
reduction, with rounded parameter specialization and uniform eventual
|
| 8 |
+
admissibility. -/
|
lean/OAI/Algebra/DepthFive/LowerInfrastructure.lean
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.IntegerRank
|
| 2 |
+
import OAI.Algebra.DepthFive.TraceRank
|
| 3 |
+
import OAI.Algebra.DepthFive.MixedOperator
|
| 4 |
+
import OAI.Algebra.DepthFive.IteratedDerivative
|
| 5 |
+
import OAI.Algebra.DepthFive.OperatorRank
|
| 6 |
+
import OAI.Algebra.DepthFive.Bidegree
|
| 7 |
+
import OAI.Algebra.DepthFive.RankMeasure
|
| 8 |
+
import OAI.Algebra.DepthFive.CircuitDegreeBounds
|
| 9 |
+
import OAI.Algebra.DepthFive.CircuitStructure
|
| 10 |
+
import OAI.Algebra.DepthFive.GateSums
|
| 11 |
+
import OAI.Algebra.DepthFive.CircuitOutputDegree
|
| 12 |
+
import OAI.Algebra.DepthFive.LowerNumerics
|
| 13 |
+
import OAI.Algebra.DepthFive.LowerOperators
|
| 14 |
+
import OAI.Algebra.DepthFive.LowerCircuit
|
| 15 |
+
|
| 16 |
+
/-! Rank estimates for homogeneous depth-five circuits and iterated matrix multiplication. -/
|
lean/OAI/Algebra/DepthFive/LowerMoments.lean
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Algebra.DepthFive.ImmFirstMomentBound
|
| 2 |
+
import OAI.Algebra.DepthFive.LocalProductAverage
|
| 3 |
+
import OAI.Algebra.DepthFive.LocalMomentPairing
|
| 4 |
+
import OAI.Algebra.DepthFive.QuadPathReindex
|
| 5 |
+
import OAI.Algebra.DepthFive.ImmPairingCompatibility
|
| 6 |
+
import OAI.Algebra.DepthFive.ImmSecondLocalBound
|
| 7 |
+
import OAI.Algebra.DepthFive.ImmFiniteMatrix
|
| 8 |
+
import OAI.Algebra.DepthFive.FourPathTrace
|
| 9 |
+
import OAI.Algebra.DepthFive.FirstTraceBound
|
| 10 |
+
import OAI.Algebra.DepthFive.PathOccupationAverage
|
| 11 |
+
import OAI.Algebra.DepthFive.BidegreeOccupationSum
|
| 12 |
+
import OAI.Algebra.DepthFive.PairingPartition
|
| 13 |
+
import OAI.Algebra.DepthFive.PairingWeights
|
| 14 |
+
import OAI.Algebra.DepthFive.ExtendedLocalMoment
|
| 15 |
+
import OAI.Algebra.DepthFive.FactorialOccupation
|
| 16 |
+
import OAI.Algebra.DepthFive.FactorialGeometricValue
|
| 17 |
+
|
| 18 |
+
/-! Finite trace-moment estimates for iterated matrix multiplication. -/
|