Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Line numbers in list printing?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Line numbers in list printing?


Chronological Thread 
  • From: Samuel Gruetter <gruetter AT mit.edu>
  • To: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Line numbers in list printing?
  • Date: Fri, 21 Jun 2019 16:52:03 +0000
  • Accept-language: en-US
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gruetter AT mit.edu; spf=Pass smtp.mailfrom=gruetter AT mit.edu; spf=None smtp.helo=postmaster AT outgoing-exchange-7.mit.edu
  • Ironport-phdr: 9a23:2GChfB1+mMXJcAsJsmDT+DRfVm0co7zxezQtwd8ZseIVIvad9pjvdHbS+e9qxAeQG9mCsbQc1aGP6/CoGTRZp8rY6TZaKN0EfiRGoP1epxYnDs+BBB+zB9/RRAt+Iv5/UkR49WqwK0lfFZW2TVTTpnqv8WxaQU2nZkJ6KevvB4Hdkdm82fys9J3PeQVIgye2ba9vIBmsogjdq9cajZF+JqswxRfFv2dEdudLzm9sOV6fggzw68it8JJ+6Shcp+4t+8tdWqjmYqo0SqBVAi47OG4v/s3rshfDTQqL5nQCV2gdjwRFDQvY4hzkR5n9qiT1uPZz1ymcJs32UKs7WS++4KdxSR/nkzkIOjgk+2zKkMNwjaZboBW8pxxjxoPffY+YOOZicq7bYNgXQ3dKUMRMWCxbGo6yb5UBAfcdPehWrIf9qVkBrRqiCgajH+7g0CNEi2Xs0KEmz+gsEwfL1xEgEdIUt3TUqc34OroIXuCw0anH0zHDZO5X1zfn9YjHbAwhoe2SUrJqbMHczkYvFxnYjlqOtYzlIy2a1v4Wvmie7upgSfijhHA6pAFsuzWiwNonhIfOhoIQ0F/E9CN5zZ46Jd25VE57YcOkH4BKuy6GMIt2R8UvSHxrtiYi0rAKpJ22cDIOxZg92RLSaOaLfoiL7x77SeqcIi10iXZ/dL6inRq/9UetxvXhWsS11FtGtDRJn9nDu3wXyhDf8NWLR/l880qnxD2BzRrc6vteLkAxjafbK4Auwro3lpcLtkTDAzP2mErxjK+XcEUk9fGk5ProY7r6pp+TLYl0ig7gPag3mMGzG+E4MgkSX2SB5+uzyaDj8VX4QLVMkPI2jrHUvI3ZKMgBoqO1GRFZ34U55xu/DDqqyNEYkmMGLFJBdhKHlY/pO1TWLfD3F/e/nkqjkCt3x//YJL3sGZDNLnnfkLv7Y7ly9lNcxBIpzd9D/5JUFq0BIPXrV0Dts9zYFwY1PBCww+b6E9pwzZgeWGKKAq+BKqzeq16I5uQ1I+mNfoAZojj9K+J2r8Lp2DUynkZYdq2017MWbmq5F7JoOQ/RNXHrm5IKFXoAlgs4Vu3jzlOYB219fXG3Cpk14yw2DMqJF5rOWpygmvTV0z2mE4FKa3puD1GQV3rkatPXCL83dCuOL5o5wXQ/Xr+7Rtp5jEz8hErB07Nia9Hs1GgYuJbkjokn4PDPmhYz8zMxAtSW02iLQGwxwSUNRiNw0axi8xQkmwWzlJNgivkdLuR9ovZAUwM0L5nZnr5/Csy0Vw7cLI7QFASWB+6+CDR0deofhscUahcvHtS+yB3PwnjyDg==

I'd like to have the same in bedrock2! I didn't try anything zip-with-index related yet, but we have a notation for separation logic equivalences, which prints (P1 * P2 * ... Pn <==> Q1 * Q2 * ... * Qn) as

[P1; P2; ... Pn]
=== seps iff ===
[Q1; Q2; ... Qn]

https://github.com/mit-plv/bedrock2/blob/ce3f6ee55351d89e0c5091a4e5af98b3ae778dae/bedrock2/src/Map/SeparationLogic.v#L218

which is probably similar to what you already have.

Another ingredient you'd need would be to print each element of a list on a new line. I haven't managed to do this within a notation for lists, but instead I had to insert a newline for each possible element of the list, see here:
https://github.com/mit-plv/riscv-coq/blob/ab9adb6ce5c104886a3a435d16b0cd78c7d1a64f/src/Utility/InstructionNotations.v

Please let us know if you make progress on this :)


On Sat, 2019-06-15 at 15:28 -0400, Joshua Gancher wrote:
Hi all,

I am mechanizing a program logic, and have an equivalence judgement (written as an Inductive) of the form Equiv xs xs', where xs and xs' are of the type list Cmd. 

My current way of displaying this goal looks something like [:: p1; p2; p3; p4] <~~> [:: p5; p6; p7] (using ssreflect's notation for lists.) I would like to instead display something like:

0 : p1;
1 : p2;
2 : p3;
4 : p4

<~~>

0 : p5;
1 : p6;
2 : p7.

Is there a simple programmatic way of doing this, akin to defining a pprint_equiv : forall xs xs', Equiv xs xs' -> string? I think I could also achieve this by zipping each list with an increasing sequence of nats, and doing something special with this list of pairs, but this seems overkill if there is a more natural solution.

Thanks,

Joshua





Archive powered by MHonArc 2.6.18.

Top of Page