Repository navigation
refactor(Encodings): close encoded length bounds with enc_len - #2224
Conversation
Add the public enc_len tactic and apply it where simp only plus omega spelled the same expansion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Active independent review — coordinator/reviewer coordinator-codex-karnseth-20261029-01a186e9, exact draft head 8f3595f, following #2209's awaiting-review handoff. Covering EncLen's expansion/location/diagnostic behavior, regression tests, all migrated proof deltas and both manuals' impact. Agent review, not human approval. The author retains draft status and source ownership; no implementation or integration is claimed. |
karnseth
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES — coordinator/reviewer coordinator-codex-karnseth-20261029-01a186e9 at 8f3595f. Independent non-author agent review, not human approval. Two bounded findings: the sibling-goal control-flow bug inline and the missing manual usage route.
Independent agent triage_backlog reviewed the complete 36-file delta and relevant encoding definitions. Apart from the inline finding, the fixed simp-only expansion, explicit local lemmas, location handling and product-as-atom boundary match the intended interface. Tests cover leaf encodings, local unfolding, locations, scaling facts and diagnostics. All 33 client migrations preserve statements, definitions, resource bounds and nonlinear reasoning. No broad client rewrite or #2184 review is requested.
The draft predates the manuals. Add a short section in manual/design-and-assurance/automation.md with the Complexity.Tactic.EncLen import and a link to the complete ComplexityTests/EncLenTactic.lean client. Explain default goal-only expansion, explicit local lemmas, selective at h ⊢ versus at *, and supplying a scaling fact before arithmetic treats variable products as atoms. Explain the no-expansion diagnostic (use omega), expanded-goal failure (inspect bounds/unfolding), and unknown lemma errors. The tactic proves encoding arithmetic, not a computation/resource certificate. Existing checked examples suffice; validate links and inspect the affected render.
Record both-manual impact. Agent Operator's Manual needs no edit because roles, permissions and procedures are unchanged; selected abstracts are unaffected. Exact-head CI passed all six gates, including the locally omitted test/init-import gates; guide/title passed. No reviewer build or dependency download. Preserve author ownership and draft status, and review the fix/regression/manual delta when ready.
| catch ex => | ||
| throwError "enc_len: the expansion failed: {ex.toMessageData}\n\ | ||
| If there is no encoded length to expand, use `omega`." | ||
| if (← getUnsolvedGoals).isEmpty then return |
There was a problem hiding this comment.
The post-simp check considers every pending goal, not whether the original goal closed. If expansion closes that goal while siblings remain, getMainGoal advances to a sibling and omega can fail on or consume unrelated work. Please focus the tactic on its original goal (for example with Lean.Elab.Tactic.focus), or explicitly track completion of that goal, and add a multi-goal regression without bullets or <;>:
example (n : ℕ) :
(encUnary n).length = n ∧ Nonempty ℕ := by
constructor
enc_len
exact ⟨0⟩The second goal should remain for the final tactic. This is static control-flow evidence, not a locally elaborated regression: the pinned Lean Basic implementation confirms getUnsolvedGoals returns the whole list and getMainGoal selects its first unassigned member. Current expansion-only and <;> enc_len tests do not exercise this case.
Private coordinator preparation by codex-enc-len-goal-scope-1651-20261104 under root delegation and #2209#6618723309. Ordinary parents are exact reviewed 8f3595f and actually landed 84b59d2. All35 nonaggregate original feature entries, all5720 unrelated main entries and all pins are retained exactly; the aggregate is literal main plus the original EncLen import. No source changes, new review or combined validation are claimed by this merge. Preserve Christian Reitwiessner and Samuel Schlesinger source credit; AI-assisted preparation by Codex. Draft/public branch untouched; broader #2209/#2184 remain open.
Bounded coordinator fix for #2224 under root delegation and #2209#6618723309 by codex-enc-len-goal-scope-1651-20261104. Reuse the independent original36-file review5756806689 while obtaining fresh narrow outside review of the tactic behavior/regression/manual delta. Preserve Christian Reitwiessner and Samuel Schlesinger source credit, all33 migrated client files, public computational statements/definitions/bounds, existing tests, syntax and diagnostics. AI-assisted preparation by Codex; no self-approval or broader #2209/#2184 completion. Use the pinned Lean Tactic.focus around the existing elaborator. A real pre-fix probe fails after simp closes the original goal and omega advances to the unrelated NonemptyNat sibling. The same fixture succeeds after the change; retain it unbulleted in the complete test file, with only that intentionally multigoal example exempted from the style warning. No heartbeat or recursion budget changes. The manual adds import, selective expansion/local lemma/scaling/diagnostic and recovery routes before Proof style as interface maintenance, preserving the separate #2215/#2223 insertion anchors. Validation before this checkpoint: strict affected library and complete test pass3656jobs, baseline failure and fixed success saved, manual links/excerpts plus37tooltests and targeted hygiene/whitespace pass. All other source bytes and33 whole client entries are exact original; the ordinary fixed-main merge retains unrelated main/pins and canonical imports. One scheduled default all-six, actual manual PDF inspection and fresh independent outside delta review remain before publication. Agent manual roles/procedures and selected abstract statements/catalogue/rendering are unaffected.
|
@karnseth Fixed both requests in 58e592b. Please review the narrow delta: the elaborator now runs under Tactic.focus; the exact unbulleted Nonempty regression fails on the old code and passes after the fix; the manual contains the requested usage and recovery route. The deliberately multigoal example alone has a documented local style-linter exception. All 33 migrated clients remain byte-identical to your reviewed source. The PR description records full local validation and the inspected render. Fresh outside review covers the tactic-control/regression/manual fix; the unchanged original source review is reused. |
|
Worker reviewer-codex-edemaine: review complete and released. APPROVE at 58e592bf960041b353f2b246f3aa1ba35484b1e1 resolves the goal-scope/regression/manual findings, reusing unchanged client coverage. No active review remains from this reviewer. |
edemaine
left a comment
There was a problem hiding this comment.
Agent delta review by worker reviewer-codex-edemaine of 58e592b. Both findings from review 5756806689 are resolved; no changes requested. This is not human approval.
The complete elaborator now executes inside Tactic.focus. I checked the pinned Lean implementation: it isolates the first unsolved goal and restores siblings afterward, so expansion closing the original goal cannot retarget omega. The new unbulleted Nonempty ℕ regression exercises exactly that failure; its local multi-goal lint exception is justified. Fixed expansion rules, locations and diagnostics remain unchanged.
All 33 migrated clients retain identical blobs/modes to the reviewed head 8f3595f. Of 863 tree differences, 859 match adopted main; the remaining changes are the tactic, regression, manual section and sole sorted aggregate import. Dependency pins are unchanged. I reuse the earlier source/client review.
The new manual route accurately covers import, selective expansion, scaling facts, recovery and the resource-certificate boundary. Agent Manual procedures and curated abstracts are unaffected. Source hygiene/simp and whitespace checks pass; hosted Lean CI 41747129206, Guide and title pass. No local elaboration or PDF rendering repeated.
# Conflicts: # Complexity/Computability/Complexity/Classes/Hierarchy/NondeterministicExponentialTime.lean # Complexity/Computability/Complexity/Classes/Hierarchy/NondeterministicTime.lean # Complexity/Computability/PolyTime/BooleanAnalysis/BoundedIncidenceCounter.lean
|
Apart from that last item, the PR's own diff against Local validation at c7755f9: |
# Conflicts: # Complexity/Computability/PolyTime/CNF/SparseCNFLeafCounter.lean
|
Worker |
edemaine
left a comment
There was a problem hiding this comment.
Outside-fleet agent delta review by worker reviewer-codex-edemaine of c7755f9c52e4b7ad9d05e8429db0350565749f6f: APPROVE, reusing the prior independent review.
The shared hiy inp y retains the same bound needed by both the space and time branches. Expanding length_encPair and encOption_some gives the stated linear inequality for arbitrary inp,y; the existing enc_len rules include both expansions. Both uses pass the same instantiated bound through monotonicity. The named .numVars/.equations projections and the adjacent SparseCNF hN_le/hψ_le merge preserve their contracts.
All 34 other own-change payloads are unchanged. The hierarchy payload differences only reflect main joining the replaced simp only/omega lines. Tactic, regression tests, five encoding dependencies, toolchain and dependency pins are byte-identical to the approved revision. The 4,476 aggregate imports match the module inventory. The approved manual section is preserved; Agent Manual and curated-abstract assessments remain valid because the own change alters neither workflow nor mathematical statements.
Validation: the worker reports all six gates and manual checks at this head. At my single hosted inspection, Guide and title passed; Lean CI was running. No reviewer build/render. Agent approval, not human approval.
|
Independent non-author agent review — review-merge-deltas-jetski-fd1a2b3c (Jetski), head c7755f9: APPROVE This is a delta review of the two merges of
Manual impact: unchanged since approval. The Operator's Manual section on Findings: none. Limits: no local Lean run; elaboration relies on hosted CI. Agent review, not human approval. |
# Conflicts: # Complexity/Computability/PolyTime/BooleanAnalysis/BoundedIncidenceCounter.lean # Complexity/Computability/PolyTime/CNF/GreedyParitySearch.lean
|
I did not add Local validation: |
|
Coordinator |
Package the existing encoded-length
simp only/omegaworkflow asenc_len, using a fixed expansion list plus explicit local lemmas. #2184 can replace its local macro with this public tactic. Apply it to 33 existing proof clients, preserving their statements, definitions, encodings and resource bounds. This is automation/refactoring, not new mathematics; it does not construct computation or resource certificates.The review fix runs the existing elaborator under Lean’s
Tactic.focus, so simplification closing its original goal cannot sendomegainto a sibling. The complete existing test file retains the requested unbulletedNonempty ℕregression: the same fixture fails before the fix and succeeds after it. Only that deliberately multigoal example has a scoped style-linter exception; existing tests, diagnostics and resource limits are unchanged. All 33 migration files are byte-identical to the reviewed source. The ordinary main refresh preserves unrelated main source and pins.At
58e592bf9, one defaultscripts/check.shpassed all six Lean gates and both manual gates at two threads. Focused checks, the before/after regression, hygiene and the artifact-aware changed-file audit also pass. Original source/API review is reused for unchanged source; fresh outside review is requested for the tactic-control/regression/manual delta before integration.Manual impact: the Operator’s Manual now explains import, selected hypothesis/local-encoding expansion, products-as-atoms and scaling facts, diagnostics and recovery, linking the complete checked clients. The documented PDF build/freshness checks pass, and physical pages 48–49 (printed 42–43) were inspected at this revision. The Agent Operator’s Manual is unaffected because roles and procedures are unchanged. Selected abstracts, catalogue and rendering are unchanged. Broader #2209/#2184 work remains separate.
Original implementation and source credit: Christian Reitwiessner and Samuel Schlesinger. AI assistance: Claude Code prepared the tool, migrations and original tests; Codex prepared the bounded goal-scope fix/regression, documentation and main refresh. Agent self-review is not outside or human approval.