src/HOL/Library/RBT_Mapping.thy
author Andreas Lochbihler
Fri, 13 Apr 2012 11:45:30 +0200
changeset 47450 2ada2be850cb
parent 43124 fdb7e1d5f762
child 49929 70300f1b6835
permissions -rw-r--r--
move RBT implementation into type class contexts
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
43124
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
     1
(* Author: Florian Haftmann, TU Muenchen *)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
     2
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
     3
header {* Implementation of mappings with Red-Black Trees *}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
     4
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
     5
(*<*)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
     6
theory RBT_Mapping
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
     7
imports RBT Mapping
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
     8
begin
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
     9
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    10
subsection {* Implementation of mappings *}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    11
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    12
definition Mapping :: "('a\<Colon>linorder, 'b) rbt \<Rightarrow> ('a, 'b) mapping" where
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    13
  "Mapping t = Mapping.Mapping (lookup t)"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    14
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    15
code_datatype Mapping
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    16
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    17
lemma lookup_Mapping [simp, code]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    18
  "Mapping.lookup (Mapping t) = lookup t"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    19
  by (simp add: Mapping_def)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    20
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    21
lemma empty_Mapping [code]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    22
  "Mapping.empty = Mapping empty"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    23
  by (rule mapping_eqI) simp
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    24
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    25
lemma is_empty_Mapping [code]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    26
  "Mapping.is_empty (Mapping t) \<longleftrightarrow> is_empty t"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    27
  by (simp add: rbt_eq_iff Mapping.is_empty_empty Mapping_def)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    28
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    29
lemma insert_Mapping [code]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    30
  "Mapping.update k v (Mapping t) = Mapping (insert k v t)"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    31
  by (rule mapping_eqI) simp
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    32
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    33
lemma delete_Mapping [code]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    34
  "Mapping.delete k (Mapping t) = Mapping (delete k t)"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    35
  by (rule mapping_eqI) simp
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    36
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    37
lemma map_entry_Mapping [code]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    38
  "Mapping.map_entry k f (Mapping t) = Mapping (map_entry k f t)"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    39
  by (rule mapping_eqI) simp
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    40
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    41
lemma keys_Mapping [code]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    42
  "Mapping.keys (Mapping t) = set (keys t)"
47450
2ada2be850cb move RBT implementation into type class contexts
Andreas Lochbihler
parents: 43124
diff changeset
    43
  by (simp add: RBT.keys_def Mapping_def Mapping.keys_def lookup_def rbt_lookup_keys)
