The Tarski language
A strict Datalog subset for declaring ontologies, with relations, rules, decisions, invariants, and reserved namespaces that the loader checks to enforce containment.
Tarski is Tarski’s ontology language, where your domain expertise is written down as
rules and invariants. It is a strict Datalog subset with Souffle-like syntax and reserved
platform namespaces. Datalog belongs to the same logic-programming family as the rule languages that
early expert systems used.
The language is not Turing-complete. Because programs stay inside well-behaved logic fragments, the platform can verify properties of your system that general-purpose code cannot provide: exact replay, load-time containment checks, and cost and monotonicity analysis.
There are two kinds of .ta file. Ontology files (ontology/*.ta) declare relations,
rules, decisions, invariants, and intents. Query files (queries/*.ta) declare
parameterized worldview reads, covered in Declared queries.
What V1 supports and rejects
V1 supports positive derivation, bounded recursive positive derivation, stratified
negation, finite non-recursive aggregates, explicit assertions and retractions, pure
helper calls (helper.std.* and app helpers), invariants, and intent. derivation.
V1 rejects recursive aggregates, unstratified negation, ambient I/O, dynamic rule loading, and unsafe relay paths from fallible evidence into trusted facts or executable intents.
An aggregate clause terminates a rule body. Put comparisons before the aggregate, or split the rule through a local relation. The parser diagnostic gives the same advice.
Rules and decisions
Derivation works as in standard Datalog: a head relation derives from a body of conditions.
-- fallible parse lands as candidate evidence (relay namespace)
-- promotion is an explicit decision the loader can check
decision.accepted.orders.line(item, qty) :-
candidate.order(item, qty),
menu.bounds(item, max),
qty <= max.
order.line(item, qty) :-
decision.accepted.orders.line(item, qty).
-- out of bounds: route for confirmation instead
decision.requires_review.orders.line(item, qty, "reviewer", "order_desk") :-
candidate.order(item, qty),
menu.bounds(item, max),
qty > max.
The decision relations separate fallible evidence from committed truth, and the loader
checks that separation. Every positive path from candidate.* to a trusted fact must
cross decision.accepted.*, and every path from proposal.* to a world-facing intent
must cross decision.approved.*. The full model, including the payload-projection rule
and common mistakes, is in
Facts, decisions & intents.
Invariants
Invariants are named, fail-closed statements about states the completed model must never contain. They are checked over the fully materialized model at every fixpoint:
-- the wall: an effect receipt without canonical approval is impossible
invariant pos_only_accepted_lines {
never pos.ticket(item, qty), not order.line(item, qty)
}
Use invariants for impossible committed states and effect-boundary backstops. Don’t use
them for ordinary proposal denial; a denied proposal should commit as decision.rejected.*
evidence. Common idioms include exclusivity invariants (a count bounded by one) and budget
backstops that make over-approval impossible.
Reserved namespaces
| Namespace | Owner | Role |
|---|---|---|
source.* |
mappers | Base evidence extracted from observations |
candidate.* |
mappers or rules | Provisional fact-domain evidence |
proposal.* |
mappers or rules | Provisional action-domain evidence |
decision.* |
rules only | Deterministic adjudication (closed outcome set) |
intent.* |
rules only | Committed action requests |
effect.* |
runtime only | Effect lifecycle: queued, in_flight, succeeded, failed, blocked, reconcile_required, conflict |
helper.std.* |
platform | Version-pinned standard helper library |
queryresult.*, proposal.query_requested |
runtime only | Agent read relay families; app declaration is a load error |
access.* |
rules | The account/authorization plane |
Entity sugar
entity blocks are the language’s only sugar construct. One declaration expands
deterministically into the full record kit: observation kinds, mapper, current-state
rules, and read queries. See Entities.
entity customer {
key customer_id: text
field name: text
field plan: text index
}
Diagnostics as a contract
Every .ta load failure carries a stable diagnostic code, the source file, line, and
column, the offending construct, and a correct form or concrete remediation. Diagnostics
are part of the product surface. Coding agents iterate against them, so they are written
to teach. Load-time families you will see include parse errors (E1040–E1047
for query files), query validation (E2601–E2611), plugin surface violations
(E2701–E2707), and composition admission (E2810, E2811).
Monotonicity, classified
Every rule, relation, and stratum in a loaded ontology is labeled monotone or non-monotone (the CALM boundary). Each label comes with explicit witnesses that name the cause: a negation, an aggregate, a retraction, or an ungrounded comparison. Monotone logic can distribute and react without coordination; non-monotone logic needs the ordering of the stratified fixed point.
You can declare the classification you designed for. If the computed classification disagrees with it, the load fails:
[analysis.monotonicity]
expect_monotone = ["workspace.open_task", "task.activity"]
expect_non_monotone = ["task.record", "task.current_version"]
Expectations only gate the load; they do not change evaluation semantics. The classification also feeds the composition architecture report. See Workviews, Collectors & modules.
Supported expressions and time
V1 makes the following boundaries explicit:
| Need | V1 stance | Recommended pattern |
|---|---|---|
| Positive recursion | Supported when finite and bounded by the input domain | Use ordinary mutually recursive positive rules; recursive aggregates and recursion through negation are rejected |
Scalar arithmetic in .ta |
Not a general expression surface | Use count, sum, min, or max, or call a pure helper with explicit inputs |
| App helpers | helper.<name>(...) is callable from rule expressions |
Put deterministic domain calculations in helpers/*.rhai; I/O, clock, randomness, and mutation are rejected |
| Current time | No ambient “now” | Append time evidence or bind an explicit query parameter; observation observed_at is system-owned evidence |
| Civil dates and timezones | Standard helpers provide UTC/fixed-offset operations, not an ambient IANA timezone database | Model a schedule with its declared IANA timezone, or pass explicit offset/calendar evidence to a helper |
| Query-local relations | Supported | Declare local relations and ordinary rules inside the query file |
| Several result rules | Supported when they derive the query’s one declared head | A query file has exactly one head, but several rules may contribute rows to it |
| Dynamic rule loading | Rejected | Make package composition explicit so evaluator identity remains stable |
| ULID/random id minting | No ambient randomness in rules or helpers | Supply ids in input observations or derive a documented deterministic digest identity |
Tarski guarantees that there is no ambient clock, randomness, network, or filesystem state, so the same observations and evaluator digest derive the same model. See Mappers & observations for the append envelope and identifier boundary.