The smt! term DSL #
smt! writes a term in notation close to Lean's own — smt! i + 2 * j ≤ k ∧ ¬ b — and builds it
in Env. smtU! builds a sort-erased term and smtT! a typed one; open Cvc.Untyped or
open Cvc.Typed makes smt! stand for the matching one.
This module declares the forms that belong to no theory: parentheses, ![e] to splice a Lean term,
identifiers, application f a b, let x ← t; u and fun (x : s) => t. Every other form —
literals, operators, if, match, quantifiers — is declared by the theory module it belongs to, so
smt! accepts exactly the notations of the theories imported.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Parenthesized SMT term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Escape back into Lean: ![e] splices the Lean term e, which must be an Env-term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An identifier denotes an already-built term, lifted with pure.
Equations
- Cvc.smtIdent = Lean.ParserDescr.node `Cvc.smtIdent 1024 (Lean.ParserDescr.const `ident)
Instances For
let x ← t; u binds the term t to x in u.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Function application, f arg₁ arg₂ …, spelled as Lean spells it.
f i b applies f to two arguments, and a new line at or left of the application's column is not
read as one more argument. if, let, match and every operator need parentheses to be an
argument, exactly as in Lean.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Binders #
A lambda and a quantifier bind their variables the way Lean's do, in parentheses with a sort after
the colon: (x y : s). Sort-erased, the sort is a Lean type (Int) or a Srt value (int);
typed, it is the Lean type indexing the variable.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Binders of an smt! lambda or quantifier.
Equations
Instances For
Variables sharing a sort: (x y : s).
Equations
- One or more equations did not get rendered due to their size.
Instances For
A lambda, fun (x y : s) => body, spelled as Lean spells it.
The body extends as far right as it can, as in Lean, so a lambda in argument position needs parentheses. cvc5 prints the variables under the names written.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Expands one smtTerm of the layer whose root is named, deferring its sub-terms to itself.
This is the DSL's dispatch: each theory adds the expansion of its own forms as a macro_rules
alternative for it, tried before those of the modules it imports.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An identifier leaf of the layer whose root is named, elaborated by Cvc.Ext.elabSmtIdent.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Builds a sort-erased term in Env from smt! notation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Builds a typed term in Env from smt! notation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The expander #
The DSL's own machinery, used by the theory modules to declare their forms.
The layer an smt! expansion targets.
- root : Lean.Name
The layer's own namespace, holding what is not a term constructor.
Instances For
Equations
Equations
Equations
- Cvc.Ext.instBEqLayer.beq { root := a } { root := b } = (a == b)
- Cvc.Ext.instBEqLayer.beq x✝¹ x✝ = false
Instances For
The layer a smtExpand% node names.
Equations
- Cvc.Ext.Layer.ofIdent id = { root := Lean.TSyntax.getId id }
Instances For
The identifier naming this layer in a smtExpand% node.
Equations
- layer.ident = Lean.mkIdent layer.root
Instances For
The identifier of an operator of this layer.
Equations
- layer.op id = Lean.mkIdent (layer.ops ++ id)
Instances For
The identifier of a declaration of this layer that is not a term constructor.
Equations
- layer.name id = Lean.mkIdent (layer.root ++ id)
Instances For
Decomposes a generated operator node kind into its shape and operator name.
Grammar rules are named …smtOp.<shape>.<id>, so the trailing three components identify the
operator regardless of the namespace the rule was generated in.
Equations
- Cvc.Ext.smtOpKind? (((pre.str "smtOp").str shape).str id) = some (Lean.Name.mkSimple shape, Lean.Name.mkSimple id)
- Cvc.Ext.smtOpKind? x✝ = none
Instances For
Name of the n-ary function of an operator, <id>N.
Equations
- Cvc.Ext.naryIdOf id = id.appendAfter "N"
Instances For
Binds every argument in order, then applies mk to the identifiers they were bound to.
Binder names are macro-scoped, so they cannot capture user identifiers. Two calls in one expansion
produce the same binder names, macro scopes and all, so a nested one shadows what the outer
bound. binder is what tells them apart where that matters.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A macro-scoped identifier, for a name the expansion binds but the writer never sees.
Equations
- Cvc.Ext.freshId base = do let __do_lift ← Lean.MonadQuotation.addMacroScope (Lean.Name.mkSimple base) pure (Lean.mkIdent __do_lift)
Instances For
A sub-term's expansion, deferred to smtExpand% so that a theory's forms can be reached.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Expands one smtTerm node into a term of the given layer.
Operator nodes are dispatched by kind; everything else is a fixed form declared above. Sub-terms
are not expanded here — they go back through smtExpand%, so a form this module does not know
can still occur inside one it does.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Whether a type is one of the layers' terms, or what converts to one.
This is where a dotted identifier stops being a Lean projection and starts reading record fields.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The conversion to a term of a typed non-terminal's, bound variable's or state symbol's type.
A state symbol is a Symbols.At, whose get answers the term it wraps when the wrap is the
layer's terms, as it is wherever smt! meets one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Elaborates an identifier leaf: the term it names, lifted with pure.
Typed, a non-terminal, a bound variable or a state symbol (Symbols.At) is converted to its term,
at the index its own type carries, so smt! n * m works over two non-terminals with nothing else
fixing the index. Anything else is elaborated exactly as written. Not only identifiers come through
here: a field projection on a Lean value does too.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An identifier leaf of the layer whose root is named, elaborated by Cvc.Ext.elabSmtIdent.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The variables of a lambda's or quantifier's binders, in order, each with its written sort.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The name cvc5 gives a bound variable: the one the writer gave it.