Utilities

The TPTP2X Utility

The TPTP2X utility is a multi-functional utility for reformatting, transforming, and generating TPTP problem files. In particular, it TPTP2X is written in Prolog, and should run on most Prolog systems. Before using TPTP2X, it is necessary to install the code for the dialect of Prolog that is to be used. This and other installation issues are described next.

WARNING: For historical reasons TPTP2X omits the quotes around some constants and function symbols that should be 'Quoted', e.g., as found in PUZ001+2. I'm really sorry about this - it's an artifact of a very generic printing framework that became overloaded when THF formulae came into the TPTP. Changing it would be a HUGE task, and now there's TPTP4X that is better in most respects.

Installation

The TPTP2X utility consists of the following files: TPTP2X is installed by running tptp2X_install, which will prompt for required information. To install TPTP2X by hand, the following must be attended to:

Using TPTP2X

The most convenient way of using the TPTP2X utility is through the tptp2X script. The use of this script is:
tptp2X [-h][-q<Level>][-i][-s<Size>][-t<Transform>][-f<Format>] [-d<Directory>] -l<NamesFile>|<TPTPFiles>
The -h flag specifies that usage information should be output. The -q<Level> flag specifies the level of quietness at which the script should operate. There are three quietness levels; 0 is verbose mode, 1 suppresses informational output from the Prolog interpreter, and 2 suppresses all informational output except lines showing what files are produced. The default quietness level is 1. The -i flag specifies that the script should enter interactive mode after processing all other command line parameters. Interactive mode is described below. The other command line parameter values are:
The output files produced by TPTP2X are named according to the input file name and the options used. The TPTP problem name (the input file name without the .p or .g) forms the basis of the output file names. For files created from TPTP generators, the size parameters are appended to the base name, separated from the base name by a ".". Then, for each transformation applied, a suffix is appended preceded by a +. Finally an extension to indicate the output format is appended to the file name. To record how a TPTP2X output file has been formed, the TPTP2X parameters are given in a % Comments field entry of the output file.

TPTP2X Transformations

The transformations are:
The default transformation is none.

TPTP2X Output Formats

The available output formats are:
The default format is tptp.

Examples

~/TPTP/TPTP2X> tptp2X -tfr,random -f prover9 PUZ001+1
This applies two separate transformations to the problem ALG001-1. The transformations are formula order reversal and formula order randomizing. The transformed problems are output in prover9 format, in a directory prover9/PUZ below the current directory. The file names are PUZ001+1+fr.in and PUZ001+1+ran.in.

~/TPTP/TPTP2X> tptp2X -q2 -s3..5 -fotter -d~tptp/tmp SYN001-1.g
This generates three sizes of the generic problem SYN001-1. The sizes are 3, 4, and 5. The output files are formatted for Otter, to use its auto mode. The files are placed in \verb/~/tptp/tmp/SYN, and are named SYN001-1.003.lop, SYN001-1.004.lop, and SYN001-1.005.lop. The quietness level is set to 2, thus suppressing all informational output except the lines showing what files are produced. Note that the file SYN001-1.g is automatically found in the generators directory.

~/TPTP/TPTP2X> tptp2X -tmagic+shorten - < ~tptp/TPTP/Problems/GRP/GRP001-1.p
This uses the TPTP2X script as a filter, to apply the non-Horn magic set transformation and then the symbol shortening transformation to GRP001-1.p. GRP001-1.p is fed in from standard input, and the output is written to standard output (thus all informational output is suppressed).

The TPTP2X Interactive Mode

If the -i flag is set, the TPTP2X script enters interactive mode after processing all other command line parameters. In interactive mode the user can change the value of any of the command line parameters. The user is prompted for the <TPTPFiles>, the <Size>, the <Transform>, the <Format>, and the <Directory>. In each prompt the current value is given. The user can respond by specifying a new value or by entering <cr> to accept the current value. The prompt-respond loop continues for each parameter until the user accepts the value for the parameter.

Running TPTP2X from within Prolog

