@@ -53,7 +53,6 @@ theorem Iter.forIn_of_step {α β : Type w} [Iterator α Id β]
53
53
· rfl
54
54
· rfl
55
55
56
- -- TODO: nonterminal simps
57
56
theorem Iter.forIn_toList {α β : Type w} [Iterator α Id β]
58
57
[Finite α Id] {m : Type w → Type w''} [Monad m] [LawfulMonad m]
59
58
[IteratorLoop α Id m] [LawfulIteratorLoop α Id m]
@@ -74,14 +73,12 @@ theorem Iter.forIn_toList {α β : Type w} [Iterator α Id β]
74
73
apply bind_congr
75
74
intro forInStep
76
75
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]
85
82
· simp
86
83
87
84
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
119
116
rw [Iter.foldM_eq_forIn, ← Iter.forIn_toList]
120
117
simp only [List.forIn_yield_eq_foldlM, id_map']
121
118
122
- -- TODO: nonterminal simp
123
119
theorem IterM.forIn_eq_foldM {α β : Type w} [Iterator α Id β]
124
120
[Finite α Id] {m : Type w → Type w''} [Monad m] [LawfulMonad m]
125
121
[IteratorLoop α Id m] [LawfulIteratorLoop α Id m]
@@ -130,7 +126,7 @@ theorem IterM.forIn_eq_foldM {α β : Type w} [Iterator α Id β]
130
126
it.foldM (fun c b => match c with
131
127
| .yield c => f b c
132
128
| .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
134
130
135
131
theorem Iter.fold_eq_forIn {α β γ : Type w} [Iterator α Id β]
136
132
[Finite α Id] [IteratorLoop α Id Id] {f : γ → β → γ} {init : γ} {it : Iter (α := α) β} :
0 commit comments