Skip to content
No description, website, or topics provided.
OCaml Other
  1. OCaml 99.7%
  2. Other 0.3%
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

SyTeCi: Automating contextual equivalence for higher-order programs with references

This prototype, written in OCaml, generates, from two programs M_1,M_2 written in a fragment of ML, the Structured-Memory Transition Machine A_S as described in this paper. It is represented using the dot format of graphviz.

One can then check that no failed states are reachable in A_S to prove that M_1,M_2 are contextually equivalent.

In the restricted fragment described in the paper cited above, the prototype can also generates the set of constrained Horn clauses corresponding to the non-reachability of failed states of A_S. These contrained Horn clauses are written in an extension of the SMT-LIB2 formate described here, than can be checked by the SMT-sover z3.

A webpage to test the prototype is available here.


This requires menhir and z3 that should be installed using opam. You can compile the program by either:

  • an invocation of dune build followed by dune install to build then install the binary syteci.
  • a simple invocation of make that will create the binary syteci in the current directory.

Basic Use

To use SyTeCi, you first have to put the programs you want to compare in two different files "file1" and "file2". Then, you have to invoke the following command: syteci -smtm -chc file1 file2 to generate:

  • the Structured-Memory Transition Machine (SMTM) in dot format;
  • the set of Constrained Horn Clauses (CHC) for the non-reachability of failed states in SMT2-LIB format. You may check this CHC with a solver like z3. If it is unsatisfiable, then the two programs are contextually equivalent. For recursion-free programs, we also have that if it is satisfiable, then the two programs are not contextually equivalent.

You may find examples (including the one presented in the paper) in the testsuite/ directory.

So for example, you can use syteci -smtm -chc testsuite/equivalence/wbsc/ testsuite/equivalence/wbsc/ to test SyTeCi on the "Well-Bracketed State Change" example. This will generate the Structured-Memory Transition Machine in dot format, and the set of Constrained Horn Clauses for the non-reachability of failed states in SMT2-LIB format.

To indicate the step-indexes to control the unfolding of recursive definitions, you can use the option -j and -k (respectively for the first and the second program), as syteci -smtm -chc testsuite/equivalence/impure-factorial/ testsuite/equivalence/impure-factorial/ -j 2 -k 2 to test SyTeCi on the "Impure Factorial" example.

Many other options are available, to discover them you can use syteci -help

You can’t perform that action at this time.