| author | nipkow | 
| Tue, 13 Nov 2007 13:51:12 +0100 | |
| changeset 25427 | 8ba39d2d9d0b | 
| parent 24783 | 5a3e336a2e37 | 
| child 35416 | d8d7d1b785af | 
| permissions | -rw-r--r-- | 
| 8011 | 1 | (* Title: HOL/MicroJava/J/JBasis.thy | 
| 2 | ID: $Id$ | |
| 3 | Author: David von Oheimb | |
| 4 | Copyright 1999 TU Muenchen | |
| 11070 | 5 | *) | 
| 8011 | 6 | |
| 12911 | 7 | header {* 
 | 
| 8 |   \chapter{Java Source Language}\label{cha:j}
 | |
| 9 |   \isaheader{Some Auxiliary Definitions}
 | |
| 10 | *} | |
| 8011 | 11 | |
| 16417 | 12 | theory JBasis imports Main begin | 
| 8011 | 13 | |
| 11026 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 14 | lemmas [simp] = Let_def | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 15 | |
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 16 | section "unique" | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 17 | |
| 8011 | 18 | constdefs | 
| 11070 | 19 |   unique  :: "('a \<times> 'b) list => bool"
 | 
| 12888 | 20 | "unique == distinct \<circ> map fst" | 
| 8011 | 21 | |
| 11026 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 22 | |
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 23 | lemma fst_in_set_lemma [rule_format (no_asm)]: | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 24 | "(x, y) : set xys --> x : fst ` set xys" | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 25 | apply (induct_tac "xys") | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 26 | apply auto | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 27 | done | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 28 | |
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 29 | lemma unique_Nil [simp]: "unique []" | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 30 | apply (unfold unique_def) | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 31 | apply (simp (no_asm)) | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 32 | done | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 33 | |
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 34 | lemma unique_Cons [simp]: "unique ((x,y)#l) = (unique l & (!y. (x,y) ~: set l))" | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 35 | apply (unfold unique_def) | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 36 | apply (auto dest: fst_in_set_lemma) | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 37 | done | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 38 | |
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 39 | lemma unique_append [rule_format (no_asm)]: "unique l' ==> unique l --> | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 40 | (!(x,y):set l. !(x',y'):set l'. x' ~= x) --> unique (l @ l')" | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 41 | apply (induct_tac "l") | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 42 | apply (auto dest: fst_in_set_lemma) | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 43 | done | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 44 | |
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 45 | lemma unique_map_inj [rule_format (no_asm)]: | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 46 | "unique l --> inj f --> unique (map (%(k,x). (f k, g k x)) l)" | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 47 | apply (induct_tac "l") | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 48 | apply (auto dest: fst_in_set_lemma simp add: inj_eq) | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 49 | done | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 50 | |
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 51 | section "More about Maps" | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 52 | |
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 53 | lemma map_of_SomeI [rule_format (no_asm)]: | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 54 | "unique l --> (k, x) : set l --> map_of l k = Some x" | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 55 | apply (induct_tac "l") | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 56 | apply auto | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 57 | done | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 58 | |
| 24783 | 59 | lemma Ball_set_table': | 
| 11070 | 60 | "(\<forall>(x,y)\<in>set l. P x y) --> (\<forall>x. \<forall>y. map_of l x = Some y --> P x y)" | 
| 11026 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 61 | apply(induct_tac "l") | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 62 | apply(simp_all (no_asm)) | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 63 | apply safe | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 64 | apply auto | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 65 | done | 
| 24783 | 66 | lemmas Ball_set_table = Ball_set_table' [THEN mp]; | 
| 11026 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 67 | |
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 68 | lemma table_of_remap_SomeD [rule_format (no_asm)]: | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 69 | "map_of (map (\<lambda>((k,k'),x). (k,(k',x))) t) k = Some (k',x) --> | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 70 | map_of t (k, k') = Some x" | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 71 | apply (induct_tac "t") | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 72 | apply auto | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 73 | done | 
| 
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
 oheimb parents: 
10042diff
changeset | 74 | |
| 8011 | 75 | end |