跳转到内容

Advertising:

谓词语言:修订间差异

来自GSXAB的知识库
Gsxab留言 | 贡献
无编辑摘要
 
Gsxab留言 | 贡献
无编辑摘要
第1行: 第1行:
[[分类:谓词逻辑]][[分类:形式语言实例]]
[[分类:谓词逻辑]]
[[分类:形式语言实例]]{{DEFAULTSORT:ming4ti2yu3yan2}}
{{#seo:
|keywords=谓词语言, 一阶语言, 谓词逻辑的形式语言, 形式语言, 谓词逻辑
|description=本文介绍谓词语言的定义、性质与语法规则,包括谓词语言作为谓词逻辑的形式语言的概念,其字母表和公式构造规则,及其在逻辑学中的基础地位。
|modified_time={{REVISIONYEAR}}-{{REVISIONMONTH}}-{{REVISIONDAY2}}
|published_time=2024-04-05
}}
{{非标准称呼}}
{{非标准称呼}}
谓词语言('''predicate language'''),也称'''一阶语言'''('''first-order language'''),也直接称为谓词逻辑的语言(language of predicate logic)或一阶逻辑的语言(language of first-order logic),指研究[[:分类:谓词逻辑|谓词逻辑]]的[[形式语言]],包括[[个体词(谓词逻辑)|个体变项]]、[[函项]]、[[谓词]]、[[逻辑联结词]]和[[量词]],有时也被称为 <math>\mathcal{L}_1</math> 、 <math>\mathcal{L}_P</math> 或 <math>\mathcal{L}^*</math>。
谓词语言('''predicate language'''),也称'''一阶语言'''('''first-order language'''),也直接称为谓词逻辑的语言(language of predicate logic)或一阶逻辑的语言(language of first-order logic),指研究[[:分类:谓词逻辑|谓词逻辑]]的[[形式语言]],包括[[个体词(谓词逻辑)|个体变项]]、[[函项]]、[[谓词]]、[[逻辑联结词]]和[[量词]],有时也被称为 <math>\mathcal{L}_1</math> 、 <math>\mathcal{L}_P</math> 或 <math>\mathcal{L}^*</math>。
第13行: 第20行:
* [[个体词(谓词逻辑)|个体变项]]的集合 <math>V = \{v_0, v_1, \dots \}</math>;
* [[个体词(谓词逻辑)|个体变项]]的集合 <math>V = \{v_0, v_1, \dots \}</math>;
* [[谓词]]的集合 <math>P = P_0 \cup P_1 \cup \dots </math>
* [[谓词]]的集合 <math>P = P_0 \cup P_1 \cup \dots </math>
** 其中每个 <math>P_n, n\in \mathbb{N}</math> 是全体 <math>n</math> 元谓词的集合。
** 其中每个 <math>P_n, n\in \mathbb{N}</math> 是全体 <math>n</math> 元谓词的集合, <math>P_n=\{p_{n1},p_{n2},\cdots\}</math> 。
** 其中 <math>P_2</math> 包含等词 <math>=</math> 。
** 其中 <math>P_2</math> 包含等词 <math>=</math> 。
* [[函项]]的集合 <math>F = F_0 \cup F_1 \cup \dots </math>
* [[函项]]的集合 <math>F = F_0 \cup F_1 \cup \dots </math>
第23行: 第30行:
* 辅助符号的集合,包括左右括号和逗号 <math>{\color{lightgray}\{} ({\color{lightgray},} ) {\color{lightgray},} , {\color{lightgray}\}}</math>。
* 辅助符号的集合,包括左右括号和逗号 <math>{\color{lightgray}\{} ({\color{lightgray},} ) {\color{lightgray},} , {\color{lightgray}\}}</math>。


