Skip to content

test: drop per-module named axiom guards that repeat the global audit - #1004

Merged
SamuelSchlesinger merged 1 commit into
mainfrom
chore/axiom-guards-sweep
Oct 25, 2026
Merged

SamuelSchlesinger merged 1 commit into
mainfrom
chore/axiom-guards-sweep

Conversation

@SamuelSchlesinger

@SamuelSchlesinger SamuelSchlesinger commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Change

ComplexityTests/Axioms.lean audits every declaration stored in the imported Complexity modules and rejects any dependency outside propext, Classical.choice and Quot.sound. #996 deletes the named guards in that file that restate this set, and changes the rule so that a named #print axioms guard is added only when a result is meant to depend on fewer axioms. This PR applies the same cleanup to the other test modules. Samuel approved removing these guards on 2026-10-25: names that need pinning are pinned by documentation and a stated purpose instead.

A script parsed every /-- info: … -/ #guard_msgs … in #print axioms X block, including open … in prefixes, wrapped messages and names on the next line, and classified it by its expected axiom set. Blocks with exactly the standard three were deleted, and every other block was kept byte for byte. For each file, the script checked three things: the parsed blocks account for every #print axioms, the kept blocks appear unchanged and in their original order, and the number of #guard_msgs drops by exactly the number of deleted blocks. Other #guard_msgs uses, such as #eval and #check outputs, are untouched.

Directory Files changed Guards deleted Guards kept
ComplexityTests/ (top level) 260 2,093 88
ComplexityTests/CircuitHamming 5 35 2
ComplexityTests/Code 3 17 0
ComplexityTests/Computability 1 20 0
ComplexityTests/Crypto 38 235 5
ComplexityTests/FineGrained 2 33 1
ComplexityTests/Iteration 4 45 0
ComplexityTests/MassProduction 6 39 0
ComplexityTests/NPCompleteGraphs 3 19 0
ComplexityTests/OracleComposition 1 5 0
ComplexityTests/ProofComplexity 3 25 5
ComplexityTests/QueryComplexity 4 41 0
ComplexityTests/RationalHitting 7 51 1
ComplexityTests/Space 1 8 0
Total 338 2,666 102

The 102 kept guards record narrower sets: 55 [propext, Quot.sound], 26 [propext], 17 with no axioms and 4 [Quot.sound]. Six files hold only kept guards and are unchanged.

The deletions left some text with nothing to describe, which this PR also removes:

  • 121 section headers, such as /-! ### Axioms -/, that headed only deleted guards.
  • 2 open lines left directly before end.
  • 2 axiom headers that ended up above an ordinary example.
  • The clauses of 109 module docs that described axiom guards or checks the file no longer has. Only those clauses are edited.

No test file was left with nothing but boilerplate, so no file is deleted. Imports are unchanged.

This PR changes only tests: no library module, statement or definition is modified.

Skipped files. Files changed by open PRs are left alone to avoid conflicts:

Follow-up. With these guards and those of #996 gone, 1,257 library declarations have no reference outside their own module. The list, grouped by module, is in #949 as a new item: #949 (comment). That item is not part of this PR.

Validation and review

  • Local validation on fe82f216 (base b3cbabf9): scripts/check.sh (all six gates; lake test re-elaborates the changed test files), python3 scripts/check_hygiene.py, python3 -m unittest discover -s scripts -p 'test_*.py' (351 tests, 3 skipped) and lake exe mk_all --check.
  • Hosted CI: Lean Action CI run 40178598350 for fe82f216.
  • No independent review yet.

Headline abstracts

  • Affected abstracts/catalogue entries, or reason the selection is unaffected: unaffected. No library statement changes, and the abstract axiom checks under abstracts/ are untouched.
  • Independent abstract review: not applicable.
  • PDF artifact/run: not applicable.

AI assistance

Prepared with Claude Code as worker-claude-axioms2-c4b0c164, delegated by coordinator-claude-c4b0c164-20261023. The worker wrote and ran the parsing and tidying scripts, edited the module docs, ran the validation above and computed the #949 follow-up list from the build's .ilean reference data.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

`ComplexityTests/Axioms.lean` audits every declaration of the imported `Complexity` modules
against `propext`, `Classical.choice` and `Quot.sound`. Delete the 2,666 named
`#guard_msgs ... #print axioms X` blocks in other test modules whose expected list is exactly
that set; keep the 102 blocks that pin a narrower set, byte for byte. Remove the section
headers and `open` lines that only served the deleted guards, and the module-doc mentions of
axiom guards in files that no longer have any.

