# DARKOZA Arrival Graph — Alpha Evidence Report

Date: 2026-11-12  
Version: 0.1.0-alpha.0  
Host: srv7700305575  
Status: EXECUTED_AND_TESTED_LOCALLY / NOT_PUBLIC / NOT_PRODUCTION_APPROVED

## Scope

A separate prototype was added to the existing Darkoza Language directory. The existing DKZ compiler, bytecode format, current release pointer, and production services were not replaced or reconfigured.

Files:
- compiler/arrival_graph.py — parser, dependency resolver, optimizer, evaluator
- bin/dkzg — command-line launcher
- tests/test_arrival_graph.py — graph optimizer and runtime tests
- examples/arrival-graph.dgz — executable sample
- docs/ARRIVAL-GRAPH.md — language design and limitations

## Verified execution

- Full test command: python3 -m unittest discover -s tests -q
- Result: 33 tests passed, 0 failures (20 existing compiler tests + 13 graph-prototype tests).
- CLI check: passed for examples/arrival-graph.dgz.
- CLI run with x=7, y=9: product_a=63, product_b=63, sum=126.
- The sample removed one unused glyph and shared the multiplication node used by two outputs.
- Synthetic redundancy test: 1,000 reachable glyph declarations all represented the same multiplication; the optimized graph contained one operation node and the evaluator executed one multiplication. Counted operation reduction: 1,000x for this specific intentionally repetitive graph. This is not a wall-clock speedup or a representative workload benchmark.

## Source SHA-256

- compiler/arrival_graph.py: aefbd64d44466b406cdc6b73d5e34a6ef7ff529188aa79d1494708049ea087c0
- bin/dkzg: a3f12d5ead050c3e6acaaff4c293acaed2965199e35f93f3b2578b1efa9c1cdf
- tests/test_arrival_graph.py: 2c315e4ebeb865241e479f75fbc15c5a9723a0c797616f5e29c7cdca55d5abd1
- examples/arrival-graph.dgz: 82b1ff8eb08c7d2f58611d3fc26d57b6bce5552d0696e5d8fc4cc895bc555fc8
- docs/ARRIVAL-GRAPH.md: 0958c9c821a6568561e827abf264e63edf6232dacc4f2bfbdc4f4926e3d0d4f3

## Safety and deployment boundary

The source language currently supports only bounded, pure signed 64-bit integer operations: add, subtract, multiply, and negate. It has source, declaration, output, and graph-depth bounds; it rejects unknown references, dependency cycles, invalid inputs, and integer overflow. It has no shell, filesystem, network, dynamic import, user callback, native-code, or foreign-function capability.

This is not a production sandbox, a formally verified compiler, an independently audited security boundary, a native-code compiler, or a self-hosted compiler. The code was staged on the primary server only. No public execution endpoint, public package, customer route, or chat UI integration was deployed.

Public execution is BLOCKED_PENDING: independent security review; property/fuzz and differential tests; a resource-isolated worker and rate limits; representative CPU/memory/latency benchmarks; packaging and licensing decision; reproducible build and rollback procedure; and a public interface with explicit user-visible experimental status.

At inspection, the primary root filesystem was 97% used with about 12 GB free, and swap was 3.9/4.0 GB used. This capacity condition is an additional reason not to expose an untrusted execution service now.

## Next technical milestones

1. Differential/property testing against a simple reference evaluator.
2. Extend types and graph operations without weakening overflow or type guarantees.
3. Add proof-preserving rewrite search (e-graphs/equality saturation) with strict node/time budgets.
4. Add incremental invalidation and memoization for changing inputs.
5. Evaluate parallel scheduling, SIMD, and native backends only where measured profiles justify them.
6. Benchmark representative Darkoza/OERSI workloads against current Python, bytecode, and established native baselines.
7. Gate any public execution release on security review and reproducible production validation.



## Equality-saturation extension — 2026-11-12

A bounded e-graph optimizer was added as an optional module: compiler/equality_saturation.py. The existing graph compiler calls it only when the user passes --optimize. The default path and the production application remain unchanged.

### Additional verified results

- Full test suite: 42 tests passed, 0 failures (20 original DKZ compiler tests, 13 Arrival Graph tests, 9 E-Graph tests).
- bin/dkzg check examples/optimized-graph.dgz --optimize: passed.
- bin/dkzg run examples/optimized-graph.dgz --inputs '{"x":123456789}' --optimize: returned 123456789 with zero arithmetic operations executed.
- Five identity operations were eliminated using safe rewrites: add-zero, multiply-one and subtract-zero.
- Overflow preservation test passed, including a case where multiplying an overflow-producing expression by zero must still fail. The optimizer deliberately does not apply that unsafe rewrite.
- E-graph budget-exhaustion test confirms fallback to the original graph.
- Python bytecode compilation of the compiler, optimizer, CLI and benchmark passed.

### Synthetic warm-run benchmark

Seven samples, 20,000 executions per sample:

- Baseline: 5 arithmetic operations; median 6,395.27 ns per execution.
- Optimized: 0 arithmetic operations; median 1,594.39 ns per execution.
- Warm-run ratio: approximately 4.01x for this synthetic identity-only workload.
- Compiler time in the measured run: 236,767 ns; optimizer time: 218,794 ns.
- Approximate break-even: 46 reuses, using optimizer cost divided by median per-run savings.

This is not representative of general workloads and excludes I/O, process startup, network, queueing, and memory contention. The timing sample is environment-specific and not a production SLO.

### Rewrite safety policy

Only identities that preserve observable checked-overflow behavior are enabled. Distributivity, factoring, x-x=0, x*0=0, and double-negation are intentionally excluded for arbitrary Int64 input because they can remove an intermediate operation that would otherwise trap. They require static range proofs or a changed, explicitly versioned arithmetic semantics.

### Release boundary

The e-graph optimizer remains experimental and opt-in. No native-code backend, formal verification, independent security review, public API, online code execution endpoint, or production integration was performed. User-facing public preview may be read-only and downloadable only; hosted execution remains blocked pending an isolated worker, rate/CPU/memory quotas, and independent security review.



## Final alpha.1 verification addendum — 2026-11-12

The CLI and compiler metadata are now explicitly versioned as 0.1.0-alpha.1. The version is present in compiled graph metrics and exposed through bin/dkzg --version.

Latest clean verification:
- Full project suite: 43 tests passed, 0 failures.
- Python py_compile: passed for parser/compiler, E-Graph optimizer, CLI and benchmark.
- Optimized sample: output 123456789; runtime arithmetic operations executed: 0.
- Public ZIP download was fetched through the primary origin and its SHA-256 matched the server-side package byte-for-byte.
- Public route was served by both primary Caddy and the edge HTTPS gateway with HTTP 200 and the expected restrictive Content-Security-Policy (script-src 'none').

Latest seven-sample warm benchmark, 20,000 executions per sample:
- Baseline median: 6,409.71 ns/execution; 5 arithmetic operations.
- Optimized median: 1,626.48 ns/execution; 0 arithmetic operations.
- Warm-run ratio: 3.94x for this synthetic identity-only workload.
- Compiler time: 198,775 ns; optimizer time: 213,169 ns.
- Approximate break-even for optimizer cost: 45 repeated executions.

The earlier 42-test and 4.01x figures in this append-only report describe the preceding alpha.0/alpha.1 development run; the final alpha.1 result is 43 tests and 3.94x on the latest recorded sample. No public hosted execution endpoint or production chat integration has been enabled.