注:有的定义将零元谓词独立作为[[命题|命题变元]]集合,有的定义将真或假看作命题常量集合,有的定义将真或假看作零元逻辑联结词 <math>C_0</math> 并入 <math>C</math> ,有的定义将零元函项独立作为个体常项集合。
注:不同文献对谓词语言的定义可能有所差异。
* 有些定义中,“个体词”指的是下文的“项”。
* 有些定义中包括个体常项的集合,与个体变项的集合并列。
* 有些定义中区分谓词常项和谓词变项的集合。
* 有些定义将零元谓词独立作为[[命题|命题变元]]集合,与谓词集合并列。
* 有些定义将零元谓词分拆成命题变元和命题常量的集合,与谓词集合并列。
* 有些定义中包括真值常量真和假构成的集合 <math>\{\mathrm{T},\mathrm{F}\}</math> 。
* 有的定义将真或假看作零元逻辑联结词 <math>C_0 = \{\top,\bot\}</math> 并认为 <math>C = C_0 \cup C_1 \cup C_2</math>
* 有些定义将真或假看作命题常量集合。
* 有些定义将零元函项独立作为个体常项集合。
* 有些定义不使用逗号。
* 有些定义中包含非常用联结词。
* 有些定义可能使用不同的符号表示。


=== 规则 ===
=== 规则 ===


<math>\mathcal{L}_1</math> 中的全体项的集合为 <math>T</math> ,其中仅包含以下几类元素:
命题语言 <math>\mathcal{L}_1</math> 中的公式集需要先定义项集 <math>T</math> ,是通过以下规则递归定义的最小集合:
* <math>v</math><math>v\in V</math>
* <math>v</math> ,其中 <math>v\in V</math> ,是递归终止条件,即个体词;
* <math>f(t_1, \dots, t_n)</math><math>f \in F_n, n \in \mathbb{N}, t_1, \dots t_n \in T</math>。
* <math>f(t_1, \dots, t_n)</math> ,其中 <math>f \in F_n, n \in \mathbb{N}, t_1, \dots t_n \in T</math> 。


记 <math>\mathcal{L}_1</math> 的公式集为 <math>W</math> ,其中仅包含以下几类元素:
记 <math>\mathcal{L}_1</math> 的公式集为 <math>\mathrm{Form}(\mathcal{L}_1)</math> ,其中仅包含以下几类元素:
* <math>p(t_1, \dots, t_n)</math><math>p\in P_n, n \in \mathbb{N}, t_1, \dots, t_n \in T</math> ,称为[[原子公式]];
* <math>p(t_1, \dots, t_n)</math> ,其中 <math>p\in P_n, n \in \mathbb{N}, t_1, \dots, t_n \in T</math> ,是递归终止条件,称为 <math>\mathcal{L}_1</math>-[[原子公式]];
* <math>\lnot\phi</math> <math>\phi \in W</math>;
* <math>\lnot\phi</math> ,其中 <math>\phi \in \mathrm{Form}(\mathcal{L}_1)</math> ;
* <math>(\phi\odot\psi)</math> <math>\phi,\psi \in W, \odot \in C_2</math>;
* <math>(\phi\odot\psi)</math> ,其中 <math>\phi,\psi \in \mathrm{Form}(\mathcal{L}_1), \odot \in C_2</math> ;
* <math>\mathsf{Q} v \phi</math> <math>\mathsf{Q} \in Q, \phi \in W, v \in V</math>。
* <math>\mathsf{Q} v \phi</math> ,其中 <math>\mathsf{Q} \in Q, \phi \in \mathrm{Form}(\mathcal{L}_1), v \in V</math> 。
且:
 
注:最后一条有些文献中也用 <math>\mathsf{Q} v, \phi</math> ,所以上面的辅助符号中也有逗号。
 
=== 括号省略约定 ===
 
