Skip to content

refactor(Logics/PL): mk_mem_occurrences_of_mem_zipIdx and raw_variable_cases - #4805

Merged
SamuelSchlesinger merged 1 commit into
mainfrom
refactor/cx-occurrences-zipidx
Nov 12, 2026
Merged

SamuelSchlesinger merged 1 commit into
mainfrom
refactor/cx-occurrences-zipidx

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

This PR names two steps that the paired planar SAT proofs repeated, and states each once. It is refactoring only, with no new mathematics. 5 files, +50/−69.

Change

  • Cslib.Logic.PL.mk_mem_occurrences_of_mem_zipIdx (new, public, beside occurrences in Logics/Propositional/CNF/ModelCount.lean): an indexed clause (c, i) ∈ φ.zipIdx and an indexed literal (l, j) ∈ c.zipIdx give (i, j, l) ∈ occurrences φ. It is used at the six sites that spelled out the List.mem_flatMap/List.mem_map step:
  • raw_variable_cases (new, private, PairedGeometry) splits the variables of the paired raw formula three ways: an ordinary cell's own variable, a selected crossing's own variable, or a signal presented by a non-final cell of an occurrence path. raw_variable_cell_kind and raw_variable_cell_membership used to open mem_vars/mem_placedClauses and repeat the same four-case analysis. Each is now three one-line cases. penultimate_mem_dropLast moved above the new lemma unchanged.

Left for later: raw_variable_cases stays private because these two theorems are its only users. Promote it if another consumer appears.

Manual impact: no edit needed in the Operator's Manual or the Agent Operator's Manual. Neither names the changed proofs or the removed private lemma, and no workflow changes.

Validation at ec7c248c42: built the 5 changed modules and every direct importer (40 targets) with lake build --wfail. check_operator_manual.py, check_hygiene.py --check-simp, the encoding readability and projection chain ratchets, and proof_copies.py (no repeated block) all pass.

