lean4-logic

This project is aim to formalize some various results of mathematical logic in Lean Theorem Prover.

This book provides explanation and summaries of formalized concepts, theorems, propositions. Proofs of them are not explained, refer to the code or the references.

Full documentation is here.

Main Results

Classical Propositional Logic

First-Order Logic

The list of main formalized results in first-order (Predicate) logics.

Superintuitionistic Propositional Logic

The list of main formalized results in superintuitionistic propositional logics.

Standard Modal Logic

The list of main formalized in standard modal logics.

Import Graph

Generated by import-graph

Foundation

Import Graph

PDF version

Arithmetization

Import Graph

PDF version

Incompleteness

Import Graph

PDF version

Usage

Add following to lakefile.lean.

require logic from git "https://github.com/FormalizedFormalLogic/Foundation"

Contributing

Discuss

GitHub Discussion is here. Feel free to correct mistakes, ask questions or share ideas.

Documentation

To compile this book, you need mdbook and some plugins.

mdbook serve md

mdbook build md

But you don't have to install to simply correct mistakes and write documents, since it can be previewed by your editor's markdown preview.

Developing

VSCode settings

Some notation is not prepared default by lean 4 extension for VSCode. Here is example .vscode/settings.json.

{
  "lean4.input.customTranslations": {
    "cand": "⋏",
    "cor": "⋎",
    "boxdot": "⊡",
    "^F": "ꟳ"
  }
}

References and Related Works

References

  • J. Han, F. van Doorn, A formalization of forcing and the unprovability of the continuum hypothesis
  • W. Pohlers, Proof Theory: The First Step into Impredicativity
  • P. Hájek, P. Pudlák, Metamathematics of First-Order Arithmetic
  • R. Kaye, Models of Peano arithmetic
  • 田中 一之, ゲーデルと 20 世紀の論理学
  • 菊池 誠 (編者), 『数学における証明と真理 ─ 様相論理と数学基礎論』
  • P. Blackburn, M. de Rijke, Y. Venema, "Modal Logic"
  • Open Logic Project, "The Open Logic Text"
  • R. Hakli, S. Negri, "Does the deduction theorem fail for modal logic?"
  • G. Boolos, "The Logic of Provability"
  • M. C. Fitting, V. W. Marek, and M. Truszczynski, "The Pure Logic of Necessitation"
  • T. Kurahashi, "The provability logic of all provability predicates"
  • W. Carnielli, C. Pizzi, "Modalities and Multimodalities"

Here is the list of project particularly formalize mathematical logics. If you find something missing from this list or add, report via issues.

Lean 4

m4lvin/lean4-pdl

Propositional dynamic logics.

alexoltean61/hybrid_logic_lean

Hybrid logic. Syntax and semantics for hybrid logic are provided, and some facts and soundness have been proven. However completeness seems to have been not yet formalized.

leanprover-community/con-nf

Formalizing the consistency of Quine's set theory "New Foundations": .

Lean 3

flypitch

Independence of the continuum hypothesis.

bbentzen/ipl

Intuitionistic propositional logic.

Hilbert-style deduction system, Kripke semantics and Henkin-style (constructing maximal prime set and canonical model) completeness proof.

bbentzen/mpl

Normal modal logic.

Hilbert-style deduction system, Kripke semantics and Henkin-style (constructing maximal consistent set and canonical model) completeness proof for .

paulaneeley/modal

Formalization of modal logic and public announcement logic.

minchaowu/ModalTab

Tableaux system for modal logic .

ljt12138/Formalization-PAL

and public announcement logic (PAL). Main result are recursion theorem (reducing public announce modality for any PAL formula) and completeness of .

Isabelle

Lawrence C. Paulson, "Gödel's Incompleteness Theorems"

Formalized Gödel's first and second incompleteness theorems. Remark the second incompleteness theorem is proved on hereditarily finite sets.

Christoph Benzmüller, Woltzenlogel Paleo, "Gödel's God in Isabelle/HOL"

Gödel's ontological argument of God's existence.

jrh13/hol-light/GL

Completeness of Gödel-Löb (provability) modal logic in HOL/Light.

u5943321/Modal-Logic

Modal Logic, based on textbook "Modal Logic" by P. Blackburn, M. de Rijke, Y. Venema in HOL.

Coq

ianshil/PhD_thesis

Coq formalization of several modal logics (related provability logic and etc.) and their caliculi.

