GLOSSARY

# Glossary

## Aggregation

An operation used to combine multiple values into a single value. Examples include count, sum, avg, min, and max.

## Analytics

The process of distilling data into useful information. For example, looking at your bank statement to figure out how much money you’re spending in various categories is an exercise in data analytics.

Large organizations use data analytics to predict many variables relevant to their decision-making process, like supply chains, market trends, and customer behavior.

## Annotations

A definition can be preceded by a number of optional annotations.

Common annotations include @inline, @outline, @ondemand, and @static.

## Any

A unary relation which contains all values. In other words, Any(x) evaluates to true for any value of x.

## Argument

An expression supplied to a relation in a relational application or partial relational application expression.

For example, in the expresson scrabble_score("zeitgeist", x), the string literal "zeitgeist" and the variable x are arguments to the relation scrabble_score.

## Arity

The number of elements in a relation’s tuples. For example, {(1, 2, 3); (4, 5, 6)} has arity 3.

## Array

An $n$-dimensional grid of numbers or other values.

A 1-dimensional array is a vector and a 2-dimensional array is a matrix.

Arrays are conventionally represented in Rel in the COO format (opens in a new tab). This means, for example, that a matrix $A$ is represented as an arity-3 relation that contains a tuple of the form (i, j, v) whenever v is the value in the ith row and jth column of $A$. For example, consider this matrix:

$A = \begin{bmatrix} 4.5 & -2.0 & 3.3 \\ -0.5 & 1.0 & 5.0 \\ \end{bmatrix}$

In Rel, this relation would be represented as:

def A {
(1, 1, 4.5);
(1, 2, -2.0);
(1, 3, 3.3);
(2, 1, -0.5);
(2, 2, 1.0);
(2, 3, 5.0)
}

## Base Relation

A relation whose tuples are inserted into the database. Base relations contrast with derived relations, which are computed from base relations and other derived relations.

## Binary Relation

A relation of arity 2. In other words, a binary relation is a relation whose tuples are pairs.

## Bindings

A language construct in Rel by which variables are introduced. Bindings may appear in the head of a rule or integrity constraint or in a relational abstraction.

Examples: x, x in A, y in B.

## Boolean Expression

An expression that evaluates to true or false.

The set of rules and computations that represent the domain-specific knowledge and processes that drive a business application.

Business logic serves as a bridge between the data in a knowledge graph and the user interface of an application built atop the knowledge graph.

## Cardinality

The number of tuples in a relation.

## Cartesian Product

The Cartesian product of two relations consists of every concatenation of a tuple from the first relation with a tuple from the second relation. For example, the Cartesian product of {(1, 2); (3, 4)} and {("a"); ("b")} is {(1, 2, "a"); (1, 2, "b"); (3, 4, "a"); (3, 4, "b")}.

In Rel the Cartesian product of relations P and Q is written as P, Q.

## Character

A single letter, number, punctuation mark, or other symbol. Character literals in Rel are enclosed in single quotes: 'c' represents the character “c”.

## CLI

A command-line interface for interacting with the RelationalAI platform. It can be used to create and manage projects, datasets, and models.

## Compiler

The component of the RelationalAI query engine that translates RelationalAI models and queries into executable code.

## Composition

A shortcut for joining the last column of a relation with the first column of another relation. The syntax for relational composition is a period (.). Example:

def order_products {(12, 3213); (10, 3213); (7, 9832)}
def product_names {(3213, "laptop"); (9832, "iphone"); (45353, "TV")}
def output = order_products.product_names

## Concatenation

Putting one just after the other. For example, the concatenation of the tuples (4, 2, 7) and (3, 1) is the tuple (4, 2, 7, 3, 1).

## Conceptual Modeling

The process of constructing a problem’s ontological schema.

## Constructor

The relation associated with a particular entity type or value that can be used to reference elements of that type.

