Documentation

Mathlib.Lean.Name

Additional functions on Lean.Name. #

We provide allNames and allNamesByModule.

def allNames (p : Lean.Name โ†’ Bool) :
Lean.CoreM (Array Lean.Name)

Retrieve all names in the environment satisfying a predicate.

Instances For
    def allNamesByModule (p : Lean.Name โ†’ Bool) :
    Lean.CoreM (Std.HashMap Lean.Name (Array Lean.Name))

    Retrieve all names in the environment satisfying a predicate, gathered together into a HashMap according to the module they are defined in.

    Instances For
      def Lean.Name.decapitalize (n : Name) :
      Name

      Decapitalize the last component of a name.

      Instances For
        def Lean.Name.willRoundTrip (n : Name) :
        Bool

        Determines if the pretty-printed version of the given name would parse as an ident with an underlying name (via getId) equal to the original name. The pretty-printer usually escapes unparsable components of a name with ยซยป, but makes exceptions for various names with special meaning, meaning that the result does not round trip. We therefore re-check those conditions here.

        This function is intended to be "safe" in that if it returns true, the name will definitely round trip. (The converse is not guaranteed.) Any deviation from this behavior is a bug which should be fixed.

        Instances For