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

Generated Code Conformance Checking #137

Open
fhackett opened this issue Jun 12, 2021 · 3 comments
Open

Generated Code Conformance Checking #137

fhackett opened this issue Jun 12, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@fhackett
Copy link
Contributor

Related to #122, this is an idea about how to verify that PGo-generated code actually does what the model says it does.

Key idea: encoded into an MPCal model, there exists a mapping from reads/writes involving archetype resources to a form of model state. This mapping is either an identity mapping, or it is one of the mapping macro forms.

Therefore, TLC model state can be (almost) deterministically reconstructed from an ordered log of the archetype resource reads and writes performed by every critical section involved in a system's operation. PGo-generated code can be instrumented to generate such information automatically, and it seems plausible that a close-to-automatic process could then convert this information to a graph of TLC states, at which point conformance checking against the original MPCal model might be performed.

Success of such a check on a collection of real execution traces would go a long way toward indicating that an implementation really does match a specification, and, with the right API, this use case might not be limited to systems generated by PGo.

Additional comments:

  • If we're comparing against an MPCal model, conformance could either relate to the model properties still holding, or, more basically, to the trace matching some valid exploration of model state. The latter might be easier to perform automatically, as it would not rely on specific assumptions that property formulations might make about how the model is laid out for TLC (node counts, etc).
  • It's worth noting that, if the ongoing rewrite works out as hoped, TLC might not be the only way to perform checking. A lightweight ad-hoc program (combined with an AST interpreter for value-level TLA+) might be sufficient, if the goal is just to check that a partially ordered sequence of critical sections (including fully modeled state variables) is a plausible execution of a given model.
@fhackett fhackett added the enhancement New feature or request label Jun 12, 2021
@lemmy
Copy link

lemmy commented Jun 12, 2021

Note that related to the last item, TLC has a simulator/generator mode.

@bestchai
Copy link
Contributor

@lemmy, thanks for the quick comment. Is it possible to influence/direct TLC during simulator mode -- i.e., to push it along a concrete path that we are checking?

@lemmy
Copy link

lemmy commented Jun 12, 2021

@bestchai The simulator honors state and action constraints. https://github.com/lemmy/PageQueue/blob/master/Schedules.tla is an example of how to make TLC follow a specific schedule.

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

No branches or pull requests

3 participants