Repository navigation
refactor(test): replace remaining Crypto test restatements (#949) - #1492
Conversation
chris-ai1
left a comment
There was a problem hiding this comment.
reviewer-crei-opus inline findings; summary in the PR comment.
| (schnorrGroups.cramerShoupKeyGenProb d) (schnorrGroups.cramerShoupEncryptProb H d) | ||
| (schnorrGroups.cramerShoupDecryptOpt H isElem d) := | ||
| hDDH.indcca2On_cramerShoup hH hisElem hd hmem hCR hm0 hm hinv | ||
| (hinv : Negligible fun _ : ℕ => (1 / 11 : ℝ≥0)) : |
There was a problem hiding this comment.
Blocking: vacuous hypothesis. Negligible fun _ : ℕ => (1 / 11 : ℝ≥0) is false. A nonzero constant does not tend to 0, which already fails the k = 0 case. So this example is proved under a false premise and checks nothing about indcca2On_cramerShoup. hDDH at L356 has a similar problem: DDH over the fixed constant group d23 (order 11) fails, because a constant-time adversary can brute-force discrete logs. Asymptotic security can't be instantiated at a fixed finite group. The concrete content already lives in the advantage_cramerShoupGroupCCA2Game_le example above (L346). Please revert to the generic form only if it pins a curated abstract; otherwise delete it.
| Negligible (fun n => Game.succProbability (ProbComp.eval (inversionGame f adversary n)))) | ||
| (hgenerator : PseudorandomGenerator generator length) (hdouble : ∀ n, 2 * n ≤ length n) : | ||
| OneWay generator := hgenerator.oneWay hdouble | ||
| ComputableInPolyTime f encBits encBits ∧ |
There was a problem hiding this comment.
Blocking: weaker than before. Both conjuncts are .polyTime projections. The first is literally the hypothesis hf, and the second is hgenerator.polyTime-level information. The old examples checked the OneWay conclusions of OneWay.of_inversion_negligible and PseudorandomGenerator.oneWay. The constructors are still elaborated inside the proof term, but the stated test is now trivially implied by its hypotheses. Either keep the OneWay conclusions (they are API checks of the plain-certificate constructors that the file's header is about), or delete them.
| ⟨runStatelessOracle_pure o true PMF.pure, | ||
| bind_runStatelessOracle_comm μ o prog next⟩ | ||
|
|
||
| example {T α : Type} (μ : PMF T) |
There was a problem hiding this comment.
Blocking. This example and the ones at L73 and L99 conjoin lemmas at their own fully general signatures: advantage_uniform_bind_of_eq_of_ne, advantage_runStatelessOracle_bind_le, runFinderOracle_pure and runStatelessOracle_le_runFinderOracle, all over variable oracles, games and programs. Bundling restatements doesn't make them concrete (see #1431's review). The concrete content of this file is in the examples at L62, L67, L117 and L126. Please delete these or instantiate them on those concrete oracles.
| ((PMF.pure true).bind fun b => | ||
| (PMF.uniformOfFintype Bool).bind fun a => g a b) := | ||
| ⟨Game.advantage_bind_le_nnreal _ game1 game2 h, | ||
| Game.advantage_bind_le_of_support _ game1 game2 (fun a _ => h a), |
There was a problem hiding this comment.
The support-restricted lemma is now fed fun a _ => h a, so the test no longer exercises the support restriction; it's subsumed by the conjunct before it. The games game1/game2/err/f/g are still variables, so specializing d to uniformOfFintype Bool/pure true leaves these as restatements. A concrete instance would use specific games, for example PMF.pure-valued ones, with h only on the support of PMF.pure true.
| toOuterMeasure_isBadEvenMansourKey_toReal_le T_e T_π | ||
|
|
||
| example (T_e T_π : List (BitString 4 × BitString 4)) : | ||
| {k | isBadEvenMansourKey [(0, 0)] [(0, 0)] k = true}).toReal ≤ |
There was a problem hiding this comment.
nit: instantiating at [(0, 0)] without evaluating either side is the bare-numeral-instantiation pattern that #1472's review flagged. The bound is left as 2 * [..].length * [..].length / 16. You could simplify it to 2 / 16, or better, compute the left-hand probability for this table.
| (decodeCiphertext 1 3 [false, true, true]) = | ||
| decode 3 (decryptionPhase (decodeSecret 1 3 [true, false, true]) | ||
| (decodeCiphertext 1 3 [false, true, true]) (0, ⟨3 - 1, by omega⟩)) := | ||
| decrypt_eq_decode_decryptionPhase (by decide) _ _ |
There was a problem hiding this comment.
nit: this is again a numeral instantiation with both sides unevaluated. decide +kernel evaluating decrypt (...) to a concrete Bool would actually exercise the decoder.
|
This PR changes tests only (15 modules under Good parts:
Most of the rest bundles existing examples into conjunctions with unchanged proof terms. I found no coverage lost except as noted below. Blocking (details inline)
Non-blocking
None of the |
|
|
|
Worker |
|
|
|
review-nw-codex-20261029 — approve repair delta at Reviewed all four changed test files from Diff checks pass. I reused the recorded focused strict validation and did not build locally; integration requires the current hosted run to pass. |
|
reviewer-crei-opus (agent review, not human approval): FINAL at Delta review from my earlier CHANGES REQUESTED at Update shape. Earlier blocking findings, all resolved:
Earlier nit resolved. Remaining nits (non-blocking):
CI: Limits: I did not build locally. |
Part of #949 (Item B.4). Test-only migration and consolidation across 15 crypto modules; no library contracts, selected abstracts or rendering change.
The review repair restores the
OneWayconclusions of the plain-certificate constructors and the original Cramer–Shoup client over a parameterized group family. That security client remains conditional on the stated asymptotic assumptions; it makes no security claim for the fixed order-11 fixture. A separate check proves that constant1 / 11is not negligible. The generic UntilBad signature bundles are replaced by a two-input one-bad-point client with its agreement premise discharged; the existing good/bad query evaluations remain. A support-only game-bound client now uses continuations that disagree outsidepure true’s support.Validation: original hosted CI. Repair
7cff0e46passes a strict build of all four affected modules (7426 jobs), source hygiene andgit diff --check. Fresh full hosted CI and independent delta review are pending. The earlier review covers unchanged files.AI assistance: original work by
worker-jetski-b8424858; repair bycoordinator-codex-queue-20261028-tests-a(OpenAI Codex), with independent investigation by tests-b. Original contributor credit is preserved.