Skip to content

Conversation

@cristianoc
Copy link
Contributor

@cristianoc cristianoc commented Nov 28, 2025

Summary

This PR adds a formal semantics for Skip's reactive reduce combinator, including a paper and a Lean formalization.

What's Included

  • Paper (reduce.tex): Formal semantics for Skip's reduce combinator with correctness proofs
  • Lean formalization (lean-formalisation/): Machine-checked proofs of the main theorems

Key Contributions

  1. Formal semantics: Denotational semantics for reduce as a derived view over collections
  2. Correctness characterization: Theorem proving that incremental correctness holds if and only if the reducer is well-formed (i.e., is the inverse of )
  3. Complexity contract: Well-formed reducers admit O(1) per-key updates, while partial reducers fall back to recomputation
  4. User-facing specification: Provides developers with a precise condition for writing correct custom reducers

Main Results

  • Theorem (Equivalence): Incremental updates are correct if and only if the reducer is well-formed
  • Well-formedness condition: (fold_⊕(ι, M) ⊕ v) ⊖ v = fold_⊕(ι, M) for all reachable accumulator states
  • Examples: Formal treatment of sum, count, and min reducers, with complexity analysis

What Distinguishes This Work

Unlike related systems (Flink, Kafka Streams, FRP frameworks), Skip exposes reducers as:

  • First-class combinators (not callbacks tied to engine contexts)
  • User-facing inverses (explicit operation, not hidden internally)
  • Formally specified (precise correctness condition for users to verify)

The Lean formalization provides machine-checked verification of the main correctness theorem and supporting lemmas.

- Move 'Partial Reducers' remark to after Theorem 4 (was prematurely placed)
- Add proper definition of algebraic aggregates in Section 3.2
- Remove incoherent 'partial average reducer' paragraph - you cannot maintain
  average incrementally with only the average value (need count too)
- Clarify min reducer as canonical example of non-invertible aggregate
- Explain Skip's strategies for handling partial reducers
- Rewrite abstract to emphasize first-class combinators vs callbacks
- Contrast with Flink, Kafka Streams, FRP, and incremental computation frameworks
- Add 'What distinguishes Skip's design' paragraph with 3 key differentiators
- Qualify claims about formal correctness to acknowledge DBSP/differential dataflow foundations
- Add 'Reactive JS and FRP streams' paragraph to related work
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants