{"id":"stock-exchange-validates-complex-write-correctness","text":"The stock exchange demonstrates that write-path structural correctness scales to complex multi-step mutations: price-time priority matching is a composite write operation (match against book, fill partial orders, cancel or rest the remainder) where structural discipline (FIFO deques, sorted price levels) ensures each step is valid — write correctness handles compositional complexity, not just single-step simplicity.","truth_value":"IN","source":"","source_url":"","source_hash":"","justifications":[{"type":"SL","antecedents":["stock-exchange-matching-produces-valid-trades","write-path-is-self-consistent-by-design"],"outlist":[],"label":"Stock exchange proves write-path structural correctness scales to composite multi-step operations"}],"dependents":["write-correctness-scales-from-routing-to-matching"],"metadata":{"last_reviewed":"2026-06-06T06:26:57","review_result":"pass"},"created_at":"","updated_at":"","reviewed_at":"","verified_at":"","retracted_at":"","explanation":{"steps":[{"node":"stock-exchange-validates-complex-write-correctness","truth_value":"IN","reason":"SL justification valid","antecedents":["stock-exchange-matching-produces-valid-trades","write-path-is-self-consistent-by-design"],"label":"Stock exchange proves write-path structural correctness scales to composite multi-step operations"},{"node":"stock-exchange-matching-produces-valid-trades","truth_value":"IN","reason":"SL justification valid","antecedents":["stock-exchange-price-time-priority"],"label":"price-time priority is correctly implemented but assumes valid quantity, price, and side; a negative quantity or missing price would propagate through matching and produce nonsensical trades","outlist":["stock-exchange-no-input-validation"]},{"node":"stock-exchange-price-time-priority","truth_value":"IN","reason":"SL justification valid","antecedents":["stock-exchange-aggressive-then-rest","stock-exchange-fifo-matching","stock-exchange-resting-price-execution"],"label":"Three beliefs compose into the canonical exchange matching semantic — aggressive-first + price-level FIFO + maker-price execution"},{"node":"stock-exchange-aggressive-then-rest","truth_value":"IN","reason":"premise"},{"node":"stock-exchange-fifo-matching","truth_value":"IN","reason":"premise"},{"node":"stock-exchange-resting-price-execution","truth_value":"IN","reason":"premise"},{"node":"write-path-is-self-consistent-by-design","truth_value":"IN","reason":"SL justification valid","antecedents":["structural-discipline-prevents-consistency-bugs","write-time-decisions-are-lightweight-but-binding"],"label":"Data-level structural invariants and control-level routing simplicity jointly eliminate write-path consistency bugs"},{"node":"structural-discipline-prevents-consistency-bugs","truth_value":"IN","reason":"SL justification valid","antecedents":["immutable-values-prevent-aliasing-bugs","multi-structure-sync-invariant"],"label":"immutability (KV vector clocks, leaderboard reinsert) prevents mutation aliasing; multi-structure sync (consistent hashing, leaderboard) prevents index divergence — leaderboard uses BOTH, showing these disciplines are complementary"},{"node":"immutable-values-prevent-aliasing-bugs","truth_value":"IN","reason":"SL justification valid","antecedents":["kv-vector-clock-immutable","leaderboard-update-by-remove-reinsert"],"label":"Immutable-value semantics eliminate shared-reference aliasing at the cost of allocation overhead"},{"node":"kv-vector-clock-immutable","truth_value":"IN","reason":"premise"},{"node":"leaderboard-update-by-remove-reinsert","truth_value":"IN","reason":"premise"},{"node":"multi-structure-sync-invariant","truth_value":"IN","reason":"SL justification valid","antecedents":["ch-triple-bookkeeping","leaderboard-dual-index-consistency"],"label":"Multi-structure sync is a recurring correctness burden where the failure mode is silent divergence"},{"node":"ch-triple-bookkeeping","truth_value":"IN","reason":"premise"},{"node":"leaderboard-dual-index-consistency","truth_value":"IN","reason":"premise"},{"node":"write-time-decisions-are-lightweight-but-binding","truth_value":"IN","reason":"SL justification valid","antecedents":["fan-out-write-pushes-references-not-data","write-time-routing-is-irrevocable"],"label":"Fan-out pushes references (lightweight) and routing decisions are permanent (binding) — the write path optimizes for speed at the cost of flexibility"},{"node":"fan-out-write-pushes-references-not-data","truth_value":"IN","reason":"SL justification valid","antecedents":["chat-fanout-on-write","news-feed-fan-out-write-pushes-ids"],"label":"Reference-based fanout limits write amplification to pointer-sized payloads"},{"node":"chat-fanout-on-write","truth_value":"IN","reason":"premise"},{"node":"news-feed-fan-out-write-pushes-ids","truth_value":"IN","reason":"premise"},{"node":"write-time-routing-is-irrevocable","truth_value":"IN","reason":"SL justification valid","antecedents":["news-feed-celebrity-threshold-at-write-time","chat-fanout-on-write"],"label":"news feed selects fan-out-on-write vs fan-out-on-read based on follower count at publish time; chat routes to inbox or offline queue based on presence at send time — both decisions are baked in at write time and not revisited"},{"node":"news-feed-celebrity-threshold-at-write-time","truth_value":"IN","reason":"premise"}]}}