Binary Tree #
Equations
- ABTree.sizeI sa sb (ABTree.leaf a) = sa a
- ABTree.sizeI sa sb (ABTree.node b bl br) = sb b + ABTree.sizeI sa sb bl + ABTree.sizeI sa sb br
Instances For
Equations
- ABTree.size = ABTree.sizeI (fun (x : α) => 1) fun (x : β) => 1
Instances For
Equations
- ABTree.height = ABTree.sizeI (fun (x : α) => 0) fun (x : β) => 1
Instances For
Equations
- ABTree.getI' p q (ABTree.leaf a) = p a
- ABTree.getI' p q (ABTree.node b bl br) = q b
Instances For
Equations
Instances For
Equations
- ABTree.getI = ABTree.getI' (fun (p : α × β) => p.snd) id
Instances For
Equations
- ABTree.fold l n (ABTree.leaf a) = l a
- ABTree.fold l n (ABTree.node b bl br) = n b (ABTree.fold l n bl) (ABTree.fold l n br)
Instances For
Equations
- ABTree.map f g (ABTree.leaf a) = ABTree.leaf (f a)
- ABTree.map f g (ABTree.node b bl br) = ABTree.node (g b) (ABTree.map f g bl) (ABTree.map f g br)
Instances For
theorem
abtree_map_compose
{α₁ α₂ α₃ β₁ β₂ β₃ : Type}
(f : α₁ → α₂)
(f' : α₂ → α₃)
(g : β₁ → β₂)
(g' : β₂ → β₃)
(t : ABTree α₁ β₁)
:
Equations
- instBifunctorABTree = { bimap := fun {α α' β β' : Type} => ABTree.map }
def
abtree_zip_with
{α β δ ε ρ η : Type}
(f : α → δ → ρ)
(g : β → ε → η)
(l : ABTree α β)
(r : ABTree δ ε)
:
Equations
- abtree_zip_with f g (ABTree.leaf a) (ABTree.leaf d) = some (ABTree.leaf (f a d))
- abtree_zip_with f g (ABTree.node b bl br) (ABTree.node e el er) = ABTree.node (g b e) <$> abtree_zip_with f g bl el <*> abtree_zip_with f g br er
- abtree_zip_with f g l r = none
Instances For
Equations
- ABTree.forget = ABTree.map (fun (x : α) => ()) fun (x : β) => ()
Instances For
Equations
Instances For
Equations
- BTree.fold l n = ABTree.fold l fun (x : Unit) => n
Instances For
Equations
Instances For
Equations
- instFunctorBTree = { map := fun {α β : Type} => BTree.map, mapConst := fun {α β : Type} => BTree.map ∘ Function.const β }
Equations
- instMembershipBTree = { mem := fun (t : BTree α) (a : α) => Mem a t }
Value Contention #
Value Contention Definition #
Utils #
Equations
- length (ABTree.leaf vb) = 1
- length (ABTree.node PUnit.unit l r) = length l + length r
Instances For
Tree Building from Paths #
Equations
- buildTreeN accumTree [] = accumTree
- buildTreeN accumTree (Sum.inl pl :: ps) = buildTreeN (pl.node accumTree) ps
- buildTreeN accumTree (Sum.inr pr :: ps) = buildTreeN (accumTree.node pr) ps
Instances For
Equations
- buildTree v path = buildTreeN (BTree.leaf v) path
Instances For
@[reducible, inline]