Re: [isabelle] Syntax proposal: multiway if
- To: Manuel Eberl <eberlm at in.tum.de>
- Subject: Re: [isabelle] Syntax proposal: multiway if
- From: Gerwin Klein <kleing at unsw.edu.au>
- Date: Wed, 10 Feb 2021 21:37:45 +0000
- Accept-language: en-AU, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=unsw.edu.au; dmarc=pass action=none header.from=unsw.edu.au; dkim=pass header.d=unsw.edu.au; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pKAecCnjZXKkUEMMgnthZlVEmfMeFpyE1/95D7X/RzE=; b=OMI8frDcvZ8Ydt6fqo0umxHjzvU9L0F6TOlKUnXcDBc99HJHK6PM/c0N3/6ACl8Ql9R7mQIRvSBDCxb9VQWqH9fPKIiCkw0MkKnS7KPu0o+Ztgzh0riGXCQnbd1MZqdCS+4Nsqngb9GgWVdeheSzyPOObxGO9hDSp3S7+qk5U8PI7pA+tYxvTxw2KGHnbdHSCOrdjdKzJ3sSV+l02hHINit6zpsVYvvumfglWf+i9mSKskTuamBBJUEotaGCFRrMlhEEbYDJK76yU5FcE3wVoCcRHHiaWZZo8gmtGz0364Ik6N6MIpbyoq406D79vDvdL9/GnsdA9/TT8vmL+skHqA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gV00Qmy+u/uhoOdD9vp80e26h5s+ZZZyr0yphBGRuegXLdeM+wak1YJ+mZWlUYvB13moyQ52s5n/1W9oRHvwBjNsIcnGMHJ3WW6Iu8282wKG7lSZopYeiJ/rjrYfn79KVeyboqWwBwEx6u+9oksvvnQmMJ12t4dbL3M17rcT36r3+yWD45Ew/oQ3QrfZw/JtHaZw53gNjtsL9lJtEZgo6UmpBxZvhNCdyjnNAzPiZ7rlD1cdVQrs2jA3YSIw3tCUiFPSuru5MjLduQP4Z7w21iIxCMT237bp+xdvZ4xplAAX3pIrpSuEV0/DUIwSKD3sVVQmMQRmOLH2oae59J9FeQ==
- Authentication-results: in.tum.de; dkim=none (message not signed) header.d=none; in.tum.de; dmarc=none action=none header.from=unsw.edu.au;
- Cc: isabelle-users <cl-isabelle-users at lists.cam.ac.uk>
- In-reply-to: <672813a9-4803-ea12-5804-72e9a71d6410@in.tum.de>
- Ironport-phdr: 9a23:cslCxhSznIIRifKJJ9hG2jTyc9psv++ubAcI9poqja5Pea2//pPkeVbS/uhpkESQBNuJ6vQCl/fT9aztCiQM4peE5XYFdpEEFxoIkt4fkAFoBsmZQVb6I/jnY21ffoxCWVZp8mv9PR1TH8DzNFzU5GGv6HgeF0a3OQ98PO+gHInUgoy+3Pyz/JuGZQJOiXK9bLp+IQ/wox/Ws5wLh5B9bKs9113AvyhF
- Ironport-sdr: Z50Atu1tpj//Ff7R0ZJIM7ID8fR6h55RRJ1J6pNWY80ydn5tCw9m3mt+Q6+yp3nEzBZUyucmdA Wja2nSHC6K1X+PDg9YxL+Dci4yK1txDgrJ1PIVHweBroEFMZou4CRoaUQYOSgNVQzuEX9ybzWT IGLKITH0lkZankGjLSKdYvvr0v6mfbumrhX+LRDdX/mpHLfsdvR/WNXqBLhqtc6d4TnbMeq/23 g5K0ooKFXJAz/cvMvGIQVVDAhJqQs9FJbwvr+fPVffSQjzX1K04XfjzZOYwUVMhmpOPc+e4ecT l8g=
- References: <4d2a929d-4ddb-2b7e-0de5-a243f61e241a@in.tum.de> <d2741e26-c649-6691-9e91-e1d5b1eb89f0@gmail.com> <672813a9-4803-ea12-5804-72e9a71d6410@in.tum.de>
- Thread-index: AQHW/771AkwKlmTF3UCFVkwrZzl8ZKpRviSAgAABFICAACs5gA==
- Thread-topic: [isabelle] Syntax proposal: multiway if
I'd be against introducing another If definition. There is a lot of automation that interacts with "If", and if you maintain your own automation, you'd now have to do two sets.
Not opposed to the notation, though. If we can figure out a way to not fire for single "if P => x | otherwise => y" case that could be quite nice. It could be part of the standard If as input, and as a bundle for output.
Cheers,
Gerwin
> On 11 Feb 2021, at 06:03, Manuel Eberl <eberlm at in.tum.de> wrote:
>
> One could of course do that. I'm not really sure it's better. I think I
> would prefer having it just as notation. But I'm not opposed to it either.
>
> Manuel
>
>
> On 10/02/2021 19:59, Christian Sternagel wrote:
>> On 2/10/21 4:07 PM, Manuel Eberl wrote:
>>> Hello,
>>>
>>> there is a Haskell extension that allows writing nested ifs in the
>>> following nice syntax:
>>>
>>> if | P -> a
>>> | Q -> b
>>> | R -> c
>>> | otherwise -> d
>>>
>>> I asked around and some people (e.g. Tobias Nipkow) agree that this
>>> might be nice to have. My proposed syntax is inspired by the "case"
>>> syntax and looks like this:
>>>
>>> if P ⇒ x | Q ⇒ y | R ⇒ z | otherwise ⇒ u
>>>
>>> One could also do
>>>
>>> if P ⇒ x | Q ⇒ y | R ⇒ z | _ ⇒ u
>>>
>>> instead.
>>>
>>> I attached a small theory that implements this.
>>>
>>> Not sure if this should be enabled for output by default as well –
>>> probably not. One could switch it on only in a special "multi_if" print
>>> mode, similarly to "do_notation" for monad syntax.
>>>
>>> The current implementation has the problem that "if b then x else y"
>>> gets output as "if b ⇒ x | otherwise ⇒ y", which we clearly don't want.
>>> Not sure how to fix that.
>>
>> Dear Manuel,
>>
>> Naive question: What if you would use your own dedicated constant
>>
>> definition "multi_if == If"
>>
>> together with some suitable simplification rules and/or other automation?
>>
>> Then users could decide on their own which syntax to use (for input and
>> output).
>>
>> cheers
>>
>> chris
>>
>>>
>>> Manuel
>>>
>>
>
Attachment:
signature.asc
Description: Message signed with OpenPGP
This archive was generated by a fusion of
Pipermail (Mailman edition) and
MHonArc.