mirror of
https://github.com/tiyn/wiki.git
synced 2025-11-26 21:29:46 +01:00
added viper entries and for the programming language and its verifiers
This commit is contained in:
37
wiki/docker/viperproject_-_viperserver.md
Normal file
37
wiki/docker/viperproject_-_viperserver.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# viperproject - viperserver
|
||||
|
||||
This is a [Docker](/wiki/docker.md) container for a [Viper](/wiki/programming_language/viper.md)
|
||||
server, which is used for building the Viper verifiers
|
||||
[Silicon and Carbon](/wiki/programming_language/viper.md#setup).
|
||||
The official container and documentation was made by
|
||||
[viperproject](https://hub.docker.com/r/viperproject/viperserver).
|
||||
|
||||
## Set-up
|
||||
|
||||
Create the file `rebuild.sh`.
|
||||
Change the settings according to your needs and run `./rebuild.sh` afterwards.
|
||||
Due to this container being used to build the Silicon and Carbon verifiers it is recommended to be
|
||||
started in interactive mode as demonstrated in the [rebuild section](#rebuildsh).
|
||||
Make sure to substitute `<path-to-carbon>` and `<path-to-silicon>`.
|
||||
If only one of them is to be built, omit the other.
|
||||
Additionally the version of viperproject has to be added for `<viperproject-version>`.
|
||||
It also depends on the Z3 version which will be used later.
|
||||
For example the version `v4_z3_4.8.7` is working for Z3 versions `4.8.7` and later.
|
||||
|
||||
## Volumes
|
||||
|
||||
Set the following volumes with the -v tag.
|
||||
|
||||
| Outside mount/volume name | Container mount | Description |
|
||||
| ------------------------- | --------------- | ----------------------------------------- |
|
||||
| `<path-to-silicon>` | `/mnt/silicon` | (optional) mount Silicon for installation |
|
||||
| `<path-to-carbon>` | `/mnt/carbon` | (optional) mount Carbon for installation |
|
||||
|
||||
## rebuild.sh
|
||||
|
||||
```sh
|
||||
docker run -it --name viperserver \
|
||||
-v <path-to-silicon>:/mnt/silicon \
|
||||
-v <path-to-carbon>:/mnt/carbon \
|
||||
viperproject/viperserver:<viperproject-version>
|
||||
```
|
||||
87
wiki/programming_language/viper.md
Normal file
87
wiki/programming_language/viper.md
Normal file
@@ -0,0 +1,87 @@
|
||||
# Viper
|
||||
|
||||
[Viper](https://www.pm.inf.ethz.ch/research/viper.html) is a verification language among other
|
||||
tools.
|
||||
|
||||
## Setup
|
||||
|
||||
For the Viper language to work a verifier needs to be set up.
|
||||
The two possibilities are [Carbon](https://github.com/viperproject/carbon) and
|
||||
[Silicon](https://github.com/viperproject/silicon).
|
||||
|
||||
This section explains the installation for [Linux-based systems](/wiki/linux.md), but they are also
|
||||
available for [Windows](/wiki/windows.md) systems though the steps to setup differ.
|
||||
For this navigate download the code from [Silicons Github](https://github.com/viperproject/silicon)
|
||||
and/or [Carbon Github](https://github.com/viperproject/carbon).
|
||||
|
||||
There are some dependencies.
|
||||
For both Carbon and Silicon to work correctly Z3 has to be installed.
|
||||
This can easily be done, for example by installing the `z3` package, which is available from
|
||||
various [package managers](/wiki/linux/package_manager/pacman_and_aur.md).
|
||||
For Carbon Boogie has to be installed too.
|
||||
This is best done by installing a .NET SDK which is often packaged in a package called `dotnet-sdk`
|
||||
or a similar named one.
|
||||
Afterwards boogie can be installed using the following command.
|
||||
|
||||
```sh
|
||||
dotnet tool install -g boogie
|
||||
```
|
||||
|
||||
Afterwards the building of Silicon and/or Carbon can follow.
|
||||
|
||||
The easiest way to build one or both verifiers locally is creating a `.jar` file via
|
||||
[Docker](/wiki/docker.md) using the
|
||||
[viperproject image](/wiki/docker/viperproject_-_viperserver.md).
|
||||
|
||||
Start the Docker container as explained in the
|
||||
[corresponding wiki entry](/wiki/docker/viperproject_-_viperserver.md).
|
||||
Make sure to change the setting as described.
|
||||
Then in the Docker container build Silicon by running the following commands.
|
||||
|
||||
```sh
|
||||
cd /mnt/silicon
|
||||
sbt assembly
|
||||
```
|
||||
|
||||
For Carbon similarly run the following commands.
|
||||
|
||||
```sh
|
||||
cd /mnt/carbon
|
||||
sbt assembly
|
||||
```
|
||||
|
||||
Afterwards leave the Docker container.
|
||||
It is no longer needed.
|
||||
|
||||
The `.jar` files are now available in `<path-to-carbon>/target/scala-<version>/carbon.jar` or
|
||||
`<path-to-silicon>/target/scala-2.13/silicon.jar` and are ready to be used outside the docker
|
||||
container from the host machine.
|
||||
|
||||
Afterwards Carbon and/or Silicon are ready to be [used](#usage).
|
||||
|
||||
## Usage
|
||||
|
||||
This section addresses the usage of Viper.
|
||||
|
||||
### Basic Verifier Usage
|
||||
|
||||
After [Silicon](https://github.com/viperproject/silicon) and/or
|
||||
[Carbon](https://github.com/viperproject/carbon) have been setup according to the
|
||||
[setup section](#setup), they can be used.
|
||||
|
||||
For Silicon run the following command.
|
||||
`<path-to-silicon-jar>` describes the path of the Silicon jar which was set in the [setup](#setup).
|
||||
`<path-to-viper-file>` is the path to the Viper file to verify.
|
||||
|
||||
```sh
|
||||
java -jar <path-to-silicon-jar> <path-to-viper-file>
|
||||
```
|
||||
|
||||
For Carbon run the following command.
|
||||
`<path-to-carbon-jar>` describes the path of the Carbon jar which was set in the [setup](#setup).
|
||||
`<path-to-z3>` is the path to the Z3 binary (for example `/bin/z3`) and `<path-to-boogie>` is the
|
||||
path to the boogie binary (for example `~/.dotnet/tools/boogie` when set up with .NET).
|
||||
|
||||
```sh
|
||||
java -jar <path-to-carbon-jar> --z3Exe <path-to-z3> --boogieExe <path-to-boogie> <path-to-viper-file>
|
||||
```
|
||||
Reference in New Issue
Block a user