Best-First Monotone Prefix-Cost Search #
This module formalizes generic best-first search over a nonempty finite candidate set Ξ : Finset ι
with a monotone non-decreasing prefix-cost table v : ℕ → ι → ℝ (original formalization of the
combinatorial core shared by best-first sphere decoding, A*-style prefix search, and minimum-metric
tree search).
Starting with every branch j ∈ Ξ at prefix length 1 (Ξ.card initial prefix nodes), each loop
iteration selects a branch minimizing the current prefix cost v (len j) j and increments its
length by 1 until a selected branch reaches target decision depth depth. Ties among branches of
equal minimum prefix cost are broken arbitrarily via classical choice (Classical.choose), so
bestFirstLoop and bestFirstSearch are noncomputable, and the visited-node count
∑ j ∈ Ξ, res.finalLen j = Ξ.card + res.expansions (initial nodes plus expansions) is sandwiched
between the counts of prefixes strictly cheaper than (< d*) and at most (≤ d*) the winning
decision-depth cost d* = v depth res.winner.
Main definitions #
Cslib.Algorithms.Lean.BestFirstPrefixSearch.SearchResult: output record holding the selectedwinner, per-branchfinalLen, andexpansionsperformed.Cslib.Algorithms.Lean.BestFirstPrefixSearch.bestFirstLoop/Cslib.Algorithms.Lean.BestFirstPrefixSearch.bestFirstSearch: fuel-bounded best-first search expanding a minimum-cost branch until a branch reaches decision depthdepth.
Main results #
Cslib.Algorithms.Lean.BestFirstPrefixSearch.bestFirstLoop_spec: loop invariant tracking branch membership, depth, lengths, total visited-node conservation∑ j ∈ Ξ, res.finalLen j = (∑ j ∈ Ξ, len j) + res.expansions, optimality (IsMinOn), and strict/non-strict threshold pruning.Cslib.Algorithms.Lean.BestFirstPrefixSearch.bestFirstSearch_optimality:bestFirstSearchreturns a member ofΞthat minimizesv depthonΞ(IsMinOn).Cslib.Algorithms.Lean.BestFirstPrefixSearch.bestFirstSearch_expansion_bounds: expansion boundsdepth - 1 ≤ res.expansions ≤ Ξ.card * (depth - 1)and visited-node boundsΞ.card + (depth - 1) ≤ ∑ j ∈ Ξ, res.finalLen j ≤ Ξ.card * depth.Cslib.Algorithms.Lean.BestFirstPrefixSearch.bestFirstSearch_pruning_sandwich: threshold-pruning sandwich bounding∑ j ∈ Ξ, res.finalLen jbetween prefixes with cost< d*and≤ d*, whered* = v depth res.winner.
Output of a best-first prefix search run over candidate branches ι.
Fuel-bounded best-first search loop expanding a branch with smallest current prefix cost
v (len j) j (breaking ties by classical choice) until a selected branch reaches target depth
depth or fuel is exhausted.
Full best-first search initialized with every candidate branch at prefix length 1 and loop
fuel depth * Ξ.card.
Unfolding equation expressing bestFirstSearch in terms of bestFirstLoop.
Exact loop invariant for bestFirstLoop under monotone non-decreasing prefix costs v.
Exact optimality of bestFirstSearch at decision depth depth ≥ 1: the selected branch
belongs to Ξ and minimizes v depth on Ξ.
Exact visited-node count identity for bestFirstSearch: the sum of final prefix lengths over
Ξ equals Ξ.card + res.expansions.
Node-expansion and visited-node count bounds for bestFirstSearch.
Threshold-pruning sandwich bounds for bestFirstSearch in terms of the winning cost
dStar = v depth res.winner.