Skip to content

feat(Foundations/Logic, Logics/Propositional): Hilbert proof systems, metalogic, ND equivalence, and Kripke semantics#633

Closed
benbrastmckie wants to merge 19 commits into
leanprover:mainfrom
benbrastmckie:pr1/foundations-logic
Closed

feat(Foundations/Logic, Logics/Propositional): Hilbert proof systems, metalogic, ND equivalence, and Kripke semantics#633
benbrastmckie wants to merge 19 commits into
leanprover:mainfrom
benbrastmckie:pr1/foundations-logic

Conversation

@benbrastmckie

Copy link
Copy Markdown

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:

  • Kripke semantics (Semantics/): Boolean and Kripke valuations with soundness and completeness for all three propositional systems
  • Metalogic for three systems: soundness, Lindenbaum's lemma, and completeness for classical, intuitionistic (Kripke), and minimal (Kripke) logic
  • Axiom parameterization (IntMinInstances.lean): proof system and ND equivalence parameterized over axiom predicates, enabling a single codebase to serve all three logics
  • CI compliance: all lake lint, lake shake, lake test, and lint-style checks pass cleanly

What's new vs PR #630

Addition Files
Kripke semantics (frames, models, forcing) Semantics/Basic.lean, Semantics/Kripke.lean
Classical soundness and completeness Metalogic/Soundness.lean, Metalogic/Completeness.lean
Intuitionistic soundness, Lindenbaum, completeness Metalogic/IntSoundness.lean, IntLindenbaum.lean, IntCompleteness.lean
Minimal soundness, Lindenbaum, completeness Metalogic/MinSoundness.lean, MinLindenbaum.lean, MinCompleteness.lean
Intuitionistic/minimal proof system instances ProofSystem/IntMinInstances.lean
Full CI compliance (lint, shake, style) All files

Design

Primitive connectives

The connective hierarchy takes bot and imp as 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 as abbrevs, so Lean handles conversions by definitional equality. Axiom schemas are polymorphic abbrevs 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:

MinimalHilbert             -- ImplyK + ImplyS + ModusPonens
  ├── IntuitionisticHilbert  -- + EFQ
  │     └── ClassicalHilbert       -- + Peirce
  ├── ModalHilbert           -- + BoxK + Necessitation
  │     └── ModalS5Hilbert         -- + BoxT + Axiom5
  └── ...

