Skip to content

Commit 86c6282

Browse files
committed
upd: clean up ConfluentReduction.lean to Cslib.Foundations.Data.Relation, and add rtc_eq_of_sandwich
1 parent cf76a74 commit 86c6282

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

Cslib/Foundations/Data/Relation.lean

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,22 @@ theorem ReflTransGen.to_eqvGen (h : ReflTransGen r a b) : EqvGen r a b := by
5151
theorem SymmGen.to_eqvGen (h : SymmGen r a b) : EqvGen r a b := by
5252
induction h <;> grind
5353

54+
/-- Sandwich: if `r ⊆ p ⊆ r*` then `r* = p*`. -/
55+
theorem ReflTransGen.sandwich_to_eq {α} {r p : α → α → Prop}
56+
(h₁ : ∀ {a b}, r a b → p a b)
57+
(h₂ : ∀ {a b}, p a b → ReflTransGen r a b) :
58+
∀ {a b}, ReflTransGen r a b ↔ ReflTransGen p a b := by
59+
intro a b
60+
constructor
61+
· intro hr
62+
induction hr with
63+
| refl => exact ReflTransGen.refl
64+
| tail hab hbc ih => exact ReflTransGen.tail ih (h₁ hbc)
65+
· intro hp
66+
induction hp with
67+
| refl => exact ReflTransGen.refl
68+
| tail hab hbc ih => exact ReflTransGen.trans ih (h₂ hbc)
69+
5470
attribute [scoped grind →] ReflGen.to_eqvGen TransGen.to_eqvGen ReflTransGen.to_eqvGen
5571
SymmGen.to_eqvGen
5672

Cslib/Languages/LambdaCalculus/Unscoped/Untyped/ChurchRosser.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Zayn Wang
55
-/
66
module
77

8-
public import Cslib.Languages.LambdaCalculus.Unscoped.Untyped.ConfluentReduction
8+
public import Cslib.Foundations.Data.Relation
99
public import Cslib.Languages.LambdaCalculus.Unscoped.Untyped.ParallelReduction
1010

1111
/-!
@@ -31,7 +31,7 @@ the complete-development machinery from `ParallelReduction`.
3131
-/
3232

3333
namespace Lambda
34-
open Term
34+
open Relation
3535

3636
/-- Parallel Reduction is Diamond. -/
3737
private lemma diamond_par : Diamond Par := by
@@ -42,10 +42,10 @@ private lemma diamond_par : Diamond Par := by
4242
public theorem churchRosser_beta : Confluent Beta := by
4343
-- Confluence of Par from diamond
4444
have hPar : Confluent Par :=
45-
confluent_of_diamond (r := Par) diamond_par
45+
Diamond.toConfluent (r := Par) diamond_par
4646
-- Identify BetaStar and ParStar via sandwich
4747
have hEq {a b : Term} : BetaStar a b ↔ ParStar a b :=
48-
rtc_eq_of_sandwich (r := Beta) (p := Par)
48+
ReflTransGen.sandwich_to_eq (r := Beta) (p := Par)
4949
(by intro a b h; exact beta_subset_par h)
5050
(by intro a b h; exact par_subset_betaStar h)
5151
-- Transport confluence

0 commit comments

Comments
 (0)