Skip to content

feat: add Logics/Propositional/NaturalDeduction/*#91

Merged
fmontesi merged 218 commits intoleanprover:mainfrom
thomaskwaring:nj-deduction
Apr 29, 2026
Merged

feat: add Logics/Propositional/NaturalDeduction/*#91
fmontesi merged 218 commits intoleanprover:mainfrom
thomaskwaring:nj-deduction

Conversation

@thomaskwaring
Copy link
Copy Markdown
Collaborator

@thomaskwaring thomaskwaring commented Oct 9, 2025

Natural deduction for minimal logic

This PR adds the definitions and basic properties of natural deduction for propositional logic.

Key developments:

  • Definition of Theory.Derivation, the type of derivation trees.
  • Definitions of derivability and equivalence.
  • Operations on derivations: weakening, substitution and cut.

twwar and others added 21 commits April 6, 2026 15:43
## Summary
- Updates `bump_toolchain_nightly-testing.yml` to change the mathlib
dependency name from `mathlib` to `mathlib-nightly-testing` in
`lakefile.toml`
- This ensures the workflow correctly references the nightly-testing
variant of mathlib, not just updating the rev

## Changes
- Added `sed` command to update `name = "mathlib"` to `name =
"mathlib-nightly-testing"`
- This runs alongside the existing `rev` update

## Test plan
- [ ] Verify the workflow runs successfully on the next scheduled
execution or manual trigger
- [ ] Confirm `lakefile.toml` on `nightly-testing` branch has both
correct name and rev after workflow runs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
…eanprover#99)

## Summary
- Validates lakefile.toml has git-based mathlib4-nightly-testing
dependency
- Updates only the `rev` field (not `name` field)
- Fails if dependency not in expected git-based format

This avoids Reservoir by assuming nightly-testing branch already uses
git field.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
Add repository checks to nightly-testing workflows to prevent them from
running in forks.
Co-authored-by: Chris Henson <chrishenson.net@gmail.com>
[x] Introduce the namespace `Cslib` for all `Cslib` files
[x] Introduce the namespace `CslibTests` for all `CslibTests` files
[x] Fix the inconsistencies in linebreaks for all namespace related
declarations
[x] Use the convention that the namespace begins one line after the
module docstring.

---------

Co-authored-by: Chris Henson <chrishenson.net@gmail.com>
…prover#102)

Normally we check that our library and documentation are using the same
`lean-toolchain`. However the [nightly testing
workflow](.github/workflows/merge_main_into_nightly-testing.yml) by
design is meant to test a toolchain ahead of our current pinned version.
To accommodate this, this PR changes the doc toolchain check to only
happen during pull requests and commits to the `main` branch.
Note that in Mathlib we actually enforce in CI that everything in
scripts/ is documented in this file. Not implemented here.
This is the initial version of ωSequence with reference to:

https://leanprover.zulipchat.com/#narrow/channel/513188-CSLib/topic/Automata/near/543709917

---------

Co-authored-by: Fabrizio Montesi <famontesi@gmail.com>
`ωSequence.flatten` is analogous to `List.flatten`: it concatenates an
infinite sequence of (finite) lists to form an infinite sequence.
…decidability (leanprover#113)

This file did not depend on Mathlib, which given the use of `weak` in
`lakefile.toml` meant that this was silently not linted. There are three
other files for which this is true:
```
Cslib.Foundations.Syntax.HasAlphaEquiv
Cslib.Foundations.Syntax.HasSubstitution
Cslib.Foundations.Syntax.HasWellFormed
```
but they only define notation typeclasses and have no lint problems.

While here, I also took the opportunity to make a decidability proof
easier to read.
This pull request extends the development of SKI combinatory logic —
adding notions of evaluation and normal forms, and proving a version of
[Rice's theorem](https://en.wikipedia.org/wiki/Rice%27s_theorem). The
results and definitions are contained in the new file
`CombinatoryLogic/Evaluation.lean`, which is based heavily on the
[following
development](https://gist.github.com/b-mehta/e412c837818223b8f16ca0b4aa19b166)
by Bhavik Mehta.

### Notes

The definitions and results of this PR allows us to define normal-order
evaluation as a `PFun`, in [the sense of
Mathlib](https://leanprover-community.github.io/mathlib4_docs/Mathlib/Data/PFun.html).
The missing piece to make this useful is the so-called _Standardisation
theorem_, saying that normal-order reduction will find a normal form, if
there is one. The proof of Theorem T9 of Section C in _A Mathematical
Logic Without Variables_ (Rosser, 1935) should be amenable to
formalization. This would be very interesting, as it ought to define a
surjection from SKI terms to, for instance, [partial recursive
functions](https://leanprover-community.github.io/mathlib4_docs/Mathlib/Computability/Partrec.html)
on the natural numbers, demonstrating that SKI terms are
Turing-complete.

---------

Co-authored-by: twwar <tom.waring@unimelb.edu.au>
Co-authored-by: Maximiliano Onofre-Martínez <maxonomar@ciencias.unam.mx>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Fabrizio Montesi <famontesi@gmail.com>
Co-authored-by: Tristan F.-R. <pub.tristanf@gmail.com>
Co-authored-by: euprunin <178733547+euprunin@users.noreply.github.com>
Co-authored-by: euprunin <euprunin@users.noreply.github.com>
Co-authored-by: kei <70096720+thelissimus@users.noreply.github.com>
Co-authored-by: Juan Pablo Yamamoto <jpy051@uregina.ca>
Co-authored-by: Kim Morrison <477956+kim-em@users.noreply.github.com>
Co-authored-by: Alexandre Rademaker <arademaker@gmail.com>
Co-authored-by: Clark Barrett <barrett@cs.stanford.edu>
Co-authored-by: Chris Henson <chrishenson.net@gmail.com>
marcelolynch and others added 2 commits April 6, 2026 15:57
[This
commit](leanprover-community/mathlib4@ed4fde1#diff-54ef6c59abdddf67950b1ee785a0c22c7e03d04f9ad8cdb7cf1d336a72f4d850)
in mathlib4 moves `foldl_eq_foldr` to another module, so we need to
import it or the build fails with

```lean
error: Cslib/Computability/URM/Basic.lean:178:27: Unknown constant `List.foldl_eq_foldr`
```

This PR updates the lake manifest past this commit with `lake update
mathlib` and fixes the issue
Co-authored-by: mathlib4-bot <github-mathlib4-bot@leanprover.zulipchat.com>
Co-authored-by: leanprover-community-mathlib4-bot <129911861+leanprover-community-mathlib4-bot@users.noreply.github.com>
Co-authored-by: Kim Morrison <kim@tqft.net>
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com>
Co-authored-by: Chris Henson <chrishenson.net@gmail.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Kim Morrison <477956+kim-em@users.noreply.github.com>
Co-authored-by: Ching-Tsun Chou <chingtsun.chou@gmail.com>
Co-authored-by: Alexandre Rademaker <arademaker@gmail.com>
Co-authored-by: mathlib-nightly-testing[bot] <mathlib-nightly-testing[bot]@users.noreply.github.com>
Co-authored-by: mathlib-nightly-testing[bot] <258991302+mathlib-nightly-testing[bot]@users.noreply.github.com>
Comment thread Cslib/Logics/Propositional/NaturalDeduction/Basic.lean Outdated
Comment thread Cslib/Logics/Propositional/NaturalDeduction/Basic.lean Outdated
Copy link
Copy Markdown
Collaborator

@fmontesi fmontesi left a comment

Choose a reason for hiding this comment

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

Looks good to me now, just minor easy nitpicks about names.

Comment thread Cslib/Logics/Propositional/NaturalDeduction/Basic.lean Outdated
Comment thread Cslib/Logics/Propositional/NaturalDeduction/Basic.lean Outdated
Comment thread Cslib/Logics/Propositional/NaturalDeduction/Basic.lean Outdated
Comment thread Cslib/Logics/Propositional/Defs.lean Outdated
@fmontesi fmontesi added this pull request to the merge queue Apr 29, 2026
Merged via the queue into leanprover:main with commit 6d112db Apr 29, 2026
2 checks passed
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.