Documentation

Lean.Class

An entry for the persistent environment extension for declared type classes

  • name : Name

    Class name.

  • outParams : Array Nat

    Position of the class outParams. For example, for class

    class GetElem (cont : Type u) (idx : Type v) (elem : outParam (Type w)) (dom : outParam (cont → idx → Prop)) where
    

    outParams := #[2, 3]

  • outLevelParams : Array Nat

    Positions of universe level parameters that only appear in output parameter types. For example, for HAdd (α : Type u) (β : Type v) (γ : outParam (Type w)), outLevelParams := #[2] since universe w only appears in the output parameter γ. This is used to normalize TC resolution cache keys.

Instances For
    Instances For

      State of the type class environment extension.

      Instances For

        Switch the state into persistent mode. We switch to this mode after we read all imported .olean files. Recall that we use a SMap for implementing the state of the type class environment extension.

        Instances For
          def Lean.isClass (env : Environment) (n : Name) :

          Return true if n is the name of type class in the given environment.

          Instances For

            If declName is a class, return the position of its outParams.

            Instances For
              def Lean.hasOutParams (env : Environment) (declName : Name) :

              Return true if the given declName is a type class with output parameters.

              Instances For

                If declName is a class, return the positions of universe level parameters that only appear in output parameter types.

                Instances For

                  Add a new type class with the given name to the environment. declName must not be the name of an existing type class, and it must be the name of constant in env. declName must be a inductive datatype or axiom. Recall that all structures are inductive datatypes.

                  Instances For