Complete Quick Reference · Print-Ready

Axioma Cheatsheet

Every construct in the Axioma language in one concise, printable desk reference — from bindings, exact numerics, sets, and pattern matching to concepts, 18+ logic systems, Z3/ASP solver blocks, belief revision, concurrency, and full Symbol + A–Z Keyword indexes. Generated from Axioma Cheatsheet.md.

⚡ 24 sections (24 subtables) · 264/264 keywords indexed · verified runnable examples. Symbol Index ↓A–Z Index ↓ Read the FAQ →

Complete, pithy reference to every Axioma language form, operator, type, logic engine, knowledge construct, and tool — built for printing, rapid scanning, and jumping into the Manual or Textbook. For cross-language rationale and gotchas, see the Axioma FAQ.

Jump to Quick Indexes: §23 Symbol, Sigil & Operator Index · §24 A–Z Keyword & Form Index


1. CLI, REPL, Comments, Pragmas & Glyph Input

Manual §2, §3, §24, §25, §26

CLI Flags & Execution Modes

Command / Flag Action
axioma / axioma --repl Interactive REPL (--no-kb fast isolated startup by default)
axioma file.ax / axioma -e 'expr' Run script or inline code in reference tree-walking evaluator
axioma --vm file.ax Run in bytecode VM (§911: byte-equal to evaluator or explicit refusal)
axioma --typecheck [--run] file.ax Static type, schema, contract & definite-initialization check (optional run)
axioma --strict file.ax / axioma --infer file.ax Strict static checking / polymorphic Hindley–Milner type inference
axioma -t / axioma --test file.ax Verify inline #> doctest assertions
axioma --kb / axioma --kb-path p.db / --no-kb Attach ~/.axiomakb/axiomakb.db, custom SQLite KB, or force clean memory
axioma --project dir_or_json Run using axioma.json ({"version": 1, "entryPoints": ["app.ax"]})
axioma --fmt / --glyphify / --asciify Format source; convert ASCII keywords ↔︎ Unicode math glyphs (∈, ∀, ⊓)
axioma --ast / --annotate Print parsed AST / generate literate Markdown or HTML documentation
axioma --language axioma/beginner / --mode ... Teaching subset (axioma/beginner, axioma/hm) or paradigm overlay
axioma --learn / --recipe / --mcp Interactive learning/design wizards; stdio MCP server

REPL Meta-Commands

Command Purpose
:help · :exit / :quit Show REPL command help; exit session
:source file.ax · :refresh Execute file into current session; replay loaded sources
:type expr · :ast expr Show static/runtime type or parsed AST of expr
:bindings · :concepts · :relations · :stack Inspect live session bindings, Concepts, Relations, or global stack
`:compare expr1 expr2`
:kb · :kb slice · :kb validate Inspect persistent KB status, syntactic locality slice, or TBox validity

Comments, Literate Docs, Doctests, Pragmas & Glyph Digraphs

