coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Adam Chlipala <adamc AT csail.mit.edu>
- To: fengsheng <fsheng1990 AT 163.com>
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] How to define the devision on nat by using Fixpoint
- Date: Thu, 20 Dec 2012 11:54:08 -0500
Maybe I'm missing something, but, the way I read the question, the (very straightforward) solution is to use this function:
Fixpoint div2 (n : nat) : nat :=
match n with
| S (S n') => S (div2 n')
| _ => O
end.
On 12/19/2012 11:29 PM, AUGER Cédric wrote:
Le Thu, 20 Dec 2012 04:17:21 +0100 (CET),
"fengsheng"<fsheng1990 AT 163.com>
a écrit :
when I wrote a function to convert natural numbers to binary[...]
numbers,I met a problem:how to take the value of a number half.
Fixpoint div2 (m n:nat): nat*bool :=
match n with
| O => (m, false)
| S O => (m, true)
| S (S n) => div2 (S m) n
end.
- [Coq-Club] How to define the devision on nat by using Fixpoint, fengsheng, 12/20/2012
- Re: [Coq-Club] How to define the devision on nat by using Fixpoint, Jason Gross, 12/20/2012
- Re: [Coq-Club] How to define the devision on nat by using Fixpoint, AUGER Cédric, 12/20/2012
- Re: [Coq-Club] How to define the devision on nat by using Fixpoint, Adam Chlipala, 12/20/2012
- Re: [Coq-Club] How to define the devision on nat by using Fixpoint, AUGER Cédric, 12/20/2012
- Re: [Coq-Club] How to define the devision on nat by using Fixpoint, Adam Chlipala, 12/20/2012
Archive powered by MHonArc 2.6.18.