coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jonathan Leivent <jonikelee AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] A version of "ring" that substitutes equalities
- Date: Wed, 4 Nov 2015 15:38:42 -0500
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-yk0-f180.google.com
- Ironport-phdr: 9a23:f7xi7xcz3NLOAJOS4bl/4Ds/lGMj4u6mDksu8pMizoh2WeGdxc6+ZR7h7PlgxGXEQZ/co6odzbGG7ua7ASdZusrJmUtBWaIPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbviptuIO04R32b1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu2pN5g/GLdfFXEtN30/zMztrxjKCwWVtVUGVWBDsB1OChTF5ReyeprwrCb8qqIp2i6cPM77Sb05cTun5qZvDhTvjXFUZHYC7GjLh5ko3+pgqxW7qkknzg==
On 11/04/2015 03:09 PM, Jonathan Leivent wrote:
On 11/04/2015 02:47 PM, Michael Shulman wrote:
On Wed, Nov 4, 2015 at 8:35 AM, Jonathan Leivent <jonikelee AT gmail.com> wrote:I have been developing a set of tactics that does something like this -Nice! Is anything available yet?
it rewrites ring equality hyps so that they have a single variable on
their lhs, and then rewrites them over the goal, which produces a more
general rewriting.
I have a working version embedded into other things - I will dis-embed it shortly and pass it along...
Here it is (attached).
-- Jonathan
Require Import ZArith. Open Scope Z_scope. Lemma lhsify_rw : forall (x y : Z), x = y <-> x - y = 0. Proof. intros; omega. Qed. Lemma deadd1 : forall x y z, x + y = z <-> x = z - y. Proof. intros; omega. Qed. Lemma deadd2 : forall x y z, x + y = z <-> y = z - x. Proof. intros; omega. Qed. Lemma desub1 : forall x y z, x - y = z <-> x = z + y. Proof. intros; omega. Qed. Lemma desub2 : forall x y z, x - y = z <-> y = x - z. Proof. intros; omega. Qed. Lemma deopp : forall x y, -x = y <-> x = -y. Proof. intros; omega. Qed. Ltac z_subst H := lazymatch type of H with | ?X + ?Y = _ => (*use backtrackable choice to search for a monomial var*) (rewrite (deadd1 X Y) in H + rewrite (deadd2 X Y) in H); z_subst H | ?X - ?Y = _ => (rewrite (desub1 X Y) in H + rewrite (desub2 X Y) in H); z_subst H | - ?X = _ => rewrite (deopp X) in H; z_subst H | ?V = _ => is_var V; (*found a monomial var*) (*don't rewrite and clear unless the rewrite does something*) rewrite !H in *; clear V H end. Ltac z_hyp H := rewrite lhsify_rw in H; z_subst H. Goal forall x y z, x*y = z + 2 -> z = y*x - 2. intros x y z H. Fail omega. Fail ring. z_hyp H. ring. Qed.
- [Coq-Club] A version of "ring" that substitutes equalities, Michael Shulman, 11/04/2015
- Re: [Coq-Club] A version of "ring" that substitutes equalities, Jonathan Leivent, 11/04/2015
- Message not available
- Re: [Coq-Club] A version of "ring" that substitutes equalities, Michael Shulman, 11/04/2015
- Re: [Coq-Club] A version of "ring" that substitutes equalities, Jonathan Leivent, 11/04/2015
- Re: [Coq-Club] A version of "ring" that substitutes equalities, Jonathan Leivent, 11/04/2015
- Re: [Coq-Club] A version of "ring" that substitutes equalities, Jonathan Leivent, 11/04/2015
- Re: [Coq-Club] A version of "ring" that substitutes equalities, Michael Shulman, 11/04/2015
- Re: [Coq-Club] A version of "ring" that substitutes equalities, Assia Mahboubi, 11/05/2015
- Re: [Coq-Club] A version of "ring" that substitutes equalities, Laurent Thery, 11/05/2015
- Message not available
- Re: [Coq-Club] A version of "ring" that substitutes equalities, Michael Shulman, 11/05/2015
- Re: [Coq-Club] A version of "ring" that substitutes equalities, Dmitrii Pasechnik, 11/05/2015
- Re: [Coq-Club] A version of "ring" that substitutes equalities, Frédéric Besson, 11/05/2015
- Re: [Coq-Club] A version of "ring" that substitutes equalities, Michael Shulman, 11/05/2015
Archive powered by MHonArc 2.6.18.