为简化书写,采用以下括号省略规则:
* 最外层的括号可省略;
* 最外层的括号可省略;
* 可以按照 <math>\forall \exists \lnot, \land, \lor, \rightarrow, \leftrightarrow</math> 的结合顺序省略括号。
* 结合性(优先级)从高到低顺序为 <math>\lnot, \mathsf{Q} v, \land, \lor, \rightarrow, \leftrightarrow</math> ,可按照这一顺序省略括号。(<math>\land,\lor</math> 之间推荐不省略)
* 多个一元运算符 <math>\lnot, \mathsf{Q}v</math> 连续出现时,不会出现歧义,因此可以省略之间的括号。
* 相同符号的二元联结词按照 <math>\land,\lor</math> 为左结合, <math>\rightarrow</math> 为右结合的形式省略括号。 <math>\leftrightarrow</math> 不规定结合性,不允许省略括号。
 
注:有些定义中不规定 <math>\rightarrow</math> 为右结合,必须使用括号明确结合性。且为了可读性, <math>\rightarrow</math> 的括号也往往不省略。


==== BNF 定义 ====
==== BNF 定义 ====
谓词语言是一种[[上下文无关语言]],可以通过 [[BNF]] 定义。


<syntaxhighlight lang="bnf">
<syntaxhighlight lang="bnf">
第47行: 第77行:
             | "(" <formula> <op> <formula> ")"
             | "(" <formula> <op> <formula> ")"
             | <quantifier> <individual> <formula>
             | <quantifier> <individual> <formula>
<op> ::= "∧" | "∨" | "→" | "↔"
<op>         ::= "∧" | "∨" | "→" | "↔"
<quantifier> ::= "∀" | "∃"
<quantifier> ::= "∀" | "∃"
<terms> ::= <terms> "," <term>
<terms>     ::= <terms> "," <term>
<term> ::= <individual> | <function> "(" <terms> ")"
<term>       ::= <individual> | <function> "(" <terms> ")"
 
<predicate>  ::= "p" | "p₀" | "p₁" | "p₂" | ...
<function>  ::= "f" | "f₀" | "v₁" | "v₂" | ...
<individual> ::= "v" | "v₀" | "v₁" | "v₂" | ...
</syntaxhighlight>
</syntaxhighlight>
其中 <syntaxhighlight inline lang="bnf"><individual>,<predicate>,<function></syntaxhighlight> 三个终结符分别是个体变元、谓词、函项 <math>v \in V, p \in P, f \in F</math> ,并限制谓词和函项的元数和后续 <syntaxhighlight inline lang="bnf"><terms></syntaxhighlight> 的元数相同。
其中 <syntaxhighlight inline lang="bnf"><individual>,<predicate>,<function></syntaxhighlight> 三个终结符分别是个体变元、谓词、函项 <math>v \in V, p \in P, f \in F</math> ,并限制谓词和函项的元数和后续 <syntaxhighlight inline lang="bnf"><terms></syntaxhighlight> 的元数相同。
且也按上述方式省略括号。
 
== 相关术语 ==
 
* 主逻辑运算符:递归定义中,若一个公式不是原子公式,则形式上最后使用的逻辑运算符,即联结词或量词,称为这一公式的主逻辑运算符。即 <math>\lnot\varphi</math> 中的 <math>\lnot</math> 、 <math>\mathsf{Q}v \varphi</math> 中的 <math>\mathsf{Q} \in Q</math> 以及 <math>\varphi\odot\psi</math> 中的 <math>\odot\in C_2</math> 。也有的定义中因为认为量化表达式不是逻辑联结词,使用其他说法。
* 直接子公式(direct subformula):递归定义中,若一个公式不是原子公式,则直接递归的公式称为这一公式的直接子公式。即 <math>\lnot\varphi</math> 中的 <math>\varphi</math> 以及 <math>\varphi\odot\psi</math> 中的 <math>\varphi</math> 和 <math>\psi</math> 。
* 子公式(subformula):对一个公式,进行递归定义。若其是原子公式,只有其本身是其子公式;若其是非原子公式,其本身及其直接子公式的任意子公式,均是其子公式。
* 真子公式(proper subformula):对一个公式,不是其自身的子公式。
 
