Documentation

LeanColls.Classes.Indexed.Basic

Indexed Collections #

This file defines [Indexed] collections, which are indexed by some type ι. The math model for indexed collections is a total function ι → α.

Note: technically [Indexed] does not require ι to be [IndexType], but a lawful [Indexed] instance implies an [IndexType] instance on ι.

structure LeanColls.Indexed.WithIdx (C : Type u) :

An indexed collection cont can be reinterpreted as a multibag of pairs (i, cont[i]).

This is similar to the List.enum operation.

  • cont : C
Instances For
    class LeanColls.Indexed (C : Type u) (ι : outParam (Type v)) (τ : outParam (Type w)) extends LeanColls.MultiBag.ReadOnly :
    Type (max (max (max u (u_1 + 1)) v) w)
    • mem : τCProp
    • toMultiset : CMultiset τ
    • fold : {β : Type} → C(βτβ)ββ
    • foldM : {β : Type} → {m : TypeType} → [inst : Monad m] → C(βτm β)βm β
    • size : C
    • ofFn : (ιτ)C

      Form an instance of the collection type by specifying its value at every index.

    • get : Cιτ

      Get the value of a collection at an index.

    • update : Cι(ττ)C

      Apply a function at an index (often done in-place).

    • set : CιτC

      Set the value of the function at an index

    Instances
      Equations
      Instances For
        @[inline]
        def LeanColls.Indexed.instOfIndexType {ι : Type u_1} {C : Type u_2} {τ : Type u_3} [LeanColls.IndexType ι] (get : Cιτ) (ofFn : (ιτ)C) (update : Cι(ττ)C) :
        Equations
        Instances For
          class LeanColls.LawfulIndexed (C : Type u_1) (ι : Type u_2) (τ : Type u_3) [LeanColls.Indexed C ι τ] :
          Instances
            @[simp]
            theorem LeanColls.LawfulIndexed.get_ofFn {C : Type u_1} {ι : Type u_2} {τ : Type u_3} [LeanColls.Indexed C ι τ] [self : LeanColls.LawfulIndexed C ι τ] (f : ιτ) :
            theorem LeanColls.LawfulIndexed.get_set_eq {C : Type u_1} {ι : Type u_2} {τ : Type u_3} [LeanColls.Indexed C ι τ] [self : LeanColls.LawfulIndexed C ι τ] (cont : C) {i : ι} {j : ι} {a : τ} :
            @[simp]
            theorem LeanColls.LawfulIndexed.get_set_ne {C : Type u_1} {ι : Type u_2} {τ : Type u_3} [LeanColls.Indexed C ι τ] [self : LeanColls.LawfulIndexed C ι τ] (cont : C) {i : ι} {j : ι} {a : τ} :
            theorem LeanColls.LawfulIndexed.get_update_eq {C : Type u_1} {ι : Type u_2} {τ : Type u_3} [LeanColls.Indexed C ι τ] [self : LeanColls.LawfulIndexed C ι τ] (cont : C) (i : ι) (j : ι) (f : ττ) :
            @[simp]
            theorem LeanColls.LawfulIndexed.get_update_ne {C : Type u_1} {ι : Type u_2} {τ : Type u_3} [LeanColls.Indexed C ι τ] [self : LeanColls.LawfulIndexed C ι τ] (cont : C) (i : ι) (j : ι) (f : ττ) :
            @[simp]
            theorem LeanColls.Indexed.get_set_eq {C : Type u_2} {ι : Type u_3} {τ : Type u_1} [LeanColls.Indexed C ι τ] [LeanColls.LawfulIndexed C ι τ] {i : ι} {a : τ} (cont : C) :
            theorem LeanColls.Indexed.get_set {C : Type u_3} {ι : Type u_1} {τ : Type u_2} [LeanColls.Indexed C ι τ] [LeanColls.LawfulIndexed C ι τ] [DecidableEq ι] (cont : C) {i : ι} {j : ι} {a : τ} :
            @[simp]
            theorem LeanColls.Indexed.get_update_eq {C : Type u_2} {ι : Type u_3} {τ : Type u_1} [LeanColls.Indexed C ι τ] [LeanColls.LawfulIndexed C ι τ] {i : ι} {f : ττ} (cont : C) :
            theorem LeanColls.Indexed.get_update {C : Type u_3} {ι : Type u_1} {τ : Type u_2} [LeanColls.Indexed C ι τ] [LeanColls.LawfulIndexed C ι τ] [DecidableEq ι] (cont : C) {i : ι} {j : ι} {f : ττ} :
            @[deprecated LeanColls.Indexed.get_update]
            theorem LeanColls.LawfulIndexed.update_set_get {C : Type u_1} {ι : Type u_2} {τ : Type u_3} [Fact False] [LeanColls.Indexed C ι τ] (cont : C) (i : ι) (f : ττ) :
            @[reducible, inline, deprecated LeanColls.Indexed.get_set]
            abbrev LeanColls.LawfulIndexed.get_set {C : Type u_1} {ι : Type u_2} {τ : Type u_3} [LeanColls.Indexed C ι τ] [LeanColls.LawfulIndexed C ι τ] [DecidableEq ι] (cont : C) {i : ι} {j : ι} {a : τ} :
            Equations
            Instances For
              @[reducible, inline, deprecated LeanColls.Indexed.get_update]
              abbrev LeanColls.LawfulIndexed.get_update {C : Type u_1} {ι : Type u_2} {τ : Type u_3} [LeanColls.Indexed C ι τ] [LeanColls.LawfulIndexed C ι τ] [DecidableEq ι] (cont : C) {i : ι} {j : ι} {f : ττ} :
              Equations
              Instances For