The proof
Erdős problem 579
Let . If is sufficiently large and is a graph on vertices with no (the octahedron) and at least edges, must contain an independent set of size ? This is a problem of Erdős, Hajnal, Sós, and Szemerédi [EHSS83]. It is **open**; they proved the statement for (seeerdos_579.variants.ehss_large_delta), and the
difficulty is to push the edge-density threshold down to an arbitrary .
Here is the complete tripartite graph with all parts of size , encoded as
completeMultipartiteGraph (fun _ : Fin 3 => Fin 2); "contains no " is expressed
via SimpleGraph.Free.
Source
Main.lean · 18336 lines · 810.0 kB
Showing the first 500 of 18336 lines. The whole file is 810.0 kB; download it to read the rest.
/-
Upstream source notice
Selected upstream portions are modified from TCSlib
https://github.com/Shilun-Allan-Li/tcslib
commit a8c77c605cb9843b3eaebe11253c4eef15ded3f7, and FABL
https://github.com/Polarnova/FABL
commit 164f830312946ccac6e7fdc7bb9493f0149e820d.
Their original source notices are retained below. Changes include
the Lean 4.33.1/Mathlib port, selection of needed declarations,
expanded notation and explicit replacement of source automation.
The following Apache 2.0 license applies to those upstream portions.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/
end Bounty
section
/- The reverse-mixing closure is copied as source; no TCSlib/FABL import is used. -/
open scoped BigOperators Topology Classical
namespace BooleanAnalysis
variable {n : ℕ}
-- TCSlib.BooleanAnalysis.Basic:62
/-- Defines the Boolean hypercube `{0,1}ⁿ`.
**Source:** [OD14, §1.1]. -/
abbrev BoolCube (n : ℕ) := Fin n → Bool
-- TCSlib.BooleanAnalysis.Basic:67
/-- Defines a real-valued Boolean function `f : {0,1}ⁿ → ℝ`.
**Source:** [OD14, §1.1]. -/
abbrev BooleanFunc (n : ℕ) := BoolCube n → ℝ
-- TCSlib.BooleanAnalysis.Basic:76
/-- Defines the uniform probability weight `2⁻ⁿ` on each point of `{0,1}ⁿ`.
**Source:** [OD14, §1.1]. -/
noncomputable def uniformWeight (n : ℕ) : ℝ := (2 : ℝ)⁻¹ ^ n
-- TCSlib.BooleanAnalysis.Basic:81
/-- Expectation of `f` under the uniform measure on `{0,1}ⁿ`.
`𝔼[f] = 2⁻ⁿ · ∑_{x ∈ {0,1}ⁿ} f(x)`.
**Source:** [OD14, §1.1]. -/
noncomputable def expect (f : BooleanFunc n) : ℝ :=
uniformWeight n * ∑ x : BoolCube n, f x
-- TCSlib.BooleanAnalysis.Basic:88
/-- The Boolean-cube expectation is Mathlib's uniform expectation on the finite cube.
**Source:** [OD14, §1.1]; Mathlib, `Fintype.expect_eq_sum_div_card`. -/
lemma expect_eq_fintypeExpect (f : BooleanFunc n) : expect f = 𝔼 x, f x := by
rw [Fintype.expect_eq_sum_div_card]
unfold expect uniformWeight
simp [Fintype.card_pi, Fintype.card_bool, div_eq_inv_mul]
-- TCSlib.BooleanAnalysis.Basic:96
/-- The `L²` inner product on Boolean functions with respect to the uniform measure:
`⟪f, g⟫ = 𝔼[f · g] = 2⁻ⁿ · ∑_x f(x) g(x)`.
**Source:** [OD14, §1.2]. -/
noncomputable def innerProduct (f g : BooleanFunc n) : ℝ :=
expect (fun x ↦ f x * g x)
-- TCSlib.BooleanAnalysis.Basic:138
/-- Converts a `Bool` to `{-1, 1} ⊆ ℝ`: `false ↦ 1`, `true ↦ -1`.
**Source:** [OD14, §1.1]. -/
def boolToSign (b : Bool) : ℝ := if b then -1 else 1
lemma boolToSign_false : boolToSign false = 1 := rfl
lemma boolToSign_true : boolToSign true = -1 := rfl
-- TCSlib.BooleanAnalysis.Basic:149
lemma boolToSign_sq (b : Bool) : boolToSign b ^ 2 = 1 := by
cases b <;> simp [boolToSign]
-- TCSlib.BooleanAnalysis.Basic:153
lemma boolToSign_mul_self (b : Bool) : boolToSign b * boolToSign b = 1 := by
cases b <;> simp [boolToSign]
-- TCSlib.BooleanAnalysis.Basic:157
/-- The Walsh–Fourier character `χ_S : {0,1}ⁿ → ℝ` associated to a set `S ⊆ [n]`.
`χ_S(x) = ∏_{i ∈ S} (-1)^{x_i}`.
This forms an orthonormal basis for `L²({0,1}ⁿ, uniform)`.
**Source:** [OD14, §1.2]. -/
noncomputable def chiS (S : Finset (Fin n)) : BooleanFunc n :=
fun x ↦ ∏ i ∈ S, boolToSign (x i)
-- TCSlib.BooleanAnalysis.Basic:168
/-- The character `χ_∅` is the constant function `1`. -/
lemma chiS_empty : chiS ((∅ : Finset (Fin n))) = fun _ ↦ 1 := by
ext x; simp [chiS]
-- TCSlib.BooleanAnalysis.Basic:173
/-- The character `χ_{i}` for a singleton `{i}` equals `(-1)^{x_i}`. -/
lemma chiS_singleton (i : Fin n) (x : BoolCube n) :
chiS ({i}) x = boolToSign (x i) := by
simp [chiS]
-- TCSlib.BooleanAnalysis.Basic:179
/-- Walsh characters take values in `{-1, 1}`. -/
lemma chiS_sq_eq_one (S : Finset (Fin n)) (x : BoolCube n) :
chiS (S) x ^ 2 = 1 := by
simp only [chiS]
induction S using Finset.induction with
| empty => simp
| insert a s ha ih =>
rw [Finset.prod_insert ha, mul_pow, boolToSign_sq, one_mul]
exact ih
-- TCSlib.BooleanAnalysis.Basic:195
/-- The pointwise product of two Walsh characters is another Walsh character (up to sign),
specifically `χ_S · χ_T = χ_{S Δ T}` where `Δ` denotes symmetric difference. -/
lemma chiS_mul_chiS (S T : Finset (Fin n)) (x : BoolCube n) :
chiS (S) x * chiS (T) x = chiS (symmDiff S T) x := by
simp only [chiS]
-- Decompose: S = (S \ T) ∪ (S ∩ T), T = (T \ S) ∪ (T ∩ S)
have hS : ∏ i ∈ S, boolToSign (x i) =
(∏ i ∈ S \ T, boolToSign (x i)) * ∏ i ∈ S ∩ T, boolToSign (x i) := by
conv_lhs => rw [← Finset.sdiff_union_inter S T]
apply Finset.prod_union
simp only [Finset.disjoint_left, Finset.mem_sdiff, Finset.mem_inter, not_and]
tauto
have hT : ∏ i ∈ T, boolToSign (x i) =
(∏ i ∈ T \ S, boolToSign (x i)) * ∏ i ∈ S ∩ T, boolToSign (x i) := by
conv_lhs => rw [← Finset.sdiff_union_inter T S]
rw [Finset.inter_comm T S]
apply Finset.prod_union
simp only [Finset.disjoint_left, Finset.mem_sdiff, Finset.mem_inter, not_and]
tauto
-- The intersection product squares to 1
have hcancel : (∏ i ∈ S ∩ T, boolToSign (x i)) * ∏ i ∈ S ∩ T, boolToSign (x i) = 1 := by
rw [← Finset.prod_mul_distrib]; simp [boolToSign_mul_self]
rw [hS, hT, symmDiff_def, Finset.sup_eq_union, Finset.prod_union disjoint_sdiff_sdiff]
-- Goal: (A * P) * (B * P) = A * B where P² = 1
set P := ∏ i ∈ S ∩ T, boolToSign (x i)
set A := ∏ i ∈ S \ T, boolToSign (x i)
set B := ∏ i ∈ T \ S, boolToSign (x i)
calc A * P * (B * P) = A * B * (P * P) := by ring
_ = A * B * 1 := by rw [hcancel]
_ = A * B := by ring
-- TCSlib.BooleanAnalysis.Basic:228
/-- The Fourier–Walsh coefficient of `f` at frequency `S`:
`f̂(S) = ⟪f, χ_S⟫ = 2⁻ⁿ · ∑_x f(x) · χ_S(x)`.
**Source:** [OD14, §1.2]. -/
noncomputable def fourierCoeff (f : BooleanFunc n) (S : Finset (Fin n)) : ℝ :=
innerProduct f (chiS S)
-- TCSlib.BooleanAnalysis.Basic:244
/-- Key identity: `∑_{S ⊆ [n]} ∏_{i∈S} c_i = ∏_i (1 + c_i)`.
Used via `Finset.prod_one_add`. -/
private lemma sum_prod_subset_eq_prod_one_add (c : Fin n → ℝ) :
∑ S : Finset (Fin n), ∏ i ∈ S, c i =
∏ i : Fin n, (1 + c i) := by
-- Use Finset.prod_one_add: ∏_{i∈s} (1 + f i) = ∑_{t∈s.powerset} ∏_{i∈t} f i
rw [Finset.prod_one_add Finset.univ]
-- Now RHS = ∑ t ∈ Finset.univ.powerset, ∏ i ∈ t, c i
-- Reindex: Finset.univ.powerset ≅ all Finset (Fin n) via id
apply Finset.sum_nbij id
· intro t _; exact Finset.mem_powerset.mpr (Finset.subset_univ t)
· intro t₁ _ t₂ _ h; exact h
· intro t ht; exact ⟨t, Finset.mem_univ t, rfl⟩
· intro t _; rfl
-- TCSlib.BooleanAnalysis.Basic:259
/-- The sum of `χ_S(x) * χ_S(y)` over all `S ⊆ [n]` equals `2ⁿ` if `x = y`, else `0`.
This is the completeness kernel for the Walsh basis. -/
private lemma sum_chiS_mul_eq (x y : BoolCube n) :
∑ S : Finset (Fin n), chiS S x * chiS S y = if x = y then (2 : ℝ) ^ n else 0 := by
simp only [chiS, ← Finset.prod_mul_distrib]
rw [sum_prod_subset_eq_prod_one_add]
split_ifs with hxy
· subst hxy; simp only [boolToSign_mul_self]
simp only [Finset.prod_const, Finset.card_univ, Fintype.card_fin]
norm_num
· obtain ⟨i, hi⟩ := Function.ne_iff.mp hxy
apply Finset.prod_eq_zero (Finset.mem_univ i)
have : boolToSign (x i) * boolToSign (y i) = -1 := by
cases hxi : x i <;> cases hyi : y i <;> simp_all [boolToSign]
simp [this]
-- TCSlib.BooleanAnalysis.Basic:275
/-- **Walsh Expansion**: every Boolean function `f : {0,1}ⁿ → ℝ` can be written as
`f(x) = ∑_{S ⊆ [n]} f̂(S) · χ_S(x)`.
This is the Fourier inversion formula for the uniform measure on `{0,1}ⁿ`.
**Source:** [OD14, §1.3]. -/
theorem walsh_expansion (f : BooleanFunc n) (x : BoolCube n) :
f x = ∑ S : Finset (Fin n), fourierCoeff f S * chiS S x := by
simp only [fourierCoeff, innerProduct, expect, uniformWeight]
-- Goal: f x = ∑_S (2⁻ⁿ * ∑_y f(y) * χ_S(y)) * χ_S(x)
-- Proof: show both sides equal 2⁻ⁿ * ∑_y f(y) * ∑_S χ_S(y) * χ_S(x)
-- then use the completeness kernel
symm
calc ∑ S : Finset (Fin n), ((2:ℝ)⁻¹^n * ∑ y, f y * chiS S y) * chiS S x
= (2:ℝ)⁻¹^n * ∑ y : BoolCube n, ∑ S : Finset (Fin n), f y * (chiS S y * chiS S x) := by
-- Move 2⁻¹^n outside by rearranging: ∑_S (a * b_S) * c_S = a * ∑_S b_S * c_S,
-- then swap sum order and distribute f y
have step1 : ∑ S : Finset (Fin n), ((2:ℝ)⁻¹^n * ∑ y, f y * chiS S y) * chiS S x =
(2:ℝ)⁻¹^n * ∑ S : Finset (Fin n), (∑ y, f y * chiS S y) * chiS S x := by
rw [Finset.mul_sum]
apply Finset.sum_congr rfl; intro S _; ring
have step2 : ∑ S : Finset (Fin n), (∑ y, f y * chiS S y) * chiS S x =
∑ y : BoolCube n, ∑ S : Finset (Fin n), f y * (chiS S y * chiS S x) := by
simp_rw [Finset.sum_mul]
rw [Finset.sum_comm]
apply Finset.sum_congr rfl; intro y _
apply Finset.sum_congr rfl; intro S _; ring
rw [step1, step2]
_ = (2:ℝ)⁻¹^n * ∑ y : BoolCube n, f y * (∑ S, chiS S y * chiS S x) := by
congr 1
apply Finset.sum_congr rfl; intro y _
rw [← Finset.mul_sum]
_ = (2:ℝ)⁻¹^n * ∑ y : BoolCube n, f y * (if y = x then (2:ℝ)^n else 0) := by
simp_rw [sum_chiS_mul_eq]
_ = (2:ℝ)⁻¹^n * (f x * (2:ℝ)^n) := by
congr 1
simp [Finset.sum_ite_eq', Finset.mem_univ]
_ = f x := by
rw [← mul_assoc, mul_comm ((2:ℝ)⁻¹^n) (f x), mul_assoc, ← mul_pow,
inv_mul_cancel₀ (by norm_num : (2:ℝ) ≠ 0), one_pow, mul_one]
-- TCSlib.BooleanAnalysis.Basic:333
/-- Summing `χ_S` over the entire hypercube gives `2ⁿ` if `S = ∅`, else `0`. -/
private lemma sum_chiS (S : Finset (Fin n)) :
∑ x : BoolCube n, chiS S x = if S = ∅ then 2 ^ n else 0 := by
simp only [chiS]
by_cases hS : S = ∅
· subst hS; simp [Fintype.card_pi, Fintype.card_bool]
· simp only [hS, if_false]
have factored : ∑ x : BoolCube n, ∏ i ∈ S, boolToSign (x i) =
∑ x : BoolCube n, ∏ i : Fin n, (if i ∈ S then boolToSign (x i) else 1) := by
congr 1; ext x; rw [← Finset.prod_filter]; simp
rw [factored]
-- Goal: ∑ x : BoolCube n, ∏ i : Fin n, g i (x i) = 0
-- where g i b = if i ∈ S then boolToSign b else 1
-- Factor: = ∏ i : Fin n, ∑ b : Bool, g i b (by Fintype.prod_sum reversed)
rw [show ∑ x : BoolCube n, ∏ i : Fin n, (if i ∈ S then boolToSign (x i) else 1) =
∏ i : Fin n, ∑ b : Bool, (if i ∈ S then boolToSign b else 1) from
(Fintype.prod_sum (fun i b => if i ∈ S then boolToSign b else 1)).symm]
obtain ⟨i, hi⟩ := Finset.nonempty_iff_ne_empty.mpr hS
apply Finset.prod_eq_zero (Finset.mem_univ i)
simp [hi, boolToSign]
-- TCSlib.BooleanAnalysis.Basic:354
/-- **Orthonormality**: `⟪χ_S, χ_T⟫ = [S = T]`.
The Walsh characters form an orthonormal system in `L²({0,1}ⁿ, uniform)`.
**Source:** [OD14, §1.2]. -/
theorem fourier_coeff_chi (S T : Finset (Fin n)) :
innerProduct (chiS S) (chiS T) = if S = T then 1 else 0 := by
simp only [innerProduct, expect, uniformWeight]
have step : ∑ x : BoolCube n, chiS S x * chiS T x =
∑ x : BoolCube n, chiS (symmDiff S T) x := by
congr 1; ext x; exact chiS_mul_chiS S T x
rw [step, sum_chiS]
by_cases hst : S = T
· -- S = T: symmDiff S T = ∅
subst hst
simp only [symmDiff_self, Finset.bot_eq_empty, ↓reduceIte]
rw [← mul_pow]; norm_num
· -- S ≠ T: symmDiff S T ≠ ∅
have hd : symmDiff S T ≠ ∅ := by
intro h
apply hst
have : symmDiff S T = ⊥ := by rwa [Finset.bot_eq_empty]
exact symmDiff_eq_bot.mp this
simp [hd, hst]
-- TCSlib.BooleanAnalysis.Basic:385
/-- **Parseval's Identity**: `‖f‖² = ∑_{S ⊆ [n]} f̂(S)²`.
The sum of squared Fourier coefficients equals the squared `L²` norm.
**Source:** [OD14, §1.4]. -/
theorem parseval (f : BooleanFunc n) :
innerProduct f f = ∑ S : Finset (Fin n), fourierCoeff f S ^ 2 := by
-- Expand f = ∑_S f̂(S) χ_S and use bilinearity + orthonormality
have expand : innerProduct f f =
∑ S : Finset (Fin n), ∑ T : Finset (Fin n),
fourierCoeff f S * fourierCoeff f T * innerProduct (chiS S) (chiS T) := by
-- Expand innerProduct and uniformWeight first so f x * f x becomes visible
simp_rw [innerProduct, expect, uniformWeight]
-- Now rewrite f(x)*f(x) using walsh_expansion
simp_rw [show ∀ x : BoolCube n, f x * f x =
(∑ S : Finset (Fin n), fourierCoeff f S * chiS S x) *
(∑ T : Finset (Fin n), fourierCoeff f T * chiS T x) from fun x => byProvenance
- Proof SHA-256
- sha256:c210bfcb2e4f1d9acf56e210d8800f831868783ff949d964033bb9cda6b684b2
- Solver
- Jordan
- Attribution
- conjectures.io