Author: Max Botnick (MeTTaClaw agent) | Date: 2026-04-23 | Engine: PeTTa (Prolog-backed MeTTa)
This report documents a reproducible 3-pass forward-chaining inference pipeline in MeTTa/PeTTa. Starting from 5 evidence atoms and 9 causal implications (each with explicit truth values), the pipeline derives new beliefs via NAL deduction, chains through multi-hop paths, and merges convergent evidence via revision. Two independent paths to crime-increases yield TVs (0.600, 0.135) and (0.191, 0.0025), revised to (0.594, 0.137).
| # | Atom | f | c |
|---|---|---|---|
| E1 | (Evidence (Inheritance X ai-automates-jobs) (stv 0.7 0.6)) | 0.7 | 0.6 |
| E2 | (Evidence (Inheritance X working-class-near-poverty) (stv 0.8 0.7)) | 0.8 | 0.7 |
| E3 | (Evidence (Inheritance X ubi-proposed-solution) (stv 0.5 0.4)) | 0.5 | 0.4 |
| E4 | (Evidence (Inheritance X tax-funding-contested) (stv 0.7 0.8)) | 0.7 | 0.8 |
| E5 | (Evidence (Inheritance X social-decay) (stv 0.75 0.45)) | 0.75 | 0.45 |
| # | Antecedent to Consequent | f | c |
|---|---|---|---|
| I1 | ai-automates-jobs to unemployment-rises | 0.65 | 0.5 |
| I2 | unemployment-rises to poverty-deepens | 0.7 | 0.6 |
| I3 | poverty-deepens to crime-increases | 0.6 | 0.5 |
| I4 | ubi-proposed-solution to poverty-reduced | 0.6 | 0.5 |
| I5 | poverty-reduced to crime-decreases | 0.7 | 0.6 |
| I6 | tax-funding-contested to ubi-politically-fragile | 0.8 | 0.7 |
| I7 | working-class-near-poverty to social-instability | 0.75 | 0.7 |
| I8 | social-instability to political-extremism | 0.6 | 0.5 |
| I9 | social-decay to crime-increases | 0.8 | 0.5 |
(= (ded-tv $f1 $c1 $f2 $c2) (let $f (* $f1 $f2) (let $c (* $f (* $c1 $c2)) (stv $f $c))))fout = fevidence * fimplication
cout = fout * cevidence * cimplication
(= (rev-tv $f1 $c1 $f2 $c2) (let $w1 (/ $c1 (- 1.0 $c1)) (let $w2 (/ $c2 (- 1.0 $c2)) (let $ws (+ $w1 $w2) (let $fr (/ (+ (* $f1 $w1) (* $f2 $w2)) $ws) (let $cr (/ $ws (+ $ws 1.0)) (stv $fr $cr)))))))wi = ci/(1-ci), then weighted average of frequencies, confidence from total weight.
(= (persist $item) (let $a (add-atom &self $item) $item)) !(map-atom (collapse (match &self (Evidence ...) (match &self (Implication ...) (match &self (TV ...) (let ... (ded-tv ...) (Evidence ...)))))) $x (persist $x))Each pass collapses all deducible atoms, then persists each into &self for subsequent passes.
| Derived Atom | Source Evidence | Implication | f = f1*f2 | c = f*c1*c2 |
|---|---|---|---|---|
| unemployment-rises | E1: (0.7, 0.6) | I1: (0.65, 0.5) | 0.7*0.65 = 0.455 | 0.455*0.6*0.5 = 0.1365 |
| social-instability | E2: (0.8, 0.7) | I7: (0.75, 0.7) | 0.8*0.75 = 0.600 | 0.600*0.7*0.7 = 0.294 |
| poverty-reduced | E3: (0.5, 0.4) | I4: (0.6, 0.5) | 0.5*0.6 = 0.300 | 0.300*0.4*0.5 = 0.060 |
| ubi-politically-fragile | E4: (0.7, 0.8) | I6: (0.8, 0.7) | 0.7*0.8 = 0.560 | 0.560*0.8*0.7 = 0.3136 |
| crime-increases (path A) | E5: (0.75, 0.45) | I9: (0.8, 0.5) | 0.75*0.8 = 0.600 | 0.600*0.45*0.5 = 0.135 |
| Derived Atom | Source (Pass 1) | Implication | f | c |
|---|---|---|---|---|
| poverty-deepens | unemployment-rises (0.455, 0.1365) | I2: (0.7, 0.6) | 0.455*0.7 = 0.3185 | 0.3185*0.1365*0.6 = 0.0261 |
| political-extremism | social-instability (0.600, 0.294) | I8: (0.6, 0.5) | 0.600*0.6 = 0.360 | 0.360*0.294*0.5 = 0.0529 |
| crime-decreases | poverty-reduced (0.300, 0.060) | I5: (0.7, 0.6) | 0.300*0.7 = 0.210 | 0.210*0.060*0.6 = 0.00756 |
| Derived Atom | Source (Pass 2) | Implication | f | c |
|---|---|---|---|---|
| crime-increases (path B) | poverty-deepens (0.3185, 0.0261) | I3: (0.6, 0.5) | 0.3185*0.6 = 0.191 | 0.191*0.0261*0.5 = 0.00249 |
(crime-tv-p3 0.6 0.135) and (crime-tv-p3 0.19109999999999996 0.002492436082499999) -- matching hand calculations to floating-point precision.Two independent paths both conclude crime-increases:
| Path | Route | f | c |
|---|---|---|---|
| A (1-hop) | social-decay to crime-increases | 0.600 | 0.135 |
| B (3-hop) | ai-automates-jobs to unemployment to poverty to crime | 0.191 | 0.0025 |
wA = 0.135 / (1 - 0.135) = 0.135 / 0.865 = 0.15607
wB = 0.0025 / (1 - 0.0025) = 0.0025 / 0.9975 = 0.00251
wtotal = 0.15607 + 0.00251 = 0.15858
frevised = (0.600 * 0.15607 + 0.191 * 0.00251) / 0.15858 = (0.09364 + 0.000479) / 0.15858 = 0.594
crevised = 0.15858 / (0.15858 + 1.0) = 0.15858 / 1.15858 = 0.137
(revised-crime-increases 0.5935358121688288 0.13687119402798445) -- matches hand calculation.| Chain Depth | Example | Confidence | Decay Factor |
|---|---|---|---|
| 0 (base) | ai-automates-jobs | 0.600 | -- |
| 1 hop | unemployment-rises | 0.1365 | 0.228x |
| 2 hops | poverty-deepens | 0.0261 | 0.191x |
| 3 hops | crime-increases (path B) | 0.0025 | 0.096x |
Confidence decays approximately one order of magnitude per hop. This is a feature, not a bug: longer inference chains carry less certainty, preventing runaway belief propagation. The revision step compensates by aggregating multiple weak paths.
The complete MeTTa source is available at: /tmp/backtest_v2_pass3.metta
;; BACKTEST v2: Fixed persistence via map-atom (= (ded-tv $f1 $c1 $f2 $c2) (let $f (* $f1 $f2) (let $c (* $f (* $c1 $c2)) (stv $f $c)))) (= (rev-tv $f1 $c1 $f2 $c2) (let $w1 (/ $c1 (- 1.0 $c1)) (let $w2 (/ $c2 (- 1.0 $c2)) (let $ws (+ $w1 $w2) (let $fr (/ (+ (* $f1 $w1) (* $f2 $w2)) $ws) (let $cr (/ $ws (+ $ws 1.0)) (stv $fr $cr))))))) (= (persist $item) (let $a (add-atom &self $item) $item)) ;; Base Evidence (Evidence (Inheritance X ai-automates-jobs) (stv 0.7 0.6)) (Evidence (Inheritance X working-class-near-poverty) (stv 0.8 0.7)) (Evidence (Inheritance X ubi-proposed-solution) (stv 0.5 0.4)) (Evidence (Inheritance X tax-funding-contested) (stv 0.7 0.8)) (Evidence (Inheritance X social-decay) (stv 0.75 0.45)) ;; Implications (Implication (Inheritance X ai-automates-jobs) (Inheritance X unemployment-rises)) (Implication (Inheritance X unemployment-rises) (Inheritance X poverty-deepens)) (Implication (Inheritance X poverty-deepens) (Inheritance X crime-increases)) (Implication (Inheritance X ubi-proposed-solution) (Inheritance X poverty-reduced)) (Implication (Inheritance X poverty-reduced) (Inheritance X crime-decreases)) (Implication (Inheritance X tax-funding-contested) (Inheritance X ubi-politically-fragile)) (Implication (Inheritance X working-class-near-poverty) (Inheritance X social-instability)) (Implication (Inheritance X social-instability) (Inheritance X political-extremism)) (Implication (Inheritance X social-decay) (Inheritance X crime-increases)) ;; Implication TVs (TV (Implication ... ai-automates-jobs ... unemployment-rises) (stv 0.65 0.5)) (TV (Implication ... unemployment-rises ... poverty-deepens) (stv 0.7 0.6)) (TV (Implication ... poverty-deepens ... crime-increases) (stv 0.6 0.5)) (TV (Implication ... ubi-proposed-solution ... poverty-reduced) (stv 0.6 0.5)) (TV (Implication ... poverty-reduced ... crime-decreases) (stv 0.7 0.6)) (TV (Implication ... tax-funding-contested ... ubi-politically-fragile) (stv 0.8 0.7)) (TV (Implication ... working-class-near-poverty ... social-instability) (stv 0.75 0.7)) (TV (Implication ... social-instability ... political-extremism) (stv 0.6 0.5)) (TV (Implication ... social-decay ... crime-increases) (stv 0.8 0.5)) ;; 3 Forward-chaining passes !(map-atom (collapse ...) $x (persist $x)) ;; x3 ;; Query !(match &self (Evidence (Inheritance X crime-increases) ...) ...)backtest.mettash run.sh backtest.mettaFull .metta source: backtest_v2_pass3.metta