@@ -8,7 +8,6 @@ import Cslib.Algorithms.Lean.TimeM
88import Mathlib.Data.Nat.Cast.Order.Ring
99import Mathlib.Data.Nat.Lattice
1010import Mathlib.Data.Nat.Log
11- import Mathlib.Deprecated.Sort
1211
1312
1413/-!
@@ -61,8 +60,8 @@ section Correctness
6160
6261open List
6362
64- /-- A list is sorted if it satisfies the `Sorted (· ≤ ·)` predicate. -/
65- abbrev IsSorted (l : List α) : Prop := Sorted (· ≤ ·) l
63+ /-- A list is sorted if it satisfies the `Pairwise (· ≤ ·)` predicate. -/
64+ abbrev IsSorted (l : List α) : Prop := List.Pairwise (· ≤ ·) l
6665
6766/-- `x` is a minimum element of list `l` if `x ≤ b` for all `b ∈ l`. -/
6867abbrev MinOfList (x : α) (l : List α) : Prop := ∀ b ∈ l, x ≤ b
@@ -85,14 +84,14 @@ theorem sorted_merge {l1 l2 : List α} (hxs : IsSorted l1) (hys : IsSorted l2) :
8584 fun_induction merge l1 l2 with
8685 | case3 =>
8786 simp only [Bind.bind, Pure.pure]
88- grind [sorted_cons ]
87+ grind [pairwise_cons ]
8988 | _ => simpa
9089
9190theorem mergeSort_sorted (xs : List α) : IsSorted ⟪mergeSort xs⟫ := by
9291 fun_induction mergeSort xs with
9392 | case1 x =>
9493 simp only [Pure.pure]
95- rcases x with _ | ⟨a, _ | ⟨b, rest⟩⟩ <;> grind [sorted_nil, sorted_singleton]
94+ rcases x with _ | ⟨a, _ | ⟨b, rest⟩⟩ <;> grind
9695 | case2 _ _ _ _ _ ih2 ih1 => exact sorted_merge ih2 ih1
9796
9897lemma merge_perm (l₁ l₂ : List α) : ⟪merge l₁ l₂⟫ ~ l₁ ++ l₂ := by
0 commit comments