Princess is a theorem prover (aka SMT Solver) for Presburger arithmetic with uninterpreted predicates, written entirely in Scala. Princess can reason about problems in integer arithmetic, augmented with predicates that can be axiomatised arbitrarily. Such problems can contain arbitrary quantifiers to express that some formula is supposed to hold for all or for some integers.
Main features of Princess include:
Princess runs on any platform that provides a Java runtime environment (version 1.5 or higher).
Princess won the TFA division (arithmetic problems) at CASC J6, 2012. In 2013 and 2014, Princess won in the TFI category of CASC, (integer problems), and was runner-up in the overall TFA division. We currently maintain a separate branch for full support of the TPTP format.
Princess is free software. Since version 2021-03-10, Princess is distributed under BSD 3-clause. Previous versions were distributed under LGPL v2.1 or later; under LGPL v3, and even earlier under GPL v3.
Please contact me if you are interested in any projects or thesis work related to Princess.
@InProceedings{princess08, author = {Philipp R{\"u}mmer}, title = {A Constraint Sequent Calculus for First-Order Logic with Linear Integer Arithmetic}, booktitle = {Proceedings, 15th International Conference on Logic for Programming, Artificial Intelligence and Reasoning}, year = 2008, volume = {5330}, pages = {274-289}, isbn = {978-3-540-89438-4}, series = {LNCS}, publisher = {Springer} }
We provide a binary distribution of the latest version of Princess. This distribution contains all required libraries, i.e., the Scala API and the Cup parser generator library; it is only necessary to have a Java runtime environment (version 1.5 or newer) installed.
To install, just
download the archive and unpack it in some directory of your choice.
The Princess gui can then be invoked using the script princessGui
,
the
command
line
tool
using
the
script
princess
. In addition, the script princessClient
can be used to run Princess in client-server mode
(more details).
If you want to use
the Princess API, it is
easiest to start from the class
ap.SimpleAPI, and use the
functions in
ap.parser.IExpression
to construct formulae. A number of examples are included in both the
source and binary distributions, in
directory testcases/api
.
Stable versions of Princess can be obtained from Maven Central, it is
enough to add the following line to your build.sbt
script:
libraryDependencies += "io.github.uuverifiers" %% "princess" % "2024-01-12"
For use in Scala3, the line has to be modified to:
libraryDependencies += ("io.github.uuverifiers" %% "princess" % "2024-01-12").cross(CrossVersion.for3Use2_13)
We also maintain a local Maven repository with stable and unstable Princess
versions, with URL
https://eldarica.org/maven/
and organisation id
uuverifiers
. If you build your software
using sbt, you can simply
add the following two lines in the build.sbt
script to
automatically download Princess during compilation:
resolvers += "uuverifiers" at "https://eldarica.org/maven/" libraryDependencies += "uuverifiers" %% "princess" % "2024-01-12"
You can download a
complete hello-world project
here. The example can be compiled
using sbt. If you have sbt
installed, just calling sbt run
in
directory hw
should take care of downloading Princess,
and all other dependencies, compilation, and running the example.
Other examples:
The class ap.JavaWrapper
can be used for processing input
in textual form, for instance stored as string or a file, with
exactly the same functionality as on the command line:
[...] final ArrayList<String> options = new ArrayList<> (); options.add("-inputFormat=pri"); // Input in the Princess format options.add("+quiet"); // No warnings or debugging output final String input1 = "\\functions { int x, y, z; } \\problem { x > y & y > z -> x > z }"; System.out.println(JavaWrapper.readFromString(input1, options)); [...]We provide a complete example for this, including a Maven build file that will automatically download all dependencies. If you have Maven installed on your machine, you can compile and run the example by invoking
> mvn package > mvn exec:java -Dexec.mainClass=SimpleSolving
To generate formulas programmatically within a Java application,
we recommend that you have a
look at the JavaSMT wrapper,
which provides uniform access to Princess and many other SMT
solvers.
When building Java programs using
Maven, it is enough
to put the following lines in your pom.xml
to have all
required libraries downloaded automatically:
<project ...> ... <dependencies> <dependency> <groupId>org.sosy-lab</groupId> <artifactId>java-smt</artifactId> <version>4.1.0</version> </dependency> <dependency> <groupId>io.github.uuverifiers</groupId> <artifactId>princess_2.13</artifactId> <version>2023-06-19</version> </dependency> </dependencies> </project>
You can again download a complete hello-world project, again including a Maven build file pre-configured to use Princess together with JavaSMT. If you have Maven installed on your machine, you can compile and run the example by invoking
> mvn package > mvn exec:java -Dexec.mainClass=Riddle
Other Java examples:
We currently maintain a separate branch for full support of the TPTP format. You can download a binary of the latest version, or the sources. This version differs from normal Princess mainly in the following points:
+multiStrategy
,
with
a
portfolio
of
strategies
optimised
for
TPTP
problems;+printProof
can be added.
princess-*
directorysbt run
in order to compile Princess and run itsbt assembly
to create a standalone jar file
that you can run with java -jar target/scala-2.XX/Princess-assembly-XX.jar
.
After sbt assembly
, you can also use the
provided scripts
princess
, princessGui
,
princessClient
to invoke Princess through the jar file.
The compilation is so far only tested on Linux systems. For the installation, using the make tool, you need:
java-cup-11a.jar
)The actual installation consists of the following steps:
princess-*
directoryextlibs
and copy the file java-cup-11a.jar
into itmake parser-jar
make
to compile Princess.If everything went ok, it is possible to run Princess with the
command ./princess <inputfile>
A list of the Princess options can be printed using ./princess -h