hferee/UIML

Uniform interpolants for basic modal logic , Gödel-Löb provability logic , intuitionistic strong Löb logic .

ana-borges/QRC1-Coq

Quantified modal logic called Quantified Reflection Calculus with one modality .

Christian Doczkal, Gert Smolka, "Completeness and decidability of converse PDL in the constructive type theory of Coq"

Propositional Dynamic Logic.

Christian Doczkal, Gert Smolka, "Constructive Formalization of Hybrid Logic with Eventualities"

Hybrid Logic.

Russell O'Connor's continuous works on Incompleteness Theorem

fondefjobn/S5-Formalization-in-Coq

Modal logic , its Kripke completeness.

Floris van Doorn, "Propositional Calculus in Coq"

Hilbert deduction system, natural deduction system, and sequent calculus for classical propositional logic. Formalized completeness of natural deduction system, the provability equivalence of three calculi, cut-elimination for sequent calculus.

Christoph Benzmüller, Bruno Woltzenlogel Paleo, "Interacting with Modal Logics in the Coq Proof Assistant"

Modal logic and Gödel's ontological argument of existence of God.

mphilipse/coq-multi-agent-systems

Multi-agent epistemic modal logic .

Iris Project

Framework for concurrent saparation logic. Verified in Coq.

Definitions and Notations

TODO:

Computability

TODO:

Classical Propositional Logic

Syntax and Semantics for Classical Propositional Logic

Deduction System

We adupt the Tait-calculus as a deduction system of classical propositional logic.

  abbrev Sequent (α : Type*) := List (Formula α)

  inductive Derivation : Sequent α → Type _
  | axL (Δ a)   : Derivation (Formula.atom a :: Formula.natom a :: Δ)
  | verum (Δ)   : Derivation (⊤ :: Δ)
  | or {Δ p q}  : Derivation (p :: q :: Δ) → Derivation (p ⋎ q :: Δ)
  | and {Δ p q} : Derivation (p :: Δ) → Derivation (q :: Δ) → Derivation (p ⋏ q :: Δ)
  | wk {Δ Γ}    : Derivation Δ → Δ ⊆ Γ → Derivation Γ
  | cut {Δ p}   : Derivation (p :: Δ) → Derivation (~p :: Δ) → Derivation Δ

  instance : OneSided (Formula α) := ⟨Derivation⟩

Semantics

Soundness and Completeness

The soundness theorem is proved by induction of derivation.

  instance (T : Theory α) : Sound T (Semantics.models (Valuation α) T)

The conpleteness theorem is also proved by constructing maximal consistent theory.

  instance (T : Theory α) : Complete T (Semantics.models (Valuation α) T)

First-Order Logic

TODO:

Term and Formula

Notation

Quantification of formulae are defined using de Bruijn index, but we can write terms and formulae by usual binder notation using macro.

variables x y z is just an example and can take any number of idents. e is an expression of term/formula.

Binder Notation

Binder notation of term takes either form:

  • Term: ‘x y z | e’, Formula: “x y z | e”
    • x y z is the symbol for the bound variables, k:num-variables denotes the terms in Semiterm L ξ (n + $k)/Semiformula L ξ (n + $k). (n can be variable)
  • Term: ‘e’, Formula: “e”
    • An abbreviation of ‘ | e’/“ | e”

Expression of term/formula

Deduction System for First-Order Logic

Semantics for First-Order Logic

Completeness Theorem

Arithmetics

In this formalization, we prefer developing arithmetic model theoretic, i.e. show instead of (They are equivalent thanks to the completeness theorem.). This approach has several advantages:

  1. In general, writing a formalized proof (in formalized system!) is very tedious. Meta-proofs, on the other hand, tend to be relatively concise.
  2. Many definitions and proofs of logic and algebra in Mathlib can be used.
  3. Metaprogramming can streamline the proof process (especially definability).
  4. It is easy to extend predicates and functions. When adding predicates or functions, it is necessary to extend its language by extension by definition in case of formalized proof, but not in model theoretic approach.

