feat(Logics/Propositional): five-primitive formula type with primitive bot#648
feat(Logics/Propositional): five-primitive formula type with primitive bot#648benbrastmckie wants to merge 5 commits into
Conversation
047b396 to
b041ae7
Compare
Session: sess_$(date +%s)_$(od -An -N3 -tx1 /dev/urandom | tr -d ' ')
Add Kamp1968, Xu1988, Venema1993SinceUntil to references.bib. Update pr-description.md with Burgess/Xu/Venema/GHR citations, Zulip discussion link, and PR leanprover#648 dependency reference. Session: sess_1781487302_dddcf1
Stack Modal PR on feat/propositional-v2 (PR leanprover#648) like PR leanprover#649 does, keeping it independent of temporal additions. Two-PR chain, not three. Session: sess_1781531573_4cdbb4
Stack on PR leanprover#648 (not leanprover#649), diplomatic PR description as first-class deliverable, integrate PR landscape audit (report 06). Session: sess_1781532709_eb0889
Diplomatic PR description for Modal/ formula primitives refactoring, stacking on PR leanprover#648. Coordinates with PRs leanprover#607, leanprover#528, leanprover#535, leanprover#649. Session: sess_1781535860_c7d8e9
There was a problem hiding this comment.
Some general comments:
- I like the idea of adding \bot as a primitive.
- I don't understand why we need both Semantics/Basic.lean and Semantics/Bool.lean. I think the latter alone is enough. Later we can add (for example) Kripke semantics for intuitionistic propositional logic.
- It is not helpful to the readers to refer to old papers from the 1930s, some of which are in German. A good modern reference is Jeremy Avigad's textbook:
https://www.cambridge.org/core/books/mathematical-logic-and-computation/300504EAD8410522CE0C27595D2825A2
whose chapters 2 and 3 covers everything in this PR. - You should definitely coordinate this PR with #607 abd #587. #536 is ready to merge, so you should wait for it.
|
I think the refactor to
Re the renaming Please split the semantics development into a separate PR. The point of requesting that large contributions are split up is not just length, but also so that conceptually separate issues can be discussed independently. FWIW, as I mentioned on zulip, imo the right way to resolve the Re the references, I agree with @ctchou about citing literature in English — the Gentzen paper is my bad, I read it in translation (in "The Collected Papers of Gerhard Gentzen" ed M. E. Szabo). |
6083b4c to
7cc0961
Compare
|
@ctchou @thomaskwaring Thank you both for the thoughtful feedback — I've reworked the PR to address each point. Changes made:
On the On bot as primitive vs atom: The key distinction is that in minimal logic bot is an unconstrained logical constant (a nullary operator), not an atom — no axioms constrain its denotation, but it's fixed under substitution. With primitive On Looking forward to your thoughts on the revised version! |
Refocused from PR leanprover#649 to PR leanprover#648 (feat/propositional-v2). Updated task description and created 6-phase plan for bot refactor. Session: sess_1781632241_ba8d68
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3-phase plan for drafting PR description, PR comment, and Zulip response for PR leanprover#648 review. All outputs target specs/tmp/ for user review. Session: sess_1781646913_02137d
Delete Proposition.instBot_eq and Proposition.instTop_eq theorems from Cslib/Logics/Propositional/Defs.lean. These two theorems auto-include the [DecidableEq Atom] section variable which they do not use, triggering unusedSectionVars/unusedDecidableInType warnings that --wfail promotes to build errors. PR leanprover#648 already removed these theorems in its direction. Session: sess_1781650791_5f754f Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Delete Proposition.instBot_eq and Proposition.instTop_eq theorems from Cslib/Logics/Propositional/Defs.lean. These two theorems auto-include the [DecidableEq Atom] section variable which they do not use, triggering unusedSectionVars/unusedDecidableInType warnings that --wfail promotes to build errors. PR leanprover#648 already removed these theorems in its direction. Session: sess_1781650791_5f754f Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Phase 1: Deleted instBot_eq/instTop_eq from Defs.lean (CI fix) Phase 2: Removed snce past-time operator from Temporal.Formula Phase 3: Blocked on PR leanprover#648 approval Session: sess_1781650791_5f754f
Rebase feat/temporal-formula-propositional onto feat/propositional-v2 head (7cc0961). Resolved conflicts in Connectives.lean, Defs.lean, Basic.lean, Theory.lean — taking PR leanprover#648 as base, adding temporal classes on top. All CI checks pass: lake build, checkInitImports, lint-style, lint, lake test. instIsIntuitionisticIntuitionisticCompletion preserved, instBot_eq/instTop_eq absent, snce removed. Force-pushed to origin with --force-with-lease. Session: sess_1781650791_5f754f Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
225: Implement GHA algebraic semantics with primitive bot on main 226: Cherry-pick from main to create PR stacked on leanprover#648 Session: sess_1750107600_orchestrate
… findings Session: sess_1750130000_research227 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> task 228: complete implementation Fix two docstring issues in PR leanprover#648: update intuitionisticCompletion docstring to reflect primitive bot semantics, and change "five-primitive propositional signature" to "five constructors" in Connectives.lean module doc. Session: sess_1750217870_a3b2c1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> task 228: complete orchestration Session: sess_1750217870_a3b2c1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…#648 refresh Recreates the four tasks lost during the main cleanup, aligned with Thomas Waring's closing recommendation in the CSLib Zulip "Propositional Logic" thread (606970606) and our synthesis decision: - 398 efq_nd_rule_ipl_base_keep_mpl: make IPL the base logic (efq as a primitive ND rule) while PRESERVING all completed MPL metatheory as a retained layer. Depends on 397 (green main). - 399 refresh_pr648_ipl_base_foundation: update PR leanprover#648 to the settled IPL-base foundation (refs + Zulip link), small + upstream-based cherry pick, connectives excluded. Depends on 398. - 400 reconcile_connectives_pr607: unbundle connectives, reconcile with fmontesi PR leanprover#607 (Waring flag a). - 401 polymorphic_evaluator_bool_prop_dpll: AlgEvaluate at Bool/Prop for DPLL (Doty/Waring). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NarRy36MgZCZP7TRsrL5Df
…st-merge) Post-merge vet of the merged Propositional development. CI: build/test/ checkInitImports/lint-style PASS; lake lint FAILS (54 errors). PR leanprover#648 foundation slice (Defs.lean + NaturalDeduction/Basic.lean) is lint-clean. - Refresh 386: 21 PL-specific lint violations (accurate post-merge scope). - New 406: 33 cross-cutting lint (Modal/Temporal/Bimodal/Foundations); absorbs 394. - Refresh 390 (ORGANISATION.md), 387 (PL->Propositional, upstream-gated), 384 (sorry location -> Minimal/Completeness.lean:110). - Abandon 394 (absorbed into 406). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NarRy36MgZCZP7TRsrL5Df
65a3af7 to
c9364b6
Compare
|
Thanks for the review, @ctchou. I've reworked the PR and narrowed its scope considerably since you looked at it. Here's how it stands against your comments: Scope and semantics. Following the design discussion with Thomas Waring on the CSLib Zulip thread, #648 is now just the IPL-base foundation: References. I've added Avigad's textbook as the lead modern reference — it's cited first in both the implementation notes and the reference list. I've kept Gentzen, Prawitz, and Troelstra & van Dalen, but de-emphasized Gentzen (now last) and replaced its German title with an English gloss, so the 1930s German paper is no longer quoted. Happy to drop it entirely if you'd prefer. Coordination. #536 has merged and this branch is rebased on top of it. Removing the semantics and the connective typeclasses from #648 also removes its overlap with #587 (notation typeclasses and models) and #607 (logical operators), which were the main points of contact; I'll leave reviews on those to help them land. Happy to wait for other maintainers' input on the |
Fetch GitHub PR leanprover#648, Zulip thread 606970606 (27 msgs), and local repo state to produce research report for PR refresh strategy. Session: sess_1782661425_115d26_399
…resh [PR READY] Cherry-pick recipe, prepare-foundation-branch.sh, pr-description.md, and zulip-response.md for a focused foundation-only refresh of PR leanprover#648. Build verified off upstream/main (v4.32.0-rc1): Defs, Basic, barrel all green; checkInitImports and lint-style pass. Task transitioned to [PR READY]. Session: sess_1782673164_f5576d_399
Tasks: 398 (completed), 399 (PR READY) Task 398: efq promoted to gated primitive ND constructor; IPL-as-base; MPL retained; 7/7 phases; full CI green; zero-debt. Task 399: PR leanprover#648 foundation refresh prepared (cherry-pick recipe + isolated build verify + PR/Zulip drafts); awaiting user /pr. Session: sess_1782673164_f5576d
Supersede the full-replacement cherry-pick recipe with a minimal additive refactor (ungated primitive efq -> IPL is the base). Implementation done and verified on branch feat/propositional-ipl-base (commit 5dbed274); leanprover#648 updates via fast-forward push, no force. MPL-as-base dispute deferred to tasks 407-409. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019sHZHp7U5qSiEzioK1nGEH
…-neg point) Add engagement report + concrete review points for fmontesi PR leanprover#607: the primary HasBot-vs-primitive-HasNot design issue for IPL/MPL, plus naming, notation-precedence, and bundling deltas. Note prereq done -- Connectives.lean removed from leanprover#648 (commit 85db79a6). Status -> researched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019sHZHp7U5qSiEzioK1nGEH
PR leanprover#648 rebased onto current upstream/main (toolchain v4.32.0-rc1), 3 clean commits (head 63cd13c), GitHub CI green, MERGEABLE. Drafts updated: drop the stale fast-forward/85db79a6/v4.31.0 wording; references corrected to 3 (Gentzen/Prawitz/Troelstra-van Dalen; Johansson omitted as minimal is set aside). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019sHZHp7U5qSiEzioK1nGEH
…er#648 body Rework pr-description.md to surgically edit the CURRENT live PR leanprover#648 description (same Summary/Modified files/Design rationale/Coordination/Deferred skeleton) instead of a from-scratch rewrite: drop the now-stale 'New files: Connectives.lean' and 'Cslib.lean' entries (not in the net 4-file diff), add the efq/IPL-base points, and correct references to Gentzen/Prawitz/Troelstra-van Dalen. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019sHZHp7U5qSiEzioK1nGEH
… +Avigad2022) Restore the Avigad2022 references.bib entry (dropped during the merge resolution) so Defs.lean's [Avigad2022] citation resolves; amended into the IPL-base commit and force-pushed (leanprover#648 head 65a3af7, MERGEABLE). Update the pr-description draft's head hash and references list accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019sHZHp7U5qSiEzioK1nGEH
…description Replace "a HasBot class is needed" with the corrected position (reuse Mathlib Bot/Top + derived HasNot + (φ → ⊥)=¬φ grind bridge, no HasBot). Aligns the leanprover#648 body with task 400's report 02 / pr-response / zulip-response. Also pushed to the live PR leanprover#648 body. Session: sess_1782754611_b50d40
…s live leanprover#648) Remove the inaccurate/out-of-scope namespace note (Cslib.Logic.PL is identical to upstream, not changed by this PR) and list Avigad 2022 in the Summary references bullet for consistency with the Modified-files line. Draft now matches the live PR leanprover#648 description. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019sHZHp7U5qSiEzioK1nGEH
…m self-correction Lead with leanprover#648 status (efq/IPL-base, deferrals, connectives out), self-correct the falsum framing (reuse Mathlib Bot/Top, no HasBot) to match leanprover#607 review, and note imp/impI/impE is settled in leanprover#648. Session: sess_1782754611_b50d40
Address Waring's four points: accept the efq-primitive/IPL-base compromise (done in leanprover#648), agree fragment design is deferred (manipulations carry over by spec), connectives out -> brief leanprover#607 mention, and confirm references + Zulip link now in the PR (his missing-refs flag). Session: sess_1782754611_b50d40
…e bot Add `bot` as a primitive constructor of `Proposition Atom`, eliminating all `[Bot Atom]` constraints from propositional logic signatures. - New `Connectives.lean`: typeclass hierarchy (HasBot, HasImp, HasAnd, HasOr) - `Defs.lean`: five-primitive Proposition type with derived neg, top, iff - `Basic.lean`: natural deduction with impI/impE, andI/andE1/andE2, orI1/orI2 - `Theory.lean`: remove [Bot Atom], add instIsIntuitionisticIntuitionisticCompletion - Replace German-language references with Avigad 2022, Prawitz 1965 - Semantics files deferred to follow-up PR per reviewer request Reconciles with merged PR leanprover#536 (InferenceSystem-parameterized typeclasses). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update intuitionisticCompletion docstring — the old wording "Attach a bottom element" was misleading since bot is already a constructor. Change "five-primitive propositional signature" to "five constructors" in Connectives.lean to avoid conflating generators with operations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… falso Promote ex falso quodlibet (bottom-elimination) to an ungated primitive constructor of the natural-deduction Derivation, so IPL is the base propositional logic and the primitive bot constructor has an inference rule. IPL becomes the empty base theory; CPL still adds double negation elimination. The minimal-logic (MPL) layer is deferred to a separate PR: this removes MPL, the IsIntuitionistic typeclass, intuitionisticCompletion, and the derived efq rules, keeping the classical layer (byContra/lem/pierce and the IsClassical instances for CPL/LEM/Pierce) intact, re-proved via the efq constructor. Per reviewer feedback (Waring, CSLib Zulip 'Propositional Logic'): - Drop the connective typeclasses (Foundations/Logic/Connectives.lean and its registration instances) -- a separate development handled via PR leanprover#607. - Restore references (Gentzen 1935, Prawitz 1965, Troelstra-van Dalen 1988) and add the CSLib Zulip thread link. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019sHZHp7U5qSiEzioK1nGEH
…rived rules PR review polish for leanprover#648. Reverts unrequested churn on Thomas Waring's original design: makes Γ implicit again on the Derivation constructors (andI/andE/orI/orE), restores the andE₁/andE₂/orI₁/orI₂ subscript names, and cleans up the resulting explicit-Γ/`_` noise at all call sites in weak/subs/substAtom. Keeps the intentional impI/impE rename. Restores contra/efqRule as plain derived rules over the now-primitive efq constructor (no longer needs an IsIntuitionistic typeclass), and uses contra to simplify IsClassical.pierce back to a readable tactic proof. Makes Atom explicit again on CPL/LEM/Pierce (Mathlib-typical for type-family constants), removing the `(Atom := Atom)` noise at their use sites, and unifies CPL's definition with the set-builder idiom already used for LEM/Pierce. Normalizes copyright headers to the standard single-copyright-line, dual-author-line format. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Reviewer ctchou asked for English-language references. Replaces the German-title journal entry with the standard English-translation citation (Szabo (ed.), The Collected Papers of Gerhard Gentzen, North-Holland, 1969, pp. 68-131), keeping a note pointing to the original 1935 Mathematische Zeitschrift publication. The doc-comment citation text in the .lean files already used the English title, so no further changes were needed there. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
c9364b6 to
9376b73
Compare
…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
Summary
Revises PR #648 based on reviewer feedback (thomaskwaring, msg 606970606). Adds
botas a primitive constructor ofProposition(eliminating all[Bot Atom]constraints) and makes IPL the base logic by taking ex falso quodlibet as a primitive natural-deduction rule. Rebased on upstream/main post-#536.Key changes from #648:
botis a primitive constructor (not an atom), so explosion andIsClassicalno longer require[Bot Atom]efqconstructor ofDerivation), so⊥has an inference rule and IPL is the base logic; minimal logic (MPL) is set aside for a separate PR/discussion, per the agreed compromiseimp/impI/impE(renamed fromimpl/implI/implEfor consistency with FormalizedFormalLogic convention; open to reverting if reviewers preferimpl)Connectives.lean)Modified files
Cslib/Logics/Propositional/Defs.lean--Propositionwith primitivebot; derivedneg,top,iff;IPLis the empty base theory andCPLadds double-negation elimination (theMPL/IsIntuitionistic/intuitionisticCompletionlayer is set aside for the minimal-logic PR)Cslib/Logics/Propositional/NaturalDeduction/Basic.lean-- derivation constructorsimpI/impE,andE1/andE2,orI1/orI2with explicitΓarguments, plus the new primitiveefq(⊥-elimination); implementation notes, references, and Zulip-thread linkCslib/Logics/Propositional/NaturalDeduction/Theory.lean--[Bot Atom]removed; the classical layer (IsClassical,byContra/lem/pierce, and theCPL/LEM/Pierceinstances) re-proved over the new base via theefqconstructorreferences.bib-- addedAvigad2022,Gentzen1935,Prawitz1965,TroelstraVanDalen1988Design rationale
Primitive
boteliminates[Bot Atom]constraints throughout the propositional logic API, givesProposition.substa natural recursive case forbot, and follows the standard treatment in Avigad (2022) wherebotis a logical constant rather than an atomic proposition. The trade-off (noted by thomaskwaring) is an extrabotcase in structural recursions. Relatedly, taking ex falso as a primitive rule rather than leaving⊥a constructor with no inference behaviour follows the standard natural-deduction treatment (Gentzen 1935, Prawitz 1965, Troelstra & van Dalen 1988) and is thomaskwaring's recommendation; minimal logic — the efq-free fragment — is deferred so the fragment design can be settled on its own.These benefits extend to planned completeness work for modal and temporal logics: primitive
botensuresProposition.substpreserves bottom structurally (subst f .bot = .bot), whereas atom-encoded bot requires additional constraints to preventsubst f (.atom ⊥) = f ⊥from mapping bottom to an arbitrary formula. As thomaskwaring notes, non-bottom-preserving maps are also useful (e.g., conservativity results viaWithBot.some).Coordination
Connectives.lean. One design point for feat(Logic): logical operators #607: it makes negation primitive (HasNot) with no⊥/⊤class, but a⊥-primitiveProposition(where¬φ := φ → ⊥and⊤ := ⊥ → ⊥) registers faithfully by reusing Mathlib'sBot/Toptogether with a derivedHasNot(not := neg) and a(φ → ⊥) = ¬φgrind bridge — no separateHasBotclass needed. I'll leave a review on feat(Logic): logical operators #607.Deferred
Bool.lean, evaluation) -- follow-up PR; thePropvsBoolvsGeneralizedHeytingAlgebraquestion (raised by thomaskwaring and ctchou) will be addressed there.AI Tools Used
Claude Code was used to refactor for primitive
efq/IPL-base, remove the connective typeclasses and the minimal-logic layer, rebase onto upstream/main and resolve thereferences.bibconflict, and verify CI. All mathematical decisions reviewed.