Form Meaning
# comment · // comment Single-line comment (both canonical and C-style accepted)
/* ... */ · /**md # Heading ... */ Multi-line block comment; literate Markdown doc block (axiomadoc)
expr #> expected_value Self-testing inline doctest checked by axioma -t
#language axioma/hm File-top pragma selecting closed Hindley–Milner typed subset
`in ∈ · `notin ∉ · `forall ∀ · `exists ∃ · `alpha α Backtick glyph digraphs (tab-completable in REPL & editor; symbols() lists all)
# Line comment
// Alternative line comment
/**md
## Square helper
Computes $n^2$ exactly.
*/
sq(n) = n * n
sq(12)   #> 144
expect sq(12) == 144

2. Bindings, Declarations, Scope & Vocabulary Aliasing

Manual §3, §19.11 · Textbook Ch. 2, Ch. 16

Form Mutability & Scope Rule
x: 10 · x = 10 · x := 10 Find-or-update: updates outer x in blocks/loops; creates local x inside func
a, b: b, a · a, b = 1, 2 Parallel multi-assignment (evaluates all RHS values before writing targets)
let x = 10 · val x = 10 Fresh immutable binding in current scope; shadows outer x; refuses writes
var x = 10 · local x = 10 · let mut x = 10 · let mutable x = 10 Fresh mutable binding in current scope; shadows outer x without modifying it
let x = 1, y = x + 1 · var a = 1, b = 2 Left-to-right declaration list (works with let, val, var, local, const, global, rebind)
var x :: Integer · local s :: String Uninitialized typed slot (checked before read statically by --typecheck & at run time)
let x :: Integer = default Initializes to designated type starting value (0, 0.0, "", false, [], {}, {:})
const MAX = 100 · const W, H = 640, 480 · const K :: Float = 1 Top-level constant (cannot be reassigned or shadowed; retired alias given hints const)
declare x :: T = expr · let/lazy x = expr · val/lazy x = expr · lazy val x = expr · lazy let x = expr Fresh immutable recursive call-by-need binding (declare/persist for snapshots): defers expr, checks/converts :: T on first read, and caches a successful result (retries on error; statement yields none)
lazy expr · force(v) · memoize(fn) First-class deferred thunk value, explicit forcing, and call memoization
rebind x: val · rebind x += 1 Updates nearest enclosing lexical binding x from inside a closure/nested function
global x = val · global x Reads/writes module/file-level binding x from inside a func
(a, b): pair · [h, ...t]: arr · {name, age}: rec Tuple, sequence, and dictionary pattern destructuring (_: discard target, never bound)
expr where [ a: 1; b: 2 ] / trailing where Body-local helper binding section
$let · $end · $"interest rate" Guarded identifier — escapes any reserved word or spaced identifier name
:name REBOL get-word — fetches value/function bound to name without invoking zero-arg calls
alias plus = + · alias whilst = while · unalias plus Extend vocabulary for fresh names (keywords, operators, builtins, bound words; never shadows)
x/persist: val · concept/persist C Persistence refinements for --kb sessions
let base = 10, offset = base + 5
var acc = 0
bump: func() [ rebind acc += base ]
bump()

$"tax rate": 8%
alias add_op = +
sum_val: 3 add_op 4
unalias add_op

var rate = 2
lazy val cached_total = 10 * rate
let/lazy pair_l, pair_r = pair_r + 1, 41
rate = 3
first_read: cached_total
rate = 4

expect offset == 15 and acc == 10 and $"tax rate" == 8% and sum_val == 7
expect first_read == 30 and cached_total == 30 and pair_l == 42

3. Primitive, Machine, Text, Binary & Domain Scalars

Manual §4 · Textbook Ch. 1, App. A

Type (@x / x is T) Literals & Constructors Key Semantics & Properties
Integer 42, -7, 1_000_000, 0xff, 0b1010, 0o77, integer("42") Arbitrary-precision big.Int (never overflows); bit_length(n), integer_digits(n, base)
Rational 1 / 3, rational(1, 3) Exact reduced fraction (numerator(r), denominator(r))
Float 3.14, 1.0, 6.02e23, float(x), inf, infinity (∞) IEEE-754 float64 (1.0 keeps .0 display; nan?, infinite?; infinity is symbolic Infinity)
Complex complex(3, 4) Complex number (real(z), imag(z), conj(z), abs(z))
Int, Int8..Int64, Uint, Uint8..Uint64 int(5), int64(5), uint8(255) Fixed-width machine integers (checked construction; width-wrapping arithmetic; sizeof(Int64) == 8)
Float32, Float64, Byte, Rune float32(1.5), float64(1.5), byte(65), rune('λ') Machine floats, 8-bit octet (0..255), Unicode scalar value
Boolean (Bool) true, false, boolean(x), bool(x) Two-valued truth (make(Boolean) → false)
None / Om / Na none · om / Ω · na (NA) Three distinct non-values: absence (none; retired null/Null/nothing hint none/None), undetermined (om), missing cell (na)
Character 'a', 'λ', chr(955), character(955) Single Unicode codepoint; ordinal ('a'..'z', succ('a'), pred('b'), c++, codepoint(c))
String "hi", """multi""", r"\d+", f"{x}", rf"..." UTF-8 text; 1-based rune indexing s[1], len(s) in characters, sizeof(s) in UTF-8 bytes
Template t"Hello {user}" Captured structured template (html.render(t"<b>{untrusted}</b>") escapes fields)
Bytes b"ABC", b"\x00\xff", bytes([65, 66]) Immutable 1-based byte sequence (pack, unpack, hex escapes)
Money $19.99, USD$10, EUR$5, money(20) Exact big.Rat currency ($0.10 + $0.20 == $0.30; refuses cross-currency +)
Percent 15%, percent(15) Exact rational percentage (200 * 15% == 30)
Quantity (Units) 5 * kg, qty(9.8, metre / sec^2), unit m = metre Exact SI/custom dimensional quantities (as_unit(5 * kg, gram), mag(q), dim(u))
Date / Time 2026-12-05, 14:30:00, date(s), time(s) .year, .month, .day / .hour, .minute, .second; datetime.now(), datetime.today()
URL / Email / File https://axiomalang.org/p, [email protected], %data.csv Structured .scheme/.host/.path, .user/.domain, path %file (url, email, file coercions)
Pair 'x => 10, pair("k", 1) Key-value pair (p.key, p.value, p[1], p[2])
Word / Tag 'symbol · <div class="x"> / <br/> Symbolic quoted atom (Word); XML/HTML markup tag literal (Tag)
Command / NL / CL / NSM c"echo hi" · <free text> · <<Socrates loves wisdom>> · <<|someone thinks something|>> Command literal, natural-language chunk, Lojbanic constrained-language clause, NSM semantic-prime explication
unit m = metre
speed: (100 * m) / (10 * sec)
u: https://axiomalang.org/manual.html
dt: 2026-12-05

expect (na is Na) and (na != none) and (na != om)
expect as_unit(2 * kg, gram) == 2000 * gram and dim(metre / sec) == "m/s"
expect u.host == "axiomalang.org" and dt.year == 2026
expect ('a'..'d').array() == ['a', 'b', 'c', 'd'] and str(infinity) == "∞" and inf > 10.0

4. Constructors, Conversions, Defaults, Pointers & References

Manual §4, §21 · Textbook Ch. 16

  • TitleCase vs lowercase rule: TitleCase (Integer, Array, Date, Int64) denotes the Type/Concept value; lowercase (integer(x), array(x), date(s), int64(x)) calls the conversion/constructor.
  • Nullary constructor rule: Nullary t() exists iff T is a container with a unique empty identity (array(), set(), tuple(), dict(), bytes(), bag(), stack(), graph()). Scalar conversions (integer(x), boolean(x), date(s)) require an input; use make(T) or = default for starting defaults.
Form Meaning
make(T) · make(T, val) Construct T's designated default (make(Integer) → 0, make(Boolean) → false) or val typed as T
types() Dictionary mapping built-in & user types to their starting value (or om if none exists)
&x · &xs[i] · &obj.field Take a live Reference (*T / Reference of T) to variable, element, or field
*p · *p = new_val Dereference pointer p to read or mutate target cell
ref(val) · ref(Type, val) · ref(make(Type)) Allocate a fresh anonymous heap cell (untyped or type-checked *Type)
p.kind · p.name · p.index Introspect reference target kind ("binding", "index", "property"), name, or slot
copy(x) / deep_copy(x) Independent deep copy of mutable nested collections/records
var x :: Integer = 10
ptr: &x
*ptr += 5
typed_cell: ref(Float, 3)     # promotes 3 -> 3.0 and enforces Float on future writes
*typed_cell = 4.5

expect x == 15 and *typed_cell == 4.5 and ptr.kind == "binding"

5. Collections: Arrays, Lists, Tuples, Sets, Bags, Dicts & Stacks

Manual §5, §7, §18 · Textbook Ch. 6–9

Overview & Literals

Type Literal / Empty Mutable? Indexing & Essential Operations
Array [10, 20] · [] / array() · 1-elem [x,] Yes (Readonly Array of T locks) 1-based xs[1], xs[-1]/xs[$], xs[1:2], push, pop, insert_at, remove_at, +:/:+, +
Slice var s :: Slice of Uint8 = [10, 20] Shared typed view 0-based s[0], s[1..<2] mutates underlying storage
Array[D] var a :: Array[0..<3] of Integer · Array[R, C] of Float Fixed domain Custom/enum/0-based or multi-axis index domains (indices(a))
List `[1, 2, 3] · `[] · `[1..5] Immutable cons-list 0 +: l, cons(0, l), head/first, tail/rest (direct ranges expand; bound r stays 1 element; refuses push/pop)
Tuple (1, "a") · () / tuple() · 1-tuple (1,) Immutable fixed-arity 1-based t[1], pattern (a, b) = t
Set {1, 2, 3} · {} / set() / ∅ Value (add! rebinds) Canonical deterministic walk; {2, 4, ..., 10} & infinite {2, 4, 6, ...}; s[1] positional read
Bag bag([1, 1, 2]) · bag() Multiset count(b, 1) → 2, count(b) → 3
Dictionary {a: 1, "b": 2} · {:} / dict() Insertion-ordered (Readonly locks) d.a, d["b"], { d with a: 9 } functional update, extend(d, d2), delete(d, "b"), map_values, filter_items
Stack stack([1, 2]) · stack() · a Stack LIFO mutable + global stack Verbs: s push x, s pop, dup, swap, over, rot, nip, tuck, drop, clear; reads: s's top, s's depth, s's empty, s's items, pop(s)

Set Theory Operators & Constants

Math / ASCII Meaning Math / ASCII Meaning
x ∈ A · x in A Element membership (A contains x) A \ B · A diff B · A difference B Set difference
x ∉ A · x notin A · x not_in A Non-membership A △ B · A ⊖ B · A symdiff B · A symmetric_difference B Symmetric difference
A ∪ B · A union B Union A ⊆ B · A subset B · A ⊇ B · A superset B Subset / superset
A ∩ B · A intersect B · A intersection B Intersection A ⊂ B / A ⊊ B (proper_subset / subsetneq) · A ⊃ B / A ⊋ B (proper_superset / supsetneq) Proper subset / superset
∅ ({}) · ℕ · ℤ · ℝ Empty, natural, integer, and real set constants powerset(A) · cartesian(A, B) Power set 𝒫(A) & Cartesian product

Universal Accessors, Receiver Chains & Place Mutators (!)

  • Possessive & unary-dot equivalence: xs.sum ≡ sum(xs) ≡ xs's sum; ordinal getters first..tenth, last, length, indexed.
  • Higher-order verbs (Iterable): map, filter, reject, reduce/foldl/foldr, flat_map, flatten, for_each, find, any?, all?, none?, count_by, group_by, partition, zip, zip_with, scanl, scanr, iterate, unfold, span, take, drop, sort, unique, reverse.
  • In-place ! mutators on variables: reverse!(xs), unique!(xs), shuffle!(xs), add!(set_var, elem).
