All Exercises
#49 Insertion Sort Preserves Length
live.lean-lang.org
Pure Lean 4 · No Mathlib
MediumVerified Algorithms

49. Insertion Sort Preserves Length

Prove that insertion sort (`isort`) preserves the length of any list of natural numbers. Keep `insertNat` and `isort` unchanged.

Target Theorem
theorem isort_length (xs : List Nat) : (isort xs).length = xs.length
Hints (0/3)

Stuck? Reveal hints one step at a time without spoiling the full proof.

Symbols:
Initializing Lean 4 editor…
Infoview & Diagnosticsline 1idle
Write your proof above and click Submit Proof (or open in live.lean-lang.org).