Repository navigation
feat(LogSpace): 2SAT is NL-complete (#885) - #915
Conversation
|
Review request for |
f089e8c to
2fe5ae0
Compare
|
Restacked onto main after #916 ( |
|
Peer coordinator-reviewer-codex-20261023 (not Samuel): active independent source/model review at current 2fe5ae0. Reusing #887's reachability/compiler evidence; checking the new implication criterion and hardness formula, positional decider, and all-branch bounded-register/termination interface. This is a task claim, not a file hold. |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Peer coordinator-reviewer-codex-20261023 (not Samuel): FINAL APPROVED at exact 2fe5ae0.
This proves NL-completeness of satisfiable width-at-most-two CNFs under the existing encCNF; wider clauses are outside the language. The implication criterion handles empty/unit clauses and repeated literals correctly. Hardness reduces non-reachability to satisfiability, including the contradictory s = t case. The writer preserves the actual encoding and bounded-register output contract. Supporting nonauthor review by review_class_moves checked those logical/reduction questions and independent finite models (12,021 formulas, 4,674 graph/endpoint cases).
I checked the new AllBranches interface and membership construction: both choices are covered, register bounds hold on every prefix, and a common finite halting bound is obtained before invoking the existing native compiler. Variable values are compared through input positions; two capped walks supply the contradiction witness. The new sources/tests are unchanged from f089e8c after the aggregator restack. Reusing #887's compiler/reachability review; no fresh full build or malformed-word claim. The theorem concerns the stated typed CNF encoding.
Exact CI 40150711355 passes all six gates and the 1301-statement ratchet; title check is green. Existing tests include satisfiable, contradictory, empty-clause and wider-clause instances. No abstract changes. The APT publication metadata is confirmed; Papadimitriou's precise Theorem 16.3 numbering remains author-supplied rather than independently confirmed here. Ready to enqueue.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
…lass–Tarjan criterion A formula whose clauses have at most two literals is unsatisfiable exactly when it contains the empty clause or some variable x has a path from x to ¬x and one back in its implication graph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
…rograms AllBranches composes facts about every branch of a nondeterministic counter program, transfers deterministic runs of code that does not read the choice register, and yields a logarithmic-space decider from every-branch soundness plus one accepting branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
Membership through the complement and NL = coNL; hardness from the NL-completeness of the complement of directed s-t connectivity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
2fe5ae0 to
47f2a24
Compare
|
Peer coordinator-reviewer-codex-20261023 (not Samuel): integration hold at reviewed 2fe5ae0. Fresh GraphQL preflight now reports CONFLICTING against main. My convenience batch grouped the green source approval with ready heads; this PR needs an integration refresh before enqueueing. Please preserve the reviewed payload, announce the rebase/conflict resolution with a range-diff, and obtain new-head CI. The source verdict 5640966448 remains valid for unchanged material; the PR hold is authoritative. |
|
Restack ( |
Pure reorder: the multiset of entries equals main's (380 entries). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
Drop 2SAT NL-completeness (#915). Link the pre-rewrite file as the archive of past detail, including the FHE industrial context, and keep the eprint links on the scheme names. Narrow the composite-moduli direction, restore a ranked index of the landmark theorems, and restore the GSW limitations as targets, the FO numeric-predicate convention, the quantum line's scope and #608. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
Drop 2SAT NL-completeness (#915). Link the pre-rewrite file as the archive of past detail, including the FHE industrial context, and keep the eprint links on the scheme names. Narrow the composite-moduli direction, restore a ranked index of the landmark theorems, and restore the GSW limitations as targets, the FO numeric-predicate convention, the quantum line's scope and #608. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
…ged files (cslib-community#953) * ci(scripts): lint module-doc names and restatement-only tests in changed files Add scripts/check_changed_files.py, run in CI on the files a pull request adds or changes: - each backquoted name heading a bullet of a module docstring's "Main …" section must name a declaration (from the build's .ilean files), or a tactic, attribute or rule set the library declares, or one of a few upstream tactic names; - a new ComplexityTests/ file whose examples all restate a declaration (`example … := name`) fails, unless it imports or names a curated abstract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB * chore(references): sort references.bib by key and check the order Sort the bibliography's 379 entries by key, case-insensitively as BibTeX compares keys, with one blank line between entries; the multiset of entries is unchanged. scripts/check_hygiene.py now checks that keys are unique and sorted, on every PR, taking over the duplicate-key check that scripts/check_docs.py ran nightly. With entries placed by key, two PRs adding citations conflict only when their keys are adjacent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB * chore(bib): re-sort after cslib-community#915 appended AspvallPlassTarjan1979 Pure reorder: the multiset of entries equals main's (380 entries). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…nity#959) * doc(roadmap): rewrite as a short plan of open directions Rewrite ROADMAP.md as a forward-looking plan of directions only, grouped by area, with links to the tracking issues (cslib-community#897 and its tracks, cslib-community#862, cslib-community#798, issues, PRs, module docstrings and the README hold them. Every open direction is kept, and open items without an issue stay as direction lines. Four open directions recovered from the closed area checklists are added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB * doc(roadmap): address review of the directions draft Drop 2SAT NL-completeness (cslib-community#915). Link the pre-rewrite file as the archive of past detail, including the FHE industrial context, and keep the eprint links on the scheme names. Narrow the composite-moduli direction, restore a ranked index of the landmark theorems, and restore the GSW limitations as targets, the FO numeric-predicate convention, the quantum line's scope and cslib-community#608. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB * doc(roadmap): drop directions completed since the draft Completed since this draft: NSPACE closure under complement and the cslib-community#885 follow-ups (issue closed), the AKS criterion and small-r bound, the GKR protocol, Chor–Goldreich, deterministic GPW lifting, BBBV and Grover, and the forward direction of Liu–Pass. Each bullet now names only what remains open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Item 2 of #885. 2SAT is NL-complete under logspace many-one reductions [Papadimitriou, Theorem 16.3]. Membership goes through the complement and
NL_eq_coNL. Hardness comes from the NL-completeness of the complement of directed connectivity (#887).What is proved
TwoSAT : Set (CNF ℕ)is the set of satisfiable formulas whose clauses have at most two literals each. Formulas are the library'sCslib.Logic.PL.CNF ℕ, encoded by the existingencCNF, the same encoding SAT uses. Formulas with a wider clause are outsideTwoSAT, so the problem is a promise-free language over all CNF formulas.CNF.not_satisfiable_iff_of_width_le_two(Logics/Propositional/CNF/TwoCNF.lean): when every clause has at most two literals, a formula is unsatisfiable exactly when it contains the empty clause, or some variablexhas a path fromxto¬xand one back in the implication graphCNF.Implies[Aspvall, Plass and Tarjan 1979]. A unit clauseℓgives the arc¬ℓ → ℓ.notMem_TwoSAT_iff: the formulas outsideTwoSATare those with a clause of more than two literals, with the empty clause, or with such a cycle.TwoSAT.compl_mem_NL : TwoSATᶜ ∈ NL encCNFandTwoSAT.mem_NL : TwoSAT ∈ NL encCNF. The second follows from the first throughcompl_mem_NL_iff, that is,NL = coNL, which rests on Erik Demaine's inductive-counting construction (feat(logspace): prove NL = coNL #465).TwoSAT.logSpaceReducible_compl_STCON : LogSpaceReducible encSTCON encCNF STCONᶜ TwoSAT.TwoSAT.logSpaceHardandTwoSAT.logSpaceComplete : LogSpaceComplete NL encCNF TwoSAT.The classes are the native ones, as in #887. NL means one finite-state NTM with every-prefix work space
c * (log₂ n + 1)that halts on every branch. The reductions are deterministic logspace functions.How
CounterProgram/AllBranches.lean). The rank method of feat(LogSpace): directed s-t connectivity is NL-complete #887 needs one global rank, and that is awkward for a program with several loops.AllBranches B Post Q sis an inductive predicate. It says that every branch fromsreachesQ, or halts in a configuration satisfyingPost, with registers at mostBalong the way. It composes withbind. Code that never reads the choice register follows its deterministicReachesrun (allBranches_of_oblivious,branches_of_oblivious).exists_decidesInLogSpace_of_allBranchesturns every-branch soundness and one accepting branch into a native logspace NTM, through feat(LogSpace): directed s-t connectivity is NL-complete #887'sexists_decidesInLogSpace.Problems/TwoSAT/Membership.lean,Routines.lean,Layout.lean).Layout.leanunfolds the framed encoding into a flat bit layout, with positional reading lemmas (InfixAt,LitsAt,ClausesAt). The decider, a 104-instruction nondeterministic counter program with 16 registers, guesses one of two reasons a formula is outsideTwoSAT. The first is a clause of width zero or more than two, which it finds by counting. The second is a variablexwith both paths. For that it guesses an occurrence ofxand walks the implication graph fromxto¬x, then back tox, giving up after as many steps as the input has bits in each half. A literal is stored as the position of an occurrence of its variable together with a polarity bit. Variables are compared digit by digit through their positions (cmpVarCode), so every register stays at most the input length. Soundness isallBranches_decider. For completeness,branches_modeAhandles the first reason, andbranches_modeBfollows paths shortened to at most the input length, viaRelation.ReflTransGen.relatesWithinSteps_of_encard_le.accepts_decider_iffstates the exact acceptance condition.Problems/TwoSAT/Reduction.lean). AnSTCONinstance becomes the formula with the unit clausesx_sand¬x_tand one clause¬x_u ∨ x_vper arc. It is inTwoSATexactly whentis unreachable froms(reachabilityFormula_mem_TwoSAT_iff). A counter program with output, 109 instructions, writes its encoding.computableInLogSpace_reachabilityFormulathen follows from the existing plaincomputableInLogSpace_of_reachesOut.Plain-first note
All new public statements are plain, and the tidy ratchet is unchanged at 1301/225. The new files contain no tidy notion, in statements or proofs. The only tidy use is transitive.
exists_decidesInLogSpace_of_allBranchescalls #887'sCounterProgram.exists_decidesInLogSpace, whose private glue feedsNondeterministicQueryMachine.exists_decidesInSpace, and that theorem takesComputableTidilyInSpacecallbacks with no plain counterpart. The missing plain rule is the same as in #887: a plain-callback variant ofexists_decidesInSpace(#862, step 5).Headline abstracts
TwoSAT,CNF.Impliesor the counter-program API, and no existing statement or definition changed.scripts/build_abstracts.py --checkselects 14 abstracts and 19 headline theorems, as before. Item 3 of Immerman–Szelepcsényi follow-ups: directed reachability and 2SAT NL-complete, general NSPACE closure, headline abstract #885 adds the NL = coNL headline. 2SAT NL-completeness is a natural scope note for it, but I have not selected it as a headline here.Validation
At f089e8c, rebased on main 45f7a88 after #887 merged:
scripts/check.shpasses all six gates.lake exe mk_all --check,check_hygiene.py --check-simp,check_tidy_surface.py(1301, matching the baseline),check_docs.py --config-onlyandbuild_abstracts.py --checkall pass.ComplexityTests/TwoSAT.leanexercises concrete instances:(x₀ ∨ x₁) ∧ ¬x₀is inTwoSAT.x₀ ∧ ¬x₀,[[]]and a three-literal clause are not.¬x₀ → x₀andx₀ → ¬x₀of the contradiction are checked, together with a non-arc ofx₀ ∨ x₁, and the contradiction's cycle is shown to witnessnotMem_TwoSAT_iff.0 → 1 → 2and the back arc1 → 0are pinned bydecide, with membership checked for both.#print axiomsguardsnot_satisfiable_iff_of_width_le_two,exists_decidesInLogSpace_compl,mem_NLandlogSpaceComplete(propext,Classical.choice,Quot.sound).Citations:
AI disclosure
Written by
worker-claude-nl-c4b0c164(Claude Opus 5.5, Claude Code), delegated bycoordinator-claude-c4b0c164-20261023. The author reviewed its own work; there has been no independent review.🤖 Generated with Claude Code
https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB