coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Fabien Renaud <Fabien.Renaud AT inria.fr>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Program and simpl/compute
- Date: Thu, 3 Oct 2013 11:07:54 +0200
Thanks guys,
I think I will use Function since I don't actually need any Program's features and I now understand how to use it.
Fabien
I think I will use Function since I don't actually need any Program's features and I now understand how to use it.
Fabien
On Wed, Oct 2, 2013 at 3:48 PM, Vincent Laporte <vincent.laporte AT gmail.com> wrote:
Le 2013-10-02 11:39, Fabien Renaud a écrit :
> I tried with Function but simpl only expands to function_terminateHi,
> and I'm stuck.
If you use Function, then several objects will be defined: the function
itself and a couple of lemmas, one of them being test_equation.
Function test (l: list nat) {measure length} :=
match l withProof.
| nil => 0
| X::R => (test (tl R))
end.
induction R; intuition.
Defined.
Check test_equation.
(* test_equation
: forall l : list nat,
test l = match l with
| [] => 0
| _ :: R => test (tl R)
end
*)
You can use this lemma to simplify some terms. For instance:
Goal ∀ x l, test (x::l) = 0.
intros x l. rewrite test_equation.
(* the goal is now: test (tl l) = 0. *)
Abort.
Moreover, there is an induction principle associated with your function
(its name is test_ind but that does not matter much). It might help
proving facts about the function, as in the following:
Lemma foo l : test l = 0.
Proof.
functional induction test l; auto.
Qed.
Regards,
--
Vincent.
- [Coq-Club] Program and simpl/compute, Fabien Renaud, 10/02/2013
- Re: [Coq-Club] Program and simpl/compute, Matthieu Sozeau, 10/02/2013
- Re: [Coq-Club] Program and simpl/compute, Vincent Laporte, 10/02/2013
- Re: [Coq-Club] Program and simpl/compute, Fabien Renaud, 10/03/2013
- Re: [Coq-Club] Program and simpl/compute, Pierre-Marie Pédrot, 10/03/2013
- Re: [Coq-Club] Program and simpl/compute, Fabien Renaud, 10/03/2013
Archive powered by MHonArc 2.6.18.