coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Adam Koprowski <adam.koprowski AT gmail.com>
- To: dimitrisg7 <dvekris AT hotmail.com>, coq-club AT pauillac.inria.fr
- Cc: Xavier Leroy <Xavier.Leroy AT inria.fr>, Taral <taralx AT gmail.com>
- Subject: Re: [Coq-Club] Sorting
- Date: Sat, 11 Apr 2009 17:08:46 +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=FdvtRZRp5OmV1zkDxxughb8H3nmFuvVriSbIUAJ2LEACMuHnFexWmfebCUO9G3D5gJ b0+kQrIUd+xjhwlTpepPtM8qdL6qeUp/btZA+Yi8sl9gjY0V0Lm7ak3HQ9QFE8hy2rCH LyGJt2SAw3sFGHG7K3T3+yQ0pS7iGgd2aFNvo=
- List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>
You may also want to take a look at the quick sort implementation (along with the proof of its average case n log n complexity) by Eelis van der Weegen and James McKinna: http://www.xs4all.nl/~weegen/eelis/research/quicksort.
Cheers,
Adam
On Sat, Apr 11, 2009 at 15:37, Xavier Leroy <Xavier.Leroy AT inria.fr> wrote:
>> The problem is that I have a list of integers (given unsorted unfortunatelyThis library provides a merge function over two sorted lists, but
>> in my proof) and I want to sort them in ascending order, which means I want
>> to construct the object (Sorted: sort le l), where l is a list of nat. Is
>> that possible or am I complicating things?
>
> Sure it's possible. Pick a sort algorithm. Given the structure of
> List, you probably want merge sort. Oh, will you look at that! It's
> been done!
>
> http://coq.inria.fr/V8.2/doc/html/stdlib/Coq.Sorting.Sorting.html
there is still some work to do to implement mergesort. See:
http://gallium.inria.fr/~xleroy/coq/Mergesort.html
http://gallium.inria.fr/~xleroy/coq/Mergesort.v
It's a nice exercise in using "Program".
Alternatively, the Coq standard library does provide a list sorting
function based on heap sort (module Coq.Sorting.Heap), but I dislike
it for reasons explained in bug report #2047.
Enjoy,
- Xavier Leroy
--------------------------------------------------------
Bug reports: http://logical.saclay.inria.fr/coq-bugs
Archives: http://pauillac.inria.fr/pipermail/coq-club
http://pauillac.inria.fr/bin/wilma/coq-club
Info: http://pauillac.inria.fr/mailman/listinfo/coq-club
--
=====================================================
Adam.Koprowski AT gmail.com, http://www.cs.ru.nl/~Adam.Koprowski
The difference between impossible and possible
lies in determination (Tommy Lasorda)
=====================================================
- [Coq-Club] Sorting, dimitrisg7
- Re: [Coq-Club] Sorting,
Taral
- Re: [Coq-Club] Sorting,
Xavier Leroy
- Re: [Coq-Club] Sorting, Adam Koprowski
- RE: [Coq-Club] Sorting, Georges Gonthier
- Re: [Coq-Club] Sorting,
Xavier Leroy
- Re: [Coq-Club] Sorting,
Taral
Archive powered by MhonArc 2.6.16.