Skip to content

feat(OracleReduction): prove identity verifier soundness and reduction log-discard - #681

Open
alexanderlhicks wants to merge 2 commits into
mainfrom
pr491-rebased
Open

feat(OracleReduction): prove identity verifier soundness and reduction log-discard#681
alexanderlhicks wants to merge 2 commits into
mainfrom
pr491-rebased

Conversation

@alexanderlhicks

Copy link
Copy Markdown
Collaborator

Supersedes #491 by @XC0R, rebased onto current main. The two proofs are XC0R's
work; this PR carries them past the v4.29 → v4.31 toolchain bump, drops one hunk
that main has since superseded, and fixes a line-length lint.

#491 could not be merged as-is: it was based on a three-month-old commit
(37298e66), conflicted in both files, and one of its three contributions is now
invalid rather than merely stale.

Kept

Verifier.id_soundness — replaces a sorry. Three other declarations depend
on it: OracleVerifier.id_soundness, Verifier.seqCompose_soundness and
OracleVerifier.seqCompose_soundness. All three reach it through implicit
simp firing, so none of them is visible to a text search — in particular
OracleVerifier.id_soundness is proved by simp [OracleVerifier.soundness] and
therefore silently inherited sorryAx on main despite looking proved.

Reduction.runWithLog_discard_logs_eq_run — replaces a sorry, plus the
supporting private lemma OptionT_liftM_bind_fst.

A whole-library scan (341,601 constants, Lean.collectAxioms run against a probe
axiom substituted for the proof) finds no consumers anywhere in ArkLib. It is
still worth proving: the lemma carries @[simp], so the admitted version sat in
the default simp set with a sorry behind it, ready to inject sorryAx into any
future proof whose goal matched its LHS. That is the hazard the previous
docstring warned about; proving it disarms the lemma, so the warning is dropped.

The scan's positive control is OracleVerifier.id_soundness, which reaches its
probe only via implicit simp — confirming the method detects exactly the kind
of reach that a null result would otherwise be suspected of missing.

Dropped

Verifier.id_knowledgeSoundness. Proved independently on main in #569,
which also strengthened the knowledgeSoundness definition to close a vacuity:
previously the always-failing extractor fun _ _ _ _ _ => failure discharged it
at error 0 for any verifier and any relations, because OptionT failure mass
falls outside probEvent. #491's proof targets the pre-#569 event shape — a bare
WitIn where the definition now carries Option WitIn — and no longer
typechecks. main's version is left untouched.

Verification

  • lake build green — 4135 jobs, 0 errors, on this exact commit
  • #print axioms[propext, Classical.choice, Quot.sound] for both theorems
    and for OracleVerifier.id_soundness; no sorryAx
  • 0 lint violations in the touched files

Scope note

The two seqCompose theorems remain sorryAx-tainted via the independent
append_soundness gap in Composition/Sequential/Append.lean. This PR removes
their dependence on this sorry; it does not make them axiom-clean.

The only sorry left in either touched file is the pre-existing, unrelated
Execution.lean:123 (fst_map_simulateQ_loggingOracle_run), which carries the
same @[simp]-contamination shape one lemma upstream and is worth a follow-up.

🤖 Generated with Claude Code

…n log-discard

Rebase of #491 (by @XC0R) onto current main, keeping only the contributions that
survive. The two proofs below are XC0R's work from that PR; this commit rebases
them past the v4.29 -> v4.31 toolchain bump, drops one hunk that main has since
superseded, and fixes a line-length lint.

- `Verifier.id_soundness`: replaces a `sorry`. Three other declarations depend
  on it -- `OracleVerifier.id_soundness`, `Verifier.seqCompose_soundness` and
  `OracleVerifier.seqCompose_soundness` -- all reaching it via implicit `simp`
  firing, so this removes their dependence on this `sorry`. They remain
  `sorryAx`-tainted via the independent `append_soundness` gap.

