The layout arithmetic as programs #
The widths and offsets of the index layout (Layout.lean) as programs. Two conventions make
them cheap:
- widths and offsets are unary.
W e,mOf e G, the field offsets: all are affine inewith small coefficients, so in unary they areappendand iteratedappend, and no arithmetic program is needed.eitself must be unary in any case — the formulas are of size polynomial ine, so a binaryewould make the output exponential in the input. - a constant of a field is a resize of a bit string.
resize w bskeeps the lowwbits ofbs, padding withfalse, andresize_eq_nbitsidentifies it withnbits w kfor anybswhose bits are those ofk. Sonbits w (2 * T)is a resize offalse :: T.bitsandnbits w (T + 3)one ofincBits (incBits (incBits T.bits)), with no multiplication or addition on numbers (planning/succinct-cook-levin.md, S3).
Unary arithmetic #
Unary multiplication by a constant.
Equations
Instances For
Resizing a bit string #
The low w bits of a bit string, padded with false to the width w.
Equations
- MIPRE.TM.CookLevin.Desc.resize w bs = List.take w (bs ++ List.replicate w false)
Instances For
The bit strings of the numbers the describer needs #
Powers of two #
Resizing, as a program #
resize, the width in unary.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Doubling a bit string: a false in front.
Equations
Instances For
2 ^ e, from e in unary: its bit string is e zeros and a one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Adding a constant to a number.
Equations
Instances For
Readers of the layout #
The constant k on w bits, read off a width in unary and the bits of k.
Equations
Instances For
The formulas of the constant k on w bits.
Equations
Instances For
The constant read off a width in unary and a reader of the number itself.
The bits of a numeral, as a reader.
Equations
Instances For
The widths and offsets #
W e, in unary.
Equations
Instances For
3, 4 and Qb and Gb Gc, in unary: the widths that do not depend on e.
Instances For
Instances For
Equations
Instances For
Equations
Instances For
mOf e Gc, in unary.
Equations
- One or more equations did not get rendered due to their size.
Instances For
flagOff e Gc, in unary.
Equations
- One or more equations did not get rendered due to their size.
Instances For
gOff e, in unary.
Equations
- One or more equations did not get rendered due to their size.
Instances For
dOff e, in unary.
Equations
Instances For
pOff e, in unary.
Equations
Instances For
vOff e, in unary.
Equations
Instances For
qOff e, in unary.
Equations
Instances For
jsOff e d, in unary.
Equations
- One or more equations did not get rendered due to their size.