coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Mathieu Boespflug <mboes AT tweag.net>
- To: Bernard Hurley <bernard AT marcade.biz>
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Functions that differ at exactly one point
- Date: Sun, 29 Apr 2012 13:38:55 -0400
Hi Bernard,
> But is it possible to define a function that differs at an arbitrary
> integer as the following incorrect code is trying to do:
>
> +++++++++++++++++++++++++++++++++
> Variable f : nat -> nat.
> Variable m : nat.
>
> Fixpoint g (n : nat) : nat :=
> match n with
> | m => 2
> | _ => f n
> end.
> ++++++++++++++++++++++++++++++++++
The second branch you wrote above is effectively a dead branch, because
the pattern in the first branch always matches. I think you meant to
write something like:
Require Import EqNat.
Section Example.
Variable f : nat -> nat.
Variable m : nat.
Fixpoint g (n : nat) : nat :=
if eq_nat_decide m n then 2 else f n.
End Example.
Hope this helps,
-- Mathieu
- [Coq-Club] Functions that differ at exactly one point, Bernard Hurley
- Re: [Coq-Club] Functions that differ at exactly one point, Jonas Oberhauser
- Re: [Coq-Club] Functions that differ at exactly one point, Mathieu Boespflug
- Re: [Coq-Club] Functions that differ at exactly one point,
Bernard Hurley
- Re: [Coq-Club] Functions that differ at exactly one point,
Daniel Schepler
- Re: [Coq-Club] Functions that differ at exactly one point, Bernard Hurley
- Re: [Coq-Club] Functions that differ at exactly one point,
Daniel Schepler
- Re: [Coq-Club] Functions that differ at exactly one point,
Bernard Hurley
- Message not available
- Message not available
- Re: [Coq-Club] Functions that differ at exactly one point, Jonas Oberhauser
- Message not available
Archive powered by MhonArc 2.6.16.