== 性质 ==
 
* 递归可枚举性:命题语言的公式集是递归可枚举的。
* 唯一可读性:每个合式公式都有唯一的语法分析树。
 
== 语法与语义 ==
 
以上是谓词语言的语法,仅在符号串角度定义了符合语法约定的谓词语言符号串,没有涉及其中符号的语义。这些符号串的语义需要通过[[解释(谓词逻辑)|解释/模型]]、[[赋值(谓词逻辑)|赋值]]等条目定义,最终用于[[逻辑蕴涵]]等场景。见对应条目。
 
== 变体 ==
 
* 逻辑联结词部分仅使用某个[[函数完备性(逻辑联结词)|函数完备集]]、量词仅选择其中的一个。
* 引入命题常量或真值常量。
 
 
{{谓词逻辑}}

2025年12月20日 (六) 07:05的版本

请注意,这个条目所介绍的术语没有标准称呼。仅仅是为了便于描述建立条目取了一个名字。

谓词语言(predicate language),也称一阶语言(first-order language),也直接称为谓词逻辑的语言(language of predicate logic)或一阶逻辑的语言(language of first-order logic),指研究谓词逻辑形式语言,包括个体变项函项谓词逻辑联结词量词,有时也被称为 [math]\displaystyle{ \mathcal{L}_1 }[/math][math]\displaystyle{ \mathcal{L}_P }[/math][math]\displaystyle{ \mathcal{L}^* }[/math]

谓词语言是对谓词逻辑进行的形式语言理论的分析,对应的句子或公式就是谓词公式

形式语言定义

定义形式语言 [math]\displaystyle{ \mathcal{L}_1 }[/math] 的字母表和规则如下:

字母表

[math]\displaystyle{ \mathcal{L}_1 }[/math] 的字母表是以下集合的并集:

  • 个体变项的集合 [math]\displaystyle{ V = \{v_0, v_1, \dots \} }[/math]
  • 谓词的集合 [math]\displaystyle{ P = P_0 \cup P_1 \cup \dots }[/math]
    • 其中每个 [math]\displaystyle{ P_n, n\in \mathbb{N} }[/math] 是全体 [math]\displaystyle{ n }[/math] 元谓词的集合, [math]\displaystyle{ P_n=\{p_{n1},p_{n2},\cdots\} }[/math]
    • 其中 [math]\displaystyle{ P_2 }[/math] 包含等词 [math]\displaystyle{ = }[/math]
  • 函项的集合 [math]\displaystyle{ F = F_0 \cup F_1 \cup \dots }[/math]
    • 其中每个 [math]\displaystyle{ F_n, n\in \mathbb{N} }[/math] 是全体 [math]\displaystyle{ n }[/math] 元函项的集合。
  • 逻辑联结词的集合 [math]\displaystyle{ C = C_1 \cup C_2 }[/math]
    • 一元逻辑联结词的集合 [math]\displaystyle{ C_1 = \{\lnot\} }[/math]
    • 二元逻辑联结词的集合 [math]\displaystyle{ C_2 = \{\land, \lor, \rightarrow, \leftrightarrow\} }[/math]
  • 量词的集合 [math]\displaystyle{ Q = \{ \forall, \exists \} }[/math]
  • 辅助符号的集合,包括左右括号和逗号 [math]\displaystyle{ {\color{lightgray}\{} ({\color{lightgray},} ) {\color{lightgray},} , {\color{lightgray}\}} }[/math]

