src/HOL/ex/InSort.thy
author paulson
Tue, 16 Jul 1996 15:49:46 +0200
changeset 1868 836950047d85
parent 1476 608483c2122a
child 1896 df4e40b9ff6d
permissions -rw-r--r--
Put in minimal simpset to avoid excessive simplification, just as in revision 1.9 of HOL/indrule.ML
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1376
diff changeset
     1
(*  Title:      HOL/ex/insort.thy
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1376
diff changeset
     3
    Author:     Tobias Nipkow
969
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