Skip to content

Commit 9ea8021

Browse files
authored
Merge pull request #42 from trueagi-io/TranslatorGeneralized
Generalized implication translator for PLN Mettamorph usage
2 parents f7029d2 + 3a2629e commit 9ea8021

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

src/Deriver.metta

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
(if (StampDisjoint $Ev1 $Ev2)
1616
(case (|- $x $y) ((($T $TV) (Sentence ($T $TV) $stamp)))) (empty)))
1717
(let (Sentence $z $Ev3) (superpose $beliefs)
18-
(case (|- $z) ((($T3 $TV3) (Sentence ($T3 $TV3) $Ev3))))))))
18+
(case (|- $z) ((($T3 $TV3) (Sentence ($T3 $TV3) $Ev3))))))))
1919
(Derive (TupleConcat $beliefs $derivations) (+ $depth 1) $maxdepth))))
2020

2121
;retrieve the best candidate

src/Translator.metta

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@
22
(= (maybe $x $y) False)
33

44
(= (sentence $X $Y)
5-
(if (maybe $X ((Implication (Evaluation $1 $11) (Evaluation $2 $22)) $TV))
6-
(trace! (= (|- ((Evaluation $1 $11) $TV1))
7-
((Evaluation $2 $22)
8-
(Truth_ModusPonens $TV1 $TV)))
9-
"PLN.Init: Translated nested implication into function")
10-
(if (maybe $X ((Implication (Evaluation $1 $11)
11-
(Implication (Evaluation $2 $22)
12-
(Evaluation $3 $33))) $TV))
13-
(trace! (= (|- ((Evaluation $1 $11) $TV1)
14-
((Evaluation $2 $22) $TV2))
15-
((Evaluation $3 $33)
16-
(Truth_ModusPonens (Truth_ModusPonens $TV1 $TV2) $TV)))
17-
"PLN.Init: Translated implication into function")
18-
(if (maybe $X ((Evaluation $1 $11) $TV))
19-
(Sentence $X $Y)
20-
(if (maybe $X ((Concept $C) $TV))
21-
(trace! (= (STV (Concept $C)) $TV)
22-
"PLN.Init: Translated concept into function")
23-
(empty))))))
5+
(if (and (maybe $X ((Implication ($LinkType1 $1 $11) ($LinkType2 $2 $22)) $TV))
6+
(not (== $LinkType2 Implication)))
7+
(trace! (= (|- (($LinkType1 $1 $11) $TV1))
8+
(($LinkType2 $2 $22) (Truth_ModusPonens $TV1 $TV)))
9+
"PLN.Init: Translated implication into function")
10+
(if (maybe $X ((Implication ($LinkType1 $1 $11)
11+
(Implication ($LinkType2 $2 $22)
12+
($LinkType3 $3 $33))) $TV))
13+
(trace! (= (|- (($LinkType1 $1 $11) $TV1)
14+
(($LinkType2 $2 $22) $TV2))
15+
(($LinkType3 $3 $33) (Truth_ModusPonens (Truth_ModusPonens $TV1 $TV2) $TV)))
16+
"PLN.Init: Translated nested implication into function")
17+
(if (maybe $X ((Concept $C) $TV))
18+
(trace! (= (STV (Concept $C)) $TV)
19+
"PLN.Init: Translated concept into function")
20+
(empty)))))
2421

0 commit comments

Comments
 (0)