Repository navigation
refactor(ExtendedFormulation/CorrDigraph): direction- and polarity-generic adjacency and tour proofs - #4973
refactor(ExtendedFormulation/CorrDigraph): direction- and polarity-generic adjacency and tour proofs#4973SamuelSchlesinger wants to merge 1 commit into
Conversation
…nd polarity twins once
- corrDigraphAdj_chainEnd: one lemma for both chain endpoints and both
directions replaces chain0_in/out and chainLast_in/out.
- corrDigraphAdj_mul3: in/out neighbors of 3j in one statement.
- corrDigraphAdj_slot_out: slot vertex 3l + r for r in {1, 2}; slot1_out
and slot2_out are instances. Unused slot1_in, slot2_in and
slotClause_inj_slot removed.
- consecutivePairs_slotVisit_mem and chain_one_zero_not_mem_forward
handle both values / clause cases with one argument; mem_slotVisit_iff
and mem_varBlock_iff share the membership proof across orientations.
- exists_dirTour_of_assignment: one index-successor fact and one block
link fact; exists_assignment_of_dirTour: shared last-slot identities
and orientation-resolved dichotomy instead of repeated case splits.
- Nonempty finRange via List.finRange_eq_nil_iff.
Statements of public declarations unchanged.
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Agent review (Jetski reviewer session b5db8351-45e5-4ea4-90e3-e3abed6a91f3) of 1f341eed41b6b8c6ac2dcd256a214ee066472e59: approve
This proof refactor of CorrDigraph.lean adds no new mathematics. Every changed or removed declaration is private. The diff touches no public signature, attribute or @[expose] body: the only declaration headers in it are the private ones listed in the description. The line count is accurate (+215/−539).
What got simpler:
corrDigraphAdj_chainEndreplaces four near-identical endpoint lemmas (chain0_in/out,chainLast_in/out). Onehnbfact about the unique interior neighbour carries both endpoints and both directions. I checked the hypotheses: the casechainLen = 1is vacuous, soomegacloses it.corrDigraphAdj_mul3andcorrDigraphAdj_slot_out(generic inr ∈ {1, 2}, with literaldecide (r = 2)) remove the in/out and slot-1/slot-2 twins.slot1_outandslot2_outare now one-line instances, kept because they fix the concreteFinindices thatexists_assignment_of_dirTouruses.consecutivePairs_slotVisit_mem,chain_one_zero_not_mem_forward,mem_slotVisit_iffandmem_varBlock_iffeach run one argument over all value/clause cases instead of mirrored case blocks.- The two tour theorems now share
hsucc,hlink,hlast_eqandhdich_fwd/hdich_bwdinstead of repeating the index and dichotomy blocks. The nonempty-finRangeproofs now useList.finRange_eq_nil_iff.
What I checked:
- The deleted
slotClause_inj_slot,corrDigraphAdj_slot1_inandcorrDigraphAdj_slot2_inwere unused onmain. Their only occurrence was the definition. There are no references elsewhere in the repo, and neither TSP nor the tests useimport all. The same holds for the replaced endpoint andmul3lemmas. - I built CorrDigraph, TSP and
CslibFrontierTests…ExtensionComplexityLowerBoundswith--wfail --iofailin my own worktree. A directlake env lean -DwarningAsError=truere-elaboration of CorrDigraph was clean, in about 27 s wall time. proof_copies.py --base origin/mainreports no repeated proof block.- Style: no lines over 100 characters, no
sorry,native_decideor heartbeat options. The one baresimp(inchain_one_zero_mem_backward) is pre-existing and terminal. - Manuals: the Operator's Manual mentions only the public
corrDigraphAdjand public theorems, and neither manual names the touched private declarations. No manual edit is needed.
Non-blocking nit: the try split_ifs … <;> first | … | … pattern in consecutivePairs_slotVisit_mem depends on the goal shape more than the explicit cases it replaces. It is acceptable for a private lemma, and the comments explain the walk.
Limitations: hosted ci-checks was still running when I wrote this. I did not run the whole-library build.
Part of #3725 (repeated proof machinery). Author: Jetski worker sessions
025a212a(delegating) andff9b1e16(implementation), branchproofs/corrdigraph-twins. This PR is its own task record.Foundations/Analysis/Convex/ExtendedFormulation/CorrDigraph.leanproved many facts once per direction (in/out), per chain end (first/last) or per literal polarity (false/true);scripts/proof_copies.pyflagged several of these twins. They are now proved once:corrDigraphAdj_chainEndcovers both chain endpoints in both directions. It replaceschain0_in,chain0_out,chainLast_inandchainLast_out(about 110 lines).3j.corrDigraphAdj_mul3states both its in- and out-neighbours, so the shared "no clause at a multiple of 3" argument appears once.corrDigraphAdj_slot_outis generic in the slotr ∈ {1, 2}, andslot1_out/slot2_outare one-line instances. The unused privateslot1_in,slot2_inandslotClause_inj_slotare deleted.List.consecutivePairs_slotVisit_memandchain_one_zero_not_mem_forward. One argument handles the false/true and no-clause/owned/not-owned cases (localhchain,hown). This replaces about 75 lines ofOr.inl/Or.inrtwins.mem_varBlock_iffandmem_slotVisit_iff. Each orientation is first rewritten to one normal form.exists_dirTour_of_assignmentandexists_assignment_of_dirTour. Sharedhsucc,hlink,hlast_eqandhdich_fwd/hdich_bwdfacts replace duplicated index, adjacency and dichotomy blocks. Five hand-written nonempty-finRangeproofs becomemt List.finRange_eq_nil_iff.1 _.No public declaration changes; every changed or removed declaration is private. Net −324 lines (+215/−539).
proof_copies.py --allreports nothing left in the file. Left as is: thei < j/j < ibranches ofslotClause_eq_some_iff(mirror images with differentCorrPairIdxconstructions) and thechain.injlines ofslotVisit_nodup/slotVisit_disjoint, which are not direction twins.This is refactoring only, with no new mathematics.
Validation:
lake build --wfail --iofailof CorrDigraph, its client TSP, the extension-complexity lower-bound test andCslibFrontierResults.Entries;scripts/check.sh --quickpassed (7 affected targets, manual checks, hygiene, lints, ratchets,mk_all --check). Single-file elaboration (lake env lean, 4 interleaved runs): 10.5–12.5 s → 9.5–12.6 s, user time 16.4 → 15.3 s. CI does the full run.Manuals: the Operator's Manual mentions only the public
corrDigraphAdjand the public theorems, which are unchanged, so it needs no edit. Nor does the Agent Operator's Manual.AI assistance: prepared by AI agents (Jetski). Not reviewed by a human.