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 type invariant to postcond #186

Closed
n-osborne opened this issue Nov 28, 2023 · 5 comments
Closed

Add type invariant to postcond #186

n-osborne opened this issue Nov 28, 2023 · 5 comments
Milestone

Comments

@n-osborne
Copy link
Collaborator

No description provided.

@n-osborne n-osborne added this to the 0.2 milestone Feb 6, 2024
@n-osborne
Copy link
Collaborator Author

Gospel type invariants are talking about models. As we only build the model of the type sut (and call it state), we can only check invariants on state

@jmid
Copy link
Contributor

jmid commented Feb 6, 2024

Ah, good point.
Perhaps simply asserting the invariant in run (where a sut is available) could work instead, since run is set up to handle side-effects (such as an assertion failure)? 🤔
Generally I'm thinking that we would want to check the invariant initially (where?) and for preservation across each cmd execution...

@n-osborne
Copy link
Collaborator Author

n-osborne commented Feb 6, 2024

I believe a sut is available both in precond and postcond. My point was that if the library has two types, both with gospel type invariants, there is no need to collect the invariants for the non-sut type as we don't have a model to check them against for this type. (My first though and experiment was to check invariants for all the types in the library).

Checking for preservation of invariants, I'm currently implementing checking them in the postcond function.
Regarding the initial value, as it is provided by the user in the init_sut value we can either wrap this value in a check for invariants, or assume that it is the user responsability. I think it is not costly enough to not check it.

@jmid
Copy link
Contributor

jmid commented Feb 6, 2024

I believe a sut is available both in precond and postcond.

Nope, unfortunately not: https://ocaml-multicore.github.io/multicoretests/0.3/qcheck-stm/STM/module-type-Spec/index.html

val precond : cmd -> state -> bool
val postcond : cmd -> state -> res -> bool

...but yes it seems I misunderstood you 🙂

@n-osborne
Copy link
Collaborator Author

Closed by #197

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

No branches or pull requests

2 participants