src/HOL/ex/Sorting.thy
author wenzelm
Mon, 16 Nov 1998 10:41:08 +0100
changeset 5869 b279a84ac11c
parent 5184 9b8547a9496a
child 8415 852c63072334
permissions -rw-r--r--
added read;
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/sorting.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
Specification of sorting
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
Sorting = List +
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    10
consts
1376
92f83b9d17e1 removed quotes from consts and syntax sections
clasohm
parents: 969
diff changeset
    11
  sorted1:: [['a,'a] => bool, 'a list] => bool
92f83b9d17e1 removed quotes from consts and syntax sections
clasohm
parents: 969
diff changeset
    12
  sorted :: [['a,'a] => bool, 'a list] => bool
92f83b9d17e1 removed quotes from consts and syntax sections
clasohm
parents: 969
diff changeset
    13
  mset   :: 'a list => ('a => nat)
92f83b9d17e1 removed quotes from consts and syntax sections
clasohm
parents: 969
diff changeset
    14
  total  :: (['a,'a] => bool) => bool
92f83b9d17e1 removed quotes from consts and syntax sections
clasohm
parents: 969
diff changeset
    15
  transf :: (['a,'a] => bool) => bool
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    16
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 3465
diff changeset
    17
primrec
2517
2af078382853 Modified some defs and shortened proofs.
nipkow
parents: 2511
diff changeset
    18
  "sorted1 le [] = True"
2af078382853 Modified some defs and shortened proofs.
nipkow
parents: 2511
diff changeset
    19
  "sorted1 le (x#xs) = ((case xs of [] => True | y#ys => le x y) &
2af078382853 Modified some defs and shortened proofs.
nipkow
parents: 2511
diff changeset
    20
                        sorted1 le xs)"
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    21
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 3465
diff changeset
    22
primrec
2517
2af078382853 Modified some defs and shortened proofs.
nipkow
parents: 2511
diff changeset
    23
  "sorted le [] = True"
3465
e85c24717cad set_of_list -> set
nipkow
parents: 2517
diff changeset
    24
  "sorted le (x#xs) = ((!y:set xs. le x y) & sorted le xs)"
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    25
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 3465
diff changeset
    26
primrec
2517
2af078382853 Modified some defs and shortened proofs.
nipkow
parents: 2511
diff changeset
    27
  "mset [] y = 0"
2af078382853 Modified some defs and shortened proofs.
nipkow
parents: 2511
diff changeset
    28
  "mset (x#xs) y = (if x=y then Suc(mset xs y) else mset xs y)"
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    29
2517
2af078382853 Modified some defs and shortened proofs.
nipkow
parents: 2511
diff changeset
    30
defs
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    31
total_def  "total r == (!x y. r x y | r y x)"
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    32
transf_def "transf f == (!x y z. f x y & f y z --> f x z)"
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    33
end