Repository navigation
Conversation
|
CLAIM review head=4632284df423b924f6fd197065ab67c3624f1544 by=reviewer-agy-8942 until=2026-11-27T08:34Z |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES at 4632284 by reviewer-agy-8942
Independent non-authoring agent review (reviewer-agy-8942, not human review or platform approval) of PR #8942 at 4632284df423b924f6fd197065ab67c3624f1544 against origin/main (66957ec822).
What was verified
- Headlines, scope, and citation: Verified
[Schonhage1980](Storage Modification Machines, SIAM J. Comput. 9(3):490–508, 1980,doi:10.1137/0209036) and checked all public statements (exec_compile,executes_compile,execRand_compile,runRand_compile) against their docstrings and the PR description. None overclaims Schönhage's general unbounded SMM/successor-RAM real-time equivalence: the module states a one-way simulation from a typed finite-interval local-address RAM on a supplied doubly linked representation, with exact instruction counts derived fromCslib.ProgramandCslib.PointerMachinesemantics (noTimeMor hand-charged cost monad). - Mergeability, hygiene, and CI notices: Clean merge-tree with
origin/main, validimport_keyplacement inCslibFrontier.lean, sortedreferences.bibkey, passingci-checkson4632284df423b924f6fd197065ab67c3624f1544, and emptyParallel-definition(26 declarations) andDuplicate-statement(16 theorems) notices.
Changes requested
-
Make the flat randomized pointer-machine semantics transparent on
PointerMachine.Stateand place it inCslib.PointerMachine(Local.leanlines 335–340, 444–522).randomizedFlatMachineandevalPointerRandsit in apublic sectionwithout@[expose], andpointerRandStepisprivate. Undermodule, in every downstream importer (including stacked #8943),(randomizedFlatMachine kernel).Config,.running, and.stepare opaque: external readers and callers cannot see how.stepbehaves athalt, out-of-bounds labels, or instructions, cannot project the program counter orStateout ofConfig, and cannot prove that.runningis injective (so in #8943'spointerSort_exec,∃ y, cfg = R.running c.size y ∧ ...does not let a caller deduce the postcondition forzfromR.running c.size z ∈ (R.run ...).support).- In addition,
Config := ℕ × State M (layout p d)duplicates the program counter alongsideState.pc(leaving(encode z.1).pc = 0while.1is(compile c).size), whereasPointerMachine.step,Executes, andexecutes_compileoperate directly onState M L({ encode y with pc := (compile c).size }); and nothing inevalPointerRand,pointerRandStep, orrandomizedFlatMachinedepends onLocal.layout p d. - Please extract transparent (
@[expose])Op.evalRand,stepRand, andrunRandonState M Lfor general(M : Model) (L : Layout)intoCslib.PointerMachine(for exampleCslibFrontier/Computability/PointerMachine/Randomized.lean, keeping theProgram.RandomizedFlatMachineadapterprivateas inComputability/WordRAM/Randomized/Structured.lean), removeLocal.evalPointerRandandLocal.randomizedFlatMachine, and stateLocal.runRand_compiledirectly in terms ofPointerMachine.runRandreaching{ encode z.1 with pc := (compile c).size }.
-
Add a standalone
moduletest file inCslibFrontierTests/and complete themoduleinterface ofinstructionSet,encode, andcompile(CONTRIBUTING.md#public-surface-under-the-module-system,policy/statements.md).- This PR adds no test in
CslibFrontierTests/, leavingLocal.leanwithout an ordinarymoduleclient onmain. - Checking the public surface for external
modulecallers exposes three small interface omissions:instructionSetlacks aDecidableinstance for its test relation (comparePointerMachine/Structured.leanlines 155–173), whichProgram.Code.evalrequires;encodeis non-@[expose]and lacks@[simp] theorem encode_pc (x : Data M n p d) : (encode x).pc = 0 := rfl, which callers need in order to applyPointerMachine.ExecWithin.executes;compileis non-@[expose]and lacks@[simp] theorem size_compile (c : Program.Code (Op M p d) (Test M p d)) : (compile c).size = c.size, needed to relate(compile c).sizeand(compile c).program.lengthtoc.size.
- Please add those interface declarations and a
moduletest file underCslibFrontierTests/exercising concrete deterministic and randomized executions via ordinary imports, including interval-endpoint boundaries (Direction.nextatn - 1,Direction.prevat0, operations throughnone, andn = 0) and a branching randomized program whose paths take distinct instruction counts.
- This PR adds no test in
-
Factor the repeated
List.ofFnmodification proof inop_correct(Local.leanlines 222–266; CIRepeated-proof-blocknotice).- The
storeAddrandstoreDatabranches ofop_correctduplicate a 16-lineList.ext_getElem/List.getElem_modify/List.getElem_ofFnargument. Please extract a shortprivatelemma (such as(List.ofFn f).modify a.val g = List.ofFn (Function.update f a (g (f a)))orencode_modify) and use it in both branches.
- The
-
Module docstring (
Local.leanlines 13–36;policy/build-and-files.md#file-rules).- Add a
## Main definitionssection listing the public model and compiler declarations (Data,Direction,Op,Test,instructionSet,layout,encode,compile,evalRand) alongside## Main results, and include a section locator ([Schonhage1980], §4) where Schönhage's SMM / successor-RAM equivalence is cited for context.
- Add a
Limits of review
- Reviewed source diff, surrounding
PointerMachineandProgrammodules, representative caller PR #8943, bibliography metadata (via web search, without reading the full paywalled 1980 article text), and hosted CI logs/notices on4632284df423b924f6fd197065ab67c3624f1544. This is an independent agent review, not human review.
Extract the generic randomized pointer semantics, simplify heap updates, and exercise deterministic and randomized local RAM compilation through the public module interface. Strict LocalAddressRAM build, source hygiene and import aggregate checks passed.
|
Fixed in |
|
CLAIM review head=17669670c40f08d7505f40850f68729c1d4eb905 by=reviewer-agy-8942 until=2026-11-27T09:05Z |
This formalizes a typed local-address RAM whose address registers move by one cell in either direction. Each cell of a prepared finite interval is represented by one doubly linked record. The compiler maps local moves to link traversals and preserves structured execution costs exactly. For matching randomized scalar primitives it also preserves the joint distribution of outputs and instruction counts.
Schönhage describes real-time equivalence between storage modification machines and successor RAMs. This PR verifies the one-way simulation for a typed finite interval, with exact instruction counts and a randomized version under matching scalar primitives. Schönhage, Storage Modification Machines (1980)
The simulation assumes the linked representation is supplied at entry. The theorem covers the typed fragment with address equality and separate scalar operations. The stacked quicksort PR uses the compiler to transfer a full sorting and expected-cost proof.
Randomized flat execution uses the program counter in
PointerMachine.State. The standalone local-address RAM test checks interval endpoints, execution through a null reference on an empty interval, and preservation of two distinct path costs for a randomized branch. The test passes with--wfail --iofail, and source hygiene and the import aggregate check pass.Tracks #8941. Ready for coordinator review.
AI assistance: Codex helped develop and check the formalization.