@@ -407,20 +407,169 @@ theorem soundness_k {𝔽 : Type _} {n : ℕ} [Field 𝔽] [Fintype 𝔽] [Decid
407407
408408
409409
410- /-- **Partial-run dishonest-claim soundness.** K-parameterized version of
411- `soundness_dishonest`: when the claimed sum is wrong, no partial-run prover
412- convinces the verifier with probability more than `soundnessErrorK k`.
413- Same reduction-to-`soundness_k` structure as the full-run case; helpers
414- needed: a k-version of `accepts_on_challenges_dishonest_implies_bad` in
415- `SumcheckProtocol/Properties/Lemmas/SoundnessLemmas.lean`. -/
410+ theorem all_rounds_honest_of_not_bad_k_aux {𝔽 : Type _} {n : ℕ} [Field 𝔽] [Fintype 𝔽] [DecidableEq 𝔽]
411+ (k : Fin (n + 1 ))
412+ (p : CPoly.CMvPolynomial n 𝔽)
413+ (t : Transcript 𝔽 k.val)
414+ (domain : List 𝔽)
415+ (hNoBad : ¬ BadTranscriptEvent k domain p t) :
416+ ∀ i : Fin k.val,
417+ t.roundPolys i = honestRoundPolyAtK k domain p t.challenges i := by
418+ intro i
419+ by_contra hneq
420+ apply hNoBad
421+ refine ⟨i, ?_⟩
422+ simpa [BadRound] using hneq
423+
424+ theorem honest_round0_atK_domain_sum_eq_honest_claim_aux {𝔽 : Type _} {n' : ℕ} [Field 𝔽] [Fintype 𝔽] [DecidableEq 𝔽]
425+ (k : Fin (Nat.succ n' + 1 ))
426+ (domain : List 𝔽)
427+ (p : CPoly.CMvPolynomial (Nat.succ n') 𝔽)
428+ (r : Fin k.val → 𝔽)
429+ (hkpos : 0 < k.val) :
430+ let i0 : Fin k.val := ⟨0 , hkpos⟩
431+ domain.foldl (fun acc a =>
432+ acc + CPoly.CMvPolynomial.eval (fun _ : Fin 1 => a)
433+ (honestRoundPolyAtK k domain p r i0)) 0
434+ = honestClaim domain (p := p) := by
435+ dsimp
436+ let rExt : Fin (Nat.succ n') → 𝔽 := fun _ => 0
437+ have hbridge :
438+ honestRoundPolyAtK k domain p r ⟨0 , hkpos⟩ =
439+ honestRoundPoly domain p rExt ⟨0 , Nat.succ_pos n'⟩ := by
440+ apply honestRoundPolyAtK_eq_honestRoundPoly_of_extend
441+ intro j
442+ exact Fin.elim0 j
443+ rw [hbridge]
444+ simpa [rExt] using honest_round0_domain_sum_eq_honest_claim (domain := domain) (p := p) (r := rExt)
445+
446+ theorem claim_eq_honest_claim_of_accepts_and_all_rounds_honest_k_aux {𝔽 : Type _} {n : ℕ} [Field 𝔽] [Fintype 𝔽] [DecidableEq 𝔽]
447+ (k : Fin (n + 1 ))
448+ (st : SumcheckProtocolStatement 𝔽 n)
449+ (P : Prover (sumcheckProtocol (𝔽 := 𝔽) (n := n) k))
450+ (r : Fin k.val → 𝔽)
451+ (hall :
452+ ∀ i : Fin k.val,
453+ (proverTranscript k st P r).roundPolys i
454+ = honestRoundPolyAtK k st.domain st.polynomial r i)
455+ (hAcc : AcceptsEvent k st.domain st.polynomial st.claim (proverTranscript k st P r)) :
456+ st.claim = honestClaim st.domain (p := st.polynomial) := by
457+ classical
458+ let t : Transcript 𝔽 k.val := proverTranscript k st P r
459+ cases hk : k.val with
460+ | zero =>
461+ have hk0 : k = 0 := by
462+ apply Fin.ext
463+ simp [hk]
464+ subst hk0
465+ have hfinal :
466+ t.claims st.claim (Fin.last 0 ) =
467+ residualSum (𝔽 := 𝔽) st.domain t.challenges st.polynomial (Nat.zero_le n) := by
468+ exact decide_eq_true_eq.mp
469+ (acceptsEvent_final_ok_k (k := 0 ) st.domain (p := st.polynomial) (claim := st.claim) (t := t) hAcc)
470+ have hclaim0 : t.claims st.claim (Fin.last 0 ) = st.claim := by
471+ simpa [Transcript.claims] using
472+ (generate_honest_claims_zero st.claim t.roundPolys t.challenges)
473+ have hchal0 : t.challenges = (fun i : Fin 0 => i.elim0) := by
474+ funext i
475+ exact i.elim0
476+ have hhonest0 :
477+ residualSum (𝔽 := 𝔽) st.domain t.challenges st.polynomial (Nat.zero_le n)
478+ = honestClaim st.domain (p := st.polynomial) := by
479+ simpa [honestClaim, hchal0]
480+ calc
481+ st.claim = t.claims st.claim (Fin.last 0 ) := by simpa using hclaim0.symm
482+ _ = residualSum (𝔽 := 𝔽) st.domain t.challenges st.polynomial (Nat.zero_le n) := hfinal
483+ _ = honestClaim st.domain (p := st.polynomial) := hhonest0
484+ | succ m =>
485+ have hkpos : 0 < k.val := by
486+ simpa [hk]
487+ let i0 : Fin k.val := ⟨0 , hkpos⟩
488+ have hsum0 :
489+ st.domain.foldl (fun acc a =>
490+ acc + CPoly.CMvPolynomial.eval (fun _ : Fin 1 => a) (t.roundPolys i0)) 0
491+ =
492+ t.claims st.claim (Fin.castSucc i0) := by
493+ exact acceptsEvent_domain_sum_eq_claim_k k st.domain (p := st.polynomial) (claim := st.claim) (t := t) (i := i0) hAcc
494+ have hi0 : t.roundPolys i0 = honestRoundPolyAtK k st.domain st.polynomial r i0 := by
495+ simpa [t] using hall i0
496+ have hcast0 : Fin.castSucc i0 = 0 := by
497+ apply Fin.ext
498+ simp [i0]
499+ have hclaim0 : t.claims st.claim (Fin.castSucc i0) = st.claim := by
500+ rw [hcast0]
501+ simpa [Transcript.claims] using
502+ (generate_honest_claims_zero st.claim t.roundPolys t.challenges)
503+ have hn_pos : 0 < n := by
504+ omega
505+ obtain ⟨n', hn'⟩ : ∃ n' : ℕ, n = Nat.succ n' :=
506+ Nat.exists_eq_succ_of_ne_zero (Nat.pos_iff_ne_zero.mp hn_pos)
507+ subst hn'
508+ have htrue :
509+ st.domain.foldl (fun acc a =>
510+ acc + CPoly.CMvPolynomial.eval (fun _ : Fin 1 => a)
511+ (honestRoundPolyAtK k st.domain st.polynomial r i0)) 0
512+ = honestClaim st.domain (p := st.polynomial) := by
513+ simpa [i0] using
514+ (honest_round0_atK_domain_sum_eq_honest_claim_aux (k := k) (domain := st.domain)
515+ (p := st.polynomial) (r := r) hkpos)
516+ calc
517+ st.claim = t.claims st.claim (Fin.castSucc i0) := by simpa using hclaim0.symm
518+ _ = st.domain.foldl (fun acc a =>
519+ acc + CPoly.CMvPolynomial.eval (fun _ : Fin 1 => a) (t.roundPolys i0)) 0 := by
520+ symm
521+ exact hsum0
522+ _ = st.domain.foldl (fun acc a =>
523+ acc + CPoly.CMvPolynomial.eval (fun _ : Fin 1 => a)
524+ (honestRoundPolyAtK k st.domain st.polynomial r i0)) 0 := by
525+ simp [hi0]
526+ _ = honestClaim st.domain (p := st.polynomial) := htrue
527+
528+ theorem accepts_on_challenges_dishonest_implies_bad_k_aux {𝔽 : Type _} {n : ℕ} [Field 𝔽] [Fintype 𝔽] [DecidableEq 𝔽]
529+ (k : Fin (n + 1 ))
530+ (st : SumcheckProtocolStatement 𝔽 n)
531+ (P : Prover (sumcheckProtocol (𝔽 := 𝔽) (n := n) k))
532+ (r : Fin k.val → 𝔽)
533+ (hDish : st.claim ≠ honestClaim st.domain (p := st.polynomial))
534+ (hAcc : AcceptsEvent k st.domain st.polynomial st.claim (proverTranscript k st P r)) :
535+ BadTranscriptEvent k st.domain st.polynomial (proverTranscript k st P r) := by
536+ classical
537+ let t := proverTranscript k st P r
538+ by_contra hNoBad
539+ have hall :
540+ ∀ i : Fin k.val,
541+ t.roundPolys i = honestRoundPolyAtK k st.domain st.polynomial t.challenges i :=
542+ all_rounds_honest_of_not_bad_k_aux k st.polynomial t st.domain hNoBad
543+ have hall' :
544+ ∀ i : Fin k.val,
545+ (proverTranscript k st P r).roundPolys i = honestRoundPolyAtK k st.domain st.polynomial r i := by
546+ intro i
547+ simpa [t] using hall i
548+ have hEq : st.claim = honestClaim st.domain (p := st.polynomial) :=
549+ claim_eq_honest_claim_of_accepts_and_all_rounds_honest_k_aux k st P r hall' hAcc
550+ exact hDish hEq
551+
416552theorem soundness_dishonest_k {𝔽 : Type _} {n : ℕ} [Field 𝔽] [Fintype 𝔽] [DecidableEq 𝔽]
417553 (k : Fin (n + 1 ))
418554 (st : SumcheckProtocolStatement 𝔽 n)
419555 (P : Prover (sumcheckProtocol (𝔽 := 𝔽) (n := n) k))
420556 (h : st.claim ≠ honestClaim st.domain (p := st.polynomial)) :
421557 probOverChallenges (E := AcceptsOnChallenges k st P)
422558 ≤ soundnessErrorK k st.polynomial := by
423- sorry
559+ let hImp : ∀ r, AcceptsOnChallenges k st P r → AcceptsAndBadTranscriptOnChallenges k st P r := by
560+ intro r hAcc
561+ refine ⟨?_, ?_⟩
562+ · simpa [AcceptsOnChallenges, AcceptsAndBadTranscriptOnChallenges] using hAcc
563+ ·
564+ have hAcc' : AcceptsEvent k st.domain st.polynomial st.claim (proverTranscript k st P r) := by
565+ simpa [AcceptsOnChallenges] using hAcc
566+ exact accepts_on_challenges_dishonest_implies_bad_k_aux k st P r h hAcc'
567+ have hMono :
568+ probOverChallenges (E := AcceptsOnChallenges k st P) ≤
569+ probOverChallenges (E := AcceptsAndBadTranscriptOnChallenges k st P) := by
570+ exact prob_over_challenges_mono hImp
571+ exact le_trans hMono (soundness_k k st P)
572+
424573
425574-- Prob verifier accepts transcript when claim is not honest claim
426575theorem soundness_dishonest {𝔽 : Type _} {n : ℕ} [Field 𝔽] [Fintype 𝔽] [DecidableEq 𝔽]
0 commit comments