coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Guillaume Brunerie <guillaume.brunerie AT gmail.com>
- To: paul.tarau AT gmail.com
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] applying a function definition
- Date: Sat, 28 May 2011 16:38:13 +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=SSapwG+tktZA2Qio9NV6bk6vXcMxOEpEq9TIkIqLRCN2GvVFSV2JeZ5von5O5IoFl6 E00SlflJjLuX6TSde/5mlvUfEGn3JzNdVOO/iBCc0Q4L1b/pEY5SagfwyMuqZL8DukGQ Mj5f/fH+g7AI4IBuogvX+eoerz6O3JrDh9K3g=
2011/5/28 <paul.tarau AT gmail.com>
I have defined a simple predecessor function "p" for bijective base-2
arithmetic on type B as:
Inductive B : Set :=
| e : B
| o : B -> B
| i : B -> B.
Delimit Scope b_scope with B.
Bind Scope b_scope with B.
Arguments Scope o [b_scope].
Arguments Scope i [b_scope].
Fixpoint p (x : B) : B :=
match x with
| e => e
| o e => e
| o a => i (p a)
| i a => o a
end.
Eval compute in p (p (i (i (o e)))).
(* The definition seems accepted and "Eval compute" works as expected *)
(* I would like to apply the definition of p and prove the following lemma. *)
Lemma po_ip : forall n:B, n<>e -> p (o n) = i (p n).
Proof.
intros n H.
Show.
(* Unfortunately none of the tactics I have tried work at this point and the
ref. manual does not seem to have one that does allows you to a apply a
function definition directly (or maybe it is there and I could not find it?).
What should I do next to convince Coq to use the option o n => i (p a) in the
definition of p to prove the lemma?
Thanks,
Paul
*)
You can use the tactic 'simpl', which will unfold the definition of p.
After that, the tactic 'case_eq' will allow you to prove the result for every case, while retaining the value of n (try 'case' instead to see what I mean).
And 'firstorder' will then do the job.
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.