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

Liquid types in Ada and SPARK... #1

Open
rod-chapman opened this issue Aug 3, 2021 · 3 comments
Open

Liquid types in Ada and SPARK... #1

rod-chapman opened this issue Aug 3, 2021 · 3 comments

Comments

@rod-chapman
Copy link

A possibly useful source of reference and background info for you: a very similar facility (called "dynamic subtype predicate") has existed in Ada since the 2012 revision of the language. It is fully implemented in GCC. Support for static verification (also using Z3, CVC4, but via with Why3 infrastructure) also exists in the SPARK Ada subset and verification tools.

You could learn a lot from all that work.

@fan-tom
Copy link
Owner

fan-tom commented Aug 3, 2021

Thank you @rod-chapman for these references! How did you find this project, I almost abandoned it since faced troubles with precise handling branching and loops, could you suggest me what can I read about how to infer loop invariants (if it is possible at all)?

@rod-chapman
Copy link
Author

The project was brought to my attention by Alastair Reid at Google Research. He has been keeping close track of projects doing verification with Rust.

Inference of loop invariants is still a hard problem. I know of a few teams that have tried it, but I don't know of any significant success.

@alastairreid
Copy link

An incomplete but useful thing to consider for loop invariants is to use a 'guess and check' approach where you first guess a possible invariant and then use SMT to check whether it holds.

This paper describes an approach (that I have not personally tried) where the guessing part works like this:

  1. Gathering some data from an actual run. Which might result in x,y pairs such as 1,3 2,6 3,9.
  2. Using linear algebra to produce a guessed invariant "y = 3 * x"

This looks so simple that I keep hoping for an excuse to implement it myself.
There may be more recent papers with improvements - worth doing at least a shallow search if you think this is promising.

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

No branches or pull requests

3 participants