Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] A version of "ring" that substitutes equalities

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] A version of "ring" that substitutes equalities


Chronological Thread 
  • 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 11:35:58 -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-f171.google.com
  • Ironport-phdr: 9a23:yx34PRf7A3ICQ7TWW0GatGfhlGMj4u6mDksu8pMizoh2WeGdxc65bR7h7PlgxGXEQZ/co6odzbGG7ua7ASdQsd6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDvvcaLKFUYzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IAu3GePEzSqUdBzA7OUg04tfqvF/NV1ih/HwZB0cRlBNUAwHDpDX3X4n8tDey4uh63iiZMMn7QJg7XD2j6+FgTxq+23RPDCIw7GyC0p84t6lcuh/0/xE=



On 11/04/2015 11:09 AM, Michael Shulman wrote:
I wanted a version of the tactic "ring" which is able to make use of
equalities in the context. So I wrote my own:

Ltac ring_useeq :=
first [ ring
| match goal with
| [ H : ?a = ?b |- _ ] =>
first [ rewrite H; clear H; ring_useeq
| rewrite <- H; clear H; ring_useeq
| clear H; ring_useeq ]
end ].

If I did it right, this is doing a tree search through all possible
combinations of rewriting in either direction or not at all with each
equality in the context. However, one could imagine it being even
smarter and trying more things, e.g. in theory it might matter what
order the rewrites happen in. Does a tactic like this exist already
somewhere?

Mike

Mike,

I have been developing a set of tactics that does something like this - 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. However, it only works for equalities that have a monomial variable in them - so not something like "x * y = 2 * z", but it will work for something like "x * y = 2 + z", as it will rewrite this first to "z = x * y - 2", then rewrite z using it.

Also, in many cases, the omega tactic (or the more general variants of it, like lia), can solve ring goals by making use of hyps without any needed rewriting.

-- Jonathan






Archive powered by MHonArc 2.6.18.

Top of Page