Commit 940b18ef authored by Guillaume Melquiond's avatar Guillaume Melquiond

Update some Coq realizations with the new script format.

Note: they are stable with respect to the following command.
why3 --realize -D drivers/coq-realize.drv -T toto.Titi -o lib/coq/toto/
parent 78aea783
......@@ -3,38 +3,26 @@
Require Import ZArith.
Require Import Rbase.
Require Import Rbasic_fun.
(*Add Rec LoadPath "/home/guillaume/bin/why3/share/why3/theories".*)
(*Add Rec LoadPath "/home/guillaume/bin/why3/share/why3/modules".*)
Require real.Real.
(* Why3 goal *)
Definition abs: R -> R.
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rabs.
Defined.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma abs_def : forall (x:R), ((0%R <= x)%R -> ((abs x) = x)) /\
((~ (0%R <= x)%R) -> ((abs x) = (-x)%R)).
(* YOU MAY EDIT THE PROOF BELOW *)
split ; intros H.
apply Rabs_right.
now apply Rle_ge.
apply Rabs_left.
now apply Rnot_le_lt.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Abs_le : forall (x:R) (y:R), ((abs x) <= y)%R <-> (((-y)%R <= x)%R /\
(x <= y)%R).
(* YOU MAY EDIT THE PROOF BELOW *)
intros x y.
unfold abs, Rabs.
case Rcase_abs ; intros H ; (split ; [intros H0;split | intros (H0,H1)]).
......@@ -57,16 +45,30 @@ now apply Ropp_le_contravar.
exact H0.
exact H1.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Abs_pos : forall (x:R), (0%R <= (abs x))%R.
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rabs_pos.
Qed.
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Abs_sum : forall (x:R) (y:R),
((abs (x + y)%R) <= ((abs x) + (abs y))%R)%R.
exact Rabs_triang.
Qed.
(* Why3 goal *)
Lemma Abs_prod : forall (x:R) (y:R),
((abs (x * y)%R) = ((abs x) * (abs y))%R).
exact Rabs_mult.
Qed.
(* Why3 goal *)
Lemma triangular_inequality : forall (x:R) (y:R) (z:R),
((abs (x - z)%R) <= ((abs (x - y)%R) + (abs (y - z)%R))%R)%R.
intros x y z.
replace (x - z)%R with ((x - y) + (y - z))%R by ring.
apply Rabs_triang.
Qed.
......@@ -2,78 +2,45 @@
(* Beware! Only edit allowed sections below *)
Require Import ZArith.
Require Import Rbase.
(*Add Rec LoadPath "/home/guillaume/bin/why3/share/why3/theories".*)
(*Add Rec LoadPath "/home/guillaume/bin/why3/share/why3/modules".*)
Require int.Int.
Require real.Real.
(* Why3 goal *)
Definition from_int: Z -> R.
(* YOU MAY EDIT THE PROOF BELOW *)
exact IZR.
Defined.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Zero : ((from_int 0%Z) = 0%R).
(* YOU MAY EDIT THE PROOF BELOW *)
split.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma One : ((from_int 1%Z) = 1%R).
(* YOU MAY EDIT THE PROOF BELOW *)
split.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Add : forall (x:Z) (y:Z),
((from_int (x + y)%Z) = ((from_int x) + (from_int y))%R).
(* YOU MAY EDIT THE PROOF BELOW *)
exact plus_IZR.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Sub : forall (x:Z) (y:Z),
((from_int (x - y)%Z) = ((from_int x) - (from_int y))%R).
(* YOU MAY EDIT THE PROOF BELOW *)
exact minus_IZR.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Mul : forall (x:Z) (y:Z),
((from_int (x * y)%Z) = ((from_int x) * (from_int y))%R).
(* YOU MAY EDIT THE PROOF BELOW *)
exact mult_IZR.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Neg : forall (x:Z), ((from_int (-x)%Z) = (-(from_int x))%R).
(* YOU MAY EDIT THE PROOF BELOW *)
exact opp_IZR.
Qed.
(* DO NOT EDIT BELOW *)
......@@ -2,264 +2,165 @@
(* Beware! Only edit allowed sections below *)
Require Import ZArith.
Require Import Rbase.
(*Add Rec LoadPath "/home/guillaume/bin/why3/share/why3/theories".*)
(*Add Rec LoadPath "/home/guillaume/bin/why3/share/why3/modules".*)
(* Why3 goal *)
Definition infix_ls: R -> R -> Prop.
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rlt.
Defined.
(* DO NOT EDIT BELOW *)
(* Why3 assumption *)
Definition infix_lseq(x:R) (y:R): Prop := (infix_ls x y) \/ (x = y).
(* Why3 goal *)
Definition infix_pl: R -> R -> R.
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rplus.
Defined.
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Definition prefix_mn: R -> R.
(* YOU MAY EDIT THE PROOF BELOW *)
exact Ropp.
Defined.
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Definition infix_as: R -> R -> R.
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rmult.
Defined.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Unit_def : forall (x:R), ((infix_pl x 0%R) = x).
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rplus_0_r.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Assoc : forall (x:R) (y:R) (z:R), ((infix_pl (infix_pl x y)
z) = (infix_pl x (infix_pl y z))).
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rplus_assoc.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Inv_def : forall (x:R), ((infix_pl x (prefix_mn x)) = 0%R).
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rplus_opp_r.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Comm : forall (x:R) (y:R), ((infix_pl x y) = (infix_pl y x)).
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rplus_comm.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Assoc1 : forall (x:R) (y:R) (z:R), ((infix_as (infix_as x y)
z) = (infix_as x (infix_as y z))).
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rmult_assoc.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Mul_distr : forall (x:R) (y:R) (z:R), ((infix_as x (infix_pl y
z)) = (infix_pl (infix_as x y) (infix_as x z))).
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rmult_plus_distr_l.
Qed.
(* DO NOT EDIT BELOW *)
(* Why3 assumption *)
Definition infix_mn(x:R) (y:R): R := (infix_pl x (prefix_mn y)).
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Comm1 : forall (x:R) (y:R), ((infix_as x y) = (infix_as y x)).
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rmult_comm.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Unitary : forall (x:R), ((infix_as 1%R x) = x).
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rmult_1_l.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma NonTrivialRing : ~ (0%R = 1%R).
(* YOU MAY EDIT THE PROOF BELOW *)
apply not_eq_sym.
exact R1_neq_R0.
Qed.
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Definition inv: R -> R.
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rinv.
Defined.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Inverse : forall (x:R), (~ (x = 0%R)) -> ((infix_as x (inv x)) = 1%R).
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rinv_r.
Qed.
(* DO NOT EDIT BELOW *)
(* Why3 assumption *)
Definition infix_sl(x:R) (y:R): R := (infix_as x (inv y)).
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma assoc_mul_div : forall (x:R) (y:R) (z:R), (~ (z = 0%R)) ->
((infix_sl (infix_as x y) z) = (infix_as x (infix_sl y z))).
(* YOU MAY EDIT THE PROOF BELOW *)
intros x y z _.
apply Rmult_assoc.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma assoc_div_mul : forall (x:R) (y:R) (z:R), ((~ (y = 0%R)) /\
~ (z = 0%R)) -> ((infix_sl (infix_sl x y) z) = (infix_sl x (infix_as y
z))).
(* YOU MAY EDIT THE PROOF BELOW *)
intros x y z (Zy, Zz).
unfold infix_sl, infix_as, inv.
rewrite Rmult_assoc.
now rewrite Rinv_mult_distr.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma assoc_div_div : forall (x:R) (y:R) (z:R), ((~ (y = 0%R)) /\
~ (z = 0%R)) -> ((infix_sl x (infix_sl y z)) = (infix_sl (infix_as x z)
y)).
(* YOU MAY EDIT THE PROOF BELOW *)
intros x y z (Zy, Zz).
unfold infix_sl, infix_as, inv.
field.
now split.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Refl : forall (x:R), (infix_lseq x x).
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rle_refl.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Trans : forall (x:R) (y:R) (z:R), (infix_lseq x y) -> ((infix_lseq y
z) -> (infix_lseq x z)).
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rle_trans.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Antisymm : forall (x:R) (y:R), (infix_lseq x y) -> ((infix_lseq y x) ->
(x = y)).
(* YOU MAY EDIT THE PROOF BELOW *)
exact Rle_antisym.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma Total : forall (x:R) (y:R), (infix_lseq x y) \/ (infix_lseq y x).
(* YOU MAY EDIT THE PROOF BELOW *)
intros x y.
destruct (Rle_or_lt x y) as [H|H].
now left.
right.
now apply Rlt_le.
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma ZeroLessOne : (infix_lseq 0%R 1%R).
exact Rle_0_1.
Qed.
(* Why3 goal *)
Lemma CompatOrderAdd : forall (x:R) (y:R) (z:R), (infix_lseq x y) ->
(infix_lseq (infix_pl x z) (infix_pl y z)).
(* YOU MAY EDIT THE PROOF BELOW *)
intros x y z.
exact (Rplus_le_compat_r z x y).
Qed.
(* DO NOT EDIT BELOW *)
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
(* Why3 goal *)
Lemma CompatOrderMult : forall (x:R) (y:R) (z:R), (infix_lseq x y) ->
((infix_lseq 0%R z) -> (infix_lseq (infix_as x z) (infix_as y z))).
(* YOU MAY EDIT THE PROOF BELOW *)
intros x y z H Zz.
now apply Rmult_le_compat_r.
Qed.
(* DO NOT EDIT BELOW *)
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