对于我们命题形式语言的语义,我们不参考特定的意图解释。此外,我们只对真值感兴趣。我们假设对原子公式的真值的初始赋值,并在此基础上,我们定义更复杂公式的真值。真值的集合是集合
. 对于原子公式集
,赋值是一个函数

. 设
是包含
的公式集,即
,并且恰好是那些可以根据语法定义从
构造的公式。那么,
在
上的扩展,
,给出如下
: 



在下文中,我们将省略索引
来指示赋值
的扩展。请注意,这是将类型为
的公式命名为合取式,将类型为
的公式命名为析取式,将类型为
的公式命名为否定式的正确位置。
以下是通过定义
进行的示例评估:假定给定
和
,那么







令
是一个赋值,而
是一个公式。
被称为
的赋值,如果
对
的每个子公式都有定义。如果
是
的赋值,并且
,我们称
是
的模型,并写成
如果
是
的赋值,并且
,我们写成
.
一个公式
被称为可满足的,当且仅当存在一个模型
,否则
被称为不可满足的。
被称为有效的(或为重言式)当且仅当对
的每一个赋值都是一个模型。我们写作
或者
。
一个公式
是有效的,当且仅当
是不可满足的。
证明:
是一个重言式
当且仅当对
的每一个赋值都是一个模型 
当且仅当对
的每一个赋值(当然,这也是对
的赋值)不是模型 
当且仅当
没有模型
当且仅当
是不可满足的。
如果对于公式
和
的任何赋值
都成立:如果
是
的模型,那么
也是
的模型。我们将这种情况记作
.
以下定理是定义的一个简单推论。
被称为公式
的推论,
当且仅当
是重言式
当且仅当
是不可满足的。
很明显,一个公式的有效性只取决于其原子子公式的赋值:如果
和
是
的赋值,并且它们对每个出现的原子子公式都产生相同的值,那么
成立。因此,我们可以说,为了检验一个公式
的有效性,只需要检验其原子子公式的无限多个赋值。这种检验可以用下表的形式轻松地描述出来,其中
是一个任意的公式,包含
个不同的原子公式
。
|
|
|
|
|
|
|
false |
|
false |
false |
|
|
false |
|
false |
true |
|
|
|
|
|
|
|
|
true |
|
true |
true |
|
在应用此过程时,引入子公式的中间结果可能会有所帮助,如下面的示例所示。
|
|
|
|
( )) |
false |
false |
true |
true |
true |
false |
true |
true |
true |
true |
true |
false |
false |
false |
true |
true |
true |
false |
true |
true |
请注意,我们只是描述了检查公式有效性的算法。假设公式包含
个原子子公式,那么我们刚刚构建的表格将包含
行。为了估计这种指数级算法的成本,假设计算一行需要 1 微秒。如果
仅包含 100 个原子子公式,则计算表格将需要
微秒。
命题公式是否可满足的问题称为 SAT,相应的重言式问题称为 TAUT。
SAT 是一个 NP 完全问题,因此目前尚不清楚 SAT 是否是易处理的。TAUT 是否属于 NP 仍然是一个开放问题。对于 TAUT,我们知道,它属于 NP 当且仅当 NP 在补运算下是封闭的。SAT 和 TAUT 都在复杂性理论研究中发挥着重要作用,特别是在关于
的问题方面。
计算以下公式的真值表。确定每个公式是否有效(重言式)、可满足或不可满足。











“你长寿的秘诀是什么?”有人问一位百岁老人。他回答道:“我严格遵守以下饮食规则:如果我晚餐不喝酒,我就总是吃鱼。每当我晚餐吃鱼和酒,都是不放蒜的。如果我吃蒜或喝酒,我就会避免吃鱼”。
- 用命题逻辑的形式化这些规则。
- 尝试简化这位百岁老人的建议。
通过对命题公式的构造进行归纳,递归地定义以下函数
:
中的原子公式集
:
中的二元连接词
和
的数量
注意:对于
给定公式
=
, 其中
是原子公式(
)其中
表示异或。证明对于所有的
: 一個合适的赋值
对于
是
的模型(即
)当且仅当
对奇数个
成立(
)。
在下面,我们研究只包含原子
的公式。
- 最多有多少个具有不同真值表的公式?
- 对于每一个真值表,是否存在一个对应的公式?如果存在,请给出构造方法!
如果上校在谋杀案发生时不在房间里,那么他就无法知道凶手的武器。管家在撒谎,或者他知道凶手是谁。如果巴恩特里夫人是凶手,那么上校在谋杀案发生时就在房间里,或者管家在撒谎。管家知道凶手是谁,或者上校在谋杀案发生时不在房间里。警察得出结论,巴恩特里夫人是凶手。为论证中的每个语句赋予命题变量。将论证写成一组命题公式,其中包含前提和结论作为命题公式
.
将以下表达式形式化,然后简化相应的公式和口头命题。
- 他的母亲不是英国人,而他的父亲也不是法国人,这是不正确的。
- 他正在学习物理,但没有学习数学,这是不正确的。
- 工资在下降,而价格在上涨,这是不正确的。
- 既不冷也不下雨,这是不正确的。
教授建议为大学餐厅的午餐制定一个新的方案。
- 如果沒有甜點,每顿午餐都必须有面包。
- 如果供应面包和甜點,则不供应汤。
- 如果供应汤,则没有面包。
帮助管理层满足教授的愿望。为此,
- 将三个命题形式化(作为蕴含式、析取式/合取式),并将它们组合成一个逻辑公式。
- 为该逻辑公式提供真值表。该公式是否有模型?
- 为该任务提供一个口语化的表达。