Skip to content

feat(FineGrained): Schöning's random walk for k-SAT (#894) - #908

Merged
SamuelSchlesinger merged 2 commits into
mainfrom
feat/schoening-walk-894
Oct 25, 2026
Merged

SamuelSchlesinger merged 2 commits into
mainfrom
feat/schoening-walk-894

Conversation

@SamuelSchlesinger

@SamuelSchlesinger SamuelSchlesinger commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Milestone M1 of #894: the random-walk analysis of Schöning's algorithm for k-SAT, following the M0 design in #894 (comment). The first commit covers k = 3. The second commit, made before any review began, generalizes the analysis to all k ≥ 3.

What is proved. FineGrained/Schoening.lean defines Schöning's local search and one trial:

  • walk φ t σ: stop if σ satisfies φ; otherwise flip the variable of a uniformly chosen literal occurrence of the first unsatisfied clause.
  • trial φ: a uniform start, then 3n steps.

The main results:

  • trial_success_of_length_le: for k ≥ 3 and a satisfiable CNF on n variables whose clauses have at most k literals, one trial succeeds with probability at least ((k−1)/k)^{k−3} · (k/(2(k−1)))ⁿ / (3n + 1).
  • trial_success: the k = 3 case, (3/4)ⁿ / (3n + 1).

Proof structure (each step is a named theorem):

  1. hit_le_succeedProb: the walk dominates the biased walk hit k, which steps down with probability 1/k. The proof is by induction on the step budget and uses hit_succ_le (antitone in the distance). It needs only one literal of the chosen clause to move toward a fixed satisfying assignment, so no coupling argument is required.
  2. choose_mul_le_hit: path counting.
  3. pow_le_choose_mul: k^{ki} ≤ C(ki, i)·(k−1)^{ki−i}·(ki+1), the middle-weight bound for ((k−1)+1)^{ki}.
  4. inv_le_hit: hit k (3d) d ≥ ((k−1)/k)^{k−3}·(k−1)^{−d}/(3d+1). Write d = (k−2)i + e with e < k − 2. The paths with i up-steps and i + d down-steps have length ki + e ≤ 3d.
  5. sum_pow_hammingDist: averaging q^{dist} over a uniform start gives (1 + q)ⁿ.

Faithfulness and scope.

  • Schöning (FOCS 1999) states the bound (k/(2(k−1)))ⁿ up to a polynomial factor. The factors ((k−1)/k)^{k−3} and 1/(3n+1) are explicit constants of this PR, not from the paper.
  • The analysis allows any choice of unsatisfied clause (the code takes the first) and allows duplicate literals.
  • Still open on Frontier track: exponential-time SAT algorithms (Schöning, PPSZ) #894: amplification over (2−2/k)ⁿ·poly(n) trials, a running-time statement in a fixed model (an M2 decision for Samuel), and PPSZ.

Abstracts. No impact. No selected abstract depends on this module. A headline is planned for M2.

Validation at e55fab79:

  • scripts/check.sh: all six strict gates pass.
  • scripts/check_hygiene.py passes.
  • ComplexityTests/Schoening.lean covers:
    • a concrete satisfiable 3-CNF and a 4-CNF (k = 4) on which the bounds apply;
    • a satisfying start, which succeeds with probability 1;
    • an exact value of hit 3 3 1;
    • the middle-weight bound;
    • axiom guards.

Also adds the Schoening1999 bibliography entry.

AI assistance: written by Jetski (worker-jetski-17d3679e). No human or independent review yet.

