Skip to content

Ignore raw string contents when collecting Lean axiom queries - #3602

Merged
Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
roger-sato:fix/lean-audit-raw-strings
Oct 20, 2026
Merged

Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
roger-sato:fix/lean-audit-raw-strings

Conversation

@roger-sato

Copy link
Copy Markdown
Contributor

Change and mathematical scope

The Lean axiom helper can print PASS 1 declarations without executing any real #print axioms query: a raw string containing interior quotes exposes a fake query to the source scanner, and an IO.println supplies the corresponding report. Conversely, raw-string documentation can cause a valid audit to fail.

Mask Lean raw strings through the matching quote/hash delimiter before collecting queries. Cover zero and multiple hashes, literal backslashes, shorter nonclosing delimiters, unterminated strings, and adjacent ASCII/Unicode identifier tokens. Keep the existing report/axiom checks and the three existing AuditAll.lean query inventories unchanged.

This is a bounded verification-tool repair. It changes no theorem, frozen input, certificate, selected result or κ. The helper is still not a complete Lean parser or authentication against arbitrary hostile elaborators/loggers; Lean compilation and source review remain trust boundaries.

Task and overlap

  • Canonical base: 20ecf2891d80b5acf18d980b2164fb44ea7faa90; priority revision 6.
  • Card: portable-replay, scope key 831cc1a3c8f9ff01b197. Scope changed from environment/artifact comparisons to a concrete source-scanner failure in the live Lean verification path. Reliable audit results are the connection to the verifier-engineering track; no mechanism improvement is claimed.
  • Read the handoff hub before selection. The closest predecessor is @ywz65's Count actual Lean axiom queries outside comments and strings #2523 at f839ed0aca28280aea47c724937a2da04e5b7bcd, which handles comments and ordinary strings. This patch adds raw-string coverage to that implementation.
  • Refetched canonical main before submission. The overlap helper refreshed all 316 open PR bodies and 2,437 discussion records on 2026-10-18 at 08:04–08:05 UTC, without warnings; raw string / check_lean_axioms had no matches. Separate all-state PR searches found Count actual Lean axiom queries outside comments and strings #2523 and no equivalent follow-up. These checks do not establish universal novelty.

Validation

Environment: macOS arm64, Python 3.11.6, Lean 4.21.0 (6741444a63ee, the historical formal package's pinned version).

  • Actual Lean compiles the raw-string spoof fixture and emits the fake report. The unmodified helper exits 0 with PASS 1 declarations; the fixed helper exits 1 because there are no real queries.
  • All 8 test methods pass with live Lean enabled, including raw-string and adjacent-token positive controls, direct compilation of the spoof, original comment/string controls, multiline custom axioms, and sorryAx rejection.
  • Three existing audit command inventories remain identical.
  • python3 -B scripts/research_baseline.py reports PASS_RESEARCH_BASELINE_BINDINGS_ONLY (orientation/source bindings only).
  • git diff --check.

Reproduce the focused suite:

LEAN_AUDIT_BIN=/path/to/lean-4.21.0/bin \
  python3 -B -m unittest discover -s tests -p test_lean_axiom_audit_parser.py -v

Without LEAN_AUDIT_BIN, the pure scanner/report/inventory checks run and the live test is explicitly skipped. Full formal-project builds, the selected mathematical replay, other OS runtimes and hosted CI have not been run for this scoped change.

Credit

Retain the existing helper authors and @ywz65's #2523 source-scanner work. Prepared for @roger-sato with substantial OpenAI Codex assistance. Apache-2.0.

@roger-sato
roger-sato marked this pull request as ready for review October 18, 2026 09:02
@Mister-Meeseeks
Mister-Meeseeks merged commit 65d9fb4 into CrocSwap:main Oct 20, 2026
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.

2 participants