Skip to content

Conversation

@ttuegel
Copy link
Contributor

@ttuegel ttuegel commented May 18, 2020

This pull request begins to fix #1545. Most of the changes in this pull request are simply consequences of the changes in Kore.Syntax.Variable, so I recommend starting there.

Summary

  • Added type Variable1 which carries a variable name and sort, representing an occurrence of a variable in a Kore pattern. Unlike Variable, this type is parameterized in the variable name type.
  • Added a VariableName type, representing the basic syntax of variable names.
  • Added ElementVariableName and SetVariableName wrappers.
  • Added SomeVariableName, which may be an ElementVariableName or a SetVariableName.
  • Added AdjSomeVariableName, which represents mappings preserving the element- or set-ness of a variable. The name of the type owes to the adjunction between SomeVariableName and AdjSomeVariableName. This is not as complicated as it sounds, but it bears close attention. Most of the changes in the pull request are related to introducing this type.
  • Added class NamedVariable for variables, representing the isomorphism between _ Variable and Variable1 _.

In the follow-up to this pull request, Variable1 _ will replace _ Variable and the NamedVariable class will be obsolete. I wanted to get this in as a separate pull request because I think adding AdjSomeVariableName is significant in its own right.


Reviewer checklist
  • Test coverage: stack test --coverage
  • Public API documentation: stack haddock

@ttuegel ttuegel force-pushed the refactor--VariableName branch from 12e78d1 to d079c24 Compare May 26, 2020 14:58
ttuegel added 13 commits May 26, 2020 10:56
The goal of refactoring is to replace type Variable and the wrappers around it
with type Variable1, and rename the latter. Note that this will make the
SortedVariable class obsolete because all variables will carry a sort field at
the top level; therefore, we will modify the SortedVariable class to carry the
intermediate definitions we need for refactoring, and remove the class in the
end.
@ttuegel ttuegel force-pushed the refactor--VariableName branch from d079c24 to 2ed1195 Compare May 26, 2020 18:50
@ttuegel ttuegel marked this pull request as ready for review May 26, 2020 19:01
@ttuegel ttuegel requested review from ana-pantilie, andreiburdusa and traiansf and removed request for traiansf May 26, 2020 19:01
:: ElementVariable variable1
-> Identity (ElementVariable variable2)
trElemVar = sequenceA . (<*>) (elemVar adj')
trSetVar = sequenceA . (<*>) (setVar adj')
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you write the signature for trElemVar but not for trSetVar?

Just (SetVar setVar') -> setVar'
_ -> setVar
subst = TermLike.mkVar <$> rename
let rename =
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't help notice that the complexity of the code has grown by a non-trivial margin. From 10 lines with easy-to-read-and-write code, we got to more than 30 of code with lenses

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's unfortunate, but temporary: the lenses are a consequence of switching between representations of variables, and after I finish the next part of the changes, then all the lenses go away.

@ttuegel ttuegel merged commit b7faace into runtimeverification:master May 28, 2020
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.

Respect the identity of variables

4 participants