Documentation

Init.Meta

Instances For
    Instances For
      Instances For
        @[extern lean_get_githash]
        Instances For
          @[extern lean_version_get_is_release]
          @[extern lean_version_get_special_desc]

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

          Instances For
            Instances For
              @[extern lean_internal_is_stage0]

              Valid identifier names

              Instances For
                Instances For
                  Instances For
                    Instances For
                      Instances For
                        Instances For
                          Instances For
                            Instances For
                              Instances For
                                Instances For
                                  Instances For
                                    Equations
                                    Instances For

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

                                      Instances For
                                        @[inline]

                                        Remove macros scopes, apply f, and put them back

                                        Instances For
                                          @[export lean_name_append_after]
                                          Instances For
                                            @[export lean_name_append_index_after]
                                            Instances For
                                              @[export lean_name_append_before]
                                              Instances For
                                                theorem Lean.Name.beq_iff_eq {m : Lake.Name} {n : Lake.Name} :
                                                (m == n) = true m = n
                                                Instances For
                                                  Instances
                                                    @[inline, reducible]
                                                    Instances For
                                                      @[inline, reducible]
                                                      Instances For
                                                        @[inline, reducible]
                                                        Instances For
                                                          @[inline, reducible]
                                                          Instances For
                                                            @[inline, reducible]
                                                            Instances For
                                                              @[inline, reducible]
                                                              Instances For
                                                                @[inline, reducible]
                                                                Instances For
                                                                  @[inline, reducible]
                                                                  Instances For
                                                                    @[inline, reducible]
                                                                    Instances For
                                                                      @[inline, reducible]
                                                                      Instances For
                                                                        @[inline, reducible]
                                                                        Instances For
                                                                          @[inline, reducible]
                                                                          Instances For
                                                                            @[inline, reducible]
                                                                            Instances For

                                                                              Compare syntax structures modulo source info.

                                                                              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).

                                                                              Instances For

                                                                                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.

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

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

                                                                                  Instances For
                                                                                    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.

                                                                                      Instances For
                                                                                        def Lean.mkIdentFromRef {m : TypeType} [Monad m] [Lean.MonadRef m] (val : Lake.Name) (canonical : optParam Bool false) :
                                                                                        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
                                                                                                @[export lean_mk_syntax_ident]
                                                                                                Instances For
                                                                                                  @[inline]
                                                                                                  Instances For
                                                                                                    Instances For

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

                                                                                                      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.

                                                                                                          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
                                                                                                            partial def Lean.Syntax.decodeScientificLitVal?.decodeAfterExp (s : String) (i : String.Pos) (val : Nat) (e : Nat) (sign : Bool) (exp : Nat) :
                                                                                                            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
                                                                                                                      Instances For
                                                                                                                        class Lean.Quote (α : Type) (k : optParam Lean.SyntaxNodeKind `term) :

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

                                                                                                                        Instances
                                                                                                                          Equations
                                                                                                                          Instances For
                                                                                                                            instance Lean.instQuoteProdMkStr1 {α : Type} {β : Type} [Lean.Quote α] [Lean.Quote β] :
                                                                                                                            Lean.Quote (α × β)

                                                                                                                            Evaluator for prec DSL

                                                                                                                            Instances For

                                                                                                                              Evaluator for prio DSL

                                                                                                                              Instances For
                                                                                                                                @[inline, reducible]
                                                                                                                                abbrev Array.getSepElems {α : Type u_1} (as : Array α) :
                                                                                                                                Instances For
                                                                                                                                  Instances For
                                                                                                                                    Instances For
                                                                                                                                      @[inline, reducible]
                                                                                                                                      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.

                                                                                                                                      Instances For

                                                                                                                                        Helper functions for manipulating interpolated strings #

                                                                                                                                        Instances For
                                                                                                                                          Instances For
                                                                                                                                            Instances For
                                                                                                                                              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.

                                                                                                                                                              Instances For