The #do command #
The #do command is like run_cmd but allows using variables from previous uses of #do.
Furthermore, #do_meta is like #do and shares its variable state while operating in MetaM.
Finally, #clear_do can be used to remove all variables from the current do state.
The part of the DoCommandExtensionState used for monad state
- metaState : Lean.Meta.State
The meta state used for
#do_meta
Instances For
The state for #do
- lctx : Lean.LocalContext
The current local context for
#do.Invariant:
lctxdoes not contain metavariables or level parameters or non-dependentldecls. - localInstances : Lean.LocalInstances
The local instances for
lctx - values : Lean.FVarIdMap NonScalar
- mutVars : Array Lean.Elab.Do.MutVar
- mutVarDefs : Std.HashMap Lean.Name Lean.Elab.Do.MutVar
- monadState : MonadStateStack
Monad state for use in e.g.
#do_meta
Instances For
The extension for #do
Implementation detail of #do
Equations
Instances For
Implementation detail of #do
Equations
- vs.getValueLetImpl i _v = unsafeCast vs[i]
Instances For
Implementation detail of #do
Equations
- _vs.getValueLet _i v = v
Instances For
Implementation detail of #do
Equations
Instances For
Given value : type which may depend on free variables in state.lctx, evaluates it to a value
of type α (assuming type is equivalent to α).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Implementation detail of #do
- newFVars : Array Lean.FVarId
All new free variables in the order they are stored in the resulting array
- newState : DoCommandExtensionState
The new state, with updated local context and mutable variables
Instances For
Monad-generic version of the #do command
Equations
- One or more equations did not get rendered due to their size.
Instances For
#do code runs code with access to all variables from previous #do (and #do_meta)
invocations. Example:
#do let x ← IO.rand 0 100
-- these will both print the same number
#do IO.println x
#do IO.println x
This command can be used to run expensive computations once and refer to them later.
For #do, the body is run in the CommandElabM monad. For an alternative where computations run
in MetaM, use #do_meta.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An alternative to #do that doesn't check for sorrys
Equations
- One or more equations did not get rendered due to their size.
Instances For
#do code runs code with access to all variables from previous #do (and #do_meta)
invocations. Example:
#do let x ← IO.rand 0 100
-- these will both print the same number
#do IO.println x
#do IO.println x
This command can be used to run expensive computations once and refer to them later.
For #do, the body is run in the CommandElabM monad. For an alternative where computations run
in MetaM, use #do_meta.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An alternative to #do that doesn't check for sorrys
Equations
- One or more equations did not get rendered due to their size.
Instances For
#do_meta code runs code with access to all variables from previous #do and #do_meta
invocations in the MetaM monad. Example:
#do_meta let x ← IO.rand 0 100
-- these will both print the same number
#do_meta IO.println x
#do_meta IO.println x
This command can be used to run expensive computations once and refer to them later.
For an alternative where computations run in CommandElabM, use #do.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An alternative to #do_meta that doesn't check for sorrys
Equations
- One or more equations did not get rendered due to their size.
Instances For
#do_meta code runs code with access to all variables from previous #do and #do_meta
invocations in the MetaM monad. Example:
#do_meta let x ← IO.rand 0 100
-- these will both print the same number
#do_meta IO.println x
#do_meta IO.println x
This command can be used to run expensive computations once and refer to them later.
For an alternative where computations run in CommandElabM, use #do.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An alternative to #do_meta that doesn't check for sorrys
Equations
- One or more equations did not get rendered due to their size.
Instances For
Clears all variables from the current #do context.
Equations
- Batteries.Tactic.DoCommand.«command#clear_do» = Lean.ParserDescr.node `Batteries.Tactic.DoCommand.«command#clear_do» 1024 (Lean.ParserDescr.symbol "#clear_do")