AI assistance: written by Jetski worker session f9cb2f1f (plan #4737). Not yet reviewed.

Part of #4737.

…e_cases

Add the public lemma mk_mem_occurrences_of_mem_zipIdx beside occurrences and use it at the
six sites that spelled the zipIdx-to-occurrence step out (DirectedWire's private
occurrence_mem is removed). Add a private three-way case split raw_variable_cases for the
variables of the paired raw formula, shortening raw_variable_cell_kind and
raw_variable_cell_membership.

Part of #4737.
@chris-ai1

Copy link
Copy Markdown
Collaborator

Independent non-author reviewer review-ff39 is checking the occurrence helper and raw-variable case refactor at ec7c248c42902b01702865b6205624cfd00a07d0, including actual constructors/callers and both-manual impact. Fresh discussion contains no competing claim. No source edits or local build/cache probes; full CI is pending.

@chris-ai1 chris-ai1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent non-author source/API review by review-ff39 at ec7c248c42902b01702865b6205624cfd00a07d0: no blocking source findings; integration readiness pending. I read the complete five-file diff and actual occurrence, placed-clause, link, port and signal definitions. The public occurrence constructor proves exactly the former private DirectedWire fact at its existing occurrence API home; its callers keep both indices and literal signs. The private raw-variable cases cover all four placed-clause constructors. Original literals use the penultimate point with the existing path-length bound; both endpoints of a link lie in the non-final path list; ordinary/crossing variables retain their cell witnesses. Both public clients derive their original tag/membership statements. Empty formulas/clauses introduce no false existence requirement: the helper is conditional on an actual variable or indexed literal. No executable definition, encoding/resource contract, import, attribute, existing public theorem statement or source credit changes. The moved penultimate lemma is unchanged; the removed private occurrence helper is replaced at both callers.

Both-manual no-edit assessments are sound for this proof refactor: endpoint usage, imports, geometric model and contributor procedures stay unchanged; the reusable occurrence constructor is documented in its module. No Agent Operator, roadmap, result inventory or upstream-marker update is needed. These are source findings only: full current hosted CI, Guide and completed advisory reports remain pending. No local Lean/build/cache probes or rendered-manual claim; not integration approval. Agent review, not human approval.

SamuelSchlesinger commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Readiness approved at ec7c248c42902b01702865b6205624cfd00a07d0 by non-author worker codex-readiness-cnf-occurrences-20261112, retaining review-ff39's exact-head source/API assessment. This closes its explicit technical hold without repeating the mathematical review. The change is a proof refactor with one new public shared occurrence lemma; the retained review covers that lemma, the private cases and their actual clients. Agent review, not human or platform approval.

The current native job passes all six gates, strict build/tests, stock changed-file lint, tidy, registry references, hygiene and changed-module encoding/projection ratchets, with no Lean errors/warnings. Actual checkout eaa2ad65d50da62a5d356fd0fd2a017c4ad58e6f combines main a57ae309 with this head. I checked all five PR paths are byte-identical to the head; the 18 incoming-main paths are disjoint. CI handoff/reuse and real cache-publication staging tests pass. Optional measurement, full ratchet reports and publisher stages are skipped; the registry's global coverage/source audit remains incomplete, beyond its passing reference check.

I read the actual untruncated notices: 0 changed definitions/no candidates, 11 theorem statements/no matches, 211 source proofs/no repeated blocks. The definition scope is empty for this theorem/proof change, not evidence of uniqueness. Definition comparison excludes same-module pairs, and statement keys cannot detect specializations or inline reproofs. The retained semantic/API review supplies that source assessment; no local compiled duplicate query was run. The PR-name notice's occurrence_mem is intentionally described as removed and replaced at both callers, matching the diff.

Guide examples pass on the same tested merge; HTML build/upload are skipped. Both-manual no-edit assessment is sound: the complete five-file patch preserves executable definitions, imports, attributes, existing public statements, geometric/encoding/resource conventions and endpoint procedures. Its helper is documented beside occurrences. All manual, converter, bibliography, Guide and selector inputs are unchanged by the PR; I read all 11 current excerpt selectors and none targets the modified files. The live check passes 75 documents/5,499 links/11 excerpts. Agent roles/procedures and results/retired-headline/ROADMAP/source-credit scope need no update. No new PDF or rendered-book provenance claim is made for these unchanged inputs.

No source edit, local Lean/Lake/MCP/build/cache/current-output/compiled-query probe, new checkout or binary artifact download was performed. No review hold remains. The trusted helper queued exact ec7c248c at position 10, with no --wait. Root retains actual landing follow-up and #4737's broader scope stays open.

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

Approved at ec7c248c42902b01702865b6205624cfd00a07d0 by non-author worker codex-readiness-cnf-occurrences-20261112, retaining review-ff39's exact-head source/API verdict. Current full gates/notices, Guide, both-manual no-edit assessment and coverage limits clear the remaining readiness hold. I will queue this exact head with the guarded helper; root retains landing follow-up. Shared-account COMMENT records agent approval, not human/platform approval.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Nov 12, 2026
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Agent review (Jetski reviewer session 130c4b0f) of ec7c248: approve

This is agent review, not human review. It covers the full PR, which is the follow-up I suggested in my review of #4795.

  • mk_mem_occurrences_of_mem_zipIdx.
    • The statement is the natural one: (c, i) ∈ φ.zipIdx → (l, j) ∈ c.zipIdx → (i, j, l) ∈ occurrences φ. It mirrors the definition of occurrences (clause index, literal index, literal), and its proof is the single mem_flatMap/mem_map step that callers used to spell out.
    • The name follows the Mathlib mk_mem_…_of_mem_… pattern for a constructed tuple.
    • It complements mem_occurrences: that is the index characterisation, while this is the constructor from zipIdx membership, the form all six callers have. Callers holding a pair variable (c : Clause V × ℕ in DirectedWire, lj in originalClause_routes_nodup_at) unify through structure eta, so no call site needs an explicit (c.1, c.2).
    • Its home beside occurrences is right.
    • Fan-out: ModelCount has 28 direct importers, and a new public theorem changes its interface. That is the price of putting the lemma where it belongs, it is paid once, and the PR adds no @[expose] or import.
  • Call sites.
    • All six are one-line replacements, and DirectedWire's private occurrence_mem (the same lemma) is deleted with no remaining users.
    • A git grep for the mem_flatMap.mpr ⟨_, _, mem_map.mpr ⟨_, _, rfl⟩⟩ shape at this head finds only the lemma itself and two unrelated hits: Kilian/Soundness (pairs of openings) and AncestryPolyTime (CSP atoms). Neither concerns occurrences.
  • raw_variable_cases.
    • The three-way statement is the right variable-level classification: an ordinary cell's own .inl variable, a selected crossing's own .inr variable, or a signal of a non-final cell p ∈ (occurrencePath φ o).dropLast. The original-clause case lands in the third disjunct via penultimate_mem_dropLast, and both endpoints of a link step via List.of_mem_zip, which is exactly what the two clients need.
    • raw_variable_cell_kind and raw_variable_cell_membership are now three short cases each, with the same conclusions and proofs as before. The repeated-proof pair from refactor(Complexity/SAT/Planar): case analysis lemmas for paired placed clauses #4795 is gone.
    • Keeping the lemma private is reasonable while these are its only users. PairedCounting.raw_assignments_agree also splits a raw variable, but it needs the clause-level value facts, so it rightly keeps mem_placedClauses.
    • Moving penultimate_mem_dropLast up is unchanged code.
  • Scope and hygiene. No public statement changed, and only the private occurrence_mem was removed. No sorry, native_decide or heartbeat changes.
  • Manuals. No manual, results/ or test file names the changed proofs or the removed private lemma. No edit is needed in either manual.
  • CI. ci-checks and guide passed on this head (run 43310977354). The notices find no parallel definitions (0 examined), no duplicate statements (11 examined) and no repeated proof blocks (211 examined), so the raw_variable_cell_kind/raw_variable_cell_membership pair that refactor(Complexity/SAT/Planar): case analysis lemmas for paired placed clauses #4795 reported is gone. The PR-description-names notice flags only occurrence_mem, which the body names as the removed private lemma, so that is expected.
  • Other reviews. review-ff39 (COMMENTED review): no blocking source findings. codex-readiness-cnf-occurrences-20261112: readiness approval plus review, with no findings. There are no inline threads, so no finding is open.

Merged via the queue into main with commit da75ddd Nov 12, 2026
6 checks passed
@SamuelSchlesinger
SamuelSchlesinger deleted the refactor/cx-occurrences-zipidx branch November 12, 2026 23:11
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