The Application Model

Alongside its code-generation IR (basic blocks, instructions, and registers), the Hale compiler frontend derives an ApplicationModel: a canonical relational…

Alongside its code-generation IR (basic blocks, instructions, and registers), the Hale compiler frontend derives an ApplicationModel: a canonical relational graph of what the program is—its loci, ownership tree, call sites, bus pub/sub edges, thread placements, effect classes, and quantitative costs. Every static analysis pass, claims { } verifier, bus dispatch planner (DispatchPlan), and topology artifact exporter queries this single model rather than re-walking the AST.

type Held = Holder;
main locus App {
params {
h: Held = Holder { }; // arranged as App.h (realizing Holder)
r: Router = RouterV1 { }; // arranged as App.r (realizing RouterV1)
workers: Worker = Worker { };
}
placement {
h: pinned; // App.h and its subtree run on pinned:App.h
workers: pinned(cores = 0..4, replicas = 4);
}
}

Inspect the derived model for any seed or file using the CLI:

Terminal window
hale model dump app.hl

Single Canonical Derivation (I7)

Section titled “Single Canonical Derivation (I7)”

A semantic fact about a program—which functions a method calls, which handlers a bus publish reaches, or which supervisor owns a child instance—has one authoritative producer in the compiler:

Explicit Horizons: Holes, Capabilities, and Verdicts (I8)

Section titled “Explicit Horizons: Holes, Capabilities, and Verdicts (I8)”

A static graph that only records discovered edges cannot distinguish “no edge exists” from “the analysis could not see past an indirect call.” To prevent unresolvable code from silently passing negative claims (forbid reaches(...) or @effects(none: { ... })), ApplicationModel records every analysis boundary as a typed Hole row:

Hole {
at: Function(cache_lookup),
kind: IndirectCall,
hides: CALLS | EFFECTS | COSTS,
reason: "call through `f`",
}

Conversely, the model records positive Capability rows to certify which fact families are closed and complete, rather than inferring completeness from the absence of warnings.

The Four Verification Verdicts

Section titled “The Four Verification Verdicts”

Because the model tracks both edges and Holes, every claim or contract check produces one of four verdicts:

Verdict Build Outcome Meaning & Action
holds Pass The property is proved over a complete, hole-free subgraph.
violated Error Disproved; the compiler prints a concrete witness counterexample path. Fix the program edge or update the law.
uncertified Error The statement is well-formed, but traversal encountered a Hole hiding CALLS, EFFECTS, or COSTS. Replace the opaque construct (e.g., function pointer or out-of-arrangement birth) so static analysis can close the graph.
invalid Error The claim itself is malformed (such as referencing an unknown identifier or an empty group without may_be_empty).

Whole-Program Properties

Section titled “Whole-Program Properties”

Holding the entire assembled program in ApplicationModel enables checks that per-function analysis cannot express:

Property Annotation / Claim How ApplicationModel Verifies It
Cross-bus transitive effects @effects(none: { fs }), forbid reaches(A, effects(syscall)) Follows edges across Topic <- payload; into every matching subscriber handler in the closed topic graph.
Backward causal influence @effects(depends: { TopicA, TopicB }) Walks the message and call graph backward to verify the complete set of upstream topics that can transitively trigger or influence a locus.
Fan-out amplification @budget(fanout = 8) Counts the maximum transitive subscriber deliveries caused by a single call across runtime replica registrations and routing keys.

Quantitative Graph Semantics

Section titled “Quantitative Graph Semantics”

Quantitative checks such as @budget(fanout = N) require counting executions rather than set reachability. ApplicationModel enforces two rules to keep quantitative counts exact:

1. Site-Grained Rows vs. Reachability Sets

Section titled “1. Site-Grained Rows vs. Reachability Sets”

Call and publish tables store one row per syntactic call or publish site, not one row per (caller, callee) pair:

2. End-to-End Scenario Aggregation

Section titled “2. End-to-End Scenario Aggregation”

When computing worst-case maxima over branching keys or polymorphic interface conformers, the analyzer evaluates each coherent scenario (a single routing key or single concrete interface conformer) end-to-end before taking the maximum:

max(immediate) + union(downstream) != max(immediate + downstream)
sum over sites of max over branches != max over branches of sum

Aggregating early (left-hand side) would combine the immediate cost of one routing key with the downstream cost of a different key, or sum two mutually exclusive interface conformers as if a single dispatch invoked both. Evaluating complete scenarios first (right-hand side) keeps bounds tight.

Instance Arrangement & Placement Projection

Section titled “Instance Arrangement & Placement Projection”

The model’s instance tables—recording which locus instances exist, their parent-child ownership tree, their assigned thread domain, and their CPU core affinity (affined_to)—are projected directly from the compiler’s placement table:

In-Process ApplicationModel vs. Out-of-Process Artifacts

Section titled “In-Process ApplicationModel vs. Out-of-Process Artifacts”

ApplicationModel exists only in memory inside the compiler process and is constructed exclusively by checking source code.

Out-of-process tools—such as hale fleet check when composing multiple binaries—read the topology artifact, which serializes a compact ComponentModel projection under a cryptographic shape_hash alongside lowered laws, capabilities, and adequacy summaries. The artifact is intentionally a one-way projection: out-of-process consumers run the shared reachability engine over ComponentModel and verify artifact digests rather than reconstructing a full compiler ApplicationModel.

Further Reading

Section titled “Further Reading”