op2130_flip_influence_projection
If a function of a longer fair coin tape depends only on injectively selected coordinates, then the total squared influence on the longer tape is its influence on the selected coordinates multiplied by the number of assignments of the unused coordinates.
Statement
theorem op2130_flip_influence_projection (N T : ℕ) (e : Fin N ↪ Fin T) (f : (Fin N → Bool) → ℤ) : (∑ r : Fin T → Bool, ∑ i : Fin T, (f (fun j => r (e j)) - f (fun j => (Function.update r i (!(r i))) (e j))).natAbs ^ 2) = 2 ^ (T - N) * ∑ s : Fin N → Bool, ∑ j : Fin N, (f s - f (Function.update s j (!(s j)))).natAbs ^ 2
- Source
- OP-2130, unused coin coordinates in the signal construction
- Verified
- 24 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext
The proof, explained
The theorem computes the total squared flip influence of a function defined on a longer coin tape of length T that depends only on N coordinates via an injection e : Fin N ↪ Fin T. Flipping any coordinate outside the image of e does not affect the restricted tape, so its influence is zero; this reduces the inner sum of T flip influences to the N selected coordinates for any fixed tape. Since every assignment to the N coordinates extends to exactly 2^(T - N) full tapes, exchanging the double sum factors out this constant multiplicity, leaving 2^(T - N) times the influence sum on the N-coordinate space.
A sum over Fin T whose terms vanish outside the range of an embedding e : Fin N ↪ Fin T reduces to the sum over Fin N.
By symmetry, this is the standard reindexing of a finite sum along an injective map (Fintype.sum_of_injective), since all terms outside the range are zero by hypothesis.
uses
Fintype.sum_of_injectivesymm exact Fintype.sum_of_injective e e.injective (fun j => G (e j)) G hzero (fun j => rfl)
Updating bit e(j) of tape r and pulling back along e is identical to pulling back r along e and updating bit j.
By function extensionality, we evaluate both sides at coordinate k using Function.update_apply. If k = j, then e(k) = e(j) and both sides evaluate to the flipped bit ¬r(e(j)). If k ≠ j, then e(k) ≠ e(j) by injectivity of e, so neither update affects coordinate k and both sides evaluate to r(e(k)).
uses
Function.update_applyfunext k rw [Function.update_apply, Function.update_apply] by_cases hk : k = j · subst hk simp · have hne : e k ≠ e j := fun h => hk (e.injective h) simp [hk, hne]
Flipping any bit outside the range of e has zero influence on the restricted tape, so the sum over all T coordinates restricts to the sum over Fin N.
If i ∉ range(e), then for every j ∈ Fin N we have e(j) ≠ i. Updating r at index i therefore leaves every coordinate r(e(j)) unchanged, so the updated tape pulled back along e is identically r ∘ e. The difference in function values is zero, hence G(i) = 0. Applying op2130_flip_influence_projection_sum_range reduces the sum over Fin T to the sum over Fin N evaluated at e(j).
uses
Function.update_apply,op2130_flip_influence_projection_sum_rangelet s : Fin N → Bool := fun k => r (e k) let G : Fin T → ℕ := fun i => (f s - f (fun j => (Function.update r i (!(r i))) (e j))).natAbs ^ 2 have hrange : (∑ i : Fin T, G i) = ∑ j : Fin N, G (e j) := by apply op2130_flip_influence_projection_sum_range intro i hi have hfun : (fun j => (Function.update r i (!(r i))) (e j)) = (fun j => r (e j)) := by funext j rw [Function.update_apply] have hne : e j ≠ i := by intro h exact hi ⟨j, h⟩ simp [hne] dsimp [G, s] rw [hfun] simp
For a fixed tape r, the total flip influence on Fin T equals the flip influence of the restriction s = r ∘ e on the N selected coordinates.
Using op2130_flip_influence_projection_update_comp, the tape updated at e(j) and pulled back along e coincides with s updated at j. Substituting this into the sum via Finset.sum_congr yields the influence sum over the N selected coordinates.
uses
Finset.sum_congr,op2130_flip_influence_projection_update_compcalc (∑ i : Fin T, (f (fun j => r (e j)) - f (fun j => (Function.update r i (!(r i))) (e j))).natAbs ^ 2) = ∑ i : Fin T, G i := rfl _ = ∑ j : Fin N, G (e j) := hrange _ = ∑ j : Fin N, (f s - f (Function.update s j (!(s j)))).natAbs ^ 2 := by apply Finset.sum_congr rfl intro j _ dsimp [G] rw [op2130_flip_influence_projection_update_comp] _ = ∑ j : Fin N, (f (fun k => r (e k)) - f (Function.update (fun k => r (e k)) j (!((fun k => r (e k)) j)))).natAbs ^ 2 := rfl
Construct an equivalence Φ decomposing any full tape into its restriction to the selected coordinates and its restriction to the unused coordinates.
The coordinate set Fin T partitions into S = range(e) and its complement C. Using the bijection Fin N ≃ S given by Equiv.ofInjective and the canonical decomposition of function types (Equiv.piEquivPiSubtypeProd, Equiv.piCongrLeft, Equiv.prodCongr), we obtain an equivalence Φ : (Fin T → Bool) ≃ (Fin N → Bool) × (C → Bool). We check componentwise using Equiv.piEquivPiSubtypeProd_apply and Equiv.refl_apply that Φ(r) = (r ∘ e, r|_C).
uses
Equiv.ofInjective,Equiv.piCongrLeft,Equiv.piEquivPiSubtypeProd,Equiv.prodCongr,Equiv.refl,Equiv.piEquivPiSubtypeProd_apply,Equiv.refl_applylet S : Set (Fin T) := Set.range e let C := {i : Fin T // i ∉ S} let ee : Fin N ≃ S := Equiv.ofInjective e e.injective let ePre : (S → Bool) ≃ (Fin N → Bool) := (Equiv.piCongrLeft (fun _ : S => Bool) ee).symm let Φ : (Fin T → Bool) ≃ (Fin N → Bool) × (C → Bool) := (Equiv.piEquivPiSubtypeProd (fun i : Fin T => i ∈ S) (fun _ => Bool)).trans (Equiv.prodCongr ePre (Equiv.refl (C → Bool))) have hΦ : ∀ r : Fin T → Bool, Φ r = (fun j => r (e j), fun c => r c.1) := by intro r ext j · simp [Φ, ePre, ee, S, Equiv.piEquivPiSubtypeProd_apply] · change (Equiv.refl (C → Bool)) (fun x => r x.1) j = r j.1 rw [Equiv.refl_apply]
There are T - N unused coordinates, so there are 2^(T - N) assignments to the unused coordinates.
The complement subtype C has cardinality T - N by subtracting the cardinality of range(e) (which equals N by Fintype.card_range and Fintype.card_fin) from the total cardinality T (Fintype.card_subtype_compl). The number of boolean assignments C → Bool is therefore 2^(T - N) by Fintype.card_fun and Fintype.card_bool.
uses
Fintype.card_subtype_compl,Fintype.card_fin,Fintype.card_range,Fintype.card_fun,Fintype.card_boolhave hcardC : Fintype.card C = T - N := by dsimp [C, S] rw [Fintype.card_subtype_compl (p := fun i : Fin T => i ∈ Set.range e)] rw [Fintype.card_fin, Fintype.card_range, Fintype.card_fin] have hcard : Fintype.card (C → Bool) = 2 ^ (T - N) := by rw [Fintype.card_fun, Fintype.card_bool, hcardC]
Summing a function g that depends only on the N selected coordinates over all full tapes yields 2^(T - N) times the sum of g over restricted tapes.
Reindexing the sum over full tapes using the equivalence Φ (Fintype.sum_equiv, Finset.sum_congr) transforms it into a sum over pairs (s, t) ∈ (Fin N → Bool) × (C → Bool). Rewriting this as an iterated sum (Fintype.sum_prod_type), the inner sum over t has constant summand g(s). Summing this constant over all 2^(T - N) assignments gives 2^(T - N) * g(s) (Finset.sum_const, Finset.card_univ, nsmul_eq_mul), which factors out of the sum over s by Finset.mul_sum.
uses
Finset.sum_congr,Fintype.sum_equiv,Fintype.sum_prod_type,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,Finset.mul_sumcalc (∑ r : Fin T → Bool, g (fun j => r (e j))) = ∑ r : Fin T → Bool, g ((Φ r).1) := by apply Finset.sum_congr rfl intro r _ rw [hΦ r] _ = ∑ p : (Fin N → Bool) × (C → Bool), g p.1 := by apply Fintype.sum_equiv Φ (fun r => g ((Φ r).1)) (fun p => g p.1) intro r rfl _ = ∑ s : Fin N → Bool, ∑ t : C → Bool, g s := by rw [Fintype.sum_prod_type] _ = ∑ s : Fin N → Bool, 2 ^ (T - N) * g s := by apply Finset.sum_congr rfl intro s _ rw [Finset.sum_const, Finset.card_univ, hcard, nsmul_eq_mul] simp _ = 2 ^ (T - N) * ∑ s : Fin N → Bool, g s := by rw [Finset.mul_sum]
The total squared flip influence on the longer tape is 2^(T - N) times the total squared flip influence on the selected coordinates.
For each full tape r, op2130_flip_influence_projection_sum_flip reduces the inner sum over all T bit-flips to the sum over the N selected bit-flips. Swapping the order of summation (Finset.sum_comm) allows applying op2130_flip_influence_projection_projection to the sum over r for each coordinate j, extracting the factor 2^(T - N). Distributing 2^(T - N) out of the sum over j (Finset.mul_sum) and swapping the summations over j and s back (Finset.sum_comm) completes the proof.
uses
Finset.sum_congr,op2130_flip_influence_projection_sum_flip,Finset.sum_comm,op2130_flip_influence_projection_projection,Finset.mul_sumlet F : (Fin N → Bool) → Fin N → ℕ := fun s j => (f s - f (Function.update s j (!(s j)))).natAbs ^ 2 calc (∑ r : Fin T → Bool, ∑ i : Fin T, (f (fun j => r (e j)) - f (fun j => (Function.update r i (!(r i))) (e j))).natAbs ^ 2) = ∑ r : Fin T → Bool, ∑ j : Fin N, F (fun k => r (e k)) j := by apply Finset.sum_congr rfl intro r _ exact op2130_flip_influence_projection_sum_flip N T e f r _ = ∑ j : Fin N, ∑ r : Fin T → Bool, F (fun k => r (e k)) j := by rw [Finset.sum_comm] _ = ∑ j : Fin N, 2 ^ (T - N) * ∑ s : Fin N → Bool, F s j := by apply Finset.sum_congr rfl intro j _ exact op2130_flip_influence_projection_projection N T e (fun s => F s j) _ = 2 ^ (T - N) * ∑ j : Fin N, ∑ s : Fin N → Bool, F s j := by rw [Finset.mul_sum] _ = 2 ^ (T - N) * ∑ s : Fin N → Bool, ∑ j : Fin N, F s j := by rw [Finset.sum_comm]
Equiv.piCongrLeft- An equivalence between domain index types induces an equivalence between dependent function types by reindexing.
Equiv.piEquivPiSubtypeProd- Functions on a type are naturally equivalent to pairs of functions on a subtype and its complement.
Equiv.piEquivPiSubtypeProd_apply- Restricting a function to a subtype and its complement gives the two components of the canonical product equivalence.
Equiv.prodCongr- Two equivalences combine componentwise into an equivalence between product types.
Equiv.refl- The identity bijection from a type to itself.
Equiv.refl_apply- The identity equivalence evaluates to its argument.
Equiv.ofInjective- An injective map defines an equivalence between its domain and its range.
Finset.card_univ- The universal finset of a finite type has cardinality equal to the type's cardinality.
Finset.mul_sum- Left multiplication distributes over a finite sum.
Finset.sum_comm- Double sums over finite sets can be swapped.
Finset.sum_congr- Two finite sums are equal if their index sets are equal and their summands agree on every element.
Finset.sum_const- Summing a constant over a finite set equals the cardinality of the set times the constant.
Fintype.card_bool- The type Bool has cardinality 2.
Fintype.card_fin- The standard finite set Fin n has cardinality n.
Fintype.card_fun- The number of functions between two finite types is the target cardinality raised to the source cardinality.
Fintype.card_range- The image of an embedding has cardinality equal to the cardinality of the domain.
Fintype.card_subtype_compl- The cardinality of the complement subtype is the cardinality of the whole type minus the cardinality of the subtype.
Fintype.sum_prod_type- A sum over a finite product type equals the iterated sum over each component.
Fintype.sum_equiv- A finite sum can be reindexed along a bijection of index types.
Fintype.sum_of_injective- The sum of a function over a finite type equals the sum of an extended function over a larger finite type via an injective map, provided the extended function is zero outside the image.
Function.update_apply- An updated function evaluates to the replacement value at the updated input, and to the original value elsewhere.
nsmul_eq_mul- Natural number scalar multiplication in a semiring equals multiplication.
op2130_flip_influence_projection_projection- Summing a function depending only on injectively selected coordinates over all 2^T tapes gives 2^(T - N) times the sum over all 2^N restricted tapes.
op2130_flip_influence_projection_sum_flip- For a fixed tape, the sum of squared flip differences over all T coordinates equals the sum of squared flip differences of the restricted tape over the N selected coordinates.
op2130_flip_influence_projection_sum_range- A sum over Fin T whose terms vanish outside the range of an embedding e : Fin N ↪ Fin T equals the sum over Fin N pulled back along e.
op2130_flip_influence_projection_update_comp- Flipping bit e(j) in a full tape and pulling back along e equals pulling back the tape and flipping bit j.
- On paper, the decomposition of the T-bit tape into the N selected coordinates and the T - N unused coordinates is treated as an obvious identification; the Lean proof explicitly constructs this equivalence Φ of function types and checks its components.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
private lemma op2130_flip_influence_projection_sum_range (N T : ℕ) (e : Fin N ↪ Fin T) (G : Fin T → ℕ) (hzero : ∀ i, i ∉ Set.range e → G i = 0) : (∑ i : Fin T, G i) = ∑ j : Fin N, G (e j) := by symm exact Fintype.sum_of_injective e e.injective (fun j => G (e j)) G hzero (fun j => rfl)private lemma op2130_flip_influence_projection_update_comp (N T : ℕ) (e : Fin N ↪ Fin T) (r : Fin T → Bool) (j : Fin N) : (fun k => (Function.update r (e j) (!(r (e j)))) (e k)) = Function.update (fun k => r (e k)) j (!(r (e j))) := by funext k rw [Function.update_apply, Function.update_apply] by_cases hk : k = j · subst hk simp · have hne : e k ≠ e j := fun h => hk (e.injective h) simp [hk, hne]private lemma op2130_flip_influence_projection_sum_flip (N T : ℕ) (e : Fin N ↪ Fin T) (f : (Fin N → Bool) → ℤ) (r : Fin T → Bool) : (∑ i : Fin T, (f (fun j => r (e j)) - f (fun j => (Function.update r i (!(r i))) (e j))).natAbs ^ 2) = ∑ j : Fin N, (f (fun k => r (e k)) - f (Function.update (fun k => r (e k)) j (!((fun k => r (e k)) j)))).natAbs ^ 2 := by let s : Fin N → Bool := fun k => r (e k) let G : Fin T → ℕ := fun i => (f s - f (fun j => (Function.update r i (!(r i))) (e j))).natAbs ^ 2 have hrange : (∑ i : Fin T, G i) = ∑ j : Fin N, G (e j) := by apply op2130_flip_influence_projection_sum_range intro i hi have hfun : (fun j => (Function.update r i (!(r i))) (e j)) = (fun j => r (e j)) := by funext j rw [Function.update_apply] have hne : e j ≠ i := by intro h exact hi ⟨j, h⟩ simp [hne] dsimp [G, s] rw [hfun] simp calc (∑ i : Fin T, (f (fun j => r (e j)) - f (fun j => (Function.update r i (!(r i))) (e j))).natAbs ^ 2) = ∑ i : Fin T, G i := rfl _ = ∑ j : Fin N, G (e j) := hrange _ = ∑ j : Fin N, (f s - f (Function.update s j (!(s j)))).natAbs ^ 2 := by apply Finset.sum_congr rfl intro j _ dsimp [G] rw [op2130_flip_influence_projection_update_comp] _ = ∑ j : Fin N, (f (fun k => r (e k)) - f (Function.update (fun k => r (e k)) j (!((fun k => r (e k)) j)))).natAbs ^ 2 := rflprivate lemma op2130_flip_influence_projection_projection (N T : ℕ) (e : Fin N ↪ Fin T) (g : (Fin N → Bool) → ℕ) : (∑ r : Fin T → Bool, g (fun j => r (e j))) = 2 ^ (T - N) * ∑ s : Fin N → Bool, g s := by let S : Set (Fin T) := Set.range e let C := {i : Fin T // i ∉ S} let ee : Fin N ≃ S := Equiv.ofInjective e e.injective let ePre : (S → Bool) ≃ (Fin N → Bool) := (Equiv.piCongrLeft (fun _ : S => Bool) ee).symm let Φ : (Fin T → Bool) ≃ (Fin N → Bool) × (C → Bool) := (Equiv.piEquivPiSubtypeProd (fun i : Fin T => i ∈ S) (fun _ => Bool)).trans (Equiv.prodCongr ePre (Equiv.refl (C → Bool))) have hΦ : ∀ r : Fin T → Bool, Φ r = (fun j => r (e j), fun c => r c.1) := by intro r ext j · simp [Φ, ePre, ee, S, Equiv.piEquivPiSubtypeProd_apply] · change (Equiv.refl (C → Bool)) (fun x => r x.1) j = r j.1 rw [Equiv.refl_apply] have hcardC : Fintype.card C = T - N := by dsimp [C, S] rw [Fintype.card_subtype_compl (p := fun i : Fin T => i ∈ Set.range e)] rw [Fintype.card_fin, Fintype.card_range, Fintype.card_fin] have hcard : Fintype.card (C → Bool) = 2 ^ (T - N) := by rw [Fintype.card_fun, Fintype.card_bool, hcardC] calc (∑ r : Fin T → Bool, g (fun j => r (e j))) = ∑ r : Fin T → Bool, g ((Φ r).1) := by apply Finset.sum_congr rfl intro r _ rw [hΦ r] _ = ∑ p : (Fin N → Bool) × (C → Bool), g p.1 := by apply Fintype.sum_equiv Φ (fun r => g ((Φ r).1)) (fun p => g p.1) intro r rfl _ = ∑ s : Fin N → Bool, ∑ t : C → Bool, g s := by rw [Fintype.sum_prod_type] _ = ∑ s : Fin N → Bool, 2 ^ (T - N) * g s := by apply Finset.sum_congr rfl intro s _ rw [Finset.sum_const, Finset.card_univ, hcard, nsmul_eq_mul] simp _ = 2 ^ (T - N) * ∑ s : Fin N → Bool, g s := by rw [Finset.mul_sum]theorem op2130_flip_influence_projection (N T : ℕ) (e : Fin N ↪ Fin T) (f : (Fin N → Bool) → ℤ) : (∑ r : Fin T → Bool, ∑ i : Fin T, (f (fun j => r (e j)) - f (fun j => (Function.update r i (!(r i))) (e j))).natAbs ^ 2) = 2 ^ (T - N) * ∑ s : Fin N → Bool, ∑ j : Fin N, (f s - f (Function.update s j (!(s j)))).natAbs ^ 2 := by let F : (Fin N → Bool) → Fin N → ℕ := fun s j => (f s - f (Function.update s j (!(s j)))).natAbs ^ 2 calc (∑ r : Fin T → Bool, ∑ i : Fin T, (f (fun j => r (e j)) - f (fun j => (Function.update r i (!(r i))) (e j))).natAbs ^ 2) = ∑ r : Fin T → Bool, ∑ j : Fin N, F (fun k => r (e k)) j := by apply Finset.sum_congr rfl intro r _ exact op2130_flip_influence_projection_sum_flip N T e f r _ = ∑ j : Fin N, ∑ r : Fin T → Bool, F (fun k => r (e k)) j := by rw [Finset.sum_comm] _ = ∑ j : Fin N, 2 ^ (T - N) * ∑ s : Fin N → Bool, F s j := by apply Finset.sum_congr rfl intro j _ exact op2130_flip_influence_projection_projection N T e (fun s => F s j) _ = 2 ^ (T - N) * ∑ j : Fin N, ∑ s : Fin N → Bool, F s j := by rw [Finset.mul_sum] _ = 2 ^ (T - N) * ∑ s : Fin N → Bool, ∑ j : Fin N, F s j := by rw [Finset.sum_comm]