Skip to content

Commit fe2e177

Browse files
committed
Clean branch (no sorries) - start sqrt+pi work
1 parent b0b7301 commit fe2e177

File tree

4 files changed

+262
-116
lines changed

4 files changed

+262
-116
lines changed

ComputableReal.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import ComputableReal.ComputableRSeq
2+
import ComputableReal.ComputableReal
3+
import ComputableReal.IsComputable
4+
import ComputableReal.SpecialFunctions

ComputableReal/Constants.lean

Lines changed: 0 additions & 24 deletions
This file was deleted.

ComputableReal/IsComputable.lean

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ instance instComputableDiv [hx : IsComputable x] [hy : IsComputable y] : IsCompu
6161
lift₂ _ (· / ·) ComputableℝSeq.val_div hx hy
6262

6363
instance instComputableNatPow [hx : IsComputable x] (n : ℕ) : IsComputable (x ^ n) := by
64+
--TODO: Redo this to use native powering on the ComputableℝSeq. This avoids more costly
65+
-- (and inaccurate) interval multiplications. That will also turn it into exponentiation
66+
-- by squaring.
6467
induction n
6568
· rw [pow_zero]
6669
infer_instance
@@ -74,9 +77,15 @@ instance instComputableZPow [hx : IsComputable x] (z : ℤ) : IsComputable (x ^
7477
· simp only [zpow_negSucc]
7578
infer_instance
7679

77-
instance instComputableNSMul [hx : IsComputable x] (n : ℕ) : IsComputable (n • x) := by
78-
rw [nsmul_eq_mul]
79-
infer_instance
80+
instance instComputableNSMul [hx : IsComputable x] (n : ℕ) : IsComputable (n • x) :=
81+
lift _ (n • ·) (by
82+
--TODO move to a ComputableℝSeq lemma
83+
intro a
84+
induction n
85+
· simp
86+
· rename_i ih
87+
simp [ih, succ_nsmul, add_mul]
88+
) hx
8089

8190
instance instComputableZSMul [hx : IsComputable x] (z : ℤ) : IsComputable (z • x) := by
8291
rw [zsmul_eq_mul]
@@ -104,7 +113,7 @@ instance instDecidableLT [hx : IsComputable x] [hy : IsComputable y] : Decidable
104113
simp only [← Computableℝ.lt_iff_lt, Computableℝ.val_mk_eq_val, hx.prop, hy.prop]
105114
)
106115

107-
private theorem test_exec : ((3 : ℝ) + (5 : ℕ)) / 100 < (3 : ℚ) * (5 + (1 / 5)^2 - 1) ∧
116+
example : ((3 : ℝ) + (5 : ℕ)) / 100 < (3 : ℚ) * (5 + (1 / 5)^2 - 1) ∧
108117
(5:ℕ) = ((1:ℝ) + (2:ℚ)^2) := by
109118
native_decide
110119

0 commit comments

Comments
 (0)