在命题逻辑中,我们考虑了关于原子对象的公式,这些对象只能是真或假。一阶逻辑是本章的主题,它建立在命题逻辑的基础上,并允许您查看公式中讨论的对象内部。我们可以通过将对象讨论为大于集合
的集合的元素,并包括任意复杂的相互关系来提供这种更精细的粒度级别。
我们首先通过定义一阶 (FO) 逻辑的语法开始,然后赋予这些结构意义。
一阶逻辑的讨论域是一阶结构或模型。一个一阶结构包含
- 关系,
- 函数,以及
- 常量(元数为 0 的函数)。
一阶逻辑的词汇是
- 一组具有关联元数的关系符号,以及
- 一组具有关联元数的函数符号。
以下是一些示例一阶逻辑词汇
- 图
- 关系集 = {
: 一元,
: 二元 }
- 函数集 = {
: 一元 }
- 算术
- 关系集 = {
: 三元,
: 三元,
: 三元,
: 二元,
: 二元 }
- 函数集 = {
: 一元,
: 常量 }
这里,图是由一组顶点
和一组边
组成。对于算术集,请注意使用
和
纯粹是语法上的,我们本可以使用“加”和“乘”符号来代替。我们还没有给这些符号赋予任何意义。
项表示一阶结构中的一个元素。项用于指代我们讨论域中的元素。以下是描述项是什么的规则
- 每个变量都是一个项,其中变量只是一个符号集合
- 每个常数都是一个项
- 如果
是项,且
是
元函数,那么
是一个项。
例如,如果
是一个二元函数,而
是一个三元函数,那么以下都是项:
.
原子公式是
,
其中
是
元关系,而
是项。当将
视为一个集合时,这只是另一种说法,即元组
.
一个特殊的“
”关系表示“等于”,不能被解释为其他含义。例如,
代表
.
一阶公式是由给定的 一阶词汇表、变量和符号
构成的表达式。 一阶公式的集合是满足以下条件的最小集合。
- 原子公式是一阶公式
- 如果
和
是公式,
是一个变量,则以下也是公式






给定词汇表上的一个一阶结构包含以下内容:
- 一个域,它是一组元素(也称为宇宙)
- 一个映射,它将词汇表中的每个
元关系符号与域上的
元关系相关联,并将每个
元函数符号与域上的
元函数相关联。
这些组件赋予符号意义。
例子
- 关系集 = {
: 三元,
: 三元,
: 三元,
: 二元,
: 二元 }
- 函数集 = {
: 一元,
: 常数 }
在这个词汇表上的一个一阶结构是
- 域:整数集
- 映射 :
加法,
乘法,
幂运算,
排序, 
在这个结构中,公式
![{\displaystyle \exists x\forall y\forall z[\times (y,z,x)\rightarrow ((y=1)\vee (z=1))]}](https://wikimedia.org/api/rest_v1/media/math/render/svg/377ac8513552e4a7fbf47f6b19d20d8e80132996)
表达了“存在质数”的命题(数字1也满足该命题)。
这里要注意
等价于
.
在公式
或
中,
被称为变量
的量化作用域。公式中变量的出现,如果在该变量的量化作用域内,则称该出现是约束的,否则称该出现是自由的。您可以将量词的用法视为变量声明。
句子是一个没有自由变量的公式(即所有变量都是约束的)。句子要么为真要么为假。
包含自由变量的公式可以被认为是描述自由变量的属性。例如,
表示一个包含
自由变量的公式,并描述了
的属性。
如果一个句子
在结构
上评估为真,我们说
满足
,并将其记为
。
当且仅当
,其中
是
在
中的解释。
当且仅当
且
。(对于
类似)。
当且仅当
。
如果
对于某些
在域中。
如果
对于每个
在域中。
注意:
表示用
替换
在
中的所有自由出现的结果。替换将在本章后面进一步讨论。
公理是一组句子,旨在区分“期望”模型与其他模型。但通常,也存在“非期望”模型,称为非标准模型。
例如: 考虑词汇表
,其中符号具有通常的含义(由关于此词汇表的 FO 句子定义)。这组公理的标准解释(见本章末尾)是整数,但模
的整数集也满足这些公理。通过将以下句子添加到公理中,可以排除这种可能性: 
问题: 所有非标准模型都可以通过公理化排除吗? 答案是否定的。考虑 [TODO: 导入图形] 中所示的模型,该模型的词汇表仅包含
(上行中的所有元素都大于下行中的元素)。
没有一组一阶句子可以区分此模型与自然数。直观地,原因是,我们无法在一阶句子中任意“回溯”(向
)。对于上面的完整词汇表,也可以获得类似的非标准模型。
给定一阶结构
和 FO 句子
,我们能否判断
?
对于有限结构,这个问题是可判定的。例如,假设
是一个表示图边界的二元关系,而给定句子是
.
我们可以通过尝试
和
的所有可能值来评估这个句子的真值。(朴素评估:“嵌套循环”。)这在域大小上是多项式时间,但在公式大小上是指数时间。
在无限域上,我们可能能够评估句子的真值,也可能不能。在词汇
中,其中
是自然数集,如果句子为真,则它是可判定的。(这被称为普雷斯伯格算术。)但是,如果我们包含乘法,则句子的真值将变得不可判定。
FO 句子的集合
是
- 可满足的,如果存在某个结构
使得 
- 不可满足的,如果它不可满足
- 有效的,如果对所有结构
,都有 
给定一组 FO 句子
和一个句子 
蕴涵
(记为
),如果每个满足
的结构也满足
。
当且仅当
是不可满足的。
- 如果
是有限的,那么,
当且仅当
是有效的。
- 如果公式
有自由变量
,
是有效的,当且仅当
是有效的。
有效性公理分为三类:
- 布尔有效性公理。这些公理从命题逻辑中继承而来。
- 等式公理。
- 量化公理。
给定一个一阶逻辑公式
,
的布尔形式是一个命题公式
,使得
是通过将
中的每个命题变量替换为
的子公式得到的。
的布尔形式集合用
表示。
例子
- 对于一阶逻辑公式
,布尔形式为
。
- 如果
,那么
,其中
。
断言: 如果
并且
是有效的,那么
是有效的。
令
是项。以下是一阶逻辑的有效公式。

, 其中
是一个
元函数。
, 其中
是一个
元关系。
给定一个公式
,其中变量
出现自由(表示为
)和一个项
,我们定义将
代入
的
,记为
,为将
中每个
的自由出现用
代替得到的结果公式,但必须满足约束条件:
不包含任何在
中被量化的变量
,使得
出现在
量化范围内的自由位置。如果
不在
中自由出现,那么
被定义为
。
例如:设
为
,
那么
是一个有效的替换
不是一个有效的替换。
,其中
是一个项,
是一个有效的替换



总之,有效性的公理是 
- 布尔有效性公理。这些公理从命题逻辑中继承而来。
- 等式公理。
- 量化公理。
定义:一个证明是一个序列
的 FO 语句,使得对于每个
或者
或者
使得
以及
.
符号: 如果存在使用
的
的证明,我们用
来表示这个事实。
事实 (可靠性): 如果
,那么
是有效的。
备注: 可以证明有效的公式集是递归可枚举的。
示例: 公式
的证明









的证明是 对称的。



例如
"x 是偶数" 以及
"x 是奇数"




断言:每个 FO 语句都等价于一个形如
的 FO 语句,其中
且
是无量词的。
这是通过使用量词的分配律证明的。可能需要重命名变量,以避免歧义。虽然你总是可以将所有量词移动到左侧,但所得公式的大小实际上可能比原始公式大很多倍。
例子:







- 使用一个(可能是无限的,但递归的)公理集
(一阶句子)尽可能详细地描述所需模型。
- 使用演绎证明事物。
符号: 我们说
是
的有效推论(记为
),如果每个满足
的模型也满足
。
事实:
当且仅当
不可满足。
以下十四个一阶公理描述了算术和数字的性质,即加法 (
),乘法 (
),幂运算 (
,相等 (
),排序 (
),后继函数 (
) 和余数 (mod)。这个例子展示了一阶语句的表达能力,最初人们希望它能为“唯一真正的数学”提供基础。
问题: 为什么它们被称为“非逻辑”公理?
- NT1:

- NT2:

- NT3:

- NT4:

- NT5:

- NT6:

- NT7:

- NT8:

- NT9:

- NT10:

- NT11:

- NT12:

- NT13:

- NT14:
