coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Guillaume Brunerie <guillaume.brunerie AT gmail.com>
- To: Paul Tarau <paul.tarau AT gmail.com>
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] applying a function definition
- Date: Sat, 28 May 2011 17:52:46 +0200
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=Gx+yUU0wS6aszVscviQws7K3ADuOtr2wnRcYvvF6s/63VDrEHFHHZie0LdUYi34bPv SwQ/RHDxtmd50Xid/+ZZ4FwgGJiVKA7+Kr+hxE6j37TEdbzj6xUG22cofiqg8OBbXWu+ HHSIj7fCyXlRm4TcnwGrH0I45ozP8A0lq4bZM=
2011/5/28 Paul Tarau <paul.tarau AT gmail.com>
Thanks a lot, the following did it!Lemma po_ip : forall n:B, n<>e -> p (o n) = i (p n).Proof.intros n H.simpl.Show.case_eq n.firstorder.firstorder.intros.firstorder.Qed.
You can do even shorter with :
Lemma po_ip : forall n:B, n<>e -> p (o n) = i (p n).
Proof.
intros n H.
simpl.
case_eq n; firstorder.
Qed.
The semicolon asks Coq to apply the tactic 'firstorder' to every new subgoal.
I am still puzzled why after simpl I get:n : BH : n <> e============================match n with| e => e| o _ => i (p n)| i _ => i (p n)end = i (p n)where the underscores indicate that Coq is ignoring or forgetting the actual argument - this does not seem equivalent with the definition of p. Impressed that magic works:-), but is there anything that could make the proof obtained by the sequence of tactics somewhat human readable - for instance I would be curious to see what firstorder did "under the hood".
'firstorder' hasn’t done any magic, the magic comes from 'simpl'.
When Coq is simplifiying the _expression_ 'p (o n)',
If n = e, then p (o e) = e by definition.
If n = o a, then p (o n) = p (o (o a)) = i (p (o a)) = i (p n)
If n = i a, then p (o n) = p (o (i a)) = i (p (i a)) = i (p n)
In the two latter cases, the result does not depend on a (the underscore), it depends only on n.
And what is left to 'firstorder' to prove is that :
If n = e, something, but n <> e so this is true
If n is of the form (o a) or (i a), then i (p n) = i (p n) which is true.
Guillaume
- [Coq-Club] applying a function definition, paul . tarau
- Re: [Coq-Club] applying a function definition,
Guillaume Brunerie
- Re: [Coq-Club] applying a function definition,
Paul Tarau
- Re: [Coq-Club] applying a function definition, Guillaume Brunerie
- Re: [Coq-Club] applying a function definition,
Paul Tarau
- Re: [Coq-Club] applying a function definition,
Guillaume Brunerie
- Re: [Coq-Club] applying a function definition, Paul Tarau
- Re: [Coq-Club] applying a function definition,
Guillaume Brunerie
- Re: [Coq-Club] applying a function definition,
Paul Tarau
- Re: [Coq-Club] applying a function definition, Guillaume Brunerie
- Re: [Coq-Club] applying a function definition,
Paul Tarau
- Re: [Coq-Club] applying a function definition,
Guillaume Brunerie
Archive powered by MhonArc 2.6.16.