Skip to main content

Overview

AXON’s type system is epistemic—it tracks the nature and reliability of information, not memory layout. The type system has four layers, from simple nominal types to dependent types, all designed to remain decidable at compile-time.

Key Principle

Types never depend on LLM outputs. This ensures type checking is always decidable.

Type Layers

AXON has four type system layers:
  1. Nominal — Name-based identity
  2. Structural Epistemic — Cognitive compatibility
  3. Refinement — Predicate-constrained types
  4. Dependent (Light) — Statically parameterized types

Layer 1: Nominal Types

Nominal types are identified by name. Two types are equal only if they have the same name.

Syntax

Examples

Important: Party ≠ Witness even though they have identical structure. Nominal typing uses name identity.

When to Use

  • Domain-specific entities
  • Business concepts
  • When structural similarity doesn’t imply semantic equivalence

Layer 2: Structural Epistemic Types

Structural compatibility based on cognitive status, not field matching.

Built-in Epistemic Types

Compatibility Rules

Example

Uncertainty Propagation

Uncertainty is infectious—once data becomes uncertain, everything computed from it is also uncertain:
This prevents laundering unreliable information into reliable conclusions.

Layer 3: Refinement Types

Refine base types with decidable predicates.

Range Constraints

Where Clauses

Allowed Predicates

Refinement predicates must be decidable:

Example

Layer 4: Dependent Types (Light)

Status: Planned for v1.5+ Dependent types parameterized by static constants (not runtime values).

Planned Syntax

What’s Allowed

Type Definition Syntax

Simple Type

Structured Type

Range-Constrained Type

Refined Type

Type with Where Clause

Combining Features

Type Expressions

Basic Type Reference

Generic Types

Optional Types

Nested Types

Generic Type Parameters

Current support:

Optional Fields

Mark fields as optional with ?:

Built-in Types

Primitive Types

Epistemic Types

Content Types

Analysis Types

Collection Types

Type Compatibility Matrix

Can Substitute

Cannot Substitute

Uncertainty Taints

Complete Examples

Domain Model

Epistemic Constraints

Range and Refinement

Best Practices

1. Use Nominal Types for Domain Concepts

2. Use Epistemic Types for Information Quality

3. Use Refinement for Constraints

4. Mark Optional Fields Explicitly

5. Prevent Opinion/Fact Confusion

Type Checking

The AXON type checker validates: Name resolution: All referenced types exist
Epistemic compatibility: Opinion cannot substitute for FactualClaim
Range validity: min < max in range constraints
Field types: All field types are valid
Generic parameters: Generic type arguments are valid

Types vs. Contracts

Example