Repository navigation
[Critical] Remove KSatisfiability KN variant and short-clause constructors - #1225
Conversation
KSatisfiability<KN> was Satisfiability under another name: it checked no clause width and its only edges were identity casts into and out of it. Every path from K2 or K3 paid an extra hop through it. - Drop the KN variant; K2 and K3 now reduce directly to Satisfiability and K3 is the default variant. - Remove new_allow_less/try_new_allow_less. K2 and K3 always hold exactly K literals per clause, matching what serde and the CLI already enforced. - Delete the short- and empty-clause branches these constructors forced on 3-SAT rules, and declare 3SAT -> KClique num_vertices and 3SAT -> DecisionMVC num_edges exact again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agentic Review ReportPR #1225 ( Structural
Semantic (traced by hand)
Quality
Feature test (
|
…e text SAT -> NAE turns every three-literal clause into a four-literal one, so the MonochromaticTriangle vertex, edge and triangle counts are equalities and its two-literal branch was dead. Also remove leftover short- and empty-clause wording and dead padding in OneInThree, QuadraticCongruences and Kernel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed the review in 86d6808. Important
Minor
Checks: lib tests 6321 passed, clippy 0 warnings, |
- Add a FixedK sub-trait implemented by K1..K5, and bound KSatisfiability and the SAT/K-SAT results by it, so KSatisfiability<KN> no longer type-checks instead of failing at construction. - Register each K-SAT aggregate mapping inside the macro that registers its witness edge, and take the SAT -> K-SAT clause width from the type. - Allocate CyclicOrdering's fresh padding variables with allocate_many. - Drop leftover braces in two tests and a stale QuadraticCongruences note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Removing the KSatisfiability KN variant does not need a new variant trait. Keep KSatisfiability bounded by KValue with the runtime width check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GiggleLiu
left a comment
There was a problem hiding this comment.
Agentic Review Report
PR #1225 — [Critical] Remove KSatisfiability KN variant and short-clause constructors
Reviewed head 3c2f9bdaf00c0f265dc567f4b593b24f8c37a625 against its own stacked base ef18c7635bb68aa2bd36b41f995ed3c89c3db9db, not main. Read-only review from /tmp/problemreductions-review-ksat; no tracked edits, posts, pushes, or merges. The user explicitly accepted the public API break if checks pass.
Structural and semantic
- Scope is the intended API cleanup: 39 Rust/Typst source and test files, with the obsolete cast rule deleted. Inspected every diff, all changed production reduction/model implementations, related SAT-to-NAE and allocator implementations, and changed test contracts. Paper review covered the affected proof sections, not the entire paper. No new core trait/macro changes or generated exports.
KSatisfiability::try_newvalidates literals and requires a fixed width and exactly K positions in every clause. Fields are private and getters expose immutable slices; serde uses the same constructor. Thus a constructible K2/K3 cannot reach the removed empty/short-clause arms. KN now fails even for an empty conjunction. Repeated literals and tautologies remain legal; an empty conjunction remains legal.- K3 is consistently the registry/schema default; K2 and K3 now each have a direct exact embedding into SAT. The embedding preserves variables, clauses, literal counts, witness values, and aggregate
Orvalues. Removing the KN casts shortens paths without introducing a K3-to-K2 reduction. The K3 ILP pipeline remains SAT -> NAE -> ILP. Lack of a K2 ILP pipeline predates this change. - Traced the surviving branches in BicliqueCover, FeasibleRegisterAssignment, RegisterSufficiency, PreemptiveScheduling and QUBO: removing literal padding is a no-op on width-K input; removing fixed empty-clause NO instances is justified by construction rejection. Empty-conjunction YES handling survives. OneInThree initializes all three positions before use. CyclicOrdering correctly retains its one- and two-literal normalized cases: deduplication of
[a,a,a]and[a,b,b]makes these reachable.allocate_many(3-len)gives the same fresh indices as the prior individual allocations, and tautologies are dropped before allocation. - KClique's
3m+1vertices andm+1threshold are exact. Literal positions remain separate vertices even when variables repeat. Every valid threshold clique contains the anchor and one compatible occurrence per clause; extraction is consistent.clique_sizeschecks the largest multiplication before allocation. - DecisionMVC has exactly
2n+3mvertices andn+6medges. The n variable edges, 3m triangle edges and 3m communication edges are pairwise distinct; repeated literals do not merge communication edges because their clause-position endpoints differ. The empty formula has n edges and cover threshold n. - MonochromaticTriangle's exact promotion is sound. SAT -> NAE appends one sentinel and preserves every three-literal clause, so there are N=n+1+m logical variables after splitting and T=n+1+3m triples. Each triple contributes 12 vertices, 48 edges and 58 triangles; the signals contribute 4N vertices and 2N edges. Distinct private sender vertices prevent extra cross-sender triangles even when a signal is reused. Therefore the registered counts are exactly
16n+40m+16,50n+146m+50,58n+174m+58. The NAE-four-to-two-triples identity holds for all 16 Boolean inputs. Empty n=m=0 still produces the sentinel/sign-consistency gadget with counts (16,50,58). - No new algorithmic complexity claim is introduced: registered K2/K3 bounds are preserved. The API/domain restriction and exact-count assertions above were checked directly, rather than inferred from tests or citations.
Quality and validation
git diff --checkpassed. Repository search found no remaining uses of the removed constructors/cast module; KN appears in K-SAT only in its deliberate rejection test.- Native validation at the reviewed head:
cargo test --locked --lib --all-features ksatpassed 169/169. Using the resulting copied test binary,symbolic_parameter_contractspassed 28,parameter_formula8,aggregate_contracts14,ilp_overhead51,test_reduction_graph72,registry107,example_db66, andtest_reduction_chain_with_variant1, all with zero failures. These filters overlap; together they cover 510 distinct passing tests. Logs aretest-1225-*.login this report directory. Built with Rust 1.98.0, jobs=2, debug=0, incremental=0; subsequent filters used test-threads=2. - Verification environment: the first build reused an older shared-target Expr artifact and reported a missing
Sumimplementation even though the reviewed source contained it. A selectivecargo clean -p problemreductions-exprcaused Expr, macros and the library to rebuild from the reviewed sources; the clean rebuild and tests passed. This was a cache artifact, not a PR defect. - Independent combinatorial probe: all 4,162 formulas consisting of the empty formula, every ordered three-literal clause and pair over two variables, plus the zero-variable empty formula, satisfy the new MonochromaticTriangle and DecisionMVC counts. Also checked the NAE splitting identity on all 16 Boolean tuples. Evidence:
ksat-exact-counts-probe.pyandksat-exact-counts-probe.txtin this report directory. This checks mathematical graph counts independently; it does not substitute for native Rust execution. - Existing tests preserve coverage of repeated/complementary literals, sparse variables, empty conjunctions, UNSAT instances, malformed target witnesses and numeric count limits. Exhaustive small-target checks remain for KClique, Kernel and QUBO. Invalid-width tests replace the now-impossible empty/short clause construction cases. No coverage percentage was measured.
Feature test
Exact-head native registry, aggregate mapping, symbolic parameter, path-chain and canonical example tests all passed, as listed above. The PR's author reports CLI, all-library, integration, Clippy and paper checks; those reports are not independent verification. No fresh exact-head CLI install or complete paper build was performed by this reviewer. API migration is explicitly documented in the PR body: use Satisfiability for former KN, repeat literals for short K2/K3 clauses, and migrate the external KN validation corpus.
Findings
Critical: no new issue found in this PR's own diff.
Important: no new issue found in this PR's own diff. This is not a merge clearance for the stack: #1224 and earlier growth/UI findings remain dependency blockers and must be resolved/reviewed separately.
Minor — remaining paper wording still advertises removed native clause widths.
docs/paper/reductions.typ:12506says the QuadraticCongruences construction handles native widths zero through three. The native K3 input now has exactly three positions; deduplication leaves one through three.docs/paper/reductions.typ:18134says RegisterSufficiency extends to the native zero-to-three-literal domain, contradicting the new constructor.docs/paper/reductions.typ:19180still mentions missing Kernel clause positions being set false; none can be missing now.
Suggested fix: describe exact-three native inputs with repeated literals, distinguish normalized widths where applicable, and delete the obsolete missing-position phrase. These are documentation cleanups, not mathematical blockers.
GitHub PR Audit
GATE: PASS for harm signals. Code correctness and inherited dependency findings are assessed separately.
- harm.secrets (
security.no-secrets): OK — reviewed added lines; no credentials, private keys or sensitive personal data found; bounded signature scan had no hits. - harm.dangerous-files (
git.harm-signals): OK — only relevant Rust and Typst files; no conflict markers, archives, binaries, local configurations or scratch files in diff. Worktree status clean. - harm.generated-artifacts (
code.generated-artifacts): OK — no generated exports, build/target/dependency outputs added. - harm.cache (
code.generated-cache): OK — no caches added. - harm.debug-leftovers (
code.debug-leftovers): OK — no new debug probes, breakpoints or WIP markers found. - pr.description-quality (
github.pr-description-quality): OK — explains purpose, API break, migration, tests and stack base in detail. - pr.traceable (
github.prs-traceable): OK — clear motivation, migration consequences and base #1224, with review/fix history.
Verdict
Own diff: acceptable with minor documentation advice after independent native checks. Keep the PR open as dependency-blocked, consistent with the user’s decision to leave substantive blockers and their dependent stack open. The accepted API break is intentional. No new substantive blocker was found; only the minor paper wording above is newly reported here. This is not blanket validation of the inherited stack or a claim that the full 6,321-test suite was independently rerun.
Review follow-upPushed proof correction The complete repaired stack passed 7,194 native tests, formatting, Clippy, and the paper build at Compatibility note for the next release: |
GiggleLiu
left a comment
There was a problem hiding this comment.
Agentic Review Report: stack consolidation
Approved reviewed head 9b281d770bd1a37cb823a2c7e041beae161ae7a8 for merging into feat/exact-tight-bounds only. The user accepted the K-SAT API migration. The proof wording correction is reviewed, and the numeric prerequisite is fixed at 52bd171a0.
Checked inline comments, submitted reviews, PR conversation, linked-issue comments, and Codecov comments. No new unaddressed material finding. Harm gate remains PASS from the independent review.
The repaired combined stack passed 7,194 native tests, formatting, all-target/all-feature Clippy, and make paper at d96e7c8b8. Those results include the separate semantic fixture correction; they are aggregate validation, not a claim that this individual head was retested unchanged. Final website checks and strict main-branch CI remain pending. This merge preserves the PR record while consolidating the reviewed backend stack.
KSatisfiabilityThis PR removes a public variant and two public constructors. Downstream code and stored instances that use them will break (see Migration).
Why
KSatisfiability<KN>checked no clause width, so it wasSatisfiabilityunder a second name. Its only edges were identity casts (K2 → KN, K3 → KN, KN → SAT), so every K-SAT path through SAT paid extra hops, e.g.new_allow_less/try_new_allow_lesslet Rust code build K2/K3 instances with fewer than K literals per clause, which serde and the CLI already rejected. No rule produced such instances; only tests did. Every 3-SAT rule still had to handle them, and two parameter formulas had to stayupper_bound.Changes
KNvariant is gone. K3 is the default variant.try_newrequires exactly K literals per clause, and a KN instance fails with a construction error.KSatisfiability/KNnow starts fromKSatisfiability/K3.num_vertices = 3m+1and 3SAT → DecisionMVCnum_edges = n+6m.allocate_many. Leftover short-clause comments and padding are removed from OneInThree, QuadraticCongruences and Kernel.[1]→[1,1,1]). Tests that only covered empty clauses are removed. New tests check that wrong widths and KN are rejected.Commits:
FixedKtrait that eafd02a added. It wasn't needed to remove the variant, soKSatisfiabilitykeepsKValuewith a runtime width check.Migration
KSatisfiability<KN>: useSatisfiabilityinstead; it has the same JSON shape.KSatisfiability::<K3>::newwith repeated literals, e.g.[a, b]→[a, b, b].pred create KSATnow creates K3.pred-validation-corpus: the 100 instances underinstances/KSatisfiability-KNneed to move toSatisfiability. I'll do that in a follow-up corpus commit.Verification
cargo test --lib --all-features: 6321 passed (at 3c2f9bd)cargo test -p problemreductions-cli --all-features: all suites passedcargo test --test main: 80 passedcargo clippy --workspace --all-features --all-targets: 0 warningsmake paper: builds with full rule coverageBase:
feat/exact-tight-bounds(#1224).🤖 Generated with Claude Code