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