Targeting Completeness: Automated Complexity Analysis of Integer Programs

This page contains additional information on our article “Targeting Completeness: Automated Complexity Analysis of Integer Programs whose full version is available on ArXiv. More precisely, we describe our implementation and our experiments.

Implementation

The source code of our new version of KoAT corresponding to our paper can be found here. The most recent official version of KoAT is also available on GitHub. See our documentation for a list of external tools and libraries used by KoAT.

Our implementation can be executed via the web interfaces, via a Docker image, and via the provided static binary. A Docker image containing KoAT2 and a static binary of the new release can be downloaded here. A web interface using this new release is provided for integer programs and C programs.

Concerning the input format, for integer programs we use the corresponding input format from the Termination and Complexity Competition as described here. Note that a disjunction is modeled by two parallel transitions with the same update, and negations are modeled by flipping every comparator (i.e., ¬(x<y) is equivalent to x≥y). Additionally, we also allow for costs in transitions as described here.

For C programs, we also use the corresponding input format from the Termination and Complexity Competition as described here. To analyze C programs, KoAT translates them into the ITS-format for integer programs using Clang and llvm2kittel.

Experiments

To evaluate the power and performance of our approach we tested it on two benchmark sets from the TPDB.

On both collections Complexity_C_Integer and Complexity_ITS, the existing tools already infer finite runtimes for more than 88 % of those examples that might terminate.

To demonstrate the strength of our new approach, we extended these collections by 20 C programs and 22 integer programs including the examples and variations of the examples from our paper. Detailed information about the new examples can be found here (for CINT) and here (for CITS).

The two new benchmark sets Complexity_C_Non_Linear and Complexity_ITS_Non_Linear are similar but they differ slightly, as an update of an integer program is performed simultaneously on all variables, whereas in a C program each variable is updated individually. Hence, we added two more integer programs which include some simple cycles of length more than one and omitted them in the collection of C programs since the transformation into integer programs already yields such cycles. Additionally, we often made non-deterministic branching in an integer program explicit by slightly changing the control-flow.

We compare the runtime bounds computed by the tools asymptotically as functions which depend on the largest initial absolute value n of all program variables. All tools were run inside an Ubuntu Docker container on a machine with an AMD Ryzen 7 3700X octa-core CPU and 48 GB of RAM. The benchmarks were evaluated in parallel such that at most 8 containers were running at once, each limited to 1.9 CPU cores. In particular, the runtimes of the tools include the times to start and remove the container. We give both the average runtime of each tool on all runs and the average runtime on successful runs, i.e., where the tool inferred a finite runtime bound before reaching the timeout. A timeout of 5 minutes was enforced for every tool and program.

We compare the results of our tool KoAT2 in different configurations to that of other state-of-the-art tools such as KoAT1 (the original implementation of KoAT), CoFloCo, Loopus (only evaluated on Complexity_C_Integer and Complexity_C_Non_Linear), and MaxCore with CoFloCo or PUBS as its backend (only evaluated on Complexity_C_Integer and Complexity_C_Non_Linear).

For KoAT2 we use the following configurations:

Complexity_C_Integer

The programs of this benchmark set are C programs on integer values. For the analysis these are assumed to be mathematical integers. The tools MaxCore and Loopus can directly analyze these programs. For KoAT1 and KoAT2 they are translated into integer programs by using the tools Clang and llvm2kittel.

Please click on the tool names to obtain a detailed list of all results or to download the output of the corresponding configuration. For example, the detailed results show that KoAT1 infers an exponential runtime for 10 benchmarks, whereas KoAT2 is able to infer a polynomial bound for 5 of these benchmarks. Note that for all configurations of KoAT2, the integer programs in the output have been rendered as graphs using Graphviz.

Tool O(1) O(log(n)) O(n) O(n²) O(nᵏ), k>2 O(EXP) < ∞ Avg. Runtime on Successful Runs Avg. Runtime on All Runs
KoAT2(F) 24 10 238 73 18 5 368 4.71s 17.47s
KoAT2(TS) 24 0 237 72 25 5 363 5.39s 18.88s
KoAT2(T) 24 0 236 69 19 8 356 5.87s 17.96s
KoAT2(S) 24 0 232 70 13 3 342 5.01s 14.52s
KoAT2 24 0 231 66 10 5 336 4.78s 14.11s
MaxCore + CoFloCo 23 0 221 67 7 0 318 1.88s 5.46s
KoAT1 25 0 170 74 12 10 291 1.83s 2.83s
MaxCore + PUBS 12 5 164 88 3 0 272 0.85s 6.16s
Loopus 17 0 171 50 7 0 245 0.53s 0.53s

Complexity_ITS

The programs of this benchmark set are integer programs in the format described in our paper. They can directly be analyzed by KoAT. For CoFloCo we used the corresponding configuration from the Termination and Complexity Competition 2019. We do not evaluate MaxCore and Loopus on these benchmarks, as these tools cannot handle integer transitions systems.

Please click on the tool names to obtain a detailed list of all results or to download the output of the corresponding configuration. For all configurations of KoAT2, the integer programs in the output have again been rendered as graphs using Graphviz.

Tool O(1) O(log(n)) O(n) O(n²) O(nᵏ), k>2 O(EXP) < ∞ Avg. Runtime on Successful Runs Avg. Runtime on All Runs
KoAT2(F) 128 11 268 111 25 10 553 4.24s 23.86s
KoAT2(TS) 128 0 265 107 33 13 546 4.52s 24.71s
KoAT2(T) 128 0 264 106 23 16 537 4.11s 23.47s
KoAT2(S) 132 0 257 104 19 8 520 4.30s 23.71s
KoAT2 131 0 258 103 13 11 516 3.89s 22.09s
KoAT1 132 0 216 104 14 9 475 0.71s 8.71s
CoFloCo 125 0 233 95 9 0 462 3.37s 17.12s