diff options
| author | Maxime Dénès | 2017-08-16 09:43:53 +0200 |
|---|---|---|
| committer | Maxime Dénès | 2017-08-16 09:43:53 +0200 |
| commit | 09b54382e52b572f8c091993309adcc4fea3a093 (patch) | |
| tree | 941b56303eb6b9547702fe54e3650c27000d19f6 | |
| parent | 64061ae938b284f246586c2e7b959413953b4b0a (diff) | |
| parent | 0b0411c56cac33ccd9474da4ae71d498355422b3 (diff) | |
Merge PR #942: solving b1859
| -rw-r--r-- | plugins/setoid_ring/Ring_tac.v | 34 | ||||
| -rw-r--r-- | test-suite/bugs/closed/1859.v | 20 |
2 files changed, 46 insertions, 8 deletions
diff --git a/plugins/setoid_ring/Ring_tac.v b/plugins/setoid_ring/Ring_tac.v index fc02cef100..329fa0ee81 100644 --- a/plugins/setoid_ring/Ring_tac.v +++ b/plugins/setoid_ring/Ring_tac.v @@ -427,19 +427,37 @@ Tactic Notation "ring_simplify" constr_list(rl) "in" hyp(H):= let t := type of H in let g := fresh "goal" in set (g:= G); - generalize H;clear H; + generalize H; ring_lookup (PackRing Ring_simplify) [] rl t; - intro H; + (* + Correction of bug 1859: + we want to leave H at its initial position + this is obtained by adding a copy of H (H'), + move it just after H, remove H and finally + rename H into H' + *) + let H' := fresh "H" in + intro H'; + move H' after H; + clear H;rename H' into H; unfold g;clear g. -Tactic Notation - "ring_simplify" "["constr_list(lH)"]" constr_list(rl) "in" hyp(H):= +Tactic Notation "ring_simplify" "["constr_list(lH)"]" constr_list(rl) "in" hyp(H):= let G := Get_goal in let t := type of H in let g := fresh "goal" in set (g:= G); - generalize H;clear H; + generalize H; ring_lookup (PackRing Ring_simplify) [lH] rl t; - intro H; - unfold g;clear g. - + (* + Correction of bug 1859: + we want to leave H at its initial position + this is obtained by adding a copy of H (H'), + move it just after H, remove H and finally + rename H into H' + *) + let H' := fresh "H" in + intro H'; + move H' after H; + clear H;rename H' into H; + unfold g;clear g.
\ No newline at end of file diff --git a/test-suite/bugs/closed/1859.v b/test-suite/bugs/closed/1859.v new file mode 100644 index 0000000000..43acfe4ba2 --- /dev/null +++ b/test-suite/bugs/closed/1859.v @@ -0,0 +1,20 @@ +Require Import Ring. +Require Import ArithRing. + +Ltac ring_simplify_neq := + match goal with + | [ H: ?X <> ?Y |- _ ] => progress ring_simplify X Y in H + end. + +Lemma toto : forall x y, x*1 <> y*1 -> y*1 <> x*1 -> x<>y. +Proof. + intros. + ring_simplify_neq. + ring_simplify_neq. + (* make sure ring_simplify has simplified both hypotheses *) + match goal with + | [ H: context[_*1] |- _ ] => fail 1 + | _ => idtac + end. + auto. +Qed. |
