url
stringclasses
147 values
commit
stringclasses
147 values
file_path
stringlengths
7
101
full_name
stringlengths
1
94
start
stringlengths
6
10
end
stringlengths
6
11
tactic
stringlengths
1
11.2k
state_before
stringlengths
3
2.09M
state_after
stringlengths
6
2.09M
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Permutation.lean
permuted.get_lt
[167, 1]
[177, 70]
apply Fin.ne_of_val_ne
case step.kj n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n lt : ↑k < first arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ k ≠ j
case step.kj.h n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n lt : ↑k < first arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ ¬↑k = ↑j
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Permutation.lean
permuted.get_lt
[167, 1]
[177, 70]
exact Nat.ne_of_lt (Nat.lt_of_lt_of_le lt (Nat.le_trans fi ij))
case step.kj.h n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n lt : ↑k < first arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ ¬↑k = ↑j
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Permutation.lean
permuted.get_gt
[179, 1]
[189, 52]
induction p with | refl => rfl | step i j fi ij jl p ih => rw [ih] rw [Vec.get_swap_neq _ i j k] . apply Fin.ne_of_val_ne exact Nat.ne_of_gt (Nat.lt_of_le_of_lt (Nat.le_trans ij jl) gt) . apply Fin.ne_of_val_ne exact Nat.ne_of_gt (Nat.lt_of_le_of_lt jl gt)
n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n p : permuted n first last arr1 arr2 k : Fin n gt : last < ↑k ⊢ arr2[k] = arr1[k]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Permutation.lean
permuted.get_gt
[179, 1]
[189, 52]
rfl
case refl n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ : Vec α✝ n ⊢ arr✝[k] = arr✝[k]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Permutation.lean
permuted.get_gt
[179, 1]
[189, 52]
rw [ih]
case step n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ arr'✝[k] = arr✝[k]
case step n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ (arr✝.swap i j)[k] = arr✝[k]
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Permutation.lean
permuted.get_gt
[179, 1]
[189, 52]
rw [Vec.get_swap_neq _ i j k]
case step n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ (arr✝.swap i j)[k] = arr✝[k]
case step.ki n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ k ≠ i case step.kj n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ k ≠ j
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Permutation.lean
permuted.get_gt
[179, 1]
[189, 52]
. apply Fin.ne_of_val_ne exact Nat.ne_of_gt (Nat.lt_of_le_of_lt (Nat.le_trans ij jl) gt)
case step.ki n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ k ≠ i case step.kj n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ k ≠ j
case step.kj n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ k ≠ j
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Permutation.lean
permuted.get_gt
[179, 1]
[189, 52]
. apply Fin.ne_of_val_ne exact Nat.ne_of_gt (Nat.lt_of_le_of_lt jl gt)
case step.kj n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ k ≠ j
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Permutation.lean
permuted.get_gt
[179, 1]
[189, 52]
apply Fin.ne_of_val_ne
case step.ki n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ k ≠ i
case step.ki.h n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ ¬↑k = ↑i
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Permutation.lean
permuted.get_gt
[179, 1]
[189, 52]
exact Nat.ne_of_gt (Nat.lt_of_le_of_lt (Nat.le_trans ij jl) gt)
case step.ki.h n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ ¬↑k = ↑i
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Permutation.lean
permuted.get_gt
[179, 1]
[189, 52]
apply Fin.ne_of_val_ne
case step.kj n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ k ≠ j
case step.kj.h n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ ¬↑k = ↑j
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Permutation.lean
permuted.get_gt
[179, 1]
[189, 52]
exact Nat.ne_of_gt (Nat.lt_of_le_of_lt jl gt)
case step.kj.h n first last : Nat α✝ : Type arr1 arr2 : Vec α✝ n k : Fin n gt : last < ↑k arr✝ arr'✝ : Vec α✝ n i j : Fin n fi : first ≤ ↑i ij : i ≤ j jl : ↑j ≤ last p : permuted n first last (arr✝.swap i j) arr'✝ ih : arr'✝[k] = (arr✝.swap i j)[k] ⊢ ¬↑k = ↑j
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/AdjacentSorted.lean
sorted_of_adjacentSorted
[4, 1]
[14, 18]
induction jk with | refl => exact Order.refl | step h ih => apply Order.trans . exact ih (Nat.lt_of_le_of_lt (Nat.le_succ ..) kn) . apply assms
α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k : Nat kn : k < n jk : j ≤ k ⊢ arr[j] ≤ arr[k]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/AdjacentSorted.lean
sorted_of_adjacentSorted
[4, 1]
[14, 18]
exact Order.refl
case refl α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k : Nat kn : j < n ⊢ arr[j] ≤ arr[j]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/AdjacentSorted.lean
sorted_of_adjacentSorted
[4, 1]
[14, 18]
apply Order.trans
case step α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k m✝ : Nat h : j.le m✝ ih : ∀ (kn : m✝ < n), arr[j] ≤ arr[m✝] kn : m✝.succ < n ⊢ arr[j] ≤ arr[m✝.succ]
case step.a α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k m✝ : Nat h : j.le m✝ ih : ∀ (kn : m✝ < n), arr[j] ≤ arr[m✝] kn : m✝.succ < n ⊢ arr[j] ≤ ?step.y case step.a α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k m✝ : Nat h : j.le m✝ ih : ∀ (kn : m✝ < n), arr[j] ≤ arr[m✝] kn : m✝.succ < n ⊢ ?step.y ≤ arr[m✝.succ] case step.y α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k m✝ : Nat h : j.le m✝ ih : ∀ (kn : m✝ < n), arr[j] ≤ arr[m✝] kn : m✝.succ < n ⊢ α
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/AdjacentSorted.lean
sorted_of_adjacentSorted
[4, 1]
[14, 18]
. exact ih (Nat.lt_of_le_of_lt (Nat.le_succ ..) kn)
case step.a α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k m✝ : Nat h : j.le m✝ ih : ∀ (kn : m✝ < n), arr[j] ≤ arr[m✝] kn : m✝.succ < n ⊢ arr[j] ≤ ?step.y case step.a α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k m✝ : Nat h : j.le m✝ ih : ∀ (kn : m✝ < n), arr[j] ≤ arr[m✝] kn : m✝.succ < n ⊢ ?step.y ≤ arr[m✝.succ] case step.y α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k m✝ : Nat h : j.le m✝ ih : ∀ (kn : m✝ < n), arr[j] ≤ arr[m✝] kn : m✝.succ < n ⊢ α
case step.a α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k m✝ : Nat h : j.le m✝ ih : ∀ (kn : m✝ < n), arr[j] ≤ arr[m✝] kn : m✝.succ < n ⊢ arr[m✝] ≤ arr[m✝.succ]
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/AdjacentSorted.lean
sorted_of_adjacentSorted
[4, 1]
[14, 18]
. apply assms
case step.a α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k m✝ : Nat h : j.le m✝ ih : ∀ (kn : m✝ < n), arr[j] ≤ arr[m✝] kn : m✝.succ < n ⊢ arr[m✝] ≤ arr[m✝.succ]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/AdjacentSorted.lean
sorted_of_adjacentSorted
[4, 1]
[14, 18]
exact ih (Nat.lt_of_le_of_lt (Nat.le_succ ..) kn)
case step.a α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k m✝ : Nat h : j.le m✝ ih : ∀ (kn : m✝ < n), arr[j] ≤ arr[m✝] kn : m✝.succ < n ⊢ arr[j] ≤ ?step.y
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/AdjacentSorted.lean
sorted_of_adjacentSorted
[4, 1]
[14, 18]
apply assms
case step.a α : Type inst✝ : Order α n : Nat arr : Vec α n assms : ∀ (i : Nat) (isLt : i + 1 < n), arr[i] ≤ arr[i + 1] j k m✝ : Nat h : j.le m✝ ih : ∀ (kn : m✝ < n), arr[j] ≤ arr[m✝] kn : m✝.succ < n ⊢ arr[m✝] ≤ arr[m✝.succ]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_set_eq
[28, 1]
[31, 26]
show (a.set i v).get i = v
α : Type n : Nat a : Vec α n i : Fin n v : α ⊢ (a.set i v)[i] = v
α : Type n : Nat a : Vec α n i : Fin n v : α ⊢ (a.set i v).get i = v
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_set_eq
[28, 1]
[31, 26]
simp [Vec.get, Vec.set]
α : Type n : Nat a : Vec α n i : Fin n v : α ⊢ (a.set i v).get i = v
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_set_ne
[33, 1]
[38, 56]
show (a.set i v).get j = a.get j
α : Type n : Nat a : Vec α n i j : Fin n v : α h : i ≠ j ⊢ (a.set i v)[j] = a[j]
α : Type n : Nat a : Vec α n i j : Fin n v : α h : i ≠ j ⊢ (a.set i v).get j = a.get j
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_set_ne
[33, 1]
[38, 56]
simp [Vec.get, Vec.set]
α : Type n : Nat a : Vec α n i j : Fin n v : α h : i ≠ j ⊢ (a.set i v).get j = a.get j
α : Type n : Nat a : Vec α n i j : Fin n v : α h : i ≠ j ⊢ (a.val.set ⟨↑i, ⋯⟩ v)[↑j] = a.val[↑j]
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_set_ne
[33, 1]
[38, 56]
exact Array.get_set_ne (j := j.val) a.val ⟨i, by simp [a.property, i.isLt]⟩ v (by simp [a.property, j.isLt]) (Fin.val_ne_of_ne h)
α : Type n : Nat a : Vec α n i j : Fin n v : α h : i ≠ j ⊢ (a.val.set ⟨↑i, ⋯⟩ v)[↑j] = a.val[↑j]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_set_ne
[33, 1]
[38, 56]
simp [a.property, i.isLt]
α : Type n : Nat a : Vec α n i j : Fin n v : α h : i ≠ j ⊢ ↑i < a.val.size
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_set_ne
[33, 1]
[38, 56]
simp [a.property, j.isLt]
α : Type n : Nat a : Vec α n i j : Fin n v : α h : i ≠ j ⊢ ↑j < a.val.size
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_set
[40, 1]
[47, 35]
if h : i = j then simp [h] exact Vec.get_set_eq a j v else simp [h] exact Vec.get_set_ne a i j v h
α : Type n : Nat a : Vec α n i j : Fin n v : α ⊢ (a.set i v)[j] = if i = j then v else a[j]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_set
[40, 1]
[47, 35]
simp [h]
α : Type n : Nat a : Vec α n i j : Fin n v : α h : i = j ⊢ (a.set i v)[j] = if i = j then v else a[j]
α : Type n : Nat a : Vec α n i j : Fin n v : α h : i = j ⊢ (a.set j v)[j] = v
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_set
[40, 1]
[47, 35]
exact Vec.get_set_eq a j v
α : Type n : Nat a : Vec α n i j : Fin n v : α h : i = j ⊢ (a.set j v)[j] = v
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_set
[40, 1]
[47, 35]
simp [h]
α : Type n : Nat a : Vec α n i j : Fin n v : α h : ¬i = j ⊢ (a.set i v)[j] = if i = j then v else a[j]
α : Type n : Nat a : Vec α n i j : Fin n v : α h : ¬i = j ⊢ (a.set i v)[j] = a[j]
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_set
[40, 1]
[47, 35]
exact Vec.get_set_ne a i j v h
α : Type n : Nat a : Vec α n i j : Fin n v : α h : ¬i = j ⊢ (a.set i v)[j] = a[j]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.swap_def
[49, 1]
[54, 6]
simp [Vec.swap]
α : Type n : Nat a : Vec α n i j : Fin n ⊢ a.swap i j = (a.set i (a.get j)).set j (a.get i)
α : Type n : Nat a : Vec α n i j : Fin n ⊢ ⟨a.val.swap (Fin.cast ⋯ i) (Fin.cast ⋯ j), ⋯⟩ = (a.set i (a.get j)).set j (a.get i)
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.swap_def
[49, 1]
[54, 6]
apply Subtype.eq
α : Type n : Nat a : Vec α n i j : Fin n ⊢ ⟨a.val.swap (Fin.cast ⋯ i) (Fin.cast ⋯ j), ⋯⟩ = (a.set i (a.get j)).set j (a.get i)
case a α : Type n : Nat a : Vec α n i j : Fin n ⊢ ⟨a.val.swap (Fin.cast ⋯ i) (Fin.cast ⋯ j), ⋯⟩.val = ((a.set i (a.get j)).set j (a.get i)).val
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.swap_def
[49, 1]
[54, 6]
simp [Vec.get, Vec.set, Array.swap_def]
case a α : Type n : Nat a : Vec α n i j : Fin n ⊢ ⟨a.val.swap (Fin.cast ⋯ i) (Fin.cast ⋯ j), ⋯⟩.val = ((a.set i (a.get j)).set j (a.get i)).val
case a α : Type n : Nat a : Vec α n i j : Fin n ⊢ (a.val.set (Fin.cast ⋯ i) a.val[↑j]).set ⟨↑j, ⋯⟩ a.val[↑i] = (a.val.set ⟨↑i, ⋯⟩ a.val[↑j]).set ⟨↑j, ⋯⟩ a.val[↑i]
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.swap_def
[49, 1]
[54, 6]
rfl
case a α : Type n : Nat a : Vec α n i j : Fin n ⊢ (a.val.set (Fin.cast ⋯ i) a.val[↑j]).set ⟨↑j, ⋯⟩ a.val[↑i] = (a.val.set ⟨↑i, ⋯⟩ a.val[↑j]).set ⟨↑j, ⋯⟩ a.val[↑i]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_swap_left
[56, 1]
[59, 39]
simp [Vec.swap_def, Vec.get_set, Vec.get_set_eq]
α : Type n : Nat a : Vec α n i j : Fin n ⊢ (a.swap i j)[i] = a[j]
α : Type n : Nat a : Vec α n i j : Fin n ⊢ (if j = i then a.get i else a.get j) = a[j]
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_swap_left
[56, 1]
[59, 39]
cases decEq j i <;> simp [*] <;> rfl
α : Type n : Nat a : Vec α n i j : Fin n ⊢ (if j = i then a.get i else a.get j) = a[j]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_swap_right
[61, 1]
[64, 6]
simp [Vec.swap_def, Vec.get_set_eq]
α : Type n : Nat a : Vec α n i j : Fin n ⊢ (a.swap i j)[j] = a[i]
α : Type n : Nat a : Vec α n i j : Fin n ⊢ a.get i = a[i]
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_swap_right
[61, 1]
[64, 6]
rfl
α : Type n : Nat a : Vec α n i j : Fin n ⊢ a.get i = a[i]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_swap_neq
[66, 1]
[70, 68]
simp [Vec.swap_def]
α : Type n : Nat a : Vec α n i j k : Fin n ki : k ≠ i kj : k ≠ j ⊢ (a.swap i j)[k] = a[k]
α : Type n : Nat a : Vec α n i j k : Fin n ki : k ≠ i kj : k ≠ j ⊢ ((a.set i (a.get j)).set j (a.get i))[k] = a[k]
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.get_swap_neq
[66, 1]
[70, 68]
rw [Vec.get_set_ne (h := kj.symm), Vec.get_set_ne (h := ki.symm)]
α : Type n : Nat a : Vec α n i j k : Fin n ki : k ≠ i kj : k ≠ j ⊢ ((a.set i (a.get j)).set j (a.get i))[k] = a[k]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Vec.lean
Vec.getElem_eq_getElem
[72, 1]
[73, 59]
rfl
α : Type n : Nat a : Vec α n i : Fin n ⊢ a[i] = a.val[↑i]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
partitionImpl_permuted
[20, 1]
[36, 18]
induction arr, first, i, j, fi, ij using partitionImpl.induct with | case1 arr first i j fi ij lt jl h prev ih => unfold partitionImpl simp [*] | @case2 arr first i j fi ij lt jl h swapped mid hm arr' eq ih => unfold partitionImpl simp [*] at * have ⟨p₂⟩ := ih have p₁ : permuted n first j arr swapped := .step i j fi ij (Nat.le_refl _) .refl exact ⟨p₁.trans $ p₂.cast_last (Nat.sub_le ..)⟩ | case3 arr first i j fi ij jn => simp [partitionImpl, *] exact ⟨.refl⟩
α : Type inst✝ : Ord α n : Nat arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j ⊢ Nonempty (permuted n (↑first) (↑j) arr (partitionImpl arr first i j fi ij).snd)
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
partitionImpl_permuted
[20, 1]
[36, 18]
unfold partitionImpl
case case1 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j lt : first < i jl : ↑first ≤ ↑i - 1 h : arr[i] < arr[first] prev : ↑i - 1 ≤ ↑j ih : Nonempty (permuted n (↑first) (↑j) arr (partitionImpl arr first i.prev j jl prev).snd) ⊢ Nonempty (permuted n (↑first) (↑j) arr (partitionImpl arr first i j fi ij).snd)
case case1 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j lt : first < i jl : ↑first ≤ ↑i - 1 h : arr[i] < arr[first] prev : ↑i - 1 ≤ ↑j ih : Nonempty (permuted n (↑first) (↑j) arr (partitionImpl arr first i.prev j jl prev).snd) ⊢ Nonempty (permuted n (↑first) (↑j) arr (if h : first < i then let_fun this := ⋯; if arr[i] < arr[first] then let_fun this_1 := ⋯; partitionImpl arr first i.prev j this this_1 else let arr := (dbgTraceIfShared "swap1" arr).swap i j; match partitionImpl arr first i.prev j.prev this ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr) else (⟨j, ⋯⟩, arr)).snd)
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
partitionImpl_permuted
[20, 1]
[36, 18]
simp [*]
case case1 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j lt : first < i jl : ↑first ≤ ↑i - 1 h : arr[i] < arr[first] prev : ↑i - 1 ≤ ↑j ih : Nonempty (permuted n (↑first) (↑j) arr (partitionImpl arr first i.prev j jl prev).snd) ⊢ Nonempty (permuted n (↑first) (↑j) arr (if h : first < i then let_fun this := ⋯; if arr[i] < arr[first] then let_fun this_1 := ⋯; partitionImpl arr first i.prev j this this_1 else let arr := (dbgTraceIfShared "swap1" arr).swap i j; match partitionImpl arr first i.prev j.prev this ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr) else (⟨j, ⋯⟩, arr)).snd)
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
partitionImpl_permuted
[20, 1]
[36, 18]
unfold partitionImpl
case case2 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j lt : first < i jl : ↑first ≤ ↑i - 1 h : ¬arr[i] < arr[first] swapped : Vec α n := (dbgTraceIfShared "swap1" arr).swap i j mid : Fin n hm : first ≤ mid ∧ mid ≤ j.prev arr' : Vec α n eq : partitionImpl swapped first i.prev j.prev jl ⋯ = (⟨mid, hm⟩, arr') ih : Nonempty (permuted n (↑first) (↑j.prev) swapped (partitionImpl swapped first i.prev j.prev jl ⋯).snd) ⊢ Nonempty (permuted n (↑first) (↑j) arr (partitionImpl arr first i j fi ij).snd)
case case2 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j lt : first < i jl : ↑first ≤ ↑i - 1 h : ¬arr[i] < arr[first] swapped : Vec α n := (dbgTraceIfShared "swap1" arr).swap i j mid : Fin n hm : first ≤ mid ∧ mid ≤ j.prev arr' : Vec α n eq : partitionImpl swapped first i.prev j.prev jl ⋯ = (⟨mid, hm⟩, arr') ih : Nonempty (permuted n (↑first) (↑j.prev) swapped (partitionImpl swapped first i.prev j.prev jl ⋯).snd) ⊢ Nonempty (permuted n (↑first) (↑j) arr (if h : first < i then let_fun this := ⋯; if arr[i] < arr[first] then let_fun this_1 := ⋯; partitionImpl arr first i.prev j this this_1 else let arr := (dbgTraceIfShared "swap1" arr).swap i j; match partitionImpl arr first i.prev j.prev this ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr) else (⟨j, ⋯⟩, arr)).snd)
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
partitionImpl_permuted
[20, 1]
[36, 18]
simp [*] at *
case case2 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j lt : first < i jl : ↑first ≤ ↑i - 1 h : ¬arr[i] < arr[first] swapped : Vec α n := (dbgTraceIfShared "swap1" arr).swap i j mid : Fin n hm : first ≤ mid ∧ mid ≤ j.prev arr' : Vec α n eq : partitionImpl swapped first i.prev j.prev jl ⋯ = (⟨mid, hm⟩, arr') ih : Nonempty (permuted n (↑first) (↑j.prev) swapped (partitionImpl swapped first i.prev j.prev jl ⋯).snd) ⊢ Nonempty (permuted n (↑first) (↑j) arr (if h : first < i then let_fun this := ⋯; if arr[i] < arr[first] then let_fun this_1 := ⋯; partitionImpl arr first i.prev j this this_1 else let arr := (dbgTraceIfShared "swap1" arr).swap i j; match partitionImpl arr first i.prev j.prev this ⋯ with | (⟨mid, hm⟩, arr) => (⟨mid, ⋯⟩, arr) else (⟨j, ⋯⟩, arr)).snd)
case case2 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j lt : first < i jl : ↑first ≤ ↑i - 1 h : ¬arr[i] < arr[first] swapped : Vec α n := (dbgTraceIfShared "swap1" arr).swap i j mid : Fin n hm : first ≤ mid ∧ mid ≤ j.prev arr' : Vec α n eq : partitionImpl swapped first i.prev j.prev jl ⋯ = (⟨mid, hm⟩, arr') ih : Nonempty (permuted n (↑first) (↑j - 1) swapped arr') ⊢ Nonempty (permuted n (↑first) (↑j) arr arr')
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
partitionImpl_permuted
[20, 1]
[36, 18]
have ⟨p₂⟩ := ih
case case2 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j lt : first < i jl : ↑first ≤ ↑i - 1 h : ¬arr[i] < arr[first] swapped : Vec α n := (dbgTraceIfShared "swap1" arr).swap i j mid : Fin n hm : first ≤ mid ∧ mid ≤ j.prev arr' : Vec α n eq : partitionImpl swapped first i.prev j.prev jl ⋯ = (⟨mid, hm⟩, arr') ih : Nonempty (permuted n (↑first) (↑j - 1) swapped arr') ⊢ Nonempty (permuted n (↑first) (↑j) arr arr')
case case2 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j lt : first < i jl : ↑first ≤ ↑i - 1 h : ¬arr[i] < arr[first] swapped : Vec α n := (dbgTraceIfShared "swap1" arr).swap i j mid : Fin n hm : first ≤ mid ∧ mid ≤ j.prev arr' : Vec α n eq : partitionImpl swapped first i.prev j.prev jl ⋯ = (⟨mid, hm⟩, arr') ih : Nonempty (permuted n (↑first) (↑j - 1) swapped arr') p₂ : permuted n (↑first) (↑j - 1) swapped arr' ⊢ Nonempty (permuted n (↑first) (↑j) arr arr')
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
partitionImpl_permuted
[20, 1]
[36, 18]
have p₁ : permuted n first j arr swapped := .step i j fi ij (Nat.le_refl _) .refl
case case2 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j lt : first < i jl : ↑first ≤ ↑i - 1 h : ¬arr[i] < arr[first] swapped : Vec α n := (dbgTraceIfShared "swap1" arr).swap i j mid : Fin n hm : first ≤ mid ∧ mid ≤ j.prev arr' : Vec α n eq : partitionImpl swapped first i.prev j.prev jl ⋯ = (⟨mid, hm⟩, arr') ih : Nonempty (permuted n (↑first) (↑j - 1) swapped arr') p₂ : permuted n (↑first) (↑j - 1) swapped arr' ⊢ Nonempty (permuted n (↑first) (↑j) arr arr')
case case2 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j lt : first < i jl : ↑first ≤ ↑i - 1 h : ¬arr[i] < arr[first] swapped : Vec α n := (dbgTraceIfShared "swap1" arr).swap i j mid : Fin n hm : first ≤ mid ∧ mid ≤ j.prev arr' : Vec α n eq : partitionImpl swapped first i.prev j.prev jl ⋯ = (⟨mid, hm⟩, arr') ih : Nonempty (permuted n (↑first) (↑j - 1) swapped arr') p₂ : permuted n (↑first) (↑j - 1) swapped arr' p₁ : permuted n (↑first) (↑j) arr swapped ⊢ Nonempty (permuted n (↑first) (↑j) arr arr')
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
partitionImpl_permuted
[20, 1]
[36, 18]
exact ⟨p₁.trans $ p₂.cast_last (Nat.sub_le ..)⟩
case case2 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j lt : first < i jl : ↑first ≤ ↑i - 1 h : ¬arr[i] < arr[first] swapped : Vec α n := (dbgTraceIfShared "swap1" arr).swap i j mid : Fin n hm : first ≤ mid ∧ mid ≤ j.prev arr' : Vec α n eq : partitionImpl swapped first i.prev j.prev jl ⋯ = (⟨mid, hm⟩, arr') ih : Nonempty (permuted n (↑first) (↑j - 1) swapped arr') p₂ : permuted n (↑first) (↑j - 1) swapped arr' p₁ : permuted n (↑first) (↑j) arr swapped ⊢ Nonempty (permuted n (↑first) (↑j) arr arr')
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
partitionImpl_permuted
[20, 1]
[36, 18]
simp [partitionImpl, *]
case case3 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j jn : ¬first < i ⊢ Nonempty (permuted n (↑first) (↑j) arr (partitionImpl arr first i j fi ij).snd)
case case3 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j jn : ¬first < i ⊢ Nonempty (permuted n (↑first) (↑j) arr arr)
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
partitionImpl_permuted
[20, 1]
[36, 18]
exact ⟨.refl⟩
case case3 α : Type inst✝ : Ord α n : Nat first✝ i✝ j✝ : Fin n arr : Vec α n first i j : Fin n fi : first ≤ i ij : i ≤ j jn : ¬first < i ⊢ Nonempty (permuted n (↑first) (↑j) arr arr)
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
quickSort'_map_index_invertible
[74, 1]
[81, 31]
let p := quickSort'_permuted arr
α : Type inst✝ : Ord α n : Nat arr : Vec α n ⊢ ∃ f, invertible f ∧ ∀ (i : Fin n), arr[i] = (quickSort' arr)[f i]
α : Type inst✝ : Ord α n : Nat arr : Vec α n p : permuted n 0 (n - 1) arr (quickSort' arr) := quickSort'_permuted arr ⊢ ∃ f, invertible f ∧ ∀ (i : Fin n), arr[i] = (quickSort' arr)[f i]
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
quickSort'_map_index_invertible
[74, 1]
[81, 31]
exists p.to_map
α : Type inst✝ : Ord α n : Nat arr : Vec α n p : permuted n 0 (n - 1) arr (quickSort' arr) := quickSort'_permuted arr ⊢ ∃ f, invertible f ∧ ∀ (i : Fin n), arr[i] = (quickSort' arr)[f i]
α : Type inst✝ : Ord α n : Nat arr : Vec α n p : permuted n 0 (n - 1) arr (quickSort' arr) := quickSort'_permuted arr ⊢ invertible p.to_map ∧ ∀ (i : Fin n), arr[i] = (quickSort' arr)[p.to_map i]
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
quickSort'_map_index_invertible
[74, 1]
[81, 31]
apply And.intro
α : Type inst✝ : Ord α n : Nat arr : Vec α n p : permuted n 0 (n - 1) arr (quickSort' arr) := quickSort'_permuted arr ⊢ invertible p.to_map ∧ ∀ (i : Fin n), arr[i] = (quickSort' arr)[p.to_map i]
case left α : Type inst✝ : Ord α n : Nat arr : Vec α n p : permuted n 0 (n - 1) arr (quickSort' arr) := quickSort'_permuted arr ⊢ invertible p.to_map case right α : Type inst✝ : Ord α n : Nat arr : Vec α n p : permuted n 0 (n - 1) arr (quickSort' arr) := quickSort'_permuted arr ⊢ ∀ (i : Fin n), arr[i] = (quickSort' arr)[p.to_map i]
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
quickSort'_map_index_invertible
[74, 1]
[81, 31]
. exact permuted_map_invertible p
case left α : Type inst✝ : Ord α n : Nat arr : Vec α n p : permuted n 0 (n - 1) arr (quickSort' arr) := quickSort'_permuted arr ⊢ invertible p.to_map case right α : Type inst✝ : Ord α n : Nat arr : Vec α n p : permuted n 0 (n - 1) arr (quickSort' arr) := quickSort'_permuted arr ⊢ ∀ (i : Fin n), arr[i] = (quickSort' arr)[p.to_map i]
case right α : Type inst✝ : Ord α n : Nat arr : Vec α n p : permuted n 0 (n - 1) arr (quickSort' arr) := quickSort'_permuted arr ⊢ ∀ (i : Fin n), arr[i] = (quickSort' arr)[p.to_map i]
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
quickSort'_map_index_invertible
[74, 1]
[81, 31]
. exact permuted_map_index p
case right α : Type inst✝ : Ord α n : Nat arr : Vec α n p : permuted n 0 (n - 1) arr (quickSort' arr) := quickSort'_permuted arr ⊢ ∀ (i : Fin n), arr[i] = (quickSort' arr)[p.to_map i]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
quickSort'_map_index_invertible
[74, 1]
[81, 31]
exact permuted_map_invertible p
case left α : Type inst✝ : Ord α n : Nat arr : Vec α n p : permuted n 0 (n - 1) arr (quickSort' arr) := quickSort'_permuted arr ⊢ invertible p.to_map
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/QuickSortPermutation.lean
quickSort'_map_index_invertible
[74, 1]
[81, 31]
exact permuted_map_index p
case right α : Type inst✝ : Ord α n : Nat arr : Vec α n p : permuted n 0 (n - 1) arr (quickSort' arr) := quickSort'_permuted arr ⊢ ∀ (i : Fin n), arr[i] = (quickSort' arr)[p.to_map i]
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.total
[12, 1]
[19, 11]
show (compare x y).isLE ∨ (compare y x).isLE
α : Type inst✝ : Order α x y : α ⊢ x ≤ y ∨ y ≤ x
α : Type inst✝ : Order α x y : α ⊢ (compare x y).isLE = true ∨ (compare y x).isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.total
[12, 1]
[19, 11]
match cmp : compare x y with | .lt | .eq => simp [Ordering.isLE, cmp] | .gt => apply Or.inr rw [←symm, cmp] decide
α : Type inst✝ : Order α x y : α ⊢ (compare x y).isLE = true ∨ (compare y x).isLE = true
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.total
[12, 1]
[19, 11]
simp [Ordering.isLE, cmp]
α : Type inst✝ : Order α x y : α cmp : compare x y = Ordering.eq ⊢ Ordering.eq.isLE = true ∨ (compare y x).isLE = true
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.total
[12, 1]
[19, 11]
apply Or.inr
α : Type inst✝ : Order α x y : α cmp : compare x y = Ordering.gt ⊢ Ordering.gt.isLE = true ∨ (compare y x).isLE = true
case h α : Type inst✝ : Order α x y : α cmp : compare x y = Ordering.gt ⊢ (compare y x).isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.total
[12, 1]
[19, 11]
rw [←symm, cmp]
case h α : Type inst✝ : Order α x y : α cmp : compare x y = Ordering.gt ⊢ (compare y x).isLE = true
case h α : Type inst✝ : Order α x y : α cmp : compare x y = Ordering.gt ⊢ Ordering.gt.swap.isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.total
[12, 1]
[19, 11]
decide
case h α : Type inst✝ : Order α x y : α cmp : compare x y = Ordering.gt ⊢ Ordering.gt.swap.isLE = true
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
match cmp : compare x x with | .eq => rfl | .lt => have h₁ : (compare x x).swap = .gt := by rw [cmp]; decide have h₂ : (compare x x).swap = .lt := by rw [symm]; assumption rw [h₂] at h₁ contradiction | .gt => have h₁ : (compare x x).swap = .lt := by rw [cmp]; decide have h₂ : (compare x x).swap = .gt := by rw [symm]; assumption rw [h₂] at h₁ contradiction
α : Type inst✝ : Order α x : α ⊢ compare x x = Ordering.eq
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
rfl
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.eq ⊢ Ordering.eq = Ordering.eq
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
have h₁ : (compare x x).swap = .gt := by rw [cmp]; decide
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt ⊢ Ordering.lt = Ordering.eq
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt h₁ : (compare x x).swap = Ordering.gt ⊢ Ordering.lt = Ordering.eq
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
have h₂ : (compare x x).swap = .lt := by rw [symm]; assumption
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt h₁ : (compare x x).swap = Ordering.gt ⊢ Ordering.lt = Ordering.eq
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt h₁ : (compare x x).swap = Ordering.gt h₂ : (compare x x).swap = Ordering.lt ⊢ Ordering.lt = Ordering.eq
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
rw [h₂] at h₁
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt h₁ : (compare x x).swap = Ordering.gt h₂ : (compare x x).swap = Ordering.lt ⊢ Ordering.lt = Ordering.eq
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt h₁ : Ordering.lt = Ordering.gt h₂ : (compare x x).swap = Ordering.lt ⊢ Ordering.lt = Ordering.eq
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
contradiction
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt h₁ : Ordering.lt = Ordering.gt h₂ : (compare x x).swap = Ordering.lt ⊢ Ordering.lt = Ordering.eq
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
rw [cmp]
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt ⊢ (compare x x).swap = Ordering.gt
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt ⊢ Ordering.lt.swap = Ordering.gt
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
decide
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt ⊢ Ordering.lt.swap = Ordering.gt
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
rw [symm]
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt h₁ : (compare x x).swap = Ordering.gt ⊢ (compare x x).swap = Ordering.lt
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt h₁ : (compare x x).swap = Ordering.gt ⊢ compare x x = Ordering.lt
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
assumption
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.lt h₁ : (compare x x).swap = Ordering.gt ⊢ compare x x = Ordering.lt
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
have h₁ : (compare x x).swap = .lt := by rw [cmp]; decide
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt ⊢ Ordering.gt = Ordering.eq
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt h₁ : (compare x x).swap = Ordering.lt ⊢ Ordering.gt = Ordering.eq
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
have h₂ : (compare x x).swap = .gt := by rw [symm]; assumption
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt h₁ : (compare x x).swap = Ordering.lt ⊢ Ordering.gt = Ordering.eq
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt h₁ : (compare x x).swap = Ordering.lt h₂ : (compare x x).swap = Ordering.gt ⊢ Ordering.gt = Ordering.eq
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
rw [h₂] at h₁
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt h₁ : (compare x x).swap = Ordering.lt h₂ : (compare x x).swap = Ordering.gt ⊢ Ordering.gt = Ordering.eq
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt h₁ : Ordering.gt = Ordering.lt h₂ : (compare x x).swap = Ordering.gt ⊢ Ordering.gt = Ordering.eq
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
contradiction
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt h₁ : Ordering.gt = Ordering.lt h₂ : (compare x x).swap = Ordering.gt ⊢ Ordering.gt = Ordering.eq
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
rw [cmp]
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt ⊢ (compare x x).swap = Ordering.lt
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt ⊢ Ordering.gt.swap = Ordering.lt
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
decide
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt ⊢ Ordering.gt.swap = Ordering.lt
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
rw [symm]
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt h₁ : (compare x x).swap = Ordering.lt ⊢ (compare x x).swap = Ordering.gt
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt h₁ : (compare x x).swap = Ordering.lt ⊢ compare x x = Ordering.gt
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.cmp_eq_of_eq
[21, 1]
[33, 18]
assumption
α : Type inst✝ : Order α x : α cmp : compare x x = Ordering.gt h₁ : (compare x x).swap = Ordering.lt ⊢ compare x x = Ordering.gt
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.refl
[35, 1]
[38, 9]
show (compare x x).isLE
α : Type inst✝ : Order α x : α ⊢ x ≤ x
α : Type inst✝ : Order α x : α ⊢ (compare x x).isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.refl
[35, 1]
[38, 9]
simp [cmp_eq_of_eq]
α : Type inst✝ : Order α x : α ⊢ (compare x x).isLE = true
α : Type inst✝ : Order α x : α ⊢ Ordering.eq.isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.refl
[35, 1]
[38, 9]
decide
α : Type inst✝ : Order α x : α ⊢ Ordering.eq.isLE = true
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.irrefl
[40, 1]
[41, 31]
simp [ltOfOrd, cmp_eq_of_eq]
α : Type inst✝ : Order α x : α ⊢ ¬x < x
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.le_of_not_lt
[43, 1]
[51, 18]
show (compare x y).isLE
α : Type inst✝ : Order α x y : α h : ¬y < x ⊢ x ≤ y
α : Type inst✝ : Order α x y : α h : ¬y < x ⊢ (compare x y).isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.le_of_not_lt
[43, 1]
[51, 18]
match cmp : compare x y with | .lt | .eq => decide | .gt => simp [ltOfOrd] at h have : compare y x = .lt := by rw [←symm, cmp]; decide rw [this] at h contradiction
α : Type inst✝ : Order α x y : α h : ¬y < x ⊢ (compare x y).isLE = true
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.le_of_not_lt
[43, 1]
[51, 18]
decide
α : Type inst✝ : Order α x y : α h : ¬y < x cmp : compare x y = Ordering.eq ⊢ Ordering.eq.isLE = true
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.le_of_not_lt
[43, 1]
[51, 18]
simp [ltOfOrd] at h
α : Type inst✝ : Order α x y : α h : ¬y < x cmp : compare x y = Ordering.gt ⊢ Ordering.gt.isLE = true
α : Type inst✝ : Order α x y : α h : ¬compare y x = Ordering.lt cmp : compare x y = Ordering.gt ⊢ Ordering.gt.isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.le_of_not_lt
[43, 1]
[51, 18]
have : compare y x = .lt := by rw [←symm, cmp]; decide
α : Type inst✝ : Order α x y : α h : ¬compare y x = Ordering.lt cmp : compare x y = Ordering.gt ⊢ Ordering.gt.isLE = true
α : Type inst✝ : Order α x y : α h : ¬compare y x = Ordering.lt cmp : compare x y = Ordering.gt this : compare y x = Ordering.lt ⊢ Ordering.gt.isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.le_of_not_lt
[43, 1]
[51, 18]
rw [this] at h
α : Type inst✝ : Order α x y : α h : ¬compare y x = Ordering.lt cmp : compare x y = Ordering.gt this : compare y x = Ordering.lt ⊢ Ordering.gt.isLE = true
α : Type inst✝ : Order α x y : α h : ¬Ordering.lt = Ordering.lt cmp : compare x y = Ordering.gt this : compare y x = Ordering.lt ⊢ Ordering.gt.isLE = true
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.le_of_not_lt
[43, 1]
[51, 18]
contradiction
α : Type inst✝ : Order α x y : α h : ¬Ordering.lt = Ordering.lt cmp : compare x y = Ordering.gt this : compare y x = Ordering.lt ⊢ Ordering.gt.isLE = true
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.le_of_not_lt
[43, 1]
[51, 18]
rw [←symm, cmp]
α : Type inst✝ : Order α x y : α h : ¬compare y x = Ordering.lt cmp : compare x y = Ordering.gt ⊢ compare y x = Ordering.lt
α : Type inst✝ : Order α x y : α h : ¬compare y x = Ordering.lt cmp : compare x y = Ordering.gt ⊢ Ordering.gt.swap = Ordering.lt
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.le_of_not_lt
[43, 1]
[51, 18]
decide
α : Type inst✝ : Order α x y : α h : ¬compare y x = Ordering.lt cmp : compare x y = Ordering.gt ⊢ Ordering.gt.swap = Ordering.lt
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.not_lt_of_le
[53, 1]
[61, 18]
match cmp : compare x y with | .lt | .eq => simp [ltOfOrd] rw [←symm, cmp] decide | .gt => simp [leOfOrd, cmp] at h contradiction
α : Type inst✝ : Order α x y : α h : x ≤ y ⊢ ¬y < x
no goals
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.not_lt_of_le
[53, 1]
[61, 18]
simp [ltOfOrd]
α : Type inst✝ : Order α x y : α h : x ≤ y cmp : compare x y = Ordering.eq ⊢ ¬y < x
α : Type inst✝ : Order α x y : α h : x ≤ y cmp : compare x y = Ordering.eq ⊢ ¬compare y x = Ordering.lt
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.not_lt_of_le
[53, 1]
[61, 18]
rw [←symm, cmp]
α : Type inst✝ : Order α x y : α h : x ≤ y cmp : compare x y = Ordering.eq ⊢ ¬compare y x = Ordering.lt
α : Type inst✝ : Order α x y : α h : x ≤ y cmp : compare x y = Ordering.eq ⊢ ¬Ordering.eq.swap = Ordering.lt
https://github.com/pandaman64/QuickSortInLean.git
ab0aaee0aed280959328844f9a6cd13bf00c5935
QuickSortInLean/Order.lean
Order.not_lt_of_le
[53, 1]
[61, 18]
decide
α : Type inst✝ : Order α x y : α h : x ≤ y cmp : compare x y = Ordering.eq ⊢ ¬Ordering.eq.swap = Ordering.lt
no goals