Repository navigation
feat(pfunctor): extend expected charge to unbounded resumptions - #487
Merged
Merged
Conversation
dtumad
force-pushed
the
dtumad/resumption-expected-charge
branch
from
November 18, 2026 03:49
a0f6986 to
dd86db2
Compare
Base automatically changed from
dtumad/finite-stateful-expected-charge
to
main
November 18, 2026 15:15
dtumad
force-pushed
the
dtumad/resumption-expected-charge
branch
from
November 18, 2026 15:15
dd86db2 to
ff64cbe
Compare
dtumad
marked this pull request as ready for review
November 18, 2026 19:29
This was referenced Nov 18, 2026
Take the supremum over finite query prefixes with zero credit at cutoffs. Use the continuous query algebra to prove sequencing, agreement with finite programs, and transfer of potential bounds. Co-Authored-By: Codex <noreply@openai.com>
dtumad
force-pushed
the
dtumad/resumption-expected-charge
branch
from
November 20, 2026 07:11
ff64cbe to
cc09351
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The statements about expected charges of resumptions use continuous algebras and truncations. The fusion and approximation theorems occur only in proofs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ptions Attain the potential bound on a client that never returns, price an adaptive client's second request in the state left by its first, and refute agreement with the finite fold over answers without measurable singletons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te or exact An infinite total needs a handler that keeps answering, since the zero kernel stops the same client after one charge. The step equation and agreement with finite folds need measurability conditions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nvariant boundary Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dtumad
added a commit
that referenced
this pull request
Nov 26, 2026
#487 landed on main as squash e688823, which carries the same tree as its head b46e02c merged above. The conflicts in PolyFun.lean, cost.md, repo-map.md and the documentation consumer were both sides adding #487's text; keep this branch's text and add #510's lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An infinite sequence of requests can incur a finite cost. If only the first request costs one, the total is one. Against a handler that always answers, charging one for every request makes the same client’s total infinite. Both equations hold for every terminal payoff because the client never returns.
PFunctor.Resumption.expectedChargetakes the supremum of the charges of finite prefixes. A return earns its terminal payoff. A prefix cut off at a pending request receives zero terminal credit. Each request incurs its price before the joint kernel samples the answer and successor state.expectedCharge_queryandexpectedCharge_bindgive the equations for one request and for sequencing.expectedCharge_toResumptionrecovers the fold on finite programs. These laws assume countable answers with measurable singletons and state-measurable prices and terminal payoffs.expectedCharge_le_of_potentiallifts the finite amortized bound to every prefix using a measurable potential, a local price inequality and an almost-sure invariant. The state may have any measurable space.Resumption.MeasurableExpectationpackages nonnegative measurable functions of the private state. Its two order instances provide bottom and suprema of increasing sequences for the existing continuous-algebra interpretation.Builds on merged #486. Refs #387.
Review and validation
At
b46e02cf, which includesmainat6c9cf976,./scripts/validate.sh --lint --test --axiomspassed, including the documentation and Parliament consumer packages. The sweep found zerosorryor nonstandard-axiom dependencies across 22,519 declarations in 635 modules.#print axiomsfor the finite-agreement, query, bind, potential and continuous-algebra theorems reported onlypropext,Classical.choiceandQuot.sound.The regressions distinguish one-time and recurring charges on a client that never returns. A zero-mass request costs seven even with infinite terminal credit, and a request answered with mass one half pays in full and earns half its credit. A finite program receives its terminal credit in the state where it returns. A one-unit potential pays for the setup of every client, and the client that never returns attains the bound. A second potential bound holds in the state its invariant describes and fails in the state it excludes. An adaptive client prices its second request in the state left by its first, so it pays two, then three. A well-founded program without a depth bound, over answers without measurable singletons, has a fold of one and an expected charge of zero, so that hypothesis cannot be dropped from
expectedCharge_toResumption. An ordinary-import consumer bounds a finite setup followed by a potentially divergent service.Mutated copies of the statements fail these tests: credit at cutoffs, a single prefix in place of the supremum, a query equation without its price, with the old state, or with an essential supremum, a bind equation without its continuation, finite agreement without terminal credit, and a potential bound without either credit term.
The result measures incurred cost on visible requests. Almost-sure termination and the law of returned values require separate arguments.