-
Notifications
You must be signed in to change notification settings - Fork 0
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
Bug fix: handle graphs with cycles #3
Comments
Done in: The fix consists of traversing the diagram keeping track of the nodes already visited. This means we need state so I introduced a State monad. I had never used this monad before so I had to learn that. Moreover, everything has to happen within (or in conjunction with a monad that represents the failure of the conversion from diagram to AST (which has been represented by a The first attempt uses manual manipulation of state:
Then I introduce the State monad containing a
After I go through a series of refactorings gradually introducing the appropriate State manipulation functions (get, put, modify, withState). Finally, I merged State and
That allowed for the removal of a layer of monad manipulation and, after a couple of rewrites, the structure became more clear... it is essentially the same code as before! That is a pattern matching on the structure of the diagram, followed by the construction of the corresponding AST nodes through a monad (before Other variations of the implementation were considered:
An important point is that the commutation proof of the bisimulation relays on the argument that:
But I'm not sure how to prove that with the Issue: Tests graphs that are not only generated from ASTs (#4) |
The function to turn diagrams into ASTs is incorrect! It is not handling cycles appropriately so if the graph has cycles the function does not terminate. The issue wasn't detected because only diagrams constructed from ASTs were being tested.
The text was updated successfully, but these errors were encountered: