Skip to content

Conversation

@arademaker
Copy link
Collaborator

For all logics that are likely to be implemented, it would be interesting to have a test suite that not only demonstrates how the definitions of syntax and semantics work, but also serves a didactic purpose through concrete instantiations of the logic.

In this PR, I suggest some initial tests for the linear logic already implemented in CSLib. In addition to tests for syntax and trivial equivalences, I present a proof of a linear logic theorem that I picked at random from https://arxiv.org/abs/1904.06850. From this PR onward, we can think about more systematic methods for constructing proof benchmarks.

@article{Olarte_2019,
   title={The ILLTP Library for Intuitionistic Linear Logic},
   volume={292},
   ISSN={2075-2180},
   url={http://dx.doi.org/10.4204/EPTCS.292.7},
   DOI={10.4204/eptcs.292.7},
   journal={Electronic Proceedings in Theoretical Computer Science},
   publisher={Open Publishing Association},
   author={Olarte, Carlos and de Paiva, Valeria and Pimentel, Elaine and Reis, Giselle},
   year={2019},
   month=apr,
   pages={118–132}}

Copilot AI review requested due to automatic review settings January 29, 2026 13:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a comprehensive test suite for the Classical Linear Logic (CLL) implementation in CSLib. The tests serve both as verification of the implementation and as pedagogical examples demonstrating the syntax and semantics of linear logic. The PR includes a proof of a linear logic theorem from the ILLTP (Intuitionistic Linear Logic Theorem Prover) library, specifically Example 37 from Figure 5 of the referenced paper.

Changes:

  • Added extensive tests for CLL covering proposition construction, duality, proofs, equivalences, inversions, and classifications
  • Included a concrete proof example from academic literature (arxiv.org/abs/1904.06850) demonstrating linear implication

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

I use `Proposition Nat` as the concrete instantiation for atoms.
-/

open Cslib.CLL
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The test file is missing the namespace CslibTests wrapper that is used consistently in other test files (see CslibTests/CCS.lean, CslibTests/Bisimulation.lean, CslibTests/LTS.lean, CslibTests/LambdaCalculus.lean, CslibTests/DFA.lean, CslibTests/FreeMonad.lean). The file should be wrapped in namespace CslibTests ... end CslibTests to follow the established convention.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

!(A ⊸ B) ⊸ B = (!(A ⊸ B))⫠ ⅋ B = ʔ(A ⊗ B⫠) ⅋ B
!A ⊸ B = (!A)⫠ ⅋ B = ʔA⫠ ⅋ B
B ⊸ (!A ⊸ B) = B⫠ ⅋ (ʔA⫠ ⅋ B) -/
--/
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

There is a spurious comment marker --/ on line 225 that should be removed. The doc comment starting at line 209 already closes with -/ on line 224, making this extra marker unnecessary and potentially confusing.

Suggested change
--/

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@arademaker arademaker enabled auto-merge January 29, 2026 18:15
@arademaker arademaker disabled auto-merge January 29, 2026 18:16
Copy link
Collaborator

@chenson2018 chenson2018 left a comment

Choose a reason for hiding this comment

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

I think it is a good general idea to have these sorts of examples as a sanity check that we've correctly defined various logics and languages.

(Leaving approval to Fabrizio since he wrote this module)

B ⊸ (!A ⊸ B) = B⫠ ⅋ (ʔA⫠ ⅋ B)
-/
example : ⇓({b⫠, (!(a ⊸ b) ⊸ b) ⊗ (b ⊸ (!a ⊸ b))} : Sequent Nat) := by
apply Proof.rwConclusion (Multiset.pair_comm ..)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We try to follow the convention of not constructing data (non-propositions) with tactics, though it is very awkward for linear logic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @chenson2018, I thought about that. The first version of the proof was a term-based proof. But the bottom-up approach to the tactics - at least in the case of LL - makes the proof much clearer. But I am open to respecting any decision.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I completely agree that it is natural to write this way. I'm fine with leaving it this way for a test file. If it breaks for whatever reason, this is also interesting information and easily fixed.

Copy link
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.

LGTM, thanks!

@fmontesi fmontesi added this pull request to the merge queue Jan 30, 2026
Merged via the queue into leanprover:main with commit 8a926ae Jan 30, 2026
2 checks passed
chenson2018 pushed a commit that referenced this pull request Jan 30, 2026
For all logics that are likely to be implemented, it would be
interesting to have a test suite that not only demonstrates how the
definitions of syntax and semantics work, but also serves a didactic
purpose through concrete instantiations of the logic.

In this PR, I suggest some initial tests for the linear logic already
implemented in CSLib. In addition to tests for syntax and trivial
equivalences, I present a proof of a linear logic theorem that I picked
at random from https://arxiv.org/abs/1904.06850. From this PR onward, we
can think about more systematic methods for constructing proof
benchmarks.

```
@Article{Olarte_2019,
   title={The ILLTP Library for Intuitionistic Linear Logic},
   volume={292},
   ISSN={2075-2180},
   url={http://dx.doi.org/10.4204/EPTCS.292.7},
   DOI={10.4204/eptcs.292.7},
   journal={Electronic Proceedings in Theoretical Computer Science},
   publisher={Open Publishing Association},
   author={Olarte, Carlos and de Paiva, Valeria and Pimentel, Elaine and Reis, Giselle},
   year={2019},
   month=apr,
   pages={118–132}}
```
arademaker added a commit to arademaker/cslib that referenced this pull request Feb 2, 2026
For all logics that are likely to be implemented, it would be
interesting to have a test suite that not only demonstrates how the
definitions of syntax and semantics work, but also serves a didactic
purpose through concrete instantiations of the logic.

In this PR, I suggest some initial tests for the linear logic already
implemented in CSLib. In addition to tests for syntax and trivial
equivalences, I present a proof of a linear logic theorem that I picked
at random from https://arxiv.org/abs/1904.06850. From this PR onward, we
can think about more systematic methods for constructing proof
benchmarks.

```
@Article{Olarte_2019,
   title={The ILLTP Library for Intuitionistic Linear Logic},
   volume={292},
   ISSN={2075-2180},
   url={http://dx.doi.org/10.4204/EPTCS.292.7},
   DOI={10.4204/eptcs.292.7},
   journal={Electronic Proceedings in Theoretical Computer Science},
   publisher={Open Publishing Association},
   author={Olarte, Carlos and de Paiva, Valeria and Pimentel, Elaine and Reis, Giselle},
   year={2019},
   month=apr,
   pages={118–132}}
```
@arademaker arademaker deleted the cll-test branch February 2, 2026 10:04
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.

3 participants