Skip to content

Commit 2796389

Browse files
committed
Update: towards metta-nars in metta-morph
1 parent d0991bb commit 2796389

31 files changed

+319
-548
lines changed

LICENSE

-21
This file was deleted.

README.md

-24
This file was deleted.

minnars/README.md

-7
This file was deleted.

minnars/input.metta

-6
This file was deleted.

minnars/minnars.metta

-41
This file was deleted.

minnars/run.sh

-6
This file was deleted.

nalifier/input.metta

-24
This file was deleted.

nalifier/nalifier.metta

-41
This file was deleted.

nalifier/run.sh

-1
This file was deleted.

repl.py

-46
This file was deleted.

run.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
sh build.sh && cat ./src/NARS.metta $1 > RUN.metta && metta RUN.metta
1+
sh build.sh && cat ./src/NARS.metta $1 > RUN.metta
2+
cd ..
3+
sh runscheme.sh ./metta-nars/RUN.metta

src/build.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ sh build.sh
1111
cd ..
1212

1313
echo "metta-nars build start."
14-
cat TUPLECOUNTS.metta > /dev/null || (cat utils.metta > BUILDTUPLECOUNTS.metta && echo "!(do (BuildTupleCounts (1) 0 100))" >> BUILDTUPLECOUNTS.metta && metta BUILDTUPLECOUNTS.metta 2> TUPLECOUNTS.metta)
15-
cat utils.metta TUPLECOUNTS.metta ./logic/LOGIC.metta ./memory/MEMORY.metta ./control/CONTROL.metta > NARS.metta
14+
cat utils.metta ./logic/LOGIC.metta ./memory/MEMORY.metta ./control/CONTROL.metta > NARS.metta
1615
echo "metta-nars build done."

src/control/declarative.metta

+16-16
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@
44
(= (ConclusionPriority $EPrio $CPrio $ConcTV) (* (* $EPrio $CPrio) (Truth_Expectation $ConcTV)))
55

66
;making declarative inferences on two events (task from PQ and belief from concept)
7-
(= (Conclude (Event $S1 ($time1 $ev1 $prio1)) (Event $S2 ($time2 $ev2 $prio2)) $CPrio $t)
7+
(= (Conclude ('Event $S1 ($time1 $ev1 $prio1)) ('Event $S2 ($time2 $ev2 $prio2)) $CPrio $t)
88
(let $ConclusionStamp (TupleConcat $ev1 $ev2)
99
(If (StampDisjoint $ConclusionStamp)
1010
(let ($ConcTerm $ConcTV) (superpose ((|- $S1 $S2) (|- $S2 $S1)))
11-
(Event ($ConcTerm $ConcTV)
12-
($time1 $ConclusionStamp
13-
($t (ConclusionPriority (EventPriorityNow $prio1 $t)
14-
(ConceptPriorityNow $CPrio $t)
15-
$ConcTV))))))))
11+
('Event ($ConcTerm $ConcTV)
12+
($time1 $ConclusionStamp
13+
($t (ConclusionPriority (EventPriorityNow $prio1 $t)
14+
(ConceptPriorityNow $CPrio $t)
15+
$ConcTV))))))))
1616

