88
99import Cslib.Init
1010
11- /-! # Connective Typeclasses for Propositional Logic
11+ /-! # Connective Typeclasses for Composable Logics
1212
13- This module defines a typeclass hierarchy for propositional logical connectives. Each formula
14- type registers itself as an instance of the appropriate connective class, enabling polymorphic
15- axiom definitions and notation that work uniformly across different formula types .
13+ This module defines a typeclass hierarchy for logical connectives, shared across propositional
14+ and modal logic levels. Each formula type registers itself as an instance of the appropriate
15+ connective class, enabling polymorphic axiom definitions and notation .
1616
1717## Design
1818
19- The hierarchy adopts five constructors `{atom, bot, imp, and, or}` ,
19+ The hierarchy adopts a hybrid design ,
2020following the operator-typeclass direction of fmontesi's PR #607 (one class per operator):
21- - **Atomic classes** : `HasBot`, `HasImp`, `HasAnd`, `HasOr`
22- - **Bundled class ** : `PropositionalConnectives` (extends `HasBot` and `HasImp`)
21+ - **Atomic classes** : `HasBot`, `HasImp`, `HasAnd`, `HasOr`, `HasBox`
22+ - **Bundled classes ** : `PropositionalConnectives`, `ModalConnectives`
2323
2424 Conjunction (`HasAnd`) and disjunction (`HasOr`) are treated as independent primitives rather
2525than Łukasiewicz-derived connectives. The classical encodings `φ ∧ ψ := ¬(φ → ¬ψ)` and
@@ -51,6 +51,18 @@ class HasImp (F : Type*) where
5151 /-- The implication connective. -/
5252 imp : F → F → F
5353
54+ /-- A type has a necessity/box modality.
55+
56+ Box represents universal quantification over accessible worlds (`∀ w', r w w' → φ`),
57+ distributes over implication (axiom K), and is the subject of the necessitation rule.
58+ In classical systems,
59+ diamond (possibility) is derived as `¬□¬φ`. Non-classical modal logics (intuitionistic,
60+ minimal) require a separate `HasDia` typeclass, since `□` and `◇` become independent
61+ operators in those settings. -/
62+ class HasBox (F : Type *) where
63+ /-- The necessity/box modality. -/
64+ box : F → F
65+
5466/-- A type has a conjunction connective. -/
5567class HasAnd (F : Type *) where
5668 /-- The conjunction connective. -/
@@ -68,4 +80,12 @@ When all four connectives are needed, use
6880`[PropositionalConnectives F] [HasAnd F] [HasOr F]`. -/
6981class PropositionalConnectives (F : Type *) extends HasBot F, HasImp F
7082
83+ /-- Modal connectives: propositional connectives plus box (necessity).
84+
85+ Diamond (possibility) is derivable from box and propositional connectives via
86+ classical negation (`◇φ := ¬□¬φ`) and need not appear in the typeclass. Non-classical modal
87+ logics (intuitionistic, minimal) require extending this class with a primitive `HasDia` once
88+ those formula types are formalized. -/
89+ class ModalConnectives (F : Type *) extends PropositionalConnectives F, HasBox F
90+
7191end Cslib.Logic
0 commit comments