<!-- Sema documentation — §4. Execution model overview
     Sema is a new AI-native, neurosymbolic programming language most models
     have not been trained on. Full corpus: https://sema.49.12.246.95.sslip.io/llms-full.txt
     Install language support: https://sema.49.12.246.95.sslip.io/install-skill/ -->

# §4. Execution model overview

> Sema language specification — §4 Execution model overview.

> Generated from `docs/LANGUAGE.md` §4. This is the normative specification; for a guided tour see the Language and Neurosymbolic sections.

(Details in RUNTIME.md; stated here because construct semantics depend on it.)

1. **Event-sourced semantics.** Every nondeterministic boundary event — model call (prompt,
   seed, model hash, output), embedding, contract verdict, policy decision, monitor sample —
   is recorded in a hash-chained append-only event log. Replay against the log is the
   *definition* of deterministic reproduction; the same substrate powers the semantic debugger,
   `monitor` windows, self-healing context, and training-data export
   ([02](./research/02-aion-os.md); [12 §4.4](./research/12-syntax-dx.md); Gen traces,
   [PLDI 2019](https://dl.acm.org/doi/10.1145/3314221.3314642)).
2. **Parallel by default.** Independent dataflow branches execute concurrently under
   structured-concurrency scopes (§5.12); there is no GIL. Model calls are non-blocking
   effects; the scheduler batches them (continuous batching default,
   [06](./research/06-runtime-substrate.md)) — SGLang's co-design lesson: program structure is
   a cache/batch opportunity ([04 §2.1](./research/04-ai-native-languages.md)).
3. **Two-phase generation.** Constructs with distributional semantics use free reasoning →
   constrained emission, never whole-output token masking, which distorts distributions and
   reasoning ([CRANE](https://arxiv.org/abs/2502.09061);
   [Grammar-Aligned Decoding](https://arxiv.org/abs/2405.21047)).
4. **Serial decode budget is a semantic parameter.** A `simulate` call's expressive class and
   reliability scale with granted decode length
   ([Merrill & Sabharwal, ICLR 2024](https://openreview.net/pdf?id=CDmerQ37Zs)); budgets appear
   in signatures and are enforced by the scheduler with typed budget-exceeded errors.
5. **One incremental query engine.** Compiler, LSP, verification memos, and the semantic
   knowledge graph are one Salsa-style red-green database
   ([12 §4.1](./research/12-syntax-dx.md); [11](./research/11-semantic-memory.md)); contracts
   in signatures act as cache firewalls ([09 §3.2](./research/09-verification-testing.md)).

---
