Documentation

Extra.AList

def AList.merge {α : Type u} [DecidableEq α] {β : α → Type v} (x y : AList β) (f : (x : α) → β x → β x → β x) :
Equations
Instances For
    @[implicit_reducible]
    instance AList.instRepr_extra {α : Type u_1} {β : α → Type u_2} [Repr α] [(x : α) → Repr (β x)] :
    Repr (AList β)
    Equations
    • One or more equations did not get rendered due to their size.
    @[inline]
    def AList.find? {α : Type u} {β : α → Type v} (p : α → Bool) (x : AList β) :
    Option ((k : α) × β k)
    Equations
    Instances For
      @[inline]
      def AList.get {α : Type u} [DecidableEq α] {β : α → Type v} (x : AList β) (k : α) (h : k ∈ x) :
      β k
      Equations
      Instances For
        theorem AList.lookup_eq_some_get_of_mem {α : Type u} [DecidableEq α] {β : α → Type v} {k : α} {x : AList β} (k_mem : k ∈ x) :
        lookup k x = some (x.get k k_mem)
        def AList.map {α : Type u} {β γ : α → Type v} (f : (k : α) → β k → γ k) (x : AList β) :
        Equations
        Instances For
          theorem AList.in_entries_to_in_keys {α : Type u} {β : α → Type v} {k : α} {v : β k} {x : AList β} :
          ⟨k, v⟩ ∈ x.entries → k ∈ x.keys
          def AList.traverse {α : Type} [DecidableEq α] {β γ : α → Type} {F : Type → Type} [Applicative F] (f : (k : α) → β k → F (γ k)) (x : AList β) :
          F (AList γ)
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            instance AList.eraseRightCommutative {α : Type u} [DecidableEq α] {β : α → Type v} :
            RightCommutative fun (x : AList β) (k : α) => erase k x

            erase on two different keys commutes, needed to fold erase over a list of keys regardless of order.

            def AList.removeAll {α : Type u} [DecidableEq α] {β : α → Type v} (ks : List α) (x : AList β) :
            Equations
            Instances For
              theorem AList.lookup_removeAll_mem {α : Type u} [DecidableEq α] {β : α → Type v} {ks : List α} {k : α} {x : AList β} (k_in : k ∈ ks) :
              theorem AList.lookup_removeAll_not_mem {α : Type u} [DecidableEq α] {β : α → Type v} {ks : List α} {k : α} {x : AList β} (k_in : k ∉ ks) :
              lookup k (removeAll ks x) = lookup k x
              theorem AList.removeAll_nil {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} :
              theorem AList.removeAll_cons {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k : α} {ks : List α} :
              removeAll (k :: ks) x = removeAll ks (erase k x)
              theorem AList.removeAll_cons' {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k : α} {ks : List α} :
              removeAll (k :: ks) x = erase k (removeAll ks x)
              theorem AList.lookup_replace {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k : α} {v : β k} :
              lookup k (replace k v x) = v <$ lookup k x
              theorem AList.lookup_replace_ne {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k k' : α} {v : β k'} (k_ne : k ≠ k') :
              lookup k (replace k' v x) = lookup k x
              theorem AList.lookup_map {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k : α} {f : (k : α) → β k → β k} :
              lookup k (map f x) = f k <$> lookup k x
              theorem AList.List.keys_map_const {α : Type u} [DecidableEq α] {β : α → Type v} {x : List (Sigma β)} {f : (k : α) → β k → β k} :
              (List.map (fun (x : Sigma β) => match x with | ⟨k, v⟩ => ⟨k, f k v⟩) x).keys = x.keys
              theorem AList.map_insert {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k : α} {v : β k} {f : (k : α) → β k → β k} :
              map f (insert k v x) = insert k (f k v) (map f x)
              theorem AList.List.kreplace_singleton {α : Type u} [DecidableEq α] {β : α → Type v} {k : α} {v b : β k} :
              theorem AList.replace_insert {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k : α} {v b : β k} :
              replace k v (insert k b x) = insert k v x
              theorem AList.List.kreplace_kerase_ne {α : Type u} [DecidableEq α] {β : α → Type v} {x : List (Sigma β)} {k a : α} {v : β k} (h : k ≠ a) :
              theorem AList.replace_insert_ne {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k a : α} {v : β k} {b : β a} (h : k ≠ a) :
              replace k v (insert a b x) = insert a b (replace k v x)
              theorem AList.map_ne_eq {α : Type u} [DecidableEq α] {β : α → Type v} {l : AList β} {a : α} {f : (k : α) → β k → β k} (h : a ∉ l) :
              map (fun (k' : α) (v : β k') => if k' = a then f k' v else v) l = l
              theorem AList.replace_eq_map {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k : α} {f : (k : α) → β k → β k} {v : β k} (h : lookup k x = some v) :
              map (fun (k' : α) (v : β k') => if k' = k then f k' v else v) x = replace k (f k v) x
              theorem AList.List.kerase_kinsert {α : Type u} [DecidableEq α] {β : α → Type v} {k : α} {v : β k} {xs : List (Sigma β)} :
              theorem AList.List.kerase_of_not_mem {α : Type u} [DecidableEq α] {β : α → Type v} {k : α} {xs : List (Sigma β)} (h : k ∉ xs.keys) :
              List.kerase k xs = xs
              theorem AList.erase_insert {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k : α} {v : β k} :
              erase k (insert k v x) = erase k x
              theorem AList.lookup_union {α : Type u} [DecidableEq α] {β : α → Type v} {x y : AList β} {k : α} :
              lookup k (x ∪ y) = (lookup k x <|> lookup k y)
              theorem AList.union_insert_ext_of_not_mem {α : Type u} [DecidableEq α] {β : α → Type v} {x y : AList β} {k : α} {v : β k} (h : k ∉ x) (k' : α) :
              lookup k' (x ∪ insert k v y) = lookup k' (insert k v (x ∪ y))
              theorem AList.notMem_iff {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k : α} :
              k ∉ x ↔ lookup k x = none
              theorem AList.mem_insert_of_ne {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k k' : α} {v : β k'} (neq : k ≠ k') :
              k ∈ insert k' v x ↔ k ∈ x
              theorem AList.mem_of_lookup_eq_some {α : Type u} [DecidableEq α] {β : α → Type v} {x : AList β} {k : α} {v : β k} (h : lookup k x = some v) :
              k ∈ x