expect `[1..10..2] == `[1, 3, 5, 7, 9]
r_step: 1..10..2
expect len(`[r_step]) == 1

evens: {2, 4, ..., 10}
rec: { name: "Ada", role: "analyst" }
rec2: { rec with role: "lead" }

expect evens == {2, 4, 6, 8, 10} and ({1, 2} ⊂ {1, 2, 3})
expect rec2.role == "lead" and rec.role == "analyst"
expect [10, 20, 30]'s second == 20 and [1, 2, 3].sum == 6

6. Ranges, Lazy Sequences, Matrices, Tensors, Graphs & Trees

Manual §4, §5, §13 · Textbook Ch. 6, Ch. 17

Type / Form Syntax & Operations
Range 1..10 (inclusive), 1..<10 (half-open), 1..10..2 or 1..10 by 2 / (1..10).by(2) (stepped), 10..1 (descending), 1.. (open infinite), 'a'..'z' (Character); keeps Range under r[2:4] & reverse(r); .start/.end (written bounds) vs .first/.last (visited values), step(r)
Generator & Sequence each(xs) · (x * 2 | x <- 1..) · xs.sequence.sequence_map(f).sequence_filter(p).sequence_take(5).sequence_drop(1).sequence_zip(ys) (materialize via collect(seq))
Matrix & Tensor matrix([[1, 2], [3, 4]]) · tensor(...) · m[r, c]; exact det(m), inv(m), transpose(m); elementwise .+, .-, .*, ./, .^, .%, .÷
Graph, Digraph & Tree g: graph(), dg: digraph(), t: tree("root"); node, edge, nodes(g), edges(g), bfs(g, start), dfs(g, start), astar(g, start, goal)
r: (1..20).by(3)
lazy_top: (1..1000).sequence.sequence_map(x => x * x).sequence_filter(x => x > 10).sequence_take(3)
m: matrix([[1, 2], [3, 4]])

expect r.first == 1 and r.last == 19 and r[2:3] == 4..7..3
expect collect(lazy_top) == [16, 25, 36]
expect inv(m) * m == matrix([[1, 0], [0, 1]])
ew_prod: [1, 2, 3] .* [10, 20, 30]
expect ew_prod == [10, 40, 90]

7. Comprehensions, SQL-Style Clauses & Generalized Aggregators

Manual §7 · Textbook Ch. 7, Ch. 10

Comprehensions build Sets ({ ... }), Arrays ([ ... ]), Dictionaries ({ k: v | ... }), or lazy Generators (( ... )) using pipe | or ISO colon : separators, <- or ∈/in generators, destructuring, local := walrus bindings, and SQL-style post-clauses:

Form Syntax Example
Set / Array / Dict { x^2 | x <- 1..5, x mod 2 == 1 } · [ x + y | x <- 1..2, y <- 10..11 ] · { w: len(w) | w <- words }
British / ISO colon { x : x ∈ 1..10, x > 7 } ({8, 9, 10})
Destructuring & Local Bind [ k + "=" + str(v2) | (k, v) <- items(d), v2: v * 2, v2 > 10 ]
orderby, having, limit, offset [ u.name | u <- users, orderby u.score desc, orderby u.name asc, having u.score > 0, offset 1, limit 3 ]
Relational & Grounding tag filter { X | X <- ancestor("ada", X) } · [ X | X <- claim(X), #axiom ]
Concept extent & Russell ι { p.name | p <- Person, p.age >= 18 } · the Person where age >= 18
Math & Set Aggregators ∑(x <- 1..5 | x^2) · ∏(x <- 1..4 | x) · ⋃(s <- sets | s) · ⋂(s <- sets | s)
rows: [{name: "Ada", pts: 95}, {name: "Bob", pts: 70}, {name: "Cy", pts: 88}]
top2: [ r.name | r <- rows, bonus: r.pts + 5, bonus >= 80, orderby bonus desc, limit 2 ]
iso_set: { n : n ∈ 1..6, n mod 2 == 0 }

expect top2 == ["Ada", "Cy"] and iso_set == {2, 4, 6}

8. Operators: Arithmetic, Bitwise, Comparison, Logical & Precedence

Manual §6 · Textbook Ch. 1–3, App. A

Complete Operator Reference

Family Operators & Meanings
Arithmetic +, -, *, / (exact Rational on Integers), fdiv(a, b) (Float), div / idiv / quotient / ÷ (floor integer), trunc(x) (toward 0), % / mod, ^ / ** (power), postfix n! (factorial: 5! == 120)
Step & Compound Assign Postfix statements i++, i-- (numbers & Character); +=, -=, *=, /=, %=, **=, ??=, ???=
Bitwise (Integer / Byte) Infix words band, bor, bxor, bshl, bshr (+ prefix bnot(x)) — no symbol collision with & pointers or ^ power
Equality, Order & Identity ==, !=, <, <=, >, >=, chained 1 <= x < 10, <=> (-1/0/1), === / !== / same? / identical? / is/same, is (membership/subsumption), <: (subtype)
Logical (MVL-dispatching) not / ¬ / !, and / && / ∧, or / || / ∨, xor / ⊻, nand / ⊼ (Sheffer), nor / ⊽ (Peirce), implies / impl / → / ⇒, iff / ⇔, therefore / ∴, because
Strict 2-Valued & Eager andalso, orelse (always coerce via truthiness & short-circuit to Boolean); `&&, `|| (always evaluate both sides)
B4 Knowledge Order a ⊕ b (information join / gullibility), a ⊗ b (information meet / consensus)
Coalescing, Safe Nav & Ternary c ? a : b · a ?? b (fallback on none) · a ??? b (fallback on none or om/Ω) · a otherwise b / a or else b (fallback on Error) · a?.b, a?.[i], `[
Pipes & Broadcast x |> f (forward pipe: x |> f(a) ≡ f(a, x)), x |?> f (short-circuits on Error/none/om), f.(xs) (fused broadcast)
Backtick & Custom Operators a `f` b ≡ f(a, b) for any binary function; operator (<|>)(a, b) = ... declares custom symbolic infix
x: none
y: om
expect (x ?? 10) == 10 and (y ?? 10) == om and (y ??? 10) == 10
expect 5! == 120 and (6 band 3) == 2 and (1 bshl 4) == 16
expect (true ⊼ true) == false and (false ⊽ false) == true
expect (10 <=> 20) == -1 and (1 < 5 <= 5)

9. Strings, Regular Expressions, Formatting & Templates

Manual §4, §22 · Textbook Ch. 1–2, App. A

Category Builtins & Syntax
String & Char ops s + t, s * n, len(s), s[i], s[i:j], chars(s), lines(s), words(s), split(s, sep), join(arr, sep)
Case & Padding upper, lower, title, capitalize, swapcase; pad_left(s, w [, ch]), pad_right, center
Trim & Search trim, trim_start, trim_end, remove_prefix, remove_suffix; contains?(s, sub), starts_with?, ends_with?, index_of(s, sub [, init]), span_of(s, sub [, init]), replace(s, old, new), normalize(s [, "NFC"])
Formatting & HTML f"val={x}", "%04d".format(7), format("%s=%d", "k", 1) / stringf / printf; t"Hi {name}" + html.render(tmpl)
Cached RE2 Regex s =~ pat (returns capture Dictionary {match, "1".., <named>} or none), s !~ pat (Boolean), regex_match(s, pat) (Boolean), regex_find, regex_find_all(s, pat [, limit]), regex_find_all_groups(s, pat [, limit]), regex_replace(s, pat, str_or_fn [, count]), regex_split(s, pat [, limit]), regex_span(s, pat [, init]), regex_escape(s)
import "html"
m: "2026-12-05" =~ r"(?P<yr>\d{4})-(\d{2})-(\d{2})"
masked: "a1 b22 c333".regex_replace(r"\d+", d => "#" * len(d.match), 2)
raw_tag: "<script>"
safe_html: html.render(t"<p>{raw_tag}</p>")

expect m.yr == "2026" and m["2"] == "12"
expect masked == "a# b## c333"
expect safe_html == "<p>&lt;script&gt;</p>"

10. Functions, Lambdas, Clauses, Composition & Three Notations

Manual §12, §19 · Textbook Ch. 4, Ch. 10

Definitions, Parameters, Clauses & Refinements

Form Syntax
Equation & Miranda guards f(x) = x + 1 · sgn(x) = -1, if x < 0 / sgn(x) = 0, if x == 0 / sgn(x) = 1, otherwise
Multi-clause & Arity overload fib(0) = 0 / fib(1) = 1 / fib(n) = fib(n-1) + fib(n-2) · norm(x) = abs(x) & norm(x, y) = sqrt(x^2 + y^2)
Block & End-form functions func add(a, b) [ return a + b ] · func add(a, b) { a + b } · function add(a, b) ... end (fn, fun, function aliases; last expr or explicit return)
Lambdas & Member chains (a, b) => a + b · x -> x * 2 · \x -> x * 2 · lambda(x) [ x + 1 ] · &.name / \.name / λ.name · func | 0 -> "z" | _ -> "nz"
Rich Parameters Defaults f(x, k = 1), variadic f(...xs), named-rest f(**kw) / f(..kw), by-name f(expr/lazy), destructuring f((a, b)), call splats f(...arr, **opts)
Refinements & Pragmas func take_items(xs, /limit n = 5) [ ... ] called via take_items/limit(xs, n: 2); pragmas /nodiscard, /deprecated, /sensitive, void(expr)
Generics & Named Results func id[T](x :: T) :: T [ x ] · func swap_pair[A, B](p :: (A, B)) -> (out :: (B, A)) { out = (p[2], p[1]) }

Composition, Combinators & Three Notations, One Tree

  • Composition: (f >> g)(x) ≡ g(f(x)) (forward / compose(f, g)); (f << g)(x) ≡ (f ∘ g)(x) ≡ f(g(x)) (backward / math ring).
  • Point-free combinators: on(cmp, key) (on(+, len)("hi", "there") == 7), via(act, fwd, inv [, val]) / f ⌾ g (transform under g, apply f, invert g), converge(join_fn, [branch1, branch2]), partial, curry, flip.
  • Operator values, sections & folds: (+) (value), (+ 1) / (10 -) (sections), (+/)(0, xs) (seeded left fold), foldr(-, 0)(xs) (right fold).
  • Three Notations, One AST: Infix 3 + 4 * 2, Prefix +(3, *(4, 2)), and Postfix body [3, 4, 2, *, +] all evaluate to 11.
inc(x) = x + 1
dbl(x) = x * 2
add_lengths: on(+, len)
postfix_demo() = [ 3, 4, 2, *, + ]

expect ((dbl >> inc)(5)) == 11 and ((dbl ∘ inc)(5)) == 12
expect add_lengths("hi", "there") == 7 and via(x => x + 1, x => x * 2, x => x / 2, 5) == 11/2
expect (+ 10)(5) == 15 and (+/)(0, [1, 2, 3, 4]) == 10 and postfix_demo() == 11

11. Control Flow, Blocks, Loops & Scoped Cleanup

Manual §6, §25, §29 · Textbook Ch. 2a

Construct All Supported Spellings
Blocks [ s1; s2 ] (in body slot) · { s1; s2 } (after header) · begin s1; s2 end (explicit anywhere; block value = last statement)
Conditionals if c then a else b · if c [ ... ] else [ ... ] · if (c) { ... } · if c ... elseif c2 ... else ... end · unless c [ ... ]
Multi-way cond & switch cond | c1 => e1 | else => e2 · switch x { case 1 => ... default => ... } (fallthrough / next case opts into fallthrough)
Collection for / foreach for x in xs [ ... ] · foreach x in xs { ... } · for x in xs ... end
Indexed, Key-first & Pointer for for x at i in xs [ ... ] · for x with index i in xs [ ... ] · for k, v across d [ ... ] · for elem_ptr in &arr [ *elem_ptr += 1 ]
Three-clause for & while for i := 0; i < n; i++ { ... } · while cond [ ... ] / while cond ... end
repeat & loop repeat 5 [ ... ] · repeat [ ... ] until cond · repeat ... until cond end · loop [ ... break val ]
Labeled break / continue 'outer: for x in xs [ for y in ys [ if x == y then break 'outer ] ] (break expr yields value from loop)
Managed Cleanup defer [ ... ] (LIFO on scope exit) · defer/error [ ... ] (on error exit only) · with r = acquire() [ ... ]
nums: [1, 2, 3]
for p in &nums { *p *= 10 }

