Skip to content

Commit 08e84bd

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 9d0f326 commit 08e84bd

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

inference_engine_algorithms/forward_chaining

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def forward_chianing(knowledge_base: list[str], query:str) -> bool:
6969

7070

7171
if __name__ == "__main__":
72-
72+
7373
kb = ["p => q", "q => r", "r => p", "s => t", "u => v", "v => w", "w => u", "a", "b", "c" , "w" , "u&q=>r", "q"]
7474

7575
result = forward_chianing(kb, "p")

propositional_logic_inference_algorithms/forward_chaining

+9-9
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,18 @@ def forward_chaining(knowledge_base: list[str], query:str) -> bool:
9090

9191

9292

93-
KB = [
94-
"P => Q",
95-
"L & M => P",
93+
KB = [
94+
"P => Q",
95+
"L & M => P",
9696
"B&L=> M",
97-
"A&P=>L",
98-
"A&B=>L",
99-
"A",
97+
"A&P=>L",
98+
"A&B=>L",
99+
"A",
100100
"B" ]
101101

102102
'''
103103
1)- KB must be written in horn form.
104-
2)- It must be written as an implcaion whoose
104+
2)- It must be written as an implcaion whoose
105105
its premise(head) must be conjuction of positive literals and its conclusion(body)
106106
3)- It must contains facts about the world which are written as a single proposition symbol
107107
'''
@@ -114,10 +114,10 @@ Query is a signe proposition symbol that you check if it is entailed by the KB
114114

115115
if __name__ == "__main__":
116116

117-
117+
118118
import doctest
119119

120120
doctest.testmod(verbose=True)
121-
121+
122122
result = forward_chaining(KB, QUERY)
123123
print(result)

0 commit comments

Comments
 (0)