Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Record with notation

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Record with notation


Chronological Thread 
  • From: Gregory Malecha <gmalecha AT gmail.com>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Record with notation
  • Date: Fri, 13 May 2016 09:57:57 -0700
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gmalecha AT gmail.com; spf=Pass smtp.mailfrom=gmalecha AT gmail.com; spf=None smtp.helo=postmaster AT mail-oi0-f48.google.com
  • Ironport-phdr: 9a23:B9/6hRYXf9oxDGegsyoJ1MP/LSx+4OfEezUN459isYplN5qZpcu4bnLW6fgltlLVR4KTs6sC0LqH9fq5EjVYu96oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDjvceKKFwQ3nKUWvBbElaflU3prM4YgI9veO4a6yDihT92QdlQ3n5iPlmJnhzxtY+a9Z9n9DlM6bp6r5YTGY2zRakzTKRZATI6KCh1oZSz7ViQBTeIs1AbSy09lgdCS1zO6wi/VZPsuAP7sPB80W+UJ5ulY6ozXGGN9apkTwX5wAIOMzMy8Gif3sN1haZWqxKojxN6yo/QJoqSMawtLevmYdoGSD8ZDY5qXCtbD9b5NtNXAg==

Hello, Pierre --

I hacked something like this together a while ago. The latest incarnation is probably not quite up to snuff but the ideas can be found in this file:

https://github.com/coq-ext-lib/coq-ext-lib/blob/v8.5/theories/Programming/With.v

Note: To use this code you need to declare some type class instances (namely Struct and Accessor) for records that you would like to do this for.

I'd be happy to chat more with you about it and fix up the code to make it easier to use. One thing that I think is important about this implementation is that 'with' desugars definitionally/judgementally rather than just propositionally which is very important for computation.


On Fri, May 13, 2016 at 2:54 AM, Pierre Néron <pierre.neron AT polytechnique.org> wrote:
Is there a way to define in Coq a notation similar to OCaml "with" notation for records ?

{ rec with foo := bar} would be a record with the same fields as "rec" except for field "foo" which would have value bar.

I did not manage to define one even for a specific record type.

Thanks in advance

--
Pierre Neron




--
gregory malecha



Archive powered by MHonArc 2.6.18.

Top of Page