The apply replaced by products, through a whole query #
Provenance.SymApply writes one apply with products (Sym.applyX), given
its right side in the fragment without the apply and a closed pool: a
unary query holding every value of the left side's rows. This module runs
that replacement through a query over {∅, Π, σ, apply, γ, win, μ^⊎},
from the leaves up, so that every query of that fragment is matched by one
over {∅, Π, σ, ×, γ, win, μ^⊎} (Sym.basisProdOps).
The pool of an apply outside a recursion is the values of its left side.
Inside a recursive term the left side reads the round, so its values are
those of the round and those the term creates; the latter are bounded by a
closed query (Cr), built from the leaves up alongside the term: the
constants and context values a projection may emit, and the cut of each
apply's right side. A recursion's rounds then hold only values of its base
and of its body's Cr, and that closed union is the pool W its body's
applies read. Each recursion is renamed to a name of the supply, as the
copies of its base the pool holds would otherwise nest a recursion inside
one of the same name.
Reading an instance away from a name #
A bag recursion under another name #
The names a term's pass binds around its pool #
The names the pass of a recursive term binds around the pool it is given: at each apply on the way to the hole, the union building the apply's pool (slice 4) and the union inside the apply over it (slice 1 of the apply's own supply); the child on the way to the hole has slice 1.
- vq (f : ℕ → String) (i : ℕ) : Enc f (part f 4 i)
- vs (f : ℕ → String) (i : ℕ) : Enc f (part (part f 0) 1 i)
- down (f : ℕ → String) (x : String) : Enc (part f 1) x → Enc f x
Instances For
Dependency graph
A window kept is of the fragment #
The values an apply's right side creates #
The pass #
The names a pass with supply f gives the values it creates: its
input's, and its supply's away from those binding around a pool.
Instances For
Dependency graph
A value of a row of X.
Instances For
Dependency graph
The queries bounding created values #
The constants and the context values a projection may emit.
Equations
Instances For
Dependency graph
A projection re-typed #
A projection with its columns read as regular ones.
Equations
- Sym.projReg ps p = AggQueryIn.castKind ⋯ (AggQueryIn.Proj (fun (j : Fin M) => (ps j).toReg) p)
Instances For
Dependency graph
Names of slices #
The pass, both halves at once. A closed query of
{∅, Π, σ, apply, γ, win, μ^⊎} is matched by a query of the fragment
with products and without the apply, defined and equal wherever it is.
A recursive term reading the name s is matched, given a closed pool W
holding the values of the round, by a term reading a name t in its
place; and the values it creates are bounded by a closed query Cr,
built before the pool is known.
Dependency graph
The basis with products #
{∅, Π, σ, ×, γ, win, μ^⊎} generates the whole algebra in the
minimal universe: every query of the algebra over a schema, in the
signature with a count as its only aggregate, is matched by one over those
seven classes, defined and equal wherever the query is. The product
stands in for the apply: first the query is matched over
{∅, Π, σ, apply, γ, win, μ^⊎} (basisRecOps_generatesOnRec), then each
apply of the match is written with products (Sym.exists_prodPass_aux).
Dependency graph
No proper subset of basisProdOps generates the whole algebra in
the minimal universe over ℕ. The rows of required_mem_of_generatesOnRec
force each class: σ because − is not in the set, and × because the
apply is not.
Dependency graph
basisProdOps is a basis of the whole algebra in the minimal
universe over ℕ: it generates over every schema, and no proper subset
does.