pub struct Bisection {
pub domain_size: u64,
pub budget: Budget,
pub lo: u64,
pub hi: u64,
pub threshold: u64,
}Expand description
Bounded monotone-boundary bisection carrier.
Fields§
§domain_size: u64Size of the ordered domain.
budget: BudgetBudget that counts admitted probes.
lo: u64Inclusive lower interval endpoint.
hi: u64Inclusive upper interval endpoint.
threshold: u64Monotone boundary retained inside the interval.
Implementations§
Source§impl Bisection
impl Bisection
Sourcepub fn new(
lo: u64,
hi: u64,
threshold: u64,
domain_size: u64,
max_probes: u64,
) -> Bisection
pub fn new( lo: u64, hi: u64, threshold: u64, domain_size: u64, max_probes: u64, ) -> Bisection
Init (TLA+ Init): a candidate interval straddling the threshold, no probes taken yet.
Sourcepub fn converged(&self) -> bool
pub fn converged(&self) -> bool
Whether the interval has been narrowed to a point (TLA+ Converged guard).
Sourcepub fn probe(&mut self)
pub fn probe(&mut self)
Probe the midpoint and narrow the interval – one atomic step (TLA+ ProbeLeft / ProbeRight). Maintains MonotonicityPreservation, at least halves the interval (the Halving property), and strictly decreases its width (the loop-termination measure).
Sourcepub fn bisect(&mut self)
pub fn bisect(&mut self)
Drive probes to convergence by choosing every next probe inside this call.
The decreases hi - lo is the loop-termination witness: the loop
halts, and on exit the interval is a point (hi - lo < 2) that still
straddles the threshold. When probe selection is delegated to an external scheduler,
temporal convergence instead depends on the corresponding scheduling fairness rely.