src/HOL/ex/InSort.thy
author clasohm
Fri, 01 Dec 1995 12:03:13 +0100
changeset 1376 92f83b9d17e1
parent 969 b051e2fc2e34
child 1476 608483c2122a
permissions -rw-r--r--
removed quotes from consts and syntax sections
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
1376
92f83b9d17e1 removed quotes from consts and syntax sections
clasohm
parents: 969
diff changeset
    12
  ins :: [['a,'a]=>bool, 'a, 'a list] => 'a list
92f83b9d17e1 removed quotes from consts and syntax sections
clasohm
parents: 969
diff changeset
    13
  insort :: [['a,'a]=>bool, 'a list] => 'a list
969
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