Documentation

BiasedBisect.Continuous

Continuous biased bisect problem #

We explore a variation of the original biased bisect problem. We find a function $E: ℝ → ℝ$ that satisfies the functional equation $$ E(n) = \min_{0 < w < n} \{E(w) + E(n - w) + w t + (n - w) s\} $$ for all positive $n$. We will see that $E(n) = n \log n/ρ$, and the optimal strategy is linear to $n$.

Main statements #

ρ is the unique real solution to the equation $ρf(ρ) = 1$, where $ρf(ρ) = e^{-s ρ} + e^{-t ρ}$.

noncomputable def ρf (s t : ) [PosReal s] [PosReal t] (ρ : ) :
Equations
Instances For
    theorem ρf_anti (s t : ) [PosReal s] [PosReal t] :
    theorem ρ_exist (s t : ) [PosReal s] [PosReal t] :
    ∃! ρ : , ρ 0 ρf s t ρ = 1
    noncomputable def ρ (s t : ) [PosReal s] [PosReal t] :
    Equations
    Instances For
      theorem ρ_satisfies (s t : ) [PosReal s] [PosReal t] :
      ρf s t (ρ s t) = 1
      theorem ρ_range (s t : ) [PosReal s] [PosReal t] :
      0 < ρ s t

      g is the unique real solution to the equation $g^s = (1-g)^t$.

      theorem g_exist (s t : ) [PosReal s] [PosReal t] :
      ∃! g : , g Set.Icc 0 1 g ^ s = (1 - g) ^ t
      noncomputable def g (s t : ) [PosReal s] [PosReal t] :
      Equations
      Instances For
        theorem g_satisfies (s t : ) [PosReal s] [PosReal t] :
        g s t ^ s = (1 - g s t) ^ t
        theorem g_range (s t : ) [PosReal s] [PosReal t] :
        g s t Set.Ioo 0 1
        theorem g_unique (s t : ) [PosReal s] [PosReal t] (g' : ) (grange : g' Set.Icc 0 1) (satisfies : g' ^ s = (1 - g') ^ t) :
        g' = g s t

        g is homogeneous.

        theorem g_homo (s t l : ) [PosReal s] [PosReal t] [PosReal l] :
        g s t = g (l * s) (l * t)

        The two coefficients ρ and g are closely related

        theorem g_ρ_agree (s t : ) [PosReal s] [PosReal t] :
        g s t = Real.exp (-t * ρ s t)

        We define the goal of the continuous version of the problem.

        def IsOptimalCostℝ (Efun : ) (s t : ) :
        Equations
        Instances For
          def IsOptimalStratℝ (Efun : ) (wfun : Set ) (s t : ) :
          Equations
          Instances For

            The proposed solution Eℝ and wℝ are simple functions with coefficients ρ and g.

            noncomputable def Eℝ (s t : ) [PosReal s] [PosReal t] :
            Equations
            Instances For
              noncomputable def wℝ (s t : ) [PosReal s] [PosReal t] :
              Equations
              Instances For

                We also verify wℝ is always between 0 and n

                theorem wℝ_range (s t : ) [PosReal s] [PosReal t] (n : ) (npos : 0 < n) :
                wℝ s t n Set.Ioo 0 n

                Similar to the discrete problem, we define the auxiliary Dℝ function and discuss its derivative. It turns out Dℝ is a convex function with a unique minimum.

                noncomputable def Dℝ (s t : ) [PosReal s] [PosReal t] (n w : ) :
                Equations
                Instances For
                  noncomputable def D'ℝ (s t : ) [PosReal s] [PosReal t] (n w : ) :
                  Equations
                  Instances For
                    theorem Dℝ_derive (s t : ) [PosReal s] [PosReal t] (n w : ) (wleft : 0 < w) (wright : w < n) :
                    HasDerivAt (Dℝ s t n) (D'ℝ s t n w) w
                    theorem D'ℝ_mono (s t : ) [PosReal s] [PosReal t] (n : ) :
                    StrictMonoOn (D'ℝ s t n) (Set.Ioo 0 n)
                    theorem D'ℝ_continuous (s t : ) [PosReal s] [PosReal t] (n : ) :
                    ContinuousOn (D'ℝ s t n) (Set.Ioo 0 n)
                    theorem D'ℝ_zero (s t : ) [PosReal s] [PosReal t] (n : ) (npos : 0 < n) :
                    D'ℝ s t n (wℝ s t n) = 0
                    theorem Dℝ_left (s t : ) [PosReal s] [PosReal t] (n w : ) (wleft : 0 < w) (wright : w < wℝ s t n) :
                    Dℝ s t n (wℝ s t n) < Dℝ s t n w
                    theorem Dℝ_right (s t : ) [PosReal s] [PosReal t] (n w : ) (wleft : wℝ s t n < w) (wright : w < n) :
                    Dℝ s t n (wℝ s t n) < Dℝ s t n w
                    theorem Dℝ_min (s t : ) [PosReal s] [PosReal t] (n : ) (npos : 0 < n) :
                    Dℝ s t n (wℝ s t n) = Eℝ s t n

                    Finally, we verify Eℝ and wℝ are indeed the solution.

                    theorem wℝ_IsOptimalStratℝ (s t : ) [PosReal s] [PosReal t] :
                    IsOptimalStratℝ (Eℝ s t) (fun (n : ) => {wℝ s t n}) s t