Documentation

Lean.DeclKeyedMap

Maps keyed by declarations whose imported part is assembled from per-module data without inserting every entry: an entry about a constant declared in the module that added it is looked up in that module's sorted array, found using the imported constants, and only the remaining entries are kept in a hash map.

Keys of an ImportedDeclKeyedMap: a declaration name plus possibly more data.

  • declName : κ → Name
  • lt : κ → κ → Bool

    A strict total order compatible with ==, for binary search.

Instances
    @[instance_reducible]
    Equations
    structure Lean.ImportedDeclKeyedMap (κ α : Type) [BEq κ] [Hashable κ] :

    The imported part of a DeclKeyedMap.

    • The imported constants, used to find the module declaring a constant.

    • ownedKeys : Array (Array κ)

      Per module index, the keys of the entries owned by the module (see isOwned), sorted.

    • ownedVals : Array (Array α)

      Per module index, the values of the owned entries, in the order of ownedKeys, or no values if they are all default.

    • foreign : PHashMap κ α

      The entries not owned by the module declaring their constant; they override owned entries.

    Instances For
      @[instance_reducible]
      instance Lean.instInhabitedImportedDeclKeyedMap {a✝ a✝¹ : Type} {a✝² : BEq a✝} {a✝³ : Hashable a✝} :
      Equations

      Whether the current module owns an entry about constant n: it declares n, which does not have a reserved name. Constants with reserved names, such as equational theorems, may be realized by several modules.

      Equations
      Instances For
        def Lean.ImportedDeclKeyedMap.sortOwned {κ α : Type} [BEq κ] [Key κ] (es : Array (κ × α)) :
        Array κ × Array α

        Sorts the entries a module owns by key, keeping the last entry of each key, and returns their keys and values.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          def Lean.ImportedDeclKeyedMap.ofModules {κ α : Type} [BEq κ] [Hashable κ] [Inhabited α] (consts : ImportedConsts ConstantInfo) (owned foreign : Array (Array κ × Array α)) :

          Assembles the imported entries of all modules, given in module order as keys and values (or no values if they are all default): those owned by a module, as returned by sortOwned, at the module's index, and the remaining ones, of which later ones override earlier ones.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            def Lean.ImportedDeclKeyedMap.contains {κ α : Type} [BEq κ] [Hashable κ] [Key κ] [Inhabited α] (m : ImportedDeclKeyedMap κ α) (k : κ) :
            Equations
            Instances For
              @[specialize #[]]
              def Lean.ImportedDeclKeyedMap.foldM {κ α : Type} [BEq κ] [Hashable κ] [Inhabited α] {m : Type u_1 → Type u_2} {β : Type u_1} [Monad m] (f : β → κ → α → m β) (init : β) (d : ImportedDeclKeyedMap κ α) :
              m β
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                structure Lean.DeclKeyedMap (κ α : Type) [BEq κ] [Hashable κ] :

                A map keyed by declarations, consisting of entries imported as an ImportedDeclKeyedMap and the changes made since.

                Instances For
                  @[instance_reducible]
                  instance Lean.instInhabitedDeclKeyedMap {a✝ a✝¹ : Type} {a✝² : BEq a✝} {a✝³ : Hashable a✝} :
                  Inhabited (DeclKeyedMap a✝ a✝¹)
                  Equations
                  def Lean.DeclKeyedMap.contains {κ α : Type} [BEq κ] [Hashable κ] [ImportedDeclKeyedMap.Key κ] [Inhabited α] (m : DeclKeyedMap κ α) (k : κ) :
                  Equations
                  Instances For
                    def Lean.DeclKeyedMap.insert {κ α : Type} [BEq κ] [Hashable κ] (m : DeclKeyedMap κ α) (k : κ) (v : α) :
                    Equations
                    Instances For
                      def Lean.DeclKeyedMap.erase {κ α : Type} [BEq κ] [Hashable κ] [ImportedDeclKeyedMap.Key κ] [Inhabited α] (m : DeclKeyedMap κ α) (k : κ) :
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        @[specialize #[]]
                        def Lean.DeclKeyedMap.foldM {κ α : Type} [BEq κ] [Hashable κ] [Inhabited α] {m : Type u_1 → Type u_2} {β : Type u_1} [Monad m] (f : β → κ → α → m β) (init : β) (d : DeclKeyedMap κ α) :
                        m β
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          @[inline]
                          def Lean.DeclKeyedMap.fold {κ α : Type} [BEq κ] [Hashable κ] [Inhabited α] {β : Type u_1} (f : β → κ → α → β) (init : β) (d : DeclKeyedMap κ α) :
                          β
                          Equations
                          Instances For
                            def Lean.DeclKeyedMap.toList {κ α : Type} [BEq κ] [Hashable κ] [Inhabited α] (d : DeclKeyedMap κ α) :
                            List (κ × α)
                            Equations
                            Instances For
                              def Lean.DeclKeyedMap.isEmpty {κ α : Type} [BEq κ] [Hashable κ] [Inhabited α] (d : DeclKeyedMap κ α) :

                              Whether the map is empty, by visiting entries up to the first one.

                              Equations
                              Instances For