-
Notifications
You must be signed in to change notification settings - Fork 151
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
Generate structure
-s for non-leaf cells
#4731
Open
tothtamas28
wants to merge
6
commits into
develop
Choose a base branch
from
cell-structure
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4a565cd
Extract cell type generation into a separate step
tothtamas28 33702a7
Extract function `_param_sorts`
tothtamas28 f9c1621
Sort cell type definitions topologically
tothtamas28 314d400
Add custom generator logic for cell sort
tothtamas28 27023c5
Generate a `structure` even for leaf cells
tothtamas28 147e15d
Revert "Generate a `structure` even for leaf cells"
tothtamas28 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There's some room for simplification here, we could just generate a
def
or anabbrev
. I.e. instead ofjust generate
abbrev SortGasCell : Type := SortGas
or even inline the definition.
The same can be done for sorts with a single subsort:
becomes
abbrev SortGas : Type := SortInt
The challenge is ordering declarations in a way that Lean does not complain about undefined types.
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.
What is the disadvantage of also using
structure
s for leaf cells? Makinginto
My intuition is that if some cells have different kinds of definitions, that can make it more difficult to deal with in general. Whereas if everything is a
structure
, you know you'll always be able to access cell contents in the same way ((sg : SortGasCell).val
for instance)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.
Good point, the generated projection is probably very useful in this case. I'll change it to a
structure
.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.
Done.
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.
Actually, now the program does not type check due to circular dependencies between definitions. I'll investigate further, but I might have to the this last commit.
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.
Reverting, opened an issue:
structure
-s for leaf cells #4732There 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've rearranged the definitions with the SCCs as
structure
s in a way that Lean type checks. It's mainly definingabbrevs
as soon as they can be defined and swaping the order that some definitions were defined.This type checks, but we still need a
mutual
definition to avoid spuriousProp
variables in definitions. However, I think this means that we can safely add back thestructure
s for SCC and then use them inmutual
definitions like:Rearranged definition