Skip to content

Commit 4e88937

Browse files
committed
post: logic-1
1 parent f466cd5 commit 4e88937

File tree

1 file changed

+140
-0
lines changed

1 file changed

+140
-0
lines changed

content/posts/logic_1.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
+++
2+
title = "【逻辑学】简单的形式语言及可靠性、完全性证明"
3+
date = 2026-03-10
4+
5+
[extra]
6+
math = true
7+
8+
[extra.sitemap]
9+
priority = "0.8"
10+
11+
[taxonomies]
12+
categories = ["知识"]
13+
tags = ["笔记", "数学", "类型论"]
14+
+++
15+
16+
选了哲学系开的Ⅲ类通识课“逻辑导论”。此文主要是做习题(之后大概也会如此),因此先快速掠过定义:
17+
18+
<!-- more -->
19+
20+
---
21+
22+
**形式语言** `formal language` 是指符合特定要求的符号串。令非空符号集 $S$, 考虑形式语言 $L_{\text{all}}^S$ 由所有形如 All $X$ are $Y$ 的公式组成。
23+
24+
一个**形式系统** `formal system` 由若干**推理规则**组成,其中没有前提的称为**公理**。考虑形式系统 $\mathrm{Sys}_{\text{all}}^S$ 包含:
25+
26+
推理规则 $\mathrm{Trans}$:
27+
28+
$$\frac{\text{All } X \text{ are } Y \quad \text{All } Y \text{ are } Z}{\text{All } X \text{ are } Z} \mathrm{Trans}$$
29+
30+
公理模式 $\mathrm{Id}$:
31+
32+
$$\frac{}{\text{All } X \text{ are } X} \mathrm{Id}$$
33+
34+
对一个前提集 $\Gamma$ (可能会长成 $\\{\text{All } A \text{ are } B\\, \text{All } B \text{ are } C\\}$),以 $\varphi$ 结尾的**推演** `deduction` 是指一个有穷公式序列:
35+
36+
$$\varphi_1, \cdots, \varphi_n = \varphi$$
37+
38+
其中每个 $\varphi_i$ 是公理或者属于 $\Gamma$ 或者可以由已有公式通过某规则得到。
39+
40+
此时记作 $\Gamma \vdash_{\mathrm{Sys}} \varphi$. 这样称 $\varphi$ 是 $\Gamma$ 的**语形后承** `syntactic consequence`. 前提集为空时简记为 $\vdash_{\mathrm{Sys}} \varphi$, 此时称推演为**证明**,证明出的公式叫内定理。
41+
42+
---
43+
44+
一个 $L_{\text{all}}^S$ 的**模型** $\mathcal{M}$ 是 $\langle O, I \rangle$, 其中 $O$ 称为对象域是非空集合,$I: S \to \mathcal{P}(O)$ 是解释函数,满足:
45+
46+
$$\mathcal{M} \models \text{All } X \text{ are } Y \iff I(X) \subseteq I(Y)$$
47+
48+
如果 $\mathcal{M} \models \varphi$ 则称 $\varphi$ 在 $\mathcal{M}$ 上真,或 $\mathcal{M}$ 满足 $\varphi$. 此处我们默认公式非真即假,定义符号 $\mathcal{M} \nvDash \varphi$.
49+
50+
如果对任意模型 $\mathcal{M}$ 只要 $M \models \Gamma$ 就有 $M \models \varphi$ 则称 $\varphi$ 是 $\Gamma$ 的**语义后承**,记作 $\Gamma \models \varphi$. 前提集为空时简记为 $\models \varphi$, 此时称 $\varphi$ 是有效的 `valid`.
51+
52+
---
53+
54+
现在证明 $\mathrm{Sys} _{\text{all}}^S$ 相对于 $L _{\text{all}}^S$ 的两个元性质(称为元定理 `metatheorem`):
55+
56+
{% admonition(type="theorem", title="可靠性 soundness") %}
57+
对任意 $\Gamma, \varphi$ 有:
58+
59+
$$\Gamma \vdash \varphi \implies \Gamma \models \varphi$$
60+
{% end %}
61+
62+
回忆推演定义为 $\varphi_1, \cdots, \varphi_n = \varphi$, 对 $i$ 归纳证 $\varphi \models \varphi_i$ 即可。
63+
64+
{% admonition(type="theorem", title="完全性 completeness") %}
65+
对任意 $\Gamma, \varphi$ 有:
66+
67+
$$\Gamma \models \varphi \implies \Gamma \vdash \varphi$$
68+
{% end %}
69+
70+
考虑证其逆否 $\Gamma \nvdash \varphi \implies \Gamma \nvDash \varphi$. 为此构造一个典范模型 `canonical model` $\mathcal{M}^\Gamma$ 为:
71+
- $O = S$
72+
- $I(X) = \\{Y \in S | \Gamma \vdash \text{All } Y \text{ are } X\\}$
73+
74+
现在可以证明:
75+
76+
$$\mathcal{M}^\Gamma \models \text{All } A \text{ are } B \iff \Gamma \vdash \text{All } A \text{ are } B$$
77+
78+
其中 $\Rightarrow$ 是通过 $\mathrm{Id}$ 证明,$\Leftarrow$ 是通过 $\mathrm{Trans}$ 证明。
79+
80+
从而 $\Gamma \nvdash \varphi$ 时 $\mathcal{M}^\Gamma$ 是一个见证 $\Gamma \nvDash \varphi$ 的反模型。
81+
82+
---
83+
84+
考虑推理规则:
85+
86+
$$\frac{\text{Some } X \text{ is } Y}{\text{Some } Y \text{ is } X} \mathrm{Symm}$$
87+
88+
$$\frac{\text{Some } X \text{ is } Y}{\text{Some } X \text{ is } X} \mathrm{Ex}$$
89+
90+
其语义为:
91+
92+
$$\mathcal{M} \models \text{Some } X \text{ is } Y \iff I(X) \cap I(Y) \neq \emptyset$$
93+
94+
{% admonition(type="question", title="习题") %}
95+
在 $\mathrm{Sys}_{\text{some}}^S$ 中分别用树形和线性推演证明 Some $X$ is $Y$ 可以推出 Some $Y$ is $Y$.
96+
{% end %}
97+
98+
主要是记住格式:
99+
100+
$$
101+
\frac{
102+
\frac{\text{Some } X \text{ is } Y}{\text{Some } Y \text{ is } X} \mathrm{Symm}
103+
}{\text{Some } Y \text{ is } Y} \mathrm{Ex}
104+
$$
105+
106+
$$
107+
\begin{align*}
108+
& \text{1. Some } X \text{ is } Y \quad (\Gamma) \\\\
109+
& \text{2. Some } Y \text{ is } X \quad (\mathrm{Symm}, 1) \\\\
110+
& \text{3. Some } Y \text{ is } Y \quad (\mathrm{Ex}, 2)
111+
\end{align*}
112+
$$
113+
114+
{% admonition(type="question", title="习题") %}
115+
证明 $\mathrm{Sys}_{\text{some}}^S$ 相对于给定的语义可靠,即两个推理规则保真。
116+
{% end %}
117+
118+
略。
119+
120+
{% admonition(type="question", title="习题") %}
121+
证明 $\mathrm{Sys}_{\text{some}}^S$ 完全。
122+
{% end %}
123+
124+
回顾在构造 $\mathrm{Sys}_{\text{all}}^S$ 的典范模型时是看成有向图,模型是考虑前驱集。
125+
126+
考虑把 $\mathrm{Sys}_{\text{some}}^S$ 看成无向图,模型是考虑连的边。典范模型 $\mathcal{M}^\Gamma$ 为:
127+
- $O = \\{\\{A, B\\} \in \mathcal{P}(S) | \Gamma \vdash \text{Some } A \text{ is } B\\}$
128+
- $I(X) = \\{\\{A, B\\} \in O | (X = A) \vee (X = B)\\}$
129+
130+
{% admonition(type="question", title="习题") %}
131+
尝试为语言 $L_{\text{all, some}}^S$ 设计一个可靠的形式系统,然后思考:你设计的系统是否完全?如果暂时证明不出来,请至少说明你认为困难在哪里。
132+
{% end %}
133+
134+
在各自规则基础上加入:
135+
136+
$$\frac{\text{Some } X \text{ is } Y \quad \text{All } Y \text{ are } Z}{\text{Some } X \text{ is } Z} \mathrm{Unnamed}$$
137+
138+
其完全性确实不容易证(甚至并且很不直观,我看着它都无法保证提供了足够的规则),先空着。
139+
140+
{{ todo() }}

0 commit comments

Comments
 (0)