Skip to content

One typed fact for many statements - #753

Merged
WaylandYang merged 3 commits into
devfrom
feat/one-typed-fact-for-many-statements
Sep 18, 2026
Merged

WaylandYang merged 3 commits into
devfrom
feat/one-typed-fact-for-many-statements

Conversation

@WaylandYang

Copy link
Copy Markdown
Contributor

0044 cut 2, third slice: several statements that produce the same triple give one typed row. Follows #752, which gave one row per statement and left the merge for later.

What lands

Migration 0068: typed_fact_sources (fact_id, statement_id), one row per statement behind a typed row, backfilled from from_statement_id; from_statement_id stays as the first source.

Materialisation goes through the typed graph's own gate. Instead of inserting a row per statement, utopia_store::materialize calls insert_fact / insert_value_fact for each due (statement, binding) pair, so the rules the rest of the typed graph already lives by apply: the same assertion with the same start reuses the row and only attests it earlier; a bare row (no time) is superseded by a dated observation of the same assertion, with the supersedes link and the evidence carried over; an observation that says "ended" closes the open row. A row's sources are then whatever statements it was computed from; its evidence rows and role-word qualifiers are the union of theirs. When a new row supersedes an old one, the old row's sources move to it in the same pass, so one run converges.

Recomputation, restated for many sources. A source is dropped when its statement no longer holds under a bound signature that yields this row (statement invalidated, signature unbound, property or direction changed, a mood added, or the row itself superseded); a computed row is retired only when it has no source left; due pairs are added as before. Idempotent: a second run changes nothing.

Test (a_bound_statement_becomes_a_typed_fact, database-backed): a bare statement, a dated one and a second document's dated one on the same pair give one live row with three sources and two evidence rows in one run (the bare row superseded, its source moved); the statement with a mood gives none; a second run is a no-op; invalidating one statement keeps the row with one source fewer; flipping both signatures to reverse retires the row and rebuilds it with the ends swapped; setting both to none retires it and adds nothing.

Measured

No model call. The two bases of #751, cleared and re-materialised under this branch:

base statements under bound signatures live typed rows sources merged into an existing row bare rows superseded by dated ones second run
25-document batch 184 175 184 8 1 0 / 0 / 0
NVDA four releases 125 98 125 7 20 0 / 0 / 0

The merged rows are figures a release states twice (a headline and a table: "revenue —value→ $96,221" with three sources) and the superseded ones are a table's cell first read without its period and then with it, all within one document; across documents the corpora repeat little. Before this branch (#752) the same bases held 184 and 125 rows, and a second run after the timeline's refinement had to run twice to settle.

Not in this change

Implication rules and readings; typed qualifiers from role words; the alignment queue (#725); the conflict detector's view of two sources that disagree (they stay two rows under insert_fact's rules, as they do for any other writer).

🤖 Generated with Claude Code

WaylandYang and others added 3 commits September 18, 2026 10:42
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: WaylandYang <wayland0916@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: WaylandYang <wayland0916@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: WaylandYang <wayland0916@gmail.com>
@WaylandYang
WaylandYang merged commit ea5b0f6 into dev Sep 18, 2026
4 checks passed
@WaylandYang
WaylandYang deleted the feat/one-typed-fact-for-many-statements branch September 18, 2026 03:02
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.

1 participant