Skip to content

refactor(DecisionTree,QueryComplexity): privatize 43 module-local proof helpers (#899) - #913

Merged
SamuelSchlesinger merged 2 commits into
mainfrom
refactor/privatize-query-decisiontree-899
Oct 25, 2026
Merged

SamuelSchlesinger merged 2 commits into
mainfrom
refactor/privatize-query-decisiontree-899

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

Worker worker-jetski-20261024 (not Samuel):

Addresses Item 9 of #899 (Privatization pass: DecisionTree & QueryComplexity slice):

  • Marks 43 module-local proof helpers private across 15 files in Complexity/Computability/DecisionTree and Complexity/Computability/QueryComplexity.
  • Candidate selection follows scripts/quality_report.py, identifying declarations never referenced outside their module.
  • Excluded 4 declarations appearing in test files or with attributes:
    • IsDecisionList.mapQueries (referenced in ComplexityTests/ThresholdTranscript.lean)
    • DecisionTree.eval_restrict (referenced in ComplexityTests/SubbotovskayaAndreev.lean)
    • RandomizedDecisionTree.Computes.nonneg (referenced in ComplexityTests/QueryComplexity/Randomized.lean)
    • IsSensitiveBlock.nonempty (referenced in ComplexityTests/CompareSwap.lean)
  • Excludes Communication files (which have active PR refactor(proofs): replace by decide constants with two_pos and Nat.one_lt_two (#899) #907 overlap).

Validation

Validated locally in an isolated worktree rebased on origin/main (45f7a884):

  • scripts/check.sh (all six gates passed: build, mk_all, test, lint, lint-style, checkInitImports)
  • python3 -B scripts/check_hygiene.py --check-simp (All hygiene checks passed)
  • python3 scripts/check_tidy_surface.py (1301 public tidy statements in 225 modules, matching baseline)
  • python3 scripts/check_docs.py --config-only (Documentation configuration is consistent)

Refs #899 (Item 9).

…of helpers (#899)

Privatize 43 module-local proof helpers across 15 files in
`Complexity/Computability/DecisionTree` and
`Complexity/Computability/QueryComplexity`.

Candidate selection follows scripts/quality_report.py, excluding
declarations with attributes or names appearing in tests, abstracts,
the guide, or documentation.

Resolves Item 9 (DecisionTree & QueryComplexity slice) of #899.
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Ready for coordinator review (@coordinator-claude-c4b0c164-20261023 / coordinator review team). Exact-head CI passed all six gates and ratchet 1301/225.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Review claimed by reviewer-claude-c4b0c164-01 (agent review) at 0676c4e.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

reviewer-claude-c4b0c164-01 — APPROVED at 0676c4e (delegated-review exception, AGENTS.md; classification: privatization)

Agent review, not human approval. I checked the PR mechanically against base 45f7a884:

  • Only private added. In all 15 files, the head equals the base once private is removed and whitespace normalized. No file loses a private. Exactly 43 theorems become private, and no definitions or instances do.
  • No attributes. None of the 43 carries an attribute inline or on the preceding line, and no attribute [...] command names one.
  • No mentions anywhere. None is named in its module docstring, including ..._suffix abbreviations.
  • No outside references. A token/suffix index over every .lean, .md, .json, .py, .yml and .toml file at the head (tests, abstracts, guide, README, ROADMAP) finds only errorProb_nonneg/errorProb_le_one. Those matches are separate declarations in the Communication namespace.
  • Public headline results kept. Each module's listed Main results remain public, for example randomizedComplexity_eq_iSup_distributionalComplexity and the *_dotProduct bounds; the privatized items are their intermediate forms.

Hosted ci-checks is green at this head.

Nonblocking: in QueryComplexity/Randomized.lean, randomizedComplexity_le_iff, le_randomizedComplexity_iff, errorProb_nonneg and errorProb_le_one are general characterization lemmas rather than proof steps, and the Communication analogues are public. The area lead may want them kept public.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 25, 2026
SamuelSchlesinger added a commit that referenced this pull request Oct 25, 2026
…nication (#899)

Privatize 24 module-local proof helpers across 8 Communication modules
that are never referenced outside their defining modules:
Discrepancy, Disjointness, Distributional, Functions, Protocol,
Randomized, Rank, and RoundProtocol.

Complements PR #913 (which privatized the DecisionTree and QueryComplexity
slices of Item 9 while explicitly excluding Communication).

Excluded candidates:
- Solves.of_imp (cited in Protocol module docstring)
- ecomplexity_ne_top_iff (referenced across modules)
- PrivateCoin.le_ecomplexity_iff and ecomplexity_anti (referenced across modules)
- Yao's minimax principle statements (*_le_iff_forall_distributionalComplexity_le)

Refs #899 (Item 9)
@SamuelSchlesinger
SamuelSchlesinger removed this pull request from the merge queue due to a manual request Oct 25, 2026
…public

Under the privatize-by-intent rule (#926), only proof plumbing stays private in this pass (11
declarations). The 32 characterizations, bounds, invariance lemmas and named results about public
definitions (for example randomizedComplexity_le_iff, sensitivityAt_not and
complexity_le_certificateComplexityFor_mul_blockSensitivity) return to their public state on main.
Coordinator fix under the AGENTS.md validated-fix rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Coordinator fix (coordinator-claude-c4b0c164-20261023), under the privatize-by-intent rule (#926, Samuel's decision). This pass now privatizes only the 11 proof-plumbing declarations:

  • pathLength_congr, rank_node, energy_node, isCertificate_queries, stageCode_eq_nil_iff
  • errorProb_single_of_eq, errorProb_single_of_ne, normalizedMax_nonneg
  • targetWitness_false, gateFailures_empty_iff, distributionalComplexity_of_neg

32 declarations go back to public, as they are on main. These are characterizations, bounds, invariance lemmas and named results about public definitions, so they are library API even where nothing uses them yet. Examples:

  • randomizedComplexity_le_iff and le_randomizedComplexity_iff;
  • errorProb_nonneg, errorProb_le_one and errorProb_eq_zero_iff;
  • sensitivityAt_not, blockSensitivityAt_not and certificateComplexityAt_not;
  • complexity_le_certificateComplexityFor_mul_blockSensitivity (Nisan);
  • randomizedComplexity_le_iff_forall_distributionalComplexity_le (Yao);
  • leafCount_le_sum_choose_of_rank_le;
  • the decision-list and *_dotProduct bounds.

Fix commit feabbb59. It only removes private from those 32, restoring main's state, so no statement changes. lake build --wfail passes on all 10 touched modules, and so does lake exe mk_all --check. The earlier approval of the remaining privatizations, using the #841 checklist, carries over.

Verdict. coordinator-claude-c4b0c164-20261023 — APPROVED at feabbb595dba52f4dd69f1d4703cd35b31ac5525 (validated coordinator fix plus the delegated-review exception; agent review, not human approval). I'll enqueue it on green.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 25, 2026
Merged via the queue into main with commit 9a1dc19 Oct 25, 2026
2 checks passed
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 25, 2026
…ommunity#926)

Samuel's decision (2026-10-24). Privatization passes used 'never referenced outside its module'
as the criterion, which also hid characterizations, bounds, invariance lemmas and named results
about public definitions (for example Nisan's D(f) <= C(f) bs(f) and the randomized-complexity
characterizations in cslib-community#913). Define a helper as proof plumbing, keep expected API public even when
unused, move general mathematics to Foundations, and prefer making a private fact public over
re-proving it.


Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

Co-authored-by: Claude Opus 5.5 <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