feat(Foundations/Relation/Confluence): generalize results from confluence to commutation - #880
Open
thomaskwaring wants to merge 15 commits into
Open
feat(Foundations/Relation/Confluence): generalize results from confluence to commutation#880thomaskwaring wants to merge 15 commits into
thomaskwaring wants to merge 15 commits into
Conversation
added 3 commits
September 7, 2026 17:03
added 3 commits
September 7, 2026 19:39
chenson2018
requested changes
Sep 9, 2026
chenson2018
left a comment
Collaborator
There was a problem hiding this comment.
Some minor organization comments:
thomaskwaring
requested review from
arademaker,
kim-em and
sorrachai
as code owners
September 11, 2026 08:14
added 3 commits
September 11, 2026 10:19
Contributor
|
Why is |
Contributor
|
Could we add this theorem to the PR? theorem diamond_commute_reflTransGen
(h : DiamondCommute r₂ r₁) :
DiamondCommute r₂ (Relation.ReflTransGen r₁) := by
intro q p r hB hA
induction hA generalizing p with
| refl => exact ⟨p, .refl, hB⟩
| tail _ a_step ih =>
obtain ⟨s, hs₁, hs₂⟩ := ih hB
obtain ⟨w, hw₁, hw₂⟩ := h hs₂ a_step
exact ⟨w, hs₁.tail hw₁, hw₂⟩ |
Collaborator
Author
|
Nice catch @lengyijun — your theorem is a direct generalisation of |
Contributor
|
@thomaskwaring @chenson2018 Shall we group the definitions into those involving one relation and those involving two relations? |
Contributor
lemma DiamondCommute.extend (h : DiamondCommute r₁ r₂) : SemiCommute r₂ r₁ := by
intros _ c _ h₂ h₁
induction h₁ using ReflTransGen.head_induction_on generalizing c with
| refl => exact Join₂.single_right (.single h₂)
| head ha _ ih =>
obtain ⟨d, had, hcd⟩ := h ha h₂
obtain ⟨d', hbd', hdd'⟩ := ih had
exact ⟨d', .head hcd hbd', hdd'⟩
/-- Extending a multistep reduction by a single step preserves multi-joinability. -/
lemma Diamond.extend (h : Diamond r) : SemiConfluent r := DiamondCommute.extend h
lemma DiamondCommute.to_commute (h : DiamondCommute r₁ r₂) : Commute r₁ r₂ := by
intro a b₁ b₂ hab₁ hab₂
induction hab₂ using ReflTransGen.head_induction_on generalizing b₁ with
| refl => exact Join₂.single_right hab₁
| @head a a' ha hab₂ ih =>
obtain ⟨c, hb₁c, hac⟩ := h.extend ha hab₁
obtain ⟨d, hcd, hb₂d⟩ := ih hb₁c
exact ⟨d, hac.trans hcd, hb₂d⟩ |
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
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 generalises many results from confluent to commuting relations, and obtains the classical case as a specialisation. We add
HJoinandMHJoin— heterogenous versions ofJoinandMJoin— and associated API for them and related relational constructions.NB: the theorem
confluent_equivalentsis now public, and theTFAEhas been extended with certain other properties which generalise better to the heterogenous case.