Documentation

Lean.ReducibilityAttrs

Reducibility status for a definition. Controls when isDefEq and whnf are allowed to unfold it. See TransparencyMode for the full design rationale.

  • reducible: Unfolded at TransparencyMode.reducible or above. Reducible definitions still appear in user-facing terms, but are eagerly unfolded when indexing terms into discrimination trees (simp, type class resolution) and in grind. Think of it as [inline] for indexing. Suitable for abbreviations and definitions that should be transparent to proof automation.
  • instanceReducible: Unfolded at TransparencyMode.instances or above. Auto-applied by the instance command and to subobject projections of class parents. The attribute [instance_reducible] marks a definition with this status; users typically do not need to apply it manually.
  • implicitReducible: Unfolded at TransparencyMode.implicit or above (strictly above .instances). Used for definitions that should unfold when checking implicit and instance-implicit arguments for definitional equality, including for resolving instance diamonds, but must stay opaque to type class search. The attribute [implicit_reducible] marks a definition with this status. (Note: core arithmetic such as Nat.add and Array.size is deliberately instanceReducible, not implicitReducible, because type class synthesis depends on it unfolding.)
  • semireducible: The default. Unfolded at TransparencyMode.default or above. Used for ordinary definitions. Suitable for user-written code where isDefEq should try hard during type checking, but not during speculative proof automation.
  • irreducible: Only unfolded at TransparencyMode.all. The definition body is effectively hidden from isDefEq in normal usage.
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 the reducibility attribute for the given declaration.

        Equations
        Instances For
          def Lean.setReducibilityStatus {m : TypeType} [MonadEnv m] (declName : Name) (s : ReducibilityStatus) :

          Set the reducibility attribute for the given declaration.

          Equations
          Instances For
            def Lean.setReducibleAttribute {m : TypeType} [MonadEnv m] (declName : Name) :

            Set the given declaration as [reducible]

            Equations
            Instances For
              def Lean.isReducible {m : TypeType} [Monad m] [MonadEnv m] (declName : Name) :

              Return true if the given declaration has been marked as [reducible].

              Equations
              Instances For
                def Lean.isIrreducible {m : TypeType} [Monad m] [MonadEnv m] (declName : Name) :

                Return true if the given declaration has been marked as [irreducible]

                Equations
                Instances For
                  def Lean.isImplicitReducible {m : TypeType} [Monad m] [MonadEnv m] (declName : Name) :

                  Return true if the given declaration has been marked as [implicit_reducible].

                  Equations
                  Instances For
                    def Lean.isInstanceReducible {m : TypeType} [Monad m] [MonadEnv m] (declName : Name) :

                    Return true if the given declaration has been marked as [instance_reducible] (automatically applied by the instance command and by subobject class projections).

                    Equations
                    Instances For
                      def Lean.setIrreducibleAttribute {m : TypeType} [MonadEnv m] (declName : Name) :

                      Set the given declaration as [irreducible]

                      Equations
                      Instances For