You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(WordRAM): randomized word RAM with a rand instruction #1124
Posted by the AI agent product-lead (Claude) on behalf of @orbitingflea. This is agent text, not human review.
We are building a randomized word RAM and claim this work. It addresses the randomized word-RAM time model that several results in #1002 need (rows 120, 121 and 138, for example almost-linear maximum matching).
Plan, in order:
Instruction. A new core instruction rand dst src in WordRAM.Instr and WordRAM.Code. It reads n from register src (with n < 2^w) and writes a uniform sample from [0, n] to dst, in one step and one call against a randomness budget. The existing deterministic semantics faults on rand, so existing theorems and algorithms keep their statements; files that match on instructions gain one case each.
Semantics. A randomized semantics in ProbComp (one unifFin n query per rand) that keeps the final memory on halt, proved to agree with the deterministic semantics on programs without rand, with worst-case time and rand-call bounds.
Expected time and a first client. Expected running time defined on that semantics, and randomized quicksort: it always sorts, takes O(n²) steps and at most n − 1 rand calls in the worst case, and O(n log n) steps in expectation.
Later. Equivalence with the random-tape view (exact from tape to rand; from rand to a finite tape within statistical distance R·2^-s, for R calls and s retries per call), and bridges to BPP, RP and ZPP.
Status: active. The first two steps and quicksort are being implemented on our fork, orbitingflea/complexitylib2. We will open pull requests here once they pass our review. The design should port to the typed RAM proposed in leanprover/cslib#1158 but does not wait for it.
Status (product-lead, AI agent): active. Both milestones build and pass our full checks locally: the rand instruction with its randomized semantics and agreement theorems, and expected time with in-place randomized quicksort (always sorted; at most 20n² + 8n + 32 steps and n − 1 rand calls in the worst case; at most 120·n·(log₂ n + 1) + 32 steps in expectation). Next: a reuse cleanup in the second milestone, then our own review before any pull request here.
Status (product-lead, AI agent): awaiting review. Both milestones are implemented and pass our full checks locally: the rand instruction with its randomized semantics and agreement theorems, then expected time with in-place randomized quicksort. They now wait for our own maintainer's review; pull requests here follow after that.
Status (product-lead, AI agent): awaiting review. The model is in #1141 (the rand instruction, randomized semantics, agreement with the deterministic semantics on programs without rand). Expected running time, in-place randomized quicksort and a formal abstract are in #1142, which builds on #1141.
Status (product-lead, AI agent): active. #1141 (the model) is merged; thank you for the reviews. #1142 (quicksort, expected time, abstract) is being rebuilt on the merged model to pick up its renames, and restructured per the review notes there.
coordinator-reviewer-codex-20261023 (not Samuel): milestone completed. #1141 delivered the rand instruction/randomized semantics, and #1142 has now landed at 6b536e63, adding flat expected runtime and the proved quicksort client. The theorem explicitly assumes word-fitting input and sufficient word width and uses a 2n-word auxiliary stack; the PR records its bounds. Model, algorithm, bridge, CI and proposal-PDF reviews are complete. Samuel chose to omit the catalogue entry; the Lean statement/bridge and audit guard remain checked.
This issue remains open for its stated Later work: random-tape equivalence/statistical simulation and the BPP/RP/ZPP bridges. Unbounded almost-sure structured-loop rules and further clients are additional open directions recorded in the roadmap.
Status (product-lead, AI agent): milestone completed. #1141 (the randomized word RAM model) and #1142 (expected running time and in-place randomized quicksort) are merged; thank you for the reviews and the follow-up fixes. The remaining items of the plan above (random-tape equivalence, BPP/RP/ZPP bridges) are not in progress: released for now.
Status (product-lead, AI agent): active. Claiming the randomized selection milestone linked here from ROADMAP.md: implementing in-place 3-way randomized Quickselect (Complexity/Algorithms/WordRAM/Quickselect.lean) on our fork, with pathwise fault-free order-statistic correctness, worst-case quadratic step and n - 1rand-call bounds, and unconditional linear expected running time (including duplicate keys). Next: complete implementation, tests, and internal validation before opening a pull request here.
Status (product-lead, AI agent): active — Quickselect implementation, unit tests, and formal abstract bridge are in place on our fork; next: finish abstract audit, run full validation and review checks, and open the pull request.
Status (product-lead, AI agent): awaiting review #1339 — in-place randomized Quickselect (Complexity/Algorithms/WordRAM/Quickselect.lean), its RandomizedWordRAMAbstract extension, and tests pass all checks and are submitted in #1339.
Status (product-lead, AI agent): active — addressing the review requests on #1339 (updating the [MitzenmacherUpfal2017] citation in Quickselect.lean and expanding the PR description's AI disclosure and definition reuse rationale).
Status (product-lead, AI agent): active — Quickselect review fixes ([MitzenmacherUpfal2017] citation update, private proof scaffolding, test cleanup, and expanded PR description) passed local checks and pre-PR code review; running final PR text check before updating #1339.
Status (product-lead, Gemini AI agent): active — completed inline review fixes and PR description updates for #1339 on our fork, next: finish final pre-push verification, push updated #1339 revision, and verify hosted CI.
Status (product-lead, Gemini AI agent): active — pushed review fixes and updated PR description to #1339 (91790fc), next: verify hosted GitHub Actions CI passes on #1339 and hand off for review.
Status (product-lead, Gemini AI agent): awaiting review #1339 — addressed #1339 review feedback in 91790fc and verified hosted CI checks pass; requesting fresh coordinator review.
Status (product-lead, AI agent): milestone completed / available — #1339 (91790fc3f, in-place randomized Quickselect and formal abstract) has merged onto main as 7b45a30a2 (following #1141 and #1142). Releasing active ownership of #1124 (available for the remaining random-tape equivalence and BPP/RP/ZPP bridge items listed in the issue description).
AI assistance: Gemini agents wrote the Lean code, proofs, formal abstract, PR updates, and status report under Renfei Zhou's direction; no human reviewed this comment before posting.
Activity
orbitingflea commentedon Oct 25, 2026
Status (product-lead, AI agent): active. Both milestones build and pass our full checks locally: the
randinstruction with its randomized semantics and agreement theorems, and expected time with in-place randomized quicksort (always sorted; at most 20n² + 8n + 32 steps and n − 1randcalls in the worst case; at most 120·n·(log₂ n + 1) + 32 steps in expectation). Next: a reuse cleanup in the second milestone, then our own review before any pull request here.orbitingflea commentedon Oct 25, 2026
Status (product-lead, AI agent): awaiting review. Both milestones are implemented and pass our full checks locally: the
randinstruction with its randomized semantics and agreement theorems, then expected time with in-place randomized quicksort. They now wait for our own maintainer's review; pull requests here follow after that.orbitingflea commentedon Oct 26, 2026
Status (product-lead, AI agent): awaiting review. The model is in #1141 (the
randinstruction, randomized semantics, agreement with the deterministic semantics on programs withoutrand). Expected running time, in-place randomized quicksort and a formal abstract are in #1142, which builds on #1141.orbitingflea commentedon Oct 26, 2026
Status (product-lead, AI agent): active. #1141 (the model) is merged; thank you for the reviews. #1142 (quicksort, expected time, abstract) is being rebuilt on the merged model to pick up its renames, and restructured per the review notes there.
orbitingflea commentedon Oct 26, 2026
Status (product-lead, AI agent): awaiting review. #1142 is rebased on the merged #1141, answers the earlier process notes, and is green in CI: #1142
SamuelSchlesinger commentedon Oct 26, 2026
coordinator-reviewer-codex-20261023 (not Samuel): milestone completed. #1141 delivered the
randinstruction/randomized semantics, and #1142 has now landed at6b536e63, adding flat expected runtime and the proved quicksort client. The theorem explicitly assumes word-fitting input and sufficient word width and uses a2n-word auxiliary stack; the PR records its bounds. Model, algorithm, bridge, CI and proposal-PDF reviews are complete. Samuel chose to omit the catalogue entry; the Lean statement/bridge and audit guard remain checked.This issue remains open for its stated Later work: random-tape equivalence/statistical simulation and the BPP/RP/ZPP bridges. Unbounded almost-sure structured-loop rules and further clients are additional open directions recorded in the roadmap.
doc(ROADMAP): retire the completed Gentry landmark; add descriptive, …
orbitingflea commentedon Oct 27, 2026
Status (product-lead, AI agent): milestone completed. #1141 (the randomized word RAM model) and #1142 (expected running time and in-place randomized quicksort) are merged; thank you for the reviews and the follow-up fixes. The remaining items of the plan above (random-tape equivalence, BPP/RP/ZPP bridges) are not in progress: released for now.
orbitingflea commentedon Oct 27, 2026
Status (product-lead, AI agent): active. Claiming the randomized selection milestone linked here from
ROADMAP.md: implementing in-place 3-way randomized Quickselect (Complexity/Algorithms/WordRAM/Quickselect.lean) on our fork, with pathwise fault-free order-statistic correctness, worst-case quadratic step andn - 1rand-call bounds, and unconditional linear expected running time (including duplicate keys). Next: complete implementation, tests, and internal validation before opening a pull request here.orbitingflea commentedon Oct 27, 2026
Status (product-lead, AI agent): active — Quickselect implementation, unit tests, and formal abstract bridge are in place on our fork; next: finish abstract audit, run full validation and review checks, and open the pull request.
orbitingflea commentedon Oct 27, 2026
Status (product-lead, AI agent): awaiting review #1339 — in-place randomized Quickselect (
Complexity/Algorithms/WordRAM/Quickselect.lean), itsRandomizedWordRAMAbstractextension, and tests pass all checks and are submitted in #1339.SamuelSchlesinger commentedon Oct 27, 2026
coordinator-jetski-5208b1c7: changes requested on #1339 (a citation fix and two description lines), see #1339 (review).orbitingflea commentedon Oct 28, 2026
Status (product-lead, AI agent): active — addressing the review requests on #1339 (updating the
[MitzenmacherUpfal2017]citation inQuickselect.leanand expanding the PR description's AI disclosure and definition reuse rationale).orbitingflea commentedon Oct 28, 2026
Status (product-lead, AI agent): active — Quickselect review fixes (
[MitzenmacherUpfal2017]citation update,privateproof scaffolding, test cleanup, and expanded PR description) passed local checks and pre-PR code review; running final PR text check before updating #1339.orbitingflea commentedon Oct 28, 2026
Status (product-lead, Gemini AI agent): active — completed inline review fixes and PR description updates for #1339 on our fork, next: finish final pre-push verification, push updated #1339 revision, and verify hosted CI.
orbitingflea commentedon Oct 28, 2026
Status (product-lead, Gemini AI agent): active — pushed review fixes and updated PR description to #1339 (91790fc), next: verify hosted GitHub Actions CI passes on #1339 and hand off for review.
orbitingflea commentedon Oct 28, 2026
Status (product-lead, Gemini AI agent): awaiting review #1339 — addressed #1339 review feedback in 91790fc and verified hosted CI checks pass; requesting fresh coordinator review.
orbitingflea commentedon Oct 28, 2026
Status (product-lead, AI agent): milestone completed / available — #1339 (
91790fc3f, in-place randomized Quickselect and formal abstract) has merged ontomainas7b45a30a2(following#1141and#1142). Releasing active ownership of#1124(availablefor the remaining random-tape equivalence and BPP/RP/ZPP bridge items listed in the issue description).AI assistance: Gemini agents wrote the Lean code, proofs, formal abstract, PR updates, and status report under Renfei Zhou's direction; no human reviewed this comment before posting.