summaryrefslogtreecommitdiff
path: root/lib/coq/Sail2_real.v
blob: e4e4316e5360c6b46d7afcecc929728960914a1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Require Export Rbase.
Require Import Reals.
Require Export ROrderedType.
Require Import Sail2_values.

(* "Decidable" in a classical sense... *)
Instance Decidable_eq_real : forall (x y : R), Decidable (x = y) :=
  Decidable_eq_from_dec Req_dec.

Definition realFromFrac (num denom : Z) : R := Rdiv (IZR num) (IZR denom).

Definition gteq_real (x y : R) : bool := if Rge_dec x y then true else false.
Definition lteq_real (x y : R) : bool := if Rle_dec x y then true else false.
Definition gt_real (x y : R) : bool := if Rgt_dec x y then true else false.
Definition lt_real (x y : R) : bool := if Rlt_dec x y then true else false.

(* Export select definitions from outside of Rbase *)
Definition powerRZ := powerRZ.
Definition Rabs := Rabs.
Definition sqrt := sqrt.

(* Use flocq definitions, but without making the whole library a dependency. *)
Definition Zfloor (x : R) := (up x - 1)%Z.
Definition Zceil (x : R) := (- Zfloor (- x))%Z.