DEVELOPMENT EDITION · 769442725406
Verification Manual
On this page

Concurrency, devices, and external state

Concurrency verification combines local operation proof with restrictions on how state is shared and how protected actions can wait or call one another. External-state verification also needs an accurate account of changes made by hardware or another program. A sequential postcondition alone is not a concurrency, scheduling or device-validity argument.

Begin with the actors and shared objects

List the main program, library tasks, protected objects and external agents. For each mutable object, record who reads it, who writes it, and which synchronization protects it. Include library state such as output files and state reached transitively through helper calls.

Verada's race analysis checks inferred effects of the supported actors. Shared mutable state belongs in an appropriate protected abstraction under the supported model; two tasks printing can conflict through library output state even when the source appears to use only literals. Moving a write into a helper does not remove its effect from the actor.

The tasking corpus uses a protected bounded buffer and producer/ consumer tasks. The Vibe equivalent uses recognized Protected, @entry, when, and @task forms. Python threads or coroutines are not an alternative source model accepted by those helpers.

Prove operations locally, then check composition

For each protected operation, state the valid input/state relation and output update. A buffer insertion needs available capacity; removal needs an available item. An entry barrier is a synchronization condition that can wait, not simply a caller precondition.

Then check the composition: can each actor call the operation in a legal context, do its effects stay within protected state, and do nested operations respect blocking/ceiling rules? An operation that proves as sequential arithmetic can still be invalid when invoked while holding a protected object's lock.

Potentially blocking actions such as delay or entry waits cannot be reached from a protected action through direct or transitive calls. B3020 reports such a path. Move the wait outside the protected action, arrange state through an entry barrier, or change the synchronization design. An assumption asserting the wait is “usually quick” does not repair the rule.

Priorities and ceilings

The supported priority/ceiling analysis checks compatible relationships between task priorities and protected objects they use, including nested protected actions. B3021 identifies a caller/object relationship breaking the supported ceiling discipline.

This static check does not give the operating system a real-time scheduler. macOS gives user programs no real-time priorities, so there priorities and ceilings order nothing. Record target and run-time assumptions separately when discussing latency, deadlines or deployment. Race and ceiling checks are not proofs of arbitrary application liveness, fairness or universal deadlock freedom.

Task lifetime and shutdown

Library tasks activate after supported elaboration and can continue after the main returns; the runtime waits for them. A returning main is not proof that the process exits. The run-time allows at most 64 tasks and 256 protected locks, and thread/OS allocation can fail independently of local safety proof.

Verada.Tasking.Stop requests cancellation of other POSIX task threads and exits the caller when it is itself a task. Cancellation is deferred to cancellation points. A CPU-bound task without such a point may continue indefinitely and leave the main waiting in joins. Treat this as a runtime cancellation mechanism, not proved bounded shutdown. A test with waiting workers does not establish every task body stops.

If completed shutdown is a requirement, design and review an appropriate cooperative protocol within supported facilities, prove its local state transitions, and test the actual runtime behavior. Do not promote local variant proof into a scheduler-wide termination theorem.

Volatile and asynchronous state

An external object may change independently of the current operation. The supported Async_Writers, Async_Readers, Effective_Reads, Effective_Writes, volatile and atomic properties tell analysis which assumptions are invalid. For example, two reads of an asynchronously written object need not return the same value.

Read a supported whole value into a local snapshot, then reason about that snapshot where appropriate. Do not prove a property by silently equating two independent hardware reads. The snapshot itself is still only a value obtained at that point, not a promise the external object remains equal to it afterward.

The language restricts non-interfering read contexts and function use. B3022/B3023 can expose a function treating changing external state as a pure stable input, or a read embedded in an unsupported expression context. Volatile_Function permits selected nondeterministic behavior under its rules; it does not make repeated identical calls interchangeable pure values.

External abstract state

An abstraction can expose an external state name and refine it to volatile constituents. Check that the public external properties match the actual device/environment behavior. The abstraction should let clients reason about a single sampled value or a documented operation without exposing unsafe assumptions about the register layout.

No ordinary proof establishes that the environment obeys an unstated rate, range, ordering, or response-time promise. If a driver assumes a sensor value belongs to a range, identify how that is validated or why it is trusted. Use a correct wrapper/type boundary rather than putting arbitrary environment facts into an unreviewed Assume.

Addresses, overlays, and foreign access

The supported address/overlay forms require the documented volatile/atomic and placement restrictions. These prevent ordinary pure-value assumptions from surviving aliasing writes through another address name. They do not prove that the numeric address is mapped, aligned as needed by the actual hardware, safe to dereference, or authorized by the OS.

Review representation, valid memory regions, device side effects, endianness/ABI, synchronization and foreign lifetime separately. A proof of arithmetic forming an address is not a proof of memory-mapped device correctness. Vibe has no native helper for every such aspect; use a validated imported boundary with explicit contracts and trust evidence.

Validation and release evidence

Run check for effects/race/blocking/ceiling errors before attempting local proof. Prove the complete project, then exercise required native/JIT behavior on the actual target. Record which scheduling, external-agent and resource premises remain assumed. Test realistic waits, interleavings, exceptional/resource behavior and shutdown requirements where the platform permits meaningful observation.

External language oracles need a matching model. A plain CPython call of a task-decorated function or protected entry cannot reproduce Verada task activation and barriers, so such programs have no CPython comparison. Likewise a sequential reference execution is not a simulation of all OS schedules. Keep those limits visible in the release record.