A total query router with at most one sampler call #
The preprocessing program either supplies a direct result, or an argument and continuation context. Only the latter branch calls the supplied sampler. The postprocessor is total on raw data, so malformed inputs preserve termination whenever routing preserves the sampler index.
Equations
- p.callWithContext post = MIPRE.Cost.Prog.fstProg.let_ (p.let_ (((MIPRE.Cost.Prog.callVar 2 MIPRE.Cost.Prog.sndProg).cons (MIPRE.Cost.Prog.var 0)).let_ post.code))
Instances For
theorem
MIPRE.Cost.Prog.callWithContext_closed
{p : Prog}
(hp : WellScoped 1 p)
(post : PolyTimeFun (Data × Data) Data)
:
WellScoped 1 (p.callWithContext post)
theorem
MIPRE.Cost.Prog.callWithContext_runs
{p : Prog}
(hp : WellScoped 1 p)
(post : PolyTimeFun (Data × Data) Data)
(a ctx r : Data)
(time : ℕ)
(hr : p.Runs a r time)
:
def
MIPRE.Cost.Prog.routeOneCall
(route : PolyTimeFun Data (Bool × Data))
(p : Prog)
(post : PolyTimeFun (Data × Data) Data)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
MIPRE.Cost.Prog.routeOneCall_closed
(route : PolyTimeFun Data (Bool × Data))
{p : Prog}
(hp : WellScoped 1 p)
(post : PolyTimeFun (Data × Data) Data)
:
WellScoped 1 (routeOneCall route p post)
theorem
MIPRE.Cost.Prog.routeOneCall_halts
(route : PolyTimeFun Data (Bool × Data))
{p : Prog}
(hp : WellScoped 1 p)
(post : PolyTimeFun (Data × Data) Data)
(n : ℕ)
(q : Data)
(halts : ∀ (d : Data), Halts p ((encode n).cons d))
(preserves :
∀ (a : Data),
route.toFun ((encode n).cons q) = (true, a) → ∃ (d : Data) (ctx : Data), a = ((encode n).cons d).cons ctx)
:
Halts (routeOneCall route p post) ((encode n).cons q)
Halting is preserved if each routed call retains the original index.