Files touched by open pull requests, and `ComplexityTests/Axioms.lean` (#996), are skipped.

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

reviewer-claude-c4b0c164-14 — APPROVED at fe82f21 (delegated-review exception, AGENTS.md; classification: test-only)

I checked this with my own parser, which is comment-aware and handles CRLF, over b3cbabf9...fe82f216. The diff touches 338 files, all under ComplexityTests/; none is added or deleted.

  • Deleted guards: 2,666 #print axioms guard blocks, each pinning exactly [propext, Classical.choice, Quot.sound]. No changed file still has a standard-set guard. After a merge with current main, the only ones left in the test tree are the 8 in PolyTimePlain.lean, which the PR skips on purpose.
  • Kept guards: 102 narrower guards remain outside Axioms.lean: 55 [propext, Quot.sound], 26 [propext], 17 with no axioms and 4 [Quot.sound]. In the changed files, 73 narrower blocks and 28 other #guard_msgs uses (#eval, #check and so on) are byte-identical and in their original order.
  • Nothing else removed: I removed the standard-set blocks from the base, then compared base and head with comments stripped and docstrings kept. They differ only by 2 top-level open Cslib.Crypto.Homomorphic.GSW lines that were left at EOF in Crypto/GSWDepthParameters.lean and Crypto/GSWEvaluation.lean. The counts of example, theorem, def, #eval, #check and import are unchanged.
  • Comments: 123 /-! headers were removed. All were axiom headers, plus one ### Migrated problems header that headed only deleted guards. Two of them, in CircuitValueCompleteness and SipserLautemann, sat above an ordinary example that is still there.
  • Module docs: 109 changed. I read the word diff of every one, including ThresholdNC1, CircuitValueCompleteness and SipserLautemann. Each edit removes wording about axiom guards and adjusts the conjunctions; no description of the remaining tests is lost. FusionTree.lean has no module-doc edit because its doc never mentioned guards, and its CRLF line endings are preserved: 93 of 93 lines.
  • Merge and CI: the PR merges cleanly with main at a621a63a. Hosted ci-checks passed at this exact head.

Non-blocking notes:

  • The PR body says the 2 open lines were "left directly before end". They actually came after the namespace end and were left at EOF.
  • Several files that keep narrower guards still say "axiom guards for the headline results" in their module doc, for example KarpLipton, ManyOne and Isolation. The guards still exist, so this is optional wording.
  • Embeddability's Corollary 9 and Fact 11 now have no test reference. The Consolidation: well-scoped cleanup tasks (replaces the metric-driven quality program) #949 follow-up list covers this.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 25, 2026
Merged via the queue into main with commit fe400c7 Oct 25, 2026
4 checks passed
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 25, 2026
cslib-community#949) (cslib-community#1012)

Item 8 of cslib-community#949, area Algorithms (Algorithms.Lean, Algorithms.Reachability,
Algorithms.WordRAM). This is documentation and visibility only: no statement
or definition changes.

Add Main entries for declarations left without outside references after
cslib-community#996 and cslib-community#1004 removed the named axiom guards:
• Algorithms/Lean/FusionTree/Compression.lean: exists_compression
• Algorithms/Reachability/InductiveCounting/Bounds.lean: accepts_complete_bounded
• Algorithms/Reachability/InductiveCounting/Completeness.lean: accepts_iff, accepts_iff_not_reachable
• Algorithms/WordRAM/PrefixSums/Dynamic.lean: instruction_bound_log, execOp_frame
• Algorithms/WordRAM/Stack.lean: frame

All 29 declarations in Algorithms on the orphan list are confirmed public API
and fully documented.
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 25, 2026
…global audit

