Documentation

Lean.Expr

inductive Lean.Literal :

Literal values for Expr.

Instances For
    Equations
    Instances For

      Total order on Expr literal values. Natural number values are smaller than string literal values.

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

        Arguments in forallE binders can be labelled as implicit or explicit.

        Each lam or forallE binder comes with a binderInfo argument (stored in ExprData). This can be set to

        • default -- (x : α)
        • implicit -- {x : α}
        • strict_implicit -- ⦃x : α⦄
        • inst_implicit -- [x : α].
        • aux_decl -- Auxillary definitions are helper methods that Lean generates. aux_decl is used for _match, _fun_match, _let_match and the self reference that appears in recursive pattern matching.

        The difference between implicit {} and strict-implicit ⦃⦄ is how implicit arguments are treated that are not followed by explicit arguments. {} arguments are applied eagerly, while ⦃⦄ arguments are left partially applied:

        def foo {x : Nat} : Nat := x
        def bar ⦃x : Nat⦄ : Nat := x
        #check foo -- foo : Nat
        #check bar -- bar : ⦃x : Nat⦄ → Nat
        

        See also the Lean manual: https://lean-lang.org/lean4/doc/expressions.html#implicit-arguments

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

            Return true if the given BinderInfo does not correspond to an implicit binder annotation (i.e., implicit, strictImplicit, or instImplicit).

            Equations
            Instances For

              Return true if the given BinderInfo is an instance implicit annotation (e.g., [Decidable α])

              Equations
              Instances For

                Return true if the given BinderInfo is a regular implicit annotation (e.g., {α : Type u})

                Equations
                Instances For

                  Return true if the given BinderInfo is a strict implicit annotation (e.g., {{α : Type u}})

                  Equations
                  Instances For
                    @[inline, reducible]

                    Expression metadata. Used with the Expr.mdata constructor.

                    Equations
                    Instances For
                      @[inline, reducible]
                      Equations
                      Instances For

                        Cached hash code, cached results, and other data for Expr.

                        • hash : 32-bits
                        • approxDepth : 8-bits -- the approximate depth is used to minimize the number of hash collisions
                        • hasFVar : 1-bit -- does it contain free variables?
                        • hasExprMVar : 1-bit -- does it contain metavariables?
                        • hasLevelMVar : 1-bit -- does it contain level metavariables?
                        • hasLevelParam : 1-bit -- does it contain level parameters?
                        • looseBVarRange : 20-bits

                        Remark: this is mostly an internal datastructure used to implement Expr, most will never have to use it.

                        Equations
                        Instances For
                          Equations
                          def Lean.Expr.mkData (h : UInt64) (looseBVarRange : optParam Nat 0) (approxDepth : optParam UInt32 0) (hasFVar : optParam Bool false) (hasExprMVar : optParam Bool false) (hasLevelMVar : optParam Bool false) (hasLevelParam : optParam Bool false) :
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            @[inline]

                            Optimized version of Expr.mkData for applications.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              @[inline]
                              def Lean.Expr.mkDataForBinder (h : UInt64) (looseBVarRange : Nat) (approxDepth : UInt32) (hasFVar : Bool) (hasExprMVar : Bool) (hasLevelMVar : Bool) (hasLevelParam : Bool) :
                              Equations
                              Instances For
                                @[inline]
                                def Lean.Expr.mkDataForLet (h : UInt64) (looseBVarRange : Nat) (approxDepth : UInt32) (hasFVar : Bool) (hasExprMVar : Bool) (hasLevelMVar : Bool) (hasLevelParam : Bool) :
                                Equations
                                Instances For
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  structure Lean.FVarId :

                                  The unique free variable identifier. It is just a hierarchical name, but we wrap it in FVarId to make sure they don't get mixed up with MVarId.

                                  This is not the user-facing name for a free variable. This information is stored in the local context (LocalContext). The unique identifiers are generated using a NameGenerator.

                                  Instances For
                                    Equations
                                    Equations

                                    A set of unique free variable identifiers. This is a persistent data structure implemented using red-black trees.

                                    Equations
                                    Instances For
                                      Equations

                                      A set of unique free variable identifiers implemented using hashtables. Hashtables are faster than red-black trees if they are used linearly. They are not persistent data-structures.

                                      Equations
                                      Instances For

                                        A mapping from free variable identifiers to values of type α. This is a persistent data structure implemented using red-black trees.

                                        Equations
                                        Instances For
                                          def Lean.FVarIdMap.insert {α : Type} (s : Lean.FVarIdMap α) (fvarId : Lean.FVarId) (a : α) :
                                          Equations
                                          Instances For
                                            Equations
                                            Equations
                                            • Lean.instInhabitedFVarIdMap = { default := }
                                            structure Lean.MVarId :

                                            Universe metavariable Id

                                            Instances For
                                              Equations
                                              Equations
                                              Equations
                                              Instances For
                                                Equations
                                                Equations
                                                Instances For
                                                  def Lean.MVarIdMap.insert {α : Type} (s : Lean.MVarIdMap α) (mvarId : Lean.MVarId) (a : α) :
                                                  Equations
                                                  Instances For
                                                    Equations
                                                    instance Lean.instForInMVarIdMapProdMVarId {m : Type u_1 → Type u_2} {α : Type} :
                                                    Equations
                                                    Equations
                                                    • Lean.instInhabitedMVarIdMap = { default := }
                                                    @[extern lean_expr_data]
                                                    noncomputable def Lean.Expr.data :
                                                    Instances For
                                                      inductive Lean.Expr :
                                                      • bvar: NatLean.Expr

                                                        The bvar constructor represents bound variables, i.e. occurrences of a variable in the expression where there is a variable binder above it (i.e. introduced by a lam, forallE, or letE).

                                                        The deBruijnIndex parameter is the de-Bruijn index for the bound variable. See here for additional information on de-Bruijn indexes.

                                                        For example, consider the expression fun x : Nat => forall y : Nat, x = y. The x and y variables in the equality expression are constructed using bvar and bound to the binders introduced by the earlier lam and forallE constructors. Here is the corresponding Expr representation for the same expression:

                                                        .lam `x (.const `Nat [])
                                                          (.forallE `y (.const `Nat [])
                                                            (.app (.app (.app (.const `Eq [.succ .zero]) (.const `Nat [])) (.bvar 1)) (.bvar 0))
                                                            .default)
                                                          .default
                                                        
                                                      • fvar: Lean.FVarIdLean.Expr

                                                        The fvar constructor represent free variables. These /free/ variable occurrences are not bound by an earlier lam, forallE, or letE contructor and its binder exists in a local context only.

                                                        Note that Lean uses the /locally nameless approach/. See here for additional details.

                                                        When "visiting" the body of a binding expression (i.e. lam, forallE, or letE), bound variables are converted into free variables using a unique identifier, and their user-facing name, type, value (for LetE), and binder annotation are stored in the LocalContext.

                                                      • mvar: Lean.MVarIdLean.Expr

                                                        Metavariables are used to represent "holes" in expressions, and goals in the tactic framework. Metavariable declarations are stored in the MetavarContext. Metavariables are used during elaboration, and are not allowed in the kernel, or in the code generator.

                                                      • sort: Lean.LevelLean.Expr

                                                        Used for Type u, Sort u, and Prop:

                                                        • Prop is represented as .sort .zero,
                                                        • Sort u as .sort (.param `u), and
                                                        • Type u as .sort (.succ (.param `u))
                                                      • const: Lake.NameList Lean.LevelLean.Expr

                                                        A (universe polymorphic) constant that has been defined earlier in the module or by another imported module. For example, @Eq.{1} is represented as Expr.const `Eq [.succ .zero], and @Array.map.{0, 0} is represented as Expr.const `Array.map [.zero, .zero].

                                                      • app: Lean.ExprLean.ExprLean.Expr

                                                        A function application.

                                                        For example, the natural number one, i.e. Nat.succ Nat.zero is represented as Expr.app (.const Nat.succ []) (.const .zero [])` Note that multiple arguments are represented using partial application.

                                                        For example, the two argument application f x y is represented as Expr.app (.app f x) y.

                                                      • lam: Lake.NameLean.ExprLean.ExprLean.BinderInfoLean.Expr

                                                        A lambda abstraction (aka anonymous functions). It introduces a new binder for variable x in scope for the lambda body.

                                                        For example, the expression fun x : Nat => x is represented as

                                                        Expr.lam `x (.const `Nat []) (.bvar 0) .default
                                                        
                                                      • forallE: Lake.NameLean.ExprLean.ExprLean.BinderInfoLean.Expr

                                                        A dependent arrow (a : α) → β) (aka forall-expression) where β may dependent on a. Note that this constructor is also used to represent non-dependent arrows where β does not depend on a.

                                                        For example:

                                                        • forall x : Prop, x ∧ x:
                                                        Expr.forallE `x (.sort .zero)
                                                          (.app (.app (.const `And []) (.bvar 0)) (.bvar 0)) .default
                                                        
                                                        Expr.forallE `a (.const `Nat [])
                                                          (.const `Bool []) .default
                                                        
                                                      • letE: Lake.NameLean.ExprLean.ExprLean.ExprBoolLean.Expr

                                                        Let-expressions.

                                                        IMPORTANT: The nonDep flag is for "local" use only. That is, a module should not "trust" its value for any purpose. In the intended use-case, the compiler will set this flag, and be responsible for maintaining it. Other modules may not preserve its value while applying transformations.

                                                        Given an environment, a metavariable context, and a local context, we say a let-expression let x : t := v; e is non-dependent when it is equivalent to (fun x : t => e) v. Here is an example of a dependent let-expression let n : Nat := 2; fun (a : Array Nat n) (b : Array Nat 2) => a = b is type correct, but (fun (n : Nat) (a : Array Nat n) (b : Array Nat 2) => a = b) 2 is not.

                                                        The let-expression let x : Nat := 2; Nat.succ x is represented as

                                                        Expr.letE `x (.const `Nat []) (.lit (.natVal 2)) (.app (.const `Nat.succ []) (.bvar 0)) true
                                                        
                                                      • lit: Lean.LiteralLean.Expr

                                                        Natural number and string literal values.

                                                        They are not really needed, but provide a more compact representation in memory for these two kinds of literals, and are used to implement efficient reduction in the elaborator and kernel. The "raw" natural number 2 can be represented as Expr.lit (.natVal 2). Note that, it is definitionally equal to:

                                                        Expr.app (.const `Nat.succ []) (.app (.const `Nat.succ []) (.const `Nat.zero []))
                                                        
                                                      • mdata: Lean.MDataLean.ExprLean.Expr

                                                        Metadata (aka annotations).

                                                        We use annotations to provide hints to the pretty-printer, store references to Syntax nodes, position information, and save information for elaboration procedures (e.g., we use the inaccessible annotation during elaboration to mark Exprs that correspond to inaccessible patterns).

                                                        Note that Expr.mdata data e is definitionally equal to e.

                                                      • proj: Lake.NameNatLean.ExprLean.Expr

                                                        Projection-expressions. They are redundant, but are used to create more compact terms, speedup reduction, and implement eta for structures. The type of struct must be an structure-like inductive type. That is, it has only one constructor, is not recursive, and it is not an inductive predicate. The kernel and elaborators check whether the typeName matches the type of struct, and whether the (zero-based) index is valid (i.e., it is smaller than the numbef of constructor fields). When exporting Lean developments to other systems, proj can be replaced with typeName.rec applications.

                                                        Example, given a : Nat x Bool, a.1 is represented as

                                                        .proj `Prod 0 a
                                                        

                                                      Lean expressions. This data structure is used in the kernel and elaborator. However, expressions sent to the kernel should not contain metavariables.

                                                      Remark: we use the E suffix (short for Expr) to avoid collision with keywords. We considered using «...», but it is too inconvenient to use.

                                                      Instances For

                                                        The constructor name for the given expression. This is used for debugging purposes.

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

                                                          Return true if e contains free variables. This is a constant time operation.

                                                          Equations
                                                          Instances For

                                                            Return true if e contains expression metavariables. This is a constant time operation.

                                                            Equations
                                                            Instances For

                                                              Return true if e contains universe (aka Level) metavariables. This is a constant time operation.

                                                              Equations
                                                              Instances For

                                                                Does the expression contain level (aka universe) or expression metavariables? This is a constant time operation.

                                                                Equations
                                                                Instances For

                                                                  Return true if e contains universe level parameters. This is a constant time operation.

                                                                  Equations
                                                                  Instances For

                                                                    Return the approximated depth of an expression. This information is used to compute the expression hash code, and speedup comparisons. This is a constant time operation. We say it is approximate because it maxes out at 255.

                                                                    Equations
                                                                    Instances For

                                                                      The range of de-Bruijn variables that are loose. That is, bvars that are not bound by a binder. For example, bvar i has range i + 1 and an expression with no loose bvars has range 0.

                                                                      Equations
                                                                      Instances For

                                                                        Return the binder information if e is a lambda or forall expression, and .default otherwise.

                                                                        Equations
                                                                        Instances For

                                                                          Export functions.

                                                                          @[export lean_expr_hash]
                                                                          Equations
                                                                          Instances For
                                                                            @[export lean_expr_has_fvar]
                                                                            Equations
                                                                            Instances For
                                                                              @[export lean_expr_has_expr_mvar]
                                                                              Equations
                                                                              Instances For
                                                                                @[export lean_expr_has_level_mvar]
                                                                                Equations
                                                                                Instances For
                                                                                  @[export lean_expr_has_mvar]
                                                                                  Equations
                                                                                  Instances For
                                                                                    @[export lean_expr_has_level_param]
                                                                                    Equations
                                                                                    Instances For
                                                                                      @[export lean_expr_loose_bvar_range]
                                                                                      Equations
                                                                                      Instances For
                                                                                        @[export lean_expr_binder_info]
                                                                                        Equations
                                                                                        Instances For
                                                                                          def Lean.mkConst (declName : Lake.Name) (us : optParam (List Lean.Level) []) :

                                                                                          mkConst declName us return .const declName us.

                                                                                          Equations
                                                                                          Instances For

                                                                                            Return the type of a literal value.

                                                                                            Equations
                                                                                            Instances For
                                                                                              @[export lean_lit_type]
                                                                                              Equations
                                                                                              Instances For

                                                                                                .bvar idx is now the preferred form.

                                                                                                Equations
                                                                                                Instances For

                                                                                                  .sort u is now the preferred form.

                                                                                                  Equations
                                                                                                  Instances For

                                                                                                    .fvar fvarId is now the preferred form. This function is seldom used, free variables are often automatically created using the telescope functions (e.g., forallTelescope and lambdaTelescope) at MetaM.

                                                                                                    Equations
                                                                                                    Instances For

                                                                                                      .mvar mvarId is now the preferred form. This function is seldom used, metavariables are often created using functions such as mkFresheExprMVar at MetaM.

                                                                                                      Equations
                                                                                                      Instances For

                                                                                                        .mdata m e is now the preferred form.

                                                                                                        Equations
                                                                                                        Instances For
                                                                                                          def Lean.mkProj (structName : Lake.Name) (idx : Nat) (struct : Lean.Expr) :

                                                                                                          .proj structName idx struct is now the preferred form.

                                                                                                          Equations
                                                                                                          Instances For

                                                                                                            .app f a is now the preferred form.

                                                                                                            Equations
                                                                                                            Instances For

                                                                                                              .lam x t b bi is now the preferred form.

                                                                                                              Equations
                                                                                                              Instances For

                                                                                                                .forallE x t b bi is now the preferred form.

                                                                                                                Equations
                                                                                                                Instances For

                                                                                                                  Return fun (_ : Unit), e

                                                                                                                  Equations
                                                                                                                  Instances For
                                                                                                                    def Lean.mkLet (x : Lake.Name) (t : Lean.Expr) (v : Lean.Expr) (b : Lean.Expr) (nonDep : optParam Bool false) :

                                                                                                                    .letE x t v b nonDep is now the preferred form.

                                                                                                                    Equations
                                                                                                                    Instances For
                                                                                                                      Equations
                                                                                                                      Instances For
                                                                                                                        Equations
                                                                                                                        Instances For
                                                                                                                          Equations
                                                                                                                          Instances For
                                                                                                                            Equations
                                                                                                                            Instances For
                                                                                                                              Equations
                                                                                                                              Instances For
                                                                                                                                def Lean.mkApp6 (f : Lean.Expr) (a : Lean.Expr) (b : Lean.Expr) (c : Lean.Expr) (d : Lean.Expr) (e₁ : Lean.Expr) (e₂ : Lean.Expr) :
                                                                                                                                Equations
                                                                                                                                Instances For
                                                                                                                                  def Lean.mkApp7 (f : Lean.Expr) (a : Lean.Expr) (b : Lean.Expr) (c : Lean.Expr) (d : Lean.Expr) (e₁ : Lean.Expr) (e₂ : Lean.Expr) (e₃ : Lean.Expr) :
                                                                                                                                  Equations
                                                                                                                                  Instances For
                                                                                                                                    def Lean.mkApp8 (f : Lean.Expr) (a : Lean.Expr) (b : Lean.Expr) (c : Lean.Expr) (d : Lean.Expr) (e₁ : Lean.Expr) (e₂ : Lean.Expr) (e₃ : Lean.Expr) (e₄ : Lean.Expr) :
                                                                                                                                    Equations
                                                                                                                                    Instances For
                                                                                                                                      def Lean.mkApp9 (f : Lean.Expr) (a : Lean.Expr) (b : Lean.Expr) (c : Lean.Expr) (d : Lean.Expr) (e₁ : Lean.Expr) (e₂ : Lean.Expr) (e₃ : Lean.Expr) (e₄ : Lean.Expr) (e₅ : Lean.Expr) :
                                                                                                                                      Equations
                                                                                                                                      Instances For
                                                                                                                                        def Lean.mkApp10 (f : Lean.Expr) (a : Lean.Expr) (b : Lean.Expr) (c : Lean.Expr) (d : Lean.Expr) (e₁ : Lean.Expr) (e₂ : Lean.Expr) (e₃ : Lean.Expr) (e₄ : Lean.Expr) (e₅ : Lean.Expr) (e₆ : Lean.Expr) :
                                                                                                                                        Equations
                                                                                                                                        Instances For

                                                                                                                                          .lit l is now the preferred form.

                                                                                                                                          Equations
                                                                                                                                          Instances For

                                                                                                                                            Return the "raw" natural number .lit (.natVal n). This is not the default representation used by the Lean frontend. See mkNatLit.

                                                                                                                                            Equations
                                                                                                                                            Instances For

                                                                                                                                              Return a natural number literal used in the frontend. It is a OfNat.ofNat application. Recall that all theorems and definitions containing numeric literals are encoded using OfNat.ofNat applications in the frontend.

                                                                                                                                              Equations
                                                                                                                                              Instances For

                                                                                                                                                Return the string literal .lit (.strVal s)

                                                                                                                                                Equations
                                                                                                                                                Instances For
                                                                                                                                                  @[export lean_expr_mk_bvar]
                                                                                                                                                  Equations
                                                                                                                                                  Instances For
                                                                                                                                                    @[export lean_expr_mk_fvar]
                                                                                                                                                    Equations
                                                                                                                                                    Instances For
                                                                                                                                                      @[export lean_expr_mk_mvar]
                                                                                                                                                      Equations
                                                                                                                                                      Instances For
                                                                                                                                                        @[export lean_expr_mk_sort]
                                                                                                                                                        Equations
                                                                                                                                                        Instances For
                                                                                                                                                          @[export lean_expr_mk_const]
                                                                                                                                                          Equations
                                                                                                                                                          Instances For
                                                                                                                                                            @[export lean_expr_mk_app]
                                                                                                                                                            Equations
                                                                                                                                                            Instances For
                                                                                                                                                              @[export lean_expr_mk_lambda]
                                                                                                                                                              Equations
                                                                                                                                                              Instances For
                                                                                                                                                                @[export lean_expr_mk_forall]
                                                                                                                                                                Equations
                                                                                                                                                                Instances For
                                                                                                                                                                  @[export lean_expr_mk_let]
                                                                                                                                                                  Equations
                                                                                                                                                                  Instances For
                                                                                                                                                                    @[export lean_expr_mk_lit]
                                                                                                                                                                    Equations
                                                                                                                                                                    Instances For
                                                                                                                                                                      @[export lean_expr_mk_mdata]
                                                                                                                                                                      Equations
                                                                                                                                                                      Instances For
                                                                                                                                                                        @[export lean_expr_mk_proj]
                                                                                                                                                                        Equations
                                                                                                                                                                        Instances For

                                                                                                                                                                          mkAppN f #[a₀, ..., aₙ] ==> f a₀ a₁ .. aₙ

                                                                                                                                                                          Equations
                                                                                                                                                                          Instances For
                                                                                                                                                                            def Lean.mkAppRange (f : Lean.Expr) (i : Nat) (j : Nat) (args : Array Lean.Expr) :

                                                                                                                                                                            mkAppRange f i j #[a_1, ..., a_i, ..., a_j, ... ] ==> the expression f a_i ... a_{j-1}

                                                                                                                                                                            Equations
                                                                                                                                                                            Instances For

                                                                                                                                                                              Same as mkApp f args but reversing args.

                                                                                                                                                                              Equations
                                                                                                                                                                              Instances For
                                                                                                                                                                                @[extern lean_expr_dbg_to_string]
                                                                                                                                                                                @[extern lean_expr_quick_lt]

                                                                                                                                                                                A total order for expressions. We say it is quick because it first compares the hashcodes.

                                                                                                                                                                                @[extern lean_expr_lt]
                                                                                                                                                                                opaque Lean.Expr.lt (a : Lean.Expr) (b : Lean.Expr) :

                                                                                                                                                                                A total order for expressions that takes the structure into account (e.g., variable names).

                                                                                                                                                                                @[extern lean_expr_eqv]

                                                                                                                                                                                Return true iff a and b are alpha equivalent. Binder annotations are ignored.

                                                                                                                                                                                @[extern lean_expr_equal]

                                                                                                                                                                                Return true iff a and b are equal. Binder names and annotations are taking into account.

                                                                                                                                                                                Return true if the given expression is a .sort ..

                                                                                                                                                                                Equations
                                                                                                                                                                                Instances For

                                                                                                                                                                                  Return true if the given expression is of the form .sort (.succ ..).

                                                                                                                                                                                  Equations
                                                                                                                                                                                  Instances For

                                                                                                                                                                                    Return true if the given expression is of the form .sort (.succ .zero).

                                                                                                                                                                                    Equations
                                                                                                                                                                                    Instances For

                                                                                                                                                                                      Return true if the given expression is a .sort .zero

                                                                                                                                                                                      Equations
                                                                                                                                                                                      Instances For

                                                                                                                                                                                        Return true if the given expression is a bound variable.

                                                                                                                                                                                        Equations
                                                                                                                                                                                        Instances For

                                                                                                                                                                                          Return true if the given expression is a metavariable.

                                                                                                                                                                                          Equations
                                                                                                                                                                                          Instances For

                                                                                                                                                                                            Return true if the given expression is a free variable.

                                                                                                                                                                                            Equations
                                                                                                                                                                                            Instances For

                                                                                                                                                                                              Return true if the given expression is an application.

                                                                                                                                                                                              Equations
                                                                                                                                                                                              Instances For

                                                                                                                                                                                                Return true if the given expression is a projection .proj ..

                                                                                                                                                                                                Equations
                                                                                                                                                                                                Instances For

                                                                                                                                                                                                  Return true if the given expression is a constant.

                                                                                                                                                                                                  Equations
                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                    Return true if the given expression is a constant of the give name. Examples:

                                                                                                                                                                                                    Equations
                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                      Return true if the given expression is a free variable with the given id. Examples:

                                                                                                                                                                                                      Equations
                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                        Return true if the given expression is a forall-expression aka (dependent) arrow.

                                                                                                                                                                                                        Equations
                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                          Return true if the given expression is a lambda abstraction aka anonymous function.

                                                                                                                                                                                                          Equations
                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                            Return true if the given expression is a forall or lambda expression.

                                                                                                                                                                                                            Equations
                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                              Return true if the given expression is a let-expression.

                                                                                                                                                                                                              Equations
                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                Return true if the given expression is a metadata.

                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                  Return true if the given expression is a literal value.

                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                    Return the "body" of a forall expression. Example: let e be the representation for forall (p : Prop) (q : Prop), p ∧ q, then getForallBody e returns .app (.app (.const `And []) (.bvar 1)) (.bvar 0)

                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                      Given a sequence of nested foralls (a₁ : α₁) → ... → (aₙ : αₙ) → _, returns the names [a₁, ... aₙ].

                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                        If the given expression is a sequence of function applications f a₁ .. aₙ, return f. Otherwise return the input expression.

                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                          Counts the number n of arguments for an expression f a₁ .. aₙ.

                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                            @[inline]

                                                                                                                                                                                                                            Given f a₁ a₂ ... aₙ, returns #[a₁, ..., aₙ]

                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                              @[specialize #[]]
                                                                                                                                                                                                                              def Lean.Expr.withAppAux {α : Sort u_1} (k : Lean.ExprArray Lean.Exprα) :
                                                                                                                                                                                                                              Lean.ExprArray Lean.ExprNatα
                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                @[inline]
                                                                                                                                                                                                                                def Lean.Expr.withApp {α : Sort u_1} (e : Lean.Expr) (k : Lean.ExprArray Lean.Exprα) :
                                                                                                                                                                                                                                α

                                                                                                                                                                                                                                Given e = f a₁ a₂ ... aₙ, returns k f #[a₁, ..., aₙ].

                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                  def Lean.Expr.traverseApp {M : TypeType u_1} [Monad M] (f : Lean.ExprM Lean.Expr) (e : Lean.Expr) :

                                                                                                                                                                                                                                  Given e = fn a₁ ... aₙ, runs f on fn and each of the arguments aᵢ and makes a new function application with the results.

                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                    @[inline]
                                                                                                                                                                                                                                    def Lean.Expr.withAppRev {α : Sort u_1} (e : Lean.Expr) (k : Lean.ExprArray Lean.Exprα) :
                                                                                                                                                                                                                                    α

                                                                                                                                                                                                                                    Same as withApp but with arguments reversed.

                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                        @[inline]

                                                                                                                                                                                                                                        Given f a₀ a₁ ... aₙ, returns the ith argument or panics if out of bounds.

                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                          @[inline]

                                                                                                                                                                                                                                          Given f a₀ a₁ ... aₙ, returns the ith argument or returns v₀ if out of bounds.

                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                            Given f a₀ a₁ ... aₙ, returns true if f is a constant with name n.

                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                              Given f a₁ ... aᵢ, returns true if f is a constant with name n and has the correct number of arguments.

                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                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
                                                                                                                                                                                                                                                                          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
                                                                                                                                                                                                                                                                                  • 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
                                                                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                                                                    Return true if e is a non-dependent arrow. Remark: the following function assumes e does not have loose bound variables.

                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                      @[extern lean_expr_has_loose_bvar]
                                                                                                                                                                                                                                                                                                      opaque Lean.Expr.hasLooseBVar (e : Lean.Expr) (bvarIdx : Nat) :

                                                                                                                                                                                                                                                                                                      Return true if e contains the loose bound variable bvarIdx in an explicit parameter, or in the range if tryRange == true.

                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                        @[extern lean_expr_lower_loose_bvars]

                                                                                                                                                                                                                                                                                                        Lower the loose bound variables >= s in e by d. That is, a loose bound variable bvar i. i >= s is mapped into bvar (i-d).

                                                                                                                                                                                                                                                                                                        Remark: if s < d, then result is e

                                                                                                                                                                                                                                                                                                        @[extern lean_expr_lift_loose_bvars]

                                                                                                                                                                                                                                                                                                        Lift loose bound variables >= s in e by d.

                                                                                                                                                                                                                                                                                                        inferImplicit e numParams considerRange updates the first numParams parameter binder annotations of the e forall type. It marks any parameter with an explicit binder annotation if there is another explicit arguments that depends on it or the resulting type if considerRange == true.

                                                                                                                                                                                                                                                                                                        Remark: we use this function to infer the bind annotations of inductive datatype constructors, and structure projections. When the {} annotation is used in these commands, we set considerRange == false.

                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                          @[extern lean_expr_instantiate]

                                                                                                                                                                                                                                                                                                          Instantiate the loose bound variables in e using subst. That is, a loose Expr.bvar i is replaced with subst[i].

                                                                                                                                                                                                                                                                                                          @[extern lean_expr_instantiate1]
                                                                                                                                                                                                                                                                                                          @[extern lean_expr_instantiate_rev]

                                                                                                                                                                                                                                                                                                          Similar to instantiate, but Expr.bvar i is replaced with subst[subst.size - i - 1]

                                                                                                                                                                                                                                                                                                          @[extern lean_expr_instantiate_range]
                                                                                                                                                                                                                                                                                                          opaque Lean.Expr.instantiateRange (e : Lean.Expr) (beginIdx : Nat) (endIdx : Nat) (xs : Array Lean.Expr) :

                                                                                                                                                                                                                                                                                                          Similar to instantiate, but consider only the variables xs in the range [beginIdx, endIdx). Function panics if beginIdx <= endIdx <= xs.size does not hold.

                                                                                                                                                                                                                                                                                                          @[extern lean_expr_instantiate_rev_range]
                                                                                                                                                                                                                                                                                                          opaque Lean.Expr.instantiateRevRange (e : Lean.Expr) (beginIdx : Nat) (endIdx : Nat) (xs : Array Lean.Expr) :

                                                                                                                                                                                                                                                                                                          Similar to instantiateRev, but consider only the variables xs in the range [beginIdx, endIdx). Function panics if beginIdx <= endIdx <= xs.size does not hold.

                                                                                                                                                                                                                                                                                                          @[extern lean_expr_abstract]

                                                                                                                                                                                                                                                                                                          Replace free (or meta) variables xs with loose bound variables.

                                                                                                                                                                                                                                                                                                          @[extern lean_expr_abstract_range]

                                                                                                                                                                                                                                                                                                          Similar to abstract, but consider only the first min n xs.size entries in xs.

                                                                                                                                                                                                                                                                                                          Replace occurrences of the free variable fvar in e with v

                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                            Replace occurrences of the free variable fvarId in e with v

                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                              Replace occurrences of the free variables fvars in e with vs

                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                Returns true when the expression does not have any sub-expressions.

                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                      @[inline, reducible]
                                                                                                                                                                                                                                                                                                                      abbrev Lean.ExprMap (α : Type) :
                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                        @[inline, reducible]
                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                          @[inline, reducible]
                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                            @[inline, reducible]
                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                              @[inline, reducible]
                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                                Auxiliary type for forcing == to be structural equality for Expr

                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                      @[inline, reducible]
                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                        @[inline, reducible]
                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                          def Lean.Expr.mkAppRevRange (f : Lean.Expr) (beginIdx : Nat) (endIdx : Nat) (revArgs : Array Lean.Expr) :

                                                                                                                                                                                                                                                                                                                                          mkAppRevRange f b e args == mkAppRev f (revArgs.extract b e)

                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                            def Lean.Expr.betaRev (f : Lean.Expr) (revArgs : Array Lean.Expr) (useZeta : optParam Bool false) (preserveMData : optParam Bool false) :

                                                                                                                                                                                                                                                                                                                                            If f is a lambda expression, than "beta-reduce" it using revArgs. This function is often used with getAppRev or withAppRev. Examples:

                                                                                                                                                                                                                                                                                                                                            • betaRev (fun x y => t x y) #[] ==> fun x y => t x y
                                                                                                                                                                                                                                                                                                                                            • betaRev (fun x y => t x y) #[a] ==> fun y => t a y
                                                                                                                                                                                                                                                                                                                                            • betaRev (fun x y => t x y) #[a, b] ==> t b a
                                                                                                                                                                                                                                                                                                                                            • betaRev (fun x y => t x y) #[a, b, c, d] ==> t d c b a Suppose t is (fun x y => t x y) a b c d, then args := t.getAppRev is #[d, c, b, a], and betaRev (fun x y => t x y) #[d, c, b, a] is t a b c d.

                                                                                                                                                                                                                                                                                                                                            If useZeta is true, the function also performs zeta-reduction (reduction of let binders) to create further opportunities for beta reduction.

                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                              partial def Lean.Expr.betaRev.go (revArgs : Array Lean.Expr) (useZeta : optParam Bool false) (preserveMData : optParam Bool false) (sz : Nat) (e : Lean.Expr) (i : Nat) :

                                                                                                                                                                                                                                                                                                                                              Apply the given arguments to f, beta-reducing if f is a lambda expression. See docstring for betaRev for examples.

                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                                                Return true if the given expression is the function of an expression that is target for (head) beta reduction. If useZeta = true, then let-expressions are visited. That is, it assumes that zeta-reduction (aka let-expansion) is going to be used.

                                                                                                                                                                                                                                                                                                                                                See isHeadBetaTarget.

                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                  Return true if the given expression is a target for (head) beta reduction. If useZeta = true, then let-expressions are visited. That is, it assumes that zeta-reduction (aka let-expansion) is going to be used.

                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                    If e is of the form (fun x₁ ... xₙ => f x₁ ... xₙ) and f does not contain x₁, ..., xₙ, then return some f. Otherwise, return none.

                                                                                                                                                                                                                                                                                                                                                    It assumes e does not have loose bound variables.

                                                                                                                                                                                                                                                                                                                                                    Remark: may be 0

                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                                                                                                      Similar to etaExpanded?, but only succeeds if ₙ ≥ 1.

                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                        Return some e' if e is of the form optParam _ e'

                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                                                                                                                                          Return some e' if e is of the form autoParam _ e'

                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                            @[export lean_is_out_param]

                                                                                                                                                                                                                                                                                                                                                            Return true if e is of the form outParam _

                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                                                                              Return true if e is of the form semiOutParam _

                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                                                                Return true if e is of the form optParam _ _

                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                  Return true if e is of the form autoParam _ _

                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                    @[export lean_expr_consume_type_annotations]

                                                                                                                                                                                                                                                                                                                                                                    Remove outParam, optParam, and autoParam applications/annotations from e. Note that it does not remove nested annotations. Examples:

                                                                                                                                                                                                                                                                                                                                                                    Remove metadata annotations and outParam, optParam, and autoParam applications/annotations from e. Note that it does not remove nested annotations. Examples:

                                                                                                                                                                                                                                                                                                                                                                    @[inline]

                                                                                                                                                                                                                                                                                                                                                                    Return true iff e contains a free variable which statisfies p.

                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                      @[specialize #[]]
                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                        Return true if e contains the given free variable.

                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                                                                                                                                                          The update functions try to avoid allocating new values using pointer equality. Note that if the update*! functions are used under a match-expression, the compiler will eliminate the double-match.

                                                                                                                                                                                                                                                                                                                                                                          @[implemented_by _private.Lean.Expr.0.Lean.Expr.updateApp!Impl]
                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                            @[inline]
                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                              @[implemented_by _private.Lean.Expr.0.Lean.Expr.updateConst!Impl]
                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                @[implemented_by _private.Lean.Expr.0.Lean.Expr.updateSort!Impl]
                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                  @[implemented_by _private.Lean.Expr.0.Lean.Expr.updateMData!Impl]
                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                    @[implemented_by _private.Lean.Expr.0.Lean.Expr.updateProj!Impl]
                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                      @[implemented_by _private.Lean.Expr.0.Lean.Expr.updateForall!Impl]
                                                                                                                                                                                                                                                                                                                                                                                      def Lean.Expr.updateForall! (e : Lean.Expr) (newBinfo : Lean.BinderInfo) (newDomain : Lean.Expr) (newBody : Lean.Expr) :
                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                        @[inline]
                                                                                                                                                                                                                                                                                                                                                                                        def Lean.Expr.updateForallE! (e : Lean.Expr) (newDomain : Lean.Expr) (newBody : Lean.Expr) :
                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                          @[implemented_by _private.Lean.Expr.0.Lean.Expr.updateLambda!Impl]
                                                                                                                                                                                                                                                                                                                                                                                          def Lean.Expr.updateLambda! (e : Lean.Expr) (newBinfo : Lean.BinderInfo) (newDomain : Lean.Expr) (newBody : Lean.Expr) :
                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                            @[inline]
                                                                                                                                                                                                                                                                                                                                                                                            def Lean.Expr.updateLambdaE! (e : Lean.Expr) (newDomain : Lean.Expr) (newBody : Lean.Expr) :
                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                              @[implemented_by _private.Lean.Expr.0.Lean.Expr.updateLet!Impl]
                                                                                                                                                                                                                                                                                                                                                                                              def Lean.Expr.updateLet! (e : Lean.Expr) (newType : Lean.Expr) (newVal : Lean.Expr) (newBody : Lean.Expr) :
                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                partial def Lean.Expr.eta (e : Lean.Expr) :

                                                                                                                                                                                                                                                                                                                                                                                                Eta reduction. If e is of the form (fun x => f x), then return f.

                                                                                                                                                                                                                                                                                                                                                                                                def Lean.Expr.setOption {α : Type} (e : Lean.Expr) (optionName : Lake.Name) [Lean.KVMap.Value α] (val : α) :

                                                                                                                                                                                                                                                                                                                                                                                                Annotate e with the given option. The information is stored using metadata around e.

                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                  Annotate e with pp.explicit := flag The delaborator uses pp options.

                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                                                                    Annotate e with pp.universes := flag The delaborator uses pp options.

                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                                                                                                                                                      If e is an application f a_1 ... a_n annotate f, a_1 ... a_n with pp.explicit := false, and annotate e with pp.explicit := true.

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

                                                                                                                                                                                                                                                                                                                                                                                                        Similar for setAppPPExplicit, but only annotate children with pp.explicit := false if e does not contain metavariables.

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

                                                                                                                                                                                                                                                                                                                                                                                                          Annotate e with the given annotation name kind. It uses metadata to store the annotation.

                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                                                                                            Return some e' if e = mkAnnotation kind e'

                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                                                                                                                              Annotate e with the let_fun annotation. This annotation is used as hint for the delaborator. If e is of the form (fun x : t => b) v, then mkLetFunAnnotation e is delaborated at let_fun x : t := v; b

                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                Return some e' if e = mkLetFunAnnotation e'

                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                  Return true if e = mkLetFunAnnotation e', and e' is of the form (fun x : t => b) v

                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                    Auxiliary annotation used to mark terms marked with the "inaccessible" annotation .(t) and _ in patterns.

                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                      Return some e' if e = mkInaccessible e'.

                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                        During elaboration expressions corresponding to pattern matching terms are annotated with Syntax objects. This function returns some (stx, p') if p is the pattern p' annotated with stx

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

                                                                                                                                                                                                                                                                                                                                                                                                                          Annotate the pattern p with stx. This is an auxiliary annotation for producing better hover information.

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

                                                                                                                                                                                                                                                                                                                                                                                                                            Return some p if e is an annotated pattern (inaccessible? or patternWithRef?)

                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                              Annotate e with the LHS annotation. The delaborator displays expressions of the form lhs = rhs as lhs when they have this annotation. This is used to implement the infoview for the conv mode.

                                                                                                                                                                                                                                                                                                                                                                                                                              This version of mkLHSGoal does not check that the argument is an equality.

                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                Return some lhs if e = mkLHSGoal e', where e' is of the form lhs = rhs.

                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                  Polymorphic operation for generating unique/fresh free variable identifiers. It is available in any monad m that implements the inferface MonadNameGenerator.

                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                  • Lean.mkFreshFVarId = do let __do_lift ← Lean.mkFreshId pure { name := __do_lift }
                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                    Polymorphic operation for generating unique/fresh metavariable identifiers. It is available in any monad m that implements the inferface MonadNameGenerator.

                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                    • Lean.mkFreshMVarId = do let __do_lift ← Lean.mkFreshId pure { name := __do_lift }
                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                      Polymorphic operation for generating unique/fresh universe metavariable identifiers. It is available in any monad m that implements the inferface MonadNameGenerator.

                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                      • Lean.mkFreshLMVarId = do let __do_lift ← Lean.mkFreshId pure { name := __do_lift }
                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                        Return Not p

                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                          Return p ∨ q

                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                            Return p ∧ q

                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                              Return Classical.em p

                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For