Commit 9ef42e17 authored by Guillaume Melquiond's avatar Guillaume Melquiond

Update parts of Coq realizations whose printing looks sane.

parent 5a92d21d
...@@ -212,8 +212,8 @@ omega. ...@@ -212,8 +212,8 @@ omega.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma nth_out_of_bound : forall (x:t) (n:Z), ((n < 0%Z)%Z \/ Lemma nth_out_of_bound :
(size <= n)%Z) -> ((nth x n) = false). forall (x:t) (n:Z), ((n < 0%Z)%Z \/ (size <= n)%Z) -> ((nth x n) = false).
intros. intros.
unfold nth. unfold nth.
rewrite nth_aux_out_of_bound; auto with zarith. rewrite nth_aux_out_of_bound; auto with zarith.
...@@ -1202,8 +1202,8 @@ Lemma to_int_def : forall (x:t), ((is_signed_positive x) -> ...@@ -1202,8 +1202,8 @@ Lemma to_int_def : forall (x:t), ((is_signed_positive x) ->
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma to_uint_extensionality : forall (v:t) (v':t), Lemma to_uint_extensionality :
((to_uint v) = (to_uint v')) -> (v = v'). forall (v:t) (v':t), ((to_uint v) = (to_uint v')) -> (v = v').
unfold to_uint. unfold to_uint.
intros v v'. intros v v'.
rewrite Nat2Z.inj_iff. rewrite Nat2Z.inj_iff.
...@@ -1211,8 +1211,8 @@ Lemma to_uint_extensionality : forall (v:t) (v':t), ...@@ -1211,8 +1211,8 @@ Lemma to_uint_extensionality : forall (v:t) (v':t),
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma to_int_extensionality : forall (v:t) (v':t), Lemma to_int_extensionality :
((to_int v) = (to_int v')) -> (v = v'). forall (v:t) (v':t), ((to_int v) = (to_int v')) -> (v = v').
apply twos_complement_extensionality. apply twos_complement_extensionality.
Qed. Qed.
...@@ -1220,8 +1220,8 @@ Qed. ...@@ -1220,8 +1220,8 @@ Qed.
Definition uint_in_range (i:Z) : Prop := (0%Z <= i)%Z /\ (i <= max_int)%Z. Definition uint_in_range (i:Z) : Prop := (0%Z <= i)%Z /\ (i <= max_int)%Z.
(* Why3 goal *) (* Why3 goal *)
Lemma to_uint_bounds : forall (v:t), (0%Z <= (to_uint v))%Z /\ Lemma to_uint_bounds :
((to_uint v) < two_power_size)%Z. forall (v:t), (0%Z <= (to_uint v))%Z /\ ((to_uint v) < two_power_size)%Z.
intros v. intros v.
unfold to_uint, uint_in_range. unfold to_uint, uint_in_range.
split. split.
...@@ -1430,8 +1430,8 @@ Lemma zeros_sign_false: Bsign last_bit zeros = false. ...@@ -1430,8 +1430,8 @@ Lemma zeros_sign_false: Bsign last_bit zeros = false.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma positive_is_ge_zeros : forall (x:t), (is_signed_positive x) <-> (sge x Lemma positive_is_ge_zeros :
zeros). forall (x:t), (is_signed_positive x) <-> (sge x zeros).
intros. intros.
unfold is_signed_positive, sge, to_int, twos_complement, size_nat. unfold is_signed_positive, sge, to_int, twos_complement, size_nat.
rewrite zeros_sign_false. destruct Bsign. rewrite zeros_sign_false. destruct Bsign.
...@@ -1586,8 +1586,8 @@ Definition lsr_bv : t -> t -> t. ...@@ -1586,8 +1586,8 @@ Definition lsr_bv : t -> t -> t.
Defined. Defined.
(* Why3 goal *) (* Why3 goal *)
Lemma lsr_bv_is_lsr : forall (x:t) (n:t), ((lsr_bv x n) = (lsr x Lemma lsr_bv_is_lsr :
(to_uint n))). forall (x:t) (n:t), ((lsr_bv x n) = (lsr x (to_uint n))).
easy. easy.
Qed. Qed.
...@@ -1616,8 +1616,8 @@ Definition lsl_bv : t -> t -> t. ...@@ -1616,8 +1616,8 @@ Definition lsl_bv : t -> t -> t.
Defined. Defined.
(* Why3 goal *) (* Why3 goal *)
Lemma lsl_bv_is_lsl : forall (x:t) (n:t), ((lsl_bv x n) = (lsl x Lemma lsl_bv_is_lsl :
(to_uint n))). forall (x:t) (n:t), ((lsl_bv x n) = (lsl x (to_uint n))).
easy. easy.
Qed. Qed.
...@@ -1640,14 +1640,14 @@ Definition rotate_left_bv : t -> t -> t. ...@@ -1640,14 +1640,14 @@ Definition rotate_left_bv : t -> t -> t.
Defined. Defined.
(* Why3 goal *) (* Why3 goal *)
Lemma rotate_left_bv_is_rotate_left : forall (v:t) (n:t), ((rotate_left_bv v Lemma rotate_left_bv_is_rotate_left :
n) = (rotate_left v (to_uint n))). forall (v:t) (n:t), ((rotate_left_bv v n) = (rotate_left v (to_uint n))).
trivial. trivial.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma rotate_right_bv_is_rotate_right : forall (v:t) (n:t), Lemma rotate_right_bv_is_rotate_right :
((rotate_right_bv v n) = (rotate_right v (to_uint n))). forall (v:t) (n:t), ((rotate_right_bv v n) = (rotate_right v (to_uint n))).
trivial. trivial.
Qed. Qed.
......
...@@ -255,8 +255,8 @@ Proof. ...@@ -255,8 +255,8 @@ Proof.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma zero_to_real : forall (x:t), (is_zero x) <-> ((t'isFinite x) /\ Lemma zero_to_real :
((t'real x) = 0%R)). forall (x:t), (is_zero x) <-> ((t'isFinite x) /\ ((t'real x) = 0%R)).
Proof. Proof.
apply zero_to_real. apply zero_to_real.
Qed. Qed.
...@@ -274,8 +274,8 @@ Proof. ...@@ -274,8 +274,8 @@ Proof.
Defined. Defined.
(* Why3 goal *) (* Why3 goal *)
Lemma zero_of_int : forall (m:ieee_float.RoundingMode.mode), Lemma zero_of_int :
(zeroF = (of_int m 0%Z)). forall (m:ieee_float.RoundingMode.mode), (zeroF = (of_int m 0%Z)).
Proof. Proof.
apply zero_of_int. apply zero_of_int.
Qed. Qed.
...@@ -302,7 +302,8 @@ Proof. ...@@ -302,7 +302,8 @@ Proof.
Defined. Defined.
(* Why3 goal *) (* Why3 goal *)
Lemma max_real_int : ((33554430 * 10141204801825835211973625643008)%R = (BuiltIn.IZR max_int)). Lemma max_real_int :
((33554430 * 10141204801825835211973625643008)%R = (BuiltIn.IZR max_int)).
Proof. Proof.
unfold max_int. unfold max_int.
now rewrite mult_IZR, <- !Z2R_IZR. now rewrite mult_IZR, <- !Z2R_IZR.
...@@ -314,8 +315,8 @@ Definition in_range (x:R) : Prop := ...@@ -314,8 +315,8 @@ Definition in_range (x:R) : Prop :=
(x <= (33554430 * 10141204801825835211973625643008)%R)%R. (x <= (33554430 * 10141204801825835211973625643008)%R)%R.
(* Why3 assumption *) (* Why3 assumption *)
Definition in_int_range (i:Z): Prop := ((-max_int)%Z <= i)%Z /\ Definition in_int_range (i:Z) : Prop :=
(i <= max_int)%Z. ((-max_int)%Z <= i)%Z /\ (i <= max_int)%Z.
(* Why3 goal *) (* Why3 goal *)
Lemma is_finite : forall (x:t), (t'isFinite x) -> (in_range (t'real x)). Lemma is_finite : forall (x:t), (t'isFinite x) -> (in_range (t'real x)).
...@@ -362,15 +363,15 @@ Proof. ...@@ -362,15 +363,15 @@ Proof.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma Round_down_le : forall (x:R), ((round ieee_float.RoundingMode.RTN Lemma Round_down_le :
x) <= x)%R. forall (x:R), ((round ieee_float.RoundingMode.RTN x) <= x)%R.
Proof. Proof.
apply Round_down_le. apply Round_down_le.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma Round_up_ge : forall (x:R), (x <= (round ieee_float.RoundingMode.RTP Lemma Round_up_ge :
x))%R. forall (x:R), (x <= (round ieee_float.RoundingMode.RTP x))%R.
Proof. Proof.
apply Round_up_ge. apply Round_up_ge.
Qed. Qed.
...@@ -390,8 +391,8 @@ Proof. ...@@ -390,8 +391,8 @@ Proof.
Qed. Qed.
(* Why3 assumption *) (* Why3 assumption *)
Definition in_safe_int_range (i:Z): Prop := ((-16777216%Z)%Z <= i)%Z /\ Definition in_safe_int_range (i:Z) : Prop :=
(i <= 16777216%Z)%Z. ((-16777216%Z)%Z <= i)%Z /\ (i <= 16777216%Z)%Z.
(* Why3 goal *) (* Why3 goal *)
Lemma Exact_rounding_for_integers : forall (m:ieee_float.RoundingMode.mode) Lemma Exact_rounding_for_integers : forall (m:ieee_float.RoundingMode.mode)
...@@ -403,12 +404,14 @@ Proof. ...@@ -403,12 +404,14 @@ Proof.
Qed. Qed.
(* Why3 assumption *) (* Why3 assumption *)
Definition same_sign (x:t) (y:t): Prop := ((is_positive x) /\ (is_positive Definition same_sign (x:t) (y:t) : Prop :=
y)) \/ ((is_negative x) /\ (is_negative y)). ((is_positive x) /\ (is_positive y)) \/
((is_negative x) /\ (is_negative y)).
(* Why3 assumption *) (* Why3 assumption *)
Definition diff_sign (x:t) (y:t): Prop := ((is_positive x) /\ (is_negative Definition diff_sign (x:t) (y:t) : Prop :=
y)) \/ ((is_negative x) /\ (is_positive y)). ((is_positive x) /\ (is_negative y)) \/
((is_negative x) /\ (is_positive y)).
(* Why3 goal *) (* Why3 goal *)
Lemma feq_eq : forall (x:t) (y:t), (t'isFinite x) -> ((t'isFinite y) -> Lemma feq_eq : forall (x:t) (y:t), (t'isFinite x) -> ((t'isFinite y) ->
...@@ -530,50 +533,50 @@ Proof. ...@@ -530,50 +533,50 @@ Proof.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma lt_lt_finite : forall (x:t) (y:t) (z:t), (lt x y) -> ((lt y z) -> Lemma lt_lt_finite :
(t'isFinite y)). forall (x:t) (y:t) (z:t), (lt x y) -> ((lt y z) -> (t'isFinite y)).
Proof. Proof.
apply lt_lt_finite. apply lt_lt_finite.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma positive_to_real : forall (x:t), (t'isFinite x) -> ((is_positive x) -> Lemma positive_to_real :
(0%R <= (t'real x))%R). forall (x:t), (t'isFinite x) -> ((is_positive x) -> (0%R <= (t'real x))%R).
Proof. Proof.
apply positive_to_real. apply positive_to_real.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma to_real_positive : forall (x:t), (t'isFinite x) -> Lemma to_real_positive :
((0%R < (t'real x))%R -> (is_positive x)). forall (x:t), (t'isFinite x) -> ((0%R < (t'real x))%R -> (is_positive x)).
Proof. Proof.
apply to_real_positive. apply to_real_positive.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma negative_to_real : forall (x:t), (t'isFinite x) -> ((is_negative x) -> Lemma negative_to_real :
((t'real x) <= 0%R)%R). forall (x:t), (t'isFinite x) -> ((is_negative x) -> ((t'real x) <= 0%R)%R).
Proof. Proof.
apply negative_to_real. apply negative_to_real.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma to_real_negative : forall (x:t), (t'isFinite x) -> Lemma to_real_negative :
(((t'real x) < 0%R)%R -> (is_negative x)). forall (x:t), (t'isFinite x) -> (((t'real x) < 0%R)%R -> (is_negative x)).
Proof. Proof.
apply to_real_negative. apply to_real_negative.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma negative_xor_positive : forall (x:t), ~ ((is_positive x) /\ Lemma negative_xor_positive :
(is_negative x)). forall (x:t), ~ ((is_positive x) /\ (is_negative x)).
Proof. Proof.
apply negative_xor_positive. apply negative_xor_positive.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma negative_or_positive : forall (x:t), (is_not_nan x) -> ((is_positive Lemma negative_or_positive :
x) \/ (is_negative x)). forall (x:t), (is_not_nan x) -> ((is_positive x) \/ (is_negative x)).
Proof. Proof.
apply negative_or_positive. apply negative_or_positive.
Qed. Qed.
...@@ -600,8 +603,9 @@ Proof. ...@@ -600,8 +603,9 @@ Proof.
Qed. Qed.
(* Why3 assumption *) (* Why3 assumption *)
Definition product_sign (z:t) (x:t) (y:t): Prop := ((same_sign x y) -> Definition product_sign (z:t) (x:t) (y:t) : Prop :=
(is_positive z)) /\ ((diff_sign x y) -> (is_negative z)). ((same_sign x y) -> (is_positive z)) /\
((diff_sign x y) -> (is_negative z)).
(* Why3 assumption *) (* Why3 assumption *)
Definition overflow_value (m:ieee_float.RoundingMode.mode) (x:t): Prop := Definition overflow_value (m:ieee_float.RoundingMode.mode) (x:t): Prop :=
...@@ -621,7 +625,7 @@ Definition overflow_value (m:ieee_float.RoundingMode.mode) (x:t): Prop := ...@@ -621,7 +625,7 @@ Definition overflow_value (m:ieee_float.RoundingMode.mode) (x:t): Prop :=
end. end.
(* Why3 assumption *) (* Why3 assumption *)
Definition sign_zero_result (m:ieee_float.RoundingMode.mode) (x:t): Prop := Definition sign_zero_result (m:ieee_float.RoundingMode.mode) (x:t) : Prop :=
(is_zero x) -> (is_zero x) ->
match m with match m with
| ieee_float.RoundingMode.RTN => (is_negative x) | ieee_float.RoundingMode.RTN => (is_negative x)
......
...@@ -274,8 +274,8 @@ Proof. ...@@ -274,8 +274,8 @@ Proof.
Defined. Defined.
(* Why3 goal *) (* Why3 goal *)
Lemma zero_of_int : forall (m:ieee_float.RoundingMode.mode), Lemma zero_of_int :
(zeroF = (of_int m 0%Z)). forall (m:ieee_float.RoundingMode.mode), (zeroF = (of_int m 0%Z)).
Proof. Proof.
apply zero_of_int. apply zero_of_int.
Qed. Qed.
...@@ -402,12 +402,14 @@ Proof. ...@@ -402,12 +402,14 @@ Proof.
Qed. Qed.
(* Why3 assumption *) (* Why3 assumption *)
Definition same_sign (x:t) (y:t): Prop := ((is_positive x) /\ (is_positive Definition same_sign (x:t) (y:t) : Prop :=
y)) \/ ((is_negative x) /\ (is_negative y)). ((is_positive x) /\ (is_positive y)) \/
((is_negative x) /\ (is_negative y)).
(* Why3 assumption *) (* Why3 assumption *)
Definition diff_sign (x:t) (y:t): Prop := ((is_positive x) /\ (is_negative Definition diff_sign (x:t) (y:t) : Prop :=
y)) \/ ((is_negative x) /\ (is_positive y)). ((is_positive x) /\ (is_negative y)) \/
((is_negative x) /\ (is_positive y)).
(* Why3 goal *) (* Why3 goal *)
Lemma feq_eq : forall (x:t) (y:t), (t'isFinite x) -> ((t'isFinite y) -> Lemma feq_eq : forall (x:t) (y:t), (t'isFinite x) -> ((t'isFinite y) ->
...@@ -529,50 +531,50 @@ Proof. ...@@ -529,50 +531,50 @@ Proof.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma lt_lt_finite : forall (x:t) (y:t) (z:t), (lt x y) -> ((lt y z) -> Lemma lt_lt_finite :
(t'isFinite y)). forall (x:t) (y:t) (z:t), (lt x y) -> ((lt y z) -> (t'isFinite y)).
Proof. Proof.
apply lt_lt_finite. apply lt_lt_finite.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma positive_to_real : forall (x:t), (t'isFinite x) -> ((is_positive x) -> Lemma positive_to_real :
(0%R <= (t'real x))%R). forall (x:t), (t'isFinite x) -> ((is_positive x) -> (0%R <= (t'real x))%R).
Proof. Proof.
apply positive_to_real. apply positive_to_real.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma to_real_positive : forall (x:t), (t'isFinite x) -> Lemma to_real_positive :
((0%R < (t'real x))%R -> (is_positive x)). forall (x:t), (t'isFinite x) -> ((0%R < (t'real x))%R -> (is_positive x)).
Proof. Proof.
apply to_real_positive. apply to_real_positive.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma negative_to_real : forall (x:t), (t'isFinite x) -> ((is_negative x) -> Lemma negative_to_real :
((t'real x) <= 0%R)%R). forall (x:t), (t'isFinite x) -> ((is_negative x) -> ((t'real x) <= 0%R)%R).
Proof. Proof.
apply negative_to_real. apply negative_to_real.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma to_real_negative : forall (x:t), (t'isFinite x) -> Lemma to_real_negative :
(((t'real x) < 0%R)%R -> (is_negative x)). forall (x:t), (t'isFinite x) -> (((t'real x) < 0%R)%R -> (is_negative x)).
Proof. Proof.
apply to_real_negative. apply to_real_negative.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma negative_xor_positive : forall (x:t), ~ ((is_positive x) /\ Lemma negative_xor_positive :
(is_negative x)). forall (x:t), ~ ((is_positive x) /\ (is_negative x)).
Proof. Proof.
apply negative_xor_positive. apply negative_xor_positive.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma negative_or_positive : forall (x:t), (is_not_nan x) -> ((is_positive Lemma negative_or_positive :
x) \/ (is_negative x)). forall (x:t), (is_not_nan x) -> ((is_positive x) \/ (is_negative x)).
Proof. Proof.
apply negative_or_positive. apply negative_or_positive.
Qed. Qed.
...@@ -599,8 +601,9 @@ Proof. ...@@ -599,8 +601,9 @@ Proof.
Qed. Qed.
(* Why3 assumption *) (* Why3 assumption *)
Definition product_sign (z:t) (x:t) (y:t): Prop := ((same_sign x y) -> Definition product_sign (z:t) (x:t) (y:t) : Prop :=
(is_positive z)) /\ ((diff_sign x y) -> (is_negative z)). ((same_sign x y) -> (is_positive z)) /\
((diff_sign x y) -> (is_negative z)).
(* Why3 assumption *) (* Why3 assumption *)
Definition overflow_value (m:ieee_float.RoundingMode.mode) (x:t): Prop := Definition overflow_value (m:ieee_float.RoundingMode.mode) (x:t): Prop :=
......
...@@ -782,8 +782,8 @@ Proof. ...@@ -782,8 +782,8 @@ Proof.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma zero_to_real : forall (x:t), (is_zero x) <-> ((is_finite x) /\ Lemma zero_to_real :
((to_real x) = 0%R)). forall (x:t), (is_zero x) <-> ((is_finite x) /\ ((to_real x) = 0%R)).
Proof. Proof.
unfold is_zero. unfold is_zero.
assert (is_finite zeroF) by easy. assert (is_finite zeroF) by easy.
...@@ -856,8 +856,8 @@ Proof. ...@@ -856,8 +856,8 @@ Proof.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma zero_of_int : forall (m:ieee_float.RoundingMode.mode), Lemma zero_of_int :
(zeroF = (of_int m 0%Z)). forall (m:ieee_float.RoundingMode.mode), (zeroF = (of_int m 0%Z)).
Proof. Proof.
auto. auto.
Qed. Qed.
...@@ -1699,8 +1699,8 @@ destruct x, y, z; destruct b, b0, b1; easy. ...@@ -1699,8 +1699,8 @@ destruct x, y, z; destruct b, b0, b1; easy.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma positive_to_real : forall (x:t), (is_finite x) -> ((is_positive x) -> Lemma positive_to_real :
(0%R <= (to_real x))%R). forall (x:t), (is_finite x) -> ((is_positive x) -> (0%R <= (to_real x))%R).
Proof. Proof.
intros x h1 h2.