- `Reduction.runWithLog_discard_logs_eq_run`: replaces a `sorry`, plus the
  supporting private lemma `OptionT_liftM_bind_fst`. A whole-library scan
  (341601 constants, `Lean.collectAxioms` against a probe axiom substituted for
  the proof) finds no consumers anywhere in ArkLib. It is nonetheless worth
  proving: the lemma is `@[simp]`, so the admitted version sat in the default
  simp set ready to inject `sorryAx` into any future proof whose goal matched
  its LHS. Proving it disarms that, so the warning docstring is dropped.

Dropped from #491: its proof of `Verifier.id_knowledgeSoundness`. That theorem
was proved independently on main in #569, which also strengthened the
`knowledgeSoundness` definition to close a vacuity (the always-failing
extractor discharged it at error 0 for any verifier and any relations). #491's
proof targets the pre-#569 event shape -- a bare `WitIn` where the definition
now carries `Option WitIn` -- and no longer typechecks.

Verified: `lake build` green (4135 jobs); `#print axioms` reports
[propext, Classical.choice, Quot.sound] for both theorems and for
`OracleVerifier.id_soundness`; no `sorryAx`.

Co-authored-by: XC0R <8145037+XC0R@users.noreply.github.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Summary

sorry delta: -2 (2 removed) — net proof progress

Proof Completion (sorries removed)

Verifier.id_soundness (in ArkLib/OracleReduction/Security/Basic.lean): Replaces a sorry with a complete proof that ∀ stmtIn, stmtIn ∉ lang → probEvent (verifier.run stmtIn witness) = 0. The proof unfolds soundness, uses simulateQ_map and support_map reasoning, and an induction on OracleComp. This lemma is critical because it is implicitly used (via simp) by OracleVerifier.id_soundness and by both Verifier.seqCompose_soundness and OracleVerifier.seqCompose_soundness — all three previously inherited sorryAx despite appearing proved.

Reduction.runWithLog_discard_logs_eq_run (in ArkLib/OracleReduction/Execution.lean): Replaces a sorry with a proof that discarding both the prover’s and verifier’s query logs yields the bare reduction. The proof uses the new supporting lemma monadLift_bind_fst, Prover.runWithLog_discard_log_eq_run, and an induction on OracleComp. The theorem carries @[simp]; the admitted version previously exposed sorryAx to any future proof matching its LHS. A whole-library scan (341,601 constants) found no direct syntactic consumers of the lemma, but the implicit simp contamination is now removed.

Infrastructure / Refactoring

  • Execution.lean: Added a universe variable v' and the lemma monadLift_bind_fst that generalizes a pair‑projection property for monad lifts. Removed the now‑unused lemma Monad.map_of_prod_fst_eq_prod_fst.
  • Fixed a single line‑length lint violation.

Dropped Proof

The proof Verifier.id_knowledgeSoundness from the superseded PR #491 was dropped because main already contains a strengthened definition (from PR #569) that makes #491’s proof type‑incorrect and its vacuous result obsolete.

Remaining Sorries

One pre‑existing sorry remains in Execution.lean:123 (fst_map_simulateQ_loggingOracle_run), which carries the same @[simp]‑contamination shape and is a candidate for a follow‑up.

Verification

  • lake build passes (4135 jobs, 0 errors).
  • #print axioms for both theorems and for OracleVerifier.id_soundness yields only [propext, Classical.choice, Quot.sound]; no sorryAx.
  • Zero lint violations in the touched files.

The two seqCompose_soundness theorems remain axiom‑tainted via the independent append_soundness gap in Composition/Sequential/Append.lean. This PR removes their dependence on the sorries it addresses but does not make them axiom‑clean.


Statistics

Metric Count
📝 Files Changed 2
Lines Added 63
Lines Removed 33

Lean Declarations

✏️ Removed: 1 declaration(s)

ArkLib/OracleReduction/Execution.lean (1)

  • private lemma Monad.map_of_prod_fst_eq_prod_fst {m : Type u → Type v} [Monad m] [LawfulMonad m]
✏️ Added: 1 declaration(s)

