Created
November 11, 2017 20:30
-
-
Save elliott-beach/0b920cc93393221c40ca615db599d51c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logic | |
# Write problem 3 into a logic base. | |
prob3 = logic.PropKB() | |
A, B, C, D, E = logic.expr('A, B, C, D, E') | |
prob3.tell(A) | |
prob3.tell(~A | C) | |
prob3.tell(C | ~D) | |
prob3.tell(D | C) | |
prob3.tell(~B | ~D | E) | |
# Use the knowledge to find the answers to (3.1) and (3.2) | |
print(prob3.ask_if_true(C)) # True | |
print(prob3.ask_if_true(E)) # False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment