OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-rocca commits / 68f303a

Replace ≺ (symbolic representation of SequentialAnd) by ⩘
That way we can also have ⩗ as symbolic representation of SequentialOr.
68f303a15136ba0fb436439cff821f6c1c3ff32a
by Nil Geisweiller <ngeiswei@gmail.com> · 2022-05-05T15:23:53.000Z

Changed files (5) +17 -15

examples/README.md +2 -2
……@@ -18,8 +18,8 @@ building more complex plans out of simpler plans using temporal
1818deduction. The optimal strategy is achieved with the following 2
1919plans:
2020
211. `PelletPosition(None)∧AgentPosition(LeftSquare)∧GoRight≺Eat↝Reward`
222. `PelletPosition(None)∧AgentPosition(RightSquare)∧GoLeft≺Eat↝Reward`
211. `PelletPosition(None) ∧ AgentPosition(LeftSquare) ∧ do(GoRight) ⩘ do(Eat) ↝ Reward(1)`
222. `PelletPosition(None) ∧ AgentPosition(RightSquare) ∧ do(GoLeft) ⩘ do(Eat) ↝ Reward(1)`
2323
2424represented in Atomese as
2525
rocca/agents/core.py +2 -2
……@@ -140,7 +140,7 @@ class OpencogAgent:
140140 # C ∧ A₁ ↝ D
141141 # D ∧ A₂ ↝ E
142142 # ⊢
143 # (C ∧ A₁) ≺ A₂ ↝ E
143 # (C ∧ A₁) ⩘ A₂ ↝ E
144144 #
145145 # Useful to string together cognitive schematics into larger
146146 # ones.
……@@ -656,7 +656,7 @@ class OpencogAgent:
656656 C ∧ A₁ ↝ D
657657 D ∧ A₂ ↝ E
658658 ⊢
659 (C ∧ A₁) ≺ A₂ ↝ E
659 (C ∧ A₁) ⩘ A₂ ↝ E
660660
661661 """
662662
rocca/agents/utils.py +9 -7
……@@ -995,7 +995,8 @@ def type_to_human_readable_str(ty) -> str:
995995 Or -> ∨
996996 Not -> ¬
997997 GreaterThan -> >
998 SequentialAnd -> ≺
998 SequentialAnd -> ⩘
999 SequentialOr -> ⩗
9991000 PredictiveImplication[Scope] -> ↝
10001001 Execution -> do
10011002
……@@ -1009,7 +1010,8 @@ def type_to_human_readable_str(ty) -> str:
10091010 types.OrLink: "∨",
10101011 types.GreaterThanLink: ">",
10111012 types.ExecutionLink: "do",
1012 get_type("BackSequentialAndLink"): "≺",
1013 get_type("BackSequentialAndLink"): "⩘",
1014 get_type("BackSequentialOrLink"): "⩗",
10131015 get_type("BackPredictiveImplicationScope"): "↝",
10141016 get_type("BackPredictiveImplicationScopeLink"): "↝",
10151017 }
……@@ -1069,21 +1071,21 @@ def to_human_readable_str(atom: Atom, parenthesis: bool = False) -> str:
10691071
10701072 Precedence order is defined in the syntax_precede function, so that
10711073
1072 C ∧ A₁ ≺ A₂ ↝ G
1074 C ∧ A₁ ⩘ A₂ ↝ G
10731075
10741076 is equivalent to
10751077
1076 ((C ∧ A₁) ≺ A₂) ↝ G
1078 ((C ∧ A₁) ⩘ A₂) ↝ G
10771079
1078 Additionally ≺ is left-associative (due to being a
1080 Additionally ⩘ is left-associative (due to being a
10791081 BackSequentialAnd, we would probably want it to be
10801082 right-associative if it were a ForeSequentialAnd) so that
10811083
1082 A₁ ≺ A₂ ≺ A₃
1084 A₁ ⩘ A₂ ⩘ A₃
10831085
10841086 is equivalent to
10851087
1086 (A₁ ≺ A₂) ≺ A₃
1088 (A₁ ⩘ A₂) ⩘ A₃
10871089
10881090 TODO: support action with arguments.
10891091
tests/agents/test_core.py +2 -2
……@@ -62,7 +62,7 @@ def test_weight():
6262 mm.complexity_penalty = 0.5
6363 mm.compressiveness = 0.1
6464
65 # 1. hold(self, key) ∧ do(go_to_house) ≺ do(go_to_diamonds) ↝ Reward(1)
65 # 1. hold(self, key) ∧ do(go_to_house) ⩘ do(go_to_diamonds) ↝ Reward(1)
6666 cogscm_1 = BackPredictiveImplicationScopeLink(
6767 VariableSet(),
6868 SLink(ZLink()),
……@@ -81,7 +81,7 @@ def test_weight():
8181 tv=createTruthValue(1.0, 0.00780669),
8282 )
8383
84 # 2. hold(self, key) ∧ do(go_to_house) ≺ do(go_to_house) ≺ do(go_to_diamonds) ↝ Reward(1)
84 # 2. hold(self, key) ∧ do(go_to_house) ⩘ do(go_to_house) ⩘ do(go_to_diamonds) ↝ Reward(1)
8585 cogscm_2 = BackPredictiveImplicationScopeLink(
8686 VariableSet(),
8787 SLink(ZLink()),
tests/agents/test_utils.py +2 -2
……@@ -316,7 +316,7 @@ def test_get_context():
316316 assert context_1[0] == expected_1
317317
318318 # 2. Dioaction plan:
319 # outside(self, house) ∧ do(go_to_key) ≺ do(go_to_house) ↝ inside(self, house)
319 # outside(self, house) ∧ do(go_to_key) ⩘ do(go_to_house) ↝ inside(self, house)
320320 cogscm_2 = BackPredictiveImplicationScopeLink(
321321 VariableSet(),
322322 SLink(ZLink()),
……@@ -345,7 +345,7 @@ def test_get_context():
345345 assert context_2[0] == expected_2
346346
347347 # 3. Triaction plan
348 # outside(self, house) ∧ do(go_to_key) ≺ do(go_to_house) ≺ do(go_to_diamonds) ↝ Reward(1)
348 # outside(self, house) ∧ do(go_to_key) ⩘ do(go_to_house) ⩘ do(go_to_diamonds) ↝ Reward(1)
349349 cogscm_3 = BackPredictiveImplicationScopeLink(
350350 VariableSet(),
351351 SLink(ZLink()),