ArkLib/OracleReduction/Execution.lean (1)

  • private lemma monadLift_bind_fst {m : Type u → Type v} {n : Type u → Type v'}

sorry Tracking

Removed: 2 `sorry`(s)

ArkLib/OracleReduction/Execution.lean (1)

  • theorem Reduction.runWithLog_discard_logs_eq_run (L427)

ArkLib/OracleReduction/Security/Basic.lean (1)

  • theorem Verifier.id_soundness {lang : Set StmtIn} : (L557)

📋 **Additional Analysis**

Style guide review of the PR diff reveals several violations of the ArkLib contribution guidelines, particularly in naming conventions and documentation standards. The PR resolves a previously admitted lemma and adds a new proof, but the new code does not fully adhere to the specified style.


📄 **Per-File Summaries**
  • ArkLib/OracleReduction/Execution.lean: The file adds a universe variable v' and a new lemma monadLift_bind_fst that generalizes a pair‑projection property for monad lifts. The previously sorry‑filled theorem Reduction.runWithLog_discard_logs_eq_run now has a complete proof that uses monadLift_bind_fst, Prover.runWithLog_discard_log_eq_run, and an induction on OracleComp to discard both the prover’s and verifier’s query logs. The old lemma Monad.map_of_prod_fst_eq_prod_fst is removed.
  • ArkLib/OracleReduction/Security/Basic.lean: The proof of Verifier.id_soundness was previously an incomplete sorry and has been replaced with a full proof. The new proof unfolds soundness, uses simulateQ_map and support_map reasoning, and shows that for any stmtIn not in lang, the probability of the verifier accepting is zero, thereby establishing soundness of the identity verifier.

Last updated: 2026-08-05 02:40 UTC.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Build Timing Report

  • Commit: d348ca9
  • Message: feat(OracleReduction): prove identity verifier soundness and reduction log-discard
  • Ref: pr491-rebased
  • Comparison baseline: 0a6d73a from the previous successful PR update.
  • Measured on ubuntu-latest with /usr/bin/time -p.
  • Commands: clean build rm -rf .lake/build && lake build; warm rebuild lake build; validation wrapper ./scripts/validate.sh.
Measurement Baseline (s) Current (s) Delta (s) Status
Clean build 813.79 1296.91 +483.12 ok
Warm rebuild 2.42 2.42 +0.00 ok
Validation wrapper 2.65 2.61 -0.04 ok

Incremental Rebuild Signal

  • Warm rebuild saved 1294.49s vs clean (535.91x faster).

This compares a clean project build against an incremental rebuild in the same CI job; it is a lightweight variability signal, not a full cross-run benchmark.

Slowest Current Clean-Build Files

Showing 20 slowest current targets, with comparison against the selected baseline when available.

Current (s) Baseline (s) Delta (s) Path
59.00 58.00 +1.00 ArkLib/Data/CodingTheory/GuruswamiSudan/Basic.lean
59.00 74.00 -15.00 ArkLib/ProofSystem/Stir/Combine.lean
56.00 64.00 -8.00 ArkLib/Data/CodingTheory/ProximityGap/DG25/MainResults.lean
51.00 62.00 -11.00 ArkLib/Data/CodingTheory/ProximityGap/BCIKS20/AffineSpaces.lean
50.00 58.00 -8.00 ArkLib/Data/CodingTheory/JohnsonBound/Lemmas.lean
48.00 50.00 -2.00 ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean
47.00 53.00 -6.00 ArkLib/Data/CodingTheory/ProximityGap/BCIKS20/AffineLines/BWMatrix.lean
36.00 41.00 -5.00 ArkLib/Data/CodingTheory/ProximityGap/Folding.lean
35.00 46.00 -11.00 ArkLib/Data/CodingTheory/BerlekampWelch/Condition.lean
35.00 41.00 -6.00 ArkLib/OracleReduction/LiftContext/Reduction.lean
33.00 23.00 +10.00 ArkLib/Commitments/Functional/KZG/Binding.lean
28.00 29.00 -1.00 ArkLib/Data/CodingTheory/DivergenceOfSets.lean
27.00 29.00 -2.00 ArkLib/Data/CodingTheory/JohnsonBound/Basic.lean
25.00 26.00 -1.00 ArkLib/Data/Polynomial/FoldingPolynomial.lean
24.00 38.00 -14.00 ArkLib/Commitments/Functional/KZG/FunctionBinding/EvaluationBindingConflict.lean
24.00 25.00 -1.00 ArkLib/Data/Polynomial/Indicator.lean
24.00 26.00 -2.00 ArkLib/ProofSystem/Sumcheck/Spec/SingleRound.lean
22.00 30.00 -8.00 ArkLib/OracleReduction/Security/RoundByRound.lean
21.00 20.00 +1.00 ArkLib/Data/CodingTheory/ReedSolomon.lean
20.00 21.00 -1.00 ArkLib/OracleReduction/Composition/Sequential/Append.lean

… and linter warnings

Addresses review findings on the identity-soundness / log-discard proofs. No statement changes;
both theorems remain axiom-clean.

1. Generalise the private helper and use core lemmas properly.

   `OptionT_liftM_bind_fst` was hard-coded to `OptionT m` at `Type 0`, and proved by unfolding
   `liftM` / `MonadLift.monadLift` / `OptionT.lift` / `OptionT.mk` through a goal-changing `show`
   plus `congr 1` -- of whose six `simp` arguments five were unused. It is in fact the
   `monadLift`-generic form of `bind_map_left`, so restate it for any
   `[MonadLiftT m n] [LawfulMonadLiftT m n]` over arbitrary universes as `monadLift_bind_fst`,
   proved by `rw [monadLift_map, bind_map_left]` (both Lean core). Shorter, strictly more general,
   and it no longer depends on how `OptionT`'s lift happens to be implemented.

2. Dead code, in the region these changes own.

   - Removed the ~20-line commented-out `calc` attempt below the now-proved theorem; the docstring
     that referred to it ("a partial `calc` attempt is retained in comments") is already gone.
   - Removed `private lemma Monad.map_of_prod_fst_eq_prod_fst`, which nothing references.

3. Linter warnings. The above removes all 8 that `lake build` reported inside the new code
   (1 × `linter.style.show`, 7 × `linter.unusedSimpArgs`). The warnings remaining in
   `Execution.lean` are pre-existing.

4. Comments. Replaced the "Remaining: ..." / "should equal" note in front of the closing `rfl`,
   which read as unfinished work, with a statement of what the `rfl` discharges; and recorded why
   the verifier-logging step needs an explicit induction rather than reusing VCV-io's
   `loggingOracle.fst_map_run_simulateQ` or ArkLib's `loggingOracle.map_fst_run_simulateQ` (the
   verifier's run sits under `liftM` inside `OptionT`, so its log is consumed by an `OptionT` bind
   rather than a `Prod.fst` map -- six drop-in variants of those lemmas were tried and none
   applies). Named the three anonymous shadowing `have`s at the end of `Verifier.id_soundness`.

Correction to the previous commit message: it says all three declarations that depend on
`Verifier.id_soundness` reach it by implicit `simp` firing and are invisible to a text search. Only
`OracleVerifier.id_soundness` does. `Verifier.seqCompose_soundness` names it outright
(`Composition/Sequential/General.lean`, `exact Verifier.id_soundness init impl`) and
`OracleVerifier.seqCompose_soundness` reaches it through that. The substantive claim is unaffected:
a library-wide `Lean.collectAxioms` sweep confirms exactly three declarations move from
`sorryAx`-tainted to clean -- `Verifier.id_soundness`, `OracleVerifier.id_soundness` (the one
silent dependent) and `Reduction.runWithLog_discard_logs_eq_run`.

Verified: `lake build` green (4135 jobs, 0 errors); `#print axioms` reports
[propext, Classical.choice, Quot.sound] for both theorems and for `OracleVerifier.id_soundness`;
no style-lint error and no build-linter warning inside the changed ranges.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant