@@ -104,21 +104,24 @@ theorem LiftRel.swap_lem {R : α → β → Prop} {s1 s2} (h : LiftRel R s1 s2)
104104theorem LiftRel.swap (R : α → β → Prop ) : swap (LiftRel R) = LiftRel (swap R) :=
105105 funext fun _ => funext fun _ => propext ⟨LiftRel.swap_lem, LiftRel.swap_lem⟩
106106
107- theorem LiftRel.refl (R : α → α → Prop ) (H : Reflexive R) : Reflexive (LiftRel R) := fun s => by
108- refine ⟨(· = ·), rfl, fun {s t} (h : s = t) => ?_⟩
109- rw [← h]
110- apply Computation.LiftRel.refl
111- intro a
112- rcases a with - | a
113- · simp
114- · cases a
115- simp only [LiftRelO, and_true]
116- apply H
107+ instance LiftRelO.refl (R : α → α → Prop ) [Std.Refl R] : Std.Refl <| LiftRelO R (· = ·) where
108+ refl a := by
109+ rcases a with - | a
110+ · simp
111+ · cases a
112+ simp only [LiftRelO, and_true]
113+ apply refl_of R
114+
115+ instance LiftRel.refl (R : α → α → Prop ) [Std.Refl R] : Std.Refl (LiftRel R) where
116+ refl s := by
117+ refine ⟨(· = ·), rfl, fun {s t} (h : s = t) => ?_⟩
118+ rw [← h]
119+ apply Computation.LiftRel.refl _ |>.refl
117120
118121theorem LiftRel.symm (R : α → α → Prop ) (H : Symmetric R) : Symmetric (LiftRel R) :=
119122 fun s1 s2 (h : Function.swap (LiftRel R) s2 s1) => by rwa [LiftRel.swap, H.swap_eq] at h
120123
121- theorem LiftRel.trans (R : α → α → Prop ) (H : IsTrans α R) : IsTrans _ (LiftRel R) := by
124+ instance LiftRel.trans (R : α → α → Prop ) [ IsTrans α R] : IsTrans _ (LiftRel R) := by
122125 refine ⟨fun s t u h1 h2 ↦ ?_⟩
123126 refine ⟨fun s u => ∃ t, LiftRel R s t ∧ LiftRel R t u, ⟨t, h1, h2⟩, fun {s u} h => ?_⟩
124127 rcases h with ⟨t, h1, h2⟩
@@ -147,10 +150,12 @@ theorem LiftRel.trans (R : α → α → Prop) (H : IsTrans α R) : IsTrans _ (L
147150 obtain ⟨c, u⟩ := c
148151 obtain ⟨ab, st⟩ := t1
149152 obtain ⟨bc, tu⟩ := t2
150- exact ⟨H.trans a b c ab bc, t, st, tu⟩
153+ exact ⟨trans_of R ab bc, t, st, tu⟩
151154
152- theorem LiftRel.equiv (R : α → α → Prop ) (H : Equivalence R) : Equivalence (LiftRel R) :=
153- ⟨LiftRel.refl R H.refl, @(LiftRel.symm R @H.symm), LiftRel.trans R H.isTrans |>.trans _ _ _⟩
155+ theorem LiftRel.equiv (R : α → α → Prop ) (H : Equivalence R) : Equivalence (LiftRel R) where
156+ refl := @LiftRel.refl α R H.stdRefl |>.refl
157+ symm := @LiftRel.symm α R H.symmetric
158+ trans := @LiftRel.trans α R H.isTrans |>.trans _ _ _
154159
155160/-- If two sequences are equivalent, then they have the same values and
156161 the same computational behavior (i.e. if one loops forever then so does
@@ -163,15 +168,15 @@ def Equiv : WSeq α → WSeq α → Prop :=
163168
164169@[refl]
165170theorem Equiv.refl : ∀ s : WSeq α, s ~ʷ s :=
166- LiftRel.refl (· = ·) Eq .refl
171+ LiftRel.refl (· = ·) |> .refl
167172
168173@[symm]
169174theorem Equiv.symm : ∀ {s t : WSeq α}, s ~ʷ t → t ~ʷ s :=
170175 @(LiftRel.symm (· = ·) (@Eq.symm _))
171176
172177@[trans]
173178theorem Equiv.trans : ∀ {s t u : WSeq α}, s ~ʷ t → t ~ʷ u → s ~ʷ u :=
174- LiftRel.trans (· = ·) inferInstance |>.trans _ _ _
179+ LiftRel.trans (· = ·) |>.trans _ _ _
175180
176181theorem Equiv.equivalence : Equivalence (@Equiv α) :=
177182 ⟨@Equiv.refl _, @Equiv.symm _, @Equiv.trans _⟩
0 commit comments