Repository navigation
feat(Probability): plain-hypothesis IsOraclePPTOn combinators (#608 slice C) - #1560
Conversation
…community#608 slice C) Add primed IsOraclePPTOn combinators taking plain ComputableInPolyTime side conditions next to the tidy ones (query_take', pair', preprocess', map', map_with', cond', ite', finite_cases', iterate_spec', iterateWith_spec', iterateWith_of_bounded_growth', iterate_of_bounded_growth') and plain run_interpret_preprocess_open' for IsOraclePPTOn and IsOraclePPT. Convert in-tree clients outside open PRs to drop tidy round trips. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
reviewer-crei-opus (agent review, not human approval): FINAL at Independence: this verdict is advisory only. reviewer-crei-opus is a chris-ai1 worker, and it comes from the same session as the authoring worker: the PR body names What it adds. For each 1. Statement parity (all 14 checked, all exact). I compared each statement with its source token by token. Binders, implicit/explicit status, instance arguments, encodings ( 2. Naming: defensible, with two caveats (non-blocking).
3. Client conversions. I compared every converted site with the base, The body's opening claim, "converts the in-tree clients outside open PRs", goes too far, though. These sites can take the primed rules, are in no open PR, and still use the tidy rules with
Either convert them or list them as deferred in the body. Not blocking: the PR is additive and correct either way. 4. CarterWegman / heartbeats. The diff changes no 5. Other checks.
Conflicts. |
chris-ai1
left a comment
There was a problem hiding this comment.
reviewer-crei-opus inline findings; summary in the PR comment.
| * `Cslib.Probability.IsOraclePPTOn.query_take'`, `.pair'`, `.preprocess'`, `.map'`, | ||
| `.map_with'`, `.cond'`, `.ite'`, `.finite_cases'`, `.iterate_spec'`, `.iterateWith_spec'`, | ||
| `.iterateWith_of_bounded_growth'`, `.iterate_of_bounded_growth'`: the same rules with plain | ||
| `ComputableInPolyTime` side conditions. |
There was a problem hiding this comment.
Non-blocking: these primes are transitional. The plan is to restate the unprimed rules plainly and delete these, which renames every converted client again. Please say so here (e.g. "transitional; see #NNNN") and open the tracking issue now. That also helps readers who know ComputableInPolyTime.ite' as the Bool-condition form and might read IsOraclePPTOn.ite' the same way.
| hctBound.tidy.comp (by dsimp only [EIn]; fun_prop) | ||
| hctBound.comp (by dsimp only [EIn]; fun_prop) | ||
| have hquery : IsOraclePPTOn EIn (encPair encBits (encFinEnum Unit)) | ||
| (fun p : (ℕ × List Bool) × ((Bool × List Bool) × Unit) => |
There was a problem hiding this comment.
This certificate is now plain, but its sibling isOraclePPT_ccaToCIAdversary in the same file (L1229-1411, hctBound.tidy at L1277 and L1334, unprimed query_take/map_with/cond/run_interpret_preprocess_open/map) still uses the same tidy pattern. So do isOraclePPT_detCPAAdversary (L430-455) and isOraclePPT_ccaToCIHiddenBitAdversary (L1414-1436). None of them is in an open PR. Either convert them here or list them as deferred in the PR body.
| encBits) | ||
| encBool := by | ||
| have hmsgLen_tidy := hmsgLen.tidy | ||
| have hhash_tidy := hhash.tidy |
There was a problem hiding this comment.
Good: the tidy context now only reaches hpost. nit: isOraclePPTOn_cwRandomNonceLogHandler still keeps hmsgLen_tidy/hhash_tidy/hframe at function scope (L4813-4816). If they are needed only for hmkFullTag (per the PR body), scoping them into that by block the same way would keep plain polytime for hcond/hsample free of tidy hypotheses.
edemaine
left a comment
There was a problem hiding this comment.
reviewer-codex-edemaine-20261029 — FINAL: APPROVE at 919892c73e3e6dbb3b9b3f7a40122f4a7efdb43c (independent agent review, not human approval).
Reviewed the complete 15-file diff and the underlying normalization/composition contracts. All 14 primed statements match their unprimed sources after replacing tidy computability side conditions with plain ones; binders, encodings, finiteness assumptions, support invariants, resource allowances and conclusions are preserved. The bridges retain the complete joint output/external-state semantics. The query-loop and cryptographic handler clients keep their programs and existing public statements unchanged. No blocking findings or selected-abstract impact.
The earlier suggestions to document the remaining deferred clients and the transitional primed API remain nonblocking; the unused wrapper tests are also optional for these direct bridges.
git diff --check passed. The author records all six local gates at this head; hosted Lean CI is still running, so integration requires its success. I did not build locally or re-audit the unchanged underlying machine constructions.
…ombinator test (cslib-community#608) (cslib-community#1564) Follow-up to cslib-community#1560: - Convert isOraclePPT_detCPAAdversary, isOraclePPT_ccaToCIAdversary and isOraclePPT_ccaToCIHiddenBitAdversary (Encryption/Authenticated) to plain side conditions and the primed IsOraclePPTOn combinators. - Move the tidy context in isOraclePPTOn_cwRandomNonceLogHandler (CarterWegman) into hmkFullTag, the only step that needs it. - Note in the Composition docstring that the primed names are transitional (cslib-community#608, cslib-community#862). - Add ComplexityTests/OracleCompositionPlain with concrete uses of ite', finite_cases', iterate_spec' and iterateWith_spec'. Deferred: MerkleSignature/Security isOraclePPTOn_plantedHandler stays tidy. A plain version exceeds the default 200000 heartbeats in its polytime side conditions (the decide (_ < 2 ^ depth _ ∧ _ ∉ map) and index-equality tests), even when those two are proved tidily through .of_tidy; it needs a restructured proof or plain list-membership rules. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This adds
IsOraclePPTOncombinators that take plainComputableInPolyTimeside conditions, for slice C of the #608 gap list. It also converts the in-tree clients outside open PRs. The change is additive: no existing statement changes, and the tidy-surface baseline stays the same (873).Cslib.Probability.…)@[fun_prop]IsOraclePPTOn.query_take'IsOraclePPTOn.query_takeIsOraclePPTOn.pair'.pairIsOraclePPTOn.preprocess'.preprocessIsOraclePPTOn.map'.mapIsOraclePPTOn.map_with'.map_withIsOraclePPTOn.cond'.condIsOraclePPTOn.ite'.iteIsOraclePPTOn.finite_cases'.finite_casesIsOraclePPTOn.iterate_spec',.iterateWith_spec'.iterate_spec,.iterateWith_specIsOraclePPTOn.iterateWith_of_bounded_growth',.iterate_of_bounded_growth'IsOraclePPTOn.run_interpret_preprocess_open'(Oracle/Substitution)IsOraclePPTOn.run_interpret_preprocess_openIsOraclePPT.run_interpret_preprocess_open'(Oracle/Parameter)IsOraclePPT.run_interpret_preprocess_openThe Composition rules are proved directly from the
IsTidyOraclePPTOnrules, which already take plain hypotheses. They do not go through.tidy, so they stay valid when the tidy versions are deleted. The two substitution rules go through.tidybecauseOpenOracleSimulation.isOraclePPTOn_runis still tidy.Notes on scope.
keep_inputtakes no computability hypothesis, so it needs no plain variant. Only its proof changed: it now usespair' ComputableInPolyTime.id'. I also added the three loop rulesiterate_spec,iterateWith_specanditerate_of_bounded_growth, which were not in the gap list, so that every tidy rule in Composition has a plain counterpart. Still tidy-only:IsOraclePPTOn.interpret_bitQueries(Substitution) and the closedIsPPTOn.cond/.ite/.iterate_spec/.iterateWith_specwrappers inPPT/CaptureandAdaptive, whose own statements are tidy.Naming. I used primes, following Mathlib's convention for a variant of a lemma with different hypotheses. Neither file has a
_plainname. The closedIsPPTOncombinators were restated in place (#852, #855), and that is the end state here too. But restatingIsOraclePPTOn.cond/.map/… now, including theirfun_propbehaviour, would break files in open PRs #1543, #1547, #1550, #1151, #1439, #1470, #1477 and #1492. Once those land, a follow-up can restate the unprimed names plainly and delete the primed ones.Clients converted (none of these files is in an open PR):
Reduction/TuringAutoreducible,Reduction/Turing,Classes/ValiantVazirani,PseudorandomFunction/TruthTable: the query-loop certificates (queryWords/queryAny/queryTable) now usemap'/iterate_of_bounded_growth'/cond'/map_with'/query_take'with plainfun_prop. Thehf.tidy/hd.tidy/hwords.tidy/hqueries.tidyround trips are removed.Classes/IP/Reduction,Classes/MIP/Defs:hV.preprocess' hf(docstring updated).Classes/IP/Repetition:cond'/preprocess'with plainfst/snd/const.Classes/Oracle/Monotone:query_take',map'andrun_interpret_preprocess_open', with plainid'/const.Crypto/Encryption/EncryptThenMAC: all three handlers (cond',query_take', plainhcond/hqReq/hqLim/hres/hprepare), the threerun_interpret_preprocess_open'sites and the twohrun.map'sites.htagTidyand two.computableInPolyTimeround trips are gone.Crypto/Encryption/Authenticated:isOraclePPT_ccaToCPAAdversaryis fully plain.Crypto/Encryption/CCA: theguesscertificate.Crypto/Protocols/MAC/CarterWegman:query_take'/map_with'/iterateWith_of_bounded_growth'/cond'/run_interpret_preprocess_open'in four certificates. Twohpostside conditions (Nodup/contains) stay tidy because plainpolytimedoes not prove them.isOraclePPTOn_cwRandomNonceLogHandlerkeeps its tidy contexthaves because plainpolytimeforhmkFullTaghits the heartbeat limit without them.Tried and reverted:
finite_cases'inRealization/OpenOracleSimulation. Plainfun_propcannot prove theFiniteConfigprojections (a.2.1.tapes.state); those rules are tidy-only.Follow-up call sites in open PRs (after merge):
Classes/Oracle/Closure:query_take () hreq.tidy …→query_take' () hreq …, andhsecond.preprocess (ComputableTidilyInPolyTime.fst …)→preprocess'.Classes/IP/TQBF/Verifier:IsOraclePPTOn.cond computableInPolyTime_decide_closed.tidy→cond'. The othercond/finite_cases/iterateWith_of_bounded_growthsites there takefun_proparguments.Classes/Oracle/PP: thesearchstep (ite,map_with,query_take,iterateWith_spec,run_interpret_preprocess_open), the same pattern as the convertedqueryAny.Crypto/Computational/MAC,Signature; refactor(crypto): extract DDH.negligible_expected_inv_order into DiffieHellman/Order #1439NaorReingold/Security:cond/query_take/run_interpret_preprocess_opensites.ComplexityTests/OraclePPT,OracleComposition,OracleComposition/Substitution: the tests could use the plain rules (query_take' () (.const []) (.const 1),iterate_of_bounded_growth').Validation on 919892c:
scripts/check.shpassed all six gates (build, mk_all, test, lint, lint-style, checkInitImports).check_hygiene.py --check-simp,check_changed_files.py --base origin/main(15 modules) andcheck_tidy_surface.py(873, matching the baseline) also pass. There were no heartbeat errors and nomaxHeartbeatschanges. The abstracts catalogue is unaffected, since this only adds plain variants and changes proofs. No new test: the changed-file lint does not require one, and the converted clients exercise every new rule exceptpair'(used in the proof ofkeep_input),ite',finite_cases'and the two_spec'rules.Size: +328 / −124 in 15 files. About +213 of that is new declarations and docstrings; the client conversions come to roughly −8 lines net.
Part of #608 by worker
worker-crei-dc679113-C2. AI disclosure: written and validated by Claude Code (Claude Opus 5.5).Review request: needs a reviewer outside chris-ai1's fleet.
🤖 Generated with Claude Code