Skip to content

Commit a7b5efc

Browse files
committed
chore: further renaming
1 parent b41c25e commit a7b5efc

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

src/Std/Data/DTreeMap/Internal/Zipper.lean

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public def Zipper.prependMapGT [Ord α] (t : Impl α β) (lowerBound : α)
199199
| .eq => prependMapGT r lowerBound it
200200
| .gt => prependMapGT r lowerBound it
201201

202-
theorem Zipper.prepend_pruneLE_eq_prependMapGE [Ord α] (t : Impl α β) (ord_t : t.Ordered)
202+
theorem Zipper.prependMap_of_pruneLE_eq_prependMapGE [Ord α] (t : Impl α β) (ord_t : t.Ordered)
203203
(z : Zipper α β) (lowerBound : α) :
204204
z.prependMap (t.pruneLE lowerBound) = z.prependMapGE t lowerBound := by
205205
induction t generalizing z
@@ -220,7 +220,7 @@ theorem Zipper.prepend_pruneLE_eq_prependMapGE [Ord α] (t : Impl α β) (ord_t
220220
apply r_ih
221221
exact Impl.Ordered.right ord_t
222222

223-
theorem Zipper.prepend_eq_prependMapGT_self [Ord α] [TransOrd α] (r : Impl α β)
223+
theorem Zipper.prependMap_eq_prependMapGT_self [Ord α] [TransOrd α] (r : Impl α β)
224224
(z : Zipper α β) (lowerBound : α) (ord_r : r.Ordered)
225225
(hyp : ∀ e ∈ r.toList, compare lowerBound e.fst = .lt) :
226226
Zipper.prependMap r z = Zipper.prependMapGT r lowerBound z := by
@@ -243,7 +243,7 @@ theorem Zipper.prepend_eq_prependMapGT_self [Ord α] [TransOrd α] (r : Impl α
243243
. rw [Impl.toList_eq_toListModel] at mem
244244
exact mem
245245

246-
theorem Zipper.prepend_pruneLT_eq_prependMapGT [Ord α] [TransOrd α] (t : Impl α β)
246+
theorem Zipper.prependMap_of_pruneLT_eq_prependMapGT [Ord α] [TransOrd α] (t : Impl α β)
247247
(ord_t : t.Ordered) (z : Zipper α β) (lowerBound : α) :
248248
z.prependMap (t.pruneLT lowerBound) = z.prependMapGT t lowerBound := by
249249
induction t generalizing z
@@ -259,7 +259,7 @@ theorem Zipper.prepend_pruneLT_eq_prependMapGT [Ord α] [TransOrd α] (t : Impl
259259
exact Impl.Ordered.left ord_t
260260
case eq =>
261261
simp only
262-
apply prepend_eq_prependMapGT_self
262+
apply Zipper.prependMap_eq_prependMapGT_self
263263
. exact Impl.Ordered.right ord_t
264264
. intro e mem
265265
apply TransCmp.lt_of_eq_of_lt heq
@@ -284,7 +284,7 @@ theorem Zipper.toList_prependMap_eq_append (t : Impl α β)
284284
simp only [Impl.toList_eq_toListModel, toList, List.cons_append,
285285
Impl.toListModel_inner, List.append_assoc]
286286

287-
theorem Zipper.toList_prependMap_done (t : Impl α β) : (Zipper.prependMap t .done).toList = t.toList := by
287+
theorem Zipper.toList_prependMap_of_done (t : Impl α β) : (Zipper.prependMap t .done).toList = t.toList := by
288288
simp [Zipper.toList_prependMap_eq_append, Zipper.toList]
289289

290290
theorem Zipper.ordered_prependMap [Ord α] [TransOrd α] {t : Impl α β}
@@ -351,7 +351,8 @@ theorem Zipper.ordered_of_cons_ordered [Ord α] [TransOrd α] {t : Impl α β}
351351
simp only [Ordered]
352352
exact List.Pairwise.sublist (List.sublist_append_right (⟨k, v⟩ :: t.toList) z.toList) hyp
353353

354-
theorem Zipper.prependMap_size (t : Impl α β) (it : Zipper α β) : (Zipper.prependMap t it).size = t.treeSize + it.size := by
354+
theorem Zipper.prependMap_size_eq (t : Impl α β) (it : Zipper α β) :
355+
(Zipper.prependMap t it).size = t.treeSize + it.size := by
355356
fun_induction Zipper.prependMap
356357
case case1 =>
357358
simp only [Impl.treeSize, Nat.zero_add]
@@ -395,7 +396,7 @@ def Zipper.instFinitenessRelation : FinitenessRelation (Zipper α β) Id where
395396
contradiction
396397
case h_2 h2 =>
397398
simp at h'
398-
simp only [h2, ← h'.1, Zipper.prependMap_size, Zipper.size, Nat.add_lt_add_iff_right,
399+
simp only [h2, ← h'.1, Zipper.prependMap_size_eq, Zipper.size, Nat.add_lt_add_iff_right,
399400
Nat.lt_add_left_iff_pos, Nat.lt_add_one]
400401

401402
@[no_expose]
@@ -493,7 +494,7 @@ decreasing_by
493494
simp only [Zipper.prependMap, Impl.treeSize, Nat.add_zero, Nat.lt_add_left_iff_pos,
494495
Nat.lt_add_one]
495496
case inner =>
496-
simp only [Zipper.prependMap_size, Impl.treeSize, Nat.add_lt_add_iff_right, Nat.lt_add_left_iff_pos,
497+
simp only [Zipper.prependMap_size_eq, Impl.treeSize, Nat.add_lt_add_iff_right, Nat.lt_add_left_iff_pos,
497498
Nat.lt_add_one]
498499

499500
public theorem Zipper.iterOfTree_toList_eq_toList (t : Impl α β) :
@@ -583,7 +584,7 @@ def instFinitenessRelation [Ord α] : FinitenessRelation (RxcIterator α β) Id
583584
contradiction
584585
case isTrue heq =>
585586
simp at h'
586-
simp only [h2, ← h'.1, Zipper.prependMap_size, Zipper.size, Nat.add_lt_add_iff_right,
587+
simp only [h2, ← h'.1, Zipper.prependMap_size_eq, Zipper.size, Nat.add_lt_add_iff_right,
587588
Nat.lt_add_left_iff_pos, Nat.lt_add_one]
588589

589590
@[no_expose]
@@ -651,7 +652,7 @@ theorem toList_rxcIter {α β} [Ord α]
651652
rw [List.takeWhile_cons_of_neg ‹_›]
652653
termination_by z.size
653654
decreasing_by
654-
simp_all [Zipper.size, Zipper.prependMap_size]
655+
simp_all [Zipper.size, Zipper.prependMap_size_eq]
655656

656657
theorem toList_eq_takeWhile_list {α : Type u} {β : α → Type v} [Ord α] [TransOrd α] {bound : α} {l : List ((a : α) × β a)}
657658
{l_ordered : l.Pairwise (fun a b => compare a.1 b.1 = .lt)} :
@@ -740,7 +741,7 @@ def RxoIterator.instFinitenessRelation [Ord α] : FinitenessRelation (RxoIterato
740741
contradiction
741742
case isTrue heq =>
742743
simp at h'
743-
simp only [h2, ← h'.1, Zipper.prependMap_size, Zipper.size, Nat.add_lt_add_iff_right,
744+
simp only [h2, ← h'.1, Zipper.prependMap_size_eq, Zipper.size, Nat.add_lt_add_iff_right,
744745
Nat.lt_add_left_iff_pos, Nat.lt_add_one]
745746

746747
@[no_expose]
@@ -808,7 +809,7 @@ theorem toList_rxoIter {α β} [Ord α]
808809
rw [List.takeWhile_cons_of_neg ‹_›]
809810
termination_by z.size
810811
decreasing_by
811-
simp_all [Zipper.size, Zipper.prependMap_size]
812+
simp_all [Zipper.size, Zipper.prependMap_size_eq]
812813

813814
theorem toList_eq_takeWhile_list_LT {α : Type u} {β : α → Type v} [Ord α] [TransOrd α] {bound : α} {l : List ((a : α) × β a)}
814815
{l_ordered : l.Pairwise (fun a b => compare a.1 b.1 = .lt)} :
@@ -918,13 +919,13 @@ theorem toList_rccIter {α β} [Ord α] [TransOrd α]
918919
rw [Bool.and_comm]
919920
rw [← List.filter_filter]
920921
congr 1
921-
rw [← Zipper.prepend_pruneLE_eq_prependMapGE]
922+
rw [← Zipper.prependMap_of_pruneLE_eq_prependMapGE]
922923
. rw [Zipper.toList_prependMap_eq_append]
923924
rw [Impl.pruneLE_eq_filter]
924925
. simp [Zipper.toList]
925926
. exact t_ord
926927
. exact t_ord
927-
. rw [← Zipper.prepend_pruneLE_eq_prependMapGE]
928+
. rw [← Zipper.prependMap_of_pruneLE_eq_prependMapGE]
928929
. simp only [Zipper.toList_prependMap_eq_append, Zipper.toList, List.append_nil]
929930
rw [Impl.pruneLE_eq_filter]
930931
. apply List.Pairwise.filter
@@ -975,13 +976,13 @@ theorem toList_rcoIter {α β} [Ord α] [TransOrd α]
975976
rw [Bool.and_comm]
976977
rw [← List.filter_filter]
977978
congr 1
978-
rw [← Zipper.prepend_pruneLE_eq_prependMapGE]
979+
rw [← Zipper.prependMap_of_pruneLE_eq_prependMapGE]
979980
. rw [Zipper.toList_prependMap_eq_append]
980981
rw [Impl.pruneLE_eq_filter]
981982
. simp only [Zipper.toList, List.append_nil]
982983
. exact t_ord
983984
. exact t_ord
984-
. rw [← Zipper.prepend_pruneLE_eq_prependMapGE]
985+
. rw [← Zipper.prependMap_of_pruneLE_eq_prependMapGE]
985986
. simp only [Zipper.toList_prependMap_eq_append, Zipper.toList, List.append_nil]
986987
rw [Impl.pruneLE_eq_filter]
987988
. apply List.Pairwise.filter
@@ -1032,13 +1033,13 @@ theorem toList_rooIter {α β} [Ord α] [TransOrd α]
10321033
rw [Bool.and_comm]
10331034
rw [← List.filter_filter]
10341035
congr 1
1035-
rw [← Zipper.prepend_pruneLT_eq_prependMapGT]
1036+
rw [← Zipper.prependMap_of_pruneLT_eq_prependMapGT]
10361037
. rw [Zipper.toList_prependMap_eq_append]
10371038
rw [Impl.pruneLT_eq_filter]
10381039
. simp only [Zipper.toList, List.append_nil]
10391040
. exact t_ord
10401041
. exact t_ord
1041-
. rw [← Zipper.prepend_pruneLT_eq_prependMapGT]
1042+
. rw [← Zipper.prependMap_of_pruneLT_eq_prependMapGT]
10421043
. simp only [Zipper.toList_prependMap_eq_append, Zipper.toList, List.append_nil]
10431044
rw [Impl.pruneLT_eq_filter]
10441045
. apply List.Pairwise.filter
@@ -1089,13 +1090,13 @@ theorem toList_rocIter {α β} [Ord α] [TransOrd α]
10891090
rw [Bool.and_comm]
10901091
rw [← List.filter_filter]
10911092
congr 1
1092-
rw [← Zipper.prepend_pruneLT_eq_prependMapGT]
1093+
rw [← Zipper.prependMap_of_pruneLT_eq_prependMapGT]
10931094
. rw [Zipper.toList_prependMap_eq_append]
10941095
rw [Impl.pruneLT_eq_filter]
10951096
. simp only [Zipper.toList, List.append_nil]
10961097
. exact t_ord
10971098
. exact t_ord
1098-
. rw [← Zipper.prepend_pruneLT_eq_prependMapGT]
1099+
. rw [← Zipper.prependMap_of_pruneLT_eq_prependMapGT]
10991100
. simp only [Zipper.toList_prependMap_eq_append, Zipper.toList, List.append_nil]
11001101
rw [Impl.pruneLT_eq_filter]
11011102
. apply List.Pairwise.filter
@@ -1141,7 +1142,7 @@ theorem toList_rciIter {α β} [Ord α] [TransOrd α]
11411142
have := @Zipper.toList_iter _ _ (Zipper.prependMapGE t lowerBound Zipper.done)
11421143
simp only [Zipper.iter] at this
11431144
simp only [this]
1144-
rw [← Zipper.prepend_pruneLE_eq_prependMapGE]
1145+
rw [← Zipper.prependMap_of_pruneLE_eq_prependMapGE]
11451146
. simp only [Zipper.toList_prependMap_eq_append, Zipper.toList, List.append_nil]
11461147
apply Impl.pruneLE_eq_filter
11471148
exact t_ord
@@ -1183,7 +1184,7 @@ theorem toList_roiIter {α β} [Ord α] [TransOrd α]
11831184
have := @Zipper.toList_iter _ _ (Zipper.prependMapGT t lowerBound .done)
11841185
simp only [Zipper.iter] at this
11851186
rw [this]
1186-
rw [← Zipper.prepend_pruneLT_eq_prependMapGT]
1187+
rw [← Zipper.prependMap_of_pruneLT_eq_prependMapGT]
11871188
. simp only [Zipper.toList_prependMap_eq_append, Zipper.toList, List.append_nil]
11881189
apply Impl.pruneLT_eq_filter
11891190
exact t_ord

src/Std/Data/DTreeMap/Slice.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ public instance {α : Type u} {β : α → Type v} (cmp : α → α → Ordering
101101
Roo.Sliceable (DTreeMap α β cmp) α (@Internal.RooSlice α β ⟨cmp⟩) :=
102102
letI _ : Ord α := ⟨cmp⟩;⟨fun carrier range => ⟨carrier.inner, range⟩⟩
103103

104-
@[simp] public theorem toList_roo {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare) [TransCmp cmp]
104+
@[simp] public theorem toList_roo {α : Type u} {β : α → Type v}
105+
(cmp : α → α → Ordering := by exact compare) [TransCmp cmp]
105106
{t : DTreeMap α β cmp} {lowerBound upperBound : α} : t[lowerBound<...upperBound].toList =
106107
t.toList.filter (fun e => (cmp e.fst lowerBound).isGT ∧ (cmp e.fst upperBound).isLT) :=
107108
@Internal.toList_roo α β ⟨cmp⟩ _ t.inner (@t.wf.ordered α β ⟨cmp⟩ _) lowerBound upperBound

0 commit comments

Comments
 (0)