Skip to content

feat(Logic): improvements to the inference system and congruence frameworks, with associated refactorings - #753

Open
fmontesi wants to merge 48 commits into
mainfrom
fmontesi/hml
Open

feat(Logic): improvements to the inference system and congruence frameworks, with associated refactorings#753
fmontesi wants to merge 48 commits into
mainfrom
fmontesi/hml

Conversation

@fmontesi

Copy link
Copy Markdown
Collaborator

This PR introduces several improvements to the frameworks based on InferenceSystem and Congruence.

  1. InferenceSystem.Default⇓a is now pretty-printed to ⇓a (which is what users write).
  2. Introduces a parametric congruence notation, since terms of the same type can have multiple congruences. Consequently, the same type can now also have multiple logical equivalences (which is important, since these may be parametric as we have, e.g., in modal and propositional logics).
  3. Introduces a DefaultCongruence class to define the 'canonical' congruence for a type.
  4. Separates classes for accessing congruence notation from that to prove that a congruence is lawful (LawfulCongruence).
  5. Simplifies instantiating Context by making the term type parameter implicit.
  6. Introduces the first examples of rewritings based on LogicalEquivalence in CslibTests. Both a manual proof based on contexts and one based on grind are provided. In the future, we should explore ways to plug such rewritings into Lean's and Mathlib's frameworks for congruences (perhaps by autogenerating lemmas and/or checks from inductive types).

The PR also refactors CLL, HML, and Modal Logic to be in line with all these recent developments. This is a step towards the formulation of general patterns for modal logics (left to future work).

Some tests to prevent future breakage are introduced as well.

Depends on #607.

Fabrizio Montesi and others added 30 commits May 21, 2026 14:48
This PR proves the standardization theorem: if `M` beta-reduces to `N`
in any number of steps, then `N` is reachable from `M` by a standard
reduction.

Builds on #671.

---------

Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <chrishenson.net@gmail.com>
If a term is locally closed at level `i` and `i ≤ j`, then it is also
locally closed at level `j`.

---------

Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
This PR refactors the cslib bench suite so it closely resembles
mathlib's again, following leanprover-community/mathlib4#41587.
- Redefine `multiApp` as right-recursive (`multiApp (app f a) as`)
instead of left.
- Switch several inductions to `List.reverseRecOn` for compatibility
with the new recursion.
- Add `listFullBeta_cons_r`/`listFullBeta_cons_l`/`multiApp_tail`
helpers.
- Update related proofs


Fixes #706

---------

Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
… fairness properties (#612)

This PR contains some technical machineries for reasoning about diamond
and fairness properties about the distributed algorithms introduced in
#556:
* `CanReachVia.lean` defines the notion of reachability via a subset of
processes and proves some of its properties, including some diamond
properties.
* `FairScheduler.lean` contains a technical machinery for constructing
fair executions, which will be used in formalizing some arguments which
were either only hinted at or completely glossed over in Völzer's paper.

Zulip discussion:

https://leanprover.zulipchat.com/#narrow/channel/513188-CSLib/topic/Impossibility.20of.20distributed.20consensus/with/592462001
This tweak brings the bench suite more in line with the other repos. It
should not affect functionality.

Follow-up to #707.
VitaliPath and others added 15 commits July 22, 2026 14:06
Addresses #638. Converts the global well-formed notation to a macro with
a `noWs` whitespace guard. This explicitly prevents the postfix parser
from greedily consuming the `✓` token across line breaks, resolving the
syntax collision with TimeM's prefix tick notation when both modules are
imported simultaneously.

---------

Co-authored-by: Sean Stoneburner <litholight@gmail.com>
Co-authored-by: Chris Henson <chrishenson.net@gmail.com>
… are regular (#720)

Prove languages matching regular expressions are regular in
IsRegular.regex.
The proof uses existing theorems IsRegular.add, IsRegular.mul, and
IsRegular.kstar.
Prove remaining key ingredient that the language containing only the one
character string is regular in IsRegular.char.


Implemented collaboratively by Brooke Gill and Chi-Yun Hsu

---------

Co-authored-by: Chi-Yun Hsu <chiyunhsu@users.noreply.github.com>
Co-authored-by: Brooke Gill <96643991+brooke-gill@users.noreply.github.com>
… OmegaLanguage (#722)

This PR proves some consequences of an empty alphabet type (denoted by
`Symbol`) on Language and OmegaLanguage:
(1) The only possible languages over an empty alphabet are {} and {[]}.
(2) The only possible omega-language over an empty alphabet is {}.
Furthermore, (1) enables the assumption `[Inhabited Symbol]` to be
removed from the regular language closure properties `IsRegular.mul` and
`IsRegular.kstar`. Now no closure property for regular languages has
that assumption.
Co-authored-by: mathlib-nightly-testing[bot] <258991302+mathlib-nightly-testing[bot]@users.noreply.github.com>
Co-authored-by: mathlib-nightly-testing[bot] <mathlib-nightly-testing[bot]@users.noreply.github.com>
Co-authored-by: mathlib4-bot <github-mathlib4-bot@leanprover.zulipchat.com>
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.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: 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: Fabrizio Montesi <famontesi@gmail.com>
This PR adds README files to some of the main source code directories,
covering explanations on principles and vision for CSLib that I've found
myself repeating often in private and public conversations.

---------

Co-authored-by: Fabrizio Montesi <fabrizio.montesi@pm.me>
Bump `mathlib` dependency to
[d99d52c](leanprover-community/mathlib4@d99d52c):
chore(Data): rename `setOf` to `Set.ofPred` (#41507) (2026-07-17)
Previously at:
[79d0395](leanprover-community/mathlib4@79d0395):
chore: bump toolchain to v4.33.0-rc1 (#41779) (2026-07-16)

Closes #727

Failure log from the validation run:
[download](https://github.com/leanprover-community/downstream-reports/actions/runs/29592162806/artifacts/8412435005)
_(link expires after 1 year)_

---

This PR bumps `mathlib` to an identified incompatible (first-known-bad)
commit (`d99d52c`) so you can reproduce and fix the incompatibility
locally by checking out this branch.

_Opened automatically by
[downstream-reports/track-incompatibility](https://github.com/leanprover-community/downstream-reports)
via [this workflow
run](https://github.com/leanprover/cslib/actions/runs/29610863999)._

---------

Co-authored-by: mathlib-nightly-testing[bot] <mathlib-nightly-testing[bot]@users.noreply.github.com>
Co-authored-by: Chris Henson <chrishenson.net@gmail.com>
Bump `mathlib` dependency to
[169c26b](leanprover-community/mathlib4@169c26b):
refactor: rename restrict to domRestrict (#25980) (2026-07-20)
Previously at:
[d99d52c](leanprover-community/mathlib4@d99d52c):
chore(Data): rename `setOf` to `Set.ofPred` (#41507) (2026-07-17)

Closes #732

Failure log from the validation run:
[download](https://github.com/leanprover-community/downstream-reports/actions/runs/29755881109/artifacts/8467297013)
_(link expires after 1 year)_

---

This PR bumps `mathlib` to an identified incompatible (first-known-bad)
commit (`169c26b`) so you can reproduce and fix the incompatibility
locally by checking out this branch.

_Opened automatically by
[downstream-reports/track-incompatibility](https://github.com/leanprover-community/downstream-reports)
via [this workflow
run](https://github.com/leanprover/cslib/actions/runs/29776447755)._

---------

Co-authored-by: mathlib-nightly-testing[bot] <mathlib-nightly-testing[bot]@users.noreply.github.com>
Co-authored-by: Chris Henson <chrishenson.net@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants