feat(Logics/Propositional): five-primitive formula type with connective typeclasses#647
Closed
benbrastmckie wants to merge 1 commit into
Closed
Conversation
- Add Cslib/Foundations/Logic/Connectives.lean: HasBot, HasImp, HasAnd, HasOr, PropositionalConnectives typeclass hierarchy
- Refactor Cslib/Logics/Propositional/Defs.lean: five-primitive Proposition {atom, bot, imp, and, or}, remove [Bot Atom] constraints, add PropositionalConnectives/HasAnd/HasOr instances, add biconditional iff abbrev
- Update Cslib/Logics/Propositional/NaturalDeduction/Basic.lean: rename implI/implE to impI/impE, rename andE₁/₂/orI₁/₂ to ASCII-safe andE1/2/orI1/2, remove [Inhabited Atom] constraints
Session: sess_1781439290_50c37f
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
benbrastmckie
added a commit
to benbrastmckie/cslib
that referenced
this pull request
Jun 14, 2026
PR leanprover#647 submitted to upstream CSLib. Branch: feat/propositional-five-primitive Status: [PR READY] Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors the propositional logic foundations with three changes:
New file
Cslib/Foundations/Logic/Connectives.lean: Introduces a typeclass hierarchyfor propositional connectives —
HasBot,HasImp,HasAnd,HasOr(atomic classes) andPropositionalConnectives(bundled class extendingHasBotandHasImp). This enablespolymorphic axiom definitions that work across any formula type providing these connectives.
Refactored
Cslib/Logics/Propositional/Defs.lean: ThePropositiontype now usesfive primitives
{atom, bot, imp, and, or}instead of four{atom, and, or, impl}.Key changes:
botas a primitive constructor (previously simulated via[Bot Atom]constraint)impltoimp(matching CSLib's existing convention in Bimodal and Temporalformula types, and aligning constructor names with rule name prefixes:
impI/impE)¬A := A → ⊥and verum⊤ := ⊥ → ⊥are now constraint-free derived connectives↔as a derived connectivePropositionalConnectives,HasAnd,HasOrinstancesUpdated
Cslib/Logics/Propositional/NaturalDeduction/Basic.lean: Adapted to the newPropositionsignature:implI/implEtoimpI/impEandE₁/andE₂/orI₁/orI₂to ASCII-safeandE1/andE2/orI1/orI2[Inhabited Atom]constraints fromderivationTop,derivableIn_top,derivable_iff_equiv_top(now constraint-free with primitivebot)Why
botShould Be PrimitiveThe
[Bot Atom]approach embedded ⊥ as a special atom (.atom ⊥). This has three concretedefects:
⊥:Proposition.subst freplaces all atoms, including the"bottom atom" —
(.atom ⊥).subst f = f ⊥. Substitution should preserve⊥; withprimitive
botit does so by construction.⊤depends on an arbitraryInhabitedinstance: The previousProposition.topwasimpl (.atom default) (.atom default)— i.e.,a → afor an arbitrary atom, not thestandard
⊥ → ⊥. DifferentInhabitedinstances give definitionally different⊤terms.Bot Atomconflates logical bottom with atomic data:neg,top,IPL,IsIntuitionistic,IsClassicalall required[Bot Atom]constraints, making definitionsneedlessly complex.
With primitive
bot, all derived connectives (neg,top,iff) and logic definitions(
IPL,IsIntuitionistic,IsClassical) are constraint-free. The five-primitive signature{atom, bot, imp, and, or}is the standard one for intuitionistic and minimal logic in[TroelstraVanDalen1988] Chapter 2. Primitive
⊥is required for Johansson's minimal logic[Johansson1937], which defines negation
¬A := A → ⊥using⊥as an undefined primitivesymbol ("undefiniertes Grundzeichen").
Naming:
impvsimplThe name
impis used for consistency with CSLib's existing formula types (e.g., Bimodal andTemporal), where
impis the constructor name for implication. It also aligns constructornames with natural deduction rule name prefixes (
impI/impE, cf.andI/andE1).Zulip Discussion
See CSLib > Propositional Logic for the motivation discussion around making
botprimitive.Relationship to Other PRs
PR #607
PR #607 by @fmontesi introduces per-operator typeclass files under
Operators/, covering bothpropositional and modal connectives. Our
Connectives.leanoverlaps in the propositional case(
HasBot,HasImp,HasAnd,HasOr). If PR #607 merges first, we can align our definitionswith its typeclass names and file structure; if ours merges first, #607 can import from
Connectives.leanfor the propositional operators. I am happy to coordinate on the finalstructure.
PR #536
PR #536 by @thomaskwaring refactors
IsClassicalandIsIntuitionisticto refer to inferencesystems. Both PRs modify
Defs.leanandNaturalDeduction/Basic.lean. The changes areconceptually independent — #536 restructures inference system predicates while this PR changes
the primitive connective set.
PR #587
PR #587 by @thomaskwaring proposes model and semantics typeclasses and also modifies
Connectives.lean. We should coordinate to avoid conflicting changes to this file.Mathlib
Bot/HImpClassesMathlib defines
BotandHImp(both inMathlib.Order.Notation) as pure notation classes.We use a uniform
Has*naming convention (HasBot,HasImp,HasAnd,HasOr) for thegeneric polymorphic layer, where these classes parameterize proof system infrastructure
(
Axioms.lean,ProofSystem.lean,Consistency.lean,BigConj.lean). Concrete formulatypes separately provide direct
Botinstances for⊥notation. We keptHasImpratherthan Mathlib's
HImpbecauseHImpuses the field namehimpand notation⇨, whichdiffer from CSLib's
imp/→convention across all four formula types.Contribution Roadmap
This PR is the first in a planned series contributing our propositional logic foundations upstream:
ProofSystem/) with minimal/intuitionistic/classical axiompredicates and sequent derivability
The planned roadmap draws from the development in Troelstra & van Dalen [TroelstraVanDalen1988]
Chapter 2, with PR 5-6 following the completeness proof strategy there.
Changed Files
Cslib/Foundations/Logic/Connectives.lean— New: connective typeclass hierarchy (HasBot,HasImp,HasAnd,HasOr,PropositionalConnectives)Cslib/Logics/Propositional/Defs.lean— Modified: five-primitivePropositiontype, constraint-free derived connectives, typeclass instancesCslib/Logics/Propositional/NaturalDeduction/Basic.lean— Modified: renamed constructors (impl→imp, subscript→ASCII), removed type constraintsCslib.lean— Modified: addedConnectivesimportBreaking Changes
Proposition.implrenamed toProposition.impandE₁/andE₂/orI₁/orI₂renamed toandE1/andE2/orI1/orI2[Bot Atom]constraints removed fromIPL,IsIntuitionistic,IsClassical, andrelated instances and theorems
[Inhabited Atom]constraint removed fromProposition.top,derivationTop,derivableIn_top,derivable_iff_equiv_topinstBotPropositionandinstInhabitedOfBotremoved; new constraint-free instances addedFiles affected upstream:
Defs.lean,NaturalDeduction/Basic.lean(only consumers)AI Tools Used
This PR was prepared with the assistance of Claude Code (Anthropic). The AI tool was used for:
The mathematical content, proof architecture, and design decisions were verified by the author.
All Lean code compiles with no sorries.