∀  ·  a cognitive language for reasoning

Axioma

State what is true. Let the language reason.

A cognitive programming language for knowledge representation and reasoning — sets, logic, and many-valued truth, with a natural-language syntax that runs entirely in your browser.

Most languages compute with numbers. Axioma computes with truth.

The language, in six axioms

What you can say

Axioma reads like mathematics and runs like a program. Each construct below is real, executable syntax — try any of it in the playground.

I.

Sets are first-class

Set-builder notation, comprehensions, and the full algebra of sets — straight from the page into the runtime.

nums: [1, 2, 3, 4, 5, 6]
{ n | n <- nums, n mod 2 == 0 }  ⇒ {2, 4, 6}
II.

Logic is executable

Universal and existential quantifiers range over sets and evaluate to a truth value — and , as code.

forall x in {2, 4, 6} | x mod 2 == 0   ⇒ true
exists x in {1, 2, 3} | x > 2        ⇒ true
III.

Rules reason for you

Declare facts and Horn-clause rules; recursion computes the full transitive closure, Datalog-style. The relation and assert keywords are even optional in the obvious cases.

ancestor(X, Z) <== parent(X, Z)
ancestor(X, Z) <== parent(X, Y) and ancestor(Y, Z)
IV.

Truth has more than two values

Boolean, Kleene K3, Łukasiewicz L3, Belnap B4, and Gödel G3 — first-class logics for the unknown and the contradictory.

belnap("both")   ⇒ ⊤⊥
om or true        ⇒ true   # unknown ∨ true
V.

“is” means three things

Russell's copula, made precise: identity, predication, and existence — with concepts, instances, and classification.

concept Stock { price: 0 }
aapl: a Stock { price: 150 }
aapl is Stock     ⇒ true
VI.

Reasoning runs anywhere

The whole interpreter compiles to WebAssembly — no install, no server. It also speaks Forth-style stacks and prose-like definitions.

# a function, REBOL-style binding
sq: func(n) [n * n]
map(sq, [1, 2, 3])     ⇒ [1, 4, 9]
Knowledge representation

Concepts that carry their philosophy

A concept is more than a class. It can hold its own purpose, the mode by which it was formed, a defining boundary, and the cases that test it — then validate itself to a four-valued truth. The everyday parts read like English; the philosophical parts are executable.

concept.ax
# A concept is a class — declared in plain English, with a doc string
concept Vehicle "anything that moves people or goods"

# Fields: add with `has`, remove with `had`
Vehicle has wheels
Vehicle has speed
Vehicle has cargo
Vehicle had cargo                 # …dropped again

# Inheritance: extends declares Car ⊆ Vehicle (auto-creates Car)
Car extends Vehicle
Car has doors

# An instance — the indefinite article `a`
tesla: a Car { wheels: 4, speed: 250, doors: 2 }

# Classify it with the copula `is` (Russell's ∈ and ⊆)
tesla is Car                      → true   (membership ∈)
tesla is Vehicle                  → true   (inherited)
Car is Vehicle                    → true   (class inclusion ⊆)

# Auto-classification — a rule decides membership
SportsCar defines { is Car and speed > 200 }
tesla is SportsCar                → true

# Lifecycle: suspend, revive, or destroy a concept
concept Draft "scratch"
Draft suspend                     # frozen
Draft unsuspend                   # live again
Draft destroy                     # gone for good
is Draft                          → false

The everyday surface: declare a concept and its fields in plain English (has adds a field, had removes one), inherit with extends, instantiate with a, classify with is, and manage a concept's whole life — suspend · unsuspend · destroy. Every is the interpreter's real output.

formation.ax
concept Man
Man has age
Man has married
alex: a Man { age: 30, married: false }
sam:  a Man { age: 28, married: true }

# A concept carries its own epistemology — not just fields:
concept Bachelor {
  purpose:         "an unmarried adult male — Quine's analytic example"
  formed_by:       "stipulation"                          # 1 of 5 formation modes
  boundary:        is Man and age >= 18 and married == false   # the intension
  examples:        [alex]                                 # must fall inside
  counterexamples: [sam]                                  # must fall outside
}

alex is Bachelor                    → true    (boundary derives the extension)
sam  is Bachelor                    → false   (married)
check(Bachelor)                     → ⊤ᵇ      (Belnap: examples in, counterexamples out)
examine(Bachelor)                   → {meaningful: true, pseudo: false, …}
grounding("isa", alex, Bachelor)    → "axiom"   (stipulated ⇒ axiomatic)

The philosophical surface: a concept carries its purpose, the formed_by mode it came from (abstraction · combination · distinction · stipulation · metaphor), a boundary that turns intension into extension, and examples / counterexamples it must honour. check grades that contract in Belnap four-valued logic; examine runs a Carnap pseudo-statement test; and because Bachelor was stipulated, its memberships are graded axiom.

Epictetus' dichotomy of control“some things are up to us, some are not” Thing partition UpToUs, NotUpToUs is_partitioned → true
Stoic adiaphorawealth is judged indifferent, not unvalued value_indifferent("wealth", …) value_kind_of → "indifferent"
Russell's definite descriptionsa class named by a property the Stock where price > 1000 luxury is it → true
Frege's sense vs. referenceone fact under two framings departed("estate") qua "lost" framings_of → {…}

The full concept vocabulary

Lifecycleconcept · has · had · suspend · unsuspend · destroy
Structureextends · implements · defines / defines~ · partition · enumerates · ranges · identified by · unify / unify~ · classify · subsumes
Formation fieldspurpose · formed_by · boundary / boundary~ · examples · counterexamples · default_grounding
Slot metadatahas slot/cumulative · inverse_slot · transitive_slot · find_or_create · cardinality
Diagnosticscheck · examine · why · grounding · proof
Reasoning about reasoning

It knows what it knows

Beyond running your program, Axioma reasons about its own knowledge — where a fact came from, how sure it is, and how to explain it. The [ model | … ] lens even charts your code on the knowledge lifecycle as you write it.

model.ax
[ model |
  relation mortal(x)
  axiom mortal("socrates")
  human(X) <== mortal(X)
  { X | X <- human(X) }
]

┌─ model · epistemic lifecycle ─────────────────────────────────────
  represented
  grounded
  inferred
│ ✗ proved        → why <conclusion>  ·  proof(rel, args…) chains back to axioms  ·  prove / derive / refute (automated reasoning)
│ ✗ truth-valued  → set_truth(rel, args…, "both")  ·  truth(rel, args…)   (T / F / Both / Neither)
│ ✗ applied       → check Concept / examine Concept (→ B4)  ·  examples / counterexamples  ·  reconcile against KB / Cascade  ·  understand X runs the whole arc
└─ 3/6 phases present · advisory only — your code runs exactly as written.

⇒ {"socrates"}

Wrap any block in [ model | … ] and Axioma runs it untouched — returning {"socrates"} — then charts how far that knowledge has travelled: represented → grounded → inferred → proved → truth-valued → applied. Here three of six phases are present, and every unreached phase () names the exact next step. It's Calculemus turned on the program itself: computing a result is one thing — knowing what you've actually established is another.

A cognitive kernel

understand · examine · abduce — Peirce's inference-to-the-best-explanation as a built-in (the "fifth paradigm").

flies(X) <~~ bird(X)
abduce("flies", "tweety")
⇒ ("bird(tweety)", defeasible)

Self-explaining proofs

Ask why a conclusion holds and get a prose proof traced back to its founding axioms.

why mortal("socrates")
# ⇒ a theorem, from
#   human("socrates") [axiom]

Knowledge has grades

Axioma is named for the axiom — you don't just assert facts, you grade them (axiom > postulate > theorem > conjecture > hypothesis), and the grade propagates through every proof.

axiom mortal("socrates")        # foundational
grounding("mortal", "socrates")  ⇒ axiom

Defaults & exceptions

Defeasible rules (<~~) hold by default and retract for exceptions — non-monotonic logic, provenance kept.

flies(X) <~~ bird(X)
cancel("flies", "pingu")
# penguins excepted; tweety still flies

Errors are values

No stack unwinding — a fault becomes an inspectable value that auto-classifies into a concept you can match on.

e: try(10 / 0)
e is DivByZero          ⇒ true
parse_int("x") otherwise 0  ⇒ 0
λ

Code is data