The PropositionalAxiom inductive and Axioms predicate are parameterized so that Instances.lean registers a ClassicalHilbert (all four axioms), while IntMinInstances.lean registers IntuitionisticHilbert (no Peirce) and MinimalHilbert (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:

System Semantics Soundness Completeness
Classical Boolean valuations Direct induction on derivation trees Lindenbaum + MCS canonical model
Intuitionistic Kripke frames (preorder, monotone, hereditary ) Induction on forcing relation Prime theory canonical model
Minimal Kripke frames (preorder, monotone, explicit -forcing) Induction on forcing relation Prime theory canonical model with botForces

The 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 module keyword with public import for transitive visibility.

Foundations/Logic/  →  Logics/Propositional/  →  Modal/  (future PR)
                                              →  Temporal/  →  Bimodal/  (future PRs)

File inventory (39 files)

Foundations/Logic/ (16 new files)

File Role
Connectives.lean HasBot, HasImp, HasBox, HasUntil, HasSince; bundled connective classes
Axioms.lean Polymorphic axiom abbrevs: ImplyK, ImplyS, EFQ, Peirce, DNE, modal/temporal axioms
ProofSystem.lean ModusPonens, Necessitation, HasAxiom*; bundled MinimalHilbert through BimodalTMHilbert
Theorems/Combinators.lean I, B, C combinators; imp_trans, pairing, dni, flip
Theorems/Propositional/Core.lean LEM, DNE, RAA, efq_neg, rcp
Theorems/Propositional/Connectives.lean iff_intro, contrapose_imp, De Morgan laws
Theorems/BigConj.lean BigConj syntax and derivability lemmas
Theorems/Modal/Basic.lean K-level: box_mono, diamond_mono, modal duality
Theorems/Modal/S5.lean Axiom 5 derivation, collapse theorems
Theorems/Temporal/TemporalDerived.lean Temporal operator lemmas
Theorems/Temporal/FrameConditions.lean Frame condition marker typeclasses
Theorems.lean Barrel aggregator
Metalogic/Consistency.lean DerivationSystem, Lindenbaum's lemma, MCS foundations
Metalogic/DeductionHelpers.lean HasHilbertTree typeclass; generic deduction theorem helpers

Logics/Propositional/ (18 new files)

File Role
ProofSystem/Axioms.lean PropositionalAxiom inductive: implyK, implyS, efq, peirce
ProofSystem/Derivation.lean DerivationTree proof witness, Deriv wrapper, height function
ProofSystem/Instances.lean Classical InferenceSystem/PropositionalHilbert instance registration
ProofSystem/IntMinInstances.lean Intuitionistic and minimal InferenceSystem instance registration
Metalogic/DeductionTheorem.lean Deduction theorem by induction on derivation height
Metalogic/MCS.lean DerivationSystem instantiation, MCS construction
Metalogic/Soundness.lean Classical soundness (Boolean valuations)
Metalogic/Completeness.lean Classical completeness (Lindenbaum + canonical model)
Metalogic/IntSoundness.lean Intuitionistic soundness (Kripke)
Metalogic/IntLindenbaum.lean Intuitionistic Lindenbaum's lemma (prime theories)
Metalogic/IntCompleteness.lean Intuitionistic completeness (canonical Kripke model)
Metalogic/MinSoundness.lean Minimal soundness (Kripke with explicit -forcing)
Metalogic/MinLindenbaum.lean Minimal Lindenbaum's lemma
Metalogic/MinCompleteness.lean Minimal completeness (canonical Kripke model)
Semantics/Basic.lean Boolean valuations and classical satisfaction
Semantics/Kripke.lean Kripke frames, models, forcing relation
NaturalDeduction/FromHilbert.lean ND wrappers over Hilbert: impI/impE/botE, cut, weakening, substitution
NaturalDeduction/DerivedRules.lean ND derived rules for conjunction, disjunction, negation, biconditional
NaturalDeduction/Equivalence.lean Extensional equivalence proof between ND and Hilbert systems
NaturalDeduction/HilbertDerivedRules.lean Hilbert derived rules via ND transport

Other (1 new file, 4 modified files)

File Role
Foundations/Data/ListHelpers.lean New: removeAll and supporting lemmas for deduction theorem files
Foundations/Logic/InferenceSystem.lean Modified: minor adjustment for DerivableIn
Logics/Propositional/Defs.lean Modified: parameterized Theory, added IsIntuitionistic/IsClassical
Logics/Propositional/NaturalDeduction/Basic.lean Modified: align with parameterized axiom infrastructure
Cslib.lean Modified: 35 new import lines

Verification

  • lake build: 0 errors (2754 jobs)
  • lake test: pass (8758 jobs)
  • lake lint: 0 errors
  • lake exe lint-style: pass
  • lake exe checkInitImports: pass
  • lake exe mk_all --module --check: no update necessary
  • lake shake --add-public --keep-implied --keep-prefix: no issues in contributed files
  • grep -rn "sorry": 0 hits across all contributed files

References

  • Blackburn, P., de Rijke, M. and Venema, Y. (2001). Modal Logic. Cambridge University Press.
  • Chellas, B.F. (1980). Modal Logic: An Introduction. Cambridge University Press.
  • Church, A. (1956). Introduction to Mathematical Logic, Vol. I. Princeton University Press.
  • Curry, H.B. and Feys, R. (1958). Combinatory Logic, Vol. I. North-Holland.
  • Griffin, T.G. (1990). "A Formulae-as-Types Notion of Control". POPL 1990.
  • Howard, W.A. (1969/1980). "The Formulae-as-Types Notion of Construction".
  • Kripke, S. (1963). "Semantical Analysis of Modal Logic I". Zeitschrift für mathematische Logik und Grundlagen der Mathematik, 9:67-96.
  • Troelstra, A.S. and Schwichtenberg, H. (2000). Basic Proof Theory. 2nd edition. Cambridge University Press.

AI Disclosure: This contribution was developed with assistance from Claude (Anthropic). All proofs have been reviewed and machine-verified by the Lean 4 type checker.

benbrastmckie and others added 14 commits June 10, 2026 12:58
…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
… 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
@chenson2018

Copy link
Copy Markdown
Collaborator

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.

@ctchou

ctchou commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

It would also be helpful to point out where exactly in your code is each reference used.

More generally, please read the following:
https://github.com/leanprover/cslib/blob/main/CONTRIBUTING.md#the-role-of-ai

benbrastmckie and others added 4 commits June 11, 2026 14:10
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>
Comment on lines +42 to +45
private def h_implyK :
∀ (φ ψ : PL.Proposition Atom),
PropositionalAxiom (φ.imp (ψ.imp φ)) :=
fun φ ψ => .implyK φ ψ

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use the syntactic sugar for this defined here:

@[inherit_doc] scoped infix:36 " ∧ " => Proposition.and
@[inherit_doc] scoped infix:35 " ∨ " => Proposition.or
@[inherit_doc] scoped infix:30 " → " => Proposition.impl
@[inherit_doc] scoped prefix:40 " ¬ " => Proposition.neg

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

benbrastmckie added a commit to benbrastmckie/cslib that referenced this pull request Jun 12, 2026
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')
@benbrastmckie benbrastmckie deleted the pr1/foundations-logic branch June 13, 2026 00:10
benbrastmckie added a commit to benbrastmckie/cslib that referenced this pull request Jun 13, 2026
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
@xcthulhu

Copy link
Copy Markdown

What would the level of effort be to strengthen your results to strong completeness?

@benbrastmckie

Copy link
Copy Markdown
Author

Should be straight forward. I'm working on it now, and will post here and Zulip once I have it buttoned up.

@benbrastmckie

Copy link
Copy Markdown
Author

What would the level of effort be to strengthen your results to strong completeness?

Just pushed to the fork I'm working off of:

Minimal Logic

Intuitionistic Logic

Classical Logic

Still have some clean up to do.

@xcthulhu

Copy link
Copy Markdown

Why are there still weak completeness results now if you have strong completeness results?

@benbrastmckie

benbrastmckie commented Jun 14, 2026

Copy link
Copy Markdown
Author

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).

benbrastmckie added a commit to benbrastmckie/cslib that referenced this pull request Jun 14, 2026
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>
benbrastmckie added a commit to benbrastmckie/cslib that referenced this pull request Jun 14, 2026
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
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.

5 participants