def
AList.merge
{α : Type u}
[DecidableEq α]
{β : α → Type v}
(x y : AList β)
(f : (x : α) → β x → β x → β x)
:
AList β
Equations
- x.merge y f = AList.foldl (fun (acc : AList β) (k : α) (b : β k) => if h : k ∈ acc then AList.replace k (f k ((AList.lookup k acc).get ⋯) b) acc else AList.insert k b acc) x y
Instances For
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 β)
:
AList β
Equations
- AList.removeAll ks x = List.foldl (fun (x : AList β) (k : α) => AList.erase k x) x ks
Instances For
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}
:
theorem
AList.List.kreplace_kerase_ne
{α : Type u}
[DecidableEq α]
{β : α → Type v}
{x : List (Sigma β)}
{k a : α}
{v : β k}
(h : k ≠ a)
:
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)
:
theorem
AList.erase_insert
{α : Type u}
[DecidableEq α]
{β : α → Type v}
{x : AList β}
{k : α}
{v : β k}
:
theorem
AList.mem_of_lookup_eq_some
{α : Type u}
[DecidableEq α]
{β : α → Type v}
{x : AList β}
{k : α}
{v : β k}
(h : lookup k x = some v)
: