prolog - Prolog 查询:- true,失败;不真实,不失败;真实,不失败
问题描述
我正在解决一个考试的测试,我得到了这个问题,答案如下:
- 失败
- 是的
- 真的
- 不
在 shell 中运行它我得到 True,但我不明白这个答案是如何获得的。我得到了第一部分true, fail;
,但其余部分是一个谜。我应该只看最后一部分true, not fail
吗?
解决方案
true, fail; not true, not fail; true, not fail
可以翻译成如下逻辑表达式:
(true and false) or (((not true) and (not false)) or (true and (not false)))
我们可以逐步简化...
(true and false) or ((false and true) or (true and true))
false or (false or true)
false or true
true
推荐阅读
- python - Google PubSub 如何在流式拉取消息时处理搜索到的消息
- android - Android 谷歌 MlKit 问题
- docker - 使用 github-action 和 docker-hub 生成乳胶简历参考书目
- android - Android FileProvider 无法使用意图查看图像
- pandas - 将来自多个 DataFrames 的数据组合成单个图,无需组合 DataFrames
- javascript - 在按钮上单击 Javascript 中“this”上的执行方法或函数
- or-tools - 有容量的车辆路径问题 - Google OR 工具
- android - 覆盖 Chromeos 上的 enter 和 space 键
- cookies - Chrome 阻止 3rd-party cookie 后我应该怎么做?
- javascript - 在 react-chartjs-2 中初始绘制后动画不起作用