Repository navigation
refactor(Complexity/FPAUS): early-stopping interval sampler with the law of sampleUniformInterval - #4791
Conversation
…law of sampleUniformInterval Move ExactSampler's capped [0, c) rejection sampler next to ProbComp.sampleUniformInterval as sampleUniformIntervalRetry. Prove once that it has the law of sampleUniformInterval, and derive the pointwise lower bound from the existing interval law. This deletes the hand-derived trial lemmas and the 75-line lower bound. The expected-cost bound and the PPT certificate move with the sampler. Part of #4737.
|
APPROVE the source/API and both-manual delta at The complete five-path change preserves the original capped sampler and its ExactSampler clients. The shared law bridge correctly separates bound zero (zero sampled bits, always failure) from positive bounds, where Both manuals are clear. The Operator paragraph accurately distinguishes exact PMF sampling from strict capped PPT, names the shared law/cost API and links the complete client; the Agent manual needs no edit because roles and procedures are unchanged. Artifact13978734918 matches the API ZIP digest and clean exact head: all72+1 chapter inputs, three converters, bibliography/363 keys and both PDF hashes verify against Git; hosted build/source checks pass. Operator PDF153 (printed145) and Agent PDF4 render readably. Guide43296525080 passes example compilation. Final technical clearance by the coordinating root, Actual hosted merge Landed: exact approved |
edemaine
left a comment
There was a problem hiding this comment.
APPROVE source/API and both-manual changes at 72e8f2bfd201b630c1659e443eb9da2a4914753b — independent non-author reviewer /root/review4791_sampler. No blocking source findings. The full optional law, zero-bound behavior, fair-bit expected cost, binary-bound/unary-budget strict PPT and actual conditional-walk clients are covered in the canonical review, including exact-head rendered-manual QA and search limitations.
Final native gates and actual completed advisory reports remain pending; this approval retains that integration hold. No queue action. Agent review, not human approval.
|
Agent review (Jetski reviewer session a02d6e9e) of 72e8f2b: approve. This is agent review, not human review. The PR removes a copy of a sampler and its 75-line hand-derived bound, and all clients now take the bound from the existing interval law. Statements are unchanged: What I checked:
Nits, all non-blocking:
|
Classes/FPAUS/ExactSamplerdefined its own capped[0, c)rejection sampler. It then re-derived that sampler's law by hand: trial masses, failure mass, and a 75-line pointwise lower bound.Languages/Probabilistic/BoundedUniformalready proves the same law forProbComp.sampleUniformInterval. This PR moves the sampler there asProbComp.sampleUniformIntervalRetryand proves once that its law equalssampleUniformInterval's. Clients now get their bound from the existing interval law.This is a refactor with no new mathematics. Every client statement is unchanged.
Change (+199 / −302, net −103)
Languages/Probabilistic/BoundedUniform:sampleUniformIntervalAttempt: one attempt, which drawsbound.sizefair bits and keeps the value if it is belowbound.sampleUniformIntervalRetry:OracleComp.retryover attempts.eval_sampleUniformIntervalRetry: law equality, by induction on attempts. A private bridge lemma shows that abound.size-bit draw andsampleBoundedIndex boundgive the same accept/reject step.le_eval_sampleUniformInterval_some: each valid index has mass at least(1 - (1/2)^attempts) / bound, fromeval_sampleUniformInterval_some_toRealandintervalFailure_le_half.expectedCost_sampleUniformIntervalRetry_le: at most2 * bound.sizefair bits in expectation, for every bound and attempt budget. The proof uses the attempt's failure mass, taken from the one-attempt law.Computability/Probabilistic/BoundedUniform:isPPTOn_sampleUniformIntervalRetry, moved from ExactSampler (binary bound, unary attempts).ExactSampler:sampleFinTrial,sampleFinBounded,expectedCost_sampleFinTrial,eval_sampleFinTrial_some/none, the private failure lemmas,eval_sampleFinBounded_some_ge(the 75-line bound), the clientlesseval_sampleFinBounded_some_of_ge, and the privatetsum_option_pmf.le_eval_boundedConditionalWalk_someis now a three-linehdrawbuilt from the two lemmas above. The onetsum_option_pmfuse is replaced by thePMF.tsum_coe+tsum_option_eqidiom used elsewhere.ThresholdSearchAndExactSampler: renamed to the new names; it still checks the expected-cost bound at(3, 5).At bound
0the attempt draws0bits, so the expected-cost bound still holds with no positivity hypothesis. Drawing fromsampleBoundedIndexinstead would cost one bit per attempt and lose that.The new public import of
Languages.Probabilistic.RetryinLanguages/Probabilistic/BoundedUniformreaches only its two library importers (Computability BoundedUniform andHomomorphic/Leveled/FlatSecurity) and ExactSampler.Manual impact. Operator's Manual:
verifiers-counting-interaction.mdnow namessampleUniformIntervalRetry, its law equality andexpectedCost_sampleUniformIntervalRetry_leinstead of the removed names. No#Lanchors point into the changed files. Agent Operator's Manual: no change, because workflow and tooling are unaffected.ROADMAP.mdandresults/do not mention these declarations.Validation at 72e8f2b, through the fleet build slots:
lake build --wfailon both BoundedUniform modules, ExactSampler,Homomorphic.Leveled.FlatSecurity,CslibFrontierTests.ThresholdSearchAndExactSamplerandCslibFrontierTests.BoundedUniform.lake linton the three changed library modules.lake exe mk_all --check,scripts/check_hygiene.pyon the changed files,scripts/check_operator_manual.py, andscripts/proof_copies.py --base origin/main(no repeated block).AI assistance: Jetski worker session
ed4d7a73, plan #4737 (iqc survey F7).Part of #4737.