Download data/lean/OAI/Computability/BinPacking/Expanders/SpectralCut.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 36.4 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/BinPacking/Expanders/SpectralCut.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/BinPacking/Expanders/SpectralCut.lean
-
curl -L -o SpectralCut.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/BinPacking/Expanders/SpectralCut.lean
36.4 kB
| import Mathlib.Algebra.Order.BigOperators.Expect | |
| import Mathlib.Basic.Real.Basic | |
| import Mathlib.Tactic.FieldSimp | |
| import Mathlib.Tactic.Linarith | |
| import Mathlib.Tactic.NormNum | |
| import Mathlib.Tactic.Positivity | |
| import Mathlib.Tactic.Ring | |
| import OAI.Computability.BinPacking.Information.GameDecoder | |
| import OAI.Computability.BinPacking.PCP.CloudRounding | |
| namespace OAI | |
| noncomputable section | |
| namespace BinPackingGames.Foundations.PCP.SpectralReturn | |
| open PoweringWalks | |
| open scoped BigOperators | |
| 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)) | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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) | |
| 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 | |
| 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] | |
| variable {V D : Type*} [Fintype V] [Fintype D] [Nonempty V] [Nonempty D] | |
| 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 | |
| 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 | |
| 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 BinPackingGames.Foundations.PCP.SpectralReturn | |
| namespace BinPackingGames.Foundations.PCP.CayleySpectral | |
| open scoped BigOperators | |
| open Finset | |
| open BinPackingGames.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] | |
| 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] | |
| 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 | |
| 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 | |
| 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)) | |
| 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] | |
| variable [Fintype I] [DecidableEq I] [Fintype D] | |
| def cayleyAverage (g : D β Cube I) (f : Cube I β β) (x : Cube I) : β := | |
| πΌ d, f ((cayleyGraph g).rot (x, d)).1 | |
| 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] | |
| 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 _ _ | |
| 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 | |
| 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 | |
| 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] | |
| 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] | |
| 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] | |
| 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 _) | |
| 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 BinPackingGames.Foundations.PCP.CayleySpectral | |
| namespace BinPackingGames.Foundations.PCP.ZigzagGraphs | |
| open PoweringWalks | |
| variable {V D E : Type*} | |
| def involutionEquiv {A : Type*} (f : A β A) (hf : Function.Involutive f) : A β A where | |
| toFun := f | |
| invFun := f | |
| left_inv := hf | |
| right_inv := hf | |
| theorem palindrome_involutive {A : Type*} (B P : A β A) | |
| (hB : Function.Involutive B) (hP : Function.Involutive P) : | |
| Function.Involutive (B.trans (P.trans B)) := by | |
| intro x | |
| change B (P (B (B (P (B x))))) = x | |
| rw [hB, hP, hB] | |
| def squareFirst (G : PortGraph V D) (s : V Γ (D Γ D)) : V Γ (D Γ D) := | |
| let step := G.rot (s.1, s.2.1) | |
| (step.1, (step.2, s.2.2)) | |
| theorem squareFirst_involutive (G : PortGraph V D) : Function.Involutive (squareFirst G) := by | |
| rintro β¨v, dβ, dββ© | |
| change ((G.rot (G.rot (v, dβ))).1, ((G.rot (G.rot (v, dβ))).2, dβ)) = | |
| (v, (dβ, dβ)) | |
| rw [G.rot_involutive] | |
| def squareSwap (s : V Γ (D Γ D)) : V Γ (D Γ D) := (s.1, (s.2.2, s.2.1)) | |
| theorem squareSwap_involutive : Function.Involutive (squareSwap (V := V) (D := D)) := by | |
| rintro β¨v, dβ, dββ© | |
| rfl | |
| def square (G : PortGraph V D) : PortGraph V (D Γ D) := by | |
| let B := involutionEquiv (squareFirst G) (squareFirst_involutive G) | |
| let P := involutionEquiv (squareSwap (V := V) (D := D)) squareSwap_involutive | |
| exact | |
| { rot := B.trans (P.trans B) | |
| rot_involutive := palindrome_involutive B P | |
| (squareFirst_involutive G) squareSwap_involutive } | |
| @[simp] theorem square_rot_apply (G : PortGraph V D) (v : V) (dβ dβ : D) : | |
| (square G).rot (v, (dβ, dβ)) = | |
| let first := G.rot (v, dβ) | |
| let second := G.rot (first.1, dβ) | |
| (second.1, (second.2, first.2)) := rfl | |
| @[simp] theorem square_next (G : PortGraph V D) (v : V) (dβ dβ : D) : | |
| next (square G) v (dβ, dβ) = next G (next G v dβ) dβ := rfl | |
| def cloudFirst (H : PortGraph D E) (s : (V Γ D) Γ (E Γ E)) : | |
| (V Γ D) Γ (E Γ E) := | |
| let step := H.rot (s.1.2, s.2.1) | |
| ((s.1.1, step.1), (step.2, s.2.2)) | |
| theorem cloudFirst_involutive (H : PortGraph D E) : | |
| Function.Involutive (cloudFirst (V := V) H) := by | |
| rintro β¨β¨v, dβ©, β¨eβ, eββ©β© | |
| change ((v, (H.rot (H.rot (d, eβ))).1), ((H.rot (H.rot (d, eβ))).2, eβ)) = | |
| ((v, d), (eβ, eβ)) | |
| rw [H.rot_involutive] | |
| def crossCloud (G : PortGraph V D) (s : (V Γ D) Γ (E Γ E)) : | |
| (V Γ D) Γ (E Γ E) := (G.rot s.1, (s.2.2, s.2.1)) | |
| theorem crossCloud_involutive (G : PortGraph V D) : | |
| Function.Involutive (crossCloud (E := E) G) := by | |
| rintro β¨x, eβ, eββ© | |
| change (G.rot (G.rot x), (eβ, eβ)) = (x, (eβ, eβ)) | |
| rw [G.rot_involutive] | |
| def zigzag (G : PortGraph V D) (H : PortGraph D E) : PortGraph (V Γ D) (E Γ E) := by | |
| let B := involutionEquiv (cloudFirst (V := V) H) (cloudFirst_involutive H) | |
| let P := involutionEquiv (crossCloud (E := E) G) (crossCloud_involutive G) | |
| exact | |
| { rot := B.trans (P.trans B) | |
| rot_involutive := palindrome_involutive B P | |
| (cloudFirst_involutive H) (crossCloud_involutive G) } | |
| @[simp] theorem zigzag_rot_apply (G : PortGraph V D) (H : PortGraph D E) | |
| (v : V) (d : D) (eβ eβ : E) : | |
| (zigzag G H).rot ((v, d), (eβ, eβ)) = | |
| let first := H.rot (d, eβ) | |
| let middle := G.rot (v, first.1) | |
| let last := H.rot (middle.2, eβ) | |
| ((middle.1, last.1), (last.2, first.2)) := rfl | |
| theorem natCard_square_ports : Nat.card (D Γ D) = Nat.card D ^ 2 := by | |
| simp [Nat.card_prod, pow_two] | |
| theorem natCard_square_edges : | |
| Nat.card (Edge V (D Γ D)) = Nat.card V * Nat.card D ^ 2 := by | |
| simp [Edge, Nat.card_prod, pow_two] | |
| theorem natCard_zigzag_vertices : | |
| Nat.card (V Γ D) = Nat.card V * Nat.card D := Nat.card_prod V D | |
| theorem natCard_zigzag_ports : Nat.card (E Γ E) = Nat.card E ^ 2 := by | |
| simp [Nat.card_prod, pow_two] | |
| theorem natCard_zigzag_edges : | |
| Nat.card (Edge (V Γ D) (E Γ E)) = | |
| Nat.card V * Nat.card D * Nat.card E ^ 2 := by | |
| simp [Edge, Nat.card_prod, pow_two] | |
| def cloudOperator [Fintype E] (H : PortGraph D E) (f : V Γ D β β) (x : V Γ D) : β := | |
| SpectralReturn.mean (fun e => f (x.1, (H.rot (x.2, e)).1)) | |
| def graphPermutation (G : PortGraph V D) (f : V Γ D β β) (x : V Γ D) : β := | |
| f (G.rot x) | |
| theorem averagingOperator_square [Fintype D] (G : PortGraph V D) (f : V β β) : | |
| SpectralReturn.averagingOperator (square G) f = | |
| SpectralReturn.averagingOperator G (SpectralReturn.averagingOperator G f) := by | |
| funext v | |
| let w : D Γ D β β := fun ds => f (G.rot ((G.rot (v, ds.1)).1, ds.2)).1 | |
| change SpectralReturn.mean w = | |
| SpectralReturn.mean (fun dβ => SpectralReturn.mean (fun dβ => w (dβ, dβ))) | |
| exact SpectralReturn.mean_prod w | |
| theorem averagingOperator_zigzag [Fintype E] (G : PortGraph V D) | |
| (H : PortGraph D E) (f : V Γ D β β) : | |
| SpectralReturn.averagingOperator (zigzag G H) f = | |
| cloudOperator H (graphPermutation G (cloudOperator H f)) := by | |
| funext x | |
| rcases x with β¨v, dβ© | |
| let w : E Γ E β β := fun es => | |
| let first := H.rot (d, es.1) | |
| let middle := G.rot (v, first.1) | |
| let last := H.rot (middle.2, es.2) | |
| f (middle.1, last.1) | |
| change SpectralReturn.mean w = | |
| SpectralReturn.mean (fun eβ => SpectralReturn.mean (fun eβ => w (eβ, eβ))) | |
| exact SpectralReturn.mean_prod w | |
| end BinPackingGames.Foundations.PCP.ZigzagGraphs | |
| namespace BinPackingGames.Foundations.PCP.SpectralCut | |
| open scoped BigOperators | |
| open PoweringWalks SpectralReturn | |
| section Indicators | |
| variable {V : Type*} [Fintype V] [DecidableEq V] | |
| def indicator (S : Finset V) (v : V) : β := if v β S then 1 else 0 | |
| theorem mean_indicator (S : Finset V) : | |
| mean (indicator S) = (S.card : β) / (Fintype.card V : β) := by | |
| have hf : Finset.univ.filter (fun v : V => v β S) = S := by | |
| ext v | |
| simp | |
| rw [mean_eq_sum_div_card] | |
| simp only [indicator, Finset.sum_boole, hf] | |
| theorem energy_indicator (S : Finset V) : energy (indicator S) = mean (indicator S) := by | |
| unfold energy | |
| congr 1 | |
| funext v | |
| unfold indicator | |
| split_ifs <;> norm_num | |
| omit [Fintype V] in | |
| theorem indicator_nonnegative (S : Finset V) (v : V) : 0 β€ indicator S v := by | |
| unfold indicator | |
| split_ifs <;> norm_num | |
| end Indicators | |
| variable {V D : Type*} [Fintype V] [Fintype D] [DecidableEq V] | |
| def cut (G : PortGraph V D) (S : Finset V) : Finset (V Γ D) := | |
| Finset.univ.filter (fun e => e.1 β S β§ (G.rot e).1 β S) | |
| section Nonempty | |
| variable [Nonempty V] [Nonempty D] (G : PortGraph V D) | |
| omit [Nonempty V] in | |
| theorem cut_density_eq (S : Finset V) : | |
| ((cut G S).card : β) / (Fintype.card (V Γ D) : β) = | |
| mean (indicator S) - correlation (indicator S) (averagingOperator G (indicator S)) := by | |
| classical | |
| calc | |
| _ = mean (indicator (cut G S)) := (mean_indicator (cut G S)).symm | |
| _ = mean (fun e : V Γ D => indicator S e.1 - | |
| indicator S e.1 * indicator S (G.rot e).1) := by | |
| congr 1 | |
| funext e | |
| by_cases hv : e.1 β S <;> by_cases hw : (G.rot e).1 β S <;> | |
| simp [indicator, cut, hv, hw] | |
| _ = mean (fun v => mean (fun d : D => indicator S v - | |
| indicator S v * indicator S (G.rot (v,d)).1)) := mean_prod _ | |
| _ = mean (fun v => indicator S v - | |
| indicator S v * averagingOperator G (indicator S) v) := by | |
| congr 1 | |
| funext v | |
| rw [mean_sub, mean_const, mean_mul_left] | |
| rfl | |
| _ = _ := mean_sub _ _ | |
| theorem cut_density_ge_variance | |
| (certificate : SpectralCertificate G (1/2)) (S : Finset V) : | |
| (1/2:β) * mean (indicator S) * (1 - mean (indicator S)) β€ | |
| ((cut G S).card : β) / (Fintype.card (V Γ D) : β) := by | |
| let f := indicator S | |
| have hz : mean (fun v => f v - mean f) = 0 := by | |
| rw [mean_sub, mean_const, sub_self] | |
| have he : energy (fun v => f v - mean f) = mean f - mean f ^ 2 := by | |
| rw [energy_sub_const, energy_indicator] | |
| ring | |
| have hb := zero_mean_correlation_bound G (1/2) certificate | |
| (fun v => f v - mean f) hz 1 | |
| have hc := correlation_centered G f 1 | |
| simp only [iterateOperator, pow_one, he] at hb hc | |
| rw [cut_density_eq] | |
| change (1/2:β) * mean f * (1 - mean f) β€ | |
| mean f - correlation f (averagingOperator G f) | |
| nlinarith | |
| theorem cut_density_ge_quarter | |
| (certificate : SpectralCertificate G (1/2)) (S : Finset V) | |
| (hsmall : 2 * S.card β€ Fintype.card V) : | |
| mean (indicator S) / 4 β€ | |
| ((cut G S).card : β) / (Fintype.card (V Γ D) : β) := by | |
| have hN : (0:β) < Fintype.card V := by exact_mod_cast Fintype.card_pos | |
| have hp0 : 0 β€ mean (indicator S) := mean_nonnegative _ (indicator_nonnegative S) | |
| have hp : mean (indicator S) β€ (1/2:β) := by | |
| rw [mean_indicator] | |
| apply (div_le_iffβ hN).mpr | |
| have hs : (2:β) * (S.card : β) β€ (Fintype.card V : β) := by exact_mod_cast hsmall | |
| nlinarith | |
| have hv := cut_density_ge_variance G certificate S | |
| have hprod := mul_nonneg hp0 (sub_nonneg.mpr hp) | |
| nlinarith | |
| theorem cut_card_ge_quarter_degree | |
| (certificate : SpectralCertificate G (1/2)) (S : Finset V) | |
| (hsmall : 2 * S.card β€ Fintype.card V) : | |
| (Fintype.card D : β) * (S.card : β) / 4 β€ ((cut G S).card : β) := by | |
| have hN : (0:β) < Fintype.card V := by exact_mod_cast Fintype.card_pos | |
| have hD : (0:β) < Fintype.card D := by exact_mod_cast Fintype.card_pos | |
| have h := cut_density_ge_quarter G certificate S hsmall | |
| rw [Fintype.card_prod, Nat.cast_mul] at h | |
| have hh := (le_div_iffβ (mul_pos hN hD)).mp h | |
| have he : mean (indicator S) / 4 * | |
| ((Fintype.card V : β) * (Fintype.card D : β)) = | |
| (Fintype.card D : β) * (S.card : β) / 4 := by | |
| rw [mean_indicator] | |
| field_simp [ne_of_gt hN] | |
| rw [he] at hh | |
| exact hh | |
| theorem degree_mul_card_le_four_cut | |
| (certificate : SpectralCertificate G (1/2)) (S : Finset V) | |
| (hsmall : 2 * S.card β€ Fintype.card V) : | |
| Fintype.card D * S.card β€ 4 * (cut G S).card := by | |
| have h := cut_card_ge_quarter_degree G certificate S hsmall | |
| have hr : (Fintype.card D : β) * (S.card : β) β€ 4 * ((cut G S).card : β) := by | |
| linarith | |
| exact_mod_cast hr | |
| theorem cut_card_ge_quarter_degree_of_card_le_half | |
| (certificate : SpectralCertificate G (1/2)) (S : Finset V) | |
| (hsmall : S.card β€ Fintype.card V / 2) : | |
| (Fintype.card D : β) * (S.card : β) / 4 β€ ((cut G S).card : β) := | |
| cut_card_ge_quarter_degree G certificate S (by omega) | |
| end Nonempty | |
| theorem cut_card_ge_twice (G : PortGraph V D) | |
| (certificate : SpectralCertificate G (1/2)) (hdegree : 8 β€ Fintype.card D) | |
| (S : Finset V) (hsmall : 2 * S.card β€ Fintype.card V) : | |
| 2 * S.card β€ (cut G S).card := by | |
| let : Nonempty D := Fintype.card_pos_iff.mp (by omega) | |
| rcases isEmpty_or_nonempty V with hV | hV | |
| Β· let := hV | |
| have hzero : Fintype.card V = 0 := Fintype.card_eq_zero | |
| have hs : S.card = 0 := by omega | |
| simp only [hs, mul_zero, Nat.zero_le] | |
| Β· let := hV | |
| have h := degree_mul_card_le_four_cut G certificate S hsmall | |
| have hdeg := Nat.mul_le_mul_right S.card hdegree | |
| omega | |
| end BinPackingGames.Foundations.PCP.SpectralCut | |
| end | |
| end OAI | |