Computer program 2026-11-05
A computer program specifies operations or constraints that an implementation can execute or interpret. Its representation can be source code, bytecode or machine code; the same intended computation can have several computer program representations. Its behavior depends on the language semantics, input and execution environment.
For example, a source expression adding two variables is not yet one fixed result. A compiler can translate it into lower-level operations, while an interpreter or CPU performs those operations for particular values. Calling a library or reading a file makes additional parts of the environment relevant. A computer program is consequently distinct from its one observed execution trace and from the abstract algorithm it implements: two programs can implement the same algorithm with different representations, error behavior or resource costs.
CSP choice Created 2026-10-31 Updated 2026-11-05
In communicating sequential processes, CSP choice combines possible process behaviours. With external choice , an offered CSP event selected by the environment can determine which branch proceeds. Internal choice leaves the branch selection nondeterministic from the environment's viewpoint. For example, choosing externally between receiving
left and receiving right offers both alternatives; internally choosing a branch can remove one offer before the environment acts. Sets of execution traces alone can hide this distinction, so CSP failures semantics also records CSP refusal sets of CSP events that may be declined. Deterministic algorithm 2026-11-05
A deterministic algorithm has one prescribed next step for each permitted input and current computational state. Thus the same input and initial state give the same execution trace and, if execution terminates, the same output. This is a statement about the abstract transition rules, not about identical elapsed time on different computers.
Binary search with a fixed midpoint rule is deterministic: every comparison determines which remaining interval is searched next. Quicksort with a fixed pivot-selection rule is also deterministic, even though different inputs can produce very different running times. Determinism therefore does not imply a constant or small time complexity.
A randomized algorithm additionally receives random choices. Fixing its entire random-choice sequence makes its subsequent execution deterministic, but averaging over those choices is essential to its randomized guarantees. A Nondeterministic Turing machine is a different mathematical model: its branches describe possible computation paths, rather than a probability distribution supplied by an implementation.
Execution trace 2026-11-05
An execution trace records the ordered steps or observations of one program execution under a chosen observation model. It might record machine instructions, state changes, procedure calls or visible communication events. The model determines what is hidden; two traces cannot be compared meaningfully without knowing their event vocabulary.
For two threads each incrementing a shared counter, a trace can record both reading zero before either writes one. Its final counter value is one even though two increments were requested. A different interleaving can produce two. One observed successful trace therefore does not establish correctness of all permitted interleavings. In communicating sequential processes, a trace conventionally records visible CSP events; internal transitions are omitted. Such a trace records what occurred but does not by itself say which unperformed events were available.