<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Nov 20, 2014 at 5:33 AM, Gabriel Scherer <span dir="ltr"><<a href="mailto:gabriel.scherer@gmail.com" target="_blank">gabriel.scherer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I see that you end your post suggesting that Youtube may be a better<br>
distribution channel for your content. I beg to differ.</blockquote><div><br></div><div>Interesting. I actually have made a video, but I am not confident enough in my presentation skills to recommend it :). On the whole though, I tend to prefer videos. I think I'll try to use the blog posts as draft scripts for the videos.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I like the post format, but if I was to point out a weak point, it is<br>
the use of screenshot. They take time for your to prepare, and they<br>
have lesser accessibility (for blind people for example) than text<br>
format (or even HTML). It would be nice to have a<br>
"this-Agda-state-to-HTML" command (that would also take into account<br>
the *Error* and other message buffers), or maybe even a way to<br>
interactively replay a proof (including errors) in a browser. The Coq<br>
community has developed a tool in that direction, Proviola :<br>
<a href="http://mws.cs.ru.nl/proviola/" target="_blank">http://mws.cs.ru.nl/proviola/</a><br></blockquote><div><br></div><div>They're not actually so bad - Alt+PrtSc is all it takes, followed by an upload. I would *love* to use a tool like you're describing, but I'm not really in a position to implement something like that myself right now. As for accessibility - well, I doubt I will reach a wide enough audience for that to matter xD<br><br></div><div>Thanks for the feedback. (I hope that this type of discussion isn't too off-topic for the mailing list...?)<br></div><div><br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
On Thu, Nov 20, 2014 at 12:52 AM, Christopher Jenkins<br>
<<a href="mailto:cjenkin1@trinity.edu">cjenkin1@trinity.edu</a>> wrote:<br>
> All,<br>
><br>
> The blog post I promised:<br>
> <a href="http://serendependy.blogspot.com/2014/11/with-great-power-great-intractibility.html" target="_blank">http://serendependy.blogspot.com/2014/11/with-great-power-great-intractibility.html</a><br>
><br>
> Feel free to add comments or suggestions on the blog itself or here.<br>
><br>
> On Thu, Nov 6, 2014 at 3:39 PM, Andreas Abel <<a href="mailto:andreas.abel@ifi.lmu.de">andreas.abel@ifi.lmu.de</a>><br>
> wrote:<br>
>><br>
>> Note that I am in the process of outlawing `with` on variables bound by<br>
>> module telescopes (because of the issue 1342 that came up during this<br>
>> discussion).<br>
>><br>
>> Cheers,<br>
>> Andreas<br>
>><br>
>> On 05.11.2014 23:53, Christopher Jenkins wrote:<br>
>>><br>
>>> Alright, two people is enough to motivate me. I will try to have a first<br>
>>> blog post out this weekend, mostly dealing with pattern-matching after a<br>
>>> rewrite and the basic concept of `with', with more to follow.<br>
>>><br>
>>> On Wed, Nov 5, 2014 at 2:21 AM, Arseniy Alekseyev<br>
>>> <<a href="mailto:arseniy.alekseyev@gmail.com">arseniy.alekseyev@gmail.com</a> <mailto:<a href="mailto:arseniy.alekseyev@gmail.com">arseniy.alekseyev@gmail.com</a>>> wrote:<br>
>>><br>
>>> Oh wow, I should have tried that. I don't understand why this works<br>
>>> at<br>
>>> all. Note that none of these compile for me:<br>
>>><br>
>>> y | true = id {A = (q : Bool) → x ≡ z q} (λ { true → refl ;<br>
>>> false<br>
>>> → refl }) -- x != true of type Bool<br>
>>><br>
>>> y | true = id {A = (q : Bool) → true ≡ z q} (λ { true → refl ;<br>
>>> false → refl }) -- true != x of type Bool<br>
>>><br>
>>> However, even more confusingly, this one does work:<br>
>>><br>
>>> y | true = id {A = _} (λ { true → refl ; false → refl })<br>
>>><br>
>>> So what's the value of underscore it infers then?<br>
>>> Can anybody explain what's going on?<br>
>>><br>
>>> As for the code smell part, I think you can only smell it on toy<br>
>>> examples, not on the "real" ones.<br>
>>><br>
>>> On 5 November 2014 01:28, Christopher Jenkins <<a href="mailto:cjenkin1@trinity.edu">cjenkin1@trinity.edu</a><br>
>>> <mailto:<a href="mailto:cjenkin1@trinity.edu">cjenkin1@trinity.edu</a>>> wrote:<br>
>>> ><br>
>>> ><br>
>>> > On Tue, Nov 4, 2014 at 5:18 PM, Arseniy Alekseyev<br>
>>> > <<a href="mailto:arseniy.alekseyev@gmail.com">arseniy.alekseyev@gmail.com</a><br>
>>> <mailto:<a href="mailto:arseniy.alekseyev@gmail.com">arseniy.alekseyev@gmail.com</a>>> wrote:<br>
>>> >><br>
>>> >> That was not a genuine attempt to prove `y : ∀ q → x ≡ z q`.<br>
>>> Instead<br>
>>> >> that was an example of `with` rewriting the goal from (as you<br>
>>> >> demonstrated!) provable one into (as I assert) non-provable one.<br>
>>> I<br>
>>> >> think that's the property of `with` that's causing you grief<br>
>>> when you<br>
>>> >> re-order or nest them in a bad way.<br>
>>> >><br>
>>> > Ah, makes sense. Though of course you could probably continue on<br>
>>> to prove<br>
>>> > the goal by pattern-matching on a lambda argument introduced in<br>
>>> both cases,<br>
>>> > but by that point hopefully someone would see the code smell.<br>
>>> ><br>
>>> > Actually, decided to include it anyway, so you could smell the<br>
>>> smelly code<br>
>>> > smell:<br>
>>> ><br>
>>> > y : ∀ q → x ≡ z q<br>
>>> > y with x<br>
>>> > y | true = λ { true → refl ; false → refl }<br>
>>> > y | false = λ { true → refl ; false → refl }<br>
>>> ><br>
>>> >><br>
>>> >> On 4 November 2014 22:43, Christopher Jenkins<br>
>>> <<a href="mailto:cjenkin1@trinity.edu">cjenkin1@trinity.edu</a> <mailto:<a href="mailto:cjenkin1@trinity.edu">cjenkin1@trinity.edu</a>>><br>
>>> >> wrote:<br>
>>> >> ><br>
>>> >> ><br>
>>> >> > On Mon, Nov 3, 2014 at 2:38 PM, Arseniy Alekseyev<br>
>>> >> > <<a href="mailto:arseniy.alekseyev@gmail.com">arseniy.alekseyev@gmail.com</a><br>
>>> <mailto:<a href="mailto:arseniy.alekseyev@gmail.com">arseniy.alekseyev@gmail.com</a>>> wrote:<br>
>>> >> >><br>
>>> >> >> You are right, there is not much point. I was trying to point<br>
>>> out that<br>
>>> >> >> it's the "proper expression" part that makes `with`<br>
>>> complicated.<br>
>>> >> >><br>
>>> >> >> Unfortunately, that's not even true. In the following<br>
>>> example, I don't<br>
>>> >> >> think you can fill the holes.<br>
>>> >> >><br>
>>> >> >> f : Bool → Bool<br>
>>> >> >> f x = true where<br>
>>> >> >><br>
>>> >> >> z : Bool → Bool<br>
>>> >> >> z true = x<br>
>>> >> >> z false = x<br>
>>> >> >><br>
>>> >> >> y : ∀ q → x ≡ z q<br>
>>> >> >> y with x<br>
>>> >> >> y | true = {!!}<br>
>>> >> >> y | false = {!!}<br>
>>> >> >><br>
>>> >> >><br>
>>> >> ><br>
>>> >> > I'm not entirely sure why you would expect that approach to be<br>
>>> fruitful.<br>
>>> >> > Essentially, what you're trying to do is unwind the<br>
>>> computational nature<br>
>>> >> > of<br>
>>> >> > `z', which is defined by case analysis on its argument (in<br>
>>> this case q).<br>
>>> >> > To<br>
>>> >> > trigger the rules, you would have to bring q into scope and<br>
>>> inspect q,<br>
>>> >> > which<br>
>>> >> > would then lead to `z true' and `z false' in the equations,<br>
>>> >> > respectively,<br>
>>> >> > and Agda will then go on to normalize the goals as `x \== x'<br>
>>> >> ><br>
>>> >> > f : Bool → Bool<br>
>>> >> > f x = true where<br>
>>> >> > z : Bool → Bool<br>
>>> >> > z true = x<br>
>>> >> > z false = x<br>
>>> >> ><br>
>>> >> > y : ∀ q → x ≡ z q<br>
>>> >> > y true = {!!} -- Goal: x ≡ x<br>
>>> >> > y false = {!!} -- Goal: x ≡ x<br>
>>> >> ><br>
>>> >> > I have actually been thinking about writing a blog post<br>
>>> targeted at<br>
>>> >> > newbies<br>
>>> >> > (such as myself) on the sometimes unintuitive behaviour of<br>
>>> `with' (and<br>
>>> >> > in<br>
>>> >> > particular, `rewrite'). Should anyone be interested I can send<br>
>>> a link on<br>
>>> >> > this email chain once I have written it.<br>
>>> >> ><br>
>>> >> ><br>
>>> >> >><br>
>>> >> >> On 3 November 2014 10:59, Andreas Abel<br>
>>> <<a href="mailto:andreas.abel@ifi.lmu.de">andreas.abel@ifi.lmu.de</a> <mailto:<a href="mailto:andreas.abel@ifi.lmu.de">andreas.abel@ifi.lmu.de</a>>> wrote:<br>
>>> >> >> > On 03.11.2014 09:47, Arseniy Alekseyev wrote:<br>
>>> >> >> >> I think the problem goes away if you<br>
>>> >> >> >> only use `with x` where `x` is a variable.<br>
>>> >> >> ><br>
>>> >> >> > Mmh, why use `with` at all then? You could directly split<br>
>>> on the<br>
>>> >> >> > variable<br>
>>> >> >> > `x`. I thought the only reason to use `with` was when you<br>
>>> wanted to<br>
>>> >> >> > case on<br>
>>> >> >> > a proper expression and refine your type in the<br>
>>> with-branches...<br>
>>> >> >> ><br>
>>> >> >> ><br>
>>> >> >> ><br>
>>> >> >> > On 03.11.2014 09:47, Arseniy Alekseyev wrote:<br>
>>> >> >> >><br>
>>> >> >> >> Indeed that's the usual Agda behaviour.<br>
>>> >> >> >> Here the reason seems to be an additional occurrence of<br>
>>> `lookup k<br>
>>> >> >> >> ps`<br>
>>> >> >> >> in the context produced by pattern-match on `no`.<br>
>>> >> >> >> You see, `with expr` only rewrites the occurrences of<br>
>>> `expr` present<br>
>>> >> >> >> in the enclosing context, so the new occurrences inside<br>
>>> the body of<br>
>>> >> >> >> `with` don't get rewritten (and you do want it rewritten<br>
>>> in this<br>
>>> >> >> >> case).<br>
>>> >> >> >><br>
>>> >> >> >> I do agree this is confusing. I think the problem goes<br>
>>> away if you<br>
>>> >> >> >> only use `with x` where `x` is a variable. That makes<br>
>>> `with` much<br>
>>> >> >> >> less<br>
>>> >> >> >> useful though. You can also avoid `with` altogether and<br>
>>> write the<br>
>>> >> >> >> helper functions by hand (that's what `with` is doing<br>
>>> after all!).<br>
>>> >> >> >><br>
>>> >> >> >> On 2 November 2014 17:14, <<a href="mailto:mechvel@scico.botik.ru">mechvel@scico.botik.ru</a><br>
>>> <mailto:<a href="mailto:mechvel@scico.botik.ru">mechvel@scico.botik.ru</a>>> wrote:<br>
>>> >> >> >>><br>
>>> >> >> >>> People,<br>
>>> >> >> >>><br>
>>> >> >> >>> Having the proof<br>
>>> >> >> >>><br>
>>> >> >> >>> prove : (k∈ks : k ∈ ks) → proj₂ (lookupIf∈ k (p ∷ ps)<br>
>>> k∈k':ks) ≡<br>
>>> >> >> >>> proj₂ (lookupIf∈ k ps k∈ks)<br>
>>> >> >> >>> prove k∈ks with k ≟ k'<br>
>>> >> >> >>> --<br>
>>> >> >> >>> (I)<br>
>>> >> >> >>><br>
>>> >> >> >>> ... | yes k≡k' = ⊥-elim $ k≉k' k≡k'<br>
>>> >> >> >>> ... | no _ with lookup k ps<br>
>>> >> >> >>> ... | inj₁ _ = PE.refl<br>
>>> >> >> >>> ... | inj₂ k∉ks = ⊥-elim $ k∉ks k∈ks<br>
>>> >> >> >>><br>
>>> >> >> >>><br>
>>> >> >> >>> (I do not give the complete code),<br>
>>> >> >> >>><br>
>>> >> >> >>> I try to rewrite it in a bit simpler way by joining it<br>
>>> into one<br>
>>> >> >> >>> `with'<br>
>>> >> >> >>> clause:<br>
>>> >> >> >>><br>
>>> >> >> >>><br>
>>> >> >> >>> prove k∈ks with k ≟ k' | lookup k ps<br>
>>> >> >> >>> --<br>
>>> >> >> >>> (II)<br>
>>> >> >> >>><br>
>>> >> >> >>> ... | yes k≡k' | _ = ⊥-elim $ k≉k' k≡k'<br>
>>> >> >> >>> ... | no _ | inj₁ _ = PE.refl<br>
>>> >> >> >>> ... | no _ | inj₂ k∉ks = ⊥-elim $ k∉ks k∈ks<br>
>>> >> >> >>><br>
>>> >> >> >>><br>
>>> >> >> >>> (I) is type-checked, and (II) is not.<br>
>>> >> >> >>><br>
>>> >> >> >>> Is this natural for Agda to decide so?<br>
>>> >> >> >>><br>
>>> >> >> >>> (I have spent 4 hours trying to prove a similar real and<br>
>>> evident<br>
>>> >> >> >>> example.<br>
>>> >> >> >>> Then tried to split `with' into two, and this has<br>
>>> succeeded).<br>
>>> >> >> >>><br>
>>> >> >> >>> Thanks,<br>
>>> >> >> >>><br>
>>> >> >> >>> ------<br>
>>> >> >> >>> Sergei<br>
>>> >> >> >>> _______________________________________________<br>
>>> >> >> >>> Agda mailing list<br>
>>> >> >> >>> <a href="mailto:Agda@lists.chalmers.se">Agda@lists.chalmers.se</a> <mailto:<a href="mailto:Agda@lists.chalmers.se">Agda@lists.chalmers.se</a>><br>
>>> >> >> >>> <a href="https://lists.chalmers.se/mailman/listinfo/agda" target="_blank">https://lists.chalmers.se/mailman/listinfo/agda</a><br>
>>> >> >> >><br>
>>> >> >> >> _______________________________________________<br>
>>> >> >> >> Agda mailing list<br>
>>> >> >> >> <a href="mailto:Agda@lists.chalmers.se">Agda@lists.chalmers.se</a> <mailto:<a href="mailto:Agda@lists.chalmers.se">Agda@lists.chalmers.se</a>><br>
>>> >> >> >> <a href="https://lists.chalmers.se/mailman/listinfo/agda" target="_blank">https://lists.chalmers.se/mailman/listinfo/agda</a><br>
>>> >> >> >><br>
>>> >> >> ><br>
>>> >> >> ><br>
>>> >> >> > --<br>
>>> >> >> > Andreas Abel <>< Du bist der geliebte Mensch.<br>
>>> >> >> ><br>
>>> >> >> > Department of Computer Science and Engineering<br>
>>> >> >> > Chalmers and Gothenburg University, Sweden<br>
>>> >> >> ><br>
>>> >> >> > <a href="mailto:andreas.abel@gu.se">andreas.abel@gu.se</a> <mailto:<a href="mailto:andreas.abel@gu.se">andreas.abel@gu.se</a>><br>
>>> >> >> > <a href="http://www2.tcs.ifi.lmu.de/~abel/" target="_blank">http://www2.tcs.ifi.lmu.de/~abel/</a><br>
>>> >> >> _______________________________________________<br>
>>> >> >> Agda mailing list<br>
>>> >> >> <a href="mailto:Agda@lists.chalmers.se">Agda@lists.chalmers.se</a> <mailto:<a href="mailto:Agda@lists.chalmers.se">Agda@lists.chalmers.se</a>><br>
>>> >> >> <a href="https://lists.chalmers.se/mailman/listinfo/agda" target="_blank">https://lists.chalmers.se/mailman/listinfo/agda</a><br>
>>> >> ><br>
>>> >> ><br>
>>> >> ><br>
>>> >> ><br>
>>> >> > --<br>
>>> >> > Christopher Jenkins<br>
>>> >> > Computer Science 2013<br>
>>> >> > Trinity University<br>
>>> ><br>
>>> ><br>
>>> ><br>
>>> ><br>
>>> > --<br>
>>> > Christopher Jenkins<br>
>>> > Computer Science 2013<br>
>>> > Trinity University<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Christopher Jenkins<br>
>>> Computer Science 2013<br>
>>> Trinity University<br>
>><br>
>><br>
>><br>
>> --<br>
>> Andreas Abel <>< Du bist der geliebte Mensch.<br>
>><br>
>> Department of Computer Science and Engineering<br>
>> Chalmers and Gothenburg University, Sweden<br>
>><br>
>> <a href="mailto:andreas.abel@gu.se">andreas.abel@gu.se</a><br>
>> <a href="http://www2.tcs.ifi.lmu.de/~abel/" target="_blank">http://www2.tcs.ifi.lmu.de/~abel/</a><br>
><br>
><br>
><br>
><br>
> --<br>
> Christopher Jenkins<br>
> Computer Science 2013<br>
> Trinity University<br>
><br>
> _______________________________________________<br>
> Agda mailing list<br>
> <a href="mailto:Agda@lists.chalmers.se">Agda@lists.chalmers.se</a><br>
</div></div>> <a href="https://lists.chalmers.se/mailman/listinfo/agda" target="_blank">https://lists.chalmers.se/mailman/listinfo/agda</a><br>
><br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Christopher Jenkins<br>Computer Science 2013<br>Trinity University</div></div></div>
</div></div>