For example, in the value type declaration value type Age = Int, the expression ^Age[18] represents a value whose type is Age. Thus ^Age is the constructor associated with the value type Age.

## Control Relation

A special relation whose contents are used to produce side effects in the RelationalAI query engine. The control relations are insert, delete, abort, output, and export.

## CSV Schema

The schema of a CSV file associates each column with a type. The load_csv option schema is a binary relation mapping each column to its type. The pairs are of the form (RelName, String):

module config
def schema {
(:cocktail, "string");
(:quantity, "int");
(:price, "decimal(64, 2)");
(:date, "date");
}
end

## Data Model

An object or concept, consisting of data, that informatively represents another object, concept, phenomenon, or system.

For example, a model airplane is a physical model of a real airplane. Friendship is a conceptual model of alliance between countries. Your driver’s license uses a conceptual model—consisting of your name, date-of-birth, address, eye color, sex, height, and organ-donor status—to represent you. The conceptual model used by your driver’s license is also a data model, since your name, date of birth, etc. are data.

## Decimal

A numeric type which represents numbers with a fixed number of digits after the decimal point. The element decimal[n, digits, v] is a value of type FixedDecimal which uses n bits to represent the value v with digits digits of precision after the decimal point.

## Declaration

A Rel model consists of of a set of declarations, which can be rules, entity or value type declarations, module declarations, integrity constraints, or use declarations.

## Declarative Language

A language that allows users to express the result they want to obtain without having to specify how to compute it. Rel and SQL are examples of declarative languages.

## Definition

A declaration that specifies how to populate a named relation with a set of tuples which is computed from a given logical rule.

Note that definition is a synonym of rule.

## Delete

A control relation used to delete tuples from base relations in the database.

In any write transaction, the tuples in the relation delete are used to modify the base relations as follows: the first element in each tuple should be a Symbol that specifies the name of the relation to be modified, and the remaining elements should compose the tuple to be deleted from the relation. For example, the declaration def delete(:R, x...) = R(x...) results in the deletion of all tuples from the relation R.

## Demand Transformation

A query transformation performed by the RelationalAI query engine that restricts a relation in such a way that it is guaranteed to be finite.

For example, in the following query, the relation f is infinite:

def f[x in Int] = 2*x
def output = f[3] + f[4]

The query engine is nevertheless able to evaluate the query by transforming it so that only the values of f[3] and f[4] are actually computed.

## Derived Relation

A relation that is computed from other relations using logical rules.

For example, results is a base relation and medal is a derived relation in this example:

//update
def insert:results {("Alice", 1), ("Bob", 2), ("Charlie", 3), ("Dave", 4), ("Eve", 5)}

//install
def medal(name) = exists(place : results(name, place) and place ≤ 3)

## Docstring

A string that provides documentation for the relation targeted in the rule following the docstring. A relation’s docstring can be accessed using docstring:

doc"""The number 0."""
def zero = 0
def output = docstring[:zero]

## Edge

A connection between nodes in a graph. For example, in a graph representing people and the friendships between them, the friendships are the edges and the people are the nodes.

## Element

One of the items in a tuple. An element may be a number, a string, a date, a character, an instance of a value type, or an instance of an entity type. For example, the third element of the tuple $(7, 4, 13)$ is 13.

## Engine

A virtual machine running in a cloud provider (such as Microsoft Azure) that executes query computations and processes database transactions.

## Entity

Something that exists in the real world and can be uniquely identified independently of its properties or other relationships. Entities are typically modeled in Rel using an hash contructor:

from ::std::datetime import Date
def ^Person = make_entity_hash[:Person, {(String, Date)}]
def output = ^Person["Marcus Jones", 1990-01-01]

## Exception

An error thrown during the execution of an expression.

This can happen even if an expression is syntactically correct.

For example:

def json = parse_json["result"]

## Existential Quantification

A logical operation that expresses the idea that there exists at least one value of a variable that makes a given relation non-empty. For example,

