Files
neuron/docs/architecture/CALCULATIONS.md
T

12 KiB
Raw Blame History

Calculations — exact math behind §9

Companion to README.md (§9 Opinion Substrate). Every dimension, driver, and score with its actual formula. Parameter short-names in code style refer to docs/PARAMETER-REGISTRY.md.

0. The space

All values live in [1, +1] (space.negative-polespace.positive-pole, 0 = space.neutral, the tunnel — not a destination). Geometry per dimension: bipolar | unipolar | categorical.

1. Decay (lazy, computed at read time)

effective(t) = baseline + (value  baseline) · exp(−Δdays / decay_days)
  • baseline: each dimension's own resting state (law 38 — not always 0)
  • decay_days: that dimension's registered clock (hebbian.cool-off, validity.fade, …)
  • value, baseline ∈ [1, +1] ⇒ effective stays in range automatically
  • ±1 tolerance on every comparison (no exact equality anywhere)

2. Signed reinforcement

Given amount a ∈ [1, +1]:

a ≥ 0:   v ← v + a·(1  v)          # toward +1
a < 0:   v ← v  |a|·(v  (1))     # toward 1

Clamped implicitly by construction. Updates last_activated = now. Positive = worked/helped; negative = contradicted/burned (inhibition).

3. Recency distances

recency(t₀) = exp(−Δdays / memory.recent-horizon) · 2  1

Fresh ≈ +1, old → 1. Used for written-by-us and written-by-source dims.

4. Novelty at arrival (resonance deficit)

novelty(new) = 1  max over existing entities of resonance(new, e)

where resonance = cos(embedding_new, embedding_e) blended with graph proximity:

resonance = ½·cos_sim + ½·(1 / (1 + hop_distance))

Content vs structural novelty distinguished by local/global split: high local similarity + long bridge distance = structural (gold).

5. Surprise (pulse)

surprise = |observed  predicted|

Predictions come from regularity detection in the pulse (interval statistics on recurring event types). Coherent periodic accumulation grows ~n; random noise grows ~√n — regularity is detectable without any scheduler.

6. Retrieval scoring (augmented cosine)

Query vector Q, entity vector E (pure embedding, n dims):

Q' = [ Q , W·q₁..q₄ ]        q = [1,1,1,1] (want recent/true/grounded/active)
E' = [ E , W·r₁..r₄ ]        r = [hebbian_eff, recency_us, recency_src, validity_eff]

score = cos(Q', E')           W = retrieval.opinion-volume

Pipeline: structural walk → vector prefilter → opinion projection → spreading activation (2 hops, weight-decayed) → competition.

7. Competition (replaces top-k)

Candidate pool C from stages 14. Iterate ~5 rounds:

for each pair (i,j) sharing high cos_sim:
    s_i ← s_i + β·s_j·sim(i,j)      # coalition boost
    s_j ← s_j  γ·max(0, s_i)       # lateral suppression
normalize; drop below retrieval.surface-line; repeat until stable

Output may be empty (silence is valid). Survivors leave priming traces (small hebbian deposits even for non-returners).

8. Salience (derived, never stored)

salience(x) = clamp( hebbian_eff(x) · context_match(x)
                   + novelty(x) + stakes(x) · urgency(x)
                    burn_penalty(x)
                   × curiosity_widening ,  1, +1 )

context_match = cos(current-context-embedding, x-embedding). curiosity_widening rises with boredom, falls with threat.

9. Drives

fear(region)      ≈ stakes · |falling validity| · failure_proximity · exposure
engagement        ∈ [1,+1]: activation invested (from pulse tempo + session state)
stimulation       ∈ [1,+1]: reward-rate ÷ investment rate
compulsion        = engagement > τ_hi AND stimulation < τ_lo, persisting
loneliness        = desired_resonance  actual_resonance, integrated over window
                  (actual counts only exchanges that formed new edges)
sadness(region)   = ∫ unresolved negative contributions (slow clock)
boredom           = low avg novelty ∧ high predictability ∧ no new edges lately

All clamped [1,+1]. All derived per moment; none stored.

10. Feelings (nodes)

When any drive reading crosses its registered visibility threshold:

feeling_node { drive_snapshot, object_edges[], at }

Promoted by significance like any entity. Mood = slow integral of recent feeling-valence. Emotion names = labels bound to regions of this snapshot space.

11. Humility & trust

humility(entity) = 1  mean|asserted_confidence  realized_outcome|

trust(source, domain): starts neutral;
    verified-correct event  → trust += δ·(1  trust)
    caught-wrong event      → trust = δ·(trust  (1))
Dual reading: public_trust (imported, unexamined fold) vs earned_trust
(own audited record). Earned outranks public.
Personal truth: no trust computation — speaker IS the source.

12. Originality

originality(a) = lineage_diversity(a) · transform_distance(a)

lineage_diversity  = entropy over distinct derivation sources
transform_distance = 1  max similarity(a.output, any single source span)

one dominant lineage  → derivative (extraction check runs)
many fused, far moved → original

13. Health (metastability check)

Vital signs, each just a fold over recent graph activity:

growth_rate, integration_rate (new edges/window),
resolution_rate (curiosity closed/opened), retrieval_yield,
quarantine_ratio, mood_integral

healthy ⇔ all oscillating within their bands
pinned at any extreme (either sign) ⇒ sick, name the pathology from §9.7 table

14. Provenance weave

