View on GitHub

nunchaku

Model finder for higher-order logic

Input Language for Nunchaku

Supported Formats

Input files are parsed by Nunchaku based on their file extension or on the --input {nunchaku,tip,tptp} command line argument

Native Format (.nun)

A few example files can be found in in examples/index.html and in the nunchaku-problems repository.

A few examples

BNF syntax

We will use a BNF-like syntax to describe the grammar of this format. In the following, <foo> represents the syntactical class of foos (e.g. <term> represents the grammar of terms), 'foo' is the verbatim text “foo”, and <foo> ::= a | b | c states that the entry <foo> corresponds to the cases a, b, and c. [a b c] is used for parenthesing; a? makes a optional; a* represents any number of consecutive a; a+ represents any non-empty sequence of a.

The first important definition for the grammar is identifiers (the basic names of objects in Nunchaku’s input). Variables are just identifiers, but we add a distinct rule for them to emphasize their role:

<id> ::= [a-zA-Z][a-zA-Z0-9$_]*]
<var> ::= <id>

Note

comments are supported. A comment starts with '#' and continues to the end of the line.

Terms and Types

Terms are written in a ML-like language that should be easy to read. Types are polymorphic and all type quantification should be prenex.

Statements

Common statements are the following:

Problem

A problem file is just a sequence of statements.

<problem> ::= <statement>*

Copy Types

A copy type is used to define a type from another type. It can take the following forms:

Refinement type

If the predicate <term> entry is present, then <term> must be a term of type bar -> prop. Only elements of bar that satisfy this term will be in the domain of the abstract function (the function is undefined on other elements).

Quotient Type

If the quotient <term> entry is present, then <term> must have the type bar -> bar -> prop and be an equivalence relation. The abstract function will map elements of bar that are equivalent w.r.t the quotient relation, to the same abstract (copy) element.

Include directive

It is possible to write commonly used definitions and axioms in a file, and include that file from other files:

Cardinality Bounds

The two following problems define an uninterpreted type and put bounds on its cardinality. Both are unsatisfiable because of the bound and additional axioms:

val i : type [max_card 2].

val i1 : i.
val i2 : i.
val i3 : i.

# at least three distinct elements
axiom (i1 != i2 && i2 != i3 && i1 != i3).

val i : type [min_card 3].

val a : i.
val b : i.

# at most 2 elements, clashes with constraint on i
axiom forall x. x = a || x = b.

There can also be an infinite uninterpreted type, typically for encoding set theory or similar untyped languages. TODO: expand on this

Builtins

There is More than One Way of Doing It

Design Goals

The native language must support: