coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: "Andrew McCreight" <continuation AT gmail.com>
- Cc: coq-club AT pauillac.inria.fr
- Subject: Re: [Coq-Club] Re: Help with a seemingly obvious proof.
- Date: Thu, 30 Oct 2008 13:19:13 -0700
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:subject:cc:in-reply-to:mime-version :content-type:references; b=dlCpjS3Bk9VaBLgI/qfrjHYf4ijorkGGIVZ84FC+M/9xAhH0ODWE6XyZDDLtpEJ6Oy XsnrP+LBgKCwiCI8+qajXLGdInU+DC37UZc+inKQfdNCvaur4Cur8znOvmLsEaYULrMV m/71KkmMfMN1ovQpWplxKsLXV2jCpMfmvhVOI=
- List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>
Unfortunately, in my experience proving even obvious things involving division can be fairly tedious. Some tactics that help are ring, which will prove equality between terms involving basic algebraic reasoning (addition, subtraction, and multiplication), and omega, which will prove things for Presburger arithmetic. Really, though, you have to look through Zdiv and puzzle out which combination of lemmas will solve your task. Ring and omega just make it easier to get the goal into a state where you can apply one of those lemmas, so maybe that is the answer to your question.
Your particular theorem can be solved like this:
Goal forall x,
x > 0 ->
x <> 1 ->
x <> 2 ->
(4 * (x - 1)) / 4 - 1 >= 0.
Proof.
intros x H1 H2 H3.
replace (4 * (x - 1)) with (x * 4 + (- 1 * 4)) by ring.
rewrite Z_div_plus. 2:omega.
rewrite Z_div_mult. 2:omega.
omega.
Qed.
Figuring out what exactly the replace line should be took me a couple of rounds of iteration, and the goal is really to massage things into a form that the built in lemmas can digest. Omega cleans up the odds and ends.
If there's a better way to prove these sorts of things, I'd love to know about it.
-Andrew
On Thu, Oct 30, 2008 at 12:08 PM, Satrajit Roy <satrajit.roy AT gmail.com> wrote:
Hi folks,I cannot prove the following with the tactics that I know of, although the goal seems pretty obvious.argc : int32
H1 : integer_of_int32 argc > 0
HW_28 : integer_of_int32 argc = 1 -> False
HW_38 : integer_of_int32 argc = 2 -> False______________________________________(1/1)
4 * (integer_of_int32 argc - 1) / 4 - 1 >= 0I think, somehow I need to reduce the goal to a form where I can apply Z_div_ge0, but I cannot find a tactic to do so.By the way, this is part of a proof obligation generated by Frama-C. If you need more information, please let me know.Thanks again.
- [Coq-Club] Re: Help with a seemingly obvious proof., Satrajit Roy
- Re: [Coq-Club] Re: Help with a seemingly obvious proof., Andrew McCreight
- Re: [Coq-Club] Re: Help with a seemingly obvious proof.,
Pierre Letouzey
- Re: [Coq-Club] Re: Help with a seemingly obvious proof., Satrajit Roy
- Re: [Coq-Club] Re: Help with a seemingly obvious proof.,
Pierre Letouzey
- Re: [Coq-Club] Re: Help with a seemingly obvious proof., Andrew McCreight
Archive powered by MhonArc 2.6.16.