This PR changes the signature of `Array.swap`, so it takes `Nat` arguments with tactic provided bounds checking. It also renames `Array.swap!` to `Array.swapIfInBounds`.
17 lines
640 B
Text
17 lines
640 B
Text
attribute [simp] Array.insertionSort.swapLoop
|
||
|
||
/--
|
||
info: Array.insertionSort.swapLoop.eq_1.{u_1} {α : Type u_1} (lt : α → α → Bool) (a : Array α) (h : 0 < a.size) :
|
||
Array.insertionSort.swapLoop lt a 0 h = a
|
||
-/
|
||
#guard_msgs in
|
||
#check Array.insertionSort.swapLoop.eq_1
|
||
|
||
/--
|
||
info: Array.insertionSort.swapLoop.eq_2.{u_1} {α : Type u_1} (lt : α → α → Bool) (a : Array α) (j' : Nat)
|
||
(h : j'.succ < a.size) :
|
||
Array.insertionSort.swapLoop lt a j'.succ h =
|
||
if lt a[j'.succ] a[j'] = true then Array.insertionSort.swapLoop lt (a.swap j'.succ j' h ⋯) j' ⋯ else a
|
||
-/
|
||
#guard_msgs in
|
||
#check Array.insertionSort.swapLoop.eq_2
|