mirror of
https://github.com/handsomezhuzhu/handsomezhuzhu.github.io.git
synced 2026-02-20 20:00:14 +00:00
141 lines
7.3 KiB
Markdown
141 lines
7.3 KiB
Markdown
# 第一章:数理逻辑
|
||
|
||
## 1.1 命题逻辑
|
||
|
||
### 1.1.1 核心概念深度解析
|
||
- **命题**:必须是**陈述句**且具有**唯一真值**。
|
||
- *易错点*:悖论(如"我正在说谎")不是命题;含有未定变量的句子(如"$x+1=2$")是谓词而非命题。
|
||
- **原子命题与复合命题**:
|
||
- 原子命题:不能再分解的命题。
|
||
- 复合命题:通过联结词组合而成。
|
||
|
||
### 1.1.2 联结词与真值表 (详细版)
|
||
| 联结词 | 符号 | 英文 | 优先级 | 逻辑详解 | 常见语言表达 |
|
||
| :--- | :---: | :--- | :---: | :--- | :--- |
|
||
| **否定** | $\neg$ | NOT | 1 | 真变假,假变真 | "并不是..." |
|
||
| **合取** | $\land$ | AND | 2 | **仅当两者全真时为真** | "且", "虽然...但是...", "既...又..." |
|
||
| **析取** | $\lor$ | OR | 3 | **仅当两者全假时为假** | "或" (包含性或) |
|
||
| **蕴涵** | $\to$ | IMPLIES | 4 | **前真后假时为假,其余全真** | "若...则...", "只要...就...", "只有...才..." |
|
||
| **双蕴涵** | $\leftrightarrow$ | IFF | 5 | **同真同假时为真** | "当且仅当", "充分必要条件" |
|
||
|
||
#### 重点难点:蕴涵关系 ($P \to Q$) 的翻译
|
||
- **充分条件**:"只要 $P$ 就 $Q$" $\Rightarrow P \to Q$
|
||
- **必要条件**:"只有 $Q$ 才 $P$" $\Rightarrow P \to Q$ (注意:$P$ 是 $Q$ 的充分条件,或者理解为 $\neg Q \to \neg P$)
|
||
- **除非**:"除非 $P$ 否则 $Q$" $\Rightarrow \neg P \to Q$ (即 $P \lor Q$)
|
||
|
||
### 1.1.3 命题公式的分类 (Classifications)
|
||
*常考题型:判断给定公式属于哪一类。*
|
||
1. **永真式 (重言式, Tautology)**:
|
||
- 在所有真值赋值下,结果均为**真** ($1$)。
|
||
- *例*:$P \lor \neg P$
|
||
2. **矛盾式 (永假式, Contradiction)**:
|
||
- 在所有真值赋值下,结果均为**假** ($0$)。
|
||
- *例*:$P \land \neg P$
|
||
3. **可满足式 (Contingency)**:
|
||
- **不是矛盾式**的公式(即至少有一种赋值为真)。
|
||
- *注意*:永真式也是可满足式的一种,但通常指"既非永真也非永假"的公式。
|
||
|
||
### 1.1.4 逻辑等值式 (Laws of Logic)
|
||
*核心:用于化简命题公式。*
|
||
|
||
1. **双重否定律**:$\neg\neg P \Leftrightarrow P$
|
||
2. **幂等律**:$P \lor P \Leftrightarrow P$, $P \land P \Leftrightarrow P$
|
||
3. **交换律**:$P \lor Q \Leftrightarrow Q \lor P$, $P \land Q \Leftrightarrow Q \land P$
|
||
4. **结合律**:$(P \lor Q) \lor R \Leftrightarrow P \lor (Q \lor R)$
|
||
5. **分配律** (非常重要):
|
||
- $P \lor (Q \land R) \Leftrightarrow (P \lor Q) \land (P \lor R)$ (析取对合取的分配)
|
||
- $P \land (Q \lor R) \Leftrightarrow (P \land Q) \lor (P \land R)$ (合取对析取的分配)
|
||
6. **德·摩根律 (De Morgan's Laws)** (变号变词):
|
||
- $\neg(P \lor Q) \Leftrightarrow \neg P \land \neg Q$
|
||
- $\neg(P \land Q) \Leftrightarrow \neg P \lor \neg Q$
|
||
7. **吸收律** (合并同类项):
|
||
- $P \lor (P \land Q) \Leftrightarrow P$
|
||
- $P \land (P \lor Q) \Leftrightarrow P$
|
||
8. **蕴含等值式**:$P \to Q \Leftrightarrow \neg P \lor Q$ (去箭头核心公式)
|
||
9. **等价等值式**:$P \leftrightarrow Q \Leftrightarrow (P \to Q) \land (Q \to P)$
|
||
10. **假言易位** (逆否命题):$P \to Q \Leftrightarrow \neg Q \to \neg P$
|
||
11. **归谬律**:$(P \to Q) \land (P \to \neg Q) \Leftrightarrow \neg P$
|
||
|
||
### 1.1.4 范式 (Normal Forms)
|
||
|
||
#### 析取范式 (DNF) 与 合取范式 (CNF)
|
||
- **定义**:
|
||
- DNF:简单合取式的析取 ($\sum$)。例如:$(P \land Q) \lor (\neg P \land R)$
|
||
- CNF:简单析取式的合取 ($\prod$)。例如:$(P \lor Q) \land (\neg P \lor R)$
|
||
- **主范式 (Principal NF)**:
|
||
- **极小项 ($m_i$)**:包含所有变量的合取项,编码对应真值表中的行号。
|
||
- **极大项 ($M_i$)**:包含所有变量的析取项。
|
||
- **转换方法**:
|
||
1. **真值表法**:
|
||
- 主析取范式:取真值表中结果为 $T$ 的行对应的极小项之和。
|
||
- 主合取范式:取真值表中结果为 $F$ 的行对应的极大项之积。
|
||
2. **等值演算法**:利用双重否定、德摩根、分配律展开。
|
||
|
||
---
|
||
|
||
## 1.2 谓词逻辑 (Predicate Logic)
|
||
|
||
### 1.2.1 基本要素
|
||
- **个体词**:常量 ($a, b$) 和 变量 ($x, y$)。
|
||
- **谓词**:$P(x_1, \dots, x_n)$,表示个体之间的性质或关系。
|
||
- **量词**:
|
||
- 全称量词 $\forall$ (For all)
|
||
- 存在量词 $\exists$ (Exists)
|
||
- **论域 (Universe)**:个体变元的取值范围。若未指定,通常指全总个体域。
|
||
|
||
### 1.2.2 翻译技巧 (易错)
|
||
1. **"所有的 S 都是 P"**:
|
||
- 正确:$\forall x (S(x) \to P(x))$
|
||
- *错误*:$\forall x (S(x) \land P(x))$ (这意味着宇宙中万物既是S也是P)
|
||
2. **"有的 S 是 P"**:
|
||
- 正确:$\exists x (S(x) \land P(x))$
|
||
- *错误*:$\exists x (S(x) \to P(x))$ (这通常是恒真的,没有意义)
|
||
|
||
### 1.2.3 谓词逻辑等值式
|
||
1. **量词否定律**:
|
||
- $\neg \forall x P(x) \Leftrightarrow \exists x \neg P(x)$ (改变量词,否定谓词)
|
||
- $\neg \exists x P(x) \Leftrightarrow \forall x \neg P(x)$
|
||
2. **量词辖域扩展** (设 $Q$ 不含 $x$):
|
||
- $\forall x (P(x) \lor Q) \Leftrightarrow (\forall x P(x)) \lor Q$
|
||
- $\exists x (P(x) \land Q) \Leftrightarrow (\exists x P(x)) \land Q$
|
||
3. **量词分配律**:
|
||
- $\forall x (P(x) \land Q(x)) \Leftrightarrow \forall x P(x) \land \forall x Q(x)$ (全称对合取可分配)
|
||
- $\exists x (P(x) \lor Q(x)) \Leftrightarrow \exists x P(x) \lor \exists x Q(x)$ (存在对析取可分配)
|
||
- *注意*:$\forall$ 对 $\lor$ 不可分配,$\exists$ 对 $\land$ 不可分配!
|
||
|
||
### 1.2.4 前束范式 (Prenex Normal Form)
|
||
**形式**:$Q_1 x_1 Q_2 x_2 \dots Q_k x_k M$
|
||
- 所有量词都在最左边。
|
||
- $M$ 是不含量词的基式。
|
||
|
||
**化简步骤**:
|
||
1. **消去蕴涵**:利用 $A \to B \Leftrightarrow \neg A \lor B$。
|
||
2. **否定内移**:利用德摩根律和量词否定律,将 $\neg$ 移到原子公式前。
|
||
3. **变元改名**:确保不同量词使用不同的变量名 (如 $\forall x P(x) \lor \exists x Q(x)$ 改为 $\forall x P(x) \lor \exists y Q(y)$)。
|
||
4. **量词左提**:利用量词辖域扩展规则将量词提到最前面。
|
||
|
||
---
|
||
|
||
## 1.3 推理理论 (Inference Theory)
|
||
|
||
### 1.3.1 常用推理规则
|
||
1. **假言推理 (Modus Ponens)**: $P, P \to Q \Rightarrow Q$
|
||
2. **拒取式 (Modus Tollens)**: $\neg Q, P \to Q \Rightarrow \neg P$
|
||
3. **析取三段论**: $P \lor Q, \neg P \Rightarrow Q$
|
||
4. **假言三段论**: $P \to Q, Q \to R \Rightarrow P \to R$
|
||
5. **化简律**: $P \land Q \Rightarrow P$
|
||
6. **附加律**: $P \Rightarrow P \lor Q$
|
||
|
||
### 1.3.2 谓词推理规则
|
||
1. **全称特指 (US)**: $\forall x P(x) \Rightarrow P(c)$ (任意 $\to$ 个体)
|
||
2. **全称推广 (UG)**: $P(x) \Rightarrow \forall x P(x)$ (任意个体 $\to$ 任意) *注意限制条件*
|
||
3. **存在特指 (ES)**: $\exists x P(x) \Rightarrow P(c)$ (存在 $\to$ 特指常量 $c$) *注意 $c$ 必须是新引入的*
|
||
4. **存在推广 (EG)**: $P(c) \Rightarrow \exists x P(x)$ (个体 $\to$ 存在)
|
||
|
||
### 1.3.3 证明方法
|
||
1. **直接证明法**:从前提及其逻辑推论出发,推导出结论。
|
||
2. **附加前提证明法 (CP规则)**:
|
||
- 若要证 $A \to B$,可将 $A$ 作为附加前提加入前提集,只需证出 $B$ 即可。
|
||
3. **反证法 (归谬法)**:
|
||
- 将结论的否定 $\neg C$ 加入前提集,推导出矛盾 ($F$)。
|