注:不同文献对谓词语言的定义可能有所差异。

  • 有些定义中,“个体词”指的是下文的“项”。
  • 有些定义中包括个体常项的集合,与个体变项的集合并列。
  • 有些定义中区分谓词常项和谓词变项的集合。
  • 有些定义将零元谓词独立作为命题变元集合,与谓词集合并列。
  • 有些定义将零元谓词分拆成命题变元和命题常量的集合,与谓词集合并列。
  • 有些定义中包括真值常量真和假构成的集合 [math]\displaystyle{ \{\mathrm{T},\mathrm{F}\} }[/math]
  • 有的定义将真或假看作零元逻辑联结词 [math]\displaystyle{ C_0 = \{\top,\bot\} }[/math] 并认为 [math]\displaystyle{ C = C_0 \cup C_1 \cup C_2 }[/math]
  • 有些定义将真或假看作命题常量集合。
  • 有些定义将零元函项独立作为个体常项集合。
  • 有些定义不使用逗号。
  • 有些定义中包含非常用联结词。
  • 有些定义可能使用不同的符号表示。

规则

命题语言 [math]\displaystyle{ \mathcal{L}_1 }[/math] 中的公式集需要先定义项集 [math]\displaystyle{ T }[/math] ,是通过以下规则递归定义的最小集合:

  • [math]\displaystyle{ v }[/math] ,其中 [math]\displaystyle{ v\in V }[/math] ,是递归终止条件,即个体词;
  • [math]\displaystyle{ f(t_1, \dots, t_n) }[/math] ,其中 [math]\displaystyle{ f \in F_n, n \in \mathbb{N}, t_1, \dots t_n \in T }[/math]

[math]\displaystyle{ \mathcal{L}_1 }[/math] 的公式集为 [math]\displaystyle{ \mathrm{Form}(\mathcal{L}_1) }[/math] ,其中仅包含以下几类元素:

  • [math]\displaystyle{ p(t_1, \dots, t_n) }[/math] ,其中 [math]\displaystyle{ p\in P_n, n \in \mathbb{N}, t_1, \dots, t_n \in T }[/math] ,是递归终止条件,称为 [math]\displaystyle{ \mathcal{L}_1 }[/math]-原子公式
  • [math]\displaystyle{ \lnot\phi }[/math] ,其中 [math]\displaystyle{ \phi \in \mathrm{Form}(\mathcal{L}_1) }[/math]
  • [math]\displaystyle{ (\phi\odot\psi) }[/math] ,其中 [math]\displaystyle{ \phi,\psi \in \mathrm{Form}(\mathcal{L}_1), \odot \in C_2 }[/math]
  • [math]\displaystyle{ \mathsf{Q} v \phi }[/math] ,其中 [math]\displaystyle{ \mathsf{Q} \in Q, \phi \in \mathrm{Form}(\mathcal{L}_1), v \in V }[/math]

注:最后一条有些文献中也用 [math]\displaystyle{ \mathsf{Q} v, \phi }[/math] ,所以上面的辅助符号中也有逗号。

括号省略约定

为简化书写,采用以下括号省略规则:

  • 最外层的括号可省略;
  • 结合性(优先级)从高到低顺序为 [math]\displaystyle{ \lnot, \mathsf{Q} v, \land, \lor, \rightarrow, \leftrightarrow }[/math] ,可按照这一顺序省略括号。([math]\displaystyle{ \land,\lor }[/math] 之间推荐不省略)
  • 多个一元运算符 [math]\displaystyle{ \lnot, \mathsf{Q}v }[/math] 连续出现时,不会出现歧义,因此可以省略之间的括号。
  • 相同符号的二元联结词按照 [math]\displaystyle{ \land,\lor }[/math] 为左结合, [math]\displaystyle{ \rightarrow }[/math] 为右结合的形式省略括号。 [math]\displaystyle{ \leftrightarrow }[/math] 不规定结合性,不允许省略括号。

注:有些定义中不规定 [math]\displaystyle{ \rightarrow }[/math] 为右结合,必须使用括号明确结合性。且为了可读性, [math]\displaystyle{ \rightarrow }[/math] 的括号也往往不省略。

BNF 定义

谓词语言是一种上下文无关语言,可以通过 BNF 定义。

