Download lean/OAI/Computability/VertexCover/Fourier/HonestTest.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 7.39 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Computability/VertexCover/Fourier/HonestTest.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Computability/VertexCover/Fourier/HonestTest.lean
-
curl -L -o HonestTest.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Computability/VertexCover/Fourier/HonestTest.lean
7.39 kB
Lean 4 · 13
declarations statementsfull
theorem dictator_test_parity (π : J → I) (i : I) (j : J) (hπ : π j = i)
(f : Cube I) (g μ : Cube J) :
(f i ^^ g j ^^ (thirdQuery π f g μ) j) = μ j := by proof · 2 lines
simp only [thirdQuery, cubeXor, hπ] cases f i <;> cases g j <;> cases μ j <;> rfl
theorem noise_coordinate_sign (ε : ℝ) (j : J) :
(∑ μ : Cube J, noiseWeight ε μ * bitSign (μ j)) = 1 - 2 * ε := by proof · 6 lines
have hs : support (coordinateMask j) = {j} := by
ext k
simp [support, coordinateMask]
have h := noise_walsh ε (coordinateMask j)
simp_rw [walsh_symm (coordinateMask j), walsh_coordinateMask] at h
simpa only [hs, Finset.card_singleton, pow_one] using htheorem noise_coordinate_false (ε : ℝ) (j : J) :
(∑ μ : Cube J, noiseWeight ε μ * if μ j then (0 : ℝ) else 1) = 1 - ε := by proof · 10 lines
have hind (b : Bool) : (if b then (0 : ℝ) else 1) =
(1 + bitSign b) * (2 : ℝ)⁻¹ := by
cases b <;> norm_num [bitSign]
have ht (μ : Cube J) : noiseWeight ε μ * (if μ j then (0 : ℝ) else 1) =
(noiseWeight ε μ + noiseWeight ε μ * bitSign (μ j)) * (2 : ℝ)⁻¹ := by
rw [hind]
ring
simp_rw [ht]
rw [← Finset.sum_mul, Finset.sum_add_distrib, noiseWeight_sum, noise_coordinate_sign]
ringtheorem testAcceptance_dictator (ε : ℝ) (π : J → I)
(i : I) (j : J) (hπ : π j = i) :
testAcceptance ε π (fun f => f i) (fun g => g j) = 1 - ε := by proof · 14 lines
have hg (f : Cube I) (μ : Cube J) :
(𝔼 g : Cube J, if f i ^^ g j ^^ (thirdQuery π f g μ) j then (0 : ℝ) else 1) =
if μ j then 0 else 1 := by
calc
_ = 𝔼 _g : Cube J, if μ j then (0 : ℝ) else 1 := by
apply Finset.expect_congr rfl
intro g _
rw [dictator_test_parity π i j hπ f g μ]
_ = _ := Fintype.expect_const _
change (𝔼 f : Cube I, ∑ μ : Cube J, noiseWeight ε μ *
(𝔼 g : Cube J, if f i ^^ g j ^^ (thirdQuery π f g μ) j then (0 : ℝ) else 1)) = _
simp_rw [hg]
rw [Fintype.expect_const]
exact noise_coordinate_false ε jtheorem testAcceptance_folded_dictators (ε : ℝ) (π : J → I)
(i₀ i : I) (j₀ j : J) (hπ : π j = i) :
testAcceptance ε π (foldedAnswer i₀ (fun h => h.val i))
(foldedAnswer j₀ (fun h => h.val j)) = 1 - ε := by proof · 6 lines
have hA : foldedAnswer i₀ (fun h => h.val i) = (fun f : Cube I => f i) :=
funext (foldedAnswer_dictator i₀ i)
have hB : foldedAnswer j₀ (fun h => h.val j) = (fun g : Cube J => g j) :=
funext (foldedAnswer_dictator j₀ j)
rw [hA, hB]
exact testAcceptance_dictator ε π i j hπtheorem testAcceptance_conditioned_dictators (ε : ℝ) (π : J → I)
(validI : I → Bool) (validJ : J → Bool)
(i₀ i : {i : I // validI i = true}) (j₀ j : {j : J // validJ j = true})
(hπ : π j.val = i.val) :
testAcceptance ε π
(conditionedFoldedAnswer validI i₀ (fun h => h.val i))
(conditionedFoldedAnswer validJ j₀ (fun h => h.val j)) = 1 - ε := by proof · 8 lines
have hA : conditionedFoldedAnswer validI i₀ (fun h => h.val i) =
(fun f : Cube I => f i.val) :=
funext (conditionedFoldedAnswer_dictator validI i₀ i)
have hB : conditionedFoldedAnswer validJ j₀ (fun h => h.val j) =
(fun g : Cube J => g j.val) :=
funext (conditionedFoldedAnswer_dictator validJ j₀ j)
rw [hA, hB]
exact testAcceptance_dictator ε π i.val j.val hπtheorem testAcceptance_folded_conditioned_dictators (ε : ℝ) (π : J → I)
(i₀ i : I) (valid : J → Bool)
(j₀ j : {j : J // valid j = true}) (hπ : π j.val = i) :
testAcceptance ε π (foldedAnswer i₀ (fun h => h.val i))
(conditionedFoldedAnswer valid j₀ (fun h => h.val j)) = 1 - ε := by proof · 7 lines
have hA : foldedAnswer i₀ (fun h => h.val i) = (fun f : Cube I => f i) :=
funext (foldedAnswer_dictator i₀ i)
have hB : conditionedFoldedAnswer valid j₀ (fun h => h.val j) =
(fun g : Cube J => g j.val) :=
funext (conditionedFoldedAnswer_dictator valid j₀ j)
rw [hA, hB]
exact testAcceptance_dictator ε π i j.val hπdef realizedTestAcceptance (D : Nat) (π : J → I)
(A : Cube I → Bool) (B : Cube J → Bool) : ℝ := body · 2 lines
𝔼 f : Cube I, 𝔼 z : J → Fin D, 𝔼 g : Cube J,
if A f ^^ B g ^^ B (thirdQuery π f g (realizedNoise z)) then 0 else 1theorem realizedTestAcceptance_eq_testAcceptance {D : Nat} (positive : 0 < D)
(π : J → I) (A : Cube I → Bool) (B : Cube J → Bool) :
realizedTestAcceptance D π A B = testAcceptance ((D : ℝ)⁻¹) π A B := by proof · 5 lines
unfold realizedTestAcceptance testAcceptance
apply Finset.expect_congr rfl
intro f _
exact expect_realizedNoise positive
(fun μ => 𝔼 g : Cube J, if A f ^^ B g ^^ B (thirdQuery π f g μ) then 0 else 1)theorem realizedTestAcceptance_dictator {D : Nat} (positive : 0 < D)
(π : J → I) (i : I) (j : J) (hπ : π j = i) :
realizedTestAcceptance D π (fun f => f i) (fun g => g j) = 1 - (D : ℝ)⁻¹ := by proof · 2 lines
rw [realizedTestAcceptance_eq_testAcceptance positive] exact testAcceptance_dictator _ π i j hπ
theorem realizedTestAcceptance_folded_dictators {D : Nat} (positive : 0 < D)
(π : J → I) (i₀ i : I) (j₀ j : J) (hπ : π j = i) :
realizedTestAcceptance D π (foldedAnswer i₀ (fun h => h.val i))
(foldedAnswer j₀ (fun h => h.val j)) = 1 - (D : ℝ)⁻¹ := by proof · 2 lines
rw [realizedTestAcceptance_eq_testAcceptance positive] exact testAcceptance_folded_dictators _ π i₀ i j₀ j hπ
theorem realizedTestAcceptance_conditioned_dictators {D : Nat} (positive : 0 < D)
(π : J → I) (validI : I → Bool) (validJ : J → Bool)
(i₀ i : {i : I // validI i = true}) (j₀ j : {j : J // validJ j = true})
(hπ : π j.val = i.val) :
realizedTestAcceptance D π
(conditionedFoldedAnswer validI i₀ (fun h => h.val i))
(conditionedFoldedAnswer validJ j₀ (fun h => h.val j)) = 1 - (D : ℝ)⁻¹ := by proof · 2 lines
rw [realizedTestAcceptance_eq_testAcceptance positive] exact testAcceptance_conditioned_dictators _ π validI validJ i₀ i j₀ j hπ
theorem realizedTestAcceptance_folded_conditioned_dictators {D : Nat} (positive : 0 < D)
(π : J → I) (i₀ i : I) (valid : J → Bool)
(j₀ j : {j : J // valid j = true}) (hπ : π j.val = i) :
realizedTestAcceptance D π (foldedAnswer i₀ (fun h => h.val i))
(conditionedFoldedAnswer valid j₀ (fun h => h.val j)) = 1 - (D : ℝ)⁻¹ := by proof · 2 lines
rw [realizedTestAcceptance_eq_testAcceptance positive] exact testAcceptance_folded_conditioned_dictators _ π i₀ i valid j₀ j hπ
Outline
- theorem
dictator_test_parity46 - theorem
noise_coordinate_sign52 - theorem
noise_coordinate_false61 - theorem
testAcceptance_dictator74 - theorem
testAcceptance_folded_dictators92 - theorem
testAcceptance_conditioned_dictators103 - theorem
testAcceptance_folded_conditioned_dictators119 - def
realizedTestAcceptance132 - theorem
realizedTestAcceptance_eq_testAcceptance137 - theorem
realizedTestAcceptance_dictator146 - theorem
realizedTestAcceptance_folded_dictators152 - theorem
realizedTestAcceptance_conditioned_dictators159 - theorem
realizedTestAcceptance_folded_conditioned_dictators169