Draft specification, RFCs, reference registries and examples, plus the reference-implementation skeleton: build.zig, diagnostic envelope with error-code registry synced to docs, aji CLI, conformance runner with seed tests, CI and contributor docs.
2.6 KiB
08. Verifier
1. Role
The verifier is part of Aji's language semantics, not an optional lint pass.
A safe module that fails verification is not an executable Aji program.
2. Required passes
A conforming verifier performs, directly or equivalently:
- type verification;
- SSA/control-flow verification;
- initialization verification;
- ownership verification;
- borrow/alias verification;
- region lifetime and generation verification;
- island closure verification;
- linear-resource verification;
- effect verification;
- capability verification;
Send/Shareverification;- task-scope verification;
- synchronization and atomic-ordering validation;
- range/bounds verification;
- unsafe-boundary verification.
3. Per-value abstract state
The verifier may track:
type
initialization state
ownership state
borrow state
provenance
region and generation
bounds
alignment
integer range
Send/Share/Local properties
task scope
resource state
4. Ownership state machine
Representative states:
AVAILABLE
MOVED
BORROWED_SHARED(n)
BORROWED_MUT
CONSUMED
Transitions are instruction-defined.
A moved or consumed value cannot be reused unless a later operation returns a distinct new value.
5. Path sensitivity
The verifier propagates facts through branches.
Example:
if i < len(data) {
let x = data[i];
}
Inside the branch, i < len(data) is available as a proof fact.
6. Guards
guard condition records a verifier-recognized condition on the continuing path.
It may justify elimination of later runtime checks.
7. Bounded analysis
Verifier algorithms must have deterministic resource budgets.
If verification exceeds configured/spec-defined complexity bounds, the verifier emits a stable failure rather than silently weakening checks.
8. Contracts
Contracts may be classified as:
PROVEN_STATICALLY
CHECKED_AT_RUNTIME
ASSUMED_UNSAFE
UNPROVEN
A high-assurance profile may reject UNPROVEN or ASSUMED_UNSAFE results.
9. Concurrency verification
The verifier must reject:
- task lifetime escape;
- transfer of non-
Sendvalues to migratable tasks/threads; - concurrent mutable aliases not proven disjoint;
- sharing non-
Sharevalues through concurrent immutable access; - use of moved channel messages;
- accessing async I/O buffers while an outstanding operation owns/borrows them;
- illegal atomic memory orders.
10. Diagnostics
Every normative verifier rejection has a stable machine-readable code.
Diagnostics should include enough structured state for an agent to repair the program without parsing prose.