docs: paper §theory correctness proofs (combine, write-barrier, backfill) - #77
Merged
Merged
Conversation
…ill) Rewrites docs/proofs.md to a per-proof structure (Statement / Setup- Lemmas / Proof / Caveats / Code anchors) for paper-blocker #5: - §2 combine_statistic correctness across schema-timeline segments: additive stats sum-bound, idempotent stats max-bound, non-combinable stats return Partial. - §3 Write-barrier safety: post-force_expire samples never reach any query, by chasing the sample through route_decoded_samples -> is_writable -> dropped. - §4 Backfill determinism: under the three §10.5 invariants enforced by BackfillRegistry::create_checked, build_backfilled_accumulator produces bit-identical bytes to a live SumAccumulator-style path (induction on sample-stream length). Each proof cites the runtime functions it relies on by symbol name (line-number-stable). Marks TODO.md item 5 done with a pointer to proofs.md; no source files touched. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rewrites
docs/proofs.mdto a per-proof structure (Statement / Setup-Lemmas / Proof / Caveats / Code anchors) for paper-blocker #5 — three formal correctness theorems the §theory chapter draws from:combine_statisticcorrectness across schema-timeline segments — additive stats (Count / Sum) bounded by the sum of per-segment errors; idempotent stats (Min / Max) bounded by the max; non-combinable stats (Cardinality / Quantile / Topk / Rate / Increase) safely returnPartial. Direct case-analysis proof relying on disjoint covering bySchemaRegistry::timeline_for_metricand the triangle inequality.force_expire(agg_id)reaches any query result. Direct path-chase:force_expireis monotonic on(retired_at_ms, expires_at_ms)AggSchema::statusreturnsExpiredthereafteris_writablerejectsroute_decoded_samplesdropsbuild_backfilled_accumulatorproduces bit-identical sketch bytes to a hypothetical live worker fed the same samples in the same order. Induction on sample-stream length, leveraging the §10.5 invariants enforced byBackfillRegistry::create_checked(known agg / time-disjoint / within retention) and the sharedcreate_accumulator_updaterfactory.Each proof cites runtime functions by symbol name (line-number-stable), lists caveats explicitly (clock skew, cross-language byte parity, HashMap-iteration order, etc.), and cross-links the corresponding sections of
design-sketch-db-core.md.TODO.mditem 5 marked done with a pointer.Touches only:
docs/proofs.md(full rewrite).TODO.md(one section header + bullet update).No source
*.rsfiles modified.Test plan
docs/proofs.mdin mkdocs / GitHub markdown — confirm$...$math renders, tables render, internal anchors (./design-sketch-db.md,./design-sketch-db-core.md) resolve.grep -n 'fn combine_statistic'inengines/timeline_dispatch.rs,grep -n 'fn force_expire\|fn is_writable\|fn status\|fn timeline_for_metric'instores/sketch_db/schema.rs,grep -n 'fn create_checked\|fn build_backfilled_accumulator'instores/sketch_db/{backfill,backfill_window_builder}.rs.backfill_builds_bit_identical_sum_accumulator_to_livestill passes:cargo test -p asap-query-engine backfill_builds_bit_identical_sum_accumulator_to_live.TODO.mditem-5 link todocs/proofs.mdresolves.🤖 Generated with Claude Code