[Agda] How can I implement naive sized lambdas?
Tom Jack
tom at tomjack.co
Wed Mar 25 05:32:30 CET 2020
This article by Rob Simmons might be relevant to you:
https://requestforlogic.blogspot.com/2010/11/totally-nameless-representation.html
It shows one way to handle the "sizes" manually (without sized types.) See
the section "Setting up a metric." The metric is nicer to work with than
Nat.
On Tue, Mar 24, 2020 at 5:28 PM Georgi Lyubenov <godzbanebane at gmail.com>
wrote:
> Hello!
>
> Sorry if this isn't the right place to ask a question like this!
>
> I want to express named lambda terms in Agda. By doing so in the most
> "naive" way possible, I encounter a termination issue when implementing
> substitution - when I want to rename a variable to avoid accidental
> variable capture, the termination checker is unhappy - I'm trying to do a
> recursive call (recursive calling substitution) on the result of a function
> (renaming). My first thought is to attach sizes (via either Nats or the
> builtin Size type), and show that renaming doesn't "change size". After a
> bit of struggling I couldn't manage to do so, and am writing to ask for a
> hint or some advice.
>
> This is my initial attempt:
>
> data : Size -> Set where
> v : {i : Size} -> (n : Nat) -> Lambda i
> _app_ : {i j : Size} -> Lambda i -> Lambda j -> Lambda (sizeSuc (sizeMax
> i j))
> lam_>_ : {i : Size} -> Nat -> Lambda i -> Lambda (sizeSuc i)
>
> but with this I can't even implement something like
>
> promo : {i j : Size} -> Lambda i -> Lambda (sizeMax i j)
>
> Furthermore I have no idea what return type to even give to substitution!
>
> I am pretty sure I am missing something very fundamental about sizes and
> how to use them, but I couldn't find materials to answer my question.
>
> Thanks in advance!
>
> =======
> Georgi
> _______________________________________________
> Agda mailing list
> Agda at lists.chalmers.se
> https://lists.chalmers.se/mailman/listinfo/agda
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.chalmers.se/pipermail/agda/attachments/20200324/3e33be36/attachment.html>
More information about the Agda
mailing list