@[simp]theorembaseGame_accepts (F : Formula) (hne : F.clauses ≠ [])
(v : FinF.«variables») (c : FinF.clauses.length) (i : Bool) (j : ClauseAnswer) :
(baseGame F hne).accepts v c i j = baseAccepts F v c i j := rfl
theoremsum_slot_accepts (F : Formula) (alice : AliceStrategyF)
(bob : BobStrategyF) (c : FinF.clauses.length) :
(∑s : Slot, if accepts F alice bob (c,s) then (1 : ℝ) else0) =
(acceptedSlots (clauseAt F c) (alice c)
(honestAnswer (clauseAt F c) bob) : ℕ) :=by
proof · 8
lines
rw [sum_slots]
by_cases hs : localSatisfies (clauseAt F c) (alice c) = true
· by_cases h₁ : (alice c).first = bob (clauseAt F c)[0].variableIndex <;>
by_cases h₂ : (alice c).second = bob (clauseAt F c)[1].variableIndex <;>
by_cases h₃ : (alice c).third = bob (clauseAt F c)[2].variableIndex <;>
norm_num [accepts, hs, acceptedSlots, matchingSlots, honestAnswer, answerAt, nameAt,
h₁, h₂, h₃]
· simp [accepts, acceptedSlots, hs]
theoremfailureCount_eq_sum_map (F : Formula) (bob : BobStrategyF)
(cs : List (FinF.clauses.length)) :
failureCount F bob cs =
(cs.map (fun c => clauseFailure (clauseAt F c) bob)).sum :=by
proof · 3
lines
induction cs with
| nil => rfl
| cons c cs ih => simp only [failureCount, List.map_cons, List.sum_cons, ih]
theoremfailureCount_allIndices (F : Formula) (bob : BobStrategyF) :
failureCount F bob (allIndices F) =
∑c : FinF.clauses.length, clauseFailure (clauseAt F c) bob :=by
theoremverifier_probability_plus_failure (F : Formula) (hne : F.clauses ≠ [])
(alice : AliceStrategyF) (bob : BobStrategyF) :
(eventLaw F hne).probability (accepts F alice bob) +
(failureCount F bob (allIndices F) : ℝ) / (3 * F.clauses.length : ℕ) ≤1:=by
proof · 16
lines
havehm : (0 : ℝ) < (3 * F.clauses.length : ℕ) :=by
exact_mod_cast Nat.mul_pos (bydecide : 0 < 3) (List.length_pos_iff.mpr hne)
have hlocal (c : FinF.clauses.length) :
(∑s : Slot, if accepts F alice bob (c,s) then (1 : ℝ) else0) +
(clauseFailure (clauseAt F c) bob : ℝ) ≤3:=by
rw [sum_slot_accepts]
exact_mod_cast local_rejection_bound (clauseAt F c) (alice c) bob
have hsum :=Finset.sum_le_sum (fun c (_ : c ∈ (Finset.univ : Finset _)) => hlocal c)
simp only [Finset.sum_add_distrib, Finset.sum_const, Finset.card_univ,
Fintype.card_fin, nsmul_eq_mul] at hsum
rw [eventLaw_probability, failureCount_allIndices]
push_cast
push_cast at hm
rw [Fintype.sum_prod_type, ← add_div]
apply (div_le_one hm).mpr
simpa only [Nat.cast_mul, Nat.cast_ofNat, mul_comm] using hsum
theorembase_success_le_verifier (F : Formula) (hne : F.clauses ≠ [])
(strategy : Strategy (FinF.«variables») (FinF.clauses.length) BoolClauseAnswer) :
(baseGame F hne).success strategy ≤
(eventLaw F hne).probability (accepts F strategy.2 strategy.1) :=by
proof · 5
lines
unfold Game.success baseGame
rw [FiniteDistribution.probability_pushforward]
apply FiniteDistribution.probability_mono
intro e he
exact baseAccepts_implies_sampled F e.1 e.2 _ _ he
classical
apply FiniteDistribution.eq_of_weight_eq
intro z
simp only [FiniteDistribution.pushforward]
calc
_ = ∑y : Y, ∑x : X, if f x = y then
(if g y = z then μ.weight x else0) else0:=by
apply Finset.sum_congr rfl
intro y _
by_cases h : g y = z <;> simp [h]
_ = _ :=by rw [Finset.sum_comm]; simp
theoremrepeated_expectation (F : Formula) (hne : F.clauses ≠ []) (u : ℕ)
(H : VariableContextF u ×ClauseContextF u →ℝ) :
((baseGame F hne).repetition u).questions.expectation H =
𝔼 events : Fin u →RandomEventF, H (repeatedVisible F u events) :=by
theoremrepeated_expectation_split (F : Formula) (hne : F.clauses ≠ []) (u : ℕ)
(H : VariableContextF u ×ClauseContextF u →ℝ) :
((baseGame F hne).repetition u).questions.expectation H =
𝔼 c : ClauseContextF u, 𝔼 s : SlotContext u,
H (sampledVariables F c s, c) :=by
proof · 8
lines
rw [repeated_expectation]
calc
_ = 𝔼 p : ClauseContextF u ×SlotContext u,
H (sampledVariables F p.1 p.2, p.1) :=Fintype.expect_equiv
(Game.tupleQuestionEquiv (Q₁:=FinF.clauses.length) (Q₂:=Slot) u)
_ _ (fun _ => rfl)
_ = _ :=SourceTape.expect_prod _
theoremsource_acceptance_le_split (F : Formula) (hne : F.clauses ≠ []) (u : ℕ)
(ε δ : ℝ) (i₀ : VariableContextF u →I u)
(tableA : ∀ v, HalfCube (i₀ v) →Bool)
(right : ∀c : ClauseContextF u, ConditionedOracle (validJ F c))
(hε : 0 < ε) (hε' : ε ≤1 / 2) (hδ : 0≤ δ)
(hvalue : ((baseGame F hne).repetition u).value ≤4 * ε * δ ^ 2) :
(𝔼 c : ClauseContextF u, 𝔼 s : SlotContext u,
testAcceptance ε (pi F c (sampledVariables F c s))
(foldedAnswer (i₀ (sampledVariables F c s)) (tableA (sampledVariables F c s)))
(right c).answer) ≤ (1 + δ) / 2:=by
proof · 6
lines
have h := conditionedOracle_acceptance_bound
((baseGame F hne).repetition u).questions ε δ (fun v c => pi F c v)
(validJ F) i₀ tableA (fun _ => default) right hε hε' hδ
((projection_value_le_repetition F hne u).trans hvalue)
rw [repeated_expectation_split] at h
exact h