Programs as readers of a shared input #
A program built by composition out of comp, pair, fst and snd is written point-free,
and a point-free term for a formula of forty conjuncts is unreadable. This file gives the
applicative reading instead: a PolyTimeFun ι α is a reader of the shared input ι, and
ap₁, ap₂, ap₃ and listOf apply a program to readers. In that style a program
transcribes its mathematical definition line for line, and its toFun is definitionally the
function it transcribes, so the congr that names it closes by rfl.
Also here, because they are the list operations the describer's programs need and they are
generic: take, tail, headD and nthD (planning/succinct-cook-levin.md, S3).
Applying a program to readers #
Apply a one-argument program to a reader.
Instances For
Apply a two-argument program to two readers.
Instances For
Apply a three-argument program to three readers.
Instances For
A two-argument program with its left argument curried away: the reader f of the shared
input supplies it.
Equations
- F.ap₂' f = F.comp ((f.comp MIPRE.Cost.PolyTimeFun.fst).pair MIPRE.Cost.PolyTimeFun.snd)
Instances For
A list of readers as a reader of the list of their values.
Equations
Instances For
Prefixes, tails and heads #
Taking a prefix, the length in unary.
Equations
- MIPRE.Cost.PolyTimeFun.take = (MIPRE.Cost.PolyTimeFun.fst.map.comp MIPRE.Cost.PolyTimeFun.zip).congr (fun (p : List α × MIPRE.Cost.Unary) => List.take (List.length p.2) p.1) ⋯
Instances For
The tail of a list.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The head of a list, or a default.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dropping a prefix, the length in unary: iterated tail.
Equations
Instances For
Dropping a prefix, the length in unary.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The k-th entry of a list, or a default.