@hviana/sema 0.9.3 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +16 -7
- package/dist/src/mind/learning.js +11 -12
- package/dist/src/mind/mind.js +4 -4
- package/dist/src/mind/types.d.ts +10 -15
- package/dist/src/store.d.ts +10 -10
- package/dist/src/store.js +5 -5
- package/docs/INDEX.md +62 -59
- package/docs/INVARIANTS.md +36 -18
- package/docs/PHILOSOPHY.md +317 -0
- package/docs/architecture/bounded-reads.md +31 -71
- package/docs/architecture/caches.md +61 -81
- package/docs/architecture/closure.md +88 -107
- package/docs/architecture/commonality.md +47 -38
- package/docs/architecture/cost-model.md +57 -79
- package/docs/architecture/determinism.md +43 -55
- package/docs/architecture/evidence.md +158 -235
- package/docs/architecture/exact-vs-approximate.md +41 -35
- package/docs/architecture/factored-machinery.md +34 -20
- package/docs/architecture/fold-contract.md +110 -118
- package/docs/architecture/halo-sketch.md +105 -96
- package/docs/architecture/match-project.md +51 -42
- package/docs/architecture/mechanism-market.md +87 -91
- package/docs/architecture/memoization.md +60 -74
- package/docs/architecture/meter.md +37 -47
- package/docs/architecture/saturation.md +75 -101
- package/docs/architecture/store.md +118 -99
- package/docs/architecture/thresholds.md +66 -73
- package/docs/failures/tempting-but-wrong.md +139 -165
- package/docs/harness/gates.md +27 -32
- package/docs/mechanisms/alu.md +22 -69
- package/docs/mechanisms/cast.md +76 -71
- package/docs/mechanisms/confluence.md +22 -29
- package/docs/mechanisms/cover.md +58 -66
- package/docs/mechanisms/extraction.md +33 -37
- package/docs/mechanisms/prefix-completion.md +36 -39
- package/docs/mechanisms/recall.md +60 -53
- package/docs/mechanisms/reference.md +63 -49
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/alu/README.md +90 -298
- package/src/derive/README.md +94 -256
- package/src/mind/learning.ts +11 -12
- package/src/mind/mind.ts +4 -4
- package/src/mind/types.ts +10 -15
- package/src/rabitq-ivf/README.md +11 -8
- package/src/store.ts +5 -5
package/docs/mechanisms/cast.md
CHANGED
|
@@ -1,80 +1,85 @@
|
|
|
1
|
-
# CAST —
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
# CAST — Carry Structure Between Woven Forms
|
|
2
|
+
|
|
3
|
+
When independently learnt structures align to genuinely different spans of the
|
|
4
|
+
question, CAST (counterfactual transfer) carries structure from one to another
|
|
5
|
+
(`src/mind/mechanisms/cast.ts`). One weave serves three schemas. Each schema
|
|
6
|
+
that fires yields its own candidate, and the market's single comparison picks.
|
|
7
|
+
|
|
8
|
+
## Matcher — the weave
|
|
9
|
+
|
|
10
|
+
`pre.weave()` is `alignGraded` over the question: literal `W`-gram runs, then
|
|
11
|
+
halo-matched sites and the climb's proposals. It produces `points[]`, each with
|
|
12
|
+
graded `runs[]`, and `depth[]`, the number of distinct structures that cover
|
|
13
|
+
each byte. A second point counts only if it adds at least one perception quantum
|
|
14
|
+
of coverage that the widest point lacks.
|
|
15
|
+
|
|
16
|
+
## Gate — the cohort's frame
|
|
17
|
+
|
|
18
|
+
Frame is what the cohort of aligned structures shares (`commonality.md`):
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
frame(i) ⇔ depth[i] > MIN_WEAVE ∧ dominates(depth[i], aligned) MIN_WEAVE = 2
|
|
22
|
+
usable(r) ⇔ ¬dominates(framedCount(qs, qe), runLen)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- **More than a pair must agree.** A pair is ambiguous when insertions are
|
|
26
|
+
possible, so with only two points no byte is frame.
|
|
27
|
+
- **`depth` counts distinct structures, never weight.** Counting weight lets a
|
|
28
|
+
shared frame such as `describe it` survive as content, and makes substitution
|
|
29
|
+
fire on reordered single-fact questions (the measured split was 29/42 against
|
|
30
|
+
6/42).
|
|
31
|
+
- **The cohort reading cannot be replaced by corpus reach.** A phrase common to
|
|
32
|
+
the aligned exemplars is frame here even when it is rare in the corpus
|
|
33
|
+
(`test/17`).
|
|
34
|
+
|
|
35
|
+
Further competence checks:
|
|
36
|
+
|
|
37
|
+
- the question is at least two quanta long;
|
|
38
|
+
- there are at least two ranked anchors;
|
|
39
|
+
- the weave touches a committed point of attention;
|
|
40
|
+
- the weave is genuinely woven, not every run restating a recognised site.
|
|
41
|
+
|
|
42
|
+
## Schemas
|
|
43
|
+
|
|
44
|
+
- **Substitution.** A subject the question supplies takes the seat of a
|
|
45
|
+
displaced structure. The filler is what the subject contributes before the
|
|
46
|
+
seat, clipped at the seat, so the result does not depend on the weave's
|
|
47
|
+
elimination order. The substitution must actually displace something.
|
|
48
|
+
- **Redirection.** The question names a substitute by quoting it from its own
|
|
49
|
+
opening bytes (`…were Lyon?` against `Lyon is a city in France`), and names it
|
|
50
|
+
after what it displaces. A substitute that is a fragment answering other
|
|
51
|
+
questions is refused: `ong)?`, the tail of every `… (… Song)?` question, once
|
|
52
|
+
voiced a stranger's birthplace.
|
|
53
|
+
- **Comparison.** The dominant is seated against one analog, reached through
|
|
54
|
+
`seatOfNode` and corroborated by `analogyStrength` (halo company). Two guards
|
|
55
|
+
apply:
|
|
56
|
+
- the question must evidence the analog with a window of its own, not inside
|
|
57
|
+
the dominant's runs and not scaffolding;
|
|
58
|
+
- the dominant must not be a co-instance of the question (`evidence.md`).
|
|
59
|
+
|
|
60
|
+
Without them, a bare question was glued onto the answer, and once Shakira's
|
|
61
|
+
birthplace was set against `John Lennon`.
|
|
46
62
|
|
|
47
63
|
## Cost
|
|
48
64
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
the
|
|
53
|
-
|
|
54
|
-
## Investment discipline
|
|
55
|
-
|
|
56
|
-
Floor is `2·STEP`. Before touching the shared expensive analyses
|
|
57
|
-
(`pre.attention()` climb, `pre.weave()`), check `worthRunning(2*STEP)` and
|
|
58
|
-
return the uninvested bound when it already loses. Never compute a shared
|
|
59
|
-
analysis just to discard it.
|
|
65
|
+
Each transfer act costs `STEP + STEP`, plus `CONCEPT` for a halo-mediated
|
|
66
|
+
analogy. `accounted` covers only the points that schema actually transferred
|
|
67
|
+
between. The floor is `2·STEP`. Before first touching the climb or the weave,
|
|
68
|
+
the floor asks `worthRunning(2·STEP)` and returns its uninvested bound if it
|
|
69
|
+
would lose (`mechanism-market.md`).
|
|
60
70
|
|
|
61
71
|
## Provenance
|
|
62
72
|
|
|
63
|
-
`cast
|
|
64
|
-
redirection, or analogical comparison), not from a literal continuation.
|
|
73
|
+
`cast`.
|
|
65
74
|
|
|
66
75
|
## Pins
|
|
67
76
|
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
`src/mind/mechanisms/cast.ts` (`counterfactualTransfer`, `seatOfNode`,
|
|
79
|
-
`MIN_WEAVE`, `weave.depth`), `src/mind/match.ts` (`alignGraded`, `project`),
|
|
80
|
-
`src/geometry.ts` (`dominates`), `src/mind/graph-search.ts` (`STEP`).
|
|
77
|
+
- `test/17` — a reordered single fact does not trigger substitution; it pins the
|
|
78
|
+
cohort frame.
|
|
79
|
+
- `test/29` — substitution, redirection and comparison, and the displacement of
|
|
80
|
+
their seats. C3: a further hop inside a comparison's seat waits to be asked.
|
|
81
|
+
- `test/43` — the direction of `seatOfNode`.
|
|
82
|
+
- `test/47`, `test/50` — comparison coverage, the analog consensus floor and the
|
|
83
|
+
shared guards.
|
|
84
|
+
- `test/154.7`, `test/155.9` — a comparison needs two named things, and never
|
|
85
|
+
takes a co-instance as its dominant.
|
|
@@ -1,43 +1,36 @@
|
|
|
1
|
-
# Confluence —
|
|
1
|
+
# Confluence — Where Independent Conditions Meet
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Some questions state several conditions, and their answer lives in no single
|
|
4
|
+
fact, only where the conditions intersect. Each condition reaches its own stored
|
|
5
|
+
contexts, and the thing that satisfies all of them sits at their meeting point
|
|
6
|
+
(`src/mind/mechanisms/confluence.ts`, `confluenceJoin`).
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
`confluenceMechanism`).
|
|
8
|
+
## Matcher — streams from the climb
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
The streams are the consensus climb's ranked anchors (`pre.attention()`,
|
|
11
|
+
`crossRegionVotes`), each bound by identity to a discriminating span of the
|
|
12
|
+
question. Two streams are independent when their spans are disjoint. The meet is
|
|
13
|
+
a set intersection by content-addressed window identity (`windowsOf`): a window
|
|
14
|
+
present in both anchors and absent from the question.
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
anchors). Streams are anchors bound by identity to disjoint discriminative query
|
|
14
|
-
spans; two streams are independent when their `cover` spans are disjoint. The
|
|
15
|
-
meet is set intersection by content-addressed identity (`windowsOf` /
|
|
16
|
-
`findBranch` window ids): present in both anchors, absent from the query.
|
|
16
|
+
## Gate — corpus-global commonality
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
`dominates(reach, N)` (`geometry.ts` half-dominance, `reach*2 > N`). Majority
|
|
23
|
-
reach is scaffolding and never binds a constraint nor survives the meet;
|
|
24
|
-
minority reach is filler/entity. Single-window meets and sub-`2W` spans are
|
|
25
|
-
refused.
|
|
18
|
+
A window's `reachOf` is gated by `dominates(reach, N)` (`commonality.md`). A
|
|
19
|
+
window reached by a majority of contexts is scaffolding: it never binds a
|
|
20
|
+
condition and never survives the meet. A minority reach is a filler, an entity.
|
|
21
|
+
A meet on a single window, or a span shorter than `2W`, is refused.
|
|
26
22
|
|
|
27
23
|
## Cost
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
`moves + PASS·unaccounted` compared at `STEP` grade (`pipeline.ts:think`).
|
|
25
|
+
`3·STEP`: two conditions and the meet. That is also its floor, so the climb is
|
|
26
|
+
never touched unless `worthRunning(3·STEP)` holds (`mechanism-market.md`).
|
|
32
27
|
|
|
33
28
|
## Provenance
|
|
34
29
|
|
|
35
|
-
`join
|
|
36
|
-
(`src/mind/mechanisms/confluence.ts` sets it when the independent evidence
|
|
37
|
-
streams meet at one anchor). It is not cover's: cover reports `cover` for every
|
|
38
|
-
derivation it wins (see `docs/mechanisms/cover.md`).
|
|
30
|
+
`join`, which belongs to this mechanism alone.
|
|
39
31
|
|
|
40
32
|
## Pins
|
|
41
33
|
|
|
42
|
-
`test/32
|
|
43
|
-
empty
|
|
34
|
+
- `test/32` — two-condition intersection, invariance to the order of the
|
|
35
|
+
conditions, honest silence on an empty intersection, and relational joins
|
|
36
|
+
across domains.
|
package/docs/mechanisms/cover.md
CHANGED
|
@@ -1,73 +1,65 @@
|
|
|
1
|
-
# Cover —
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
is the
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
`
|
|
20
|
-
- A
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
(`
|
|
27
|
-
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
for an offered key only where it reaches it — a connector when its splice's two
|
|
53
|
-
premises meet, a concept target when the hop's asking form (held at the hop's
|
|
54
|
-
own cost) is popped. A cover that asked is provisional: `cover.run` grants the
|
|
55
|
-
asked keys and covers again, until a cover asks nothing — which is then the
|
|
56
|
-
cover every key resolved in advance would have made. The joins licensed by
|
|
57
|
-
ask-free rounds are kept across the re-covers.
|
|
1
|
+
# Cover — Compose the Question From What It Contains
|
|
2
|
+
|
|
3
|
+
`cover` answers by graph search. Its axioms are the question's own recognised
|
|
4
|
+
sites, and its goal is the lightest derivation that covers the question's bytes
|
|
5
|
+
and follows their continuations (`src/mind/mechanisms/cover.ts`, `GraphSearch`).
|
|
6
|
+
It runs first: a cover backed by a computation becomes an incumbent near zero
|
|
7
|
+
cost, and prunes the rest of the market through the ordinary floor check
|
|
8
|
+
(`mechanism-market.md`).
|
|
9
|
+
|
|
10
|
+
## Matcher — recognition sites
|
|
11
|
+
|
|
12
|
+
Sites are the spans of the question that name a stored form (`recognition.ts`).
|
|
13
|
+
Any site that overlaps a computed span is masked: computation always wins,
|
|
14
|
+
enforced by masking rather than by price (`cost-model.md`).
|
|
15
|
+
|
|
16
|
+
## Gates
|
|
17
|
+
|
|
18
|
+
- **The site must lead somewhere.** It has a continuation or a halo
|
|
19
|
+
(`leadsSomewhere`).
|
|
20
|
+
- **A fragment needs to be asked.** A site that answers other questions
|
|
21
|
+
(`answersOtherQuestions`: inside other forms, several continuations, a window
|
|
22
|
+
of the question outside it) is dropped unless the question names one of its
|
|
23
|
+
continuations. Otherwise the cover accounted the fragment's bytes as explained
|
|
24
|
+
by a stranger's answer (`unaskedFragments`).
|
|
25
|
+
- **Scaffolding accounts for nothing.** A span made only of hub windows
|
|
26
|
+
(`scaffoldSpans`) is not accounted (`evidence.md`).
|
|
27
|
+
|
|
28
|
+
## Projection
|
|
29
|
+
|
|
30
|
+
- **Continuation edges.** `formRules` follow continuation edges at `STEP` per
|
|
31
|
+
hop, forking over continuations up to the hub bound. The continuation chosen
|
|
32
|
+
is `guidedFirst`'s: first one the question names, then distributional support,
|
|
33
|
+
then the first inserted (`determinism.md`).
|
|
34
|
+
- **Concept hops.** A form with no edge of its own may borrow a halo sibling's
|
|
35
|
+
continuation, at `CONCEPT`.
|
|
36
|
+
- **Dominance.** A span's cheapest completion dominates the rest, so a hub's
|
|
37
|
+
degree generates no work in the chart (`cost-model.md`).
|
|
38
|
+
|
|
39
|
+
## Premises resolved where the search reaches them
|
|
40
|
+
|
|
41
|
+
The synchronous search cannot run the async reads that two of its rules need: a
|
|
42
|
+
concept target, which is a halo lookup, and a learnt connector between two
|
|
43
|
+
answers, which is a `bridge`. So `offerConcepts` and `offerConnectors` offer the
|
|
44
|
+
keys up front, cheaply. The search then asks for a key only when it reaches it:
|
|
45
|
+
a connector when a splice's two premises meet, and a concept target when the
|
|
46
|
+
form asking for it is popped.
|
|
47
|
+
|
|
48
|
+
A cover that asked is provisional. `cover.run` grants the asked keys and covers
|
|
49
|
+
again, until a cover asks for nothing. That final cover is the one that
|
|
50
|
+
resolving every key in advance would have produced. Joins licensed by rounds
|
|
51
|
+
that asked for nothing are kept across re-covers.
|
|
58
52
|
|
|
59
53
|
## Provenance
|
|
60
54
|
|
|
61
|
-
`cover
|
|
62
|
-
|
|
63
|
-
that provenance belongs to the CONFLUENCE mechanism, which reports it when
|
|
64
|
-
independent evidence streams meet at one anchor — see
|
|
65
|
-
`docs/mechanisms/confluence.md`.)
|
|
55
|
+
`cover`, including fusion and recomposition steps that name a deeper learnt
|
|
56
|
+
form. `join` belongs to `confluence`, not to `cover`.
|
|
66
57
|
|
|
67
58
|
## Pins
|
|
68
59
|
|
|
69
|
-
- `test/09
|
|
70
|
-
- `test/19
|
|
60
|
+
- `test/09` — edge following and hop semantics.
|
|
61
|
+
- `test/19` — form rules and multi-hop chains.
|
|
71
62
|
- `test/151` — connectors and concept hops resolved where the search reaches
|
|
72
|
-
them;
|
|
73
|
-
|
|
63
|
+
them; dominance.
|
|
64
|
+
- `test/154` — a fragment voices none of its continuations unless the question
|
|
65
|
+
names one.
|
|
@@ -1,53 +1,49 @@
|
|
|
1
|
-
# Extraction —
|
|
1
|
+
# Extraction — Read a Span Between Located Frames
|
|
2
2
|
|
|
3
|
-
Extraction transfers a learnt
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
what sits between them
|
|
3
|
+
Extraction transfers a learnt skill of the form "the answer is a span of the
|
|
4
|
+
context" to a question it has never seen. A **skill exemplar** is a stored fact
|
|
5
|
+
whose answer appears inside its own context. Extraction finds the exemplar's
|
|
6
|
+
framing bytes in the question and reads what sits between them
|
|
7
|
+
(`src/mind/mechanisms/extraction.ts`).
|
|
7
8
|
|
|
8
|
-
## Matcher —
|
|
9
|
+
## Matcher — span-shaped exemplars
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
extraction decomposes with `answerRunsInContext` (greedy longest runs).
|
|
14
|
-
Candidates are ranked anchors from `climbAttentionAll`
|
|
15
|
-
(`Precomputed.spanShapedOf`), tried up to `pre.k`; sub-quantum (`< W`) or
|
|
16
|
-
unanchored results are skipped.
|
|
11
|
+
The candidates are the climb's ranked anchors, tried up to `pre.k`
|
|
12
|
+
(`Precomputed.spanShapedOf`, `skillExemplar`). An exemplar qualifies when its
|
|
13
|
+
answer embeds in its context in order:
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
- **`isSpanShaped`** is the open reading, a sparse subsequence. Extraction
|
|
16
|
+
accepts on it.
|
|
17
|
+
- **`answerRunsInContext`** decomposes the answer into its pieces within the
|
|
18
|
+
context, taking the longest runs greedily. Fusion gates on the strict reading,
|
|
19
|
+
`containsSpan`, instead.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
For each piece, the `W`-bounded pre-frame (and post-frame or next-piece
|
|
22
|
-
pre-frame) is `locate`d in the query at recognition sites. Located frames define
|
|
23
|
-
`start`/`end`; the bytes `query[start:end]` are read out. Multi-piece skills
|
|
24
|
-
concatenate reads in order.
|
|
21
|
+
## Projection — locate the frames, read between them
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
For each piece, the bytes just before it (and just after it, or before the next
|
|
24
|
+
piece), bounded at `W`, are located in the question (`locate`). The located
|
|
25
|
+
frames fix the read's start and end. Multi-piece skills concatenate their reads
|
|
26
|
+
in order. Results shorter than one quantum are skipped.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
located, `accounted === []`) is discarded — not an extraction. An open-ended
|
|
30
|
-
read (only one border located) stays unaccounted.
|
|
28
|
+
## Gate and accounting — both borders, or nothing
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
- **No frame located** (`accounted = []`): the read is discarded. That is
|
|
31
|
+
silence, not extraction.
|
|
32
|
+
- **A located frame is always evidence.**
|
|
33
|
+
- **The span read between frames is accounted only when both of its borders were
|
|
34
|
+
located.** An open-ended read stays priced at `PASS` per byte, so a bounded
|
|
35
|
+
extraction outweighs an echo that merely sets things side by side.
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
`moves = CONCEPT + STEP * accounted.length`. Comparison is at `STEP` grade, then
|
|
36
|
-
scaffolding, then list order.
|
|
37
|
+
## Cost
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Frames are always accounted when located. The read span between them is
|
|
41
|
-
accounted only when bounded on both sides (`preBounded && postBounded`);
|
|
42
|
-
otherwise it is PASS-priced like uncovered bytes, so a correct bounded
|
|
43
|
-
extraction can outweigh an echoing juxtaposition.
|
|
39
|
+
`moves = CONCEPT + STEP · accounted.length`, with a floor of `CONCEPT + STEP`.
|
|
40
|
+
The floor checks `worthRunning` before touching the climb.
|
|
44
41
|
|
|
45
42
|
## Provenance
|
|
46
43
|
|
|
47
|
-
`extract
|
|
44
|
+
`extract`.
|
|
48
45
|
|
|
49
46
|
## Pins
|
|
50
47
|
|
|
51
|
-
- `test/00
|
|
52
|
-
- `test/68
|
|
53
|
-
silence)
|
|
48
|
+
- `test/00` — skill transfer across values and relations.
|
|
49
|
+
- `test/68` — an unanchored read is silence.
|
|
@@ -1,54 +1,51 @@
|
|
|
1
|
-
# Prefix Completion —
|
|
1
|
+
# Prefix Completion — Complete a Known Beginning
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
whole
|
|
3
|
+
When the question is a proper prefix of exactly one trained form, that form is
|
|
4
|
+
voiced whole and nothing is invented
|
|
5
|
+
(`src/mind/mechanisms/prefix-completion.ts`).
|
|
5
6
|
|
|
6
|
-
##
|
|
7
|
+
## Supply — one union, decided once
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
Resonance cannot rank a proper prefix. On the trained store, the cosine between
|
|
10
|
+
a prefix and its form falls from 0.96 at one truncated byte to 0.62 at three,
|
|
11
|
+
against a reach bar of 0.875. So the candidates come from two supplies:
|
|
11
12
|
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- **
|
|
16
|
-
- **Zero or ≥2 distinct continuations → refuse** (the prefix trap).
|
|
13
|
+
- **`formsOpenedBy`** (`traverse.ts`) reads the write side's window index, which
|
|
14
|
+
is position-invariant, and climbs containment and then parents to the deposits
|
|
15
|
+
a prefix opens. It is bounded by `hubBound`.
|
|
16
|
+
- **The response's top-`k` resonance.**
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
The two are concatenated, and the guards decide once over the union. A chain
|
|
19
|
+
that tried one supply and then the other would let the approximate tier override
|
|
20
|
+
an ambiguity the exact one found.
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
| ------ | ----- | ------------------------------------------------- |
|
|
22
|
-
| `STEP` | 1 | maximal claim: every query byte literally matched |
|
|
22
|
+
## Guards
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
1. **Literal opening.** Every byte of the question matches the form in order
|
|
25
|
+
from offset 0.
|
|
26
|
+
2. **Exactly one distinct continuation**, compared by bytes, not by form id.
|
|
27
|
+
Zero or two or more means refusal: that is the prefix trap.
|
|
28
|
+
3. **Readable.** If any candidate saturates its capped `bytesPrefix` read, none
|
|
29
|
+
is licensed.
|
|
30
|
+
4. **At least one window.** A continuation shorter than `W` cannot be voiced,
|
|
31
|
+
and counts as disagreement.
|
|
26
32
|
|
|
27
|
-
##
|
|
33
|
+
## Cost
|
|
28
34
|
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
`STEP`, with `accounted = [[0, query.length]]`, since every byte is literally
|
|
36
|
+
matched. The result is **not** `complete`: the form may carry more beyond the
|
|
37
|
+
remainder this step voiced. The floor checks `worthRunning(STEP)` before either
|
|
38
|
+
supply is touched, and returns `null` when the question leaves no room for a
|
|
39
|
+
continuation within the phrase cap.
|
|
31
40
|
|
|
32
|
-
|
|
41
|
+
The mechanism is registered after `recall`, so an exact self-match wins ties.
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
disagreement; if any candidate saturates, none is licensed.
|
|
36
|
-
2. **One grouping window** — continuation must be ≥ `W` (`maxGroup`);
|
|
37
|
-
sub-quantum tails are unvoiceable and also count as disagreement.
|
|
38
|
-
3. **Uniqueness** — as above.
|
|
43
|
+
## Provenance
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
(no room for a perceivable continuation).
|
|
42
|
-
|
|
43
|
-
## Where it runs
|
|
44
|
-
|
|
45
|
-
Last grounding mechanism in `defaultMechanisms` (`mind/pipeline.ts`); registered
|
|
46
|
-
after recall so an exact self-match (`IDENTITY`) wins ties. Shares
|
|
47
|
-
`formsOpenedBy` (`mind/traverse.ts`) and `Precomputed.resonance()`.
|
|
45
|
+
`prefix`.
|
|
48
46
|
|
|
49
47
|
## Pins
|
|
50
48
|
|
|
51
|
-
- `test/70
|
|
52
|
-
saturating
|
|
53
|
-
- `test/72
|
|
54
|
-
union supply; resonance alone cannot rank a proper prefix.
|
|
49
|
+
- `test/70` — a literal prefix, ambiguity, a sub-quantum tail, the veto on a
|
|
50
|
+
saturating read, and determinism.
|
|
51
|
+
- `test/72` — the union supply; resonance alone cannot rank a proper prefix.
|