Documentation

Init.Meta

@[extern lean_get_githash]
@[extern c inline "LEAN_VERSION_IS_RELEASE"]
@[extern c inline "lean_mk_string(LEAN_SPECIAL_VERSION_DESC)"]

Additional version description like "nightly-2018-03-11"

Equations
  • One or more equations did not get rendered due to their size.
Equations
Equations
  • One or more equations did not get rendered due to their size.
@[extern c inline "LEAN_IS_STAGE0"]

Valid identifier names

Equations
Equations
  • One or more equations did not get rendered due to their size.
Equations
Equations
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations
  • One or more equations did not get rendered due to their size.
Equations

eraseSuffix? n s return n' if n is of the form n == n' ++ s.

@[inline]

Remove macros scopes, apply f, and put them back

Equations
  • One or more equations did not get rendered due to their size.
@[export lean_name_append_after]
Equations
@[export lean_name_append_index_after]
Equations
  • One or more equations did not get rendered due to their size.
@[export lean_name_append_before]
Equations
  • One or more equations did not get rendered due to their size.
theorem Lean.Name.beq_iff_eq {m : Lean.Name} {n : Lean.Name} :
(m == n) = true m = n
Equations
Instances For
    Equations
    @[inline]
    Equations
    @[inline]
    Equations
    Instances
      def Lean.mkFreshId {m : TypeType} [inst : Monad m] [inst : Lean.MonadNameGenerator m] :
      Equations
      Equations
      Equations
      • Lean.Syntax.instReprTSyntax = { reprPrec := Lean.Syntax.reprTSyntax✝ }
      @[inline]
      Equations
      @[inline]
      Equations
      @[inline]
      Equations
      @[inline]
      Equations
      Equations
      • Lean.TSyntax.instCoeTSyntaxConsSyntaxNodeKindNil = { coe := fun stx => { raw := stx.raw } }
      Equations
      • Lean.TSyntax.instCoeTSyntaxConsSyntaxNodeKind = { coe := fun stx => { raw := stx.raw } }
      Equations
      Equations
      • Lean.TSyntax.instCoeDepTermMkConsSyntaxNodeKindMkStr1NilIdentIdent = { coe := { raw := Lean.Syntax.ident info ss n res } }
      Equations
      Equations
      Equations
      Equations
      Equations
      • Lean.TSyntax.Compat.instCoeTailSyntaxTSyntax = { coe := fun s => { raw := s } }
      Equations
      • Lean.TSyntax.Compat.instCoeTailArraySyntaxTSyntaxArray = { coe := Lean.TSyntaxArray.mk }

      Compare syntax structures modulo source info.

      Equations
      • Lean.Syntax.instBEqTSyntax = { beq := fun x x_1 => x.raw == x_1.raw }
      Equations

      Return substring of original input covering stx. Result is meaningful only if all involved SourceInfo.originals refer to the same string (as is the case after parsing).

      Equations
      • One or more equations did not get rendered due to their size.
      Equations
      Equations
      • One or more equations did not get rendered due to their size.
      Equations
      Equations
      • One or more equations did not get rendered due to their size.

      Return the first atom/identifier that has position information

      Ensure head position is synthetic. The server regards syntax as "original" only if both head and tail info are original.

      Equations
      @[inline]
      def Lean.withHeadRefOnly {m : TypeType} [inst : Monad m] [inst : Lean.MonadRef m] {α : Type} (x : m α) :
      m α

      Use the head atom/identifier of the current ref as the ref

      Equations
      structure Lean.Module :

      Syntax objects for a Lean module.

      Instances For
        partial def Lean.expandMacros (stx : Lean.Syntax) (p : optParam (Lean.SyntaxNodeKindBool) fun k => k != `Lean.Parser.Term.byTactic) :

        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.

        Equations
        def Lean.mkIdentFromRef {m : TypeType} [inst : Monad m] [inst : Lean.MonadRef m] (val : Lean.Name) (canonical : optParam Bool false) :
        Equations

        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.

        Equations
        • One or more equations did not get rendered due to their size.
        def Lean.mkCIdentFromRef {m : TypeType} [inst : Monad m] [inst : Lean.MonadRef m] (c : Lean.Name) (canonical : optParam Bool false) :
        Equations
        @[export lean_mk_syntax_ident]
        Equations
        Equations
        • One or more equations did not get rendered due to their size.
        Equations
        Equations
        Equations
        def Lean.Syntax.SepArray.ofElemsUsingRef {m : TypeType} [inst : Monad m] [inst : Lean.MonadRef m] {sep : String} (elems : Array Lean.Syntax) :
        Equations
        • One or more equations did not get rendered due to their size.
        Equations
        • Lean.Syntax.instCoeArraySyntaxSepArray = { coe := Lean.Syntax.SepArray.ofElems }
        Equations

        Create syntax representing a Lean term application, but avoid degenerate empty applications.

        Equations
        Equations
        Equations

        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.

        Equations
        • One or more equations did not get rendered due to their size.
        Equations
        • One or more equations did not get rendered due to their size.

        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.

        Equations
        • One or more equations did not get rendered due to their size.
        partial def Lean.Syntax.decodeScientificLitVal?.decodeAfterExp (s : String) (i : String.Pos) (val : Nat) (e : Nat) (sign : Bool) (exp : Nat) :
        Equations
        • One or more equations did not get rendered due to their size.
        Equations
        Equations
        Equations
        • One or more equations did not get rendered due to their size.
        Equations
        • One or more equations did not get rendered due to their size.

        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 [].

        Equations
        Equations
        • One or more equations did not get rendered due to their size.
        Equations
        Equations
        Equations
        Equations
        Equations
        class Lean.Quote (α : Type) (k : optParam Lean.SyntaxNodeKind `term) :

        Reflect a runtime datum back to surface syntax (best-effort).

        Instances
          instance Lean.instQuote {α : Type} {k : Lean.SyntaxNodeKind} {k' : Lean.SyntaxNodeKind} [inst : Lean.Quote α k] [inst : CoeHTCT (Lean.TSyntax k) (Lean.TSyntax k')] :
          Equations
          Equations
          Equations
          • One or more equations did not get rendered due to their size.
          instance Lean.instQuoteProdMkStr1 {α : Type} {β : Type} [inst : Lean.Quote α] [inst : Lean.Quote β] :
          Lean.Quote (α × β)
          Equations
          instance Lean.instQuoteListMkStr1 {α : Type} [inst : Lean.Quote α] :
          Equations
          instance Lean.instQuoteArrayMkStr1 {α : Type} [inst : Lean.Quote α] :
          Equations
          instance Lean.Option.hasQuote {α : Type} [inst : Lean.Quote α] :
          Equations
          • One or more equations did not get rendered due to their size.

          Evaluator for prec DSL

          Equations
          • One or more equations did not get rendered due to their size.

          Evaluator for prio DSL

          Equations
          • One or more equations did not get rendered due to their size.
          Equations
          @[inline]
          abbrev Array.getSepElems {α : Type u_1} (as : Array α) :
          Equations
          Equations
          • One or more equations did not get rendered due to their size.
          Equations
          • Lean.Syntax.instEmptyCollectionSepArray = { emptyCollection := { elemsAndSeps := } }
          Equations
          • Lean.Syntax.instEmptyCollectionTSepArray = { emptyCollection := { elemsAndSeps := } }
          Equations
          • Lean.Syntax.instCoeOutSepArrayArraySyntax = { coe := Lean.Syntax.SepArray.getElems }
          Equations
          • Lean.Syntax.instCoeOutTSepArrayTSyntaxArray = { coe := Lean.Syntax.TSepArray.getElems }
          Equations
          • Lean.Syntax.instCoeTSyntaxArray = { coe := fun a => Array.map Coe.coe a }
          Equations
          Equations
          @[inline]
          abbrev autoParam (α : Sort u) (tactic : Lean.Syntax) :

          Gadget for automatic parameter support. This is similar to the optParam gadget, but it uses the given tactic. Like optParam, this gadget only affects elaboration. For example, the tactic will not be invoked during type class resolution.

          Equations

          Helper functions for manipulating interpolated strings #

          Equations
          • One or more equations did not get rendered due to their size.
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            Instances For
              Equations
              • One or more equations did not get rendered due to their size.
              • maxSteps : Nat
              • maxDischargeDepth : Nat
              • contextual : Bool
              • memoize : Bool
              • singlePass : Bool
              • zeta : Bool
              • beta : Bool
              • eta : Bool
              • iota : Bool
              • proj : Bool
              • decide : Bool
              • arith : Bool
              • autoUnfold : Bool
              • If dsimp := true, then switches to dsimp on dependent arguments where there is no congruence theorem that allows simp to visit them. If dsimp := false, then argument is not visited.

                dsimp : Bool
              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Equations
                • One or more equations did not get rendered due to their size.
                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).

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Equations
                  • One or more equations did not get rendered due to their size.

                  simp! is shorthand for simp with autoUnfold := true. This will rewrite with all equation lemmas, which can be used to partially evaluate many definitions.

                  Equations
                  • One or more equations did not get rendered due to their size.

                  simp_arith is shorthand for simp with arith := true. This enables the use of normalization by linear arithmetic.

                  Equations
                  • One or more equations did not get rendered due to their size.

                  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.

                  Equations
                  • One or more equations did not get rendered due to their size.

                  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.

                  Equations
                  • One or more equations did not get rendered due to their size.

                  simp_all_arith combines the effects of simp_all and simp_arith.

                  Equations
                  • One or more equations did not get rendered due to their size.

                  simp_all_arith! combines the effects of simp_all, simp_arith and simp!.

                  Equations
                  • One or more equations did not get rendered due to their size.

                  dsimp! is shorthand for dsimp with autoUnfold := true. This will rewrite with all equation lemmas, which can be used to partially evaluate many definitions.

                  Equations
                  • One or more equations did not get rendered due to their size.