Skip to content

Instantly share code, notes, and snippets.

@tangentstorm
Created January 9, 2016 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tangentstorm/c23f572bf7ed9771b667 to your computer and use it in GitHub Desktop.
Save tangentstorm/c23f572bf7ed9771b667 to your computer and use it in GitHub Desktop.
theory QSort
imports Main
begin
fun qsort :: "'a::ord list ⇒ 'a list" where
"qsort [] = []"
| "qsort (x#xs) = (qsort (filter (λy. y≤x) xs))
@ x#(qsort (filter (λy. y>x) xs))"
fun sorted :: "'a::ord list ⇒ bool" where
"sorted [] = True"
| "sorted [x] = True"
| "sorted (x#y#zs) = ((x ≤ y) ∧ sorted (y#zs))"
theorem "∀xs::('a::ord list). sorted (qsort xs)"
sorry
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment