Created
July 31, 2025 22:07
-
-
Save patham9/56ccaf963266406c33d27826ee6a6f4b to your computer and use it in GitHub Desktop.
PLN deriver efficiency: use derivations only for inference in each recursion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Exhaustive-until-depth deriver | |
| (= (Derive $derivationsLast $beliefs $depth $maxdepth) | |
| (if (> $depth $maxdepth) | |
| $beliefs | |
| (let $derivations | |
| (collapse (superpose ((let* (((Sentence $x $Ev1) (superpose $derivationsLast)) | |
| ((Sentence $y $Ev2) (superpose $beliefs)) | |
| ($stamp (TupleConcat $Ev1 $Ev2))) | |
| (if (StampDisjoint $Ev1 $Ev2) | |
| (case (|- $x $y) ((($T $TV) (Sentence ($T $TV) $stamp)))) (empty))) | |
| (let (Sentence $z $Ev3) (superpose $beliefs) | |
| (case (|- $z) ((($T3 $TV3) (Sentence ($T3 $TV3) $Ev3)))))))) | |
| (Derive $derivations (TupleConcat $beliefs $derivations) (+ $depth 1) $maxdepth)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment