Lean / Reader
Lean reader

E2nMinus3.lean

310 lines8 declarationsno sorryimports E9Elimination E2nMinus3.BesselDeficit E2nMinus3.ClassIIbAllD E2nMinus3.ClassIIaAllD E2nMinus3.MaioranaReduction

Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports E9Elimination, E2nMinus3.BesselDeficit, E2nMinus3.ClassIIbAllD, E2nMinus3.ClassIIaAllD and more, which it does not have: you can read it there, but it will not check. Build the project itself to check it.

  1. import E9Elimination
  2. import E2nMinus3.BesselDeficit
  3. import E2nMinus3.ClassIIbAllD
  4. import E2nMinus3.ClassIIaAllD
  5. import E2nMinus3.MaioranaReduction
  6. /-!
  7. # Complete Unconditional All-Dimensions Elimination of the `E_{2n-3}` Flat Family (`2n ≥ 12`, `IIS-O-0250`)
  8. This top-level module exports the **headline theorems of Paper 9**, closing BOTH the
  9. polytope-level hypercube uncertainty theorems AND the end-to-end Boolean-function
  10. Maiorana–McFarland `E_{2n-3}` elimination directly inside the Lean 4 kernel:
  11. 1. **Sharp Real-Valued Polytope Theorem for ALL `d ≥ 4` (`2n ≥ 14`)** (`e2n_minus_3_real_complete`):
  12. For **EVERY** `d ≥ 4` and **EVERY** REAL vector `w ∈ 𝒫_d(8, 8) ⊂ ℝ^{2^{2d}}` — with **ZERO**
  13. even-lattice integrality (`IsEvenInt`), sign-pattern, bent-proximity, or normal-flat assumptions —
  14. `448 < ∑ z : Vec (2 * d), ((8 : ℝ)^2 - (w z)^2)`
  15. (equivalently `∑ z, (w z)^2 < 64 * 2^{2d} - 448`).
  16. 2. **Unified All-Dimensions Polytope Theorem for ALL `d ≥ 3` (`2n ≥ 12`)** (`e2n_minus_3_all_dimensions_complete`):
  17. Uniting `e2n_minus_3_real_complete` (`d ≥ 4`, real `w`) with Paper 8's `e9_complete_elimination`
  18. (`d = 3`, even-integer lattice `w ∈ (2ℤ)^{64}`): for **EVERY** `d ≥ 3` and **EVERY**
  19. even-integer vector `w ∈ 𝒫_d(8, 8) ∩ (2ℤ)^{2^{2d}}`,
  20. `448 < ∑ z : Vec (2 * d), ((8 : ℝ)^2 - (w z)^2)`.
  21. 3. **End-to-End Boolean-Function Maiorana–McFarland `E_{2n-3}` Elimination**
  22. (`maiorana_mcfarland_E2n_minus_3_walsh_lb`, `maiorana_mcfarland_E2n_minus_3_nonlinearity_ub`,
  23. `maiorana_mcfarland_E9_dobbertin_12var`, `maiorana_mcfarland_affine_pi_E2n_minus_3`):
  24. Directly for balanced Boolean functions `f : Vec (2 * n) → ZMod 2` (`n ≥ 6`) agreeing with a
  25. Maiorana–McFarland bent function `B(x, y) = x · π(y) + h(y)` outside a fiber-aligned
  26. codimension-3 flat `E_{2n-3} = 𝔽₂^n × W_{n-3}` whose image `π(W_{n-3})` is affine (in
  27. particular, every affine bijection `π` and arbitrary `h` of degree up to `n`):
  28. - `∃ ω, 2^n + 12 ≤ |W f ω|`,
  29. - `∃ ω c, distH f (fun z => dotProduct ω z + c) ≤ 2^{2n - 1} - 2^{n - 1} - 6`,
  30. - At `n = 6` (`2n = 12`): `∃ ω c, distH f (fun z => dotProduct ω z + c) ≤ 2010 = NLB₁₂`,
  31. matching Dobbertin's Conjecture exactly!
  32. (For `2n ≥ 14`, this strictly sharpens the universal barrier `2^{2n-1} - 2^{n-1} - 4` to
  33. `2^{2n-1} - 2^{n-1} - 6`, while Dobbertin's conjectured global bound `2^{2n-1} - 2^n + NLB_n`
  34. remains strictly lower for `2n ≥ 14` and open in general.)
  35. -/
  36. open Finset BigOperators E9Elimination
  37. namespace E2nMinus3
  38. /-- **Theorem 1 (Complete Unconditional Real-Valued Elimination of `E_{2n-3}` for ALL `2n ≥ 14`, `d ≥ 4`)**:
  39. For EVERY `d ≥ 4` (`2n = 2d + 6 ≥ 14`) and EVERY REAL vector `w : Vec (2*d) → ℝ` in the balanced
  40. bounded-spectrum polytope `𝒫_d(8, 8)` — with ZERO even-integer, sign-pattern, bent-proximity,
  41. or normal-flat assumptions — the `L²` deficit strictly exceeds `448`:
  42. `448 < ∑ z : Vec (2 * d), ((8 : ℝ)^2 - (w z)^2)`. -/
  43. theorem e2n_minus_3_real_complete {d : ℕ} (hd : 4 ≤ d)
  44. (w : Vec (2 * d) → ℝ) (hwP : InPolytope d 8 8 w) :
  45. 448 < ∑ z : Vec (2 * d), ((8 : ℝ) ^ 2 - (w z) ^ 2) := by
  46. classical
  47. -- Step 1: Extract a canonical sign pattern `g : Vec (2*d) → ZMod 2` with `HasSign g w`!
  48. rcases hasSign_of_real w with ⟨g, hwS⟩
  49. -- Step 2: Eliminate `|W g 0| ≥ 8` via `zero_sum_deficit_ge` (deficit ≥ 512 > 448)!
  50. by_cases hW0_ge8 : 8 ≤ |W g 0|
  51. · have hdef := zero_sum_deficit_ge g 8 (by norm_num) w hwP.1 hwP.2.1 hwS
  52. have hR : (8 : ℝ) ≤ (|W g 0| : ℝ) := by exact_mod_cast hW0_ge8
  53. nlinarith
  54. -- Step 3: Eliminate `∃ ω, 2^d + 8 ≤ |W g ω|` via `signed_quadrant_l2` (deficit ≥ 480 > 448)!
  55. by_cases hW_hi : ∃ ω : Vec (2 * d), (2 : ℤ) ^ d + 8 ≤ |W g ω|
  56. · rcases hW_hi with ⟨u, hu_ge⟩
  57. have hM16 : (16 : ℤ) ≤ (2 : ℤ) ^ d := by
  58. have : (2 : ℤ) ^ 4 ≤ (2 : ℤ) ^ d := pow_le_pow_right₀ (by decide) hd
  59. norm_num at this; exact this
  60. have hu0 : u ≠ 0 := fun h => by rw [h] at hu_ge; omega
  61. have hG_ge : |W g 0| ≤ |W g u| - (2 : ℤ) ^ d := by omega
  62. have hdef := signed_quadrant_l2 (d := d) (by omega) g u hu0 (|W g u| - (2 : ℤ) ^ d)
  63. (by omega) hG_ge 8 8 (by norm_num) (by norm_num) (by norm_num) w hwP hwS
  64. have hGR : (8 : ℝ) ≤ ((|W g u| - (2 : ℤ) ^ d : ℤ) : ℝ) := by
  65. have : (8 : ℤ) ≤ |W g u| - (2 : ℤ) ^ d := by omega
  66. exact_mod_cast this
  67. have hstep : (480 : ℝ) ≤ ((|W g u| - (2 : ℤ) ^ d : ℤ) : ℝ) * (8 : ℝ) ^ 2 - (1 / 2 : ℝ) * (8 : ℝ) ^ 2 := by
  68. linarith
  69. exact lt_of_lt_of_le (by norm_num) (le_trans hstep hdef)
  70. push Not at hW0_ge8 hW_hi
  71. -- Step 4: Now `|W g 0| ≤ 7` and `∀ ω, |W g ω| ≤ 2^d + 7`! Split by parity of `wt g`!
  72. have hM16 : (16 : ℤ) ≤ (2 : ℤ) ^ d := by
  73. have : (2 : ℤ) ^ 4 ≤ (2 : ℤ) ^ d := pow_le_pow_right₀ (by decide) hd
  74. norm_num at this; exact this
  75. have h4M : (4 : ℤ) ∣ (2 : ℤ) ^ d := by
  76. have : (2 : ℤ) ^ d = 4 * (2 : ℤ) ^ (d - 2) := by
  77. calc (2 : ℤ) ^ d = (2 : ℤ) ^ (2 + (d - 2)) := by rw [Nat.add_sub_of_le (by omega)]
  78. _ = 4 * (2 : ℤ) ^ (d - 2) := by rw [pow_add]; norm_num
  79. exact ⟨(2 : ℤ) ^ (d - 2), this⟩
  80. rcases Nat.even_or_odd (wt g) with hev | hodd
  81. · -- EVEN WEIGHT: `4 ∣ W g ω` ⟹ `|W g 0| ≤ 4` and `∀ ω, |W g ω| ≤ 2^d + 4`!
  82. have h4 : ∀ ω : Vec (2 * d), (4 : ℤ) ∣ W g ω := four_dvd_W_of_even_wt (by omega) g hev
  83. have hW4 : ∀ ω : Vec (2 * d), |W g ω| ≤ (2 : ℤ) ^ d + 4 := fun ω => by
  84. rcases h4 ω with ⟨k, hk⟩; rcases h4M with ⟨q, hq⟩
  85. have h1 := abs_lt.mp (hW_hi ω); rw [abs_le]; omega
  86. have h0_le4 : |W g 0| ≤ 4 := by
  87. rcases h4 0 with ⟨k, hk⟩
  88. have h1 := abs_lt.mp hW0_ge8; rw [abs_le]; omega
  89. have hmod8 : ∀ ω : Vec (2 * d), (8 : ℤ) ∣ (W g ω - 4) :=
  90. even_weight_walsh_dichotomy hd g hev hW4 ⟨0, h0_le4⟩
  91. have hW0_4 : |W g 0| = 4 := by
  92. rcases hmod8 0 with ⟨k, hk⟩
  93. have h1 := abs_le.mp h0_le4
  94. have hk0 : k = 0 ∨ k = -1 := by omega
  95. rcases hk0 with rfl | rfl <;> (have : W g 0 = 4 ∨ W g 0 = -4 := by omega)
  96. · rcases this with h | h <;> simp [h]
  97. · rcases this with h | h <;> simp [h]
  98. exact e2n_minus_3_subcase_Ib_complete hd g hmod8 hW0_4 hW4 w hwP hwS
  99. · -- ODD WEIGHT: `4 ∣ (W g ω - 2)` ⟹ `|W g 0| ∈ {2, 6}` and `∀ ω, |W g ω| ≤ 2^d + 6`!
  100. have h4 : ∀ ω : Vec (2 * d), (4 : ℤ) ∣ (W g ω - 2) := W_mod_four_of_odd_wt (by omega) g hodd
  101. have hW6 : ∀ ω : Vec (2 * d), |W g ω| ≤ (2 : ℤ) ^ d + 6 := fun ω => by
  102. rcases h4 ω with ⟨k, hk⟩; rcases h4M with ⟨q, hq⟩
  103. have h1 := abs_lt.mp (hW_hi ω); rw [abs_le]; omega
  104. have h026 : |W g 0| = 2 ∨ |W g 0| = 6 := by
  105. rcases h4 0 with ⟨k, hk⟩
  106. have h1 := abs_lt.mp hW0_ge8
  107. have hk_cases : k = -2 ∨ k = -1 ∨ k = 0 ∨ k = 1 := by omega
  108. rcases hk_cases with rfl | rfl | rfl | rfl
  109. · right
  110. have hval : W g 0 = -6 := by omega
  111. rw [hval]; decide
  112. · left
  113. have hval : W g 0 = -2 := by omega
  114. rw [hval]; decide
  115. · left
  116. have hval : W g 0 = 2 := by omega
  117. rw [hval]; decide
  118. · right
  119. have hval : W g 0 = 6 := by omega
  120. rw [hval]; decide
  121. -- Apply `odd_weight_canonical_flip` to split Class `IIa` vs Class `IIb`!
  122. rcases odd_weight_canonical_flip (d := d) (by omega) g hodd with
  123. ⟨x₀, _, _, hIIa | ⟨hIIb_mod8, hIIb_props⟩⟩
  124. · exact e2n_minus_3_class_IIa_complete hd g x₀ hIIa h026 hW6 w hwP hwS
  125. · rcases hIIb_props ⟨by omega, h026, hW6⟩ with ⟨hW'0, hW'4⟩
  126. exact e2n_minus_3_class_IIb_complete hd g x₀ hIIb_mod8 hW'0 hW'4 w hwP hwS
  127. /-- **Corollary 1a (`L²` Form of Real-Valued `E_{2n-3}` Elimination for ALL `d ≥ 4`)**:
  128. No real vector `w ∈ 𝒫_d(8, 8)` (`d ≥ 4`) can satisfy `∑ z, (w z)^2 ≥ 64 * 2^{2d} - 448`. -/
  129. theorem e2n_minus_3_real_complete_l2 {d : ℕ} (hd : 4 ≤ d)
  130. (w : Vec (2 * d) → ℝ) (hwP : InPolytope d 8 8 w) :
  131. ∑ z : Vec (2 * d), (w z) ^ 2 < 64 * (2 : ℝ) ^ (2 * d) - 448 := by
  132. have h := e2n_minus_3_real_complete hd w hwP
  133. have h64 : ∑ _z : Vec (2 * d), (8 : ℝ) ^ 2 = 64 * (2 : ℝ) ^ (2 * d) := by
  134. rw [Finset.sum_const, Finset.card_univ, card_vec, nsmul_eq_mul, Nat.cast_pow, Nat.cast_ofNat]; ring
  135. rw [Finset.sum_sub_distrib, h64] at h; linarith
  136. /-- **Theorem 2 (Unified All-Dimensions Elimination of `E_{2n-3}` for EVERY `2n ≥ 12`, `d ≥ 3`)**:
  137. Unites Paper 8 (`d = 3`, `2n = 12`, `iis:2611.00058`, using even-lattice integrality for the
  138. three bent-ball families inside `|W g 0| ≤ 6`) and Paper 9 (`d ≥ 4`, `2n ≥ 14`, holding
  139. unconditionally over ALL real vectors `w ∈ 𝒫_d(8, 8)`):
  140. for EVERY `d ≥ 3` (`2n ≥ 12`) and EVERY even-integer vector `w ∈ 𝒫_d(8, 8) ∩ (2ℤ)^{2^{2d}}`,
  141. `448 < ∑ z : Vec (2 * d), ((8 : ℝ)^2 - (w z)^2)`. -/
  142. theorem e2n_minus_3_all_dimensions_complete {d : ℕ} (hd : 3 ≤ d)
  143. (w : Vec (2 * d) → ℝ) (hwP : InPolytope d 8 8 w) (heven : IsEvenInt w) :
  144. 448 < ∑ z : Vec (2 * d), ((8 : ℝ) ^ 2 - (w z) ^ 2) := by
  145. by_cases hd4 : 4 ≤ d
  146. · exact e2n_minus_3_real_complete hd4 w hwP
  147. · have hd3 : d = 3 := by omega
  148. subst hd3
  149. exact e9_complete_elimination w hwP heven
  150. /-- **Corollary 2a (`L²` Form of Unified All-Dimensions `E_{2n-3}` Elimination for EVERY `d ≥ 3`)**:
  151. For EVERY `d ≥ 3` (`2n ≥ 12`), no even-integer vector `w ∈ 𝒫_d(8, 8) ∩ (2ℤ)^{2^{2d}}` can
  152. satisfy `∑ z, (w z)^2 ≥ 64 * 2^{2d} - 448`. -/
  153. theorem e2n_minus_3_all_dimensions_l2 {d : ℕ} (hd : 3 ≤ d)
  154. (w : Vec (2 * d) → ℝ) (hwP : InPolytope d 8 8 w) (heven : IsEvenInt w) :
  155. ∑ z : Vec (2 * d), (w z) ^ 2 < 64 * (2 : ℝ) ^ (2 * d) - 448 := by
  156. have h := e2n_minus_3_all_dimensions_complete hd w hwP heven
  157. have h64 : ∑ _z : Vec (2 * d), (8 : ℝ) ^ 2 = 64 * (2 : ℝ) ^ (2 * d) := by
  158. rw [Finset.sum_const, Finset.card_univ, card_vec, nsmul_eq_mul, Nat.cast_pow, Nat.cast_ofNat]; ring
  159. rw [Finset.sum_sub_distrib, h64] at h; linarith
  160. /-! ### End-to-End Boolean-Function Elimination Theorems on `𝔽₂^{2n}` -/
  161. /-- **Theorem 4 (End-to-End Boolean-Function Maiorana–McFarland `E_{2n-3}` Walsh Bound, ALL `2n ≥ 12`)**:
  162. For EVERY `n ≥ 6` (`2n ≥ 12`), EVERY bijective `π : Vec n → Vec n`, EVERY `h : Vec n → ZMod 2`,
  163. EVERY fiber-aligned codimension-3 flat `E_{2n-3} = 𝔽₂^n × (y₀ + im L_Y)` (`L_Y : Vec (n - 3) →ₗ Vec n`
  164. injective) whose `π`-image `π(y₀ + im L_Y) = a₀ + im L_X` is affine, and EVERY balanced Boolean
  165. function `f : Vec (2*n) → ZMod 2` agreeing with `B(x, y) = x · π(y) + h(y)` outside `E_{2n-3}`,
  166. there exists a Walsh frequency `ω` with `|W f ω| ≥ 2^n + 12`. -/
  167. theorem maiorana_mcfarland_E2n_minus_3_walsh_lb {n : ℕ} (hn : 6 ≤ n)
  168. (π : Vec n → Vec n) (hπ : Function.Bijective π) (h : Vec n → ZMod 2)
  169. (y₀ : Vec n) (LY : Vec (n - 3) →ₗ[ZMod 2] Vec n) (hLY : Function.Injective LY)
  170. (a₀ : Vec n) (LX : Vec (n - 3) →ₗ[ZMod 2] Vec n) (hLX : Function.Injective LX)
  171. (hπ_flat : ∀ y : Vec n, inAffineFlat y₀ LY y ↔ inAffineFlat a₀ LX (π y))
  172. (f : Vec (2 * n) → ZMod 2) (hf_bal : IsBalanced f)
  173. (hf_out : ∀ z : Vec (2 * n), ¬ inAffineFlat y₀ LY (vecRight z) →
  174. f z = maioranaMcFarland π h z) :
  175. ∃ ω : Vec (2 * n), (2 : ℤ) ^ n + 12 ≤ |W f ω| := by
  176. -- Step 1: Rule out `∀ ω, |W f ω| ≤ 2^n + 8` via `maiorana_mcfarland_flat_reduction` +
  177. -- `e2n_minus_3_all_dimensions_complete`!
  178. have hnot8 : ¬ (∀ ω : Vec (2 * n), |W f ω| ≤ (2 : ℤ) ^ n + 8) := by
  179. intro hle8
  180. have h8lt : (8 : ℤ) < (2 : ℤ) ^ n := by
  181. have : (2 : ℤ) ^ 6 ≤ (2 : ℤ) ^ n := pow_le_pow_right₀ (by decide) hn
  182. norm_num at this; omega
  183. rcases maiorana_mcfarland_flat_reduction (d := n - 3) (by omega)
  184. π hπ h y₀ LY hLY a₀ LX hLX hπ_flat f hf_bal hf_out 8 (by norm_num) h8lt hle8 with
  185. ⟨w, hwP, hwEven, hwDef⟩
  186. have hsub : n - (n - 3) = 3 := by omega
  187. rw [hsub] at hwP hwDef
  188. norm_num at hwP hwDef
  189. have hgt := e2n_minus_3_all_dimensions_l2 (d := n - 3) (by omega) w hwP hwEven
  190. linarith
  191. push Not at hnot8
  192. rcases hnot8 with ⟨ω, hω_gt⟩
  193. -- Step 2: Since `f` is balanced in `2n ≥ 12` variables, `wt f = 2^{2n-1}` is even, so `4 ∣ W f ω`!
  194. have hwt_ev : Even (wt f) := by
  195. have hW0 := W_zero_eq f
  196. rw [hf_bal] at hW0
  197. have hpow : (2 : ℤ) ^ (2 * n) = 4 * (2 : ℤ) ^ (2 * n - 2) := by
  198. calc (2 : ℤ) ^ (2 * n) = (2 : ℤ) ^ (2 + (2 * n - 2)) := by congr 1; omega
  199. _ = 4 * (2 : ℤ) ^ (2 * n - 2) := by rw [pow_add]; norm_num
  200. refine ⟨2 ^ (2 * n - 2), ?_⟩
  201. zify; omega
  202. have h4W : (4 : ℤ) ∣ W f ω := four_dvd_W_of_even_wt (by omega) f hwt_ev ω
  203. have h4M : (4 : ℤ) ∣ (2 : ℤ) ^ n := by
  204. have : (2 : ℤ) ^ n = 4 * (2 : ℤ) ^ (n - 2) := by
  205. calc (2 : ℤ) ^ n = (2 : ℤ) ^ (2 + (n - 2)) := by congr 1; omega
  206. _ = 4 * (2 : ℤ) ^ (n - 2) := by rw [pow_add]; norm_num
  207. exact ⟨(2 : ℤ) ^ (n - 2), this⟩
  208. rcases h4W with ⟨k, hk⟩
  209. rcases h4M with ⟨q, hq⟩
  210. refine ⟨ω, ?_⟩
  211. rw [hk, hq] at hω_gt ⊢
  212. rcases le_or_gt 0 (4 * k) with hp | hn'
  213. · rw [abs_of_nonneg hp] at hω_gt ⊢; omega
  214. · rw [abs_of_neg hn'] at hω_gt ⊢; omega
  215. /-- **Corollary 4a (End-to-End Nonlinearity Upper Bound for ALL `2n ≥ 12`)**:
  216. Every balanced `E_{2n-3}`-modification of `B(x, y) = x · π(y) + h(y)` (with `π(W_{n-3})` affine)
  217. has an explicit affine function `ω · z + c` at Hamming distance `≤ 2^{2n - 1} - 2^{n - 1} - 6`. -/
  218. theorem maiorana_mcfarland_E2n_minus_3_nonlinearity_ub {n : ℕ} (hn : 6 ≤ n)
  219. (π : Vec n → Vec n) (hπ : Function.Bijective π) (h : Vec n → ZMod 2)
  220. (y₀ : Vec n) (LY : Vec (n - 3) →ₗ[ZMod 2] Vec n) (hLY : Function.Injective LY)
  221. (a₀ : Vec n) (LX : Vec (n - 3) →ₗ[ZMod 2] Vec n) (hLX : Function.Injective LX)
  222. (hπ_flat : ∀ y : Vec n, inAffineFlat y₀ LY y ↔ inAffineFlat a₀ LX (π y))
  223. (f : Vec (2 * n) → ZMod 2) (hf_bal : IsBalanced f)
  224. (hf_out : ∀ z : Vec (2 * n), ¬ inAffineFlat y₀ LY (vecRight z) →
  225. f z = maioranaMcFarland π h z) :
  226. ∃ (ω : Vec (2 * n)) (c : ZMod 2),
  227. distH f (fun z => dotProduct ω z + c) ≤ 2 ^ (2 * n - 1) - 2 ^ (n - 1) - 6 := by
  228. rcases maiorana_mcfarland_E2n_minus_3_walsh_lb hn π hπ h y₀ LY hLY a₀ LX hLX hπ_flat
  229. f hf_bal hf_out with ⟨ω, hW⟩
  230. rcases walsh_lb_implies_affine_distH (by omega) f ω hW with ⟨c, hc⟩
  231. exact ⟨ω, c, hc⟩
  232. /-- **Corollary 4b (Exact Dobbertin Bound `NLB₁₂ = 2010` for `E₉` at `2n = 12`)**:
  233. At `2n = 12` (`n = 6`), every balanced `E₉`-modification of `B(x, y) = x · π(y) + h(y)` (with
  234. `π(W₃)` affine) has nonlinearity `≤ 2010 = NLB₁₂`, matching Dobbertin's Conjecture exactly! -/
  235. theorem maiorana_mcfarland_E9_dobbertin_12var
  236. (π : Vec 6 → Vec 6) (hπ : Function.Bijective π) (h : Vec 6 → ZMod 2)
  237. (y₀ : Vec 6) (LY : Vec 3 →ₗ[ZMod 2] Vec 6) (hLY : Function.Injective LY)
  238. (a₀ : Vec 6) (LX : Vec 3 →ₗ[ZMod 2] Vec 6) (hLX : Function.Injective LX)
  239. (hπ_flat : ∀ y : Vec 6, inAffineFlat y₀ LY y ↔ inAffineFlat a₀ LX (π y))
  240. (f : Vec 12 → ZMod 2) (hf_bal : IsBalanced f)
  241. (hf_out : ∀ z : Vec 12, ¬ inAffineFlat y₀ LY (vecRight z) →
  242. f z = maioranaMcFarland π h z) :
  243. ∃ (ω : Vec 12) (c : ZMod 2),
  244. distH f (fun z => dotProduct ω z + c) ≤ 2010 := by
  245. simpa using maiorana_mcfarland_E2n_minus_3_nonlinearity_ub (n := 6) (by decide)
  246. π hπ h y₀ LY hLY a₀ LX hLX hπ_flat f hf_bal hf_out
  247. /-- **Corollary 4c (Arbitrary Affine `π(y) = A y + c₀` and Arbitrary `h`, ALL `2n ≥ 12`)**:
  248. When `π(y) = A y + c₀` is ANY affine bijection on `𝔽₂^n` and `h : Vec n → ZMod 2` is arbitrary
  249. (degree up to `n`), EVERY fiber-aligned codimension-3 flat `E_{2n-3} = 𝔽₂^n × (y₀ + im L_Y)`
  250. automatically has affine `π`-image and satisfies `NL(f) ≤ 2^{2n - 1} - 2^{n - 1} - 6`! -/
  251. theorem maiorana_mcfarland_affine_pi_E2n_minus_3 {n : ℕ} (hn : 6 ≤ n)
  252. (A : Vec n ≃ₗ[ZMod 2] Vec n) (c₀ : Vec n) (h : Vec n → ZMod 2)
  253. (y₀ : Vec n) (LY : Vec (n - 3) →ₗ[ZMod 2] Vec n) (hLY : Function.Injective LY)
  254. (f : Vec (2 * n) → ZMod 2) (hf_bal : IsBalanced f)
  255. (hf_out : ∀ z : Vec (2 * n), ¬ inAffineFlat y₀ LY (vecRight z) →
  256. f z = maioranaMcFarland (fun y => A y + c₀) h z) :
  257. ∃ (ω : Vec (2 * n)) (c : ZMod 2),
  258. distH f (fun z => dotProduct ω z + c) ≤ 2 ^ (2 * n - 1) - 2 ^ (n - 1) - 6 := by
  259. let π : Vec n → Vec n := fun y => A y + c₀
  260. have hπ : Function.Bijective π := by
  261. refine ⟨fun y₁ y₂ h12 => ?_, fun b => ⟨A.symm (b + c₀), ?_⟩⟩
  262. · have hA : A y₁ = A y₂ := by
  263. have h' := congrArg (fun t => t + c₀) h12
  264. simpa [π, add_assoc, vec_add_self] using h'
  265. exact A.injective hA
  266. · simp [π, add_assoc, vec_add_self]
  267. let LX : Vec (n - 3) →ₗ[ZMod 2] Vec n := A.toLinearMap.comp LY
  268. have hLX : Function.Injective LX := A.injective.comp hLY
  269. have hπ_flat : ∀ y : Vec n, inAffineFlat y₀ LY y ↔ inAffineFlat (A y₀ + c₀) LX (π y) := by
  270. intro y
  271. constructor
  272. · rintro ⟨u, rfl⟩
  273. refine ⟨u, ?_⟩
  274. simp only [π, LX, LinearMap.comp_apply, LinearEquiv.coe_coe, map_add]
  275. abel
  276. · rintro ⟨u, hu⟩
  277. refine ⟨u, ?_⟩
  278. have hA : A y = A (y₀ + LY u) := by
  279. have h1 := congrArg (fun t => t + c₀) hu
  280. simp only [π, LX, LinearMap.comp_apply, LinearEquiv.coe_coe, map_add] at h1 ⊢
  281. have h2 : A y + c₀ + c₀ = A y := by rw [add_assoc, vec_add_self, add_zero]
  282. have h3 : A y₀ + c₀ + A (LY u) + c₀ = A y₀ + A (LY u) := by
  283. calc A y₀ + c₀ + A (LY u) + c₀
  284. = A y₀ + A (LY u) + (c₀ + c₀) := by abel
  285. _ = A y₀ + A (LY u) := by rw [vec_add_self, add_zero]
  286. calc A y = A y + c₀ + c₀ := h2.symm
  287. _ = A y₀ + c₀ + A (LY u) + c₀ := h1
  288. _ = A y₀ + A (LY u) := h3
  289. exact A.injective hA
  290. exact maiorana_mcfarland_E2n_minus_3_nonlinearity_ub hn π hπ h
  291. y₀ LY hLY (A y₀ + c₀) LX hLX hπ_flat f hf_bal hf_out
  292. end E2nMinus3