src/HOL/MicroJava/J/JBasis.thy
author wenzelm
Tue, 10 Feb 2015 14:48:26 +0100
changeset 59498 50b60f501b05
parent 58886 8a6cac7c7247
child 61361 8b5f00202e1a
permissions -rw-r--r--
proper context for resolve_tac, eresolve_tac, dresolve_tac, forward_tac etc.; occasionally clarified use of context;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/MicroJava/J/JBasis.thy
41589
bbd861837ebc tuned headers;
wenzelm
parents: 35416
diff changeset
     2
    Author:     David von Oheimb, TU Muenchen
11070
cc421547e744 improved document (added headers etc)
oheimb
parents: 11026
diff changeset
     3
*)
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
     4
58886
8a6cac7c7247 modernized header;
wenzelm
parents: 45634
diff changeset
     5
chapter {* Java Source Language \label{cha:j} *}
8a6cac7c7247 modernized header;
wenzelm
parents: 45634
diff changeset
     6
8a6cac7c7247 modernized header;
wenzelm
parents: 45634
diff changeset
     7
section {* Some Auxiliary Definitions *}
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
     8
44035
322d1657c40c replace old SML code generator by new code generator in MicroJava/JVM and /BV
Andreas Lochbihler
parents: 41589
diff changeset
     9
theory JBasis imports Main "~~/src/HOL/Library/Transitive_Closure_Table" begin 
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    10
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    11
lemmas [simp] = Let_def
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    12
58886
8a6cac7c7247 modernized header;
wenzelm
parents: 45634
diff changeset
    13
subsection "unique"
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    14
 
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 24783
diff changeset
    15
definition unique :: "('a \<times> 'b) list => bool" where
45634
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    16
  "unique == distinct \<circ> map fst"
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    17
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    18
45634
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    19
lemma fst_in_set_lemma: "(x, y) : set xys ==> x : fst ` set xys"
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    20
  by (induct xys) auto
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    21
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    22
lemma unique_Nil [simp]: "unique []"
45634
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    23
  by (simp add: unique_def)
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    24
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    25
lemma unique_Cons [simp]: "unique ((x,y)#l) = (unique l & (!y. (x,y) ~: set l))"
45634
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    26
  by (auto simp: unique_def dest: fst_in_set_lemma)
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    27
45634
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    28
lemma unique_append: "unique l' ==> unique l ==>
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    29
    (!(x,y):set l. !(x',y'):set l'. x' ~= x) ==> unique (l @ l')"
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    30
  by (induct l) (auto dest: fst_in_set_lemma)
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    31
45634
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    32
lemma unique_map_inj: "unique l ==> inj f ==> unique (map (%(k,x). (f k, g k x)) l)"
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    33
  by (induct l) (auto dest: fst_in_set_lemma simp add: inj_eq)
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    34
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    35
58886
8a6cac7c7247 modernized header;
wenzelm
parents: 45634
diff changeset
    36
subsection "More about Maps"
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    37
45634
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    38
lemma map_of_SomeI: "unique l ==> (k, x) : set l ==> map_of l k = Some x"
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    39
  by (induct l) auto
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    40
45634
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    41
lemma Ball_set_table: "(\<forall>(x,y)\<in>set l. P x y) ==> (\<forall>x. \<forall>y. map_of l x = Some y --> P x y)"
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    42
  by (induct l) auto
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    43
45634
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    44
lemma table_of_remap_SomeD:
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    45
  "map_of (map (\<lambda>((k,k'),x). (k,(k',x))) t) k = Some (k',x) ==>
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    46
    map_of t (k, k') = Some x"
b3dce535960f tuned proofs;
wenzelm
parents: 44035
diff changeset
    47
  by (atomize (full), induct t) auto
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10042
diff changeset
    48
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    49
end