Playground Documentation Challenges Full Docs

Atoms

Values, functions, and named entities

Overview

Atoms are the named entities in Formall — constants, variables, and functions. They are declared using the for command and always have an associated type.

for(atomName: type)for(atomName1, atomName2: type)for(atomName1: type1; atomName2: type2)for(atomName: [argumentTypes -> resultType])
atomName
The name of the atom: letters, digits, any non-ASCII symbols (∀, ➕, 𝔹) and _ ! $ % & ' = ? @ ` ~ + ^ - (not before >) and *; not spaces or the characters of the syntax ( ) [ ] { } < > , : ; | ". . is reserved for namespaces.
type
A declared type, or a function type [argumentType1, argumentType2 -> resultType].

Basic examples

Simple Atoms

Simple atoms represent values of a given type:

Declaring simple atoms

▶ Run

More compact declaration

▶ Run

Function Atoms

Functions are atoms with function types. They can take arguments and return values:

Function declarations

▶ Run

Calling Functions

Functions are called with parentheses. Constructors create anonymous functions using {varName: Type | expression}:

Function application and constructors

▶ Run

Atom Naming

Atom names can include letters (including Unicode: Greek, Cyrillic, mathematical symbols like ×, =, ∈, ➕), digits (in any position), and underscores. However, the symbols +, -, *, ^ are reserved for label operations and cannot be used in atom names.

Naming examples

▶ Run

Scoping Rules

Atoms are scoped to their declaration for command. Inner for can shadow outer atoms:

Atom scoping

▶ Run
⚠
When an atom is shadowed, the outer atom is completely inaccessible in the inner scope. Choose unique names when you need both.

Atoms vs Labels

Don't confuse atoms with labels:

  • Atoms — declared with for, have types, appear in expressions
  • Labels — declared with +, store statements, used in proof commands

Atoms vs Labels

▶ Run