From 05fc195f4e6e0a194323e68efa0d18dafece96ae Mon Sep 17 00:00:00 2001 From: QGarchery Date: Fri, 8 Feb 2019 07:51:05 +0100 Subject: tactic notations (#31) --- unit-tests/Tests_verit.v | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'unit-tests') diff --git a/unit-tests/Tests_verit.v b/unit-tests/Tests_verit.v index 9117864..6a22f8e 100644 --- a/unit-tests/Tests_verit.v +++ b/unit-tests/Tests_verit.v @@ -26,13 +26,13 @@ Proof. verit. Qed. -(* In standard coq we need decidability of Int31.digits *) +(* (* In standard coq we need decidability of Int31.digits *) *) (* Lemma fun_const : *) (* forall f (g : int -> int -> bool), *) (* (forall x, g (f x) 2) -> g (f 3) 2. *) (* Proof. *) (* intros f g Hf. *) -(* verit_base Hf; vauto. *) +(* verit Hf. *) (* exists (fun x y => match (x, y) with (Int31.D0, Int31.D0) | (Int31.D1, Int31.D1) => true | _ => false end). *) (* intros x y; destruct x, y; constructor; try reflexivity; try discriminate. *) (* exists Int63Native.eqb. *) @@ -41,12 +41,12 @@ Qed. Open Scope Z_scope. + Lemma fun_const2 : forall f (g : Z -> Z -> bool), (forall x, g (f x) 2) -> g (f 3) 2. Proof. - intros f g Hf. - verit_bool_base Hf; vauto. + intros f g Hf. verit Hf. Qed. (* Toplevel input, characters 916-942: @@ -565,7 +565,6 @@ Qed. Goal forall a , (xorb a a) || negb (xorb a a). verit. Qed. -Print Unnamed_thm5. Goal forall a, (a||negb a) || negb (a||negb a). verit. @@ -1021,85 +1020,85 @@ Proof. Qed. -(* Some examples of using verit with lemmas. Use +(* Some examples of using verit with lemmas. Use to temporarily add the lemmas H1 .. Hn to the verit environment. *) Lemma taut1 : forall f, f 2 =? 0 -> f 2 =? 0. -Proof. intros f p. verit_bool_base p; vauto. Qed. +Proof. intros f p. verit p. Qed. Lemma taut2 : forall f, 0 =? f 2 -> 0 =?f 2. -Proof. intros f p. verit_bool_base p; vauto. Qed. +Proof. intros f p. verit p. Qed. Lemma taut3 : forall f, f 2 =? 0 -> f 3 =? 5 -> f 2 =? 0. -Proof. intros f p1 p2. verit_bool_base p1 p2; vauto. Qed. +Proof. intros f p1 p2. verit p1 p2. Qed. Lemma taut4 : forall f, f 3 =? 5 -> f 2 =? 0 -> f 2 =? 0. -Proof. intros f p1 p2. verit_bool_base p1 p2; vauto. Qed. +Proof. intros f p1 p2. verit p1 p2. Qed. Lemma test_eq_sym a b : implb (a =? b) (b =? a). Proof. verit. Qed. Lemma taut5 : forall f, 0 =? f 2 -> f 2 =? 0. -Proof. intros f p. verit_bool_base p; vauto. Qed. +Proof. intros f p. verit p. Qed. Lemma fun_const_Z : forall f , (forall x, f x =? 2) -> f 3 =? 2. -Proof. intros f Hf. verit_bool_base Hf; vauto. Qed. +Proof. intros f Hf. verit Hf. Qed. Lemma lid (A : bool) : A -> A. -Proof. intro a. verit_bool_base a; vauto. Qed. +Proof. intro a. verit a. Qed. Lemma lpartial_id A : (xorb A A) -> (xorb A A). -Proof. intro xa. verit_bool_base xa; vauto. Qed. +Proof. intro xa. verit xa. Qed. Lemma llia1 X Y Z: (X <=? 3) && ((Y <=? 7) || (Z <=? 9)) -> (X + Y <=? 10) || (X + Z <=? 12). -Proof. intro p. verit_bool_base p; vauto. Qed. +Proof. intro p. verit p. Qed. Lemma llia2 X: X - 3 =? 7 -> X >=? 10. -Proof. intro p. verit_bool_base p; vauto. Qed. +Proof. intro p. verit p. Qed. Lemma llia3 X Y: X >? Y -> Y + 1 <=? X. -Proof. intro p. verit_bool_base p; vauto. Qed. +Proof. intro p. verit p. Qed. Lemma llia6 X: andb ((X - 3) <=? 7) (7 <=? (X - 3)) -> X >=? 10. -Proof. intro p. verit_bool_base p; vauto. Qed. +Proof. intro p. verit p. Qed. Lemma even_odd b1 b2 x1 x2: (ifb b1 (ifb b2 (2*x1+1 =? 2*x2+1) (2*x1+1 =? 2*x2)) (ifb b2 (2*x1 =? 2*x2+1) (2*x1 =? 2*x2))) -> ((implb b1 b2) && (implb b2 b1) && (x1 =? x2)). -Proof. intro p. verit_bool_base p; vauto. Qed. +Proof. intro p. verit p. Qed. Lemma lcongr1 (a b : Z) (P : Z -> bool) f: (f a =? b) -> (P (f a)) -> P b. -Proof. intros eqfab pfa. verit_bool_base eqfab pfa; vauto. Qed. +Proof. intros eqfab pfa. verit eqfab pfa. Qed. Lemma lcongr2 (f:Z -> Z -> Z) x y z: x =? y -> f z x =? f z y. -Proof. intro p. verit_bool_base p; vauto. Qed. +Proof. intro p. verit p. Qed. Lemma lcongr3 (P:Z -> Z -> bool) x y z: x =? y -> P z x -> P z y. -Proof. intros eqxy pzx. verit_bool_base eqxy pzx; vauto. Qed. +Proof. intros eqxy pzx. verit eqxy pzx. Qed. Lemma test20 : forall x, (forall a, a 0 <=? x = false. -Proof. intros x H. verit_bool_base H; vauto. Qed. +Proof. intros x H. verit H. Qed. Lemma test21 : forall x, (forall a, negb (x <=? a)) -> negb (0 <=? x). -Proof. intros x H. verit_bool_base H; vauto. Qed. +Proof. intros x H. verit H. Qed. Lemma un_menteur (a b c d : Z) dit: dit a =? c -> @@ -1108,13 +1107,13 @@ Lemma un_menteur (a b c d : Z) dit: (a =? c) || (a =? d) -> (b =? c) || (b =? d) -> a =? d. -Proof. intros H1 H2 H3 H4 H5. verit_bool_base H1 H2 H3 H4 H5; vauto. Qed. +Proof. intros H1 H2 H3 H4 H5. verit H1 H2 H3 H4 H5. Qed. Lemma const_fun_is_eq_val_0 : forall f : Z -> Z, (forall a b, f a =? f b) -> forall x, f x =? f 0. -Proof. intros f Hf. verit_bool_base Hf; vauto. Qed. +Proof. intros f Hf. verit Hf. Qed. (* You can use to permanently add the lemmas H1 .. Hn to the environment. If you did so in a section then, at the end of the section, @@ -1193,7 +1192,7 @@ End mult3. (* Hypothesis mult_Sx : forall x y, mult (x+1) y =? mult x y + y. *) (* Lemma mult_1_x : forall x, mult 1 x =? x. *) -(* Proof. verit_bool_base mult_0 mult_Sx. *) +(* Proof. verit mult_0 mult_Sx. *) (* Qed. *) (* End mult. *) @@ -1325,15 +1324,16 @@ Section group. Lemma unique_identity e': (forall z, op e' z =? z) -> e' =? e. - Proof. intros pe'. verit_bool_base pe'; vauto. Qed. + Proof. intros pe'. verit pe'. Qed. Lemma simplification_right x1 x2 y: op x1 y =? op x2 y -> x1 =? x2. - Proof. intro H. verit_bool_base H; vauto. Qed. + Proof. intro H. verit H. Qed. Lemma simplification_left x1 x2 y: op y x1 =? op y x2 -> x1 =? x2. - Proof. intro H. verit_bool_base H; vauto. Qed. + Proof. intro H. verit H. Qed. Clear_lemmas. End group. + -- cgit