Documentation

Lean.Meta.Tactic.Simp.Types

The result of simplifying some expression e.

  • expr : Lean.Expr

    The simplified version of e

  • proof? : Option Lean.Expr

    A proof that $e = $expr, where the simplified expression is on the RHS. If none, the proof is assumed to be refl.

  • dischargeDepth : UInt32

    Save the field dischargeDepth at Simp.Context because it impacts the simplifier result.

  • cache : Bool

    If cache := true the result is cached.

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

      Flip the proof in a Simp.Result.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        • maxDischargeDepth : UInt32
        • parent? : Option Lean.Expr

          Stores the "parent" term for the term being simplified. If a simplification procedure result depends on this value, then it is its reponsability to set Result.cache := false.

          Motivation for this field: Suppose we have a simplication procedure for normalizing arithmetic terms. Then, given a term such as t_1 + ... + t_n, we don't want to apply the procedure to every subterm t_1 + ... + t_i for i < n for performance issues. The procedure can accomplish this by checking whether the parent term is also an arithmetical expression and do nothing if it is. However, it should set Result.cache := false to ensure we don't miss simplification opportunities. For example, consider the following:

          example (x y : Nat) (h : y = 0) : id ((x + x) + y) = id (x + x) := by
            simp_arith only
            ...
          

          If we don't set Result.cache := false for the first x + x, then we get the resulting state:

          ... |- id (2*x + y) = id (x + x)
          

          instead of

          ... |- id (2*x + y) = id (2*x)
          

          as expected.

          Remark: given an application f a b c the "parent" term for f, a, b, and c is f a b c.

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

            Result type for a simplification procedure. We have pre and post simplication procedures.

            Instances For
              @[inline, reducible]

              A simplification procedure. Recall that we have pre and post procedures. See Step.

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

                  "Compose" the two given simplification procedures. We use the following semantics.

                  • If f produces done or visit, then return f's result.
                  • If f produces continue, then apply g to new expression returned by f.

                  See Simp.Step type.

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

                    Simproc .olean entry.

                    Instances For
                      Equations

                      Simproc entry. It is the .olean entry plus the actual function.

                      Instances For
                        Equations
                        Equations
                        @[implemented_by Lean.Meta.Simp.Methods.toMethodsRefImpl]
                        @[implemented_by Lean.Meta.Simp.MethodsRef.toMethodsImpl]
                        Equations
                        Instances For
                          Equations
                          Instances For
                            Equations
                            Instances For
                              @[inline]
                              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
                                  @[inline]
                                  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
                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For

                                        Similar to Result.getProof, but adds a mkExpectedTypeHint if proof? is none (i.e., result is definitionally equal to input), but we cannot establish that source and r.expr are definitionally when using TransparencyMode.reducible.

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

                                          Construct the Expr cast h e, from a Simp.Result with proof h.

                                          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

                                                  Given the application e, remove unnecessary casts of the form Eq.rec a rfl and Eq.ndrec a rfl.

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

                                                    Given a simplified function result r and arguments args, simplify arguments using simp and dsimp. The resulting proof is built using congr and congrFun theorems.

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

                                                      Retrieve auto-generated congruence lemma for f.

                                                      Remark: If all argument kinds are fixed or eq, it returns none because using simple congruence theorems congr, congrArg, and congrFun produces a more compact proof.

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

                                                        Try to use automatically generated congruence theorems. See mkCongrSimp?.

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

                                                          Return a WHNF configuration for retrieving [simp] from the discrimination tree. If user has disabled zeta and/or beta reduction in the simplifier, or enabled zetaDelta, we must also disable/enable them when retrieving lemmas from discrimination tree. See issues: #2669 and #2281

                                                          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

                                                                Auxiliary method. Given the current target of mvarId, apply r which is a new target and proof that it is equal to the current one.

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