RedPRL / cooltt

😎TT
http://www.redprl.org/
Apache License 2.0
217 stars 16 forks source link

🪟 Translucency: semi-abstract definitions and unfolding via extension types #373

Closed jonsterling closed 2 years ago

jonsterling commented 2 years ago

OK, I'm running out of steam today but let me record what I need to do:

jonsterling commented 2 years ago

So let me summarize the state of things here. This is a proof of concept PR for a research paper, and I am not requesting that it be merged at this time unless substantial improvements are made. But it is already really cool and suffices to test out the research ideas 😎

What would need to be done for this to be mergeable / usable is:

jonsterling commented 2 years ago

The main usability problems with this PR have been addressed and now I think it constitutes a strict improvement on what is in main. Therefore I think it is possible to merge this PR, pending review and whatever changes are suggested.

favonia commented 2 years ago

Following the comments above, if we wish to have keep the current generality, I think we could maybe make the type of unfolder being a list or something. The semantics of [d1; d2; d3] would be meet [eq1 d1; eq1 d2; eq3], and maybe it would be interesting for a top-level def to share the unfolder of another top-level def?

Maybe this is already something easily doable in the current framework.

EDIT: Add the second paragraph.

jonsterling commented 2 years ago

Following the comments above, if we wish to have keep the current generality, I think we could maybe make the type of unfolder being a list or something. The semantics of [d1; d2; d3] would be meet [eq1 d1; eq1 d2; eq3], and maybe it would be interesting for a top-level def to share the unfolder of another top-level def?

Maybe this is already something easily doable in the current framework.

EDIT: Add the second paragraph.

In principle this is possible, but I don't see a compelling use case for it right now... Do you?

favonia commented 2 years ago

In principle this is possible, but I don't see a compelling use case for it right now... Do you?

What could be interesting is to 100% recreate the abstract block in Agda, which is essentially prefixing everything with the same unfolder.

jonsterling commented 2 years ago

@favonia that's a cool idea.

jonsterling commented 2 years ago

In principle this is possible, but I don't see a compelling use case for it right now... Do you?

What could be interesting is to 100% recreate the abstract block in Agda, which is essentially prefixing everything with the same unfolder.

Hmm @favonia I think that prefixing a bunch of definitions under the same unfolder is not a use-case for the generality you are proposing; it in particular does not need a single global to have multiple unfolders.

favonia commented 2 years ago

Hmm @favonia I think that prefixing a bunch of definitions under the same unfolder is not a use-case for the generality you are proposing; it in particular does not need a single global to have multiple unfolders.

That's correct, but this would justify the current (unnecessary imo) generality. The list thing is for composable and resumable abstract regions/blocks.

jonsterling commented 2 years ago

@favonia If you feel the current generality is unnecessary, please feel free to fix the #376 PR where I tried to implement your proposed downgrade ;-) I got stuck and I couldn't figure out what happened, but maybe your knowledge of the units mechanism will help you make progress where I failed.

favonia commented 2 years ago

@favonia If you feel the current generality is unnecessary, please feel free to fix the #376 PR where I tried to implement your proposed downgrade ;-) I got stuck and I couldn't figure out what happened, but maybe your knowledge of the units mechanism will help you make progress where I failed.

BTW the #376 is a bit different from what I imagined, and I realized the unleash_top_level could not be structured in a way I wanted it to be anyways, so maybe we should just give up #376. :laughing: