Chapters · Chapter 13

The Single-Node Tour, with Theorems

Part V — The Theorem · seven builds, seven receipts

The spirit of this chapter's exercises is single-node-first: every build starts on the trivial atlas where the sharded answer must equal the unsharded one bit-for-bit, then widens the cut until the geometry costs you something the receipt can name. The receipts you produce will be Rust test passes against src/sharded/execution.rs, byte-equality assertions against wrap_trivial, and live numbers off examples/sharding_penguins.rs that you compare against my BLD-CH13-PENGUIN-LIVE-OUTPUT.

Run it live — GQL console

Point at the public read-only instance (no key needed) or your own engine (start it with GIGI_CORS_ORIGIN=* for browser access — dev only).

E13.1Reproduce the penguin walk end-to-end

Build

Run cargo run --release --features kahler,sharded --example sharding_penguins on a clean checkout and capture all three blocks of output — unsharded baseline, three-chart hash sharding, Möbius holonomy — into a single log file.

Receipt

Your log shows \(K_{\text{global}} = 0.128159\) on Run [1], \(|K_{\text{sharded}} - K_{\text{unsharded}}| = 2.1076 \times 10^{-3}\) (relative 1.64%) on Run [2], and \(\det(H) = -1.000\) with orientation_flipped = true on Run [3]; diff against the verbatim numbers in BLD-CH13-PENGUIN-LIVE-OUTPUT and confirm zero drift.

Bonus

Re-run with --features sharded only (drop kahler) and watch which output blocks degrade to typed refusals at the Kähler-gate boundary.

E13.2Instrument the trivial-atlas identity test

Build

Fork shard_curvature_on_trivial_atlas_matches_inner_store at src/sharded/execution.rs:734-750, parameterize it over record counts \(n \in \{1, 20, 200, 2000\}\), and emit the wall-clock cost of the wrap_trivial path versus the direct BundleStore path.

Receipt

A passing test shard_curvature_trivial_byte_identical_across_sizes that asserts assert_eq! on k_sum and k_count for every \(n\), plus a printed table showing the wrap overhead stays below a constant factor of the direct path — the engine charges nothing for the option that chapter 1 promised.

Bonus

Insert one NaN record and confirm both paths return the same NaN-poisoned aggregate, not different ones.

E13.3Refute T2 by perturbing the stereographic atlas

Build

Take theory/poincare_to_sharding/validation/t2_cocycle_bound.py and sweep the perturbation magnitude \(\varepsilon\) across \(\{10^{-4}, 10^{-3}, 10^{-2}, 10^{-1}\}\) on the three-chart stereographic atlas \((N, S, E)\) on \(S^2\), fitting the log-log regression slope of \(\delta_{\text{cocycle}}\) versus \(\varepsilon\).

Receipt

Your fitted slope lands within \(\pm 0.05\) of my \(0.924\) figure from BLD-CH13-T2-RECEIPT; the analytic-atlas baseline (no perturbation) returns a max discrepancy below \(10^{-13}\) across 200 triple-overlap samples, matching my \(1.78 \times 10^{-14}\).

Bonus

Push \(\varepsilon\) to \(1.0\) and observe where first-order linearity breaks — the bound stops being honest before the manifold does.

E13.4Forge a Fiedler-sharded penguin run

Build

Edit examples/sharding_penguins.rs to swap the wrap_hash_sharded call for wrap_fiedler_sharded (the constructor exercised at src/sharded/sharded_bundle.rs:782) and rerun the three-chart curvature aggregation on the same forty-five records.

Receipt

Your \(|K_{\text{sharded}} - K_{\text{unsharded}}|\) drops below the \(2.1076 \times 10^{-3}\) hash-partition number, ideally toward the analytic floor T3 names; the per-chart species concentration printout shows Adelie/Chinstrap/Gentoo landing in distinct charts at \(\geq 75\%\) concentration, matching the test contract at :782.

Bonus

Compute the K-drift collapse ratio against the hash baseline and pin it as a numerical lower bound for the spec recommendation the demo prints twice but does not execute.

E13.5Stress the Möbius holonomy carry

Build

Walk shard_holonomy_around_loop at src/sharded/execution.rs:410 around a four-chart closed path whose transitions compose to (a) the identity, (b) a single Möbius reflection, (c) a double Möbius reflection.

Receipt

Case (a) lands \(\det(H) = +1.000\) and orientation_flipped = false; case (b) lands \(\det(H) = -1.000\) and orientation_flipped = true (mirroring the BLD-CH13-PENGUIN Möbius result); case (c) lands \(\det(H) = +1.000\) again — the \(\mathbb{Z}_2\) closes. Cross-check against holonomy_four_chart_path_is_transition_product at :1214.

Bonus

Inject a non-trivial gauge generator \(h(x) = x\) as in t4_sharded_holonomy.py and confirm the round-trip phase still lands within \(10^{-4}\) of \(e^{-i} = 0.540343 - 0.841534j\).

E13.6Replay T1 BETTI on the three named fixtures

Build

Run shard_betti_mayer_vietoris (Kähler-gated, src/sharded/execution.rs:201) against the three fixtures from BLD-CH13-T1-RECEIPT — \(S^1\) as two arcs, \(S^2\) as two half-tetrahedra, \(T^2\) on a \(3 \times 3\) strip cover — and record per-chart Betti vectors alongside the assembled global Betti.

Receipt

Per-chart Bettis disagree with global Bettis on every fixture (the arc has \(\beta_1 = 0\) but \(S^1\) has \(\beta_1 = 1\)); the Mayer-Vietoris assembly returns integer-equal ground truth for all three, and mv_betti_correction_recovers_truth_at_four_charts at :910 plus the eight-chart variant at :925 both pass.

Bonus

Add a fourth fixture — the Klein bottle on a four-strip cover — and confirm the assembly recovers \(\beta_0 = 1, \beta_1 = 1, \beta_2 = 0\) over \(\mathbb{Z}_2\) coefficients.

E13.7Benchmark the n_charts fork

Build

Hit the live /v1/bundles/{name}/sharded/curvature endpoint (mounted at src/bin/gigi_stream.rs:14496-14506) with n_charts \(\in \{1, 2, 4, 8, 16\}\) on a synthetic 1000-record bundle, and instrument the wall-clock and the returned \(K\)-mean at each setting.

Receipt

A scrape table where \(n_{\text{charts}} = 1\) returns the byte-identical answer the trivial-atlas branch promises and the higher-\(n\) runs drift by a bounded percentage you name; the fork at :3527-3540 is the only difference between the two code paths, and your numbers prove the single-node branch costs zero extra.

Bonus

Wire a Prometheus counter for which branch the fork took and watch the ratio as you sweep traffic — the trivial atlas should dominate the small-bundle regime.

← Chapter 12 exercisesChapter 14 exercises →