-
Notifications
You must be signed in to change notification settings - Fork 1
craft: fourth module — semiring-basics (recipe-template anchor) #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0b23470
6ff16cf
00d4c0b
58a71dd
becc213
e3dd55b
ef6fa62
fb17d16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,310 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Semirings — the recipe template Zeta plugs different | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "arithmetics" into | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| **Subject:** zeta | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| **Level:** applied (default) + theoretical (opt-in) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| **Audience:** contributors curious why Zeta claims | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "multiple algebras in one database" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| **Prerequisites:** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `subjects/zeta/zset-basics/` (ℤ-with-retraction is the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| signed-integer case; this module shows why it's just | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| one of many) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `subjects/zeta/operator-composition/` (operators | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new module declares Useful? React with 👍 / 👎. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| compose the same way across different arithmetics) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+14
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `subjects/zeta/zset-basics/` (ℤ-with-retraction is the | |
| signed-integer case; this module shows why it's just | |
| one of many) | |
| - `subjects/zeta/operator-composition/` (operators | |
| compose the same way across different arithmetics) | |
| - `subjects/zeta/retraction-intuition/` (the signed-update | |
| intuition first; this module generalises that one case | |
| into a broader arithmetic template) | |
| - Operator composition across arithmetics (forthcoming; | |
| operators compose the same way across different | |
| arithmetics) |
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prerequisite/next-suggested links point at subjects/zeta/zset-basics/, subjects/zeta/operator-composition/, and subjects/cs/databases/, but those modules/directories don't exist under docs/craft/subjects/ in this repo right now. Either add the missing modules, or mark these references as forthcoming and avoid presenting them as resolvable links until they land.
| - `subjects/zeta/zset-basics/` (ℤ-with-retraction is the | |
| signed-integer case; this module shows why it's just | |
| one of many) | |
| - `subjects/zeta/operator-composition/` (operators | |
| compose the same way across different arithmetics) | |
| **Next suggested:** `subjects/cs/databases/` (forthcoming | |
| — where Zeta fits among database paradigms) | |
| - Z-set basics *(forthcoming)* (ℤ-with-retraction is the | |
| signed-integer case; this module shows why it's just | |
| one of many) | |
| - Operator composition *(forthcoming)* (operators | |
| compose the same way across different arithmetics) | |
| **Next suggested:** Databases *(forthcoming)* (where | |
| Zeta fits among database paradigms) |
Copilot
AI
Apr 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: The markdown tables here use || at the start of each row, which will render as an extra empty first column (and misalign the table) in standard GFM. Use a single leading | (or no leading pipe) consistently for the header and each row.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate probabilistic from fuzzy max-times semantics
This row is labeled probabilistic but defines combination as max, which is possibilistic/Viterbi-style behavior rather than probability accumulation. If contributors apply this as a probability semiring, alternative derivations will be collapsed instead of accumulated, yielding systematically wrong results for probabilistic interpretation; either the operation should reflect probabilistic addition semantics or the row should be renamed to fuzzy/possibilistic.
Useful? React with 👍 / 👎.
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The semiring comparison table rows start with ||, which creates an empty first column in Markdown tables. If the intent is a 4-column table, switch the leading || to a single | on the header/separator/rows so the table renders correctly.
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The F# signature block is presented as a sketch, but as written it won’t typecheck: it uses non-F# type identifiers (ℤ/ℕ/𝔹), references an ISemiring interface that doesn’t exist in src/, and suggests Tropical results as float while the current implementation uses TropicalWeight backed by int64 (src/Core/NovelMath.fs). Consider making this explicitly pseudocode (no F#-looking types), or update it to use real types from the codebase (Weight, TropicalWeight, etc.) so readers don’t copy a non-compiling pattern.
| F# signature (sketch — actual APIs are an active- | |
| development surface): | |
| ```fsharp | |
| // Instead of hard-coding ℤ: | |
| type ZSet<'K> = ... | |
| // Parameterise over semiring S: | |
| type SemiringSet<'K, 'S when 'S :> ISemiring> = ... | |
| // Same operators, different arithmetic: | |
| count : SemiringSet<'K, ℤ> -> int64 // retractable count | |
| count : SemiringSet<'K, ℕ> -> uint64 // plain count | |
| count : SemiringSet<'K, 𝔹> -> bool // is-any-present | |
| count : SemiringSet<'K, Tropical> -> float // minimum cost | |
| Pseudocode sketch (illustrative only — not current F# | |
| API surface): | |
| ```text | |
| // Instead of hard-coding integer weights: | |
| ZSet<Key> = ... | |
| // Parameterise the collection by a chosen semiring: | |
| SemiringSet<Key, Semiring> = ... | |
| // Same operator shape, different arithmetic: | |
| count : SemiringSet<Key, Integers> -> int64 // retractable count | |
| count : SemiringSet<Key, Naturals> -> uint64 // plain count | |
| count : SemiringSet<Key, Booleans> -> bool // is-any-present | |
| count : SemiringSet<Key, TropicalWeight> -> TropicalWeight // minimum cost |
Copilot
AI
Apr 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The fenced block is tagged as fsharp, but it’s not valid F# as written (placeholders like ..., and type identifiers like ℤ/ℕ/𝔹). If this is meant to be copy/pasteable, consider making the snippet syntactically valid (e.g., use int64/uint64/bool weight types or type aliases) or change the fence to text/pseudo to avoid implying it compiles.
Copilot
AI
Apr 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: This table header uses || at the start of rows, which creates an unintended empty first column in Markdown rendering. Switching to a single leading | on the header/separator rows will keep the table shape consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct K-relations retraction limitation statement
The statement that “pure-semiring-based K-relations … support lineage/provenance/counting but not retraction” is too broad and contradicts the module’s own semiring table where ℤ supports retraction. K-relations instantiated with semirings/rings that have additive inverses (e.g., ℤ) can encode retractions via negative annotations; the limitation is specific to non-invertible semirings like ℕ, 𝔹, or tropical. As written, this teaches readers that retraction is outside K-relations entirely, which misstates the framework boundary.
Useful? React with 👍 / 👎.
Copilot
AI
Apr 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: The statement that K-relations are "pure-semiring-based" and therefore "support ... but not retraction" is misleading: rings (like ℤ) are semirings, and K-relations over ℤ do support retraction via additive inverses. Suggest rephrasing to explicitly scope the limitation to semirings without additive inverses (i.e., non-rings).
| just a semiring. Pure-semiring-based K-relations (per | |
| Green-Karvounarakis-Tannen PODS 2007) support | |
| lineage / provenance / counting but not retraction. | |
| just a semiring. K-relations over semirings without | |
| additive inverses (per Green-Karvounarakis-Tannen | |
| PODS 2007) support lineage / provenance / counting, | |
| but not retraction; K-relations over rings such as ℤ | |
| do support retraction. |
Copilot
AI
Apr 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The canonical semirings table header begins with ||, which will render as a blank leading column in many Markdown parsers. Prefer a single leading | for these rows to avoid the extra empty column.
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Tropical row states R = ℝ ∪ {+∞}, but Zeta’s current tropical implementation is explicitly (ℤ ∪ {∞}, min, +) with TropicalWeight.Value : int64 and Int64.MaxValue as +∞ (src/Core/NovelMath.fs:13-34). Since this module links to NovelMath.fs as the implementation, aligning the table with the code (or calling out that the table is the general definition vs Zeta’s discrete instantiation) would avoid confusion.
| | Semiring | R | + | × | 0 | 1 | Retraction? | | |
| |---|---|---|---|---|---|---| | |
| | Signed integers | ℤ | + | × | 0 | 1 | Yes (ring) | | |
| | Counting | ℕ | + | × | 0 | 1 | No (no negatives) | | |
| | Boolean | {T, F} | ∨ | ∧ | F | T | N/A (can't "retract") | | |
| | Tropical | ℝ ∪ {+∞} | min | + | +∞ | 0 | No (min has no additive inverse) | | |
| | Max-plus | ℝ ∪ {-∞} | max | + | -∞ | 0 | No | | |
| These rows give the **canonical mathematical** | |
| definitions. Zeta's current `NovelMath.fs` tropical | |
| implementation is the discrete instantiation | |
| `(ℤ ∪ {∞}, min, +)` backed by `int64`, not the full | |
| real-valued tropical semiring. | |
| | Semiring | R | + | × | 0 | 1 | Retraction? | | |
| |---|---|---|---|---|---|---| | |
| | Signed integers | ℤ | + | × | 0 | 1 | Yes (ring) | | |
| | Counting | ℕ | + | × | 0 | 1 | No (no negatives) | | |
| | Boolean | {T, F} | ∨ | ∧ | F | T | N/A (can't "retract") | | |
| | Tropical (general) | ℝ ∪ {+∞} | min | + | +∞ | 0 | No (min has no additive inverse) | | |
| | Max-plus (general) | ℝ ∪ {-∞} | max | + | -∞ | 0 | No | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix lineage semiring multiplication semantics
The canonical-semirings table defines lineage as (2^X, ∪, ∩, ∅, X), but for tuple-lineage/witness tracking the multiplicative step for a join must combine evidence from both sides (set union of witnesses), not set intersection. With × = ∩, joining tuples with disjoint provenance sets collapses to ∅, which loses provenance and contradicts the K-relation interpretation described later in the module. This will teach contributors the wrong algebra for provenance-style joins.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mark N[X] provenance row as non-retractable
The table currently lists N[X] for provenance but says retraction “Depends on coefficient ring,” which is inconsistent with the type shown: N[X] is fixed to natural-number coefficients and therefore has no additive inverses. In this module’s own ring-vs-semiring framing, that means retractions cannot be represented losslessly, so this row teaches the wrong tradeoff when readers choose a semiring.
Useful? React with 👍 / 👎.
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The canonical semirings table also uses || at line starts, which will render as an extra empty column. Use a single leading | for the header/separator/rows to avoid a spurious blank column.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restrict homomorphism claim to positive relational algebra
The text currently states this result for "every relational-algebra result," but the GKT semiring-homomorphism theorem applies to positive relational algebra (SPJU), not arbitrary RA with non-monotone operators like difference/negation. As written, readers can infer that semiring-swapping preserves semantics for queries outside that fragment, which is incorrect and can lead to wrong expectations about what operators are validly semiring-parameterised.
Useful? React with 👍 / 👎.
Copilot
AI
Apr 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: In docs/TECH-RADAR.md, the "11" for Tropical semiring is the Round column, not a "ring" number. Updating this wording will keep the cross-reference accurate (Tech Radar table columns are Technique | Ring | Round | Notes).
| - `docs/TECH-RADAR.md` — Tropical semiring Adopt (ring | |
| - `docs/TECH-RADAR.md` — Tropical semiring Adopt (round |
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docs/TECH-RADAR.md reference claims “provenance deferred”, but docs/TECH-RADAR.md currently has rows for Tropical semiring and Residuated lattices and no provenance entry. Either add a provenance row to TECH-RADAR (so this bullet is grounded), or drop/soften the provenance claim here to match the radar source of truth.
| 11); residuated lattices Adopt; provenance deferred | |
| 11); residuated lattices Adopt |
Copilot
AI
Apr 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1 (xref): This references a "Per-user memory" file, but the semiring regime-change document appears to live in-repo under memory/project_semiring_parameterized_zeta_regime_change_one_algebra_to_map_others_2026_04_22.md. Consider updating the label (it’s not per-user) and the path so the cross-reference resolves.
| - Per-user memory | |
| `project_semiring_parameterized_zeta_regime_change_one_algebra_to_map_others_2026_04_22.md` | |
| - Project memory | |
| `memory/project_semiring_parameterized_zeta_regime_change_one_algebra_to_map_others_2026_04_22.md` |
Copilot
AI
Apr 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: The ## Attribution section includes direct contributor/agent name attribution (and review assignments). Repo standing rule is to avoid names in code/docs/skills and use role references instead; names belong only under memory/persona/<name>/ and optionally docs/BACKLOG.md when capturing a request (see docs/AGENT-BEST-PRACTICES.md:284-292). Please rewrite this section to be role-based (or remove it) to comply.
| Otto (loop-agent PM hat) authored v0. Fourth Craft | |
| module (after zset-basics / retraction-intuition / | |
| operator-composition). Content accuracy: future Soraya | |
| (formal-verification) review on formal definitions; | |
| Hiroshi (complexity-theory) on shortest-path / | |
| idempotence / Kleene-star claims; Kira (harsh-critic) | |
| normal pass. | |
| Initial draft produced via a loop-agent project- | |
| management pass. Fourth Craft module (after zset- | |
| basics / retraction-intuition / operator-composition). | |
| Content accuracy follow-up: formal-verification review | |
| on formal definitions; complexity-theory review on | |
| shortest-path / idempotence / Kleene-star claims; and | |
| a standard harsh-critic pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The H1 heading is split across two lines, so only the first line is part of the heading and the second line becomes a separate paragraph. Consider making it a single heading line (or use an explicit
<br>if a line break is intentional).