Skip to content

fix(polytime): certify plain verifiers and document bounded mixed search - #567

Merged
SamuelSchlesinger merged 3 commits into
mainfrom
perf/plain-polytime-automation-558
Oct 23, 2026
Merged

SamuelSchlesinger merged 3 commits into
mainfrom
perf/plain-polytime-automation-558

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

Plain verifier hypotheses currently need manual .tidy conversions before using the andVerifier, orVerifier and selectVerifier certificates. This adds three plain fun_prop rules, proved from the existing tidy certificates, so by fun_prop handles those plain goals directly, including mixed plain/tidy inputs.

The other #558 cases get documented, checked usage patterns in PolyTime/Plain.lean and ComplexityTests/PolyTimeMixes.lean:

  • The WPP singleton-list reproducer with only a plain certificate exhausts 20,000 heartbeats under default fun_prop. A bounded fun_prop (config := { maxSteps := 32 }) attempt followed by have hf := hf.tidy; fun_prop succeeds under 2,000 heartbeats; the regression test enforces that smaller budget. The isolated Lean elaboration measured 2.1 s for the failing default attempt and 1.3 s for the successful bounded/conversion proof; these are illustrative local observations, not a benchmark guarantee.
  • polytime prepares plain hypotheses and proves both the mixed binary/unary SBP threshold 3 * (k a * 2 ^ q.eval (enc a).length) and Toda's input-dependent sharpTest verifier. Tests cover the original shapes and before/after verifier and arithmetic proofs.

This implements #558's documented-pattern option for slow failure and arithmetic/counting composites. It does not change default fun_prop search or guarantee quick failure on every goal. No plain-to-tidy fun_prop transition is registered, avoiding a transition cycle. Existing declarations and statements are preserved; these are reusable certificate rules and proof guidance, not a new complexity result.

Abstract impact: no selected abstract, bridge, catalogue entry, theorem statement or renderer source changes; the new rules prove existing verifier computability from the existing equivalence. No new headline or PDF inspection is needed.

Validation: all six required gates pass at f204da57a692b8857702876205e76a2794d772a6 (LEAN_NUM_THREADS=4 LAKE_ARTIFACT_CACHE=true scripts/check.sh); the focused strict ComplexityTests.PolyTimeMixes check also passes. Lean MCP tools are unavailable, so focused Lake checks were used.

AI assistance: implemented and self-reviewed by Codex worker worker-codex-01a16ab8-558, delegated by coordinator-codex-01a16ab8. Independent review is requested before integration.

Closes #558.

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

Independent review and coordinator verdict (coordinator-claude-c4b0c164-20261023, Claude Code; non-authoring, covering both roles as AGENTS.md allows): approve f204da57. Integration waits for required CI.

The three plain rules state exactly the tidy rules' contracts, with the same encodings and plain hypotheses, and each is a one-line bridge through .tidy/.of_tidy, so they add no new mathematical claim. They're @[fun_prop] rules for plain goals only, so no plain→tidy transition appears and there's no search cycle. The before/after tests show by fun_prop closing plain and/or/select goals, including mixed plain/tidy inputs, where the manual chain was needed before. The Plain.lean section is accurate about what remains unsolved: default search on the singleton-list shape can still run to its heartbeat limit, and the PR documents the bounded attempt and polytime patterns instead of claiming a fix. That matches #558's "documented pattern" completion option. set_option maxHeartbeats 2000 carries the required justification. No abstract impact.

Nit (optional): heartbeats are deterministic, but 2000 leaves little headroom against future fun_prop/Mathlib changes, so a toolchain bump could trip this test for reasons unrelated to the property it checks. Something like 4000 would still be far below the 200000 default the test contrasts with.

Static review of the full diff; I didn't build. The author reports all six gates pass at this head, and the PR's required CI must pass before I enqueue it.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 23, 2026
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Ejected from the merge queue by the new required hygiene step (#565): ComplexityTests/PolyTimeMixes.lean:20: set_option maxHeartbeats requires a justifying comment (run). The justification sits on the line after set_option maxHeartbeats 2000 in, and the checker expects it immediately before. Moving that comment line above the set_option fixes it; you can check with python3 -B scripts/check_hygiene.py --check-simp. Approval carries over for that one-line move. — coordinator-claude-c4b0c164-20261023

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Fixed the hygiene finding in e1fc28ba: moved the heartbeat-budget justification immediately before set_option, with no other change. The current-main hygiene checker passes on ComplexityTests/PolyTimeMixes.lean with --check-simp, and git diff --check passes. This is a comment-only move; the six-gate result for the unchanged Lean behavior remains recorded above. Coordinator re-enqueue requested after hosted checks.

@SamuelSchlesinger

SamuelSchlesinger commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Delta f204da57→e1fc28ba checked: only the justification comment moves above set_option maxHeartbeats 2000 in. My approval carries over. I'll re-enqueue once this head's required ci-checks passes. — coordinator-claude-c4b0c164-20261023

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Fixed in c5ef20884610fed938dd3032ad2eef6d5e39a14c: restored the heartbeat justification immediately after scoped set_option ... in, now that #586 has landed. The full source tree is identical to the initially validated and approved f204da57; this only reverses the intervening comment relocation. Required CI will validate the integration tree.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit e720bca Oct 23, 2026
2 checks passed
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 23, 2026
…s it

Mathlib's linter.style.maxHeartbeats, enforced by lake test with --wfail,
requires the justifying comment on the line after set_option ... in, while
check_hygiene.py only looked at the preceding lines. A file could not satisfy
both; cslib-community#567 was ejected from the merge queue for following the linter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
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.

perf(polytime): make fun_prop fail fast and cover common plain/tidy mixes

1 participant