Commit 98920324 authored by MARCHE Claude's avatar MARCHE Claude

sessions: more updates for Coq 8.5

parent 5a24300d
......@@ -241,6 +241,9 @@ Axiom long_path_decomposition_pigeon3 : forall (l:(list vertex)) (v:vertex),
exists l3:(list vertex),
(l = (Init.Datatypes.app l1 (Init.Datatypes.cons n (Init.Datatypes.app l2 (Init.Datatypes.cons n l3)))))).
Require Import Why3.
Ltac ae := why3 "Alt-Ergo,0.99.1," timelimit 5; admit.
(* Why3 goal *)
Theorem long_path_decomposition : forall (l:(list vertex)) (v:vertex), (path
s l v) -> (((cardinal vertices) <= (list.Length.length l))%Z ->
......@@ -252,11 +255,8 @@ Theorem long_path_decomposition : forall (l:(list vertex)) (v:vertex), (path
(* Why3 intros l v h1 h2. *)
intuition.
Require Why3.
Ltac ae := why3 "alt-ergo".
apply long_path_decomposition_pigeon3.
apply long_path_decomposition_pigeon2 ; ae.
Qed.
Admitted.
......@@ -258,7 +258,8 @@ Definition negative_cycle (v:vertex): Prop := (mem v vertices) /\
((exists l1:(list vertex), (path s l1 v)) /\ exists l2:(list vertex), (path
v l2 v) /\ ((path_weight l2 v) < 0%Z)%Z).
Require Import Why3. Ltac ae := why3 "alt-ergo".
Require Import Why3.
Ltac ae := why3 "Alt-Ergo,0.99.1," timelimit 5; admit.
Require Import list.Length.
......@@ -342,5 +343,5 @@ assert (path_weight ln v =
assert (path_weight l' v = path_weight l1 u + path_weight (cons u l3) v)%Z.
ae.
omega.
Qed.
Admitted.
......@@ -249,7 +249,8 @@ Axiom long_path_decomposition : forall (l:(list vertex)) (v:vertex), (path s
exists l3:(list vertex),
(l = (Init.Datatypes.app l1 (Init.Datatypes.cons n (Init.Datatypes.app l2 (Init.Datatypes.cons n l3))))))).
Require Import Why3. Ltac ae := why3 "alt-ergo".
Require Import Why3.
Ltac ae := why3 "Alt-Ergo,0.99.1," timelimit 5; admit.
Require Import list.Length.
......@@ -299,5 +300,5 @@ assert (0 <= length (app l1 (cons u l3)) < z)%Z.
apply (IH (length (app l1 (cons u l3))) H1 (app l1 (cons u l3))).
omega.
assumption.
Qed.
Admitted.
......@@ -354,8 +354,9 @@ Axiom key_lemma_2 : forall (m:(map.Map.map vertex t)), (inv1 m
edges) -> forall (v:vertex), ~ (negative_cycle v)).
Require Import Why3.
Ltac Z3 := why3 "z3".
Ltac ae := why3 "alt-ergo".
Ltac Z3 := why3 "Z3,4.4.0,"; admit.
Ltac ae := why3 "Alt-Ergo,0.99.1,"; admit.
Ltac cvc3 := why3 "CVC3,2.4.1,"; admit.
(* Why3 goal *)
Theorem WP_parameter_bellman_ford : let o := ((cardinal vertices) - 1%Z)%Z in
......@@ -412,7 +413,9 @@ intros o h1 m i (h2,h3) h4 es h5 es1 m1 (h6,h7) o1 h8 h9 h10 v h11 x
h12 l hpath hlength.
destruct (path_right_inversion s v l hpath) as [(hg1,hg2) | (y, (l', (hg1, (hg2, hg3))))].
(* Nil *)
subst. simpl. why3 "cvc3".
cvc3.
subst. simpl. cvc3.
(*
(* Cons *)
rewrite hg3; rewrite path_weight_right_extension.
generalize (h10 v h11); clear h10.
......@@ -423,5 +426,6 @@ assert (Length.length l = Length.length l' + 1)%Z.
subst l. rewrite Append.Append_length.
auto.
ae.
Qed.
*)
Admitted.
......@@ -354,7 +354,7 @@ Axiom key_lemma_2 : forall (m:(map.Map.map vertex t)), (inv1 m
edges) -> forall (v:vertex), ~ (negative_cycle v)).
Require Import Why3.
Ltac ae := why3 "alt-ergo" timelimit 30.
Ltac ae := why3 "Alt-Ergo,0.99.1," timelimit 30; admit.
(* Why3 goal *)
Theorem WP_parameter_bellman_ford : let o := ((cardinal vertices) - 1%Z)%Z in
......@@ -421,5 +421,5 @@ assert (i <= Length.length l')%Z by ae.
assert (Length.length l = Length.length l' + 1)%Z.
subst l. apply Append.Append_length.
ae.
Qed.
Admitted.
......@@ -7,15 +7,12 @@ Require list.Length.
Require int.Int.
Require list.Mem.
Require map.Map.
Require map.Const.
Require list.Append.
(* Why3 assumption *)
Definition unit := unit.
Axiom qtmark : Type.
Parameter qtmark_WhyType : WhyType qtmark.
Existing Instance qtmark_WhyType.
Axiom set : forall (a:Type), Type.
Parameter set_WhyType : forall (a:Type) {a_WT:WhyType a}, WhyType (set a).
Existing Instance set_WhyType.
......@@ -116,6 +113,10 @@ Axiom cardinal_remove : forall {a:Type} {a_WT:WhyType a}, forall (x:a),
Axiom cardinal_subset : forall {a:Type} {a_WT:WhyType a}, forall (s1:(set a))
(s2:(set a)), (subset s1 s2) -> ((cardinal s1) <= (cardinal s2))%Z.
Axiom subset_eq : forall {a:Type} {a_WT:WhyType a}, forall (s1:(set a))
(s2:(set a)), (subset s1 s2) -> (((cardinal s1) = (cardinal s2)) ->
(infix_eqeq s1 s2)).
Axiom cardinal1 : forall {a:Type} {a_WT:WhyType a}, forall (s:(set a)),
((cardinal s) = 1%Z) -> forall (x:a), (mem x s) -> (x = (choose s)).
......@@ -353,7 +354,7 @@ Axiom key_lemma_2 : forall (m:(map.Map.map vertex t)), (inv1 m
edges) -> forall (v:vertex), ~ (negative_cycle v)).
Require Import Why3.
Ltac ae := why3 "alt-ergo".
Ltac ae := why3 "Alt-Ergo,0.99.1," timelimit 5; admit.
(* Why3 goal *)
Theorem WP_parameter_bellman_ford : let o := ((cardinal vertices) - 1%Z)%Z in
......@@ -366,6 +367,7 @@ Theorem WP_parameter_bellman_ford : let o := ((cardinal vertices) - 1%Z)%Z in
forall (v:vertex), (mem v vertices) -> forall (x:Z), ((map.Map.get m
v) = (Finite x)) -> forall (l:(list vertex)), (path s l v) ->
(x <= (path_weight l v))%Z)))).
(* Why3 intros o h1 m h2 h3 es h4 es1 (h5,h6) o1 h7 h8 h9 v h10 x h11 l h12. *)
intros o _ m _ hinv1 _ _ _ _ _ _ _ hinv2 v hv z Heqt0 l hl.
assert (case: (z <= path_weight l v \/ path_weight l v < z)%Z) by omega.
destruct case; auto.
......@@ -374,5 +376,5 @@ generalize (hinv1 v hv); clear hinv1 hinv2.
rewrite Heqt0; ae.
exists l; intuition.
ae.
Qed.
Admitted.
......@@ -354,7 +354,7 @@ Axiom key_lemma_2 : forall (m:(map.Map.map vertex t)), (inv1 m
edges) -> forall (v:vertex), ~ (negative_cycle v)).
Require Import Why3.
Ltac ae := why3 "alt-ergo".
Ltac ae := why3 "Alt-Ergo,0.99.1,"; admit.
(* Why3 goal *)
Theorem WP_parameter_bellman_ford : (((cardinal vertices) - 1%Z)%Z < 1%Z)%Z ->
......@@ -377,7 +377,7 @@ Theorem WP_parameter_bellman_ford : (((cardinal vertices) - 1%Z)%Z < 1%Z)%Z ->
vertex t)) s (Finite 0%Z))
result1) with
| Infinite => True
| (Finite y) => ((x + (weight result result1))%Z < y)%Z
| (Finite x1) => ((x + (weight result result1))%Z < x1)%Z
end
end -> exists v:vertex, (negative_cycle v)))))).
(* Why3 intros h1 h2 es h3 es1 (h4,h5) o h6 h7 h8 es2 result result1 result2
......@@ -395,8 +395,12 @@ assert (v = s) by ae. subst v.
rewrite Map.Select_eq; auto.
intros hneg.
exists s. red.
split. ae.
split. exists nil; ae.
exists (cons s nil); ae.
Qed.
split.
- ae.
- split.
+ exists nil; ae.
+ exists (cons s nil); split.
apply Path_cons with s; ae.
ae.
Admitted.
......@@ -354,7 +354,7 @@ Axiom key_lemma_2 : forall (m:(map.Map.map vertex t)), (inv1 m
edges) -> forall (v:vertex), ~ (negative_cycle v)).
Require Import Why3.
Ltac ae := why3 "alt-ergo".
Ltac ae := why3 "Alt-Ergo,0.99.1,"; admit.
Require Import Classical.
(* Why3 goal *)
......@@ -379,7 +379,7 @@ Theorem WP_parameter_relax : forall (m:(map.Map.map vertex t)) (u:vertex)
| (Finite x) => match (map.Map.get m
v) with
| Infinite => True
| (Finite y) => ((x + (weight u v))%Z < y)%Z
| (Finite x1) => ((x + (weight u v))%Z < x1)%Z
end
end -> forall (m1:(map.Map.map vertex t)), (m1 = (map.Map.set m v
match (map.Map.get m
......@@ -400,5 +400,5 @@ destruct H as (lu, (hu1, hu2)).
exists (app lu (cons u nil)); ae.
subst m1. rewrite Map.Select_neq; auto.
ae.
Qed.
Admitted.
......@@ -350,8 +350,8 @@ Definition inv2 (m:(map.Map.map vertex t)) (via:(set (vertex*
(le (map.Map.get m v) (add1 (map.Map.get m u) (Finite (weight u v)))).
Require Import Why3.
Ltac ae := why3 "alt-ergo" timelimit 60.
Ltac Z3 := why3 "z3" timelimit 10.
Ltac ae := why3 "alt-ergo" timelimit 60; admit.
Ltac Z3 := why3 "z3" timelimit 10; admit.
Require Import list.Length.
......@@ -400,5 +400,5 @@ unfold le, add1; destruct (Map.get m v) as [] _eqn.
ae.
absurd (Map.get m v = Infinite); auto.
ae.
Qed.
Admitted.
This diff is collapsed.
......@@ -41,14 +41,17 @@ theory FibSumEven "sum of even-valued Fibonacci numbers"
end
theory FibOnlyEven
module FibOnlyEven
use import int.Int
use import int.ComputerDivision
use import int.Fibonacci
lemma fib_even_3n : forall n:int. n >= 0 ->
mod (fib n) 2 = 0 <-> mod n 3 = 0
let rec lemma fib_even_3n (n:int)
requires { n >= 0 }
variant { n }
ensures { mod (fib n) 2 = 0 <-> mod n 3 = 0 }
= if n > 2 then fib_even_3n (n-3)
function fib_even (n: int) : int = fib (3 * n)
......
(* This file is generated by Why3's Coq 8.4 driver *)
(* Beware! Only edit allowed sections below *)
Require Import BuiltIn.
Require Import ZOdiv.
Require BuiltIn.
Require int.Int.
Require int.Abs.
Require int.ComputerDivision.
Parameter fib: Z -> Z.
Axiom fib0 : ((fib 0%Z) = 0%Z).
Axiom fib1 : ((fib 1%Z) = 1%Z).
Axiom fibn : forall (n:Z), (2%Z <= n)%Z ->
((fib n) = ((fib (n - 1%Z)%Z) + (fib (n - 2%Z)%Z))%Z).
Require Import Why3.
(* Why3 goal *)
Theorem fib_even_3n : forall (n:Z), (0%Z <= n)%Z ->
(((ZOmod (fib n) 2%Z) = 0%Z) <-> ((ZOmod n 3%Z) = 0%Z)).
Proof.
intros n h1.
generalize h1; pattern n.
apply Z_lt_induction; auto.
why3 "cvc3" timelimit 10.
Qed.
This diff is collapsed.
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