@[irreducible]
def
Chapter5.Quicksort.mkTree
{a : Type}
[h₁ : LT a]
[h₂ : DecidableRel fun (x1 x2 : a) => x1 < x2]
:
Equations
- One or more equations did not get rendered due to their size.
- Chapter5.Quicksort.mkTree [] = Chapter5.Quicksort.Tree.null
Instances For
def
Chapter5.Quicksort.qsort₀
{a : Type}
[h₁ : LT a]
[h₂ : DecidableRel fun (x1 x2 : a) => x1 < x2]
:
Instances For
@[irreducible]
def
Chapter5.Quicksort.qsort₁
{a : Type}
[h₁ : LT a]
[h₂ : DecidableRel fun (x1 x2 : a) => x1 < x2]
:
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
Instances For
@[irreducible]
Equations
- Chapter5.Mergesort.merge [] x✝ = x✝
- Chapter5.Mergesort.merge x✝ [] = x✝
- Chapter5.Mergesort.merge (x_2 :: xs) (y :: ys) = if x_2 ≤ y then x_2 :: Chapter5.Mergesort.merge xs (y :: ys) else y :: Chapter5.Mergesort.merge (x_2 :: xs) ys
Instances For
Equations
Instances For
@[irreducible]
Equations
- One or more equations did not get rendered due to their size.
- Chapter5.Mergesort.mkTree₀ [] = Chapter5.Mergesort.Tree.null
Instances For
def
Chapter5.Mergesort.msort₀
{a : Type}
[LE a]
[DecidableRel fun (x1 x2 : a) => x1 ≤ x2]
(xs : List a)
:
List a
Equations
Instances For
@[irreducible]
Equations
Instances For
Equations
- Chapter5.Mergesort.mkTree₁ as = (Chapter5.Mergesort.mkPair as.length as).1
Instances For
def
Chapter5.Mergesort.msort₂
{a : Type}
[Inhabited a]
[LE a]
[DecidableRel fun (x1 x2 : a) => x1 ≤ x2]
(xs : List a)
:
List a
Equations
Instances For
Equations
- Chapter5.Mergesort.pairWith f [] = []
- Chapter5.Mergesort.pairWith f [x_1] = [x_1]
- Chapter5.Mergesort.pairWith f (x_1 :: y :: xs) = f x_1 y :: Chapter5.Mergesort.pairWith f xs
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Chapter5.Mergesort.mkTree₂ [] = Chapter5.Mergesort.Tree.null
Instances For
def
Chapter5.Mergesort.msort₃
{a : Type}
[LE a]
[DecidableRel fun (x1 x2 : a) => x1 ≤ x2]
(xs : List a)
:
List a
Equations
Instances For
Equations
Instances For
Equations
Instances For
Instances For
Equations
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Chapter5.Heapsort.Tree.null.toFormat = Std.Format.text "."
Instances For
Equations
- Chapter5.Heapsort.instReprTree = { reprPrec := fun (e : Chapter5.Heapsort.Tree a) (x : ℕ) => e.toFormat }
def
Chapter5.Bucketsort.ordered
{α β : Type}
[BEq β]
[LT β]
[DecidableRel fun (x1 x2 : β) => x1 < x2]
:
Equations
- Chapter5.Bucketsort.ordered [] x✝¹ x✝ = true
- Chapter5.Bucketsort.ordered (d :: ds) x✝¹ x✝ = (decide (d x✝¹ < d x✝) || d x✝¹ == d x✝ && Chapter5.Bucketsort.ordered ds x✝¹ x✝)
Instances For
Equations
@[irreducible]
Equations
Instances For
Equations
- Chapter5.Bucketsort.ptn₀ rng f xs = List.map (fun (m : β) => List.filter (fun (x : α) => f x == m) xs) rng
Instances For
def
Chapter5.Bucketsort.mkTree
{α β : Type}
[BEq β]
(rng : List β)
(ds : List (α → β))
(xs : List α)
:
Equations
- Chapter5.Bucketsort.mkTree rng [] xs = Chapter5.Bucketsort.Tree.leaf xs
- Chapter5.Bucketsort.mkTree rng (d :: ds') xs = Chapter5.Bucketsort.Tree.node (List.map (Chapter5.Bucketsort.mkTree rng ds') (Chapter5.Bucketsort.ptn₀ rng d xs))
Instances For
def
Chapter5.Bucketsort.bsort₀
{α β : Type}
[BEq β]
(rng : List β)
(ds : List (α → β))
(xs : List α)
:
List α
Equations
- Chapter5.Bucketsort.bsort₀ rng ds xs = (Chapter5.Bucketsort.mkTree rng ds xs).flatten
Instances For
Equations
- Chapter5.Bucketsort.bsort₁ rng [] x✝ = x✝
- Chapter5.Bucketsort.bsort₁ rng (d :: ds) x✝ = Chapter1.concatMap (Chapter5.Bucketsort.bsort₁ rng ds) (Chapter5.Bucketsort.ptn₀ rng d x✝)
Instances For
Equations
- Chapter5.Bucketsort.rsort₀ rng [] x✝ = x✝
- Chapter5.Bucketsort.rsort₀ rng (d :: ds) x✝ = (Chapter5.Bucketsort.ptn₀ rng d (Chapter5.Bucketsort.rsort₀ rng ds x✝)).flatten
Instances For
def
Chapter5.Bucketsort.ptn₁
{a b : Type}
(bnds : b × b)
[Chapter3.Ix b]
[BEq b]
(d : a → b)
(xs : List a)
:
Equations
- Chapter5.Bucketsort.ptn₁ bnds d xs = Chapter3.elems bnds default (Chapter3.accumArray (fun (xs : List a) (x : a) => xs ++ [x]) [] bnds ((List.map d xs).zip xs))
Instances For
Equations
- Chapter5.SortingSums.sortsums₀ xs ys = Chapter5.Quicksort.qsort₂ compare (List.flatMap (fun (x : a) => List.map (fun (y : a) => x + y) ys) xs)
Instances For
@[reducible, inline]
Equations
Instances For
@[reducible, inline]
Instances For
Equations
- Chapter5.SortingSums.instOrdProdPair = { compare := fun (p q : a × Chapter5.SortingSums.Pair) => compare p.1 q.1 }
def
Chapter5.SortingSums.sortsubs₁
{a : Type}
[Ord a]
[Sub a]
[Neg a]
[OfNat a 0]
[LE a]
[DecidableRel fun (x1 x2 : a) => x1 ≤ x2]
: