-
Notifications
You must be signed in to change notification settings - Fork 54
feat: syntactic contexts and congruence relations #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+82
−22
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctchou
reviewed
Jan 23, 2026
chenson2018
reviewed
Jan 23, 2026
chenson2018
reviewed
Jan 23, 2026
chenson2018
reviewed
Jan 24, 2026
Collaborator
Author
|
I was doing it to be consistent with HasEquiv in Lean core, because I don't
need it to be a type, strictly speaking.
But I think using Type is fine for our purposes, so integrating with
mathlib should take priority here. I'll change it to what you suggest, I
think it's a good idea!
…On Sat, 24 Jan 2026, 08:38 Chris Henson, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In Cslib/Foundations/Syntax/Congruence.lean
<#284 (comment)>:
> +/-
+Copyright (c) 2026 Fabrizio Montesi. All rights reserved.
+Released under Apache 2.0 license as described in the file LICENSE.
+Authors: Fabrizio Montesi
+-/
+
+module
+
+public import Cslib.Foundations.Syntax.Context
+
***@***.*** public section
+
+namespace Cslib
+
+/-- An equivalence relation preserved by all contexts. -/
+class Congruence (α : Sort*) [HasContext α] (r : α → α → Prop) extends IsEquiv α r where
Does α need to be a Sort here? This builds if you make it a Type, so I
wondered if you did this just because you were extending IsEquiv.
If this can be in Type, the following is equivalent:
class Congruence (α : Type*) [HasContext α] (r : α → α → Prop) extends
IsEquiv α r,
is_congruence : CovariantClass (HasContext.Context α) α (·[·]) r
up to ordering of arguments, e.g.
instance bisimilarityCongruence :
Congruence (Process Name Constant) (Bisimilarity (lts (defs := defs))) where
is_congruence := ⟨by grind [Covariant, bisimilarity_is_congruence]⟩
works in CCS.BehaviouralTheory.
If we end up using this sort of thing in multiple places (i.e. here and
@ctchou <https://github.com/ctchou>'s #278
<#278>), I'd prefer that we use
the same naming like covariant : CovariantClass ... so that you get the
constructor covariant.elim : Covariant ....
—
Reply to this email directly, view it on GitHub
<#284 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAP3DSPGPNW6ZCTVO6NMNED4IMOOJAVCNFSM6AAAAACSU4BY52VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTOMBQHE4DANZYGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Collaborator
Author
|
All done. Looks pretty. :-) |
chenson2018
approved these changes
Jan 27, 2026
Collaborator
chenson2018
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces notions of (single hole) syntactic contexts (
HasContext) and congruence relations (Congruence), along with the standard notationc[t]for 'fill the hole in the contextcwith termt'.The development of CCS is adapted accordingly and should hold for many other calculi. The idea actually comes from an ongoing development on the generalisation of sequent calculi and logics, but these require more concepts. Also, in the future, it might be interesting to study approaches similar to
HasContextin semantics that use different kinds of contexts.The PR also scopes the
grindannotations in CCS.