The TPTP2X utility can also be run from within a Prolog interpreter. The tptp2X.main file has to be loaded, and the entry point is then tptp2X/5, in the form:

?-tptp2X(<TPTPFile>,<Size>,<Transform>,<Format>,<Directory>).

The parameters are similar to the TPTP2X script command line parameters. A summary, highlighting differences with "(!)", is given here.

Writing your own Transformations and Output Formats

The transformations and output formatting are implemented in Prolog, in the files transform.<TRAN> and format.<ATP>, respectively. It is simple to add new transformations and output formats to the TPTP2X utility, by creating new transformation and format files. New files should follow the structure of the existing files. Typically, a new file can be created by modifying a copy of one of the existing files.

The entry point in a transformation file is <Transform>/6. The first three arguments are inputs: a list of the problem's formulae, the variable dictionary (a bit complicated), and the transformation specification. The next three arguments are outputs: the transformed formulae, the transformed variable dictionary (typically the same as the input dictionary), and the transformation suffix. As well as the <Transform>/6 entry point, a <Transform>_file_information/2 fact must be provided. The two arguments of the <Transform>_file_information/2 fact are the atom transform and a description of the possible transformation specifications (as used in the third argument of <Transform>/6). See the existing transform.<TRAN> files for examples.

The entry point in a format file is <Format>/3. The three arguments are inputs: the format specification, a list of the problem's formulae, and the file header information. (It is not necessary to output a file header here; this information is available only for producing supplementary documentation.) As well as the <Format>/3 entry point, a <Format>_format_information/2 fact and a <Format>_file_information/2 fact must be provided. The two arguments of the <Format>_format_information/2 fact are a character that can be used to start a comment in the output file and the format extension, both as Prolog atoms. The two arguments of the <Format>_file_information/2 fact are the atom format and a description of the possible format specifications. See the existing format.<ATP> files for examples.

New transformation and format files must be compiled in with the other TPTP2X files. This is done by adding a compile query in the tptp2X.main file, alongside the queries that compile in the existing files.

If you need help, please contact the TPTP developers.

Writing your own Problem Generators

The TPTP generators are implemented in Prolog. It is simple to write new generators. New files should follow the structure of the existing files.

The entry point in a generator file is <Problem name>/3, where <Problem name> is the file name without the .g suffix. The first argument is an input: the size parameter for generation. The second and third arguments are outputs: the formulae generated and the % Status of the formulae. The formulae must be a Prolog list of formulae in TPTP format. A <Problem name>_file_information/3 fact must also be provided. The three arguments of the fact are the atom generator, a description of the possible size parameters, and the TPTP size for this problem (this is hard to determine!). See the existing generator files for examples.

If you need help, please contact the TPTP developers.


The TPTP4X Utility

The TPTP4X utility is a multi-functional utility for reformatting, transforming, and generating TPTP problem files. It is the successor to the TPTP2X utility, and offers some of the same functionality, and some extra functionality. TPTP4X is written in C, and is thus faster than TPTP2X.

The TPTP4X usage is Usage: tptp4X <options> <files>. The options are (defaults in ()s):


The TPTP2T Script

The TPTP2T script selects lines from either the
ProblemAndSolutionStatistics file, by problem and solution characteristics.

The TPTP2T script is written in perl.

Installation

Installation of the TPTP2T utility requires simple changes in the tptp2T script. These changes can be made by running tptp2T_install, which will prompt for required information.

Using TPTP2T

The use of this script is:

tptp2T [-f FileName] [-q1 or -q2 or -q3] [-pp or -ps or -pps] {[-]Constraint {[and/or] [-]Constraint}}

The Constraints specify required problem and solution characteristics that must be satisfied for the statistics file line(s) to be selected. There are two sets of constraints, problem constraints and solution constraints, which apply to problem lines and solution lines separately. For a solution line to be printed, the problem line it accompanies must pass all problem constraints, if any are provided. Different sets of solution constraints can be applied to different systems individually.

A problem Constraint is selected from:

A solution <Constraint> is selected from: