Skip to content

Commit a1f5c3d

Browse files
committed
feat: change Array.set to take a Nat and a tactic provided bound
1 parent 74e9807 commit a1f5c3d

File tree

19 files changed

+66
-86
lines changed

19 files changed

+66
-86
lines changed

src/Init/Data/Array/Basic.lean

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ namespace Array
3030

3131
/-! ### Preliminary theorems -/
3232

33-
@[simp] theorem size_set (a : Array α) (i : Fin a.size) (v : α) : (set a i v).size = a.size :=
33+
@[simp] theorem size_set (a : Array α) (i : Nat) (v : α) (h : i < a.size) :
34+
(set a i v h).size = a.size :=
3435
List.length_set ..
3536

3637
@[simp] theorem size_push (a : Array α) (v : α) : (push a v).size = a.size + 1 :=
@@ -142,7 +143,7 @@ def uget (a : @& Array α) (i : USize) (h : i.toNat < a.size) : α :=
142143
`fset` may be slightly slower than `uset`. -/
143144
@[extern "lean_array_uset"]
144145
def uset (a : Array α) (i : USize) (v : α) (h : i.toNat < a.size) : Array α :=
145-
a.set i.toNat, h⟩ v
146+
a.set i.toNat v h
146147

147148
@[extern "lean_array_pop"]
148149
def pop (a : Array α) : Array α where
@@ -168,10 +169,10 @@ def swap (a : Array α) (i j : @& Fin a.size) : Array α :=
168169
let v₁ := a.get i
169170
let v₂ := a.get j
170171
let a' := a.set i v₂
171-
a'.set (size_set a i v₂ ▸ j) v₁
172+
a'.set j v₁ (Nat.lt_of_lt_of_eq j.isLt (size_set a i v₂ _).symm)
172173

173174
@[simp] theorem size_swap (a : Array α) (i j : Fin a.size) : (a.swap i j).size = a.size := by
174-
show ((a.set i (a.get j)).set (size_set a i _ ▸ j) (a.get i)).size = a.size
175+
show ((a.set i (a.get j)).set j (a.get i) (Nat.lt_of_lt_of_eq j.isLt (size_set a i (a.get j) _).symm)).size = a.size
175176
rw [size_set, size_set]
176177

177178
/--
@@ -279,7 +280,7 @@ unsafe def modifyMUnsafe [Monad m] (a : Array α) (i : Nat) (f : α → m α) :
279280
-- of the element type, and that it is valid to store `box(0)` in any array.
280281
let a' := a.set idx (unsafeCast ())
281282
let v ← f v
282-
pure <| a'.set (size_set a .. ▸ idx) v
283+
pure <| a'.set idx v (Nat.lt_of_lt_of_eq h (size_set a ..).symm)
283284
else
284285
pure a
285286

src/Init/Data/Array/BasicAux.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ where
6060
if ptrEq a b then
6161
go (i+1) as
6262
else
63-
go (i+1) (as.set ⟨i, h⟩ b)
63+
go (i+1) (as.set i b h)
6464
else
6565
return as
6666

src/Init/Data/Array/Lemmas.lean

Lines changed: 38 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -337,25 +337,26 @@ theorem get!_eq_getD [Inhabited α] (a : Array α) : a.get! n = a.getD n default
337337

338338
/-! # set -/
339339

340-
@[simp] theorem getElem_set_eq (a : Array α) (i : Fin a.size) (v : α) {j : Nat}
341-
(eq : i.val = j) (p : j < (a.set i v).size) :
340+
@[simp] theorem getElem_set_eq (a : Array α) (i : Nat) (h : i < a.size) (v : α) {j : Nat}
341+
(eq : i = j) (p : j < (a.set i v).size) :
342342
(a.set i v)[j]'p = v := by
343343
simp [set, getElem_eq_getElem_toList, ←eq]
344344

