Programs over operations
Library · Source module
Programs over operations
A program NLAlib.Ops.Stmt Op is a first-order tree over the operation names Op. Its only effects are calls of operations. An operation is used in one of three ways: call (it writes cells), a test (ite, whileFuel: it returns a Boolean) or an index (bindIdx: it returns a number, and the run fails if the conversion fails or the number exceeds the bound).
whileFuel is the loop of an iteration with a stopping test: it binds the round index in the test and in the body, stops at the cap without failing, and hands the number of rounds done to its continuation. The strict loop, which fails if the test still holds at the cap, is NLAlib.Ops.Stmt.whileStrict. There is no Lean function in a tree: index variables and buffer variables are positions in the environment (NLAlib.Ops.Env), a binder appends to it, and sizes are index expressions NLAlib.Ops.IExp. So one tree serves all sizes.
frame runs a body in a new environment made of the dimensions and operands it is given: it is the instance of a procedure, and linking (NLAlib.Ops.Stmt.link) turns a call into the frame of its implementation.
note attaches metadata (NLAlib.Ops.Note: the routine a frame runs, the source name of a variable) to a subtree and does nothing else: a tree with a note is run, counted, checked and linked as the tree without it. It is the one place where a tree carries metadata.
Main definitions
* NLAlib.Ops.Stmt, NLAlib.Ops.Note: trees and the metadata they may carry.
Main results
* NLAlib.Ops.Operand.evalList_append, NLAlib.Ops.Operand.evalList_off_of_evalList: the evaluation of operand lists.
Declarations
- NLAlib.Ops.Bookkeeping
- NLAlib.Ops.Bookkeeping.ofNat
- NLAlib.Ops.Bookkeeping.ofNat_ctorIdx
- NLAlib.Ops.Env
- NLAlib.Ops.Env.buf_frame
- NLAlib.Ops.Env.buf_pushBuf
- NLAlib.Ops.Env.buf_pushIdx
- NLAlib.Ops.Env.frame
- NLAlib.Ops.Env.idx_frame
- NLAlib.Ops.Env.idx_pushBuf
- NLAlib.Ops.Env.idx_pushIdx
- NLAlib.Ops.Env.pushBuf
- NLAlib.Ops.Env.pushIdx
- NLAlib.Ops.IExp
- NLAlib.Ops.IExp.bookkeeping
- NLAlib.Ops.IExp.brecOn.eq
- NLAlib.Ops.IExp.brecOn.go
- NLAlib.Ops.IExp.eval
- NLAlib.Ops.IExp.evalList
- NLAlib.Ops.IExp.evalList_cons
- NLAlib.Ops.IExp.evalList_nil
- NLAlib.Ops.IExp.eval_add
- NLAlib.Ops.IExp.eval_const
- NLAlib.Ops.IExp.eval_div
- NLAlib.Ops.IExp.eval_mul
- NLAlib.Ops.IExp.eval_sub
- NLAlib.Ops.IExp.eval_var
- NLAlib.Ops.IExp.length_of_evalList
- NLAlib.Ops.Note
- NLAlib.Ops.Operand
- NLAlib.Ops.Operand.eval
- NLAlib.Ops.Operand.evalList
- NLAlib.Ops.Operand.evalList_append
- NLAlib.Ops.Operand.evalList_cons
- NLAlib.Ops.Operand.evalList_nil
- NLAlib.Ops.Operand.evalList_off_of_evalList
- NLAlib.Ops.Operand.eval_eq
- NLAlib.Ops.Operand.formatList
- NLAlib.Ops.Operand.length_of_evalList
- NLAlib.Ops.OperandSignature
- NLAlib.Ops.Program
- NLAlib.Ops.Program.environment
- NLAlib.Ops.Program.wellTyped
- NLAlib.Ops.ResourceModel
- NLAlib.Ops.Stmt
- NLAlib.Ops.Stmt.alloc
- NLAlib.Ops.Stmt.brecOn.eq
- NLAlib.Ops.Stmt.brecOn.go
- NLAlib.Ops.Stmt.ifPos
- NLAlib.Ops.Stmt.ifZero
- NLAlib.Ops.Stmt.instrument
- NLAlib.Ops.Stmt.wellTyped
- NLAlib.Ops.Stmt.whileStrict
- NLAlib.Ops.indexBookkeeping
- NLAlib.Ops.instDecidableEqIExp.decEq
- NLAlib.Ops.instDecidableEqNote.decEq
- NLAlib.Ops.instDecidableEqOperand.decEq
- NLAlib.Ops.instReprBookkeeping.repr
- NLAlib.Ops.instReprIExp.repr
- NLAlib.Ops.instReprNote.repr
- NLAlib.Ops.instReprOperand.repr
- NLAlib.Ops.operandBookkeeping
- NLAlib.Ops.tally