Skip to content

Commit 6707170

Browse files
committed
more @[simp]
1 parent 4ea3b43 commit 6707170

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/Std/Data/HashMap/IteratorLemmas.lean

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,18 @@ theorem toList_inner :
2828
simp [toList, DHashMap.Internal.Raw.Const.toList_eq_toListModel_map,
2929
← DHashMap.Internal.Raw.toList_eq_toListModel, Function.comp_def]
3030

31+
@[simp]
3132
public theorem toList_iter :
3233
m.iter.toList = m.toList := by
3334
simp [Raw.iter, Iter.toList_map, DHashMap.Raw.toList_iter, toList_inner,
3435
Function.comp_def]
3536

37+
@[simp]
3638
public theorem toListRev_iter :
3739
m.iter.toListRev = m.toList.reverse := by
3840
simp [Iter.toListRev_eq, toList_iter]
3941

42+
@[simp]
4043
public theorem toArray_iter [BEq α] [Hashable α] (h : m.WF) :
4144
m.iter.toArray = m.toArray := by
4245
simp [← Iter.toArray_toList, ← Raw.toArray_toList h, toList_iter]
@@ -51,15 +54,18 @@ theorem keys_inner :
5154
m.inner.keys = m.keys :=
5255
rfl
5356

57+
@[simp]
5458
public theorem toList_keysIter [BEq α] [Hashable α] [EquivBEq α] [LawfulHashable α] (h : m.WF) :
5559
m.keysIter.toList = m.keys := by
5660
simp only [keysIter, ← map_fst_toList_eq_keys h, DHashMap.Raw.toList_keysIter h.out]
5761
simp [HashMap.Raw.map_fst_toList_eq_keys h, keys_inner]
5862

63+
@[simp]
5964
public theorem toListRev_keysIter [BEq α] [Hashable α] [EquivBEq α] [LawfulHashable α] (h : m.WF) :
6065
m.keysIter.toListRev = m.keys.reverse := by
6166
simp [Iter.toListRev_eq, toList_keysIter h]
6267

68+
@[simp]
6369
public theorem toArray_keysIter [BEq α] [Hashable α] [EquivBEq α] [LawfulHashable α] (h : m.WF) :
6470
m.keysIter.toArray = m.keysArray := by
6571
simp [← Iter.toArray_toList, ← Raw.toArray_keys h, toList_keysIter h]
@@ -70,16 +76,19 @@ section ValuesIter
7076

7177
variable {α β : Type u} {m : Raw α β}
7278

79+
@[simp]
7380
public theorem toList_valuesIter_eq_toList_map_snd :
7481
m.valuesIter.toList = m.toList.map Prod.snd := by
7582
simp [valuesIter, DHashMap.Raw.toList_valuesIter_eq_toList_map_snd,
7683
DHashMap.Internal.Raw.toList_eq_toListModel, toList,
7784
DHashMap.Internal.Raw.Const.toList_eq_toListModel_map]
7885

86+
@[simp]
7987
public theorem toListRev_valuesIter :
8088
m.valuesIter.toListRev = (m.toList.map Prod.snd).reverse := by
8189
simp [Iter.toListRev_eq, toList_valuesIter_eq_toList_map_snd]
8290

91+
@[simp]
8392
public theorem toArray_valuesIter :
8493
m.valuesIter.toArray = (m.toList.map Prod.snd).toArray := by
8594
simp [← Iter.toArray_toList, toList_valuesIter_eq_toList_map_snd]
@@ -100,14 +109,17 @@ theorem toList_inner :
100109
simp [toList, DHashMap.Const.toList, DHashMap.Internal.Raw.Const.toList_eq_toListModel_map,
101110
Function.comp_def, DHashMap.toList, DHashMap.Internal.Raw.toList_eq_toListModel]
102111

112+
@[simp]
103113
public theorem toList_iter :
104114
m.iter.toList = m.toList := by
105115
simp [iter, DHashMap.toList_iter, toList_inner, Function.comp_def]
106116

117+
@[simp]
107118
public theorem toListRev_iter :
108119
m.iter.toListRev = m.toList.reverse := by
109120
simp [Iter.toListRev_eq, toList_iter]
110121