345-
@[simp] theorem getElem_set_ne (a : Array α) (i : Fin a.size) (v : α) {j : Nat} (pj : j < (a.set i v).size)
346-
(h : i.val ≠ j) : (a.set i v)[j]'pj = a[j]'(size_set a i v ▸ pj) := by
345+
@[simp] theorem getElem_set_ne (a : Array α) (i : Nat) (h' : i < a.size) (v : α) {j : Nat}
346+
(pj : j < (a.set i v).size) (h : i ≠ j) :
347+
(a.set i v)[j]'pj = a[j]'(size_set a i v _ ▸ pj) := by
347348
simp only [set, getElem_eq_getElem_toList, List.getElem_set_ne h]
348349

349-
theorem getElem_set (a : Array α) (i : Fin a.size) (v : α) (j : Nat)
350+
theorem getElem_set (a : Array α) (i : Nat) (h' : i < a.size) (v : α) (j : Nat)
350351
(h : j < (a.set i v).size) :
351-
(a.set i v)[j]'h = if i = j then v else a[j]'(size_set a i v ▸ h) := by
352-
by_cases p : i.1 = j <;> simp [p]
352+
(a.set i v)[j]'h = if i = j then v else a[j]'(size_set a i v _ ▸ h) := by
353+
by_cases p : i = j <;> simp [p]
353354

354-
@[simp] theorem getElem?_set_eq (a : Array α) (i : Fin a.size) (v : α) :
355-
(a.set i v)[i.1]? = v := by simp [getElem?_lt, i.2]
355+
@[simp] theorem getElem?_set_eq (a : Array α) (i : Nat) (h : i < a.size) (v : α) :
356+
(a.set i v)[i]? = v := by simp [getElem?_lt, h]
356357

357-
@[simp] theorem getElem?_set_ne (a : Array α) (i : Fin a.size) {j : Nat} (v : α)
358-
(ne : i.val ≠ j) : (a.set i v)[j]? = a[j]? := by
358+
@[simp] theorem getElem?_set_ne (a : Array α) (i : Nat) (h : i < a.size) {j : Nat} (v : α)
359+
(ne : i ≠ j) : (a.set i v)[j]? = a[j]? := by
359360
by_cases h : j < a.size <;> simp [getElem?_lt, getElem?_ge, Nat.ge_of_not_lt, ne, h]
360361

361362
/-! # setD -/
@@ -372,7 +373,7 @@ theorem getElem_set (a : Array α) (i : Fin a.size) (v : α) (j : Nat)
372373
@[simp] theorem getElem_setD_eq (a : Array α) {i : Nat} (v : α) (h : _) :
373374
(setD a i v)[i]'h = v := by
374375
simp at h
375-
simp only [setD, h, dite_true, getElem_set, ite_true]
376+
simp only [setD, h, ↓reduceDIte, getElem_set_eq]
376377

377378
@[simp]
378379
theorem getElem?_setD_eq (a : Array α) {i : Nat} (p : i < a.size) (v : α) : (a.setD i v)[i]? = some v := by
@@ -547,43 +548,43 @@ theorem getElem?_push {a : Array α} : (a.push x)[i]? = if i = a.size then some
547548

548549
@[deprecated getElem?_size (since := "2024-10-21")] abbrev get?_size := @getElem?_size
549550

550-
@[simp] theorem toList_set (a : Array α) (i v) : (a.set i v).toList = a.toList.set i.1 v := rfl
551+
@[simp] theorem toList_set (a : Array α) (i v h) : (a.set i v).toList = a.toList.set i v := rfl
551552

552-
theorem get_set_eq (a : Array α) (i : Fin a.size) (v : α) :
553-
(a.set i v)[i.1] = v := by
553+
theorem get_set_eq (a : Array α) (i : Nat) (v : α) (h : i < a.size) :
554+
(a.set i v h)[i]'(by simp [h]) = v := by
554555
simp only [set, getElem_eq_getElem_toList, List.getElem_set_self]
555556

556-
theorem get?_set_eq (a : Array α) (i : Fin a.size) (v : α) :
557-
(a.set i v)[i.1]? = v := by simp [getElem?_pos, i.2]
557+
theorem get?_set_eq (a : Array α) (i : Nat) (v : α) (h : i < a.size) :
558+
(a.set i v)[i]? = v := by simp [getElem?_pos, h]
558559

559-
@[simp] theorem get?_set_ne (a : Array α) (i : Fin a.size) {j : Nat} (v : α)
560-
(h : i.1 ≠ j) : (a.set i v)[j]? = a[j]? := by
560+
@[simp] theorem get?_set_ne (a : Array α) (i : Nat) (h' : i < a.size) {j : Nat} (v : α)
561+
(h : i ≠ j) : (a.set i v)[j]? = a[j]? := by
561562
by_cases j < a.size <;> simp [getElem?_pos, getElem?_neg, *]
562563

563-
theorem get?_set (a : Array α) (i : Fin a.size) (j : Nat) (v : α) :
564-
(a.set i v)[j]? = if i.1 = j then some v else a[j]? := by
565-
if h : i.1 = j then subst j; simp [*] else simp [*]
564+
theorem get?_set (a : Array α) (i : Nat) (h : i < a.size) (j : Nat) (v : α) :
565+
(a.set i v)[j]? = if i = j then some v else a[j]? := by
566+
if h : i = j then subst j; simp [*] else simp [*]
566567

567-
theorem get_set (a : Array α) (i : Fin a.size) (j : Nat) (hj : j < a.size) (v : α) :
568+
theorem get_set (a : Array α) (i : Nat) (hi : i < a.size) (j : Nat) (hj : j < a.size) (v : α) :
568569
(a.set i v)[j]'(by simp [*]) = if i = j then v else a[j] := by
569-
if h : i.1 = j then subst j; simp [*] else simp [*]
570+
if h : i = j then subst j; simp [*] else simp [*]
570571

571-
@[simp] theorem get_set_ne (a : Array α) (i : Fin a.size) {j : Nat} (v : α) (hj : j < a.size)
572-
(h : i.1 ≠ j) : (a.set i v)[j]'(by simp [*]) = a[j] := by
572+
@[simp] theorem get_set_ne (a : Array α) (i : Nat) (hi : i < a.size) {j : Nat} (v : α) (hj : j < a.size)
573+
(h : i ≠ j) : (a.set i v)[j]'(by simp [*]) = a[j] := by
573574
simp only [set, getElem_eq_getElem_toList, List.getElem_set_ne h]
574575

575576
theorem getElem_setD (a : Array α) (i : Nat) (v : α) (h : i < (setD a i v).size) :
576577
(setD a i v)[i] = v := by
577578
simp at h
578-
simp only [setD, h, dite_true, get_set, ite_true]
579+
simp only [setD, h, ↓reduceDIte, getElem_set_eq]
579580

580-
theorem set_set (a : Array α) (i : Fin a.size) (v v' : α) :
581-
(a.set i v).set ⟨i, by simp [i.2]⟩ v' = a.set i v' := by simp [set, List.set_set]
581+
theorem set_set (a : Array α) (i : Nat) (h) (v v' : α) :
582+
(a.set i v h).set i v' (by simp [h]) = a.set i v' := by simp [set, List.set_set]
582583

583584
private theorem fin_cast_val (e : n = n') (i : Fin n) : e ▸ i = ⟨i.1, e ▸ i.2⟩ := by cases e; rfl
584585

585586
theorem swap_def (a : Array α) (i j : Fin a.size) :
586-
a.swap i j = (a.set i (a.get j)).set ⟨j.1, by simp [j.2]⟩ (a.get i) := by
587+
a.swap i j = (a.set i (a.get j)).set j (a.get i) := by
587588
simp [swap, fin_cast_val]
588589

589590
@[simp] theorem toList_swap (a : Array α) (i j : Fin a.size) :
@@ -601,7 +602,7 @@ theorem getElem?_swap (a : Array α) (i j : Fin a.size) (k : Nat) : (a.swap i j)
601602

602603
@[simp]
603604
theorem swapAt!_def (a : Array α) (i : Nat) (v : α) (h : i < a.size) :
604-
a.swapAt! i v = (a[i], a.set ⟨i, h⟩ v) := by simp [swapAt!, h]
605+
a.swapAt! i v = (a[i], a.set i v) := by simp [swapAt!, h]
605606

606607
@[simp] theorem size_swapAt! (a : Array α) (i : Nat) (v : α) :
607608
(a.swapAt! i v).2.size = a.size := by
@@ -966,7 +967,7 @@ theorem getElem_modify {as : Array α} {x i} (h : i < (as.modify x f).size) :
966967
(as.modify x f)[i] = if x = i then f (as[i]'(by simpa using h)) else as[i]'(by simpa using h) := by
967968
simp only [modify, modifyM, get_eq_getElem, Id.run, Id.pure_eq]
968969
split
969-
· simp only [Id.bind_eq, get_set _ _ _ (by simpa using h)]; split <;> simp [*]
970+
· simp only [Id.bind_eq, get_set _ _ _ _ (by simpa using h)]; split <;> simp [*]
970971
· rw [if_neg (mt (by rintro rfl; exact h) (by simp_all))]
971972

972973
@[simp] theorem toList_modify (as : Array α) (f : α → α) :
@@ -1406,30 +1407,15 @@ instance [DecidableEq α] (a : α) (as : Array α) : Decidable (a ∈ as) :=
14061407

14071408
open Fin
14081409

1409-
@[simp] theorem getElem_swap_right (a : Array α) {i j : Fin a.size} : (a.swap i j)[j.val] = a[i] :=
1410-
by simp only [swap, fin_cast_val, get_eq_getElem, getElem_set_eq, getElem_fin]
1410+
@[simp] theorem getElem_swap_right (a : Array α) {i j : Fin a.size} : (a.swap i j)[j.1] = a[i] := by
1411+
simp [swap_def, getElem_set]
14111412

1412-
@[simp] theorem getElem_swap_left (a : Array α) {i j : Fin a.size} : (a.swap i j)[i.val] = a[j] :=
1413-
if he : ((Array.size_set _ _ _).symm ▸ j).val = i.val then by
1414-
simp only [←he, fin_cast_val, getElem_swap_right, getElem_fin]
1415-
else by
1416-
apply Eq.trans
1417-
· apply Array.get_set_ne
1418-
· simp only [size_set, Fin.isLt]
1419-
· assumption
1420-
· simp [get_set_ne]
1413+
@[simp] theorem getElem_swap_left (a : Array α) {i j : Fin a.size} : (a.swap i j)[i.1] = a[j] := by
1414+
simp +contextual [swap_def, getElem_set]
14211415

14221416
@[simp] theorem getElem_swap_of_ne (a : Array α) {i j : Fin a.size} (hp : p < a.size)
14231417
(hi : p ≠ i) (hj : p ≠ j) : (a.swap i j)[p]'(a.size_swap .. |>.symm ▸ hp) = a[p] := by
1424-
apply Eq.trans
1425-
· have : ((a.size_set i (a.get j)).symm ▸ j).val = j.val := by simp only [fin_cast_val]
1426-
apply Array.get_set_ne
1427-
· simp only [this]
1428-
apply Ne.symm
1429-
· assumption
1430-
· apply Array.get_set_ne
1431-
· apply Ne.symm
1432-
· assumption
1418+
simp [swap_def, getElem_set, hi.symm, hj.symm]
14331419

14341420
theorem getElem_swap' (a : Array α) (i j : Fin a.size) (k : Nat) (hk : k < a.size) :
14351421
(a.swap i j)[k]'(by simp_all) = if k = i then a[j] else if k = j then a[i] else a[k] := by

src/Init/Data/Array/Set.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ This will perform the update destructively provided that `a` has a reference
1414
count of 1 when called.
1515
-/
1616
@[extern "lean_array_fset"]
17-
def Array.set (a : Array α) (i : @& Fin a.size) (v : α) : Array α where
18-
toList := a.toList.set i.val v
17+
def Array.set (a : Array α) (i : @& Nat) (v : α) (h : i < a.size := by get_elem_tactic): Array α where
18+
toList := a.toList.set i v
1919

2020
/--
2121
Set an element in an array, or do nothing if the index is out of bounds.
@@ -24,7 +24,7 @@ This will perform the update destructively provided that `a` has a reference
2424
count of 1 when called.
2525
-/
2626
@[inline] def Array.setD (a : Array α) (i : Nat) (v : α) : Array α :=
27-
dite (LT.lt i a.size) (fun h => a.set ⟨i, h⟩ v) (fun _ => a)
27+
dite (LT.lt i a.size) (fun h => a.set i v h) (fun _ => a)
2828

2929
/--
3030
Set an element in an array, or panic if the index is out of bounds.

src/Init/Data/ByteArray/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def set! : ByteArray → (@& Nat) → UInt8 → ByteArray
6565

6666
@[extern "lean_byte_array_fset"]
6767
def set : (a : ByteArray) → (@& Fin a.size) → UInt8 → ByteArray
68-
| ⟨bs⟩, i, b => ⟨bs.set i b
68+
| ⟨bs⟩, i, b => ⟨bs.set i.1 b i.2
6969

7070
@[extern "lean_byte_array_uset"]
7171
def uset : (a : ByteArray) → (i : USize) → UInt8 → i.toNat < a.size → ByteArray

src/Init/Data/FloatArray/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def uset : (a : FloatArray) → (i : USize) → Float → i.toNat < a.size → F
7171

7272
@[extern "lean_float_array_fset"]
7373
def set : (ds : FloatArray) → (@& Fin ds.size) → Float → FloatArray
74-
| ⟨ds⟩, i, d => ⟨ds.set i d
74+
| ⟨ds⟩, i, d => ⟨ds.set i.1 d i.2
7575

7676
@[extern "lean_float_array_set"]
7777
def set! : FloatArray → (@& Nat) → Float → FloatArray

src/Init/Meta.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def unsetTrailing (stx : Syntax) : Syntax :=
443443
if h : i < a.size then
444444
let v := a[i]
445445
match f v with
446-
| some v => some <| a.set ⟨i, h⟩ v
446+
| some v => some <| a.set i v h
447447
| none => updateFirst a f (i+1)
448448
else
449449
none

src/Lean/Data/PersistentArray.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ partial def popLeaf : PersistentArrayNode α → Option (Array α) × Array (Per
159159
let cs' := cs'.pop
160160
if cs'.isEmpty then (some l, emptyArray) else (some l, cs')
161161
else
162-
(some l, cs'.set (Array.size_set cs idx _ ▸ idx) (node newLast))
162+
(some l, cs'.set idx (node newLast) (by simp only [cs', Array.size_set]; omega))
163163
else
164164
(none, emptyArray)
165165
| leaf vs => (some vs, emptyArray)

src/Lean/Elab/Inductive.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -740,10 +740,7 @@ private def getArity (indType : InductiveType) : MetaM Nat :=
740740
forallTelescopeReducing indType.type fun xs _ => return xs.size
741741

742742
private def resetMaskAt (mask : Array Bool) (i : Nat) : Array Bool :=
743-
if h : i < mask.size then
744-
mask.set ⟨i, h⟩ false
745-
else
746-
mask
743+
mask.setD i false
747744

748745
/--
749746
Compute a bit-mask that for `indType`. The size of the resulting array `result` is the arity of `indType`.

src/Lean/Environment.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ private def invalidExtMsg := "invalid environment extension has been accessed"
328328

329329
unsafe def setState {σ} (ext : Ext σ) (exts : Array EnvExtensionState) (s : σ) : Array EnvExtensionState :=
330330
if h : ext.idx < exts.size then
331-
exts.set ext.idx, h⟩ (unsafeCast s)
331+
exts.set ext.idx (unsafeCast s)
332332
else
333333
have : Inhabited (Array EnvExtensionState) := ⟨exts⟩
334334
panic! invalidExtMsg

src/Lean/Meta/Closure.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ partial def pickNextToProcessAux (lctx : LocalContext) (i : Nat) (toProcess : Ar
226226
if h : i < toProcess.size then
227227
let elem' := toProcess.get ⟨i, h⟩
228228
if (lctx.get! elem.fvarId).index < (lctx.get! elem'.fvarId).index then
229-
pickNextToProcessAux lctx (i+1) (toProcess.set ⟨i, h⟩ elem) elem'
229+
pickNextToProcessAux lctx (i+1) (toProcess.set i elem) elem'
230230
else
231231
pickNextToProcessAux lctx (i+1) toProcess elem
232232
else

src/Lean/Meta/DiscrTree.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ where
460460
loop (i : Nat) : Array α :=
461461
if h : i < vs.size then
462462
if v == vs[i] then
463-
vs.set ⟨i,h⟩ v
463+
vs.set i v
464464
else
465465
loop (i+1)
466466
else

src/Lean/Meta/ExprDefEq.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ private partial def processAssignment (mvarApp : Expr) (v : Expr) : MetaM Bool :
12051205
if h : i < args.size then
12061206
let arg := args.get ⟨i, h⟩
12071207
let arg ← simpAssignmentArg arg
1208-
let args := args.set ⟨i, h⟩ arg
1208+
let args := args.set i arg
12091209
match arg with
12101210
| Expr.fvar fvarId =>
12111211
if args[0:i].any fun prevArg => prevArg == arg then

src/Lean/Meta/GeneralizeTelescope.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ partial def updateTypes (e eNew : Expr) (entries : Array Entry) (i : Nat) : Meta
2323
let typeAbst ← kabstract type e
2424
if typeAbst.hasLooseBVars then do
2525
let typeNew := typeAbst.instantiate1 eNew
26-
let entries := entries.set ⟨i, h⟩ { entry with type := typeNew, modified := true }
26+
let entries := entries.set i { entry with type := typeNew, modified := true }
2727
updateTypes e eNew entries (i+1)
2828
else
2929
updateTypes e eNew entries (i+1)

src/Lean/Meta/Match/MatcherApp/Transform.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private partial def updateAlts (unrefinedArgType : Expr) (typeNew : Expr) (altNu
2929
else
3030
pure <| !(← isDefEq unrefinedArgType (← inferType x[0]!))
3131
return (← mkLambdaFVars xs alt, refined)
32-
updateAlts unrefinedArgType (b.instantiate1 alt) (altNumParams.set! i (numParams+1)) (alts.set ⟨i, h⟩ alt) refined (i+1)
32+
updateAlts unrefinedArgType (b.instantiate1 alt) (altNumParams.set! i (numParams+1)) (alts.set i alt) refined (i+1)
3333
| _ => throwError "unexpected type at MatcherApp.addArg"
3434
else
3535
if refined then

src/Lean/Meta/SynthInstance.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ private partial def preprocessArgs (type : Expr) (i : Nat) (args : Array Expr) (
671671
If an instance implicit argument depends on an `outParam`, it is treated as an `outParam` too.
672672
-/
673673
let arg ← if outParamsPos.contains i then mkFreshExprMVar d else pure arg
674-
let args := args.set ⟨i, h⟩ arg
674+
let args := args.set i arg
675675
preprocessArgs (b.instantiate1 arg) (i+1) args outParamsPos
676676
| _ =>
677677
throwError "type class resolution failed, insufficient number of arguments" -- TODO improve error message

src/Std/Data/DHashMap/Internal/WF.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ theorem toListModel_foldl_reinsertAux [BEq α] [Hashable α] [PartialEquivBEq α
115115
theorem expand.go_pos [Hashable α] {i : Nat} {source : Array (AssocList α β)}
116116
{target : { d : Array (AssocList α β) // 0 < d.size }} (h : i < source.size) :
117117
expand.go i source target = go (i + 1)
118-
(source.set ⟨i, h⟩ .nil) ((source.get ⟨i, h⟩).foldl (reinsertAux hash) target) := by
118+
(source.set i .nil) ((source.get ⟨i, h⟩).foldl (reinsertAux hash) target) := by
119119
rw [expand.go]
120120
simp only [h, dite_true]
121121

0 commit comments

Comments
 (0)