Commit b6e25241 authored by MARCHE Claude's avatar MARCHE Claude

Merge branch 'new_ide'

# Conflicts:
#	examples/residual/why3session.xml
#	examples/residual/why3shapes.gz
#	lib/coq/int/Int.v
#	lib/coq/int/NumOf.v
#	lib/coq/map/Const.v
#	lib/coq/map/Map.v
#	lib/coq/map/MapInjection.v
#	lib/coq/map/MapPermut.v
#	lib/coq/map/Occ.v
#	lib/coq/number/Divisibility.v
#	lib/coq/real/Real.v
#	lib/coq/set/Set.v
parents d3f0595d 50317a3a
......@@ -15,55 +15,60 @@ Require Import BuiltIn.
Require BuiltIn.
(* Why3 goal *)
Lemma andb_def : forall (x:bool) (y:bool),
((Init.Datatypes.andb x y) = match x with
| true => y
| false => false
end).
Lemma andb_def :
forall (x:bool) (y:bool),
((Init.Datatypes.andb x y) = match x with
| true => y
| false => false
end).
Proof.
intros x y.
apply refl_equal.
Qed.
(* Why3 goal *)
Lemma orb_def : forall (x:bool) (y:bool),
((Init.Datatypes.orb x y) = match x with
| false => y
| true => true
end).
Lemma orb_def :
forall (x:bool) (y:bool),
((Init.Datatypes.orb x y) = match x with
| false => y
| true => true
end).
Proof.
intros x y.
apply refl_equal.
Qed.
(* Why3 goal *)
Lemma notb_def : forall (x:bool),
((Init.Datatypes.negb x) = match x with
| false => true
| true => false
end).
Lemma notb_def :
forall (x:bool),
((Init.Datatypes.negb x) = match x with
| false => true
| true => false
end).
Proof.
intros x.
apply refl_equal.
Qed.
(* Why3 goal *)
Lemma xorb_def : forall (x:bool) (y:bool),
((Init.Datatypes.xorb x y) = match x with
| false => y
| true => (Init.Datatypes.negb y)
end).
Lemma xorb_def :
forall (x:bool) (y:bool),
((Init.Datatypes.xorb x y) = match x with
| false => y
| true => (Init.Datatypes.negb y)
end).
Proof.
intros x y.
destruct x; destruct y; auto.
Qed.
(* Why3 goal *)
Lemma implb_def : forall (x:bool) (y:bool),
((Init.Datatypes.implb x y) = match x with
| false => true
| true => y
end).
Lemma implb_def :
forall (x:bool) (y:bool),
((Init.Datatypes.implb x y) = match x with
| false => true
| true => y
end).
Proof.
now intros [|] [|].
Qed.
......
This diff is collapsed.
......@@ -21,31 +21,36 @@ Definition pow2: Z -> Z.
Defined.
(* Why3 goal *)
Lemma Power_0 : ((pow2 0%Z) = 1%Z).
Lemma Power_0 :
((pow2 0%Z) = 1%Z).
easy.
Qed.
(* Why3 goal *)
Lemma Power_s : forall (n:Z), (0%Z <= n)%Z ->
((pow2 (n + 1%Z)%Z) = (2%Z * (pow2 n))%Z).
Lemma Power_s :
forall (n:Z), (0%Z <= n)%Z -> ((pow2 (n + 1%Z)%Z) = (2%Z * (pow2 n))%Z).
apply two_p_S.
Qed.
(* Why3 goal *)
Lemma Power_1 : ((pow2 1%Z) = 2%Z).
Lemma Power_1 :
((pow2 1%Z) = 2%Z).
easy.
Qed.
(* Why3 goal *)
Lemma Power_sum : forall (n:Z) (m:Z), ((0%Z <= n)%Z /\ (0%Z <= m)%Z) ->
((pow2 (n + m)%Z) = ((pow2 n) * (pow2 m))%Z).
Lemma Power_sum :
forall (n:Z) (m:Z),
((0%Z <= n)%Z /\ (0%Z <= m)%Z) ->
((pow2 (n + m)%Z) = ((pow2 n) * (pow2 m))%Z).
unfold pow2.
intros n m [H1 H2].
apply two_p_is_exp; easy.
Qed.
(* Why3 goal *)
Lemma pow2pos : forall (i:Z), (0%Z <= i)%Z -> (0%Z < (pow2 i))%Z.
Lemma pow2pos :
forall (i:Z), (0%Z <= i)%Z -> (0%Z < (pow2 i))%Z.
intros i h1.
Require Import Zorder.
apply Zgt_lt.
......@@ -53,328 +58,393 @@ Lemma pow2pos : forall (i:Z), (0%Z <= i)%Z -> (0%Z < (pow2 i))%Z.
Qed.
(* Why3 goal *)
Lemma pow2_0 : ((pow2 0%Z) = 1%Z).
Lemma pow2_0 :
((pow2 0%Z) = 1%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_1 : ((pow2 1%Z) = 2%Z).
Lemma pow2_1 :
((pow2 1%Z) = 2%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_2 : ((pow2 2%Z) = 4%Z).
Lemma pow2_2 :
((pow2 2%Z) = 4%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_3 : ((pow2 3%Z) = 8%Z).
Lemma pow2_3 :
((pow2 3%Z) = 8%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_4 : ((pow2 4%Z) = 16%Z).
Lemma pow2_4 :
((pow2 4%Z) = 16%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_5 : ((pow2 5%Z) = 32%Z).
Lemma pow2_5 :
((pow2 5%Z) = 32%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_6 : ((pow2 6%Z) = 64%Z).
Lemma pow2_6 :
((pow2 6%Z) = 64%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_7 : ((pow2 7%Z) = 128%Z).
Lemma pow2_7 :
((pow2 7%Z) = 128%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_8 : ((pow2 8%Z) = 256%Z).
Lemma pow2_8 :
((pow2 8%Z) = 256%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_9 : ((pow2 9%Z) = 512%Z).
Lemma pow2_9 :
((pow2 9%Z) = 512%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_10 : ((pow2 10%Z) = 1024%Z).
Lemma pow2_10 :
((pow2 10%Z) = 1024%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_11 : ((pow2 11%Z) = 2048%Z).
Lemma pow2_11 :
((pow2 11%Z) = 2048%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_12 : ((pow2 12%Z) = 4096%Z).
Lemma pow2_12 :
((pow2 12%Z) = 4096%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_13 : ((pow2 13%Z) = 8192%Z).
Lemma pow2_13 :
((pow2 13%Z) = 8192%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_14 : ((pow2 14%Z) = 16384%Z).
Lemma pow2_14 :
((pow2 14%Z) = 16384%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_15 : ((pow2 15%Z) = 32768%Z).
Lemma pow2_15 :
((pow2 15%Z) = 32768%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_16 : ((pow2 16%Z) = 65536%Z).
Lemma pow2_16 :
((pow2 16%Z) = 65536%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_17 : ((pow2 17%Z) = 131072%Z).
Lemma pow2_17 :
((pow2 17%Z) = 131072%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_18 : ((pow2 18%Z) = 262144%Z).
Lemma pow2_18 :
((pow2 18%Z) = 262144%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_19 : ((pow2 19%Z) = 524288%Z).
Lemma pow2_19 :
((pow2 19%Z) = 524288%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_20 : ((pow2 20%Z) = 1048576%Z).
Lemma pow2_20 :
((pow2 20%Z) = 1048576%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_21 : ((pow2 21%Z) = 2097152%Z).
Lemma pow2_21 :
((pow2 21%Z) = 2097152%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_22 : ((pow2 22%Z) = 4194304%Z).
Lemma pow2_22 :
((pow2 22%Z) = 4194304%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_23 : ((pow2 23%Z) = 8388608%Z).
Lemma pow2_23 :
((pow2 23%Z) = 8388608%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_24 : ((pow2 24%Z) = 16777216%Z).
Lemma pow2_24 :
((pow2 24%Z) = 16777216%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_25 : ((pow2 25%Z) = 33554432%Z).
Lemma pow2_25 :
((pow2 25%Z) = 33554432%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_26 : ((pow2 26%Z) = 67108864%Z).
Lemma pow2_26 :
((pow2 26%Z) = 67108864%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_27 : ((pow2 27%Z) = 134217728%Z).
Lemma pow2_27 :
((pow2 27%Z) = 134217728%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_28 : ((pow2 28%Z) = 268435456%Z).
Lemma pow2_28 :
((pow2 28%Z) = 268435456%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_29 : ((pow2 29%Z) = 536870912%Z).
Lemma pow2_29 :
((pow2 29%Z) = 536870912%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_30 : ((pow2 30%Z) = 1073741824%Z).
Lemma pow2_30 :
((pow2 30%Z) = 1073741824%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_31 : ((pow2 31%Z) = 2147483648%Z).
Lemma pow2_31 :
((pow2 31%Z) = 2147483648%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_32 : ((pow2 32%Z) = 4294967296%Z).
Lemma pow2_32 :
((pow2 32%Z) = 4294967296%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_33 : ((pow2 33%Z) = 8589934592%Z).
Lemma pow2_33 :
((pow2 33%Z) = 8589934592%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_34 : ((pow2 34%Z) = 17179869184%Z).
Lemma pow2_34 :
((pow2 34%Z) = 17179869184%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_35 : ((pow2 35%Z) = 34359738368%Z).
Lemma pow2_35 :
((pow2 35%Z) = 34359738368%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_36 : ((pow2 36%Z) = 68719476736%Z).
Lemma pow2_36 :
((pow2 36%Z) = 68719476736%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_37 : ((pow2 37%Z) = 137438953472%Z).
Lemma pow2_37 :
((pow2 37%Z) = 137438953472%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_38 : ((pow2 38%Z) = 274877906944%Z).
Lemma pow2_38 :
((pow2 38%Z) = 274877906944%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_39 : ((pow2 39%Z) = 549755813888%Z).
Lemma pow2_39 :
((pow2 39%Z) = 549755813888%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_40 : ((pow2 40%Z) = 1099511627776%Z).
Lemma pow2_40 :
((pow2 40%Z) = 1099511627776%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_41 : ((pow2 41%Z) = 2199023255552%Z).
Lemma pow2_41 :
((pow2 41%Z) = 2199023255552%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_42 : ((pow2 42%Z) = 4398046511104%Z).
Lemma pow2_42 :
((pow2 42%Z) = 4398046511104%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_43 : ((pow2 43%Z) = 8796093022208%Z).
Lemma pow2_43 :
((pow2 43%Z) = 8796093022208%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_44 : ((pow2 44%Z) = 17592186044416%Z).
Lemma pow2_44 :
((pow2 44%Z) = 17592186044416%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_45 : ((pow2 45%Z) = 35184372088832%Z).
Lemma pow2_45 :
((pow2 45%Z) = 35184372088832%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_46 : ((pow2 46%Z) = 70368744177664%Z).
Lemma pow2_46 :
((pow2 46%Z) = 70368744177664%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_47 : ((pow2 47%Z) = 140737488355328%Z).
Lemma pow2_47 :
((pow2 47%Z) = 140737488355328%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_48 : ((pow2 48%Z) = 281474976710656%Z).
Lemma pow2_48 :
((pow2 48%Z) = 281474976710656%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_49 : ((pow2 49%Z) = 562949953421312%Z).
Lemma pow2_49 :
((pow2 49%Z) = 562949953421312%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_50 : ((pow2 50%Z) = 1125899906842624%Z).
Lemma pow2_50 :
((pow2 50%Z) = 1125899906842624%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_51 : ((pow2 51%Z) = 2251799813685248%Z).
Lemma pow2_51 :
((pow2 51%Z) = 2251799813685248%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_52 : ((pow2 52%Z) = 4503599627370496%Z).
Lemma pow2_52 :
((pow2 52%Z) = 4503599627370496%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_53 : ((pow2 53%Z) = 9007199254740992%Z).
Lemma pow2_53 :
((pow2 53%Z) = 9007199254740992%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_54 : ((pow2 54%Z) = 18014398509481984%Z).
Lemma pow2_54 :
((pow2 54%Z) = 18014398509481984%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_55 : ((pow2 55%Z) = 36028797018963968%Z).
Lemma pow2_55 :
((pow2 55%Z) = 36028797018963968%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_56 : ((pow2 56%Z) = 72057594037927936%Z).
Lemma pow2_56 :
((pow2 56%Z) = 72057594037927936%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_57 : ((pow2 57%Z) = 144115188075855872%Z).
Lemma pow2_57 :
((pow2 57%Z) = 144115188075855872%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_58 : ((pow2 58%Z) = 288230376151711744%Z).
Lemma pow2_58 :
((pow2 58%Z) = 288230376151711744%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_59 : ((pow2 59%Z) = 576460752303423488%Z).
Lemma pow2_59 :
((pow2 59%Z) = 576460752303423488%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_60 : ((pow2 60%Z) = 1152921504606846976%Z).
Lemma pow2_60 :
((pow2 60%Z) = 1152921504606846976%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_61 : ((pow2 61%Z) = 2305843009213693952%Z).
Lemma pow2_61 :
((pow2 61%Z) = 2305843009213693952%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_62 : ((pow2 62%Z) = 4611686018427387904%Z).
Lemma pow2_62 :
((pow2 62%Z) = 4611686018427387904%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_63 : ((pow2 63%Z) = 9223372036854775808%Z).
Lemma pow2_63 :
((pow2 63%Z) = 9223372036854775808%Z).
easy.
Qed.
(* Why3 goal *)
Lemma pow2_64 : ((pow2 64%Z) = 18446744073709551616%Z).
Lemma pow2_64 :
((pow2 64%Z) = 18446744073709551616%Z).
easy.
Qed.
......@@ -53,72 +53,80 @@ Definition total_error (x:floating_point.DoubleFormat.double): R :=
(* Why3 assumption *)
Definition no_overflow (m:floating_point.Rounding.mode) (x:R): Prop :=
((Reals.Rbasic_fun.Rabs (round m
x)) <= (9007199254740991 * 19958403095347198116563727130368385660674512604354575415025472424372118918689640657849579654926357010893424468441924952439724379883935936607391717982848314203200056729510856765175377214443629871826533567445439239933308104551208703888888552684480441575071209068757560416423584952303440099278848)%R)%R.
((Reals.Rbasic_fun.Rabs (round m x)) <= (9007199254740991 * 19958403095347198116563727130368385660674512604354575415025472424372118918689640657849579654926357010893424468441924952439724379883935936607391717982848314203200056729510856765175377214443629871826533567445439239933308104551208703888888552684480441575071209068757560416423584952303440099278848)%R)%R.
(* Why3 goal *)
Lemma Bounded_real_no_overflow : forall (m:floating_point.Rounding.mode)
(x:R),
((Reals.Rbasic_fun.Rabs x) <= (9007199254740991 * 19958403095347198116563727130368385660674512604354575415025472424372118918689640657849579654926357010893424468441924952439724379883935936607391717982848314203200056729510856765175377214443629871826533567445439239933308104551208703888888552684480441575071209068757560416423584952303440099278848)%R)%R ->
(no_overflow m x).
Lemma Bounded_real_no_overflow :
forall (m:floating_point.Rounding.mode) (x:R),
((Reals.Rbasic_fun.Rabs x) <= (9007199254740991 * 19958403095347198116563727130368385660674512604354575415025472424372118918689640657849579654926357010893424468441924952439724379883935936607391717982848314203200056729510856765175377214443629871826533567445439239933308104551208703888888552684480441575071209068757560416423584952303440099278848)%R)%R ->
(no_overflow m x).
exact (Bounded_real_no_overflow 53 1024 (refl_equal true) (refl_equal true)).
Qed.
(* Why3 goal *)
Lemma Round_monotonic : forall (m:floating_point.Rounding.mode) (x:R) (y:R),
(x <= y)%R -> ((round m x) <= (round m y))%R.
Lemma Round_monotonic :
forall (m:floating_point.Rounding.mode) (x:R) (y:R),
(x <= y)%R -> ((round m x) <= (round m y))%R.
now apply Round_monotonic.
Qed.
(* Why3 goal *)
Lemma Round_idempotent : forall (m1:floating_point.Rounding.mode)
(m2:floating_point.Rounding.mode) (x:R), ((round m1 (round m2
x)) = (round m2 x)).
Lemma Round_idempotent :
forall (m1:floating_point.Rounding.mode) (m2:floating_point.Rounding.mode)
(x:R), ((round m1 (round m2 x)) = (round m2 x)).
now apply Round_idempotent.
Qed.
(* Why3 goal *)
Lemma Round_value : forall (m:floating_point.Rounding.mode)
(x:floating_point.DoubleFormat.double), ((round m (value x)) = (value x)).
Lemma Round_value :
forall (m:floating_point.Rounding.mode)
(x:floating_point.DoubleFormat.double),
((round m (value x)) = (value x)).
now apply Round_value.
Qed.
(* Why3 goal *)
Lemma Bounded_value : forall (x:floating_point.DoubleFormat.double),
((Reals.Rbasic_fun.Rabs (value x)) <= (9007199254740991 * 19958403095347198116563727130368385660674512604354575415025472424372118918689640657849579654926357010893424468441924952439724379883935936607391717982848314203200056729510856765175377214443629871826533567445439239933308104551208703888888552684480441575071209068757560416423584952303440099278848)%R)%R.
Lemma Bounded_value :
forall (x:floating_point.DoubleFormat.double),
((Reals.Rbasic_fun.Rabs (value x)) <= (9007199254740991 * 19958403095347198116563727130368385660674512604354575415025472424372118918689640657849579654926357010893424468441924952439724379883935936607391717982848314203200056729510856765175377214443629871826533567445439239933308104551208703888888552684480441575071209068757560416423584952303440099278848)%R)%R.
now apply Bounded_value.
Qed.
(* Why3 goal *)
Lemma Exact_rounding_for_integers : forall (m:floating_point.Rounding.mode)
(i:Z), (((-9007199254740992%Z)%Z <= i)%Z /\ (i <= 9007199254740992%Z)%Z) ->
((round m (BuiltIn.IZR i)) = (BuiltIn.IZR i)).
Lemma Exact_rounding_for_integers :
forall (m:floating_point.Rounding.mode) (i:Z),
(((-9007199254740992%Z)%Z <= i)%Z /\ (i <= 9007199254740992%Z)%Z) ->
((round m (BuiltIn.IZR i)) = (BuiltIn.IZR i)).
Proof.
intros m i Hi.
now apply Exact_rounding_for_integers.
Qed.
(* Why3 goal *)
Lemma Round_down_le : forall (x:R), ((round floating_point.Rounding.Down
x) <= x)%R.
Lemma Round_down_le :
forall (x:R), ((round floating_point.Rounding.Down x) <= x)%R.
now apply Round_down_le.
Qed.
(* Why3 goal *)
Lemma Round_up_ge : forall (x:R), (x <= (round floating_point.Rounding.Up
x))%R.
Lemma Round_up_ge :
forall (x:R), (x <= (round floating_point.Rounding.Up x))%R.
now apply Round_up_ge.
Qed.
(* Why3 goal *)
Lemma Round_down_neg : forall (x:R), ((round floating_point.Rounding.Down
(-x)%R) = (-(round floating_point.Rounding.Up x))%R).
Lemma Round_down_neg :
forall (x:R),
((round floating_point.Rounding.Down (-x)%R) = (-(round floating_point.Rounding.Up
x))%R).
now apply Round_down_neg.
Qed.
(* Why3 goal *)
Lemma Round_up_neg : forall (x:R), ((round floating_point.Rounding.Up
(-x)%R) = (-(round floating_point.Rounding.Down x))%R).
Lemma Round_up_neg :