@@ -21,24 +21,6 @@ section
2121
2222variable {σ : Type u} {m : Type u → Type v} {α β : Type u}
2323
24- /--
25- `StateT` doesn't require a constructor, but it appears confusing to declare the
26- following theorem as a simp theorem.
27- ```lean
28- @[simp]
29- theorem run_fun (f : σ → m (α × σ)) (st : σ) : StateT.run (fun s => f s) st = f st :=
30- rfl
31- ```
32- If we declare this theorem as a simp theorem, `StateT.run f st` is simplified to `f st` by eta
33- reduction. This breaks the structure of `StateT`.
34- So, we declare a constructor-like definition `StateT.mk` and a simp theorem for it.
35- -/
36- protected def mk (f : σ → m (α × σ)) : StateT σ m α := f
37-
38- @[simp]
39- theorem run_mk (f : σ → m (α × σ)) (st : σ) : StateT.run (StateT.mk f) st = f st :=
40- rfl
41-
4224/-- A copy of `LawfulFunctor.map_const` for `StateT` that holds even if `m` is not lawful. -/
4325protected lemma map_const [Monad m] :
4426 (Functor.mapConst : α → StateT σ m β → StateT σ m α) = Functor.map ∘ Function.const β :=
@@ -62,38 +44,4 @@ theorem run_monadLift {n} [Monad m] [MonadLiftT n m] (x : n α) :
6244 (monadLift x : ExceptT ε m α).run = Except.ok <$> (monadLift x : m α) :=
6345 rfl
6446
65- @[simp]
66- theorem run_monadMap {n} [MonadFunctorT n m] (f : ∀ {α}, n α → n α) :
67- (monadMap (@f) x : ExceptT ε m α).run = monadMap (@f) x.run :=
68- rfl
69-
7047end ExceptT
71-
72- namespace ReaderT
73-
74- section
75-
76- variable {m : Type u → Type v}
77- variable {α σ : Type u}
78-
79- /--
80- `ReaderT` doesn't require a constructor, but it appears confusing to declare the
81- following theorem as a simp theorem.
82- ```lean
83- @[simp]
84- theorem run_fun (f : σ → m α) (r : σ) : ReaderT.run (fun r' => f r') r = f r :=
85- rfl
86- ```
87- If we declare this theorem as a simp theorem, `ReaderT.run f st` is simplified to `f st` by eta
88- reduction. This breaks the structure of `ReaderT`.
89- So, we declare a constructor-like definition `ReaderT.mk` and a simp theorem for it.
90- -/
91- protected def mk (f : σ → m α) : ReaderT σ m α := f
92-
93- @[simp]
94- theorem run_mk (f : σ → m α) (r : σ) : ReaderT.run (ReaderT.mk f) r = f r :=
95- rfl
96-
97- end
98-
99- end ReaderT
0 commit comments