found: 'search: loop [
  for x at idx in nums {
    if x == 20 { break 'search (idx, x) }
  }
  break none
]
expect nums == [10, 20, 30] and found == (2, 20)

12. Pattern Matching, Extractors & Sequence Patterns

Manual §6, §33 · Textbook Ch. 5, Ch. 11

Pattern Kind Syntax Example
Match expressions & tests match v with | p1 => e1 | p2 when g => e2 (no end) · case v | p1 => e1 end · if Some(x) = opt [ ... ] · v matches Some(_)
Wildcard, Literal, Bind, Pin & Alias _ · 42, "ok" · x (fresh capture) · ^pinned_var (equals existing binding) · 1..9 as digit
Alternatives, Ranges, Membership & Types 1 | 2 | 3 · 0..9 · n in {20, 30} · n is Integer
Tuple, Array, List & Multi-segment (a, b) · [head, ...tail] · [h | t] · seqpat [...prefix, 0, ...suffix] (bounded sequence search) · `[h, ...t]
Dictionary / Schema & ADT Constructors { type: "click", x, y = 0 } · Some(v) / Absent · Point(x, y)
Custom Extractor (TitleCase) Any TitleCase function returning Some(...) / Absent used as Mailbox(u, d) in a pattern arm
Mailbox(s) = match split(s, "@") with
  | [u, d] => Some((u, d))
  | _      => Absent

target: 99
pat_label(v) = match v with
  | ^target => "hit-pinned"
  | 1..10 as small_n => f"small:{small_n}"
  | n in {20, 30} => f"set:{n}"
  | Mailbox(u, d) => f"mail:{u}@{d}"
  | _ => "other"

expect pat_label(99) == "hit-pinned" and pat_label(5) == "small:5"
expect pat_label(20) == "set:20" and pat_label("[email protected]") == "mail:[email protected]"

13. Type System, Schemas, Structs, ADTs, Enums, Interfaces & Traits

Manual §4, §5, §13, §33 · Textbook Ch. 5, Ch. 12–15

Unified Type Declarations & Type Algebra (::)

Declaration / Type Expression Syntax & Meaning
Synonym & Opaque Newtype type Age = Integer · type PairOf[T] = (T, T) · type UserId = opaque Integer (UserId(7) wraps; distinct from Integer)
Structural Schema type PersonRec = { name :: String, age? :: Integer } (open vs closed field checking; recursive schemas allowed)
Product struct / record type Point = struct { x :: Integer, y :: Integer } · type Row = record { id :: Integer } (Point(3, 4) or Point(x: 3, y: 4))
Algebraic Sum data data Tree[T] = Leaf(v :: T) | Branch(l :: Tree[T], r :: Tree[T]) (also type T = data { ... }; --typecheck checks exhaustiveness)
Ordinal enum & Subranges Day enumerates Mon, Tue, Wed, Thu, Fri · Midweek extends Day in Tue..Thu · Percentage ranges 0..100
Behavior interface type Show = interface { render } + implement Show for Point as { render: func(p) [ ... ] } + dispatch(Show, "render", pt)
Method trait trait Printable { show_me: func() [ str(it) ] } + MyConcept uses Printable
Unions & Intersections Integer | String · Named & Aged / Named ⊓ Aged (merges schemas; empty Integer & String refused; (A -> B) & (C -> D) single-body contract)
Container & Function Types [T] (Array of T), Readonly Array of T, {T} (Set of T), {K to V} (Dictionary of K to V), Readonly Dictionary of K to V, *T (Reference of T), Slice of T, Promise of T, A -> B, [T of Number & Show]
Ascription, Detached & Type-of (expr :: Float) · detached f :: Integer -> Integer above f(x) = ... · :: expr (type value) · A <: B (subtype test) · annotations(f)

Built-in Option & Result Bridges

  • Seeded ADTs: Option (Some(value) | Absent) and Result (Ok(value) | Err(error)).
  • Helpers: to_option(x), from_option(opt, default), to_result(x), from_result(res), unwrap_or(x, default), map_ok, and_then, or_else.
Day enumerates Mon, Tue, Wed, Thu, Fri
Digit ranges 0..9

let d :: Day = Wed
let k :: Digit = 7
expect (d < Fri) and (k is Digit) and (Integer <: Number)
expect (:: 42) == Integer

14. Contracts, Property Testing (check), Bottoms, Errors & expect

Manual §12, §26, §29 · Textbook Ch. 4

Declarative Contracts & Randomized Verification (contract / check / prove)

clamp_pos: func(x :: Integer, hi :: Integer) :: Integer [ min(max(x, 1), hi) ]
contract clamp_pos {
  purpose:   "Clamp an integer into 1..hi."
  requires:  hi >= 1
  ensures:   result >= 1 and result <= hi
  examples:  [(5, 10), (-3, 4)]
  trials:    50
}
verdict: check clamp_pos      # Runs examples + randomized trials with shrinking -> ⊤ᵇ
expect verdict == ⊤ᵇ
  • Additional contract slots: old(expr) pre-state in ensures:, decreases: expr termination measure, effects: [kb, io, error], generate: fn, classify: fn, invariant: on Concepts, and prove fn symbolic verification.

Failure Policies, Errors as Values & Two-Tier Faults

Construct Behavior
Truthiness rule Only false, none, om (Ω), and undesignated MVL values (⊥ᵇ, ?ᵇ, ?ᵏ, …) are falsy. 0, "", [], {}, {:}, na, and Error are truthy!
error("msg") · error('kind, "msg") Construct a first-class Error value (.message, .kind, .stack, error?(e))
raise "msg" / throw err Raise a catchable runtime error (panic("bug") / Defects like AssertionError & PostconditionError bypass casual otherwise/attempt)
expr otherwise fb · attempt(expr) · try(expr) Evaluate expr; on recoverable error return fb, none, or the Error object itself
try ... catch e is Kind ... catch e ... finally ... end Structured multi-arm handler (also accepts { ... } / [ ... ] clauses; catch d is Defect catches defects)
expect expr [, "msg"] Silent on pass; /verbose logs PASS + summary; /strict raises AssertionError with 2D Power-Assert diagram; expect_cases runs named table rows; expect(label, actual, expected) functional form

15. The Concept System, KM Frames, Russell's is & Description Logic

Manual §13, §20 · Textbook Ch. 13–15

Concepts, Entities, Actions, Lifecycle & KM Forms

Form Meaning
concept C "doc" · concept C { slot: def } Declare an open-world Concept (with optional docstring or default slot block; concept/persist persists)
Dog extends Animal · C implements I · C uses Trait Subconcept inclusion (multiple parents allowed; retired inherits hints extends), interface & trait attachment
C has slot :: Type: default · every C has s: v Slot declaration (had past-slot query); C has tags/cumulative: v accumulates values
ada: a Person { name: "Ada" } · an Artist with name: "Ada" · entity Instantiate named or anonymous ([a Person { ... }]) Concept entities
action greet(who) for Person [ f"Hi {who} from {it.name}" ] Attach action to Concept (it binds receiver); call via ada.greet("Bob") or message `[
Adult defines { is Person and age >= 18 } · define Necessary & sufficient auto-classification predicate (ada is Adult computed live!) and schema define
Country identified by code · unify a with b Unique key identity & coreference merging of two entity handles
Animal partition Bird, Mammal · disjoint Declare mutually disjoint subconcepts
the Person where age > 30 · what is ada? Intensional class / definite description (ι); KM interactive frame query
suspend C · unsuspend C · unfreeze · destroy C Concept lifecycle management; introspection via ancestors(C), subconcepts(C), instances(C), responds_to?(x, "m")
constrain(...) · validate · satisfies · paraphrase(...) · annotation · document / documented Value constraints, axiom validate/satisfies checks, natural-language why templates, and ontology metadata

Russell's Three Meanings of "is" & ALC Description Logic

  • Predication: ada is Person (a ∈ C) · Class inclusion: Person is Agent (C ⊑ D, declared via extends) · Identity: a === b / a is/same b / same?(a, b) · Existence: there is x in Person | x.age > 30.
  • ALC Description Logic operators: Intersection C ⊓ D, Union C ⊔ D, Complement ¬C, Subsumption C ⊑ D (C subsumes D), Equivalence C ≡ D (C equivalent D), Top Thing, Bottom Nothing, existential/universal role restrictions, satisfiable(C), classify.
concept Asset
concept Equity extends Asset
Equity has ticker :: String: ""
Equity has pe :: Float: 0.0
ValueStock defines { is Equity and pe > 0 and pe < 15 }

acme: an Equity with ticker: "ACME", pe: 11.5
expect (acme is ValueStock) and (Equity is Asset) and (Equity ⊑ Asset)
expect [| "  axioma  " trim |] == "axioma"

16. Cognitive & Philosophical KR: CGs, Conceptual Spaces, NSM & Causes

Manual §13, §16, §30

Paradigm Language Forms
Conceptual Graphs (Sowa) g: <<<[Person: "Ada"]>>>, relational graph links -> / <-, operations connect, join, restrict, generalize
Conceptual Spaces (Gärdenfors) sp: conceptual_space("Color", "HSB"), add_dimension(...), add_prototype(...), nearest_prototype(sp, coords)
Natural & Constrained Language <natural text>, Lojbanic <<Socrates loves wisdom>> (infer, explain, count <<...>>), bilingual word definitions
NSM Semantic Primes (Wierzbicka) <<| someone wants something |>> universal semantic metalanguage explication literals
Aristotelian Predicables & Causes Predicables: essence (→ axiom), proprium (→ theorem), accident (→ datum), attribute, nominally, really; Four Causes: materially, formally, efficiently, teleologically, causally
Argumentation & Discourse Relations argues, entails, presupposes, contradicts, analogous, similar, different, partOf, relatedTo, taxonomy, observed_by
cg: <<<[Person: "Socrates"]>>>
cs: conceptual_space("Temp", "1D")
add_dimension(cs, "celsius", -50, 100)
add_prototype(cs, "freezing", [0])
add_prototype(cs, "boiling", [100])

expect nearest_prototype(cs, [4]) == "freezing" and cg != none

17. First-Order, Counting, Free, Lojban, Multi-Valued, Modal & Fuzzy Logics

Manual §8, §9, §10, §11 · Textbook Ch. 3, Ch. 8

Logic Family Syntax & Truth Values
First-Order & Counting Quantifiers forall x in S | P(x) (∀), exists x in S | P(x) (∃), there is x in S | P(x), unique exists! x in S | P(x) (∃!), universally, particularly, categorical every S is P / some S is P
Free Logic E!(x) existence predicate · x denotes denotation check (separates quantification from existence assumptions)
Lojban / Lojban++ Sub-language Quantifiers ro (∀), suho (∃), no (¬∃), pa (1), re (2), ci (3), vo (4), mu (5), sohu (few), sohi (many), soha (almost all), where; predicate place tags fi, fe, fu
Five Multi-Valued Logics Boolean (true, false) · Kleene K3 (⊤ᵏ, ⊥ᵏ, ?ᵏ / om) · Łukasiewicz L3 (⊤ˡ, ⊥ˡ, ?ˡ, continuous degrees) · Gödel G3 (⊤ᵍ, ⊥ᵍ, ?ᵍ) · Belnap B4 (⊤ᵇ, ⊥ᵇ, ?ᵇ gap, ⊤⊥ᵇ glut/conflict; knowledge ⊕, ⊗); truth tables via tableform(fn)
Alethic Modal Logic necessarily(p) (□), possibly(p) (◇), contingently(p), impossibly(p) (+ Kripke world models)
Temporal Logic (LTL) always(p), eventually(p), next(p), p until q, p since q
Epistemic & Doxastic Logic a: agent("alice"), believes(a, "rel", x), held-AST opaque believes(a, [logic | φ]), attitude_holds(a, [logic | φ]), beliefs_of(a), knows(a, "rel", x) / knows(a, [logic | φ]) (requires supporting fact), a doubts p
Deontic Logic a must "act", a ought "...", a should "...", a may "...", a must_not "...", permitted, forbidden
Probabilistic, Default, Fuzzy & SOL p with_probability 0.9, p probably 0.8; Reiter default birds typically fly, by_default; fuzzy_set("tall", [[175, 0.4], [190, 0.9]]) + membership(fs, x); finite Second-Order quantification over function sets
tall: fuzzy_set("tall", [[170, 0.25], [190, 0.9]])
alice: agent("alice")
_ : believes(alice, "rain", "today")

expect (⊤ᵏ and ?ᵏ) == ?ᵏ and (⊥ᵏ and ?ᵏ) == ⊥ᵏ
expect (⊤ᵇ ⊕ ⊥ᵇ) == ⊤⊥ᵇ and (⊤ᵇ ⊗ ⊥ᵇ) == ?ᵇ
expect membership(tall, 190) == 0.9 and beliefs_of(alice) == ["rain(\"today\")"]

18. Executable Logic Engines ([logic/… | …]), Proof Assistant & Reasoning

Manual §31, §32

[logic/<mode> | …] Solver Portfolio

  • [logic | φ] returns the held AST formula without running a solver; [logic/<mode> | φ] runs the fragment engine and returns a SolveResult (.result, .status, .complete, .model, .objective, .regime, .grounding, .justification).
Engine Mode Decidable / Target Fragment
[logic/holds | φ] · [logic/sld | φ] Closed fact-store check · Datalog / SLD relational resolution
[logic/sat | C] · [logic/asp | P] ALC Description Logic tableau satisfiability · Answer-Set Programming (NAF, choice, aggregates)
[logic/smt | φ] · [logic/valid | φ] Z3 quantifier-free equality, linear arithmetic, Money, Quantity, strings, ADTs, bitvectors, arrays
[logic/nra | φ] · [logic/nia | φ] · [logic/z3 | φ] Nonlinear real polynomials (nlsat CAD), nonlinear integers, full Z3 portfolio
[logic/optimize | φ; maximize(e)] Exact linear / MIP / bitvector / MaxSMT minimize & maximize optimization
[logic/prove | φ] · [logic/qe | φ] · [logic/chc | P] Quantified SMT (E-matching), symbolic quantifier elimination (AST), Constrained Horn Clauses (Spacer)
[logic/chase | P] · [logic/answer | P ? q] · [logic/model | Γ] · [logic/epr | φ] Datalog± existential chase, certain-answer querying, finite EPR model finder, decidable ∃*∀* Herbrand DPLL
[logic/ist | g, c: φ] · [logic/wmc | P] Contextualized ContextGraph + rule deduction (ist(g, c, [logic | φ])) · Exact Rational/Float Weighted Model Counting (p :: atom, annotated disjunctions p1 :: a1 | p2 :: a2, evidence)
[solver/advisor | ...] · [solver/cegis | ...] Axioma Advisor / Situation Calculus planner ([solver/advice | ...], can_do, | sense contingent plans) · Z3 Counterexample-Guided Inductive Synthesis & closed-loop neural repair (propose, ai.cegis_infer, theorem-certified)
[logic/smt2 | ...] · [logic/auto | φ] Raw SMT-LIB 2.6 passthrough with ${...} splices · automatic fragment classifier

Proof Assistant (lib/proof), Axioma Advisor (lib/advice), Neuro-Symbolic Core (ai / lib/neurosym) & Classical Reasoning Verbs

  • Proof kernel (import "proof" / import "proof.lemmas" / import "proof.zfc" / import "proof.godel" / import "proof.metamath"): Sealed theorem certificates via certify(steps, goal, premises) (exE, byThm, zfSep, zfRep, kfn), proved(thm), whyRejected(bad), showTheorem(lemContra), Kalmár completeness gProveComplete(f), and Metamath .mm / $d verification via mmVerify / mmVerifyFile.
  • Axioma Advisor & Causal do (import "advice" / import "advice.causal", realizes McCarthy's 1959 Advice Taker): Credal intervals (credal_interval, credal_envelope, credal_intersect), functional Situation Calculus (sit_action, sit_can, sit_result), and Pearlian Structural Causal Models (scm, scm_do parent-severing graph surgery, scm_observe_prob, scm_intervene_prob, scm_counterfactual).
  • Neuro-symbolic inference, autodiff & differentiable WMC (ai.* / import "neurosym", Manual §30.2): Schema-checked neural proposals ai.infer(prompt, TargetType [, opts]) (capped at "hypothesis"/"datum" grounding, with ai.cassette offline replay), closed-loop Z3 counterexample repair ai.cegis_infer(prompt, spec [, opts]) (@hypothesis → "theorem"), grounded dense/cassette/hashed embeddings ai.embed / ai.cosine / ai.soft_match, reverse-mode Wengert-tape grad(fn) / value_and_grad(fn), exact differentiable WMC (wmc_prob, semantic_loss, calibrate_wmc, plus [logic/wmc] inside grad), differentiable Product/Gödel/Łukasiewicz t-norms (soft_and, soft_or, soft_not, soft_implies), and gd_minimize.
  • Automated reasoning & meta-logic keywords: modus_ponens, modus_tollens, syllogism, derive, deduce, prove, query, refute, forward, contradiction, deductive, inductive, abductive, generate, consistency, completeness, decidability, metalogical.
held_f: [logic | x + 1 == 2]
import "proof"
import "proof.lemmas"
expect (@held_f == AST) and showTheorem(lemDne) == "⊢ (¬¬A → A)"
wmc_res: [logic/wmc | 1/2 :: open_a | 1/3 :: open_b; reach <== open_a or open_b; ? reach]
expect wmc_res.result == 5/6 and wmc_prob([[1, 2], [1, 3]], [1/2, 1/2, 1/2]) == 3/8
expect grad(func(x) [ x^3 + 2*x ])(3.0) == 29.0

19. Relations, Datalog/Prolog Modes, Rules, Grounding, qua & KB Revision

Manual §14, §15, §16, §17 · Textbook Ch. 8–9

Relation Regimes & Queries

Declaration / Query Semantics
relation r(x, y) (rel alias; r(x :: Person, C :> Agent)) Default deterministic set-based KB engine with Belnap B4 truth & 6-tier grounding (relation/strict enforces arg types)
relation/datalog r(x, y) Safe, range-restricted, stratified finite-domain bottom-up Datalog fixpoint
relation/prolog r(x, y) Ordered top-down SLD backtracking, unification, once, finite failure, cut (! / prune), tabling
assert/weight: 2 r(a, b) · [logic/datalog/minplus | (X, Y) <- r(X, Y)] Weighted Datalog: Dictionary answer → tag; semirings minplus (cost), maxtimes (best single path), maxmin (bottleneck), count (derivations), why (minimal witness sets), plus exact possible-world WMC [logic/datalog/prob | …]
{ (X, Y) | (X, Y) <- r(X, Y) } Set-comprehension pattern query (capitalized names are logic variables only in relations/rules/queries)
relation/datalog hop(x, y)
relation/datalog trip(x, y)
assert/weight: 2 hop("a", "b")
assert/weight: 3 hop("b", "c")
assert/weight: 9 hop("a", "c")
trip(X, Y) :- hop(X, Y)
trip(X, Z) :- hop(X, Y), trip(Y, Z)
cost: [logic/datalog/minplus | (X, Y) <- trip(X, Y)]
expect cost.result[("a", "c")] == 5
expect cost.semiring == "minplus"

Six-Grade Epistemic Grounding Ladder & Rules

axiom > postulate > theorem > conjecture > hypothesis > datum

Form Grounding / Effect
assert/axiom p(a) · axiom p(a) · postulate p(a) · hypothesis p(a) · theorem p(a) · assert p(a) (datum) Posit fact at explicit grounding grade (grounding(p(a)), strength(p(a)), tier p(a))
Strict rules (→ theorem): h(X) whenever b1(X) and b2(X) · h(X) <== b(X) · h(X) <= b(X) · b(X) ==> h(X) · h(X) :- b1(X), b2(X) · rule/strict ... Monotonic deduction; weakest premise grade propagates to derived conclusion
Defeasible rules (→ conjecture): typically h(X) whenever b(X) · normally h(X) if b(X) · h(X) <~~ b(X) · b(X) ~~> h(X) · rule~ ... · rule/defeasible ... Non-monotonic defaults; overridden by strict theorems, contradicting higher-grade evidence, or cancel
Production rules: produce forward action rules Bounded forward-chaining action execution
Stateful production s: rules.session(matcher="incremental") (default, Rete retains partial matches), rules.session(matcher="recompute") (full rematch), s.load(path), h: s.insert([ada waits]), s.step(), s.run(limit=10), s.modify(h, [ada ready]), s.why([ada ready]), s.checkpoint(path)
Aspectual qua: departed("estate") qua "lost" · framings_of(...) · framed_qua(...) · h(X) <~~ r(X) qua "tag" Attach intensional framing handles to facts and trigger aspect-sensitive rules
Inspect & Revise: why p(a) · how p(a) · show facts / axioms / postulates / definitions · retract p(a) · cancel / uncancel / force_cancel · forget · forget_cascade("p", "a") · kb_contract_plan("p", "a") · kb_apply_contraction(r) · context_assert_fact · context_lift_rule · transaction [ ... ] / with transaction Full derivation explanation, TMS cascading retraction, Reiter HS-Tree AGM contraction receipts, contextualized ist lifting, and atomic rollback
relation human(x)
relation mortal(x)
relation departed(x)

assert/axiom human("socrates")
mortal(X) <== human(X)
departed("estate") qua "given_back"

expect { X | X <- mortal(X) } == {"socrates"}
expect framed_qua("departed", "estate", "given_back")

with transaction [
  forget_cascade("human", "socrates")
]
expect { X | X <- mortal(X) } == {}

20. Homoiconicity, Macros, AST Rewriting, Tracing, Timing & Visualization

Manual §19.7–19.10, §23

Surface Primitives
Quoting & Hygiene Macros quote(e), quasiquote(e), unquote(e), splice(xs) (unquote_splice), gensym(), macro m(x) quasiquote(...), macroexpand(e), hold(e), eval(ast), do(ast)
AST Algebra & Rewriting ast("1 + 2"), ast_string(a), fullform(e), treeform(e), headof(e) / ast_head, argsof(e) / ast_operands, ast_make(h, args), ast_match, ast_substitute, ast_rewrite, ast_rules, to_data(a) / from_data(d)
Debugging, Tracing & Timing inspect expr / see expr (prints expr = val, returns val), elapsed expr, bench "lbl" expr, trace domain [ ... ], trace/functions, trace/equational, untrace, step, sleep(sec)
Venn & *form Visuals venn(A, B), venn(A, B, C), tableform(bool_or_mvl_fn), graphform(g)
macro twice_add(x) quasiquote(unquote(x) + unquote(x))
q: ast("2 * (3 + 4)")

expect twice_add(21) == 42
expect eval(q) == 14 and fullform(1 + 2 * 3) == "+(1, *(2, 3))"

21. Modules, Ambient Packages, File/HTTP/Stream I/O & Reflection

Manual §22, §25, §27.2, §34, §35

Modules & Imports

Form Meaning
module M ... end · module M [ ... ] In-file or standalone module scope
export f, g · export Shape/transparent · allow f Export bindings, or export an ADT together with all its constructors
import "path_or_mod" · use "mod" · include "file.ax" Import module namespace, natural-language alias use, or load & re-export
import x, y from "mod" · take x from "mod" Selective symbol import
import "mod" as m · import "mod" called m · import * from "mod" hiding (x) Renamed import and wildcard import with exclusions

Ambient Standard Packages (no import needed; disambiguate via builtin.<pkg>.<fn>)

  • math: pi (π), e, phi (φ), sin, cos, tan, asin, acos, atan2, sqrt, exp, log, log2, log10, floor, ceil, round, abs, gcd, lcm, mean, stddev, random, random_seed, shuffle, sample.
  • string / array / formatverbs / html: full string/array manipulation, printf verbs, html.render(t"...").
  • datetime: datetime.now(), datetime.today(), DateTime, Duration.
  • io / os / logger: read(%file_or_url), write(%file_or_url, data), write(val) / writeln(val), delete_file(p) / io.remove(p), to_json(v), from_json(s), read_csv(p), write_csv(p, rows), input(), readline(), readlines(), eachline(), streamlines(p), eof(), is_interactive() / isatty(), os.env, logger.

Self-Describing Runtime Reflection & Word Oracle

  • Catalogs: builtins(), keywords(), symbols(), concepts(), relations(), bindings(), modules(), functions(mod) / methods(x), types().
  • Callable metadata: doc("name"), signature(fn), arity(fn), parameters(fn), annotations(fn), describe(x), type(x) / @x / :: x.
  • Interactive Oracle: oracle, ask, ask/any, manual (contextual discovery & trace inspection).
module JsonDemo
  roundtrip(x) = from_json(to_json(x))
  export roundtrip
end

payload: JsonDemo.roundtrip({ host: "localhost", ports: [80, 443] })
expect payload.ports == [80, 443]
expect ("let" in keywords()) and arity(map) == 2

22. Structured Concurrency (Tasks, Channels, Promises), Agents & Polyglot

Manual §28, §30, §33, §35

Cooperative Structured Concurrency (Evaluator)

Construct Syntax & Contract
Task scope & spawn / await with tasks begin t1: spawn [ ... ]; t2: spawn [ ... ]; await(t1) + await(t2) end
Unbounded & Bounded channel ch: channel() or channel(cap) · send(ch, val) · receive(ch) · close(ch) (ChannelClosedError on drained close; TaskDeadlockError on all-blocked cycle)
Shared one-shot Promise let p :: Promise of Integer = promise() · resolve(p, 42) · reject(p, err) · await(p)
let shared :: Promise of Integer = promise()
with tasks begin
  a: spawn [ await(shared) + 10 ]
  b: spawn [ await(shared) * 2 ]
  spawn [ resolve(shared, 21) ]
  expect [await(a), await(b)] == [31, 42]
end

Cognitive Kernel, Agent Platform & Embedded Polyglot Blocks

Surface Forms
Cognitive & Agent Primitives [model | ...] advisory lifecycle block; AgentStep, vector embeddings cosine(u, v) & top_k(items, q, k), tool permit / forbid guardrails, symbolize, transform
Embedded Relational [sql | ...] CREATE TABLE, DROP TABLE, TRUNCATE, INSERT, UPDATE, DELETE, SELECT (joins, GROUP BY, HAVING, WITH CTEs, UNION/INTERSECT/EXCEPT), refinements /bag, /k3, /strict, /distinct, /explain; tuple relational calculus [trc | ...]; lineage [sql -> algebra | ...] / [sql -> trc | ...]
Cross-Language Translation [axioma -> python | expr] (offline deterministic) · [A -> B | ...] / [A --> B | ...] (configured AI provider)
In-Process & Host Language Blocks [monkey | ...] (in-tree) · [python | ...] / [python/eval | ...] · [julia | ...] · [mojo | ...] · [rlang | ...] · [js | ...] · [ts | ...] · [lua | ...] · [lisp | ...] · [pascal | ...] · [clang | ...] · [haskell | ...] · [ocaml | ...] · import go "pkg" · import python "mod"
relation items_rel(name, price)
assert items_rel("book", 25)
assert items_rel("pen", 4)
expensive: [sql| SELECT name FROM items_rel WHERE price >= 10 ]
py_out: [axioma -> python | [x + 1 | x <- range(3)]]

expect expensive == {"book"} and py_out == "[x + 1 for x in range(3)]"

23. Symbol, Sigil & Operator Index

Symbol / Sigil Name & Meaning Section
# · // · /* */ · /**md */ Line, block, and literate Markdown comments §1
#> Inline self-checking doctest assertion (axioma -t) §1
: · = · := Find-or-update binding & assignment (f(x) = ... defines function) §2
:: Type annotation (x :: T), detached signature, ascription (e :: T), prefix type-of :: e §13
:name Get-word — read value/function bound to name without calling §2
'name · 'c' · 'label: · x's p Symbolic Word · Character · loop label · possessive property/method read §3, §5, §11
$name · $"a b" · xs[$] · $19.99 Escaped keyword/identifier · last sequence index · exact Money literal §2, §3, §5
%file.txt · % File literal (path) · modulo operator (mod) §3, §8
@x · [email protected] Type/category sigil · Email literal §3, §21
&x · *p · A & B · &.field Address-of Reference · dereference · intersection type · member-access lambda §4, §10, §13
{} · {1, 2} · {:} · {a: 1} Empty Set (∅) · Set · empty Dictionary · Dictionary / statement { ... } block §5, §11
[1, 2] · [x,] · `[1, 2] Array (or body block) · unambiguous 1-element Array · immutable List §5
+: · :+ · + Non-mutating element prepend · element append · sequence concatenation §5
.. · ..< · ... Inclusive range · half-open range · set ellipsis {2, 4, ..., 10} & variadic/rest ...xs §5, §6, §10
.+ .- .* ./ .^ .% .÷ · f.(xs) Element-wise array/matrix operators · fused function broadcasting §6, §10
|> · |?> Forward value pipe · error/bottom-short-circuiting railway pipe §8
>> · << · ∘ · ⌾ Forward compose · backward compose · math ring compose · via structural combinator §10
(op/) · a `f` b · `glyph Seeded left-fold operator reduction · backtick infix call · Unicode glyph digraph §1, §8, §10
== · != · === · !== · <=> · <: Value equality · inequality · exact/reference identity · 3-way compare · subtype §8, §13
=~ · !~ Regex match (capture Dictionary or none) · regex non-match (Boolean) §9
?? · ??? · ?. · ??= · ???= none-coalesce · bottom (none or om) coalesce · safe navigation · coalesce-assign §8
++ · -- · += -= *= /= %= **= Postfix step statement (numbers & Character) · compound assignments §8
⊤ᵇ ⊥ᵇ ?ᵇ ⊤⊥ᵇ · ⊕ ⊗ · ⊼ ⊽ Belnap B4 truth literals · B4 knowledge join/meet · Sheffer nand / Peirce nor §8, §17
⊓ · ⊔ · ¬ · ⊑ · ≡ · :> DL/type intersection · union · complement · subsumption · equivalence · subcollection §15, §19
<== <= ==> :- · <~~ ~~> rule~ Strict backward/forward rules (→ theorem) · defeasible rules (→ conjecture) §19
[| obj msg |] · [lang | ...] · [logic/m | ...] Message send · embedded language/SQL/translation block · solver block §15, §18, §22
<...> · <<...>> · <<|...|>> · <<<...>>> Natural language · Constrained language · NSM explication · Conceptual Graph §3, §16

24. A–Z Keyword & Form Index

Every reserved keyword, soft keyword, and core construct in Axioma (retired spellings marked → with their replacement).

  • A: a / an (§15) · abductive (§18) · Absent (§13) · accident (§16) · across (§11) · action (§15) · alias (§2) · allow (§21) · always (§17) · analogous (§16) · and / andalso (§8) · annotation (§15) · argues (§16) · as (§12, §21) · asc (§7) · ask (§21) · assert (§19) · attempt (§14) · attribute (§16) · await (§22) · axiom / axioms (§19)
  • B: band / bor / bshl / bshr / bxor (§8) · because (§8) · begin (§11) · believes (§17) · bench (§20) · break (§11) · by (§6) · by_default (§17)
  • C: called (§21) · cancel (§19) · case (§12) · catch (§14) · causally (§16) · channel (§22) · check (§14, §18) · ci (§17) · classify (§15) · completeness (§18) · concept (§15) · cond (§11) · connect (§16) · consistency (§18) · const (§2) · contains (§5) · contingently (§17) · continue (§11) · contract (§14) · contradiction / contradicts (§16, §18)
  • D: data (§13) · decidability (§18) · declare / declare/persist (§2) · deduce / deductive (§18) · default (§2, §11) · defer / defer/error (§11) · define / defines / definitions (§15, §19) · delete (§5) · denotes (§17) · derive (§18) · desc (§7) · destroy (§15) · diff / difference / different (§5, §16) · dispatch (§13) · div (§8) · do (§20) · doc / document / documented (§15, §21) · doubts (§17)
  • E: E! (§17) · efficiently (§16) · elapsed (§20) · else / elseif (§11) · end (§11) · entails (§16) · entity (§15) · enum / enumerates (§13) · equivalent (§15) · essence (§16) · eval (§20) · eventually (§17) · every (§15, §17) · exists / exists! (§17) · expect (§14) · explain (§16) · export (§21) · extends (§15)
  • F–G: facts (§19) · false (§3) · fe / fi / fu (§17) · finally (§14) · fn / for / foreach (§10, §11) · forbidden (§17) · forall (§17) · forget_cascade (§19) · formally (§16) · forward (§18) · from (§21) · fun / func / function (§10) · generalize (§16) · generate (§18) · gensym (§20) · given (retired → const, §2) · global (§2)
  • H–I: had / has (§15) · having (§7) · hiding (§21) · how (§19) · hypothesis (§19) · identical / identified (§8, §15) · if / iff (§8, §11) · impl / implies (§8) · implement / implements (§13, §15) · import (§21) · impossibly (§17) · in / include (§5, §21) · inductive / infer (§16, §18) · infinity (§3) · inherits (retired → extends, §15) · inspect (§20) · interface (§13) · intersect / intersection (§5) · is (isa/kindof retired → is, §15) · it (§15)
  • J–N: join (§9, §16) · knows (§17) · lambda (§10) · lazy / lazy let / lazy val (§2) · let / let mut / let mutable / let/lazy / limit / local / loop (§2, §7, §11) · macro / macroexpand (§20) · make (§4) · match / matches (§12) · materially (§16) · may (§17) · metalogical (§18) · mod / module / modus_ponens / modus_tollens (§8, §18, §21) · mu / must / must_not / mut / mutable (§2, §17) · na / Na (§3) · necessarily / next / no / nominally (§16, §17) · none (null / Null / nothing retired → none / None, §3, §14) · normally / not / not_in / notin (§5, §8, §19)
  • O–R: observed_by (§16) · offset (§7) · om / Ω (§3, §14) · opaque / operator (§8, §13) · or / orderby / orelse / otherwise / ought (§7, §8, §14, §17) · pa / partOf / particularly / partition (§15, §16, §17) · permitted / possibly / postulate / postulates / predicate / presupposes / probably / produce / promise / proper_subset / proper_superset / proprium / prove (§5, §6, §16, §17, §18, §19, §22) · qua / quasiquote / query / quote (§18, §19, §20) · raise / ranges / re / really / rebind / record / ref / refute / rel / relatedTo / relation / repeat / restrict / retract / return / ro / rule (§2, §4, §10, §11, §13, §16, §17, §18, §19)
  • S–Z: same / satisfies / see / should / show / similar / since / soha / sohi / sohu / some / spawn / splice / step / struct / subset / subsetneq / subsumes / suho / superset / supsetneq / suspend / switch / syllogism / symdiff / symmetric_difference / symbolize (§5, §11, §13, §15, §16, §17, §18, §20, §22) · take / taxonomy / teleologically / the / then / theorem / there / therefore / throw / tier / to / trace / trait / transaction / transform / true / try / type / typically (§3, §8, §11, §13, §14, §15, §16, §19, §20, §21) · unalias / unfreeze / unify / union / unit / universally / unless / unquote / unquote_splice / unsuspend / until / untrace / use / uses (§2, §3, §5, §11, §13, §15, §17, §20, §21) · val / val/lazy / validate / var / venn / via / vo (§2, §10, §15, §17, §20) · what / when / whenever / where / while / why / with / with_probability / word / xor (§2, §8, §11, §12, §15, §16, §17, §19, §22)