aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Théry2018-09-21 16:41:55 +0200
committerGitHub2018-09-21 16:41:55 +0200
commit9b8499178e7ce58c576a81c73f1cc23c74ed8aee (patch)
tree66392b730341fe94ba9b8efeb9317261c97e9a2f
parent508265318ad39d2962587af4e10f79f4cf4cf4c6 (diff)
parentf5e33af81f56253ba777cde96831ef23f25addba (diff)
Merge pull request #8462 from vbgl/zify-colonequal
Zify: replace local definitions by equations
-rw-r--r--plugins/omega/PreOmega.v4
-rw-r--r--test-suite/success/ROmega4.v6
2 files changed, 7 insertions, 3 deletions
diff --git a/plugins/omega/PreOmega.v b/plugins/omega/PreOmega.v
index 59fd9b8017..094adfda7a 100644
--- a/plugins/omega/PreOmega.v
+++ b/plugins/omega/PreOmega.v
@@ -85,6 +85,7 @@ Ltac zify_binop t thm a b:=
Ltac zify_op_1 :=
match goal with
+ | x := ?t : Z |- _ => let h := fresh "heq_" x in pose proof (eq_refl : x = t) as h; clearbody x
| |- context [ Z.max ?a ?b ] => zify_binop Z.max Z.max_spec a b
| H : context [ Z.max ?a ?b ] |- _ => zify_binop Z.max Z.max_spec a b
| |- context [ Z.min ?a ?b ] => zify_binop Z.min Z.min_spec a b
@@ -114,6 +115,7 @@ Ltac hide_Z_of_nat t :=
Ltac zify_nat_rel :=
match goal with
(* I: equalities *)
+ | x := ?t : nat |- _ => let h := fresh "heq_" x in pose proof (eq_refl : x = t) as h; clearbody x
| |- (@eq nat ?a ?b) => apply (Nat2Z.inj a b) (* shortcut *)
| H : context [ @eq nat ?a ?b ] |- _ => rewrite <- (Nat2Z.inj_iff a b) in H
| |- context [ @eq nat ?a ?b ] => rewrite <- (Nat2Z.inj_iff a b)
@@ -223,6 +225,7 @@ Ltac hide_Zpos t :=
Ltac zify_positive_rel :=
match goal with
(* I: equalities *)
+ | x := ?t : positive |- _ => let h := fresh "heq_" x in pose proof (eq_refl : x = t) as h; clearbody x
| |- (@eq positive ?a ?b) => apply Pos2Z.inj
| H : context [ @eq positive ?a ?b ] |- _ => rewrite <- (Pos2Z.inj_iff a b) in H
| |- context [ @eq positive ?a ?b ] => rewrite <- (Pos2Z.inj_iff a b)
@@ -348,6 +351,7 @@ Ltac hide_Z_of_N t :=
Ltac zify_N_rel :=
match goal with
(* I: equalities *)
+ | x := ?t : N |- _ => let h := fresh "heq_" x in pose proof (eq_refl : x = t) as h; clearbody x
| |- (@eq N ?a ?b) => apply (N2Z.inj a b) (* shortcut *)
| H : context [ @eq N ?a ?b ] |- _ => rewrite <- (N2Z.inj_iff a b) in H
| |- context [ @eq N ?a ?b ] => rewrite <- (N2Z.inj_iff a b)
diff --git a/test-suite/success/ROmega4.v b/test-suite/success/ROmega4.v
index 58ae5b8fb8..a724592749 100644
--- a/test-suite/success/ROmega4.v
+++ b/test-suite/success/ROmega4.v
@@ -3,12 +3,12 @@
See also #148 for the corresponding improvement in Omega.
*)
-Require Import ZArith ROmega.
+Require Import ZArith Lia.
Open Scope Z.
Goal let x := 3 in x = 3.
intros.
-romega.
+lia.
Qed.
(** Example seen in #4132
@@ -22,5 +22,5 @@ Lemma foo
(H : - zxy' <= zxy)
(H' : zxy' <= x') : - b <= zxy.
Proof.
-romega.
+lia.
Qed.