Formalized Formal Logic

2.4. Gödel's Second Incompleteness Theorem🔗

Recall that inside \mathsf{I}\Sigma_1 we can do basic set theory and primitive recursion. Many inductive notions and functions on them are defined in \Delta_1 or \Sigma_1 using the fixedpoint construction.

We work inside an arbitrary model V of \mathsf{I}\Sigma_1.

2.4.1. Coding of Terms and Formulae

2.4.1.1. Term

Define T_C as follows.

\begin{align*} u \in T_C &\iff && (\exists z)[u = \widehat{\#z}] \lor {} \\ & && (\exists x) [u = \widehat{\&x}] \lor {} \\ & && (\exists k, f, v) [\mathrm{Func}_k(f) \land \mathrm{Seq}(v) \land k = \mathrm{lh}(v) \land (\forall i, z)[\braket{i, z} \in v \to z \in C] \land u = \widehat{f^k(v)}] \\ \end{align*}

\widehat{\bullet} is a quasi-quotation..

\begin{align*} \text{bounded variable: }&& \widehat{\#z} &\coloneqq \braket{0, z} + 1 \\ \text{free variable: }&&\widehat{\&x} &\coloneqq \braket{1, x} + 1 \\ \text{function: }&&\widehat{f^k(v)} &\coloneqq \braket{2, f, k, v} + 1 \\ \end{align*}

T_C is \Delta_1 (if C is a finite set) and monotone. Let \mathrm{UTerm}(t) be a fixedpoint of T_C. It is \Delta_1 since T_C satisfies strong finiteness. Define the function \mathrm{termBV}(t) inductively on \mathrm{UTerm} meaning the largest bounded variable +1 that appears in the term. Define \mathrm{Semiterm}(n, t) := \mathrm{UTerm}(t) \land \mathrm{termBV}(t) \le n.

🔗def
LO.ISigma1.Metamath.IsSemiterm.{u_1, u_2} {V : Type u_1} [ORingStruc V] [V ⊧ₘ* 𝗜𝚺₁] (L : Language) [L.Encodable] [L.LORDefinable] (n t : V) : Prop
LO.ISigma1.Metamath.IsSemiterm.{u_1, u_2} {V : Type u_1} [ORingStruc V] [V ⊧ₘ* 𝗜𝚺₁] (L : Language) [L.Encodable] [L.LORDefinable] (n t : V) : Prop

2.4.1.2. Formula

Similarly, Define F_C:

\begin{align*} u \in F_C &\iff && (\exists k, R, v)[\mathrm{Rel}_k(R) \land \text{$v$ is a list of $\mathrm{UTerm}$ of length $k$} \land u = \widehat{R^k (v)}] \lor {} \\ & && (\exists k, R, v)[\mathrm{Rel}_k(R) \land \text{$v$ is a list of $\mathrm{UTerm}$ of length $k$} \land u = \widehat{\lnot R^k (v)}] \lor {} \\ & && [u = \widehat{\top}] \lor {} \\ & && [u = \widehat{\bot}] \lor {} \\ & && (\exists p \in C, q \in C) [u = \widehat{p \land q}] \lor {} \\ & && (\exists p \in C, q \in C) [u = \widehat{p \lor q}] \lor {} \\ & && (\exists p \in C) [u = \widehat{\forall p}] \lor {} \\ & && (\exists p \in C) [u = \widehat{\exists p}] \end{align*}

\begin{align*} \widehat{R^k(v)} &\coloneqq \braket{0, R, k, v} + 1\\ \widehat{\lnot R^k(v)} &\coloneqq \braket{1, R, k, v} + 1 \\ \widehat{\top} &\coloneqq \braket{2, 0} + 1\\ \widehat{\bot} &\coloneqq \braket{3, 0} + 1\\ \widehat{p \land q} &\coloneqq \braket{4, p, q} + 1\\ \widehat{p \lor q} &\coloneqq \braket{5, p, q} + 1\\ \widehat{\forall p} &\coloneqq \braket{6, p} + 1\\ \widehat{\exists p} &\coloneqq \braket{7, p} + 1\\ \end{align*}

F_C is \Delta_1 and monotone. Let \mathrm{UFormula}(p) be a fixedpoint of F_C and define

\mathrm{Semiformula}(n, p) \iff \mathrm{UFormula}(p) \land \mathrm{bv}(p) \le n
🔗structure
LO.ISigma1.Metamath.IsSemiformula.{u_1, u_2} {V : Type u_1} [ORingStruc V] [V ⊧ₘ* 𝗜𝚺₁] (L : Language) [L.Encodable] [L.LORDefinable] (n p : V) : Prop
LO.ISigma1.Metamath.IsSemiformula.{u_1, u_2} {V : Type u_1} [ORingStruc V] [V ⊧ₘ* 𝗜𝚺₁] (L : Language) [L.Encodable] [L.LORDefinable] (n p : V) : Prop

Constructor

LO.ISigma1.Metamath.IsSemiformula.mk.{u_1, u_2}

Fields

isUFormula : IsUFormula L p
bv_le : bv L p  n

The function \mathrm{bv}(p) is defined inductively on \mathrm{UFormula} meaning the largest bounded variable +1 that appears in the formula.

\mathrm{UFormula}(p) and \mathrm{Semiormula}(n, p) are again \Delta_1 since F_C satisfies strong finiteness.

🔗def
LO.ISigma1.Metamath.IsUFormula.{u_1, u_2} {V : Type u_1} [ORingStruc V] [V ⊧ₘ* 𝗜𝚺₁] (L : Language) [L.Encodable] [L.LORDefinable] : V Prop
LO.ISigma1.Metamath.IsUFormula.{u_1, u_2} {V : Type u_1} [ORingStruc V] [V ⊧ₘ* 𝗜𝚺₁] (L : Language) [L.Encodable] [L.LORDefinable] : V Prop

2.4.2. Formalized Provability

Let T be \Delta_1-definable theory. Define D_C:

\begin{align*} d \in D_C &\iff &&(\forall p \in \mathrm{sqt}(d))[\mathrm{Semiformula}(0, p)] \land {} \\ && [ & (\exists s, p)[d = \widehat{\text{AXL}(s, p)} \land p \in s \land \hat\lnot p \in s] \lor {} \\ & && (\exists s)[d = \widehat{\top\text{-INTRO}(s)} \land \widehat{\top} \in s] \lor {} \\ & && (\exists s, p, q)(\exists d_p, d_q \in C)[ d = \widehat{\land\text{-INTRO} (s, p, q, d_p, d_q)} \land \widehat{p \land q} \in s \land \mathrm{sqt}(d_p) = s \cup \{p\} \land \mathrm{sqt}(d_q) = s \cup \{q\}] \lor {} \\ & && (\exists s, p, q)(\exists d \in C)[ d = \widehat{\lor\text{-INTRO}(s, p,q,d)} \land \widehat{p \lor q} \in s \land \mathrm{sqt}(d) = s \cup \{p, q\}] \lor {} \\ & && (\exists s, p)(\exists d \in C)[ d = \widehat{\forall\text{-INTRO}(s, p, d)} \land \widehat{\forall p} \in s \land \mathrm{sqt}(d) = s^+ \cup \{p^+[\&0]\}] \lor {} \\ & && (\exists s, p, t)(\exists d \in C)[ d = \widehat{\exists\text{-INTRO}(s, p, t, d)} \land \widehat{\exists p} \in s \land \mathrm{sqt}(d) = s \cup \{p(t)\}] \lor {} \\ & && (\exists s)(\exists d' \in C)[ d = \widehat{\mathrm{WK}(s, d')} \land s \supseteq \mathrm{sqt}(d') ] \\ & && (\exists s)(\exists d' \in C)[ d = \widehat{\mathrm{SHIFT}(s, d')} \land s = \mathrm{sqt}(d')^+ ] \\ & && (\exists s, p)(\exists d_1, d_2 \in C)[ d = \widehat{\mathrm{CUT}(s, p, d_1, d_2)} \land \mathrm{sqt}(d_1) = s \cup \{p\} \land \mathrm{sqt}(d_2) = s \cup \{\lnot p\}] \\ & && (\exists s, p)[ d = \widehat{\mathrm{ROOT}(s, p)} \land p \in s \land p \in T ] ]\end{align*}

\begin{align*} \widehat{\text{AXL}(s, p)} &\coloneqq \braket{s, 0, p} + 1\\ \widehat{\top\text{-INTRO}(s)} &\coloneqq \braket{s, 1, 0} + 1 \\ \widehat{\land\text{-INTRO}(s, p, q, d_p, d_q)} &\coloneqq \braket{s,2, p, q, d_p, d_q} + 1\\ \widehat{\lor\text{-INTRO}(s, p, q, d)} &\coloneqq \braket{s, 3,p, q, d} + 1\\ \widehat{\forall\text{-INTRO}(s, p, d)} &\coloneqq \braket{s, 4, p, d} + 1\\ \widehat{\exists\text{-INTRO}(s, p, t, d)} &\coloneqq \braket{s, 5, p, t, d} + 1\\ \widehat{\text{WK}(s, d)} &\coloneqq \braket{s, 6, d} + 1\\ \widehat{\text{SHIFT}(s, d)} &\coloneqq \braket{s, 7, d} + 1\\ \widehat{\text{CUT}(s, p, d_1, d_2)} &\coloneqq \braket{s, 8, p, d_1, d_2} + 1\\ \widehat{\text{ROOT}(s, p)} &\coloneqq \braket{s, 9, p} + 1 \\ \mathrm{sqt}(d) &\coloneqq \pi_1(d - 1) \end{align*}

p^+ is a shift of a formula p. s^+ is a image of shift of s. Take fixedpoint \mathrm{Derivation}_T(d).

\begin{align*} \mathrm{Derivable}_T(\Gamma) &\coloneqq (\exists d)[\mathrm{Derivation}_T(d) \land \mathrm{sqt}(d) = \Gamma] \\ \mathrm{Provable}_T(p) &\coloneqq \mathrm{Derivable}_T(\{p\}) \end{align*}

🔗def
LO.FirstOrder.Theory.Derivable.{u_1, u_2} {V : Type u_1} [ORingStruc V] [V ⊧ₘ* 𝗜𝚺₁] {L : Language} [L.Encodable] [L.LORDefinable] (T : Theory L) [T.Δ₁] (s : V) : Prop
LO.FirstOrder.Theory.Derivable.{u_1, u_2} {V : Type u_1} [ORingStruc V] [V ⊧ₘ* 𝗜𝚺₁] {L : Language} [L.Encodable] [L.LORDefinable] (T : Theory L) [T.Δ₁] (s : V) : Prop
🔗def
LO.FirstOrder.Theory.Provable.{u_1, u_2} {V : Type u_1} [ORingStruc V] [V ⊧ₘ* 𝗜𝚺₁] {L : Language} [L.Encodable] [L.LORDefinable] (T : Theory L) [T.Δ₁] (φ : V) : Prop
LO.FirstOrder.Theory.Provable.{u_1, u_2} {V : Type u_1} [ORingStruc V] [V ⊧ₘ* 𝗜𝚺₁] {L : Language} [L.Encodable] [L.LORDefinable] (T : Theory L) [T.Δ₁] (φ : V) : Prop
🔗def
LO.FirstOrder.Theory.Proof.{u_1, u_2} {V : Type u_1} [ORingStruc V] [V ⊧ₘ* 𝗜𝚺₁] {L : Language} [L.Encodable] [L.LORDefinable] (T : Theory L) [T.Δ₁] (d φ : V) : Prop
LO.FirstOrder.Theory.Proof.{u_1, u_2} {V : Type u_1} [ORingStruc V] [V ⊧ₘ* 𝗜𝚺₁] {L : Language} [L.Encodable] [L.LORDefinable] (T : Theory L) [T.Δ₁] (d φ : V) : Prop

Following holds for all formula (not coded one) \varphi and finite set \Gamma.

\N \models \mathrm{Provable}_T(\ulcorner \varphi \urcorner) \implies T \vdash \varphi

🔗theorem
LO.FirstOrder.Theory.Provable.sound.{u_2} {L : Language} [L.DecidableEq] [L.Encodable] [L.LORDefinable] {T : Theory L} [T.Δ₁] {φ : Sentence L} (h : T.Provable φ) : T φ
LO.FirstOrder.Theory.Provable.sound.{u_2} {L : Language} [L.DecidableEq] [L.Encodable] [L.LORDefinable] {T : Theory L} [T.Δ₁] {φ : Sentence L} (h : T.Provable φ) : T φ

Now assume that U is a theory of arithmetic stronger than \mathsf{R_0} and T be a theory of arithmetic stronger than \mathsf{I}\Sigma_1. The following holds, thanks to the completeness theorem.

1 U \vdash \sigma \iff T \vdash \mathrm{Provable}_U(\ulcorner \sigma \urcorner)

🔗theorem
LO.FirstOrder.Arithmetic.provable_complete {T : Theory ℒₒᵣ} [T.Δ₁] {U : ArithmeticTheory} [U.SoundOnHierarchy 𝚺 1] [𝗜𝚺₁ U] {σ : Sentence ℒₒᵣ} : T σ U T.provabilityPred σ
LO.FirstOrder.Arithmetic.provable_complete {T : Theory ℒₒᵣ} [T.Δ₁] {U : ArithmeticTheory} [U.SoundOnHierarchy 𝚺 1] [𝗜𝚺₁ U] {σ : Sentence ℒₒᵣ} : T σ U T.provabilityPred σ

2 T \vdash \mathrm{Provable}_U(\ulcorner \sigma \to \pi \urcorner) \to \mathrm{Provable}_U(\ulcorner \sigma \urcorner) \to \mathrm{Provable}_U(\ulcorner \pi \urcorner)

🔗theorem
LO.FirstOrder.Arithmetic.provable_D2.{u_1} {L : Language} [L.Encodable] [L.LORDefinable] {T : Theory L} [T.Δ₁] {σ π : Sentence L} : 𝗜𝚺₁ T.provabilityPred (σ π) T.provabilityPred σ T.provabilityPred π
LO.FirstOrder.Arithmetic.provable_D2.{u_1} {L : Language} [L.Encodable] [L.LORDefinable] {T : Theory L} [T.Δ₁] {σ π : Sentence L} : 𝗜𝚺₁ T.provabilityPred (σ π) T.provabilityPred σ T.provabilityPred π

The derivability condition D2.

3 T \vdash \mathrm{Provable}_U(\ulcorner \sigma \urcorner) \to \mathrm{Provable}_U(\ulcorner \mathrm{Provable}_U(\ulcorner \sigma \urcorner) \urcorner)

🔗theorem
LO.FirstOrder.Arithmetic.provable_D3 {T : Theory ℒₒᵣ} [T.Δ₁] [𝗣𝗔⁻ T] {σ : Sentence ℒₒᵣ} : 𝗜𝚺₁ T.provabilityPred σ T.provabilityPred (T.provabilityPred σ)
LO.FirstOrder.Arithmetic.provable_D3 {T : Theory ℒₒᵣ} [T.Δ₁] [𝗣𝗔⁻ T] {σ : Sentence ℒₒᵣ} : 𝗜𝚺₁ T.provabilityPred σ T.provabilityPred (T.provabilityPred σ)

The derivability condition D3.

2.4.3. Second Incompleteness Theorem

Assume that T is \Delta_1-definable and stronger than \mathsf{I}\Sigma_1.

section variable (T : Theory ℒₒᵣ) [𝗜𝚺₁ T]

2.4.3.1. Fixed-point Lemma

Since the substitution is \Sigma_1, There is a formula \mathrm{ssnum}(y, p, x) such that, for all formula \varphi with only one variable and x, y \in V,

\mathrm{ssnum}(y, {\ulcorner \varphi \urcorner}, x) \iff y = \ulcorner \varphi(\overline{x}) \urcorner

holds. (overline \overline{\bullet} denotes the (formalized) numeral of x)

Define a sentence \mathrm{fixedpoint}_\theta for formula (with one variable) \theta as follows.

\begin{align*} \mathrm{fixedpoint}_\theta &\coloneqq \mathrm{diag}_\theta(\overline{\ulcorner \mathrm{diag}_\theta \urcorner}) \\ \mathrm{diag}_\theta(x) &\coloneqq (\forall y)[\mathrm{ssnum}(y, x, x) \to \theta (y)] \end{align*}

namespace Book noncomputable def diag (θ : Semisentence ℒₒᵣ 1) : Semisentence ℒₒᵣ 1 := x. y, !ssnum y x x !θ y noncomputable def fixedpoint (θ : Semisentence ℒₒᵣ 1) : Sentence ℒₒᵣ := (Book.diag θ)/[Book.diag θ]

By simple reasoning, it can be checked that f satisfies the following:

T \vdash \mathrm{fixedpoint}_\theta \leftrightarrow \theta({\ulcorner \mathrm{fixedpoint}_\theta \urcorner})

theorem diagonal (θ : Semisentence ℒₒᵣ 1) : T fixedpoint θ θ/[fixedpoint θ] := haveI : 𝗘𝗤 T := Entailment.WeakerThan.trans (𝓣 := 𝗜𝚺₁) inferInstance inferInstance complete <| oRing_consequence_of.{0} _ _ fun (V : Type) _ _ T:Theory ℒₒᵣinst✝:𝗜𝚺₁ Tθ:Semisentence ℒₒᵣ 1this:𝗘𝗤 _fvar.3 := WeakerThan.trans inferInstance inferInstanceV:Typex✝¹:ORingStruc Vx✝:V ⊧ₘ* TV ⊧ₘ fixedpoint θ θ/[fixedpoint θ] T:Theory ℒₒᵣinst✝:𝗜𝚺₁ Tθ:Semisentence ℒₒᵣ 1this✝:𝗘𝗤 _fvar.3 := WeakerThan.trans inferInstance inferInstanceV:Typex✝¹:ORingStruc Vx✝:V ⊧ₘ* Tthis:_fvar.2127 ⊧ₘ* 𝗜𝚺₁ := ModelsTheory.of_provably_subtheory _fvar.2127 𝗜𝚺₁ _fvar.3 inferInstanceV ⊧ₘ fixedpoint θ θ/[fixedpoint θ] suffices V ⊧/![] (fixedpoint θ) V ⊧/![fixedpoint θ] θ T:Theory ℒₒᵣinst✝:𝗜𝚺₁ Tθ:Semisentence ℒₒᵣ 1this✝¹:𝗘𝗤 _fvar.3 := WeakerThan.trans inferInstance inferInstanceV:Typex✝¹:ORingStruc Vx✝:V ⊧ₘ* Tthis✝:_fvar.2127 ⊧ₘ* 𝗜𝚺₁ := ModelsTheory.of_provably_subtheory _fvar.2127 𝗜𝚺₁ _fvar.3 inferInstancethis:_fvar.2127 ⊧/(@Matrix.vecEmpty _fvar.2127) (Book.fixedpoint _fvar.1852) _fvar.2127 ⊧/(@Matrix.vecCons _fvar.2127 0 (@GödelQuote.quote (Sentence ℒₒᵣ) _fvar.2127 Sentence.instGödelQuoteSemisentence (Book.fixedpoint _fvar.1852)) (@Matrix.vecEmpty _fvar.2127)) _fvar.1852 := ?_mvar.2538V ⊧ₘ fixedpoint θ θ/[fixedpoint θ] All goals completed! 🐙 T:Theory ℒₒᵣinst✝:𝗜𝚺₁ Tθ:Semisentence ℒₒᵣ 1this✝:𝗘𝗤 _fvar.3 := WeakerThan.trans inferInstance inferInstanceV:Typex✝¹:ORingStruc Vx✝:V ⊧ₘ* Tthis:_fvar.2127 ⊧ₘ* 𝗜𝚺₁ := ModelsTheory.of_provably_subtheory _fvar.2127 𝗜𝚺₁ _fvar.3 inferInstancet:_fvar.2127 := Book.diag _fvar.1852V ⊧/![] (fixedpoint θ) V ⊧/![fixedpoint θ] θ have ht : substNumeral t t = fixedpoint θ := T:Theory ℒₒᵣinst✝:𝗜𝚺₁ Tθ:Semisentence ℒₒᵣ 1this:𝗘𝗤 _fvar.3 := WeakerThan.trans inferInstance inferInstanceV:Typex✝¹:ORingStruc Vx✝:V ⊧ₘ* TV ⊧ₘ fixedpoint θ θ/[fixedpoint θ] All goals completed! 🐙 calc V ⊧/![] (fixedpoint θ) _ V ⊧/![t] (diag θ) := T:Theory ℒₒᵣinst✝:𝗜𝚺₁ Tθ:Semisentence ℒₒᵣ 1this✝:𝗘𝗤 _fvar.3 := WeakerThan.trans inferInstance inferInstanceV:Typex✝¹:ORingStruc Vx✝:V ⊧ₘ* Tthis:_fvar.2127 ⊧ₘ* 𝗜𝚺₁ := ModelsTheory.of_provably_subtheory _fvar.2127 𝗜𝚺₁ _fvar.3 inferInstancet:_fvar.2127 := @GödelQuote.quote (Semisentence ℒₒᵣ 1) _fvar.2127 Sentence.instGödelQuoteSemisentence (Book.diag _fvar.1852)ht:@substNumeral _fvar.2127 _fvar.2130 _fvar.2234 _fvar.15362 _fvar.15362 = @GödelQuote.quote (Sentence ℒₒᵣ) _fvar.2127 Sentence.instGödelQuoteSemisentence (Book.fixedpoint _fvar.1852) := of_eq_true (Eq.trans (congrArg (fun x x = @GödelQuote.quote (Sentence ℒₒᵣ) _fvar.2127 Sentence.instGödelQuoteSemisentence ((Book.diag _fvar.1852)/[Book.diag _fvar.1852])) (substNumeral_app_quote (Book.diag _fvar.1852) (Book.diag _fvar.1852))) (eq_self (@GödelQuote.quote (FirstOrder.Semiformula ℒₒᵣ Empty 0) _fvar.2127 Sentence.instGödelQuoteSemisentence ((Book.diag _fvar.1852)/[Book.diag _fvar.1852]))))V ⊧/![] (fixedpoint θ) V ⊧/![t] (diag θ) All goals completed! 🐙 _ V ⊧/![substNumeral t t] θ := T:Theory ℒₒᵣinst✝:𝗜𝚺₁ Tθ:Semisentence ℒₒᵣ 1this✝:𝗘𝗤 _fvar.3 := WeakerThan.trans inferInstance inferInstanceV:Typex✝¹:ORingStruc Vx✝:V ⊧ₘ* Tthis:_fvar.2127 ⊧ₘ* 𝗜𝚺₁ := ModelsTheory.of_provably_subtheory _fvar.2127 𝗜𝚺₁ _fvar.3 inferInstancet:_fvar.2127 := @GödelQuote.quote (Semisentence ℒₒᵣ 1) _fvar.2127 Sentence.instGödelQuoteSemisentence (Book.diag _fvar.1852)ht:@substNumeral _fvar.2127 _fvar.2130 _fvar.2234 _fvar.15362 _fvar.15362 = @GödelQuote.quote (Sentence ℒₒᵣ) _fvar.2127 Sentence.instGödelQuoteSemisentence (Book.fixedpoint _fvar.1852) := of_eq_true (Eq.trans (congrArg (fun x x = @GödelQuote.quote (Sentence ℒₒᵣ) _fvar.2127 Sentence.instGödelQuoteSemisentence ((Book.diag _fvar.1852)/[Book.diag _fvar.1852])) (substNumeral_app_quote (Book.diag _fvar.1852) (Book.diag _fvar.1852))) (eq_self (@GödelQuote.quote (FirstOrder.Semiformula ℒₒᵣ Empty 0) _fvar.2127 Sentence.instGödelQuoteSemisentence ((Book.diag _fvar.1852)/[Book.diag _fvar.1852]))))V ⊧/![t] (diag θ) V ⊧/![substNumeral t t] θ All goals completed! 🐙 _ V ⊧/![fixedpoint θ] θ := T:Theory ℒₒᵣinst✝:𝗜𝚺₁ Tθ:Semisentence ℒₒᵣ 1this✝:𝗘𝗤 _fvar.3 := WeakerThan.trans inferInstance inferInstanceV:Typex✝¹:ORingStruc Vx✝:V ⊧ₘ* Tthis:_fvar.2127 ⊧ₘ* 𝗜𝚺₁ := ModelsTheory.of_provably_subtheory _fvar.2127 𝗜𝚺₁ _fvar.3 inferInstancet:_fvar.2127 := @GödelQuote.quote (Semisentence ℒₒᵣ 1) _fvar.2127 Sentence.instGödelQuoteSemisentence (Book.diag _fvar.1852)ht:@substNumeral _fvar.2127 _fvar.2130 _fvar.2234 _fvar.15362 _fvar.15362 = @GödelQuote.quote (Sentence ℒₒᵣ) _fvar.2127 Sentence.instGödelQuoteSemisentence (Book.fixedpoint _fvar.1852) := of_eq_true (Eq.trans (congrArg (fun x x = @GödelQuote.quote (Sentence ℒₒᵣ) _fvar.2127 Sentence.instGödelQuoteSemisentence ((Book.diag _fvar.1852)/[Book.diag _fvar.1852])) (substNumeral_app_quote (Book.diag _fvar.1852) (Book.diag _fvar.1852))) (eq_self (@GödelQuote.quote (FirstOrder.Semiformula ℒₒᵣ Empty 0) _fvar.2127 Sentence.instGödelQuoteSemisentence ((Book.diag _fvar.1852)/[Book.diag _fvar.1852]))))V ⊧/![substNumeral t t] θ V ⊧/![fixedpoint θ] θ All goals completed! 🐙 end Book

2.4.3.2. Main Theorem

Let T be a \Delta_1-theory, which is stronger than \mathsf{I}\Sigma_1.

namespace Book variable (T : Theory ℒₒᵣ) [T.Δ₁] [𝗜𝚺₁ T]

We will use \square \varphi to denote \mathrm{Provable}(\ulcorner\varphi\urcorner). Define Gödel sentence \mathsf{G}, as \mathrm{fixedpoint}_{\lnot\mathrm{Provable}_T(x)} using fixed-point theorem, satisfies

T \vdash \mathsf{G} \leftrightarrow \lnot \mathrm{Provable}(\ulcorner\mathsf{G}\urcorner)

local prefix:max "□" => T.provabilityPred noncomputable def gödel : Sentence ℒₒᵣ := Book.fixedpoint (T.provable) local notation "𝗚" => gödel T variable {T} lemma gödel_spec : T 𝗚 𝗚 := T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ TT 𝗚 T.provabilityPred 𝗚 All goals completed! 🐙

Gödel sentence is undecidable, i.e., T \nvdash \mathsf{G} if T is consistent,

lemma gödel_unprovable [Entailment.Consistent T] : T 𝗚 := T:Theory ℒₒᵣinst✝²:T.Δ₁inst✝¹:𝗜𝚺₁ Tinst✝:Consistent TT 𝗚 T:Theory ℒₒᵣinst✝²:T.Δ₁inst✝¹:𝗜𝚺₁ Tinst✝:Consistent Th:T 𝗚False T:Theory ℒₒᵣinst✝²:T.Δ₁inst✝¹:𝗜𝚺₁ Tinst✝:Consistent Th:T 𝗚hp:_fvar.93 Theory.provabilityPred _fvar.93 (Book.gödel _fvar.93) := weakening inferInstance (provable_D1 _fvar.302)False T:Theory ℒₒᵣinst✝²:T.Δ₁inst✝¹:𝗜𝚺₁ Tinst✝:Consistent Th:T 𝗚hp:_fvar.93 Theory.provabilityPred _fvar.93 (Book.gödel _fvar.93) := weakening inferInstance (provable_D1 _fvar.302)hn:_fvar.93 Theory.provabilityPred _fvar.93 (Book.gödel _fvar.93) := K!_left Book.gödel_spec⨀!_fvar.302False All goals completed! 🐙

And T \nvdash \lnot\mathsf{G} if \mathbb{N} \models T.

lemma gödel_irrefutable [ ⊧ₘ* T] : T 𝗚 := fun h T:Theory ℒₒᵣinst✝²:T.Δ₁inst✝¹:𝗜𝚺₁ Tinst✝: ⊧ₘ* Th:T 𝗚False T:Theory ℒₒᵣinst✝²:T.Δ₁inst✝¹:𝗜𝚺₁ Tinst✝: ⊧ₘ* Th:T 𝗚this:_fvar.93 Theory.provabilityPred _fvar.93 (Book.gödel _fvar.93) := CN!_of_CN!_left (K!_right Book.gödel_spec)⨀!_fvar.1028False T:Theory ℒₒᵣinst✝²:T.Δ₁inst✝¹:𝗜𝚺₁ Tinst✝: ⊧ₘ* Th:T 𝗚this✝:_fvar.93 Theory.provabilityPred _fvar.93 (Book.gödel _fvar.93) := CN!_of_CN!_left (K!_right Book.gödel_spec)⨀!_fvar.1028this:_fvar.93 Book.gödel _fvar.93 := provable_sound _fvar.5255False All goals completed! 🐙

Define formalized consistent statement \mathrm{Con}_T as \lnot\mathrm{Provable}_T(\ulcorner \bot \urcorner):

variable (T) noncomputable def consistent : Sentence ℒₒᵣ := local notation "𝗖𝗼𝗻" => consistent T

And, surprisingly enough, it can be proved that Gödel sentence \mathsf{G} is equivalent to the consistency statement.

variable {T} open Entailment FiniteContext lemma consistent_iff_goedel : T 𝗖𝗼𝗻 𝗚 := T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ TT 𝗖𝗼𝗻 𝗚 T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ TT 𝗖𝗼𝗻 𝗚T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ TT 𝗚 𝗖𝗼𝗻 T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ TT 𝗖𝗼𝗻 𝗚 T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ Tbew_G:[Book.gödel _fvar.306] ⊢[_fvar.306] Theory.provabilityPred _fvar.306 (Book.gödel _fvar.306) := FiniteContext.deductInv'! (CN!_of_CN!_left (K!_right Book.gödel_spec))T 𝗖𝗼𝗻 𝗚 have bew_not_bew_G : [𝗚] ⊢[T] (𝗚) := T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ TT 𝗖𝗼𝗻 𝗚 T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ Tbew_G:[Book.gödel _fvar.306] ⊢[_fvar.306] Theory.provabilityPred _fvar.306 (Book.gödel _fvar.306) := FiniteContext.deductInv'! (CN!_of_CN!_left (K!_right Book.gödel_spec))this:_fvar.306 Theory.provabilityPred _fvar.306 (Book.gödel _fvar.306 Theory.provabilityPred _fvar.306 (Book.gödel _fvar.306)) := weakening inferInstance (provable_D1 (K!_left Book.gödel_spec))[𝗚] ⊢[T] T.provabilityPred (T.provabilityPred 𝗚) All goals completed! 🐙 T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ Tbew_G:[Book.gödel _fvar.306] ⊢[_fvar.306] Theory.provabilityPred _fvar.306 (Book.gödel _fvar.306) := FiniteContext.deductInv'! (CN!_of_CN!_left (K!_right Book.gödel_spec))bew_not_bew_G:[Book.gödel _fvar.306] ⊢[_fvar.306] Theory.provabilityPred _fvar.306 (∼Theory.provabilityPred _fvar.306 (Book.gödel _fvar.306)) := ?_mvar.3469bew_bew_G:[Book.gödel _fvar.306] ⊢[_fvar.306] Theory.provabilityPred _fvar.306 (Theory.provabilityPred _fvar.306 (Book.gödel _fvar.306)) := provable_D3_context _fvar.2568T 𝗖𝗼𝗻 𝗚 T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ Tbew_G:[Book.gödel _fvar.306] ⊢[_fvar.306] Theory.provabilityPred _fvar.306 (Book.gödel _fvar.306) := FiniteContext.deductInv'! (CN!_of_CN!_left (K!_right Book.gödel_spec))bew_not_bew_G:[Book.gödel _fvar.306] ⊢[_fvar.306] Theory.provabilityPred _fvar.306 (∼Theory.provabilityPred _fvar.306 (Book.gödel _fvar.306)) := ?_mvar.3469bew_bew_G:[Book.gödel _fvar.306] ⊢[_fvar.306] Theory.provabilityPred _fvar.306 (Theory.provabilityPred _fvar.306 (Book.gödel _fvar.306)) := provable_D3_context _fvar.2568this:[Book.gödel _fvar.306] ⊢[_fvar.306] Theory.provabilityPred _fvar.306 := provable_D2_context (provable_D2_context (FiniteContext.of'! (weakening inferInstance (provable_D1 CNC!))) _fvar.3470) _fvar.4460T 𝗖𝗼𝗻 𝗚 All goals completed! 🐙 T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ TT 𝗚 𝗖𝗼𝗻 have : [] ⊢[T] 𝗚 := T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ TT 𝗖𝗼𝗻 𝗚 T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ Tthis:_fvar.306 Theory.provabilityPred _fvar.306 ( Book.gödel _fvar.306) := weakening inferInstance (provable_D1 efq!)[T.provabilityPred ] ⊢[T] T.provabilityPred 𝗚 exact provable_D2_context (of'! this) (T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ Tthis:_fvar.306 Theory.provabilityPred _fvar.306 ( Book.gödel _fvar.306) := weakening inferInstance (provable_D1 efq!)[T.provabilityPred ] ⊢[T] T.provabilityPred All goals completed! 🐙) T:Theory ℒₒᵣinst✝¹:T.Δ₁inst✝:𝗜𝚺₁ Tthis✝:[Theory.provabilityPred _fvar.306 ] ⊢[_fvar.306] Theory.provabilityPred _fvar.306 (Book.gödel _fvar.306) := ?_mvar.6543this:[Theory.provabilityPred _fvar.306 ] ⊢[_fvar.306] Book.gödel _fvar.306 := FiniteContext.of'! (CN!_of_CN!_right (K!_left Book.gödel_spec))⨀!_fvar.6544T 𝗚 𝗖𝗼𝗻 All goals completed! 🐙

Finally, combined with the fact that \mathsf{G} is independent, we can prove that the consistency statement is also independent.

theorem consistent_unprovable [Consistent T] : T 𝗖𝗼𝗻 := fun h gödel_unprovable <| K!_left consistent_iff_goedel h theorem inconsistent_unprovable [ ⊧ₘ* T] : T 𝗖𝗼𝗻 := fun h gödel_irrefutable <| contra! (K!_right consistent_iff_goedel) h
🔗theorem
LO.FirstOrder.Arithmetic.consistent_unprovable (T : Theory ℒₒᵣ) [T.Δ₁] [𝗜𝚺₁ T] [Consistent T] : T T.consistent
LO.FirstOrder.Arithmetic.consistent_unprovable (T : Theory ℒₒᵣ) [T.Δ₁] [𝗜𝚺₁ T] [Consistent T] : T T.consistent

Gödel's second incompleteness theorem

🔗theorem
LO.FirstOrder.Arithmetic.inconsistent_independent (T : Theory ℒₒᵣ) [T.Δ₁] [𝗜𝚺₁ T] [ArithmeticTheory.SoundOnHierarchy T 𝚺 1] : Independent T T.consistent
LO.FirstOrder.Arithmetic.inconsistent_independent (T : Theory ℒₒᵣ) [T.Δ₁] [𝗜𝚺₁ T] [ArithmeticTheory.SoundOnHierarchy T 𝚺 1] : Independent T T.consistent

The consistency statement is independent.