Skip to main content
AXON’s type system is fundamentally different from traditional programming languages. Instead of representing memory layouts or data structures, AXON types represent epistemic states — the nature, reliability, and provenance of information.

Core Principle

Epistemic Types = Meaning TypesTypes in AXON track what information means and how reliable it is, not how many bytes it occupies in memory.
This enables the compiler and runtime to enforce semantic correctness: for example, preventing an Opinion from being used where a FactualClaim is required, or propagating Uncertainty through computations to maintain epistemic honesty.

The Partial Order Lattice

AXON’s type system is formalized as a partial order lattice (T, ≤), where represents the subsumption relationship between types.

Lattice Structure

Subsumption Rule

Type Subsumption: If T₁ ≤ T₂, then T₁ can be used wherever T₂ is expected.
Examples:
  • CitedFact ≤ FactualClaim — A cited fact is a factual claim
  • HighConfidenceFact ≤ CitedFact — A high-confidence fact is a cited fact
  • Opinion ≤ Any — An opinion is some form of information
  • Opinion ≰ FactualClaim — An opinion cannot satisfy a factual claim requirement

Type Categories

1. Epistemic Types (Reliability)

Track the epistemic status of information — how certain, verifiable, or grounded it is.
Information presented as objectively verifiable fact.
Subsumption: FactualClaim ≤ Any
Cannot contain: Opinion, Speculation
A factual claim with explicit source attribution.
Subsumption: CitedFact ≤ FactualClaim ≤ Any
A cited fact with confidence score ≥ 0.85 (configurable).Subsumption: HighConfidenceFact ≤ CitedFact ≤ FactualClaim ≤ Any
Use case: Medical, legal, or financial domains requiring high certainty.
Subjective judgment or interpretation.
Critical: Opinion ≰ FactualClaim — opinions never satisfy factual requirements.
Lack of sufficient information to make a determination.
Taint Propagation: Any computation involving Uncertainty produces Uncertainty. This is enforced at compile time.
Conjecture without evidence.
Subsumption: Speculation ≤ Any but incompatible with most epistemic types.

2. Content Types (Data)

Represent structured or unstructured information that flows through pipelines.
Example: Content pipeline

3. Analysis Types (Metrics)

Quantitative or qualitative assessments with bounded ranges.
Range Constraints: Analysis types have built-in validation. Values outside the declared range raise ValidationError.

4. Structural Types (User-Defined)

Custom types for domain-specific entities.
contract_analyzer.axon
Compositional Types: User types can embed epistemic types, enforcing semantic constraints at every level.

Type Checking

AXON performs semantic type checking at compile time via the TypeChecker module.

Compatibility Matrix

The type checker uses an EpistemicLattice class to determine type compatibility:
type_checker.py

Validation Rules

1

Assignment Compatibility

Can source_type be assigned to target_type?
2

Parameter Passing

Can argument_type satisfy parameter_type?
3

Return Type Checking

Does step output match declared type?
4

Uncertainty Propagation

Any operation on Uncertainty yields Uncertainty.

Runtime Validation

While the TypeChecker catches structural issues at compile time, semantic validation happens at runtime via the SemanticValidator.

How It Works

  1. Step Execution — Model produces output
  2. Semantic Classification — Runtime determines epistemic type
  3. Lattice Check — Validator checks actual_type ≤ declared_type
  4. Action — Pass, raise ValidationError, or trigger refine
semantic_validator.py
ValidationError (Level 1): Raised when output type doesn’t match declaration. Can trigger automatic refinement if configured.

Special Type Rules

Optional Types

Use ? suffix for optional fields:

List Types

Range Types

Union Types (Planned)


Type Inference

AXON performs limited type inference for intermediate values:
Design Choice: Step outputs require explicit type declarations for clarity and safety. Intermediate expressions support inference.

Comparison with Other Type Systems


Next Steps

Cognitive Primitives

Learn about the 12 core primitives

Error Handling

See how type errors are handled

Compilation Pipeline

Understand type checking in the compiler

Examples

See types in real programs