def R {1; 2; 3}
def output = exists((x) | R(x) and x > 2)

## First-Order

Having every variable represent an element rather than an entire relation. This term may be used to describe a rule, a relation, a variable, or an expression.

## Function

A relation that associates every input to at most one output element, where the final element is regarded as the output and the input comprises all of the other elements.

## Functional Dependency

An argument of a relation is functionally dependent on a set of arguments if it can be determined by those arguments.

For example, in the relation add, which contains a triple (x, y, z) if x + y = z, the argument z is functionally dependent on the arguments x and y.

## Graph

A set of nodes and edges that represent relationships between the nodes.

## Graph Normal Form

A level of database normalization beyond the usual Third Normal Form used by wide-table relational database management systems.

A collection of relations is in Graph Normal Form if it satisfies two conditions:

1. Indivisibility of facts. Each tuple in each relation must correspond to a single, indivisible fact. In other words, each relation must have at most one non-key column.
2. Things not Strings. The identity of each element in the database must reflect the identity of the concept it represents. In other words, elements in the database should be equal if and only if they are intended to represent the same real-world object.

## Grounded Variable

A variable v is said to be grounded when the query engine can determine that v represents an element of a finite set of values. If a variable is not grounded, error messages will inform you that it is “not ground” or “not bound”.

The head of a rule is the part that appears between the keyword def and the body of the rule. For example,

def <head> {
<body>
}

## Higher-Order

Having at least one argument which represents a relation rather than an individual element. This term may be used to describe a rule, a relation, a variable, or an expression. For example, count is a higher-order relation because the relation R in count[R] represents an entire relation.

## Identifier

The name of a relation or variable in Rel. An identifier may be any sequence of any Unicode letter or underscore, followed by zero or more Unicode letters, underscores, or numbers. For example, the following are valid identifiers: x, a1, b1c, θ, φ, Σ, ß, β1, β2, ^V.

## Incremental View Maintenance

An implementation feature of RelationalAI’s system whereby the contents of derived relations are updated incrementally whenever base relations are updated, as opposed to being repopulated from scratch in response to every change.

## Infinite Relation

A relation that contains an infinite number of tuples.

For example, the relation R in the definition below contains all of the tuples ...(-3, -2), (-2, -1), (-1, 0), (0, 1), (1, 2), (2, 3), ...:

@inline
def R(x in Int, y in Int): y = x + 1

## Inline

When a definition of relation R is annotated with @inline, its definition is expanded at every place where it is used. For example,

@inline
def P[x, y]: x * x + y
def Q[x]: P[x, x] + P[2.0, 3.0]

This makes the definition of Q equivalent to:

def Q[x]: x * x + x + 2.0 * 2.0 + 3.0

## Insert

A control relation used to insert tuples into base relations in the database. In any write transaction, the tuples in the relation insert are used to modify the base relations as follows: the first element in each tuple should be a Symbol that specifies the name of the relation to be modified, and the remaining elements should compose the tuple to be inserted into the relation.

## Integrity Constraint

A declaration that ensures that a specified condition is met. For example:

ic symmetric(a, b) requires R(a, b) implies R(b, a)

If a transaction is attempted that would violate an integrity constraint in the query or in a model in a database, that transaction is rejected and the user is notified of the integrity constraint violation.

## Join

An operation whereby data in multiple relations are combined into a single relation.

In the example below, the relationship between a company’s name and the hex code of their primary color is obtained from the relations color and hex by joining them using the color name:

def color {
("UPS", "brown");
("FedEx", "purple");
("USPS", "blue")
}

def hex {
("purple", "#4d148c");
("blue", "#333366");
("brown", "#310200")
}

def output(carrier, hex):
exists((color) | color(carrier, color) and hex(color, hex))

## Key

The smallest set of arguments that uniquely identifies a tuple in a relation. In Rel, a relation’s key is customarily either all of the relation’s arguments or all of them except the last one.

