DSL for definition DRY #
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Arity of an expression.
Stolen from batteries.
Equations
- cvc5.forallArity (Lean.Expr.mdata data b) = cvc5.forallArity b
- cvc5.forallArity (Lean.Expr.forallE binderName binderType body binderInfo) = 1 + cvc5.forallArity body
- cvc5.forallArity x✝ = 0
Instances For
Equations
- cvc5.defsMod? = Lean.ParserDescr.node `cvc5.defsMod? 1024 (Lean.ParserDescr.symbol "?")
Instances For
Equations
- cvc5.defsMod! = Lean.ParserDescr.node `cvc5.defsMod! 1024 (Lean.ParserDescr.symbol "!")
Instances For
Equations
- cvc5.defsMod!? = Lean.ParserDescr.node `cvc5.defsMod!? 1024 (Lean.ParserDescr.symbol "!?")
Instances For
Equations
- cvc5.defsMod?! = Lean.ParserDescr.node `cvc5.defsMod?! 1024 (Lean.ParserDescr.symbol "?!")
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Defines similar functions realized by extern.
extern! in "prefix"
/-- Create a Boolean constant.
- `b`: The Boolean constant.
Will create an opaque definition with `[@extern extStr]` where
`extStr = "prefix" ++ "_" ++ "myFunction"`.
-/
def myFunction : Term → Except Error Op
with!?
endsWithBang!
endWithQuestion?
with
myOtherFunction : Term → Op :=
Error.unwrap! ∘ myFunction
/-- Optional function docstring: if none, inherit from the main function. -/
yetAnotherFunction : Term → Option Op :=
Except.toOption ∘ myFunction
in "prefix"is optional; if none, then the prefix will be the (last component of the) name of the current namespace with the first letter lowercased. Fails if the current namespace has no components.with ...: takes a sequence of identifiers, each generate a function that- unwraps the result if
!-ended, which generates code similar tomyOtherFunctionabove; - turns a result into an option if
?-ended, which generates code similar toyetAnotherFunctionabove; - fails otherwise.
The
with ...syntax is currently only compatible with external functions that produceExcept Error αvalues.- unwraps the result if
Supports
declModifierson the main (def) functionmyFunctionsuch asprivate.Accepts a list of external (
def) functions, each with itswithclauses.
This macro can generate optional (?) and panic (!) wrappers even more automatically.
extern! "prefix"
/-- Create a Boolean constant.
- `b`: The Boolean constant.
Will create an opaque definition with `[@extern extStr]` where
`extStr = "prefix" ++ "_" ++ "myFunction"`.
-/
def !? myFunction : Term → Except Error Op
with
myOtherFunction : Term → Op :=
myFunction!
/-- Optional function docstring: if none, inherit from the main function. -/
yetAnotherFunction : Term → Option Op :=
myFunction?
Notice the !? between def and myFunction. This generates myFunction! and myFunction? which
respectively panic-unwrap errors and turn the Except into an Option. In other words, it is the
same as (and internally turned into) a with!? myFunction! myFunction? clause using the first
syntax above.
Besides !?, the following are also supported:
?!: same behavior as!?;!: only generate the panic unwrapper;?: only generate theOptionunwrapper.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Defines similar functions realized by extern.
extern! in "prefix"
/-- Create a Boolean constant.
- `b`: The Boolean constant.
Will create an opaque definition with `[@extern extStr]` where
`extStr = "prefix" ++ "_" ++ "myFunction"`.
-/
def myFunction : Term → Except Error Op
with!?
endsWithBang!
endWithQuestion?
with
myOtherFunction : Term → Op :=
Error.unwrap! ∘ myFunction
/-- Optional function docstring: if none, inherit from the main function. -/
yetAnotherFunction : Term → Option Op :=
Except.toOption ∘ myFunction
in "prefix"is optional; if none, then the prefix will be the (last component of the) name of the current namespace with the first letter lowercased. Fails if the current namespace has no components.with ...: takes a sequence of identifiers, each generate a function that- unwraps the result if
!-ended, which generates code similar tomyOtherFunctionabove; - turns a result into an option if
?-ended, which generates code similar toyetAnotherFunctionabove; - fails otherwise.
The
with ...syntax is currently only compatible with external functions that produceExcept Error αvalues.- unwraps the result if
Supports
declModifierson the main (def) functionmyFunctionsuch asprivate.Accepts a list of external (
def) functions, each with itswithclauses.
This macro can generate optional (?) and panic (!) wrappers even more automatically.
extern! "prefix"
/-- Create a Boolean constant.
- `b`: The Boolean constant.
Will create an opaque definition with `[@extern extStr]` where
`extStr = "prefix" ++ "_" ++ "myFunction"`.
-/
def !? myFunction : Term → Except Error Op
with
myOtherFunction : Term → Op :=
myFunction!
/-- Optional function docstring: if none, inherit from the main function. -/
yetAnotherFunction : Term → Option Op :=
myFunction?
Notice the !? between def and myFunction. This generates myFunction! and myFunction? which
respectively panic-unwrap errors and turn the Except into an Option. In other words, it is the
same as (and internally turned into) a with!? myFunction! myFunction? clause using the first
syntax above.
Besides !?, the following are also supported:
?!: same behavior as!?;!: only generate the panic unwrapper;?: only generate theOptionunwrapper.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Defines an external, opaque function with optional helpers.
/-- Some documentation. -/
extern_def!? in "prefix" myFunction : Term → Except Error Op
Generates an opaque definition
/-- Some documentation. -/
@[extern "prefix_myFunction"]
def myFunction : Term → Except Error Op
in "prefix"is optional, uses the current namespace with first letter lowercased if none.extern_def!?also definesmyFunction! : Term → OpandmyFunction? : Term → Option Opin terms ofmyFunction.Other variants exist:
extern_def?!: same asextern_def!?;extern_def?: only definesmyFunction?;extern_def!: only definesmyFunction!;extern_def: defines nothing besidesmyFunction.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Defines an external, opaque function with optional helpers.
/-- Some documentation. -/
extern_def!? in "prefix" myFunction : Term → Except Error Op
Generates an opaque definition
/-- Some documentation. -/
@[extern "prefix_myFunction"]
def myFunction : Term → Except Error Op
in "prefix"is optional, uses the current namespace with first letter lowercased if none.extern_def!?also definesmyFunction! : Term → OpandmyFunction? : Term → Option Opin terms ofmyFunction.Other variants exist:
extern_def?!: same asextern_def!?;extern_def?: only definesmyFunction?;extern_def!: only definesmyFunction!;extern_def: defines nothing besidesmyFunction.
Equations
- One or more equations did not get rendered due to their size.