Skip to content
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 simple pruning and folding abilities to LMC tools #43

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

ehildenb
Copy link
Owner

@ehildenb ehildenb commented Feb 9, 2019

No description provided.

Copy link
Collaborator

@sskeirik sskeirik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a huge improvement in readability over the previous version! The commits were tight and easy to review. Thanks for your patience in me getting to this.

Really, the only thing that bothered me besides the other comment I gave is that some operations in your spec are partial, e.g.

  • intersect fails to be defined when passed two NodeIds where both have the form: N or N[F]
  • nodes and frontier defined over FoldedLabelGraph? fail to be defined when they are applied to a FoldedLabelGraph which is a subtype of FoldedLabelGraph?

I prefer functions to be total unless otherwise specified, so I would like to see that changed or at least marked partial.

However, ultimately, my issues are matters of taste rather than correctness, so I'll mark this approved and leave it up to you.

op _[_] : Nat Fold -> NodeId [right id: .Fold prec 20] .
--------------------------------------------------------
A `NodeMap` is a lookup table of `Nat |-> Node`, which supports a lookup `_[_]` and `insert` operation.
The insert operation is aware of the user defined `Fold`s, and will not create new entries for new nodes that are less general than existing ones.

Copy link
Collaborator

@sskeirik sskeirik Feb 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the NodeMap? data structure name somewhat misleading. As far as I can tell, a NodeMap? always corresponds to a NodeMap --- in my mind, adding a question mark to the end sort of connotes a partial operation; AFAICT insert which returns one, is not partial.

I know you prefer compact names, so if a more descriptive name is out of the question, I think it would be worth it to just note that this data structure is just an intermediate used to track when fresh nodes have been added to a NodeMap. Also, AFACIT, the NodeSet argument in NodeMap? is always either a singleton Node or .NodeSet. If that is true, I think that would be nice to note as well.

It seems that, at least here, the question mark denotes that essentially the same type but with extra metadata attached to it; FoldedLabeledGraph? seems to use a similar naming convention, though I don't mind as much in that case since I think that may actually not always reduce into a FoldedLabeledGraph, i.e. in case stepping over the frontier fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants