-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the notion of a DeepThunk
and generation for this
#35
base: main
Are you sure you want to change the base?
Conversation
See comments on the other PR, they also apply here |
02fbbf2
to
563190b
Compare
DeepThunk
and generation for this
6d85d1c
to
5befbab
Compare
@@ -0,0 +1,66 @@ | |||
import Qpf.Macro.Data.Replace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this maybe be a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. It seems like this functionality was just lifted from another file ("Ind.lean") and so it is a non-functional refactoring. I think it would be good to make a small pr of the form "[NFC] Chore: refactor Recursive form functionality into a separate file".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand this code at a deep level. There seem to be a lot of macros and quotations and syntaxes.
I think at a high level, this PR would be easier to understand if you split this PR up into at least three separate PRs:
- Refactor "RecursionForm" into a separate file
- Add the notion of a "DeepThunk"
- Add syntax support for Deepthunks in the quotations.
When it comes to expressing co-recursive functions, a state type is required to seed the progress. This state often also stores at what point the expression is in. This can be for a corec function on streams that repeats each element once more can have a state of a boolean and the stream that flips the boolean every other emission. This behaviour can be a bit funny to encode correctly in general corec functions so we use DeepThunk (the trace) to construct it instead. Generation of these objects takes a bit of work as seen in Ind.lean but the general categorical object resides in DeepThunk.lean.
Additionally, to this we split some files out and move some code around. This might be worth doing in a separate PR though.