src/HOL/ex/InSort.thy
author clasohm
Wed, 22 Mar 1995 12:42:34 +0100
changeset 969 b051e2fc2e34
child 1376 92f83b9d17e1
permissions -rw-r--r--
converted ex with curried function application
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     1
(*  Title: 	HOL/ex/insort.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     3
    Author: 	Tobias Nipkow
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1994 TU Muenchen
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     5
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     6
Insertion sort
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     7
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     8
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     9
InSort  =  Sorting +
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    10
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    11
consts
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    12
  ins :: "[['a,'a]=>bool, 'a, 'a list] => 'a list"
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    13
  insort :: "[['a,'a]=>bool, 'a list] => 'a list"
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    14
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    15
primrec ins List.list
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    16
  ins_Nil  "ins f x [] = [x]"
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    17
  ins_Cons "ins f x (y#ys) = (if f x y then (x#y#ys) else y#(ins f x ys))"
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    18
primrec insort List.list
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    19
  insort_Nil  "insort f [] = []"
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    20
  insort_Cons "insort f (x#xs) = ins f x (insort f xs)"
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    21
end