@@ -20,8 +20,8 @@ def tt_entails(kb: list[str], query: str, symbols: list[str]) -> bool:
2020
2121 Returns:
2222 bool: True if KB entails query, False otherwise
23-
24- Example:
23+
24+ Example:
2525 tt_entails(["P or Q"], "Q", ["P","Q"])
2626
2727 """
@@ -33,19 +33,17 @@ def tt_entails(kb: list[str], query: str, symbols: list[str]) -> bool:
3333 return False
3434 return True
3535
36+
3637# Example usage
3738if __name__ == "__main__" :
3839 # Example 1: KB entails query → should return True
3940 symbols = ["P" , "Q" ]
40- kb = ["P or Q" , "not P or Q" ] # KB says P or Q is True, and not P or Q is True
41- query = "Q" # Query: Is Q True?
41+ kb = ["P or Q" , "not P or Q" ] # KB says P or Q is True, and not P or Q is True
42+ query = "Q" # Query: Is Q True?
4243 print ("Does KB entail query? : " , tt_entails (kb , query , symbols ))
43-
44+
4445 # Example 2: KB does NOT entail query → should return False
4546 symbols2 = ["P" , "Q" ]
46- kb2 = ["P" ] # KB says only P is True
47- query2 = "Q" # Query asks if Q is True
47+ kb2 = ["P" ] # KB says only P is True
48+ query2 = "Q" # Query asks if Q is True
4849 print ("Does KB2 entail query2? : " , tt_entails (kb2 , query2 , symbols2 ))
49-
50-
51-
0 commit comments