Interactions Trees (ITrees) are coinductive structures used to represent interactions between a system and its environment in the style of a process algebra.
This repository contains a mechanisation of ITrees in Isabelle/HOL, for the purpose of verifying reactive systems and generating code for animation purposes.
You can find a number of examples under examples/
, and in particular the Haskell code can be executed in GHCi for animation purposes.
RoboChart theories and examples are under RoboChart
and RoboChart/examples
. There are also instructions and documents inside the folder. The latest development of RoboChart related theories is in the branch robochart_nondeterminism_resolving.
The theories have been developed in Isabelle2021-1. This instruction is based on Ubuntu/Linux. It would be similar on other operation systems.
Steps:
The prebuilt version comes with a patched Isabelle/HOL to have a console for animation, which is more convenient.
/path/to/yourfolder $ git clone https://github.com/isabelle-utp/interaction-trees.git
/path/to/yourfolder $ cd interaction-trees
We use /path/to/interaction-trees/
to denote the path to this particular directory.
Isabelle2021-1 on Linux (January 26th 2023)
, it is Isabelle2021-1-CyPhyAssure-20230126.tar.bz2
in this case/path/to/yourfolder $ tar -xvjf Isabelle2021-1-CyPhyAssure-20230126.tar.bz2
/path/to/yourfolder $ cd Isabelle2021-1-CyPhyAssure/
ITree_VCG
/path/to/yourfolder/Isabelle2021-1-CyPhyAssure/ $ ./bin/isabelle jedit -l ITree_VCG
/path/to/yourfolder $ tar zxvf Isabelle2021-1_linux.tar.gz
/path/to/yourfolder $ git clone https://github.com/isabelle-utp/CyPhyAssure.git
/path/to/yourfolder $ cd CyPhyAssure
/path/to/yourfolder/CyPhyAssure (main) $ git submodule update --init --recursive
ITree_VCG
/path/to/yourfolder $ ./Isabelle2021-1/bin/isabelle jedit -d CyPhyAssure -l ITree_VCG
With the prebuild version, animation would be simpler.
Load the theory for animation, then move your cursor to a line starting with animate
, such as animate D_PatrolMod_p_sim
to animate a definition D_PatrolMod_p_sim
. When the cursor stops there, code generator starts to generate Haskell code, and compile. Usually, we will see below on the Output
window.
See theory exports
Compiling animation...
See theory exports
Start animation
Then click Start animation
.
General steps are shown below. Please see instructions in each specific example for further considerations.
Output
window and you will see See theory exports, then double click the area theory exports, and now the exported code will be displayed on File Browser
. Use File Browser
to copy the generated files to the local physical file system, such as /path/to/simulation
.simulation.hs
and main.hs
.Output
window and you will see See theory exports, then double click the area theory exports, and now the two exported files will be displayed on File Browser
. Use File Browser
to copy the generated files to the local physical file system /path/to/simulation
./path/to/simulation
.
$ cd /path/to/simulation
main.hs
, then run main
.
$ ghci main.hs
*Main> main
$ ghc -g main.hs
$ ./main