@SamuelSchlesinger SamuelSchlesinger changed the title feat(FineGrained): Schöning's random walk for 3-SAT (#894) feat(FineGrained): Schöning's random walk for k-SAT (#894) Oct 25, 2026
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Review claimed by reviewer-claude-c4b0c164-01 (agent review) at e55fab7.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

reviewer-claude-c4b0c164-01 — APPROVED at e55fab7

Agent review, not human approval. Hosted ci-checks is green at this head.

Algorithm against Schöning (FOCS 1999). The algorithm matches Schöning's:

  • a uniform start;
  • then 3n steps, each flipping the variable of a uniformly chosen literal of an unsatisfied clause, and stopping as soon as the formula is satisfied.

Proof.

  • Domination (hit_le_succeedProb). It needs only two facts. A literal flip changes the Hamming distance to σ⋆ by exactly one. At least one occurrence among the ≤ k literals of the chosen clause moves toward σ⋆, so the step moves toward σ⋆ with probability at least 1/k. Together with hit being antitone in the distance, this gives the domination; no coupling is needed.
  • Recursion for hit. It is correct: from d + 1, a down-step goes to d with probability 1/k and an up-step to d + 2 with probability (k−1)/k. The test value hit 3 3 1 = 1/3 + (2/3)(1/9) is right.
  • Bound. trial_success_of_length_le gives ((k−1)/k)^{k−3}·(k/(2(k−1)))ⁿ/(3n+1) for k ≥ 3, clause lengths ≤ k (duplicates allowed) and a satisfiable φ. That is Schöning's (k/(2(k−1)))ⁿ up to an explicit polynomial factor, as the docs say. The k = 3 case (3/4)ⁿ/(3n+1) follows.
  • Time model. No running-time or amplification claim is made. The docs leave both open on Frontier track: exponential-time SAT algorithms (Schöning, PPSZ) #894.

Tests, scope and hygiene. The tests are concrete:

  • a 3-CNF instance and a 4-CNF instance of the bound;
  • a direct hit value;
  • the binomial middle-term bound;
  • axiom guards.

Scope is only the claimed files, ROADMAP and bib (FOCS 1999, pp. 410–414, doi 10.1109/SFFCS.1999.814612). Hygiene is clean.

Nonblocking:

  1. Several lemmas are general combinatorics and would be reusable from Foundations rather than FineGrained/Schoening:
    • sum_pow_hammingDist (∑_σ q^{d(σ, τ)} = (1 + q)^n), next to Mathlib's hammingDist API;
    • hammingDist_flip;
    • pow_le_choose_mul, the middle binomial term.
  2. The module doc's "about (2 − 2/k)^n independent trials find a satisfying assignment with high probability" describes M2, which is not proved yet. Mark it as the planned consequence, or cite where it will be proved.

…bability (3/4)^n/(3n+1) (#894)

Define Schöning's local search and one trial, compare the walk with a
biased random walk on Hamming distances by induction on the step
budget, count paths, bound the middle binomial weight, and average over
the uniform start.

AI-assisted: Jetski (worker-jetski-17d3679e).
Generalize the biased walk to down-probability 1/k, the middle-weight
bound to ((k-1)+1)^{ki}, and the hitting bound to any distance d via
d = (k-2) i + e, giving one-trial success probability at least
((k-1)/k)^(k-3) (k/(2(k-1)))^n / (3n+1) for k-CNF; the 3-SAT bound
is the case k = 3.

AI-assisted: Jetski (worker-jetski-17d3679e).
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Restack (coordinator-claude-c4b0c164-20261023, validated coordinator fix). Rebased e55fab79 onto main after #916, and resolved only the mechanical conflicts:

The payload is otherwise identical to the approved head, checked by diff hash excluding those files, and lake exe mk_all --check passes. reviewer-claude-c4b0c164-01's approval of the mathematics carries over. coordinator-claude-c4b0c164-20261023 — APPROVED at 495d1d77b4a99adde008ccbdca0a803122dc5e35. I'll enqueue on green.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 25, 2026
Merged via the queue into main with commit f403097 Oct 25, 2026
2 checks passed
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 31, 2026
…RAM (cslib-community#894 M2) (cslib-community#1922)

One trial of Schöning's k-SAT algorithm as a randomized word-RAM program whose
final assignment has exactly the law of `Schoening.trial` (cslib-community#908), with an
explicit instruction bound and `4 n` rand calls; the amplified algorithm with
failure probability exactly `(1 - p) ^ R` and at most `e ^ (-c)` for
`schoeningTrials k n c` trials on satisfiable k-CNFs; and the generic
`ExecRandLaw` rules for exact laws of structured randomized programs.


Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 31, 2026
…tion on the trial count (cslib-community#894 M2) (cslib-community#1935)

* feat(WordRAM/Schoening): Schöning's algorithm on the randomized word RAM (cslib-community#894 M2)

One trial of Schöning's k-SAT algorithm as a randomized word-RAM program whose
final assignment has exactly the law of `Schoening.trial` (cslib-community#908), with an
explicit instruction bound and `4 n` rand calls; the amplified algorithm with
failure probability exactly `(1 - p) ^ R` and at most `e ^ (-c)` for
`schoeningTrials k n c` trials on satisfiable k-CNFs; and the generic
`ExecRandLaw` rules for exact laws of structured randomized programs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): multiword trial counter, no word-size assumption on R (cslib-community#894 M2)

The amplified Schöning program now computes the trial count
`schoeningTrials k n c` itself, on the input `k :: c :: encode φ`, in a
multiword counter in memory (one binary digit per word), and the amplified
theorems need only `L + 6n + 4k + 2c + counterLen k n c + 2 < 2^w`, a
logarithmic word size, instead of `R < 2^w`.

- `Counter.lean`: multiply-add, floor division and decrement on a memory
  digit array, specified against functions on digit lists; amortized
  decrement cost (`decSteps_add_count_le`).
- `TrialCount.lean`: the digits computed by the setup have value
  `schoeningTrials k n c`, with at most `counterLen k n c` digits.
- `Trial.lean`: `Frame` records that a trial never writes after the
  assignment, where the counter lives.
- `Amplify.lean`: setup, counted loops, trial loop with the counter, and
  `ampProgram_spec` / `ampProgram_failure_le_exp` without `R < 2^w`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): asymptotic time bound for the amplified algorithm

`ampTime_le`: `ampTime k n c L ≤ 900 (n + k + L + 1)^3 (2(k-1)/k)^n (c + 1)`,
from `schoeningTrials_le` (the trial count is at most
`(9n + 4)(2(k-1)/k)^n c`, using `(k/(k-1))^(k-3) ≤ 3`) and
`counterLen_le`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): note the trial frame's guarantee on memory after the assignment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): keep n and k in the word-size summary

The input length L does not bound n or k: a formula without clauses has
L = 3 for every n. State the word size as O(log(n + k + L + c)), and
O(log(L + c)) only for fixed k and n = O(L).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 31, 2026
cslib-community#1949)

* feat(WordRAM/Schoening): Schöning's algorithm on the randomized word RAM (cslib-community#894 M2)

One trial of Schöning's k-SAT algorithm as a randomized word-RAM program whose
final assignment has exactly the law of `Schoening.trial` (cslib-community#908), with an
explicit instruction bound and `4 n` rand calls; the amplified algorithm with
failure probability exactly `(1 - p) ^ R` and at most `e ^ (-c)` for
`schoeningTrials k n c` trials on satisfiable k-CNFs; and the generic
`ExecRandLaw` rules for exact laws of structured randomized programs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): multiword trial counter, no word-size assumption on R (cslib-community#894 M2)

The amplified Schöning program now computes the trial count
`schoeningTrials k n c` itself, on the input `k :: c :: encode φ`, in a
multiword counter in memory (one binary digit per word), and the amplified
theorems need only `L + 6n + 4k + 2c + counterLen k n c + 2 < 2^w`, a
logarithmic word size, instead of `R < 2^w`.

- `Counter.lean`: multiply-add, floor division and decrement on a memory
  digit array, specified against functions on digit lists; amortized
  decrement cost (`decSteps_add_count_le`).
- `TrialCount.lean`: the digits computed by the setup have value
  `schoeningTrials k n c`, with at most `counterLen k n c` digits.
- `Trial.lean`: `Frame` records that a trial never writes after the
  assignment, where the counter lives.
- `Amplify.lean`: setup, counted loops, trial loop with the counter, and
  `ampProgram_spec` / `ampProgram_failure_le_exp` without `R < 2^w`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): asymptotic time bound for the amplified algorithm

`ampTime_le`: `ampTime k n c L ≤ 900 (n + k + L + 1)^3 (2(k-1)/k)^n (c + 1)`,
from `schoeningTrials_le` (the trial count is at most
`(9n + 4)(2(k-1)/k)^n c`, using `(k/(k-1))^(k-3) ≤ 3`) and
`counterLen_le`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): note the trial frame's guarantee on memory after the assignment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): keep n and k in the word-size summary

The input length L does not bound n or k: a formula without clauses has
L = 3 for every n. State the word size as O(log(n + k + L + c)), and
O(log(L + c)) only for fixed k and n = O(L).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(PPZ): lazy-order rounds and the forced-value scan on the word RAM (cslib-community#894 M2)

Two building blocks for one PPZ round on the randomized word RAM.

FineGrained/PPZ/LazyOrder: roundOn O g τ processes g 0, ..., g (m - 1)
in a uniformly random order. roundOn_succ gives its Fisher-Yates form:
choose p uniformly, process g p, then recurse on g with positions 0 and
p swapped, from position 1 on (Equiv.Perm.decomposeFin).
roundWith_eq_roundOn identifies PPZ and PPSZ rounds with roundOn on all
variables, so a RAM round can sample its order lazily.

Algorithms/WordRAM/PPZ/Forced: forcedCode stores the word of
PPZ.forced φ τ x, with τ stored as words 0/1/2, by at most two clause
scans (polarity true, then false), within 28 E + 15 instructions and
without changing memory (forcedCode_spec).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/PPZ): state the forced-value bound as 28 E + 15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 31, 2026
…exact law (cslib-community#1954)

* feat(WordRAM/Schoening): Schöning's algorithm on the randomized word RAM (cslib-community#894 M2)

One trial of Schöning's k-SAT algorithm as a randomized word-RAM program whose
final assignment has exactly the law of `Schoening.trial` (cslib-community#908), with an
explicit instruction bound and `4 n` rand calls; the amplified algorithm with
failure probability exactly `(1 - p) ^ R` and at most `e ^ (-c)` for
`schoeningTrials k n c` trials on satisfiable k-CNFs; and the generic
`ExecRandLaw` rules for exact laws of structured randomized programs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): multiword trial counter, no word-size assumption on R (cslib-community#894 M2)

The amplified Schöning program now computes the trial count
`schoeningTrials k n c` itself, on the input `k :: c :: encode φ`, in a
multiword counter in memory (one binary digit per word), and the amplified
theorems need only `L + 6n + 4k + 2c + counterLen k n c + 2 < 2^w`, a
logarithmic word size, instead of `R < 2^w`.

- `Counter.lean`: multiply-add, floor division and decrement on a memory
  digit array, specified against functions on digit lists; amortized
  decrement cost (`decSteps_add_count_le`).
- `TrialCount.lean`: the digits computed by the setup have value
  `schoeningTrials k n c`, with at most `counterLen k n c` digits.
- `Trial.lean`: `Frame` records that a trial never writes after the
  assignment, where the counter lives.
- `Amplify.lean`: setup, counted loops, trial loop with the counter, and
  `ampProgram_spec` / `ampProgram_failure_le_exp` without `R < 2^w`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): asymptotic time bound for the amplified algorithm

`ampTime_le`: `ampTime k n c L ≤ 900 (n + k + L + 1)^3 (2(k-1)/k)^n (c + 1)`,
from `schoeningTrials_le` (the trial count is at most
`(9n + 4)(2(k-1)/k)^n c`, using `(k/(k-1))^(k-3) ≤ 3`) and
`counterLen_le`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): note the trial frame's guarantee on memory after the assignment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): keep n and k in the word-size summary

The input length L does not bound n or k: a formula without clauses has
L = 3 for every n. State the word size as O(log(n + k + L + c)), and
O(log(L + c)) only for fixed k and n = O(L).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(PPZ): lazy-order rounds and the forced-value scan on the word RAM (cslib-community#894 M2)

Two building blocks for one PPZ round on the randomized word RAM.

FineGrained/PPZ/LazyOrder: roundOn O g τ processes g 0, ..., g (m - 1)
in a uniformly random order. roundOn_succ gives its Fisher-Yates form:
choose p uniformly, process g p, then recurse on g with positions 0 and
p swapped, from position 1 on (Equiv.Perm.decomposeFin).
roundWith_eq_roundOn identifies PPZ and PPSZ rounds with roundOn on all
variables, so a RAM round can sample its order lazily.

Algorithms/WordRAM/PPZ/Forced: forcedCode stores the word of
PPZ.forced φ τ x, with τ stored as words 0/1/2, by at most two clause
scans (polarity true, then false), within 28 E + 15 instructions and
without changing memory (forcedCode_spec).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/PPZ): state the forced-value bound as 28 E + 15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPZ): one PPZ round on the randomized word RAM with its exact law (cslib-community#894 M2)

The round keeps the unprocessed variables in an array and, at step i,
swaps a uniformly drawn P[j], j in [i, n), into position i, then sets
that variable to its forced value (forcedCode) or a uniform bit. Each
iteration matches roundOn_succ, so the loop has the law of roundOn and
the whole round the law of PPZ.round. The final satisfaction check
reuses Schoening's scan, renamed into the 32-register file.

roundProgram_spec: halting within n (28 L + 40) + 12 L + 19 instructions,
at most 2 n rand calls, a correct satisfaction output, and the exact law
PPZ.round phi of the partial assignment left in memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 31, 2026
…b-community#1960)

* feat(WordRAM/Schoening): Schöning's algorithm on the randomized word RAM (cslib-community#894 M2)

One trial of Schöning's k-SAT algorithm as a randomized word-RAM program whose
final assignment has exactly the law of `Schoening.trial` (cslib-community#908), with an
explicit instruction bound and `4 n` rand calls; the amplified algorithm with
failure probability exactly `(1 - p) ^ R` and at most `e ^ (-c)` for
`schoeningTrials k n c` trials on satisfiable k-CNFs; and the generic
`ExecRandLaw` rules for exact laws of structured randomized programs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): multiword trial counter, no word-size assumption on R (cslib-community#894 M2)

The amplified Schöning program now computes the trial count
`schoeningTrials k n c` itself, on the input `k :: c :: encode φ`, in a
multiword counter in memory (one binary digit per word), and the amplified
theorems need only `L + 6n + 4k + 2c + counterLen k n c + 2 < 2^w`, a
logarithmic word size, instead of `R < 2^w`.

- `Counter.lean`: multiply-add, floor division and decrement on a memory
  digit array, specified against functions on digit lists; amortized
  decrement cost (`decSteps_add_count_le`).
- `TrialCount.lean`: the digits computed by the setup have value
  `schoeningTrials k n c`, with at most `counterLen k n c` digits.
- `Trial.lean`: `Frame` records that a trial never writes after the
  assignment, where the counter lives.
- `Amplify.lean`: setup, counted loops, trial loop with the counter, and
  `ampProgram_spec` / `ampProgram_failure_le_exp` without `R < 2^w`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): asymptotic time bound for the amplified algorithm

`ampTime_le`: `ampTime k n c L ≤ 900 (n + k + L + 1)^3 (2(k-1)/k)^n (c + 1)`,
from `schoeningTrials_le` (the trial count is at most
`(9n + 4)(2(k-1)/k)^n c`, using `(k/(k-1))^(k-3) ≤ 3`) and
`counterLen_le`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): note the trial frame's guarantee on memory after the assignment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): keep n and k in the word-size summary

The input length L does not bound n or k: a formula without clauses has
L = 3 for every n. State the word size as O(log(n + k + L + c)), and
O(log(L + c)) only for fixed k and n = O(L).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(PPZ): lazy-order rounds and the forced-value scan on the word RAM (cslib-community#894 M2)

Two building blocks for one PPZ round on the randomized word RAM.

FineGrained/PPZ/LazyOrder: roundOn O g τ processes g 0, ..., g (m - 1)
in a uniformly random order. roundOn_succ gives its Fisher-Yates form:
choose p uniformly, process g p, then recurse on g with positions 0 and
p swapped, from position 1 on (Equiv.Perm.decomposeFin).
roundWith_eq_roundOn identifies PPZ and PPSZ rounds with roundOn on all
variables, so a RAM round can sample its order lazily.

Algorithms/WordRAM/PPZ/Forced: forcedCode stores the word of
PPZ.forced φ τ x, with τ stored as words 0/1/2, by at most two clause
scans (polarity true, then false), within 28 E + 15 instructions and
without changing memory (forcedCode_spec).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/PPZ): state the forced-value bound as 28 E + 15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPZ): one PPZ round on the randomized word RAM with its exact law (cslib-community#894 M2)

The round keeps the unprocessed variables in an array and, at step i,
swaps a uniformly drawn P[j], j in [i, n), into position i, then sets
that variable to its forced value (forcedCode) or a uniform bit. Each
iteration matches roundOn_succ, so the loop has the law of roundOn and
the whole round the law of PPZ.round. The final satisfaction check
reuses Schoening's scan, renamed into the 32-register file.

roundProgram_spec: halting within n (28 L + 40) + 12 L + 19 instructions,
at most 2 n rand calls, a correct satisfaction output, and the exact law
PPZ.round phi of the partial assignment left in memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPZ): the PPZ algorithm on the randomized word RAM (cslib-community#894 M2)

On the input k :: c :: encode phi, ampProgram computes R = 2^ceil((k-1)n/k) * c
in a multiword counter (zero digits, a one, then Schoening's mulAdd by c,
renamed into the PPZ register file) and runs up to R rounds of cslib-community#1954's
roundCore, stopping at the first satisfying assignment.

ampProgram_spec: halting within ampTime, at most 2 n R rand calls, no
false positives, and the exact output law repeatRound phi R.
ampProgram_failure_le_exp: failure at most e^(-c) on satisfiable k-CNFs,
from the merged round_success_of_satisfiable. ampTime_le: time at most
200 (n + L + 1)^2 2^((1 - 1/k) n) (c + 1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 31, 2026
…ommunity#1980)

* feat(WordRAM/Schoening): Schöning's algorithm on the randomized word RAM (cslib-community#894 M2)

One trial of Schöning's k-SAT algorithm as a randomized word-RAM program whose
final assignment has exactly the law of `Schoening.trial` (cslib-community#908), with an
explicit instruction bound and `4 n` rand calls; the amplified algorithm with
failure probability exactly `(1 - p) ^ R` and at most `e ^ (-c)` for
`schoeningTrials k n c` trials on satisfiable k-CNFs; and the generic
`ExecRandLaw` rules for exact laws of structured randomized programs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): multiword trial counter, no word-size assumption on R (cslib-community#894 M2)

The amplified Schöning program now computes the trial count
`schoeningTrials k n c` itself, on the input `k :: c :: encode φ`, in a
multiword counter in memory (one binary digit per word), and the amplified
theorems need only `L + 6n + 4k + 2c + counterLen k n c + 2 < 2^w`, a
logarithmic word size, instead of `R < 2^w`.

- `Counter.lean`: multiply-add, floor division and decrement on a memory
  digit array, specified against functions on digit lists; amortized
  decrement cost (`decSteps_add_count_le`).
- `TrialCount.lean`: the digits computed by the setup have value
  `schoeningTrials k n c`, with at most `counterLen k n c` digits.
- `Trial.lean`: `Frame` records that a trial never writes after the
  assignment, where the counter lives.
- `Amplify.lean`: setup, counted loops, trial loop with the counter, and
  `ampProgram_spec` / `ampProgram_failure_le_exp` without `R < 2^w`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): asymptotic time bound for the amplified algorithm

`ampTime_le`: `ampTime k n c L ≤ 900 (n + k + L + 1)^3 (2(k-1)/k)^n (c + 1)`,
from `schoeningTrials_le` (the trial count is at most
`(9n + 4)(2(k-1)/k)^n c`, using `(k/(k-1))^(k-3) ≤ 3`) and
`counterLen_le`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): note the trial frame's guarantee on memory after the assignment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): keep n and k in the word-size summary

The input length L does not bound n or k: a formula without clauses has
L = 3 for every n. State the word size as O(log(n + k + L + c)), and
O(log(L + c)) only for fixed k and n = O(L).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(PPZ): lazy-order rounds and the forced-value scan on the word RAM (cslib-community#894 M2)

Two building blocks for one PPZ round on the randomized word RAM.

FineGrained/PPZ/LazyOrder: roundOn O g τ processes g 0, ..., g (m - 1)
in a uniformly random order. roundOn_succ gives its Fisher-Yates form:
choose p uniformly, process g p, then recurse on g with positions 0 and
p swapped, from position 1 on (Equiv.Perm.decomposeFin).
roundWith_eq_roundOn identifies PPZ and PPSZ rounds with roundOn on all
variables, so a RAM round can sample its order lazily.

Algorithms/WordRAM/PPZ/Forced: forcedCode stores the word of
PPZ.forced φ τ x, with τ stored as words 0/1/2, by at most two clause
scans (polarity true, then false), within 28 E + 15 instructions and
without changing memory (forcedCode_spec).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/PPZ): state the forced-value bound as 28 E + 15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPZ): one PPZ round on the randomized word RAM with its exact law (cslib-community#894 M2)

The round keeps the unprocessed variables in an array and, at step i,
swaps a uniformly drawn P[j], j in [i, n), into position i, then sets
that variable to its forced value (forcedCode) or a uniform bit. Each
iteration matches roundOn_succ, so the loop has the law of roundOn and
the whole round the law of PPZ.round. The final satisfaction check
reuses Schoening's scan, renamed into the 32-register file.

roundProgram_spec: halting within n (28 L + 40) + 12 L + 19 instructions,
at most 2 n rand calls, a correct satisfaction output, and the exact law
PPZ.round phi of the partial assignment left in memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPZ): the PPZ algorithm on the randomized word RAM (cslib-community#894 M2)

On the input k :: c :: encode phi, ampProgram computes R = 2^ceil((k-1)n/k) * c
in a multiword counter (zero digits, a one, then Schoening's mulAdd by c,
renamed into the PPZ register file) and runs up to R rounds of cslib-community#1954's
roundCore, stopping at the first satisfying assignment.

ampProgram_spec: halting within ampTime, at most 2 n R rand calls, no
false positives, and the exact output law repeatRound phi R.
ampProgram_failure_le_exp: failure at most e^(-c) on satisfiable k-CNFs,
from the merged round_success_of_satisfiable. ampTime_le: time at most
200 (n + L + 1)^2 2^((1 - 1/k) n) (c + 1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPSZ): w-implication on the randomized word RAM (cslib-community#894 M2)

PPSZ's oracle `PPSZ.implied` as a word-RAM program with an exact contract.

- `PPSZ.wImplied_iff_test`: w-implication is a finite search over
  sections: `τ x = some b`, or some choice of `w` clauses has no compatible
  choice of one literal per clause under `τ[x ↦ !b]`.
- `nextSection_sections`: the odometer step enumerates `List.sections`.
- `impliedCode_spec`: on the stored clauses and partial assignment, the
  program stores `optCode (implied φ s τ x)`, leaves memory unchanged
  (its 2 s scratch words are cleared), within `impliedTime s E ≤
  140 (s + 1)^2 (E + 1)^(2 s)` instructions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 31, 2026
…s exact law (cslib-community#1986)

* feat(WordRAM/Schoening): Schöning's algorithm on the randomized word RAM (cslib-community#894 M2)

One trial of Schöning's k-SAT algorithm as a randomized word-RAM program whose
final assignment has exactly the law of `Schoening.trial` (cslib-community#908), with an
explicit instruction bound and `4 n` rand calls; the amplified algorithm with
failure probability exactly `(1 - p) ^ R` and at most `e ^ (-c)` for
`schoeningTrials k n c` trials on satisfiable k-CNFs; and the generic
`ExecRandLaw` rules for exact laws of structured randomized programs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): multiword trial counter, no word-size assumption on R (cslib-community#894 M2)

The amplified Schöning program now computes the trial count
`schoeningTrials k n c` itself, on the input `k :: c :: encode φ`, in a
multiword counter in memory (one binary digit per word), and the amplified
theorems need only `L + 6n + 4k + 2c + counterLen k n c + 2 < 2^w`, a
logarithmic word size, instead of `R < 2^w`.

- `Counter.lean`: multiply-add, floor division and decrement on a memory
  digit array, specified against functions on digit lists; amortized
  decrement cost (`decSteps_add_count_le`).
- `TrialCount.lean`: the digits computed by the setup have value
  `schoeningTrials k n c`, with at most `counterLen k n c` digits.
- `Trial.lean`: `Frame` records that a trial never writes after the
  assignment, where the counter lives.
- `Amplify.lean`: setup, counted loops, trial loop with the counter, and
  `ampProgram_spec` / `ampProgram_failure_le_exp` without `R < 2^w`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): asymptotic time bound for the amplified algorithm

`ampTime_le`: `ampTime k n c L ≤ 900 (n + k + L + 1)^3 (2(k-1)/k)^n (c + 1)`,
from `schoeningTrials_le` (the trial count is at most
`(9n + 4)(2(k-1)/k)^n c`, using `(k/(k-1))^(k-3) ≤ 3`) and
`counterLen_le`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): note the trial frame's guarantee on memory after the assignment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): keep n and k in the word-size summary

The input length L does not bound n or k: a formula without clauses has
L = 3 for every n. State the word size as O(log(n + k + L + c)), and
O(log(L + c)) only for fixed k and n = O(L).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(PPZ): lazy-order rounds and the forced-value scan on the word RAM (cslib-community#894 M2)

Two building blocks for one PPZ round on the randomized word RAM.

FineGrained/PPZ/LazyOrder: roundOn O g τ processes g 0, ..., g (m - 1)
in a uniformly random order. roundOn_succ gives its Fisher-Yates form:
choose p uniformly, process g p, then recurse on g with positions 0 and
p swapped, from position 1 on (Equiv.Perm.decomposeFin).
roundWith_eq_roundOn identifies PPZ and PPSZ rounds with roundOn on all
variables, so a RAM round can sample its order lazily.

Algorithms/WordRAM/PPZ/Forced: forcedCode stores the word of
PPZ.forced φ τ x, with τ stored as words 0/1/2, by at most two clause
scans (polarity true, then false), within 28 E + 15 instructions and
without changing memory (forcedCode_spec).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/PPZ): state the forced-value bound as 28 E + 15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPZ): one PPZ round on the randomized word RAM with its exact law (cslib-community#894 M2)

The round keeps the unprocessed variables in an array and, at step i,
swaps a uniformly drawn P[j], j in [i, n), into position i, then sets
that variable to its forced value (forcedCode) or a uniform bit. Each
iteration matches roundOn_succ, so the loop has the law of roundOn and
the whole round the law of PPZ.round. The final satisfaction check
reuses Schoening's scan, renamed into the 32-register file.

roundProgram_spec: halting within n (28 L + 40) + 12 L + 19 instructions,
at most 2 n rand calls, a correct satisfaction output, and the exact law
PPZ.round phi of the partial assignment left in memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPZ): the PPZ algorithm on the randomized word RAM (cslib-community#894 M2)

On the input k :: c :: encode phi, ampProgram computes R = 2^ceil((k-1)n/k) * c
in a multiword counter (zero digits, a one, then Schoening's mulAdd by c,
renamed into the PPZ register file) and runs up to R rounds of cslib-community#1954's
roundCore, stopping at the first satisfying assignment.

ampProgram_spec: halting within ampTime, at most 2 n R rand calls, no
false positives, and the exact output law repeatRound phi R.
ampProgram_failure_le_exp: failure at most e^(-c) on satisfiable k-CNFs,
from the merged round_success_of_satisfiable. ampTime_le: time at most
200 (n + L + 1)^2 2^((1 - 1/k) n) (c + 1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPSZ): w-implication on the randomized word RAM (cslib-community#894 M2)

PPSZ's oracle `PPSZ.implied` as a word-RAM program with an exact contract.

- `PPSZ.wImplied_iff_test`: w-implication is a finite search over
  sections: `τ x = some b`, or some choice of `w` clauses has no compatible
  choice of one literal per clause under `τ[x ↦ !b]`.
- `nextSection_sections`: the odometer step enumerates `List.sections`.
- `impliedCode_spec`: on the stored clauses and partial assignment, the
  program stores `optCode (implied φ s τ x)`, leaves memory unchanged
  (its 2 s scratch words are cleared), within `impliedTime s E ≤
  140 (s + 1)^2 (E + 1)^(2 s)` instructions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPSZ): one PPSZ round on the randomized word RAM with its exact law (cslib-community#894 M2)

Make the PPZ round loop generic in its oracle code (`IsOracleCode`,
`roundBodyWith`/`roundLoopWith`/`roundCoreWith` and their laws), keeping
the PPZ names and statements as instances at `forcedCode`. Use it with
`impliedCode` for one PPSZ round on the input `s :: encode φ`, whose output
law is exactly `PPSZ.round φ s` (`PPSZ.roundProgram_spec`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 31, 2026
…lib-community#1990)

* feat(WordRAM/Schoening): Schöning's algorithm on the randomized word RAM (cslib-community#894 M2)

One trial of Schöning's k-SAT algorithm as a randomized word-RAM program whose
final assignment has exactly the law of `Schoening.trial` (cslib-community#908), with an
explicit instruction bound and `4 n` rand calls; the amplified algorithm with
failure probability exactly `(1 - p) ^ R` and at most `e ^ (-c)` for
`schoeningTrials k n c` trials on satisfiable k-CNFs; and the generic
`ExecRandLaw` rules for exact laws of structured randomized programs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): multiword trial counter, no word-size assumption on R (cslib-community#894 M2)

The amplified Schöning program now computes the trial count
`schoeningTrials k n c` itself, on the input `k :: c :: encode φ`, in a
multiword counter in memory (one binary digit per word), and the amplified
theorems need only `L + 6n + 4k + 2c + counterLen k n c + 2 < 2^w`, a
logarithmic word size, instead of `R < 2^w`.

- `Counter.lean`: multiply-add, floor division and decrement on a memory
  digit array, specified against functions on digit lists; amortized
  decrement cost (`decSteps_add_count_le`).
- `TrialCount.lean`: the digits computed by the setup have value
  `schoeningTrials k n c`, with at most `counterLen k n c` digits.
- `Trial.lean`: `Frame` records that a trial never writes after the
  assignment, where the counter lives.
- `Amplify.lean`: setup, counted loops, trial loop with the counter, and
  `ampProgram_spec` / `ampProgram_failure_le_exp` without `R < 2^w`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): asymptotic time bound for the amplified algorithm

`ampTime_le`: `ampTime k n c L ≤ 900 (n + k + L + 1)^3 (2(k-1)/k)^n (c + 1)`,
from `schoeningTrials_le` (the trial count is at most
`(9n + 4)(2(k-1)/k)^n c`, using `(k/(k-1))^(k-3) ≤ 3`) and
`counterLen_le`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): note the trial frame's guarantee on memory after the assignment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): keep n and k in the word-size summary

The input length L does not bound n or k: a formula without clauses has
L = 3 for every n. State the word size as O(log(n + k + L + c)), and
O(log(L + c)) only for fixed k and n = O(L).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(PPZ): lazy-order rounds and the forced-value scan on the word RAM (cslib-community#894 M2)

Two building blocks for one PPZ round on the randomized word RAM.

FineGrained/PPZ/LazyOrder: roundOn O g τ processes g 0, ..., g (m - 1)
in a uniformly random order. roundOn_succ gives its Fisher-Yates form:
choose p uniformly, process g p, then recurse on g with positions 0 and
p swapped, from position 1 on (Equiv.Perm.decomposeFin).
roundWith_eq_roundOn identifies PPZ and PPSZ rounds with roundOn on all
variables, so a RAM round can sample its order lazily.

Algorithms/WordRAM/PPZ/Forced: forcedCode stores the word of
PPZ.forced φ τ x, with τ stored as words 0/1/2, by at most two clause
scans (polarity true, then false), within 28 E + 15 instructions and
without changing memory (forcedCode_spec).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/PPZ): state the forced-value bound as 28 E + 15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPZ): one PPZ round on the randomized word RAM with its exact law (cslib-community#894 M2)

The round keeps the unprocessed variables in an array and, at step i,
swaps a uniformly drawn P[j], j in [i, n), into position i, then sets
that variable to its forced value (forcedCode) or a uniform bit. Each
iteration matches roundOn_succ, so the loop has the law of roundOn and
the whole round the law of PPZ.round. The final satisfaction check
reuses Schoening's scan, renamed into the 32-register file.

roundProgram_spec: halting within n (28 L + 40) + 12 L + 19 instructions,
at most 2 n rand calls, a correct satisfaction output, and the exact law
PPZ.round phi of the partial assignment left in memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPZ): the PPZ algorithm on the randomized word RAM (cslib-community#894 M2)

On the input k :: c :: encode phi, ampProgram computes R = 2^ceil((k-1)n/k) * c
in a multiword counter (zero digits, a one, then Schoening's mulAdd by c,
renamed into the PPZ register file) and runs up to R rounds of cslib-community#1954's
roundCore, stopping at the first satisfying assignment.

ampProgram_spec: halting within ampTime, at most 2 n R rand calls, no
false positives, and the exact output law repeatRound phi R.
ampProgram_failure_le_exp: failure at most e^(-c) on satisfiable k-CNFs,
from the merged round_success_of_satisfiable. ampTime_le: time at most
200 (n + L + 1)^2 2^((1 - 1/k) n) (c + 1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPSZ): w-implication on the randomized word RAM (cslib-community#894 M2)

PPSZ's oracle `PPSZ.implied` as a word-RAM program with an exact contract.

- `PPSZ.wImplied_iff_test`: w-implication is a finite search over
  sections: `τ x = some b`, or some choice of `w` clauses has no compatible
  choice of one literal per clause under `τ[x ↦ !b]`.
- `nextSection_sections`: the odometer step enumerates `List.sections`.
- `impliedCode_spec`: on the stored clauses and partial assignment, the
  program stores `optCode (implied φ s τ x)`, leaves memory unchanged
  (its 2 s scratch words are cleared), within `impliedTime s E ≤
  140 (s + 1)^2 (E + 1)^(2 s)` instructions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPSZ): one PPSZ round on the randomized word RAM with its exact law (cslib-community#894 M2)

Make the PPZ round loop generic in its oracle code (`IsOracleCode`,
`roundBodyWith`/`roundLoopWith`/`roundCoreWith` and their laws), keeping
the PPZ names and statements as instances at `forcedCode`. Use it with
`impliedCode` for one PPSZ round on the input `s :: encode φ`, whose output
law is exactly `PPSZ.round φ s` (`PPSZ.roundProgram_spec`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPSZ): the PPSZ algorithm on the randomized word RAM (cslib-community#894 M2)

Generalize PPZ's amplified loop and counter setup over the round body
(`IsRoundCore`, `ampLoopWith`, `repeatRoundWith`, `countSetup_spec`), keeping
PPZ's statements. Run up to `2^⌈a n / b⌉ c` rounds of PPSZ on the input
`s :: a :: b :: c :: encode φ`, with the exact law of repeated rounds, no false
positives, failure at most `e^{-c}` when `1 - qbar k h ≤ a / b`, and time
`O((s+1)^2 (n+L)^(2s+1) 2^((a/b) n) (c+1))`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/PPSZ): ε-form of PPSZ's failure bound on the word RAM (cslib-community#894 M2)

Factor the amplification step (`le_ppszRounds_mul`,
`ampProgram_failure_le_exp_of_le`) and add `ampProgram_failure_le_exp_limit`
from `round_success_limit`: for k ≥ 3 and ε > 0 there is a bound `s` with
failure at most `e^{-c}` for every `a / b ≥ 1 - μ_k / (k - 1) + ε`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Nov 1, 2026
…M (candidate) (cslib-community#1945)

* feat(WordRAM/Schoening): Schöning's algorithm on the randomized word RAM (cslib-community#894 M2)

One trial of Schöning's k-SAT algorithm as a randomized word-RAM program whose
final assignment has exactly the law of `Schoening.trial` (cslib-community#908), with an
explicit instruction bound and `4 n` rand calls; the amplified algorithm with
failure probability exactly `(1 - p) ^ R` and at most `e ^ (-c)` for
`schoeningTrials k n c` trials on satisfiable k-CNFs; and the generic
`ExecRandLaw` rules for exact laws of structured randomized programs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): multiword trial counter, no word-size assumption on R (cslib-community#894 M2)

The amplified Schöning program now computes the trial count
`schoeningTrials k n c` itself, on the input `k :: c :: encode φ`, in a
multiword counter in memory (one binary digit per word), and the amplified
theorems need only `L + 6n + 4k + 2c + counterLen k n c + 2 < 2^w`, a
logarithmic word size, instead of `R < 2^w`.

- `Counter.lean`: multiply-add, floor division and decrement on a memory
  digit array, specified against functions on digit lists; amortized
  decrement cost (`decSteps_add_count_le`).
- `TrialCount.lean`: the digits computed by the setup have value
  `schoeningTrials k n c`, with at most `counterLen k n c` digits.
- `Trial.lean`: `Frame` records that a trial never writes after the
  assignment, where the counter lives.
- `Amplify.lean`: setup, counted loops, trial loop with the counter, and
  `ampProgram_spec` / `ampProgram_failure_le_exp` without `R < 2^w`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(WordRAM/Schoening): asymptotic time bound for the amplified algorithm

`ampTime_le`: `ampTime k n c L ≤ 900 (n + k + L + 1)^3 (2(k-1)/k)^n (c + 1)`,
from `schoeningTrials_le` (the trial count is at most
`(9n + 4)(2(k-1)/k)^n c`, using `(k/(k-1))^(k-3) ≤ 3`) and
`counterLen_le`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): note the trial frame's guarantee on memory after the assignment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(WordRAM/Schoening): keep n and k in the word-size summary

The input length L does not bound n or k: a formula without clauses has
L = 3 for every n. State the word size as O(log(n + k + L + c)), and
O(log(L + c)) only for fixed k and n = O(L).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* feat(abstracts): Schöning's 3-SAT algorithm on the randomized word RAM (candidate)

A curated abstract candidate for cslib-community#894 M2. One fixed 24-register program
on the input 3 :: c :: encode φ halts on every path within
⌊900 (n + L + 4)^3 (4/3)^n (c + 1)⌋ steps, makes at most 4 n R rand
calls for R = ⌈(3n + 1)(4/3)^n⌉ c, outputs 1 only with a satisfying
assignment in memory, fails with probability exactly (1 - p)^R for the
success probability p of one restated Schöning trial, and fails on
satisfiable 3-CNFs with probability at most e^(-c).

The abstract restates the randomized word RAM over the standard basis
(truncated subtraction, x / 0 = 0, x % 0 = x), CNF formulas, their word
encoding and Schöning's trial, with no allowlisted project module. The
bridge proves the presentation correspondence for Basis.standard,
identifies the restated trial with Cslib.Complexity.Schoening.trial, and
transports ampProgram_spec, ampProgram_failure_eq and
ampProgram_failure_le_exp at k = 3.

The TeX renderer gains a mapping for ö.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(abstracts): credit Renfei Zhou's presentation bridge, verified Schöning locator

Address review on cslib-community#1945: the bridge's Part 1 and the abstract's model
definitions adapt Renfei Zhou's RandomizedWordRAMBridge and
RandomizedWordRAMAbstract, so both files now credit him. The source note
cites Schöning's Abstract and Section 2 (pp. 410-411), checked against
the paper, and notes that the formalization picks the first falsified
clause. The trial count has O(n + log(c + 1)) bits, not 0.415 n.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

* doc(readme): list the Schöning abstract among the selected results

The README hygiene check (cslib-community#1958) requires every catalogue entry in the root README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant