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: Dmitrii Pasechnik <dmitrii.pasechnik AT cs.ox.ac.uk>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] A version of "ring" that substitutes equalities
  • Date: Thu, 5 Nov 2015 16:38:27 +0000
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=dmitrii.pasechnik AT cs.ox.ac.uk; spf=None smtp.mailfrom=Dmitrii.Pasechnik AT cs.ox.ac.uk; spf=None smtp.helo=postmaster AT relay16.mail.ox.ac.uk
  • Ironport-phdr: 9a23:FnDBmxwFY2YE9u7XCy+O+j09IxM/srCxBDY+r6Qd0e8WIJqq85mqBkHD//Il1AaPBtWGrakZwLCG+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuStOU1Jn8jbD60qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGwD884mosVHSODxe7kyZb1eFjUvdW4vt+PxshyWYQ6O+mEdUy0umwFFCAjD7RKyCpv0szfgt+s7wCCBMMb2S7E3cT+5qaB7DhbjzjoEYW1quFrLg9B92foI6CmqoAZyltbZ

On Thu, Nov 05, 2015 at 08:20:56AM -0800, Michael Shulman wrote:
> According to the manual
> https://coq.inria.fr/distrib/current/refman/Reference-Manual024.html
> the tactic psatz requires the external program "cspd". But it's

It's a typo in the manual, it's csdp (as is clear from the link provided
there).
I can also (shameless self-advertising here) point out that one might prefer
to install csdp
from https://github.com/dimpase/csdp
(which is the "usual" ./configure + make procedure to follow, rather
than manually editing a makefile...)
Actually, not hard to install, at all.

> unclear to me from reading that chapter in the manual whether the
> other tactics it mentions (lia, nia, lra) also require cspd; do they?

I don't know, but things involving Positivestellensatz might need a
semidefinite programming solver (csdp is one of them). Unless you use
a very weak form of it, that would only need a linear programming solver
(more precisely, testing systems of linear inequalities for solvability)

Dima
>
> On Thu, Nov 5, 2015 at 4:27 AM, Laurent Thery
> <Laurent.Thery AT inria.fr>
> wrote:
> >
> >
> > On 11/04/2015 05:09 PM, 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
> >>
> >
> > As a mattern of fact one can use assumptions with ring if there are of
> > the form A = P where addition and multiplication do not occur in A.
> >
> > Example 1 :
> >
> > Require Import ZArith Ring.
> >
> > Open Scope Z_scope.
> >
> > Goal forall x y z,
> > x = y ^ 2 -> (y - z) * (y + z) = x - z^2.
> > Proof.
> > intros x y z H; ring [H].
> > Qed.
> >
> > You have also grobner like computation available with Loïc Pottier's
> > tactic nsatz. Grobner is a very powerful technique but even for simple
> > example it can be very CPU intensive.
> >
> > Example 2 from cyclic 3 :
> >
> > Require Import Reals Nsatz.
> >
> > Open Scope R_scope.
> >
> > Goal forall x y z,
> > x + y + z = 0 ->
> > x * y + x * z + y * z = 0 ->
> > x * y * z = 0 -> x * x * x = 0.
> > Proof.
> > intros x y z H1 H2 H3; nsatz.
> > Qed.
> >
> > There is also a third tactic called nia developed by Frédéric Besson
> > It just adds some non-linear tricks on top of psatz. In practice I find
> > this tactic very impressive.
> >
> > Example 3 from bresenham's algo :
> >
> > Require Import Psatz ZArith.
> >
> > Open Scope Z_scope.
> >
> > Goal forall a b c,
> > 0 < a -> Zabs (2 * a * b - 2 * c) <= a -> forall b', Zabs (a * b - c)
> > <= Zabs (a * b' - c).
> > Proof.
> > intros a b c _ H b'.
> > assert (H1: b = b' \/ Zabs (b - b') >= 1) by nia.
> > nia.
> > Qed.
> >
> > --
> > Laurent



Archive powered by MHonArc 2.6.18.

Top of Page