Lean / Reader
Lean readerE2nMinus3.lean
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.
import E9Eliminationimport E2nMinus3.BesselDeficitimport E2nMinus3.ClassIIbAllDimport E2nMinus3.ClassIIaAllDimport E2nMinus3.MaioranaReduction/-!# Complete Unconditional All-Dimensions Elimination of the `E_{2n-3}` Flat Family (`2n ≥ 12`, `IIS-O-0250`)This top-level module exports the **headline theorems of Paper 9**, closing BOTH thepolytope-level hypercube uncertainty theorems AND the end-to-end Boolean-functionMaiorana–McFarland `E_{2n-3}` elimination directly inside the Lean 4 kernel:1. **Sharp Real-Valued Polytope Theorem for ALL `d ≥ 4` (`2n ≥ 14`)** (`e2n_minus_3_real_complete`):For **EVERY** `d ≥ 4` and **EVERY** REAL vector `w ∈ 𝒫_d(8, 8) ⊂ ℝ^{2^{2d}}` — with **ZERO**even-lattice integrality (`IsEvenInt`), sign-pattern, bent-proximity, or normal-flat assumptions —`448 < ∑ z : Vec (2 * d), ((8 : ℝ)^2 - (w z)^2)`(equivalently `∑ z, (w z)^2 < 64 * 2^{2d} - 448`).2. **Unified All-Dimensions Polytope Theorem for ALL `d ≥ 3` (`2n ≥ 12`)** (`e2n_minus_3_all_dimensions_complete`):Uniting `e2n_minus_3_real_complete` (`d ≥ 4`, real `w`) with Paper 8's `e9_complete_elimination`(`d = 3`, even-integer lattice `w ∈ (2ℤ)^{64}`): for **EVERY** `d ≥ 3` and **EVERY**even-integer vector `w ∈ 𝒫_d(8, 8) ∩ (2ℤ)^{2^{2d}}`,`448 < ∑ z : Vec (2 * d), ((8 : ℝ)^2 - (w z)^2)`.3. **End-to-End Boolean-Function Maiorana–McFarland `E_{2n-3}` Elimination**(`maiorana_mcfarland_E2n_minus_3_walsh_lb`, `maiorana_mcfarland_E2n_minus_3_nonlinearity_ub`,`maiorana_mcfarland_E9_dobbertin_12var`, `maiorana_mcfarland_affine_pi_E2n_minus_3`):Directly for balanced Boolean functions `f : Vec (2 * n) → ZMod 2` (`n ≥ 6`) agreeing with aMaiorana–McFarland bent function `B(x, y) = x · π(y) + h(y)` outside a fiber-alignedcodimension-3 flat `E_{2n-3} = 𝔽₂^n × W_{n-3}` whose image `π(W_{n-3})` is affine (inparticular, every affine bijection `π` and arbitrary `h` of degree up to `n`):- `∃ ω, 2^n + 12 ≤ |W f ω|`,- `∃ ω c, distH f (fun z => dotProduct ω z + c) ≤ 2^{2n - 1} - 2^{n - 1} - 6`,- At `n = 6` (`2n = 12`): `∃ ω c, distH f (fun z => dotProduct ω z + c) ≤ 2010 = NLB₁₂`,matching Dobbertin's Conjecture exactly!(For `2n ≥ 14`, this strictly sharpens the universal barrier `2^{2n-1} - 2^{n-1} - 4` to`2^{2n-1} - 2^{n-1} - 6`, while Dobbertin's conjectured global bound `2^{2n-1} - 2^n + NLB_n`remains strictly lower for `2n ≥ 14` and open in general.)-/open Finset BigOperators E9Eliminationnamespace E2nMinus3/-- **Theorem 1 (Complete Unconditional Real-Valued Elimination of `E_{2n-3}` for ALL `2n ≥ 14`, `d ≥ 4`)**:For EVERY `d ≥ 4` (`2n = 2d + 6 ≥ 14`) and EVERY REAL vector `w : Vec (2*d) → ℝ` in the balancedbounded-spectrum polytope `𝒫_d(8, 8)` — with ZERO even-integer, sign-pattern, bent-proximity,or normal-flat assumptions — the `L²` deficit strictly exceeds `448`:`448 < ∑ z : Vec (2 * d), ((8 : ℝ)^2 - (w z)^2)`. -/theorem e2n_minus_3_real_complete {d : ℕ} (hd : 4 ≤ d)(w : Vec (2 * d) → ℝ) (hwP : InPolytope d 8 8 w) :448 < ∑ z : Vec (2 * d), ((8 : ℝ) ^ 2 - (w z) ^ 2) := byclassical-- Step 1: Extract a canonical sign pattern `g : Vec (2*d) → ZMod 2` with `HasSign g w`!rcases hasSign_of_real w with ⟨g, hwS⟩-- Step 2: Eliminate `|W g 0| ≥ 8` via `zero_sum_deficit_ge` (deficit ≥ 512 > 448)!by_cases hW0_ge8 : 8 ≤ |W g 0|· have hdef := zero_sum_deficit_ge g 8 (by norm_num) w hwP.1 hwP.2.1 hwShave hR : (8 : ℝ) ≤ (|W g 0| : ℝ) := by exact_mod_cast hW0_ge8nlinarith-- Step 3: Eliminate `∃ ω, 2^d + 8 ≤ |W g ω|` via `signed_quadrant_l2` (deficit ≥ 480 > 448)!by_cases hW_hi : ∃ ω : Vec (2 * d), (2 : ℤ) ^ d + 8 ≤ |W g ω|· rcases hW_hi with ⟨u, hu_ge⟩have hM16 : (16 : ℤ) ≤ (2 : ℤ) ^ d := byhave : (2 : ℤ) ^ 4 ≤ (2 : ℤ) ^ d := pow_le_pow_right₀ (by decide) hdnorm_num at this; exact thishave hu0 : u ≠ 0 := fun h => by rw [h] at hu_ge; omegahave hG_ge : |W g 0| ≤ |W g u| - (2 : ℤ) ^ d := by omegahave hdef := signed_quadrant_l2 (d := d) (by omega) g u hu0 (|W g u| - (2 : ℤ) ^ d)(by omega) hG_ge 8 8 (by norm_num) (by norm_num) (by norm_num) w hwP hwShave hGR : (8 : ℝ) ≤ ((|W g u| - (2 : ℤ) ^ d : ℤ) : ℝ) := byhave : (8 : ℤ) ≤ |W g u| - (2 : ℤ) ^ d := by omegaexact_mod_cast thishave hstep : (480 : ℝ) ≤ ((|W g u| - (2 : ℤ) ^ d : ℤ) : ℝ) * (8 : ℝ) ^ 2 - (1 / 2 : ℝ) * (8 : ℝ) ^ 2 := bylinarithexact lt_of_lt_of_le (by norm_num) (le_trans hstep hdef)push Not at hW0_ge8 hW_hi-- Step 4: Now `|W g 0| ≤ 7` and `∀ ω, |W g ω| ≤ 2^d + 7`! Split by parity of `wt g`!have hM16 : (16 : ℤ) ≤ (2 : ℤ) ^ d := byhave : (2 : ℤ) ^ 4 ≤ (2 : ℤ) ^ d := pow_le_pow_right₀ (by decide) hdnorm_num at this; exact thishave h4M : (4 : ℤ) ∣ (2 : ℤ) ^ d := byhave : (2 : ℤ) ^ d = 4 * (2 : ℤ) ^ (d - 2) := bycalc (2 : ℤ) ^ d = (2 : ℤ) ^ (2 + (d - 2)) := by rw [Nat.add_sub_of_le (by omega)]_ = 4 * (2 : ℤ) ^ (d - 2) := by rw [pow_add]; norm_numexact ⟨(2 : ℤ) ^ (d - 2), this⟩rcases Nat.even_or_odd (wt g) with hev | hodd· -- EVEN WEIGHT: `4 ∣ W g ω` ⟹ `|W g 0| ≤ 4` and `∀ ω, |W g ω| ≤ 2^d + 4`!have h4 : ∀ ω : Vec (2 * d), (4 : ℤ) ∣ W g ω := four_dvd_W_of_even_wt (by omega) g hevhave hW4 : ∀ ω : Vec (2 * d), |W g ω| ≤ (2 : ℤ) ^ d + 4 := fun ω => byrcases h4 ω with ⟨k, hk⟩; rcases h4M with ⟨q, hq⟩have h1 := abs_lt.mp (hW_hi ω); rw [abs_le]; omegahave h0_le4 : |W g 0| ≤ 4 := byrcases h4 0 with ⟨k, hk⟩have h1 := abs_lt.mp hW0_ge8; rw [abs_le]; omegahave hmod8 : ∀ ω : Vec (2 * d), (8 : ℤ) ∣ (W g ω - 4) :=even_weight_walsh_dichotomy hd g hev hW4 ⟨0, h0_le4⟩have hW0_4 : |W g 0| = 4 := byrcases hmod8 0 with ⟨k, hk⟩have h1 := abs_le.mp h0_le4have hk0 : k = 0 ∨ k = -1 := by omegarcases hk0 with rfl | rfl <;> (have : W g 0 = 4 ∨ W g 0 = -4 := by omega)· rcases this with h | h <;> simp [h]· rcases this with h | h <;> simp [h]exact e2n_minus_3_subcase_Ib_complete hd g hmod8 hW0_4 hW4 w hwP hwS· -- ODD WEIGHT: `4 ∣ (W g ω - 2)` ⟹ `|W g 0| ∈ {2, 6}` and `∀ ω, |W g ω| ≤ 2^d + 6`!have h4 : ∀ ω : Vec (2 * d), (4 : ℤ) ∣ (W g ω - 2) := W_mod_four_of_odd_wt (by omega) g hoddhave hW6 : ∀ ω : Vec (2 * d), |W g ω| ≤ (2 : ℤ) ^ d + 6 := fun ω => byrcases h4 ω with ⟨k, hk⟩; rcases h4M with ⟨q, hq⟩have h1 := abs_lt.mp (hW_hi ω); rw [abs_le]; omegahave h026 : |W g 0| = 2 ∨ |W g 0| = 6 := byrcases h4 0 with ⟨k, hk⟩have h1 := abs_lt.mp hW0_ge8have hk_cases : k = -2 ∨ k = -1 ∨ k = 0 ∨ k = 1 := by omegarcases hk_cases with rfl | rfl | rfl | rfl· righthave hval : W g 0 = -6 := by omegarw [hval]; decide· lefthave hval : W g 0 = -2 := by omegarw [hval]; decide· lefthave hval : W g 0 = 2 := by omegarw [hval]; decide· righthave hval : W g 0 = 6 := by omegarw [hval]; decide-- Apply `odd_weight_canonical_flip` to split Class `IIa` vs Class `IIb`!rcases odd_weight_canonical_flip (d := d) (by omega) g hodd with⟨x₀, _, _, hIIa | ⟨hIIb_mod8, hIIb_props⟩⟩· exact e2n_minus_3_class_IIa_complete hd g x₀ hIIa h026 hW6 w hwP hwS· rcases hIIb_props ⟨by omega, h026, hW6⟩ with ⟨hW'0, hW'4⟩exact e2n_minus_3_class_IIb_complete hd g x₀ hIIb_mod8 hW'0 hW'4 w hwP hwS/-- **Corollary 1a (`L²` Form of Real-Valued `E_{2n-3}` Elimination for ALL `d ≥ 4`)**:No real vector `w ∈ 𝒫_d(8, 8)` (`d ≥ 4`) can satisfy `∑ z, (w z)^2 ≥ 64 * 2^{2d} - 448`. -/theorem e2n_minus_3_real_complete_l2 {d : ℕ} (hd : 4 ≤ d)(w : Vec (2 * d) → ℝ) (hwP : InPolytope d 8 8 w) :∑ z : Vec (2 * d), (w z) ^ 2 < 64 * (2 : ℝ) ^ (2 * d) - 448 := byhave h := e2n_minus_3_real_complete hd w hwPhave h64 : ∑ _z : Vec (2 * d), (8 : ℝ) ^ 2 = 64 * (2 : ℝ) ^ (2 * d) := byrw [Finset.sum_const, Finset.card_univ, card_vec, nsmul_eq_mul, Nat.cast_pow, Nat.cast_ofNat]; ringrw [Finset.sum_sub_distrib, h64] at h; linarith/-- **Theorem 2 (Unified All-Dimensions Elimination of `E_{2n-3}` for EVERY `2n ≥ 12`, `d ≥ 3`)**:Unites Paper 8 (`d = 3`, `2n = 12`, `iis:2611.00058`, using even-lattice integrality for thethree bent-ball families inside `|W g 0| ≤ 6`) and Paper 9 (`d ≥ 4`, `2n ≥ 14`, holdingunconditionally over ALL real vectors `w ∈ 𝒫_d(8, 8)`):for EVERY `d ≥ 3` (`2n ≥ 12`) and EVERY even-integer vector `w ∈ 𝒫_d(8, 8) ∩ (2ℤ)^{2^{2d}}`,`448 < ∑ z : Vec (2 * d), ((8 : ℝ)^2 - (w z)^2)`. -/theorem e2n_minus_3_all_dimensions_complete {d : ℕ} (hd : 3 ≤ d)(w : Vec (2 * d) → ℝ) (hwP : InPolytope d 8 8 w) (heven : IsEvenInt w) :448 < ∑ z : Vec (2 * d), ((8 : ℝ) ^ 2 - (w z) ^ 2) := byby_cases hd4 : 4 ≤ d· exact e2n_minus_3_real_complete hd4 w hwP· have hd3 : d = 3 := by omegasubst hd3exact e9_complete_elimination w hwP heven/-- **Corollary 2a (`L²` Form of Unified All-Dimensions `E_{2n-3}` Elimination for EVERY `d ≥ 3`)**:For EVERY `d ≥ 3` (`2n ≥ 12`), no even-integer vector `w ∈ 𝒫_d(8, 8) ∩ (2ℤ)^{2^{2d}}` cansatisfy `∑ z, (w z)^2 ≥ 64 * 2^{2d} - 448`. -/theorem e2n_minus_3_all_dimensions_l2 {d : ℕ} (hd : 3 ≤ d)(w : Vec (2 * d) → ℝ) (hwP : InPolytope d 8 8 w) (heven : IsEvenInt w) :∑ z : Vec (2 * d), (w z) ^ 2 < 64 * (2 : ℝ) ^ (2 * d) - 448 := byhave h := e2n_minus_3_all_dimensions_complete hd w hwP hevenhave h64 : ∑ _z : Vec (2 * d), (8 : ℝ) ^ 2 = 64 * (2 : ℝ) ^ (2 * d) := byrw [Finset.sum_const, Finset.card_univ, card_vec, nsmul_eq_mul, Nat.cast_pow, Nat.cast_ofNat]; ringrw [Finset.sum_sub_distrib, h64] at h; linarith/-! ### End-to-End Boolean-Function Elimination Theorems on `𝔽₂^{2n}` -//-- **Theorem 4 (End-to-End Boolean-Function Maiorana–McFarland `E_{2n-3}` Walsh Bound, ALL `2n ≥ 12`)**:For EVERY `n ≥ 6` (`2n ≥ 12`), EVERY bijective `π : Vec n → Vec n`, EVERY `h : Vec n → ZMod 2`,EVERY fiber-aligned codimension-3 flat `E_{2n-3} = 𝔽₂^n × (y₀ + im L_Y)` (`L_Y : Vec (n - 3) →ₗ Vec n`injective) whose `π`-image `π(y₀ + im L_Y) = a₀ + im L_X` is affine, and EVERY balanced Booleanfunction `f : Vec (2*n) → ZMod 2` agreeing with `B(x, y) = x · π(y) + h(y)` outside `E_{2n-3}`,there exists a Walsh frequency `ω` with `|W f ω| ≥ 2^n + 12`. -/theorem maiorana_mcfarland_E2n_minus_3_walsh_lb {n : ℕ} (hn : 6 ≤ n)(π : Vec n → Vec n) (hπ : Function.Bijective π) (h : Vec n → ZMod 2)(y₀ : Vec n) (LY : Vec (n - 3) →ₗ[ZMod 2] Vec n) (hLY : Function.Injective LY)(a₀ : Vec n) (LX : Vec (n - 3) →ₗ[ZMod 2] Vec n) (hLX : Function.Injective LX)(hπ_flat : ∀ y : Vec n, inAffineFlat y₀ LY y ↔ inAffineFlat a₀ LX (π y))(f : Vec (2 * n) → ZMod 2) (hf_bal : IsBalanced f)(hf_out : ∀ z : Vec (2 * n), ¬ inAffineFlat y₀ LY (vecRight z) →f z = maioranaMcFarland π h z) :∃ ω : Vec (2 * n), (2 : ℤ) ^ n + 12 ≤ |W f ω| := by-- Step 1: Rule out `∀ ω, |W f ω| ≤ 2^n + 8` via `maiorana_mcfarland_flat_reduction` +-- `e2n_minus_3_all_dimensions_complete`!have hnot8 : ¬ (∀ ω : Vec (2 * n), |W f ω| ≤ (2 : ℤ) ^ n + 8) := byintro hle8have h8lt : (8 : ℤ) < (2 : ℤ) ^ n := byhave : (2 : ℤ) ^ 6 ≤ (2 : ℤ) ^ n := pow_le_pow_right₀ (by decide) hnnorm_num at this; omegarcases maiorana_mcfarland_flat_reduction (d := n - 3) (by omega)π hπ h y₀ LY hLY a₀ LX hLX hπ_flat f hf_bal hf_out 8 (by norm_num) h8lt hle8 with⟨w, hwP, hwEven, hwDef⟩have hsub : n - (n - 3) = 3 := by omegarw [hsub] at hwP hwDefnorm_num at hwP hwDefhave hgt := e2n_minus_3_all_dimensions_l2 (d := n - 3) (by omega) w hwP hwEvenlinarithpush Not at hnot8rcases hnot8 with ⟨ω, hω_gt⟩-- Step 2: Since `f` is balanced in `2n ≥ 12` variables, `wt f = 2^{2n-1}` is even, so `4 ∣ W f ω`!have hwt_ev : Even (wt f) := byhave hW0 := W_zero_eq frw [hf_bal] at hW0have hpow : (2 : ℤ) ^ (2 * n) = 4 * (2 : ℤ) ^ (2 * n - 2) := bycalc (2 : ℤ) ^ (2 * n) = (2 : ℤ) ^ (2 + (2 * n - 2)) := by congr 1; omega_ = 4 * (2 : ℤ) ^ (2 * n - 2) := by rw [pow_add]; norm_numrefine ⟨2 ^ (2 * n - 2), ?_⟩zify; omegahave h4W : (4 : ℤ) ∣ W f ω := four_dvd_W_of_even_wt (by omega) f hwt_ev ωhave h4M : (4 : ℤ) ∣ (2 : ℤ) ^ n := byhave : (2 : ℤ) ^ n = 4 * (2 : ℤ) ^ (n - 2) := bycalc (2 : ℤ) ^ n = (2 : ℤ) ^ (2 + (n - 2)) := by congr 1; omega_ = 4 * (2 : ℤ) ^ (n - 2) := by rw [pow_add]; norm_numexact ⟨(2 : ℤ) ^ (n - 2), this⟩rcases h4W with ⟨k, hk⟩rcases h4M with ⟨q, hq⟩refine ⟨ω, ?_⟩rw [hk, hq] at hω_gt ⊢rcases le_or_gt 0 (4 * k) with hp | hn'· rw [abs_of_nonneg hp] at hω_gt ⊢; omega· rw [abs_of_neg hn'] at hω_gt ⊢; omega/-- **Corollary 4a (End-to-End Nonlinearity Upper Bound for ALL `2n ≥ 12`)**:Every balanced `E_{2n-3}`-modification of `B(x, y) = x · π(y) + h(y)` (with `π(W_{n-3})` affine)has an explicit affine function `ω · z + c` at Hamming distance `≤ 2^{2n - 1} - 2^{n - 1} - 6`. -/theorem maiorana_mcfarland_E2n_minus_3_nonlinearity_ub {n : ℕ} (hn : 6 ≤ n)(π : Vec n → Vec n) (hπ : Function.Bijective π) (h : Vec n → ZMod 2)(y₀ : Vec n) (LY : Vec (n - 3) →ₗ[ZMod 2] Vec n) (hLY : Function.Injective LY)(a₀ : Vec n) (LX : Vec (n - 3) →ₗ[ZMod 2] Vec n) (hLX : Function.Injective LX)(hπ_flat : ∀ y : Vec n, inAffineFlat y₀ LY y ↔ inAffineFlat a₀ LX (π y))(f : Vec (2 * n) → ZMod 2) (hf_bal : IsBalanced f)(hf_out : ∀ z : Vec (2 * n), ¬ inAffineFlat y₀ LY (vecRight z) →f z = maioranaMcFarland π h z) :∃ (ω : Vec (2 * n)) (c : ZMod 2),distH f (fun z => dotProduct ω z + c) ≤ 2 ^ (2 * n - 1) - 2 ^ (n - 1) - 6 := byrcases maiorana_mcfarland_E2n_minus_3_walsh_lb hn π hπ h y₀ LY hLY a₀ LX hLX hπ_flatf hf_bal hf_out with ⟨ω, hW⟩rcases walsh_lb_implies_affine_distH (by omega) f ω hW with ⟨c, hc⟩exact ⟨ω, c, hc⟩/-- **Corollary 4b (Exact Dobbertin Bound `NLB₁₂ = 2010` for `E₉` at `2n = 12`)**:At `2n = 12` (`n = 6`), every balanced `E₉`-modification of `B(x, y) = x · π(y) + h(y)` (with`π(W₃)` affine) has nonlinearity `≤ 2010 = NLB₁₂`, matching Dobbertin's Conjecture exactly! -/theorem maiorana_mcfarland_E9_dobbertin_12var(π : Vec 6 → Vec 6) (hπ : Function.Bijective π) (h : Vec 6 → ZMod 2)(y₀ : Vec 6) (LY : Vec 3 →ₗ[ZMod 2] Vec 6) (hLY : Function.Injective LY)(a₀ : Vec 6) (LX : Vec 3 →ₗ[ZMod 2] Vec 6) (hLX : Function.Injective LX)(hπ_flat : ∀ y : Vec 6, inAffineFlat y₀ LY y ↔ inAffineFlat a₀ LX (π y))(f : Vec 12 → ZMod 2) (hf_bal : IsBalanced f)(hf_out : ∀ z : Vec 12, ¬ inAffineFlat y₀ LY (vecRight z) →f z = maioranaMcFarland π h z) :∃ (ω : Vec 12) (c : ZMod 2),distH f (fun z => dotProduct ω z + c) ≤ 2010 := bysimpa using maiorana_mcfarland_E2n_minus_3_nonlinearity_ub (n := 6) (by decide)π hπ h y₀ LY hLY a₀ LX hLX hπ_flat f hf_bal hf_out/-- **Corollary 4c (Arbitrary Affine `π(y) = A y + c₀` and Arbitrary `h`, ALL `2n ≥ 12`)**:When `π(y) = A y + c₀` is ANY affine bijection on `𝔽₂^n` and `h : Vec n → ZMod 2` is arbitrary(degree up to `n`), EVERY fiber-aligned codimension-3 flat `E_{2n-3} = 𝔽₂^n × (y₀ + im L_Y)`automatically has affine `π`-image and satisfies `NL(f) ≤ 2^{2n - 1} - 2^{n - 1} - 6`! -/theorem maiorana_mcfarland_affine_pi_E2n_minus_3 {n : ℕ} (hn : 6 ≤ n)(A : Vec n ≃ₗ[ZMod 2] Vec n) (c₀ : Vec n) (h : Vec n → ZMod 2)(y₀ : Vec n) (LY : Vec (n - 3) →ₗ[ZMod 2] Vec n) (hLY : Function.Injective LY)(f : Vec (2 * n) → ZMod 2) (hf_bal : IsBalanced f)(hf_out : ∀ z : Vec (2 * n), ¬ inAffineFlat y₀ LY (vecRight z) →f z = maioranaMcFarland (fun y => A y + c₀) h z) :∃ (ω : Vec (2 * n)) (c : ZMod 2),distH f (fun z => dotProduct ω z + c) ≤ 2 ^ (2 * n - 1) - 2 ^ (n - 1) - 6 := bylet π : Vec n → Vec n := fun y => A y + c₀have hπ : Function.Bijective π := byrefine ⟨fun y₁ y₂ h12 => ?_, fun b => ⟨A.symm (b + c₀), ?_⟩⟩· have hA : A y₁ = A y₂ := byhave h' := congrArg (fun t => t + c₀) h12simpa [π, add_assoc, vec_add_self] using h'exact A.injective hA· simp [π, add_assoc, vec_add_self]let LX : Vec (n - 3) →ₗ[ZMod 2] Vec n := A.toLinearMap.comp LYhave hLX : Function.Injective LX := A.injective.comp hLYhave hπ_flat : ∀ y : Vec n, inAffineFlat y₀ LY y ↔ inAffineFlat (A y₀ + c₀) LX (π y) := byintro yconstructor· rintro ⟨u, rfl⟩refine ⟨u, ?_⟩simp only [π, LX, LinearMap.comp_apply, LinearEquiv.coe_coe, map_add]abel· rintro ⟨u, hu⟩refine ⟨u, ?_⟩have hA : A y = A (y₀ + LY u) := byhave h1 := congrArg (fun t => t + c₀) husimp only [π, LX, LinearMap.comp_apply, LinearEquiv.coe_coe, map_add] at h1 ⊢have h2 : A y + c₀ + c₀ = A y := by rw [add_assoc, vec_add_self, add_zero]have h3 : A y₀ + c₀ + A (LY u) + c₀ = A y₀ + A (LY u) := bycalc A y₀ + c₀ + A (LY u) + c₀= A y₀ + A (LY u) + (c₀ + c₀) := by abel_ = A y₀ + A (LY u) := by rw [vec_add_self, add_zero]calc A y = A y + c₀ + c₀ := h2.symm_ = A y₀ + c₀ + A (LY u) + c₀ := h1_ = A y₀ + A (LY u) := h3exact A.injective hAexact maiorana_mcfarland_E2n_minus_3_nonlinearity_ub hn π hπ hy₀ LY hLY (A y₀ + c₀) LX hLX hπ_flat f hf_bal hf_outend E2nMinus3