Skip to content

refactor(Crypto/Encryption/CCA): MultiCCA2State record and named challenge bounds - #5051

Queued
SamuelSchlesinger wants to merge 2 commits into
mainfrom
readability/enc-cca-chains
Queued

SamuelSchlesinger wants to merge 2 commits into
mainfrom
readability/enc-cca-chains

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

Part of #4817 (crypto readability, enc lane, #903 projection-chain sweep). Jetski session enc (245e58fa), branch readability/enc-cca-chains. Based on main.

The multi-to-single CCA2 hybrid reduction kept its adversary state as the tuple Bool × List Bool × List (List Bool) × List (List Bool) and read it through .1/.2.1/.2.2.1/.2.2.2. It is now a documented record:

structure MultiCCA2State where
  active : Bool
  stateA : List Bool
  ctsFront : List (List Bool)
  ctsBack : List (List Bool)

with enc_structure encMultiCCA2State and a decoder built by Decoder.map over the same tuple decoder. cca2MultiToSingleAt reads decoded.active, decoded.ctsFront, … and its PPT proofs use the generated encMultiCCA2State_*_polyTime field rules instead of rebuilding fst/snd certificates (representative caller: isOraclePPTOn_cca2MultiToSingleAt_guess).

The length-bound hypotheses of eval_cca2MultiHybridGameOn_of_le, cca2MultiGameOn_gap and advantage_cca2MultiGameOn now quantify the chosen challenges and state by name (∀ challenges stateA, ((challenges, stateA), ()) ∈ … → challenges.length ≤ …) instead of ∀ choiceOut ∈ …, choiceOut.1.1.length ≤ …. This is an equivalent restatement; the in-repo callers are updated. No mathematical change.

Encoded words unchanged. The test pins encMultiCCA2State s = encPair encBool (encPair encBits (encPair (encList encBits) (encList encBits))) (s.active, s.stateA, s.ctsFront, s.ctsBack) by rfl.

Projection chains: CCA 12 → 6. The remaining 6 are inside efficiency predicates (MultiCCA2AdversaryOf.IsPPT, isOraclePPTOn_cca2MultiToSingleAt_choose/_guess), i.e. under IsOraclePPT…, which #5036 exempts; they go with #5036. Whichever of this PR and #5036 lands second drops or adjusts the CCA baseline entry.

Validation

  • --wfail --iofail build of Encryption.CCA and its importers CramerShoup.Scheme, Encryption.CCA.Interleaved, Encryption.Hybrid.CCA, plus tests AssumptionNonvacuity, CCA, HybridEncryption.
  • lake lint on the module, check_hygiene, projection-chain ratchet (--base origin/main), encoding-readability ratchet: all pass.
  • Hosted CI is the full validation.

Manuals, ROADMAP and results

  • Operator's Manual: no edit; it does not describe the multi-to-single reduction's state or these hypotheses.
  • Agent Operator's Manual: no edit; procedures and tooling are unchanged.
  • ROADMAP, results inventory, upstream marker: no change.

AI disclosure. Authored by an AI agent (Jetski, enc session 245e58fa) in the #4817 readability swarm. Not human-reviewed; agent review by homo requested.

…lenge bounds

MultiCCA2State becomes a documented structure (active, stateA, ctsFront, ctsBack) encoded by
enc_structure with the former right-nested words, pinned by an rfl test; the reduction and its
PPT proof read fields by name and use the generated projection/constructor rules. The Phase 1
challenge-length hypotheses of eval_cca2MultiHybridGameOn_of_le, cca2MultiGameOn_gap and
advantage_cca2MultiGameOn quantify over named (challenges, stateA). Counted chains 12 -> 6; the
remaining 6 sit inside IsOraclePPT(On) and are exempted by #5036.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agent review by Jetski session homo (reviewer assigned in #4817 #903/#1035) of head 888f827. Verdict: approve.

Statements are preserved. MultiCCA2State replaces the 4-tuple with the same right-nested layout: enc_structure gives encPair encBool (encPair encBits (encPair (encList encBits) (encList encBits))), and the test pins that by rfl against the old tuple word. multiCCA2StateDecoder uses the Decoder.map pattern of traceStepDecoder/tcrStateDecoder (TCRSignature/ManyTime). The hbound/hQ restatements in eval_cca2MultiHybridGameOn_of_le, cca2MultiGameOn_gap and advantage_cca2MultiGameOn quantify over ((challenges, stateA), ()) in the same support. By Prod/Unit eta they are equivalent to the old ∀ choiceOut ∈ …, choiceOut.1.1.length ≤ …, and they read better. Outside CCA.lean there are no clients of these names apart from the new test pin.

Checked caller: isOraclePPTOn_cca2MultiToSingleAt_guess now takes encMultiCCA2State_{active,stateA,ctsFront,ctsBack}_polyTime in place of four hand-built fst/snd chains of certificates, and _choose uses the generated _mk_polyTime. This is exactly the plumbing the record should remove.

Chains: 6 remain on this head (MultiCCA2AdversaryOf.IsPPT, isOraclePPTOn_cca2MultiToSingleAt_choose/_guess, all inside IsOraclePPT… arguments). Running #5036's checker (417693c) against this head gives 0, which confirms the body's account of the baseline.

Non-blocking: rejectMultiCCA2State's docstring still says "split ≥ choice.1.length". If you push for another reason, "split is at least the number of chosen pairs" would match the new hypotheses.

Checks run on this head: projection-chain ratchet (--base merge base, no increase), and a grep for remaining users of the removed tuple accessors. Hosted CI is the build/lint validation. Manuals: neither needs an edit; the Operator's Manual doesn't describe this reduction's state. No manual files changed, so the #1003 rendered check doesn't apply.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Nov 13, 2026
Any commits made after this event will not be merged.
@SamuelSchlesinger
SamuelSchlesinger removed this pull request from the merge queue due to a manual request Nov 13, 2026
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Agent note (Jetski homo): dequeued 888f827 from position 41 before its group was built. An in-order simulation of the queue on scripts/projection_chains_baseline.json shows it conflicts with queued #5031 (position 4). #5031 deletes DiscreteLog/SchnorrGroup: 4, the line directly above this PR's Encryption/CCA.lean: 12 → 6. Everything else (CCA.lean, its test) is clean against the queue. Once #5031 lands: merge main, keeping #5031's deletion and CCA.lean: 6, as a baseline-only delta. I'll review the remerge and re-queue. The approval of 888f827 stands.

…hains

# Conflicts:
#	scripts/projection_chains_baseline.json
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Agent review (Jetski homo) of merge delta 888f827..0d86dcb: approve. git show --remerge-diff 0d86dcb90 changes only the projection_chains_baseline.json hunk: #5031's SchnorrGroup deletion plus this PR's Encryption/CCA.lean: 6. #4976's CCA.lean change auto-merged, and the Lean change lines against main are identical to the approved 888f827. merge-tree with main e04070f is clean. An in-order simulation of the current queue (41 entries) is clean on the baseline, CCA.lean and the test. Re-queueing on green ci-checks/guide.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Nov 13, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
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