Local Notation __ := (eq_refl Datatypes.Lt).
Local Hint Extern 1 (Prec_gt_0 _) => exact (eq_refl Datatypes.Lt).
Local Hint Extern 1 (_ < _) => exact (eq_refl Datatypes.Lt).
(** * Double-precision FP numbers *)
Module Float.
(** ** NaN payload manipulations *)
(** The following definitions are not part of the IEEE754 standard but apply to all architectures supported by CompCert. *)
(** Transform a Nan payload to a quiet Nan payload. *)
Program Definition transform_quiet_pl (pl:nan_pl 53) : nan_pl 53 :=
Pos.lor pl (iter_nat xO 51 xH).
Next Obligation.
destruct pl.
simpl. rewrite Z.ltb_lt in *.
assert (forall x, Fcore_digits.digits2_pos x = Pos.size x).
{ induction x0; simpl; auto; rewrite IHx0; zify; omega. }
rewrite H, Psize_log_inf, <- Zlog2_log_inf in *. clear H.
change (Z.pos (Pos.lor x 2251799813685248)) with (Z.lor (Z.pos x) 2251799813685248%Z).
rewrite Z.log2_lor by (zify; omega).
apply Z.max_case. auto. simpl. omega.
Qed.

(* Specifications: *)
Lemma nan_payload_fequal:
forall prec (p1 p2: nan_pl prec),
proj1_sig p1 = proj1_sig p2 -> p1 = p2.
Lemma lor_idempotent:
forall x y, Pos.lor (Pos.lor x y) y = Pos.lor x y.
Lemma transform_quiet_pl_idempotent:
forall pl, transform_quiet_pl (transform_quiet_pl pl) = transform_quiet_pl pl.
Lemma nan_payload_fequal:
forall prec (p1 p2: nan_pl prec),
proj1_sig p1 = proj1_sig p2 -> p1 = p2.
Lemma lor_idempotent:
forall x y, Pos.lor (Pos.lor x y) y = Pos.lor x y.
Lemma transform_quiet_pl_idempotent:
forall pl, transform_quiet_pl (transform_quiet_pl pl) = transform_quiet_pl pl.