@@ -42,38 +42,37 @@ def DiamondProperty (r : α → α → Type u)
4242
4343/-- Property that if diverged in any number of steps, the results can be joined in any number of steps -/
4444@[simp]
45- def ChurchRosser (r : α → α → Type u)
45+ def Confluence (r : α → α → Type u)
4646 := ∀ a b c, ReflTransGen r a b → ReflTransGen r a c → Join (ReflTransGen r) b c
4747
48- def confluence_step
49- { a b c : α }
50- (h : ∀ a b c, r a b → r a c → Join r b c)
51- (hab : r a b)
52- (hac : ReflTransGen r a c)
53- : Σ d : α, Prod (ReflTransGen r b d) (r c d) := match hac with
54- | ReflTransGen.refl => ⟨ b, ReflTransGen.refl, hab ⟩
55- | ReflTransGen.head hax hxc => by
56- rename_i x
57- have ⟨y, hby, hxy⟩ := (h a b x hab hax)
58- have ⟨d, hyd, hcd⟩ := confluence_step h hxy hxc
59- exact ⟨d, ReflTransGen.head hby hyd, hcd⟩
60-
6148/-- Diamond property implies Church-Rosser (in the form in which Lean recognizes termination) -/
62- def confluence
49+ def diamond_implies_confluence'
6350 (h : ∀ a b c, r a b → r a c → Join r b c)
6451 (a b c : α)
6552 (hab : ReflTransGen r a b)
6653 (hac : ReflTransGen r a c)
6754 : Join (ReflTransGen r) b c := match hab with
6855 | ReflTransGen.refl => ⟨ c, hac, ReflTransGen.refl⟩
6956 | ReflTransGen.head hax hxb => by
57+ let rec step
58+ { a b c : α }
59+ (h : ∀ a b c, r a b → r a c → Join r b c)
60+ (hab : r a b)
61+ (hac : ReflTransGen r a c)
62+ : Σ d : α, Prod (ReflTransGen r b d) (r c d) := match hac with
63+ | ReflTransGen.refl => ⟨ b, ReflTransGen.refl, hab ⟩
64+ | ReflTransGen.head hax hxc => by
65+ rename_i x
66+ have ⟨y, hby, hxy⟩ := (h a b x hab hax)
67+ have ⟨d, hyd, hcd⟩ := step h hxy hxc
68+ exact ⟨d, ReflTransGen.head hby hyd, hcd⟩
7069 rename_i x
71- have ⟨c', hxc', hcc'⟩ := confluence_step h hax hac
72- have ⟨d, hbd, hc'd⟩ := confluence h x b c' hxb hxc'
70+ have ⟨c', hxc', hcc'⟩ := step h hax hac
71+ have ⟨d, hbd, hc'd⟩ := diamond_implies_confluence' h x b c' hxb hxc'
7372 exact ⟨d, hbd, ReflTransGen.head hcc' hc'd⟩
7473
7574/-- Diamond property implies Church-Rosser -/
76- def diamond_implies_church_rosser : DiamondProperty r → ChurchRosser r := by
75+ def diamond_implies_confluence : DiamondProperty r → Confluence r := by
7776 simp
7877 intros h a b c hab hac
79- exact confluence h a b c hab hac
78+ exact diamond_implies_confluence' h a b c hab hac
0 commit comments