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
More compact declaration
Function Atoms
Functions are atoms with function types. They can take arguments and return values:
Function declarations
Calling Functions
Functions are called with parentheses. Constructors create anonymous functions using {varName: Type | expression}:
Function application and constructors
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
Scoping Rules
Atoms are scoped to their declaration for command. Inner for can shadow outer atoms:
Atom scoping
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