Documentation

LeanColls.Classes.Seq

Sequences #

Sequences are an ordered collection of elements.

All sequences are isomorphic to [List], which is also the model used for sequence operations.

class LeanColls.Seq (C : Type u) (τ : outParam (Type v)) extends LeanColls.Fold , LeanColls.Insert , LeanColls.ToList , Membership , LeanColls.Size , Append :
Type (max (u + 1) (v + 1))

A collection which is ordered (i.e. isomorphic to [List]).

  • fold : {β : Type (max u v)} → C(βτβ)ββ
  • foldM : {β : Type (max u v)} → {m : Type (max u v) → Type (max u v)} → [inst : Monad m] → C(βτm β)βm β
  • empty : C
  • insert : CτC
  • singleton : τC
  • toList : CList τ
  • mem : τCProp
  • size : C
  • append : CCC
  • ofFn : {sz : } → (Fin szτ)C
  • get : (cont : C) → Fin (LeanColls.size cont)τ
  • set : (cont : C) → Fin (LeanColls.size cont)τC
  • update : (cont : C) → Fin (LeanColls.size cont)(ττ)C
  • cons : τCC
  • getCons? : COption (τ × C)
  • snoc : CτC
  • getSnoc? : COption (C × τ)
Instances
    instance List.instSeqList {τ : Type u_1} :
    Equations
    • One or more equations did not get rendered due to their size.
    @[simp]
    theorem List.toList_eq {α : Type u_1} (L : List α) :
    @[simp]
    theorem List.size_cons {α : Type u_1} (x : α) (xs : List α) :
    @[simp]
    theorem List.size_nil {α : Type u_1} :
    @[simp]
    theorem List.toMultiset_eq {α : Type u_1} (L : List α) :
    Instances
      theorem LeanColls.LawfulSeq.size_def {C : Type u} {τ : outParam (Type v)} [LeanColls.Seq C τ] [self : LeanColls.LawfulSeq C τ] (cont : C) :
      LeanColls.size cont = (LeanColls.toList cont).length
      theorem LeanColls.LawfulSeq.get_def {C : Type u} {τ : outParam (Type v)} [LeanColls.Seq C τ] [self : LeanColls.LawfulSeq C τ] (cont : C) (i : Fin (LeanColls.size cont)) :
      @[simp]
      theorem LeanColls.LawfulSeq.toList_set {C : Type u} {τ : outParam (Type v)} [LeanColls.Seq C τ] [self : LeanColls.LawfulSeq C τ] (cont : C) (i : Fin (LeanColls.size cont)) (x : τ) :
      @[simp]
      theorem LeanColls.LawfulSeq.toList_update {C : Type u} {τ : outParam (Type v)} [LeanColls.Seq C τ] [self : LeanColls.LawfulSeq C τ] (cont : C) (i : Fin (LeanColls.size cont)) (f : ττ) :
      @[simp]
      theorem LeanColls.LawfulSeq.getCons?_eq_some {C : Type u} {τ : outParam (Type v)} [LeanColls.Seq C τ] [self : LeanColls.LawfulSeq C τ] (cont : C) (x : τ) (c' : C) :
      @[simp]
      theorem LeanColls.LawfulSeq.getSnoc?_eq_some {C : Type u} {τ : outParam (Type v)} [LeanColls.Seq C τ] [self : LeanColls.LawfulSeq C τ] (cont : C) (x : τ) (c' : C) :
      instance List.instLawfulSeq {τ : Type u_1} :
      Equations
      • =
      @[simp]
      theorem LeanColls.Seq.size_set {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] (cont : C) (i : Fin (LeanColls.size cont)) (x : τ) :
      @[simp]
      theorem LeanColls.Seq.size_update {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] (cont : C) (i : Fin (LeanColls.size cont)) (f : ττ) :
      @[simp]
      theorem LeanColls.Seq.size_cons {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] (cont : C) (x : τ) :
      @[simp]
      theorem LeanColls.Seq.size_snoc {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] (cont : C) (x : τ) :
      @[simp]
      theorem LeanColls.Seq.size_append {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] (c1 : C) (c2 : C) :
      @[simp]
      @[simp]
      theorem LeanColls.Seq.size_ofFn {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] {n : } (f : Fin nτ) :
      @[simp]
      theorem LeanColls.Seq.get_ofFn {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] {n : } (f : Fin nτ) (i : Fin (LeanColls.size (LeanColls.Seq.ofFn f))) :
      @[simp]
      theorem LeanColls.Seq.get_set_eq {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] (cont : C) (i : Fin (LeanColls.size cont)) (x : τ) (j : Fin (LeanColls.size (LeanColls.Seq.set cont i x))) :
      i = jLeanColls.Seq.get (LeanColls.Seq.set cont i x) j = x
      @[simp]
      theorem LeanColls.Seq.get_set_ne {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] (cont : C) (i : Fin (LeanColls.size cont)) (x : τ) (j : Fin (LeanColls.size (LeanColls.Seq.set cont i x))) :
      i jLeanColls.Seq.get (LeanColls.Seq.set cont i x) j = LeanColls.Seq.get cont (Fin.cast j)
      theorem LeanColls.Seq.get_set {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] (cont : C) (i : Fin (LeanColls.size cont)) (x : τ) (j : Fin (LeanColls.size (LeanColls.Seq.set cont i x))) :
      LeanColls.Seq.get (LeanColls.Seq.set cont i x) j = if i = j then x else LeanColls.Seq.get cont (Fin.cast j)
      @[simp]
      theorem LeanColls.Seq.get_update_eq {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] (cont : C) (i : Fin (LeanColls.size cont)) (f : ττ) (j : Fin (LeanColls.size (LeanColls.Seq.update cont i f))) :
      i = jLeanColls.Seq.get (LeanColls.Seq.update cont i f) j = f (LeanColls.Seq.get cont i)
      @[simp]
      theorem LeanColls.Seq.get_update_ne {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] (cont : C) (i : Fin (LeanColls.size cont)) (f : ττ) (j : Fin (LeanColls.size (LeanColls.Seq.update cont i f))) :
      i jLeanColls.Seq.get (LeanColls.Seq.update cont i f) j = LeanColls.Seq.get cont (Fin.cast j)
      theorem LeanColls.Seq.get_update {C : Type u_1} {τ : Type u_2} [LeanColls.Seq C τ] [LeanColls.LawfulSeq C τ] (cont : C) (i : Fin (LeanColls.size cont)) (f : ττ) (j : Fin (LeanColls.size (LeanColls.Seq.update cont i f))) :
      LeanColls.Seq.get (LeanColls.Seq.update cont i f) j = if i = j then f (LeanColls.Seq.get cont (Fin.cast j)) else LeanColls.Seq.get cont (Fin.cast j)