Documentation

LeanPool.ComputableReal.IsComputable

The IsComputable typeclass #

IsComputable x packages a ComputableℝSeq converging to the real number x: an explicit sequence of rational interval approximations. Closure instances (for arithmetic, powers, scalar multiples) and Decidable instances for comparisons are provided, along with a tool for lifting continuous functions defined by locally-uniformly converging rational approximations.

Since a ComputableℝSeq is an arbitrary function ℕ → ℚInterval (with convergence proofs) rather than recursive data, this is not computability in the computable-analysis sense, and the comparison instances below are classical (noncomputable, via sign information on the limit).

class IsComputable (x : ) :

Type class stating that x : ℝ carries a ComputableℝSeq: an explicit sequence of rational interval approximations converging to x. Like Decidable, it carries data with it, and classically every real number admits such a sequence; its value lies in the explicit approximations it provides, not in a computability guarantee.

Instances
    @[reducible]
    def IsComputable.liftEq {x y : } (h : x = y) :

    Turns one IsComputable into another one, given a proof that they're equal. This is directly analogous to decidable_of_iff, as a way to avoid Eq.rec on data-carrying instances.

    Equations
    Instances For
      @[reducible]
      def IsComputable.lift {x : } (fr : ) (fs : ComputableℝSeqComputableℝSeq) (h : ∀ (a : ComputableℝSeq), (fs a).val = fr a.val) :

      Definition of lift.

      Equations
      Instances For
        @[reducible]
        def IsComputable.lift₂ {x y : } (fr : ) (fs : ComputableℝSeqComputableℝSeqComputableℝSeq) (h : ∀ (a b : ComputableℝSeq), (fs a b).val = fr a.val b.val) :

        Definition of lift₂.

        Equations
        Instances For
          @[implicit_reducible]
          Equations
          @[implicit_reducible]
          Equations
          @[implicit_reducible]
          Equations
          @[implicit_reducible]
          Equations
          • One or more equations did not get rendered due to their size.
          @[implicit_reducible]
          noncomputable instance IsComputable.instComputableDiv {x y : } [hx : IsComputable x] [hy : IsComputable y] :
          Equations
          @[implicit_reducible]
          Equations
          @[implicit_reducible]
          noncomputable instance IsComputable.instComputableZPow {x : } [hx : IsComputable x] (z : ) :
          Equations
          • One or more equations did not get rendered due to their size.
          @[implicit_reducible]
          noncomputable instance IsComputable.instComputableNSMul {x : } [hx : IsComputable x] (n : ) :
          Equations
          @[implicit_reducible]
          noncomputable instance IsComputable.instComputableZSMul {x : } [hx : IsComputable x] (z : ) :
          Equations
          @[implicit_reducible]
          noncomputable instance IsComputable.instComputableQSMul {x : } [hx : IsComputable x] (q : ) :
          Equations
          @[implicit_reducible]
          noncomputable instance IsComputable.instDecidableLE {x y : } [hx : IsComputable x] [hy : IsComputable y] :

          When expressions happen to be IsComputable, we can get a decidability instance by lifting them to a comparison on the ComputableℝSeqs. The comparison there is classical (it goes through the noncomputable ComputableℝSeq.sign), so this instance is noncomputable and carries no algorithmic content.

          Equations
          @[implicit_reducible]
          noncomputable instance IsComputable.instDecidableEq {x y : } [hx : IsComputable x] [hy : IsComputable y] :
          Decidable (x = y)
          Equations
          @[implicit_reducible]
          noncomputable instance IsComputable.instDecidableLT {x y : } [hx : IsComputable x] [hy : IsComputable y] :
          Decidable (x < y)
          Equations
          def TendstoLocallyUniformlyWithout (F : ) (f : ) :

          This is very similar to the statement TendstoLocallyUniformly (fun n x ↦ (F n x : ℝ)) (fun (q : ℚ) ↦ f q) .atTop but that only uses neighborhoods within the rationals, which is a strictly weaker condition. This uses neighborhoods in the ambient space, the reals.

          Equations
          Instances For
            theorem Real_mk_of_TendstoLocallyUniformly' (fImpl : ) (f : ) (hfImpl : TendstoLocallyUniformlyWithout fImpl f) (hf : Continuous f) (x : CauSeq abs) :
            ∃ (h : IsCauSeq abs fun (n : ) => fImpl n (x n)), Real.mk fun (n : ) => fImpl n (x n), h = f (Real.mk x)
            def ComputableℝSeq.ofTendstoLocallyUniformlyContinuous {f : } (hf : Continuous f) (fImpl : NonemptyInterval NonemptyInterval ) (fImpl_l fImpl_u : ) (hlb : ∀ (n : ) (q : NonemptyInterval ), xq, (fImpl_l n q.toProd.1) f x) (hub : ∀ (n : ) (q : NonemptyInterval ), xq, f x (fImpl_u n q.toProd.2)) (hImplDef : ∀ (n : ) (q : NonemptyInterval ), fImpl n q = { fst := fImpl_l n q.toProd.1, snd := fImpl_u n q.toProd.2, fst_le_snd := }) (hTLU_l : TendstoLocallyUniformlyWithout fImpl_l f) (hTLU_u : TendstoLocallyUniformlyWithout fImpl_u f) (x : ComputableℝSeq) :

            Definition of ofTendstoLocallyUniformlyContinuous.

            Equations
            Instances For
              @[simp]
              theorem ComputableℝSeq.val_ofTendstoLocallyUniformlyContinuous (f : ) (hf : Continuous f) (fI : NonemptyInterval NonemptyInterval ) (fl fu : ) (h₁ : ∀ (n : ) (q : NonemptyInterval ), xq, (fl n q.toProd.1) f x) (h₂ : ∀ (n : ) (q : NonemptyInterval ), xq, f x (fu n q.toProd.2)) (h₃ : ∀ (n : ) (q : NonemptyInterval ), fI n q = { fst := fl n q.toProd.1, snd := fu n q.toProd.2, fst_le_snd := }) (h₄ : TendstoLocallyUniformlyWithout fl f) (h₅ : TendstoLocallyUniformlyWithout fu f) (a : ComputableℝSeq) :
              (ofTendstoLocallyUniformlyContinuous hf fI fl fu h₁ h₂ h₃ h₄ h₅ a).val = f a.val
              def Rat.toDecimal (q : ) (prec : := 20) :

              Definition of toDecimal.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For