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
Files changed (50)
- lean/OAI/Algebra/DepthFive/FourPathTrace.leanAdded+164
- lean/OAI/Algebra/DepthFive/FractionRounding.leanAdded+119
- lean/OAI/Algebra/DepthFive/GateCardinality.leanAdded+33
- lean/OAI/Algebra/DepthFive/GateSums.leanAdded+108
- lean/OAI/Algebra/DepthFive/HighDegreeWeights.leanAdded+143
- lean/OAI/Algebra/DepthFive/Homogeneity.leanAdded+86
- lean/OAI/Algebra/DepthFive/HomogeneousSpaceDimension.leanAdded+62
- lean/OAI/Algebra/DepthFive/ImmBidegree.leanAdded+46
- lean/OAI/Algebra/DepthFive/ImmBlocks.leanAdded+48
- lean/OAI/Algebra/DepthFive/ImmCompatibleTrace.leanAdded+62
- lean/OAI/Algebra/DepthFive/ImmDegree.leanAdded+166
- lean/OAI/Algebra/DepthFive/ImmFiniteMatrix.leanAdded+190
- lean/OAI/Algebra/DepthFive/ImmFirstMomentBound.leanAdded+59
- lean/OAI/Algebra/DepthFive/ImmFirstMomentParameters.leanAdded+64
- lean/OAI/Algebra/DepthFive/ImmFirstTrace.leanAdded+129
- lean/OAI/Algebra/DepthFive/ImmFockMatrix.leanAdded+161
- lean/OAI/Algebra/DepthFive/ImmMap.leanAdded+34
- lean/OAI/Algebra/DepthFive/ImmOperatorPaths.leanAdded+190
- lean/OAI/Algebra/DepthFive/ImmPairingCompatibility.leanAdded+50
- lean/OAI/Algebra/DepthFive/ImmPairingReindex.leanAdded+61
- lean/OAI/Algebra/DepthFive/ImmPathCompatibility.leanAdded+51
- lean/OAI/Algebra/DepthFive/ImmPathShifts.leanAdded+73
- lean/OAI/Algebra/DepthFive/ImmProfileCompatibility.leanAdded+38
- lean/OAI/Algebra/DepthFive/ImmSecondLocalBound.leanAdded+49
- lean/OAI/Algebra/DepthFive/ImmSecondMomentParameters.leanAdded+79
- lean/OAI/Algebra/DepthFive/ImmSecondTrace.leanAdded+184
- lean/OAI/Algebra/DepthFive/IndependentCoordinates.leanAdded+322
- lean/OAI/Algebra/DepthFive/IndexedCircuit.leanAdded+99
- lean/OAI/Algebra/DepthFive/IndexedCircuitValue.leanAdded+86
- lean/OAI/Algebra/DepthFive/Infrastructure.leanAdded+13
- lean/OAI/Algebra/DepthFive/IntegerRank.leanAdded+89
- lean/OAI/Algebra/DepthFive/IntermediateDimension.leanAdded+141
- lean/OAI/Algebra/DepthFive/IntermediateFactorization.leanAdded+176
- lean/OAI/Algebra/DepthFive/InvalidOccupation.leanAdded+80
- lean/OAI/Algebra/DepthFive/IsolatedFlip.leanAdded+257
- lean/OAI/Algebra/DepthFive/IsolatedWeight.leanAdded+380
- lean/OAI/Algebra/DepthFive/IteratedDerivative.leanAdded+56
- lean/OAI/Algebra/DepthFive/LayeredFourPath.leanAdded+114
- lean/OAI/Algebra/DepthFive/LocalFactorialExpansion.leanAdded+124
- lean/OAI/Algebra/DepthFive/LocalMomentPairing.leanAdded+75
- lean/OAI/Algebra/DepthFive/LocalMomentPolynomials.leanAdded+174
- lean/OAI/Algebra/DepthFive/LocalMomentWeights.leanAdded+107
- lean/OAI/Algebra/DepthFive/LocalOccupationAverage.leanAdded+122
- lean/OAI/Algebra/DepthFive/LocalProductAverage.leanAdded+104
- lean/OAI/Algebra/DepthFive/LowDegreeWeights.leanAdded+123
- lean/OAI/Algebra/DepthFive/LowerAsymptotics.leanAdded+80
- lean/OAI/Algebra/DepthFive/LowerBoundAssembly.leanAdded+67
- lean/OAI/Algebra/DepthFive/LowerCircuit.leanAdded+8
- lean/OAI/Algebra/DepthFive/LowerInfrastructure.leanAdded+16
- lean/OAI/Algebra/DepthFive/LowerMoments.leanAdded+18
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164import OAI.Algebra.DepthFive.TraceComplexification
namespace OAI
/-! Elimination of the second source index in the four-path trace formula. -/
noncomputable sectionopen scoped BigOperators
namespace Problem335
variable {I P G : Type*} [Fintype I] [AddCommGroup G] [DecidableEq G]
/-- Extending finite source weights by zero gives the unique weight at aspecified occupation vector; this lemma also handles invalid occupations. -/theorem sum_source_eq_zeroExtend {I : Type u_1} {G : Type u_3} [Fintype I] [AddCommGroup G] [DecidableEq G] (occupation : I → G) (hinj : Function.Injective occupation) (weight : I → ℝ) (x : G) : (∑ k, if occupation k = x then weight k else 0) = Function.extend occupation weight (fun _ => 0) x := by classical by_cases hx : ∃ k, occupation k = x · obtain ⟨k, rfl⟩ := hx rw [hinj.extend_apply] simp [hinj.eq_iff] · rw [Function.extend_apply' _ _ _ hx] apply Finset.sum_eq_zero intro k hk simp [show occupation k ≠ x from fun h => hx ⟨k, h⟩]
/-- The second source in a compatible four-path term is uniquely determined.The zero extension records absent (invalid) source occupations exactly. -/theorem fourPath_eliminate_source (occupation : I → G) (hinj : Function.Injective occupation) (wq ws : I → ℝ) (M ep eq er es : G) (A C : ℝ) : (∑ k, if M + ep = occupation k + eq ∧ M + er = occupation k + es then A * wq k * C * ws k else 0) = if ep - eq = er - es then A * Function.extend occupation wq (fun _ => 0) (M + ep - eq) * C * Function.extend occupation ws (fun _ => 0) (M + ep - eq) else 0 := by classical let x := M + ep - eq have hfirst (k : I) : M + ep = occupation k + eq ↔ occupation k = x := by dsimp [x] constructor · intro h exact (eq_sub_iff_add_eq).2 h.symm · intro h exact ((eq_sub_iff_add_eq).1 h).symm have hsecond : M + er = x + es ↔ ep - eq = er - es := by have hx : x + es = M + ((ep - eq) + es) := by dsimp [x]; abel rw [hx, add_left_cancel_iff, eq_comm, ← eq_sub_iff_add_eq] by_cases hx : ∃ k, occupation k = x · obtain ⟨k, hk⟩ := hx have heq (l : I) : M + ep = occupation l + eq ↔ l = k := by rw [hfirst, ← hk, hinj.eq_iff] have hsec : M + er = occupation k + es ↔ ep - eq = er - es := by rw [hk] exact hsecond change _ = if ep - eq = er - es then A * Function.extend occupation wq (fun _ => 0) x * C * Function.extend occupation ws (fun _ => 0) x else 0 rw [← hk, hinj.extend_apply, hinj.extend_apply] rw [Finset.sum_eq_single k] · simp [heq, hsec] · intro l hl hlk simp [heq, hlk] · simp · have hzq := Function.extend_apply' (f := occupation) wq (fun _ => (0 : ℝ)) x hx change _ = if ep - eq = er - es then A * Function.extend occupation wq (fun _ => 0) x * C * Function.extend occupation ws (fun _ => 0) x else 0 rw [hzq] simp only [mul_zero, zero_mul, ite_self] apply Finset.sum_eq_zero intro k hk have hne : occupation k ≠ x := fun h => hx ⟨k, h⟩ simp [hfirst, hne]
/-- The full four-path sum with the second source eliminated and invalidsource occupations retained through zero extension. -/theorem fourPath_sum_eliminate_source [Fintype P] (occupation : I → G) (hinj : Function.Injective occupation) (eps : P → G) (weight : I → P → ℝ) : (∑ i, ∑ k, ∑ p, ∑ q, ∑ r, ∑ s, if occupation i + eps p = occupation k + eps q ∧ occupation i + eps r = occupation k + eps s then weight i p * weight k q * weight i r * weight k s else 0) = ∑ i, ∑ p, ∑ q, ∑ r, ∑ s, if eps p - eps q = eps r - eps s then weight i p * Function.extend occupation (fun k => weight k q) (fun _ => 0) (occupation i + eps p - eps q) * weight i r * Function.extend occupation (fun k => weight k s) (fun _ => 0) (occupation i + eps p - eps q) else 0 := by classical apply Finset.sum_congr rfl intro i hi rw [Finset.sum_comm] apply Finset.sum_congr rfl intro p hp rw [Finset.sum_comm] apply Finset.sum_congr rfl intro q hq rw [Finset.sum_comm] apply Finset.sum_congr rfl intro r hr rw [Finset.sum_comm] apply Finset.sum_congr rfl intro s hs exact fourPath_eliminate_source occupation hinj (fun k => weight k q) (fun k => weight k s) (occupation i) (eps p) (eps q) (eps r) (eps s) (weight i p) (weight i r)
/-- The complex four-path trace with its second source removed. The signedshift identity is required only for nonzero path weights, so invalid-pathfallback target indices do not affect the identity. -/theorem complex_path_second_trace_eliminate_source {J : Type*} [Fintype J] [Fintype P] [DecidableEq I] [DecidableEq J] (occupation : I → G) (hinj : Function.Injective occupation) (targetOccupation : J → G) (htarget : Function.Injective targetOccupation) (eps : P → G) (shift : I → P → J) (weight : I → P → ℝ) (hshift : ∀ i p, weight i p ≠ 0 → targetOccupation (shift i p) = occupation i + eps p) : let A := pathShiftMatrix shift (fun i p => (weight i p : ℂ)) ((A.conjTranspose * A) ^ 2).trace.re = ∑ i, ∑ p, ∑ q, ∑ r, ∑ s, if eps p - eps q = eps r - eps s then weight i p * Function.extend occupation (fun k => weight k q) (fun _ => 0) (occupation i + eps p - eps q) * weight i r * Function.extend occupation (fun k => weight k s) (fun _ => 0) (occupation i + eps p - eps q) else 0 := by classical dsimp rw [complex_path_second_trace_four_paths, ← fourPath_sum_eliminate_source occupation hinj] apply Finset.sum_congr rfl intro i hi apply Finset.sum_congr rfl intro k hk apply Finset.sum_congr rfl intro p hp apply Finset.sum_congr rfl intro q hq apply Finset.sum_congr rfl intro r hr apply Finset.sum_congr rfl intro s hs by_cases hz : weight i p * weight k q * weight i r * weight k s = 0 · simp [hz] · have hp' : weight i p ≠ 0 := by intro h; simp [h] at hz have hq' : weight k q ≠ 0 := by intro h; simp [h] at hz have hr' : weight i r ≠ 0 := by intro h; simp [h] at hz have hs' : weight k s ≠ 0 := by intro h; simp [h] at hz have h₁ : shift i p = shift k q ↔ occupation i + eps p = occupation k + eps q := by rw [← htarget.eq_iff, hshift i p hp', hshift k q hq'] have h₂ : shift i r = shift k s ↔ occupation i + eps r = occupation k + eps s := by rw [← htarget.eq_iff, hshift i r hr', hshift k s hs'] simp only [h₁, h₂]
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119import Mathlib
namespace OAI
noncomputable sectionnamespace Problem335
/-- Quantitative monotonicity of the fraction used in the rounded rank parameters. -/theorem fraction_rounding_ratio_bounds {x v a : ℝ} (hx : 0 < x) (hv : 0 < v) (hxa : x ≤ a) (hax : a ≤ x + 1) : 1 ≤ (a / (a + v)) / (x / (x + v)) ∧ (a / (a + v)) / (x / (x + v)) ≤ 1 + 1 / x := by have ha : 0 < a := lt_of_lt_of_le hx hxa have hxv : 0 < x + v := add_pos hx hv have hav : 0 < a + v := add_pos ha hv have hratio : (a / (a + v)) / (x / (x + v)) = a * (x + v) / (x * (a + v)) := by field_simp rw [hratio] constructor · apply (le_div_iff₀ (mul_pos hx hav)).mpr nlinarith · apply (div_le_iff₀ (mul_pos hx hav)).mpr have hxne : x ≠ 0 := ne_of_gt hx field_simp nlinarith
/-- Rounding upward by at most one changes the logarithm by at most `1/x`. -/theorem fraction_rounding_log_bounds {x v a : ℝ} (hx : 0 < x) (hv : 0 < v) (hxa : x ≤ a) (hax : a ≤ x + 1) : 0 ≤ Real.log ((a / (a + v)) / (x / (x + v))) ∧ Real.log ((a / (a + v)) / (x / (x + v))) ≤ 1 / x := by obtain ⟨hlo, hhi⟩ := fraction_rounding_ratio_bounds hx hv hxa hax constructor · exact Real.log_nonneg hlo · have hpos : 0 < (a / (a + v)) / (x / (x + v)) := lt_of_lt_of_le zero_lt_one hlo have hlog := Real.log_le_sub_one_of_pos hpos linarith
/-- Once the unrounded value is at least one, the logarithmic loss is `2/a`. -/theorem fraction_rounding_log_le_two_div {x v a : ℝ} (hx : 1 ≤ x) (hv : 0 < v) (hxa : x ≤ a) (hax : a ≤ x + 1) : Real.log ((a / (a + v)) / (x / (x + v))) ≤ 2 / a := by have hxpos : 0 < x := zero_lt_one.trans_le hx have hapos : 0 < a := hxpos.trans_le hxa apply (fraction_rounding_log_bounds hxpos hv hxa hax).2.trans apply (div_le_div_iff₀ hxpos hapos).mpr nlinarith
/-- Equivalent multiplicative exponential form of the rounding estimate. -/theorem fraction_rounding_bounds {x v a : ℝ} (hx : 0 < x) (hv : 0 < v) (hxa : x ≤ a) (hax : a ≤ x + 1) : x / (x + v) ≤ a / (a + v) ∧ a / (a + v) ≤ x / (x + v) * Real.exp (1 / x) := by have hbase : 0 < x / (x + v) := div_pos hx (add_pos hx hv) obtain ⟨hlo, hhi⟩ := fraction_rounding_ratio_bounds hx hv hxa hax constructor · exact (one_le_div hbase).mp hlo · have hexp : 1 + 1 / x ≤ Real.exp (1 / x) := by simpa [add_comm] using Real.add_one_le_exp (1 / x) have hratio := hhi.trans hexp exact (div_le_iff₀ hbase).mp hratio |>.trans_eq (mul_comm _ _)
/-- The ceiling specialization used for both parameters `a` and `b`. -/theorem fraction_natCeil_log_bounds {x v : ℝ} (hx : 0 < x) (hv : 0 < v) : 0 ≤ Real.log (((⌈x⌉₊ : ℝ) / ((⌈x⌉₊ : ℝ) + v)) / (x / (x + v))) ∧ Real.log (((⌈x⌉₊ : ℝ) / ((⌈x⌉₊ : ℝ) + v)) / (x / (x + v))) ≤ 1 / x := by apply fraction_rounding_log_bounds hx hv · exact Nat.le_ceil x · exact le_of_lt (Nat.ceil_lt_add_one (le_of_lt hx))
/-- The first rank parameter has ideal fraction `1/s`; here `s = sqrt n`. -/theorem fraction_natCeil_inverse_bounds {s v : ℝ} (hs : 1 < s) (hv : 0 < v) : let a : ℝ := ⌈v / (s - 1)⌉₊ 1 / s ≤ a / (a + v) ∧ a / (a + v) ≤ 1 / s * Real.exp ((s - 1) / v) := by have hsm : 0 < s - 1 := sub_pos.mpr hs have hx : 0 < v / (s - 1) := div_pos hv hsm have hbase : (v / (s - 1)) / (v / (s - 1) + v) = 1 / s := by field_simp ring have hinv : 1 / (v / (s - 1)) = (s - 1) / v := by rw [one_div_div] have h := fraction_rounding_bounds hx hv (Nat.le_ceil _) (le_of_lt (Nat.ceil_lt_add_one hx.le)) simpa only [hbase, hinv] using h
/-- The first rounded parameter has reciprocal at most its ideal reciprocal. -/theorem fraction_natCeil_reciprocal_le {s v : ℝ} (hs : 1 < s) (hv : 0 < v) : let a : ℝ := ⌈v / (s - 1)⌉₊ (a / (a + v))⁻¹ ≤ s := by dsimp have h := (fraction_natCeil_inverse_bounds hs hv).1 have hspos : 0 < s := zero_lt_one.trans hs have hpos : 0 < (⌈v / (s - 1)⌉₊ : ℝ) / ((⌈v / (s - 1)⌉₊ : ℝ) + v) := lt_of_lt_of_le (one_div_pos.mpr hspos) h rw [inv_eq_one_div] apply (div_le_iff₀ hpos).mpr nlinarith [(div_le_iff₀ hspos).mp h]
/-- The second rank parameter is rounded from a prescribed target fraction `p`. -/theorem fraction_natCeil_target_bounds {p v : ℝ} (hp : 0 < p) (hp1 : p < 1) (hv : 0 < v) : let b : ℝ := ⌈v * p / (1 - p)⌉₊ p ≤ b / (b + v) ∧ b / (b + v) ≤ p * Real.exp ((1 - p) / (v * p)) := by have hpm : 0 < 1 - p := sub_pos.mpr hp1 have hx : 0 < v * p / (1 - p) := div_pos (mul_pos hv hp) hpm have hbase : (v * p / (1 - p)) / (v * p / (1 - p) + v) = p := by field_simp ring have hinv : 1 / (v * p / (1 - p)) = (1 - p) / (v * p) := by rw [one_div_div] have h := fraction_rounding_bounds hx hv (Nat.le_ceil _) (le_of_lt (Nat.ceil_lt_add_one hx.le)) simpa only [hbase, hinv] using h
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233import OAI.Algebra.DepthFive.Basic
namespace OAI
namespace Problem335
/-- The numerical size estimate used after instantiating the block circuit. -/theorem circuitSize_le_block_bound {K : Type*} [CommSemiring K] {n r t : ℕ} (c : Depth5Circuit K n) (hleaf : c.leafCount ≤ n ^ 3) (hbottom : c.bottomCount ≤ n ^ 3) (hlower : c.lowerCount ≤ r * n ^ (t + 1)) (hmiddle : c.middleCount ≤ r * n ^ 2) (hupper : c.upperCount ≤ n ^ (r - 1)) : circuitSize c ≤ 2 * n ^ 3 + r * n ^ 2 + r * n ^ (t + 1) + n ^ (r - 1) + 1 := by unfold circuitSize omega
/-- Specialization of the block count to the precise upper gate bound. -/theorem circuitSize_le_upperGateBound {K : Type*} [CommSemiring K] {n : ℕ} (c : Depth5Circuit K n) (hleaf : c.leafCount ≤ n ^ 3) (hbottom : c.bottomCount ≤ n ^ 3) (hlower : c.lowerCount ≤ ceilDiv n (ceilSqrt n) * n ^ (ceilSqrt n + 1)) (hmiddle : c.middleCount ≤ ceilDiv n (ceilSqrt n) * n ^ 2) (hupper : c.upperCount ≤ n ^ (ceilDiv n (ceilSqrt n) - 1)) : circuitSize c ≤ upperGateBound n := by exact circuitSize_le_block_bound c hleaf hbottom hlower hmiddle hupper
end Problem335
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108import OAI.Algebra.DepthFive.Basic
namespace OAI
noncomputable section
open scoped BigOperators
namespace Problem335
/-- The combined coefficient of all wires from a fixed predecessor.Wire multiplicity is absorbed into this coefficient, not charged as gates. -/def gateCoefficient {K ι : Type*} [AddCommMonoid K] [DecidableEq ι] (inputs : List (K × ι)) (i : ι) : K := (inputs.map (fun entry => if entry.2 = i then entry.1 else 0)).sum
@[simp] theorem gateCoefficient_nil {K ι : Type*} [AddCommMonoid K] [DecidableEq ι] (i : ι) : gateCoefficient ([] : List (K × ι)) i = 0 := by simp [gateCoefficient]
@[simp] theorem gateCoefficient_cons {K ι : Type*} [AddCommMonoid K] [DecidableEq ι] (entry : K × ι) (inputs : List (K × ι)) (i : ι) : gateCoefficient (entry :: inputs) i = (if entry.2 = i then entry.1 else 0) + gateCoefficient inputs i := by simp [gateCoefficient]
/-- Any finite list of weighted inputs can be regrouped over its finite gate type. -/theorem list_weighted_sum_eq_sum {K R ι : Type*} [Semiring K] [Semiring R] [Fintype ι] [DecidableEq ι] (f : K →+* R) (value : ι → R) (inputs : List (K × ι)) : (inputs.map (fun entry => f entry.1 * value entry.2)).sum = ∑ i, f (gateCoefficient inputs i) * value i := by induction inputs with | nil => simp | cons entry inputs ih => simp only [List.map_cons, List.sum_cons, gateCoefficient_cons, map_add, add_mul, Finset.sum_add_distrib] rw [← ih] congr 1 simp [apply_ite, ite_mul]
/-- A combined coefficient vanishes if its predecessor does not occur. -/theorem gateCoefficient_eq_zero_of_not_mem {K ι : Type*} [AddCommMonoid K] [DecidableEq ι] (inputs : List (K × ι)) (i : ι) (h : ∀ entry ∈ inputs, entry.2 ≠ i) : gateCoefficient inputs i = 0 := by unfold gateCoefficient apply List.sum_eq_zero intro x hx obtain ⟨entry, hentry, rfl⟩ := List.mem_map.mp hx simp [h entry hentry]
/-- A nonzero combined coefficient must come from an actual wire. -/theorem exists_mem_of_gateCoefficient_ne_zero {K ι : Type*} [AddCommMonoid K] [DecidableEq ι] (inputs : List (K × ι)) (i : ι) (h : gateCoefficient inputs i ≠ 0) : ∃ entry ∈ inputs, entry.2 = i := by by_contra hn apply h apply gateCoefficient_eq_zero_of_not_mem intro entry hentry heq exact hn ⟨entry, hentry, heq⟩
theorem bottomValue_eq_sum {K : Type*} [CommSemiring K] {n : ℕ} (c : Depth5Circuit K n) (i : Fin c.bottomCount) : bottomValue c i = ∑ j : Fin c.leafCount, MvPolynomial.C (gateCoefficient (c.bottomInputs i) j) * d5LeafValue (c.leaves j) := by exact list_weighted_sum_eq_sum MvPolynomial.C (fun j => d5LeafValue (c.leaves j)) _
theorem middleValue_eq_sum {K : Type*} [CommSemiring K] {n : ℕ} (c : Depth5Circuit K n) (i : Fin c.middleCount) : middleValue c i = ∑ j : Fin c.lowerCount, MvPolynomial.C (gateCoefficient (c.middleInputs i) j) * lowerValue c j := by exact list_weighted_sum_eq_sum MvPolynomial.C (lowerValue c) _
theorem circuitValue_eq_sum {K : Type*} [CommSemiring K] {n : ℕ} (c : Depth5Circuit K n) : circuitValue c = ∑ j : Fin c.upperCount, MvPolynomial.C (gateCoefficient c.outputInputs j) * upperValue c j := by exact list_weighted_sum_eq_sum MvPolynomial.C (upperValue c) _
/-- Aggregating wires preserves the bottom homogeneous-degree constraint. -/theorem bottomDegree_of_gateCoefficient_ne_zero {K : Type*} [CommSemiring K] {n : ℕ} (c : Depth5Circuit K n) (i : Fin c.bottomCount) (j : Fin c.leafCount) (h : gateCoefficient (c.bottomInputs i) j ≠ 0) : d5LeafDegree (c.leaves j) = c.bottomDegree i := by obtain ⟨entry, hentry, heq⟩ := exists_mem_of_gateCoefficient_ne_zero _ _ h simpa [heq] using c.bottomHomogeneous i entry hentry
/-- Aggregating wires preserves the middle homogeneous-degree constraint. -/theorem middleDegree_of_gateCoefficient_ne_zero {K : Type*} [CommSemiring K] {n : ℕ} (c : Depth5Circuit K n) (i : Fin c.middleCount) (j : Fin c.lowerCount) (h : gateCoefficient (c.middleInputs i) j ≠ 0) : ((c.lowerInputs j).map c.bottomDegree).sum = c.middleDegree i := by obtain ⟨entry, hentry, heq⟩ := exists_mem_of_gateCoefficient_ne_zero _ _ h simpa [heq] using c.middleHomogeneous i entry hentry
/-- Aggregating wires preserves the output homogeneous-degree constraint. -/theorem outputDegree_of_gateCoefficient_ne_zero {K : Type*} [CommSemiring K] {n : ℕ} (c : Depth5Circuit K n) (j : Fin c.upperCount) (h : gateCoefficient c.outputInputs j ≠ 0) : ((c.upperInputs j).map c.middleDegree).sum = c.outputDegree := by obtain ⟨entry, hentry, heq⟩ := exists_mem_of_gateCoefficient_ne_zero _ _ h simpa [heq] using c.outputHomogeneous entry hentry
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143import OAI.Algebra.DepthFive.ProductCostimport OAI.Algebra.DepthFive.LowDegreeWeights
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335
/-- Remaining unexpanded factors cost at most one factor of five per largeoccurrence, and a total exponential error for the low occurrences. -/theorem remaining_degreeWeight_product_bound {ι : Type*} (I : Finset ι) (e : ι → ℕ) {n s q : ℝ} (hn : 0 < n) (hs : 0 < s) (hshi : s ≤ Real.sqrt n) (hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsqrt : q ≤ 2 / Real.sqrt n) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1) (he : ∀ i ∈ I, 0 < e i) (hsum : (∑ i ∈ I, (e i : ℝ)) ≤ n) : (∏ i ∈ I, degreeWeight q (1 / 2 - s / (2 * n)) (e i)) ≤ (5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n) := by classical have hq1 : q ≤ 1 := by linarith have ht : 0 < n / (4 * s) := by positivity have hcorr : (∑ i ∈ I with (e i : ℝ) < n / (4 * s), q ^ (1 - s * e i / n)) ≤ 6 * Real.sqrt n := by apply sum_small_degree_corrections_le (I.filter (fun i => (e i : ℝ) < n / (4 * s))) n s q (fun i => (e i : ℝ)) hn hs.le hshi hq hq1 hqsqrt · intro i hi exact_mod_cast he i (Finset.mem_filter.mp hi).1 · intro i hi obtain ⟨hI, hlow⟩ := Finset.mem_filter.mp hi obtain ⟨_, h⟩ := low_degree_offset hn hs (he i hI) hlow have hid : s * e i / n = 2 * (s * e i / (2 * n)) := by ring rw [hid] linarith · exact (Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) (fun i _ _ => Nat.cast_nonneg (e i))).trans hsum have herr : (∑ i ∈ I with (e i : ℝ) < n / (4 * s), 4 * q ^ (1 - s * e i / n)) ≤ 24 * Real.sqrt n := by rw [← Finset.mul_sum] linarith have hlow : ∀ i ∈ I, (e i : ℝ) < n / (4 * s) → degreeWeight q (1 / 2 - s / (2 * n)) (e i) ≤ Real.exp (4 * q ^ (1 - s * e i / n)) := by intro i hi hlow have hw := low_degreeWeight_le_with_correction hn hs hq hqhalf hqsmall (he i hi) hlow have hd : 0 ≤ degreeDistance n s (e i) := nearestIntegerDistance_nonneg _ have hp : q ^ (degreeDistance n s (e i) / 2) ≤ 1 := Real.rpow_le_one hq.le hq1 (by positivity) exact hw.trans (by simpa only [one_mul] using mul_le_mul_of_nonneg_right hp (Real.exp_pos (4 * q ^ (1 - s * e i / n))).le) have h := prod_high_low_cost_le_rpow I (fun i => degreeWeight q (1 / 2 - s / (2 * n)) (e i)) (fun i => 4 * q ^ (1 - s * e i / n)) (fun i => (e i : ℝ)) (n / (4 * s)) 5 (24 * Real.sqrt n) n ht (fun i _ => degreeWeight_nonneg hq.le _ _) (by norm_num) (fun i _ => Nat.cast_nonneg (e i)) hsum (fun i _ _ => degreeWeight_le_five hq hqhalf _ _) hlow herr have hdiv : n / (n / (4 * s)) = 4 * s := by field_simp simpa only [hdiv] using h
/-- The actual factor weights in the one-high case obey the strong powersaving required by the homogeneous depth-five circuit rank argument. -/theorem high_degreeWeight_product_bound {ι : Type*} (I : Finset ι) (e : ι → ℕ) (d : ℕ) {n s q : ℝ} (hn : 1 ≤ n) (hs : 0 < s) (hshi : s ≤ Real.sqrt n) (hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsqrt : q ≤ 2 / Real.sqrt n) (hqpow : q ≤ n ^ (-(2 : ℝ) / 5)) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1) (hlam : (3 : ℝ) / 8 ≤ 1 / 2 - s / (2 * n)) (htone : 1 < n / (4 * s)) (hd : n / (4 * s) ≤ (d : ℝ)) (he : ∀ i ∈ I, 0 < e i) (hsum : (∑ i ∈ I, (e i : ℝ)) ≤ n) : degreeWeight q (1 / 2 - s / (2 * n)) 1 ^ d * (∏ i ∈ I, degreeWeight q (1 / 2 - s / (2 * n)) (e i)) ≤ (5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n) * n ^ (-(3 * Real.sqrt n) / 160) := by have hn0 : 0 < n := by linarith have hq1 : q ≤ 1 := by linarith have hdist : degreeDistance n s 1 = 1 / 2 - s / (2 * n) := by simpa using degreeDistance_odd hn0 hs (by decide : 0 < (1 : ℕ)) (by simpa using htone) (by decide : Odd (1 : ℕ)) have hlinear : degreeWeight q (1 / 2 - s / (2 * n)) 1 ≤ q ^ ((1 / 2 - s / (2 * n)) / 2) := by simpa only [hdist] using low_odd_degreeWeight_le hn0 hs hq hqhalf hqsmall (by decide : 0 < (1 : ℕ)) (by simpa using htone) (by decide : Odd (1 : ℕ)) have hlinpow := linear_factor_cost_power_le (degreeWeight q (1 / 2 - s / (2 * n)) 1) q (1 / 2 - s / (2 * n)) (n / (4 * s)) d (degreeWeight_nonneg hq.le _ _) hq hq1 (by linarith) hlinear hd have hprod := remaining_degreeWeight_product_bound I e hn0 hs hshi hq hqhalf hqsqrt hqsmall he hsum have ht : Real.sqrt n / 4 ≤ n / (4 * s) := by apply (le_div_iff₀ (by positivity : 0 < 4 * s)).mpr have hm := mul_le_mul_of_nonneg_left hshi (Real.sqrt_nonneg n) nlinarith [Real.sq_sqrt hn0.le] have hpower := one_high_power_saving n q (1 / 2 - s / (2 * n)) (n / (4 * s)) hn hq.le hqpow hlam ht calc _ ≤ q ^ ((1 / 2 - s / (2 * n)) * (n / (4 * s)) / 2) * ((5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n)) := mul_le_mul hlinpow hprod (Finset.prod_nonneg (fun i _ => degreeWeight_nonneg hq.le _ _)) (Real.rpow_nonneg hq.le _) _ ≤ n ^ (-(3 * Real.sqrt n) / 160) * ((5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n)) := mul_le_mul_of_nonneg_right hpower (by positivity) _ = _ := by ring
/-- The circuit interface only assumes `n ≥ 64`: the required slope andthreshold bounds follow from `s ≤ sqrt n`. This adapter reconciles thecanonical high-weight estimate with the circuit product interface. -/theorem expanded_degreeWeight_product_bound {ι : Type*} (I : Finset ι) (e : ι → ℕ) (d : ℕ) {n s q : ℝ} (hn : 64 ≤ n) (hs : 0 < s) (hshi : s ≤ Real.sqrt n) (hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsqrt : q ≤ 2 / Real.sqrt n) (hqpow : q ≤ n ^ (-(2 / 5 : ℝ))) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1) (he : ∀ i ∈ I, 0 < e i) (hsum : ∑ i ∈ I, (e i : ℝ) ≤ n) (hd : n / (4 * s) ≤ (d : ℝ)) : (degreeWeight q (1 / 2 - s / (2 * n)) 1) ^ d * (∏ i ∈ I, degreeWeight q (1 / 2 - s / (2 * n)) (e i)) ≤ (5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n) * n ^ (-(3 * Real.sqrt n / 160)) := by have hn0 : 0 < n := by linarith have hsq := Real.sq_sqrt hn0.le have hsqrt := Real.sqrt_nonneg n have hsqrt8 : 8 ≤ Real.sqrt n := by nlinarith have ht : Real.sqrt n / 4 ≤ n / (4 * s) := by apply (le_div_iff₀ (by positivity : 0 < 4 * s)).mpr nlinarith [mul_le_mul_of_nonneg_left hshi hsqrt] have hdiv : s / (2 * n) ≤ 1 / 8 := by apply (div_le_iff₀ (by positivity : 0 < 2 * n)).mpr nlinarith simpa only [neg_div] using high_degreeWeight_product_bound I e d (by linarith) hs hshi hq hqhalf hqsqrt (by simpa only [neg_div] using hqpow) hqsmall (by linarith) (by linarith) hd he hsum
end Problem335
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586import OAI.Algebra.DepthFive.Basic
namespace OAI
noncomputable section
namespace Problem335
universe u v w
/-- Homogeneity is preserved by a list sum, including the empty sum. -/theorem isHomogeneous_list_sum {K : Type u} [CommSemiring K] {σ : Type v} {ι : Type w} (l : List ι) (f : ι → MvPolynomial σ K) (d : ℕ) (h : ∀ i ∈ l, (f i).IsHomogeneous d) : (l.map f).sum.IsHomogeneous d := by induction l with | nil => simpa using MvPolynomial.isHomogeneous_zero σ K d | cons a l ih => simp only [List.map_cons, List.sum_cons] exact (h a (by simp)).add (ih (fun i hi => h i (by simp [hi])))
/-- A product's formal degree is the sum of its factors' formal degrees. -/theorem isHomogeneous_list_prod {K : Type u} [CommSemiring K] {σ : Type v} {ι : Type w} (l : List ι) (f : ι → MvPolynomial σ K) (d : ι → ℕ) (h : ∀ i ∈ l, (f i).IsHomogeneous (d i)) : (l.map f).prod.IsHomogeneous (l.map d).sum := by induction l with | nil => simpa using MvPolynomial.isHomogeneous_one (σ := σ) K | cons a l ih => simp only [List.map_cons, List.prod_cons, List.sum_cons] exact (h a (by simp)).mul (ih (fun i hi => h i (by simp [hi])))
theorem d5LeafValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ} (x : D5Leaf K n) : (d5LeafValue x).IsHomogeneous (d5LeafDegree x) := by cases x with | scalar a => exact MvPolynomial.isHomogeneous_C _ a | «variable» i => exact MvPolynomial.isHomogeneous_X K i
theorem bottomValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ} (c : Depth5Circuit K n) (i : Fin c.bottomCount) : (bottomValue c i).IsHomogeneous (c.bottomDegree i) := by unfold bottomValue apply isHomogeneous_list_sum intro entry hentry rw [← c.bottomHomogeneous i entry hentry] exact (d5LeafValue_isHomogeneous (c.leaves entry.2)).C_mul entry.1
theorem lowerValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ} (c : Depth5Circuit K n) (i : Fin c.lowerCount) : (lowerValue c i).IsHomogeneous ((c.lowerInputs i).map c.bottomDegree).sum := by unfold lowerValue apply isHomogeneous_list_prod intro j _ exact bottomValue_isHomogeneous c j
theorem middleValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ} (c : Depth5Circuit K n) (i : Fin c.middleCount) : (middleValue c i).IsHomogeneous (c.middleDegree i) := by unfold middleValue apply isHomogeneous_list_sum intro entry hentry rw [← c.middleHomogeneous i entry hentry] exact (lowerValue_isHomogeneous c entry.2).C_mul entry.1
theorem upperValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ} (c : Depth5Circuit K n) (i : Fin c.upperCount) : (upperValue c i).IsHomogeneous ((c.upperInputs i).map c.middleDegree).sum := by unfold upperValue apply isHomogeneous_list_prod intro j _ exact middleValue_isHomogeneous c j
theorem circuitValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ} (c : Depth5Circuit K n) : (circuitValue c).IsHomogeneous c.outputDegree := by unfold circuitValue apply isHomogeneous_list_sum intro entry hentry rw [← c.outputHomogeneous entry hentry] exact (upperValue_isHomogeneous c entry.2).C_mul entry.1
end Problem335
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162import Mathlib
namespace OAI
noncomputable section
namespace Problem335
universe u v w
/-- Degree-exact exponent vectors are multisets of the indicated cardinality. -/def degreeExponentsEquivSym (σ : Type u) (d : ℕ) : { m : σ →₀ ℕ // m.degree = d } ≃ Sym σ d := by classical exact (Sym.equivNatSum σ d).symm
/-- The number of monomials of total degree `d`. -/theorem card_degree_exponents (σ : Type u) [Fintype σ] (d : ℕ) : Nat.card { m : σ →₀ ℕ // m.degree = d } = Nat.multichoose (Fintype.card σ) d := by rw [Nat.card_congr (degreeExponentsEquivSym σ d)] simpa only [Nat.card_eq_fintype_card] using Sym.natCard_sym_eq_multichoose (α := σ) d
/-- Homogeneous polynomial spaces in finitely many variables are finite modules. -/instance homogeneousSubmodule_finite (K : Type u) [CommSemiring K] (σ : Type v) [Finite σ] (d : ℕ) : Module.Finite K (MvPolynomial.homogeneousSubmodule σ K d) := Module.Finite.of_fg (MvPolynomial.homogeneousSubmodule_fg σ K d)
/-- Exact dimension of the homogeneous polynomial space. -/theorem homogeneousSubmodule_finrank (K : Type u) [Field K] (σ : Type v) [Fintype σ] (d : ℕ) : Module.finrank K (MvPolynomial.homogeneousSubmodule σ K d) = Nat.multichoose (Fintype.card σ) d := by rw [MvPolynomial.homogeneousSubmodule_eq_finsupp_supported] change Module.finrank K (MvPolynomial.restrictSupport K {m : σ →₀ ℕ | m.degree = d}) = _ rw [Module.finrank_eq_nat_card_basis (MvPolynomial.basisRestrictSupport K _)] exact card_degree_exponents σ d
/-- The usual stars-and-bars presentation of homogeneous dimension. -/theorem homogeneousSubmodule_finrank_choose (K : Type u) [Field K] (σ : Type v) [Fintype σ] (d : ℕ) : Module.finrank K (MvPolynomial.homogeneousSubmodule σ K d) = Nat.choose (Fintype.card σ + d - 1) d := by rw [homogeneousSubmodule_finrank, Nat.multichoose_eq]
/-- Dimension of the separate-variable source/intermediate spaces used by the rank measure. -/theorem homogeneousTensor_finrank (K : Type u) [Field K] (σ : Type v) [Fintype σ] (τ : Type w) [Fintype τ] (a b : ℕ) : Module.finrank K (TensorProduct K (MvPolynomial.homogeneousSubmodule σ K a) (MvPolynomial.homogeneousSubmodule τ K b)) = Nat.choose (Fintype.card σ + a - 1) a * Nat.choose (Fintype.card τ + b - 1) b := by rw [Module.finrank_tensorProduct, homogeneousSubmodule_finrank_choose, homogeneousSubmodule_finrank_choose]
end Problem335
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546import OAI.Algebra.DepthFive.ImmDegreeimport OAI.Algebra.DepthFive.OperatorRank
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335
/-- With a layerwise partition, IMM is already in the selected bidegree. -/theorem imm_mem_bidegreeSubmodule (K : Type*) [CommSemiring K] (n : ℕ) (side : Fin n → Bool) : imm K n ∈ bidegreeSubmodule (fun x => side x.1) (Finset.univ.filter (fun t => side t = true)).card (Finset.univ.filter (fun t => side t = false)).card := by classical have h := imm_isWeightedHomogeneous K n (bidegreeWeight side) have hs : (∑ t, bidegreeWeight side t) = ((Finset.univ.filter (fun t => side t = true)).card, (Finset.univ.filter (fun t => side t = false)).card) := by apply Prod.ext · simp only [Prod.fst_sum, Finset.card_filter] apply Finset.sum_congr rfl intro t ht cases hs : side t <;> simp [bidegreeWeight, hs] · simp only [Prod.snd_sum, Finset.card_filter] apply Finset.sum_congr rfl intro t ht cases hs : side t <;> simp [bidegreeWeight, hs] rw [hs] at h exact h
/-- A bidegree projection does not change IMM when the selected index is its layer count. -/theorem bidegreeComponent_imm (K : Type*) [CommSemiring K] (n : ℕ) (side : Fin n → Bool) : bidegreeComponent (fun x => side x.1) (Finset.univ.filter (fun t => side t = true)).card (Finset.univ.filter (fun t => side t = false)).card (imm K n) = imm K n := bidegreeComponent_eq_self (imm_mem_bidegreeSubmodule K n side)
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748import OAI.Algebra.DepthFive.Basicimport OAI.Algebra.DepthFive.MatrixPaths
namespace OAI
noncomputable section
namespace Problem335
variable {K : Type*} [CommSemiring K] {n : ℕ}
/-- Each block of layer labels represents the product of its matrices. -/def immBlock (K : Type*) [CommSemiring K] (n : ℕ) (labels : List (Fin n)) : Matrix (Fin n) (Fin n) (MvPolynomial (Fin n × Fin n × Fin n) K) := (labels.map (immLayer K n)).prod
/-- Regrouping consecutive layers does not change the iterated matrix product. -/theorem imm_eq_blocks_prod (hn : 0 < n) (blocks : List (List (Fin n))) (hblocks : blocks.flatten = List.finRange n) : imm K n = ((blocks.map (immBlock K n)).prod) ⟨0, hn⟩ ⟨0, hn⟩ := by have hm : (blocks.map (fun b : List (Fin n) => b.map (immLayer K n))).flatten = (List.finRange n).map (immLayer K n) := by rw [← List.map_flatten, hblocks] have hp : (blocks.map (immBlock K n)).prod = ((List.finRange n).map (immLayer K n)).prod := by change (blocks.map (fun b : List (Fin n) => (b.map (immLayer K n)).prod)).prod = _ simpa only [List.prod_flatten, List.map_map, Function.comp_def] using congrArg List.prod hm rw [hp] simp only [imm, dite_eq_left hn, List.ofFn_eq_map]
/-- The outer path expansion of the block matrices computes `imm`. -/theorem imm_eq_blocks_path_sum (hn : 0 < n) (blocks : List (List (Fin n))) (hblocks : blocks.flatten = List.finRange n) : imm K n = ((matrixEntryPaths (List.finRange blocks.length) (⟨0, hn⟩ : Fin n) ⟨0, hn⟩).map (fun p => (p.map (fun e => immBlock K n (blocks.get e.1) e.2.1 e.2.2)).prod)).sum := by rw [matrixEntryPaths_sum_prod (fun j : Fin blocks.length => immBlock K n (blocks.get j))] rw [imm_eq_blocks_prod hn blocks hblocks] simp [← List.ofFn_eq_map]
end Problem335
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162import OAI.Algebra.DepthFive.ImmSecondLocalBoundimport OAI.Algebra.DepthFive.ImmPairingReindeximport OAI.Algebra.DepthFive.ImmProfileCompatibility
namespace OAI
noncomputable sectionopen scoped BigOperatorsnamespace Problem335
private def totalImmProfile (n : ℕ) (P : List (Fin n × Fin n × Fin n)) : Fin n → Fin n × Fin n := if h : P.map Prod.fst = List.finRange n then edgeProfile P h else fun t => (t, t)
private theorem totalImmProfile_get (n : ℕ) (hn : 0 < n) (p : Fin (immPaths n hn).length) : totalImmProfile n ((immPaths n hn).get p) = FockLayerProfile.immProfile n hn p := by simp only [totalImmProfile, dite_eq_left (immPaths_labels n hn _ (List.get_mem _ p)), FockLayerProfile.immProfile]
private theorem totalImmProfile_internal (d : ℕ) (p : Fin d → Fin (d + 1)) : totalImmProfile (d + 1) (immInternalPathEdges d p) = immInternalCoordinate d p := by funext t simp only [totalImmProfile, dite_eq_left (immInternalPathEdges_labels d p), edgeProfile_immInternalPathEdges]
/-- The actual second trace is bounded by the compatible endpoint-path localoccupation sum, with one source sum and no remaining representation hypotheses. -/theorem immNormalizedMatrix_second_trace_le_compatible (d : ℕ) (side : Fin (d + 1) → Bool) (a b : ℕ) : let A := immNormalizedMatrix (d + 1) side a b ((A.conjTranspose * A) ^ 2).trace.re ≤ ∑ M : ImmSourceIndex (d + 1) side a b, ∑ x : {x : Fin d → Pairings.Labels (Fin (d + 1)) // MomentPairing.Compatible 0 x}, ∏ t : Fin (d + 1), LocalMoments.localPolynomial (side t) (fun y => M.1 (t, y)) (MomentPairing.layerLabels 0 x.1 t).p (MomentPairing.layerLabels 0 x.1 t).q (MomentPairing.layerLabels 0 x.1 t).r := by classical refine (immNormalizedMatrix_second_trace_le_localPolynomial_sum (d + 1) (Nat.succ_pos d) side a b).trans_eq ?_ apply Finset.sum_congr rfl intro M hM have h := sum_four_immPaths_compatible_eq d side (fun P Q R _ => ∏ t : Fin (d + 1), LocalMoments.localPolynomial (side t) (fun y => M.1 (t, y)) (totalImmProfile (d + 1) P t) (totalImmProfile (d + 1) Q t) (totalImmProfile (d + 1) R t)) simp only [totalImmProfile_get, totalImmProfile_internal] at h convert h using 1 · rfl · apply Finset.sum_congr rfl intro x hx apply Finset.prod_congr rfl intro t ht rw [show x.1 = (fun i => ⟨(x.1 i).p, (x.1 i).q, (x.1 i).r, (x.1 i).s⟩) from rfl, layerLabels_immInternalCoordinate]
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166import OAI.Algebra.DepthFive.Basic
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335
variable {K : Type*} [CommSemiring K]
/-- A product of matrices whose entries are linear is homogeneous in its length. -/theorem matrix_list_prod_isHomogeneous {σ ι : Type*} [Fintype ι] [DecidableEq ι] (L : List (Matrix ι ι (MvPolynomial σ K))) (hL : ∀ A ∈ L, ∀ i j, (A i j).IsHomogeneous 1) (i j : ι) : (L.prod i j).IsHomogeneous L.length := by induction L generalizing i j with | nil => simp only [List.prod_nil, List.length_nil, Matrix.one_apply] split_ifs · exact MvPolynomial.isHomogeneous_one σ K · exact MvPolynomial.isHomogeneous_zero σ K 0 | cons A L ih => simp only [List.prod_cons, List.length_cons, Matrix.mul_apply] apply MvPolynomial.IsHomogeneous.sum intro k hk simpa only [Nat.add_comm] using (hL A (List.mem_cons_self) i k).mul (ih (fun B hB => hL B (List.mem_cons_of_mem A hB)) k j)
/-- The iterated matrix multiplication polynomial has its expected degree. -/theorem imm_isHomogeneous (K : Type*) [CommSemiring K] (n : ℕ) : (imm K n).IsHomogeneous n := by classical unfold imm split_ifs with hn · simpa only [List.length_ofFn] using matrix_list_prod_isHomogeneous (List.ofFn (fun t : Fin n => immLayer K n t)) (by intro A hA i j obtain ⟨t, rfl⟩ := List.mem_ofFn.mp hA exact MvPolynomial.isHomogeneous_X K (t, i, j)) (⟨0, hn⟩ : Fin n) (⟨0, hn⟩ : Fin n) · exact MvPolynomial.isHomogeneous_zero _ _ _
/-- Matrix multiplication adds weighted degrees, including repeated layer occurrences. -/theorem matrix_list_map_prod_isWeightedHomogeneous {σ ι τ M : Type*} [Fintype ι] [DecidableEq ι] [AddCommMonoid M] (w : σ → M) (A : τ → Matrix ι ι (MvPolynomial σ K)) (d : τ → M) (L : List τ) (hA : ∀ t ∈ L, ∀ i j, (A t i j).IsWeightedHomogeneous w (d t)) (i j : ι) : ((L.map A).prod i j).IsWeightedHomogeneous w (L.map d).sum := by induction L generalizing i j with | nil => simp only [List.map_nil, List.prod_nil, List.sum_nil, Matrix.one_apply] split_ifs · exact MvPolynomial.isWeightedHomogeneous_one K w · exact MvPolynomial.isWeightedHomogeneous_zero K w 0 | cons t L ih => simp only [List.map_cons, List.prod_cons, List.sum_cons, Matrix.mul_apply] apply MvPolynomial.IsWeightedHomogeneous.sum intro k hk exact (hA t List.mem_cons_self i k).mul (ih (fun s hs => hA s (List.mem_cons_of_mem t hs)) k j)
/-- Every monomial of IMM uses each matrix layer once, expressed with arbitrary additive weights. -/theorem imm_isWeightedHomogeneous (K : Type*) [CommSemiring K] (n : ℕ) {M : Type*} [AddCommMonoid M] (w : Fin n → M) : (imm K n).IsWeightedHomogeneous (fun x => w x.1) (∑ t, w t) := by classical unfold imm split_ifs with hn · simpa only [← List.ofFn_eq_map, List.sum_ofFn] using matrix_list_map_prod_isWeightedHomogeneous (fun x : Fin n × Fin n × Fin n => w x.1) (immLayer K n) w (List.finRange n) (fun t ht i j => MvPolynomial.isWeightedHomogeneous_X K _ (t, i, j)) (⟨0, hn⟩ : Fin n) (⟨0, hn⟩ : Fin n) · exact MvPolynomial.isWeightedHomogeneous_zero _ _ _
/-- The degree in any selected collection of matrix layers is its cardinality. -/theorem imm_layers_isWeightedHomogeneous (K : Type*) [CommSemiring K] (n : ℕ) (s : Finset (Fin n)) : (imm K n).IsWeightedHomogeneous (fun x => if x.1 ∈ s then 1 else 0) s.card := by classical simpa using imm_isWeightedHomogeneous K n (fun t => if t ∈ s then (1 : ℕ) else 0)
/-- A support monomial has degree exactly one in each individual matrix layer. -/theorem imm_support_layer_weight (K : Type*) [CommSemiring K] (n : ℕ) (t : Fin n) {d : (Fin n × Fin n × Fin n) →₀ ℕ} (hd : d ∈ (imm K n).support) : Finsupp.weight (fun x : Fin n × Fin n × Fin n => if x.1 = t then (1 : ℕ) else 0) d = 1 := by classical simpa using (imm_isWeightedHomogeneous K n (fun s => if s = t then (1 : ℕ) else 0)) (MvPolynomial.mem_support_iff.mp hd)
/-- IMM is multilinear in every matrix-entry variable. -/theorem imm_degreeOf_le_one (K : Type*) [CommSemiring K] (n : ℕ) (x : Fin n × Fin n × Fin n) : (imm K n).degreeOf x ≤ 1 := by classical apply MvPolynomial.degreeOf_le_iff.mpr intro d hd have hdeg := imm_support_layer_weight K n x.1 hd rw [Finsupp.weight_apply, Finsupp.sum] at hdeg by_cases hx : d x = 0 · simp [hx] · calc d x = d x • (if x.1 = x.1 then (1 : ℕ) else 0) := by simp _ ≤ ∑ y ∈ d.support, d y • (if y.1 = x.1 then (1 : ℕ) else 0) := Finset.single_le_sum (f := fun y => d y • (if y.1 = x.1 then (1 : ℕ) else 0)) (fun y hy => Nat.zero_le _) (Finsupp.mem_support_iff.mpr hx) _ = 1 := hdeg
/-- Evaluation assigning every matrix layer the identity matrix. -/def immIdentityEvaluation (K : Type*) [CommSemiring K] (n : ℕ) : MvPolynomial (Fin n × Fin n × Fin n) K →+* K := MvPolynomial.eval (fun x => if x.2.1 = x.2.2 then 1 else 0)
@[simp] theorem immIdentityEvaluation_layer (n : ℕ) (t : Fin n) : (immIdentityEvaluation K n).mapMatrix (immLayer K n t) = 1 := by classical ext i j simp [immIdentityEvaluation, immLayer, Matrix.one_apply]
/-- Evaluation at identity matrices sends any product of variable layers to the identity. -/theorem immIdentityEvaluation_layers (n : ℕ) (L : List (Fin n)) : (immIdentityEvaluation K n).mapMatrix ((L.map (immLayer K n)).prod) = 1 := by classical rw [map_list_prod, List.map_map] simp only [Function.comp_def, immIdentityEvaluation_layer] simp
@[simp] theorem immIdentityEvaluation_imm (n : ℕ) (hn : 0 < n) : immIdentityEvaluation K n (imm K n) = 1 := by classical unfold imm simp only [dite_eq_left hn] have h : (immIdentityEvaluation K n).mapMatrix (List.ofFn (fun t : Fin n => immLayer K n t)).prod = 1 := by rw [map_list_prod, List.map_ofFn] simp only [Function.comp_def, immIdentityEvaluation_layer] simp exact congrArg (fun A : Matrix (Fin n) (Fin n) K => A ⟨0, hn⟩ ⟨0, hn⟩) h
/-- IMM does not vanish over any nontrivial coefficient semiring when its size is positive. -/theorem imm_ne_zero (K : Type*) [CommSemiring K] [Nontrivial K] (n : ℕ) (hn : 0 < n) : imm K n ≠ 0 := by intro h have he := immIdentityEvaluation_imm (K := K) n hn rw [h, map_zero] at he exact zero_ne_one he
/-- The total degree of IMM is the number of matrix layers. -/theorem imm_totalDegree (K : Type*) [CommSemiring K] [Nontrivial K] (n : ℕ) : (imm K n).totalDegree = n := by by_cases hn : 0 < n · exact (imm_isHomogeneous K n).totalDegree (imm_ne_zero K n hn) · have hn0 : n = 0 := Nat.eq_zero_of_not_pos hn subst n simp [imm]
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190import OAI.Algebra.DepthFive.FiniteOperatorimport OAI.Algebra.DepthFive.ImmFockMatriximport OAI.Algebra.DepthFive.FockBidegreeBasisimport OAI.Algebra.DepthFive.TraceExpansionimport OAI.Algebra.DepthFive.PathInjectivity
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335
/-- The number of derivative layers in a layerwise partition. -/def immLayerVCount {n : ℕ} (side : Fin n → Bool) : ℕ := (Finset.univ.filter (fun t => side t = true)).card
/-- The number of multiplication layers in a layerwise partition. -/def immLayerUCount {n : ℕ} (side : Fin n → Bool) : ℕ := (Finset.univ.filter (fun t => side t = false)).card
/-- Source exponent vectors for the finite IMM operator. -/abbrev ImmSourceIndex (n : ℕ) (side : Fin n → Bool) (a b : ℕ) := BidegreeIndex (fun x : Fin n × Fin n × Fin n => side x.1) a b
/-- Target exponent vectors for the finite IMM operator. -/abbrev ImmTargetIndex (n : ℕ) (side : Fin n → Bool) (a b : ℕ) := BidegreeIndex (fun x : Fin n × Fin n × Fin n => side x.1) (a - immLayerVCount side) (b + immLayerUCount side)
/-- The actual finite IMM map written in factorial-normalized source and target bases. -/def immNormalizedMatrix (n : ℕ) (side : Fin n → Bool) (a b : ℕ) : Matrix (ImmTargetIndex n side a b) (ImmSourceIndex n side a b) ℂ := LinearMap.toMatrix (bidegreeComplexFockBasis (σ := Fin n × Fin n × Fin n) (fun x => side x.1) a b) (bidegreeComplexFockBasis (σ := Fin n × Fin n × Fin n) (fun x => side x.1) (a - immLayerVCount side) (b + immLayerUCount side)) (finiteMixedOperator (K := ℂ) (σ := Fin n × Fin n × Fin n) (fun x => side x.1) a b (immLayerVCount side) (immLayerUCount side) (imm ℂ n))
/-- Each finite normalized matrix entry is exactly the weighted sum of its IMM path shifts. -/theorem immNormalizedMatrix_apply (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) (e : ImmTargetIndex n side a b) (d : ImmSourceIndex n side a b) : immNormalizedMatrix n side a b e d = ∑ p : Fin (immPaths n hn).length, if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 then (immPathAmplitude n hn (fun x => side x.1) d.1 p : ℂ) else 0 := by classical unfold immNormalizedMatrix rw [LinearMap.toMatrix_apply, bidegreeComplexFockBasis_repr] change (Real.sqrt (multiFactorial e.1 : ℝ) : ℂ) * (mixedOperator (fun x => side x.1) (bidegreeComponent (fun x => side x.1) (immLayerVCount side) (immLayerUCount side) (imm ℂ n)) ((bidegreeComplexFockBasis (σ := Fin n × Fin n × Fin n) (fun x => side x.1) a b d) : MvPolynomial (Fin n × Fin n × Fin n) ℂ)).coeff e.1 = _ rw [bidegreeComplexFockBasis_apply] simp only [immLayerVCount, immLayerUCount, bidegreeComponent_imm] rw [← complexFockBasis_repr] exact complexFockBasis_repr_mixedOperator_imm n hn (fun x => side x.1) d.1 e.1
/-- The finite normalized matrix computes exactly the manuscript's rank measure. -/theorem immNormalizedMatrix_rank (n : ℕ) (side : Fin n → Bool) (a b : ℕ) : (immNormalizedMatrix n side a b).rank = bidegreeRank (fun x => side x.1) a b (immLayerVCount side) (immLayerUCount side) (imm ℂ n) := by rw [immNormalizedMatrix, ← RankMeasure.mapRank_eq_matrixRank, finiteMixedOperator_rank]
/-- The genuine target occupation, with an irrelevant fallback for zero-amplitude paths. -/def immTargetShift (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)] (d : ImmSourceIndex n side a b) (p : Fin (immPaths n hn).length) : ImmTargetIndex n side a b := by classical exact if h : Finsupp.weight (bidegreeWeight (fun x => side x.1)) (immPathOccupation n hn (fun x => side x.1) d.1 p) = (a - immLayerVCount side, b + immLayerUCount side) then ⟨_, h⟩ else Classical.choice inferInstance
/-- Nonzero paths never use the arbitrary fallback index. -/theorem immTargetShift_val_of_amplitude_ne_zero (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)] (d : ImmSourceIndex n side a b) (p : Fin (immPaths n hn).length) (hp : immPathAmplitude n hn (fun x => side x.1) d.1 p ≠ 0) : (immTargetShift n hn side a b d p).1 = immPathOccupation n hn (fun x => side x.1) d.1 p := by have h := immPathOccupation_bidegree_of_amplitude_ne_zero n hn side a b d.1 d.2 p hp unfold immTargetShift split_ifs with hdegree · rfl · exact False.elim (hdegree h)
/-- The actual normalized IMM matrix is the finite weighted path-shift matrix. -/theorem immNormalizedMatrix_eq_pathShiftMatrix (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)] : immNormalizedMatrix n side a b = pathShiftMatrix (immTargetShift n hn side a b) (fun d p => (immPathAmplitude n hn (fun x => side x.1) d.1 p : ℂ)) := by classical ext e d rw [immNormalizedMatrix_apply n hn side a b e d] unfold pathShiftMatrix apply Finset.sum_congr rfl intro p hp by_cases ha : immPathAmplitude n hn (fun x => side x.1) d.1 p = 0 · simp [ha] · have hs := immTargetShift_val_of_amplitude_ne_zero n hn side a b d p ha have he : immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 ↔ immTargetShift n hn side a b d p = e := by rw [Subtype.ext_iff, hs] simp only [he]
/-- Distinct nonzero path contributions cannot reach the same occupation vector. -/theorem immPathOccupation_injective_of_nonzero (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (d : (Fin n × Fin n × Fin n) →₀ ℕ) (p q : Fin (immPaths n hn).length) (hp : immPathAmplitude n hn (fun x => side x.1) d p ≠ 0) (hq : immPathAmplitude n hn (fun x => side x.1) d q ≠ 0) (heq : immPathOccupation n hn (fun x => side x.1) d p = immPathOccupation n hn (fun x => side x.1) d q) : p = q := by have hsp := signedOccupation_path_of_amplitude_ne_zero (fun x : Fin n × Fin n × Fin n => side x.1) ((immPaths n hn).get p) (immPaths_nodup n hn _ (List.get_mem _ p)) d hp have hsq := signedOccupation_path_of_amplitude_ne_zero (fun x : Fin n × Fin n × Fin n => side x.1) ((immPaths n hn).get q) (immPaths_nodup n hn _ (List.get_mem _ q)) d hq have hs := congrArg signedOccupation heq change signedOccupation (pathOccupation _ _ _) = signedOccupation (pathOccupation _ _ _) at hs rw [hsp, hsq] at hs have hshift := add_left_cancel hs apply immPaths_get_injective n hn apply edgeListShift_injective_of_labels side (List.finRange n) (List.nodup_finRange n) _ _ (immPaths_labels n hn _ (List.get_mem _ p)) (immPaths_labels n hn _ (List.get_mem _ q)) simpa only [edgeListShift_eq_sum, occupationShift] using hshift
/-- Any collision of distinct finite shifts has a zero-amplitude contribution. -/theorem immTargetShift_collision_zero (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)] (d : ImmSourceIndex n side a b) (p q : Fin (immPaths n hn).length) (hpq : p ≠ q) (hs : immTargetShift n hn side a b d p = immTargetShift n hn side a b d q) : immPathAmplitude n hn (fun x => side x.1) d.1 p = 0 ∨ immPathAmplitude n hn (fun x => side x.1) d.1 q = 0 := by by_cases hp : immPathAmplitude n hn (fun x => side x.1) d.1 p = 0 · exact Or.inl hp by_cases hq : immPathAmplitude n hn (fun x => side x.1) d.1 q = 0 · exact Or.inr hq apply False.elim apply hpq apply immPathOccupation_injective_of_nonzero n hn side d.1 p q hp hq have hv := congrArg Subtype.val hs simpa only [immTargetShift_val_of_amplitude_ne_zero n hn side a b d p hp, immTargetShift_val_of_amplitude_ne_zero n hn side a b d q hq] using hv
/-- All entries of the normalized IMM operator are real, so adjoint equals transpose. -/theorem immNormalizedMatrix_conjTranspose (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) : (immNormalizedMatrix n side a b).conjTranspose = (immNormalizedMatrix n side a b).transpose := by classical ext d e simp only [Matrix.conjTranspose_apply, Matrix.transpose_apply, immNormalizedMatrix_apply n hn side a b] simp only [star_sum] apply Finset.sum_congr rfl intro p hp split_ifs <;> simp
/-- The first Gram trace of the actual IMM operator is its total path occupation mass. -/theorem immNormalizedMatrix_first_trace (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)] : Matrix.trace ((immNormalizedMatrix n side a b).conjTranspose * immNormalizedMatrix n side a b) = ∑ d : ImmSourceIndex n side a b, ∑ p : Fin (immPaths n hn).length, ((immPathAmplitude n hn (fun x => side x.1) d.1 p) ^ 2 : ℝ) := by classical rw [immNormalizedMatrix_conjTranspose n hn side a b, immNormalizedMatrix_eq_pathShiftMatrix n hn side a b, pathShiftMatrix_first_trace] · simp · intro d p q hpq hs rcases immTargetShift_collision_zero n hn side a b d p q hpq hs with hp | hq · simp [hp] · simp [hq]
end Problem335
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859import OAI.Algebra.DepthFive.ImmFirstTraceimport OAI.Algebra.DepthFive.PathMassLowerBound
namespace OAI
noncomputable sectionopen scoped BigOperators Matrix
namespace Problem335
/-- The independent geometric benchmark for one IMM path. -/def immFirstMomentMean (n : ℕ) (side : Fin n → Bool) (a b : ℕ) : ℝ := ((a : ℝ) / Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = true}) ^ immLayerVCount side * (1 + (b : ℝ) / Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = false}) ^ immLayerUCount side
/-- The explicit finite-size occupation loss, before parameter specialization. -/def immFirstMomentLoss (n : ℕ) (side : Fin n → Bool) (a b : ℕ) : ℝ := (immLayerVCount side : ℝ) ^ 2 / a + (immLayerVCount side : ℝ) ^ 2 / (2 * Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = true}) + (immLayerUCount side : ℝ) ^ 2 / b + (immLayerUCount side : ℝ) ^ 2 / (2 * Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = false})
/-- First-moment lower bound for the actual finite normalized IMM matrix.The only hypotheses are positive occupation totals, nonempty variable groups,and the elementary order range required by the occupation ratio estimate. -/theorem immNormalizedMatrix_first_moment_lower (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) [Nonempty {x : Fin n × Fin n × Fin n // side x.1 = true}] [Nonempty {x : Fin n × Fin n × Fin n // side x.1 = false}] (ha : 0 < a) (hb : 0 < b) (hk : 2 * immLayerVCount side ≤ a) (hm : 2 * immLayerUCount side ≤ b) : (Fintype.card (ImmSourceIndex n side a b) : ℝ) * (n : ℝ) ^ (n - 1) * (Real.exp (-immFirstMomentLoss n side a b) * immFirstMomentMean n side a b) ≤ ((immNormalizedMatrix n side a b).conjTranspose * immNormalizedMatrix n side a b).trace.re := by classical apply immNormalizedMatrix_first_trace_lower_of_average n hn side a b intro p have h := immPath_source_mass_lower n hn side a b ((immPaths n hn).get p) (List.get_mem _ p) ha hb hk hm change _ ≤ (∑ d : ImmSourceIndex n side a b, immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2) / (Fintype.card (ImmSourceIndex n side a b) : ℝ) at h convert h using 1 apply congrArg₂ (fun x y : ℝ => x * y) · apply congrArg Real.exp dsimp [immFirstMomentLoss, immLayerVCount, immLayerUCount] ring · rfl
end Problem335
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364import OAI.Algebra.DepthFive.ImmFirstTraceimport OAI.Algebra.DepthFive.PathMassParameters
namespace OAI
noncomputable sectionopen scoped BigOperators Matrix
namespace Problem335
open LowerParameters
/-- The first trace of the actual finite normalized IMM matrix at the canonicaloccupation parameters. The path-count and geometric scale agree with the secondmoment normalization; there are no auxiliary matrix-identity hypotheses. -/theorem immNormalizedMatrix_first_moment_lower_parameters {n : ℕ} (hn : 16 ≤ n) (side : Fin n → Bool) (hk : immLayerVCount side = k n) (hm : immLayerUCount side = m n) : (Fintype.card (ImmSourceIndex n side (a n) (b n)) : ℝ) * ((n : ℝ) ^ (n - 1) * (((a n : ℝ) / v n) ^ k n * (1 + (b n : ℝ) / u n) ^ m n)) * Real.exp (-64 / Real.sqrt (n : ℝ)) ≤ ((immNormalizedMatrix n side (a n) (b n)).conjTranspose * immNormalizedMatrix n side (a n) (b n)).trace.re := by classical have h := immNormalizedMatrix_first_trace_lower_of_average n (by omega) side (a n) (b n) (Real.exp (-64 / Real.sqrt (n : ℝ)) * (((a n : ℝ) / v n) ^ k n * (1 + (b n : ℝ) / u n) ^ m n)) (by intro p have hpath := immPath_source_mass_lower_parameters hn side hk hm ((immPaths n (by omega)).get p) (List.get_mem _ p) change _ ≤ (∑ d : ImmSourceIndex n side (a n) (b n), immPathAmplitude n (by omega) (fun x => side x.1) d.1 p ^ 2) / (Fintype.card (ImmSourceIndex n side (a n) (b n)) : ℝ) at hpath exact hpath) simpa only [mul_assoc, mul_left_comm, mul_comm] using h
/-- A weaker square-root-exponential version is convenient for the finalrank lower bound, whose constant absorbs both trace losses. -/theorem immNormalizedMatrix_first_moment_lower_sqrt {n : ℕ} (hn : 16 ≤ n) (side : Fin n → Bool) (hk : immLayerVCount side = k n) (hm : immLayerUCount side = m n) : (Fintype.card (ImmSourceIndex n side (a n) (b n)) : ℝ) * ((n : ℝ) ^ (n - 1) * (((a n : ℝ) / v n) ^ k n * (1 + (b n : ℝ) / u n) ^ m n)) * Real.exp (-64 * Real.sqrt (n : ℝ)) ≤ ((immNormalizedMatrix n side (a n) (b n)).conjTranspose * immNormalizedMatrix n side (a n) (b n)).trace.re := by have hs := sqrt_ge_four hn have hspos : 0 < Real.sqrt (n : ℝ) := by linarith have hexp : Real.exp (-64 * Real.sqrt (n : ℝ)) ≤ Real.exp (-64 / Real.sqrt (n : ℝ)) := by apply Real.exp_le_exp.mpr apply (le_div_iff₀ hspos).mpr nlinarith [sq_nonneg (Real.sqrt (n : ℝ) - 1)] exact (mul_le_mul_of_nonneg_left hexp (by positivity)).trans (immNormalizedMatrix_first_moment_lower_parameters hn side hk hm)
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129import OAI.Algebra.DepthFive.ImmFiniteMatriximport OAI.Algebra.DepthFive.FirstTraceNonnegative
namespace OAI
noncomputable sectionopen scoped BigOperators Matrix
namespace Problem335
/-- The real, nonnegative matrix underlying the actual normalized IMM map. -/def immRealNormalizedMatrix (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) : Matrix (ImmTargetIndex n side a b) (ImmSourceIndex n side a b) ℝ := by classical exact fun e d => ∑ p : Fin (immPaths n hn).length, if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 then immPathAmplitude n hn (fun x => side x.1) d.1 p else 0
theorem immNormalizedMatrix_eq_map_real (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) : immNormalizedMatrix n side a b = (immRealNormalizedMatrix n hn side a b).map Complex.ofReal := by classical ext e d rw [immNormalizedMatrix_apply n hn] simp only [Matrix.map_apply, immRealNormalizedMatrix, Complex.ofReal_sum] apply Finset.sum_congr rfl intro p hp split_ifs <;> simp
/-- Every nonzero path amplitude occurs in exactly one genuine target row.Zero-amplitude paths need no artificial target-row choice. -/theorem immPathAmplitude_sq_sum_target (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) (d : ImmSourceIndex n side a b) (p : Fin (immPaths n hn).length) : (∑ e : ImmTargetIndex n side a b, (if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 then immPathAmplitude n hn (fun x => side x.1) d.1 p else 0) ^ 2) = immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2 := by classical by_cases hw : immPathAmplitude n hn (fun x => side x.1) d.1 p = 0 · simp [hw] let e : ImmTargetIndex n side a b := ⟨immPathOccupation n hn (fun x => side x.1) d.1 p, immPathOccupation_bidegree_of_amplitude_ne_zero n hn side a b d.1 d.2 p hw⟩ rw [Finset.sum_eq_single e] · simp [e] · intro e' he' hne have hocc : immPathOccupation n hn (fun x => side x.1) d.1 p ≠ e'.1 := by intro heq apply hne exact Subtype.ext heq.symm simp [hocc] · simp
/-- Actual normalized IMM first trace dominates the total occupation mass.Nonnegative coefficients make path-collision analysis unnecessary for thislower bound. All sources and targets are the genuine finite bidegree spaces. -/theorem immNormalizedMatrix_first_trace_lower (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) : (∑ d : ImmSourceIndex n side a b, ∑ p : Fin (immPaths n hn).length, immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2) ≤ ((immNormalizedMatrix n side a b).conjTranspose * immNormalizedMatrix n side a b).trace.re := by classical rw [immNormalizedMatrix_eq_map_real n hn, complexify_first_trace, trace_transpose_mul_self] apply Finset.sum_le_sum intro d hd calc _ = ∑ p : Fin (immPaths n hn).length, ∑ e : ImmTargetIndex n side a b, (if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 then immPathAmplitude n hn (fun x => side x.1) d.1 p else 0) ^ 2 := by apply Finset.sum_congr rfl intro p hp exact (immPathAmplitude_sq_sum_target n hn side a b d p).symm _ = ∑ e : ImmTargetIndex n side a b, ∑ p : Fin (immPaths n hn).length, (if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 then immPathAmplitude n hn (fun x => side x.1) d.1 p else 0) ^ 2 := Finset.sum_comm _ ≤ _ := by apply Finset.sum_le_sum intro e he apply Finset.sum_sq_le_sq_sum_of_nonneg intro p hp split_ifs · exact immPathAmplitude_nonneg n hn _ d.1 p · exact le_rfl
/-- Uniform actual-source occupation averages lift to the normalized IMMfirst trace with exactly `n^(n-1)` endpoint paths. -/theorem immNormalizedMatrix_first_trace_lower_of_average (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) (L : ℝ) (hmean : ∀ p : Fin (immPaths n hn).length, L ≤ (∑ d : ImmSourceIndex n side a b, immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2) / (Fintype.card (ImmSourceIndex n side a b) : ℝ)) : (Fintype.card (ImmSourceIndex n side a b) : ℝ) * (n : ℝ) ^ (n - 1) * L ≤ ((immNormalizedMatrix n side a b).conjTranspose * immNormalizedMatrix n side a b).trace.re := by classical have hsum (p : Fin (immPaths n hn).length) : (Fintype.card (ImmSourceIndex n side a b) : ℝ) * L ≤ ∑ d : ImmSourceIndex n side a b, immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2 := by by_cases hz : Fintype.card (ImmSourceIndex n side a b) = 0 · simp only [hz, Nat.cast_zero, zero_mul] exact Finset.sum_nonneg (fun d _ => sq_nonneg _) · have hpos : (0 : ℝ) < Fintype.card (ImmSourceIndex n side a b) := by exact_mod_cast Nat.pos_of_ne_zero hz simpa only [mul_comm] using (le_div_iff₀ hpos).mp (hmean p) calc _ = ∑ p : Fin (immPaths n hn).length, (Fintype.card (ImmSourceIndex n side a b) : ℝ) * L := by simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, immPaths_length, nsmul_eq_mul, Nat.cast_pow] ring _ ≤ ∑ p : Fin (immPaths n hn).length, ∑ d : ImmSourceIndex n side a b, immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2 := Finset.sum_le_sum (fun p _ => hsum p) _ = ∑ d : ImmSourceIndex n side a b, ∑ p : Fin (immPaths n hn).length, immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2 := Finset.sum_comm _ ≤ _ := immNormalizedMatrix_first_trace_lower n hn side a b
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161import OAI.Algebra.DepthFive.ImmOperatorPathsimport OAI.Algebra.DepthFive.FockPathsimport OAI.Algebra.DepthFive.ImmBidegreeimport OAI.Algebra.DepthFive.FiniteOperator
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335
/-- The normalized coefficient contributed by one endpoint path of IMM. -/def immPathAmplitude (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) (d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) : ℝ := (((immPaths n hn).get p).map (occupationAmplitude isV d)).prod
/-- The final occupation vector of one path operator. -/def immPathOccupation (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) (d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) : (Fin n × Fin n × Fin n) →₀ ℕ := pathOccupation isV ((immPaths n hn).get p) d
theorem immPathAmplitude_nonneg (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) (d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) : 0 ≤ immPathAmplitude n hn isV d p := by apply List.prod_nonneg intro x hx obtain ⟨i, hi, rfl⟩ := List.mem_map.mp hx exact occupationAmplitude_nonneg isV d i
/-- The actual IMM operator on a normalized monomial is the sum of its sparse path actions. -/theorem mixedOperator_imm_complexFockMonomial (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) (d : (Fin n × Fin n × Fin n) →₀ ℕ) : mixedOperator isV (imm ℂ n) (complexFockMonomial d) = ∑ p : Fin (immPaths n hn).length, (immPathAmplitude n hn isV d p : ℂ) • complexFockMonomial (immPathOccupation n hn isV d p) := by rw [mixedOperator_imm_apply_eq_sum_paths n hn isV] apply Finset.sum_congr rfl intro p hp have h := mixedOperator_path_complexFockMonomial isV ((immPaths n hn).get p) (immPaths_nodup n hn _ (List.get_mem _ p)) d simpa only [map_list_prod, List.map_map, Function.comp_def, mixedOperator_X, immPathAmplitude, immPathOccupation] using h
/-- Normalized matrix entries of the actual IMM operator are weighted path-shift counts. -/theorem complexFockBasis_repr_mixedOperator_imm (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) (d e : (Fin n × Fin n × Fin n) →₀ ℕ) : complexFockBasis.repr (mixedOperator isV (imm ℂ n) (complexFockMonomial d)) e = ∑ p : Fin (immPaths n hn).length, if immPathOccupation n hn isV d p = e then (immPathAmplitude n hn isV d p : ℂ) else 0 := by classical rw [mixedOperator_imm_complexFockMonomial n hn isV] simp only [map_sum, map_smul, Finsupp.finsetSum_apply, Finsupp.smul_apply] apply Finset.sum_congr rfl intro p hp rw [← complexFockBasis_apply, Module.Basis.repr_self] simp [Finsupp.single_apply]
/-- A product of variables has the sum of their assigned weighted degrees. -/theorem variable_list_product_isWeightedHomogeneous {K σ M : Type*} [CommSemiring K] [AddCommMonoid M] (w : σ → M) (l : List σ) : ((l.map (MvPolynomial.X : σ → MvPolynomial σ K)).prod).IsWeightedHomogeneous w (l.map w).sum := by induction l with | nil => simpa using MvPolynomial.isWeightedHomogeneous_one K w | cons x l ih => simpa only [List.map_cons, List.prod_cons, List.sum_cons] using (MvPolynomial.isWeightedHomogeneous_X K w x).mul ih
/-- The path monomials all have the same layerwise bidegree as IMM. -/theorem immPath_product_mem_bidegreeSubmodule (K : Type*) [CommSemiring K] (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (p : Fin (immPaths n hn).length) : ((((immPaths n hn).get p).map (MvPolynomial.X (R := K))).prod) ∈ bidegreeSubmodule (fun x => side x.1) (Finset.univ.filter (fun t => side t = true)).card (Finset.univ.filter (fun t => side t = false)).card := by have h := variable_list_product_isWeightedHomogeneous (K := K) (fun x : Fin n × Fin n × Fin n => bidegreeWeight side x.1) ((immPaths n hn).get p) have hl := immPaths_labels n hn _ (List.get_mem _ p) have hs := congrArg (fun l : List (Fin n) => (l.map (bidegreeWeight side)).sum) hl simp only [List.map_map, Function.comp_def, ← List.ofFn_eq_map, List.sum_ofFn] at hs rw [hs] at h have he : (∑ t, bidegreeWeight side t) = ((Finset.univ.filter (fun t => side t = true)).card, (Finset.univ.filter (fun t => side t = false)).card) := by apply Prod.ext · simp only [Prod.fst_sum, Finset.card_filter] apply Finset.sum_congr rfl intro t ht cases ht' : side t <;> simp [bidegreeWeight, ht'] · simp only [Prod.snd_sum, Finset.card_filter] apply Finset.sum_congr rfl intro t ht cases ht' : side t <;> simp [bidegreeWeight, ht'] rw [he] at h exact h
/-- A nonzero scalar multiple of a normalized monomial determines its weighted degree. -/theorem weight_eq_of_complexFockMonomial_smul_mem {σ M : Type*} [Fintype σ] [DecidableEq σ] [AddCommMonoid M] (w : σ → M) (d : σ →₀ ℕ) (a : M) (c : ℂ) (hc : c ≠ 0) (h : (c • complexFockMonomial d).IsWeightedHomogeneous w a) : Finsupp.weight w d = a := by apply h (d := d) rw [MvPolynomial.coeff_smul, complexFockMonomial_eq, MvPolynomial.coeff_monomial] simp only [smul_eq_mul] apply mul_ne_zero hc exact inv_ne_zero (by exact_mod_cast (sqrt_multiFactorial_pos d).ne')
/-- A nonzero path amplitude guarantees that its occupation lies in the genuine target bidegree. -/theorem immPathOccupation_bidegree_of_amplitude_ne_zero (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) (d : (Fin n × Fin n × Fin n) →₀ ℕ) (hd : Finsupp.weight (bidegreeWeight (fun x => side x.1)) d = (a, b)) (p : Fin (immPaths n hn).length) (hp : immPathAmplitude n hn (fun x => side x.1) d p ≠ 0) : Finsupp.weight (bidegreeWeight (fun x => side x.1)) (immPathOccupation n hn (fun x => side x.1) d p) = (a - (Finset.univ.filter (fun t => side t = true)).card, b + (Finset.univ.filter (fun t => side t = false)).card) := by have hinput : complexFockMonomial d ∈ bidegreeSubmodule (fun x => side x.1) a b := by rw [complexFockMonomial_eq] exact MvPolynomial.isWeightedHomogeneous_monomial _ _ _ hd have hpoly := immPath_product_mem_bidegreeSubmodule ℂ n hn side p have hout := mixedOperator_mem_bidegreeSubmodule_all (K := ℂ) (σ := Fin n × Fin n × Fin n) (q := (((immPaths n hn).get p).map (MvPolynomial.X (R := ℂ))).prod) (p := complexFockMonomial d) (k := (Finset.univ.filter (fun t => side t = true)).card) (m := (Finset.univ.filter (fun t => side t = false)).card) (a := a) (b := b) (fun x => side x.1) hpoly hinput have hact := mixedOperator_path_complexFockMonomial (fun x => side x.1) ((immPaths n hn).get p) (immPaths_nodup n hn _ (List.get_mem _ p)) d rw [hact] at hout exact weight_eq_of_complexFockMonomial_smul_mem _ _ _ _ (by exact_mod_cast hp) hout
/-- Squared path amplitudes are the occupation monomials occurring in the moment calculation. -/theorem immPathAmplitude_sq (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) (d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) : (immPathAmplitude n hn isV d p) ^ 2 = (((immPaths n hn).get p).map (fun i => if isV i then (d i : ℝ) else (d i : ℝ) + 1)).prod := pathAmplitude_sq isV _ d
end Problem335
end
end OAI12345678910111213141516171819202122232425262728293031323334import OAI.Algebra.DepthFive.Basic
namespace OAI
noncomputable sectionuniverse u v
namespace Problem335
/-- Iterated matrix multiplication commutes with change of coefficient semiring. -/@[simp] theorem map_imm {K : Type u} {L : Type v} [CommSemiring K] [CommSemiring L] (f : K →+* L) (n : ℕ) : MvPolynomial.map f (imm K n) = imm L n := by classical by_cases hn : 0 < n · simp only [imm, dite_eq_left hn] let F := (MvPolynomial.map (σ := Fin n × Fin n × Fin n) f).mapMatrix (m := Fin n) have h := F.map_list_prod (List.ofFn (fun t : Fin n => immLayer K n t)) have hm : (List.ofFn (fun t : Fin n => immLayer K n t)).map F = List.ofFn (fun t : Fin n => immLayer L n t) := by simp only [List.map_ofFn] congr 1 funext t i j simp [F, immLayer] change F (List.ofFn (fun t : Fin n => immLayer K n t)).prod = ((List.ofFn (fun t : Fin n => immLayer K n t)).map F).prod at h rw [hm] at h exact congrArg (fun M => M ⟨0, hn⟩ ⟨0, hn⟩) h · simp [imm, hn]
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190import OAI.Algebra.DepthFive.Basicimport OAI.Algebra.DepthFive.MatrixPathsimport OAI.Algebra.DepthFive.MixedOperator
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335
open MvPolynomial
/-- Enumerating labelled matrix paths never repeats an edge list. -/private theorem immOperatorPaths_enumeration_nodup {σ ι : Type*} [Fintype ι] [DecidableEq ι] (labels : List σ) (i j : ι) : (matrixEntryPaths labels i j).Nodup := by induction labels generalizing i with | nil => by_cases hij : i = j <;> simp [matrixEntryPaths, hij] | cons t ts ih => cases ts with | nil => simp [matrixEntryPaths] | cons u us => rw [matrixEntryPaths, List.nodup_flatMap] constructor · intro k hk exact List.Nodup.map (fun p q h => (List.cons.inj h).2) (ih k) · apply (Finset.nodup_toList _).pairwise_of_forall_ne intro a ha b hb hab p hp hq obtain ⟨q, hq', rfl⟩ := List.mem_map.mp hp obtain ⟨r, hr, heq⟩ := List.mem_map.mp hq simp only [List.cons.injEq, Prod.mk.injEq] at heq exact hab heq.1.2.2.symm
/-- The canonical labelled paths contributing to the endpoint IMM entry. -/def immPaths (n : ℕ) (hn : 0 < n) : List (List (Fin n × Fin n × Fin n)) := matrixEntryPaths (List.finRange n) ⟨0, hn⟩ ⟨0, hn⟩
/-- Every IMM path uses exactly one coordinate in each layer, in layer order. -/theorem immPaths_labels (n : ℕ) (hn : 0 < n) (p : List (Fin n × Fin n × Fin n)) (hp : p ∈ immPaths n hn) : p.map Prod.fst = List.finRange n := matrixEntryPaths_labels _ _ _ _ hp
/-- Distinct path indices select distinct edge lists. -/theorem immPaths_get_injective (n : ℕ) (hn : 0 < n) : Function.Injective (immPaths n hn).get := by apply List.nodup_iff_injective_get.mp exact immOperatorPaths_enumeration_nodup _ _ _
/-- The number of endpoint paths is `n^(n-1)`. -/theorem immPaths_length (n : ℕ) (hn : 0 < n) : (immPaths n hn).length = n ^ (n - 1) := by unfold immPaths rw [matrixEntryPaths_length _ (by simpa using (Nat.ne_of_gt hn))] simp
variable {K : Type*} [CommSemiring K]
/-- The endpoint IMM polynomial is the sum of its labelled path monomials. -/theorem imm_eq_sum_path_products (n : ℕ) (hn : 0 < n) : imm K n = ((immPaths n hn).map fun p => (p.map (X (R := K))).prod).sum := by have h := matrixEntryPaths_sum_prod (immLayer K n) (List.finRange n) (⟨0, hn⟩ : Fin n) (⟨0, hn⟩ : Fin n) simp only [imm, dite_eq_left hn, List.ofFn_eq_map] exact h.symm
/-- The full IMM polynomial operator is a sum of products of its edge operators. -/theorem mixedOperator_imm_eq_sum_paths (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) : mixedOperator (K := K) isV (imm K n) = ((immPaths n hn).map fun p => (p.map (variableOperator (K := K) isV)).prod).sum := by rw [imm_eq_sum_path_products n hn, map_list_sum] simp only [List.map_map, Function.comp_def, map_list_prod, mixedOperator_X]
/-- Each individual IMM path contains no repeated variable. -/theorem immPaths_nodup (n : ℕ) (hn : 0 < n) (p : List (Fin n × Fin n × Fin n)) (hp : p ∈ immPaths n hn) : p.Nodup := by apply List.Nodup.of_map Prod.fst rw [immPaths_labels n hn p hp] exact List.nodup_finRange n
/-- The operator expansion indexed by the finite type of paths. -/theorem mixedOperator_imm_eq_sum_paths_fin (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) : mixedOperator (K := K) isV (imm K n) = ∑ p : Fin (immPaths n hn).length, (((immPaths n hn).get p).map (variableOperator (K := K) isV)).prod := by rw [mixedOperator_imm_eq_sum_paths n hn isV] symm simpa only [List.get_eq_getElem] using (Fin.sum_univ_fun_getElem (immPaths n hn) (fun p => (p.map (variableOperator (K := K) isV)).prod))
/-- Applying the IMM operator is the sum of its individual path actions. -/theorem mixedOperator_imm_apply_eq_sum_paths (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) (f : MvPolynomial (Fin n × Fin n × Fin n) K) : mixedOperator isV (imm K n) f = ∑ p : Fin (immPaths n hn).length, ((((immPaths n hn).get p).map (variableOperator isV)).prod) f := by rw [mixedOperator_imm_eq_sum_paths_fin n hn isV, LinearMap.sum_apply]
/-- Coefficients of the IMM operator are finite sums of path coefficients. -/theorem coeff_mixedOperator_imm_eq_sum_paths (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) (f : MvPolynomial (Fin n × Fin n × Fin n) K) (d : (Fin n × Fin n × Fin n) →₀ ℕ) : (mixedOperator isV (imm K n) f).coeff d = ∑ p : Fin (immPaths n hn).length, (((((immPaths n hn).get p).map (variableOperator isV)).prod) f).coeff d := by rw [mixedOperator_imm_apply_eq_sum_paths n hn isV f, coeff_sum]
/-- Extend internal vertex choices by the two fixed endpoint vertices. -/def immInternalPathVertices (d : ℕ) (p : Fin d → Fin (d + 1)) : Fin (d + 2) → Fin (d + 1) := Fin.cons (α := fun _ => Fin (d + 1)) 0 (Fin.snoc p 0)
/-- The edge list associated to the tuple of internal vertices. -/def immInternalPathEdges (d : ℕ) (p : Fin d → Fin (d + 1)) : List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) := List.ofFn fun t : Fin (d + 1) => (t, Fin.cons (α := fun _ => Fin (d + 1)) 0 p t, Fin.snoc (α := fun _ => Fin (d + 1)) p 0 t)
@[simp] theorem immInternalPathVertices_start (d : ℕ) (p : Fin d → Fin (d + 1)) : immInternalPathVertices d p 0 = 0 := by simp [immInternalPathVertices]
@[simp] theorem immInternalPathVertices_end (d : ℕ) (p : Fin d → Fin (d + 1)) : immInternalPathVertices d p (Fin.last (d + 1)) = 0 := by simp [immInternalPathVertices]
@[simp] theorem immInternalPathVertices_castSucc (d : ℕ) (p : Fin d → Fin (d + 1)) (t : Fin (d + 1)) : immInternalPathVertices d p t.castSucc = Fin.cons (α := fun _ => Fin (d + 1)) 0 p t := by simp [immInternalPathVertices, Fin.cons_snoc_eq_snoc_cons]
@[simp] theorem immInternalPathVertices_succ (d : ℕ) (p : Fin d → Fin (d + 1)) (t : Fin (d + 1)) : immInternalPathVertices d p t.succ = Fin.snoc (α := fun _ => Fin (d + 1)) p 0 t := by simp [immInternalPathVertices]
/-- Extending by endpoints does not identify different internal paths. -/theorem immInternalPathVertices_injective (d : ℕ) : Function.Injective (immInternalPathVertices d) := by intro p q h funext t have hh := congrFun h t.castSucc.succ simpa [immInternalPathVertices] using hh
/-- The edge list has every layer as its first coordinate, exactly once. -/theorem immInternalPathEdges_labels (d : ℕ) (p : Fin d → Fin (d + 1)) : (immInternalPathEdges d p).map Prod.fst = List.finRange (d + 1) := by rw [immInternalPathEdges, List.map_ofFn] exact List.ofFn_id _
/-- Internal-vertex edge lists have no repeated variable. -/theorem immInternalPathEdges_nodup (d : ℕ) (p : Fin d → Fin (d + 1)) : (immInternalPathEdges d p).Nodup := by apply List.Nodup.of_map Prod.fst rw [immInternalPathEdges_labels] exact List.nodup_finRange _
/-- The IMM expansion using the canonical tuple of internal vertices. -/theorem imm_succ_eq_sum_internal_paths (d : ℕ) : imm K (d + 1) = ∑ p : Fin d → Fin (d + 1), ((immInternalPathEdges d p).map (X (R := K))).prod := by simp only [imm, Nat.succ_pos, dite_eq_left] rw [matrix_ofFn_prod_eq_sum_paths] simp [immInternalPathEdges, List.map_ofFn, Function.comp_def, immLayer]
/-- The actual IMM operator as a sum over internal vertex tuples. -/theorem mixedOperator_imm_succ_eq_sum_internal_paths (d : ℕ) (isV : (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) → Bool) : mixedOperator (K := K) isV (imm K (d + 1)) = ∑ p : Fin d → Fin (d + 1), ((immInternalPathEdges d p).map (variableOperator (K := K) isV)).prod := by rw [imm_succ_eq_sum_internal_paths d, map_sum] apply Finset.sum_congr rfl intro p hp simp only [map_list_prod, List.map_map, Function.comp_def, mixedOperator_X]
end Problem335
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950import OAI.Algebra.DepthFive.ImmPathCompatibilityimport OAI.Algebra.DepthFive.SecondMomentPairing
namespace OAI
noncomputable section
namespace Problem335
/-- Closing the four internal IMM paths gives the canonical endpoint-fixed labels. -/theorem closePaths_immInternalPathVertices (d : ℕ) (p q r s : Fin d → Fin (d + 1)) (t : Fin (d + 2)) : Pairings.closePaths 0 (fun i => ⟨p i, q i, r i, s i⟩) t = (⟨immInternalPathVertices d p t, immInternalPathVertices d q t, immInternalPathVertices d r t, immInternalPathVertices d s t⟩ : Pairings.Labels (Fin (d + 1))) := by refine Fin.cases ?_ (fun i => ?_) t · rfl · refine Fin.lastCases ?_ (fun j => ?_) i · simp only [Fin.succ_last, Pairings.closePaths_last, immInternalPathVertices_end] rfl · simp [Pairings.closePaths, immInternalPathVertices]
/-- Layer labels used in the relaxed pairing sum are the actual four IMM coordinates. -/theorem layerLabels_immInternalCoordinate (d : ℕ) (p q r s : Fin d → Fin (d + 1)) (t : Fin (d + 1)) : MomentPairing.layerLabels 0 (fun i => ⟨p i, q i, r i, s i⟩) t = (⟨immInternalCoordinate d p t, immInternalCoordinate d q t, immInternalCoordinate d r t, immInternalCoordinate d s t⟩ : Pairings.Labels (Fin (d + 1) × Fin (d + 1))) := by simp only [MomentPairing.layerLabels, closePaths_immInternalPathVertices] rfl
/-- The actual four-path shift constraint is exactly the compatibility predicateused by the weighted exact-to-relaxed pairing inequality. -/theorem immInternalPath_shift_sub_eq_iff_compatible (d : ℕ) (side : Fin (d + 1) → Bool) (p q r s : Fin d → Fin (d + 1)) : occupationShift (fun e => side e.1) (immInternalPathEdges d p) - occupationShift (fun e => side e.1) (immInternalPathEdges d q) = occupationShift (fun e => side e.1) (immInternalPathEdges d r) - occupationShift (fun e => side e.1) (immInternalPathEdges d s) ↔ MomentPairing.Compatible 0 (fun i => ⟨p i, q i, r i, s i⟩) := by rw [immInternalPath_shift_sub_eq_iff] simp only [MomentPairing.Compatible, layerLabels_immInternalCoordinate]
end Problem335
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061import OAI.Algebra.DepthFive.MatrixPathPairingsimport OAI.Algebra.DepthFive.ImmPairingCompatibility
namespace OAI
noncomputable sectionopen scoped BigOperatorsnamespace Problem335
/-- Filtered four-path IMM sums are exactly the compatible internal-label sums. -/theorem sum_four_immPaths_compatible_eq {A : Type*} [AddCommMonoid A] (d : ℕ) (side : Fin (d + 1) → Bool) (f : List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) → List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) → List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) → List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) → A) : let paths := immPaths (d + 1) (Nat.succ_pos d) (∑ p : Fin paths.length, ∑ q : Fin paths.length, ∑ r : Fin paths.length, ∑ s : Fin paths.length, let P := paths.get p let Q := paths.get q let R := paths.get r let S := paths.get s if occupationShift (fun e => side e.1) P - occupationShift (fun e => side e.1) Q = occupationShift (fun e => side e.1) R - occupationShift (fun e => side e.1) S then f P Q R S else 0) = ∑ x : {x : Fin d → Pairings.Labels (Fin (d + 1)) // MomentPairing.Compatible 0 x}, f (immInternalPathEdges d (fun t => (x.1 t).p)) (immInternalPathEdges d (fun t => (x.1 t).q)) (immInternalPathEdges d (fun t => (x.1 t).r)) (immInternalPathEdges d (fun t => (x.1 t).s)) := by classical dsimp only have hp : immPaths (d + 1) (Nat.succ_pos d) = matrixEntryPaths (List.ofFn (id : Fin (d + 1) → Fin (d + 1))) 0 0 := by rw [List.ofFn_id] rfl rw [hp] rw [Pairings.sum_four_matrixEntryPaths_eq d (id : Fin (d + 1) → Fin (d + 1)) 0 (fun P Q R S => if occupationShift (fun e => side e.1) P - occupationShift (fun e => side e.1) Q = occupationShift (fun e => side e.1) R - occupationShift (fun e => side e.1) S then f P Q R S else 0)] change (∑ x : Fin d → Pairings.Labels (Fin (d + 1)), if occupationShift (fun e => side e.1) (immInternalPathEdges d (fun t => (x t).p)) - occupationShift (fun e => side e.1) (immInternalPathEdges d (fun t => (x t).q)) = occupationShift (fun e => side e.1) (immInternalPathEdges d (fun t => (x t).r)) - occupationShift (fun e => side e.1) (immInternalPathEdges d (fun t => (x t).s)) then f (immInternalPathEdges d (fun t => (x t).p)) (immInternalPathEdges d (fun t => (x t).q)) (immInternalPathEdges d (fun t => (x t).r)) (immInternalPathEdges d (fun t => (x t).s)) else 0) = _ simp only [immInternalPath_shift_sub_eq_iff_compatible] rw [← Finset.sum_filter] exact Finset.sum_subtype _ (by simp) _
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051import OAI.Algebra.DepthFive.ImmPathShiftsimport OAI.Algebra.DepthFive.Pairings
namespace OAI
noncomputable section
namespace Problem335
/-- The coordinate in one layer of a genuine endpoint-fixed internal path. -/def immInternalCoordinate (d : ℕ) (p : Fin d → Fin (d + 1)) (t : Fin (d + 1)) : Fin (d + 1) × Fin (d + 1) := (immInternalPathVertices d p t.castSucc, immInternalPathVertices d p t.succ)
/-- Four genuine IMM path shifts are compatible exactly when their coordinatevectors are compatible separately in each layer. -/theorem immInternalPath_shift_sub_eq_iff (d : ℕ) (side : Fin (d + 1) → Bool) (p q r s : Fin d → Fin (d + 1)) : occupationShift (fun e => side e.1) (immInternalPathEdges d p) - occupationShift (fun e => side e.1) (immInternalPathEdges d q) = occupationShift (fun e => side e.1) (immInternalPathEdges d r) - occupationShift (fun e => side e.1) (immInternalPathEdges d s) ↔ ∀ t, Finsupp.single (immInternalCoordinate d p t) (1 : ℤ) - Finsupp.single (immInternalCoordinate d q t) 1 = Finsupp.single (immInternalCoordinate d r t) 1 - Finsupp.single (immInternalCoordinate d s t) 1 := by simp only [occupationShift_immInternalPathEdges] exact pathShift_sub_eq_iff _ (fun t => by cases side t <;> norm_num) _ _ _ _
/-- The exact normal/diagonal pairing alternative for genuine IMM paths.The all-equal case is assigned only to the normal alternative. -/theorem immInternalPath_shift_sub_eq_iff_pairings (d : ℕ) (side : Fin (d + 1) → Bool) (p q r s : Fin d → Fin (d + 1)) : occupationShift (fun e => side e.1) (immInternalPathEdges d p) - occupationShift (fun e => side e.1) (immInternalPathEdges d q) = occupationShift (fun e => side e.1) (immInternalPathEdges d r) - occupationShift (fun e => side e.1) (immInternalPathEdges d s) ↔ ∀ t, (immInternalCoordinate d p t = immInternalCoordinate d q t ∧ immInternalCoordinate d r t = immInternalCoordinate d s t) ∨ (immInternalCoordinate d p t = immInternalCoordinate d r t ∧ immInternalCoordinate d q t = immInternalCoordinate d s t ∧ immInternalCoordinate d p t ≠ immInternalCoordinate d q t) := by rw [immInternalPath_shift_sub_eq_iff] exact forall_congr' fun t => Pairings.coordinate_difference_eq_iff_exclusive _ _ _ _
end Problem335
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273import OAI.Algebra.DepthFive.ImmOperatorPathsimport OAI.Algebra.DepthFive.FockPathsimport OAI.Algebra.DepthFive.PathShifts
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335
/-- The signed creation/annihilation shift of the actual IMM edge list isexactly the layered vertex-path shift. -/theorem occupationShift_immInternalPathEdges (d : ℕ) (side : Fin (d + 1) → Bool) (p : Fin d → Fin (d + 1)) : occupationShift (fun e => side e.1) (immInternalPathEdges d p) = pathShift (fun t => if side t then (-1 : ℤ) else 1) (immInternalPathVertices d p) := by simp only [occupationShift, immInternalPathEdges, List.map_ofFn, List.sum_ofFn, Function.comp_def, pathShift, immInternalPathVertices_castSucc, immInternalPathVertices_succ]
/-- Different IMM paths have different signed occupation shifts. -/theorem occupationShift_immInternalPathEdges_injective (d : ℕ) (side : Fin (d + 1) → Bool) : Function.Injective (fun p : Fin d → Fin (d + 1) => occupationShift (fun e => side e.1) (immInternalPathEdges d p)) := by intro p q hpq dsimp only at hpq rw [occupationShift_immInternalPathEdges, occupationShift_immInternalPathEdges] at hpq apply immInternalPathVertices_injective d apply pathShift_injective (Nat.succ_pos d) _ (fun t => ?_) hpq cases side t <;> norm_num
/-- Nonzero normalized IMM path actions cannot collide at a natural occupation. -/theorem immInternalPath_target_injective_of_amplitudes_ne_zero (d : ℕ) (side : Fin (d + 1) → Bool) (M : (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) →₀ ℕ) (p q : Fin d → Fin (d + 1)) (hp : ((immInternalPathEdges d p).map (occupationAmplitude (fun e => side e.1) M)).prod ≠ 0) (hq : ((immInternalPathEdges d q).map (occupationAmplitude (fun e => side e.1) M)).prod ≠ 0) (heq : pathOccupation (fun e => side e.1) (immInternalPathEdges d p) M = pathOccupation (fun e => side e.1) (immInternalPathEdges d q) M) : p = q := by apply occupationShift_immInternalPathEdges_injective d side apply add_left_cancel (a := signedOccupation M) rw [← signedOccupation_path_of_amplitude_ne_zero _ _ (immInternalPathEdges_nodup d p) M hp, ← signedOccupation_path_of_amplitude_ne_zero _ _ (immInternalPathEdges_nodup d q) M hq, heq]
/-- The collision-zero hypothesis of the first-trace expansion for genuine IMM paths. -/theorem immInternalPath_collision_zero (d : ℕ) (side : Fin (d + 1) → Bool) (M : (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) →₀ ℕ) (p q : Fin d → Fin (d + 1)) (hpq : p ≠ q) (heq : pathOccupation (fun e => side e.1) (immInternalPathEdges d p) M = pathOccupation (fun e => side e.1) (immInternalPathEdges d q) M) : ((immInternalPathEdges d p).map (occupationAmplitude (fun e => side e.1) M)).prod * ((immInternalPathEdges d q).map (occupationAmplitude (fun e => side e.1) M)).prod = 0 := by by_cases hp : ((immInternalPathEdges d p).map (occupationAmplitude (fun e => side e.1) M)).prod = 0 · simp [hp] by_cases hq : ((immInternalPathEdges d q).map (occupationAmplitude (fun e => side e.1) M)).prod = 0 · simp [hq] exact (hpq (immInternalPath_target_injective_of_amplitudes_ne_zero d side M p q hp hq heq)).elim
end Problem335
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738import OAI.Algebra.DepthFive.PathInjectivityimport OAI.Algebra.DepthFive.ImmPairingCompatibility
namespace OAI
noncomputable sectionnamespace Problem335
/-- The list-based layer profile of an actual internal IMM path is its vertex coordinate. -/@[simp] theorem edgeProfile_immInternalPathEdges (d : ℕ) (p : Fin d → Fin (d + 1)) (t : Fin (d + 1)) : edgeProfile (immInternalPathEdges d p) (immInternalPathEdges_labels d p) t = immInternalCoordinate d p t := by simp only [edgeProfile, immInternalPathEdges, List.getElem_ofFn, immInternalCoordinate, immInternalPathVertices_castSucc, immInternalPathVertices_succ]
/-- All four list profiles agree with the layer labels defining pairing weights. -/theorem layerLabels_eq_immPathProfiles (d : ℕ) (x : Fin d → Pairings.Labels (Fin (d + 1))) (t : Fin (d + 1)) : MomentPairing.layerLabels 0 x t = (⟨edgeProfile (immInternalPathEdges d (fun i => (x i).p)) (immInternalPathEdges_labels d _) t, edgeProfile (immInternalPathEdges d (fun i => (x i).q)) (immInternalPathEdges_labels d _) t, edgeProfile (immInternalPathEdges d (fun i => (x i).r)) (immInternalPathEdges_labels d _) t, edgeProfile (immInternalPathEdges d (fun i => (x i).s)) (immInternalPathEdges_labels d _) t⟩ : Pairings.Labels (Fin (d + 1) × Fin (d + 1))) := by simpa only [edgeProfile_immInternalPathEdges] using layerLabels_immInternalCoordinate d (fun i => (x i).p) (fun i => (x i).q) (fun i => (x i).r) (fun i => (x i).s) t
end Problem335
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849import OAI.Algebra.DepthFive.ImmSecondTraceimport OAI.Algebra.DepthFive.FockLayerProfile
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335
/-- The actual finite normalized IMM second trace is bounded by the sumof the compatible local occupation-polynomial products. This has nosource-validity, moment, or nonempty-index assumptions. -/theorem immNormalizedMatrix_second_trace_le_localPolynomial_sum (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) : let A := immNormalizedMatrix n side a b let eps := immPathSignedShift n hn (fun x => side x.1) ((A.conjTranspose * A) ^ 2).trace.re ≤ ∑ d : ImmSourceIndex n side a b, ∑ p, ∑ q, ∑ r, ∑ s, if eps p - eps q = eps r - eps s then ∏ t : Fin n, LocalMoments.localPolynomial (side t) (fun x => d.1 (t, x)) (FockLayerProfile.immProfile n hn p t) (FockLayerProfile.immProfile n hn q t) (FockLayerProfile.immProfile n hn r t) else 0 := by classical dsimp only rw [immNormalizedMatrix_second_trace n hn side a b] apply Finset.sum_le_sum intro d hd apply Finset.sum_le_sum intro p hp apply Finset.sum_le_sum intro q hq apply Finset.sum_le_sum intro r hr apply Finset.sum_le_sum intro s hs split_ifs with hmatch · exact FockLayerProfile.imm_zeroExtended_amplitude_four_le_local_product n hn side (fun d : ImmSourceIndex n side a b => d.1) Subtype.val_injective d p q r s hmatch · exact le_rfl
end Problem335
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879import OAI.Algebra.DepthFive.ImmCompatibleTraceimport OAI.Algebra.DepthFive.BidegreeLocalProductAverageimport OAI.Algebra.DepthFive.PairingAverageCardinalityimport OAI.Algebra.DepthFive.PairingOccupationAverage
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335open Pairings MomentPairing
private theorem source_bound (L : ℕ) (side : Fin (L + 1) → Bool) [Nonempty {x : Fin (L + 1) × (Fin (L + 1) × Fin (L + 1)) // side x.1 = true}] [Nonempty {x : Fin (L + 1) × (Fin (L + 1) × Fin (L + 1)) // ¬ side x.1 = true}] (a b : ℕ) (ha : 0 < a) : (∑ M : ImmSourceIndex (L + 1) side a b, ∑ x : {x : Fin L → Labels (Fin (L + 1)) // Compatible 0 x}, ∏ t : Fin (L + 1), LocalMoments.localPolynomial (side t) (fun y => M.1 (t, y)) (MomentPairing.layerLabels 0 x.1 t).p (MomentPairing.layerLabels 0 x.1 t).q (MomentPairing.layerLabels 0 x.1 t).r) ≤ (Fintype.card (ImmSourceIndex (L + 1) side a b) : ℝ) * pathMean side (layerMeanV (Fin (L + 1)) side a) (layerMeanU (Fin (L + 1)) side b) ^ 2 * ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths (Fin (L + 1)) 0 τ, pathWeight side (layerMeanV (Fin (L + 1)) side a / (layerMeanV (Fin (L + 1)) side a + 1)) (layerMeanU (Fin (L + 1)) side b / (layerMeanU (Fin (L + 1)) side b + 1)) 0 τ x.1 := by classical have hA : 0 < layerMeanV (Fin (L + 1)) side a := by unfold layerMeanV exact div_pos (by exact_mod_cast ha) (by exact_mod_cast Fintype.card_pos) have hB : 0 ≤ layerMeanU (Fin (L + 1)) side b := by unfold layerMeanU positivity apply sum_sources_local_moments_le_of_average (ι := ImmSourceIndex (L + 1) side a b) (γ := Fin (L + 1)) (L := L) side hA hB 0 (fun M : ImmSourceIndex (L + 1) side a b => fun x => ∏ t : Fin (L + 1), LocalMoments.localPolynomial (side t) (fun y => M.1 (t, y)) (MomentPairing.layerLabels 0 x t).p (MomentPairing.layerLabels 0 x t).q (MomentPairing.layerLabels 0 x t).r) intro x _ simpa only [layerMeanV, layerMeanU] using LocalMoments.bidegree_average_layered_localProduct_le side a b Finset.univ (fun t => (MomentPairing.layerLabels 0 x t).p) (fun t => (MomentPairing.layerLabels 0 x t).q) (fun t => (MomentPairing.layerLabels 0 x t).r)
/-- The actual finite IMM second trace is bounded by the relaxed pairing sum,with precisely one source dimension and the square of the path mean. -/theorem immNormalizedMatrix_second_moment_le_relaxed (L : ℕ) (side : Fin (L + 1) → Bool) [Nonempty {x : Fin (L + 1) × (Fin (L + 1) × Fin (L + 1)) // side x.1 = true}] [Nonempty {x : Fin (L + 1) × (Fin (L + 1) × Fin (L + 1)) // ¬ side x.1 = true}] (a b : ℕ) (ha : 0 < a) : let A := immNormalizedMatrix (L + 1) side a b ((A.conjTranspose * A) ^ 2).trace.re ≤ (Fintype.card (ImmSourceIndex (L + 1) side a b) : ℝ) * pathMean side (layerMeanV (Fin (L + 1)) side a) (layerMeanU (Fin (L + 1)) side b) ^ 2 * ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths (Fin (L + 1)) 0 τ, pathWeight side (layerMeanV (Fin (L + 1)) side a / (layerMeanV (Fin (L + 1)) side a + 1)) (layerMeanU (Fin (L + 1)) side b / (layerMeanU (Fin (L + 1)) side b + 1)) 0 τ x.1 := by exact (immNormalizedMatrix_second_trace_le_compatible L side a b).trans (source_bound L side a b ha)
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184import OAI.Algebra.DepthFive.ImmFiniteMatriximport OAI.Algebra.DepthFive.FourPathTrace
namespace OAI
/-! The second trace identity for the actual IMM operator in normalizedmonomial coordinates. Invalid path actions have zero amplitude, so theirchosen finite target index does not enter the trace. -/
noncomputable sectionopen scoped BigOperators
namespace Problem335
/-- The signed exponent displacement of an actual IMM path. -/def immPathSignedShift (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) (p : Fin (immPaths n hn).length) : (Fin n × Fin n × Fin n) →₀ ℤ := occupationShift isV ((immPaths n hn).get p)
/-- Every nonzero actual path action has its prescribed signed displacement. -/theorem signedOccupation_immPathOccupation (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) (d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) (hamp : immPathAmplitude n hn isV d p ≠ 0) : signedOccupation (immPathOccupation n hn isV d p) = signedOccupation d + immPathSignedShift n hn isV p := by exact signedOccupation_path_of_amplitude_ne_zero isV ((immPaths n hn).get p) (immPaths_nodup n hn _ (List.get_mem _ p)) d hamp
/-- A finite submatrix of the genuine normalized IMM operator. -/def immCoefficientMatrix {I J : Type*} (n : ℕ) (isV : (Fin n × Fin n × Fin n) → Bool) (source : I → (Fin n × Fin n × Fin n) →₀ ℕ) (target : J → (Fin n × Fin n × Fin n) →₀ ℕ) : Matrix J I ℂ := fun j i => complexFockBasis.repr (mixedOperator isV (imm ℂ n) (complexFockMonomial (source i))) (target j)
/-- The finite normalized coefficient matrix is the actual weighted path matrixwhenever all nonzero path actions are represented in its target coordinates. -/theorem immCoefficientMatrix_eq_pathShiftMatrix {I J : Type*} [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) (source : I → (Fin n × Fin n × Fin n) →₀ ℕ) (target : J → (Fin n × Fin n × Fin n) →₀ ℕ) (htarget : Function.Injective target) (shift : I → Fin (immPaths n hn).length → J) (hshift : ∀ i p, immPathAmplitude n hn isV (source i) p ≠ 0 → target (shift i p) = immPathOccupation n hn isV (source i) p) : immCoefficientMatrix n isV source target = pathShiftMatrix shift (fun i p => (immPathAmplitude n hn isV (source i) p : ℂ)) := by classical ext j i change complexFockBasis.repr (mixedOperator isV (imm ℂ n) (complexFockMonomial (source i))) (target j) = _ rw [complexFockBasis_repr_mixedOperator_imm n hn isV] unfold pathShiftMatrix apply Finset.sum_congr rfl intro p hp by_cases hz : immPathAmplitude n hn isV (source i) p = 0 · simp [hz] · simp only [← hshift i p hz, htarget.eq_iff]
/-- Source-eliminated second trace for the genuine finite IMM coefficientmatrix. The only coordinate hypothesis says that nonzero path actions stayin the chosen target basis; no trace or moment formula is assumed. -/theorem immCoefficientMatrix_second_trace {I J : Type*} [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) (source : I → (Fin n × Fin n × Fin n) →₀ ℕ) (hsource : Function.Injective source) (target : J → (Fin n × Fin n × Fin n) →₀ ℕ) (htarget : Function.Injective target) (shift : I → Fin (immPaths n hn).length → J) (hshift : ∀ i p, immPathAmplitude n hn isV (source i) p ≠ 0 → target (shift i p) = immPathOccupation n hn isV (source i) p) : let A := immCoefficientMatrix n isV source target let occupation := fun i => signedOccupation (source i) let eps := immPathSignedShift n hn isV let weight := fun i p => immPathAmplitude n hn isV (source i) p ((A.conjTranspose * A) ^ 2).trace.re = ∑ i, ∑ p, ∑ q, ∑ r, ∑ s, if eps p - eps q = eps r - eps s then weight i p * Function.extend occupation (fun k => weight k q) (fun _ => 0) (occupation i + eps p - eps q) * weight i r * Function.extend occupation (fun k => weight k s) (fun _ => 0) (occupation i + eps p - eps q) else 0 := by classical dsimp only rw [immCoefficientMatrix_eq_pathShiftMatrix n hn isV source target htarget shift hshift] apply complex_path_second_trace_eliminate_source (fun i => signedOccupation (source i)) (signedOccupation_injective.comp hsource) (fun j => signedOccupation (target j)) (signedOccupation_injective.comp htarget) intro i p hp rw [hshift i p hp] exact signedOccupation_immPathOccupation n hn isV (source i) p hp
/-- A finite target index for each path. The fallback is used only for azero-amplitude path, and is therefore invisible in the operator matrix. -/def immFinitePathShift (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) (e0 : ImmTargetIndex n side a b) (d : ImmSourceIndex n side a b) (p : Fin (immPaths n hn).length) : ImmTargetIndex n side a b := by classical exact if h : immPathAmplitude n hn (fun x => side x.1) d.1 p ≠ 0 then ⟨immPathOccupation n hn (fun x => side x.1) d.1 p, immPathOccupation_bidegree_of_amplitude_ne_zero n hn side a b d.1 d.2 p h⟩ else e0
theorem immFinitePathShift_val_of_amplitude_ne_zero (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) (e0 : ImmTargetIndex n side a b) (d : ImmSourceIndex n side a b) (p : Fin (immPaths n hn).length) (hp : immPathAmplitude n hn (fun x => side x.1) d.1 p ≠ 0) : (immFinitePathShift n hn side a b e0 d p).1 = immPathOccupation n hn (fun x => side x.1) d.1 p := by simp only [immFinitePathShift, dite_eq_left hp]
/-- The finite normalized operator matrix is the indicated submatrix of itsambient normalized monomial coefficients. -/theorem immNormalizedMatrix_eq_immCoefficientMatrix (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) : immNormalizedMatrix n side a b = immCoefficientMatrix n (fun x => side x.1) (fun d : ImmSourceIndex n side a b => d.1) (fun e : ImmTargetIndex n side a b => e.1) := by classical ext e d rw [immNormalizedMatrix_apply n hn side a b] exact (complexFockBasis_repr_mixedOperator_imm n hn (fun x => side x.1) d.1 e.1).symm
/-- The actual finite IMM matrix has a weighted finite-path representation. -/theorem immNormalizedMatrix_eq_pathShiftMatrix_of_fallback (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) (e0 : ImmTargetIndex n side a b) : immNormalizedMatrix n side a b = pathShiftMatrix (immFinitePathShift n hn side a b e0) (fun d p => (immPathAmplitude n hn (fun x => side x.1) d.1 p : ℂ)) := by classical rw [immNormalizedMatrix_eq_immCoefficientMatrix n hn side a b] exact immCoefficientMatrix_eq_pathShiftMatrix n hn (fun x => side x.1) _ _ Subtype.val_injective _ (immFinitePathShift_val_of_amplitude_ne_zero n hn side a b e0)
/-- Exact source-eliminated second trace of the genuine finite IMM operator.This includes an empty target space: then every path amplitude vanishes.There are no trace, closure, or nonempty-index assumptions in the statement. -/theorem immNormalizedMatrix_second_trace (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) : let A := immNormalizedMatrix n side a b let occupation := fun d : ImmSourceIndex n side a b => signedOccupation d.1 let eps := immPathSignedShift n hn (fun x => side x.1) let weight := fun (d : ImmSourceIndex n side a b) p => immPathAmplitude n hn (fun x => side x.1) d.1 p ((A.conjTranspose * A) ^ 2).trace.re = ∑ d, ∑ p, ∑ q, ∑ r, ∑ s, if eps p - eps q = eps r - eps s then weight d p * Function.extend occupation (fun k => weight k q) (fun _ => 0) (occupation d + eps p - eps q) * weight d r * Function.extend occupation (fun k => weight k s) (fun _ => 0) (occupation d + eps p - eps q) else 0 := by classical rcases isEmpty_or_nonempty (ImmTargetIndex n side a b) with h | h · let := h have hA : immNormalizedMatrix n side a b = 0 := Subsingleton.elim _ _ have hz (d : ImmSourceIndex n side a b) (p : Fin (immPaths n hn).length) : immPathAmplitude n hn (fun x => side x.1) d.1 p = 0 := by by_contra hp exact isEmptyElim (⟨immPathOccupation n hn (fun x => side x.1) d.1 p, immPathOccupation_bidegree_of_amplitude_ne_zero n hn side a b d.1 d.2 p hp⟩ : ImmTargetIndex n side a b) simp [hA, hz] · obtain ⟨e0⟩ := h dsimp only rw [immNormalizedMatrix_eq_immCoefficientMatrix n hn side a b] exact immCoefficientMatrix_second_trace n hn (fun x => side x.1) _ Subtype.val_injective _ Subtype.val_injective (immFinitePathShift n hn side a b e0) (immFinitePathShift_val_of_amplitude_ne_zero n hn side a b e0)
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322import Mathlib
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335namespace IndependentCoordinates
/-- The uniform average on a finite type, with value zero on an empty type. -/def average {α : Type*} [Fintype α] (f : α → ℝ) : ℝ := (∑ x, f x) / Fintype.card α
/-- Uniform finite averages are unchanged by relabeling. -/theorem average_equiv {α β : Type*} [Fintype α] [Fintype β] (e : α ≃ β) (f : β → ℝ) : average (fun x => f (e x)) = average f := by simp only [average, e.sum_comp, Fintype.card_congr e]
/-- Independent coordinates factor the average of a product. -/theorem average_prod {ι : Type*} [Fintype ι] [DecidableEq ι] {α : ι → Type*} [∀ i, Fintype (α i)] (f : ∀ i, α i → ℝ) : average (fun x : ∀ i, α i => ∏ i, f i (x i)) = ∏ i, average (f i) := by classical simp only [average, Fintype.card_pi, Nat.cast_prod, Finset.prod_div_distrib] congr 1 exact (Fintype.prod_sum f).symm
/-- Reorganize coordinates into the fibers of a grouping function. -/def fiberAssignmentEquiv {σ ι α : Type*} (group : σ → ι) : (σ → α) ≃ (∀ i, {s // group s = i} → α) := (Equiv.piCongrLeft (fun _ : σ => α) (Equiv.sigmaFiberEquiv group)).symm.trans (Equiv.piCurry (fun _ _ => α))
@[simp] theorem fiberAssignmentEquiv_apply {σ ι α : Type*} (group : σ → ι) (x : σ → α) (i : ι) (s : {s // group s = i}) : fiberAssignmentEquiv group x i s = x s := rfl
/-- Factors on disjoint groups of coordinates have independent uniform averages.An unused group can be included with its factor set equal to one. -/theorem average_grouped_prod {σ ι α : Type*} [Fintype σ] [Fintype ι] [Fintype α] [DecidableEq σ] [DecidableEq ι] (group : σ → ι) (f : ∀ i, ({s // group s = i} → α) → ℝ) : average (fun x : σ → α => ∏ i, f i (fun s => x s)) = ∏ i, average (f i) := by calc _ = average (fun x : ∀ i, ({s // group s = i} → α) => ∏ i, f i (x i)) := average_equiv (fiberAssignmentEquiv group) _ _ = _ := average_prod f
/-- One independent pair of uniform labels agrees with probability `1 / card α`. -/theorem average_pair_eq {α : Type*} [Fintype α] [DecidableEq α] : average (fun x : α × α => if x.1 = x.2 then (1 : ℝ) else 0) = (Fintype.card α : ℝ)⁻¹ := by rw [average, Fintype.sum_prod_type] simp only [Finset.sum_ite_eq, Finset.mem_univ, ite_true, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one, Fintype.card_prod, Nat.cast_mul] by_cases h : (Fintype.card α : ℝ) = 0 · simp [h] · field_simp
theorem average_add {α : Type*} [Fintype α] (f g : α → ℝ) : average (fun x => f x + g x) = average f + average g := by simp [average, Finset.sum_add_distrib, add_div]
theorem average_const {α : Type*} [Fintype α] [Nonempty α] (c : ℝ) : average (fun _ : α => c) = c := by simp [average, Fintype.card_ne_zero]
theorem average_const_mul {α : Type*} [Fintype α] (c : ℝ) (f : α → ℝ) : average (fun x => c * f x) = c * average f := by simp [average, ← Finset.mul_sum, mul_div_assoc]
/-- The indicator that two labels agree. -/def pairEq {α : Type*} [DecidableEq α] (x : α × α) : ℝ := if x.1 = x.2 then 1 else 0
/-- Simultaneous agreement of `card κ` independent label pairs. -/def allPairsEq {κ α : Type*} [Fintype κ] [DecidableEq α] (x : κ → α × α) : ℝ := ∏ i, pairEq (x i)
theorem average_allPairsEq {κ α : Type*} [Fintype κ] [Fintype α] [DecidableEq κ] [DecidableEq α] : average (allPairsEq (κ := κ) (α := α)) = (Fintype.card α : ℝ)⁻¹ ^ Fintype.card κ := by rw [show allPairsEq (κ := κ) (α := α) = (fun x : κ → α × α => ∏ i, pairEq (x i)) from rfl, average_prod] simp only [Finset.prod_const, Finset.card_univ] exact congrArg (fun z : ℝ => z ^ Fintype.card κ) (average_pair_eq (α := α))
theorem average_equality_correction {κ α : Type*} [Fintype κ] [Fintype α] [DecidableEq κ] [DecidableEq α] [Nonempty α] (c : ℝ) : average (fun x : κ → α × α => 1 + c * allPairsEq x) = 1 + c * (Fintype.card α : ℝ)⁻¹ ^ Fintype.card κ := by rw [average_add, average_const, average_const_mul, average_allPairsEq]
/-- The precise independence identity used for nonadjacent derivative layers.The fibers of `group` are the disjoint sets of free endpoints of those layers. -/theorem average_grouped_equality_corrections {σ ι α : Type*} [Fintype σ] [Fintype ι] [Fintype α] [DecidableEq σ] [DecidableEq ι] [DecidableEq α] [Nonempty α] (group : σ → ι) (c : ι → ℝ) : average (fun x : σ → α × α => ∏ i, (1 + c i * allPairsEq (fun s : {s // group s = i} => x s))) = ∏ i, (1 + c i * (Fintype.card α : ℝ)⁻¹ ^ Fintype.card {s // group s = i}) := by rw [average_grouped_prod group (fun i x => 1 + c i * allPairsEq x)] congr 1 ext i exact average_equality_correction (c i)
/-- Coordinates assigned to `none` are unused and integrate out. -/theorem average_selected_grouped_prod {σ ι α : Type*} [Fintype σ] [Fintype ι] [Fintype α] [Nonempty α] [DecidableEq σ] [DecidableEq ι] (group : σ → Option ι) (f : ∀ i, ({s // group s = some i} → α) → ℝ) : average (fun x : σ → α => ∏ i, f i (fun s => x s)) = ∏ i, average (f i) := by let F : ∀ o : Option ι, ({s // group s = o} → α) → ℝ := fun o => match o with | none => fun _ => 1 | some i => f i have h := average_grouped_prod group F simpa only [Fintype.prod_option, F, one_mul, average_const] using h
/-- Equality corrections for selected disjoint endpoint groups. Other verticesmay be assigned to `none`, and their choices do not affect the expectation. -/theorem average_selected_equality_corrections {σ ι α : Type*} [Fintype σ] [Fintype ι] [Fintype α] [DecidableEq σ] [DecidableEq ι] [DecidableEq α] [Nonempty α] (group : σ → Option ι) (c : ι → ℝ) : average (fun x : σ → α × α => ∏ i, (1 + c i * allPairsEq (fun s : {s // group s = some i} => x s))) = ∏ i, (1 + c i * (Fintype.card α : ℝ)⁻¹ ^ Fintype.card {s // group s = some i}) := by rw [average_selected_grouped_prod group (fun i x => 1 + c i * allPairsEq x)] congr 1 ext i exact average_equality_correction (c i)
/-- Extra independent coordinates that do not appear in the integrand cancel. -/theorem average_ignore_right {α β : Type*} [Fintype α] [Fintype β] [Nonempty β] (f : α → ℝ) : average (fun x : α × β => f x.1) = average f := by rw [average, Fintype.sum_prod_type] simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, ← Finset.mul_sum, Fintype.card_prod, Nat.cast_mul, average] have hβ : (Fintype.card β : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero by_cases hα : (Fintype.card α : ℝ) = 0 · simp [hα] · field_simp
/-- Split all assignments into their values on an embedded coordinate set andon its complement. -/def restrictAssignmentEquiv {σ τ α : Type*} (j : τ → σ) (hj : Function.Injective j) : (σ → α) ≃ (τ → α) × ({s // s ∉ Set.range j} → α) := by classical let e : τ ⊕ {s // s ∉ Set.range j} ≃ σ := ((Equiv.ofInjective j hj).sumCongr (Equiv.refl _)).trans (Equiv.sumCompl (fun s => s ∈ Set.range j)) exact (Equiv.piCongrLeft (fun _ : σ => α) e).symm.trans (Equiv.sumPiEquivProdPi (fun _ => α))
@[simp] theorem restrictAssignmentEquiv_fst {σ τ α : Type*} (j : τ → σ) (hj : Function.Injective j) (x : σ → α) (t : τ) : (restrictAssignmentEquiv j hj x).1 t = x (j t) := rfl
/-- Uniform assignments restrict uniformly to any subset of coordinates. -/theorem average_precomp_injective {σ τ α : Type*} [Fintype σ] [Fintype τ] [Fintype α] [Nonempty α] [DecidableEq σ] [DecidableEq τ] (j : τ → σ) (hj : Function.Injective j) (f : (τ → α) → ℝ) : average (fun x : σ → α => f (fun t => x (j t))) = average f := by classical calc _ = average (fun x : (τ → α) × ({s // s ∉ Set.range j} → α) => f x.1) := average_equiv (restrictAssignmentEquiv j hj) _ _ = _ := average_ignore_right f
/-- A sigma-indexed family of labels is the product of its fiber families. -/theorem average_sigma_prod {ι α : Type*} {κ : ι → Type*} [Fintype ι] [Fintype α] [∀ i, Fintype (κ i)] [DecidableEq ι] [∀ i, DecidableEq (κ i)] (f : ∀ i, (κ i → α) → ℝ) : average (fun x : (Σ i, κ i) → α => ∏ i, f i (fun t => x ⟨i, t⟩)) = ∏ i, average (f i) := by let e := Equiv.piCurry (α := ι) (β := κ) (fun _ _ => α) have h := average_equiv e (fun x : ∀ i, κ i → α => ∏ i, f i (x i)) change average (fun x : (Σ i, κ i) → α => ∏ i, f i (fun t => x ⟨i, t⟩)) = _ at h exact h.trans (average_prod f)
/-- Finite factors on an injectively embedded disjoint family of coordinatesfactor under uniform averaging. -/theorem average_embedded_prod {σ ι α : Type*} {κ : ι → Type*} [Fintype σ] [Fintype ι] [Fintype α] [∀ i, Fintype (κ i)] [Nonempty α] [DecidableEq σ] [DecidableEq ι] [∀ i, DecidableEq (κ i)] (j : ∀ i, κ i → σ) (hj : Function.Injective (Sigma.uncurry j)) (f : ∀ i, (κ i → α) → ℝ) : average (fun x : σ → α => ∏ i, f i (fun t => x (j i t))) = ∏ i, average (f i) := by have h := average_precomp_injective (Sigma.uncurry j) hj (fun x : (Σ i, κ i) → α => ∏ i, f i (fun t => x ⟨i, t⟩)) exact h.trans (average_sigma_prod f)
/-- Pairwise disjoint subsets give an injective family of coordinate inclusions. -/theorem sigma_val_injective {σ ι : Type*} (s : ι → Finset σ) (hs : Pairwise (fun i j => Disjoint (s i) (s j))) : Function.Injective (fun x : Σ i, s i => (x.2 : σ)) := by rintro ⟨i, x⟩ ⟨j, y⟩ hxy change (x : σ) = (y : σ) at hxy have hij : i = j := by by_contra hne exact (Finset.disjoint_left.mp (hs hne)) x.property (hxy.symm ▸ y.property) subst j have h : x = y := Subtype.ext hxy subst y rfl
/-- Factors depending on pairwise disjoint finite coordinate sets are independent. -/theorem average_disjoint_finset_prod {σ ι α : Type*} [Fintype σ] [Fintype ι] [Fintype α] [Nonempty α] [DecidableEq σ] [DecidableEq ι] (s : ι → Finset σ) (hs : Pairwise (fun i j => Disjoint (s i) (s j))) (f : ∀ i, (s i → α) → ℝ) : average (fun x : σ → α => ∏ i, f i (fun t => x t)) = ∏ i, average (f i) := by exact average_embedded_prod (fun i (t : s i) => (t : σ)) (sigma_val_injective s hs) f
/-- The endpoint-coincidence average for pairwise disjoint free-endpoint sets. -/theorem average_disjoint_equality_corrections {σ ι α : Type*} [Fintype σ] [Fintype ι] [Fintype α] [DecidableEq σ] [DecidableEq ι] [DecidableEq α] [Nonempty α] (s : ι → Finset σ) (hs : Pairwise (fun i j => Disjoint (s i) (s j))) (c : ι → ℝ) : average (fun x : σ → α × α => ∏ i, (1 + c i * allPairsEq (fun t : s i => x t))) = ∏ i, (1 + c i * (Fintype.card α : ℝ)⁻¹ ^ (s i).card) := by rw [average_disjoint_finset_prod s hs (fun i x => 1 + c i * allPairsEq x)] apply Finset.prod_congr rfl intro i _ simpa only [Fintype.card_coe] using (average_equality_correction (κ := s i) (α := α) (c i))
/-- Dependent-coordinate version of restriction to an embedded coordinate set. -/def restrictDependentAssignmentEquiv {σ τ : Type*} (β : σ → Type*) (j : τ → σ) (hj : Function.Injective j) : (∀ s, β s) ≃ (∀ t, β (j t)) × (∀ s : {s // s ∉ Set.range j}, β s) := by classical let e : τ ⊕ {s // s ∉ Set.range j} ≃ σ := ((Equiv.ofInjective j hj).sumCongr (Equiv.refl _)).trans (Equiv.sumCompl (fun s => s ∈ Set.range j)) exact (Equiv.piCongrLeft β e).symm.trans (Equiv.sumPiEquivProdPi (fun z => β (e z)))
@[simp] theorem restrictDependentAssignmentEquiv_fst {σ τ : Type*} (β : σ → Type*) (j : τ → σ) (hj : Function.Injective j) (x : ∀ s, β s) (t : τ) : (restrictDependentAssignmentEquiv β j hj x).1 t = x (j t) := rfl
/-- Marginals of a uniform finite product are uniform, allowing differentcoordinate types at different vertices. -/theorem average_precomp_injective_dependent {σ τ : Type*} {β : σ → Type*} [Fintype σ] [Fintype τ] [∀ s, Fintype (β s)] [∀ s, Nonempty (β s)] [DecidableEq σ] [DecidableEq τ] (j : τ → σ) (hj : Function.Injective j) (f : (∀ t, β (j t)) → ℝ) : average (fun x : ∀ s, β s => f (fun t => x (j t))) = average f := by classical calc _ = average (fun x : (∀ t, β (j t)) × (∀ s : {s // s ∉ Set.range j}, β s) => f x.1) := average_equiv (restrictDependentAssignmentEquiv β j hj) _ _ = _ := average_ignore_right f
theorem average_sigma_prod_dependent {ι : Type*} {κ : ι → Type*} {β : (Σ i, κ i) → Type*} [Fintype ι] [∀ i, Fintype (κ i)] [∀ s, Fintype (β s)] [DecidableEq ι] [∀ i, DecidableEq (κ i)] (f : ∀ i, (∀ t : κ i, β ⟨i,t⟩) → ℝ) : average (fun x : ∀ s, β s => ∏ i, f i (fun t => x ⟨i,t⟩)) = ∏ i, average (f i) := by let e := Equiv.piCurry (fun i (t : κ i) => β ⟨i,t⟩) have h := average_equiv e (fun x : ∀ i, ∀ t : κ i, β ⟨i,t⟩ => ∏ i, f i (x i)) change average (fun x : ∀ s, β s => ∏ i, f i (fun t => x ⟨i,t⟩)) = _ at h exact h.trans (average_prod f)
theorem average_embedded_prod_dependent {σ ι : Type*} {κ : ι → Type*} {β : σ → Type*} [Fintype σ] [Fintype ι] [∀ i, Fintype (κ i)] [∀ s, Fintype (β s)] [∀ s, Nonempty (β s)] [DecidableEq σ] [DecidableEq ι] [∀ i, DecidableEq (κ i)] (j : ∀ i, κ i → σ) (hj : Function.Injective (Sigma.uncurry j)) (f : ∀ i, (∀ t : κ i, β (j i t)) → ℝ) : average (fun x : ∀ s, β s => ∏ i, f i (fun t => x (j i t))) = ∏ i, average (f i) := by have h := average_precomp_injective_dependent (β := β) (Sigma.uncurry j) hj (fun x : ∀ s : Σ i, κ i, β (j s.1 s.2) => ∏ i, f i (fun t => x ⟨i,t⟩)) exact h.trans (average_sigma_prod_dependent (β := fun s : Σ i, κ i => β (j s.1 s.2)) f)
/-- Disjoint coordinate families remain independent when vertex alphabets vary. -/theorem average_disjoint_finset_prod_dependent {σ ι : Type*} {β : σ → Type*} [Fintype σ] [Fintype ι] [∀ s, Fintype (β s)] [∀ s, Nonempty (β s)] [DecidableEq σ] [DecidableEq ι] (s : ι → Finset σ) (hs : Pairwise (fun i j => Disjoint (s i) (s j))) (f : ∀ i, (∀ t : s i, β t) → ℝ) : average (fun x : ∀ s, β s => ∏ i, f i (fun t => x t)) = ∏ i, average (f i) := by exact average_embedded_prod_dependent (fun i (t : s i) => (t : σ)) (sigma_val_injective s hs) f
end IndependentCoordinatesend Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899import OAI.Algebra.DepthFive.Basic
namespace OAI
noncomputable section
namespace Problem335
/-- A depth-five circuit whose gates are indexed by arbitrary finite types.This representation is convenient for products, sums, and path-indexed gates;`toDepth5Circuit` transports it to the qualified circuit representation. -/structure IndexedDepth5Circuit (K : Type*) [CommSemiring K] (n : ℕ) (L B P M U : Type*) where leaves : L → D5Leaf K n bottomInputs : B → List (K × L) bottomDegree : B → ℕ bottomHomogeneous : ∀ i entry, entry ∈ bottomInputs i → d5LeafDegree (leaves entry.2) = bottomDegree i bottomEmpty : ∀ i, bottomInputs i = [] → bottomDegree i = 0 lowerInputs : P → List B middleInputs : M → List (K × P) middleDegree : M → ℕ middleHomogeneous : ∀ i entry, entry ∈ middleInputs i → ((lowerInputs entry.2).map bottomDegree).sum = middleDegree i middleEmpty : ∀ i, middleInputs i = [] → middleDegree i = 0 upperInputs : U → List M outputInputs : List (K × U) outputDegree : ℕ outputHomogeneous : ∀ entry, entry ∈ outputInputs → ((upperInputs entry.2).map middleDegree).sum = outputDegree outputEmpty : outputInputs = [] → outputDegree = 0
namespace IndexedDepth5Circuit
variable {K : Type*} [CommSemiring K] {n : ℕ}variable {L B P M U : Type*}variable [Fintype L] [Fintype B] [Fintype P] [Fintype M] [Fintype U]
/-- Relabel each finite gate type by `Fin` without changing any wire or degree. -/def toDepth5Circuit (c : IndexedDepth5Circuit K n L B P M U) : Depth5Circuit K n where leafCount := Fintype.card L leaves i := c.leaves ((Fintype.equivFin L).symm i) bottomCount := Fintype.card B bottomInputs i := (c.bottomInputs ((Fintype.equivFin B).symm i)).map (fun e => (e.1, Fintype.equivFin L e.2)) bottomDegree i := c.bottomDegree ((Fintype.equivFin B).symm i) bottomHomogeneous := by intro i entry h obtain ⟨e, he, rfl⟩ := List.mem_map.mp h simpa using c.bottomHomogeneous ((Fintype.equivFin B).symm i) e he bottomEmpty := by intro i h exact c.bottomEmpty _ (List.map_eq_nil_iff.mp h) lowerCount := Fintype.card P lowerInputs i := (c.lowerInputs ((Fintype.equivFin P).symm i)).map (Fintype.equivFin B) middleCount := Fintype.card M middleInputs i := (c.middleInputs ((Fintype.equivFin M).symm i)).map (fun e => (e.1, Fintype.equivFin P e.2)) middleDegree i := c.middleDegree ((Fintype.equivFin M).symm i) middleHomogeneous := by intro i entry h obtain ⟨e, he, rfl⟩ := List.mem_map.mp h simpa [List.map_map, Function.comp_def] using c.middleHomogeneous ((Fintype.equivFin M).symm i) e he middleEmpty := by intro i h exact c.middleEmpty _ (List.map_eq_nil_iff.mp h) upperCount := Fintype.card U upperInputs i := (c.upperInputs ((Fintype.equivFin U).symm i)).map (Fintype.equivFin M) outputInputs := c.outputInputs.map (fun e => (e.1, Fintype.equivFin U e.2)) outputDegree := c.outputDegree outputHomogeneous := by intro entry h obtain ⟨e, he, rfl⟩ := List.mem_map.mp h simpa [List.map_map, Function.comp_def] using c.outputHomogeneous e he outputEmpty := by intro h exact c.outputEmpty (List.map_eq_nil_iff.mp h)
@[simp] theorem circuitSize_toDepth5Circuit (c : IndexedDepth5Circuit K n L B P M U) : circuitSize c.toDepth5Circuit = Fintype.card L + Fintype.card B + Fintype.card P + Fintype.card M + Fintype.card U + 1 := rfl
@[simp] theorem outputDegree_toDepth5Circuit (c : IndexedDepth5Circuit K n L B P M U) : c.toDepth5Circuit.outputDegree = c.outputDegree := rfl
end IndexedDepth5Circuitend Problem335
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586import OAI.Algebra.DepthFive.IndexedCircuit
namespace OAI
noncomputable section
namespace Problem335namespace IndexedDepth5Circuit
variable {K : Type*} [CommSemiring K] {n : ℕ}variable {L B P M U : Type*}
/-- Value of a bottom gate before relabelling the gate types. -/def bottomValue (c : IndexedDepth5Circuit K n L B P M U) (i : B) : MvPolynomial (Fin n × Fin n × Fin n) K := ((c.bottomInputs i).map (fun entry => MvPolynomial.C entry.1 * d5LeafValue (c.leaves entry.2))).sum
/-- Value of a lower product gate before relabelling the gate types. -/def lowerValue (c : IndexedDepth5Circuit K n L B P M U) (i : P) : MvPolynomial (Fin n × Fin n × Fin n) K := ((c.lowerInputs i).map (fun j => bottomValue c j)).prod
/-- Value of a middle sum gate before relabelling the gate types. -/def middleValue (c : IndexedDepth5Circuit K n L B P M U) (i : M) : MvPolynomial (Fin n × Fin n × Fin n) K := ((c.middleInputs i).map (fun entry => MvPolynomial.C entry.1 * lowerValue c entry.2)).sum
/-- Value of an upper product gate before relabelling the gate types. -/def upperValue (c : IndexedDepth5Circuit K n L B P M U) (i : U) : MvPolynomial (Fin n × Fin n × Fin n) K := ((c.upperInputs i).map (fun j => middleValue c j)).prod
/-- Polynomial computed by a circuit indexed by arbitrary finite types. -/def circuitValue (c : IndexedDepth5Circuit K n L B P M U) : MvPolynomial (Fin n × Fin n × Fin n) K := (c.outputInputs.map (fun entry => MvPolynomial.C entry.1 * upperValue c entry.2)).sum
variable [Fintype L] [Fintype B] [Fintype P] [Fintype M] [Fintype U]
@[simp] theorem bottomValue_toDepth5Circuit (c : IndexedDepth5Circuit K n L B P M U) (i : Fin (Fintype.card B)) : Problem335.bottomValue c.toDepth5Circuit i = c.bottomValue ((Fintype.equivFin B).symm i) := by simp [Problem335.bottomValue, toDepth5Circuit, bottomValue, List.map_map, Function.comp_def]
@[simp] theorem lowerValue_toDepth5Circuit (c : IndexedDepth5Circuit K n L B P M U) (i : Fin (Fintype.card P)) : Problem335.lowerValue c.toDepth5Circuit i = c.lowerValue ((Fintype.equivFin P).symm i) := by simp [Problem335.lowerValue, lowerValue, toDepth5Circuit, List.map_map, Function.comp_def, Problem335.bottomValue, bottomValue]
@[simp] theorem middleValue_toDepth5Circuit (c : IndexedDepth5Circuit K n L B P M U) (i : Fin (Fintype.card M)) : Problem335.middleValue c.toDepth5Circuit i = c.middleValue ((Fintype.equivFin M).symm i) := by simp [Problem335.middleValue, middleValue, toDepth5Circuit, List.map_map, Function.comp_def, Problem335.lowerValue, lowerValue, Problem335.bottomValue, bottomValue]
@[simp] theorem upperValue_toDepth5Circuit (c : IndexedDepth5Circuit K n L B P M U) (i : Fin (Fintype.card U)) : Problem335.upperValue c.toDepth5Circuit i = c.upperValue ((Fintype.equivFin U).symm i) := by simp [Problem335.upperValue, upperValue, toDepth5Circuit, List.map_map, Function.comp_def, Problem335.middleValue, middleValue, Problem335.lowerValue, lowerValue, Problem335.bottomValue, bottomValue]
@[simp] theorem circuitValue_toDepth5Circuit (c : IndexedDepth5Circuit K n L B P M U) : Problem335.circuitValue c.toDepth5Circuit = c.circuitValue := by simp [Problem335.circuitValue, circuitValue, toDepth5Circuit, List.map_map, Function.comp_def, Problem335.upperValue, upperValue, Problem335.middleValue, middleValue, Problem335.lowerValue, lowerValue, Problem335.bottomValue, bottomValue]
end IndexedDepth5Circuitend Problem335
end
end OAI12345678910111213import OAI.Algebra.DepthFive.UpperConstructionimport OAI.Algebra.DepthFive.UpperBoundArithmeticimport OAI.Algebra.DepthFive.CharacteristicZeroTransferimport OAI.Algebra.DepthFive.LowerInfrastructureimport OAI.Algebra.DepthFive.ParameterGrowthimport OAI.Algebra.DepthFive.ParameterCutoffimport OAI.Algebra.DepthFive.BetaRefinementsimport OAI.Algebra.DepthFive.LowerMomentsimport OAI.Algebra.DepthFive.LowerCircuitimport OAI.Algebra.DepthFive.WordInfrastructureimport OAI.Algebra.DepthFive.MomentAssemblyInterfaces
/-! Circuit constructions, field transfer, and rank estimates. -/1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889import Mathlib
namespace OAI
noncomputable section
namespace Problem335
open Module Submodule
universe u v w x
/-- Comparing all finite column families compares matrix ranks. -/theorem matrix_rank_le_of_independent_imp {m : Type u} {n : Type v} [Fintype m] [Fintype n] {K : Type w} {L : Type x} [Field K] [Field L] (A : Matrix m n K) (B : Matrix m n L) (h : ∀ (r : ℕ) (f : Fin r → n), LinearIndependent K (A.col ∘ f) → LinearIndependent L (B.col ∘ f)) : A.rank ≤ B.rank := by classical obtain ⟨p, hp, hspan, hli⟩ := Submodule.exists_fun_fin_finrank_span_eq K (Set.range A.col) choose f hf using hp have heq : A.col ∘ f = p := funext hf have hli' : LinearIndependent L (B.col ∘ f) := h _ f (heq.symm ▸ hli) rw [A.rank_eq_finrank_span_cols, B.rank_eq_finrank_span_cols] have hsub : Set.range (B.col ∘ f) ⊆ Set.range B.col := by rintro _ ⟨i, rfl⟩ exact ⟨f i, rfl⟩ calc finrank K (span K (Set.range A.col)) = finrank L (span L (Set.range (B.col ∘ f))) := by simp [finrank_span_eq_card hli'] _ ≤ finrank L (span L (Set.range B.col)) := Submodule.finrank_mono (Submodule.span_mono hsub)
/-- Matrices with the same finite-column dependence relations have equal ranks. -/theorem matrix_rank_eq_of_independent_iff {m : Type u} {n : Type v} [Fintype m] [Fintype n] {K : Type w} {L : Type x} [Field K] [Field L] (A : Matrix m n K) (B : Matrix m n L) (h : ∀ (r : ℕ) (f : Fin r → n), LinearIndependent K (A.col ∘ f) ↔ LinearIndependent L (B.col ∘ f)) : A.rank = B.rank := by exact le_antisymm (matrix_rank_le_of_independent_imp A B (fun r f => (h r f).mp)) (matrix_rank_le_of_independent_imp B A (fun r f => (h r f).mpr))
/-- Extending an integral coefficient matrix to either of two faithful fieldextensions gives the same rank. The fields need not embed into each other. -/theorem matrix_rank_algebraMap_eq {m : Type u} {n : Type v} [Fintype m] [Fintype n] {R K L : Type*} [CommRing R] [Field K] [Field L] [Algebra R K] [Algebra R L] [FaithfulSMul R K] [FaithfulSMul R L] (A : Matrix m n R) : (A.map (algebraMap R K)).rank = (A.map (algebraMap R L)).rank := by apply matrix_rank_eq_of_independent_iff intro r f change LinearIndependent K (fun i => algebraMap R K ∘ A.col (f i)) ↔ LinearIndependent L (fun i => algebraMap R L ∘ A.col (f i)) rw [linearIndependent_algebraMap_comp_iff, linearIndependent_algebraMap_comp_iff]
/-- A field embedding preserves the rank of a finite rectangular matrix. -/theorem matrix_rank_map {m : Type u} {n : Type v} [Fintype m] [Fintype n] {F K : Type*} [Field F] [Field K] (f : F →+* K) (A : Matrix m n F) : (A.map f).rank = A.rank := by let : Algebra F K := f.toAlgebra simpa only [RingHom.algebraMap_toAlgebra, Algebra.algebraMap_self, RingHom.coe_id, Matrix.map_id] using (matrix_rank_algebraMap_eq (K := K) (L := F) A)
/-- Integer matrices have the same rank over any two characteristic-zero fields. -/theorem integer_matrix_rank_eq {m : Type u} {n : Type v} [Fintype m] [Fintype n] (K L : Type*) [Field K] [CharZero K] [Field L] [CharZero L] (A : Matrix m n ℤ) : (A.map (Int.castRingHom K)).rank = (A.map (Int.castRingHom L)).rank := by exact matrix_rank_algebraMap_eq A
/-- The characteristic-zero rank-transfer step used in the lower bound. -/theorem integer_matrix_rank_eq_complex {m : Type u} {n : Type v} [Fintype m] [Fintype n] (K : Type*) [Field K] [CharZero K] (A : Matrix m n ℤ) : (A.map (Int.castRingHom K)).rank = (A.map (Int.castRingHom ℂ)).rank := by exact integer_matrix_rank_eq K ℂ A
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141import OAI.Algebra.DepthFive.DimensionCorrectionimport OAI.Algebra.DepthFive.DegreeDiscrepancy
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335
/-- Factors applied first in the intermediate-space argument. -/def positiveBidegreeSet {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) : Finset ι := by classical exact s.filter (fun j => 0 < (i j : ℝ) - lam * e j)
/-- Total differentiation degree of the first group of factors. -/def positiveBidegreeV {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) : ℕ := ∑ j ∈ positiveBidegreeSet s e i lam, i j
/-- Total multiplication degree of the first group of factors. -/def positiveBidegreeU {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) : ℕ := ∑ j ∈ positiveBidegreeSet s e i lam, (e j - i j)
theorem positiveBidegreeV_le {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) : positiveBidegreeV s e i lam ≤ ∑ j ∈ s, i j := by classical exact Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) (fun _ _ _ => Nat.zero_le _)
theorem positiveBidegreeU_le {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) (hie : ∀ j ∈ s, i j ≤ e j) : positiveBidegreeU s e i lam ≤ (∑ j ∈ s, e j) - ∑ j ∈ s, i j := by classical calc _ ≤ ∑ j ∈ s, (e j - i j) := Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) (fun _ _ _ => Nat.zero_le _) _ = _ := Finset.sum_tsub_distrib s hie
/-- Natural bidegree assignments give exactly the discrepancy-weight product. -/theorem positiveBidegree_rpow {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (ρ lam α : ℝ) (hα : 0 < α) (hie : ∀ j ∈ s, i j ≤ e j) (hlam : (1 + ρ) * lam = ρ) (hbalance : lam * (∑ j ∈ s, e j : ℕ) = (∑ j ∈ s, i j : ℕ)) : α ^ ((positiveBidegreeV s e i lam : ℝ) - ρ * positiveBidegreeU s e i lam) = ∏ j ∈ s, (α ^ ((1 + ρ) / 2)) ^ |(i j : ℝ) - lam * e j| := by classical have hzero : ∑ j ∈ s, ((i j : ℝ) - lam * e j) = 0 := by rw [Finset.sum_sub_distrib, ← Finset.mul_sum] norm_cast at hbalance ⊢ exact sub_eq_zero.mpr hbalance.symm have hcast : (positiveBidegreeU s e i lam : ℝ) = ∑ j ∈ s.filter (fun j => 0 < (i j : ℝ) - lam * e j), ((e j : ℝ) - i j) := by unfold positiveBidegreeU positiveBidegreeSet push_cast apply Finset.sum_congr rfl intro j hj exact Nat.cast_sub (hie j (Finset.mem_filter.mp hj).1) rw [hcast] simp only [positiveBidegreeV, positiveBidegreeSet, Nat.cast_sum] exact positive_bidegree_rpow s (fun j => (e j : ℝ)) (fun j => (i j : ℝ)) ρ lam α hα hlam hzero
/-- The intermediate space associated to an admissible natural bidegreeassignment is bounded by its product of discrepancy weights. -/theorem intermediate_dimension_le_weight_product {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (k n v u a b : ℕ) (ρ lam : ℝ) (hie : ∀ j ∈ s, i j ≤ e j) (he : ∑ j ∈ s, e j = n) (hi : ∑ j ∈ s, i j = k) (hproportion : lam * n = k) (hlam : (1 + ρ) * lam = ρ) (hv : 1 ≤ v) (hu : 1 ≤ u) (ha : 0 < a) (hb : 0 < b) (hka : k ≤ a) (hbudget : 2 * k ≤ a + v) (hbalance : ((a : ℝ) / ((a : ℝ) + v)) ^ ρ ≤ (b : ℝ) / ((b : ℝ) + u)) : (homogeneousDim v (a - positiveBidegreeV s e i lam) : ℝ) * homogeneousDim u (b + positiveBidegreeU s e i lam) ≤ 2 * ((homogeneousDim v a : ℝ) * homogeneousDim u b) * ∏ j ∈ s, (((a : ℝ) / ((a : ℝ) + v)) ^ ((1 + ρ) / 2)) ^ |(i j : ℝ) - lam * e j| := by have hVk : positiveBidegreeV s e i lam ≤ k := by simpa only [hi] using positiveBidegreeV_le s e i lam have hVa : positiveBidegreeV s e i lam ≤ a := hVk.trans hka have hVbudget : 2 * positiveBidegreeV s e i lam ≤ a + v := by omega have hα : 0 < (a : ℝ) / ((a : ℝ) + v) := by positivity have hprop : lam * (∑ j ∈ s, e j : ℕ) = (∑ j ∈ s, i j : ℕ) := by rw [he, hi] exact hproportion have h := intermediate_dimension_le_balanced (I := positiveBidegreeV s e i lam) (J := positiveBidegreeU s e i lam) hv hu ha hb hVa hVbudget ρ hbalance rw [positiveBidegree_rpow s e i ρ lam _ hα hie hlam hprop] at h exact h
/-- Summing intermediate dimensions over the admissible bidegrees gives thenumerical product bound used after rank subadditivity. -/theorem sum_intermediate_dimensions_le_weight_product {ι : Type*} [Fintype ι] [DecidableEq ι] (e : ι → ℕ) (k n v u a b : ℕ) (ρ lam : ℝ) (he : ∑ j, e j = n) (hproportion : lam * n = k) (hlam : (1 + ρ) * lam = ρ) (hv : 1 ≤ v) (hu : 1 ≤ u) (ha : 0 < a) (hb : 0 < b) (hka : k ≤ a) (hbudget : 2 * k ≤ a + v) (hbalance : ((a : ℝ) / ((a : ℝ) + v)) ^ ρ ≤ (b : ℝ) / ((b : ℝ) + u)) : (∑ i ∈ (Fintype.piFinset (fun j => Finset.range (e j + 1))).filter (fun i => ∑ j, i j = k), (homogeneousDim v (a - positiveBidegreeV Finset.univ e i lam) : ℝ) * homogeneousDim u (b + positiveBidegreeU Finset.univ e i lam)) ≤ 2 * ((homogeneousDim v a : ℝ) * homogeneousDim u b) * ∏ j, degreeWeight (((a : ℝ) / ((a : ℝ) + v)) ^ ((1 + ρ) / 2)) lam (e j) := by classical let α : ℝ := (a : ℝ) / ((a : ℝ) + v) let q : ℝ := α ^ ((1 + ρ) / 2) let D : ℝ := (homogeneousDim v a : ℝ) * homogeneousDim u b let A := (Fintype.piFinset (fun j => Finset.range (e j + 1))).filter (fun i => ∑ j, i j = k) have hα : 0 ≤ α := by dsimp [α]; positivity change (∑ i ∈ A, _) ≤ 2 * D * ∏ j, degreeWeight q lam (e j) calc _ ≤ ∑ i ∈ A, 2 * D * ∏ j, q ^ |(i j : ℝ) - lam * e j| := by apply Finset.sum_le_sum intro i hi have hiA := Finset.mem_filter.mp hi have hie : ∀ j ∈ (Finset.univ : Finset ι), i j ≤ e j := by intro j _ have hj := Fintype.mem_piFinset.mp hiA.1 j exact Nat.le_of_lt_succ (Finset.mem_range.mp hj) exact intermediate_dimension_le_weight_product Finset.univ e i k n v u a b ρ lam hie he hiA.2 hproportion hlam hv hu ha hb hka hbudget hbalance _ = 2 * D * ∑ i ∈ A, ∏ j, q ^ |(i j : ℝ) - lam * e j| := by rw [Finset.mul_sum] _ ≤ 2 * D * ∏ j, degreeWeight q lam (e j) := by apply mul_le_mul_of_nonneg_left · exact bidegree_weight_sum_le e k q lam (Real.rpow_nonneg hα _) · dsimp [D] positivity
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176import OAI.Algebra.DepthFive.MixedOperatorimport OAI.Algebra.DepthFive.OperatorRankimport OAI.Algebra.DepthFive.MixedOperatorBidegreeimport OAI.Algebra.DepthFive.RankMeasure
namespace OAI
/-! Factorization of mixed operators through intermediate bidegree spaces.The codomain is initially the full polynomial space. Restricting it to abidegree submodule leaves the range dimension unchanged, as proved below. -/
noncomputable sectionopen scoped BigOperators
namespace Problem335
variable {σ K : Type*} [Field K]
/-- The full operator restricted to a finite-bidegree source, as a linearfamily in the polynomial defining the operator. -/def sourceMixedOperator (isV : σ → Bool) (a b : ℕ) : MvPolynomial σ K →ₗ[K] (bidegreeSubmodule (K := K) isV a b →ₗ[K] MvPolynomial σ K) where toFun p := (mixedOperator isV p).comp (bidegreeSubmodule isV a b).subtype map_add' p q := by ext f simp map_smul' c p := by ext f simp
@[simp] theorem sourceMixedOperator_apply (isV : σ → Bool) (a b : ℕ) (p : MvPolynomial σ K) (f : bidegreeSubmodule (K := K) isV a b) : sourceMixedOperator isV a b p f = mixedOperator isV p (f : MvPolynomial σ K) := rfl
/-- The operator for `p` maps the source into the proposed intermediate space. -/def intermediateStart (isV : σ → Bool) (a b c d : ℕ) (p : MvPolynomial σ K) (h : ∀ f : bidegreeSubmodule (K := K) isV a b, mixedOperator isV p (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) : bidegreeSubmodule (K := K) isV a b →ₗ[K] bidegreeSubmodule (K := K) isV c d := LinearMap.codRestrict _ (sourceMixedOperator isV a b p) h
/-- Factorization is an equality of actual linear maps, not merely a rankinequality. The rightmost polynomial factor operates first. -/theorem sourceMixedOperator_mul_factorization (isV : σ → Bool) (a b c d : ℕ) (p q : MvPolynomial σ K) (h : ∀ f : bidegreeSubmodule (K := K) isV a b, mixedOperator isV p (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) : sourceMixedOperator isV a b (q * p) = (sourceMixedOperator isV c d q).comp (intermediateStart isV a b c d p h) := by apply LinearMap.ext intro f exact mixedOperator_mul_apply isV q p f
/-- Any factorization through an intermediate bidegree space bounds rank bythat space's dimension. -/theorem sourceMixedOperator_mul_rank_le [Finite σ] (isV : σ → Bool) (a b c d : ℕ) (p q : MvPolynomial σ K) (h : ∀ f : bidegreeSubmodule (K := K) isV a b, mixedOperator isV p (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) : RankMeasure.mapRank (sourceMixedOperator isV a b (q * p)) ≤ Module.finrank K (bidegreeSubmodule (K := K) isV c d) := by rw [sourceMixedOperator_mul_factorization isV a b c d p q h] exact RankMeasure.mapRank_factor_le _ _
/-- The bidegree of a selected subproduct is the sum of the selectedbidegrees, with no condition on the unselected factors. -/theorem selected_bidegree_product_mem {ι : Type*} (s : Finset ι) (selected : ι → Prop) [DecidablePred selected] (Q : ι → MvPolynomial σ K) (i j : ι → ℕ) (isV : σ → Bool) (hQ : ∀ l ∈ s, Q l ∈ bidegreeSubmodule isV (i l) (j l)) : (∏ l ∈ s.filter selected, Q l) ∈ bidegreeSubmodule isV (∑ l ∈ s.filter selected, i l) (∑ l ∈ s.filter selected, j l) := by have hp := MvPolynomial.IsWeightedHomogeneous.prod (s.filter selected) Q (fun l => (i l, j l)) (w := bidegreeWeight isV) (fun l hl => hQ l (Finset.mem_filter.mp hl).1) rw [← prod_mk_sum] at hp exact hp
/-- In a commutative polynomial product, any chosen group of factors can beapplied first. In the product-rank proof this group consists of the factorswith positive proportional bidegree discrepancy. -/theorem sourceMixedOperator_prod_rank_le [Finite σ] {ι : Type*} (s : Finset ι) (selected : ι → Prop) [DecidablePred selected] (Q : ι → MvPolynomial σ K) (isV : σ → Bool) (a b c d : ℕ) (h : ∀ f : bidegreeSubmodule (K := K) isV a b, mixedOperator isV (∏ j ∈ s.filter selected, Q j) (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) : RankMeasure.mapRank (sourceMixedOperator isV a b (∏ j ∈ s, Q j)) ≤ Module.finrank K (bidegreeSubmodule (K := K) isV c d) := by classical rw [← Finset.prod_filter_mul_prod_filter_not s selected Q, mul_comm] exact sourceMixedOperator_mul_rank_le isV a b c d _ _ h
/-- A selected homogeneous subproduct gives the actual intermediate dimensionbound. Only its total derivative degree needs to fit inside the source. -/theorem sourceMixedOperator_homogeneous_prod_rank_le [Finite σ] {ι : Type*} (s : Finset ι) (selected : ι → Prop) [DecidablePred selected] (Q : ι → MvPolynomial σ K) (i j : ι → ℕ) (isV : σ → Bool) (a b : ℕ) (hQ : ∀ l ∈ s, Q l ∈ bidegreeSubmodule isV (i l) (j l)) (hi : (∑ l ∈ s.filter selected, i l) ≤ a) : RankMeasure.mapRank (sourceMixedOperator isV a b (∏ l ∈ s, Q l)) ≤ Module.finrank K (bidegreeSubmodule (K := K) isV (a - ∑ l ∈ s.filter selected, i l) (b + ∑ l ∈ s.filter selected, j l)) := by apply sourceMixedOperator_prod_rank_le s selected Q isV a b intro f exact mixedOperator_mem_bidegreeSubmodule isV hi (selected_bidegree_product_mem s selected Q i j isV hQ) f.property
/-- Specialization to the component product belonging to one bidegreeassignment. This is the geometric rank estimate used before summing overassignments in the product-rank lemma. -/theorem sourceMixedOperator_component_prod_rank_le [Finite σ] {ι : Type*} (s : Finset ι) (selected : ι → Prop) [DecidablePred selected] (Q : ι → MvPolynomial σ K) (e i : ι → ℕ) (isV : σ → Bool) (a b : ℕ) (hi : (∑ l ∈ s.filter selected, i l) ≤ a) : RankMeasure.mapRank (sourceMixedOperator isV a b (∏ l ∈ s, bidegreeComponent isV (i l) (e l - i l) (Q l))) ≤ Module.finrank K (bidegreeSubmodule (K := K) isV (a - ∑ l ∈ s.filter selected, i l) (b + ∑ l ∈ s.filter selected, (e l - i l))) := by exact sourceMixedOperator_homogeneous_prod_rank_le s selected (fun l => bidegreeComponent isV (i l) (e l - i l) (Q l)) i (fun l => e l - i l) isV a b (fun l _ => bidegreeComponent_mem isV (i l) (e l - i l) (Q l)) hi
/-- A total derivative-degree bound suffices for every selection of factors.This version is convenient for constrained assignments whose degrees sum to `k`. -/theorem sourceMixedOperator_component_prod_rank_le_of_sum_le [Finite σ] {ι : Type*} (s : Finset ι) (selected : ι → Prop) [DecidablePred selected] (Q : ι → MvPolynomial σ K) (e i : ι → ℕ) (isV : σ → Bool) (a b : ℕ) (hi : (∑ l ∈ s, i l) ≤ a) : RankMeasure.mapRank (sourceMixedOperator isV a b (∏ l ∈ s, bidegreeComponent isV (i l) (e l - i l) (Q l))) ≤ Module.finrank K (bidegreeSubmodule (K := K) isV (a - ∑ l ∈ s.filter selected, i l) (b + ∑ l ∈ s.filter selected, (e l - i l))) := by apply sourceMixedOperator_component_prod_rank_le s selected Q e i isV a b exact (Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) (fun _ _ _ => Nat.zero_le _)).trans hi
/-- Passing from a fixed-bidegree codomain to the full polynomial codomaindoes not alter the dimension of the range. -/theorem mapRank_subtype_comp {V : Type*} [AddCommGroup V] [Module K V] (Z : Submodule K (MvPolynomial σ K)) (f : V →ₗ[K] Z) : RankMeasure.mapRank (Z.subtype.comp f) = RankMeasure.mapRank f := by unfold RankMeasure.mapRank rw [LinearMap.range_comp] exact Submodule.finrank_map_subtype_eq Z f.range
/-- Consequently a codomain-restricted mixed operator and its source-onlyrestriction have exactly the same rank. -/theorem sourceMixedOperator_codRestrict_rank (isV : σ → Bool) (a b c d : ℕ) (p : MvPolynomial σ K) (h : ∀ f : bidegreeSubmodule (K := K) isV a b, mixedOperator isV p (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) : RankMeasure.mapRank (intermediateStart isV a b c d p h) = RankMeasure.mapRank (sourceMixedOperator isV a b p) := by have heq : (bidegreeSubmodule (K := K) isV c d).subtype.comp (intermediateStart isV a b c d p h) = sourceMixedOperator isV a b p := by apply LinearMap.ext intro f rfl rw [← heq] exact (mapRank_subtype_comp _ _).symm
end Problem335
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980import OAI.Algebra.DepthFive.FourPathLocalimport OAI.Algebra.DepthFive.ShiftedOccupation
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335namespace LocalMoments
def operatorSign (derivative : Bool) : ℤ := if derivative then -1 else 1
/-- An invalid shifted coordinate forces the relevant local table factor to vanish. -/lemma localPolynomial_zero_of_negative {σ : Type*} [DecidableEq σ] (derivative : Bool) (M : σ → ℕ) (p q r x : σ) (hneg : (M x : ℤ) + operatorSign derivative * ((if x = p then 1 else 0) - (if x = q then 1 else 0)) < 0) : localPolynomial derivative M p q r = 0 := by by_cases hpq : p = q · subst q simp at hneg omega · cases derivative · have hMq : M q = 0 := by by_cases hxq : x = q · subst x simp [operatorSign, Ne.symm hpq] at hneg omega · by_cases hxp : x = p · subst x simp [operatorSign, hpq] at hneg omega · simp [operatorSign, hxp, hxq] at hneg omega simp [localPolynomial, hpq, hMq] · have hMp : M p = 0 := by by_cases hxp : x = p · subst x simp [operatorSign, hpq] at hneg omega · by_cases hxq : x = q · subst x simp [operatorSign, Ne.symm hpq] at hneg omega · simp [operatorSign, hxp, hxq] at hneg omega simp [localPolynomial, hpq, hMp]
/-- An invalid source in any layer annihilates the complete four-path table product. -/lemma localPolynomial_product_zero_of_negative {ι σ : Type*} [DecidableEq σ] (layers : Finset ι) (derivative : ι → Bool) (M : ι × σ → ℕ) (p q r : ι → σ) (t : ι) (a : σ) (ht : t ∈ layers) (hneg : ShiftedOccupation.signedSource M (operatorSign ∘ derivative) p q (t, a) < 0) : (∏ j ∈ layers, localPolynomial (derivative j) (fun b => M (j, b)) (p j) (q j) (r j)) = 0 := by apply Finset.prod_eq_zero ht apply localPolynomial_zero_of_negative (derivative t) (fun b => M (t, b)) (p t) (q t) (r t) a exact hneg
/-- The global table vanishes whenever no natural shifted source exists. -/lemma localPolynomial_product_zero_of_no_source {ι σ : Type*} [Fintype ι] [DecidableEq σ] (derivative : ι → Bool) (M : ι × σ → ℕ) (p q r : ι → σ) (hbad : ¬ ∃ N : ι × σ → ℕ, ∀ x, (N x : ℤ) = ShiftedOccupation.signedSource M (operatorSign ∘ derivative) p q x) : (∏ j : ι, localPolynomial (derivative j) (fun b => M (j, b)) (p j) (q j) (r j)) = 0 := by rw [ShiftedOccupation.exists_source_iff] at hbad push Not at hbad obtain ⟨⟨t, a⟩, hneg⟩ := hbad exact localPolynomial_product_zero_of_negative Finset.univ derivative M p q r t a (Finset.mem_univ _) hneg
end LocalMomentsend Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257import Mathlib
namespace OAI
/-!Canonical removal of isolated positions in an independent set.
The value `true` denotes the D type from the manuscript. The set `S`contains the positions allowed to flip (interior V layers), and `R a b`means that `b` is a neighbor of `a`. Independence is the only propertyof the path graph needed for the fiber calculation.-/
noncomputable section
open scoped BigOperators
namespace Problem335.IsolatedFlip
variable {α : Type*} [Fintype α] [DecidableEq α]
def eligible (S : Finset α) (R : α → α → Prop) (w : α → Bool) : Finset α := by classical exact S.filter (fun a => ∀ b, R a b → w b = true)
def flip (S : Finset α) (R : α → α → Prop) (w : α → Bool) (a : α) : Bool := by classical exact if a ∈ eligible S R w then true else w a
def unset (w : α → Bool) (T : Finset α) (a : α) : Bool := if a ∈ T then false else w a
def removed (S : Finset α) (R : α → α → Prop) (w : α → Bool) : Finset α := by classical exact (eligible S R w).filter (fun a => w a = false)
@[simp] theorem mem_eligible {α : Type u_1} [Fintype α] [DecidableEq α] {S : Finset α} {R : α → α → Prop} {w : α → Bool} {a : α} : a ∈ eligible S R w ↔ a ∈ S ∧ ∀ b, R a b → w b = true := by classical simp [eligible]
theorem eligible_subset (S : Finset α) (R : α → α → Prop) (w : α → Bool) : eligible S R w ⊆ S := by intro a ha exact (mem_eligible.mp ha).1
theorem flip_eq_of_not_mem {S : Finset α} {R : α → α → Prop} {w : α → Bool} {a : α} (ha : a ∉ S) : flip S R w a = w a := by classical have h : a ∉ eligible S R w := fun h => ha (eligible_subset S R w h) simp [flip, h]
theorem eligible_congr {S : Finset α} {R : α → α → Prop} (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) {w z : α → Bool} (h : ∀ a, a ∉ S → w a = z a) : eligible S R w = eligible S R z := by ext a simp only [mem_eligible] constructor · rintro ⟨ha, hw⟩ refine ⟨ha, ?_⟩ intro b hab rw [← h b (hS a ha b hab)] exact hw b hab · rintro ⟨ha, hz⟩ refine ⟨ha, ?_⟩ intro b hab rw [h b (hS a ha b hab)] exact hz b hab
theorem eligible_flip {S : Finset α} {R : α → α → Prop} (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) (w : α → Bool) : eligible S R (flip S R w) = eligible S R w := by apply eligible_congr hS intro a ha exact flip_eq_of_not_mem ha
theorem flip_idempotent {S : Finset α} {R : α → α → Prop} (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) (w : α → Bool) : flip S R (flip S R w) = flip S R w := by classical funext a simp only [flip, eligible_flip hS] split_ifs <;> rfl
theorem eligible_unset {S : Finset α} {R : α → α → Prop} (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) (w : α → Bool) {T : Finset α} (hT : T ⊆ S) : eligible S R (unset w T) = eligible S R w := by apply eligible_congr hS intro a ha have hn : a ∉ T := fun ht => ha (hT ht) simp [unset, hn]
theorem flip_unset {S : Finset α} {R : α → α → Prop} (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) {w : α → Bool} (hw : flip S R w = w) {T : Finset α} (hT : T ⊆ eligible S R w) : flip S R (unset w T) = w := by classical have he := eligible_unset hS w (hT.trans (eligible_subset S R w)) funext a have hw' := congrFun hw a simp only [flip, he] at hw' ⊢ by_cases ha : a ∈ eligible S R w · simpa [ha] using hw' · have hn : a ∉ T := fun ht => ha (hT ht) simp [ha, unset, hn]
theorem removed_subset {α : Type u_1} [Fintype α] [DecidableEq α] (S : Finset α) (R : α → α → Prop) (w : α → Bool) : removed S R w ⊆ eligible S R w := by classical exact Finset.filter_subset _ _
theorem unset_flip_removed (S : Finset α) (R : α → α → Prop) (w : α → Bool) : unset (flip S R w) (removed S R w) = w := by classical funext a by_cases ha : a ∈ eligible S R w · cases hw : w a <;> simp [unset, removed, flip, ha, hw] · simp [unset, removed, flip, ha]
theorem removed_unset {S : Finset α} {R : α → α → Prop} (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) {w : α → Bool} (hw : flip S R w = w) {T : Finset α} (hT : T ⊆ eligible S R w) : removed S R (unset w T) = T := by classical have he := eligible_unset hS w (hT.trans (eligible_subset S R w)) ext a simp only [removed, Finset.mem_filter, he] constructor · rintro ⟨ha, hz⟩ by_contra hn have hw' := congrFun hw a simp [flip, ha] at hw' simp [unset, hn, hw'] at hz · intro ha exact ⟨hT ha, by simp [unset, ha]⟩
/-! Each fiber of the canonicalization is exactly a powerset. -/
def fiberEquiv {S : Finset α} {R : α → α → Prop} (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) (w : α → Bool) (hw : flip S R w = w) : {z : α → Bool // flip S R z = w} ≃ {T : Finset α // T ⊆ eligible S R w} where toFun z := ⟨removed S R z, by have he : eligible S R z = eligible S R w := by exact (eligible_flip hS z).symm.trans (congrArg (eligible S R) z.property) rw [← he] exact removed_subset S R z⟩ invFun T := ⟨unset w T, flip_unset hS hw T.property⟩ left_inv z := by apply Subtype.ext change unset w (removed S R z) = z exact (congrArg (fun q => unset q (removed S R z)) z.property.symm).trans (unset_flip_removed S R z) right_inv T := by apply Subtype.ext exact removed_unset hS hw T.property
theorem fiber_card {S : Finset α} {R : α → α → Prop} (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) (w : α → Bool) (hw : flip S R w = w) : Fintype.card {z : α → Bool // flip S R z = w} = 2 ^ (eligible S R w).card := by classical rw [Fintype.card_congr (fiberEquiv hS w hw)] simpa only [Finset.mem_powerset] using (Fintype.card_coe (eligible S R w).powerset).trans (Finset.card_powerset _)
theorem fiber_sum_pow {S : Finset α} {R : α → α → Prop} (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) (w : α → Bool) (hw : flip S R w = w) {K : Type*} [CommSemiring K] (c : K) : (∑ z : {z : α → Bool // flip S R z = w}, c ^ (removed S R z).card) = (1 + c) ^ (eligible S R w).card := by classical calc _ = ∑ T : {T : Finset α // T ⊆ eligible S R w}, c ^ T.val.card := Fintype.sum_equiv (fiberEquiv hS w hw) _ _ (fun _ => rfl) _ = ∑ T ∈ (eligible S R w).powerset, c ^ T.card := (Finset.sum_subtype (p := fun T : Finset α => T ⊆ eligible S R w) (eligible S R w).powerset (fun _ => Finset.mem_powerset) (fun T => c ^ T.card)).symm _ = _ := by simpa [Finset.prod_const, add_comm] using (Finset.prod_add_one (f := fun _ : α => c) (eligible S R w)).symm
theorem fiber_weight_sum {S : Finset α} {R : α → α → Prop} (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) (w : α → Bool) (hw : flip S R w = w) {K : Type*} [CommSemiring K] (c : K) (W : (α → Bool) → K) (hW : ∀ z, flip S R z = w → W z = W w * c ^ (removed S R z).card) : (∑ z : {z : α → Bool // flip S R z = w}, W z) = W w * (1 + c) ^ (eligible S R w).card := by classical calc _ = ∑ z : {z : α → Bool // flip S R z = w}, W w * c ^ (removed S R z).card := Finset.sum_congr rfl (fun z _ => hW z z.property) _ = W w * ∑ z : {z : α → Bool // flip S R z = w}, c ^ (removed S R z).card := (Finset.mul_sum _ _ _).symm _ = _ := by rw [fiber_sum_pow hS w hw]
theorem total_weight_sum {S : Finset α} {R : α → α → Prop} (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) {K : Type*} [CommSemiring K] (c : K) (W : (α → Bool) → K) (hW : ∀ z, W z = W (flip S R z) * c ^ (removed S R z).card) : (∑ z, W z) = ∑ w ∈ Finset.univ.filter (fun w => flip S R w = w), W w * (1 + c) ^ (eligible S R w).card := by classical rw [Finset.sum_filter] calc _ = ∑ w, ∑ z : {z : α → Bool // flip S R z = w}, W z := (Fintype.sum_fiberwise (flip S R) W).symm _ = _ := by apply Finset.sum_congr rfl intro w _ by_cases hw : flip S R w = w · rw [ite_eq_left hw] apply fiber_weight_sum hS w hw c W intro z hz simpa only [hz] using hW z · rw [ite_eq_right hw] have hempty : IsEmpty {z : α → Bool // flip S R z = w} := by refine ⟨fun z => hw ?_⟩ exact (congrArg (flip S R) z.property.symm).trans ((flip_idempotent hS z).trans z.property) let := hempty simp
theorem correction_removal {S : Finset α} {R : α → α → Prop} (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) (c : ℝ) (hc : 0 ≤ c) (W : (α → Bool) → ℝ) (hWnonneg : ∀ z, 0 ≤ W z) (hW : ∀ z, W z = W (flip S R z) * c ^ (removed S R z).card) : (∑ z, W z) ≤ (1 + c) ^ S.card * ∑ w ∈ Finset.univ.filter (fun w => flip S R w = w), W w := by classical rw [total_weight_sum hS c W hW, Finset.mul_sum] apply Finset.sum_le_sum intro w _ rw [mul_comm ((1 + c) ^ S.card)] exact mul_le_mul_of_nonneg_left (pow_le_pow_right₀ (by linarith : 1 ≤ 1 + c) (Finset.card_le_card (eligible_subset S R w))) (hWnonneg w)
end Problem335.IsolatedFlip
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380import OAI.Algebra.DepthFive.IsolatedFlipimport OAI.Algebra.DepthFive.SwitchRestoration
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335.IsolatedWeight
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
/-- Internal neighboring positions of the same normal (false) type. -/def falseNeighbors (R : ι → ι → Prop) (w : ι → Bool) (i : ι) : Finset ι := by classical exact Finset.univ.filter (fun j => R i j ∧ w j = false)
/-- The coincidence correction factors at the normal V positions. -/def correction (V : Finset ι) (R : ι → ι → Prop) (A x : ℝ) (w : ι → Bool) : ℝ := by classical exact ∏ i ∈ V.filter (fun i => w i = false), (1 + A * x ^ (falseNeighbors R w i).card)
/-- Restoring any subset of an independent V set does not change theneighbors of any V position. Endpoints are allowed in V. -/theorem falseNeighbors_unset {V T : Finset ι} {R : ι → ι → Prop} (hT : T ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) (w : ι → Bool) {i : ι} (hi : i ∈ V) : falseNeighbors R (IsolatedFlip.unset w T) i = falseNeighbors R w i := by classical ext j by_cases hr : R i j · have hj : j ∉ T := fun ht => hV i hi j hr (hT ht) simp [falseNeighbors, IsolatedFlip.unset, hr, hj] · simp [falseNeighbors, hr]
omit [DecidableEq ι] intheorem falseNeighbors_eq_empty {R : ι → ι → Prop} {w : ι → Bool} {i : ι} (h : ∀ j, R i j → w j = true) : falseNeighbors R w i = ∅ := by classical apply Finset.eq_empty_iff_forall_notMem.mpr intro j hj have hh := Finset.mem_filter.mp hj have heq := h j hh.2.1 simp only [heq, Bool.true_eq_false] at hh exact hh.2.2
omit [Fintype ι] in/-- The normal V positions after restoration consist of the old normalpositions together with the restored subset. -/theorem falseVertices_unset {V T : Finset ι} (hT : T ⊆ V) (w : ι → Bool) : (V.filter fun i => IsolatedFlip.unset w T i = false) = (V.filter fun i => w i = false) ∪ T := by classical ext i by_cases hi : i ∈ T · simp [IsolatedFlip.unset, hi, hT hi] · simp [IsolatedFlip.unset, hi]
omit [Fintype ι] [DecidableEq ι] intheorem falseVertices_disjoint {V T : Finset ι} (w : ι → Bool) (hw : ∀ i ∈ T, w i = true) : Disjoint (V.filter fun i => w i = false) T := by classical apply Finset.disjoint_left.mpr intro i hi ht have hf := (Finset.mem_filter.mp hi).2 have ht := hw i ht simp only [ht, Bool.true_eq_false] at hf
/-- The exact local correction-product factor in the isolated-position flip.Every restored position has no normal neighbors, and hence contributes `1+A`. -/theorem correction_unset {V T : Finset ι} {R : ι → ι → Prop} (hT : T ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) (w : ι → Bool) (hw : ∀ i ∈ T, w i = true) (hnear : ∀ i ∈ T, ∀ j, R i j → w j = true) (A x : ℝ) : correction V R A x (IsolatedFlip.unset w T) = correction V R A x w * (1 + A) ^ T.card := by classical unfold correction rw [falseVertices_unset hT w, Finset.prod_union (falseVertices_disjoint w hw)] congr 1 · apply Finset.prod_congr rfl intro i hi rw [falseNeighbors_unset hT hV w (Finset.mem_filter.mp hi).1] · calc _ = ∏ _i ∈ T, (1 + A) := by apply Finset.prod_congr rfl intro i hi rw [falseNeighbors_unset hT hV w (hT hi), falseNeighbors_eq_empty (hnear i hi)] simp _ = (1 + A) ^ T.card := by simp
/-- True positions in the complementary variable group are unchanged. -/theorem complement_trueVertices_unset {V T : Finset ι} (hT : T ⊆ V) (w : ι → Bool) : ((Finset.univ \ V).filter fun i => IsolatedFlip.unset w T i = true) = ((Finset.univ \ V).filter fun i => w i = true) := by classical ext i by_cases hi : i ∈ V · simp [hi] · have hit : i ∉ T := fun ht => hi (hT ht) simp [IsolatedFlip.unset, hi, hit]
/-- The actual weighted word summand, with `A = alpha⁻¹`, `B = beta`,and `x = n⁻¹`. The relation records internal adjacency. -/def weight (edges : Finset (ι × ι)) (V : Finset ι) (R : ι → ι → Prop) (A B x : ℝ) (w : ι → Bool) : ℝ := by classical exact x ^ SwitchRestoration.switchCount edges w * A ^ (V.filter fun i => w i = true).card * B ^ ((Finset.univ \ V).filter fun i => w i = true).card * correction V R A x w
/-- Exact isolated-flip weight identity given the switch-count increment.The switch increment is supplied by `switchCount_restore_eq_add_twice_card`.No bound or positivity is needed except nonvanishing of the D-layer weight. -/theorem weight_unset {edges : Finset (ι × ι)} {V T : Finset ι} {R : ι → ι → Prop} (hT : T ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) (w : ι → Bool) (hw : ∀ i ∈ T, w i = true) (hnear : ∀ i ∈ T, ∀ j, R i j → w j = true) (hswitch : SwitchRestoration.switchCount edges (IsolatedFlip.unset w T) = SwitchRestoration.switchCount edges w + 2 * T.card) {A : ℝ} (hA : A ≠ 0) (B x : ℝ) : weight edges V R A B x (IsolatedFlip.unset w T) = weight edges V R A B x w * (x ^ 2 * (1 + A) / A) ^ T.card := by classical have hcount := SwitchRestoration.trueVertices_restore_card_add V T w hT hw change (V.filter fun i => IsolatedFlip.unset w T i = true).card + T.card = (V.filter fun i => w i = true).card at hcount unfold weight rw [hswitch, complement_trueVertices_unset hT w, correction_unset hT hV w hw hnear A x, ← hcount] simp only [pow_add, pow_mul, mul_pow, div_pow] field_simp
/-- The isolated-flip identity for the actual word weight. Only interiorpositions (of edge degree two) may flip, while V may also contain endpoints. -/theorem weight_flip {edges : Finset (ι × ι)} {V S : Finset ι} {R : ι → ι → Prop} (hS : S ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) (hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1) (hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2) {A : ℝ} (hA : A ≠ 0) (B x : ℝ) (w : ι → Bool) : weight edges V R A B x w = weight edges V R A B x (IsolatedFlip.flip S R w) * (x ^ 2 * (1 + A) / A) ^ (IsolatedFlip.removed S R w).card := by classical let T := IsolatedFlip.removed S R w let y := IsolatedFlip.flip S R w have hTe : T ⊆ IsolatedFlip.eligible S R w := IsolatedFlip.removed_subset S R w have hTS : T ⊆ S := hTe.trans (IsolatedFlip.eligible_subset S R w) have hTV : T ⊆ V := hTS.trans hS have hy : ∀ i ∈ T, y i = true := by intro i hi simp only [y, IsolatedFlip.flip, ite_eq_left (hTe hi)] have hnear : ∀ i ∈ T, ∀ j, R i j → y j = true := by intro i hi j hij have hwj := (IsolatedFlip.mem_eligible.mp (hTe hi)).2 j hij simp [y, IsolatedFlip.flip, hwj] have hsw : SwitchRestoration.switchCount edges (IsolatedFlip.unset y T) = SwitchRestoration.switchCount edges y + 2 * T.card := by apply SwitchRestoration.switchCount_restore_eq_add_twice_card · intro e he h rcases h with h | h · exact ⟨hy _ h, hnear _ h _ (hR e he).1⟩ · exact ⟨hnear _ h _ (hR e he).2, hy _ h⟩ · intro e he h exact hV e.1 (hTV h.1) e.2 (hR e he).1 (hTV h.2) · intro i hi exact hdegree i (hTS hi) have h := weight_unset hTV hV y hy hnear hsw hA B x simpa only [y, T, IsolatedFlip.unset_flip_removed] using h
/-- Nonnegative parameters give a nonnegative word weight. -/theorem weight_nonneg (edges : Finset (ι × ι)) (V : Finset ι) (R : ι → ι → Prop) {A B x : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (w : ι → Bool) : 0 ≤ weight edges V R A B x w := by classical unfold weight correction positivity
/-- Summing the exact word-weight identity over the fibers removes allisolated positions at a multiplicative cost `(1+x²(1+A)/A)^|S|`. -/theorem sum_weight_le_fixed {edges : Finset (ι × ι)} {V S : Finset ι} {R : ι → ι → Prop} (hS : S ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) (hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1) (hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2) {A B x : ℝ} (hA : 0 < A) (hB : 0 ≤ B) (hx : 0 ≤ x) : (∑ w : ι → Bool, weight edges V R A B x w) ≤ (1 + x ^ 2 * (1 + A) / A) ^ S.card * ∑ w ∈ Finset.univ.filter (fun w => IsolatedFlip.flip S R w = w), weight edges V R A B x w := by classical apply IsolatedFlip.correction_removal · intro i hi j hij hj exact hV i (hS hi) j hij (hS hj) · positivity · exact weight_nonneg edges V R hA.le hB hx · exact weight_flip hS hV hR hdegree hA.ne' B x
/-- A normal position in the flip set of a fixed word has at least onenormal neighbor: otherwise the canonical flip would change it. -/theorem falseNeighbors_card_pos_of_fixed {S : Finset ι} {R : ι → ι → Prop} {w : ι → Bool} (hw : IsolatedFlip.flip S R w = w) {i : ι} (hi : i ∈ S) (hwi : w i = false) : 0 < (falseNeighbors R w i).card := by classical have hn : ¬ ∀ j, R i j → w j = true := by intro h have he : i ∈ IsolatedFlip.eligible S R w := IsolatedFlip.mem_eligible.mpr ⟨hi, h⟩ have hh := congrFun hw i simp [IsolatedFlip.flip, he, hwi] at hh push Not at hn obtain ⟨j, hij, hj⟩ := hn have hwj : w j = false := by cases h : w j <;> simp_all exact Finset.card_pos.mpr ⟨j, by simp [falseNeighbors, hij, hwj]⟩
/-- The coincidence correction of a word with no isolated eligible position.The exceptional positions `V \ S` include the external endpoint. -/theorem correction_le_of_fixed {V S : Finset ι} {R : ι → ι → Prop} (hS : S ⊆ V) {w : ι → Bool} (hw : IsolatedFlip.flip S R w = w) {A x : ℝ} (hA : 0 ≤ A) (hx : 0 ≤ x) (hx1 : x ≤ 1) : correction V R A x w ≤ (1 + A * x) ^ S.card * (1 + A) ^ (V \ S).card := by classical unfold correction rw [Finset.prod_filter] calc _ ≤ ∏ i ∈ V, if i ∈ S then 1 + A * x else 1 + A := by apply Finset.prod_le_prod₀ · intro i hi split_ifs <;> positivity · intro i hi by_cases his : i ∈ S <;> by_cases hwi : w i = false · simp only [ite_eq_left his, ite_eq_left hwi] have hc := falseNeighbors_card_pos_of_fixed hw his hwi have hp : x ^ (falseNeighbors R w i).card ≤ x := by simpa using pow_le_pow_of_le_one hx hx1 (show 1 ≤ (falseNeighbors R w i).card by omega) linarith [mul_le_mul_of_nonneg_left hp hA] · simp only [ite_eq_left his, ite_eq_right hwi] nlinarith [mul_nonneg hA hx] · simp only [ite_eq_right his, ite_eq_left hwi] have hp : x ^ (falseNeighbors R w i).card ≤ 1 := pow_le_one₀ hx hx1 nlinarith · simp only [ite_eq_right his, ite_eq_right hwi] linarith _ = (1 + A * x) ^ S.card * (1 + A) ^ (V \ S).card := by rw [Finset.prod_ite] have hmem : V.filter (fun i => i ∈ S) = S := by ext i simp only [Finset.mem_filter] exact ⟨fun h => h.2, fun h => ⟨hS h, h⟩⟩ have hnot : V.filter (fun i => ¬ i ∈ S) = V \ S := by ext i simp rw [hmem, hnot] simp
/-- With at most one exceptional V endpoint, the fixed-word correction hasthe exact uniform bound used in the manuscript. -/theorem correction_le_endpoint_bound {V S : Finset ι} {R : ι → ι → Prop} (hS : S ⊆ V) (hend : (V \ S).card ≤ 1) {w : ι → Bool} (hw : IsolatedFlip.flip S R w = w) {A x : ℝ} (hA : 0 ≤ A) (hx : 0 ≤ x) (hx1 : x ≤ 1) : correction V R A x w ≤ (1 + A) * (1 + A * x) ^ V.card := by have hpow : (1 + A * x) ^ S.card ≤ (1 + A * x) ^ V.card := pow_le_pow_right₀ (by nlinarith) (Finset.card_le_card hS) have hendpow : (1 + A) ^ (V \ S).card ≤ 1 + A := by simpa using pow_le_pow_right₀ (by linarith : 1 ≤ 1 + A) hend calc correction V R A x w ≤ (1 + A * x) ^ S.card * (1 + A) ^ (V \ S).card := correction_le_of_fixed hS hw hA hx hx1 _ ≤ (1 + A * x) ^ V.card * (1 + A) := mul_le_mul hpow hendpow (by positivity) (by positivity) _ = (1 + A) * (1 + A * x) ^ V.card := mul_comm _ _
/-- The word summand without coincidence corrections. -/def baseWeight (edges : Finset (ι × ι)) (V : Finset ι) (A B x : ℝ) (w : ι → Bool) : ℝ := x ^ SwitchRestoration.switchCount edges w * A ^ (V.filter fun i => w i = true).card * B ^ ((Finset.univ \ V).filter fun i => w i = true).card
theorem weight_eq_baseWeight (edges : Finset (ι × ι)) (V : Finset ι) (R : ι → ι → Prop) (A B x : ℝ) (w : ι → Bool) : weight edges V R A B x w = baseWeight edges V A B x w * correction V R A x w := rfl
theorem baseWeight_nonneg (edges : Finset (ι × ι)) (V : Finset ι) {A B x : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (w : ι → Bool) : 0 ≤ baseWeight edges V A B x w := by unfold baseWeight positivity
/-- Complete isolated-position correction removal, including the exceptionalendpoint factor and enlargement of the fixed-word sum to all words. -/theorem sum_weight_le_uncorrected {edges : Finset (ι × ι)} {V S : Finset ι} {R : ι → ι → Prop} (hS : S ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) (hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1) (hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2) (hend : (V \ S).card ≤ 1) {A B x : ℝ} (hA : 0 < A) (hB : 0 ≤ B) (hx : 0 ≤ x) (hx1 : x ≤ 1) : (∑ w : ι → Bool, weight edges V R A B x w) ≤ (1 + x ^ 2 * (1 + A) / A) ^ S.card * (1 + A) * (1 + A * x) ^ V.card * ∑ w : ι → Bool, baseWeight edges V A B x w := by classical let fixed := Finset.univ.filter (fun w => IsolatedFlip.flip S R w = w) let C := (1 + A) * (1 + A * x) ^ V.card have hC : 0 ≤ C := by dsimp [C]; positivity have hsum : (∑ w ∈ fixed, weight edges V R A B x w) ≤ C * ∑ w : ι → Bool, baseWeight edges V A B x w := by calc _ ≤ ∑ w ∈ fixed, C * baseWeight edges V A B x w := by apply Finset.sum_le_sum intro w hw rw [weight_eq_baseWeight, mul_comm C] exact mul_le_mul_of_nonneg_left (correction_le_endpoint_bound hS hend (Finset.mem_filter.mp hw).2 hA.le hx hx1) (baseWeight_nonneg edges V hA.le hB hx w) _ = C * ∑ w ∈ fixed, baseWeight edges V A B x w := (Finset.mul_sum _ _ _).symm _ ≤ C * ∑ w : ι → Bool, baseWeight edges V A B x w := by apply mul_le_mul_of_nonneg_left _ hC apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) intro w hw hn exact baseWeight_nonneg edges V hA.le hB hx w calc _ ≤ (1 + x ^ 2 * (1 + A) / A) ^ S.card * ∑ w ∈ fixed, weight edges V R A B x w := sum_weight_le_fixed hS hV hR hdegree hA hB hx _ ≤ (1 + x ^ 2 * (1 + A) / A) ^ S.card * (C * ∑ w : ι → Bool, baseWeight edges V A B x w) := mul_le_mul_of_nonneg_left hsum (by positivity) _ = _ := by dsimp [C]; ring
/-- The uniform correction-removal inequality in the form used by theword-sum estimate: `A ≥ 1` bounds the flip cost by `1+2*x²`. -/theorem sum_weight_le_uniform_uncorrected {edges : Finset (ι × ι)} {V S : Finset ι} {R : ι → ι → Prop} (hS : S ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) (hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1) (hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2) (hend : (V \ S).card ≤ 1) {A B x : ℝ} (hA : 1 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (hx1 : x ≤ 1) : (∑ w : ι → Bool, weight edges V R A B x w) ≤ (1 + 2 * x ^ 2) ^ V.card * (1 + A) * (1 + A * x) ^ V.card * ∑ w : ι → Bool, baseWeight edges V A B x w := by classical have hAp : 0 < A := by linarith have hfrac : (1 + A) / A ≤ 2 := (div_le_iff₀ hAp).mpr (by linarith) have hc : x ^ 2 * (1 + A) / A ≤ 2 * x ^ 2 := by rw [mul_div_assoc] simpa only [mul_comm (x ^ 2) 2] using mul_le_mul_of_nonneg_left hfrac (sq_nonneg x) have hF : (1 + x ^ 2 * (1 + A) / A) ^ S.card ≤ (1 + 2 * x ^ 2) ^ V.card := by calc _ ≤ (1 + 2 * x ^ 2) ^ S.card := pow_le_pow_left₀ (by positivity) (by linarith) S.card _ ≤ (1 + 2 * x ^ 2) ^ V.card := pow_le_pow_right₀ (by nlinarith [sq_nonneg x]) (Finset.card_le_card hS) have hZ : 0 ≤ ∑ w : ι → Bool, baseWeight edges V A B x w := Finset.sum_nonneg (fun w _ => baseWeight_nonneg edges V hAp.le hB hx w) refine (sum_weight_le_uncorrected hS hV hR hdegree hend hAp hB hx hx1).trans ?_ have h := mul_le_mul_of_nonneg_right hF (show 0 ≤ (1 + A) * (1 + A * x) ^ V.card * ∑ w : ι → Bool, baseWeight edges V A B x w by positivity) simpa only [mul_assoc] using h
end Problem335.IsolatedWeight
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556import Mathlib
namespace OAI
noncomputable section
namespace Problem335
open MvPolynomial
variable {K σ : Type*} [CommSemiring K]
/-- Repeated partial differentiation acts by a falling factorial on each monomial. -/theorem iterate_pderiv_monomial (i : σ) (r : ℕ) (d : σ →₀ ℕ) (a : K) : (pderiv i)^[r] (monomial d a) = monomial (d - Finsupp.single i r) (a * (d i).descFactorial r) := by classical induction r with | zero => simp | succ r ih => rw [Function.iterate_succ_apply', ih, pderiv_monomial, Nat.descFactorial_succ] simp only [Finsupp.tsub_apply, Finsupp.single_eq_same, Nat.cast_mul] rw [show d - Finsupp.single i r - Finsupp.single i 1 = d - Finsupp.single i (r + 1) by rw [tsub_tsub, Finsupp.single_add]] congr 1 ring
/-- Derivatives beyond a monomial's exponent vanish, in any characteristic. -/theorem iterate_pderiv_monomial_eq_zero (i : σ) (r : ℕ) (d : σ →₀ ℕ) (a : K) (h : d i < r) : (pderiv i)^[r] (monomial d a) = 0 := by rw [iterate_pderiv_monomial, Nat.descFactorial_eq_zero_iff_lt.mpr h] simp
/-- Coefficients of a repeated derivative are shifted coefficients times a rising factorial. -/theorem coeff_iterate_pderiv (i : σ) (r : ℕ) (p : MvPolynomial σ K) (m : σ →₀ ℕ) : ((pderiv i)^[r] p).coeff m = p.coeff (m + Finsupp.single i r) * (m i + 1).ascFactorial r := by classical induction r generalizing p with | zero => simp | succ r ih => rw [Function.iterate_succ_apply, ih, coeff_pderiv, Nat.ascFactorial_succ] simp only [Finsupp.add_apply, Finsupp.single_eq_same, Nat.cast_mul] rw [show m + Finsupp.single i r + Finsupp.single i 1 = m + Finsupp.single i (r + 1) by rw [add_assoc, ← Finsupp.single_add]] push_cast ring
end Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114import OAI.Algebra.DepthFive.FourPathLocal
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335namespace LayeredFourPath
/-- Signed occupations, retaining the layer coordinate explicitly. -/def signedOccupation {T σ : Type*} (M : T → σ → ℕ) : T → σ → ℤ := fun t x => M t x
/-- Every path chooses exactly one coordinate in every layer. -/def signedShift {T σ : Type*} [DecidableEq σ] (side : T → Bool) (p : T → σ) : T → σ → ℤ := fun t x => (if side t then -1 else 1) * (Finsupp.single (p t) (1 : ℤ)) x
/-- The Fock coefficient of a layered path. -/def amplitude {T σ : Type*} [Fintype T] (side : T → Bool) (M : T → σ → ℕ) (p : T → σ) : ℝ := ∏ t, LocalMoments.coefficient (side t) (M t (p t))
/-- Compatibility of global signed shifts gives the local pairing identity at every layer. -/theorem coordinate_matching_of_signedShift {T σ : Type*} [DecidableEq σ] (side : T → Bool) (p q r s : T → σ) (h : signedShift side p - signedShift side q = signedShift side r - signedShift side s) (t : T) : Finsupp.single (p t) (1 : ℤ) - Finsupp.single (q t) 1 = Finsupp.single (r t) 1 - Finsupp.single (s t) 1 := by ext x have hx := congrArg (fun f : T → σ → ℤ => f t x) h change (Finsupp.single (p t) (1 : ℤ)) x - (Finsupp.single (q t) 1) x = (Finsupp.single (r t) 1) x - (Finsupp.single (s t) 1) x cases ht : side t <;> simp [signedShift, ht] at hx <;> omega
/-- An actual shifted source automatically satisfies the local occupation relation. -/theorem local_shift_of_signedOccupation {T σ : Type*} [DecidableEq σ] (side : T → Bool) (M M' : T → σ → ℕ) (p q : T → σ) (h : signedOccupation M' = signedOccupation M + signedShift side p - signedShift side q) (t : T) : LocalMoments.ShiftRelation (side t) (M t) (M' t) (p t) (q t) := by intro x have hx := congrArg (fun f : T → σ → ℤ => f t x) h change (M' t x : ℤ) = (M t x : ℤ) + (if side t then -1 else 1) * (Finsupp.single (p t) (1 : ℤ)) x - (if side t then -1 else 1) * (Finsupp.single (q t) (1 : ℤ)) x at hx rw [Finsupp.sub_apply] rw [hx] ring
/-- The entire valid four-path coefficient is the product of the local occupation table. -/theorem amplitude_four_eq_local_product {T σ : Type*} [Fintype T] [DecidableEq σ] (side : T → Bool) (M M' : T → σ → ℕ) (p q r s : T → σ) (hmatch : signedShift side p - signedShift side q = signedShift side r - signedShift side s) (hshift : signedOccupation M' = signedOccupation M + signedShift side p - signedShift side q) : amplitude side M p * amplitude side M' q * amplitude side M r * amplitude side M' s = ∏ t, LocalMoments.localPolynomial (side t) (M t) (p t) (q t) (r t) := by exact LocalMoments.four_path_products_eq_localPolynomial_product Finset.univ side M M' p q r s (fun t _ => coordinate_matching_of_signedShift side p q r s hmatch t) (fun t _ => local_shift_of_signedOccupation side M M' p q hshift t)
/-- Lift the valid-source identity to a zero extension. Missing shifted source occupationscontribute zero, so an upper estimate needs no source-validity-closure hypothesis. -/theorem zeroExtended_amplitude_four_le_local_product {I T σ : Type*} [Fintype T] [DecidableEq σ] (side : T → Bool) (M : I → T → σ → ℕ) (hinj : Function.Injective (fun i => signedOccupation (M i))) (i : I) (p q r s : T → σ) (hmatch : signedShift side p - signedShift side q = signedShift side r - signedShift side s) : amplitude side (M i) p * Function.extend (fun k => signedOccupation (M k)) (fun k => amplitude side (M k) q) (fun _ => 0) (signedOccupation (M i) + signedShift side p - signedShift side q) * amplitude side (M i) r * Function.extend (fun k => signedOccupation (M k)) (fun k => amplitude side (M k) s) (fun _ => 0) (signedOccupation (M i) + signedShift side p - signedShift side q) ≤ ∏ t, LocalMoments.localPolynomial (side t) (M i t) (p t) (q t) (r t) := by classical let x := signedOccupation (M i) + signedShift side p - signedShift side q by_cases hx : ∃ k, signedOccupation (M k) = x · obtain ⟨k, hk⟩ := hx change amplitude side (M i) p * Function.extend (fun k => signedOccupation (M k)) (fun k => amplitude side (M k) q) (fun _ => 0) x * amplitude side (M i) r * Function.extend (fun k => signedOccupation (M k)) (fun k => amplitude side (M k) s) (fun _ => 0) x ≤ _ rw [← hk, hinj.extend_apply, hinj.extend_apply] exact (amplitude_four_eq_local_product side (M i) (M k) p q r s hmatch hk).le · have hz := Function.extend_apply' (f := fun k => signedOccupation (M k)) (fun k => amplitude side (M k) q) (fun _ => (0 : ℝ)) x hx change amplitude side (M i) p * Function.extend (fun k => signedOccupation (M k)) (fun k => amplitude side (M k) q) (fun _ => 0) x * amplitude side (M i) r * Function.extend (fun k => signedOccupation (M k)) (fun k => amplitude side (M k) s) (fun _ => 0) x ≤ _ rw [hz] simp only [mul_zero, zero_mul] exact Finset.prod_nonneg (fun t _ => LocalMoments.localPolynomial_nonneg _ _ _ _ _)
end LayeredFourPathend Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124import OAI.Algebra.DepthFive.FactorialPositiveimport OAI.Algebra.DepthFive.FourPathLocal
namespace OAI
/-! The actual local four-path table has bounded nonnegative factorial expansions. -/namespace Problem335
open scoped BigOperators
namespace FactorialExpansion
variable {σ : Type*} [Fintype σ]
/-- Enlarge the permitted support and total-order bound. -/def weaken {f : (σ → ℕ) → ℕ} {S T : Finset σ} {D E : ℕ} (F : FactorialExpansion f S D) (hS : S ⊆ T) (hD : D ≤ E) : FactorialExpansion f T E where Index := F.Index indexFintype := F.indexFintype coeff := F.coeff degree := F.degree order_le := fun j => (F.order_le j).trans hD supported := fun j i hi => F.supported j i (fun h => hi (hS h)) eval_eq := F.eval_eq
end FactorialExpansion
namespace LocalMoments
variable {σ : Type*} [DecidableEq σ]
/-- Natural-valued version of the exact local table. -/def localPolynomialNat (derivative : Bool) (M : σ → ℕ) (p q r : σ) : ℕ := if p = q then if derivative then M p * M r else (M p + 1) * (M r + 1) else if derivative then M p * (M q + 1) else (M p + 1) * M q
@[simp] theorem localPolynomialNat_cast (derivative : Bool) (M : σ → ℕ) (p q r : σ) : (localPolynomialNat derivative M p q r : ℝ) = localPolynomial derivative M p q r := by cases derivative <;> by_cases h : p = q <;> simp [localPolynomialNat, localPolynomial, mass, h]
/-- All branches of the local four-path table have total factorial order at most two.The normal branch includes coincident coordinates and their first-order corrections. -/def localPolynomialExpansion [Fintype σ] (derivative : Bool) (p q r : σ) : FactorialExpansion (fun M => localPolynomialNat derivative M p q r) {p, q, r} 2 := by have hpr : ({p, r} : Finset σ) ⊆ {p, q, r} := by intro i hi simp only [Finset.mem_insert, Finset.mem_singleton] at * tauto have hpq : ({p, q} : Finset σ) ⊆ {p, q, r} := by intro i hi simp only [Finset.mem_insert, Finset.mem_singleton] at * tauto cases derivative · by_cases h : p = q · exact (FactorialExpansion.normalMultiplication p r).reframe (by intro M; simp [localPolynomialNat, h]) hpr (le_refl 2) · exact (FactorialExpansion.distinctMultiplication p q h).reframe (by intro M; simp [localPolynomialNat, h]) hpq (le_refl 2) · by_cases h : p = q · exact (FactorialExpansion.normalDerivative p r).reframe (by intro M; simp [localPolynomialNat, h]) hpr (le_refl 2) · exact (FactorialExpansion.distinctDerivative p q h).reframe (by intro M; simp [localPolynomialNat, h]) hpq (le_refl 2)
/-- The natural polynomial for a finite set of layers. -/def localProductNat {ι : Type*} (layers : Finset ι) (derivative : ι → Bool) (p q r : ι → σ) (M : σ → ℕ) : ℕ := ∏ t ∈ layers, localPolynomialNat (derivative t) M (p t) (q t) (r t)
@[simp] theorem localProductNat_cast {ι : Type*} (layers : Finset ι) (derivative : ι → Bool) (p q r : ι → σ) (M : σ → ℕ) : (localProductNat layers derivative p q r M : ℝ) = ∏ t ∈ layers, localPolynomial (derivative t) M (p t) (q t) (r t) := by simp [localProductNat]
/-- This finite product is the exact nonnegative factorial expansion requiredby the occupation-moment comparison, rather than an assumed positivity property. -/theorem localProduct_expansion {ι : Type*} [Fintype σ] (layers : Finset ι) (derivative : ι → Bool) (p q r : ι → σ) (hdis : (layers : Set ι).Pairwise fun i j => Disjoint ({p i, q i, r i} : Finset σ) {p j, q j, r j}) : Nonempty (FactorialExpansion (localProductNat layers derivative p q r) (layers.biUnion fun i => {p i, q i, r i}) (2 * layers.card)) := by have h := FactorialExpansion.nonempty_prod layers (fun i M => localPolynomialNat (derivative i) M (p i) (q i) (r i)) (fun i => {p i, q i, r i}) (fun _ => 2) (fun i => localPolynomialExpansion (derivative i) (p i) (q i) (r i)) hdis convert h using 1 simp [Nat.mul_comm] congr 1
/-- Layer-labelled coordinates automatically have disjoint local supports. -/theorem layered_support_disjoint {ι κ : Type*} [DecidableEq ι] [DecidableEq κ] (layers : Finset ι) (p q r : ι → κ) : (layers : Set ι).Pairwise fun i j => Disjoint ({(i, p i), (i, q i), (i, r i)} : Finset (ι × κ)) {(j, p j), (j, q j), (j, r j)} := by intro i hi j hj hij apply Finset.disjoint_left.mpr intro x hx hy have hx' : x.1 = i := by simp only [Finset.mem_insert, Finset.mem_singleton] at hx rcases hx with h | h | h <;> simp [h] have hy' : x.1 = j := by simp only [Finset.mem_insert, Finset.mem_singleton] at hy rcases hy with h | h | h <;> simp [h] exact hij (hx'.symm.trans hy')
/-- Specialization to the actual matrix-layer coordinate shape. -/theorem layered_localProduct_expansion {ι κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] (layers : Finset ι) (derivative : ι → Bool) (p q r : ι → κ) : Nonempty (FactorialExpansion (localProductNat layers derivative (fun i => (i, p i)) (fun i => (i, q i)) (fun i => (i, r i))) (layers.biUnion fun i => {(i, p i), (i, q i), (i, r i)}) (2 * layers.card)) := localProduct_expansion layers derivative _ _ _ (layered_support_disjoint layers p q r)
end LocalMomentsend Problem335
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475import OAI.Algebra.DepthFive.SecondMomentNormalizationimport OAI.Algebra.DepthFive.FactorialGeometricValue
namespace OAI
/-! The actual geometric local table agrees with the canonical pairingnormalization, including coincident coordinates in the normal class. -/
noncomputable sectionopen scoped BigOperators
namespace Problem335.MomentPairing
open Pairings
theorem localGeometricMass_eq_moment {γ : Type*} [DecidableEq γ] (side : Bool) (A B : ℝ) (x : Labels γ) : LocalMoments.localGeometricMass side (if side then A else B) x.p x.q x.r = LocalMomentWeights.moment side (isDiagonal (classifyLayer x)) (coincides x) A B := by classical cases side <;> by_cases hpq : x.p = x.q <;> simp [LocalMoments.localGeometricMass, LocalMoments.normalGeometricMass, LocalMoments.diagonalGeometricMass, LocalMomentWeights.moment, classifyLayer, isDiagonal, coincides, hpq]
/-- No compatibility assumption is needed for this algebraic identity: thecanonical class always chooses the normal branch precisely when `p=q`. -/theorem prod_localGeometricMass_eq {γ : Type*} [DecidableEq γ] {L : ℕ} (side : Fin (L + 1) → Bool) (A B : ℝ) (endpoint : γ) (x : Fin L → Labels γ) : (∏ t, LocalMoments.localGeometricMass (side t) (if side t then A else B) (layerLabels endpoint x t).p (layerLabels endpoint x t).q (layerLabels endpoint x t).r) = pathGeometricMoment side A B endpoint (classifyWord endpoint x) x := by unfold pathGeometricMoment classifyWord apply Finset.prod_congr rfl intro t _ exact localGeometricMass_eq_moment _ _ _ _
theorem prod_localGeometricMass_eq_normalized {γ : Type*} [DecidableEq γ] {L : ℕ} (side : Fin (L + 1) → Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) (endpoint : γ) (x : Fin L → Labels γ) : (∏ t, LocalMoments.localGeometricMass (side t) (if side t then A else B) (layerLabels endpoint x t).p (layerLabels endpoint x t).q (layerLabels endpoint x t).r) = pathMean side A B ^ 2 * pathWeight side (A / (A + 1)) (B / (B + 1)) endpoint (classifyWord endpoint x) x := by rw [prod_localGeometricMass_eq, pathGeometricMoment_eq side hA hB]
/-- Concrete input interface for occupation averaging: the geometric RHS isthe actual local polynomial table, rather than an assumed pairing weight. -/theorem sum_sources_local_moments_le {ι γ : Type*} [Fintype ι] [Fintype γ] [DecidableEq γ] {L : ℕ} (side : Fin (L + 1) → Bool) {A B D : ℝ} (hA : 0 < A) (hB : 0 ≤ B) (hD : 0 ≤ D) (endpoint : γ) (C : ι → (Fin L → Labels γ) → ℝ) (hexpect : ∀ x, Compatible endpoint x → (∑ i, C i x) ≤ D * ∏ t, LocalMoments.localGeometricMass (side t) (if side t then A else B) (layerLabels endpoint x t).p (layerLabels endpoint x t).q (layerLabels endpoint x t).r) : (∑ i, ∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, C i x.1) ≤ D * pathMean side A B ^ 2 * ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, pathWeight side (A / (A + 1)) (B / (B + 1)) endpoint τ x.1 := by apply sum_sources_compatible_le side hA hB hD endpoint C intro x hx simpa only [prod_localGeometricMass_eq] using hexpect x hx
end Problem335.MomentPairing
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174import Mathlib
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335namespace LocalMoments
/-- Squared local Fock coefficient, with `true` denoting differentiation. -/def mass (derivative : Bool) (z : ℕ) : ℝ := if derivative then z else z + 1
def coefficient (derivative : Bool) (z : ℕ) : ℝ := Real.sqrt (mass derivative z)
lemma mass_nonneg (derivative : Bool) (z : ℕ) : 0 ≤ mass derivative z := by cases derivative <;> dsimp [mass] all_goals positivity
@[simp] lemma coefficient_sq (derivative : Bool) (z : ℕ) : coefficient derivative z ^ 2 = mass derivative z := Real.sq_sqrt (mass_nonneg derivative z)
/-- One layer's four factors in the second trace. -/def fourCoefficient (derivative : Bool) (a b c d : ℕ) : ℝ := coefficient derivative a * coefficient derivative b * coefficient derivative c * coefficient derivative d
/-- The normal pairing has zero occupation shift. -/lemma normal_fourCoefficient (derivative : Bool) (a b : ℕ) : fourCoefficient derivative a a b b = mass derivative a * mass derivative b := by calc _ = coefficient derivative a ^ 2 * coefficient derivative b ^ 2 := by unfold fourCoefficient ring _ = _ := by rw [coefficient_sq, coefficient_sq]
/-- Differentiating diagonal pairing: the second path receives one occupation. -/lemma derivative_diagonal_fourCoefficient (a b : ℕ) : fourCoefficient true a (b + 1) a (b + 1) = (a : ℝ) * ((b : ℝ) + 1) := by calc _ = coefficient true a ^ 2 * coefficient true (b + 1) ^ 2 := by unfold fourCoefficient ring _ = _ := by simp [mass]
/-- Multiplying diagonal pairing, expressed without natural subtraction. -/lemma multiplication_diagonal_fourCoefficient (a b : ℕ) : fourCoefficient false a b a b = ((a : ℝ) + 1) * ((b : ℝ) + 1) := by calc _ = coefficient false a ^ 2 * coefficient false b ^ 2 := by unfold fourCoefficient ring _ = _ := by simp [mass]
lemma multiplication_diagonal_fourCoefficient_pred (a b : ℕ) (hb : 0 < b) : fourCoefficient false a (b - 1) a (b - 1) = ((a : ℝ) + 1) * (b : ℝ) := by rw [multiplication_diagonal_fourCoefficient] have h : (b - 1 : ℕ) + 1 = b := by omega have hr := congrArg (fun n : ℕ => (n : ℝ)) h push_cast at hr rw [hr]
/-- The unavailable differentiation contribution vanishes identically. -/@[simp] lemma derivative_invalid (b : ℕ) : (0 : ℝ) * ((b : ℝ) + 1) = 0 := zero_mul _
/-- If the multiplication shift would create a negative source occupation,its table contribution is zero. -/@[simp] lemma multiplication_invalid (a : ℕ) : ((a : ℝ) + 1) * (0 : ℝ) = 0 := mul_zero _
/-- Move the four path products into a product of local four-factor entries. -/lemma four_products_eq_product {ι : Type*} (s : Finset ι) (derivative : ι → Bool) (a b c d : ι → ℕ) : (∏ i ∈ s, coefficient (derivative i) (a i)) * (∏ i ∈ s, coefficient (derivative i) (b i)) * (∏ i ∈ s, coefficient (derivative i) (c i)) * (∏ i ∈ s, coefficient (derivative i) (d i)) = ∏ i ∈ s, fourCoefficient (derivative i) (a i) (b i) (c i) (d i) := by simp only [fourCoefficient, Finset.prod_mul_distrib]
/-- Version of the normal pairing usable with occupation functions. -/lemma normal_layer {σ : Type*} (derivative : Bool) (M M' : σ → ℕ) (i j : σ) (hi : M' i = M i) (hj : M' j = M j) : fourCoefficient derivative (M i) (M' i) (M j) (M' j) = mass derivative (M i) * mass derivative (M j) := by rw [hi, hj, normal_fourCoefficient]
lemma derivative_diagonal_layer {σ : Type*} (M M' : σ → ℕ) (i j : σ) (hj : M' j = M j + 1) : fourCoefficient true (M i) (M' j) (M i) (M' j) = (M i : ℝ) * ((M j : ℝ) + 1) := by rw [hj, derivative_diagonal_fourCoefficient]
lemma multiplication_diagonal_layer {σ : Type*} (M M' : σ → ℕ) (i j : σ) (hj : M' j + 1 = M j) : fourCoefficient false (M i) (M' j) (M i) (M' j) = ((M i : ℝ) + 1) * (M j : ℝ) := by rw [multiplication_diagonal_fourCoefficient] have hr := congrArg (fun n : ℕ => (n : ℝ)) hj push_cast at hr rw [hr]
/-- The multiplying diagonal term, extended by zero when its backward shift is invalid. -/def multiplicationDiagonalTerm (a b : ℕ) : ℝ := if b = 0 then 0 else fourCoefficient false a (b - 1) a (b - 1)
lemma multiplicationDiagonalTerm_eq (a b : ℕ) : multiplicationDiagonalTerm a b = ((a : ℝ) + 1) * (b : ℝ) := by by_cases hb : b = 0 · simp [multiplicationDiagonalTerm, hb] · simp only [multiplicationDiagonalTerm, hb, ↓reduceIte] exact multiplication_diagonal_fourCoefficient_pred a b (Nat.pos_of_ne_zero hb)
lemma square_fallingFactorial (z : ℕ) : (z : ℝ)^2 = (z.descFactorial 2 : ℝ) + (z : ℝ) := by cases z with | zero => norm_num | succ z => simp [Nat.descFactorial_succ]; ring
lemma successor_square_fallingFactorial (z : ℕ) : ((z : ℝ) + 1)^2 = (z.descFactorial 2 : ℝ) + 3 * (z : ℝ) + 1 := by rw [show ((z : ℝ) + 1)^2 = (z : ℝ)^2 + 2 * z + 1 by ring, square_fallingFactorial] ring
/-- Geometric first/second-moment input, before normalization, for normal pairings. -/def normalGeometricMass (derivative : Bool) (G : ℝ) (collision : Bool) : ℝ := if derivative then if collision then 2 * G^2 + G else G^2 else if collision then 2 * G^2 + 3 * G + 1 else (G + 1)^2
def diagonalGeometricMass (G : ℝ) : ℝ := G * (G + 1)
lemma derivative_normal_weight (G : ℝ) (hG : 0 < G) (collision : Bool) : normalGeometricMass true G collision / G^2 = 1 + (G / (G + 1))⁻¹ * (if collision then 1 else 0) := by have h0 : G ≠ 0 := ne_of_gt hG have h1 : G + 1 ≠ 0 := ne_of_gt (by linarith) cases collision <;> simp [normalGeometricMass, h0] all_goals field_simp all_goals ring
lemma multiplication_normal_weight (G : ℝ) (hG : 0 ≤ G) (collision : Bool) : normalGeometricMass false G collision / (G + 1)^2 = 1 + (G / (G + 1)) * (if collision then 1 else 0) := by have h1 : G + 1 ≠ 0 := ne_of_gt (by linarith) cases collision <;> simp [normalGeometricMass, h1] all_goals field_simp all_goals ring
lemma derivative_diagonal_weight (G : ℝ) (hG : 0 < G) : diagonalGeometricMass G / G^2 = (G / (G + 1))⁻¹ := by have h0 : G ≠ 0 := ne_of_gt hG have h1 : G + 1 ≠ 0 := ne_of_gt (by linarith) unfold diagonalGeometricMass field_simp
lemma multiplication_diagonal_weight (G : ℝ) (hG : 0 ≤ G) : diagonalGeometricMass G / (G + 1)^2 = G / (G + 1) := by have h1 : G + 1 ≠ 0 := ne_of_gt (by linarith) unfold diagonalGeometricMass field_simp
end LocalMomentsend Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107import Mathlib
namespace OAI
/-! Normalization of the local geometric occupation moments in the four-pathtrace expansion. Missing derivative occupations are handled by local-polynomialidentities, preserving the repeated-coordinate second moment rather thantreating it as a product of independent moments. -/
noncomputable sectionopen scoped BigOperators
namespace Problem335.LocalMomentWeights
/-- `isD` denotes the nonzero-difference pairing. `same` is relevant only inits complementary pairing, where the two selected coordinates may coincide. -/def moment (isV isD same : Bool) (A B : ℝ) : ℝ := if isV then if isD then A * (A + 1) else if same then 2 * A ^ 2 + A else A ^ 2 else if isD then B * (B + 1) else if same then 2 * B ^ 2 + 3 * B + 1 else (B + 1) ^ 2
/-- The square of the first-moment factor at a layer. -/def scale (isV : Bool) (A B : ℝ) : ℝ := if isV then A ^ 2 else (B + 1) ^ 2
/-- The exact local weights after division by the first-moment square. -/def weight (isV isD same : Bool) (alpha beta : ℝ) : ℝ := if isV then if isD then alpha⁻¹ else 1 + if same then alpha⁻¹ else 0 else if isD then beta else 1 + if same then beta else 0
lemma scale_pos (isV : Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) : 0 < scale isV A B := by cases isV <;> simp only [scale, Bool.false_eq_true, ↓reduceIte] <;> positivity
lemma weight_nonneg (isV isD same : Bool) {alpha beta : ℝ} (ha : 0 < alpha) (hb : 0 ≤ beta) : 0 ≤ weight isV isD same alpha beta := by cases isV <;> cases isD <;> cases same <;> simp [weight] <;> positivity
/-- Repeated-coordinate geometric second moments give the additional term`alpha⁻¹` or `beta` exactly. -/theorem moment_eq_scale_mul_weight (isV isD same : Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) : moment isV isD same A B = scale isV A B * weight isV isD same (A / (A + 1)) (B / (B + 1)) := by have hA0 : A ≠ 0 := ne_of_gt hA have hAp : A + 1 ≠ 0 := by linarith have hBp : B + 1 ≠ 0 := by linarith cases isV <;> cases isD <;> cases same <;> simp [moment, scale, weight] <;> field_simp <;> ring
lemma moment_div_scale (isV isD same : Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) : moment isV isD same A B / scale isV A B = weight isV isD same (A / (A + 1)) (B / (B + 1)) := by rw [moment_eq_scale_mul_weight _ _ _ hA hB] exact mul_div_cancel_left₀ _ (scale_pos isV hA hB).ne'
/-- The normalized means agree with the original degree/cardinality ratios. -/lemma mean_ratio {a v : ℝ} (hv : 0 < v) (ha : 0 ≤ a) : (a / v) / (a / v + 1) = a / (a + v) := by have hv0 : v ≠ 0 := ne_of_gt hv have hap : a + v ≠ 0 := by linarith field_simp
/-- A pointwise normalization can be factored out of the entire layer product. -/theorem prod_moment_eq {ι : Type*} (s : Finset ι) (isV isD same : ι → Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) : (∏ i ∈ s, moment (isV i) (isD i) (same i) A B) = (∏ i ∈ s, scale (isV i) A B) * ∏ i ∈ s, weight (isV i) (isD i) (same i) (A / (A + 1)) (B / (B + 1)) := by simp_rw [moment_eq_scale_mul_weight _ _ _ hA hB] exact Finset.prod_mul_distrib
/-- The product of the local normalization factors is exactly `mu^2`. -/theorem prod_scale_eq {ι : Type*} (s : Finset ι) (isV : ι → Bool) (A B : ℝ) : (∏ i ∈ s, scale (isV i) A B) = (A ^ (s.filter (fun i => isV i = true)).card * (B + 1) ^ (s.filter (fun i => isV i = false)).card) ^ 2 := by classical simp only [scale] rw [Finset.prod_ite] simp only [Finset.prod_const] have hfilter : s.filter (fun i => ¬isV i = true) = s.filter (fun i => isV i = false) := by ext i cases isV i <;> simp rw [hfilter, mul_pow] congr 1 <;> rw [← pow_mul, ← pow_mul] <;> congr 1 <;> omega
/-- Full local-weight normalization for a fixed four-path pairing pattern. -/theorem prod_moment_eq_mu_sq_mul {ι : Type*} (s : Finset ι) (isV isD same : ι → Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) : (∏ i ∈ s, moment (isV i) (isD i) (same i) A B) = (A ^ (s.filter (fun i => isV i = true)).card * (B + 1) ^ (s.filter (fun i => isV i = false)).card) ^ 2 * ∏ i ∈ s, weight (isV i) (isD i) (same i) (A / (A + 1)) (B / (B + 1)) := by rw [prod_moment_eq s isV isD same hA hB, prod_scale_eq]
end Problem335.LocalMomentWeights
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122import OAI.Algebra.DepthFive.FactorialPositiveimport OAI.Algebra.DepthFive.OccupationExpansion
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335
variable {σ : Type*} [Fintype σ]
/-- Reassemble two occupation vectors on the complementary variable classes. -/def joinOccupation (side : σ → Bool) (M : {i // side i = true} → ℕ) (N : {i // ¬ side i = true} → ℕ) : σ → ℕ := fun i => if h : side i = true then M ⟨i, h⟩ else N ⟨i, h⟩
omit [Fintype σ] in@[simp] theorem joinOccupation_true (side : σ → Bool) (M : {i // side i = true} → ℕ) (N : {i // ¬ side i = true} → ℕ) (i : {i // side i = true}) : joinOccupation side M N i = M i := by simp [joinOccupation, i.property]
omit [Fintype σ] in@[simp] theorem joinOccupation_false (side : σ → Bool) (M : {i // side i = true} → ℕ) (N : {i // ¬ side i = true} → ℕ) (i : {i // ¬ side i = true}) : joinOccupation side M N i = N i := by simp [joinOccupation, i.property]
theorem factorialMonomial_joinOccupation (side : σ → Bool) (d : σ → ℕ) (M : {i // side i = true} → ℕ) (N : {i // ¬ side i = true} → ℕ) : factorialMonomial d (joinOccupation side M N) = (∏ i, (M i).descFactorial (d i)) * (∏ i, (N i).descFactorial (d i)) := by classical unfold factorialMonomial rw [← Fintype.prod_subtype_mul_prod_subtype (fun i => side i = true)] simp
variable [DecidableEq σ]
/-- The actual finite uniform average, not an assumed moment functional. -/def partitionCompositionMean (side : σ → Bool) (f : (σ → ℕ) → ℝ) (a b : ℕ) : ℝ := by classical exact (∑ M ∈ Finset.finsuppAntidiag (Finset.univ : Finset {i // side i = true}) a, (∑ N ∈ Finset.finsuppAntidiag (Finset.univ : Finset {i // ¬ side i = true}) b, f (joinOccupation side M N)) / (Finset.finsuppAntidiag (Finset.univ : Finset {i // ¬ side i = true}) b).card) / (Finset.finsuppAntidiag (Finset.univ : Finset {i // side i = true}) a).card
namespace FactorialExpansionvariable {f : (σ → ℕ) → ℕ} {S : Finset σ} {D : ℕ}
theorem partitionCompositionMean_eq (F : FactorialExpansion f S D) (side : σ → Bool) (a b : ℕ) : Problem335.partitionCompositionMean side (fun M => (f M : ℝ)) a b = twoGroupCompositionExpansionMean Finset.univ (fun j => (F.coeff j : ℝ)) (fun j (i : {i // side i = true}) => F.degree j i) (fun j (i : {i // ¬ side i = true}) => F.degree j i) a b := by classical unfold Problem335.partitionCompositionMean twoGroupCompositionExpansionMean compositionExpansionMean factorialExpansionValue apply congrArg (fun x : ℝ => x / _) apply Finset.sum_congr rfl intro M hM apply congrArg (fun x : ℝ => x / _) apply Finset.sum_congr rfl intro N hN dsimp only rw [F.eval_real] apply Finset.sum_congr rfl intro j hj rw [factorialMonomial_joinOccupation] push_cast ring
omit [DecidableEq σ] in/-- The two means give one coordinate-wise geometric factorial monomial. -/theorem partition_geometric_monomial (side : σ → Bool) (d : σ → ℕ) (A B : ℝ) : (∏ i, (d i).factorial * (if side i = true then A else B) ^ d i : ℝ) = (∏ i : {i // side i = true}, ((d i).factorial : ℝ)) * (∏ i : {i // ¬ side i = true}, ((d i).factorial : ℝ)) * (A ^ (∑ i : {i // side i = true}, d i) * B ^ (∑ i : {i // ¬ side i = true}, d i)) := by classical rw [← Fintype.prod_subtype_mul_prod_subtype (fun i => side i = true)] have hV (i : {i // side i = true}) : (if side i = true then A else B) = A := ite_eq_left i.property have hU (i : {i // ¬ side i = true}) : (if side i = true then A else B) = B := ite_eq_right i.property simp_rw [hV, hU] simp only [Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum] ring
/-- Upper occupation comparison for every concrete nonnegative factorial expansion.No total-order restriction is necessary for this upper bound. -/theorem partitionCompositionMean_le (F : FactorialExpansion f S D) (side : σ → Bool) [Nonempty {i // side i = true}] [Nonempty {i // ¬ side i = true}] (a b : ℕ) : Problem335.partitionCompositionMean side (fun M => (f M : ℝ)) a b ≤ ∑ j, (F.coeff j : ℝ) * ∏ i, ((F.degree j i).factorial : ℝ) * (if side i = true then (a : ℝ) / Fintype.card {i // side i = true} else (b : ℝ) / Fintype.card {i // ¬ side i = true}) ^ F.degree j i := by classical rw [F.partitionCompositionMean_eq] have h := twoGroupCompositionExpansionMean_le_geometric Finset.univ (fun j => (F.coeff j : ℝ)) (fun j (i : {i // side i = true}) => F.degree j i) (fun j (i : {i // ¬ side i = true}) => F.degree j i) a b (by intro j hj; positivity) refine h.trans_eq ?_ unfold twoGroupGeometricExpansionValue apply Finset.sum_congr rfl intro j hj rw [partition_geometric_monomial] ring
end FactorialExpansionend Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104import OAI.Algebra.DepthFive.LocalOccupationAverageimport OAI.Algebra.DepthFive.FactorialGeometricValue
namespace OAI
noncomputable sectionopen scoped BigOperators
namespace Problem335namespace LocalMoments
variable {σ ι : Type*} [Fintype σ] [DecidableEq σ]
/-- The actual occupation average of the full local four-path table is boundedby the product of its independent geometric local moments. -/theorem partitionCompositionMean_localProduct_le (side : σ → Bool) [Nonempty {i // side i = true}] [Nonempty {i // ¬ side i = true}] (a b : ℕ) (layers : Finset ι) (derivative : ι → Bool) (p q r : ι → σ) (hp : ∀ t ∈ layers, side (p t) = derivative t) (hq : ∀ t ∈ layers, side (q t) = derivative t) (hr : ∀ t ∈ layers, side (r t) = derivative t) (hdis : (layers : Set ι).Pairwise fun i j => Disjoint ({p i, q i, r i} : Finset σ) {p j, q j, r j}) : partitionCompositionMean side (fun M => ∏ t ∈ layers, localPolynomial (derivative t) M (p t) (q t) (r t)) a b ≤ ∏ t ∈ layers, localGeometricMass (derivative t) (if derivative t = true then (a : ℝ) / Fintype.card {i // side i = true} else (b : ℝ) / Fintype.card {i // ¬ side i = true}) (p t) (q t) (r t) := by classical let G : σ → ℝ := fun i => if side i = true then (a : ℝ) / Fintype.card {i // side i = true} else (b : ℝ) / Fintype.card {i // ¬ side i = true} let g : ι → ℝ := fun t => if derivative t = true then (a : ℝ) / Fintype.card {i // side i = true} else (b : ℝ) / Fintype.card {i // ¬ side i = true} obtain ⟨F, hF⟩ := exists_localProduct_geometricValue_of_eq layers derivative p q r G g (by intro t ht; simp only [G, g, hp t ht]) (by intro t ht; simp only [G, g, hq t ht]) (by intro t ht; simp only [G, g, hr t ht]) hdis have hmean := F.partitionCompositionMean_le side a b change partitionCompositionMean side (fun M => (localProductNat layers derivative p q r M : ℝ)) a b ≤ F.geometricValue G at hmean rw [hF] at hmean simpa only [localProductNat_cast] using hmean
/-- Specialization to the matrix-layer coordinate shape: disjoint supports andthe common local mean are automatic, not additional analytic assumptions. -/theorem partitionCompositionMean_layered_localProduct_le {κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] (derivative : ι → Bool) [Nonempty {x : ι × κ // derivative x.1 = true}] [Nonempty {x : ι × κ // ¬ derivative x.1 = true}] (a b : ℕ) (layers : Finset ι) (p q r : ι → κ) : partitionCompositionMean (fun x : ι × κ => derivative x.1) (fun M => ∏ t ∈ layers, localPolynomial (derivative t) M (t, p t) (t, q t) (t, r t)) a b ≤ ∏ t ∈ layers, localGeometricMass (derivative t) (if derivative t = true then (a : ℝ) / Fintype.card {x : ι × κ // derivative x.1 = true} else (b : ℝ) / Fintype.card {x : ι × κ // ¬ derivative x.1 = true}) (t, p t) (t, q t) (t, r t) := by apply partitionCompositionMean_localProduct_le (fun x : ι × κ => derivative x.1) a b layers derivative (fun t => (t, p t)) (fun t => (t, q t)) (fun t => (t, r t)) · intros; rfl · intros; rfl · intros; rfl · exact layered_support_disjoint layers p q r
/-- Coordinate-form conversion to the local table used in the four-path identity. -/@[simp] theorem localPolynomial_layered {κ : Type*} [DecidableEq ι] [DecidableEq κ] (d : Bool) (M : ι × κ → ℕ) (t : ι) (p q r : κ) : localPolynomial d M (t, p) (t, q) (t, r) = localPolynomial d (fun x => M (t, x)) p q r := by simp [localPolynomial]
@[simp] theorem localGeometricMass_layered {κ : Type*} [DecidableEq ι] [DecidableEq κ] (d : Bool) (G : ℝ) (t : ι) (p q r : κ) : localGeometricMass d G (t, p) (t, q) (t, r) = localGeometricMass d G p q r := by simp [localGeometricMass]
/-- Row-restriction presentation matching the actual four-path local table directly. -/theorem partitionCompositionMean_layered_restrict_le {κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] (derivative : ι → Bool) [Nonempty {x : ι × κ // derivative x.1 = true}] [Nonempty {x : ι × κ // ¬ derivative x.1 = true}] (a b : ℕ) (layers : Finset ι) (p q r : ι → κ) : partitionCompositionMean (fun x : ι × κ => derivative x.1) (fun M => ∏ t ∈ layers, localPolynomial (derivative t) (fun x => M (t, x)) (p t) (q t) (r t)) a b ≤ ∏ t ∈ layers, localGeometricMass (derivative t) (if derivative t = true then (a : ℝ) / Fintype.card {x : ι × κ // derivative x.1 = true} else (b : ℝ) / Fintype.card {x : ι × κ // ¬ derivative x.1 = true}) (p t) (q t) (r t) := by simpa only [localPolynomial_layered, localGeometricMass_layered] using partitionCompositionMean_layered_localProduct_le derivative a b layers p q r
end LocalMomentsend Problem335
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123import OAI.Algebra.DepthFive.DegreeWeightimport OAI.Algebra.DepthFive.DegreeProductBoundsimport OAI.Algebra.DepthFive.SmallDegreeCorrections
namespace OAI
noncomputable sectionopen scoped BigOperatorsnamespace Problem335
lemma degreeWeight_nonneg {q : ℝ} (hq : 0 ≤ q) (lam : ℝ) (e : ℕ) : 0 ≤ degreeWeight q lam e := Finset.sum_nonneg (fun _ _ => Real.rpow_nonneg hq _)
lemma degreeWeight_le_five_mul_distance {q : ℝ} (hq : 0 < q) (hqhalf : q ≤ 1 / 2) (lam : ℝ) (e : ℕ) : degreeWeight q lam e ≤ 5 * q ^ nearestIntegerDistance (lam * e) := by have hq1 : q ≤ 1 := by linarith have hd := nearestIntegerDistance_le_half (lam * e) have htail := Real.rpow_le_one hq.le hq1 (show 0 ≤ 1 - 2 * nearestIntegerDistance (lam * e) by linarith) calc degreeWeight q lam e ≤ q ^ nearestIntegerDistance (lam * e) * (1 + 4 * q ^ (1 - 2 * nearestIntegerDistance (lam * e))) := degreeWeight_le_nearest hq hqhalf lam e _ ≤ q ^ nearestIntegerDistance (lam * e) * 5 := mul_le_mul_of_nonneg_left (by linarith) (Real.rpow_nonneg hq.le _) _ = _ := mul_comm _ _
lemma low_odd_degreeWeight_le {n s q : ℝ} (hn : 0 < n) (hs : 0 < s) (hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1) {e : ℕ} (he : 0 < e) (helow : (e : ℝ) < n / (4 * s)) (hodd : Odd e) : degreeWeight q (1 / 2 - s / (2 * n)) e ≤ q ^ (degreeDistance n s e / 2) := by have hq1 : q ≤ 1 := by linarith have hd := degreeDistance_odd_ge hn hs he helow hodd have hp : q ^ (degreeDistance n s e / 2) ≤ q ^ ((3 : ℝ) / 16) := Real.rpow_le_rpow_of_exponent_ge hq hq1 (by linarith) have hp5 : 5 * q ^ (degreeDistance n s e / 2) ≤ 1 := (mul_le_mul_of_nonneg_left hp (by norm_num)).trans hqsmall have hbound := degreeWeight_le_five_mul_distance hq hqhalf (1 / 2 - s / (2 * n)) e change degreeWeight q (1 / 2 - s / (2 * n)) e ≤ 5 * q ^ degreeDistance n s e at hbound calc degreeWeight q (1 / 2 - s / (2 * n)) e ≤ 5 * q ^ degreeDistance n s e := hbound _ = (5 * q ^ (degreeDistance n s e / 2)) * q ^ (degreeDistance n s e / 2) := by rw [mul_assoc, ← Real.rpow_add hq] congr 2 ring _ ≤ 1 * q ^ (degreeDistance n s e / 2) := mul_le_mul_of_nonneg_right hp5 (Real.rpow_nonneg hq.le _) _ = _ := one_mul _
lemma low_even_degreeWeight_le {n s q : ℝ} (hn : 0 < n) (hs : 0 < s) (hq : 0 < q) (hqhalf : q ≤ 1 / 2) {e : ℕ} (he : 0 < e) (helow : (e : ℝ) < n / (4 * s)) (heven : Even e) : degreeWeight q (1 / 2 - s / (2 * n)) e ≤ q ^ degreeDistance n s e * Real.exp (4 * q ^ (1 - s * e / n)) := by have hbound := degreeWeight_le_nearest hq hqhalf (1 / 2 - s / (2 * n)) e change degreeWeight q (1 / 2 - s / (2 * n)) e ≤ q ^ degreeDistance n s e * (1 + 4 * q ^ (1 - 2 * degreeDistance n s e)) at hbound have hexponent : 1 - 2 * degreeDistance n s e = 1 - s * e / n := by rw [degreeDistance_even hn hs he helow heven] ring rw [hexponent] at hbound exact hbound.trans (mul_le_mul_of_nonneg_left (by linarith [Real.add_one_le_exp (4 * q ^ (1 - s * e / n))]) (Real.rpow_nonneg hq.le _))
lemma low_degreeWeight_le_with_correction {n s q : ℝ} (hn : 0 < n) (hs : 0 < s) (hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1) {e : ℕ} (he : 0 < e) (helow : (e : ℝ) < n / (4 * s)) : degreeWeight q (1 / 2 - s / (2 * n)) e ≤ q ^ (degreeDistance n s e / 2) * Real.exp (4 * q ^ (1 - s * e / n)) := by have hq1 : q ≤ 1 := by linarith rcases Nat.even_or_odd e with heven | hodd · refine (low_even_degreeWeight_le hn hs hq hqhalf he helow heven).trans ?_ apply mul_le_mul_of_nonneg_right _ (Real.exp_pos _).le apply Real.rpow_le_rpow_of_exponent_ge hq hq1 have hd : 0 ≤ degreeDistance n s e := nearestIntegerDistance_nonneg _ linarith · refine (low_odd_degreeWeight_le hn hs hq hqhalf hqsmall he helow hodd).trans ?_ have hexp : 1 ≤ Real.exp (4 * q ^ (1 - s * e / n)) := Real.one_le_exp_iff.mpr (by positivity) simpa only [mul_one] using mul_le_mul_of_nonneg_left hexp (Real.rpow_nonneg hq.le (degreeDistance n s e / 2))
/-- The actual factor weights, rather than hypothetical costs, give theall-low product saving in the circuit argument. -/theorem low_degreeWeight_product_bound {ι : Type*} (I : Finset ι) (e : ι → ℕ) {n s q : ℝ} (hn : 1 ≤ n) (hs : 0 < s) (hslo : Real.sqrt n / 2 ≤ s) (hshi : s ≤ Real.sqrt n) (hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsqrt : q ≤ 2 / Real.sqrt n) (hqpow : q ≤ n ^ (-(2 / 5 : ℝ))) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1) (he : ∀ i ∈ I, 0 < e i) (helow : ∀ i ∈ I, (e i : ℝ) < n / (4 * s)) (hsum : ∑ i ∈ I, (e i : ℝ) = n) : (∏ i ∈ I, degreeWeight q (1 / 2 - s / (2 * n)) (e i)) ≤ Real.exp (24 * Real.sqrt n) * n ^ (-Real.sqrt n / 20) := by have hn0 : 0 < n := by linarith have hq1 : q ≤ 1 := by linarith have hcorr : (∑ i ∈ I, q ^ (1 - s * e i / n)) ≤ 6 * Real.sqrt n := by apply sum_small_degree_corrections_le I n s q (fun i => (e i : ℝ)) hn0 hs.le hshi hq hq1 hqsqrt · intro i hi exact_mod_cast he i hi · intro i hi obtain ⟨_, h⟩ := low_degree_offset hn0 hs (he i hi) (helow i hi) have hid : s * e i / n = 2 * (s * e i / (2 * n)) := by ring rw [hid] linarith · exact hsum.le apply all_low_degree_product_bound I e (fun i => degreeWeight q (1 / 2 - s / (2 * n)) (e i)) (fun i => 4 * q ^ (1 - s * e i / n)) hn hs hslo hq hq1 hqpow he helow hsum · exact fun i _ => degreeWeight_nonneg hq.le _ _ · exact fun i hi => low_degreeWeight_le_with_correction hn0 hs hq hqhalf hqsmall (he i hi) (helow i hi) · rw [← Finset.mul_sum] linarith
end Problem335
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980import Mathlib
namespace OAI
noncomputable section
namespace Problem335
open Filter
/-- The numerical comparison in the lower-bound argument, with an explicitsufficient logarithmic threshold. No algebraic complexity hypotheses enter here. -/theorem size_lower_bound_of_rank_bounds (x S D R C₁ C₂ : ℝ) (hx : 1 ≤ x) (hS : 0 ≤ S) (hD : 0 < D) (hlog : 400 * (|C₁| + |C₂| + 1) ≤ Real.log x) (hlower : D * Real.exp (-C₁ * Real.sqrt x) ≤ R) (hupper : R ≤ 2 * S ^ 2 * D * Real.exp (C₂ * Real.sqrt x) * x ^ (-Real.sqrt x / 100)) : x ^ (Real.sqrt x / 400) ≤ S := by have hxpos : 0 < x := lt_of_lt_of_le zero_lt_one hx have hbounds := hlower.trans hupper have hleftpos : 0 < D * Real.exp (-C₁ * Real.sqrt x) := mul_pos hD (Real.exp_pos _) have hSpos : 0 < S := by by_contra h have hzero : S = 0 := le_antisymm (le_of_not_gt h) hS simp only [hzero, zero_pow (by decide : 2 ≠ 0), mul_zero, zero_mul] at hbounds exact (not_le_of_gt hleftpos) hbounds have hlogs := Real.log_le_log hleftpos hbounds have hDne : D ≠ 0 := ne_of_gt hD have hSne : S ≠ 0 := ne_of_gt hSpos simp [Real.log_mul, Real.log_pow, Real.log_rpow hxpos, hDne, hSne, ne_of_gt (Real.rpow_pos_of_pos hxpos (-Real.sqrt x / 100))] at hlogs have hsqrt : 1 ≤ Real.sqrt x := Real.one_le_sqrt.mpr hx have hlogtwo : Real.log 2 ≤ 1 := by have := Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 2) norm_num at this ⊢ exact this have habs₁ := le_abs_self C₁ have habs₂ := le_abs_self C₂ have hnonneg₁ := abs_nonneg C₁ have hnonneg₂ := abs_nonneg C₂ have hslack : C₁ + C₂ + 1 ≤ Real.log x / 400 := by linarith have hslackmul := mul_le_mul_of_nonneg_right hslack (Real.sqrt_nonneg x) have hlognonneg : 0 ≤ Real.log x := Real.log_nonneg hx have htarget : Real.sqrt x / 400 * Real.log x ≤ Real.log S := by nlinarith apply (Real.log_le_log_iff (Real.rpow_pos_of_pos hxpos _) hSpos).mp rw [Real.log_rpow hxpos] exact htarget
/-- Fixed exponential losses can be absorbed uniformly into the power saving.The threshold is independent of `S`, `D`, and the rank value `R`. -/theorem eventual_size_lower_bound_of_rank_bounds (C₁ C₂ : ℝ) : ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n → ∀ S D R : ℝ, 0 ≤ S → 0 < D → D * Real.exp (-C₁ * Real.sqrt (n : ℝ)) ≤ R → R ≤ 2 * S ^ 2 * D * Real.exp (C₂ * Real.sqrt (n : ℝ)) * (n : ℝ) ^ (-Real.sqrt (n : ℝ) / 100) → (n : ℝ) ^ (Real.sqrt (n : ℝ) / 400) ≤ S := by have hcast : Tendsto (fun n : ℕ => (n : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop have hlog := Real.tendsto_log_atTop.comp hcast have hone : ∀ᶠ n : ℕ in atTop, (1 : ℝ) ≤ n := hcast.eventually (eventually_ge_atTop 1) have hlarge : ∀ᶠ n : ℕ in atTop, 400 * (|C₁| + |C₂| + 1) ≤ Real.log (n : ℝ) := hlog.eventually (eventually_ge_atTop _) obtain ⟨n₀, hn₀⟩ := eventually_atTop.mp (hone.and hlarge) refine ⟨n₀, ?_⟩ intro n hn S D R hS hD hlower hupper exact size_lower_bound_of_rank_bounds (n : ℝ) S D R C₁ C₂ (hn₀ n hn).1 hS hD (hn₀ n hn).2 hlower hupper
end Problem335
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667import OAI.Algebra.DepthFive.ActualCircuitRankimport OAI.Algebra.DepthFive.ActualImmRankimport OAI.Algebra.DepthFive.LowerAsymptotics
namespace OAI
/-! Circuit-size lower bounds from eventual rank and second-trace estimatesfor the normalized IMM matrix. -/
noncomputable section
namespace Problem335
open LowerParameters
/-- An eventual lower bound for the configured IMM rank, together with theproved circuit upper bound, gives the exact complex circuit-size conclusion. -/theorem complex_depth_five_lower_bound_of_eventual_rank_lower (C : ℝ) (hlower : ∀ᶠ n : ℕ in Filter.atTop, rankDimension n * Real.exp (-C * Real.sqrt (n : ℝ)) ≤ rankData n (imm ℂ n)) : ∃ n0 : ℕ, ∀ n : ℕ, n0 ≤ n → ∀ c : Depth5Circuit ℂ n, circuitValue c = imm ℂ n → (n : ℝ) ^ (Real.sqrt (n : ℝ) / 400) ≤ (circuitSize c : ℝ) := by obtain ⟨Nlower, hNlower⟩ := Filter.eventually_atTop.mp hlower obtain ⟨Nupper, hNupper⟩ := exists_rankData_circuit_upper_cutoff obtain ⟨Nnumeric, hNnumeric⟩ := eventual_size_lower_bound_of_rank_bounds C (24 + 4 * Real.log 5) refine ⟨max 4 (max Nlower (max Nupper Nnumeric)), ?_⟩ intro n hn c hc have hn4 : 4 ≤ n := (le_max_left _ _).trans hn have hnlo : Nlower ≤ n := (le_max_left _ _).trans ((le_max_right _ _).trans hn) have hnup : Nupper ≤ n := (le_max_left _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans hn)) have hnnum : Nnumeric ≤ n := (le_max_right _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans hn)) apply hNnumeric n hnnum (circuitSize c) (rankDimension n) (rankData n (imm ℂ n)) (Nat.cast_nonneg _) (rankDimension_pos hn4) (hNlower n hnlo) simpa only [hc] using hNupper n hnup c hc
/-- The second-trace bound, together with the first-trace and circuitestimates, implies the complex circuit-size lower bound. -/theorem complex_depth_five_lower_bound_of_eventual_second_trace (C : ℝ) (hsecond : ∀ᶠ n : ℕ in Filter.atTop, ∀ hn : 16 ≤ n, (((immNormalizedMatrix n (balancedLayer (Nat.le_trans (by decide : 4 ≤ 16) hn)) (a n) (b n)).conjTranspose * immNormalizedMatrix n (balancedLayer (Nat.le_trans (by decide : 4 ≤ 16) hn)) (a n) (b n)) ^ 2).trace.re ≤ rankDimension n * rankMomentScale n ^ 2 * Real.exp (C * Real.sqrt (n : ℝ))) : ∃ n0 : ℕ, ∀ n : ℕ, n0 ≤ n → ∀ c : Depth5Circuit ℂ n, circuitValue c = imm ℂ n → (n : ℝ) ^ (Real.sqrt (n : ℝ) / 400) ≤ (circuitSize c : ℝ) := by apply complex_depth_five_lower_bound_of_eventual_rank_lower (128 + C) filter_upwards [hsecond, Filter.eventually_ge_atTop 16] with n hn hlarge simpa only [neg_mul] using rankData_imm_lower_of_second_trace_bound hlarge C (hn hlarge)
end Problem335
end
end OAI12345678import OAI.Algebra.DepthFive.ActualProductRankimport OAI.Algebra.DepthFive.CircuitOutputDegreeimport OAI.Algebra.DepthFive.ActualWeightParametersimport OAI.Algebra.DepthFive.ActualCircuitRank
/-! The actual mixed-product rank estimate and its depth-five circuitreduction, with rounded parameter specialization and uniform eventualadmissibility. -/12345678910111213141516import OAI.Algebra.DepthFive.IntegerRankimport OAI.Algebra.DepthFive.TraceRankimport OAI.Algebra.DepthFive.MixedOperatorimport OAI.Algebra.DepthFive.IteratedDerivativeimport OAI.Algebra.DepthFive.OperatorRankimport OAI.Algebra.DepthFive.Bidegreeimport OAI.Algebra.DepthFive.RankMeasureimport OAI.Algebra.DepthFive.CircuitDegreeBoundsimport OAI.Algebra.DepthFive.CircuitStructureimport OAI.Algebra.DepthFive.GateSumsimport OAI.Algebra.DepthFive.CircuitOutputDegreeimport OAI.Algebra.DepthFive.LowerNumericsimport OAI.Algebra.DepthFive.LowerOperatorsimport OAI.Algebra.DepthFive.LowerCircuit
/-! Rank estimates for homogeneous depth-five circuits and iterated matrix multiplication. -/123456789101112131415161718import OAI.Algebra.DepthFive.ImmFirstMomentBoundimport OAI.Algebra.DepthFive.LocalProductAverageimport OAI.Algebra.DepthFive.LocalMomentPairingimport OAI.Algebra.DepthFive.QuadPathReindeximport OAI.Algebra.DepthFive.ImmPairingCompatibilityimport OAI.Algebra.DepthFive.ImmSecondLocalBoundimport OAI.Algebra.DepthFive.ImmFiniteMatriximport OAI.Algebra.DepthFive.FourPathTraceimport OAI.Algebra.DepthFive.FirstTraceBoundimport OAI.Algebra.DepthFive.PathOccupationAverageimport OAI.Algebra.DepthFive.BidegreeOccupationSumimport OAI.Algebra.DepthFive.PairingPartitionimport OAI.Algebra.DepthFive.PairingWeightsimport OAI.Algebra.DepthFive.ExtendedLocalMomentimport OAI.Algebra.DepthFive.FactorialOccupationimport OAI.Algebra.DepthFive.FactorialGeometricValue
/-! Finite trace-moment estimates for iterated matrix multiplication. -/lean/OAI/Algebra/DepthFive/FourPathTrace.leanAdded+164
lean/OAI/Algebra/DepthFive/FractionRounding.leanAdded+119
lean/OAI/Algebra/DepthFive/GateCardinality.leanAdded+33
lean/OAI/Algebra/DepthFive/GateSums.leanAdded+108
lean/OAI/Algebra/DepthFive/HighDegreeWeights.leanAdded+143
lean/OAI/Algebra/DepthFive/Homogeneity.leanAdded+86
lean/OAI/Algebra/DepthFive/HomogeneousSpaceDimension.leanAdded+62
lean/OAI/Algebra/DepthFive/ImmBidegree.leanAdded+46
lean/OAI/Algebra/DepthFive/ImmBlocks.leanAdded+48
lean/OAI/Algebra/DepthFive/ImmCompatibleTrace.leanAdded+62
lean/OAI/Algebra/DepthFive/ImmDegree.leanAdded+166
lean/OAI/Algebra/DepthFive/ImmFiniteMatrix.leanAdded+190
lean/OAI/Algebra/DepthFive/ImmFirstMomentBound.leanAdded+59
lean/OAI/Algebra/DepthFive/ImmFirstMomentParameters.leanAdded+64
lean/OAI/Algebra/DepthFive/ImmFirstTrace.leanAdded+129
lean/OAI/Algebra/DepthFive/ImmFockMatrix.leanAdded+161
lean/OAI/Algebra/DepthFive/ImmMap.leanAdded+34
lean/OAI/Algebra/DepthFive/ImmOperatorPaths.leanAdded+190
lean/OAI/Algebra/DepthFive/ImmPairingCompatibility.leanAdded+50
lean/OAI/Algebra/DepthFive/ImmPairingReindex.leanAdded+61
lean/OAI/Algebra/DepthFive/ImmPathCompatibility.leanAdded+51
lean/OAI/Algebra/DepthFive/ImmPathShifts.leanAdded+73
lean/OAI/Algebra/DepthFive/ImmProfileCompatibility.leanAdded+38
lean/OAI/Algebra/DepthFive/ImmSecondLocalBound.leanAdded+49
lean/OAI/Algebra/DepthFive/ImmSecondMomentParameters.leanAdded+79
lean/OAI/Algebra/DepthFive/ImmSecondTrace.leanAdded+184
lean/OAI/Algebra/DepthFive/IndependentCoordinates.leanAdded+322
lean/OAI/Algebra/DepthFive/IndexedCircuit.leanAdded+99
lean/OAI/Algebra/DepthFive/IndexedCircuitValue.leanAdded+86
lean/OAI/Algebra/DepthFive/Infrastructure.leanAdded+13
lean/OAI/Algebra/DepthFive/IntegerRank.leanAdded+89
lean/OAI/Algebra/DepthFive/IntermediateDimension.leanAdded+141
lean/OAI/Algebra/DepthFive/IntermediateFactorization.leanAdded+176
lean/OAI/Algebra/DepthFive/InvalidOccupation.leanAdded+80
lean/OAI/Algebra/DepthFive/IsolatedFlip.leanAdded+257
lean/OAI/Algebra/DepthFive/IsolatedWeight.leanAdded+380
lean/OAI/Algebra/DepthFive/IteratedDerivative.leanAdded+56
lean/OAI/Algebra/DepthFive/LayeredFourPath.leanAdded+114
lean/OAI/Algebra/DepthFive/LocalFactorialExpansion.leanAdded+124
lean/OAI/Algebra/DepthFive/LocalMomentPairing.leanAdded+75
lean/OAI/Algebra/DepthFive/LocalMomentPolynomials.leanAdded+174
lean/OAI/Algebra/DepthFive/LocalMomentWeights.leanAdded+107
lean/OAI/Algebra/DepthFive/LocalOccupationAverage.leanAdded+122
lean/OAI/Algebra/DepthFive/LocalProductAverage.leanAdded+104
lean/OAI/Algebra/DepthFive/LowDegreeWeights.leanAdded+123
lean/OAI/Algebra/DepthFive/LowerAsymptotics.leanAdded+80
lean/OAI/Algebra/DepthFive/LowerBoundAssembly.leanAdded+67
lean/OAI/Algebra/DepthFive/LowerCircuit.leanAdded+8
lean/OAI/Algebra/DepthFive/LowerInfrastructure.leanAdded+16
lean/OAI/Algebra/DepthFive/LowerMoments.leanAdded+18