Natural deduction for propositional logic #
We define, for minimal logic, deduction trees (a Type) and derivability (a Prop) relative to a
Theory (set of propositions).
Main definitions #
Sequent: a pair of a context and conclusion.Derivation: natural deduction derivation, done in "sequent style", ie with explicit hypotheses at each step. Contexts areFinset's of propositions, which avoids explicit contraction and exchange, and the axiom rule derivesΓ ⊢ Afor any contextΓwithA ∈ Γ, allowing weakening to be a derived rule. The derivation may appeal to hypotheses from theTheory T. This defines an instance ofInferenceSystem T Sequent.Theory.equiv:Type-valued equivalence of propositions.Theory.Equiv:Prop-valued equivalence of propositions.
Main results #
Derivation.weak: weakening as a derived rule.Derivation.cut,Derivation.subs: replace a hypothesis in a derivation — the two versions differ in the construction of the relevant derivation.Theory.equiv_equivalence: equivalence of propositions is an equivalence relation.
Notation #
The sequent ⟨Γ, A⟩ is notated Γ ⊢ A, so that a derivation using axioms from a theory T is
noted T⇓(Γ ⊢ A). We define also an InferenceSystem T (Proposition Atom), so that T⇓A
abbreviates a derivation of A in the empty context: T⇓(∅ ⊢ A).
Implementation notes #
We formalise here a single type of derivations, meaning there is a single collection of inference
rules (those for minimal logic). The extension to intuitionistic and classical logic are modelled
by adding axioms --- for instance, intuitionistic derivations are allowed to appeal to axioms of
the form ⊥ → A for any proposition A. This differs from many on-paper presentations, which add
that principle as a deduction rule: from Γ ⊢ ⊥ derive Γ ⊢ A. Discussion on proper way to
capture such developments in cslib is ongoing, see the following
zulip discussion.
References #
- Dag Prawitz, Natural Deduction: a proof-theoretical study.
- The sequent-style natural deduction I present here doesn't seem to be common, but it is tersely presented in §10.4 of Troelstra & van Dalen's Constructivism in Mathematics: an introduction, and in §2.2 of Sorensen & Urzyczyn's Lectures on the Curry-Howard Isomorphism. (Suggestions of better references welcome!)
Contexts are finsets of propositions.
Equations
- Cslib.Logic.PL.Ctx Atom = Finset (Cslib.Logic.PL.Proposition Atom)
Instances For
Map a context along a substitution.
Equations
- Cslib.Logic.PL.Ctx.subst f = Finset.image fun (x : Cslib.Logic.PL.Proposition Atom) => x >>= f
Instances For
Sequents {A₁, ..., Aₙ} ⊢ B.
Equations
Instances For
Sequents {A₁, ..., Aₙ} ⊢ B.
Equations
- Cslib.Logic.PL.«term_⊢_» = Lean.ParserDescr.trailingNode `Cslib.Logic.PL.«term_⊢_» 1022 60 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊢ ") (Lean.ParserDescr.cat `term 0))
Instances For
A T-derivation of {A₁, ..., Aₙ} ⊢ B demonstrates B using (undischarged) assumptions among Aᵢ,
possibly appealing to axioms from T.
- ax
{Atom : Type u}
[DecidableEq Atom]
{T : Theory Atom}
{Γ : Ctx Atom}
{A : Proposition Atom}
: A ∈ T → Derivation Γ A
Axiom
- ass
{Atom : Type u}
[DecidableEq Atom]
{T : Theory Atom}
{Γ : Ctx Atom}
{A : Proposition Atom}
: A ∈ Γ → Derivation Γ A
Assumption
- andI
{Atom : Type u}
[DecidableEq Atom]
{T : Theory Atom}
{Γ : Ctx Atom}
{A B : Proposition Atom}
: Derivation Γ A → Derivation Γ B → Derivation Γ (A.and B)
Conjunction introduction
- andE₁
{Atom : Type u}
[DecidableEq Atom]
{T : Theory Atom}
{Γ : Ctx Atom}
{A B : Proposition Atom}
: Derivation Γ (A.and B) → Derivation Γ A
Conjunction elimination left
- andE₂
{Atom : Type u}
[DecidableEq Atom]
{T : Theory Atom}
{Γ : Ctx Atom}
{A B : Proposition Atom}
: Derivation Γ (A.and B) → Derivation Γ B
Conjunction elimination right
- orI₁
{Atom : Type u}
[DecidableEq Atom]
{T : Theory Atom}
{Γ : Ctx Atom}
{A B : Proposition Atom}
: Derivation Γ A → Derivation Γ (A.or B)
Disjunction introduction left
- orI₂
{Atom : Type u}
[DecidableEq Atom]
{T : Theory Atom}
{Γ : Ctx Atom}
{A B : Proposition Atom}
: Derivation Γ B → Derivation Γ (A.or B)
Disjunction introduction right
- orE
{Atom : Type u}
[DecidableEq Atom]
{T : Theory Atom}
{Γ : Ctx Atom}
{A B C : Proposition Atom}
: Derivation Γ (A.or B) → Derivation (insert A Γ) C → Derivation (insert B Γ) C → Derivation Γ C
Disjunction elimination
- implI
{Atom : Type u}
[DecidableEq Atom]
{T : Theory Atom}
{A B : Proposition Atom}
(Γ : Ctx Atom)
: Derivation (insert A Γ) B → Derivation Γ (A.impl B)
Implication introduction
- implE
{Atom : Type u}
[DecidableEq Atom]
{T : Theory Atom}
{Γ : Ctx Atom}
{A B : Proposition Atom}
: Derivation Γ (A.impl B) → Derivation Γ A → Derivation Γ B
Implication elimination
Instances For
Inference system for derivations under the theory T.
Equations
- Cslib.Logic.PL.instInferenceSystemElemPropositionSequent T = { derivation := fun (S : Cslib.Logic.PL.Sequent) => Cslib.Logic.PL.Theory.Derivation S.1 S.2 }
Inference system for propositions (using the empty context).
Equations
- Cslib.Logic.PL.instInferenceSystemElemProposition T = { derivation := fun (A : Cslib.Logic.PL.Proposition Atom) => Cslib.Logic.PL.Theory.Derivation ∅ A }
An equivalence between A and B is a derivation of B from A and vice-versa.
Equations
Instances For
Forward direction of an equivalence.
Instances For
Reverse direction of an equivalence.
Instances For
A and B are T-equivalent if T.equiv A B is nonempty.
Equations
Instances For
A and B are T-equivalent if T.equiv A B is nonempty.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Minimally equivalent propositions.
Instances For
Minimally equivalent propositions.
Equations
- Cslib.Logic.PL.«term_≡_» = Lean.ParserDescr.trailingNode `Cslib.Logic.PL.«term_≡_» 29 30 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ≡ ") (Lean.ParserDescr.cat `term 30))
Instances For
Operations on derivations #
Weakening is a derived rule.
Equations
- One or more equations did not get rendered due to their size.
- Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx (Cslib.Logic.PL.Theory.Derivation.ax hA) = Cslib.Logic.PL.Theory.Derivation.ax ⋯
- Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx (Cslib.Logic.PL.Theory.Derivation.ass hA) = Cslib.Logic.PL.Theory.Derivation.ass ⋯
- Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx (D.andI D') = (Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx D).andI (Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx D')
- Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx D.andE₁ = (Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx D).andE₁
- Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx D.andE₂ = (Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx D).andE₂
- Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx D.orI₁ = (Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx D).orI₁
- Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx D.orI₂ = (Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx D).orI₂
- Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx (Cslib.Logic.PL.Theory.Derivation.implI Γ D) = Cslib.Logic.PL.Theory.Derivation.implI Δ (Cslib.Logic.PL.Theory.Derivation.weak hTheory ⋯ D)
- Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx (D.implE D') = (Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx D).implE (Cslib.Logic.PL.Theory.Derivation.weak hTheory hCtx D')
Instances For
Weakening the theory only.
Equations
Instances For
Weakening the context only.
Equations
Instances For
Proof irrelevant weakening.
Proof irrelevant weakening of the theory.
Proof irrelevant weakening of the context.
Implement the cut rule, removing a hypothesis A from E using a derivation D. This is not
substitution, which would replace appeals to A in E by the whole derivation D.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Proof irrelevant cut rule.
Remove unnecessary hypotheses. This can't be computable because it requires picking an order
on the finset Δ.
Substitution of a family of derivations D for hypotheses in the context Γ of E. TODO:
this implementation is not capture avoiding.
Equations
- One or more equations did not get rendered due to their size.
- Cslib.Logic.PL.Theory.Derivation.subs Ds (Cslib.Logic.PL.Theory.Derivation.ax hB) = Cslib.Logic.PL.Theory.Derivation.ax hB
- Cslib.Logic.PL.Theory.Derivation.subs Ds (E.andI E') = (Cslib.Logic.PL.Theory.Derivation.subs Ds E).andI (Cslib.Logic.PL.Theory.Derivation.subs Ds E')
- Cslib.Logic.PL.Theory.Derivation.subs Ds E.andE₁ = (Cslib.Logic.PL.Theory.Derivation.subs Ds E).andE₁
- Cslib.Logic.PL.Theory.Derivation.subs Ds E.andE₂ = (Cslib.Logic.PL.Theory.Derivation.subs Ds E).andE₂
- Cslib.Logic.PL.Theory.Derivation.subs Ds E.orI₁ = (Cslib.Logic.PL.Theory.Derivation.subs Ds E).orI₁
- Cslib.Logic.PL.Theory.Derivation.subs Ds E.orI₂ = (Cslib.Logic.PL.Theory.Derivation.subs Ds E).orI₂
- Cslib.Logic.PL.Theory.Derivation.subs Ds (E.implE E') = (Cslib.Logic.PL.Theory.Derivation.subs Ds E).implE (Cslib.Logic.PL.Theory.Derivation.subs Ds E')
Instances For
Transport a derivation along a substitution of atoms.
Equations
- One or more equations did not get rendered due to their size.
- Cslib.Logic.PL.Theory.Derivation.substAtom f (Cslib.Logic.PL.Theory.Derivation.ax hB) = Cslib.Logic.PL.Theory.Derivation.ax ⋯
- Cslib.Logic.PL.Theory.Derivation.substAtom f (Cslib.Logic.PL.Theory.Derivation.ass hB) = Cslib.Logic.PL.Theory.Derivation.ass ⋯
- Cslib.Logic.PL.Theory.Derivation.substAtom f (E.andI E') = (Cslib.Logic.PL.Theory.Derivation.substAtom f E).andI (Cslib.Logic.PL.Theory.Derivation.substAtom f E')
- Cslib.Logic.PL.Theory.Derivation.substAtom f E.andE₁ = (Cslib.Logic.PL.Theory.Derivation.substAtom f E).andE₁
- Cslib.Logic.PL.Theory.Derivation.substAtom f E.andE₂ = (Cslib.Logic.PL.Theory.Derivation.substAtom f E).andE₂
- Cslib.Logic.PL.Theory.Derivation.substAtom f E.orI₁ = (Cslib.Logic.PL.Theory.Derivation.substAtom f E).orI₁
- Cslib.Logic.PL.Theory.Derivation.substAtom f E.orI₂ = (Cslib.Logic.PL.Theory.Derivation.substAtom f E).orI₂
- Cslib.Logic.PL.Theory.Derivation.substAtom f (E.implE E') = (Cslib.Logic.PL.Theory.Derivation.substAtom f E).implE (Cslib.Logic.PL.Theory.Derivation.substAtom f E')
Instances For
Properties of equivalence #
A derivation of the canonical tautology.
Equations
Instances For
Change the conclusion along an equivalence.
Equations
Instances For
Replace a hypothesis along an equivalence.
Equations
Instances For
An equivalence of a proposition with itself.
Equations
Instances For
Reverse an equivalence.
Instances For
Compose two equivalences.
Equations
Instances For
A and B are equivalent (in T) iff they are provable from the same contexts.
A and B are equivalent (in T) iff they have the same strength as hypotheses.
Equivalence is indeed an equivalence relation.
The setoid of propositions under equivalence.
Equations
- T.propositionSetoid = { r := Cslib.Logic.PL.Theory.Equiv, iseqv := ⋯ }