## Knowledge Graph

A data model that represents knowledge as a graph where the nodes are entities or values and the edges represent relationships between them. This graph structure captures the meanings of the entities and relationships, enabling analytical capabilities such as reasoning, inference, and discovery of new knowledge.

## Literal

An expression that directly represents a specific value. For example, 17 is an integer literal, while "flower" is a string literal.

## Meta Values

A value in Rel which indicates that the element represents schema rather than data. For example, the names of relations or the column headers in CSV data are represented and can be accessed using Meta Value Strings. Additionally, Meta Value Integers are used to describe the number of bits in numeric types. A Meta Value String literal has the form of an identifier prefixed with a colon, such as :title. A Meta Value Integer literal has the form of a positive number prefixed with a hash, such as #64. std::mirror::lift is the generic constructor for Meta Values.

Meta Value Strings are also used to represent relation names in modules. For example, the partial application Graph[:edge] may be used to access the relation called edge in the module Graph:

module Graph
def node {1; 2; 3; 4}
def edge {(1,2); (2, 3); (3, 4); (4, 1)}
end
def output = Graph[:edge]

Note that Meta Value String is a synonym of RelName.

## Model

A collection of Rel declarations that is loaded into a RelationalAI database. The RelationalAI query engine makes the declarations in a model available to other models and to all queries executed in the database.

A transaction that persists a Rel model in the database. Loading a model is the only way to persist derived relations and integrity constraints.

## Module

A relation that represents a collection of relations.

Partial application is used to access the relations being grouped in a module. For example, the subrelations store[:office] and store[:product] are grouped together in the module store below:

module store
def office {"Boston"; "New York"; "Los Angeles"; "Chicago"}
def product {(1, "Laptops"); (2, "Desktops"); (3, "Phones")}
end

The keys in a module — :office and :product in the example above — are Meta Values.

## Module Declaration

Syntax for defining a module that begins with module <module_name> and ends with end. For example:

module store
def office {"Boston"; "New York"; "Los Angeles"; "Chicago"}
def product {(1, "Laptops"); (2, "Desktops"); (3, "Phones")}
end

The declaration above defines a relation store which contains the following tuples:

{
(:office, "Boston");
(:office, "New York");
(:office, "Los Angeles");
(:office, "Chicago");
(:product, 1, "Laptops");
(:product, 2, "Desktops");
(:product, 3, "Phones")
}

The body of a module declaration may contain rules, use declarations, integrity constraints, and other module declarations. Module declarations may also be parameterized.

## Negation

The logical operation that inverts the truth value of a Boolean expression.

For example, the expression not x > 2 is the negation of the expression x > 2.

## Node

An element in a graph which can be connected to other elements by edges. For example, in a graph representing people and the friendships between them, the people are the nodes and the friendships are the edges.

## Nullary Relation

A relation of arity zero. There are two nullary relations: {()} and {}.

## Ontology

A description of the concepts used in a database, including rules that define how the concepts relate to one another. For example, an ontology for a zoo’s animal database might enumerate types like bird, fish, mammal, flamingo, tiger, etc., as well as facts like “all flamingos are birds, all tigers are mammals”, and so on.

## Outline

An annotation that directs the compiler to use the annotated definition as a template from which to generate a first-order definition that is specialized on the higher-order parameters.

For example:

doc"Compute the transitive closure of a binary relation"
@outline
def transitive_closure[R]: R
@outline
def transitive_closure[R]: R . (transitive_closure[R])

def edges {(1, 2); (2, 3); (3, 4)}
def output { transitive_closure[edges] }

Targeting the same relation with multiple rules.

For example:

def zip:short = "12345"
def zip:full = "12345-6789"

## Parameter

A variable that is used to represent a value that is supplied when a relation is used.

For example, word and points are parameters in the following rule:

def scrabble_score(word, points) {
sum(string_split["", word].letter_points, points)
}

