@@ -30,7 +30,6 @@ def find_symbols_in_kb(knowledge_base: list[str]) -> dict:
30
30
31
31
32
32
def number_of_symbols_in_premise (knowledge_base : list [str ]) -> dict :
33
-
34
33
"""
35
34
Count the number of prposiotion symbols in each premise of KB clause.
36
35
:param knowledge_base: a list of string of definite clauses
@@ -66,13 +65,13 @@ def get_known_facts(knowledge_base: list[str]) -> list[str]:
66
65
def forward_chaining (knowledge_base : list [str ], query : str ) -> bool :
67
66
"""Forward chaining on Knowledge Base(KB) of definite clauses
68
67
:param knowledge_base: a list of string of definite clauses
69
- :param query: a single proposition symbol
68
+ :param query: a single proposition symbol
70
69
:returns: If the query entailed by the KB or not?
71
- >>> input_kb = [ "P => Q", "L & M => P",
70
+ >>> input_kb = [ "P => Q", "L & M => P",
72
71
... "B&L=> M", "A&P=>L", "A&B=>L", "A", "B" ]
73
72
>>> forward_chaining(input_kb, "Q")
74
73
True
75
- >>> input_kb = [ "P => Q", "L & M => P",
74
+ >>> input_kb = [ "P => Q", "L & M => P",
76
75
... "B&L=> M", "A&P=>L", "A&B=>L", "A", "B" ]
77
76
>>> forward_chaining(input_kb, "C")
78
77
False
0 commit comments