<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">what Thorsten reported is clearly a bug.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I have the feeling it has a lot to do with the with construct.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">My definition of + is as follows, using a for me more intuitive notation (I borrowed some of the musical notation;</p>
<p style="margin-top:0;margin-bottom:0">at the end of my paper with Ulrich Berger on undecidability of codata types I discuss how the musical notation can be regarded with minor modifications as a nice abbreviation mechanism - the following definition would
with such a mechanism only consist of the definition of <span>coℕ</span> and <span>
+∞</span>)</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div> record coℕ∞ : Set where<br>
coinductive<br>
field<br>
♭ : coℕ<br>
<br>
<br>
data coℕ : Set where<br>
zero : coℕ<br>
suc : coℕ∞ → coℕ</div>
<div><br>
</div>
<div>
<div> _+∞'_ : coℕ∞ → coℕ → coℕ∞<br>
♭ (m +∞' n) = ♭ m +∞ n<br>
<br>
_+∞_ : coℕ → coℕ → coℕ<br>
zero +∞ n = n<br>
suc m +∞ n = suc (m +∞' n)<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>The definition of * is not guarded recursive since in guarded recursion one cannot apply functions to the corecursive call. One can solve this by using sized types, or by unfolding the guarded recursive definition. Here one needs a function plustimes n
m k which computes n + m * k</div>
<div>Again the suggested abbreviation mechanism would avoid the need for <span>∞₁'</span> and
<br>
</div>
<div><br>
</div>
<br>
</div>
<p></p>
<p style="margin-top:0;margin-bottom:0"></p>
<div> _*∞₁'_ : coℕ∞ → coℕ → coℕ∞<br>
♭ (m *∞₁' n) = ♭ m *∞ n<br>
<br>
_*∞₁_ : coℕ → coℕ → coℕ<br>
zero *∞₁ n = zero<br>
suc m *∞₁ n = plustimes n m n<br>
<br>
<div> plustimes' : coℕ∞ → coℕ∞ → coℕ → coℕ∞<br>
♭ (plustimes' n m k) = plustimes (♭ n) m k<br>
<br>
<div> plustimes : coℕ → coℕ∞ → coℕ → coℕ<br>
plustimes zero m k = ♭ (m *∞₁' k)<br>
plustimes (suc n) m k = suc (plustimes' n m k)</div>
<br>
</div>
<br>
</div>
<br>
<p></p>
<div id="Signature">
<meta content="text/html; charset=UTF-8">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<span></span><span></span>
<div dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<span>
<div><span><span><span><span><span><br>
</span></span></span></span></span></div>
</span><span></span>Anton<br>
<span>
<div></div>
</span><span><br>
</span></div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Agda <agda-bounces@lists.chalmers.se> on behalf of Thorsten Altenkirch <Thorsten.Altenkirch@nottingham.ac.uk><br>
<b>Sent:</b> 03 March 2019 12:16:10<br>
<b>To:</b> agda@lists.chalmers.se<br>
<b>Subject:</b> [Agda] Strangeness with corecursion</font>
<div> </div>
</div>
<style>
<!--
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
{color:#0563C1;
text-decoration:underline}
a:visited, span.x_MsoHyperlinkFollowed
{color:#954F72;
text-decoration:underline}
span.x_EmailStyle17
{font-family:"Calibri",sans-serif;
color:windowtext}
.x_MsoChpDefault
{font-family:"Calibri",sans-serif}
@page WordSection1
{margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.x_WordSection1
{}
-->
</style>
<div lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="x_WordSection1">
<p class="x_MsoNormal"><span style="font-size:11.0pt">Hi,</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">I just set the exercise to define multiplication for conats for my course on type theory. So please don’t blurt put the solution – see the attached code. The following is not a solution because agda doesn’t
see that the definition is productive (even though it is):</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">prd∞ (m *∞ n) with prd∞ m </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">prd∞ (m *∞ n) | (just pm) = prd∞ (n +∞ (pm *∞ n))</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">prd∞ (m *∞ n) | nothing = nothing</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">but after the following change</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">prd∞ (m *∞ n) with prd∞ m
</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">prd∞ (m *∞ n) | (just pm) with (pm *∞ n)</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">prd∞ (m *∞ n) | (just pm) | x = prd∞ (n +∞ x)</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">prd∞ (m *∞ n) | nothing = nothing</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">agda seems to accept is. Actually even if +∞ is not contractive.</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">Is this a known bug? Otherwise can somebody remind e how to report this?</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">Cheers,</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">Thorsten</span></p>
</div>
<pre>
This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please contact the sender and delete the email and
attachment.
Any views or opinions expressed by the author of this email do not
necessarily reflect the views of the University of Nottingham. Email
communications with the University of Nottingham may be monitored
where permitted by law.
</pre>
</div>
</body>
</html>