Commit 14972b6d authored by Guillaume Melquiond's avatar Guillaume Melquiond

Update parts of Coq realizations whose printing looks sane.

parent 070cdf54
...@@ -1754,8 +1754,8 @@ Defined. ...@@ -1754,8 +1754,8 @@ Defined.
(* Why3 goal *) (* Why3 goal *)
Lemma eq_sub_bv_def : Lemma eq_sub_bv_def :
forall (a:t) (b:t) (i:t) (n:t), forall (a:t) (b:t) (i:t) (n:t),
let mask := (lsl_bv (sub (lsl_bv one n) one) i) in let mask := lsl_bv (sub (lsl_bv one n) one) i in
((eq_sub_bv a b i n) <-> ((bw_and b mask) = (bw_and a mask))). (eq_sub_bv a b i n) <-> ((bw_and b mask) = (bw_and a mask)).
rewrite Of_int_one. rewrite Of_int_one.
easy. easy.
Qed. Qed.
......
...@@ -61,7 +61,7 @@ Lemma Bounded_real_no_overflow : ...@@ -61,7 +61,7 @@ Lemma Bounded_real_no_overflow :
forall (m:floating_point.Rounding.mode) (x:R), forall (m:floating_point.Rounding.mode) (x:R),
((Reals.Rbasic_fun.Rabs x) <= ((Reals.Rbasic_fun.Rabs x) <=
(9007199254740991 * 19958403095347198116563727130368385660674512604354575415025472424372118918689640657849579654926357010893424468441924952439724379883935936607391717982848314203200056729510856765175377214443629871826533567445439239933308104551208703888888552684480441575071209068757560416423584952303440099278848)%R)%R -> (9007199254740991 * 19958403095347198116563727130368385660674512604354575415025472424372118918689640657849579654926357010893424468441924952439724379883935936607391717982848314203200056729510856765175377214443629871826533567445439239933308104551208703888888552684480441575071209068757560416423584952303440099278848)%R)%R ->
(no_overflow m x). no_overflow m x.
exact (Bounded_real_no_overflow 53 1024 (refl_equal true) (refl_equal true)). exact (Bounded_real_no_overflow 53 1024 (refl_equal true) (refl_equal true)).
Qed. Qed.
......
...@@ -65,7 +65,7 @@ Qed. ...@@ -65,7 +65,7 @@ Qed.
Lemma Bounded_real_no_overflow : Lemma Bounded_real_no_overflow :
forall (m:floating_point.Rounding.mode) (x:R), forall (m:floating_point.Rounding.mode) (x:R),
((Reals.Rbasic_fun.Rabs x) <= ((Reals.Rbasic_fun.Rabs x) <=
(33554430 * 10141204801825835211973625643008)%R)%R -> (no_overflow m x). (33554430 * 10141204801825835211973625643008)%R)%R -> no_overflow m x.
intros m x Hx. intros m x Hx.
unfold no_overflow. unfold no_overflow.
rewrite max_single_eq in *. rewrite max_single_eq in *.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -28,7 +28,7 @@ Definition permut {a:Type} {a_WT:WhyType a} (l1:(list a)) ...@@ -28,7 +28,7 @@ Definition permut {a:Type} {a_WT:WhyType a} (l1:(list a))
(* Why3 goal *) (* Why3 goal *)
Lemma Permut_refl : Lemma Permut_refl :
forall {a:Type} {a_WT:WhyType a}, forall (l:(list a)), (permut l l). forall {a:Type} {a_WT:WhyType a}, forall (l:(list a)), permut l l.
Proof. Proof.
now intros a a_WT l. now intros a a_WT l.
Qed. Qed.
...@@ -44,7 +44,7 @@ Qed. ...@@ -44,7 +44,7 @@ Qed.
Lemma Permut_trans : Lemma Permut_trans :
forall {a:Type} {a_WT:WhyType a}, forall {a:Type} {a_WT:WhyType a},
forall (l1:(list a)) (l2:(list a)) (l3:(list a)), forall (l1:(list a)) (l2:(list a)) (l3:(list a)),
(permut l1 l2) -> (permut l2 l3) -> (permut l1 l3). (permut l1 l2) -> (permut l2 l3) -> permut l1 l3.
Proof. Proof.
intros a a_WT l1 l2 l3 h1 h2 x. intros a a_WT l1 l2 l3 h1 h2 x.
now rewrite h1. now rewrite h1.
...@@ -108,7 +108,7 @@ Qed. ...@@ -108,7 +108,7 @@ Qed.
Lemma Permut_append_swap : Lemma Permut_append_swap :
forall {a:Type} {a_WT:WhyType a}, forall {a:Type} {a_WT:WhyType a},
forall (l1:(list a)) (l2:(list a)), forall (l1:(list a)) (l2:(list a)),
(permut (Init.Datatypes.app l1 l2) (Init.Datatypes.app l2 l1)). permut (Init.Datatypes.app l1 l2) (Init.Datatypes.app l2 l1).
Proof. Proof.
intros a a_WT l1 l2 y. intros a a_WT l1 l2 y.
rewrite 2!NumOcc.Append_Num_Occ. rewrite 2!NumOcc.Append_Num_Occ.
...@@ -119,7 +119,7 @@ Qed. ...@@ -119,7 +119,7 @@ Qed.
Lemma Permut_mem : Lemma Permut_mem :
forall {a:Type} {a_WT:WhyType a}, forall {a:Type} {a_WT:WhyType a},
forall (x:a) (l1:(list a)) (l2:(list a)), forall (x:a) (l1:(list a)) (l2:(list a)),
(permut l1 l2) -> (list.Mem.mem x l1) -> (list.Mem.mem x l2). (permut l1 l2) -> (list.Mem.mem x l1) -> list.Mem.mem x l2.
Proof. Proof.
intros a a_WT x l1 l2 h1 h2. intros a a_WT x l1 l2 h1 h2.
apply NumOcc.Mem_Num_Occ. apply NumOcc.Mem_Num_Occ.
......
...@@ -237,8 +237,7 @@ Definition range (a:(Z -> Z)) (n:Z) : Prop := ...@@ -237,8 +237,7 @@ Definition range (a:(Z -> Z)) (n:Z) : Prop :=
(* Why3 goal *) (* Why3 goal *)
Lemma injective_surjective : Lemma injective_surjective :
forall (a:(Z -> Z)) (n:Z), forall (a:(Z -> Z)) (n:Z), (injective a n) -> (range a n) -> surjective a n.
(injective a n) -> (range a n) -> (surjective a n).
Proof. Proof.
unfold injective, range, surjective. unfold injective, range, surjective.
intros a n h1 h2. intros a n h1 h2.
......
...@@ -39,7 +39,7 @@ Qed. ...@@ -39,7 +39,7 @@ Qed.
Lemma prime_coprime : Lemma prime_coprime :
forall (p:Z), forall (p:Z),
(number.Prime.prime p) <-> (number.Prime.prime p) <->
((2%Z <= p)%Z /\ forall (n:Z), ((1%Z <= n)%Z /\ (n < p)%Z) -> (coprime n p)). ((2%Z <= p)%Z /\ forall (n:Z), ((1%Z <= n)%Z /\ (n < p)%Z) -> coprime n p).
intros p. intros p.
(* (*
Znumtheory.prime_intro: Znumtheory.prime_intro:
...@@ -66,7 +66,7 @@ Qed. ...@@ -66,7 +66,7 @@ Qed.
Lemma Gauss : Lemma Gauss :
forall (a:Z) (b:Z) (c:Z), forall (a:Z) (b:Z) (c:Z),
((number.Divisibility.divides a (b * c)%Z) /\ (coprime a b)) -> ((number.Divisibility.divides a (b * c)%Z) /\ (coprime a b)) ->
(number.Divisibility.divides a c). number.Divisibility.divides a c.
intros a b c (h1,h2). intros a b c (h1,h2).
apply Znumtheory.Gauss with b; auto. apply Znumtheory.Gauss with b; auto.
rewrite <- coprime_is_Zrel_prime; auto. rewrite <- coprime_is_Zrel_prime; auto.
......
...@@ -40,59 +40,59 @@ easy. ...@@ -40,59 +40,59 @@ easy.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_refl : forall (n:Z), (divides n n). Lemma divides_refl : forall (n:Z), divides n n.
Proof. Proof.
exact Zdivide_refl. exact Zdivide_refl.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_1_n : forall (n:Z), (divides 1%Z n). Lemma divides_1_n : forall (n:Z), divides 1%Z n.
Proof. Proof.
exact Zone_divide. exact Zone_divide.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_0 : forall (n:Z), (divides n 0%Z). Lemma divides_0 : forall (n:Z), divides n 0%Z.
Proof. Proof.
exact Zdivide_0. exact Zdivide_0.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_left : Lemma divides_left :
forall (a:Z) (b:Z) (c:Z), (divides a b) -> (divides (c * a)%Z (c * b)%Z). forall (a:Z) (b:Z) (c:Z), (divides a b) -> divides (c * a)%Z (c * b)%Z.
Proof. Proof.
exact Zmult_divide_compat_l. exact Zmult_divide_compat_l.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_right : Lemma divides_right :
forall (a:Z) (b:Z) (c:Z), (divides a b) -> (divides (a * c)%Z (b * c)%Z). forall (a:Z) (b:Z) (c:Z), (divides a b) -> divides (a * c)%Z (b * c)%Z.
Proof. Proof.
exact Zmult_divide_compat_r. exact Zmult_divide_compat_r.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_oppr : forall (a:Z) (b:Z), (divides a b) -> (divides a (-b)%Z). Lemma divides_oppr : forall (a:Z) (b:Z), (divides a b) -> divides a (-b)%Z.
Proof. Proof.
exact Zdivide_opp_r. exact Zdivide_opp_r.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_oppl : forall (a:Z) (b:Z), (divides a b) -> (divides (-a)%Z b). Lemma divides_oppl : forall (a:Z) (b:Z), (divides a b) -> divides (-a)%Z b.
Proof. Proof.
exact Zdivide_opp_l. exact Zdivide_opp_l.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_oppr_rev : Lemma divides_oppr_rev :
forall (a:Z) (b:Z), (divides (-a)%Z b) -> (divides a b). forall (a:Z) (b:Z), (divides (-a)%Z b) -> divides a b.
Proof. Proof.
exact Zdivide_opp_l_rev. exact Zdivide_opp_l_rev.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_oppl_rev : Lemma divides_oppl_rev :
forall (a:Z) (b:Z), (divides a (-b)%Z) -> (divides a b). forall (a:Z) (b:Z), (divides a (-b)%Z) -> divides a b.
Proof. Proof.
exact Zdivide_opp_r_rev. exact Zdivide_opp_r_rev.
Qed. Qed.
...@@ -100,7 +100,7 @@ Qed. ...@@ -100,7 +100,7 @@ Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_plusr : Lemma divides_plusr :
forall (a:Z) (b:Z) (c:Z), forall (a:Z) (b:Z) (c:Z),
(divides a b) -> (divides a c) -> (divides a (b + c)%Z). (divides a b) -> (divides a c) -> divides a (b + c)%Z.
Proof. Proof.
exact Zdivide_plus_r. exact Zdivide_plus_r.
Qed. Qed.
...@@ -108,14 +108,14 @@ Qed. ...@@ -108,14 +108,14 @@ Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_minusr : Lemma divides_minusr :
forall (a:Z) (b:Z) (c:Z), forall (a:Z) (b:Z) (c:Z),
(divides a b) -> (divides a c) -> (divides a (b - c)%Z). (divides a b) -> (divides a c) -> divides a (b - c)%Z.
Proof. Proof.
exact Zdivide_minus_l. exact Zdivide_minus_l.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_multl : Lemma divides_multl :
forall (a:Z) (b:Z) (c:Z), (divides a b) -> (divides a (c * b)%Z). forall (a:Z) (b:Z) (c:Z), (divides a b) -> divides a (c * b)%Z.
Proof. Proof.
intros a b c. intros a b c.
apply Zdivide_mult_r. apply Zdivide_mult_r.
...@@ -123,19 +123,19 @@ Qed. ...@@ -123,19 +123,19 @@ Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_multr : Lemma divides_multr :
forall (a:Z) (b:Z) (c:Z), (divides a b) -> (divides a (b * c)%Z). forall (a:Z) (b:Z) (c:Z), (divides a b) -> divides a (b * c)%Z.
Proof. Proof.
exact Zdivide_mult_l. exact Zdivide_mult_l.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_factorl : forall (a:Z) (b:Z), (divides a (b * a)%Z). Lemma divides_factorl : forall (a:Z) (b:Z), divides a (b * a)%Z.
Proof. Proof.
exact Zdivide_factor_l. exact Zdivide_factor_l.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_factorr : forall (a:Z) (b:Z), (divides a (a * b)%Z). Lemma divides_factorr : forall (a:Z) (b:Z), divides a (a * b)%Z.
Proof. Proof.
exact Zdivide_factor_r. exact Zdivide_factor_r.
Qed. Qed.
...@@ -157,7 +157,7 @@ Qed. ...@@ -157,7 +157,7 @@ Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma divides_trans : Lemma divides_trans :
forall (a:Z) (b:Z) (c:Z), (divides a b) -> (divides b c) -> (divides a c). forall (a:Z) (b:Z) (c:Z), (divides a b) -> (divides b c) -> divides a c.
Proof. Proof.
exact Zdivide_trans. exact Zdivide_trans.
Qed. Qed.
...@@ -174,7 +174,7 @@ Import EuclideanDivision. ...@@ -174,7 +174,7 @@ Import EuclideanDivision.
(* Why3 goal *) (* Why3 goal *)
Lemma mod_divides_euclidean : Lemma mod_divides_euclidean :
forall (a:Z) (b:Z), forall (a:Z) (b:Z),
~ (b = 0%Z) -> ((int.EuclideanDivision.mod1 a b) = 0%Z) -> (divides b a). ~ (b = 0%Z) -> ((int.EuclideanDivision.mod1 a b) = 0%Z) -> divides b a.
Proof. Proof.
intros a b Zb H. intros a b Zb H.
exists (div a b). exists (div a b).
...@@ -202,7 +202,7 @@ Qed. ...@@ -202,7 +202,7 @@ Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma mod_divides_computer : Lemma mod_divides_computer :
forall (a:Z) (b:Z), forall (a:Z) (b:Z),
~ (b = 0%Z) -> ((ZArith.BinInt.Z.rem a b) = 0%Z) -> (divides b a). ~ (b = 0%Z) -> ((ZArith.BinInt.Z.rem a b) = 0%Z) -> divides b a.
Proof. Proof.
intros a b Zb H. intros a b Zb H.
exists (Z.quot a b). exists (Z.quot a b).
......
...@@ -32,16 +32,14 @@ exact Zgcd_is_pos. ...@@ -32,16 +32,14 @@ exact Zgcd_is_pos.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma gcd_def1 : Lemma gcd_def1 : forall (a:Z) (b:Z), number.Divisibility.divides (gcd a b) a.
forall (a:Z) (b:Z), (number.Divisibility.divides (gcd a b) a).
Proof. Proof.
intros a b. intros a b.
apply Zgcd_is_gcd. apply Zgcd_is_gcd.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma gcd_def2 : Lemma gcd_def2 : forall (a:Z) (b:Z), number.Divisibility.divides (gcd a b) b.
forall (a:Z) (b:Z), (number.Divisibility.divides (gcd a b) b).
Proof. Proof.
intros a b. intros a b.
apply Zgcd_is_gcd. apply Zgcd_is_gcd.
...@@ -52,7 +50,7 @@ Lemma gcd_def3 : ...@@ -52,7 +50,7 @@ Lemma gcd_def3 :
forall (a:Z) (b:Z) (x:Z), forall (a:Z) (b:Z) (x:Z),
(number.Divisibility.divides x a) -> (number.Divisibility.divides x a) ->
(number.Divisibility.divides x b) -> (number.Divisibility.divides x b) ->
(number.Divisibility.divides x (gcd a b)). number.Divisibility.divides x (gcd a b).
Proof. Proof.
intros a b x. intros a b x.
apply Zgcd_is_gcd. apply Zgcd_is_gcd.
......
...@@ -72,7 +72,7 @@ now apply even_not_odd. ...@@ -72,7 +72,7 @@ now apply even_not_odd.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma even_odd : forall (n:Z), (even n) -> (odd (n + 1%Z)%Z). Lemma even_odd : forall (n:Z), (even n) -> odd (n + 1%Z)%Z.
Proof. Proof.
intros n H. intros n H.
apply <- odd_is_Zodd. apply <- odd_is_Zodd.
...@@ -82,7 +82,7 @@ easy. ...@@ -82,7 +82,7 @@ easy.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma odd_even : forall (n:Z), (odd n) -> (even (n + 1%Z)%Z). Lemma odd_even : forall (n:Z), (odd n) -> even (n + 1%Z)%Z.
Proof. Proof.
intros n H. intros n H.
apply <- even_is_Zeven. apply <- even_is_Zeven.
...@@ -92,7 +92,7 @@ easy. ...@@ -92,7 +92,7 @@ easy.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma even_even : forall (n:Z), (even n) -> (even (n + 2%Z)%Z). Lemma even_even : forall (n:Z), (even n) -> even (n + 2%Z)%Z.
Proof. Proof.
intros n H. intros n H.
apply <- even_is_Zeven. apply <- even_is_Zeven.
...@@ -102,7 +102,7 @@ easy. ...@@ -102,7 +102,7 @@ easy.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma odd_odd : forall (n:Z), (odd n) -> (odd (n + 2%Z)%Z). Lemma odd_odd : forall (n:Z), (odd n) -> odd (n + 2%Z)%Z.
Proof. Proof.
intros n H. intros n H.
apply <- odd_is_Zodd. apply <- odd_is_Zodd.
...@@ -112,14 +112,14 @@ easy. ...@@ -112,14 +112,14 @@ easy.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma even_2k : forall (k:Z), (even (2%Z * k)%Z). Lemma even_2k : forall (k:Z), even (2%Z * k)%Z.
Proof. Proof.
intros k. intros k.
now exists k. now exists k.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma odd_2k1 : forall (k:Z), (odd ((2%Z * k)%Z + 1%Z)%Z). Lemma odd_2k1 : forall (k:Z), odd ((2%Z * k)%Z + 1%Z)%Z.
Proof. Proof.
intros k. intros k.
now exists k. now exists k.
......
...@@ -44,14 +44,14 @@ now elim H1. ...@@ -44,14 +44,14 @@ now elim H1.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma prime_2 : (prime 2%Z). Lemma prime_2 : prime 2%Z.
Proof. Proof.
apply <- prime_is_Zprime. apply <- prime_is_Zprime.
apply prime_2. apply prime_2.
Qed. Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma prime_3 : (prime 3%Z). Lemma prime_3 : prime 3%Z.
Proof. Proof.
apply <- prime_is_Zprime. apply <- prime_is_Zprime.
apply prime_3. apply prime_3.
...@@ -183,7 +183,7 @@ Qed. ...@@ -183,7 +183,7 @@ Qed.
(* Why3 goal *) (* Why3 goal *)
Lemma odd_prime : Lemma odd_prime :
forall (p:Z), (prime p) -> (3%Z <= p)%Z -> (number.Parity.odd p). forall (p:Z), (prime p) -> (3%Z <= p)%Z -> number.Parity.odd p.
Proof. Proof.
intros p Pp Hp. intros p Pp Hp.
apply <- Divisibility.odd_divides. apply <- Divisibility.odd_divides.
......
...@@ -72,7 +72,7 @@ Definition subset {a:Type} {a_WT:WhyType a} (s1:(a -> bool)) (s2:(a -> ...@@ -72,7 +72,7 @@ Definition subset {a:Type} {a_WT:WhyType a} (s1:(a -> bool)) (s2:(a ->
(* Why3 goal *) (* Why3 goal *)
Lemma subset_refl : Lemma subset_refl :
forall {a:Type} {a_WT:WhyType a}, forall (s:(a -> bool)), (subset s s). forall {a:Type} {a_WT:WhyType a}, forall (s:(a -> bool)), subset s s.
Proof. Proof.
now intros a a_WT s x. now intros a a_WT s x.
Qed. Qed.
...@@ -81,7 +81,7 @@ Qed. ...@@ -81,7 +81,7 @@ Qed.
Lemma subset_trans : Lemma subset_trans :
forall {a:Type} {a_WT:WhyType a}, forall {a:Type} {a_WT:WhyType a},
forall (s1:(a -> bool)) (s2:(a -> bool)) (s3:(a -> bool)), forall (s1:(a -> bool)) (s2:(a -> bool)) (s3:(a -> bool)),
(subset s1 s2) -> (subset s2 s3) -> (subset s1 s3). (subset s1 s2) -> (subset s2 s3) -> subset s1 s3.
Proof. Proof.
intros a a_WT s1 s2 s3 h1 h2 x H. intros a a_WT s1 s2 s3 h1 h2 x H.
now apply h2, h1. now apply h2, h1.
...@@ -94,7 +94,7 @@ Definition is_empty {a:Type} {a_WT:WhyType a} (s:(a -> bool)) : Prop := ...@@ -94,7 +94,7 @@ Definition is_empty {a:Type} {a_WT:WhyType a} (s:(a -> bool)) : Prop :=
(* Why3 goal *) (* Why3 goal *)
Lemma mem_empty : Lemma mem_empty :
forall {a:Type} {a_WT:WhyType a}, forall {a:Type} {a_WT:WhyType a},
(is_empty (map.Const.const false: (a -> bool))). is_empty (map.Const.const false: (a -> bool)).
Proof. Proof.
now intros a a_WT x. now intros a a_WT x.
Qed. Qed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment