M6: concrete syntax for the core language #
cm{ … } writes a statement of the core language and cme{ … } an expression:
cm{ gp := G[g].prev
if gp ≠ 0 then G[gp].next := gl
if C[c].first = g then C[c].first := gl else { x := 1; fail }
labL ← labBeforeP(g) }
Statements are separated by newlines (aligned) or ;, and { … } groups them. This is
notation only: each form expands to the constructor term written with the helpers of
Notation.lean (Exp.gF, Stm.wgF, ;;, ::=, =ₑ, …), so the proofs see the same terms.
- Registers are identifiers:
xis.var "x".P.kis parameterk,S.kis scalark. E[i].f,G[i].f,C[i].f,N[i].fare fieldfof recordiof a table;a[i]is celliof the core arraya(AF).k[i]withk : LKis a list:len k[i],k[i][j].fst,append k[i] (a, b),pop k[i];kis anLKconstructor or a Lean variable.x := new Tappends a fresh record to tableT;x ← p(args)calls procedurep.for x < n do sis the bounded loop,try s catch hthe handler.O.kis fieldkof the pending job or path preparation,size Tthe number of records of tableT,path(c, j)leveljof chunkc's path;max(a, b),msb(a), anda ∸ bis truncated subtraction (Exp.monus). The other statements ofStm(pcSet(…),prepCommit, …) keep their constructor names.skip,failandbugare the statements of those names; any other bare identifier in statement position is aStmdefined elsewhere, and‹t›embeds a Lean term (anExp, aStm, or a field name).x ← ‹q›(args),(x, y) ← ‹q›(args)andcall ‹q›(args)call a procedure given by a Lean termq : Proc(e.g.‹findP k›, a procedure family applied to its list kind).‹r› := eassigns to the register named by the Lean termr : Reg(a parameter of the definition), as‹r›reads it.- Comparisons,
!,&&,||return 0 or 1, as<ₑ,!ₑ, … do.
Field selectors in the core-program surface syntax.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Expressions in the core-program surface syntax.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Statements in the core-program surface syntax.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Statements separated by ; or by line breaks at the same column.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A field given by its identifier.
Equations
- OrderMaintenance.Impl.CM.fId = Lean.ParserDescr.node `OrderMaintenance.Impl.CM.fId 1022 (Lean.ParserDescr.const `ident)
Instances For
A field supplied as an embedded Lean term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A natural-number literal in a core expression.
Equations
- OrderMaintenance.Impl.CM.eNum = Lean.ParserDescr.node `OrderMaintenance.Impl.CM.eNum 1022 (Lean.ParserDescr.const `num)
Instances For
A register, parameter, scalar or optional-job field in a core expression.
Equations
- OrderMaintenance.Impl.CM.eVar = Lean.ParserDescr.node `OrderMaintenance.Impl.CM.eVar 1022 (Lean.ParserDescr.const `ident)
Instances For
A parenthesized core expression.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An embedded Lean expression term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A field read from an indexed core record.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A read from a core array.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A first or second component read from a stored list entry.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The length of a stored core list.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The number of allocated table records.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A read of one chunk ancestor-path entry.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The maximum of two core expressions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The most-significant-bit index of a core expression.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Boolean negation, represented by zero or one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Left shift of a core expression.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Right shift of a core expression.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Multiplication of core expressions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Natural-number division of core expressions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Natural-number remainder of core expressions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Addition of core expressions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Guarded subtraction of core expressions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Truncated subtraction of core expressions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Strict comparison of core expressions, returning zero or one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Nonstrict comparison of core expressions, returning zero or one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equality comparison of core expressions, returning zero or one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Inequality comparison of core expressions, returning zero or one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Boolean conjunction of core expressions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Boolean disjunction of core expressions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An existing core statement named by an identifier.
Equations
- OrderMaintenance.Impl.CM.sId = Lean.ParserDescr.node `OrderMaintenance.Impl.CM.sId 1022 (Lean.ParserDescr.const `ident)
Instances For
An embedded Lean statement term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A grouped sequence of core statements.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Assignment to a local register named by an identifier.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Assignment to a register supplied as a Lean term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Allocation of a fresh core record with its index assigned to a local.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Assignment to an indexed core-record field.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Assignment to a core-array entry.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Assignment to a first or second component of a stored list entry.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Appending a pair to a stored core list.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Removing the last stored-list entry.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Clearing a stored core list.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Conditional execution of core statements.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A bounded core loop with a local counter.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Handling a recoverable core guard failure.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Assignment to a chunk ancestor-path entry.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A core statement constructor applied to expression arguments.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A named procedure call returning one local.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A named procedure call returning a tuple of locals.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A named procedure call without returned locals.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An embedded procedure call returning one local.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An embedded procedure call returning a tuple of locals.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An embedded procedure call without returned locals.
Equations
- One or more equations did not get rendered due to their size.
Instances For
ns.f for a field identifier f, or the embedded term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The single name component of an identifier, as a string.
Equations
- OrderMaintenance.Impl.CM.str x = { raw := (Lean.Syntax.mkStrLit x.getId.toString).raw }
Instances For
P.k and S.k: the table prefix and the field.
Equations
- OrderMaintenance.Impl.CM.dotted x = match x.getId with | (Lean.Name.anonymous.str p).str k => some (p, Lean.Name.mkSimple k) | x => none
Instances For
A list kind: an LK constructor, or else a Lean variable of type LK.
Equations
Instances For
Decode a list-component selector, rejecting names other than fst and snd.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Construct a core binary expression with the named machine primitive.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Count syntax nodes without depending on the non-executable SizeOf Syntax instance.
Equations
- One or more equations did not get rendered due to their size.
- OrderMaintenance.Impl.CM.syntaxWeight x✝ = 1
Instances For
Expand a core expression using structural syntax fuel.
Equations
- One or more equations did not get rendered due to their size.
- OrderMaintenance.Impl.CM.expandExpression 0 x✝ = Lean.Macro.throwErrorAt x✝ "invalid expression nesting"
Instances For
Expand an expression with a structural bound from its syntax tree.
Equations
Instances For
Expand a sequence of core-expression arguments.
Equations
- One or more equations did not get rendered due to their size.
Instances For
p.call [args] [dsts].
Equations
- One or more equations did not get rendered due to their size.
Instances For
Expand a statement sequence using structural syntax fuel.
Equations
- One or more equations did not get rendered due to their size.
- OrderMaintenance.Impl.CM.expandStatements 0 x✝ = Lean.Macro.throwError "invalid statement nesting"
Instances For
Expand one core statement using structural syntax fuel.
Equations
- One or more equations did not get rendered due to their size.
- OrderMaintenance.Impl.CM.expandStatement 0 x✝ = Lean.Macro.throwErrorAt x✝ "invalid statement nesting"
Instances For
Expand a statement sequence with a structural bound from its syntax tree.
Equations
- OrderMaintenance.Impl.CM.expSeq ss = OrderMaintenance.Impl.CM.expandStatements (Array.foldl (fun (total : ℕ) (s : Lean.Syntax) => total + OrderMaintenance.Impl.CM.syntaxWeight s) 1 ss) ss
Instances For
Expand a statement with a structural bound from its syntax tree.
Equations
Instances For
Surface notation embedding a core statement sequence as a Lean term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Surface notation embedding a core expression as a Lean term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Expand a complete core statement with fuel derived from its syntax tree.
Equations
- OrderMaintenance.Impl.CM.expandStm s = do let a ← OrderMaintenance.Impl.CM.expSeq s[1][0].getSepArgs pure a.raw
Instances For
Expand a complete core expression with fuel derived from its syntax tree.
Equations
- OrderMaintenance.Impl.CM.expandExp s = do let a ← OrderMaintenance.Impl.CM.expE s[1] pure a.raw