feat(Foundations/Logic, Logics/Propositional): Hilbert proof systems, metalogic, ND equivalence, and Kripke semantics#633
Conversation
…nd MCS consistency foundations Adds the Cslib/Foundations/Logic/ module hierarchy: 16 files, 3,704 lines total. Provides Hilbert-style proof system infrastructure for downstream modal, temporal, and bimodal metalogic modules. - Core definitions: InferenceSystem typeclass, HasBot/HasImp connective classes, polymorphic axiom abbrevs, bundled proof system typeclasses, LogicalEquivalence - Theorem libraries: SKI/BCC combinators, propositional core (LEM, DNE, RAA), derived connective theorems, big conjunction, K-level and S5-level modal theorems, temporal derived theorems, frame conditions - Metalogic foundations: DerivationSystem with Lindenbaum's lemma via Zorn's lemma, MCS construction; HasHilbertTree with generic deduction theorem helpers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add 6 new files (ProofSystem/{Axioms,Derivation,Instances}, Metalogic/{DeductionTheorem,MCS},
NaturalDeduction/FromHilbert), update 2 modified files (Defs, NaturalDeduction/Basic),
add transitive dependency (Foundations/Data/ListHelpers), and update Cslib.lean imports.
Session: sess_1781124422_5169f2
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- FromHilbert.lean: change 6 `def` to `theorem` for Prop-valued results, remove redundant `noncomputable` modifiers - Instances.lean: wrap instances in `Cslib.Logic.PL` namespace to fix topNamespace lint errors - Defs.lean: replace Set.Image import with Set.Basic per lake shake Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace Mathlib.Order.SuccPred.LinearLocallyFinite with Mathlib.Data.Finset.Attr for import minimization. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…, and intuitionistic hierarchy Session: sess_1781153904_261d3f
Session: sess_1781153904_261d3f
Session: sess_1781153904_261d3f
… embeddings Add 13 new files from main: - 2 semantics files (Basic, Kripke) - 1 proof system instance file (IntMinInstances) - 9 metalogic files (Soundness/Completeness for classical, intuitionistic, minimal) - 2 cross-logic embedding files (Modal/FromPropositional, Temporal/FromPropositional) Session: sess_1781192410_b56b66
…nce over axiom sets Update 8 files from main with parameterized versions: - Axioms.lean: IntPropAxiom, MinPropAxiom, subsumption theorems - Derivation.lean: parameterized DerivationTree/Deriv/Derivable - Instances.lean: minor updates - DeductionTheorem.lean: parameterized over Axioms - MCS.lean: parameterized MCS properties - FromHilbert.lean: parameterized over Axioms - HilbertDerivedRules.lean: intuitionistic/classical layers - Equivalence.lean: parameterized hilbert_iff_nd ProofSystem.lean already has HilbertInt/HilbertMin tags; no changes needed. Modal bundled classes correctly excluded (out of scope). Session: sess_1781192410_b56b66
Add 13 import lines for new propositional files: - 9 metalogic (Soundness/Completeness for classical/intuitionistic/minimal) - 1 proof system instance (IntMinInstances) - 2 semantics (Basic, Kripke) - 2 cross-logic embeddings (Modal/Temporal FromPropositional) Generated via `lake exe mk_all --module`. Session: sess_1781192410_b56b66
…Modal/Temporal types The Modal/Temporal FromPropositional embedding files from main rely on Modal.Proposition having bot/imp constructors and Temporal.Syntax.Formula existing, neither of which is true on this branch. The branch's Modal.Proposition uses not/and/diamond as primitives. These embeddings require main's Modal/Temporal refactoring and are deferred to a future PR that brings those type changes. Session: sess_1781192410_b56b66
- Rename 8 snake_case defs to lowerCamelCase (defsWithUnderscore lint) - Remove @[simp] from mem_hilbertAxiomTheory (simpNF lint) - Fix 9 import issues per lake shake - Remove unused [DecidableEq Atom'] from FromHilbert.lean - Update Cslib.lean module list (mk_all --module) Session: sess_1781194255_b2a0c0
|
Hello, thank you for your interest in contributing to CSLib! At the moment this PR is very large. Especially for new contributors and/or when AI is involved, we ask for smaller PRs in the neighborhood of fewer than 500 lines, and even this is quite large for a first contribution. You can leave this PR open for reference, but it would be very helpful to extract a smaller PR that is easier to review. |
|
It would also be helpful to point out where exactly in your code is each reference used. More generally, please read the following: |
Replace all informal CZ abbreviations with Mathlib-style [ChagrovZakharyaschev1997] citations across 11 files. Add References section to Defs.lean. Fix NaturalDeduction/Basic.lean to use star bullets with [Prawitz1965] and [TroelstraVanDalen1988] BibKeys. Session: sess_1749674900_a3c1f2
Add ## References sections with [Blackburn2001] citation to Denotation.lean and LogicalEquivalence.lean. Basic.lean and Cube.lean already have correct references (unchanged). Session: sess_1749674900_a3c1f2
Wrap long citation lines to stay within 100-character limit. lake build passes cleanly with no warnings. Session: sess_1749674900_a3c1f2
Remove orphaned HughesCresswell1996 bib entry, add SorensenUrzyczyn2006, split compound citation in NaturalDeduction/Basic.lean, and convert 8 backtick-wrapped internal cross-references to bare paths. Session: sess_1749688800_orchestrate Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| private def h_implyK : | ||
| ∀ (φ ψ : PL.Proposition Atom), | ||
| PropositionalAxiom (φ.imp (ψ.imp φ)) := | ||
| fun φ ψ => .implyK φ ψ |
There was a problem hiding this comment.
I think you can use the syntactic sugar for this defined here:
cslib/Cslib/Logics/Propositional/Defs.lean
Lines 70 to 73 in 1f601a2
There was a problem hiding this comment.
Applied syntactic sugar throughout the file. The specific line you flagged uses .imp inside a ∀-quantified type signature where → would be parsed as the built-in function type arrow (Pi type) rather than the scoped Proposition.imp notation. Since → is overloaded in Lean 4, it resolves as a Pi type in that binder position, making the scoped notation unusable there. The same constraint applies to h_implyS and similar axiom witnesses throughout the Hilbert proof system. All other occurrences in the file have been replaced with the notation.
Three tasks to incorporate task 165 syntactic sugar changes into open PRs: - 166: PR leanprover#633 (pr1/foundations-logic) — Propositional, addresses xcthulhu review comment - 167: PR leanprover#637 (refactor/modal-primitives) — Modal - 168: pr3/temporal-formula branch — Temporal (no PR submission) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Apply notation replacements (¬, ∧, ∨, →, ↔, ⊥) to Propositional/ files on the pr1/foundations-logic branch. Add missing biconditional (↔) notation to Defs.lean. Fix parenthesization of (¬φ) ∈ S in MCS.lean (was being parsed as Prop-level negation). All CI checks pass. Session: sess_$(date +%s)_$(od -An -N3 -tx1 /dev/urandom | tr -d ' \n')
Applied syntactic sugar to PR leanprover#633 Propositional files on pr1/foundations-logic. All 6 phases completed, CI passed, pushed to remote branch. Session: sess_1781298334_941bd3
|
What would the level of effort be to strengthen your results to strong completeness? |
|
Should be straight forward. I'm working on it now, and will post here and Zulip once I have it buttoned up. |
Just pushed to the fork I'm working off of: Minimal LogicIntuitionistic LogicClassical LogicStill have some clean up to do. |
|
Why are there still weak completeness results now if you have strong completeness results? |
Just finished cleaning that up so that weak completeness (prop_completeness, int_completeness, min_completeness) are now 3-line corollaries of strong completeness, and used downstream (e.g., the conservative extension proofs for Modal K, Temporal BX, and Bimodal TM). |
Three tasks to incorporate task 165 syntactic sugar changes into open PRs: - 166: PR leanprover#633 (pr1/foundations-logic) — Propositional, addresses xcthulhu review comment - 167: PR leanprover#637 (refactor/modal-primitives) — Modal - 168: pr3/temporal-formula branch — Temporal (no PR submission) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Applied syntactic sugar to PR leanprover#633 Propositional files on pr1/foundations-logic. All 6 phases completed, CI passed, pushed to remote branch. Session: sess_1781298334_941bd3
Summary
Adds reusable Hilbert-style proof system infrastructure (
Foundations/Logic/) and a complete propositional logic development (Logics/Propositional/): 39 files, ~7,800 lines. The propositional logic includes soundness and completeness for classical, intuitionistic, and minimal systems, natural deduction equivalence, and Kripke semantics. The generic infrastructure is designed to extend modularly to modal, temporal, and bimodal logics in follow-up PRs.This supersedes the closed PR #630, extending it with:
Semantics/): Boolean and Kripke valuations with soundness and completeness for all three propositional systemsIntMinInstances.lean): proof system and ND equivalence parameterized over axiom predicates, enabling a single codebase to serve all three logicslake lint,lake shake,lake test, andlint-stylechecks pass cleanlyWhat's new vs PR #630
Semantics/Basic.lean,Semantics/Kripke.leanMetalogic/Soundness.lean,Metalogic/Completeness.leanMetalogic/IntSoundness.lean,IntLindenbaum.lean,IntCompleteness.leanMetalogic/MinSoundness.lean,MinLindenbaum.lean,MinCompleteness.leanProofSystem/IntMinInstances.leanDesign
Primitive connectives
The connective hierarchy takes
botandimpas primitives, following Church (1956) and the Tarski-Bernays-Wajsberg system. All other connectives are derived via the Lukasiewicz encoding (neg φ := imp φ bot, etc.) and defined asabbrevs, so Lean handles conversions by definitional equality. Axiom schemas are polymorphicabbrevs over[HasBot F] [HasImp F], instantiated at any formula type via typeclass resolution.Three-level proof system hierarchy
The classical/intuitionistic/minimal boundary is drawn by axiom selection:
The
PropositionalAxiominductive andAxiomspredicate are parameterized so thatInstances.leanregisters aClassicalHilbert(all four axioms), whileIntMinInstances.leanregistersIntuitionisticHilbert(no Peirce) andMinimalHilbert(no Peirce, no EFQ) instances over the same formula type.Metalogic: soundness and completeness
Each of the three systems has its own soundness and completeness proof:
⊥)⊥-forcing)botForcesThe Lindenbaum constructions use Zorn's lemma. The intuitionistic and minimal completeness proofs build canonical Kripke models whose worlds are prime/maximal consistent sets.
ND-Hilbert equivalence
The extensional equivalence between ND and Hilbert (
Equivalence.lean) proves that⊢_ND Γ ⊢ φ ↔ ⊢_H Γ ⊢ φfor classical propositional logic. Minimal logic has no ND equivalent (it lacks EFQ, which ND assumes) and is excluded. This enables using whichever proof system is more convenient while maintaining a single metalogic.Import hierarchy
All files use the Lean 4
modulekeyword withpublic importfor transitive visibility.File inventory (39 files)
Foundations/Logic/ (16 new files)
Connectives.leanHasBot,HasImp,HasBox,HasUntil,HasSince; bundled connective classesAxioms.leanabbrevs:ImplyK,ImplyS,EFQ,Peirce,DNE, modal/temporal axiomsProofSystem.leanModusPonens,Necessitation,HasAxiom*; bundledMinimalHilbertthroughBimodalTMHilbertTheorems/Combinators.leanimp_trans,pairing,dni,flipTheorems/Propositional/Core.leanefq_neg,rcpTheorems/Propositional/Connectives.leaniff_intro,contrapose_imp, De Morgan lawsTheorems/BigConj.leanBigConjsyntax and derivability lemmasTheorems/Modal/Basic.leanbox_mono,diamond_mono, modal dualityTheorems/Modal/S5.leanTheorems/Temporal/TemporalDerived.leanTheorems/Temporal/FrameConditions.leanTheorems.leanMetalogic/Consistency.leanDerivationSystem, Lindenbaum's lemma, MCS foundationsMetalogic/DeductionHelpers.leanHasHilbertTreetypeclass; generic deduction theorem helpersLogics/Propositional/ (18 new files)
ProofSystem/Axioms.leanPropositionalAxiominductive:implyK,implyS,efq,peirceProofSystem/Derivation.leanDerivationTreeproof witness,Derivwrapper, height functionProofSystem/Instances.leanInferenceSystem/PropositionalHilbertinstance registrationProofSystem/IntMinInstances.leanInferenceSysteminstance registrationMetalogic/DeductionTheorem.leanMetalogic/MCS.leanDerivationSysteminstantiation, MCS constructionMetalogic/Soundness.leanMetalogic/Completeness.leanMetalogic/IntSoundness.leanMetalogic/IntLindenbaum.leanMetalogic/IntCompleteness.leanMetalogic/MinSoundness.lean⊥-forcing)Metalogic/MinLindenbaum.leanMetalogic/MinCompleteness.leanSemantics/Basic.leanSemantics/Kripke.leanNaturalDeduction/FromHilbert.leanimpI/impE/botE, cut, weakening, substitutionNaturalDeduction/DerivedRules.leanNaturalDeduction/Equivalence.leanNaturalDeduction/HilbertDerivedRules.leanOther (1 new file, 4 modified files)
Foundations/Data/ListHelpers.leanremoveAlland supporting lemmas for deduction theorem filesFoundations/Logic/InferenceSystem.leanDerivableInLogics/Propositional/Defs.leanTheory, addedIsIntuitionistic/IsClassicalLogics/Propositional/NaturalDeduction/Basic.leanCslib.leanVerification
lake build: 0 errors (2754 jobs)lake test: pass (8758 jobs)lake lint: 0 errorslake exe lint-style: passlake exe checkInitImports: passlake exe mk_all --module --check: no update necessarylake shake --add-public --keep-implied --keep-prefix: no issues in contributed filesgrep -rn "sorry": 0 hits across all contributed filesReferences