Soothsharp is a transcompiler that transforms C# code into code files of the Viper Intermediate Language (.vpr
), a verification language based on permission logics.
This project is currently in active development.
The corresponding thesis text is being created at: https://docs.google.com/document/d/1o0VfYGBnORk7PDMHPIxl39hZ8iz5wEKCxPs34RVM4YY/edit?usp=sharing
You will need Visual Studio 2015 or newer (tested on 2015 only).
- Clone this repository locally.
- Put the
Viper
directory into your%PATH%
environment variable. TheINSTALL.txt
file in that directory gives more details. - Install additional programs required by the Viper tools.
- Install Java.
- Install Z3 4.4.0 and put the path to
z3.exe
in an environment variable namedZ3_EXE
. Alternatively, you may putz3.exe
and all associated files into a directory in your%PATH%
variable. - Install Boogie by building it from source and putting the path to
boogie.exe
in an environment variable namedBOOGIE_EXE
. This is only required for the Carbon backend. - After setting environment variables, you may need to restart Visual Studio and any command-line windows you use for the changes to take effect.
- Rebuild the solution.
- If the fails, right-click the solution in the Solution Explorer and click "Restore NuGet packages", then try to rebuild the solution again.
- Run the "csverify GUI" project.
- You may find examples in the "Examples" project.
This class file defines a tuple of two integers that can be verifiably swapped.
using System;
using static Soothsharp.Contracts.Contract;
namespace Soothsharp.Examples.Algorithms
{
public class Tuple
{
public int First;
public int Second;
public Tuple(int first, int second)
{
Ensures(Acc(First) && Acc(Second));
First = first;
Second = second;
}
public void Swap()
{
Requires(Acc(First) && Acc(Second));
Ensures(Acc(First) && Acc(Second));
Ensures(First == Old(Second) && Second == Old(First));
int temp = First;
First = Second;
Second = temp;
}
}
}