1717
;find a belief for the task to generate conclusions with
18-
(= (ReasonWithTask (Event $S1 ($time1 $ev1 $prio1)) $t)
19-
(let ($Belief $CPrio) (case (get-atoms &attentional_focus)
20-
(((Concept $Term (Event $SE2 ($timeE2 $evE2 $prioE2)) (Event $S2 ($time2 $ev2 $prio2)) $CPrio)
18+
(= (ReasonWithTask ('Event $S1 ($time1 $ev1 $prio1)) $t)
19+
(let ($Belief $CPrio) (case (get-atoms '&attentional_focus)
20+
((('Concept $Term ('Event $SE2 ($timeE2 $evE2 $prioE2)) ('Event $S2 ($time2 $ev2 $prio2)) $CPrio)
2121
(If (and (not (== $time1 eternal)) (> (abs (- $time1 $time2)) 20))
22-
((Event $SE2 ($timeE2 $evE2 $prioE2)) $Cprio)
23-
((Event $S2 ($time2 $ev2 $prio2)) $CPrio)))))
24-
(case (Conclude (Event $S1 ($time1 $ev1 $prio1)) (TemporallyAlignedBelief $time1 $Belief) $CPrio $t)
25-
(((Event $1 $2) (ProcessBeliefEvent (Event (trace! (. $1) $1) $2) $t))))))
22+
(('Event $SE2 ($timeE2 $evE2 $prioE2)) $Cprio)
23+
(('Event $S2 ($time2 $ev2 $prio2)) $CPrio)))))
24+
(case (Conclude ('Event $S1 ($time1 $ev1 $prio1)) (TemporallyAlignedBelief $time1 $Belief) $CPrio $t)
25+
((('Event $1 $2) (ProcessBeliefEvent ('Event (trace! ('pt $1) $1) $2) $t))))))
2626

2727
;select the highest priority belief event from the PQ and use it for reasoning
28-
(= (BeliefCycle $t) (do (sequential ((let $Ev (SelectHighestPriorityEvent &belief_events $t)
29-
(sequential ((remove-atom &belief_events $Ev)
28+
(= (BeliefCycle $t) (do (sequential ((let $Ev (SelectHighestPriorityEvent '&belief_events $t)
29+
(sequential ((remove-atom '&belief_events $Ev)
3030
(ReasonWithTask $Ev $t))))
3131
(UpdateReasonerState)
32-
(BoundEvents &belief_events 0.0 0.1 (BeliefEventsMax) $t)
32+
(BoundEvents '&belief_events 0.0 0.1 (BeliefEventsMax 'dummy) $t)
3333
(BoundAttention 0.0 0.1 (AttentionalFocusConceptsMax) $t)))))

src/control/procedural.metta

+17-17
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,45 @@
44
(= (SubgoalPriority $EPrio $ConcTV) (* $EPrio (Truth_Expectation $ConcTV)))
55

66
;Expectation of an operation is the truth expectation of its desire value
7-
(= (OpExpectation (Decision ($Opname $DVOp) $Subgoal) $t) (Truth_Expectation $DVOp))
7+
(= (OpExpectation ('Decision ($Opname $DVOp) $Subgoal) $t) (Truth_Expectation $DVOp))
88

99
;Inject executed operation as an event and return its name
1010
(= (Execute $Opname) (superpose ((AddBeliefEvent ($Opname (1.0 0.9))) $Opname)))
1111

1212
;Add subgoals to the PQ
1313
(= (DeriveSubgoals $Options)
14-
(do (let (Decision $Op (Event $S $Metadata)) (superpose $Options)
15-
(let $Subgoal (Event (trace! (! $S) $S) $Metadata)
16-
(add-atom &goal_events $Subgoal)))))
14+
(do (let ('Decision $Op ('Event $S $Metadata)) (superpose $Options)
15+
(let $Subgoal ('Event (trace! (! $S) $S) $Metadata)
16+
(add-atom '&goal_events $Subgoal)))))
1717

1818
;execute the operation which most likely gets the goal achieved in current contexts, and if contexts are not yet fulfilled, derive them as subgoals
19-
(= (BestDecision $t (Event ($Term $DV) ($GoalTime $GoalEvBase $GoalPrio)) $FIFO)
20-
(let $Options (collapse (let* (((Event ((($Prec &/ (^ $Op)) =/> $Term) $ImpTV) ($ImpTime $ImpEvBase $ImpPrio))
21-
(EternalQuestion (($Prec &/ (^ $Op)) =/> $Term)))
19+
(= (BestDecision $t ('Event ($Term $DV) ($GoalTime $GoalEvBase $GoalPrio)) $FIFO)
20+
(let $Options (collapse (let* ((('Event ((($Prec '&/ ('^ $Op)) '=/> $Term) $ImpTV) ($ImpTime $ImpEvBase $ImpPrio))
21+
(EternalQuestion (($Prec '&/ ('^ $Op)) '=/> $Term)))
2222
($DVPrecOp (Truth_Deduction $DV $ImpTV))
23-
((Event ($PrecTerm $PrecTV) $PrecMetadata)
23+
(('Event ($PrecTerm $PrecTV) $PrecMetadata)
2424
(Projection (EventQuestion $Prec) $t))
2525
($DVOp (Truth_Deduction $PrecTV $DVPrecOp))
2626
($DVPrec (Truth_StructuralDeduction $DVPrecOp))
2727
($SubgoalStamp (TupleConcat $GoalEvBase $ImpEvBase)))
2828
(If (StampDisjoint $SubgoalStamp)
29-
(Decision ((^ $Op) $DVOp) (Event ($Prec (Truth_StructuralDeduction $DVPrecOp))
29+
('Decision (('^ $Op) $DVOp) ('Event ($Prec (Truth_StructuralDeduction $DVPrecOp))
3030
($t $SubgoalStamp ($t (SubgoalPriority (EventPriorityNow $GoalPrio $t) $DVPrec))))))))
31-
(let (Decision ($Opname $DVOp) $Subgoal) (BestCandidate $Options OpExpectation $t)
31+
(let ('Decision ($Opname $DVOp) $Subgoal) (BestCandidate $Options OpExpectation $t)
3232
(If (> (Truth_Expectation $DVOp) 0.5)
3333
(Execute $Opname)
3434
(DeriveSubgoals $Options)))))
3535

3636
;select the highest priority goal event from the PQ and use it for decision making
37-
(= (GoalCycle $t) (sequential ((let $Ev (SelectHighestPriorityEvent &goal_events $t)
38-
(sequential ((do (remove-atom &goal_events $Ev))
39-
(BestDecision $t $Ev (get-state &FIFO)))))
37+
(= (GoalCycle $t) (sequential ((let $Ev (SelectHighestPriorityEvent '&goal_events $t)
38+
(sequential ((do (remove-atom '&goal_events $Ev))
39+
(BestDecision $t $Ev (get-state '&FIFO)))))
4040
(do (UpdateReasonerState))
41-
(do (BoundEvents &goal_events 0.0 0.1 (GoalEventsMax) $t)))))
41+
(do (BoundEvents '&goal_events 0.0 0.1 (GoalEventsMax 'dummy) $t)))))
4242

4343
;Input procedure
4444
(= (AddGoalEvent $Sentence)
45-
(let* ((($t $evidentialBase) (GetReasonerState))
46-
($InputEvent (Event (trace! (! $Sentence) $Sentence) ($t $evidentialBase ($t 1.0)))))
47-
(sequential ((do (add-atom &goal_events $InputEvent))
45+
(let* ((($t $evidentialBase) (GetReasonerState 'dummy))
46+
($InputEvent ('Event (trace! (! $Sentence) $Sentence) ($t $evidentialBase ($t 1.0)))))
47+
(sequential ((do (add-atom '&goal_events $InputEvent))
4848
(GoalCycle $t)))))

0 commit comments

Comments
 (0)