feat(v4): Phase 7 Task 4 -- the loops' words: v3's physics-freeze and inference words, F18 asking the kernel (#189)
capsules/v4/physics.4th, a kernel capsule on Hera (blocks 8200-8201): FREEZE-WORD UNFREEZE-WORD FROZEN? HEAT! HEAT@ DECAY-RATE@ Q.VARIANCE INFER-DECAY-SLOPE INFER-WINDOW-WIDTH INFER-RUN INFER-WINDOW@ INFER-DECAY@ INFER-VARIANCE@ INFER-FIT@ INFER-EARLY-EXIT@ -- each a KERNEL-WORD, requests -21..-34 (v4/mesh.h), served by the kernel on any node: "The compudynamics is stadium/fabric" (Captain Bob, 2026-11-14). A word is named as v3's, the newest visible entry of CONTEXT then FORTH (the image gains CONTEXT's address); the arithmetic is v4/system/inference.c, v3's to the bit. Q48.16 results are v4's doubles (low cell, then high). HEAT! starts the word's decay from now. Test first with v3's POST cases in v4's address units: test_mesh_boot.c 86 checks, 95 on, 83 without opcode physics. docs/reference/v4-dictionary.tsv: the 15 words (392 live). amd64 PASS, word_count=392. Not pushed (held to the end of Phase 7). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
@@ -141,6 +141,7 @@ D2/ ( d1 -- d2 ) Shift d1 right one bit, keeping the sign.
|
||||
D< ( d1 d2 -- flag ) True if d1 is less than d2.
|
||||
D= ( d1 d2 -- flag ) True if d1 equals d2.
|
||||
DABS ( d -- ud ) The absolute value of d.
|
||||
DECAY-RATE@ ( -- n ) v3's DECAY_RATE_PER_US_Q16, its compile-time constant: 1.
|
||||
DECIMAL ( -- ) Set BASE to ten.
|
||||
DEFAULT-ROUTE ( port -- ) The port, by its number, leads toward every node this node has not been told of.
|
||||
DEFER ( -- ) DEFER xxx: define xxx, whose action is set later by IS; run unset, it is error 15.
|
||||
@@ -172,8 +173,12 @@ FIND ( -- xt | 0 ) FIND xxx: the execution token of xxx, from the input stream,
|
||||
FLUSH ( -- ) Write every changed block (SAVE-BUFFERS).
|
||||
FORGET ( -- ) FORGET xxx: remove xxx and every word defined after it, never below FENCE.
|
||||
FORTH ( -- ) Make FORTH, the primary vocabulary, the CONTEXT vocabulary.
|
||||
FREEZE-WORD ( baddr u -- ) The word named stops decaying (its record frozen, in the kernel). Nothing if there is no such word.
|
||||
FROZEN? ( baddr u -- flag ) True if the word named is frozen; false for one that is not, or is not there.
|
||||
GONE ( n node -- ) Tell the node that node n is gone; it acts on that only if this node is its centre.
|
||||
HEAT! ( n baddr u -- ) The heat of the word named, in the kernel's record of it, set to n; its decay counts from now.
|
||||
HEAT-OP@ ( op -- n ) How many times opcode op (taken mod 32) has retired: its heat counter, HEAT-OP[op] (#189).
|
||||
HEAT@ ( baddr u -- n ) The heat of the word named, from the kernel's record of it; 0 if there is no such word.
|
||||
HERE ( -- addr ) The address of the next free dictionary cell.
|
||||
HEX ( -- ) Set BASE to sixteen.
|
||||
HIDDEN ( -- ) Hide the newest entry: it cannot be found until revealed.
|
||||
@@ -181,6 +186,14 @@ HOLD ( c -- ) Pictured output: put the character c in front of the string being
|
||||
I ( -- n ) Compile-only: the index of the innermost DO loop.
|
||||
IF ( flag -- ) Compile-only: run what follows if flag is not zero, else skip to ELSE or THEN.
|
||||
IMMEDIATE ( -- ) Make the newest definition run when compiling instead of being compiled.
|
||||
INFER-DECAY-SLOPE ( addr u -- d ) The decay slope of u cells of heat at addr, as Q48.16 (a log-linear regression, as v3's).
|
||||
INFER-DECAY@ ( -- d ) The decay slope inference last found, as Q48.16.
|
||||
INFER-EARLY-EXIT@ ( -- flag ) 1 if the last inference exited early, its variance within 5% of the time before.
|
||||
INFER-FIT@ ( -- d ) The fit of the last decay slope, as Q48.16 (v3's: 0.8 always, a placeholder).
|
||||
INFER-RUN ( -- ) Run the inference engine now on this node's rolling window; what it finds is read with the INFER-...@ words.
|
||||
INFER-VARIANCE@ ( -- d ) The window's variance when inference last ran, as Q48.16.
|
||||
INFER-WINDOW-WIDTH ( addr u -- n ) The window width at which the variance of u cells at addr stops changing (Levene's test, as v3's).
|
||||
INFER-WINDOW@ ( -- u ) The window width inference last found.
|
||||
INTERPRET ( -- ) Interpret words from the input stream until it is exhausted.
|
||||
INVERT ( x1 -- x2 ) Invert every bit.
|
||||
IS ( xt -- ) IS xxx: make the deferred word xxx run xt; compiled when compiling.
|
||||
@@ -265,6 +278,7 @@ Q.SCALE ( -- q ) The scale of the fraction, 65536 0 (1.0).
|
||||
Q.SIN ( q1 -- q2 ) The sine of q1, in radians.
|
||||
Q.SQRT ( q1 -- q2 ) The square root of q1; below zero is error 12.
|
||||
Q.TO-INT ( q -- n ) The integer part of q.
|
||||
Q.VARIANCE ( addr u -- d ) The variance of u cells at addr, as Q48.16, computed by the kernel as v3's inference engine does.
|
||||
QUERY ( -- ) Read up to 80 characters, or a line, from the terminal into TIB; set >IN to 0.
|
||||
QUIT ( -- ) Empty the return stack, set execution mode and go back to the terminal, without a message.
|
||||
R> ( -- x ) ( R: x -- ) Compile-only: move the top of the return stack to the data stack.
|
||||
@@ -304,6 +318,7 @@ U/MOD ( ud u1 -- u2 u3 ) Unsigned divide: u2 the remainder, u3 the quotient; by
|
||||
U< ( u1 u2 -- flag ) True if u1 is less than u2, unsigned.
|
||||
U> ( u1 u2 -- flag ) True if u1 is greater than u2, unsigned.
|
||||
UM* ( u1 u2 -- ud ) Multiply, unsigned: the double-cell product.
|
||||
UNFREEZE-WORD ( baddr u -- ) The word named decays again. Nothing if there is no such word.
|
||||
UNLOOP ( -- ) Compile-only: discard the innermost DO loop's index and limit, before an EXIT from inside it.
|
||||
UNTIL ( flag -- ) Compile-only: end a BEGIN loop, jumping back to BEGIN while flag is zero.
|
||||
UPDATE ( -- ) Mark the block most recently asked for as changed, so it is written.
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 10 and column 3.
|
Reference in New Issue
Block a user