The density theorem (docs/roleflow.tex, sec:density) #
Fix the context Γ of all variables and a family of traces T : Ω → Val Γ (for a program at
fixed weights: the trace of each input). Det T A v says that v is determined by the
positions A: some measurable function of the live state on A gives its value on every
trace. A recipe holds (Holds) if its targets are determined by its sources.
Factorization (det_of_known, Recov.det, Recov.det_params): if all recipes hold and
the weights are determined by nothing (they are constant), then everything in
Known R (Θ ∪ K) is determined by K. With Recov this gives the recomputation r_v of
every variable in scope from the live state, and at a spine step that of the parameters from
the live variables the step does not consume.
Density (density_aux, by Typed.induction_recov): given that the recipes of the lines
hold (xrecs_holds), at each node of a derivation (NodeInv) there are a measurable
F : X_Λ → X_O and L : X_Λ → ℝ with Cov (lvol Λ) (vol O) F e^L that give the returned tuple and the remaining log-weight on every trace. At a spine step,
F = F' ∘ step with step(c, q) = (q, ⟦o⟧(c, z q)), where z recomputes the parameters from
q; its Cov is Tri with the leaf at z q, between measure-preserving splittings.
Prog.density reads this at the root, and Prog.density_joint is the joint statement over
the weights, which covers conditional flows. Only the left law is used.
Determined positions #
v is determined by the positions A on the traces T.
Equations
- RoleFlow.Det T A v = ∀ (a : S) (h : Γ[v]? = some a), ∃ (g : RoleFlow.LState Γ A → RoleFlow.X a), Measurable g ∧ ∀ (ω : Ω), (T ω).get v h = g (RoleFlow.LState.restrict A (T ω))
Instances For
If every position of B is determined by A, so is the live state on B.
Determined positions can be picked by a measurable function of the live state.
If the values at ys are a measurable function of those at xs on every trace, then every
position of ys is determined by xs.
Factorization: if the recipes hold and the weights are determined by nothing, everything
known from the weights and K is determined by K.
Factorization, the live-state recomputation r_v: under Recov, every variable in
scope is determined by the live state.
Factorization at a spine step: the parameters factor through the live variables the step does not consume, since their supports avoid them.
Density along a derivation #
The invariant at a node of a derivation, with live set Λ, remaining lines ls, returned xs and roles ρ: a measurable F and L on live states with
Cov (lvol Λ) (vol O) F e^L, which give the returned tuple and the remaining log-weight on
every trace. The node starts in the context Γ', and pre ω is the value of Γ' from which
the trace T ω continues.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Density at every node of a derivation, given recipes R that hold and contain those of
the lines.
The density theorem #
Under the right law, the semantics of a typed program is surjective
(prop:surj): every live-state step is solved by the semi-inverse.
Joint density (cor:joint): over the weights and the inputs together. Conditioning
values of conditional flows are weights, so this is the density of the joint distribution with
them.