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).
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.
- seq : ComputableℝSeq
A computable sequence representing
x. The sequence converges to
x.
Instances
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.
Instances For
Definition of lift.
Instances For
Definition of lift₂.
Equations
Instances For
Equations
- IsComputable.instComputableNat n = { seq := ComputableℝSeq.ofRat ↑n, prop := ⋯ }
Equations
- IsComputable.instComputableInt z = { seq := ComputableℝSeq.ofRat ↑z, prop := ⋯ }
Equations
- IsComputable.instComputableRat q = { seq := ComputableℝSeq.ofRat q, prop := ⋯ }
Equations
- IsComputable.instComputableOfNat1 = { seq := 1, prop := ComputableℝSeq.val_one }
Equations
- IsComputable.instComputableOfNat0 = { seq := 0, prop := ComputableℝSeq.val_zero }
Equations
- One or more equations did not get rendered due to their size.
Equations
- IsComputable.instComputableNeg x = IsComputable.lift Neg.neg (fun (x : ComputableℝSeq) => -x) ComputableℝSeq.val_neg hx
Equations
- IsComputable.instComputableInv x = IsComputable.lift Inv.inv (fun (x : ComputableℝSeq) => x⁻¹) ComputableℝSeq.val_inv hx
Equations
- IsComputable.instComputableAdd = IsComputable.lift₂ HAdd.hAdd (fun (x1 x2 : ComputableℝSeq) => x1 + x2) ComputableℝSeq.val_add hx hy
Equations
- IsComputable.instComputableSub = IsComputable.lift₂ HSub.hSub (fun (x1 x2 : ComputableℝSeq) => x1 - x2) ComputableℝSeq.val_sub hx hy
Equations
- IsComputable.instComputableMul = IsComputable.lift₂ HMul.hMul (fun (x1 x2 : ComputableℝSeq) => x1 * x2) ComputableℝSeq.val_mul hx hy
Equations
- IsComputable.instComputableDiv = IsComputable.lift₂ HDiv.hDiv (fun (x1 x2 : ComputableℝSeq) => x1 / x2) ComputableℝSeq.val_div hx hy
Equations
- IsComputable.instComputableNatPow n = Nat.recAux (⋯.mpr inferInstance) (fun (n : ℕ) (a : IsComputable (x ^ n)) => ⋯.mpr inferInstance) n
Equations
- One or more equations did not get rendered due to their size.
Equations
- IsComputable.instComputableNSMul n = IsComputable.lift (HSMul.hSMul n) (fun (x : ComputableℝSeq) => n • x) ⋯ hx
Equations
Equations
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
Equations
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
Definition of ofTendstoLocallyUniformlyContinuous.
Equations
- ComputableℝSeq.ofTendstoLocallyUniformlyContinuous hf fImpl fImpl_l fImpl_u hlb hub hImplDef hTLU_l hTLU_u x = ComputableℝSeq.mk (f x.val) (fun (n : ℕ) => fImpl n (x.lub n)) ⋯ ⋯ ⋯ ⋯ ⋯