This guide formally defines the Isaacus Query Language (IQL), a legal AI query language designed specifically for analyzing legal documents with AI systems.

If you’re interested in learning how to use IQL in practice, check out our introduction to IQL to get started. Otherwise, if you’re looking to understand the complete syntax and semantics of IQL, you’re in the right place.

Statements

The most basic unit of an IQL query (QQ) is a statement (SS).

A statement is formally defined as a sequence of any characters except for curly brackets (\{ and \}) unless they are prefixed by a backslash (\\{ and \\}), in which case the backslashes will be removed and treated as raw curly brackets. Backslashes preceding backslashes being used to escape curly brackets can themselves be escaped by adding another backslash (e.g., \\\} would be interpreted as literally \}).

Statements must be enclosed in curly brackets (\{ and \}) unless they are intended to be the entirety of a query and do not contain any curly brackets, in which case the curly brackets are optional (e.g., confidentiality would be interpreted as {confidentiality}).

A statement beginning with the word IS followed by a space is treated as a template invocation, discussed in the next section. This may be avoided by escaping the word IS with a backslash (\IS). Backslashes preceding backslashes being used to escape the word IS can themselves be escaped by adding another backslash (e.g., \\\IS would be interpreted as literally \IS).

When run through an AI system (typically alongside a legal document), a statement (excluding template invocations, which will be discussed shortly) will evaluate to score(S)\text{score}(S), a probability between 00 and 11, inclusive ([0,1][0,1]). In most cases, the score()\text{score}() function will be a sigmoid()\text{sigmoid}() or softmax()\text{softmax}() function function that converts the raw output (logits) of a model into a probability distribution.

Templates

A template (Tname\text{T}_{\langle\text{name}\rangle} ([a1],,[an])([a_1], \ldots, [a_n])) is a function with a unique case-insensitive name (name\langle\text{name}\rangle) that takes in any number of arguments (aa) or no arguments at all (n0n \geq 0) and resolves to a query (QTQ_\text{T}), which, if arguments are provided, may have those arguments substituted into it.

Templates improve the accessibility and extensibility of queries by allowing for the reuse of common or complex query patterns. They also enable queries to become model-agnostic by abstracting away the need to optimize new idiosyncratic queries for individual models.

A list of currently available built-in templates for Isaacus models may be found here. While it is not currently possible to define one’s own templates, that functionality may be introduced in the future if there is sufficient demand for it (you can express your interest in this feature by contacting us).

A template invocation (STS_\text{T}) is a statement beginning with the word IS followed by a space followed by the name of a template followed by any number of arguments enclosed in double quotation marks (IS <name> "<argument>").

Double quotation marks can be used inside of an argument by simply escaping them with a backslash (\"). Backslashes preceding backslashes being used to escape double quotation marks can themselves be escaped by adding another backslash (e.g., \\\" would be interpreted as \").

As mentioned earlier, a statement intended to begin literally with the word IS should escape it with a backslash (\IS).

A template invocation will evaluate to the score()\text{score}() of the query that the invocation resolves to (score(QT)\text{score}(Q_\text{T})).

Examples

  • confidentiality
  • {This is a confidentiality clause.}
  • {IS confidentiality clause}
  • {IS clause called "confidentiality"}

Operators

IQL supports the following operators, listed in order of precedence from highest to lowest:

OperatorSyntaxExplanation
()(...)A group of terms.
+S₁ + S₂ + ... + SₙThe average of the scores of the terms.
>S₁ > S₂The score of the first term if it is greater than the score of the second term; otherwise, 00.
<S₁ < S₂The score of the second term if it is less than the score of the first term; otherwise, 00.
NOTNOT SThe complement of the score of the term.
ANDS₁ AND S₂ AND ... AND SₙThe minimum of the scores of the terms.
ORS₁ OR S₂ OR ... OR SₙThe maximum of the scores of the terms.

When using a comparison operator (> or <) with more than two arguments, the expression will be interpreted as a chain of pairwise comparisons from left to right such that S₁ > S₂ > S₃ will be interpreted as (S₁ > S₂) AND (S₂ > S₃).

Examples

  • {confidentiality} AND {IS confidentiality clause}
  • {ADR} OR {IS ADR clause} AND NOT {IS clause called "mediation"}