Buckets:
| import Mathlib.Algebra.Order.BigOperators.Expect | |
| import Mathlib.Basic.Real.Basic | |
| import Mathlib.Tactic.Linarith | |
| import Mathlib.Tactic.Ring | |
| import OAI.Computability.UniqueGames.PCP.InitialGraphLemmas | |
| import OAI.Computability.UniqueGames.PCP.PoweringLabelsLemmas | |
| import OAI.Computability.UniqueGames.PCP.SourceNoiseParameterLemmas | |
| namespace OAI | |
| section | |
| /-! | |
| Pull a graph predicate back through a surjective label decoder. This preserves | |
| every rejection count after decoding. A concrete section embeds the initial | |
| eight-label graph into the fixed 64-label alphabet used throughout amplification. | |
| -/ | |
| namespace UniqueGamesTheorem.Foundations.PCP.AlphabetRetraction | |
| variable {V E A B : Type*} | |
| def pullback (G : ConstraintGraph V E A) (decode : B → A) : ConstraintGraph V E B where | |
| reverse := G.reverse | |
| reverse_involutive := G.reverse_involutive | |
| tail := G.tail | |
| accepts := fun e b c => G.accepts e (decode b) (decode c) | |
| reverse_accepts := fun e b c => G.reverse_accepts e (decode b) (decode c) | |
| @[simp] theorem edgeSatisfied_pullback (G : ConstraintGraph V E A) | |
| (decode : B → A) (labeling : V → B) (e : E) : | |
| (pullback G decode).edgeSatisfied labeling e = | |
| G.edgeSatisfied (decode ∘ labeling) e := rfl | |
| @[simp] theorem rejectionCount_pullback [Fintype E] (G : ConstraintGraph V E A) | |
| (decode : B → A) (labeling : V → B) : | |
| (pullback G decode).rejectionCount labeling = | |
| G.rejectionCount (decode ∘ labeling) := rfl | |
| theorem satisfiable_pullback_iff (G : ConstraintGraph V E A) | |
| (decode : B → A) (encode : A → B) (sectionLaw : ∀ a, decode (encode a) = a) : | |
| (pullback G decode).Satisfiable ↔ G.Satisfiable := by | |
| constructor | |
| · rintro ⟨labeling, h⟩ | |
| exact ⟨decode ∘ labeling, h⟩ | |
| · rintro ⟨labeling, h⟩ | |
| refine ⟨encode ∘ labeling, fun e => ?_⟩ | |
| change G.accepts e (decode (encode (labeling (G.tail e)))) | |
| (decode (encode (labeling (G.head e)))) = true | |
| simpa only [ConstraintGraph.edgeSatisfied, sectionLaw] using h e | |
| abbrev Label64 := QueryIncidence.Label 6 | |
| def decode64 (label : Label64) : InitialGraph.Label := (label 0, label 1, label 2) | |
| def encode64 (label : InitialGraph.Label) : Label64 := | |
| fun i => if i = 0 then label.1 else if i = 1 then label.2.1 else label.2.2 | |
| @[simp] theorem decode_encode64 (label : InitialGraph.Label) : | |
| decode64 (encode64 label) = label := by | |
| rcases label with ⟨a, b, c⟩ | |
| rfl | |
| def initial64 (F : UniqueGamesTheorem.Foundations.Target.Formula) : | |
| ConstraintGraph (InitialGraph.CompactVertex F) (InitialGraph.CompactDart F) Label64 := | |
| pullback (InitialGraph.build F) decode64 | |
| theorem initial64_satisfiable_iff (F : UniqueGamesTheorem.Foundations.Target.Formula) : | |
| (initial64 F).Satisfiable ↔ F.Satisfiable := | |
| (satisfiable_pullback_iff (InitialGraph.build F) decode64 encode64 decode_encode64).trans | |
| (InitialGraph.build_satisfiable_iff F) | |
| theorem initial64_alphabet : Fintype.card Label64 = 64 := | |
| QueryIncidence.six_query_alphabet | |
| theorem initial64_inverse_size_gap (F : UniqueGamesTheorem.Foundations.Target.Formula) | |
| (unsat : ¬ F.Satisfiable) (labeling : InitialGraph.CompactVertex F → Label64) : | |
| Fintype.card (InitialGraph.CompactDart F) ≤ | |
| (6 * F.clauses.length + 1) * (initial64 F).rejectionCount labeling := | |
| InitialGraph.build_inverse_size_gap F unsat (decode64 ∘ labeling) | |
| end UniqueGamesTheorem.Foundations.PCP.AlphabetRetraction | |
| end | |
| section | |
| namespace UniqueGamesTheorem.Foundations.PCP.SpectralReturn | |
| open PoweringWalks | |
| open scoped BigOperators | |
| noncomputable section | |
| def mean {A : Type*} [Fintype A] (f : A → ℝ) : ℝ := Finset.univ.expect f | |
| def energy {A : Type*} [Fintype A] (f : A → ℝ) : ℝ := mean (fun x => (f x) ^ 2) | |
| def correlation {A : Type*} [Fintype A] (f g : A → ℝ) : ℝ := | |
| mean (fun x => f x * g x) | |
| def averagingOperator {V D : Type*} [Fintype D] (G : PortGraph V D) | |
| (f : V → ℝ) (v : V) : ℝ := Finset.univ.expect (fun d => f (G.rot (v, d)).1) | |
| def iterateOperator {V D : Type*} [Fintype D] (G : PortGraph V D) : | |
| Nat → (V → ℝ) → (V → ℝ) | |
| | 0, f => f | |
| | n + 1, f => averagingOperator G (iterateOperator G n f) | |
| def edgeProfile {V D : Type*} [Fintype D] (bad : V × D → Bool) (v : V) : ℝ := | |
| Finset.univ.expect (fun d => if bad (v, d) then 1 else 0) | |
| def edgeDensity {V D : Type*} [Fintype V] [Fintype D] (bad : V × D → Bool) : ℝ := | |
| mean (edgeProfile bad) | |
| def markedStep {V D : Type*} [Fintype D] (G : PortGraph V D) | |
| (bad : V × D → Bool) (f : V → ℝ) (v : V) : ℝ := | |
| Finset.univ.expect (fun d => if bad (v, d) then f (G.rot (v, d)).1 else 0) | |
| def returnMass {V D : Type*} [Fintype V] [Fintype D] | |
| (G : PortGraph V D) (bad : V × D → Bool) (gap : Nat) : ℝ := | |
| mean (markedStep G bad (iterateOperator G gap (edgeProfile bad))) | |
| structure SpectralCertificate {V D : Type*} [Fintype V] [Fintype D] | |
| (G : PortGraph V D) (lambda : ℝ) : Prop where | |
| nonnegative : 0 ≤ lambda | |
| lt_one : lambda < 1 | |
| contraction : ∀ f : V → ℝ, mean f = 0 → | |
| energy (averagingOperator G f) ≤ lambda ^ 2 * energy f | |
| section Averages | |
| variable {A B : Type*} [Fintype A] [Fintype B] | |
| theorem mean_eq_sum_div_card (f : A → ℝ) : | |
| mean f = (∑ x, f x) / (Fintype.card A : ℝ) := | |
| Fintype.expect_eq_sum_div_card f | |
| theorem mean_equiv (e : A ≃ B) (f : B → ℝ) : | |
| mean (fun x => f (e x)) = mean f := | |
| Fintype.expect_equiv e _ _ (fun _ => rfl) | |
| theorem mean_prod (f : A × B → ℝ) : | |
| mean f = mean (fun a => mean (fun b => f (a, b))) := by | |
| simpa only [mean, Finset.univ_product_univ] using | |
| Finset.expect_product (Finset.univ : Finset A) (Finset.univ : Finset B) f | |
| @[simp] theorem mean_const [Nonempty A] (c : ℝ) : mean (fun _ : A => c) = c := | |
| Fintype.expect_const c | |
| theorem mean_add (f g : A → ℝ) : | |
| mean (fun x => f x + g x) = mean f + mean g := | |
| Finset.expect_add_distrib _ f g | |
| theorem mean_sub (f g : A → ℝ) : | |
| mean (fun x => f x - g x) = mean f - mean g := | |
| Finset.expect_sub_distrib _ f g | |
| theorem mean_mul_left (c : ℝ) (f : A → ℝ) : | |
| mean (fun x => c * f x) = c * mean f := | |
| (Finset.mul_expect _ f c).symm | |
| theorem mean_mul_right (f : A → ℝ) (c : ℝ) : | |
| mean (fun x => f x * c) = mean f * c := | |
| (Finset.expect_mul _ f c).symm | |
| theorem mean_nonnegative (f : A → ℝ) (hf : ∀ x, 0 ≤ f x) : 0 ≤ mean f := | |
| Finset.expect_nonneg (fun x _ => hf x) | |
| theorem mean_mono {f g : A → ℝ} (h : ∀ x, f x ≤ g x) : mean f ≤ mean g := | |
| Finset.expect_le_expect (fun x _ => h x) | |
| theorem energy_nonnegative (f : A → ℝ) : 0 ≤ energy f := | |
| mean_nonnegative _ (fun x => sq_nonneg (f x)) | |
| /-- The finite Cauchy--Schwarz inequality, in the chosen normalized convention. -/ | |
| theorem correlation_sq_le (f g : A → ℝ) : | |
| correlation f g ^ 2 ≤ energy f * energy g := | |
| Finset.expect_mul_sq_le_sq_mul_sq Finset.univ f g | |
| theorem energy_sub_const [Nonempty A] (f : A → ℝ) (c : ℝ) : | |
| energy (fun x => f x - c) = energy f - 2 * c * mean f + c ^ 2 := by | |
| have h : (fun x => (f x - c) ^ 2) = | |
| (fun x => (f x) ^ 2 - (2 * c) * f x + c ^ 2) := by | |
| funext x | |
| ring | |
| unfold energy | |
| rw [h, mean_add, mean_sub, mean_mul_left, mean_const] | |
| theorem correlation_sub_const [Nonempty A] (f g : A → ℝ) (c d : ℝ) : | |
| correlation (fun x => f x - c) (fun x => g x - d) = | |
| correlation f g - d * mean f - c * mean g + c * d := by | |
| have h : (fun x => (f x - c) * (g x - d)) = | |
| (fun x => f x * g x - d * f x - c * g x + c * d) := by | |
| funext x | |
| ring | |
| unfold correlation | |
| rw [h, mean_add, mean_sub, mean_sub, mean_mul_left, mean_mul_left, mean_const] | |
| end Averages | |
| section Graph | |
| variable {V D : Type*} [Fintype V] [Fintype D] [Nonempty V] [Nonempty D] | |
| (G : PortGraph V D) | |
| omit [Nonempty V] in | |
| theorem mean_operator (f : V → ℝ) : mean (averagingOperator G f) = mean f := by | |
| calc | |
| mean (averagingOperator G f) = mean (fun e : V × D => f (G.rot e).1) := | |
| (mean_prod (fun e : V × D => f (G.rot e).1)).symm | |
| _ = mean (fun e : V × D => f e.1) := mean_equiv G.rot (fun e => f e.1) | |
| _ = mean (fun v : V => mean (fun _ : D => f v)) := | |
| mean_prod (fun e : V × D => f e.1) | |
| _ = mean f := by simp only [mean_const] | |
| omit [Fintype V] [Nonempty V] in | |
| theorem operator_sub_const (f : V → ℝ) (c : ℝ) : | |
| averagingOperator G (fun v => f v - c) = fun v => averagingOperator G f v - c := by | |
| funext v | |
| change mean (fun d => f (G.rot (v, d)).1 - c) = _ | |
| rw [mean_sub, mean_const] | |
| rfl | |
| omit [Nonempty V] in | |
| theorem mean_iterate (n : Nat) (f : V → ℝ) : mean (iterateOperator G n f) = mean f := by | |
| induction n with | |
| | zero => rfl | |
| | succ n ih => rw [iterateOperator, mean_operator, ih] | |
| omit [Fintype V] [Nonempty V] in | |
| theorem iterate_sub_const (n : Nat) (f : V → ℝ) (c : ℝ) : | |
| iterateOperator G n (fun v => f v - c) = fun v => iterateOperator G n f v - c := by | |
| induction n with | |
| | zero => rfl | |
| | succ n ih => rw [iterateOperator, ih, operator_sub_const]; rfl | |
| omit [Nonempty V] [Nonempty D] in | |
| /-- Reversal moves the first marked edge to its endpoint. The profile therefore | |
| appears at the endpoint, before the `gap` remaining vertex transitions. -/ | |
| theorem mean_markedStep (bad : V × D → Bool) | |
| (reversal : ∀ e, bad (G.rot e) = bad e) (f : V → ℝ) : | |
| mean (markedStep G bad f) = correlation (edgeProfile bad) f := by | |
| calc | |
| mean (markedStep G bad f) = | |
| mean (fun e : V × D => if bad e then f (G.rot e).1 else 0) := by | |
| exact (mean_prod (fun e : V × D => if bad e then f (G.rot e).1 else 0)).symm | |
| _ = mean (fun e : V × D => if bad (G.rot e) | |
| then f (G.rot (G.rot e)).1 else 0) := | |
| (mean_equiv G.rot (fun e : V × D => if bad e then f (G.rot e).1 else 0)).symm | |
| _ = mean (fun e : V × D => if bad e then f e.1 else 0) := by | |
| congr 1 | |
| funext e | |
| rw [reversal e, G.rot_involutive e] | |
| _ = mean (fun v => mean (fun d => if bad (v, d) then f v else 0)) := | |
| mean_prod (fun e : V × D => if bad e then f e.1 else 0) | |
| _ = correlation (edgeProfile bad) f := by | |
| unfold correlation | |
| congr 1 | |
| funext v | |
| have h : (fun d => if bad (v, d) then f v else 0) = | |
| (fun d => (if bad (v, d) then (1 : ℝ) else 0) * f v) := by | |
| funext d | |
| cases bad (v, d) <;> simp | |
| rw [h, mean_mul_right] | |
| rfl | |
| omit [Nonempty V] [Nonempty D] in | |
| theorem returnMass_eq_correlation (bad : V × D → Bool) | |
| (reversal : ∀ e, bad (G.rot e) = bad e) (gap : Nat) : | |
| returnMass G bad gap = correlation (edgeProfile bad) | |
| (iterateOperator G gap (edgeProfile bad)) := | |
| mean_markedStep G bad reversal _ | |
| omit [Nonempty V] in | |
| theorem iterate_energy_bound (lambda : ℝ) (certificate : SpectralCertificate G lambda) | |
| (f : V → ℝ) (hf : mean f = 0) (n : Nat) : | |
| energy (iterateOperator G n f) ≤ (lambda ^ n) ^ 2 * energy f := by | |
| induction n with | |
| | zero => simp [iterateOperator] | |
| | succ n ih => | |
| calc | |
| energy (iterateOperator G (n + 1) f) ≤ | |
| lambda ^ 2 * energy (iterateOperator G n f) := | |
| certificate.contraction _ ((mean_iterate G n f).trans hf) | |
| _ ≤ lambda ^ 2 * ((lambda ^ n) ^ 2 * energy f) := | |
| mul_le_mul_of_nonneg_left ih (sq_nonneg lambda) | |
| _ = (lambda ^ (n + 1)) ^ 2 * energy f := by rw [pow_succ]; ring | |
| omit [Nonempty V] in | |
| theorem zero_mean_correlation_bound (lambda : ℝ) | |
| (certificate : SpectralCertificate G lambda) (f : V → ℝ) | |
| (hf : mean f = 0) (n : Nat) : | |
| correlation f (iterateOperator G n f) ≤ lambda ^ n * energy f := by | |
| have hsq : correlation f (iterateOperator G n f) ^ 2 ≤ | |
| (lambda ^ n * energy f) ^ 2 := by | |
| calc | |
| _ ≤ energy f * energy (iterateOperator G n f) := correlation_sq_le _ _ | |
| _ ≤ energy f * ((lambda ^ n) ^ 2 * energy f) := | |
| mul_le_mul_of_nonneg_left (iterate_energy_bound G lambda certificate f hf n) | |
| (energy_nonnegative f) | |
| _ = _ := by ring | |
| exact le_of_sq_le_sq hsq | |
| (mul_nonneg (pow_nonneg certificate.nonnegative n) (energy_nonnegative f)) | |
| theorem correlation_centered (f : V → ℝ) (n : Nat) : | |
| correlation f (iterateOperator G n f) = mean f ^ 2 + | |
| correlation (fun v => f v - mean f) | |
| (iterateOperator G n (fun v => f v - mean f)) := by | |
| rw [iterate_sub_const, correlation_sub_const, mean_iterate] | |
| ring | |
| end Graph | |
| section Profiles | |
| variable {V D : Type*} [Fintype V] [Fintype D] [Nonempty V] [Nonempty D] | |
| omit [Nonempty V] [Nonempty D] in | |
| /-- Density is exactly the uniform probability of a marked directed port-edge. -/ | |
| theorem edgeDensity_eq_edge_mean (bad : V × D → Bool) : | |
| edgeDensity bad = mean (fun e => if bad e then (1 : ℝ) else 0) := | |
| (mean_prod (fun e : V × D => if bad e then (1 : ℝ) else 0)).symm | |
| omit [Nonempty V] [Nonempty D] in | |
| /-- The edge convention counts each directed port once, including parallel | |
| edges and loops. Thus the density is literally the marked-edge cardinal ratio. -/ | |
| theorem edgeDensity_eq_card (bad : V × D → Bool) : | |
| edgeDensity bad = | |
| ((Finset.univ.filter (fun e => bad e = true)).card : ℝ) / | |
| (Fintype.card (V × D) : ℝ) := by | |
| rw [edgeDensity_eq_edge_mean, mean_eq_sum_div_card] | |
| simp only [Finset.sum_boole] | |
| omit [Fintype V] [Nonempty V] [Nonempty D] in | |
| theorem edgeProfile_nonnegative (bad : V × D → Bool) (v : V) : 0 ≤ edgeProfile bad v := | |
| mean_nonnegative _ (fun d => by cases bad (v, d) <;> norm_num) | |
| omit [Fintype V] [Nonempty V] in | |
| theorem edgeProfile_le_one (bad : V × D → Bool) (v : V) : edgeProfile bad v ≤ 1 := by | |
| change mean (fun d => if bad (v, d) then (1 : ℝ) else 0) ≤ 1 | |
| calc | |
| _ ≤ mean (fun _ : D => (1 : ℝ)) := mean_mono (fun d => by | |
| cases bad (v, d) <;> norm_num) | |
| _ = 1 := mean_const _ | |
| omit [Nonempty V] [Nonempty D] in | |
| theorem edgeDensity_nonnegative (bad : V × D → Bool) : 0 ≤ edgeDensity bad := | |
| mean_nonnegative _ (edgeProfile_nonnegative bad) | |
| theorem edgeDensity_le_one (bad : V × D → Bool) : edgeDensity bad ≤ 1 := by | |
| calc | |
| _ ≤ mean (fun _ : V => (1 : ℝ)) := mean_mono (edgeProfile_le_one bad) | |
| _ = 1 := mean_const _ | |
| omit [Nonempty V] in | |
| theorem edgeProfile_energy_le_density (bad : V × D → Bool) : | |
| energy (edgeProfile bad) ≤ edgeDensity bad := | |
| mean_mono (fun v => by | |
| have h0 := edgeProfile_nonnegative bad v | |
| have h1 := edgeProfile_le_one bad v | |
| nlinarith) | |
| theorem edgeProfile_centered_energy (bad : V × D → Bool) : | |
| energy (fun v => edgeProfile bad v - edgeDensity bad) ≤ | |
| edgeDensity bad * (1 - edgeDensity bad) := by | |
| rw [energy_sub_const] | |
| have h := edgeProfile_energy_le_density bad | |
| change energy (edgeProfile bad) - 2 * edgeDensity bad * edgeDensity bad + | |
| edgeDensity bad ^ 2 ≤ _ | |
| nlinarith | |
| /-- Sharp return bound. No division by the bad-edge density occurs, so the empty | |
| bad set is covered. `gap = 0` gives the adjacent-edge upper bound `epsilon`. -/ | |
| theorem returnMass_le_sharp (G : PortGraph V D) (lambda : ℝ) | |
| (certificate : SpectralCertificate G lambda) (bad : V × D → Bool) | |
| (reversal : ∀ e, bad (G.rot e) = bad e) (gap : Nat) : | |
| returnMass G bad gap ≤ edgeDensity bad ^ 2 + | |
| lambda ^ gap * (edgeDensity bad * (1 - edgeDensity bad)) := by | |
| rw [returnMass_eq_correlation G bad reversal, correlation_centered] | |
| have hzero : mean (fun v => edgeProfile bad v - edgeDensity bad) = 0 := by | |
| rw [mean_sub, mean_const] | |
| simp only [edgeDensity, sub_self] | |
| have hc := zero_mean_correlation_bound G lambda certificate | |
| (fun v => edgeProfile bad v - edgeDensity bad) hzero gap | |
| have hv := mul_le_mul_of_nonneg_left (edgeProfile_centered_energy bad) | |
| (pow_nonneg certificate.nonnegative gap) | |
| change edgeDensity bad ^ 2 + _ ≤ _ | |
| exact add_le_add (le_refl _) (hc.trans hv) | |
| /-- The simple bound used in the second-moment estimate. -/ | |
| theorem returnMass_le (G : PortGraph V D) (lambda : ℝ) | |
| (certificate : SpectralCertificate G lambda) (bad : V × D → Bool) | |
| (reversal : ∀ e, bad (G.rot e) = bad e) (gap : Nat) : | |
| returnMass G bad gap ≤ edgeDensity bad ^ 2 + edgeDensity bad * lambda ^ gap := by | |
| have h := returnMass_le_sharp G lambda certificate bad reversal gap | |
| have hvar : edgeDensity bad * (1 - edgeDensity bad) ≤ edgeDensity bad := by | |
| nlinarith [sq_nonneg (edgeDensity bad)] | |
| have hm := mul_le_mul_of_nonneg_left hvar (pow_nonneg certificate.nonnegative gap) | |
| nlinarith | |
| theorem adjacent_returnMass_le (G : PortGraph V D) (lambda : ℝ) | |
| (certificate : SpectralCertificate G lambda) (bad : V × D → Bool) | |
| (reversal : ∀ e, bad (G.rot e) = bad e) : | |
| returnMass G bad 0 ≤ edgeDensity bad := by | |
| have h := returnMass_le_sharp G lambda certificate bad reversal 0 | |
| norm_num at h | |
| nlinarith | |
| end Profiles | |
| /-- The finite geometric-series bound that absorbs forward and reverse returns. | |
| It applies to every finite window, with no limiting probability argument. -/ | |
| theorem geometric_sum_le (lambda : ℝ) (h0 : 0 ≤ lambda) (h1 : lambda < 1) (n : Nat) : | |
| (∑ k ∈ Finset.range n, lambda ^ k) ≤ 1 / (1 - lambda) := by | |
| have hsum : (∑ k ∈ Finset.range n, lambda ^ k) * (1 - lambda) = 1 - lambda ^ n := by | |
| induction n with | |
| | zero => simp | |
| | succ n ih => rw [Finset.sum_range_succ, pow_succ]; nlinarith | |
| have hden : 0 < 1 - lambda := by linarith | |
| apply (le_div_iff₀ hden).2 | |
| rw [hsum] | |
| linarith [pow_nonneg h0 n] | |
| section ReturnSums | |
| variable {V D : Type*} [Fintype V] [Fintype D] [Nonempty V] [Nonempty D] | |
| /-- The return contribution from one marked edge, over a finite forward window. -/ | |
| theorem sum_returnMass_le (G : PortGraph V D) (lambda : ℝ) | |
| (certificate : SpectralCertificate G lambda) (bad : V × D → Bool) | |
| (reversal : ∀ e, bad (G.rot e) = bad e) (n : Nat) : | |
| (∑ gap ∈ Finset.range n, returnMass G bad gap) ≤ | |
| (n : ℝ) * edgeDensity bad ^ 2 + edgeDensity bad / (1 - lambda) := by | |
| calc | |
| _ ≤ ∑ gap ∈ Finset.range n, | |
| (edgeDensity bad ^ 2 + edgeDensity bad * lambda ^ gap) := | |
| Finset.sum_le_sum (fun gap _ => returnMass_le G lambda certificate bad reversal gap) | |
| _ = (n : ℝ) * edgeDensity bad ^ 2 + | |
| edgeDensity bad * (∑ gap ∈ Finset.range n, lambda ^ gap) := by | |
| rw [Finset.sum_add_distrib, ← Finset.mul_sum] | |
| simp only [Finset.sum_const, Finset.card_range, nsmul_eq_mul] | |
| _ ≤ (n : ℝ) * edgeDensity bad ^ 2 + edgeDensity bad * (1 / (1 - lambda)) := | |
| add_le_add (le_refl _) | |
| (mul_le_mul_of_nonneg_left | |
| (geometric_sum_le lambda certificate.nonnegative certificate.lt_one n) | |
| (edgeDensity_nonnegative bad)) | |
| _ = _ := by ring | |
| /-- Sum over all distinct ordered-time pairs, counting each pair once. | |
| The row for the later edge `j` has gaps `0,...,j-1`. -/ | |
| theorem triangular_returnMass_sum_le (G : PortGraph V D) (lambda : ℝ) | |
| (certificate : SpectralCertificate G lambda) (bad : V × D → Bool) | |
| (reversal : ∀ e, bad (G.rot e) = bad e) (n : Nat) : | |
| (∑ j ∈ Finset.range n, ∑ gap ∈ Finset.range j, returnMass G bad gap) ≤ | |
| ((n : ℝ) * ((n : ℝ) - 1) / 2) * edgeDensity bad ^ 2 + | |
| (n : ℝ) * (edgeDensity bad / (1 - lambda)) := by | |
| induction n with | |
| | zero => simp | |
| | succ n ih => | |
| rw [Finset.sum_range_succ] | |
| have hrow := sum_returnMass_le G lambda certificate bad reversal n | |
| have h := add_le_add ih hrow | |
| calc | |
| _ ≤ ((n : ℝ) * ((n : ℝ) - 1) / 2) * edgeDensity bad ^ 2 + | |
| (n : ℝ) * (edgeDensity bad / (1 - lambda)) + | |
| ((n : ℝ) * edgeDensity bad ^ 2 + edgeDensity bad / (1 - lambda)) := h | |
| _ = _ := by simp only [Nat.cast_add, Nat.cast_one]; ring | |
| /-- The exact finite envelope needed after expanding the square of the hit | |
| count. The diagonal contributes `n * epsilon`; both off-diagonal triangles | |
| contribute twice the return sum. The actual walk-event identity is supplied by | |
| `PoweringMoment` and `PoweringReturn`. -/ | |
| theorem secondMoment_return_envelope (G : PortGraph V D) (lambda : ℝ) | |
| (certificate : SpectralCertificate G lambda) (bad : V × D → Bool) | |
| (reversal : ∀ e, bad (G.rot e) = bad e) (n : Nat) : | |
| (n : ℝ) * edgeDensity bad + | |
| 2 * (∑ j ∈ Finset.range n, ∑ gap ∈ Finset.range j, returnMass G bad gap) ≤ | |
| (n : ℝ) * edgeDensity bad * | |
| (1 + 2 / (1 - lambda) + ((n : ℝ) - 1) * edgeDensity bad) := by | |
| calc | |
| _ ≤ (n : ℝ) * edgeDensity bad + | |
| 2 * (((n : ℝ) * ((n : ℝ) - 1) / 2) * edgeDensity bad ^ 2 + | |
| (n : ℝ) * (edgeDensity bad / (1 - lambda))) := | |
| add_le_add (le_refl _) | |
| (mul_le_mul_of_nonneg_left | |
| (triangular_returnMass_sum_le G lambda certificate bad reversal n) (by norm_num)) | |
| _ = _ := by ring | |
| end ReturnSums | |
| end | |
| end UniqueGamesTheorem.Foundations.PCP.SpectralReturn | |
| end | |
| section | |
| /-! | |
| # Walsh diagonalization of actual Boolean-cube Cayley graphs | |
| Every port is an indexed generator. The rotation keeps the port and adds its | |
| generator by pointwise xor, so loops and repeated generators keep their full | |
| multiplicity. The Fourier multiplier and energy estimate are proved for this | |
| actual averaging operator; no Fourier/operator compatibility is assumed. | |
| -/ | |
| noncomputable section | |
| namespace UniqueGamesTheorem.Foundations.PCP.CayleySpectral | |
| open scoped BigOperators | |
| open Finset | |
| open UniqueGamesTheorem.Foundations.Hastad | |
| open PoweringWalks | |
| variable {I D : Type*} | |
| def zeroFrequency : Cube I := fun _ => false | |
| theorem cubeXor_cancel_right (x y : Cube I) : | |
| cubeXor (cubeXor x y) y = x := by | |
| funext i | |
| cases hx : x i <;> cases hy : y i <;> simp [cubeXor, hx, hy] | |
| theorem cubeXor_assoc (x y z : Cube I) : | |
| cubeXor (cubeXor x y) z = cubeXor x (cubeXor y z) := by | |
| funext i | |
| cases hx : x i <;> cases hy : y i <;> cases hz : z i <;> | |
| simp [cubeXor, hx, hy, hz] | |
| @[simp] theorem cubeXor_zeroFrequency (x : Cube I) : | |
| cubeXor x zeroFrequency = x := by | |
| funext i | |
| cases hx : x i <;> simp [cubeXor, zeroFrequency, hx] | |
| /-- Uniform cube measure is invariant under this explicit xor translation. -/ | |
| def xorTranslation (y : Cube I) : Cube I ≃ Cube I where | |
| toFun x := cubeXor x y | |
| invFun x := cubeXor x y | |
| left_inv x := cubeXor_cancel_right x y | |
| right_inv x := cubeXor_cancel_right x y | |
| def rotate (g : D → Cube I) (p : Cube I × D) : Cube I × D := | |
| (cubeXor p.1 (g p.2), p.2) | |
| theorem rotate_involutive (g : D → Cube I) : Function.Involutive (rotate g) := by | |
| rintro ⟨x, d⟩ | |
| change (cubeXor (cubeXor x (g d)) (g d), d) = (x, d) | |
| rw [cubeXor_cancel_right] | |
| /-- The undirected regular port graph generated by the indexed cube vectors. -/ | |
| def cayleyGraph (g : D → Cube I) : PortGraph (Cube I) D where | |
| rot := | |
| { toFun := rotate g | |
| invFun := rotate g | |
| left_inv := rotate_involutive g | |
| right_inv := rotate_involutive g } | |
| rot_involutive := rotate_involutive g | |
| @[simp] theorem cayleyGraph_rot (g : D → Cube I) (x : Cube I) (d : D) : | |
| (cayleyGraph g).rot (x, d) = (cubeXor x (g d), d) := rfl | |
| /-- Expose the first actual port in a finite port word. -/ | |
| def splitPortWord (n : Nat) : (Fin (n + 1) → D) ≃ D × (Fin n → D) where | |
| toFun p := (p 0, fun j => p j.succ) | |
| invFun z := Fin.cases z.1 z.2 | |
| left_inv p := by | |
| funext j | |
| exact Fin.cases rfl (fun _ => rfl) j | |
| right_inv z := rfl | |
| /-- The generator of a powered port is the xor of its original port word. -/ | |
| def powerGenerators (g : D → Cube I) : (n : Nat) → (Fin n → D) → Cube I | |
| | 0, _ => zeroFrequency | |
| | n + 1, p => cubeXor (g (p 0)) (powerGenerators g n (fun j => p j.succ)) | |
| /-- These are actual walk displacements, including repeated vertices and ports. -/ | |
| theorem wordEnd_eq_powerGenerators (g : D → Cube I) (n : Nat) | |
| (x : Cube I) (p : Fin n → D) : | |
| wordEnd (cayleyGraph g) n x p = cubeXor x (powerGenerators g n p) := by | |
| induction n generalizing x with | |
| | zero => simp [wordEnd, powerGenerators] | |
| | succ n ih => | |
| change wordEnd (cayleyGraph g) n (cubeXor x (g (p 0))) (fun j => p j.succ) = | |
| cubeXor x (cubeXor (g (p 0)) (powerGenerators g n (fun j => p j.succ))) | |
| rw [ih, cubeXor_assoc] | |
| section Finite | |
| variable [Fintype I] [DecidableEq I] [Fintype D] | |
| /-- Average along the actual outgoing ports of the Cayley graph. -/ | |
| def cayleyAverage (g : D → Cube I) (f : Cube I → ℝ) (x : Cube I) : ℝ := | |
| 𝔼 d, f ((cayleyGraph g).rot (x, d)).1 | |
| /-- The eigenvalue is the empirical bias of the generator characters. -/ | |
| def eigenvalue (g : D → Cube I) (s : Cube I) : ℝ := | |
| 𝔼 d, walsh s (g d) | |
| omit [Fintype I] [DecidableEq I] in | |
| @[simp] theorem averagingOperator_cayleyGraph (g : D → Cube I) (f : Cube I → ℝ) : | |
| SpectralReturn.averagingOperator (cayleyGraph g) f = cayleyAverage g f := rfl | |
| @[simp] theorem coefficient_zeroFrequency (f : Cube I → ℝ) : | |
| coefficient f zeroFrequency = 𝔼 x, f x := by | |
| simp [coefficient, zeroFrequency, walsh, bitSign] | |
| /-- Change variables through xor translation in the actual Fourier average. -/ | |
| theorem coefficient_xorTranslation (f : Cube I → ℝ) (s v : Cube I) : | |
| coefficient (fun x => f (cubeXor x v)) s = walsh s v * coefficient f s := by | |
| calc | |
| coefficient (fun x => f (cubeXor x v)) s = | |
| 𝔼 x, f x * walsh s (cubeXor x v) := by | |
| unfold coefficient | |
| apply Fintype.expect_equiv (xorTranslation v) | |
| intro x | |
| change f (cubeXor x v) * walsh s x = | |
| f (cubeXor x v) * walsh s (cubeXor (cubeXor x v) v) | |
| rw [cubeXor_cancel_right] | |
| _ = 𝔼 x, (f x * walsh s x) * walsh s v := by | |
| apply Finset.expect_congr rfl | |
| intro x _ | |
| rw [walsh_xor] | |
| ring | |
| _ = coefficient f s * walsh s v := by | |
| rw [← Finset.expect_mul] | |
| rfl | |
| _ = walsh s v * coefficient f s := mul_comm _ _ | |
| /-- Each Walsh character is an eigenvector of the actual Cayley averaging. -/ | |
| theorem cayleyAverage_walsh (g : D → Cube I) (s x : Cube I) : | |
| cayleyAverage g (walsh s) x = eigenvalue g s * walsh s x := by | |
| unfold cayleyAverage | |
| simp only [cayleyGraph_rot, walsh_xor] | |
| rw [← Finset.mul_expect] | |
| rw [mul_comm] | |
| rfl | |
| /-- Full Walsh diagonalization, obtained by swapping the two finite averages. -/ | |
| theorem coefficient_cayleyAverage (g : D → Cube I) (f : Cube I → ℝ) (s : Cube I) : | |
| coefficient (cayleyAverage g f) s = eigenvalue g s * coefficient f s := by | |
| calc | |
| coefficient (cayleyAverage g f) s = | |
| 𝔼 x, 𝔼 d, f (cubeXor x (g d)) * walsh s x := by | |
| unfold coefficient cayleyAverage | |
| simp only [cayleyGraph_rot, Finset.expect_mul] | |
| _ = 𝔼 d, 𝔼 x, f (cubeXor x (g d)) * walsh s x := by | |
| rw [Finset.expect_comm] | |
| _ = 𝔼 d, walsh s (g d) * coefficient f s := by | |
| apply Finset.expect_congr rfl | |
| intro d _ | |
| exact coefficient_xorTranslation f s (g d) | |
| _ = eigenvalue g s * coefficient f s := by | |
| rw [← Finset.expect_mul] | |
| rfl | |
| /-- Uniform finite port-word splitting multiplies the actual eigenvalues. -/ | |
| theorem eigenvalue_powerGenerators (g : D → Cube I) (n : Nat) (s : Cube I) : | |
| eigenvalue (powerGenerators g n) s = eigenvalue g s ^ n := by | |
| induction n with | |
| | zero => | |
| let : Nonempty (Fin 0 → D) := ⟨fun i => Fin.elim0 i⟩ | |
| simp [eigenvalue, powerGenerators, zeroFrequency, walsh, bitSign] | |
| | succ n ih => | |
| calc | |
| eigenvalue (powerGenerators g (n + 1)) s = | |
| 𝔼 z : D × (Fin n → D), | |
| walsh s (cubeXor (g z.1) (powerGenerators g n z.2)) := by | |
| unfold eigenvalue | |
| apply Fintype.expect_equiv (splitPortWord n) | |
| intro p | |
| rfl | |
| _ = 𝔼 d, 𝔼 p : Fin n → D, | |
| walsh s (cubeXor (g d) (powerGenerators g n p)) := by | |
| exact SpectralReturn.mean_prod _ | |
| _ = eigenvalue g s * eigenvalue (powerGenerators g n) s := by | |
| simp_rw [walsh_xor, ← Finset.mul_expect] | |
| rw [← Finset.expect_mul] | |
| rfl | |
| _ = eigenvalue g s ^ (n + 1) := by | |
| rw [ih, pow_succ, mul_comm] | |
| /-- The port degree of the powered graph is the exact number of port words. -/ | |
| theorem power_port_card (n : Nat) : | |
| Fintype.card (Fin n → D) = Fintype.card D ^ n := by | |
| simp only [Fintype.card_fun, Fintype.card_fin] | |
| theorem seven_power_port_card : | |
| Fintype.card (Fin 7 → Fin (2 ^ 16)) = (2 ^ 16) ^ 7 := by | |
| simp only [Fintype.card_fun, Fintype.card_fin] | |
| /-- A bias bound on all nonconstant generator characters contracts the actual | |
| mean-zero function energy. The constant coefficient is eliminated by its exact | |
| identification with the mean, and every other coefficient is bounded termwise. | |
| -/ | |
| theorem cayley_energy_contraction (g : D → Cube I) (lambda : ℝ) (_hlambda : 0 ≤ lambda) | |
| (hbias : ∀ s : Cube I, s ≠ zeroFrequency → |eigenvalue g s| ≤ lambda) | |
| (f : Cube I → ℝ) (hmean : (𝔼 x, f x) = 0) : | |
| (𝔼 x, cayleyAverage g f x ^ 2) ≤ lambda ^ 2 * (𝔼 x, f x ^ 2) := by | |
| classical | |
| have hzero : coefficient f zeroFrequency = 0 := by | |
| rw [coefficient_zeroFrequency] | |
| exact hmean | |
| calc | |
| (𝔼 x, cayleyAverage g f x ^ 2) = | |
| ∑ s, coefficient (cayleyAverage g f) s ^ 2 := (walsh_parseval _).symm | |
| _ = ∑ s, (eigenvalue g s * coefficient f s) ^ 2 := by | |
| simp only [coefficient_cayleyAverage] | |
| _ ≤ ∑ s, lambda ^ 2 * coefficient f s ^ 2 := by | |
| apply Finset.sum_le_sum | |
| intro s _ | |
| by_cases hs : s = zeroFrequency | |
| · subst s | |
| simp [hzero] | |
| · have hb := hbias s hs | |
| have hlo : -lambda ≤ eigenvalue g s := (abs_le.mp hb).1 | |
| have hhi : eigenvalue g s ≤ lambda := (abs_le.mp hb).2 | |
| have hprod : 0 ≤ (lambda - eigenvalue g s) * (lambda + eigenvalue g s) := | |
| mul_nonneg (sub_nonneg.mpr hhi) (by linarith) | |
| have hsq : eigenvalue g s ^ 2 ≤ lambda ^ 2 := by nlinarith | |
| calc | |
| (eigenvalue g s * coefficient f s) ^ 2 = | |
| eigenvalue g s ^ 2 * coefficient f s ^ 2 := by rw [mul_pow] | |
| _ ≤ lambda ^ 2 * coefficient f s ^ 2 := | |
| mul_le_mul_of_nonneg_right hsq (sq_nonneg _) | |
| _ = lambda ^ 2 * (𝔼 x, f x ^ 2) := by | |
| rw [← Finset.mul_sum, walsh_parseval] | |
| /-- The Fourier proof supplies the graph certificate used in return bounds. -/ | |
| theorem cayley_spectralCertificate (g : D → Cube I) (lambda : ℝ) | |
| (hlambda : 0 ≤ lambda) (hlambdaone : lambda < 1) | |
| (hbias : ∀ s : Cube I, s ≠ zeroFrequency → |eigenvalue g s| ≤ lambda) : | |
| SpectralReturn.SpectralCertificate (cayleyGraph g) lambda where | |
| nonnegative := hlambda | |
| lt_one := hlambdaone | |
| contraction := by | |
| intro f hf | |
| change (𝔼 x, cayleyAverage g f x ^ 2) ≤ lambda ^ 2 * (𝔼 x, f x ^ 2) | |
| exact cayley_energy_contraction g lambda hlambda hbias f hf | |
| theorem power_eigenvalue_bound (g : D → Cube I) (lambda : ℝ) (hlambda : 0 ≤ lambda) | |
| (hbias : ∀ s : Cube I, s ≠ zeroFrequency → |eigenvalue g s| ≤ lambda) | |
| (n : Nat) (s : Cube I) (hs : s ≠ zeroFrequency) : | |
| |eigenvalue (powerGenerators g n) s| ≤ lambda ^ n := by | |
| rw [eigenvalue_powerGenerators, abs_pow] | |
| induction n with | |
| | zero => simp | |
| | succ n ih => | |
| rw [pow_succ, pow_succ] | |
| exact mul_le_mul ih (hbias s hs) (abs_nonneg _) (pow_nonneg hlambda _) | |
| /-- Seven actual generator steps turn one-half character bias into `2⁻⁷`. -/ | |
| theorem sevenStep_halfCertificate (g : D → Cube I) | |
| (hbias : ∀ s : Cube I, s ≠ zeroFrequency → |eigenvalue g s| ≤ (1 / 2 : ℝ)) : | |
| SpectralReturn.SpectralCertificate (cayleyGraph (powerGenerators g 7)) | |
| ((1 / 2 : ℝ) ^ 7) := by | |
| apply cayley_spectralCertificate | |
| · norm_num | |
| · norm_num | |
| · intro s hs | |
| exact power_eigenvalue_bound g (1 / 2) (by norm_num) hbias 7 s hs | |
| end Finite | |
| end UniqueGamesTheorem.Foundations.PCP.CayleySpectral | |
| end | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 31.7 kB
- Xet hash:
- 5f3c934819f8707b7006eac533ce60949ed6d371c18db3614521b8b49812eca6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.