Skip to content

feat(Logics/Modal): refactor formula primitives to {atom, bot, imp, box}#662

Open
benbrastmckie wants to merge 1 commit into
leanprover:mainfrom
benbrastmckie:feat/modal-formula-primitives
Open

feat(Logics/Modal): refactor formula primitives to {atom, bot, imp, box}#662
benbrastmckie wants to merge 1 commit into
leanprover:mainfrom
benbrastmckie:feat/modal-formula-primitives

Conversation

@benbrastmckie

@benbrastmckie benbrastmckie commented Jun 19, 2026

Copy link
Copy Markdown

Refactors the modal formula type to the primitive set {atom, bot, imp, box} and builds out the modal cube and logical equivalence over it.

The original PR mixed this with propositional-logic changes and was large to review. Per reviewer feedback it is now slimmed to the modal layer only — a single commit touching the files below — and builds independently on main.

Files Changed

Cslib/Logics/Modal/Basic.lean (modified)

Modal.Proposition uses {atom, bot, imp, box} as primitives; negation, conjunction, disjunction and diamond are derived (◇φ := ¬□¬φ). Box is kept primitive so necessitation and the K axiom stay pure rules on a single operator. Proves each of K/T/B/4/5/D valid under its frame condition, with canonicity (the condition is also necessary) for T/B/4/5/D. Diamond's derivation is classical-only; a primitive HasDia for intuitionistic/minimal modal logic is noted as future work.

Cslib/Logics/Modal/Cube.lean (modified)

Assembles the fifteen named logics of the modal cube (K, T, B, 4, 5, D, D4, D5, D45, DB, TB, KB5, S4, S5, K45) as axiom-set unions over the relevant model classes, and proves the standard cube inclusions.

Cslib/Logics/Modal/LogicalEquivalence.lean (modified)

Defines Proposition.Equiv S, parametric in the model class S, so equivalence can be stated relative to any modal-cube class (T/B/4/5/S4/S5, …) rather than only the class of all models. Proved to be an equivalence relation and a congruence over one-hole contexts, and registered into the shared Cslib.Foundations.Logic.LogicalEquivalence framework.

Cslib/Logics/Modal/Denotation.lean (modified)

Semantics/denotation for the new primitive set.

Cslib/Foundations/Logic/Connectives.lean (new file)

A small operator-typeclass hierarchy — HasBot, HasImp, HasAnd, HasOr, HasBox, bundled into PropositionalConnectives and ModalConnectives. This follows the one-class-per-operator direction of #607, but is self-owned here rather than depending on #607, which is not yet merged and does not currently carry HasBot/the bundled classes. Folding this onto #607's hierarchy once it lands is left to a follow-up.

references.bib (modified)

Adds Avigad2022 and ChagrovZakharyaschev1997 for the sources cited in the modal files.

Cslib.lean, CslibTests/GrindLint.lean (modified)

Module registration for the above, plus #grind_lint skip entries for the four new @[scoped grind] modal lemmas (the same mechanism already used by Cslib.Logic.HML).

AI Disclosure

Claude (Anthropic) assisted with the rebase, file selection, and CI verification. The Lean proofs are by the contributors listed in the file headers; AI use was limited to mechanical git work and drafting this description.

benbrastmckie added a commit to benbrastmckie/cslib that referenced this pull request Jun 19, 2026
…PR description with line-number links

Phase 1: Removed ~157 scratch-work inline comments from 14 Modal/ proof files
Phase 2: Revised PR description with exact line-number table for all 15 strong soundness/completeness results
Phase 3: Updated GitHub PR leanprover#662 body

Session: sess_1781890976_cc3df6
@benbrastmckie benbrastmckie force-pushed the feat/modal-formula-primitives branch from e01881d to f46056b Compare June 19, 2026 19:46
@benbrastmckie benbrastmckie marked this pull request as ready for review June 19, 2026 19:46
benbrastmckie added a commit to benbrastmckie/cslib that referenced this pull request Jun 21, 2026
benbrastmckie added a commit to benbrastmckie/cslib that referenced this pull request Jun 21, 2026
…leanup

