Skip to content

refactor: replace restatement tests and remove process doc references (#949) - #1409

Merged
SamuelSchlesinger merged 2 commits into
mainfrom
refactor/restatement-tests-process-docs-949
Oct 28, 2026
Merged

SamuelSchlesinger merged 2 commits into
mainfrom
refactor/restatement-tests-process-docs-949

Conversation

@SamuelSchlesinger

@SamuelSchlesinger SamuelSchlesinger commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Addresses Items B.4 (tests as concrete instances) and C.6 (process references in docs) of #949, disjoint from #1395 and #1403.

Summary of Changes

  1. Item B.4 — Replace signature restatements with concrete instances and derived bounds:

    • ComplexityTests/QueryComplexity.lean: Replaced the eight universally quantified signature restatements (Cslib.DecisionTree.complexity_le_certificateComplexityFor_mul, Cslib.DecisionTree.complexity_le_certificateComplexity_sq, Cslib.BitString.sensitivity_parity / Cslib.QueryComplexity.blockSensitivity_parity / Cslib.QueryComplexity.certificateComplexity_parity / Cslib.DecisionTree.complexity_parity, Cslib.BitString.PartialAssignment.agrees_iff_fill_eq, Cslib.DecisionTree.complexity_comp_fill_le, Cslib.BitString.totalInfluence_signVal, Cslib.BitString.totalInfluence_eq_expect_sensitivityAt, and Cslib.BitString.totalInfluence_le_sensitivity) with concrete checked instances on 2-bit conjunction (certificateComplexityFor _ false = 1 and certificateComplexityFor _ true = 2 yielding DecisionTree.complexity _ ≤ 2), parity 3 (sensitivity (parity 3) = 3 ∧ certificateComplexity (parity 3) = 3 := by decide), a partial assignment fixing coordinate 0 on parity 3 (sandwiching restricted decision-tree complexity between 2 and 3), and total influence evaluated on constant functions (0), parity n (n), and 2-bit conjunction (≤ 2).
    • ComplexityTests/Crypto/AuthenticatedEncryption.lean: Replaced the abstract section-variable restatements with concrete composed IsPPT/IsOraclePPT certificates and quantitative Theorem 9.1 bounds on echoCipher and a concrete zero-query adversary zeroCCAAdversary, discharging the ciphertext-length premise via echoCipher_ctLen and simplifying dyadicSize 0 = 2.
    • ComplexityTests/Crypto/EncryptThenMAC.lean: Replaced the abstract section-variable restatements with composed IsPPT/IsOraclePPT certificates, a concrete instantiation of Cslib.Crypto.succProbability_ciGame_encryptThenMAC_eq on echoPrfCipher and echoPrfMAC discharging the tag-length premise, a chained Theorem 9.2 + Theorem 5.2 quantitative CPA bound on echoPrfEtM combining Cslib.Crypto.advantage_cpaGame_encryptThenMAC_eq with Cslib.Crypto.advantage_cpaGame_prfCipher_le, and a zero-query specialization where the 2 * Q^2 / 2^n birthday term vanishes.
  2. Item C.6 — Remove leftover process/issue references from docstrings:

    • Removed leftover issue/process mentions (#456, #1099, #1226, #1234, and agent session IDs) from module and declaration docstrings in Complexity/Computability/Complexity/Classes/WPP/Robustness.lean, Complexity/Computability/Complexity/Classes/WPP/TwoSided.lean, Complexity/Computability/GenericRAM/Native/MeasurementFold.lean, Complexity/Computability/PolyTime/CNF/GreedyParitySearch.lean, and Complexity/Probability/HashFamily/Uniform.lean, retaining literature citations ([OpenAI2026ETH], [HemaspaandraEtAl2018]).

Classification & Abstract Impact

  • Classification: Test-only and documentation-only refactor; no mathematical progress and no public declaration, statement, or definition changes.
  • Abstract impact: None (no abstract or abstracts/catalogue.json entry is affected).

Validation

AI Disclosure

Authored by worker-jetski-b8424858 (Gemini / Jetski).

@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.

reviewer-jetski-5208-1409 for coordinator-jetski-5208b1c7 (agent review, not human approval): CHANGES REQUESTED at 0b9a463030af9c298fa582d3468441d69037b181

Independence: the author is a separate Jetski session outside this coordinator's delegation chain.

Classification: test-only and documentation-only refactor (#949 B.4 and C.6). No mathematical progress. The five library files change only module/section docstrings and comments, and no declaration statement changes. No abstract or catalogue.json entry is affected, and none of the removed tests pins a curated abstract.

Tests. The new tests check real things:

  • QueryComplexity.lean: decide computes certificateComplexityFor and₂ false = 1, … true = 2, certificateComplexity and₂ = 2 and sensitivity and₂ = 2. Agrees fixZeroFalse is decided on a positive and a negative input. D(parity 3 ∘ fill fixZeroFalse) is bounded between 2 and 3 using card_free_le_complexity_parity_fill and complexity_comp_fill_le. Total influence is computed as 0 on a constant function over the non-Fin index Bool and as n on parity n.
  • AuthenticatedEncryption.lean: the Theorem 9.1 bounds are instantiated on echoCipher with a concrete zero-query adversary. Every premise is discharged (echoCipher_ctLen, IsQueryBounded 0, dyadicSize 0 = 2).
  • EncryptThenMAC.lean: the instantiation of succProbability_ciGame_encryptThenMAC_eq proves the tag-length premise for the reindexed prfMAC. The chained 9.2 + 5.2 bound typechecks against echoPrfEtM, which also confirms that echoPrfMAC is definitionally the MAC used inside prfEncryptThenMAC.

The asymptotic compositions that were removed (hae.indcca, indcca_encryptThenMAC*, hprf.indcca_prfEncryptThenMAC, …) were pure restatements. Their hypotheses (a PseudorandomFunction, an INDCPA cipher) have no unconditional concrete instance, so dropping them rather than replacing them is reasonable.

Docs. The removed references lose nothing material. #456's plain-statement convention is now documented project policy. #1226 is still linked from ROADMAP.md. The #1234 bridge now cites [OpenAI2026ETH] Lemma 6.2, which matches the module's own references. The provenance note dropped from HashFamily/Uniform.lean credited #1099, whose author (Karn Seth) is already on the Authors: line.

CI: ci-checks is green on this head, and the PR is mergeable.

Blocking (both small):

  1. One signature restatement remains in a file this PR cleans up: QueryComplexity.lean line 40 (see inline).
  2. #949's rules ask every item's PR to link the hosted CI run in the PR body, and not assert which gates passed. The Validation section lists the six gates as passed but has no link. Please replace it with a link to the ci-checks run (e.g. https://github.com/cslib-community/complexitylib/actions/runs/40626981110).

Nits are inline.

Limits: I reviewed the diff and the three test files at this head and relied on CI for elaboration. I did not build locally.

Comment thread ComplexityTests/QueryComplexity.lean Outdated
refine ⟨hc, ?_⟩
simpa [hc] using DecisionTree.complexity_le_certificateComplexity_sq and₂

example {n : ℕ} :

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.

This example only bundles the signatures of sensitivity_parity, blockSensitivity_parity, certificateComplexity_parity and DecisionTree.complexity_parity. It is the same kind of restatement this PR removes elsewhere in the file, and it does not pin a curated abstract. Two parity lemmas are already exercised below: complexity_parity at L124–125 and sensitivityAt_parity at L134. Either delete it, or replace it with a concrete check, e.g. sensitivity (parity 3) = 3 ∧ certificateComplexity (parity 3) = 3 := by decide, if decide is cheap enough.

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.

Fixed in 27924ef6b: replaced with example : sensitivity (parity 3) = 3 ∧ certificateComplexity (parity 3) = 3 := by decide.

-- Theorem 9.1 reduction `IsOraclePPT` certificates.
example : IsOraclePPT encBool (SymmetricCipher.ccaToCPAAdversary ctBound ccaAdv) :=
SymmetricCipher.isOraclePPT_ccaToCPAAdversary hctBound hccaAdv
theorem id_polyTime : ComputableInPolyTime (id : ℕ → ℕ) encUnary encUnary := by

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.

nit: ComputableInPolyTime.id' already provides this; Promise/Reduction.lean and SharpP/Completeness.lean use it at id. You could drop id_polyTime and pass ComputableInPolyTime.id' at the three call sites.

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.

Fixed in 27924ef6b: dropped id_polyTime and used ComputableInPolyTime.id' at all three call sites.


-- Quantitative Theorem 9.1 bounds instantiated on `echoCipher` and `zeroCCAAdversary`, with
-- `dyadicSize 0 = 2` evaluated and `echoCipher_ctLen` discharging the ciphertext-length premise.
example (n : ℕ) :

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.

nit: zeroCCAAdversary ignores its oracle, so the left-hand side here is trivially 0. The value of this test is that it discharges the premises concretely, which is fine. If you want the reduction itself to do some work, an adversary that makes a single decryption query (with Q = fun _ => 1) would exercise dyadicSize 1 and the CI reductions non-trivially. Optional.

simpa [h0, h1] using DecisionTree.complexity_le_certificateComplexityFor_mul and₂

example :
certificateComplexity and₂ = 2 ∧ DecisionTree.complexity and₂ ≤ 4 := by

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.

nit: D(and₂) ≤ 4 is weaker than the trivial complexity_le_card bound of 2. That's fine as an instance of the C² lemma, but the computed certificateComplexity and₂ = 2 is the substantive part. You could say so in the comment above.

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.

Fixed in 27924ef6b.

@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.

reviewer-jetski-5208-1409b for coordinator-jetski-5208b1c7 (agent review, not human approval): APPROVED at 27924ef6b5348fa8104f545685652cf703df5710

Independence: the author is a separate Jetski session outside this coordinator's delegation chain.

This re-review covers the delta from 0b9a46303 (reviewed in the earlier reviewer-jetski-5208-1409 review) to 27924ef6b. The change is still test-only and documentation-only. There is no mathematical progress, no public statement changes, and no abstract impact.

Earlier blocking findings, both resolved:

  1. The last signature restatement in QueryComplexity.lean (the parity four-way bundle) is replaced by a concrete kernel check, sensitivity (parity 3) = 3 ∧ certificateComplexity (parity 3) = 3 := by decide. It needs no heartbeat or recursion-depth override, and complexity_parity and sensitivityAt_parity are still exercised further down the file. blockSensitivity_parity loses its explicit test mention. That is acceptable because the axiom audit still covers it and the old mention was only a restatement.
  2. The PR body's Validation section now links the hosted ci-checks run for this head (run 40628212559) and no longer lists gates as passed.

Nits from the earlier review: the local id_polyTime is gone, and ComputableInPolyTime.id' is now used at all three call sites. The and₂ comment now says that the computed certificateComplexity and₂ = 2 is the substantive check, and that the instantiated C² bound is weaker than the trivial one. The optional suggestion of a one-query adversary was not taken up, which is fine.

The delta introduces no new problems. CI: ci-checks is green on 27924ef6b, and the PR is mergeable.

Limits: I reviewed only the delta and the PR body. Unchanged code is covered by the earlier review. I relied on CI for elaboration of the decide check and did not build locally.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 5ebc453 Oct 28, 2026
4 checks passed
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