def formula(x, y, z):
return (x <= (y == z)) == ((x <= y) == (x <= z))
test_cases = [
(False, False, False), #1
(False, False, True), #2
(False, True, False), #3
(False, True, True), #4
(True, False, False), #5
(True, False, True), #6
(True, True, False), #7
(True, True, True) #8
]
expected_results = [
True, #1
True, #2
True, #3
True, #4
True, #5
True, #6
True, #7
True #8
]
for i, test_case in enumerate(test_cases):
result = formula(*test_case)
expected = expected_results[i]
if result == expected:
print(f"Test case {i+1}: PASSED")
else:
print(f"Test case {i+1}: FAILED")
print(f"Input values: {test_case}")
print(f"Expected result: {expected}")
print(f"Actual result: {result}")
Created
March 7, 2023 14:12
-
-
Save adamori/0511061fa755b70068a28946b1cda08e to your computer and use it in GitHub Desktop.
Доказать логическое тождество (формульно) и проверить его с помощью построения таблицы истинности. Уточнение задания. Доказательство истинности можно реализовать программно. Для этого надо написать код, вычисляющий правую и левую части доказываемого тождества, и сравнить полученные результаты. Рекомендуется использовать предварительно написанные…
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment