Documentation

CslibFrontier.Algorithms.Lean.Query.Sort.LEQuery.KeyOracle

The comparison oracle of a key function #

Cslib.Query.LEQuery.keyOracle key answers the comparison a ≤ b of the query model FreeM (LEQuery α) by comparing the keys key a ≤ key b in a linear order. Comparing edges by their weights w : E → W is the oracle of the weight function, as in the comparison (decision tree) complexity of minimum spanning forests, where a program may compare edge weights but never see them.

Main definitions #

def Cslib.Query.LEQuery.keyOracle {α : Type} {W : Type u_1} [LE W] [DecidableLE W] (key : α → W) {ι : Type} :
LEQuery α ι → ι

The comparison oracle of a key function: a ≤ b is answered by key a ≤ key b.

@[simp]
theorem Cslib.Query.LEQuery.keyOracle_le {α : Type} {W : Type u_1} [LE W] [DecidableLE W] (key : α → W) (a b : α) :
keyOracle key (le a b) = decide (key a ≤ key b)