11/-
2- Copyright (c) 2025 Thomas Waring. All rights reserved.
2+ Copyright (c) 2025 Thomas Waring, 2026 Benjamin Brast-McKie . All rights reserved.
33Released under Apache 2.0 license as described in the file LICENSE.
4- Authors: Thomas Waring
4+ Authors: Thomas Waring, Benjamin Brast-McKie
55-/
66
77module
88
99public import Cslib.Init
10+ public import Cslib.Foundations.Logic.Connectives
1011public import Mathlib.Data.FunLike.Basic
11- public import Mathlib.Data.Set.Image
12+ public import Mathlib.Data.Set.Basic
1213public import Mathlib.Order.TypeTags
1314
1415/-! # Propositions and theories
1516
1617## Main definitions
1718
18- - `Proposition` : the type of propositions over a given type of atom. This type has a `Bot`
19- instance whenever `Atom` does, and a `Top` whenever `Atom` is inhabited.
19+ - `Proposition` : the type of propositions over a given type of atom. Primitives are `atom`,
20+ `bot` (falsum), and `imp` (implication); since `{imp, bot}` is functionally complete for
21+ classical logic, conjunction, disjunction, negation, and verum are derived connectives
22+ (`abbrev`s) rather than constructors, keeping the inductive minimal.
2023- `Theory` : set of `Proposition`.
2124- `IsIntuitionistic` : a theory is intuitionistic if it contains the principle of explosion.
2225- `IsClassical` : an intuitionistic theory is classical if it further contains double negation
@@ -32,6 +35,11 @@ theory.
3235
3336We introduce notation for the logical connectives: `⊥ ⊤ ∧ ∨ → ¬` for, respectively, falsum, verum,
3437conjunction, disjunction, implication and negation.
38+
39+ ## References
40+
41+ * [ A. Church, *Introduction to Mathematical Logic* ] [Church1956 ]
42+ * [ A. Chagrov, M. Zakharyaschev, *Modal Logic* ] [ChagrovZakharyaschev1997 ], Chapter 1
3543 -/
3644
3745@[expose] public section
@@ -42,44 +50,54 @@ variable {Atom : Type u} [DecidableEq Atom]
4250
4351namespace Cslib.Logic.PL
4452
45- /-- Propositions. -/
53+ /-- Propositions. Primitives are atoms, falsum, and implication. -/
4654inductive Proposition (Atom : Type u) : Type u where
4755 /-- Propositional atoms -/
4856 | atom (x : Atom)
49- /-- Conjunction -/
50- | and (a b : Proposition Atom)
51- /-- Disjunction -/
52- | or (a b : Proposition Atom)
57+ /-- Falsum / bottom -/
58+ | bot
5359 /-- Implication -/
54- | impl (a b : Proposition Atom)
60+ | imp (a b : Proposition Atom)
5561deriving DecidableEq, BEq
5662
57- instance instBotProposition [Bot Atom] : Bot (Proposition Atom) := ⟨.atom ⊥⟩
58- instance instInhabitedOfBot [Bot Atom] : Inhabited Atom := ⟨⊥⟩
63+ /-- Negation as a derived connective: ¬A := A → ⊥ -/
64+ abbrev Proposition.neg : Proposition Atom → Proposition Atom := (Proposition.imp · .bot)
5965
60- /-- We view negation as a defined connective ~A := A → ⊥ -/
61- abbrev Proposition.neg [Bot Atom] : Proposition Atom → Proposition Atom := (Proposition.impl · ⊥)
66+ /-- Verum / top as a derived connective: ⊤ := ⊥ → ⊥ -/
67+ abbrev Proposition.top : Proposition Atom := .imp .bot .bot
6268
63- /-- A fixed choice of a derivable proposition (of course any two are equivalent). -/
64- abbrev Proposition.top [Inhabited Atom] : Proposition Atom := impl (.atom default) (.atom default)
69+ /-- Disjunction as a derived connective: A ∨ B := ¬A → B -/
70+ abbrev Proposition.or (A B : Proposition Atom) : Proposition Atom :=
71+ .imp (.imp A .bot) B
6572
66- instance instTopProposition [Inhabited Atom] : Top (Proposition Atom) := ⟨.top⟩
73+ /-- Conjunction as a derived connective: A ∧ B := ¬(A → ¬B) -/
74+ abbrev Proposition.and (A B : Proposition Atom) : Proposition Atom :=
75+ .imp (.imp A (.imp B .bot)) .bot
6776
68- example [Bot Atom] : (⊤ : Proposition Atom) = Proposition.impl ⊥ ⊥ := rfl
77+ /-- Biconditional as a derived connective: A ↔ B := (A → B) ∧ (B → A) -/
78+ abbrev Proposition.iff (A B : Proposition Atom) : Proposition Atom :=
79+ (A.imp B).and (B.imp A)
80+
81+ instance : Bot (Proposition Atom) := ⟨.bot⟩
82+ instance : Top (Proposition Atom) := ⟨.top⟩
6983
7084@[inherit_doc] scoped infix :36 " ∧ " => Proposition.and
7185@[inherit_doc] scoped infix :35 " ∨ " => Proposition.or
72- @[inherit_doc] scoped infix :30 " → " => Proposition.impl
86+ @[inherit_doc] scoped infix :30 " → " => Proposition.imp
7387@[inherit_doc] scoped prefix :40 " ¬ " => Proposition.neg
7488
89+ /-- Register `Proposition` as an instance of `PropositionalConnectives`. -/
90+ instance : PropositionalConnectives (Proposition Atom) where
91+ bot := .bot
92+ imp := .imp
93+
7594/-- Substitute each atom in a proposition for a proposition, possibly changing the atomic
7695language. -/
7796def Proposition.subst {Atom Atom' : Type u} (f : Atom → Proposition Atom') :
7897 Proposition Atom → Proposition Atom'
7998 | atom x => f x
80- | and A B => (A.subst f) ∧ (B.subst f)
81- | or A B => (A.subst f) ∨ (B.subst f)
82- | impl A B => (A.subst f) → (B.subst f)
99+ | bot => .bot
100+ | imp A B => .imp (A.subst f) (B.subst f)
83101
84102-- This is probably a lawful monad, but that doesn't seem to be important.
85103instance : Monad Proposition where
@@ -102,45 +120,45 @@ instance : Functor Theory where
102120abbrev MPL : Theory (Atom) := ∅
103121
104122/-- Intuitionistic propositional logic adds the principle of explosion (ex falso quodlibet). -/
105- abbrev IPL [Bot Atom] : Theory Atom :=
106- Set.range (⊥ → ·)
123+ abbrev IPL : Theory Atom :=
124+ Set.range (Proposition.imp ⊥ ·)
107125
108126/-- Classical logic further adds double negation elimination. -/
109- abbrev CPL [Bot Atom] : Theory Atom :=
127+ abbrev CPL : Theory Atom :=
110128 Set.range (fun (A : Proposition Atom) ↦ ¬¬A → A)
111129
112130/-- A theory is intuitionistic if it validates ex falso quodlibet. -/
113131@ [scoped grind]
114- class IsIntuitionistic [Bot Atom] (T : Theory Atom) where
132+ class IsIntuitionistic (T : Theory Atom) where
115133 efq (A : Proposition Atom) : (⊥ → A) ∈ T
116134
117135omit [DecidableEq Atom] in
118136@ [scoped grind =]
119- theorem isIntuitionisticIff [Bot Atom] (T : Theory Atom) : IsIntuitionistic T ↔ IPL ⊆ T := by grind
137+ theorem isIntuitionisticIff (T : Theory Atom) : IsIntuitionistic T ↔ IPL ⊆ T := by grind
120138
121139/-- A theory is classical if it validates double-negation elimination. -/
122140@ [scoped grind]
123- class IsClassical [Bot Atom] (T : Theory Atom) where
141+ class IsClassical (T : Theory Atom) where
124142 dne (A : Proposition Atom) : (¬¬A → A) ∈ T
125143
126144omit [DecidableEq Atom] in
127145@ [scoped grind =]
128- theorem isClassicalIff [Bot Atom] (T : Theory Atom) : IsClassical T ↔ CPL ⊆ T := by grind
146+ theorem isClassicalIff (T : Theory Atom) : IsClassical T ↔ CPL ⊆ T := by grind
129147
130- instance instIsIntuitionisticIPL [Bot Atom] : IsIntuitionistic (Atom := Atom) IPL where
148+ instance instIsIntuitionisticIPL : IsIntuitionistic (Atom := Atom) IPL where
131149 efq A := Set.mem_range.mpr ⟨A, rfl⟩
132150
133- instance instIsClassicalCPL [Bot Atom] : IsClassical (Atom := Atom) CPL where
151+ instance instIsClassicalCPL : IsClassical (Atom := Atom) CPL where
134152 dne A := Set.mem_range.mpr ⟨A, rfl⟩
135153
136154omit [DecidableEq Atom] in
137155@ [scoped grind →]
138- theorem instIsIntuitionisticExtention [Bot Atom] {T T' : Theory Atom} [IsIntuitionistic T]
156+ theorem instIsIntuitionisticExtention {T T' : Theory Atom} [IsIntuitionistic T]
139157 (h : T ⊆ T') : IsIntuitionistic T' := by grind
140158
141159omit [DecidableEq Atom] in
142160@ [scoped grind →]
143- theorem instIsClassicalExtention [Bot Atom] {T T' : Theory Atom} [IsClassical T] (h : T ⊆ T') :
161+ theorem instIsClassicalExtention {T T' : Theory Atom} [IsClassical T] (h : T ⊆ T') :
144162 IsClassical T' := by grind
145163
146164/-- Attach a bottom element to a theory `T`, and the principle of explosion for that bottom. -/
0 commit comments