Martin Escardo, 3 February 2021. We consider one special kind of Church-Rosser property motivated by our applications of this module to the contruction of free groups without higher-inductive types other than propositional truncation. \begin{code} {-# OPTIONS --safe --without-K #-} open import MLTT.Spartan module Relations.ChurchRosser {π€ : Universe} {X : π€ Μ } (_β·_ : X β X β π€ Μ ) where open import Relations.SRTclosure infix 1 _ββ·_ infix 1 _ββ·[_]_ infix 1 _β·β_ infix 1 _β·[_]_ infix 1 _βΏ_ _ββ·_ : X β X β π€ Μ _ββ·_ = s-closure _β·_ _ββ·[_]_ : X β β β X β π€ Μ x ββ·[ n ] y = iteration _ββ·_ n x y _βΏ_ : X β X β π€ Μ _βΏ_ = srt-closure _β·_ _β·β_ : X β X β π€ Μ _β·β_ = rt-closure _β·_ _β·[_]_ : X β β β X β π€ Μ x β·[ n ] y = iteration _β·_ n x y to-βΏ : (x y : X) β (Ξ£ z κ X , (x β·β z) Γ (y β·β z)) β x βΏ y to-βΏ x y (z , r , s) = srt-transitive _β·_ x z y (rt-gives-srt _β·_ x z r) (srt-symmetric _β·_ y z (rt-gives-srt _β·_ y z s)) module _ (Church-Rosser : (x yβ yβ : X) β x β· yβ β x β· yβ β (yβ οΌ yβ) + (Ξ£ y κ X , (yβ β· y) Γ (yβ β· y))) where Church-Rosserβ : (x yβ yβ : X) β x β·β yβ β x β· yβ β Ξ£ y κ X , (yβ β·β y) Γ (yβ β·β y) Church-Rosserβ x yβ yβ (m , i) b = f m x yβ yβ i b where f : (m : β) (x yβ yβ : X) β x β·[ m ] yβ β x β· yβ β Ξ£ y κ X , (yβ β·β y) Γ (yβ β·β y) f 0 x x yβ refl e = yβ , rt-extension _β·_ x yβ e , rt-reflexive _β·_ yβ f (succ m) x yβ yβ (t , d , i) e = Ξ³ c where c : (yβ οΌ t) + (Ξ£ y κ X , (yβ β· y) Γ (t β· y)) c = Church-Rosser x yβ t e d Ξ³ : type-of c β Ξ£ u κ X , (yβ β·β u) Γ (yβ β·β u) Ξ³ (inl refl) = yβ , rt-reflexive _β·_ yβ , m , i Ξ³ (inr (y , a , b)) = Ξ΄ IH where IH : Ξ£ u κ X , (yβ β·β u) Γ (y β·β u) IH = f m t yβ y i b Ξ΄ : type-of IH β Ξ£ u κ X , (yβ β·β u) Γ (yβ β·β u) Ξ΄ (u , b , n , j) = u , b , succ n , y , a , j from-βΏ : (x y : X) β x βΏ y β Ξ£ z κ X , (x β·β z) Γ (y β·β z) from-βΏ x y (m , e) = f m x y e where f : (m : β) (x y : X) β x ββ·[ m ] y β Ξ£ z κ X , (x β·β z) Γ (y β·β z) f 0 x x refl = x , rt-reflexive _β·_ x , rt-reflexive _β·_ x f (succ m) x y (z , d , i) = Ξ³ IH d where IH : Ξ£ t κ X , (z β·β t) Γ (y β·β t) IH = f m z y i Ξ³ : type-of IH β x ββ· z β Ξ£ u κ X , (x β·β u) Γ (y β·β u) Ξ³ (t , (n , i) , a) (inl c) = t , (succ n , z , c , i) , a Ξ³ (t , (n , i) , a) (inr c) = Ξ΄ Ο where Ο : Ξ£ u κ X , (t β·β u) Γ (x β·β u) Ο = Church-Rosserβ z t x (n , i) c Ξ΄ : type-of Ο β Ξ£ u κ X , (x β·β u) Γ (y β·β u) Ξ΄ (u , d , e) = u , e , rt-transitive _β·_ y t u a d \end{code}