Skip to content

Commit 3e439f7

Browse files
committed
chore : fix user facing instances
1 parent 816e158 commit 3e439f7

File tree

3 files changed

+171
-167
lines changed

3 files changed

+171
-167
lines changed

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

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ end Impl
158158
open Std.Iterators
159159

160160
section Zipper
161+
161162
public inductive Zipper (α : Type u) (β : α → Type v) where
162163
| done
163164
| cons (k : α) (v : β k) (tree : Impl α β) (next : Zipper α β)
@@ -529,6 +530,7 @@ theorem Zipper.val_step_map_Zipper_eq_match {α β γ} {f : (a : α) × β a →
529530
end Zipper
530531

531532
section Rxc
533+
532534
public structure RxcIterator (α : Type u) (β : α → Type v) [Ord α] where
533535
iter : Zipper α β
534536
upper : α
@@ -630,7 +632,7 @@ public theorem val_step_rxcIterator_eq_match {α β} [Ord α]
630632
· simp only [IterM.Step.toPure, IterStep.mapIterator, Id.run]
631633
· split <;> simp only [IterM.Step.toPure, IterM.toIter, IterStep.mapIterator, Id.run]
632634

633-
public theorem toList_rxcIter {α β} [Ord α]
635+
theorem toList_rxcIter {α β} [Ord α]
634636
{z : Zipper α β} {bound : α} :
635637
(⟨RxcIterator.mk z bound⟩ : Iter (Sigma β)).toList =
636638
z.toList.takeWhile (fun e => (compare e.fst bound).isLE) := by
@@ -651,7 +653,7 @@ termination_by z.size
651653
decreasing_by
652654
simp_all [Zipper.size, Zipper.prependMap_size]
653655

654-
public theorem toList_eq_takeWhile_list {α : Type u} {β : α → Type v} [Ord α] [TransOrd α] {bound : α} {l : List ((a : α) × β a)}
656+
theorem toList_eq_takeWhile_list {α : Type u} {β : α → Type v} [Ord α] [TransOrd α] {bound : α} {l : List ((a : α) × β a)}
655657
{l_ordered : l.Pairwise (fun a b => compare a.1 b.1 = .lt)} :
656658
l.takeWhile (fun e => (compare e.fst bound).isLE) = l.filter (fun e => (compare e.fst bound).isLE) := by
657659
induction l
@@ -787,7 +789,7 @@ public theorem val_step_rxoIterator_eq_match {α β} [Ord α]
787789
· simp only [IterM.Step.toPure, IterStep.mapIterator, Id.run]
788790
· split <;> simp only [IterM.Step.toPure, IterM.toIter, IterStep.mapIterator, Id.run]
789791

790-
public theorem toList_rxoIter {α β} [Ord α]
792+
theorem toList_rxoIter {α β} [Ord α]
791793
{z : Zipper α β} {bound : α} :
792794
(⟨RxoIterator.mk z bound⟩ : Iter (Sigma β)).toList =
793795
z.toList.takeWhile (fun e => (compare e.fst bound).isLT) := by
@@ -808,7 +810,7 @@ termination_by z.size
808810
decreasing_by
809811
simp_all [Zipper.size, Zipper.prependMap_size]
810812

811-
public theorem toList_eq_takeWhile_list_LT {α : Type u} {β : α → Type v} [Ord α] [TransOrd α] {bound : α} {l : List ((a : α) × β a)}
813+
theorem toList_eq_takeWhile_list_LT {α : Type u} {β : α → Type v} [Ord α] [TransOrd α] {bound : α} {l : List ((a : α) × β a)}
812814
{l_ordered : l.Pairwise (fun a b => compare a.1 b.1 = .lt)} :
813815
l.takeWhile (fun e => (compare e.fst bound).isLT) = l.filter (fun e => (compare e.fst bound).isLT) := by
814816
induction l
@@ -844,6 +846,7 @@ public theorem toList_eq_takeWhile_LT {α β} [Ord α] [TransOrd α] {z : Zipper
844846
end Rxo
845847

846848
section Ric
849+
847850
public structure RicSliceData (α : Type u) (β : α → Type v) [Ord α] where
848851
treeMap : Impl α β
849852
range : Ric α
@@ -870,6 +873,7 @@ public theorem toList_ric {α : Type u} {β : α → Type v} [Ord α] [TransOrd
870873
end Ric
871874

872875
section Rio
876+
873877
public structure RioSliceData (α : Type u) (β : α → Type v) [Ord α] where
874878
treeMap : Impl α β
875879
range : Rio α
@@ -901,7 +905,7 @@ section Rcc
901905
public def RccIterator [Ord α] (t : Impl α β) (lowerBound : α) (upperBound : α) : Iter (α := RxcIterator α β) ((a : α) × β a) :=
902906
⟨RxcIterator.mk (Zipper.prependMapGE t lowerBound .done) upperBound⟩
903907

904-
public theorem toList_rccIter {α β} [Ord α] [TransOrd α]
908+
theorem toList_rccIter {α β} [Ord α] [TransOrd α]
905909
{t : Impl α β} {t_ord : t.Ordered} {lowerBound upperBound : α} :
906910
(RccIterator t lowerBound upperBound : Iter (Sigma β)).toList =
907911
t.toList.filter (fun e => (compare e.fst lowerBound).isGE ∧ (compare e.fst upperBound).isLE) := by
@@ -958,7 +962,7 @@ section Rco
958962
public def RcoIterator [Ord α] (t : Impl α β) (lowerBound : α) (upperBound : α) : Iter (α := RxoIterator α β) ((a : α) × β a) :=
959963
⟨RxoIterator.mk (Zipper.prependMapGE t lowerBound .done) upperBound⟩
960964

961-
public theorem toList_rcoIter {α β} [Ord α] [TransOrd α]
965+
theorem toList_rcoIter {α β} [Ord α] [TransOrd α]
962966
{t : Impl α β} {t_ord : t.Ordered} {lowerBound upperBound : α} :
963967
(RcoIterator t lowerBound upperBound : Iter (Sigma β)).toList =
964968
t.toList.filter (fun e => (compare e.fst lowerBound).isGE ∧ (compare e.fst upperBound).isLT) := by
@@ -1010,11 +1014,12 @@ public theorem toList_rco {α : Type u} {β : α → Type v} [Ord α] [TransOrd
10101014
end Rco
10111015

10121016
section Roo
1017+
10131018
@[always_inline]
10141019
public def RooIterator [Ord α] (t : Impl α β) (lowerBound : α) (upperBound : α) : Iter (α := RxoIterator α β) ((a : α) × β a) :=
10151020
⟨RxoIterator.mk (Zipper.prependMapGT t lowerBound .done) upperBound⟩
10161021

1017-
public theorem toList_rooIter {α β} [Ord α] [TransOrd α]
1022+
theorem toList_rooIter {α β} [Ord α] [TransOrd α]
10181023
{t : Impl α β} {t_ord : t.Ordered} {lowerBound upperBound : α} :
10191024
(RooIterator t lowerBound upperBound : Iter (Sigma β)).toList =
10201025
t.toList.filter (fun e => (compare e.fst lowerBound).isGT ∧ (compare e.fst upperBound).isLT) := by
@@ -1066,11 +1071,12 @@ public theorem toList_roo {α : Type u} {β : α → Type v} [Ord α] [TransOrd
10661071
end Roo
10671072

10681073
section Roc
1074+
10691075
@[always_inline]
10701076
public def RocIterator [Ord α] (t : Impl α β) (lowerBound : α) (upperBound : α) : Iter (α := RxcIterator α β) ((a : α) × β a) :=
10711077
⟨RxcIterator.mk (Zipper.prependMapGT t lowerBound .done) upperBound⟩
10721078

1073-
public theorem toList_rocIter {α β} [Ord α] [TransOrd α]
1079+
theorem toList_rocIter {α β} [Ord α] [TransOrd α]
10741080
{t : Impl α β} {t_ord : t.Ordered} {lowerBound upperBound : α} :
10751081
(RocIterator t lowerBound upperBound : Iter (Sigma β)).toList =
10761082
t.toList.filter (fun e => (compare e.fst lowerBound).isGT ∧ (compare e.fst upperBound).isLE) := by
@@ -1122,11 +1128,12 @@ public theorem toList_roc {α : Type u} {β : α → Type v} [Ord α] [TransOrd
11221128
end Roc
11231129

11241130
section Rci
1131+
11251132
@[always_inline]
11261133
public def RciIterator [Ord α] (t : Impl α β) (lowerBound : α) : Iter (α := Zipper α β) ((a : α) × β a) :=
11271134
⟨Zipper.prependMapGE t lowerBound .done⟩
11281135

1129-
public theorem toList_rciIter {α β} [Ord α] [TransOrd α]
1136+
theorem toList_rciIter {α β} [Ord α] [TransOrd α]
11301137
{t : Impl α β} {t_ord : t.Ordered} {lowerBound : α} :
11311138
(RciIterator t lowerBound : Iter (Sigma β)).toList =
11321139
t.toList.filter (fun e => (compare e.fst lowerBound).isGE) := by
@@ -1163,11 +1170,12 @@ public theorem toList_rci {α : Type u} {β : α → Type v} [Ord α] [TransOrd
11631170
end Rci
11641171

11651172
section Roi
1173+
11661174
@[always_inline]
11671175
public def RoiIterator [Ord α] (t : Impl α β) (lowerBound : α) : Iter (α := Zipper α β) ((a : α) × β a) :=
11681176
⟨Zipper.prependMapGT t lowerBound .done⟩
11691177

1170-
public theorem toList_roiIter {α β} [Ord α] [TransOrd α]
1178+
theorem toList_roiIter {α β} [Ord α] [TransOrd α]
11711179
{t : Impl α β} {t_ord : t.Ordered} {lowerBound : α} :
11721180
(RoiIterator t lowerBound : Iter (Sigma β)).toList =
11731181
t.toList.filter (fun e => (compare e.fst lowerBound).isGT) := by
@@ -1208,7 +1216,7 @@ section Rii
12081216
public def RiiIterator (t : Impl α β) : Iter (α := Zipper α β) ((a : α) × β a) :=
12091217
⟨Zipper.prependMap t .done⟩
12101218

1211-
public theorem toList_riiIter {α β}
1219+
theorem toList_riiIter {α β}
12121220
{t : Impl α β} :
12131221
(RiiIterator t : Iter (Sigma β)).toList =
12141222
t.toList := by

src/Std/Data/DTreeMap/Raw/Slice.lean

Lines changed: 76 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -19,85 +19,83 @@ public instance {α : Type u} {β : α → Type v}
1919
mkSlice carrier range := ⟨carrier.inner, range⟩
2020

2121
@[simp] public theorem toList_rii {α : Type u} {β : α → Type v}
22-
[Ord α] {t : Raw α β compare} : t[*...*].toList = t.toList := by
22+
(cmp : α → α → Ordering := by exact compare) {t : Raw α β cmp} : t[*...*].toList = t.toList := by
2323
apply Internal.toList_rii
2424

25-
public instance {α : Type u} {β : α → Type v} [Ord α] (cmp : α → α → Ordering := by exact compare) :
26-
Ric.Sliceable (Raw α β cmp) α (Internal.RicSlice α β) where
27-
mkSlice carrier range := ⟨carrier.inner, range⟩
28-
29-
public theorem toList_ric {α : Type u} {β : α → Type v} [Ord α] [TransOrd α]
30-
{t : Raw α β compare} {wf : t.WF} {bound : α} :
31-
t[*...=bound].toList = t.toList.filter (fun e => (compare e.fst bound).isLE) := by
32-
apply Internal.toList_ric
33-
. exact wf.out.ordered
34-
35-
public instance {α : Type u} {β : α → Type v} [Ord α] (cmp : α → α → Ordering := by exact compare) :
36-
Rio.Sliceable (Raw α β cmp) α (Internal.RioSlice α β) where
37-
mkSlice carrier range := ⟨carrier.inner, range⟩
38-
39-
public theorem toList_rio {α : Type u} {β : α → Type v} [Ord α] [TransOrd α] {t : Raw α β compare} {wf : t.WF} {bound : α} :
40-
t[*...<bound].toList = t.toList.filter (fun e => (compare e.fst bound).isLT) := by
41-
apply Internal.toList_rio
42-
. exact wf.out.ordered
43-
44-
public instance {α : Type u} {β : α → Type v} [Ord α] (cmp : α → α → Ordering := by exact compare) :
45-
Rci.Sliceable (Raw α β cmp) α (Internal.RciSlice α β) where
46-
mkSlice carrier range := ⟨carrier.inner, range⟩
47-
48-
public theorem toList_rci {α : Type u} {β : α → Type v} [Ord α] [TransOrd α] {t : Raw α β compare} {wf : t.WF} {bound : α} :
49-
t[bound...*].toList = t.toList.filter (fun e => (compare e.fst bound).isGE) := by
50-
apply Internal.toList_rci
51-
. exact wf.out.ordered
52-
53-
public instance {α : Type u} {β : α → Type v} [Ord α] (cmp : α → α → Ordering := by exact compare) :
54-
Rco.Sliceable (Raw α β cmp) α (Internal.RcoSlice α β) where
55-
mkSlice carrier range := ⟨carrier.inner, range⟩
56-
57-
public theorem toList_rco {α : Type u} {β : α → Type v} [Ord α] [TransOrd α] {t : Raw α β compare}
58-
{wf : t.WF} {lowerBound upperBound : α} : t[lowerBound...<upperBound].toList =
59-
t.toList.filter (fun e => (compare e.fst lowerBound).isGE ∧ (compare e.fst upperBound).isLT) := by
60-
apply Internal.toList_rco
61-
. exact wf.out.ordered
62-
63-
public instance {α : Type u} {β : α → Type v} [Ord α] (cmp : α → α → Ordering := by exact compare) :
64-
Rcc.Sliceable (Raw α β cmp) α (Internal.RccSlice α β) where
65-
mkSlice carrier range := ⟨carrier.inner, range⟩
66-
67-
public theorem toList_rcc {α : Type u} {β : α → Type v} [Ord α] [TransOrd α] {t : Raw α β compare}
68-
{wf : t.WF} {lowerBound upperBound : α} : t[lowerBound...=upperBound].toList =
69-
t.toList.filter (fun e => (compare e.fst lowerBound).isGE ∧ (compare e.fst upperBound).isLE) := by
70-
apply Internal.toList_rcc
71-
. exact wf.out.ordered
72-
73-
public instance {α : Type u} {β : α → Type v} [Ord α] (cmp : α → α → Ordering := by exact compare) :
74-
Roi.Sliceable (Raw α β cmp) α (Internal.RoiSlice α β) where
75-
mkSlice carrier range := ⟨carrier.inner, range⟩
76-
77-
public theorem toList_roi {α : Type u} {β : α → Type v} [Ord α] [TransOrd α]
78-
{t : Raw α β compare} {wf : t.WF} {bound: α} : t[bound<...*].toList =
79-
t.toList.filter (fun e => (compare e.fst bound).isGT) := by
80-
apply Internal.toList_roi
81-
. exact wf.out.ordered
82-
83-
public instance {α : Type u} {β : α → Type v} [Ord α] (cmp : α → α → Ordering := by exact compare) :
84-
Roc.Sliceable (Raw α β cmp) α (Internal.RocSlice α β) where
85-
mkSlice carrier range := ⟨carrier.inner, range⟩
86-
87-
public theorem toList_roc {α : Type u} {β : α → Type v} [Ord α] [TransOrd α] {t : Raw α β compare}
88-
{wf : t.WF} {lowerBound upperBound : α} : t[lowerBound<...=upperBound].toList =
89-
t.toList.filter (fun e => (compare e.fst lowerBound).isGT ∧ (compare e.fst upperBound).isLE) := by
90-
apply Internal.toList_roc
91-
. exact wf.out.ordered
92-
93-
public instance {α : Type u} {β : α → Type v} [Ord α] (cmp : α → α → Ordering := by exact compare) :
94-
Roo.Sliceable (Raw α β cmp) α (Internal.RooSlice α β) where
95-
mkSlice carrier range := ⟨carrier.inner, range⟩
96-
97-
public theorem toList_roo {α : Type u} {β : α → Type v} [Ord α] [TransOrd α]
98-
{t : Raw α β compare} {wf : t.WF} {lowerBound upperBound : α} : t[lowerBound<...upperBound].toList =
99-
t.toList.filter (fun e => (compare e.fst lowerBound).isGT ∧ (compare e.fst upperBound).isLT) := by
100-
apply Internal.toList_roo
101-
. exact wf.out.ordered
25+
public instance {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare) :
26+
Ric.Sliceable (Raw α β cmp) α (@Internal.RicSlice α β ⟨cmp⟩) :=
27+
letI _ : Ord α := ⟨cmp⟩;⟨fun carrier range => ⟨carrier.inner, range⟩⟩
28+
29+
public theorem toList_ric {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare)
30+
[TransCmp cmp] {t : Raw α β cmp} {wf : t.WF} {bound : α} :
31+
t[*...=bound].toList = t.toList.filter (fun e => (cmp e.fst bound).isLE) :=
32+
@Internal.toList_ric α β ⟨cmp⟩ _ t.inner (@wf.out.ordered α β ⟨cmp⟩ _) bound
33+
34+
public instance {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare) :
35+
Rio.Sliceable (Raw α β cmp) α (@Internal.RioSlice α β ⟨cmp⟩) :=
36+
letI _ : Ord α := ⟨cmp⟩;⟨fun carrier range => ⟨carrier.inner, range⟩⟩
37+
38+
public theorem toList_rio {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare)
39+
[TransCmp cmp] {t : Raw α β cmp} {wf : t.WF} {bound : α} :
40+
t[*...<bound].toList = t.toList.filter (fun e => (cmp e.fst bound).isLT) :=
41+
@Internal.toList_rio α β ⟨cmp⟩ _ t.inner (@wf.out.ordered α β ⟨cmp⟩ _) bound
42+
43+
public instance {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare) :
44+
Rci.Sliceable (Raw α β cmp) α (@Internal.RciSlice α β ⟨cmp⟩) :=
45+
letI _ : Ord α := ⟨cmp⟩;⟨fun carrier range => ⟨carrier.inner, range⟩⟩
46+
47+
public theorem toList_rci {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare)
48+
[TransCmp cmp] {t : Raw α β cmp} {wf : t.WF} {bound : α} :
49+
t[bound...*].toList = t.toList.filter (fun e => (cmp e.fst bound).isGE) :=
50+
@Internal.toList_rci α β ⟨cmp⟩ _ t.inner (@wf.out.ordered α β ⟨cmp⟩ _) bound
51+
52+
public instance {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare) :
53+
Rco.Sliceable (Raw α β cmp) α (@Internal.RcoSlice α β ⟨cmp⟩) :=
54+
letI _ : Ord α := ⟨cmp⟩;⟨fun carrier range => ⟨carrier.inner, range⟩⟩
55+
56+
public theorem toList_rco {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare)
57+
[TransCmp cmp] {t : Raw α β cmp} {wf : t.WF} {lowerBound upperBound : α} :
58+
t[lowerBound...<upperBound].toList =
59+
t.toList.filter (fun e => (cmp e.fst lowerBound).isGE ∧ (cmp e.fst upperBound).isLT) :=
60+
@Internal.toList_rco α β ⟨cmp⟩ _ t.inner (@wf.out.ordered α β ⟨cmp⟩ _) lowerBound upperBound
61+
62+
public instance {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare) :
63+
Rcc.Sliceable (Raw α β cmp) α (@Internal.RccSlice α β ⟨cmp⟩) :=
64+
letI _ : Ord α := ⟨cmp⟩;⟨fun carrier range => ⟨carrier.inner, range⟩⟩
65+
66+
public theorem toList_rcc {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare)
67+
[TransCmp cmp] {t : Raw α β cmp} {wf : t.WF} {lowerBound upperBound : α} :
68+
t[lowerBound...=upperBound].toList =
69+
t.toList.filter (fun e => (cmp e.fst lowerBound).isGE ∧ (cmp e.fst upperBound).isLE) :=
70+
@Internal.toList_rcc α β ⟨cmp⟩ _ t.inner (@wf.out.ordered α β ⟨cmp⟩ _) lowerBound upperBound
71+
72+
public instance {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare) :
73+
Roi.Sliceable (Raw α β cmp) α (@Internal.RoiSlice α β ⟨cmp⟩) :=
74+
letI _ : Ord α := ⟨cmp⟩;⟨fun carrier range => ⟨carrier.inner, range⟩⟩
75+
76+
public theorem toList_roi {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare)
77+
[TransCmp cmp] {t : Raw α β cmp} {wf : t.WF} {bound: α} : t[bound<...*].toList =
78+
t.toList.filter (fun e => (cmp e.fst bound).isGT) :=
79+
@Internal.toList_roi α β ⟨cmp⟩ _ t.inner (@wf.out.ordered α β ⟨cmp⟩ _) bound
80+
81+
public instance {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare) :
82+
Roc.Sliceable (Raw α β cmp) α (@Internal.RocSlice α β ⟨cmp⟩) :=
83+
letI _ : Ord α := ⟨cmp⟩;⟨fun carrier range => ⟨carrier.inner, range⟩⟩
84+
85+
public theorem toList_roc {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare)
86+
[TransCmp cmp] {t : Raw α β cmp} {wf : t.WF} {lowerBound upperBound : α} :
87+
t[lowerBound<...=upperBound].toList =
88+
t.toList.filter (fun e => (cmp e.fst lowerBound).isGT ∧ (cmp e.fst upperBound).isLE) :=
89+
@Internal.toList_roc α β ⟨cmp⟩ _ t.inner (@wf.out.ordered α β ⟨cmp⟩ _) lowerBound upperBound
90+
91+
public instance {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare) :
92+
Roo.Sliceable (Raw α β cmp) α (@Internal.RooSlice α β ⟨cmp⟩) :=
93+
letI _ : Ord α := ⟨cmp⟩;⟨fun carrier range => ⟨carrier.inner, range⟩⟩
94+
95+
public theorem toList_roo {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare)
96+
[TransCmp cmp] {t : Raw α β cmp} {wf : t.WF} {lowerBound upperBound : α} :
97+
t[lowerBound<...upperBound].toList =
98+
t.toList.filter (fun e => (cmp e.fst lowerBound).isGT ∧ (cmp e.fst upperBound).isLT) :=
99+
@Internal.toList_roo α β ⟨cmp⟩ _ t.inner (@wf.out.ordered α β ⟨cmp⟩ _) lowerBound upperBound
102100

103101
end Std.DTreeMap.Raw

0 commit comments

Comments
 (0)