theorem
MindFormal.DescribedChoice.switch_interval
{K : Type u_1}
(amount : K → ℝ)
(answer : K → Bool)
(F : ℝ → ℝ)
(Q e lo hi grid tolerance reported : ℝ)
(hleft : ∀ (j : K), amount j < lo → F (amount j) < Q - e)
(hright : ∀ (j : K), hi < amount j → Q + e < F (amount j))
(htrue : ∀ (j : K), F (amount j) < Q - e → answer j = true)
(hfalse : ∀ (j : K), Q + e < F (amount j) → answer j = false)
(a b : K)
(hab : amount a ≤ amount b)
(hswitch : answer a ≠ answer b)
(hspacing : amount b - amount a + tolerance ≤ grid)
(hread : reported ∈ Set.Icc (amount a - tolerance) (amount b + tolerance))
:
Every adjacent switch is localized by the verified outer tests. The complete comparator may be nonmonotone inside the interval and have several roots. Spacing and numerical tolerance are charged together, exactly once.
theorem
MindFormal.DescribedChoice.slope_outer
(F : ℝ → ℝ)
{a b root Q e slope : ℝ}
(hroot : root ∈ Set.Icc a b)
(hvalue : F root = Q)
(hslope : 0 < slope)
(he : 0 ≤ e)
(hcont : ContinuousOn F (Set.Icc a b))
(hdiff : DifferentiableOn ℝ F (Set.Ioo a b))
(hderiv : ∀ x ∈ Set.Ioo a b, slope ≤ deriv F x)
:
The lower derivative bound is on the complete comparator, including the derivative of its amount-dependent residual. The mean value theorem gives both outer tests at the exact e/slope distance from the root.
theorem
MindFormal.DescribedChoice.signed_switch_error
{K : Type u_1}
(amount : K → ℝ)
(answer : K → Bool)
(F : ℝ → ℝ)
(Q e root slope grid tolerance reported sign : ℝ)
(hleft : ∀ (j : K), amount j < root - e / slope → F (amount j) < Q - e)
(hright : ∀ (j : K), root + e / slope < amount j → Q + e < F (amount j))
(htrue : ∀ (j : K), F (amount j) < Q - e → answer j = true)
(hfalse : ∀ (j : K), Q + e < F (amount j) → answer j = false)
(a b : K)
(hab : amount a ≤ amount b)
(hswitch : answer a ≠ answer b)
(hspacing : amount b - amount a + tolerance ≤ grid)
(hread : reported ∈ Set.Icc (amount a - tolerance) (amount b + tolerance))
(hsign : |sign| = 1)
:
FF1.4's point error from the exact outer tests and a finite switch. The sign is retained in the reported cash equivalent, so losses are not silently treated as positive equivalent payments.