43124
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    44
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    45
lemma ordered_keys_Mapping [code]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    46
  "Mapping.ordered_keys (Mapping t) = keys t"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    47
  by (rule sorted_distinct_set_unique) (simp_all add: ordered_keys_def keys_Mapping)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    48
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    49
lemma Mapping_size_card_keys: (*FIXME*)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    50
  "Mapping.size m = card (Mapping.keys m)"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    51
  by (simp add: Mapping.size_def Mapping.keys_def)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    52
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    53
lemma size_Mapping [code]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    54
  "Mapping.size (Mapping t) = length (keys t)"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    55
  by (simp add: Mapping_size_card_keys keys_Mapping distinct_card)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    56
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    57
lemma tabulate_Mapping [code]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    58
  "Mapping.tabulate ks f = Mapping (bulkload (List.map (\<lambda>k. (k, f k)) ks))"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    59
  by (rule mapping_eqI) (simp add: map_of_map_restrict)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    60
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    61
lemma bulkload_Mapping [code]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    62
  "Mapping.bulkload vs = Mapping (bulkload (List.map (\<lambda>n. (n, vs ! n)) [0..<length vs]))"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    63
  by (rule mapping_eqI) (simp add: map_of_map_restrict fun_eq_iff)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    64
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    65
lemma equal_Mapping [code]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    66
  "HOL.equal (Mapping t1) (Mapping t2) \<longleftrightarrow> entries t1 = entries t2"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    67
  by (simp add: equal Mapping_def entries_lookup)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    68
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    69
lemma [code nbe]:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    70
  "HOL.equal (x :: (_, _) mapping) x \<longleftrightarrow> True"
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    71
  by (fact equal_refl)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    72
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    73
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    74
hide_const (open) impl_of lookup empty insert delete
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    75
  entries keys bulkload map_entry map fold
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    76
(*>*)
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    77
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    78
text {* 
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    79
  This theory defines abstract red-black trees as an efficient
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    80
  representation of finite maps, backed by the implementation
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    81
  in @{theory RBT_Impl}.
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    82
*}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    83
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    84
subsection {* Data type and invariant *}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    85
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    86
text {*
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    87
  The type @{typ "('k, 'v) RBT_Impl.rbt"} denotes red-black trees with
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    88
  keys of type @{typ "'k"} and values of type @{typ "'v"}. To function
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    89
  properly, the key type musorted belong to the @{text "linorder"}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    90
  class.
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    91
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    92
  A value @{term t} of this type is a valid red-black tree if it
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    93
  satisfies the invariant @{text "is_rbt t"}.  The abstract type @{typ
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    94
  "('k, 'v) rbt"} always obeys this invariant, and for this reason you
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    95
  should only use this in our application.  Going back to @{typ "('k,
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    96
  'v) RBT_Impl.rbt"} may be necessary in proofs if not yet proven
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    97
  properties about the operations must be established.
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    98
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
    99
  The interpretation function @{const "RBT.lookup"} returns the partial
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   100
  map represented by a red-black tree:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   101
  @{term_type[display] "RBT.lookup"}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   102
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   103
  This function should be used for reasoning about the semantics of the RBT
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   104
  operations. Furthermore, it implements the lookup functionality for
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   105
  the data structure: It is executable and the lookup is performed in
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   106
  $O(\log n)$.  
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   107
*}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   108
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   109
subsection {* Operations *}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   110
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   111
text {*
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   112
  Currently, the following operations are supported:
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   113
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   114
  @{term_type [display] "RBT.empty"}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   115
  Returns the empty tree. $O(1)$
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   116
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   117
  @{term_type [display] "RBT.insert"}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   118
  Updates the map at a given position. $O(\log n)$
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   119
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   120
  @{term_type [display] "RBT.delete"}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   121
  Deletes a map entry at a given position. $O(\log n)$
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   122
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   123
  @{term_type [display] "RBT.entries"}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   124
  Return a corresponding key-value list for a tree.
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   125
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   126
  @{term_type [display] "RBT.bulkload"}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   127
  Builds a tree from a key-value list.
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   128
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   129
  @{term_type [display] "RBT.map_entry"}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   130
  Maps a single entry in a tree.
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   131
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   132
  @{term_type [display] "RBT.map"}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   133
  Maps all values in a tree. $O(n)$
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   134
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   135
  @{term_type [display] "RBT.fold"}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   136
  Folds over all entries in a tree. $O(n)$
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   137
*}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   138
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   139
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   140
subsection {* Invariant preservation *}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   141
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   142
text {*
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   143
  \noindent
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   144
  @{thm Empty_is_rbt}\hfill(@{text "Empty_is_rbt"})
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   145
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   146
  \noindent
47450
2ada2be850cb move RBT implementation into type class contexts
Andreas Lochbihler
parents: 43124
diff changeset
   147
  @{thm rbt_insert_is_rbt}\hfill(@{text "rbt_insert_is_rbt"})
43124
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   148
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   149
  \noindent
47450
2ada2be850cb move RBT implementation into type class contexts
Andreas Lochbihler
parents: 43124
diff changeset
   150
  @{thm rbt_delete_is_rbt}\hfill(@{text "delete_is_rbt"})
43124
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   151
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   152
  \noindent
47450
2ada2be850cb move RBT implementation into type class contexts
Andreas Lochbihler
parents: 43124
diff changeset
   153
  @{thm rbt_bulkload_is_rbt}\hfill(@{text "bulkload_is_rbt"})
43124
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   154
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   155
  \noindent
47450
2ada2be850cb move RBT implementation into type class contexts
Andreas Lochbihler
parents: 43124
diff changeset
   156
  @{thm rbt_map_entry_is_rbt}\hfill(@{text "map_entry_is_rbt"})
43124
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   157
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   158
  \noindent
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   159
  @{thm map_is_rbt}\hfill(@{text "map_is_rbt"})
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   160
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   161
  \noindent
47450
2ada2be850cb move RBT implementation into type class contexts
Andreas Lochbihler
parents: 43124
diff changeset
   162
  @{thm rbt_union_is_rbt}\hfill(@{text "union_is_rbt"})
43124
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   163
*}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   164
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   165
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   166
subsection {* Map Semantics *}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   167
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   168
text {*
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   169
  \noindent
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   170
  \underline{@{text "lookup_empty"}}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   171
  @{thm [display] lookup_empty}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   172
  \vspace{1ex}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   173
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   174
  \noindent
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   175
  \underline{@{text "lookup_insert"}}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   176
  @{thm [display] lookup_insert}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   177
  \vspace{1ex}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   178
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   179
  \noindent
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   180
  \underline{@{text "lookup_delete"}}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   181
  @{thm [display] lookup_delete}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   182
  \vspace{1ex}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   183
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   184
  \noindent
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   185
  \underline{@{text "lookup_bulkload"}}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   186
  @{thm [display] lookup_bulkload}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   187
  \vspace{1ex}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   188
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   189
  \noindent
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   190
  \underline{@{text "lookup_map"}}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   191
  @{thm [display] lookup_map}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   192
  \vspace{1ex}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   193
*}
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   194
fdb7e1d5f762 splitting RBT theory into RBT and RBT_Mapping
bulwahn
parents:
diff changeset
   195
end