coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Leonardo Rodriguez <leonardomatiasrodriguez AT gmail.com>
- To: Adam Chlipala <adam AT chlipala.net>
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] question about a simple arithmetic theorem
- Date: Wed, 22 Jun 2011 22:09:26 -0300
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=HiuHkHkW3SsnphArSgINR/CwroRSOcAa/d6mFjR2JEaDHRpx5fM8WO/jcDFAys6gGw ABXRYEBJLi9ezRBAoLX0MP+WIGL4m5WAschf+DhGMeo9WbYnlS0nFVJVc1vPs7+Nz7mM 6SLaQD1NmhyUV7iPGkN3/05cjKle0AZqM8ZAk=
i'm glad for your answer to my first post, because i'm reading your book about program certification . I hope understand the magic of omega and "crush" tactic in a near future. Your solution with the "replace" tactic was interesting too. Thank you.
2011/6/22 Adam Chlipala <adam AT chlipala.net>
leonardomatiasrodriguez@gmail.com wrote:I see you got an answer to your question, but I'd like to point out another tactic that may make your life easier in the future. The [rewrite] syntax, suggested by Evgeny and used in your posted solution, requires you to keep track of the argument orders of various lemmas. By using the [replace] tactic instead, you can avoid that need. Here's an alternate script using [replace] (see the manual for documentation of unfamiliar tactics):
I'm just learning Coq, and i'm proving a simple theorem:
Theorem le_minus_minus : forall n m , n<= m -> m - (m - n) = n.
My idea is to replace the first occurrence of "m" in "m - (m - n)" by "n + (m
- n)" using
le_plus_minus
: forall n m : nat, n<= m -> m = n + (m - n)
and then prove another lemma
forall n p : nat, (n+p) - p = n.
to conclude ( n + (m - n) ) - (m - n) = n.
Goal forall n m , n <= m -> m - (m - n) = n.
intros.
pattern m at 1.
replace m with (n + (m - n)).
apply other_lemma.
symmetry; apply le_plus_minus; assumption.
Qed.
P.S.: I wouldn't recommend using such an unwieldy proof script in a real development, since this proof script also works (after you have run "Require Import Omega."):
intros; omega.
- [Coq-Club] question about a simple arithmetic theorem, leonardomatiasrodriguez
- Re: [Coq-Club] question about a simple arithmetic theorem,
Evgeny Makarov
- Re: [Coq-Club] question about a simple arithmetic theorem, Leonardo Rodriguez
- Re: [Coq-Club] question about a simple arithmetic theorem,
Adam Chlipala
- Re: [Coq-Club] question about a simple arithmetic theorem, Leonardo Rodriguez
- Re: [Coq-Club] question about a simple arithmetic theorem,
Evgeny Makarov
Archive powered by MhonArc 2.6.16.