Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Chapter8.S1.instReprTree = { reprPrec := Chapter8.S1.instReprTree.repr }
Instances For
Equations
@[irreducible]
Equations
- One or more equations did not get rendered due to their size.
- Chapter8.S1.mkTree [] = Chapter8.S1.Tree.leaf default
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Chapter8.S1.mkTree₁ [] = Chapter8.S1.Tree.leaf default
Instances For
Equations
- Chapter8.S1.cost (Chapter8.S1.Tree.leaf x_1) = x_1
- Chapter8.S1.cost (t₁.node t₂) = 1 + (Chapter8.S1.cost t₁).max (Chapter8.S1.cost t₂)
Instances For
Equations
- Chapter8.S1.extend x (Chapter8.S1.Tree.leaf a_1) = [(Chapter8.S1.Tree.leaf x).node (Chapter8.S1.Tree.leaf a_1)]
- Chapter8.S1.extend x (a_1.node a_2) = [(Chapter8.S1.Tree.leaf x).node (a_1.node a_2)] ++ List.map (fun (x : Chapter8.S1.Tree a) => x.node a_2) (Chapter8.S1.extend x a_1)
Instances For
Equations
- Chapter8.S1.mkTrees [] = []
- Chapter8.S1.mkTrees [x_1] = [Chapter8.S1.Tree.leaf x_1]
- Chapter8.S1.mkTrees (x_1 :: xs) = Chapter1.concatMap (Chapter8.S1.extend x_1) (Chapter8.S1.mkTrees xs)
Instances For
Equations
- Chapter8.S1.foldrn f g [] = default
- Chapter8.S1.foldrn f g [x_1] = g x_1
- Chapter8.S1.foldrn f g (x_1 :: xs) = f x_1 (Chapter8.S1.foldrn f g xs)
Instances For
Equations
Instances For
@[reducible, inline]
Equations
Instances For
Instances For
Equations
- Chapter8.S1.spine (Chapter8.S1.Tree.leaf a_1) = [Chapter8.S1.Tree.leaf a_1]
- Chapter8.S1.spine (a_1.node a_2) = Chapter8.S1.spine a_1 ++ [a_2]
Instances For
Equations
- Chapter8.S1.extend₁ x ts = List.map (fun (i : ℕ) => Chapter8.S1.Tree.leaf x :: Chapter8.S1.rollup (List.take i ts) :: List.drop i ts) (List.range' 1 (List.length ts))
Instances For
Equations
Instances For
Instances For
Instances For
Equations
- Chapter8.S1.scanl1 f (x_1 :: xs) = Chapter1.scanl f x_1 xs
- Chapter8.S1.scanl1 f [] = []
Instances For
Equations
- Chapter8.S1.lcost = List.reverse ∘ (Chapter8.S1.scanl1 fun (x y : ℕ) => 1 + x.max y) ∘ List.map Chapter8.S1.cost ∘ Chapter8.S1.spine
Instances For
Equations
- Chapter8.S1.add x ts = Chapter8.S1.Tree.leaf x :: Chapter8.S1.add.join x ts
Instances For
@[irreducible]
Equations
- Chapter8.S1.add.join x [u] = [u]
- Chapter8.S1.add.join x [] = []
- Chapter8.S1.add.join x (u :: v :: ts) = if x.max (Chapter8.S1.cost u) < Chapter8.S1.cost v then u :: v :: ts else Chapter8.S1.add.join x (u.node v :: ts)
Instances For
Equations
Instances For
@[reducible, inline]
Equations
Instances For
Equations
- Chapter8.S1.leaf x✝ = (Chapter8.S1.Tree.leaf x✝, x✝)
Instances For
Equations
Instances For
Equations
- Chapter8.S2.depths.frm n (Chapter8.S1.Tree.leaf a_1) = [n]
- Chapter8.S2.depths.frm n (a_1.node a_2) = Chapter8.S2.depths.frm (n + 1) a_1 ++ Chapter8.S2.depths.frm (n + 1) a_2
Instances For
@[reducible, inline]
Equations
Instances For
@[reducible, inline]
Equations
Instances For
Equations
- Chapter8.S2.cost t = (List.map (fun (x : Chapter8.S2.Elem × ℕ) => match x with | (c, d) => d * c.2) (t.fringe.zip (Chapter8.S2.depths t))).sum
Instances For
Equations
- Chapter8.S2.weight (Chapter8.S1.Tree.leaf (fst, w)) = w
- Chapter8.S2.weight (u.node v) = Chapter8.S2.weight u + Chapter8.S2.weight v
Instances For
Equations
Instances For
Equations
- Chapter8.S2.insert t₁ [] = [t₁]
- Chapter8.S2.insert t₁ (t₂ :: ts) = if Chapter8.S2.weight t₁ ≤ Chapter8.S2.weight t₂ then t₁ :: t₂ :: ts else t₂ :: Chapter8.S2.insert t₁ ts
Instances For
Equations
Instances For
Equations
Instances For
Equations
- Chapter8.S2.mkForests₁ ts = Chapter1.apply (ts.length - 1) (Chapter1.concatMap Chapter8.S2.combine) [ts]
Instances For
Equations
Instances For
@[reducible, inline]
Equations
Instances For
@[reducible, inline]
Equations
Instances For
@[reducible, inline]
Instances For
Equations
Instances For
Equations
- Chapter8.S2.singleSQ sq = decide (List.isEmpty sq.1 = true ∧ Chapter3.SymList.singleSL sq.2 = true)
Instances For
Equations
- Chapter8.S2.extractSQ sq = (Chapter3.SymList.headSL! sq.2).1
Instances For
@[reducible, inline]
Equations
Instances For
def
Chapter8.PriorityQueue.instReprPQ.repr
{α✝ β✝ : Type}
[Repr α✝]
[Repr β✝]
:
PQ α✝ β✝ → ℕ → Std.Format
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
@[irreducible]
def
Chapter8.PriorityQueue.mergeOnSnd
{α β : Type}
[LE β]
[DecidableRel fun (x1 x2 : β) => x1 ≤ x2]
:
Equations
- One or more equations did not get rendered due to their size.
- Chapter8.PriorityQueue.mergeOnSnd [] x✝ = x✝
- Chapter8.PriorityQueue.mergeOnSnd x✝ [] = x✝
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Chapter8.PriorityQueue.toListQ Chapter8.PriorityQueue.PQ.null = []
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[irreducible]
Equations
- One or more equations did not get rendered due to their size.
- Chapter8.PriorityQueue.combineQ Chapter8.PriorityQueue.PQ.null x✝ = x✝
- Chapter8.PriorityQueue.combineQ x✝ Chapter8.PriorityQueue.PQ.null = x✝
Instances For
def
Chapter8.PriorityQueue.insertQ
{α β : Type}
[LE β]
[DecidableRel fun (x1 x2 : β) => x1 ≤ x2]
(x : α)
(p : β)
(t : PQ α β)
:
PQ α β
Equations
Instances For
def
Chapter8.PriorityQueue.deleteQ
{α β : Type}
[LE β]
[DecidableRel fun (x1 x2 : β) => x1 ≤ x2]
(q : PQ α β)
(h : q ≠ PQ.null)
:
Equations
- Chapter8.PriorityQueue.deleteQ Chapter8.PriorityQueue.PQ.null h_2 = absurd ⋯ h_2
- Chapter8.PriorityQueue.deleteQ (Chapter8.PriorityQueue.PQ.fork a x p t₁ t₂) h_2 = ((x, p), Chapter8.PriorityQueue.combineQ t₁ t₂)
Instances For
def
Chapter8.PriorityQueue.deleteQ?
{α β : Type}
[LE β]
[DecidableRel fun (x1 x2 : β) => x1 ≤ x2]
(q : PQ α β)
:
Equations
- Chapter8.PriorityQueue.deleteQ? Chapter8.PriorityQueue.PQ.null = none
- Chapter8.PriorityQueue.deleteQ? (Chapter8.PriorityQueue.PQ.fork a a_1 a_2 a_3 a_4) = some ((a_1, a_2), Chapter8.PriorityQueue.combineQ a_3 a_4)
Instances For
Instances For
Equations
Instances For
def
Chapter8.PriorityQueue.addListQ
{α β : Type}
[LE β]
[DecidableRel fun (x1 x2 : β) => x1 ≤ x2]
(xs : List (α × β))
(q : PQ α β)
:
PQ α β
Equations
- Chapter8.PriorityQueue.addListQ xs q = List.foldl (fun (acc : Chapter8.PriorityQueue.PQ α β) (x : α × β) => match x with | (x, p) => Chapter8.PriorityQueue.insertQ x p acc) q xs
Instances For
def
Chapter8.PriorityQueue.makeQ
{α β : Type}
[LE β]
[DecidableRel fun (x1 x2 : β) => x1 ≤ x2]
(xs : List (α × β))
:
PQ α β
Equations
Instances For
def
Chapter8.PriorityQueue.singleQ
{α β : Type}
[LE β]
[DecidableRel fun (x1 x2 : β) => x1 ≤ x2]
(q : PQ α β)
:
Equations
- Chapter8.PriorityQueue.singleQ q = match Chapter8.PriorityQueue.deleteQ? q with | none => true | some (fst, remaining) => Chapter8.PriorityQueue.nullQ remaining