Documentation

LeanPool.MRiscX.AbstractSyntax.Map

inductive TMap (α β : Type) :

Total map as recursive type with a key type α and value of type β. The empty map takes a default value d of type β.

  • empty {α β : Type} (d : β) : TMap α β
  • put {α β : Type} (k : α) (v : β) (t : TMap α β) : TMap α β
Instances For
    def instReprTMap.repr {α✝ β✝ : Type} [Repr α✝] [Repr β✝] :
    TMap α✝ β✝NatStd.Format
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      @[implicit_reducible]
      instance instReprTMap {α✝ β✝ : Type} [Repr α✝] [Repr β✝] :
      Repr (TMap α✝ β✝)
      Equations
      @[implicit_reducible]
      instance instInhabitedTMap {a✝ a✝¹ : Type} [Inhabited a✝¹] :
      Inhabited (TMap a✝ a✝¹)
      Equations
      def TMap.get {α : Type} [BEq α] [LawfulBEq α] {β : Type} (map : TMap α β) (k : α) :
      β

      Let k ∈ α and v, d ∈ β. The function TMap.get(k) returns either the value v assigned to k or d as the default value if no assignment to k.

      Equations
      Instances For
        def TMap.getKeysAux {α β : Type} [BEq α] [LawfulBEq α] (map : TMap α β) (list : List α) :
        List α

        Accumulate the keys of a TMap onto list, used by getKeys.

        Equations
        Instances For
          def TMap.getKeys {α β : Type} [BEq α] [LawfulBEq α] (map : TMap α β) :
          List α

          Get all keys of a map as a list

          Equations
          Instances For
            def TMap.getLastKey {α β : Type} [BEq α] [LawfulBEq α] (map : TMap α β) :

            The most recently inserted key of a TMap, if any.

            Equations
            Instances For
              def TMap.getValuesAux {α β : Type} [BEq α] [LawfulBEq α] (map : TMap α β) (list : List β) :
              List β

              Accumulate the values of a TMap onto list, used by getValues.

              Equations
              Instances For
                def TMap.getValues {α β : Type} [BEq α] [LawfulBEq α] (map : TMap α β) :
                List β

                Get all values of a map as a list

                Equations
                Instances For
                  def TMap.toStringAux {α β : Type} [ToString α] [ToString β] (t : TMap α β) :

                  Render the bindings of a TMap as a ; -separated string, used by toString.

                  Equations
                  Instances For
                    def TMap.toString {α β : Type} [ToString α] [ToString β] (t : TMap α β) :

                    Render a TMap as a parenthesised string of its bindings.

                    Equations
                    Instances For
                      @[implicit_reducible]
                      instance instReprTMapOfToString {α β : Type} [ToString α] [ToString β] :
                      Repr (TMap α β)
                      Equations

                      Notation (k ↦ v; m) for inserting the binding k ↦ v into the total map m.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        inductive PMap (α β : Type) :

                        Partial map as recursive type with a key type α and value of type β is defined. Returns an option.

                        Instances For
                          def instReprPMap.repr {α✝ β✝ : Type} [Repr α✝] [Repr β✝] :
                          PMap α✝ β✝NatStd.Format
                          Equations
                          Instances For
                            @[implicit_reducible]
                            instance instReprPMap {α✝ β✝ : Type} [Repr α✝] [Repr β✝] :
                            Repr (PMap α✝ β✝)
                            Equations
                            @[implicit_reducible]
                            instance instInhabitedPMap {a✝ a✝¹ : Type} :
                            Inhabited (PMap a✝ a✝¹)
                            Equations
                            def PMap.get {α β : Type} [BEq α] (map : PMap α β) (k : α) :

                            Let k ∈ α and v ∈ β, then PMap.get(k) returns some v (v wrapped inside an option object), when k is assigned to some v. Return none, else.

                            Equations
                            Instances For
                              def PMap.getKeysAux {α β : Type} [BEq α] [LawfulBEq α] (map : PMap α β) (list : List α) :
                              List α

                              Accumulate the keys of a PMap onto list, used by getKeys.

                              Equations
                              Instances For
                                def PMap.getKeys {α β : Type} [BEq α] [LawfulBEq α] (map : PMap α β) :
                                List α

                                Get all keys of a PMap as a list.

                                Equations
                                Instances For
                                  def PMap.toStringAux {α β : Type} [ToString α] [ToString β] (p : PMap α β) :

                                  Render the bindings of a PMap as a ; -separated string, used by toString.

                                  Equations
                                  Instances For
                                    def PMap.toString {α β : Type} [ToString α] [ToString β] (p : PMap α β) :

                                    Render a PMap as a parenthesised string of its bindings.

                                    Equations
                                    Instances For
                                      @[implicit_reducible]
                                      instance instReprPMapOfToString {α β : Type} [ToString α] [ToString β] :
                                      Repr (PMap α β)
                                      Equations

                                      Notation p(k ↦ v; m) for inserting the binding k ↦ v into the partial map m.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        @[simp]
                                        theorem t_update_eq (α β : Type) [BEq α] [LawfulBEq α] (t : TMap α β) (k : α) (v : β) :
                                        (k v; t).get k = v

                                        This theorem states, when a given map [t] which contains the key [k] with the value [v] as last entry, the function TMap.get returns the corresponding value [v].

                                        @[simp]
                                        theorem t_update_neq (α β : Type) [BEq α] [LawfulBEq α] (t : TMap α β) (k k' : α) (v : β) :
                                        k k'(k v; t).get k' = t.get k'

                                        If a total map [t] is updated with some k ∈ α and v ∈ β (k ↦ v; t), and we search for some key [k'] with k ≠ k', we get the same result as when we would just search [t] for [k'].

                                        @[simp]
                                        theorem p_update_eq (α β : Type) [BEq α] [LawfulBEq α] (p : PMap α β) (k : α) (v : β) :
                                        p(k v; p).get k = some v

                                        This theorem states, when a given map [p] which contains the key [k] with the value [v] as last entry, the function PMap.get returns the corresponding value [v].

                                        @[simp]
                                        theorem p_update_neq (α β : Type) [BEq α] [LawfulBEq α] (p : PMap α β) (k k' : α) (v : β) :
                                        k k'p(k v; p).get k' = p.get k'

                                        If a partial map [p] is updated with some k ∈ α and v ∈ β (k ↦ v; p), and we search for some key [k'] with k ≠ k', we get the same result as when we would just search [t] for [k'].