src/HOLCF/IOA/NTP/Multiset.thy
author aspinall
Fri, 30 Sep 2005 18:18:34 +0200
changeset 17740 fc385ce6187d
parent 17244 0b2ff9541727
child 19739 c58ef2aa5430
permissions -rw-r--r--
Add icon for interface.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     1
(*  Title:      HOL/IOA/NTP/Multiset.thy
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     2
    ID:         $Id$
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     3
    Author:     Tobias Nipkow & Konrad Slind
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     4
*)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     5
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
     6
header {* Axiomatic multisets *}
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     7
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
     8
theory Multiset
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
     9
imports Lemmas
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    10
begin
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    11
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    12
typedecl
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    13
  'a multiset
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    14
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    15
consts
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    16
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    17
  "{|}"  :: "'a multiset"                        ("{|}")
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    18
  addm   :: "['a multiset, 'a] => 'a multiset"
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    19
  delm   :: "['a multiset, 'a] => 'a multiset"
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    20
  countm :: "['a multiset, 'a => bool] => nat"
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    21
  count  :: "['a multiset, 'a] => nat"
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    22
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    23
axioms
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    24
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    25
delm_empty_def:
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    26
  "delm {|} x = {|}"
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    27
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    28
delm_nonempty_def:
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    29
  "delm (addm M x) y == (if x=y then M else addm (delm M y) x)"
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    30
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    31
countm_empty_def:
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    32
   "countm {|} P == 0"
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    33
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    34
countm_nonempty_def:
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    35
   "countm (addm M x) P == countm M P + (if P x then Suc 0 else 0)"
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    36
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    37
count_def:
3852
e694c660055b fixed dots;
wenzelm
parents: 3073
diff changeset
    38
   "count M x == countm M (%y. y = x)"
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    39
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    40
"induction":
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    41
   "[| P({|}); !!M x. P(M) ==> P(addm M x) |] ==> P(M)"
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    42
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    43
ML {* use_text Context.ml_output true
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    44
  ("structure Multiset = struct " ^ legacy_bindings (the_context ()) ^ " end") *}
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    45
ML {* open Multiset *}
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    46
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    47
end