122+
@[simp]
111123
public theorem toArray_iter :
112124
m.iter.toArray = m.toArray := by
113125
simp [← Iter.toArray_toList, toList_iter]
@@ -122,14 +134,17 @@ theorem keys_inner {α : Type u} {β : Type v} [BEq α] [Hashable α] {m : HashM
122134

123135
variable {α : Type u} {β : Type u} [BEq α] [Hashable α] {m : HashMap α β}
124136

137+
@[simp]
125138
public theorem toList_keysIter [EquivBEq α] [LawfulHashable α] :
126139
m.keysIter.toList = m.keys := by
127140
simp [keysIter, DHashMap.toList_keysIter, keys_inner]
128141

142+
@[simp]
129143
public theorem toListRev_keysIter [EquivBEq α] [LawfulHashable α] :
130144
m.keysIter.toListRev = m.keys.reverse := by
131145
simp [keysIter, DHashMap.toListRev_keysIter, keys_inner]
132146

147+
@[simp]
133148
public theorem toArray_keysIter [EquivBEq α] [LawfulHashable α] :
134149
m.keysIter.toArray = m.keysArray := by
135150
simp [← Iter.toArray_toList, keysIter, keysArray, DHashMap.toList_keysIter]
@@ -140,14 +155,17 @@ section ValuesIter
140155

141156
variable {α : Type u} {β : Type u} [BEq α] [Hashable α] {m : HashMap α β}
142157

158+
@[simp]
143159
public theorem toList_valuesIter_eq_toList_map_snd :
144160
m.valuesIter.toList = m.toList.map Prod.snd := by
145161
simp [valuesIter, DHashMap.toList_valuesIter_eq_toList_map_snd, toList_inner]
146162

163+
@[simp]
147164
public theorem toListRev_valuesIter :
148165
m.valuesIter.toListRev = (m.toList.map Prod.snd).reverse := by
149166
simp [Iter.toListRev_eq, toList_valuesIter_eq_toList_map_snd]
150167

168+
@[simp]
151169
public theorem toArray_valuesIter :
152170
m.valuesIter.toArray = (m.toList.map Prod.snd).toArray := by
153171
simp [← Iter.toArray_toList, toList_valuesIter_eq_toList_map_snd]

src/Std/Data/HashSet/IteratorLemmas.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@ open Std.Iterators
2222

2323
variable {α : Type u} {m : Raw α}
2424

25+
@[simp]
2526
public theorem toList_iter [BEq α] [Hashable α] [EquivBEq α] [LawfulHashable α] (h : m.WF) :
2627
m.iter.toList = m.toList := by
2728
simp [toList, iter, DHashMap.Raw.toList_iter,
2829
← HashMap.Raw.map_fst_toList_eq_keys h.out, HashMap.Raw.toList_inner]
2930

31+
@[simp]
3032
public theorem toListRev_iter [BEq α] [Hashable α] [EquivBEq α] [LawfulHashable α] (h : m.WF) :
3133
m.iter.toListRev = m.toList.reverse := by
3234
simp [Iter.toListRev_eq, toList_iter h]
3335

36+
@[simp]
3437
public theorem toArray_iter [BEq α] [Hashable α] [EquivBEq α] [LawfulHashable α] (h : m.WF) :
3538
m.iter.toArray = m.toArray := by
3639
simp [← Iter.toArray_toList, ← Raw.toArray_toList h, toList_iter h]
@@ -42,14 +45,17 @@ open Std.Iterators
4245

4346
variable {α : Type u} [BEq α] [Hashable α] {m : HashSet α}
4447

48+
@[simp]
4549
public theorem toList_iter [EquivBEq α] [LawfulHashable α] :
4650
m.iter.toList = m.toList := by
4751
simp [iter, DHashMap.toList_iter, toList, HashMap.keys_inner]
4852

53+
@[simp]
4954
public theorem toListRev_iter [EquivBEq α] [LawfulHashable α] :
5055
m.iter.toListRev = m.toList.reverse := by
5156
simp [iter, DHashMap.toListRev_iter, toList, HashMap.keys_inner]
5257

58+
@[simp]
5359
public theorem toArray_iter [EquivBEq α] [LawfulHashable α] :
5460
m.iter.toArray = m.toArray := by
5561
simp [iter, DHashMap.toArray_iter, toArray, HashMap.keysArray]

0 commit comments

Comments
 (0)