AXIOM Axiom Documentation
UABLACKGRAYWHITE
Axiom · dark

From Axiom to Ada and SPARK

After Axiom, many “strange” Ada ideas stop looking strange: ranges, contracts, strong types, and proof-oriented design all reduce accidental states.

Axiom does not copy Ada syntax. It tries to teach the same engineering reflex: define the valid state first, then implement the operation.

AxiomAda/SPARK ideaShared purpose
requirePreconditionCaller obligation
ensurePostconditionCallee obligation
invariantType/Loop invariantPreserved property
bounded values/contractsRange/subtype constraintsReject invalid values early
view + lifetime proofaccessibility/ownership disciplinePrevent dangling references
no recursion + memory reportshigh-integrity resource reasoningBound stack/resources
proof reportsGNATprove-style analysisDiagnostics as proofs, not only warnings

A small design-by-contract example

Design by contractAxiom
1percentage(i32 value) -> i32:2    require value >= 03    require value <= 1004    ensure result >= 05    ensure result <= 1006    RETURN value
1

The raw integer type is wider than the domain concept.

2

Preconditions narrow the valid domain.

4

Postconditions export a guarantee to future callers.

6

The body is trivial; the contract carries the semantic knowledge.

What to notice when you open Ada/SPARK

Focus on subtypes/ranges, contracts, tasking, strong typing, accessibility rules, and GNATprove. Those are practical tools for software where “usually works” is not an acceptable requirement.