The front end is complete (module FrontComplete) #
If some swap of P (SwapLine) is typed, swapArgs P is typed with the same roles
(swapArgs_complete); with Prog.infer_iff, inference after the front end is exact up to swaps
(infer_swapArgs_iff).
Fix the typed swap and its roles. Its recipes recs, one per line, are equations of the search
(RecsOK.sub): the forward form of a conditioner, the solved or swapped solved form of a spine
step. The search fires only recipes: every other equation of a line has a back edge to the
line's recipe (line_back_cond, line_back_spine), reading a variable whose recipe reads one of
its results, so it cannot fire while the known set is closed under the recipes (only_A). The
search stops at a fixpoint (fwdKnown_terminal), where everything the recipes derive from the
weights and the returned variables is known (fix_forward); that is every variable
(Typed.known_xrecs), so every recipe has fired (fwdKnown_exact). Hence the swapped forms that fired
are exactly the swapped spine steps of the typed swap, and the swaps swapArgs makes differ from
it only on conditioners, whose argument order the typing ignores (typed_congr). The typing
supplies unique binders and results outside the weights and the returned variables
(recs_ok).
The search itself is Search; this module supplies its hypotheses for the lines.
The recipe of the line l, numbered i, at scope n, under a role, swapped if s: the forward form of a conditioner, the (swapped) solved form of a spine step.
Equations
- One or more equations did not get rendered due to their size.
- RoleFlow.lineRecipe s i n l RoleFlow.Role.cond = [{ binds := l.ys n, reads := l.args, line := i, swap := false }]
Instances For
The typing's recipes #
The recipes of the lines numbered from i at scope n under the roles ρ, with the lines
selected by sw swapped.
Equations
- RoleFlow.recs sw x✝¹ x✝ (l :: ls) (r :: ρ) = RoleFlow.lineRecipe (sw x✝¹) x✝¹ x✝ l r ++ RoleFlow.recs sw (x✝¹ + 1) (x✝ + l.bs.length) ls ρ
- RoleFlow.recs sw x✝³ x✝² x✝¹ x✝ = []
Instances For
Two line lists that agree on the spine steps and differ at most by a swap on conditioners.
Equations
- RoleFlow.SwapAgree (l₁ :: ls₁) (l₂ :: ls₂) (RoleFlow.Role.cond :: ρ) = (RoleFlow.SwapLine l₁ l₂ ∧ RoleFlow.SwapAgree ls₁ ls₂ ρ)
- RoleFlow.SwapAgree (l₁ :: ls₁) (l₂ :: ls₂) (RoleFlow.Role.spine :: ρ) = (l₁ = l₂ ∧ RoleFlow.SwapAgree ls₁ ls₂ ρ)
- RoleFlow.SwapAgree [] [] [] = True
- RoleFlow.SwapAgree x✝² x✝¹ x✝ = False
Instances For
The typing ignores the argument order of conditioners.
What the typing of a swap gives about its recipes.
- uniq : Search.UniqB (recs sw i n ls ρ)
- back (q : Search.Eqn) : q ∈ eqns i n ls → q ∈ recs sw i n ls ρ ∨ Search.BackEdge (recs sw i n ls ρ) q
- sub (r : Search.Eqn) : r ∈ recs sw i n ls ρ → r ∈ eqns i n ls
- line (r : Search.Eqn) : r ∈ recs sw i n ls ρ → i ≤ r.line
Instances For
The recipes of a typed swap: unique binders, results live or later and outside the weights and the returned variables, back edges, and the swap flags.
Every result of the recipes is derivable #
Completeness #
All typed swaps of a program have the same roles.