Incremental Formal Modeling Using Logic Programming and Analysis
- Install Rust toolchain, .NET SDK and Runtime and Differential-Datalog following the tutorials in the links. Use command
ddlog --version
to check if DDLog is successfully installed in the local environment. Maintain a copy of Differential-Datalog source code so we can call its standard library later.
-
Generate a Rust Runtime for
formula2ddlog
transformation tool- Go to directory
ddlog_examples/formula2ddlog
and runddlog -i formula2ddlog.dl
. If DDLog cannot find the dependencies tryddlog -i formula2ddlog.dl -L /path/to/differential-datalog/lib/
with additional argument to specify the path of standard library. - The Rust runtime for
formula2ddlog
is generated in directoryddlog_examples/formula2ddlog/formula2ddlog_ddlog
based on the DDLog programformula2ddlog.dl
that formally specifies the transformation rules from FORMULA to DDLog. - Build the Rust runtime directly if you want to use the raw transformation tool in command line by running
cargo build --release
insideformula2ddlog_ddlog
. The command line only accepts data written in DDLog format.
- Go to directory
-
Build the
formula2ddlog_lib
with commandcargo run --release
which will use the Rust runtime built fromformula2ddlog.dl
as library and generate an executable for transformation tool. This tool can translate any FORMULA file such asformula2ddlog/examples/graph/graph.4ml
in our example into an equivalent DDLog program ingraph.dl
in the same folder. -
Copy the DDLog program into
ddlog_examples/formula2ddlog/example/graph/graph.dl
and runddlog -i graph.dl
to generate a Rust runtime for the graph domain that can execute constraint checking and model transformation incrementally. The Rust runtime for graph domain is generated ingraph_ddlog
and a separategraph_lib
uses the Rust runtime ingraph_ddlog
as library to build an executable that does graph domain related computation incrementally.
Run ddlog_examples/formula2ddlog/benchmark.sh
to benchmark constraint checking on random graph in both FORMULA and DDLog.
Usage:
run.sh <NODE=2000> <EDGE=100> <TARGET=ddlog>
if the target is set to ddlog
or formula
, and are the attributes of the auto-generated random graph. The constraint checking will only be executed once on the random graph with the exact size we specify in the arguments or the default value.
if the target is for benchmark as ddlog_bench
or formula_bench
, is the number of nodes for the auto-generated random graph but is number for both initial edges and the range interval. The constraint checking will be executed multiple times for the benchmarking.
Well, things may not be working well on your machine for various reasons when you are following the instructions to run the testing or benchmark. In this case, build a docker image with command docker build -t differential-formula .
in the main directory where Dockerfile
is located or pull differential-formula
from Docker Hub.
The image has 3 executables inside a folder named dformula-executable
:
- DDLog binary and library in case you still need it to run some DDLog commands.
formula2ddlog_lib
transformation tool - Generates a DDLog program given a FORMULA program as parameter. For example,formula2ddlog_lib xxx.4ml > xxx.dl
.graph_lib
benchmarking tool - Run benchmark or just testing with parameters asgraph_lib <NODE=2000> <EDGE=100> <TARGET=ddlog>
. If the target isddlog
orformula
,<NODE>
and<EDGE>
define the size of the random graph for testing. If the target is set for benchmark asddlog_bench
orformula_bench
,<NODE>
is the number of nodes of the random graph for benchmark but<EDGE>
is number of both initial edges and the range interval.