Mathematical logic (4) First order logic 一阶逻辑

本文最后更新于 2024年6月20日 晚上

1. Basic 基础组成

1.1 Domain 论域

The set of objects to be discussed is called Domain.

1.2 Constants 常元

The symbol to describe a concrete objects in domain is called constant.

e.g. Alice, Bob, 00, 11, \dots

1.3 Variables 变元

A symbol to represent an uncertain objects in domain is called variable.

e.g. x,y,z,w,x,y,z,w,\dots

1.4 Predicates 谓词

Predicates are symbols represents a property of an individual object or a relationship amon multiple individuals.

e.g. S(x)S(x) : xx is a student; R(x,y)R(x, y) : x<bryx <br y.

The arity of predicates is the number of its arguments(参数):e.g. Q3Q^3 can receive three arguments written as Q(x,y,z)Q(x, y, z).

1.5 Quantifiers 量词

  1. Universal Quantifier \forall : The value for variable ranges throughout the domain.

  2. Existential Quantifier \exists : The value for variable is limited to some objects in domain.

1.6 Functions 函词

A symbol represents the mapping from a set of individuals to an individual is called Function.

Like predicates, function has arity represents the numbers of input objects.

e.g. m(x,y)m(x, y) : the product of xx and yy.

2. Syntax 语义

2.1 Alphabet

Non-logical symbols :

  1. Constant symbols: c1,c2,c_1,c_2,\dots
  2. Predicates: P,Q,P12,P,Q,P^2_1,\dots
  3. Functions: f,g,h,f21,g12,f,g,h,f^1_2,g^2_1,\dots

Logical symols :

  1. Quantifiers: ,\forall,\exists
  2. Variables: x,y,z,x1,,x2,,y1,x,y,z,x_1,,x_2,\dots,y_1,\dots
  3. Connectives: ¬,,,,\neg, \land, \lor, \to, \leftrightarrow
  4. Punctuations: (,)(,) and ,
  5. Equality: ==

2.2 Terms 项

  • Constant symbols and variables are (atomic) terms.
  • If f(n)f^{(n)} is a function and t1,t2,,tnTerm(L)t_1,t_2,\dots,t_n \in Term(\mathscr{L}), then f(n)(t1,t2,,tn)Term(L)f^{(n)}(t_1,t_2,\dots,t_n) \in Term(\mathscr{L})

2.3 Atom 原子公式

  • P(t1,t2,,tn)Atom(L)P(t_1,t_2,\dots,t_n) \in Atom(\mathscr{L}) if t1,t2,,tnTerm(L)t_1,t_2,\dots,t_n \in Term(\mathscr{L}) and PP is an nn-ary predicate.
  • =(t1,t2)=(t_1,t_2) (or, t1=t2t_1=t_2) Atom(L)\in Atom(\mathscr{L}) where t1,t2Term(L)t_1,t_2 \in Term(\mathscr{L})

2.4 Formulas 公式

αForm(L)\alpha \in Form(\mathscr{L}) if and only if :

  1. Atom(L)Form(L)Atom(\mathscr{L}) \in Form(\mathscr{L}).
  2. If αForm(L)\alpha \in Form(\mathscr{L}), then (¬α)Form(L)(\neg \alpha) \in Form(\mathscr{L}).
  3. If α,βForm(L)\alpha, \beta \in Form(\mathscr{L}), then (αβ)Form(L)(\alpha*\beta) \in Form(\mathscr{L}), where * is one of ,,,\land, \lor, \to, \leftrightarrow.
  4. If αForm(L)\alpha \in Form(\mathscr{L}) and xx is a variable, then (xα),(xα)Form(L)(\forall x \alpha), (\exists x \alpha) \in Form(\mathscr{L}).

2.4.1 Precedence 优先顺序

  • x,x\forall x, \exists x have the same precedence as ¬\neg.
  • The rest remains as in proposition logic.

2.4.2 Conventions

  • Parenthese around quantifiers can be omitted.
  • The order of priority in which to consider ¬,,\neg, \exists, \forall is determined by the order in which they are listed.

2.5 Formalization 形式化

3. Semantics 语义

3.1 Basic

3.1.1 Scope 辖域

Formula α\alpha is the scope of the quatifier x(x)\forall x(\exists x) if x(x)\forall x(\exists x) is adjacent to α\alpha, and any proper prefix of α\alpha is not a formula.

e.g. xP(x)Q(x)\forall x P(x)\land Q(x), P(x)P(x) is the scope of x\forall x.

3.1.2 Free and Bound Variables 自由变元和约束变元

  • Free Variable : the variable is not within the scope of the relative quantifier.
  • Bound Variable : the variable is within the scope of the relative quantifier.

3.1.3 Sentence 语句

A formula with no free variables is called closed formula, or a sentence.

e.g.

  • yxf(x)=y\forall y \exists x f(x) = y is a sentence.

Closure(封闭式) :

If {x1,x2,,xn}\{x_1,x_2,\dots,x_n\} are all the free variables of a formula α\alpha, then

  • Universal closure: x1xnα\forall x_1 \dots \forall x_n \alpha
  • Existential closure: x1xnα\exists x_1 \dots \exists x_n \alpha

3.2 Interpretation 解释

An interpretation I\mathcal{I} consists of :

  • A non-empty domain DD of I\mathcal{I}.
  • Constant symbol cIc^\mathcal{I} in DD.
  • Function symbol fIf^\mathcal{I}.
  • Predicate symbol PIP^\mathcal{I}.

e.g. Define an interpretation I\mathcal{I} by

  • Domain: D={1,2,3}D = \{1, 2 ,3\}
  • Constant: αI=1,bI=2,cI=3\alpha^\mathcal{I} = 1, b^\mathcal{I} = 2, c^\mathcal{I} = 3
  • Function: fI:(x,y)min{x,y}f^\mathcal{I}:(x, y) \mapsto min\{x, y\}
  • Predicates: PI={1,3},QI={1,2,3,3,3,1}P^\mathcal{I} = \{1, 3\}, Q^\mathcal{I} = \{\langle1,2\rangle,\langle3,3\rangle,\langle3,1\rangle\}

3.3 Environment 环境

An environment EE is a function that assigns a value in the domain to every symbol in the language.

The combination of interpretation and environment supplies a value for every formulas in FOL.

3.4 Truth Value of Formulas

3.4.1 Valuation for Terms

  • If term tt is a constant cc, then t(I,E)=cIt^{(\mathcal{I},E)} = c^{\mathcal{I}}.

  • If term tt is a free variable xx, then t(I,E)=xEt^{(\mathcal{I},E)}= x^E.

  • If term tt is a function f(t1,t2,,tn)f(t_1,t_2,\dots,t_n), then t(I,E)=fI(t1(I,E),t2(I,E),,tn(I,E))t^{(\mathcal{I},E)} = f^\mathcal{I}(t_1^{(\mathcal{I},E)},t_2^{(\mathcal{I},E)},\dots,t_n^{(\mathcal{I},E)}).

3.4.2 Valution for Well-Formed Formulas

3.4.3 Defination 定义

For any environment EE and domain element dd, the new environment EE with xx re-assigned to dd, denoted E[xd]E[x \mapsto d], is given by:

E[xd](y)={dif y is xE(y)if y is not xE[x \mapsto d](y) = \left\{ \begin{aligned} &d &&\text{if } y \text{ is } x \\ &E(y) &&\text{if } y \text{ is not } x\\ \end{aligned} \right.

3.4.4 Valuation for Quantified Formulas

(x α)(I,E)={1if α(I,E[xd])=1 for every ddom(I)0otherwise(\forall x \ \alpha)^{(\mathcal{I},E)} = \left\{ \begin{aligned} &1 &&\text{if } \alpha^{(\mathcal{I},E[x \mapsto d])} = 1\text{ for every } d \in dom(\mathcal{I}) \\ &0 &&\text{otherwise} \end{aligned} \right.

(x α)(I,E)={1if α(I,E[xd])=1 for some ddom(I)0otherwise(\exists x \ \alpha)^{(\mathcal{I},E)} = \left\{ \begin{aligned} &1 &&\text{if } \alpha^{(\mathcal{I},E[x \mapsto d])} = 1\text{ for some } d \in dom(\mathcal{I}) \\ &0 &&\text{otherwise} \end{aligned} \right.

4. Entailment 蕴涵

4.1 Satisfaction and Validity 可满足性和永真性

An interpretation I\mathcal{I} and environment EE satisfy a formula α\alpha, denoted IEα\mathcal{I} \models_E \alpha, iff α(I,E)=1\alpha^{(\mathcal{I},E)}=1.

Otherwise, they don’t satisfy α\alpha, denoted I̸Eα\mathcal{I} \not\models_E \alpha if α(I,E)=0\alpha^{(\mathcal{I},E)}=0.

Typically, if IEα\mathcal{I} \models_E \alpha for every EE, then II satisfy α\alpha, denoted Iα\mathcal{I} \models \alpha.

For a formula α\alpha:

  • Valid: if IEα\mathcal{I} \models_E \alpha for every I\mathcal{I} and EE (like tautology in proposition logic).
  • Satisfiable: if IEα\mathcal{I} \models_E \alpha for some I\mathcal{I} and EE.
  • Unsatisfiable: if I̸Eα\mathcal{I} \not\models_E \alpha for every I\mathcal{I} and EE.

4.2 Semantic Entailment 语意蕴涵

Σ\Sigma is a set of FOL formulas and α\alpha is a formula, we say Σα\Sigma \models \alpha if and only if, for any I\mathcal{I} and EE, if IEΣ\mathcal{I} \models_E \Sigma then IEα\mathcal{I} \models_E \alpha.

α\emptyset \models \alpha means α\alpha is valid.

4.2.1 Prove Entailment 蕴含证明

e.g. Prove that

x(¬y)¬(x y)\forall x (\neg y) \models \neg (\exists x \ y)

Proof:

Assume IEx(¬y)\mathcal{I} \models_E \forall x (\neg y), then we obtain

For every adom(I),IE[xa](¬y) For every adom(I),I̸E[xa] y\begin{aligned} &\text{For every } a \in dom(\mathcal{I}), \mathcal{I} \models_{E[x \mapsto a]} (\neg y) \\ \equiv \ &\text{For every } a \in dom(\mathcal{I}), \mathcal{I} \not\models_{E[x \mapsto a]} \ y \end {aligned}

by the entailment rules of negation, this means if IE(x y)\mathcal{I} \models_E (\exists x \ y), there will raise a contradiction for no adom(I) such that IE[xa] ya \in dom(\mathcal{I}) \text{ such that } \mathcal{I} \models_{E[x \mapsto a]} \ y.

Hence, IE¬(x y)\mathcal{I} \models_E \neg(\exists x \ y) holds. Q.E.D.

5. Natural Dedution 自然演绎

5.1 Substitution 代换

For a variable xx, a term tt and a formula α\alpha, α[t/x]\alpha[t/x] denotes the resulting formula by replacing each free occurence of xx in α\alpha with tt.

e.g. (xP(x)P(y))[u/x]    P(u)P(y)(\forall x P(x)\land P(y))[u/x] \iff P(u) \land P(y)

5.2 Inference Rules

Name \vdash-notation inference notation
\forall-elimination If ΣND(x α)\Sigma \vdash_{ND}(\forall x \ \alpha), then ΣNDα[t/x]\Sigma \vdash_{ND}\alpha[t/x] ( α)α[t/x]\dfrac{(\forall \ \alpha)}{\alpha[t/x]}
\forall-introduction If ΣNDα[u/x]\Sigma \vdash_{ND} \alpha[u/x] and uu is not free in Σ,α\Sigma,\alpha, then ΣNDα\Sigma \vdash_{ND} \forall \alpha u fresh α[u/x]x α\dfrac{\boxed{\begin{aligned}&u \ \text{fresh} \\ & \quad \ \vdots \\ &\alpha[u/x]\end{aligned}}}{\forall x \ \alpha}
\exists-elimination If Σ,α[u/x]NDβ\Sigma,\alpha[u/x]\vdash_{ND}\beta with uu fresh, then Σ,(x α)NDβ\Sigma, (\exists x \ \alpha)\vdash_{ND}\beta (x α)α[u/x],u fresh     ββ\dfrac{(\exists x \ \alpha) \quad \boxed{\begin{aligned}&\alpha[u/x], u \ \text{fresh} \\ & \quad \quad \ \ \ \vdots \\ &\quad \quad \ \ \beta\end{aligned}}}{\beta}
\exists-introdution If ΣNDα[t/x]\Sigma\vdash_{ND}\alpha[t/x], then ΣND(x α)\Sigma \vdash_{ND} (\exists x \ \alpha) α[t/x](x α)\dfrac{\alpha[t/x]}{(\exists x \ \alpha)}

e.g.

i.x(¬P(x))¬(xP(x))\text{i}. \quad \exists x (\neg P(x)) \vdash \neg (\forall x P(x))

Proof :

1.x(¬P(x))Premise2.xP(x)Assumption3.¬P(u), u fresh4.P(u)e:25.i:3,46.e:1,357.¬(xP(x))¬i:26\begin{aligned} &1. \quad \exists x (\neg P(x)) \quad \quad \text{Premise} \\ &\boxed{ \begin{aligned} &2. \quad \forall x P(x) \quad \quad \quad \text{Assumption} \\ &\boxed{ \begin{aligned} &3. \quad \neg P(u), \ u \ \text{fresh} \\ &4. \quad P(u) \quad \quad \quad \quad \forall_e: 2 \\ &5. \quad \perp \quad \quad \quad \quad \quad \perp_i: 3, 4 \\ \end{aligned} }\\ &6. \quad \perp \quad \quad \quad \quad \quad \exists_e: 1, 3-5 \\ \end{aligned} }\\ &7. \quad \neg (\forall x P(x)) \quad \quad \neg_i: 2-6 \\ \\ \\ \end{aligned}

ii.¬(P(x))x(¬P(x))\text{ii}. \quad \neg (\forall P(x)) \vdash \exists x(\neg P(x))

Proof :

1.¬(xP(x))Premise2.¬x(¬P(x)) Assumption3.u  fresh4.¬P(u) Assumption5.¬P(x)   i:46.i:2,57.P(u) Reductio ad Absurbum: 4-68.xP(x)  i:379.  i:1,810.x¬P(x)  Reductio ad Absurbum: 2-9\begin{aligned} &1. \quad \neg (\forall x P(x)) \quad \quad \text{Premise} \\ &\boxed{ \begin{aligned} &2. \quad \neg \exists x(\neg P(x)) \quad \ \text{Assumption} \\ &\boxed{ \begin{aligned} &3. \quad u \ \ \text{fresh} \\ &\boxed{ \begin{aligned} &4. \quad \neg P(u) \quad \quad \quad \ \text{Assumption} \\ &5. \quad \exists \neg P(x) \quad \quad \ \ \ \exists_i: 4 \\ &6. \quad \perp \quad \quad \quad \quad \quad \perp_i: 2, 5 \\ \end{aligned} }\\ &7. \quad P(u) \quad \quad \quad \quad \ \text{Reductio ad Absurbum: 4-6} \\ \end{aligned} }\\ &8. \quad \forall x P(x) \quad \quad \quad \ \ \forall_i: 3-7 \\ &9. \quad \perp \quad \quad \quad \quad \quad\ \ \perp_i: 1, 8 \\ \end{aligned} }\\ &10. \quad \exists x \neg P(x) \quad \quad \ \ \text{Reductio ad Absurbum: 2-9} \\ \end{aligned}


Mathematical logic (4) First order logic 一阶逻辑
http://example.com/2024/06/20/mml-4/
作者
Zaddle
发布于
2024年6月20日
更新于
2024年6月20日
许可协议