2014-01-05 20:05:08 +00:00
|
|
|
|
import Int
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
|
variable Real : Type
|
|
|
|
|
alias ℝ : Real
|
|
|
|
|
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-05 20:05:08 +00:00
|
|
|
|
namespace Real
|
|
|
|
|
builtin numeral
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
|
builtin add : Real → Real → Real
|
|
|
|
|
infixl 65 + : add
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
|
builtin mul : Real → Real → Real
|
|
|
|
|
infixl 70 * : mul
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
|
builtin div : Real → Real → Real
|
|
|
|
|
infixl 70 / : div
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
|
builtin le : Real → Real → Bool
|
|
|
|
|
infix 50 <= : le
|
|
|
|
|
infix 50 ≤ : le
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +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-05 20:05:08 +00:00
|
|
|
|
definition lt (a b : Real) : Bool := ¬ (a ≥ b)
|
|
|
|
|
infix 50 < : lt
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
|
definition gt (a b : Real) : Bool := ¬ (a ≤ b)
|
|
|
|
|
infix 50 > : gt
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +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-05 20:05:08 +00:00
|
|
|
|
definition neg (a : Real) : Real := -1.0 * a
|
|
|
|
|
notation 75 - _ : neg
|
2013-12-30 19:02:22 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
|
definition abs (a : Real) : Real := if (0.0 ≤ a) a (- a)
|
|
|
|
|
notation 55 | _ | : abs
|
|
|
|
|
end
|