Role typing (docs/roleflow.tex, sec:typing) #
The judgement Typed Sg O Γ Λ D ls xs ρ has the output sorts O, the context Γ (its length
is the next free position), the live set Λ and the supports D; ls are the remaining lines,
xs the returned positions and ρ the roles. Every rule checks the sorts of its line, and
Ret those of the returned variables, so a typing includes well-formedness (Typed.wf). The support D.getD v ∅ of v stands for its live ancestors: empty for a
weight and {x} for an input; a conditioner's results get the union of its arguments'
supports (condSupp), and a spine step replaces the consumed arguments in every support that
meets them by its results and its parameters' supports (spineSupp).
The invariant Recov (every variable is recomputable from the weights and its support) is
preserved from each rule's conclusion to its premise (Recov.init, Recov.cond,
Recov.spine), for a fixed list R of recipes that contains those of the lines (xrecs).
Typed.induction_recov threads Recov through a whole derivation.
Typed is defined by recursion on the lines, so it is decidable as it stands (decTyped,
Prog.decTyped, for decidable equality of sorts). Nothing here uses measure theory.
The judgement #
The live set after a spine step at scope n solving the first k arguments: the consumed
arguments leave, the results [n, n + |ys|) enter.
Equations
Instances For
The supports after a conditioner: each result has the union of its arguments' supports.
Equations
Instances For
The supports after a spine step at scope n solving the first k arguments: a support that
meets the consumed arguments drops them and gains the results and the parameters' supports;
each result supports itself.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Γ; Λ; D ⊢ e : O with roles ρ, for the lines ls and the returned positions xs: the
rules Ret, Cond and Spine, by recursion on the lines. Each rule also checks the sorts
of its line, so a typing includes well-formedness (Typed.wf).
Equations
- One or more equations did not get rendered due to their size.
- RoleFlow.Typed Sg O x✝³ x✝² x✝¹ [] x✝ [] = (x✝.Nodup ∧ x✝.toFinset = x✝² ∧ RoleFlow.Args x✝³ x✝ O)
- RoleFlow.Typed Sg O x✝³ x✝² x✝¹ (l :: ls) x✝ (RoleFlow.Role.cond :: ρ) = (RoleFlow.Args x✝³ l.args l.as ∧ RoleFlow.Typed Sg O (x✝³ ++ l.bs) x✝² (RoleFlow.condSupp x✝¹ l) ls x✝ ρ)
- RoleFlow.Typed Sg O x✝⁵ x✝⁴ x✝³ x✝² x✝¹ x✝ = False
Instances For
Equations
- One or more equations did not get rendered due to their size.
- RoleFlow.decTyped O x✝³ x✝² x✝¹ [] x✝ [] = RoleFlow.decTyped._aux_1 O x✝³ x✝² x✝¹ x✝
- RoleFlow.decTyped O x✝³ x✝² x✝¹ [] x✝ (head :: tail) = isFalse ⋯
- RoleFlow.decTyped O x✝³ x✝² x✝¹ (head :: tail) x✝ [] = isFalse ⋯
Recoverability #
At the start, with the inputs live.
Cond preserves Recov: the new variables are settled by their own equation.
Spine preserves Recov: the consumed arguments are settled by the solved equation,
whose sources are the new live variables and parameters, whose supports avoid them.
Recoverability along a derivation #
Recov along a derivation: induction on a typing in which every node may use Recov,
given Recov at the root and recipes R that contain those of the lines.
Congruence and the returned variables #
Hash sets #
Insert a list into a hash set.
Equations
- RoleFlow.insertAll H xs = List.foldl (fun (x1 : Std.HashSet ℕ) (x2 : ℕ) => x1.insert x2) H xs