Documentation

Lean.Meta.Sym.Simp.Theorems

A simplification theorem for the structural simplifier.

Contains both the theorem expression and a precomputed pattern for efficient unification during rewriting.

  • expr : Expr

    The theorem expression, typically Expr.const declName for a named theorem.

  • pattern : Pattern

    Precomputed pattern extracted from the theorem's type for efficient matching.

  • rhs : Expr

    Right-hand side of the equation.

  • perm : Bool

    If true, the theorem is a permutation rule (e.g., x + y = y + x). Rewriting is only applied when the result is strictly less than the input (using acLt), preventing infinite loops.

  • rhsVarMask : Nat

    Bitmask of the pattern variables that occur in rhs: bit i is set iff pattern variable i occurs in rhs. Theorem.rewrite uses it to detect hypothesis proofs that become part of the resulting term and must consequently be maximally shared.

  • fallback : Bool

    If true, the theorem is tried only when no other theorem rewrites the term. Used for the unfolding theorem f.eq_def of a definition f provided as a Sym.simp parameter: the equational theorems of f take precedence. See Theorems.rewrite.

Instances For
    @[instance_reducible]

    Collection of simplification theorems available to the simplifier.

    Instances For

      Returns the theorems matching e, excluding the fallback ones.

      Instances For

        Returns the theorems matching a prefix of e, excluding the fallback ones.

        Instances For

          Returns the fallback theorems matching a prefix of e.

          Instances For
            def Lean.Meta.Sym.Simp.isPerm (numVars : Nat) (lhs rhs : Expr) :
            Instances For

              Create a Theorem from a declaration. Handles equalities, ¬, ↔, and propositions.

              Instances For

                Create a Theorem from a proof expression. Handles equalities, ¬, ↔, and propositions.

                Instances For

                  The names of the theorems contributed by a declaration used as a Sym.simp theorem.

                  • thms : Array Name

                    The declaration itself when it is a proposition, or the equational theorems of a definition. Empty for a reducible definition, which the Sym preprocessing unfolds.

                  • unfold? : Option Name

                    The unfolding theorem f.eq_def of a non-recursive definition f, unless thms already unfolds every f application. It is a fallback (see Theorem.fallback), so that simp [f] unfolds the f applications not covered by the equational theorems, like Meta.simp does.

                  Instances For

                    Returns the names of the theorems contributed by declName when it is used as a Sym.simp theorem. A proposition contributes itself. A definition contributes its equational theorems and, when it is not recursive, its unfolding theorem, so that simp [f] unfolds f applications.

                    Instances For

                      Creates the Theorems contributed by declName when it is used as a Sym.simp theorem. See getSimpTheoremNames.

                      Instances For
                        @[reducible, inline]

                        Environment extension storing a set of Sym.Simp theorems. Each named set gets its own extension, created by registerSymSimpAttr.

                        Instances For
                          def Lean.Meta.Sym.Simp.mkSymSimpExt (name : Name := by exact decl_name%) :
                          Instances For
                            @[reducible, inline]
                            Instances For