- Added 17 docstrings to Basic.lean, Cube.lean, DerivationTree.lean
- Removed @[simp] from k_strong_completeness_iff for consistency
- Fixed "satifies" typo in Basic.lean
- Removed 4 S5 backward-compatibility aliases from DerivationTree.lean
- Removed 2 dead ModalSetDerivable lemmas from Completeness.lean
- Removed HasHilbertTree instance from DeductionTheorem.lean
- Removed dead t_canonical_refl, t_truth_lemma from T/Completeness.lean
- Removed dead tb_canonical_refl, tb_canonical_symm, tb_truth_lemma from TB/Completeness.lean
- Removed 14 dead _soundness_derivable wrappers (kept K's, used by ConservativeExtension)
- Removed unused _h_T parameter from canonical_eucl; updated S5/Completeness.lean caller
- Removed 2 redundant imports from K/Completeness.lean and T/Completeness.lean
- Normalized blank lines in 11 Completeness files
- Updated pr-description.md line numbers and pushed to GitHub PR leanprover#662

Session: sess_1781895004_06f0c7

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
benbrastmckie added a commit to benbrastmckie/cslib that referenced this pull request Jun 21, 2026
…cription updated

Cleaned stale module docstring references left after dead code removal phase:
- Removed _soundness_derivable references from 14 Soundness module docblocks
- Updated T/Completeness and TB/Completeness module docs to list actual results
- Updated Metalogic/Completeness module doc (removed deleted lemma names)
- Corrected T and TB line numbers in pr-description.md (shifted by +4 lines)
- Pushed updated PR description to GitHub PR leanprover#662

Session: sess_1781894063_86b06e

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
benbrastmckie added a commit to benbrastmckie/cslib that referenced this pull request Jul 3, 2026
…ositional-v2

Rebuild PR leanprover#662 as a single clean commit stacked on rebased leanprover#648
(feat/propositional-v2), containing only the six genuine modal files
(placeholder message; finalized message pending Phase 5 user approval,
D5).

- Basic.lean: box-primitive Proposition {atom, bot, imp, box}, diamond
  derived as neg(box(neg _)) (classical), ModalConnectives instance.
- Cube.lean, Denotation.lean: adapted to the imp/box primitive set.
- LogicalEquivalence.lean: task-472 parametric Proposition.Equiv S
  (transplanted from main 9c5cbd08), replacing the stale standalone
  LogicallyEquivalent def carried by the old leanprover#662 tip.
- Connectives.lean: self-owned PropositionalConnectives/ModalConnectives
  typeclass hierarchy (Option A, task 469); leanprover#607 decoupling deferred.
- Cslib.lean: add Connectives module registration.
- CslibTests/GrindLint.lean: add four #grind_lint skip entries for new
  Modal @[scoped grind] lemmas that trigger run-away grind instantiation
  (neg_denotation, Satisfies.and_iff_and, Satisfies.iff_iff_iff,
  Satisfies.or_iff_or) -- same sanctioned escape hatch already used by
  the analogous Cslib.Logic.HML module (HML.Satisfies.diamond, etc.).

references.bib required no changes (Avigad2022 already present,
inherited from leanprover#648's rebased bib).

Session: sess_1783038723_6ac05b
@benbrastmckie benbrastmckie force-pushed the feat/modal-formula-primitives branch from f46056b to 8506bf1 Compare July 3, 2026 04:16
Modal formula type with primitives {atom, bot, imp, box}; diamond derived
as ¬□¬. Adds self-owned Foundations/Logic/Connectives (HasBox/ModalConnectives),
K/T/B/4/5/D validity + canonicity (Basic, Cube), model-class-parametric
Proposition.Equiv S integrated with the shared LogicalEquivalence framework
(LogicalEquivalence, Denotation). Adds Avigad2022 and ChagrovZakharyaschev1997
references for the cited sources.
@benbrastmckie benbrastmckie force-pushed the feat/modal-formula-primitives branch from 8506bf1 to b0d085e Compare July 3, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant