是否可以简化此布尔代数?我想删除使用两倍X变量的冗余,但似乎看不出如何。
(X和Y)或不(X和Z)
提前致谢!
答案 0 :(得分:1)
相当于
(X AND Y) OR (NOT X OR NOT Z)
相当于
(X AND Y) OR NOT X OR NOT Z
相当于
(X OR NOT X OR NOT Z) AND (Y OR NOT X OR NOT Z)
相当于
(TRUE) AND (Y OR NOT X OR NOT Z)
(自X or NOT x == true
和TRUE OR Z == true
)
相当于
Y OR NOT X OR NOT Z
您还可以使用K-map查找等效的逻辑表达式,但这些表达式更难输入:)
答案 1 :(得分:1)
在卡诺图中,您可以看到您的表达式确实相当于三个单字词术语的总和:
ubuntu@ubuntu-VirtualBox:~/Documents/code/python- stuff/googleapis/cloudvisionapi/cloud-vision/python/face_detection$ python faces.py demo-image.jpg
Traceback (most recent call last):
File "faces.py", line 121, in <module>
main(args.input_image, args.output, args.max_results)
File "faces.py", line 98, in main
faces = detect_face(image, max_results)
File "faces.py", line 62, in detect_face
service = get_vision_service()
File "faces.py", line 35, in get_vision_service
credentials = GoogleCredentials.get_application_default()
File "/home/ubuntu/.local/lib/python2.7/site- packages/oauth2client/client.py", line 1398, in get_application_default
return GoogleCredentials._get_implicit_credentials()
File "/home/ubuntu/.local/lib/python2.7/site- packages/oauth2client/client.py", line 1388, in _get_implicit_credentials
raise ApplicationDefaultCredentialsError(ADC_HELP_MSG)
oauth2client.client.ApplicationDefaultCredentialsError: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application- default-credentials for more information.
ubuntu@ubuntu-VirtualBox:~/Documents/code/python- stuff/googleapis/cloudvisionapi/cloud-vision/python/face_detection$
[1]: https://github.com/GoogleCloudPlatform/cloud- vision/tree/master/python/face_detection
正如Elye指出的那样,单个0可以表示为具有三个输入的反转项:
not x or y or not z
yz
00 01 11 10
+---+---+---+---+
0 | 1 | 1 | 1 | 1 |
x +---+---+---+---+
1 | 1 | 0 | 1 | 1 |
+---+---+---+---+
答案 2 :(得分:0)
这等于!(X和!Y和Z)。
你也可以有公式 (!X或Y或!Z)
您可以在http://www.wolframalpha.com/input/?i=%28X+AND+Y%29+OR+NOT%28X+AND+Z%29
中确认答案