NLA-lib Explorer

Catalog: comparisons and the conversion to an index

Library · Source module

Catalog: comparisons and the conversion to an index

Queries are the names a program uses in a test (ite, whileFuel) or as an index (bindIdx). They are primitives of the access model, which imposes their exactness; no table implements them.

* NLAlib.Ops.CmpOp compares decoded inputs and writes a flag cell. A table can implement this call. The access model's NLAlib.Ops.FlagTst.isSet query reads the flag cell using the same Boolean decoding. * NLAlib.Ops.CmpTst: the comparisons lt, le, eq of two cells and isZero, isPos of one cell. Contract NLAlib.Ops.IsCmp dec: each is decided exactly on the decoded values (NLAlib.Ops.Interp.IsTest). * NLAlib.Ops.IdxTst.toNat: the conversion of a cell to a number. Contract NLAlib.Ops.IsToNat dec: the number is the floor of the decoded value, and the conversion fails on a negative value (NLAlib.Ops.Interp.IsIndex, whose function is Option-valued). Nothing is clamped: a program that wants a clamp tests first.

Witness: NLAlib.Ops.exists_isCmp, on the real numbers.

Main results

* NLAlib.Ops.IsCmpOp and NLAlib.Ops.IsFlagTest specify a comparison call and flag read. NLAlib.Ops.exists_isCmpOp_isFlagTest witnesses both contracts on the real numbers. * NLAlib.Ops.IsCmp, NLAlib.Ops.IsToNat: the contracts. * NLAlib.Ops.IsCmp.test_lt and its analogues, NLAlib.Ops.IsToNat.index_eq, NLAlib.Ops.IsToNat.index_neg: what a query returns on readable cells. * NLAlib.Ops.exists_isCmp: the contracts can be met.

Declarations