Skip to content

feat(Logics/Modal): semantics for the modal metalogic, compatible with constructive modal theories#662

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

feat(Logics/Modal): semantics for the modal metalogic, compatible with constructive modal theories#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

Contributes a foundational semantic layer for the modal metalogic, designed to be compatible with the intuitionistic and constructive modal systems (IK, CK). This is the substantive ambition of the PR; the native Proposition datatype it is built on is the enabling foundation.

The semantic layer

Built on a native 7-primitive Proposition:

Proposition {atom, bot, imp, and, or, box, diamond}

(negation and verum stay derived via the Łukasiewicz convention ¬φ := φ → ⊥, ⊤ := ⊥ → ⊥, mirroring Cslib.Logic.PL.Proposition's native and/or), it provides:

  • Satisfies — the satisfaction relation, defined natively over all 7 constructors.
  • Denotational semanticsDenotation.lean extended to every constructor, with satisfies_mem_denotation, not_denotation, and theoryEq_denotation_eq.
  • The duality theorem ◇φ ↔ ¬□¬φ — recovered as a proved semantic theorem (Satisfies.dual, via excluded middle) rather than baked in as a definition.
  • One decomposition lemma per connective — now Iff.rfl, since every connective is structural (no Łukasiewicz-bridge lemmas).
  • K-axiom validity, and the T/B/4/5/D frame-correspondence results and their converses, all preserved.

Why both box and diamond primitive?

Classically ◇φ := ¬□¬φ suffices, but in IK/CK and are not interdefinable ([Simpson 1994]). Keeping both native means the same datatype carries unchanged into those systems, and the semantic/tableau layer gets one clean decomposition rule per connective. Classically nothing is lost — the duality is recovered as the theorem above.

Relationship to #607 (rebase plan)

The native primitive-constructor design — {atom, bot, imp, and, or, box, diamond} with box/diamond both primitive — is the subject of #607, where the operator layer is being standardised. This PR is intended to be rebased onto #607 once it lands, so that the primitive constructors come from #607 and this PR carries only the semantic layer on top.

Until then it is based on main and self-contained, so it builds and can be reviewed independently. Coordination on the native primitive set is ongoing on #607 and the CSLib > Modal Logic Zulip thread.

Changes (5 files, +145 / −40 against main; the base will move to #607 on rebase)

  • Cslib/Logics/Modal/Basic.lean — 7-primitive Proposition; native Satisfies; derived neg/top/iff; per-connective characterisation lemmas (now Iff.rfl); Satisfies.dual as a semantic theorem. All existing theorems preserved — including the T/B/4/5/D frame-correspondence results and their converses.
  • Cslib/Logics/Modal/Denotation.lean — denotation extended to all 7 constructors; satisfies_mem_denotation, not_denotation, theoryEq_denotation_eq preserved.
  • Cslib/Logics/Modal/Cube.lean — unchanged except an import; the Modal Cube (K…S5) and its validities carry over.
  • Cslib/Logics/Modal/LogicalEquivalence.lean — one-hole Context notneg former; congruence/LogicalEquivalence instances preserved.
  • references.bib — adds the Simpson 1994 reference.

Notation (¬ ∧ ∨ → □ ◇ ↔) and every theorem name are preserved. Two derived definitions are renamed to match the native constructors — Proposition.notProposition.neg and Proposition.implProposition.imp — and box/or move from derived definitions to native constructors under the same names (Proposition.Context.not is likewise renamed to neg). Sorry-free; axioms limited to propext / Classical.choice / Quot.sound. Full lake build, checkInitImports, lake lint, lint-style, lake test, and shake pass.

AI Disclosure

This work was drafted with the assistance of an AI coding agent (Claude, Anthropic) under the contributor's direction. All proofs were machine-checked by lake build/lake lint and the full CSLib CI, and reviewed before submission. Design decisions and review are the contributor's.

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 2 times, most recently from 8506bf1 to b0d085e Compare July 3, 2026 06:16
@benbrastmckie benbrastmckie force-pushed the feat/modal-formula-primitives branch from b0d085e to 8d7a061 Compare July 12, 2026 02:57
benbrastmckie added a commit to benbrastmckie/cslib that referenced this pull request Jul 12, 2026
…anprover#662 on leanprover#607

Rework PR leanprover#662's modal-logic contribution to stack cleanly on PR leanprover#607
(fmontesi/connectives), whose head already provides the consolidated
HasBox/HasDiamond/... operator typeclasses in
Cslib/Foundations/Logic/Operators.lean. On this base, Proposition was
{atom, not, and, diamond} with box derived as ¬◇¬φ. This commit adds
box as a fifth primitive constructor so both modalities are primitive,
and turns the interdefinability law into a derived theorem.

- Basic.lean: add `| box (φ : Proposition Atom)` to the Proposition
  inductive; add the matching `Satisfies` clause
  `∀ w', m.r w w' → Satisfies m w' φ`; point HasBox at the new
  constructor; reduce `Satisfies.box_iff_forall` to `Iff.rfl`; prove
  `Satisfies.dual : ◇φ ↔ ¬□¬φ` as a genuine classical theorem from the
  two now-independent primitive semantic clauses (was previously
  definitional); add companion `Satisfies.box_iff_not_diamond_not`.
- Denotation.lean: add the box denotation clause
  `{w | ∀ w', m.r w w' → w' ∈ φ.denotation m}`.
- LogicalEquivalence.lean: add the `box` `Proposition.Context`
  constructor, its `fill` clause, and the matching `Congruence`
  induction case.

No duplicate Connectives.lean exists on this branch (leanprover#607's Operators.lean
is already the sole source of these typeclasses), so no deletion was
needed there.

Net diff vs ddc2c9b (the leanprover#607 head this branch is built on): 3 files
changed, +39/-17 (net +22 LOC). Zero sorry, zero new axioms.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015tcPjCXNeSAzBxWeFYsZM5
@benbrastmckie benbrastmckie force-pushed the feat/modal-formula-primitives branch from 8d7a061 to 70b7ec4 Compare July 12, 2026 20:13
@benbrastmckie benbrastmckie changed the base branch from main to fmontesi/connectives July 12, 2026 20:13
@benbrastmckie benbrastmckie changed the title feat(Logics/Modal): refactor formula primitives to {atom, bot, imp, box} feat(Logics/Modal): make box primitive alongside diamond (stacked on #607) Jul 12, 2026
Refactor the modal `Proposition` from the 4-primitive `{atom, not, and,
diamond}` design (with `or`/`impl`/`box` derived) to a 7-primitive native
design `{atom, bot, imp, and, or, box, diamond}`, with negation and verum
derived via the Łukasiewicz convention (`¬φ := φ → ⊥`, `⊤ := ⊥ → ⊥`).

Keeping `box` and `diamond` as independent native constructors (rather than
`◇φ := ¬□¬φ`) means the same datatype carries unchanged into intuitionistic
and constructive modal logics, where `□`/`◇` are not interdefinable
(Simpson 1994), and gives one decomposition rule per connective for the
semantic/tableau layer. Classically the duality `◇φ ↔ ¬□¬φ` is recovered as
a proved semantic theorem (`Satisfies.dual`) rather than a definition.

All existing declarations are preserved with identical names and signatures,
including the T/B/4/5/D frame-correspondence theorems, the Modal Cube, the
denotational semantics, and logical-equivalence congruence. The per-connective
`Satisfies` characterisation lemmas now hold by `Iff.rfl`. Sorry-free; axioms
limited to propext/Classical.choice/Quot.sound.

Adds the Simpson 1994 reference to references.bib.

AI disclosure: this refactor was drafted with the assistance of an AI coding
agent (Claude); all proofs were verified by `lake build`/`lake lint` and the
full CSLib CI, and reviewed before submission.
@benbrastmckie benbrastmckie force-pushed the feat/modal-formula-primitives branch from 70b7ec4 to 2482583 Compare July 14, 2026 04:05
@benbrastmckie benbrastmckie requested a review from kim-em as a code owner July 14, 2026 04:05
@benbrastmckie benbrastmckie changed the title feat(Logics/Modal): make box primitive alongside diamond (stacked on #607) feat(Logics/Modal): make Proposition a native 7-primitive type Jul 14, 2026
@benbrastmckie benbrastmckie changed the base branch from fmontesi/connectives to main July 14, 2026 04:06
@benbrastmckie benbrastmckie changed the title feat(Logics/Modal): make Proposition a native 7-primitive type feat(Logics/Modal): semantics for the modal metalogic, compatible with constructive modal theories Jul 14, 2026
@benbrastmckie

Copy link
Copy Markdown
Author

I've retitled this to reflect what it's really aiming at. The 7-primitive Proposition refactor is the enabling foundation, but the substantive contribution is the semantic layer for the modal metalogic: the Satisfies relation, the denotational semantics, the duality ◇φ ↔ ¬□¬φ recovered as a proved semantic theorem (Satisfies.dual, via excluded middle rather than by definition), one decomposition lemma per connective, and K-axiom validity.

The reason both and are native primitives here — rather than defining ◇φ := ¬□¬φ — is that this is what keeps the layer compatible with the intuitionistic and constructive modal systems (IK, CK), where the two are genuinely not interdefinable ([Simpson 1994]). That's the metalogic I want to build on top of this. Classically nothing is lost: the duality comes back as the theorem above.

On the primitive constructors themselves, this mirrors #607, which is where the native {atom, bot, imp, and, or, box, diamond} operator design is being worked out. Coordination on standardising that primitive set is ongoing on #607 and the CSLib > Modal Logic Zulip thread; this PR builds the semantics on that basis.

@benbrastmckie benbrastmckie marked this pull request as draft July 14, 2026 05:33
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