## Parameterized Module Declaration

A module declaration with parameters. For example:

@outline
module my_stats[R]
def my_minmax { (min[R], max[R]) }
def my_mean { mean[R] }
def my_median { median[R] }
end
def output { my_stats[{1; 2; 3; 5; 8; 13; 100}] }

## Parser

The part of the RelationalAI query engine that converts the text representing each query into an internal data structure intended for further processing by the engine.

## Partial Application

The operation of supplying an initial segment of arguments to a relation and obtaining the rest of each tuple in the relation that begins with the given arguments. For example, the output of the following transaction is {(2, 3); (4, 5)}:

def R {
(1, 2, 3);
(1, 4, 5);
(2, 6, 7)
}
def output { R[1] }

## Point-free

A style of writing Rel expressions that avoids the use of variables to represent individual elements.

For example, the expression R.S expresses a join of R and S in a point-free style because the only identifiers that appear in the expression are relation names rather than variables.

## Point-wise

A style of writing Rel expressions that involves using variables to represent individual elements.

For example {(x, y) : exists((z) | R(x, z) and S(z, y))} expresses a join of R and S in a point-wise style because the identifiers x, y, and z are variables which represent individual elements.

## Precedence

The order in which operations apply in an expression.

For example, the default precedence rules imply that multiplication is performed before addition in the expression 1 + 2 * 3. Curly braces or parentheses may be used to override default precedence rules: for example, the addition is performed first in (1 + 2) * 3 or {1 + 2} * 3. By convention, curly braces are often used for non-singleton relations and parentheses for singletons.

## Projection

The operation of dropping some of a relation’s columns.

This example shows how you can drop the first and last columns of a ternary relation:

def myrel { (1, "a", 2); (1, "b", 3); (3, "a", 6); (4, "b", 12) }
def output(y): exists((x, z) | myrel(x, y, z))

## Property

An attribute or characteristic of an entity or value in a database.

For example, a person’s name, date of birth, and address are properties of that person.

## Qualified Name

A partially-applied relation name that is prefixed with one or more module names.

For example, audit[:contact, :number] is a qualified name that refers to a relation called number in a module called contact which in turn is in a module called audit.

## Query

A collection of declarations submitted to the RelationalAI query engine for execution. Read queries do not modify the state of the database, while write queries can modify the state of the database.

## Query Engine

The cloud software that executes queries against a RelationalAI database.

## Raw Strings

Used to represent strings that contain characters that would otherwise be interpreted as part of the string syntax.

A raw string begins with the identifier raw, immediately followed by N double quotes, where N must be an odd number. The raw string extends until the nearest occurrence of N double quotes.

raw"""
The backslash \ and percent sign % usually have special meanings.
"""

A query that is not allowed to modify the database.

A transaction that is not allowed to change the state of the database. Note that “read transaction” is a synonym of “read query”.

## Reasoning

The process of inferring new facts based on a knowledge graph’s ontology and data.

## Recursion

A rule in Rel is recursive if the same relation is referenced in the rule’s head and body. For example, the second rule in this example is recursive because it references the relation ancestor in both the head and body:

def ancestor(a, b): parent(a, b)
def ancestor(a, b): exists((c) | parent(a, c) and ancestor(c, b))

A pair of rules is mutually recursive if the body of the first rule references the head of the second rule and vice versa. A sequence of three rules is mutually recursive if the body of the first rule references the head of the second rule, the body of the second rule references the head of the third rule, and the body of the third rule references the head of the first rule. Mutual recursion is defined similarly for sequences of four or more rules.

## Reification

A transformation by which a domain-level concept is given explicit representation as a set of elements in a knowledge graph.

For example, a relation representing tennis matches may contain the concept of a match implicitly as set of tuples:

def match {
("Roger Federer", "Rafael Nadal", "2019 French Open");
("Roger Federer", "Novak Djokovic", "2012 Wimbledon");
("Rafael Nadal", "Novak Djokovic", "2013 US Open")
}

Reifying the notion of a match involves creating elements that represent matches:

def match { 1; 2; 3 }
def competitor[1]: "Roger Federer"
def competitor[1]: "Rafael Nadal"
def competitor[2]: "Roger Federer"
def competitor[2]: "Novak Djokovic"
def competitor[3]: "Rafael Nadal"
def competitor[3]: "Novak Djokovic"
def event[1]: "2019 French Open"
def event[2]: "2012 Wimbledon"
def event[3]: "2013 US Open"

## Rel

RelationalAI’s declarative modeling language, used to define relations and logic in the RelationalAI system.

## Relation

A set of tuples. For example, {(1, 2), (3, 4), (5, 6)} is a relation with three tuples, each of which contains two elements.

Relations may be visualized as tables, with tuples corresponding to rows.

## Relational Data Model

A data model in which concepts and relationships between them are represented using relations.

## Relational Abstraction

Defines a relation without a name.

The general structure of a relational abstraction is { binding : expression }. The binding introduces one or more variables, while the expression evalutes to a relation for each value of the variables. For example:

{ (x, y) : x != y and exists( (p) | parent(p, x) and parent(p, y)) }

## Relational Application

A language construct in Rel whose syntax involves a relation immediately followed by a set of arguments in parentheses. The expression evaluates to true if the tuple in the parentheses is in the relation and false otherwise.

age("Martin", 39)

This expression evaluates to true if the relation age contains the tuple ("Martin", 39), and false otherwise.

## Relational Knowledge Graph

A database that represents knowledge as a collection of base relations and derived relations.

## Relational Knowledge Graph System

A system designed to support building and using a relational knowledge graph.

## RelName

A data type in Rel similar to String but which is typically used to indicate that the element represents schema rather than data. Note that RelName is a synonym for a Meta Value string. For example, the names of relations or the column headers in CSV data are represented and can be accessed using Meta Values. A Meta Value String literal has the form of an identifier prefixed with a colon, such as :title.

Meta Value Strings are also used to represent relation names in modules. For example, the partial application Graph[:edge] may be used to access the relation called edge in the module Graph:

module Graph
def node {1; 2; 3; 4}
def edge {(1,2); (2, 3); (3, 4); (4, 1)}
end
def output { Graph[:edge] }

## Rule

A declaration that specifies how to populate a named relation with a set of tuples which is computed from a given logical rule.

For example, this rule says that R should contain every integer from 1 to 10:

def R(x): range(1, 10, 1, x)

Rule is a synonym of definition.

## Scalar Conversion

The application of an operation element-wise across sets, yielding a result comprising all possible outcomes of the operation on elements from the given sets.

For example, the expression {1; 2} + {10; 20; 30} evaluates to a relation containing six elements: {11; 21; 31; 12; 22; 32}. Each of these six sums is the result of adding an element in the first set to an element in the second set.

## Schema

How data in a database are organized.

## Schema Mapping

Transforming data from one schema to another.

## Semantic Stability

One of the benefits of using Graph Normal Form: because a collection of relations in Graph Normal Form is fully broken down into indivisible facts, schema changes can be applied without having to split relations to accommodate those changes.

For example, a wide table storing many one-to-one relationships must be split into two tables if circumstances change so that one of the relationships becomes one-to-many.

## Set

An unordered collection of objects that does not contain duplicates.

A variable introduced in a particular scope shadows any variable with the same name in an outer scope.

## String

A sequence of characters. For example, the string "Hello" is a string consisting of the five characters 'H', 'e', 'l', 'l', and 'o'.

## String Interpolation

A Rel language construct for embedding a value into a string. For example, if you have a singleton relation name that contains the string "Alice", you can embed it into a string like this: "Hello %(name)!".

## Subrelation

A relation that may be accessed from another relation via partial application with a meta value. For example, if first[store] contains the Symbols :office and :product, then store[:office] and store[:product] are subrelations of the module store.

