(* *********************************************************************) (* *) (* The Compcert verified compiler *) (* *) (* Xavier Leroy, INRIA Paris-Rocquencourt *) (* *) (* Copyright Institut National de Recherche en Informatique et en *) (* Automatique. All rights reserved. This file is distributed *) (* under the terms of the GNU General Public License as published by *) (* the Free Software Foundation, either version 2 of the License, or *) (* (at your option) any later version. This file is also distributed *) (* under the terms of the INRIA Non-Commercial License Agreement. *) (* *) (* *********************************************************************) (* * Axiomatization of floating-point numbers. *) (* * In contrast with what we do with machine integers, we do not bother to formalize precisely IEEE floating-point arithmetic. Instead, we simply axiomatize a type [float] for IEEE double-precision floats and the associated operations. *) include "Coqlib.ma". include "Integers.ma". naxiom float: Type. (*Module Float.*) naxiom Fzero: float. naxiom Fone: float. naxiom Fneg: float → float. naxiom Fabs: float → float. naxiom singleoffloat: float → float. naxiom intoffloat: float → int. naxiom intuoffloat: float → int. naxiom floatofint: int → float. naxiom floatofintu: int → float. naxiom Fadd: float → float → float. naxiom Fsub: float → float → float. naxiom Fmul: float → float → float. naxiom Fdiv: float → float → float. naxiom Fcmp: comparison → float → float → bool. naxiom eq_dec: ∀f1,f2: float. (f1 = f2) + (f1 ≠ f2). (* * Below are the only properties of floating-point arithmetic that we rely on in the compiler proof. *) naxiom addf_commut: ∀f1,f2. Fadd f1 f2 = Fadd f2 f1. naxiom subf_addf_opp: ∀f1,f2. Fsub f1 f2 = Fadd f1 (Fneg f2). naxiom singleoffloat_idem: ∀f. singleoffloat (singleoffloat f) = singleoffloat f. naxiom Fcmp_ne_eq: ∀ f1,f2. Fcmp Cne f1 f2 = ¬(Fcmp Ceq f1 f2). naxiom Fcmp_le_lt_eq: ∀ f1,f2. Fcmp Cle f1 f2 = (Fcmp Clt f1 f2 ∨ Fcmp Ceq f1 f2). naxiom Fcmp_ge_gt_eq: ∀f1,f2. Fcmp Cge f1 f2 = (Fcmp Cgt f1 f2 ∨ Fcmp Ceq f1 f2). naxiom Feq_zero_true: Fcmp Ceq Fzero Fzero = true. naxiom Feq_zero_false: ∀f. f ≠ Fzero → Fcmp Ceq f Fzero = false. (*End Float.*)