This procedure is done as follows. Suppose we wish to prove that the totality of an exponential function can be proved in . First, the graph of the exponential function must be defined. This is achieved by the following two definitions.

  1. Semantic definition.

    def Exponential {M : Type*} [Zero M] [One M] [Add M] [Mul M] [LT M] [M ⊧ₘ* 𝐈𝚺₀] :
        M → M → Prop
    
  2. Syntactic definition that expresses the semantic definition.

    def exponentialDef : 𝚺₀-Semisentence 2
    
        lemma Exponential.defined :
            𝚺₀-Relation (Exponential : M → M → Prop) via exponentialDef
        ```
    
    Then prove the totality.
    
theorem Exponential.total  {M : Type*} [Zero M] [One M] [Add M] [Mul M] [LT M] [M ⊧ₘ* 𝐈𝚺₀] (x : M) : ∃ y, Exponential x y

Since Exponential and Exponential.total are defined in all the model of , 𝐈𝚺₁ ⊢! ∀' ∃' exponentialDef is obtained by the completeness theorem. This was the result we wanted to achieve.

Defined Predicates and Functions

Predicate/FunctionNotationDefined inTotality is proved inComplexityPolynomial Bound
0
1
x + y
x * y
x = y--
x < y--
x ≤ y--
(modified subtraction)x - y
(devides)x ∣ y--
min x y
max x y
x / y
(remainder)x % y
√x
⟪x, y⟫
(first inversion of pairing)π₁ x
(second inversion of pairing)π₂ x
exp xnone
log x
(binary length)‖x‖
x # ynone
(number of ones)nuon x
, x ∈ y--
x ⊆ y--
⋃ʰᶠ xnone
x ∪ y
⋂ʰᶠ x?
x ∩ y
(cartesian product)x ×ʰᶠ y?
(domain of relation)domain x
IsMapping x--
Seq x--
(length of sequence)lh x
(concatation of sequence)x ⁀' ynone
(-th element of sequence)znth x
L.Semiterm x y--
L.termSubst n m w tnone
L.Semiformula x y--

Theories of Arithmetics

NotationDescription
𝐏𝐀⁻Finitely axiomatized fragment of
𝐈open + Induction of open formula
𝐈𝚺₀ + Induction of formulaTheory
𝐈𝚺₀ + Ω₁ + -axiom
𝐄𝐀Elementary arithmetic
𝐈𝚺₁ + Induction of formulaTheory
𝐏𝐀Peano arithmetic

Theory

These results are included in Arithmetization.

Exponential

The graph of exponential is definable by -fomrula, and its inductive properties are proved in .

instance exponential_definable [M ⊧ₘ* 𝐈𝚺₀] : 𝚺₀-Relation (Exponential : M → M → Prop)

Import Graph

lemma exponential_zero_one [M ⊧ₘ* 𝐈𝚺₀] :
    Exponential 0 1
lemma exponential_succ_mul_two [M ⊧ₘ* 𝐈𝚺₀] {x y : M} :
    Exponential (x + 1) (2 * y) ↔ Exponential x y

Other basic functions, such as are defined by using exponential.

Theory

These results are included in Arithmetization.

Exponential

It is proved that the graph of exponential is definable by -formula, and their inductive properties are provable in . In , we can further prove their entireness.

Theory of Hereditary Finite Sets in

Weak theory of sets in (Hereditary Finite Sets) can be developed inside using Ackermann coding and bit predicate. Hereafter, we will use the notation in the sense of bit predicate:

lemma mem_iff_bit [M ⊧ₘ* 𝐈𝚺₁] {i a : M} : i ∈ a ↔ Bit i a

The following comprehension holds.

theorem finset_comprehension₁ [M ⊧ₘ* 𝐈𝚺₁]
    {P : M → Prop} (hP : (Γ, 1)-Predicate P) (a : M) :
    ∃ s < exp a, ∀ i < a, i ∈ s ↔ P i

The basic concepts of set theory, such as union, inter, cartesian product, and mapping, etc. are defined.

Seq

iff is a mapping and its domain is for some .

def Seq [M ⊧ₘ* 𝐈𝚺₁] (s : M) : Prop := IsMapping s ∧ ∃ l, domain s = under l

Primitive Recursion

Let , be a -function. There is a -function such that:

structure Formulae (k : ℕ) where
  zero : 𝚺₁-Semisentence (k + 1)
  succ : 𝚺₁-Semisentence (k + 3)

structure Construction {k : ℕ} (p : Formulae k) where
  zero : (Fin k → M) → M
  succ : (Fin k → M) → M → M → M
  zero_defined : DefinedFunction zero p.zero
  succ_defined : DefinedFunction (fun v ↦ succ (v ·.succ.succ) (v 1) (v 0)) p.succ

variable {k : ℕ} {p : Formulae k} (c : Construction M p) (v : Fin k → M)

def Construction.result (u : M) : M

theorem Construction.result_zero :
    c.result v 0 = c.zero v

theorem Construction.result_succ (u : M) :
    c.result v (u + 1) = c.succ v u (c.result v u)

Fixpoint

Let be a predicate, which takes a class as a parameter. Then there is a -predicate such that

if satisfies following conditions:

  1. is -definable if is a set. i.e., a predicate is -definable.
  2. Monotone: and implies .
  3. Finite: implies the existence of a s.t. .
structure Blueprint (k : ℕ) where
  core : 𝚫₁-Semisentence (k + 2)

structure Construction (φ : Blueprint k) where
  Φ : (Fin k → M) → Set M → M → Prop
  defined : Arith.Defined (fun v ↦ Φ (v ·.succ.succ) {x | x ∈ v 1} (v 0)) φ.core
  monotone {C C' : Set M} (h : C ⊆ C') {v x} : Φ v C x → Φ v C' x

class Construction.Finite (c : Construction M φ) where
  finite {C : Set M} {v x} : c.Φ v C x → ∃ m, c.Φ v {y ∈ C | y < m} x

variable {k : ℕ} {φ : Blueprint k} (c : Construction M φ) [Finite c] (v : Fin k → M)

def Construction.Fixpoint (x : M) : Prop

theorem Construction.case :
    c.Fixpoint v x ↔ c.Φ v {z | c.Fixpoint v z} x

is if satisfies strong finiteness:

class Construction.StrongFinite (c : Construction M φ) where
  strong_finite {C : Set M} {v x} : c.Φ v C x → c.Φ v {y ∈ C | y < x} x

Also structural induction holds.

theorem Construction.induction [c.StrongFinite]
    {P : M → Prop} (hP : (Γ, 1)-Predicate P)
    (H : ∀ C : Set M, (∀ x ∈ C, c.Fixpoint v x ∧ P x) → ∀ x, c.Φ v C x → P x) :
    ∀ x, c.Fixpoint v x → P x

Gödel's First Incompleteness Theorem

A deduction system is complete iff it can prove or refute every sentence . Otherwise, is incomplete.

def System.Complete {F S} [System F S] [LogicalConnective F] (𝓢 : S) : Prop :=
    ∀ f, 𝓢 ⊢! f ∨ 𝓢 ⊢! ~f

Theorem

Let be a -definable arithmetic theory, stronger than and -sound.

Representeation Theorem

Theorem: Let be a r.e. set. Then, there exists a formula such that for all .

lemma re_complete
    [𝐑₀ ≼ T] [Sigma1Sound T]
    {p : ℕ → Prop} (hp : RePred p) {x : ℕ} :
    p x ↔ T ⊢! ↑((codeOfRePred p)/[‘↑x’] : Sentence ℒₒᵣ) 

Main Theorem

Theorem: -sound and -definable first-order theory, which is stronger than , is incomplete.

  • Proof.

    Define a set of formulae with one variable. is r.e. since is -definable. (one could use Craig's trick to weaken this condition to , but I will not do that here.)

    By the representation theorem, there exists a formula that represents . i.e.,

    Let . The next follows immediately.

    Thus, as is consistent, is undecidable from . ∎

theorem goedel_first_incompleteness
  (T : Theory ℒₒᵣ) [𝐑₀ ≼ T] [Sigma1Sound T] [T.Delta1Definable] :
  ¬System.Complete T

Gödel's Second Incompleteness Theorem

Recall that inside we can do basic set theory and primitive recursion. Many inductive notions and functions on them are defined in or using the fixpoint construction.

We work inside an arbitrary model of .

Coding of Terms and Formulae

Term

Define as follows.

is a quasi-quotation.

is (if is a finite set) and monotone. Let be a fixpoint of . It is since satisfies strong finiteness. Define the function inductively on meaning the largest bounded variable that appears in the term. Define .

Formula

Similarly, Define :

is and monotone. Let be a fixpoint of and define

The function is defined inductively on meaning the largest bounded variable that appears in the formula.

and are again since satisfies strong finiteness.

Formalized Provability

Let be -definable theory. Define :

is a shift of a formula . is a image of shift of . Take fixpoint .

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

  • Sound:
    lemma LO.Arith.Language.Theory.Provable.sound :
        (T.codeIn ℕ).Provable ⌜p⌝ → T ⊢! p 
    
  • D1:
    theorem LO.Arith.provable_of_provable :
        T ⊢! p → (T.codeIn V).Provable ⌜p⌝ 
    
  • D2:
  • Formalized -completeness: Let be a -sentence.
    theorem LO.Arith.sigma₁_complete (hσ : Hierarchy 𝚺 1 σ) :
        V ⊧ₘ₀ σ → T.Provableₐ (⌜σ⌝ : V)
    

Now assume that is a theory of arithmetic stronger than and be a theory of arithmetic stronger than . The following holds, thanks to the completeness theorem.

Second Incompleteness Theorem

Assume that is -definable and stronger than .

Fixpoint Lemma

Since the substitution is , There is a formula such that, for all formula with only one variable and ,

holds. (overline denotes the (formalized) numeral of )

Define a sentence for formula (with one variable) as follows.

Lemma:

  • Proof.
theorem LO.FirstOrder.Arith.diagonal (θ : Semisentence ℒₒᵣ 1) :
    T ⊢!. fixpoint θ ⭤ θ/[⌜fixpoint θ⌝]

Main Theorem

Define Gödel sentence :

Lemma: Gödel sentence is undecidable, i.e., if is consistent, and if .

lemma goedel_unprovable
    (T : Theory ℒₒᵣ) [𝐈𝚺₁ ≼ T] [T.Delta1Definable] [System.Consistent T] :
    T ⊬ ↑𝗚

lemma not_goedel_unprovable
    (T : Theory ℒₒᵣ) [𝐈𝚺₁ ≼ T] [T.Delta1Definable] [ℕ ⊧ₘ* T] :
    T ⊬ ∼↑𝗚

Define formalized incompleteness sentence :

Lemma:

lemma consistent_iff_goedel
    (T : Theory ℒₒᵣ) [𝐈𝚺₁ ≼ T] [T.Delta1Definable] :
    T ⊢! ↑𝗖𝗼𝗻 ⭤ ↑𝗚

Theorem: cannot prove its own consistency, i.e., if is consistent. Moreover, is undecidable from if .

theorem goedel_second_incompleteness
    (T : Theory ℒₒᵣ) [𝐈𝚺₁ ≼ T] [T.Delta1Definable] [System.Consistent T] :
    T ⊬ ↑𝗖𝗼𝗻 

theorem inconsistent_undecidable
    (T : Theory ℒₒᵣ) [𝐈𝚺₁ ≼ T] [T.Delta1Definable] [ℕ ⊧ₘ* T] :
    System.Undecidable T ↑𝗖𝗼𝗻

Interpretation

Superintuitionistic Logic

Intuitionistic Logic is defined roughly that classical logic without law of excluded middle.

And superintuitionistic logic is some axioms add to intuitionistic logic.

Axioms

NotationSchemaName
𝗘𝗙𝗤⊥ ⟶ pEx Falso Quodlibet or Law of Explosion
𝗗𝗡𝗘~~p ⟶ pDouble Negation Elimination
𝗟𝗘𝗠p ⋎ ~pLaw of Excluded Middle
𝘄𝗟𝗘𝗠~p ⋎ ~~pWeak Law of Excluded Middle
𝗣𝗲((p ⟶ q) ⟶ p) ⟶ pPeirce's Law
𝗚𝗗(p ⟶ q) ⋎ (q ⟶ p)Gödel-Dummett Axiom

Deduction System

Our Hilbert-style deduction system for propositional logic is designed to take parameters. These parameters are as follows.

structure DeductionParameter (α) where
  axiomSet : AxiomSet α
  • axiomSet is set of formulas (axioms), For example, 𝗘𝗙𝗤, 𝗘𝗙𝗤 ∪ 𝗟𝗘𝗠.

In this formalization, logics that we usually refer to as (Intuitionistic Propositional Logic), (Classical Propositional Logic), etc. is characterized by deduction parameter.

Well-Known Systems

NameNotationAxioms
Minimal
Intuitionistic𝐈𝐧𝐭𝗘𝗙𝗤
Classical𝐂𝐥𝗘𝗙𝗤 ∪ 𝗟𝗘𝗠

Glivenko's Theorem

If is provable in classical logic, double negation inserted is provable in intuitionistic logic.

theorem iff_provable_dn_efq_dne_provable: 𝐈𝐧𝐭 ⊢! ~~p ↔ 𝐂𝐥 ⊢! p

Kripke Semantics

TODO:

Soundness for Kripke Semantics

instance : Sound 𝓓 𝔽(Ax(𝓓))

Completeness for Kripke Semantics

Standard completeness proof using canonical models, etc.

instance : Complete 𝐈𝐧𝐭 𝔽(Ax(𝐈𝐧𝐭))

Rejection Law of Excluded Middle

Law of Excluded Middle (LEM) is not always provable in intuitionistic logic.

theorem noLEM : ∃ (p : Formula α), 𝐈𝐧𝐭 ⊬! p ⋎ ~p := by

Thus, intuitionistic logic is proper weaker than classical logic, since LEM is always provable in classical logic.

theorem strictReducible_intuitionistic_classical : 𝐈𝐧𝐭 <ₛ 𝐂𝐥

Disjunctive Property

Intuitionistic Logic have Disjunctive Property (DP).

class Disjunctive (𝓢 : S) : Prop where
  disjunctive : ∀ {p q}, 𝓢 ⊢! p ⋎ q → 𝓢 ⊢! p ∨ 𝓢 ⊢! q

instance : Disjunctive 𝐈𝐧𝐭

Standard Modal Logic

As a general term for various modal logics commonly known as , , etc., we refer to the logic defined on a language that includes the modal operators (Box) and (Diamond), where is defined as the dual of (i.e., ), as Standard Modal Logic1.

Be cautious similar notations for different concepts. We use notation for concept that unrelated to our formalization, and code block `` for related our formalization.

  • (\sf K) is axiom schema unrelated to formalization.
  • (\bf K) is logic unrelated to formalization.
  • 𝗞 (Mathematical Sans-Serif Bold) is AxiomSet in formalization.
  • 𝐊 (Mathematical Bold Capital) is DeductionParameter in formalization.
1

This term is probably not usual. We introducing for convenience in naming and organizing within our formalization.

Axioms

As an example, describe about axiom . Other axioms such as and follow the same manner.

-- Axiom schema
abbrev System.Axioms.K (p q : F) := □(p ⟶ q) ⟶ □p ⟶ □q

abbrev Modal.Standard.AxiomSet (α : Type*) := Set (Modal.Standard.Formula α)

abbrev Modal.Standard.AxiomSet.K : AxiomSet α := { System.Axioms.K p q | (p) (q) }

notation "𝗞" => Modal.Standard.AxiomSet.K

Well-Known Axioms

NotationNameSchemaGeach
𝗞K□(p ⟶ q) ⟶ □p ⟶ □q
𝗧T□p ⟶ p
𝗕Bp ⟶ □◇p
𝗗D□p ⟶ ◇p
𝟰Four□p ⟶ □□p
𝟱Five◇p ⟶ □◇p
.𝟮Dot2◇□p ⟶ □◇p
.𝟯Dot3□(□p ⟶ □q) ⋎ □(□q ⟶ □p)
𝗟L□(□p ⟶ p) ⟶ □p
𝗚𝗿𝘇Grz□(□(p ⟶ □p) ⟶ p) ⟶ p
𝗧𝗰Tcp ⟶ □p
𝗩𝗲𝗿Ver□p
𝗖𝟰C4□□p ⟶ □p
𝗖𝗗CD◇p ⟶ □p
𝗠M□◇p ⟶ ◇□p

Geach Axioms

Geach Axiom is defined as .

structure Geach.Taple where
  i : ℕ
  j : ℕ
  m : ℕ
  n : ℕ

abbrev Geach (l : Geach.Taple) (p : F) := ◇^[l.i](□^[l.m]p) ⟶ □^[l.j](◇^[l.n]p)
notation "𝗴𝗲(" t ")" => AxiomSet.Geach t

Some axioms is generalized as Geach axioms (Above table, Geach: ✅). For example and .

Deduction System for Modal Logic

Our Hilbert-style deduction system for modal logic is designed to take parameters. These parameters are as follows.

structure DeductionParameter (α) where
  axiomSet : AxiomSet α
  nec : Bool
  • axiomSet is set of formulas (axioms), For example, 𝗞, 𝗞 ∪ 𝗧 ∪ 𝟰.
  • nec is flag to contain necessitation rule.

The parameter is called Normal if axiomSet includes 𝗞 and nec is true.

In this formalization, modal logics that we usually refer to as , , etc. is characterized by deduction parameter.

Geach Logic

def AxiomSet.MultiGeach : List Axioms.Geach.Taple → AxiomSet α
  | [] => 𝗞
  | x :: xs => (AxiomSet.Geach x) ∪ (AxiomSet.MultiGeach xs)
notation "𝗚𝗲(" l ")" => AxiomSet.MultiGeach l

def DeductionParameter.Geach (l : List Axioms.Geach.Taple) : DeductionParameter α where
  axiomSet := 𝗚𝗲(l)
  nec := true
notation "𝐆𝐞(" l ")" => DeductionParameter.Geach l

If 𝓓 is some 𝐆𝐞(l), 𝓓 is called Geach.

class IsGeach (𝓓 : DeductionParameter α) where
  taples : List Axioms.Geach.Taple
  char : 𝓓 = 𝐆𝐞(taples)

Soundness for Kripke Semantics

Let deduction system of 𝓓 has necessitation. If 𝓓 ⊢! p then p is valid on every frame in 𝔽(Ax(𝓓)).

instance [HasNec 𝓓] : Sound 𝓓 𝔽(Ax(𝓓))

Consistency of Deduction System via Kripke Semantics

From soundness theorem, if 𝔽(Ax(𝓓)) is nonempty, deduction system of 𝓓 is consistent (i.e. not every formula is provable in 𝓓).

instance [FrameClass.IsNonempty 𝔽(Ax(𝓓))] : System.Consistent 𝓓

It is immediately apparent, frameclass of 𝔽(Ax(𝐊)) is nonempty, thus 𝐊 is consistent.

instance : FrameClass.IsNonempty 𝔽(Ax(𝐊))

instance : System.Consistent 𝐊

Futhermore, if 𝓓 is Geach, then its frameclass is nonempty, thus it is consistent.

instance [𝓓.IsGeach] : FrameClass.IsNonempty 𝔽(Ax(𝓓))

instance [𝓓.IsGeach] : System.Consistent 𝓓

Completeness for Kripke Semantics

Completeness for Kripke Semantics (shortly called, Kripke Completeness) proved by usual way with Canonical frames and models.

If every axioms in Ax(𝓓) is valid in Canonical frame of 𝓓, 𝓓 is called Canonical.

class Canonical (𝓓 : DeductionParameter α) [Inhabited (MCT 𝓓)] where
  realize : (CanonicalFrame 𝓓) ⊧* Ax(𝓓)

If 𝓓 is canonical and consistent, then 𝓓 is complete for 𝔽(Ax(𝓓)).

instance [System.Consistent 𝓓] [Canonical 𝓓] : Complete 𝓓 𝔽(Ax(𝓓))

Immediately apparent that 𝐊 is canonical and 𝐊 is consistent mentioned above, then 𝐊 is complete.

instance : Canonical 𝐊

instance : Complete 𝐊 𝔽(Ax(𝐊))

Futhermore, if 𝓓 is Geach, then 𝓓 is canonical, thus it is complete.

instance [𝓓.IsGeach] : Canonical 𝓓

instance [𝓓.IsGeach] : Complete 𝓓 𝔽(Ax(𝓓))

On Gödel-Löb Logic

Logics Equivalent to GL

Let's introduce Henkin Axiom 𝗛, Löb Rule (𝐋), Henkin Rule (𝐇).

protected abbrev H := □(□p ⟷ p) ⟶ □p

class LoebRule where
  loeb {p : F} : 𝓢 ⊢ □p ⟶ p → 𝓢 ⊢ p

class HenkinRule where
  henkin {p : F} : 𝓢 ⊢ □p ⟷ p → 𝓢 ⊢ p
  • 𝐊𝟒𝐇 is defined normal logic that axioms are 𝗞, 𝟰, 𝗛.
  • 𝐊𝟒(𝐋) is defined as 𝐊𝟒 extended (𝐋).
  • 𝐊𝟒(𝐇) is defined as 𝐊𝟒 extended (𝐇).

These logics are equivalent to 𝐆𝐋.

lemma reducible_GL_K4Loeb : 𝐆𝐋 ≤ₛ 𝐊𝟒(𝐋)
lemma reducible_K4Loeb_K4Henkin: 𝐊𝟒(𝐋) ≤ₛ 𝐊𝟒(𝐇)
lemma reducible_K4Henkin_K4H : 𝐊𝟒(𝐇) ≤ₛ 𝐊𝟒𝐇
lemma reducible_K4Henkin_GL : 𝐊𝟒𝐇 ≤ₛ 𝐆𝐋

--- Obviously `𝐆𝐋 =ₛ 𝐊𝟒(𝐋) =ₛ 𝐊𝟒(𝐇) =ₛ 𝐊𝟒𝐇`, since transitivity of `≤ₛ` and definition of `=ₛ`.

Note: 𝐊𝐇 (normal logic that axioms are 𝗞, 𝗛) is proper weak logic of 𝐆𝐋 and not Kripke complete.

Frame Definability of GL

Strength between Logics

It is immediately apparent that, when 𝓓₁​ and 𝓓₂ are same inference rule1, the logical strength between 𝓓₁ and 𝓓₂ is determined by the subset of their axiom set.

lemma reducible_of_subset (hNec : L₁.nec ≤ L₂.nec) (hAx : Ax(L₁) ⊆ Ax(L₂)) : L₁ ≤ₛ L₂ := by

lemma reducible_K_KT : 𝐊 ≤ₛ 𝐊𝐓

However, even without the subset of axiomset, it is possible to analyze the strength of logic via Kripke semantics, specifically by analyzing the properties of frames defined by the axioms. For example, since seriality follows from reflexivity, is stronger than ().

lemma reducible_of_definability
  [Sound 𝓓₁​ 𝔽(Ax(𝓓₁​))] [Complete 𝓓₂ 𝔽(Ax(𝓓₂))]
  [Definability Ax(𝓓₁​) P₁] [Definability Ax(𝓓₂) P₂]
  (hs : ∀ {F : Frame}, P₂ F → P₁ F)
  : 𝓓₁​ ≤ₛ 𝓓₂

theorem reducible_KD_KT : 𝐊𝐃 ≤ₛ 𝐊𝐓

By same argument, the equivalence of provability between logics can be analyzed. is equivalent to ().

lemma equiv_of_iff_definability
  [Sound 𝓓₁​ 𝔽(Ax(𝓓₁​))] [Sound 𝓓₂ 𝔽(Ax(𝓓₂))]
  [Complete 𝓓₁​ 𝔽(Ax(𝓓₁​))] [Complete 𝓓₂ 𝔽(Ax(𝓓₂))]
  [Definability Ax(𝓓₁​) P₁] [Definability Ax(𝓓₂) P₂]
  (h : ∀ {F : Frame}, P₁ F ↔ P₂ F) : 𝓓₁​ =ₛ 𝓓₂

theorem equiv_S5_KT4B : 𝐒𝟓 =ₛ 𝐊𝐓𝟒𝐁
1

It is permissible that 𝓓₂ has all inference rule of 𝓓₁​.

Undefinability of Frame Property

There is no axiom set that irreflexivity of frame defines. In other words, as long as the inference rule of 𝓓 is only necessitation, no matter what axiom sets of 𝓓 has, deduction system of 𝓓 cannot be represent irreflexive Kripke frame.

theorem Kripke.undefinability_irreflexive : ¬∃ (Ax : AxiomSet α), (∀ {F : Frame}, (Irreflexive F.Rel) ↔ F ⊧* Ax)

Modal Companion

Gödel-McKensey-Tarski Theorem

Through a translation called Gödel Translation from propositional logic formula to modal logic formula, intuitionistic logic can be embedded into . (This theorem is known as Gödel-McKensey-Tarski Theorem.)

def GoedelTranslation : Superintuitionistic.Formula α → Formula α

postfix:75 "ᵍ" => GoedelTranslation

theorem provable_efq_iff_provable_S4
  {p : Superintuitionistic.Formula α}
  : 𝐈𝐧𝐭 ⊢! p ↔ 𝐒𝟒 ⊢! pᵍ

The generalized version of this relationship is called Modal Companion. has modal companion.

class ModalCompanion (i𝓓 : Superintuitionistic.DeductionParameter α) (m𝓓 : Modal.Standard.DeductionParameter α) where
  companion : ∀ {p : Superintuitionistic.Formula α}, i𝓓 ⊢! p ↔ m𝓓 ⊢! pᵍ

instance : ModalCompanion 𝐈𝐧𝐭 𝐒𝟒