## Syntax

The textual form of a construct in a language. For example, the Rel syntax for defining a relation involves using the keyword def.

## Ternary Relation

A relation of arity 3. In other words, a ternar relation is a relation whose tuples are triples.

## Type Relation

A relation that represents a set of all values of a particular type.

For example, Int is a built-in relation that represents the set of all integers. A user-defined relation with a name like Customer would typically represent the set of all customers.

## The Relational Model

An organizational structure for databases wherein all data are organized into sets of tuples.

## Things Not Strings

A catchphrase for the idea that elements in the database should be represented in a way that encodes their meaning.

Specifically, a database is said to satisfy the “things not strings” principle if it is possible to determine whether two elements in the database are intended to refer to the same real-world concept by doing an equality comparison between the two elements.

## Transaction

A unit of work that takes the database from one state to another. Transactions happen atomically, meaning that either the entire transaction succeeds or it fails and the database is left unchanged.

## Tuple

An ordered list of elements. For example, the tuple ("AcmeCo", 1920-06-21) is a tuple containing two elements: the string "AcmeCo" and the date 1920-06-21.

## Unary Relation

A relation of arity 1. In other words, a unary relation is a relation whose tuples contain a single element.

## Underscore

A synonym of Any, the infinite relation that contains every element.

After further rewriting, this typically becomes an existential quantification of a variable with a unique name. Underscore is often used when you do not care about certain arguments of a relation and want to avoid introducing a named variable and quantifier.

// Unary relation of all orders with a line item:
{ (order): line_item(order, _) }

## Ungrounded Variable

A variable v is said to be ungrounded when the query engine cannot determine that v represents an element of a finite set of values.

## Union

An operation that combines two relations into a single relation that contains every tuple that is in either of the original relations.

## Universal Quantification

A logical operation expressing the idea that every value of a particular variable makes a particular expression evaluate to true. For example,

def R {1; 2; 3}
def output { forall((x in R ) | x > 0) }

## Use Declaration

A language construct in Rel that allows you to import relations from a module into the current scope:

module store
def office {"Boston"; "New York"; "Los Angeles"; "Chicago"}
def product {(1, "Laptops"); (2, "Desktops"); (3, "Phones")}
end

module summary
with store use office, product

def num_offices { count[office] }
def num_products { count[product] }
end

## Value Column

A column in a relation that is not part of the relation’s key.

## Value Type

A custom type for database elements. For example, rather than representing a distance using a floating point number, you can represent the element in a way that includes both the quantity and the unit:

def UnitOfDistance { :in ; :cm ; :km ; :mile }
value type UDistance  {(UnitOfDistance, Float)}
def dist {(:A, :B, ^UDistance[:cm, 100.0])}
def dist {(:B, :C, ^UDistance[:in,  50.0])}

## Varargs

A mechanism to write code that works for multiple arities, where x... matches zero or more elements of a tuple. For example, the stdlib defines first and last as:

@inline
def first({R}, x): exists((y...) | R(x, y...))

@inline
def last({R}, y): exists((x...) | R(x..., y))

## Variable

An identifier in a Rel declaration that acts as a placeholder. For example, in the rule def drivers_license_eligible(person) { age[person] ≥ 16 }, the variable person is a placeholder: any element may be considered as a possible value for person, and if age[person] ≥ 16 evalutes to true, then the rule tells you that the element is a person who is eligible to get a driver’s license.

## Vector

A data structure which represents an ordered list of elements.

Vectors are represented in Rel as binary relations. The first column is the array index, and the second column is the value at that index:

def A {
(1, 4.2);
(2, 18.0);
(3, 3.14);
(4, 11.0);
(5, 7.5)
}

## Write Query

A query that is allowed to modify base relations in the database.

## Write Transaction

A transaction that is allowed to change the state of the database by modifying base relations.