Additional version description like "nightly-2018-03-11"
Equations
- Lean.Name.getRoot Lean.Name.anonymous = Lean.Name.anonymous
- Lean.Name.getRoot (Lean.Name.str Lean.Name.anonymous str) = Lean.Name.str Lean.Name.anonymous str
- Lean.Name.getRoot (Lean.Name.num Lean.Name.anonymous i) = Lean.Name.num Lean.Name.anonymous i
- Lean.Name.getRoot (Lean.Name.str n str) = Lean.Name.getRoot n
- Lean.Name.getRoot (Lean.Name.num n i) = Lean.Name.getRoot n
Instances For
Equations
- Lean.Name.isInaccessibleUserName (Lean.Name.str pre s) = (String.contains s (Char.ofNat 10013) || s == "_inaccessible")
- Lean.Name.isInaccessibleUserName (Lean.Name.num p i) = Lean.Name.isInaccessibleUserName p
- Lean.Name.isInaccessibleUserName x = false
Instances For
Equations
- Lean.Name.toStringWithSep sep escape Lean.Name.anonymous = "[anonymous]"
- Lean.Name.toStringWithSep sep escape (Lean.Name.str Lean.Name.anonymous s) = Lean.Name.toStringWithSep.maybeEscape escape s
- Lean.Name.toStringWithSep sep escape (Lean.Name.num Lean.Name.anonymous v) = toString v
- Lean.Name.toStringWithSep sep escape (Lean.Name.str n s) = Lean.Name.toStringWithSep sep escape n ++ sep ++ Lean.Name.toStringWithSep.maybeEscape escape s
- Lean.Name.toStringWithSep sep escape (Lean.Name.num n v) = Lean.Name.toStringWithSep sep escape n ++ sep ++ Nat.repr v
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Lean.Name.reprPrec Lean.Name.anonymous prec = Std.Format.text "Lean.Name.anonymous"
- Lean.Name.reprPrec (Lean.Name.num pre i) prec = Repr.addAppParen (Std.Format.text "Lean.Name.mkNum " ++ Lean.Name.reprPrec pre 1024 ++ Std.Format.text " " ++ repr i) prec
Instances For
Equations
- Lean.Name.replacePrefix Lean.Name.anonymous Lean.Name.anonymous x = x
- Lean.Name.replacePrefix Lean.Name.anonymous x x = Lean.Name.anonymous
- Lean.Name.replacePrefix (Lean.Name.str p s) x x = if (Lean.Name.str p s == x) = true then x else Lean.Name.mkStr (Lean.Name.replacePrefix p x x) s
- Lean.Name.replacePrefix (Lean.Name.num p s) x x = if (Lean.Name.num p s == x) = true then x else Lean.Name.mkNum (Lean.Name.replacePrefix p x x) s
Instances For
eraseSuffix? n s
return n'
if n
is of the form n == n' ++ s
.
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
- getNGen : m Lean.NameGenerator
- setNGen : Lean.NameGenerator → m Unit
Instances
Instances For
Instances For
Instances For
Compare syntax structures modulo source info.
Return substring of original input covering stx
.
Result is meaningful only if all involved SourceInfo.original
s refer to the same string (as is the case after parsing).
Instances For
Instances For
Instances For
Return the first atom/identifier that has position information
Instances For
Ensure head position is synthetic. The server regards syntax as "original" only if both head and tail info are original
.
Instances For
Use the head atom/identifier of the current ref
as the ref
Instances For
Expand macros in the given syntax.
A node with kind k
is visited only if p k
is true.
Note that the default value for p
returns false for by ...
nodes.
This is a "hack". The tactic framework abuses the macro system to implement extensible tactics.
For example, one can define
syntax "my_trivial" : tactic -- extensible tactic
macro_rules | `(tactic| my_trivial) => `(tactic| decide)
macro_rules | `(tactic| my_trivial) => `(tactic| assumption)
When the tactic evaluator finds the tactic my_trivial
, it tries to evaluate the macro_rule
expansions
until one "works", i.e., the macro expansion is evaluated without producing an exception.
We say this solution is a bit hackish because the term elaborator may invoke expandMacros
with (p := fun _ => true)
,
and expand the tactic macros as just macros. In the example above, my_trivial
would be replaced with assumption
,
decide
would not be tried if assumption
fails at tactic evaluation time.
We are considering two possible solutions for this issue: 1- A proper extensible tactic feature that does not rely on the macro system.
2- Typed macros that know the syntax categories they're working in. Then, we would be able to select which
syntatic categories are expanded by expandMacros
.
Helper functions for processing Syntax programmatically #
Create an identifier copying the position from src
.
To refer to a specific constant, use mkCIdentFrom
instead.
Instances For
Instances For
Create an identifier referring to a constant c
copying the position from src
.
This variant of mkIdentFrom
makes sure that the identifier cannot accidentally
be captured.
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Create syntax representing a Lean term application, but avoid degenerate empty applications.
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Recall that we don't have special Syntax constructors for storing numeric and string atoms.
The idea is to have an extensible approach where embedded DSLs may have new kind of atoms and/or
different ways of representing them. So, our atoms contain just the parsed string.
The main Lean parser uses the kind numLitKind
for storing natural numbers that can be encoded
in binary, octal, decimal and hexadecimal format. isNatLit
implements a "decoder"
for Syntax objects representing these numerals.
Instances For
Decodes a 'scientific number' string which is consumed by the OfScientific
class.
Takes as input a string such as 123
, 123.456e7
and returns a triple (n, sign, e)
with value given by
n * 10^-e
if sign
else n * 10^e
.
Instances For
Instances For
Split a name literal (without the backtick) into its dot-separated components. For example,
foo.bla.«bo.o»
↦ ["foo", "bla", "«bo.o»"]
. If the literal cannot be parsed, return []
.
Instances For
Instances For
Instances For
Instances For
Equations
- Lean.quoteNameMk Lean.Name.anonymous = { raw := (Lean.mkCIdent `Lean.Name.anonymous).raw }
- Lean.quoteNameMk (Lean.Name.str p s) = Lean.Syntax.mkCApp `Lean.Name.mkStr #[Lean.quoteNameMk p, Lean.quote `term s]
- Lean.quoteNameMk (Lean.Name.num p n) = Lean.Syntax.mkCApp `Lean.Name.mkNum #[Lean.quoteNameMk p, Lean.quote `term n]
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Helper functions for manipulating interpolated strings #
Instances For
Instances For
- all: Lean.Meta.TransparencyMode
- default: Lean.Meta.TransparencyMode
- reducible: Lean.Meta.TransparencyMode
- instances: Lean.Meta.TransparencyMode
Instances For
- all: Lean.Meta.EtaStructMode
Enable eta for structure and classes.
- notClasses: Lean.Meta.EtaStructMode
Enable eta only for structures that are not classes.
- none: Lean.Meta.EtaStructMode
Disable eta for structures and classes.
Instances For
- maxSteps : Nat
- maxDischargeDepth : Nat
- contextual : Bool
- memoize : Bool
- singlePass : Bool
- zeta : Bool
- beta : Bool
- eta : Bool
- etaStruct : Lean.Meta.EtaStructMode
- iota : Bool
- proj : Bool
- decide : Bool
- arith : Bool
- autoUnfold : Bool
- dsimp : Bool
- failIfUnchanged : Bool
If
failIfUnchanged := true
, then calls tosimp
,dsimp
, orsimp_all
will fail if they do not make progress.
Instances For
- all: Lean.Meta.Occurrences
- pos: List Nat → Lean.Meta.Occurrences
- neg: List Nat → Lean.Meta.Occurrences
Instances For
- transparency : Lean.Meta.TransparencyMode
- offsetCnstrs : Bool
- occs : Lean.Meta.Occurrences
Instances For
erw [rules]
is a shorthand for rw (config := { transparency := .default }) [rules]
.
This does rewriting up to unfolding of regular definitions (by comparison to regular rw
which only unfolds @[reducible]
definitions).
Instances For
simp!
is shorthand for simp
with autoUnfold := true
.
This will rewrite with all equation lemmas, which can be used to
partially evaluate many definitions.
Instances For
simp_arith
is shorthand for simp
with arith := true
.
This enables the use of normalization by linear arithmetic.
Instances For
simp_arith!
is shorthand for simp_arith
with autoUnfold := true
.
This will rewrite with all equation lemmas, which can be used to
partially evaluate many definitions.
Instances For
simp_all!
is shorthand for simp_all
with autoUnfold := true
.
This will rewrite with all equation lemmas, which can be used to
partially evaluate many definitions.
Instances For
simp_all_arith
combines the effects of simp_all
and simp_arith
.
Instances For
simp_all_arith!
combines the effects of simp_all
, simp_arith
and simp!
.
Instances For
dsimp!
is shorthand for dsimp
with autoUnfold := true
.
This will rewrite with all equation lemmas, which can be used to
partially evaluate many definitions.