On this page
Declarations, statements, and control flow
Statements execute in order within a subprogram, block, package elaboration, task, or supported protected operation. Declarations create names and, where specified, initialize objects. An object's mutability, initialized parts, subtype, and ownership determine which subsequent statements are legal.
Objects, constants, and initialization
An initialized object receives a value when its declaration is elaborated. A constant cannot later be assigned. A variable can change subject to its subtype and alias rules. Varc distinguishes let and var; Vibe infers supported local constness from assignment and mutation rather than requiring either word.
An absent initializer does not generally create an arbitrary readable scalar. Access objects default to null; record components and array elements can have defaults. Flow analysis checks every path that reads a value and every required initialized component. A whole-composite operation can require more initialized parts than a single component assignment does.
out parameters must be assigned as required before a normal return. An in out parameter supplies an incoming value and must remain valid on return. Global initialization and package elaboration have analogous checks. Relaxed_Initialization permits supported partial-initialization reasoning; it does not permit reading an uninitialized part as though it contained a valid arbitrary value.
Assignment and component updates
Assignment evaluates a supported right-hand value and stores it in a writable target. The target must be a variable, writable component, slice, dereference, or another supported view. Assignment to a constant or an in parameter is illegal. Type conversion is not implicit permission to reinterpret unrelated storage.
Storing a value introduces its target constraints: scalar range, predicate, null exclusion, array length/shape, discriminant, and other applicable checks. A successful type match does not establish these obligations. An owning value is moved rather than freely copied; a limited value has additional restrictions. See ownership.
Updating one component can preserve other components, but an overlapping source/target or two mutable aliases still requires valid semantics. Vibe tuple assignment and selected collection operations have their own lowering rules for simultaneous values, views, and mutation; a Python assignment is not a general reference rebinding model.
Procedure calls
A procedure call performs an operation using its argument modes and contracts. Writable actual arguments must be valid variable views. Varc requires & on out/inout actuals. Vada expresses modes in the declaration; Vibe infers modes from component mutation and returns scalar results (see subprograms). Calls must establish preconditions and avoid forbidden argument/global interference.
After a call, modular proof uses the operation's postconditions and effects, not every implementation statement in its body. State that the contract permits the callee to change cannot simply be assumed unchanged. See subprograms.
Branches and case statements
An if selects the first true branch and otherwise the alternative, if present. Conditions must be Boolean. Only the selected statements execute. Facts from a condition become available for proof inside that branch, but only facts valid on every incoming path survive a later merge.
A case statement selects among discrete choices. Choices must have the required type, coverage, and non-overlap. The choices must cover the selector's subtype when it is static: over a record component (case P.S is with S : Shape, where Shape is a static subtype of an enumeration), the alternatives cover Shape's values, not the whole type's. others covers otherwise unlisted possibilities where allowed. A case statement need not produce a value; a case expression does. Vibe match additionally supports its enumerated class/union patterns, with exclusions listed in the syntax reference.
Loops and iteration
| Loop | Execution rule | Proof considerations |
|---|---|---|
| Unconditional loop | Repeats until a transfer exits it | A terminating context needs a valid variant or established finite scheme |
| While loop | Tests its Boolean condition before each iteration | Invariant and termination obligations are separate |
| Discrete for loop | Visits a finite range in its specified direction | The loop parameter is controlled by iteration and is not writable |
| Array/container element loop | Visits the supported iterable domain | Bounds/protocol and mutation restrictions apply |
| Filtered loop | Runs the body only for elements satisfying its filter | Predicate is evaluated safely for visited source values |
| Lockstep loop | Advances supported sources together and stops at the shortest | Each source's origin, bounds, and terminal state matter |
Bounds and source values are established according to the accepted iterator form. An empty range executes no body. Reverse iteration changes traversal direction rather than negating an element. Vibe's half-open range and zero-based collection indices map to these rules through its frontend; do not substitute Vada inclusive-range syntax mechanically.
A loop invariant must hold each time execution reaches its placement. Preservation means the next iteration reaches it with the condition still true. At a loop cut, the prover does not retain arbitrary facts about variables modified by the loop. State the bounds, relationships, and unchanged regions that later checks need. Placement can be before or after a meaningful statement; adapt the formula to the point it describes.
A loop variant measures progress in a bounded domain. A decreasing part must decrease, or an increasing part increase, in the supported lexicographic form. An invariant that only describes safety does not establish progress. Functions, procedures marked Always_Terminates, and finalizers require the applicable termination obligations; ordinary procedures are not universally required to terminate.
Exiting and continuing
exit/break leaves the selected enclosing loop, optionally under a Boolean condition. Supported named loops allow an explicit target where the syntax permits it. The transfer also exits nested scopes and triggers applicable cleanup. A loop parameter cannot be changed to simulate a different iteration protocol.
Varc and Vibe have continue, which goes on with the loop's next iteration. Vada, like Ada, has none, and expresses the same with a conditional remainder of the loop body. goto and statement labels are excluded; loop and block names are a different construct.
Blocks and local lifetime
A block introduces local declarations and a statement sequence, optionally with exception handlers. Local objects become usable after their declaration/initialization and cease being live when their scope is left. Returns, loop exits, and exception propagation can leave several nested scopes, requiring the same applicable resource checks and finalization.
Do not hold an escaping view of a local object beyond its permitted lifetime. Shadowing a name creates another declaration, not a way to keep the previous object's storage alive. The REPL's declaration versioning and dropping rules are separate operational behavior.
Returns and null statements
A function return supplies a value of the declared result type and constraint. A procedure return supplies no ordinary value, though its output parameters and exceptional policy still matter. Each return must meet postconditions and required output/ownership state. Reaching the end of a function without its required result is not a successful undefined return.
The accepted extended-return form creates a named result object and can build supported limited results in place. A result initializer or subsequent return-object statements must still establish the result's subtype, invariant, and resource obligations. It is not a general exception to limited-copy restrictions.
A null/pass statement performs no computation. A null procedure remains an operation whose public contract must be satisfied. It cannot claim an arbitrary postcondition merely because its body is empty.
Assertions, exceptions, and delays
Assertions require their Boolean condition at the point reached. Assumptions are trusted rather than proved and are reported as such. Loop annotations and ghost statements obey their placement and noninterference rules; see contracts.
Raise and handler statements follow exception rules. Delays and protected entry calls can block and are prohibited in contexts where blocking is forbidden; see concurrency. A development-mode runtime-check failure does not become a normal user exception simply because the syntax includes an exception handler.