src/HOL/Map.thy
author nipkow
Wed, 14 May 2003 10:33:52 +0200
changeset 14026 c031a330a03f
parent 14025 d9b155757dc8
child 14027 68d247b7b14b
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3981
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/Map.thy
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
     2
    ID:         $Id$
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
     3
    Author:     Tobias Nipkow, based on a theory by David von Oheimb
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
     4
    Copyright   1997-2003 TU Muenchen
3981
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
     5
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
     6
The datatype of `maps' (written ~=>); strongly resembles maps in VDM.
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
     7
*)
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
     8
13914
nipkow
parents: 13912
diff changeset
     9
header {* Maps *}
nipkow
parents: 13912
diff changeset
    10
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    11
theory Map = List:
3981
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
    12
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    13
types ('a,'b) "~=>" = "'a => 'b option" (infixr 0)
3981
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
    14
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
    15
consts
5300
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    16
chg_map	:: "('b => 'b) => 'a => ('a ~=> 'b) => ('a ~=> 'b)"
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
    17
map_add:: "('a ~=> 'b) => ('a ~=> 'b) => ('a ~=> 'b)" (infixl "++" 100)
5300
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    18
dom	:: "('a ~=> 'b) => 'a set"
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    19
ran	:: "('a ~=> 'b) => 'b set"
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    20
map_of	:: "('a * 'b)list => 'a ~=> 'b"
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    21
map_upds:: "('a ~=> 'b) => 'a list => 'b list => 
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
    22
	    ('a ~=> 'b)"		 ("_/'(_[|->]_/')" [900,0,0]900)
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
    23
map_le  :: "('a ~=> 'b) => ('a ~=> 'b) => bool" (infix "\<subseteq>\<^sub>m" 50)
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
    24
5300
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    25
syntax
13890
90611b4e0054 Made empty a translation rather than a constant.
nipkow
parents: 12919
diff changeset
    26
empty	::  "'a ~=> 'b"
5300
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    27
map_upd	:: "('a ~=> 'b) => 'a => 'b => ('a ~=> 'b)"
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
    28
					 ("_/'(_/|->_')"   [900,0,0]900)
3981
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
    29
12114
a8e860c86252 eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents: 10137
diff changeset
    30
syntax (xsymbols)
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    31
  "~=>"     :: "[type, type] => type"    (infixr "\<leadsto>" 0)
5300
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    32
  map_upd   :: "('a ~=> 'b) => 'a      => 'b      => ('a ~=> 'b)"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    33
					  ("_/'(_/\<mapsto>/_')"  [900,0,0]900)
5300
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    34
  map_upds  :: "('a ~=> 'b) => 'a list => 'b list => ('a ~=> 'b)"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    35
				         ("_/'(_/[\<mapsto>]/_')" [900,0,0]900)
5300
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    36
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    37
translations
13890
90611b4e0054 Made empty a translation rather than a constant.
nipkow
parents: 12919
diff changeset
    38
  "empty"    => "_K None"
90611b4e0054 Made empty a translation rather than a constant.
nipkow
parents: 12919
diff changeset
    39
  "empty"    <= "%x. None"
5300
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    40
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    41
  "m(a|->b)" == "m(a:=Some b)"
3981
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
    42
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
    43
defs
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    44
chg_map_def:  "chg_map f a m == case m a of None => m | Some b => m(a|->f b)"
3981
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
    45
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
    46
map_add_def: "m1++m2 == %x. case m2 x of None => m1 x | Some y => Some y"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
    47
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
    48
map_upds_def: "m(xs [|->] ys) == m ++ map_of (rev(zip xs ys))"
3981
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
    49
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    50
dom_def: "dom(m) == {a. m a ~= None}"
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
    51
ran_def: "ran(m) == {b. EX a. m a = Some b}"
3981
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
    52
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
    53
map_le_def: "m1 \<subseteq>\<^sub>m m2  ==  ALL a : dom m1. m1 a = m2 a"
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
    54
5183
89f162de39cf Adapted to new datatype package.
berghofe
parents: 3981
diff changeset
    55
primrec
89f162de39cf Adapted to new datatype package.
berghofe
parents: 3981
diff changeset
    56
  "map_of [] = empty"
5300
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    57
  "map_of (p#ps) = (map_of ps)(fst p |-> snd p)"
2b1ca524ace8 defined map_upd by translation via fun_upd
oheimb
parents: 5195
diff changeset
    58
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    59
13937
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
    60
subsection {* empty *}
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    61
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
    62
lemma empty_upd_none[simp]: "empty(x := None) = empty"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    63
apply (rule ext)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    64
apply (simp (no_asm))
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    65
done
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
    66
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    67
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    68
(* FIXME: what is this sum_case nonsense?? *)
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
    69
lemma sum_case_empty_empty[simp]: "sum_case empty empty = empty"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    70
apply (rule ext)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    71
apply (simp (no_asm) split add: sum.split)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    72
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    73
13937
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
    74
subsection {* map\_upd *}
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    75
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    76
lemma map_upd_triv: "t k = Some x ==> t(k|->x) = t"
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    77
apply (rule ext)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    78
apply (simp (no_asm_simp))
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    79
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    80
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
    81
lemma map_upd_nonempty[simp]: "t(k|->x) ~= empty"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    82
apply safe
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    83
apply (drule_tac x = "k" in fun_cong)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    84
apply (simp (no_asm_use))
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    85
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    86
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    87
lemma finite_range_updI: "finite (range f) ==> finite (range (f(a|->b)))"
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    88
apply (unfold image_def)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    89
apply (simp (no_asm_use) add: full_SetCompr_eq)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    90
apply (rule finite_subset)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    91
prefer 2 apply (assumption)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    92
apply auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    93
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    94
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    95
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    96
(* FIXME: what is this sum_case nonsense?? *)
13937
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
    97
subsection {* sum\_case and empty/map\_upd *}
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
    98
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
    99
lemma sum_case_map_upd_empty[simp]:
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   100
 "sum_case (m(k|->y)) empty =  (sum_case m empty)(Inl k|->y)"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   101
apply (rule ext)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   102
apply (simp (no_asm) split add: sum.split)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   103
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   104
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   105
lemma sum_case_empty_map_upd[simp]:
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   106
 "sum_case empty (m(k|->y)) =  (sum_case empty m)(Inr k|->y)"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   107
apply (rule ext)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   108
apply (simp (no_asm) split add: sum.split)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   109
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   110
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   111
lemma sum_case_map_upd_map_upd[simp]:
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   112
 "sum_case (m1(k1|->y1)) (m2(k2|->y2)) = (sum_case (m1(k1|->y1)) m2)(Inr k2|->y2)"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   113
apply (rule ext)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   114
apply (simp (no_asm) split add: sum.split)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   115
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   116
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   117
13937
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
   118
subsection {* chg\_map *}
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   119
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   120
lemma chg_map_new[simp]: "m a = None   ==> chg_map f a m = m"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   121
apply (unfold chg_map_def)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   122
apply auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   123
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   124
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   125
lemma chg_map_upd[simp]: "m a = Some b ==> chg_map f a m = m(a|->f b)"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   126
apply (unfold chg_map_def)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   127
apply auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   128
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   129
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   130
13937
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
   131
subsection {* map\_of *}
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   132
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   133
lemma map_of_SomeD [rule_format (no_asm)]: "map_of xs k = Some y --> (k,y):set xs"
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   134
apply (induct_tac "xs")
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   135
apply  auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   136
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   137
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   138
lemma map_of_mapk_SomeI [rule_format (no_asm)]: "inj f ==> map_of t k = Some x -->  
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   139
   map_of (map (split (%k. Pair (f k))) t) (f k) = Some x"
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   140
apply (induct_tac "t")
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   141
apply  (auto simp add: inj_eq)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   142
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   143
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   144
lemma weak_map_of_SomeI [rule_format (no_asm)]: "(k, x) : set l --> (? x. map_of l k = Some x)"
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   145
apply (induct_tac "l")
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   146
apply  auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   147
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   148
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   149
lemma map_of_filter_in: 
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   150
"[| map_of xs k = Some z; P k z |] ==> map_of (filter (split P) xs) k = Some z"
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   151
apply (rule mp)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   152
prefer 2 apply (assumption)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   153
apply (erule thin_rl)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   154
apply (induct_tac "xs")
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   155
apply  auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   156
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   157
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   158
lemma finite_range_map_of: "finite (range (map_of l))"
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   159
apply (induct_tac "l")
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   160
apply  (simp_all (no_asm) add: image_constant)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   161
apply (rule finite_subset)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   162
prefer 2 apply (assumption)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   163
apply auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   164
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   165
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   166
lemma map_of_map: "map_of (map (%(a,b). (a,f b)) xs) x = option_map f (map_of xs x)"
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   167
apply (induct_tac "xs")
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   168
apply auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   169
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   170
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   171
13937
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
   172
subsection {* option\_map related *}
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   173
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   174
lemma option_map_o_empty[simp]: "option_map f o empty = empty"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   175
apply (rule ext)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   176
apply (simp (no_asm))
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   177
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   178
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   179
lemma option_map_o_map_upd[simp]:
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   180
 "option_map f o m(a|->b) = (option_map f o m)(a|->f b)"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   181
apply (rule ext)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   182
apply (simp (no_asm))
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   183
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   184
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   185
13937
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
   186
subsection {* ++ *}
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   187
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   188
lemma map_add_empty[simp]: "m ++ empty = m"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   189
apply (unfold map_add_def)
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   190
apply (simp (no_asm))
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   191
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   192
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   193
lemma empty_map_add[simp]: "empty ++ m = m"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   194
apply (unfold map_add_def)
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   195
apply (rule ext)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   196
apply (simp split add: option.split)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   197
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   198
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   199
lemma map_add_assoc[simp]: "m1 ++ (m2 ++ m3) = (m1 ++ m2) ++ m3"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   200
apply(rule ext)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   201
apply(simp add: map_add_def split:option.split)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   202
done
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   203
14026
c031a330a03f *** empty log message ***
nipkow
parents: 14025
diff changeset
   204
lemma map_add_comm: "dom m1 \<inter> dom m2 = {} \<Longrightarrow> m1++m2 = m2++m1"
c031a330a03f *** empty log message ***
nipkow
parents: 14025
diff changeset
   205
apply(rule ext)
c031a330a03f *** empty log message ***
nipkow
parents: 14025
diff changeset
   206
apply(fastsimp simp:map_add_def split:option.split)
c031a330a03f *** empty log message ***
nipkow
parents: 14025
diff changeset
   207
done
c031a330a03f *** empty log message ***
nipkow
parents: 14025
diff changeset
   208
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   209
lemma map_add_Some_iff: 
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   210
 "((m ++ n) k = Some x) = (n k = Some x | n k = None & m k = Some x)"
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   211
apply (unfold map_add_def)
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   212
apply (simp (no_asm) split add: option.split)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   213
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   214
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   215
lemmas map_add_SomeD = map_add_Some_iff [THEN iffD1, standard]
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   216
declare map_add_SomeD [dest!]
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   217
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   218
lemma map_add_find_right[simp]: "!!xx. n k = Some xx ==> (m ++ n) k = Some xx"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   219
apply (subst map_add_Some_iff)
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   220
apply fast
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   221
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   222
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   223
lemma map_add_None [iff]: "((m ++ n) k = None) = (n k = None & m k = None)"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   224
apply (unfold map_add_def)
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   225
apply (simp (no_asm) split add: option.split)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   226
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   227
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   228
lemma map_add_upd[simp]: "f ++ g(x|->y) = (f ++ g)(x|->y)"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   229
apply (unfold map_add_def)
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   230
apply (rule ext)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   231
apply auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   232
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   233
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   234
lemma map_of_append[simp]: "map_of (xs@ys) = map_of ys ++ map_of xs"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   235
apply (unfold map_add_def)
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   236
apply (induct_tac "xs")
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   237
apply (simp (no_asm))
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   238
apply (rule ext)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   239
apply (simp (no_asm_simp) split add: option.split)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   240
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   241
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   242
declare fun_upd_apply [simp del]
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   243
lemma finite_range_map_of_map_add:
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   244
 "finite (range f) ==> finite (range (f ++ map_of l))"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   245
apply (induct_tac "l")
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   246
apply  auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   247
apply (erule finite_range_updI)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   248
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   249
declare fun_upd_apply [simp]
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   250
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   251
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   252
subsection {* map\_upds *}
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   253
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   254
lemma map_upds_Nil1[simp]: "m([] [|->] bs) = m"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   255
by(simp add:map_upds_def)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   256
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   257
lemma map_upds_Nil2[simp]: "m(as [|->] []) = m"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   258
by(simp add:map_upds_def)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   259
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   260
lemma map_upds_Cons[simp]: "m(a#as [|->] b#bs) = (m(a|->b))(as[|->]bs)"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   261
by(simp add:map_upds_def)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   262
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   263
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   264
lemma map_upd_upds_conv_if: "!!x y ys f.
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   265
 (f(x|->y))(xs [|->] ys) =
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   266
 (if x : set(take (length ys) xs) then f(xs [|->] ys)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   267
                                  else (f(xs [|->] ys))(x|->y))"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   268
apply(induct xs)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   269
 apply simp
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   270
apply(case_tac ys)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   271
 apply(auto split:split_if simp:fun_upd_twist)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   272
done
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   273
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   274
lemma map_upds_twist [simp]:
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   275
 "a ~: set as ==> m(a|->b)(as[|->]bs) = m(as[|->]bs)(a|->b)"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   276
apply(insert set_take_subset)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   277
apply (fastsimp simp add: map_upd_upds_conv_if)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   278
done
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   279
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   280
lemma map_upds_apply_nontin[simp]:
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   281
 "!!ys. x ~: set xs ==> (f(xs[|->]ys)) x = f x"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   282
apply(induct xs)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   283
 apply simp
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   284
apply(case_tac ys)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   285
 apply(auto simp: map_upd_upds_conv_if)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   286
done
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   287
13937
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
   288
subsection {* dom *}
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   289
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   290
lemma domI: "m a = Some b ==> a : dom m"
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   291
apply (unfold dom_def)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   292
apply auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   293
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   294
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   295
lemma domD: "a : dom m ==> ? b. m a = Some b"
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   296
apply (unfold dom_def)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   297
apply auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   298
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   299
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   300
lemma domIff[iff]: "(a : dom m) = (m a ~= None)"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   301
apply (unfold dom_def)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   302
apply auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   303
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   304
declare domIff [simp del]
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   305
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   306
lemma dom_empty[simp]: "dom empty = {}"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   307
apply (unfold dom_def)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   308
apply (simp (no_asm))
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   309
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   310
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   311
lemma dom_fun_upd[simp]:
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   312
 "dom(f(x := y)) = (if y=None then dom f - {x} else insert x (dom f))"
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   313
by (simp add:dom_def) blast
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   314
13937
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
   315
lemma dom_map_of: "dom(map_of xys) = {x. \<exists>y. (x,y) : set xys}"
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
   316
apply(induct xys)
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
   317
apply(auto simp del:fun_upd_apply)
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
   318
done
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
   319
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   320
lemma finite_dom_map_of: "finite (dom (map_of l))"
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   321
apply (unfold dom_def)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   322
apply (induct_tac "l")
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   323
apply (auto simp add: insert_Collect [symmetric])
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   324
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   325
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   326
lemma dom_map_upds[simp]:
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   327
 "!!m ys. dom(m(xs[|->]ys)) = set(take (length ys) xs) Un dom m"
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   328
apply(induct xs)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   329
 apply simp
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   330
apply(case_tac ys)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   331
 apply auto
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   332
done
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   333
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   334
lemma dom_map_add[simp]: "dom(m++n) = dom n Un dom m"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   335
apply (unfold dom_def)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   336
apply auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   337
done
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   338
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   339
lemma dom_overwrite[simp]:
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   340
 "dom(f(g|A)) = (dom f  - {a. a : A - dom g}) Un {a. a : A Int dom g}"
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   341
by(auto simp add: dom_def overwrite_def)
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   342
13937
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
   343
subsection {* ran *}
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   344
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   345
lemma ran_empty[simp]: "ran empty = {}"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   346
apply (unfold ran_def)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   347
apply (simp (no_asm))
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   348
done
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   349
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   350
lemma ran_map_upd[simp]: "m a = None ==> ran(m(a|->b)) = insert b (ran m)"
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   351
apply (unfold ran_def)
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   352
apply auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   353
apply (subgoal_tac "~ (aa = a) ")
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   354
apply auto
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   355
done
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   356
13937
e9d57517c9b1 added a thm
nipkow
parents: 13914
diff changeset
   357
subsection {* map\_le *}
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   358
13912
3c0a340be514 fixed document
kleing
parents: 13910
diff changeset
   359
lemma map_le_empty [simp]: "empty \<subseteq>\<^sub>m g"
13910
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   360
by(simp add:map_le_def)
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   361
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   362
lemma map_le_upd[simp]: "f \<subseteq>\<^sub>m g ==> f(a := b) \<subseteq>\<^sub>m g(a := b)"
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   363
by(fastsimp simp add:map_le_def)
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   364
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   365
lemma map_le_upds[simp]:
f9a9ef16466f Added thms
nipkow
parents: 13909
diff changeset
   366
 "!!f g bs. f \<subseteq>\<^sub>m g ==> f(as [|->] bs) \<subseteq>\<^sub>m g(as [|->] bs)"
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   367
apply(induct as)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   368
 apply simp
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   369
apply(case_tac bs)
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   370
 apply auto
d9b155757dc8 *** empty log message ***
nipkow
parents: 13937
diff changeset
   371
done
13908
4bdfa9f77254 Map.ML integrated into Map.thy
webertj
parents: 13890
diff changeset
   372
3981
b4f93a8da835 Added the new theory Map.
nipkow
parents:
diff changeset
   373
end