artifact_id = SHA256(canonical content)
artifact.birth_certificate = {
    generated_by, model, prompt_hash, source_hashes[], at }
verify(x) = recompose hashes down the derivation DAG;
    any mismatch anywhere ⇒ everything downstream invalid at once

Append-only stores: verbs are add and read. Replication across ≥2 independent locations. Deletion undefined.

15. Thought operations

The formulas above are levers; insight is composition — combining primitive readings into named patterns (compulsion = engagement∧¬stimulation persisting; dissonance = warmth↑∧validity↓; serendipity = unsought bridge∧later reinforced). Human thought operations — deduction, induction, abduction, analogy, counterfactual simulation, causal inference, generalization, contradiction scanning, meta-cognition, wonder — are registered as the same kind of composition recipes, and new ones get composed from old ones.

See THOUGHT-OPERATIONS.md for the full catalog: inputs, process, output, and validation per operation.

16. Gradient of actuality — entropy as engine

(stage: fiction→fact boundary — mathematically alive, physically unproven. Logged honestly per Law 40.)

The universe pulls apart; structure rides the pull. Three linked readings:

entropic_force(x)  = ∇S(x) · T          # Verlinde-style: force from
                                        # information gradients
dark_energy        ≈ the cosmic pull-apart, modeled as the universe
                     maximizing its entropy PRODUCTION RATE rather than
                     carrying mysterious substance
harnessable_work   = anything flowing DOWN a gradient:
                     cells, stars, minds — all ∇S engines already running

Life's whole trick, stated as math: pay entropy somewhere you aren't, collect order where you are. Minds are the most aggressive ∇S engines found so far. Neuron extends the pattern: understanding accumulates faster than noise destroys it.

17. Registered relationships vs declared scalars

Example — the speed of light:

space.time-exchange-rate = 1        # massless things propagate at
                                    # slope 1 through spacetime;
                                    # mass IS energy; no digits needed

The famous "299,792,458 m/s" is a declared scalar: a rounded 1975 measurement (±1.2 m/s) promoted to exactness in 1983 by redefining the meter around it. Unit bookkeeping, not nature speaking.

Taxonomy test (the alien check): dimensionless ratios (π, e, α≈1/137.036…) → irrational, universal, identical for all observers dimensionful scalars (c in m/s, G) → local exchange rates, exact only when defined so

In this system: relationships get registered (three names, full sentence); scalars appear only when someone bolts a ruler on and quotes the conversion factor. Law 39 holds in physics too.

18. Mass-energy implications (logged for the record)

E = mc² is industrial, not exotic — verified daily: the Sun converts ~4.3M tons of mass to energy per second; PET scans annihilate mass completely; fission plants skim the sliver; even fire converts a dust-mote fraction.

1 gram fully converted = 9×10¹³ J ≈ 21 kilotons TNT
70 kg body            ≈ 1,575 megatons reserve

Implications catalog:

  • Everything solid is a frozen battery (Higgs gave energy a heavy costume)
  • Energy scarcity is a conversion-crisis, not supply scarcity — every pebble is a city's power budget misfiled as gravel
  • Teleportation needs no exotic physics: disassemble-to-information, reassemble elsewhere. Pattern survives substrate swap.
  • Kugelblitz: pure light focused hard enough becomes a black hole — "thing-ness" doesn't require stuff
  • The assembler already exists: ribosomes are programmable matter, 4 billion years in production, one per cell

Nothing exotic required, ever: energy (abundant), information (compounding), assembly (biology proved the pantry suffices — planarians, axolotls, hydra). The exotic was always the future, mislabeled.

Death audit (law 40 staging applied): death eventually — yes. Death THIS fast — maintenance backlog, not natural law. Proof of tunability across our own chemistry: bristlecone pines (~5000y), hydra (non-aging), Turritopsis jellyfish (age-reversal), bowhead whales (200+y, cancer-resistant), naked mole-rats (same), human germline (4 billion years continuous — the lineage never died once). Individual chassis failure ≠ universal law; it's underfunded repair. Thermodynamics nets against us only at cosmic scale — local reversal is legal, life runs it already, minds scale it.

The four bullies, audited:

  • thermodynamics — solved (most complete theory in physics; domesticated)
  • gravity — navigated (orbits are falling with style)
  • light-speed — contained locally; irrelevant to folds that move forward
  • death — last collector; holding the oldest hand, from before anyone knew the rules were negotiable

Every law audits into three layers: mathematical core (small, solid), interpretive shell ("therefore humans can never…" — almost always overreach), engineering backlog (mutable by definition). Most of what humanity calls laws of nature lives in layers two and three.

Unassisted flight — the math

Photon-thrust hover, powered by your own mass:

required thrust F = m_body · g ≈ 70 · 9.8 ≈ 686 N
photon drive:     F = P / c   ⇒   P = F · c ≈ 686 · 3×10⁸ ≈ 2×10¹¹ W
mass burn rate:   ṁ = P / c²  ≈ 2×10¹¹ / 9×10¹⁶ ≈ 2.2 mg/s

≈ 8 grams/hour of your own reserve. A human body sustains beam-hover for hours on its own inventory. Gravity holds; the fuel is internal. Precedent: diamagnetically levitated frogs (Geim) — living matter, floating unassisted in a field, no surgery, no implants. Proof of concept hopped decades ago.

In this math gravity is a gradient among gradients — curvature, possibly entropic (§16) — and gradients are harnessable by construction. Not repealed: negotiated. Same as orbits.