Optional minima, maxima and strict predecessors of finite ordered sets #
The least- and greatest-result contracts include absence: none means the eligible set is empty.
They are independent of any tree, storage representation or cost model. The strict predecessor
of a query is the greatest key strictly below it; the strict successor used by
Cslib.DataStructure.OrderedSet.spec is least (s.filter (x < ·)).
Main definitions #
Cslib.DataStructure.OrderedSet.LeastResult: a complete optional-minimum contract.Cslib.DataStructure.OrderedSet.least: the mathematical minimum of a finite set.Cslib.DataStructure.OrderedSet.GreatestResult: a complete optional-maximum contract.Cslib.DataStructure.OrderedSet.greatest: the mathematical maximum of a finite set.Cslib.DataStructure.OrderedSet.predecessor: the greatest key strictly below a query.
Main results #
Cslib.DataStructure.OrderedSet.least_spec: the mathematical minimum satisfies the contract.Cslib.DataStructure.OrderedSet.LeastResult.eq_least: any satisfying result equals that minimum.Cslib.DataStructure.OrderedSet.least_eq_min:leastagrees withFinset.min.Cslib.DataStructure.OrderedSet.greatest_spec,Cslib.DataStructure.OrderedSet.GreatestResult.eq_greatest,Cslib.DataStructure.OrderedSet.greatest_eq_iff,Cslib.DataStructure.OrderedSet.greatest_eq_max: the corresponding maximum facts.Cslib.DataStructure.OrderedSet.predecessor_eq_none_iff,Cslib.DataStructure.OrderedSet.predecessor_eq_some_iff: the strict predecessor contract.
References #
Uses Mathlib's finite-set minimum, maximum and linear-order API.
A complete optional-minimum contract: none means no eligible key exists.
The mathematical minimum, independent of any representation.
least s satisfies the optional-minimum contract for s.
Every result satisfying the optional-minimum contract for s is least s.
least agrees with Finset.min (WithTop α is Option α).
A complete optional-maximum contract: none means no eligible key exists.
The mathematical maximum, independent of any representation.
greatest s satisfies the optional-maximum contract for s.
Every result satisfying the optional-maximum contract for s is greatest s.
The optional-maximum contract characterizes greatest.
greatest agrees with Finset.max (WithBot α is Option α).
The strict predecessor: the greatest key of s strictly below x, or none.
A strict predecessor is absent exactly when every key is at least the query.
A strict predecessor is the greatest key strictly below the query.