- leaf: {α : Type u} → {β : α → Type v} → Lean.RBNode α β
- node: {α : Type u} → {β : α → Type v} → Lean.RBColor → Lean.RBNode α β → (key : α) → β key → Lean.RBNode α β → Lean.RBNode α β
Instances For
Equations
- Lean.RBNode.depth f Lean.RBNode.leaf = 0
- Lean.RBNode.depth f (Lean.RBNode.node color l key val r) = (f (Lean.RBNode.depth f l) (Lean.RBNode.depth f r)).succ
Instances For
Instances For
Equations
- Lean.RBNode.leaf.max = none
- (Lean.RBNode.node color lchild k v Lean.RBNode.leaf).max = some ⟨k, v⟩
- (Lean.RBNode.node color lchild key val r).max = r.max
Instances For
Equations
- Lean.RBNode.fold f x Lean.RBNode.leaf = x
- Lean.RBNode.fold f x (Lean.RBNode.node color l k v r) = Lean.RBNode.fold f (f (Lean.RBNode.fold f x l) k v) r
Instances For
Equations
- Lean.RBNode.forM f Lean.RBNode.leaf = pure ()
- Lean.RBNode.forM f (Lean.RBNode.node color l key val r) = do Lean.RBNode.forM f l f key val Lean.RBNode.forM f r
Instances For
Equations
- Lean.RBNode.foldM f x Lean.RBNode.leaf = pure x
- Lean.RBNode.foldM f x (Lean.RBNode.node color l k v r) = do let b ← Lean.RBNode.foldM f x l let b ← f b k v Lean.RBNode.foldM f b r
Instances For
Equations
- as.forIn init f = do let __do_lift ← Lean.RBNode.forIn.visit f as init match __do_lift with | ForInStep.done b => pure b | ForInStep.yield b => pure b
Instances For
Equations
- Lean.RBNode.revFold f x Lean.RBNode.leaf = x
- Lean.RBNode.revFold f x (Lean.RBNode.node color l k v r) = Lean.RBNode.revFold f (f (Lean.RBNode.revFold f x r) k v) l
Instances For
Equations
- Lean.RBNode.all p Lean.RBNode.leaf = true
- Lean.RBNode.all p (Lean.RBNode.node color l key val r) = (p key val && Lean.RBNode.all p l && Lean.RBNode.all p r)
Instances For
Instances For
Instances For
Equations
- (Lean.RBNode.node color Lean.RBNode.leaf key val Lean.RBNode.leaf).isSingleton = true
- x.isSingleton = false
Instances For
Instances For
Equations
- One or more equations did not get rendered due to their size.
- x✝².balance2 x✝¹ x✝ x = Lean.RBNode.node Lean.RBColor.black x✝² x✝¹ x✝ x
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Lean.RBNode.ins cmp Lean.RBNode.leaf x✝ x = Lean.RBNode.node Lean.RBColor.red Lean.RBNode.leaf x✝ x Lean.RBNode.leaf
Instances For
Instances For
Equations
- Lean.RBNode.insert cmp t k v = if t.isRed = true then (Lean.RBNode.ins cmp t k v).setBlack else Lean.RBNode.ins cmp t k v
Instances For
Equations
- (Lean.RBNode.node color l k v r).setRed = Lean.RBNode.node Lean.RBColor.red l k v r
- x.setRed = x
Instances For
Equations
- One or more equations did not get rendered due to their size.
- (Lean.RBNode.node Lean.RBColor.red a kx vx b).balLeft x✝¹ x✝ x = Lean.RBNode.node Lean.RBColor.red (Lean.RBNode.node Lean.RBColor.black a kx vx b) x✝¹ x✝ x
- x✝¹.balLeft x✝ x (Lean.RBNode.node Lean.RBColor.black a ky vy b) = x✝¹.balance2 x✝ x (Lean.RBNode.node Lean.RBColor.red a ky vy b)
- x✝².balLeft x✝¹ x✝ x = Lean.RBNode.node Lean.RBColor.red x✝² x✝¹ x✝ x
Instances For
Instances For
The number of nodes in the tree.
Equations
- Lean.RBNode.leaf.size = 0
- (Lean.RBNode.node color l key val r).size = l.size + r.size + 1
Instances For
Instances For
Instances For
Equations
- Lean.RBNode.erase cmp x t = (Lean.RBNode.del cmp x t).setBlack
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Lean.RBNode.findCore cmp Lean.RBNode.leaf x = none
Instances For
Equations
- Lean.RBNode.find cmp Lean.RBNode.leaf x = none
- Lean.RBNode.find cmp (Lean.RBNode.node color a ky vy b) x = match cmp x ky with | Ordering.lt => Lean.RBNode.find cmp a x | Ordering.gt => Lean.RBNode.find cmp b x | Ordering.eq => some vy
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Lean.RBNode.lowerBound cmp Lean.RBNode.leaf x✝ x = x
Instances For
- leafWff: ∀ {α : Type u} {β : α → Type v} {cmp : α → α → Ordering}, Lean.RBNode.WellFormed cmp Lean.RBNode.leaf
- insertWff: ∀ {α : Type u} {β : α → Type v} {cmp : α → α → Ordering} {n n' : Lean.RBNode α β} {k : α} {v : β k}, Lean.RBNode.WellFormed cmp n → n' = Lean.RBNode.insert cmp n k v → Lean.RBNode.WellFormed cmp n'
- eraseWff: ∀ {α : Type u} {β : α → Type v} {cmp : α → α → Ordering} {n n' : Lean.RBNode α β} {k : α}, Lean.RBNode.WellFormed cmp n → n' = Lean.RBNode.erase cmp k n → Lean.RBNode.WellFormed cmp n'
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Lean.RBNode.mapM f Lean.RBNode.leaf = pure Lean.RBNode.leaf
Instances For
Instances For
Instances For
Equations
- Lean.RBMap α β cmp = { t : Lean.RBNode α fun (x : α) => β // Lean.RBNode.WellFormed cmp t }
Instances For
Instances For
Equations
- Lean.instEmptyCollectionRBMap α β cmp = { emptyCollection := Lean.RBMap.empty }
Instances For
Instances For
Equations
- Lean.RBMap.fold f x ⟨t, property⟩ = Lean.RBNode.fold f x t
Instances For
Instances For
Instances For
Equations
- Lean.RBMap.forM f t = Lean.RBMap.foldM (fun (x : PUnit) (k : α) (v : β) => f k v) PUnit.unit t
Instances For
Equations
- t.forIn init f = t.val.forIn init fun (a : α) (b : β) (acc : σ) => f (a, b) acc
Instances For
Instances For
Returns a List
of the key/value pairs in order.
Equations
- Lean.RBMap.toList ⟨t, property⟩ = Lean.RBNode.revFold (fun (ps : List (α × β)) (k : α) (v : β) => (k, v) :: ps) [] t
Instances For
Returns an Array
of the key/value pairs in order.
Instances For
Returns the kv pair (a,b)
such that a ≤ k
for all keys in the RBMap.
Instances For
Returns the kv pair (a,b)
such that a ≥ k
for all keys in the RBMap.
Instances For
Equations
- Lean.RBMap.insert ⟨t, w⟩ x✝ x = ⟨Lean.RBNode.insert cmp t x✝ x, ⋯⟩
Instances For
Equations
- Lean.RBMap.erase ⟨t, w⟩ x = ⟨Lean.RBNode.erase cmp x t, ⋯⟩
Instances For
Equations
- Lean.RBMap.ofList [] = Lean.mkRBMap α β cmp
- Lean.RBMap.ofList ((k, v) :: xs) = (Lean.RBMap.ofList xs).insert k v
Instances For
Instances For
Instances For
Instances For
(lowerBound k) retrieves the kv pair of the largest key smaller than or equal to k
,
if it exists.
Instances For
Returns true if the given key a
is in the RBMap.
Equations
- t.contains a = (t.find? a).isSome
Instances For
Equations
- Lean.RBMap.fromList l cmp = List.foldl (fun (r : Lean.RBMap α β cmp) (p : α × β) => r.insert p.fst p.snd) (Lean.mkRBMap α β cmp) l
Instances For
Equations
- Lean.RBMap.fromArray l cmp = Array.foldl (fun (r : Lean.RBMap α β cmp) (p : α × β) => r.insert p.fst p.snd) (Lean.mkRBMap α β cmp) l
Instances For
Returns true if the given predicate is true for all items in the RBMap.
Equations
- Lean.RBMap.all ⟨t, property⟩ x = Lean.RBNode.all x t
Instances For
Returns true if the given predicate is true for any item in the RBMap.
Equations
- Lean.RBMap.any ⟨t, property⟩ x = Lean.RBNode.any x t
Instances For
The number of items in the RBMap.
Instances For
Equations
- t.maxDepth = Lean.RBNode.depth Nat.max t.val
Instances For
Instances For
Equations
- t.max! = match t.max with | some p => p | none => panicWithPosWithDecl "Lean.Data.RBMap" "Lean.RBMap.max!" 383 14 "map is empty"
Instances For
Attempts to find the value with key k : α
in t
and panics if there is no such key.
Instances For
Merges the maps t₁
and t₂
, if a key a : α
exists in both,
then use mergeFn a b₁ b₂
to produce the new merged value.
Instances For
Intersects the maps t₁
and t₂
using mergeFn a b₁ b₂
to produce the new value.
Instances For
filter f m
returns the RBMap
consisting of all
"key
/val
"-pairs in m
where f key val
returns true
.
Equations
- Lean.RBMap.filter f m = Lean.RBMap.fold (fun (r : Lean.RBMap α β cmp) (k : α) (v : β) => if f k v = true then r.insert k v else r) ∅ m
Instances For
filterMap f m
filters an RBMap
and simultaneously modifies the filtered values.
It takes a function f : α → β → Option γ
and applies f k v
to the value with key k
.
The resulting entries with non-none
value are collected to form the output RBMap
.
Equations
- Lean.RBMap.filterMap f m = Lean.RBMap.fold (fun (r : Lean.RBMap α γ cmp) (k : α) (v : β) => match f k v with | none => r | some b => r.insert k b) ∅ m
Instances For
Equations
- Lean.rbmapOf l cmp = Lean.RBMap.fromList l cmp