2013-12-30 19:02:22 +00:00
|
|
|
|
Import int.
|
|
|
|
|
|
|
|
|
|
Variable Real : Type.
|
|
|
|
|
Alias ℝ : Real.
|
2014-01-01 20:40:54 +00:00
|
|
|
|
Builtin int_to_real : Int → Real.
|
|
|
|
|
Coercion int_to_real.
|
|
|
|
|
Definition nat_to_real (a : Nat) : Real := int_to_real (nat_to_int a).
|
|
|
|
|
Coercion nat_to_real.
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-01 20:40:54 +00:00
|
|
|
|
Namespace Real.
|
|
|
|
|
Builtin numeral.
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-01 20:40:54 +00:00
|
|
|
|
Builtin add : Real → Real → Real.
|
|
|
|
|
Infixl 65 + : add.
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-01 20:40:54 +00:00
|
|
|
|
Builtin mul : Real → Real → Real.
|
|
|
|
|
Infixl 70 * : mul.
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-01 20:40:54 +00:00
|
|
|
|
Builtin div : Real → Real → Real.
|
|
|
|
|
Infixl 70 / : div.
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-01 20:40:54 +00:00
|
|
|
|
Builtin le : Real → Real → Bool.
|
|
|
|
|
Infix 50 <= : le.
|
|
|
|
|
Infix 50 ≤ : le.
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-01 20:40:54 +00:00
|
|
|
|
Definition ge (a b : Real) : Bool := b ≤ a.
|
|
|
|
|
Infix 50 >= : ge.
|
|
|
|
|
Infix 50 ≥ : ge.
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-01 20:40:54 +00:00
|
|
|
|
Definition lt (a b : Real) : Bool := ¬ (a ≥ b).
|
|
|
|
|
Infix 50 < : lt.
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-01 20:40:54 +00:00
|
|
|
|
Definition gt (a b : Real) : Bool := ¬ (a ≤ b).
|
|
|
|
|
Infix 50 > : gt.
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-01 20:40:54 +00:00
|
|
|
|
Definition sub (a b : Real) : Real := a + -1.0 * b.
|
|
|
|
|
Infixl 65 - : sub.
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-01 20:40:54 +00:00
|
|
|
|
Definition neg (a : Real) : Real := -1.0 * a.
|
|
|
|
|
Notation 75 - _ : neg.
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-01 20:40:54 +00:00
|
|
|
|
Definition abs (a : Real) : Real := if (0.0 ≤ a) a (- a).
|
|
|
|
|
Notation 55 | _ | : abs.
|
|
|
|
|
EndNamespace.
|