This module includes a dependently typed adaption of the Lean.RBMap
defined in Lean.Data.RBMap
module of the Lean core. Most of the code is
copied directly from there with only minor edits.
Equations
- Lake.inhabitedOfEmptyCollection = { default := ∅ }
@[specialize #[]]
def
Lake.RBNode.dFind
{α : Type u}
{β : α → Type v}
(cmp : α → α → Ordering)
[h : EqOfCmpWrt α β cmp]
:
Lean.RBNode α β → (k : α) → Option (β k)
Equations
- One or more equations did not get rendered due to their size.
- Lake.RBNode.dFind cmp Lean.RBNode.leaf x✝ = none
Instances For
A Dependently typed RBMap
.
Instances For
instance
Lake.instCoeDRBMapRBMap
{α : Type u_1}
{β : Type u_2}
{cmp : α → α → Ordering}
:
Coe (DRBMap α (fun (x : α) => β) cmp) (Lean.RBMap α β cmp)
Equations
- Lake.instCoeDRBMapRBMap = { coe := id }
@[inline]
Instances For
instance
Lake.instEmptyCollectionDRBMap
(α : Type u)
(β : α → Type v)
(cmp : α → α → Ordering)
:
EmptyCollection (DRBMap α β cmp)
@[inline]
def
Lake.DRBMap.forM
{α : Type u}
{β : α → Type v}
{cmp : α → α → Ordering}
{m : Type u_1 → Type u_2}
[Monad m]
(f : (k : α) → β k → m PUnit)
(t : DRBMap α β cmp)
:
m PUnit
Equations
- Lake.DRBMap.forM f t = Lake.DRBMap.foldM (fun (x : PUnit) (k : α) (v : β k) => f k v) PUnit.unit t
Instances For
@[inline]
def
Lake.DRBMap.forIn
{α : Type u}
{β : α → Type v}
{σ : Type w}
{cmp : α → α → Ordering}
{m : Type w → Type u_1}
[Monad m]
(t : DRBMap α β cmp)
(init : σ)
(f : (k : α) × β k → σ → m (ForInStep σ))
:
m σ
Equations
- t.forIn init f = t.val.forIn init fun (a : α) (b : β a) (acc : σ) => f ⟨a, b⟩ acc
Instances For
instance
Lake.DRBMap.instForInSigma
{α : Type u}
{β : α → Type v}
{cmp : α → α → Ordering}
{m : Type u_1 → Type u_2}
:
Equations
- Lake.DRBMap.instForInSigma = { forIn := fun {β_1 : Type ?u.42} [Monad m] => Lake.DRBMap.forIn }
@[inline]
Instances For
@[specialize #[]]
Equations
- Lake.DRBMap.toList ⟨t, property⟩ = Lean.RBNode.revFold (fun (ps : List ((k : α) × β k)) (k : α) (v : β k) => ⟨k, v⟩ :: ps) [] t
Instances For
@[inline]
Equations
- Lake.DRBMap.min ⟨t, property⟩ = match t.min with | some ⟨k, v⟩ => some ⟨k, v⟩ | none => none
Instances For
@[inline]
Equations
- Lake.DRBMap.max ⟨t, property⟩ = match t.max with | some ⟨k, v⟩ => some ⟨k, v⟩ | none => none
Instances For
instance
Lake.DRBMap.instReprOfSigma
{α : Type u}
{β : α → Type v}
{cmp : α → α → Ordering}
[Repr ((k : α) × β k)]
:
Equations
- Lake.DRBMap.instReprOfSigma = { reprPrec := fun (m : Lake.DRBMap α β cmp) (prec : Nat) => Repr.addAppParen (Std.Format.text "Lake.drbmapOf " ++ repr m.toList) prec }
@[inline]
Instances For
@[inline]
Instances For
@[specialize #[]]
Equations
Instances For
@[inline]
Instances For
@[inline]
Instances For
@[inline]
def
Lake.DRBMap.findD
{α : Type u}
{β : α → Type v}
{cmp : α → α → Ordering}
[EqOfCmpWrt α β cmp]
(t : DRBMap α β cmp)
(k : α)
(v₀ : β k)
:
β k
Equations
- t.findD k v₀ = (t.find? k).getD v₀
Instances For
@[inline]
(lowerBound k) retrieves the kv pair of the largest key smaller than or equal to k
,
if it exists.
Instances For
@[inline]
def
Lake.DRBMap.contains
{α : Type u}
{β : α → Type v}
{cmp : α → α → Ordering}
[EqOfCmpWrt α β cmp]
(t : DRBMap α β cmp)
(k : α)
:
Equations
Instances For
@[inline]
def
Lake.DRBMap.fromList
{α : Type u}
{β : α → Type v}
(l : List ((k : α) × β k))
(cmp : α → α → Ordering)
:
DRBMap α β cmp
Equations
- Lake.DRBMap.fromList l cmp = List.foldl (fun (r : Lake.DRBMap α β cmp) (p : (k : α) × β k) => r.insert p.fst p.snd) (Lake.mkDRBMap α β cmp) l
Instances For
def
Lake.DRBMap.maxDepth
{α : Type u}
{β : α → Type v}
{cmp : α → α → Ordering}
(t : DRBMap α β cmp)
:
Instances For
@[inline]
def
Lake.DRBMap.find!
{α : Type u}
{β : α → Type v}
{cmp : α → α → Ordering}
[EqOfCmpWrt α β cmp]
(t : DRBMap α β cmp)
(k : α)
[Inhabited (β k)]
:
β k