src/HOL/ex/InSort.thy
author nipkow
Fri, 24 Nov 2000 16:49:27 +0100
changeset 10519 ade64af4c57c
parent 8422 6c6a5410a9bd
child 13159 2af7b94892ce
permissions -rw-r--r--
hide many names from Datatype_Universe.
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
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 1896
diff changeset
    15
primrec
8422
6c6a5410a9bd renamed "f" to "le" and "mset" to "multiset"
paulson
parents: 5184
diff changeset
    16
  "ins le x [] = [x]"
6c6a5410a9bd renamed "f" to "le" and "mset" to "multiset"
paulson
parents: 5184
diff changeset
    17
  "ins le x (y#ys) = (if le x y then (x#y#ys) else y#(ins le x ys))"
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 1896
diff changeset
    18
primrec
8422
6c6a5410a9bd renamed "f" to "le" and "mset" to "multiset"
paulson
parents: 5184
diff changeset
    19
  "insort le [] = []"
6c6a5410a9bd renamed "f" to "le" and "mset" to "multiset"
paulson
parents: 5184
diff changeset
    20
  "insort le (x#xs) = ins le x (insort le xs)"
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    21
end
1896
df4e40b9ff6d Simplified primrec - definitions.
berghofe
parents: 1476
diff changeset
    22