Buckets:
| import Mathlib | |
| import OAI.Computability.MaxCut.PCP.Product | |
| import OAI.Computability.MaxCut.PCP.AnalyticCheeger | |
| import OAI.Computability.MaxCut.PCP.Overlap | |
| namespace OAI | |
| noncomputable section | |
| /-! High-value rounding of finite nonnegative vectors. The finite threshold | |
| partition and bounded shared rejection sampler produce an ordinary deterministic | |
| labeling. The auxiliary edge sample may retain hidden constraint information; | |
| the labeling receives only its local vertex. -/ | |
| namespace MaxCutGames.Repetition | |
| section | |
| open scoped BigOperators | |
| open Foundations.Games | |
| variable {V E A Ω : Type*} [Fintype V] [Fintype E] [Fintype A] [Fintype Ω] | |
| [Nonempty V] [Nonempty A] [Nonempty Ω] | |
| omit [Fintype A] [Nonempty V] [Nonempty A] in | |
| theorem threshold_average_good_mass (ν : FiniteDistribution E) | |
| (left right : E → V) (R : E → A → A → Bool) | |
| (a : V → Ω → A) (f : V → Ω → ℝ) | |
| (hrow : ∀ v, rowSquareMass f v = 1) : | |
| ν.expectation (partialEdgeMass (thresholdDistribution f) | |
| (thresholdAccept f) (thresholdLabel f a) left right R) = | |
| thresholdRate Ω * pairOverlap ν left right R a f := by | |
| unfold partialEdgeMass pairOverlap FiniteDistribution.expectation | |
| simp_rw [threshold_good_pair_mass_bool f hrow a] | |
| rw [Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro e _ | |
| ring | |
| /-- Unit squared row mass converts a large collision energy into a genuinely | |
| local deterministic labeling. All randomness used by the proof is independent | |
| of the sampled constraint, and the final answer has no random seed. -/ | |
| theorem exists_labeling_high_value (ν : FiniteDistribution E) | |
| (left right : E → V) (R : E → A → A → Bool) | |
| (a : V → Ω → A) (f : V → Ω → ℝ) | |
| (hf : ∀ v ω, 0 ≤ f v ω) (hrow : ∀ v, rowSquareMass f v = 1) : | |
| ∃ labels : V → A, | |
| 1 - 2 * Real.sqrt (2 * (1 - pairEnergy ν left right R a f)) ≤ | |
| partialLabelScore ν left right R labels := by | |
| obtain ⟨labels, hlabels⟩ := exists_labeling_ge_partial | |
| (thresholdDistribution f) ν (thresholdAccept f) (thresholdLabel f a) | |
| left right R (thresholdRate Ω) thresholdRate_positive | |
| (threshold_acceptance_mass f hrow) | |
| rw [threshold_average_good_mass ν left right R a f hrow, | |
| mul_div_cancel_left₀ _ (ne_of_gt (thresholdRate_positive (Ω := Ω)))] at hlabels | |
| have hoverlap := pairOverlap_ge_energy ν left right R a f hf hrow | |
| refine ⟨labels, ?_⟩ | |
| linarith | |
| omit [Nonempty Ω] in | |
| /-- Rows of mass at most one are completed by private vertex coordinates. | |
| Their nonnegative contribution only improves the collision energy. -/ | |
| theorem exists_labeling_high_value_of_rows_le_one (ν : FiniteDistribution E) | |
| (left right : E → V) (R : E → A → A → Bool) | |
| (a : V → Ω → A) (f : V → Ω → ℝ) | |
| (hf : ∀ v ω, 0 ≤ f v ω) (hrow : ∀ v, rowSquareMass f v ≤ 1) : | |
| ∃ labels : V → A, | |
| 1 - 2 * Real.sqrt (2 * (1 - pairEnergy ν left right R a f)) ≤ | |
| partialLabelScore ν left right R labels := by | |
| classical | |
| let fallback : A := Classical.choice inferInstance | |
| obtain ⟨labels, hlabels⟩ := exists_labeling_high_value ν left right R | |
| (paddedLabel a fallback) (paddedAmplitude f) | |
| (paddedAmplitude_nonnegative f hf) (paddedAmplitude_row f hrow) | |
| have henergy := pairEnergy_le_padded ν left right R a f hf fallback | |
| have hsqrt := Real.sqrt_le_sqrt (show | |
| 2 * (1 - pairEnergy ν left right R (paddedLabel a fallback) (paddedAmplitude f)) ≤ | |
| 2 * (1 - pairEnergy ν left right R a f) by linarith) | |
| exact ⟨labels, (by linarith : | |
| 1 - 2 * Real.sqrt (2 * (1 - pairEnergy ν left right R a f)) ≤ | |
| 1 - 2 * Real.sqrt | |
| (2 * (1 - pairEnergy ν left right R (paddedLabel a fallback) | |
| (paddedAmplitude f)))).trans hlabels⟩ | |
| omit [Nonempty Ω] in | |
| /-- A genuine gap for every deterministic labeling bounds the vector energy | |
| by an alphabet-independent quadratic gap. -/ | |
| theorem pairEnergy_le_of_labeling_gap (ν : FiniteDistribution E) | |
| (left right : E → V) (R : E → A → A → Bool) | |
| (a : V → Ω → A) (f : V → Ω → ℝ) | |
| (hf : ∀ v ω, 0 ≤ f v ω) (hrow : ∀ v, rowSquareMass f v ≤ 1) | |
| {g : ℝ} (hg : 0 < g) | |
| (hgap : ∀ labels : V → A, partialLabelScore ν left right R labels ≤ 1 - g) : | |
| pairEnergy ν left right R a f ≤ 1 - g ^ 2 / 8 := by | |
| obtain ⟨labels, hlabels⟩ := exists_labeling_high_value_of_rows_le_one | |
| ν left right R a f hf hrow | |
| have hbound := hlabels.trans (hgap labels) | |
| have he : pairEnergy ν left right R a f ≤ 1 := by | |
| by_contra h | |
| have hneg : 2 * (1 - pairEnergy ν left right R a f) ≤ 0 := by linarith | |
| rw [Real.sqrt_eq_zero_of_nonpos hneg] at hbound | |
| linarith | |
| have hs := Real.sq_sqrt (show 0 ≤ 2 * (1 - pairEnergy ν left right R a f) by linarith) | |
| have hgs : g ≤ 2 * Real.sqrt (2 * (1 - pairEnergy ν left right R a f)) := by | |
| linarith | |
| have hsq := mul_self_le_mul_self hg.le hgs | |
| nlinarith | |
| end | |
| /-! | |
| Determinization of a nonnegative vector with one label chosen per vertex. | |
| Every vertex retains its total mass. The objective is an arbitrary nonnegative | |
| weighted sum of squares of linear functionals, so coefficients may have either | |
| sign. Sampling complete label tables gives the original vector as its mean; | |
| finite variance and an attained maximum then supply a deterministic table. | |
| -/ | |
| section | |
| open scoped BigOperators | |
| open MaxCutGames.Foundations.Games | |
| variable {V A T : Type*} [Fintype V] [Fintype A] [Fintype T] | |
| /-- The mass at each vertex, before or after determinization. -/ | |
| def rowMass (h : V → A → ℝ) (v : V) : ℝ := ∑ a, h v a | |
| /-- Move the full mass of each row to its selected label. -/ | |
| def deterministicVector [DecidableEq A] (h : V → A → ℝ) (labels : V → A) | |
| (v : V) (a : A) : ℝ := | |
| if a = labels v then rowMass h v else 0 | |
| omit [Fintype V] in | |
| @[simp] theorem deterministicVector_rowMass [DecidableEq A] | |
| (h : V → A → ℝ) (labels : V → A) (v : V) : | |
| rowMass (deterministicVector h labels) v = rowMass h v := by | |
| simp [rowMass, deterministicVector] | |
| omit [Fintype V] in | |
| theorem rowMass_nonnegative (h : V → A → ℝ) (hh : ∀ v a, 0 ≤ h v a) (v : V) : | |
| 0 ≤ rowMass h v := | |
| Finset.sum_nonneg (fun a _ => hh v a) | |
| omit [Fintype V] in | |
| theorem deterministicVector_nonnegative [DecidableEq A] (h : V → A → ℝ) | |
| (hh : ∀ v a, 0 ≤ h v a) (labels : V → A) (v : V) (a : A) : | |
| 0 ≤ deterministicVector h labels v a := by | |
| unfold deterministicVector | |
| split | |
| · exact rowMass_nonnegative h hh v | |
| · exact le_rfl | |
| @[simp] theorem deterministicVector_linear_image [DecidableEq A] | |
| (h : V → A → ℝ) (labels : V → A) (c : V → A → ℝ) : | |
| (∑ v, ∑ a, c v a * deterministicVector h labels v a) = | |
| ∑ v, c v (labels v) * rowMass h v := by | |
| simp [deterministicVector, mul_ite] | |
| omit [Fintype V] in | |
| theorem entry_eq_zero_of_rowMass_eq_zero (h : V → A → ℝ) | |
| (hh : ∀ v a, 0 ≤ h v a) (v : V) (hz : rowMass h v = 0) (a : A) : | |
| h v a = 0 := by | |
| have hle : h v a ≤ rowMass h v := | |
| Finset.single_le_sum (fun b _ => hh v b) (Finset.mem_univ a) | |
| exact le_antisymm (hz ▸ hle) (hh v a) | |
| /-- A zero row is harmless and uses a fixed fallback label. -/ | |
| def rowLaw [Nonempty A] (h : V → A → ℝ) (hh : ∀ v a, 0 ≤ h v a) | |
| (v : V) : FiniteDistribution A := by | |
| classical | |
| exact if hz : rowMass h v = 0 then | |
| { weight := fun a => if a = Classical.choice (inferInstance : Nonempty A) then 1 else 0 | |
| nonnegative := fun a => by split <;> norm_num | |
| normalized := by simp } | |
| else | |
| { weight := fun a => h v a / rowMass h v | |
| nonnegative := fun a => div_nonneg (hh v a) (rowMass_nonnegative h hh v) | |
| normalized := by | |
| simp only [div_eq_mul_inv] | |
| rw [← Finset.sum_mul] | |
| exact mul_inv_cancel₀ hz } | |
| omit [Fintype V] in | |
| theorem rowLaw_expectation_mul_mass [Nonempty A] (h : V → A → ℝ) | |
| (hh : ∀ v a, 0 ≤ h v a) (v : V) (f : A → ℝ) : | |
| (rowLaw h hh v).expectation (fun a => f a * rowMass h v) = | |
| ∑ a, f a * h v a := by | |
| classical | |
| by_cases hz : rowMass h v = 0 | |
| · have he : ∀ a, h v a = 0 := entry_eq_zero_of_rowMass_eq_zero h hh v hz | |
| simp [FiniteDistribution.expectation, hz, he] | |
| · simp only [rowLaw, hz, ↓reduceDIte, FiniteDistribution.expectation] | |
| apply Finset.sum_congr rfl | |
| intro a _ | |
| field_simp [hz] | |
| /-- Finite Jensen for the square, proved by expanding nonnegative variance. -/ | |
| theorem square_expectation_le {Ω : Type*} [Fintype Ω] | |
| (law : FiniteDistribution Ω) (f : Ω → ℝ) : | |
| law.expectation f ^ 2 ≤ law.expectation (fun x => f x ^ 2) := by | |
| let m := law.expectation f | |
| have h : 0 ≤ law.expectation (fun x => (f x - m) ^ 2) := by | |
| apply Finset.sum_nonneg | |
| intro x _ | |
| exact mul_nonneg (law.nonnegative x) (sq_nonneg _) | |
| have he : law.expectation (fun x => (f x - m) ^ 2) = | |
| law.expectation (fun x => f x ^ 2) - m ^ 2 := by | |
| unfold FiniteDistribution.expectation | |
| calc | |
| _ = ∑ x, ((law.weight x * f x ^ 2 - 2 * m * (law.weight x * f x)) + | |
| law.weight x * m ^ 2) := by | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| ring | |
| _ = _ := by | |
| rw [Finset.sum_add_distrib, Finset.sum_sub_distrib, | |
| ← Finset.mul_sum, ← Finset.sum_mul, law.normalized] | |
| change (law.expectation (fun x => f x ^ 2) - 2 * m * m) + 1 * m ^ 2 = _ | |
| simp only [FiniteDistribution.expectation] | |
| ring | |
| rw [he] at h | |
| dsimp [m] at h | |
| linarith | |
| theorem exists_expectation_le {Ω : Type*} [Fintype Ω] [Nonempty Ω] | |
| (law : FiniteDistribution Ω) (f : Ω → ℝ) : | |
| ∃ x, law.expectation f ≤ f x := by | |
| classical | |
| let M := Finset.univ.sup' Finset.univ_nonempty f | |
| obtain ⟨x, _, hx⟩ := Finset.exists_mem_eq_sup' | |
| (s := (Finset.univ : Finset Ω)) Finset.univ_nonempty f | |
| refine ⟨x, ?_⟩ | |
| calc | |
| law.expectation f ≤ ∑ y, law.weight y * M := by | |
| apply Finset.sum_le_sum | |
| intro y _ | |
| exact mul_le_mul_of_nonneg_left | |
| (Finset.le_sup' f (Finset.mem_univ y)) (law.nonnegative y) | |
| _ = M := by rw [← Finset.sum_mul, law.normalized, one_mul] | |
| _ = f x := hx | |
| /-- One label per vertex preserves every row's mass and can only improve the | |
| nonnegative weighted squared image under any fixed linear map. In particular, | |
| the same theorem applies separately at each coordinate of a vector-valued | |
| assignment; no product or independence property of those coordinates is used. -/ | |
| theorem exists_deterministic_preserving_mass [Nonempty A] | |
| (h : V → A → ℝ) (hh : ∀ v a, 0 ≤ h v a) | |
| (w : T → ℝ) (hw : ∀ t, 0 ≤ w t) (c : T → V → A → ℝ) : | |
| ∃ labels : V → A, | |
| (∑ t, w t * (∑ v, ∑ a, c t v a * h v a) ^ 2) ≤ | |
| ∑ t, w t * (∑ v, c t v (labels v) * rowMass h v) ^ 2 := by | |
| classical | |
| let law := FiniteDistribution.table (rowLaw h hh) | |
| let X (t : T) (labels : V → A) : ℝ := | |
| ∑ v, c t v (labels v) * rowMass h v | |
| have hmean (t : T) : law.expectation (X t) = ∑ v, ∑ a, c t v a * h v a := by | |
| change (∑ labels : V → A, law.weight labels * | |
| ∑ v, c t v (labels v) * rowMass h v) = _ | |
| simp_rw [Finset.mul_sum] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro v _ | |
| change (FiniteDistribution.table (rowLaw h hh)).expectation | |
| (fun labels => c t v (labels v) * rowMass h v) = _ | |
| exact (FiniteDistribution.expectation_table_eval (rowLaw h hh) v | |
| (fun a => c t v a * rowMass h v)).trans | |
| (rowLaw_expectation_mul_mass h hh v (c t v)) | |
| have hjensen (t : T) : (∑ v, ∑ a, c t v a * h v a) ^ 2 ≤ | |
| law.expectation (fun labels => X t labels ^ 2) := by | |
| rw [← hmean] | |
| exact square_expectation_le law (X t) | |
| have hsum : (∑ t, w t * (∑ v, ∑ a, c t v a * h v a) ^ 2) ≤ | |
| ∑ t, w t * law.expectation (fun labels => X t labels ^ 2) := by | |
| apply Finset.sum_le_sum | |
| intro t _ | |
| exact mul_le_mul_of_nonneg_left (hjensen t) (hw t) | |
| have heq : (∑ t, w t * law.expectation (fun labels => X t labels ^ 2)) = | |
| law.expectation (fun labels => ∑ t, w t * X t labels ^ 2) := by | |
| unfold FiniteDistribution.expectation | |
| simp_rw [Finset.mul_sum] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro labels _ | |
| apply Finset.sum_congr rfl | |
| intro t _ | |
| ring | |
| obtain ⟨labels, hlabels⟩ := exists_expectation_le law | |
| (fun labels => ∑ t, w t * X t labels ^ 2) | |
| rw [heq] at hsum | |
| exact ⟨labels, hsum.trans hlabels⟩ | |
| /-- The same conclusion stated directly as a deterministic nonnegative vector. | |
| Its row masses are exactly those of the original vector. -/ | |
| theorem exists_deterministic_vector [Nonempty A] [DecidableEq A] | |
| (h : V → A → ℝ) (hh : ∀ v a, 0 ≤ h v a) | |
| (w : T → ℝ) (hw : ∀ t, 0 ≤ w t) (c : T → V → A → ℝ) : | |
| ∃ labels : V → A, | |
| (∀ v a, 0 ≤ deterministicVector h labels v a) ∧ | |
| (∀ v, rowMass (deterministicVector h labels) v = rowMass h v) ∧ | |
| (∑ t, w t * (∑ v, ∑ a, c t v a * h v a) ^ 2) ≤ | |
| ∑ t, w t * (∑ v, ∑ a, c t v a * deterministicVector h labels v a) ^ 2 := by | |
| obtain ⟨labels, hlabels⟩ := exists_deterministic_preserving_mass h hh w hw c | |
| refine ⟨labels, deterministicVector_nonnegative h hh labels, | |
| deterministicVector_rowMass h labels, ?_⟩ | |
| simpa only [deterministicVector_linear_image] using hlabels | |
| end | |
| /-! | |
| Finite conditional projection kernels for the Dinur--Steurer argument. | |
| The outer distribution samples the right question and the inner distribution | |
| samples the left question conditional on it. These are genuine normalized | |
| finite distributions; no norm inequality or repetition claim is a field. | |
| -/ | |
| open MaxCutGames.Foundations.Games | |
| open scoped BigOperators | |
| structure ProjectionKernel (Q₁ Q₂ A₁ A₂ : Type*) | |
| [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] where | |
| outer : FiniteDistribution Q₂ | |
| inner : Q₂ → FiniteDistribution Q₁ | |
| accepts : Q₁ → Q₂ → A₁ → A₂ → Bool | |
| projection : ∀ x y a b b', accepts x y a b = true → | |
| accepts x y a b' = true → b = b' | |
| namespace ProjectionKernel | |
| variable {Q₁ Q₂ A₁ A₂ Ω : Type*} | |
| [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] [Fintype Ω] | |
| def toGame (K : ProjectionKernel Q₁ Q₂ A₁ A₂) : Game Q₁ Q₂ A₁ A₂ where | |
| questions := | |
| { weight := fun q => K.outer.weight q.2 * (K.inner q.2).weight q.1 | |
| nonnegative := fun q => mul_nonneg (K.outer.nonnegative _) ((K.inner _).nonnegative _) | |
| normalized := by | |
| rw [Fintype.sum_prod_type, Finset.sum_comm] | |
| simp_rw [← Finset.mul_sum, FiniteDistribution.normalized, mul_one] | |
| exact K.outer.normalized } | |
| accepts := K.accepts | |
| theorem toGame_isProjection (K : ProjectionKernel Q₁ Q₂ A₁ A₂) : | |
| IsProjection K.toGame := K.projection | |
| /-- Apply the projection operator to an arbitrary real assignment table. -/ | |
| def apply (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (f : Q₁ → A₁ → ℝ) (y : Q₂) (b : A₂) : ℝ := | |
| ∑ x, (K.inner y).weight x * ∑ a, if K.accepts x y a b then f x a else 0 | |
| /-- Squared Hilbert norm, with the actual right-question marginal. -/ | |
| def energy (K : ProjectionKernel Q₁ Q₂ A₁ A₂) (f : Q₁ → A₁ → ℝ) : ℝ := | |
| ∑ y, K.outer.weight y * ∑ b, K.apply f y b ^ 2 | |
| def assignment (labels : Q₁ → A₁) (x : Q₁) (a : A₁) : ℝ := by | |
| classical | |
| exact if labels x = a then 1 else 0 | |
| def assignmentEnergy (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (labels : Q₁ → A₁) : ℝ := K.energy (assignment labels) | |
| /-- Maximum squared collision norm of an ordinary deterministic left strategy. -/ | |
| def collisionValue [Nonempty A₁] (K : ProjectionKernel Q₁ Q₂ A₁ A₂) : ℝ := by | |
| classical | |
| exact Finset.univ.sup' Finset.univ_nonempty K.assignmentEnergy | |
| def vectorEnergy (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (f : Ω → Q₁ → A₁ → ℝ) : ℝ := ∑ ω, K.energy (f ω) | |
| def vectorMass (f : Ω → Q₁ → A₁ → ℝ) (x : Q₁) : ℝ := | |
| ∑ ω, (∑ a, f ω x a) ^ 2 | |
| theorem energy_nonneg (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (f : Q₁ → A₁ → ℝ) : 0 ≤ K.energy f := by | |
| exact Finset.sum_nonneg fun y _ => mul_nonneg (K.outer.nonnegative y) | |
| (Finset.sum_nonneg fun b _ => sq_nonneg _) | |
| theorem assignmentEnergy_le_collisionValue [Nonempty A₁] | |
| (K : ProjectionKernel Q₁ Q₂ A₁ A₂) (labels : Q₁ → A₁) : | |
| K.assignmentEnergy labels ≤ K.collisionValue := by | |
| classical | |
| exact Finset.le_sup' _ (Finset.mem_univ labels) | |
| theorem collisionValue_le_iff [Nonempty A₁] | |
| (K : ProjectionKernel Q₁ Q₂ A₁ A₂) (bound : ℝ) : | |
| K.collisionValue ≤ bound ↔ ∀ labels, K.assignmentEnergy labels ≤ bound := by | |
| classical | |
| simp [collisionValue, Finset.sup'_le_iff] | |
| theorem exists_optimal_assignment [Nonempty A₁] | |
| (K : ProjectionKernel Q₁ Q₂ A₁ A₂) : | |
| ∃ labels, K.assignmentEnergy labels = K.collisionValue := by | |
| classical | |
| obtain ⟨labels, _, h⟩ := Finset.exists_mem_eq_sup' | |
| (s := (Finset.univ : Finset (Q₁ → A₁))) Finset.univ_nonempty K.assignmentEnergy | |
| exact ⟨labels, h.symm⟩ | |
| theorem collisionValue_nonneg [Nonempty A₁] | |
| (K : ProjectionKernel Q₁ Q₂ A₁ A₂) : 0 ≤ K.collisionValue := by | |
| obtain ⟨labels, h⟩ := K.exists_optimal_assignment | |
| rw [← h] | |
| exact K.energy_nonneg _ | |
| @[simp] theorem apply_assignment (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (labels : Q₁ → A₁) (y : Q₂) (b : A₂) : | |
| K.apply (assignment labels) y b = | |
| ∑ x, if K.accepts x y (labels x) b then (K.inner y).weight x else 0 := by | |
| classical | |
| unfold apply assignment | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| have hsum : (∑ a, if K.accepts x y a b then | |
| (if labels x = a then (1 : ℝ) else 0) else 0) = | |
| if K.accepts x y (labels x) b then (1 : ℝ) else 0 := by | |
| have hpoint (a : A₁) : | |
| (if K.accepts x y a b then (if labels x = a then (1 : ℝ) else 0) else 0) = | |
| (if a = labels x then (if K.accepts x y a b then (1 : ℝ) else 0) else 0) := by | |
| by_cases h : a = labels x | |
| · subst a | |
| simp | |
| · simp [h, Ne.symm h] | |
| simp_rw [hpoint] | |
| simp | |
| rw [hsum] | |
| by_cases h : K.accepts x y (labels x) b = true <;> simp [h] | |
| end ProjectionKernel | |
| end MaxCutGames.Repetition | |
| /-! | |
| The collision norm as an actual finite distribution on symmetrized edges. | |
| An edge retains the hidden common right question, while each label remains a | |
| function of its own left question. Projection uniqueness turns the sum over | |
| common right answers into a Boolean compatibility predicate exactly. | |
| -/ | |
| namespace MaxCutGames.Repetition.ProjectionKernel | |
| section | |
| open Foundations.Games | |
| open scoped BigOperators | |
| attribute [local instance] Classical.propDecidable | |
| variable {Q₁ Q₂ A₁ A₂ Ω : Type*} | |
| [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] [Fintype Ω] | |
| abbrev SymmetricEdge (Q₁ Q₂ : Type*) := Q₂ × Q₁ × Q₁ | |
| def symmetricLeft (e : SymmetricEdge Q₁ Q₂) : Q₁ := e.2.1 | |
| def symmetricRight (e : SymmetricEdge Q₁ Q₂) : Q₁ := e.2.2 | |
| def symmetricDistribution (K : ProjectionKernel Q₁ Q₂ A₁ A₂) : | |
| FiniteDistribution (SymmetricEdge Q₁ Q₂) where | |
| weight e := K.outer.weight e.1 * (K.inner e.1).weight e.2.1 * | |
| (K.inner e.1).weight e.2.2 | |
| nonnegative e := mul_nonneg | |
| (mul_nonneg (K.outer.nonnegative _) ((K.inner _).nonnegative _)) | |
| ((K.inner _).nonnegative _) | |
| normalized := by | |
| rw [Fintype.sum_prod_type] | |
| calc | |
| _ = ∑ y, K.outer.weight y := by | |
| apply Finset.sum_congr rfl | |
| intro y _ | |
| rw [Fintype.sum_prod_type] | |
| calc | |
| _ = ∑ x, K.outer.weight y * (K.inner y).weight x := by | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| dsimp only | |
| rw [← Finset.mul_sum, (K.inner y).normalized, mul_one] | |
| _ = K.outer.weight y := by | |
| rw [← Finset.mul_sum, (K.inner y).normalized, mul_one] | |
| _ = 1 := K.outer.normalized | |
| def symmetricAccept (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (e : SymmetricEdge Q₁ Q₂) (a a' : A₁) : Bool := by | |
| classical | |
| exact decide (∃ b, K.accepts e.2.1 e.1 a b = true ∧ | |
| K.accepts e.2.2 e.1 a' b = true) | |
| /-- A coordinate has one possible nonzero label at each question. -/ | |
| def singleLabelVector (a : Q₁ → Ω → A₁) (f : Q₁ → Ω → ℝ) | |
| (ω : Ω) (x : Q₁) (b : A₁) : ℝ := by | |
| classical | |
| exact if a x ω = b then f x ω else 0 | |
| theorem sum_projection_gates (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (y : Q₂) (x x' : Q₁) (a a' : A₁) (r s : ℝ) : | |
| (∑ b, (if K.accepts x y a b then r else 0) * | |
| (if K.accepts x' y a' b then s else 0)) = | |
| if K.symmetricAccept (y, x, x') a a' then r * s else 0 := by | |
| classical | |
| by_cases hex : ∃ b, K.accepts x y a b = true ∧ K.accepts x' y a' b = true | |
| · obtain ⟨b₀, hb₀, hb₀'⟩ := hex | |
| have hex' : ∃ b, K.accepts x y a b = true ∧ K.accepts x' y a' b = true := | |
| ⟨b₀, hb₀, hb₀'⟩ | |
| simp only [symmetricAccept, hex', decide_true, ite_true] | |
| calc | |
| _ = (if K.accepts x y a b₀ then r else 0) * | |
| (if K.accepts x' y a' b₀ then s else 0) := by | |
| apply Finset.sum_eq_single b₀ | |
| · intro b _ hne | |
| have hb : K.accepts x y a b ≠ true := by | |
| intro hb | |
| exact hne (K.projection x y a b b₀ hb hb₀) | |
| simp [hb] | |
| · simp | |
| _ = r * s := by simp [hb₀, hb₀'] | |
| · simp only [symmetricAccept, hex, decide_false, Bool.false_eq_true, ite_false] | |
| apply Finset.sum_eq_zero | |
| intro b _ | |
| by_cases hb : K.accepts x y a b = true | |
| · have hb' : K.accepts x' y a' b ≠ true := fun hb' => hex ⟨b, hb, hb'⟩ | |
| simp [hb'] | |
| · simp [hb] | |
| theorem apply_single_label (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (labels : Q₁ → A₁) (f : Q₁ → ℝ) (y : Q₂) (b : A₂) : | |
| K.apply (fun x a => if labels x = a then f x else 0) y b = | |
| ∑ x, (K.inner y).weight x * (if K.accepts x y (labels x) b then f x else 0) := by | |
| classical | |
| unfold apply | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| congr 1 | |
| calc | |
| _ = ∑ a, if labels x = a then | |
| (if K.accepts x y (labels x) b then f x else 0) else 0 := by | |
| apply Finset.sum_congr rfl | |
| intro a _ | |
| by_cases ha : labels x = a | |
| · subst a | |
| simp | |
| · simp [ha] | |
| _ = _ := by simp | |
| theorem energy_single_label (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (labels : Q₁ → A₁) (f : Q₁ → ℝ) : | |
| K.energy (fun x a => if labels x = a then f x else 0) = | |
| K.symmetricDistribution.expectation (fun e => | |
| if K.symmetricAccept e (labels (symmetricLeft e)) (labels (symmetricRight e)) | |
| then f (symmetricLeft e) * f (symmetricRight e) else 0) := by | |
| classical | |
| have hexpand (y : Q₂) : | |
| (∑ b, (∑ x, (K.inner y).weight x * | |
| (if K.accepts x y (labels x) b then f x else 0)) ^ 2) = | |
| ∑ x, ∑ x', (K.inner y).weight x * (K.inner y).weight x' * | |
| (if K.symmetricAccept (y, x, x') (labels x) (labels x') | |
| then f x * f x' else 0) := by | |
| simp only [pow_two, Finset.sum_mul, Finset.mul_sum] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro x' _ | |
| calc | |
| _ = (K.inner y).weight x * (K.inner y).weight x' * | |
| ∑ b, (if K.accepts x y (labels x) b then f x else 0) * | |
| (if K.accepts x' y (labels x') b then f x' else 0) := by | |
| rw [Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro b _ | |
| ring | |
| _ = _ := by rw [K.sum_projection_gates] | |
| unfold energy | |
| simp_rw [K.apply_single_label, hexpand] | |
| simp only [FiniteDistribution.expectation, symmetricDistribution, | |
| Fintype.sum_prod_type, symmetricLeft, symmetricRight, Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro y _ | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| apply Finset.sum_congr rfl | |
| intro x' _ | |
| simp only [mul_assoc] | |
| rfl | |
| /-- Coordinate expansion and the symmetrized edge law agree exactly. -/ | |
| theorem vectorEnergy_singleLabelVector (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (a : Q₁ → Ω → A₁) (f : Q₁ → Ω → ℝ) : | |
| K.vectorEnergy (singleLabelVector a f) = | |
| pairEnergy K.symmetricDistribution symmetricLeft symmetricRight K.symmetricAccept a f := by | |
| classical | |
| unfold vectorEnergy singleLabelVector | |
| simp_rw [K.energy_single_label] | |
| unfold pairEnergy FiniteDistribution.expectation | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro e _ | |
| rw [Finset.mul_sum] | |
| /-- Ordinary deterministic labelings give the collision assignment energy. -/ | |
| theorem symmetric_probability_eq_assignmentEnergy (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (labels : Q₁ → A₁) : | |
| K.symmetricDistribution.probability (fun e => | |
| K.symmetricAccept e (labels (symmetricLeft e)) (labels (symmetricRight e))) = | |
| K.assignmentEnergy labels := by | |
| classical | |
| change _ = K.energy (fun x a => if labels x = a then (1 : ℝ) else 0) | |
| rw [K.energy_single_label] | |
| simp only [FiniteDistribution.probability, FiniteDistribution.expectation, | |
| mul_ite, mul_one, mul_zero] | |
| end | |
| /-! | |
| Apply finite positive-vector determinization to the actual projection kernel. | |
| The target coordinates retain both the right question and the right answer. | |
| The selected label may depend on the auxiliary coordinate, but only on its own | |
| left question. Every question's squared vector mass is preserved exactly. | |
| -/ | |
| open scoped BigOperators | |
| attribute [local instance] Classical.propDecidable | |
| variable {Q₁ Q₂ A₁ A₂ Ω : Type*} | |
| [Fintype Q₁] [Fintype Q₂] [Fintype A₁] [Fintype A₂] [Fintype Ω] | |
| /-- Explicit matrix coefficients of the projection operator. -/ | |
| def linearCoefficient (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (t : Q₂ × A₂) (x : Q₁) (a : A₁) : ℝ := | |
| (K.inner t.1).weight x * (if K.accepts x t.1 a t.2 then 1 else 0) | |
| theorem apply_eq_linearCoefficient_sum (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (h : Q₁ → A₁ → ℝ) (y : Q₂) (b : A₂) : | |
| K.apply h y b = ∑ x, ∑ a, K.linearCoefficient (y, b) x a * h x a := by | |
| unfold apply | |
| simp_rw [Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| apply Finset.sum_congr rfl | |
| intro a _ | |
| by_cases ha : K.accepts x y a b = true <;> simp [linearCoefficient, ha] | |
| theorem energy_eq_linearCoefficient_sum (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (h : Q₁ → A₁ → ℝ) : | |
| K.energy h = ∑ t : Q₂ × A₂, K.outer.weight t.1 * | |
| (∑ x, ∑ a, K.linearCoefficient t x a * h x a) ^ 2 := by | |
| rw [Fintype.sum_prod_type] | |
| simp_rw [← K.apply_eq_linearCoefficient_sum, ← Finset.mul_sum] | |
| rfl | |
| /-- Scalar kernel determinization preserves the whole mass at every question. -/ | |
| theorem exists_energy_le_deterministicVector [Nonempty A₁] | |
| (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (h : Q₁ → A₁ → ℝ) (hh : ∀ x a, 0 ≤ h x a) : | |
| ∃ labels : Q₁ → A₁, | |
| K.energy h ≤ K.energy (deterministicVector h labels) := by | |
| classical | |
| obtain ⟨labels, _, _, hlabels⟩ := exists_deterministic_vector h hh | |
| (fun t : Q₂ × A₂ => K.outer.weight t.1) | |
| (fun t => K.outer.nonnegative t.1) K.linearCoefficient | |
| refine ⟨labels, ?_⟩ | |
| rw [K.energy_eq_linearCoefficient_sum, K.energy_eq_linearCoefficient_sum] | |
| exact hlabels | |
| /-- The amplitude at a question is the sum of its original label entries. -/ | |
| def vectorAmplitude (h : Ω → Q₁ → A₁ → ℝ) (x : Q₁) (ω : Ω) : ℝ := | |
| rowMass (h ω) x | |
| omit [Fintype Ω] in | |
| omit [Fintype Q₁] in | |
| theorem vectorAmplitude_nonnegative (h : Ω → Q₁ → A₁ → ℝ) | |
| (hh : ∀ ω x a, 0 ≤ h ω x a) (x : Q₁) (ω : Ω) : | |
| 0 ≤ vectorAmplitude h x ω := | |
| rowMass_nonnegative (h ω) (hh ω) x | |
| omit [Fintype Q₁] in | |
| @[simp] theorem rowSquareMass_vectorAmplitude (h : Ω → Q₁ → A₁ → ℝ) (x : Q₁) : | |
| rowSquareMass (vectorAmplitude h) x = vectorMass h x := rfl | |
| /-- Auxiliary coordinates are determinized separately; they need not be | |
| independent, normalized, or nonempty. -/ | |
| theorem exists_vectorEnergy_le_singleLabelVector [Nonempty A₁] | |
| (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (h : Ω → Q₁ → A₁ → ℝ) (hh : ∀ ω x a, 0 ≤ h ω x a) : | |
| ∃ labels : Q₁ → Ω → A₁, | |
| K.vectorEnergy h ≤ K.vectorEnergy (singleLabelVector labels (vectorAmplitude h)) := by | |
| classical | |
| have hex (ω : Ω) := K.exists_energy_le_deterministicVector (h ω) (hh ω) | |
| let labels (ω : Ω) : Q₁ → A₁ := Classical.choose (hex ω) | |
| have hlabels (ω : Ω) : K.energy (h ω) ≤ | |
| K.energy (deterministicVector (h ω) (labels ω)) := Classical.choose_spec (hex ω) | |
| refine ⟨fun x ω => labels ω x, ?_⟩ | |
| apply Finset.sum_le_sum | |
| intro ω _ | |
| have heq : deterministicVector (h ω) (labels ω) = | |
| singleLabelVector (fun x ω => labels ω x) (vectorAmplitude h) ω := by | |
| funext x a | |
| by_cases ha : a = labels ω x | |
| · simp [deterministicVector, singleLabelVector, vectorAmplitude, ha] | |
| · simp [deterministicVector, singleLabelVector, ha, Ne.symm ha] | |
| exact heq ▸ hlabels ω | |
| /-- Package the deterministic labels, amplitudes, exact mass preservation, and | |
| energy inequality for use by the finite threshold-rounding construction. -/ | |
| theorem exists_mass_preserving_singleLabelVector [Nonempty A₁] | |
| (K : ProjectionKernel Q₁ Q₂ A₁ A₂) | |
| (h : Ω → Q₁ → A₁ → ℝ) (hh : ∀ ω x a, 0 ≤ h ω x a) : | |
| ∃ (labels : Q₁ → Ω → A₁) (f : Q₁ → Ω → ℝ), | |
| (∀ x ω, 0 ≤ f x ω) ∧ | |
| (∀ x, rowSquareMass f x = vectorMass h x) ∧ | |
| K.vectorEnergy h ≤ K.vectorEnergy (singleLabelVector labels f) := by | |
| obtain ⟨labels, hlabels⟩ := K.exists_vectorEnergy_le_singleLabelVector h hh | |
| exact ⟨labels, vectorAmplitude h, vectorAmplitude_nonnegative h hh, | |
| rowSquareMass_vectorAmplitude h, hlabels⟩ | |
| end MaxCutGames.Repetition.ProjectionKernel | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 30 kB
- Xet hash:
- 302a2d83c8f98bc35aa0b29b5774261505ff62d31acd37219f32e247b1b16a90
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.