<formula> ::= <predicate> ( <terms> )
            | "¬" <formula>
            | "(" <formula> <op> <formula> ")"
            | <quantifier> <individual> <formula>
<op>         ::= "∧" | "∨" | "→" | "↔"
<quantifier> ::= "∀" | "∃"
<terms>      ::= <terms> "," <term>
<term>       ::= <individual> | <function> "(" <terms> ")"

<predicate>  ::= "p" | "p₀" | "p₁" | "p₂" | ...
<function>   ::= "f" | "f₀" | "v₁" | "v₂" | ...
<individual> ::= "v" | "v₀" | "v₁" | "v₂" | ...

其中 <individual>,<predicate>,<function> 三个终结符分别是个体变元、谓词、函项 [math]\displaystyle{ v \in V, p \in P, f \in F }[/math] ,并限制谓词和函项的元数和后续 <terms> 的元数相同。

相关术语

  • 主逻辑运算符:递归定义中,若一个公式不是原子公式,则形式上最后使用的逻辑运算符,即联结词或量词,称为这一公式的主逻辑运算符。即 [math]\displaystyle{ \lnot\varphi }[/math] 中的 [math]\displaystyle{ \lnot }[/math][math]\displaystyle{ \mathsf{Q}v \varphi }[/math] 中的 [math]\displaystyle{ \mathsf{Q} \in Q }[/math] 以及 [math]\displaystyle{ \varphi\odot\psi }[/math] 中的 [math]\displaystyle{ \odot\in C_2 }[/math] 。也有的定义中因为认为量化表达式不是逻辑联结词,使用其他说法。
  • 直接子公式(direct subformula):递归定义中,若一个公式不是原子公式,则直接递归的公式称为这一公式的直接子公式。即 [math]\displaystyle{ \lnot\varphi }[/math] 中的 [math]\displaystyle{ \varphi }[/math] 以及 [math]\displaystyle{ \varphi\odot\psi }[/math] 中的 [math]\displaystyle{ \varphi }[/math][math]\displaystyle{ \psi }[/math]
  • 子公式(subformula):对一个公式,进行递归定义。若其是原子公式,只有其本身是其子公式;若其是非原子公式,其本身及其直接子公式的任意子公式,均是其子公式。
  • 真子公式(proper subformula):对一个公式,不是其自身的子公式。

性质

  • 递归可枚举性:命题语言的公式集是递归可枚举的。
  • 唯一可读性:每个合式公式都有唯一的语法分析树。

语法与语义

以上是谓词语言的语法,仅在符号串角度定义了符合语法约定的谓词语言符号串,没有涉及其中符号的语义。这些符号串的语义需要通过解释/模型赋值等条目定义,最终用于逻辑蕴涵等场景。见对应条目。

变体

  • 逻辑联结词部分仅使用某个函数完备集、量词仅选择其中的一个。
  • 引入命题常量或真值常量。


谓词逻辑/一阶逻辑
命题结构 个体词(个体常项、个体变项)、论域/个体域函项项、闭项
谓词 谓词(谓词常项、谓词变项)
量词 量词(辖域、出现)全称量词 [math]\displaystyle{ \forall }[/math]存在量词 [math]\displaystyle{ \exists }[/math]
谓词公式 形式定义 谓词语言 [math]\displaystyle{ \mathcal{L}^* }[/math]谓词公式闭式
逻辑语义 结构指派/赋值基本语义定义解释满足模型
语义分类 普遍有效公式、可满足式、不可满足式
语义关系 逻辑等值/逻辑等价 [math]\displaystyle{ = }[/math]/[math]\displaystyle{ \Leftrightarrow }[/math]逻辑蕴涵 [math]\displaystyle{ \Rightarrow }[/math]
范式 前束范式Skolem 范式
个体变项代入 可自由代入易字简单易字变形、易字变形
命题变元代入 置换定理

Advertising: