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.
120 lines
2.6 KiB
Markdown
120 lines
2.6 KiB
Markdown
# 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:
|
|
|
|
1. type verification;
|
|
2. SSA/control-flow verification;
|
|
3. initialization verification;
|
|
4. ownership verification;
|
|
5. borrow/alias verification;
|
|
6. region lifetime and generation verification;
|
|
7. island closure verification;
|
|
8. linear-resource verification;
|
|
9. effect verification;
|
|
10. capability verification;
|
|
11. `Send`/`Share` verification;
|
|
12. task-scope verification;
|
|
13. synchronization and atomic-ordering validation;
|
|
14. range/bounds verification;
|
|
15. unsafe-boundary verification.
|
|
|
|
## 3. Per-value abstract state
|
|
|
|
The verifier may track:
|
|
|
|
```text
|
|
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:
|
|
|
|
```text
|
|
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:
|
|
|
|
```aji
|
|
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:
|
|
|
|
```text
|
|
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-`Send` values to migratable tasks/threads;
|
|
- concurrent mutable aliases not proven disjoint;
|
|
- sharing non-`Share` values 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.
|