@@ -19,6 +19,7 @@ namespace SciLean
1919
2020open Classical
2121
22+
2223/-- `K` are real or complex numbers over real numbers `R`
2324
2425This class allows us to write code independent of particular implementation of real or complex numbers.
@@ -115,7 +116,9 @@ This class allows us to write code independent of particular implementation of r
115116
116117See `Scalar` for motivation for this class.
117118-/
118- class RealScalar (R :(Type _)) extends Scalar R R, LinearOrder R where
119+ class RealScalar (R : Type *) extends Scalar R R where
120+ [order : LinearOrder R]
121+
119122 is_real : ∀ x : R, im x = 0
120123
121124 asin (x : R) : R
@@ -127,6 +130,8 @@ class RealScalar (R :(Type _)) extends Scalar R R, LinearOrder R where
127130 atan (x : R) : R
128131 atan_def : ∀ x, toReal (atan x) = Real.arctan (toReal x)
129132
133+ instance {R : Type*} [RealScalar R] : LinearOrder R := RealScalar.order
134+
130135def RealScalar.pi [RealScalar R] : R := RealScalar.acos (-1 )
131136
132137scoped notation "π" => @RealScalar.pi defaultScalar% inferInstance
@@ -282,10 +287,10 @@ noncomputable instance : RealScalar ℝ where
282287 pow_def := by intros; simp; rfl
283288
284289 abs x := abs x
285- abs_def := by intros; simp; sorry_proof
290+ abs_def := by intros; sorry_proof
286291
287292 tgamma x := x.Gamma
288- tgamma_def := by intros; simp; sorry_proof
293+ tgamma_def := by intros;sorry_proof
289294
290295 lgamma x := |x.Gamma|.log
291296 lgamma_def := by intros; simp; sorry_proof
@@ -296,36 +301,7 @@ noncomputable instance : RealScalar ℝ where
296301 isNaN x := false
297302 isInf x := false
298303
299- le_total := by sorry_proof
300-
301- decidableLE x y :=
302- have := Classical.propDecidable
303- if h : x ≤ y then
304- .isTrue h
305- else
306- .isFalse h
307-
308- decidableEq x y :=
309- have := Classical.propDecidable
310- if h : x = y then
311- .isTrue h
312- else
313- .isFalse h
314-
315- decidableLT x y :=
316- have := Classical.propDecidable
317- if h : x < y then
318- .isTrue h
319- else
320- .isFalse h
321-
322- min := fun a b => if a ≤ b then a else b
323- max := fun a b => if a ≤ b then b else a
324- min_def := by sorry_proof
325- max_def := by sorry_proof
326- compare a b := compareOfLessAndEq a b
327- compare_eq_compareOfLessAndEq := by
328- compareOfLessAndEq_rfl
304+ order := by infer_instance
329305
330306
331307
0 commit comments