Subject: Ssreflect Users Discussion List
List archive
- From: Kazuhiko Sakaguchi <>
- To: Jake <>
- Cc: ssreflect <>
- Subject: Re: [ssreflect] Stable Sorts and Permutations Help
- Date: Wed, 6 Feb 2019 07:33:52 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
- Ironport-phdr: 9a23:KXpfaBZQ4Mb4+YjFR/FbAaX/LSx+4OfEezUN459isYplN5qZr8m7bnLW6fgltlLVR4KTs6sC17KG9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCa+bL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjmk8qxlSgLniD0fOjE2/mHYiMx+gqxYrhy8uRJw34HabZqJNPpnZK7RYc8WSXZDU8tXSidPApm8b4wKD+cZOOhXtYj8p0YOrRu/BgmsA/7kxCJSiX/1x6I63PkhHh3G3AwhAtkDt2/Uo8/2NKgIXuC10bXHzTXCb/5NxTj974nIchY6of2WQbJwatfRyUoyFwzelFqcs5bqMC+P2uQPq2iW9uxtXv+hhW4grgF+uDmvxsE0h4nGh4IV1lDE9Thiz4ovOdK4T0t7bNi5G5VTryGXL5Z6T80+T21ypSo3yr4LtYS4cSUI0pgqxwbTZ+Kbf4WM+B7uV+acLS1miH54fL+znQu+/Equx+D6S8K6ykxFrjBfndnJrn0N1wLc6syASvZl4Eeh2DGP1wTN5eFYOEw0k6TaJIA7zrEskZoTsELDHjTslEXql6+Wa0Yk+vWz5Ov9eLnpvIOTO5V2igHmKqgum8q/DvokMgUWQmSW9/iw2Kf+8UD5Q7hGlP47n6vDvJ3aPcgbo7S2Aw5R0oYt8Ra/CDKm3cwDnXYdL1JKYh2Hj5X1NFHOIfD1Fuuwg1OtkDdt3PDKJKHhAo7QLnjAjbfuZqxy51RGxwUv19xf5YpUBqkbIP3vQk/xqMDYDhghPgyv2ObnEsty1o0aWW2RHqCZLLjfsUSI5+IqO+mDfpUZuDf7K/g/5v7hl2U1mVEHffrh4ZxCSnm7E7wyIUyabDzzi9QaG24XuyIxSeXrjBuJVjsFNFioWKdpxTgpFYKnDoCLfYmuibOc1ye6VslNb2NPBU2HEXbAfIKFXexKdDmPIdJrm3oNXv6jU9lyhlmVqAbmxu8/faLv8SoCuMe7jYkn16jojRg3sAdMIYGY2mCJQXtzmzlRFTQx3aZk51Bm11Se26E+ivceF8QBv6oVADd/DobVyqlBM/63QhjIJI7bQ1GnRM7gHSosTc87ypkHaAB/A4f6102R72+RG7YQ0oezKtk0/6bbhCKjOcd6z3vaka8+gh8tRcpJLiu6nbN86gLaQYfC1UeBxf6n
Hello Jake,
This is my implementation of merge sort for lists in MathComp, proved
to be stable, and consumes only O(log n) stack space:
https://github.com/pi8027/efficient-finfun/blob/master/theories/misc/mergesort.v#L446
Best,
Kazuhiko
2019年2月6日(水) 6:41 Jake
<>:
>
> Hi,
>
> I'm an undergraduate at Princeton working on a project in Coq that requires
> a theory of stable sorts.
>
> Has anyone seen or done work on stable sorts in the past? The only thing I
> found was Xavier Leroy's Mergesort proof, but I've found his definition
> unwieldy in proving things about stable sorts.
>
> I'd like to make use of math-comp, especially the definition of
> permutations, to formulate an elegant definition of what it means for sorts
> to be stable, but I'm having trouble using the mathematical components
> library and ssreflect. Is there anyone who could give me guidance on using
> the permutations part of the library?
>
> One specific question I have about permutations is: how can I evaluate a
> permutation in Coq? If I define the permutation (01) in S₃:
>
> Let n := 3.
>
> Program Definition zero : 'I_n := Ordinal (_ : 0 < n).
> Program Definition one : 'I_n := Ordinal (_ : 1 < n).
> Program Definition two : 'I_n := Ordinal (_ : 2 < n).
>
> Definition p := tperm zero one.
>
> I can prove things about the action of p:
>
> Goal p zero == one.
> Proof. by case: tpermP. Qed.
>
> Goal p one == zero.
> Proof. by case: tpermP. Qed.
>
> Goal p two == two.
> Proof. by case: tpermP. Qed.
>
> But I can't evaluate it directly like I would a normal Coq function:
>
> Eval compute in ((tperm zero one) zero).
> (*
> = perm (can_inj (tperm_proof (Ordinal is_true_true) (Ordinal
> is_true_true)))
> (Ordinal is_true_true)
> : ordinal_finType n
> *)
>
> Thanks,
> Jake Waksbaum
- [ssreflect] Stable Sorts and Permutations Help, Jake, 02/06/2019
- Re: [ssreflect] Stable Sorts and Permutations Help, Kazuhiko Sakaguchi, 02/06/2019
Archive powered by MHonArc 2.6.18.