source: C-semantics/Floats.ma @ 3

Last change on this file since 3 was 3, checked in by campbell, 9 years ago

Import work-in-progress port of the CompCert? C semantics to matita.

File size: 2.6 KB
Line 
1(* *********************************************************************)
2(*                                                                     *)
3(*              The Compcert verified compiler                         *)
4(*                                                                     *)
5(*          Xavier Leroy, INRIA Paris-Rocquencourt                     *)
6(*                                                                     *)
7(*  Copyright Institut National de Recherche en Informatique et en     *)
8(*  Automatique.  All rights reserved.  This file is distributed       *)
9(*  under the terms of the GNU General Public License as published by  *)
10(*  the Free Software Foundation, either version 2 of the License, or  *)
11(*  (at your option) any later version.  This file is also distributed *)
12(*  under the terms of the INRIA Non-Commercial License Agreement.     *)
13(*                                                                     *)
14(* *********************************************************************)
15
16(* * Axiomatization of floating-point numbers. *)
17
18(* * In contrast with what we do with machine integers, we do not bother
19  to formalize precisely IEEE floating-point arithmetic.  Instead, we
20  simply axiomatize a type [float] for IEEE double-precision floats
21  and the associated operations.  *)
22
23include "Coqlib.ma".
24include "Integers.ma".
25
26naxiom float: Type.
27
28(*Module Float.*)
29
30naxiom Fzero: float.
31naxiom Fone: float.
32
33naxiom Fneg: float → float.
34naxiom Fabs: float → float.
35naxiom singleoffloat: float → float.
36naxiom intoffloat: float → int.
37naxiom intuoffloat: float → int.
38naxiom floatofint: int → float.
39naxiom floatofintu: int → float.
40
41naxiom Fadd: float → float → float.
42naxiom Fsub: float → float → float.
43naxiom Fmul: float → float → float.
44naxiom Fdiv: float → float → float.
45
46naxiom Fcmp: comparison → float → float → bool.
47
48naxiom eq_dec: ∀f1,f2: float. (f1 = f2) + (f1 ≠ f2).
49
50(* * Below are the only properties of floating-point arithmetic that we
51  rely on in the compiler proof. *)
52
53naxiom addf_commut: ∀f1,f2. Fadd f1 f2 = Fadd f2 f1.
54
55naxiom subf_addf_opp: ∀f1,f2. Fsub f1 f2 = Fadd f1 (Fneg f2).
56
57naxiom singleoffloat_idem:
58  ∀f. singleoffloat (singleoffloat f) = singleoffloat f.
59
60naxiom Fcmp_ne_eq:
61  ∀ f1,f2. Fcmp Cne f1 f2 = ¬(Fcmp Ceq f1 f2).
62naxiom Fcmp_le_lt_eq:
63  ∀ f1,f2. Fcmp Cle f1 f2 = (Fcmp Clt f1 f2 ∨ Fcmp Ceq f1 f2).
64naxiom Fcmp_ge_gt_eq:
65  ∀f1,f2. Fcmp Cge f1 f2 = (Fcmp Cgt f1 f2 ∨ Fcmp Ceq f1 f2).
66
67naxiom Feq_zero_true: Fcmp Ceq Fzero Fzero = true.
68naxiom Feq_zero_false: ∀f. f ≠ Fzero → Fcmp Ceq f Fzero = false.
69
70(*End Float.*)
Note: See TracBrowser for help on using the repository browser.