coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Adam Chlipala <adamc AT hcoop.net>
- To: Hermann Lehner <hermann.lehner AT inf.ethz.ch>
- Cc: Coq Club <coq-club AT pauillac.inria.fr>
- Subject: Re: [Coq-Club] Fixpoint definitions over Z
- Date: Mon, 26 May 2008 09:08:27 -0400
- List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>
Hermann Lehner wrote:
I'm trying to define a function 'SumFilterZ' in Coq that corresponds to the addition of all integers between 'lo' and 'hi' if 'filter' is true.
You should be able to do it by:
- Subtracting 'lo' from 'hi'
- Converting to [nat] (give up at this point (by, e.g., returning [None] or 0) if the result was negative)
- Calling a function that is primitive recursive on a natural number N, which takes an integer i and acts like your filter function for i..i+N (with conversions between naturals and integers as needed)
- [Coq-Club] Fixpoint definitions over Z, Hermann Lehner
- Re: [Coq-Club] Fixpoint definitions over Z,
Jean-Marc Notin
- Re: [Coq-Club] Fixpoint definitions over Z, Hermann Lehner
- Re: [Coq-Club] Fixpoint definitions over Z, Adam Chlipala
- Re: [Coq-Club] Fixpoint definitions over Z,
Jean-Marc Notin
Archive powered by MhonArc 2.6.16.