Skip to content

Commit ba059db

Browse files
committed
cleanups
1 parent 09e986e commit ba059db

File tree

1 file changed

+7
-11
lines changed
  • src/Std/Data/Iterators/Lemmas/Consumers

1 file changed

+7
-11
lines changed

src/Std/Data/Iterators/Lemmas/Consumers/Loop.lean

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ theorem Iter.forIn_of_step {α β : Type w} [Iterator α Id β]
5353
· rfl
5454
· rfl
5555

56-
-- TODO: nonterminal simps
5756
theorem Iter.forIn_toList {α β : Type w} [Iterator α Id β]
5857
[Finite α Id] {m : Type w → Type w''} [Monad m] [LawfulMonad m]
5958
[IteratorLoop α Id m] [LawfulIteratorLoop α Id m]
@@ -74,14 +73,12 @@ theorem Iter.forIn_toList {α β : Type w} [Iterator α Id β]
7473
apply bind_congr
7574
intro forInStep
7675
cases forInStep
77-
· simp
78-
induction it'.toList <;> simp [*]
79-
· simp
80-
simp only [ForIn.forIn, forIn', List.forIn'] at ihy
81-
rw [ihy h, forIn_eq_forIn_toIterM]
82-
· simp
83-
rw [ihs]
84-
assumption
76+
· induction it'.toList <;> simp [*]
77+
· simp only [ForIn.forIn, forIn', List.forIn'] at ihy
78+
simp [ihy h, forIn_eq_forIn_toIterM]
79+
· rename_i it' h
80+
simp only [bind_pure_comp]
81+
rw [ihs h]
8582
· simp
8683

8784
theorem Iter.foldM_eq_forIn {α β γ : Type w} [Iterator α Id β] [Finite α Id] {m : Type w → Type w'}
@@ -119,7 +116,6 @@ theorem Iter.foldlM_toList {α β γ : Type w} [Iterator α Id β] [Finite α Id
119116
rw [Iter.foldM_eq_forIn, ← Iter.forIn_toList]
120117
simp only [List.forIn_yield_eq_foldlM, id_map']
121118

122-
-- TODO: nonterminal simp
123119
theorem IterM.forIn_eq_foldM {α β : Type w} [Iterator α Id β]
124120
[Finite α Id] {m : Type w → Type w''} [Monad m] [LawfulMonad m]
125121
[IteratorLoop α Id m] [LawfulIteratorLoop α Id m]
@@ -130,7 +126,7 @@ theorem IterM.forIn_eq_foldM {α β : Type w} [Iterator α Id β]
130126
it.foldM (fun c b => match c with
131127
| .yield c => f b c
132128
| .done c => pure (.done c)) (ForInStep.yield init) := by
133-
simp [← Iter.forIn_toList, ← Iter.foldlM_toList, List.forIn_eq_foldlM]; rfl
129+
simp only [← Iter.forIn_toList, List.forIn_eq_foldlM, ← Iter.foldlM_toList]; rfl
134130

135131
theorem Iter.fold_eq_forIn {α β γ : Type w} [Iterator α Id β]
136132
[Finite α Id] [IteratorLoop α Id Id] {f : γ → β → γ} {init : γ} {it : Iter (α := α) β} :

0 commit comments

Comments
 (0)