Homoiconic to the core: quote ASTs, write hygienic macros, even build a symbolic differentiator in user code.

macro double(x) quasiquote(unquote(x) * 2)
double(21)            ⇒ 42
A wider vocabulary

Three centuries of ideas, runnable

Set theory and intensional logic, the geometry of meaning, prime-number taxonomy, the opacity of belief — each is a chip in the playground, one click from running.

Concepts as numbers

Leibniz's 1666 dream: encode primitive concepts as primes, so that subsumption becomes plain divisibility.

human: 2*3*7*13*19   # a prime fingerprint
is_subtype_of(human, 2*3*7)  ⇒ true

Definite descriptions

Russell's the X where … — name a class by a property, then test membership or iterate its extent.

big: the Stock where price > 1000
luxury is big            ⇒ true

Textbook notation

Write the symbols mathematicians use — quantifiers ∀ ∃, membership ∈, set difference \, proper subset ⊊.

∀ x in {2,4,6} | x mod 2 == 0   ⇒ true
{1,2,3,4} \ {2,4}            ⇒ {1, 3}
{1,2} ⊊ {1,2,3}              ⇒ true

The geometry of meaning

Gärdenfors conceptual spaces — concepts as convex regions, categorization by the nearest prototype.

add_prototype(fruit, "apple", [7,5])
nearest_prototype(fruit, [6,5])  ⇒ "apple"

One fact, two framings

Intensionality made executable — the same fact under divergent value-laden descriptions (Epictetus, Ench. 11).

departed("estate") qua "lost"
departed("estate") qua "given_back"
framings_of("departed", "estate")
⇒ {"lost", "given_back"}
Many-valued logic

Beyond true and false

Real knowledge is incomplete and sometimes contradictory. Axioma builds that in: Belnap's four-valued bilattice treats missing and conflicting information as first-class truth values.

  • ⊤ true asserted, no conflict
  • ⊥ false denied, no conflict
  • ⊤⊥ both asserted and denied — a paraconsistent contradiction
  • ? neither no information either way

Contradiction propagates through rules instead of crashing — and every derived fact carries its epistemic grounding, from axiom down to hypothesis.

⊤⊥ ? more info ↑
A cognitive paradigm

Computing as the mind does

Axioma is a cognitive programming language — built for knowledge representation, symbolic reasoning, and explainable AI. After procedural, object-oriented, functional, and logic programming comes a fifth paradigm, whose defining act is to understand: to model a thing into a model of everything. Seventeen logics and eight knowledge-representation systems, unified under a single old dream.

Calculemus. Let us calculate.”— G. W. Leibniz, on settling every dispute by computation

1679
Leibniz

characteristica universalis + calculus ratiocinator — a universal language of thought, and a calculus to reason in it.

1854
Boole

The Laws of Thought — the algebra of logic.

1879
Frege

Begriffsschrift — the first formal logic; quantifiers, sense & reference.

1903
Russell

Types, definite descriptions, and the three meanings of “is.”

1931
Gödel

Incompleteness — and numbering a formal system within itself.

1959
McCarthy

Programs with common sense.

today
Axioma

The cognitive language — 17 logics and 8 knowledge-representation systems, executable in your browser.

Interop

It speaks other languages

One bracket form, many backends: translate Axioma to Python, run Python or SQL inline, or symbolize plain English. These reach out to other runtimes, so they need the native axioma binary — shown here rather than in the browser playground.

axioma → python

Translate

Compile a comprehension to idiomatic Python source — deterministic and offline.

[axioma -> python | [n*n | n <- range(10)]]
⇒ "[n * n for n in range(10)]"
python → axioma

Embed & call

Run Python inline, or pull a Python function into Axioma scope and call it.

[python --> axioma | def double(x): return x*2]
double(5)   ⇒ 10
sql

Query tables

Run SQL against in-process tables — joins, GROUP BY, aggregates.

[sql | SELECT region, SUM(qty)
       FROM sales GROUP BY region]
english → axioma

Symbolize

Describe what you want in plain English; an LLM emits Axioma you can run.

[nl --> axioma | the empty list]
⇒ []

Try it. No install.

The interpreter runs in your browser — write a comprehension, prove a theorem, watch a rule reach its fixpoint.

▶ Open the Playground
play.axiomalang.org