`ComplexityTests/Axioms.lean` audits every declaration of the `Complexity` modules against
`propext`, `Classical.choice` and `Quot.sound`, and upstream (cslib-community#1004) removed the named guards whose
expected list is exactly that set. The three guards here, on `logLinearStatement`, `logLinearSpec`
and `heapDijkstra_spec`, were of that kind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
orbitingflea added a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 25, 2026
…global audit

`ComplexityTests/Axioms.lean` audits every declaration of the `Complexity` modules against
`propext`, `Classical.choice` and `Quot.sound`, and upstream (cslib-community#1004) removed the named guards whose
expected list is exactly that set. The three guards here, on `logLinearStatement`, `logLinearSpec`
and `heapDijkstra_spec`, were of that kind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chris-ai1 pushed a commit to chris-ai1/complexitylib that referenced this pull request Oct 28, 2026
…me with a formal abstract (cslib-community#1098)

* refactor(Computability/WordRAM): scope the word-RAM statement syntax and ram_eval

The statement forms of `wramStmt`, the `macro_rules` that expand `ram[`, `ram_block%` and
`ram_stmt%`, and the tactic `ram_eval` with its `macro_rules` are now `scoped` to
`Cslib.WordRAM`, like the entry points `ram[`, `ram_block%` and `ram_stmt%` already were. Only the
category `wramStmt` and the syntax abbreviation `wramBlock` stay global, since Lean cannot scope
them; without the open they parse nothing. Every current user is inside a `Cslib.WordRAM`
namespace or opens it before use, so no other file changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(Algorithms/WordRAM): Dijkstra's algorithm in O((m + 1) log n) time with a formal abstract

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(Algorithms/WordRAM/Dijkstra): use the scoped word-RAM statement syntax

`ExactNotation` writes its rules over the `wramStmt` statements, which are now scoped to
`Cslib.WordRAM`, so it opens that scope, and its own `macro_rules` are scoped to
`Cslib.Algorithms.WordRAM.Dijkstra`. The bridge's note on syntax in its imports now says that
only the category `wramStmt` and the abbreviation `wramBlock` are global.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(Algorithms/WordRAM/Dijkstra): drop axiom guards that repeat the global audit

`ComplexityTests/Axioms.lean` audits every declaration of the `Complexity` modules against
`propext`, `Classical.choice` and `Quot.sound`, and upstream (cslib-community#1004) removed the named guards whose
expected list is exactly that set. The three guards here, on `logLinearStatement`, `logLinearSpec`
and `heapDijkstra_spec`, were of that kind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* doc(Algorithms/WordRAM): list the Dijkstra phase specs and helpers in their module docs

Add Main-list entries for the declarations that cslib-community#949 item 8 flags as having
no outside reference, and a docstring for decodeDist_encodeDist. Doc
comments only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(Algorithms/WordRAM): use Fin.sum_univ_def and drop a transparency option in Dijkstra

`ListEncode` uses Mathlib's `Fin.sum_univ_def` instead of a private copy of it.
`execWithin_append` is stated for any basis and register count, as `appendCode` is.
`Invariant` no longer sets `backward.isDefEq.respectTransparency false`: its two path
proofs apply `Quiver.Path.addWeight_cons` and `addWeight_nil` with `V := I.Vertex` given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* doc(Abstracts): say which Dijkstra abstract definitions come from WordRAMAbstract

`Runs` is new in `DijkstraAbstract`; the other machine definitions are those of
`WordRAMAbstract`. The paragraph is rewrapped; the theorem statement is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(Algorithms/WordRAM): run Dijkstra on a graph with no edges

Two vertices and no edge: the interpreter leaves `0` in the unreachable vertex's output
cell within the bound of `heapDijkstra_spec`, where `m + 1 = 1`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* doc(Algorithms/WordRAM): add References sections to six Dijkstra modules

Upstream's file template asks for `## References` in each module docstring. `BinaryHeap` and
`HeapSift` cite `CLRS2009`; `ListEncode`, `HeapRelax` and `LogLinear` cite `Dijkstra1959` and
`CLRS2009`; `ExactNotation`, which has no source of its own, points to the `ram[` notation and
`Algolean2026`, as upstream's `WordRAM/Notation` does. Doc comments only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(Algorithms/WordRAM): import WordRAM.Time in Dijkstra's HeapStatement, not Statement

`Statement` uses no declaration of `Complexity.Computability.WordRAM.Time`. It needs only the
`Fintype` instance on products for `maxWeight`, now imported from `Mathlib.Data.Fintype.Prod`, and
`Cslib.Init`, now imported through `Complexity.Init` as upstream's file template asks.
`HeapStatement`, whose `LogLinearSpec` is stated with the word-RAM machine, imports `Time`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(Algorithms/WordRAM): define Dijkstra's sift-down step from its two halves

`siftDownBody` was written out in full in `HeapProgram` and again, for its proof, as the
private `chooseCode` and `sinkCode` in `HeapSift`. Define the halves once, as the public
`siftDownChoose` and `siftDownSink`, and `siftDownBody` as their sequence. `HeapSift` uses the
new names, and `siftDownBody_spec` composes the two runs with `ExecWithin.seq`, so the split
lemma `siftDownBody_eq` is no longer needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(Algorithms/WordRAM): port Dijkstra to Code.rand and instrOf outOfBounds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(Complexity): sort the root imports after the upstream merge

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* doc(Algorithms/WordRAM): describe the bridge's rand-free step agreement

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

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