src/HOL/MicroJava/J/Example.thy
author oheimb
Thu, 01 Feb 2001 20:53:13 +0100
changeset 11026 a50365d21144
parent 10763 08e1610c1dcb
child 11070 cc421547e744
permissions -rw-r--r--
converted to Isar, simplifying recursion on class hierarchy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
     1
(*  Title:      isabelle/Bali/Example.thy
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
     2
    ID:         $Id$
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
     3
    Author:     David von Oheimb
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
     4
    Copyright   1997 Technische Universitaet Muenchen
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
     5
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
     6
The following example Bali program includes:
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
     7
 class declarations with inheritance, hiding of fields, and overriding of
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
     8
  methods (with refined result type), 
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
     9
 instance creation, local assignment, sequential composition,
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    10
 method call with dynamic binding, literal values,
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    11
 expression statement, local access, type cast, field assignment (in part), skip
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    12
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    13
class Base {
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    14
  boolean vee;
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    15
  Base foo(Base x) {return x;}
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    16
}
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    17
10229
10e2d29a77de cosmetics
oheimb
parents: 10042
diff changeset
    18
class Ext extends Base {
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    19
  int vee;
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    20
  Ext foo(Base x) {((Ext)x).vee=1; return null;}
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    21
}
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    22
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    23
class Example {
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    24
  public static void main (String args[]) {
9498
b5d6db4111bc minor corrections
oheimb
parents: 9348
diff changeset
    25
    Base e=new Ext();
b5d6db4111bc minor corrections
oheimb
parents: 9348
diff changeset
    26
    e.foo(null);
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    27
  }
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    28
}
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    29
*)
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    30
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    31
theory Example = Eval:
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    32
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    33
datatype cnam_ = Base_ | Ext_
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    34
datatype vnam_ = vee_ | x_ | e_
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    35
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    36
consts
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    37
10042
7164dc0d24d8 unsymbolized
kleing
parents: 9793
diff changeset
    38
  cnam_ :: "cnam_ => cname"
7164dc0d24d8 unsymbolized
kleing
parents: 9793
diff changeset
    39
  vnam_ :: "vnam_ => vnam"
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    40
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    41
axioms (* cnam_ and vnam_ are intended to be isomorphic to cnam and vnam *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    42
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    43
  inj_cnam_:  "(cnam_ x = cnam_ y) = (x = y)"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    44
  inj_vnam_:  "(vnam_ x = vnam_ y) = (x = y)"
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    45
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    46
  surj_cnam_: "\<exists>m. n = cnam_ m"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    47
  surj_vnam_: "\<exists>m. n = vnam_ m"
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    48
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    49
declare inj_cnam_ [simp] inj_vnam_ [simp]
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    50
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    51
syntax
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    52
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    53
  Base :: cname
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    54
  Ext  :: cname
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    55
  vee  :: vname
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    56
  x    :: vname
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    57
  e    :: vname
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    58
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    59
translations
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    60
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    61
  "Base" == "cnam_ Base_"
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    62
  "Ext"	 == "cnam_ Ext_"
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    63
  "vee"  == "VName (vnam_ vee_)"
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    64
  "x"	 == "VName (vnam_ x_)"
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    65
  "e"	 == "VName (vnam_ e_)"
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    66
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    67
axioms
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    68
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    69
  Base_not_Object: "Base \<noteq> Object"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    70
  Ext_not_Object:  "Ext  \<noteq> Object"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    71
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    72
declare Base_not_Object [simp] Ext_not_Object [simp]
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    73
declare Base_not_Object [THEN not_sym, simp] 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    74
declare Ext_not_Object  [THEN not_sym, simp]
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    75
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    76
consts
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    77
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    78
  foo_Base::  java_mb
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    79
  foo_Ext ::  java_mb
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    80
  BaseC   :: "java_mb cdecl"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    81
  ExtC    :: "java_mb cdecl"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    82
  test	  ::  stmt
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    83
  foo	  ::  mname
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    84
  a	  ::  loc
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    85
  b       ::  loc
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    86
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    87
defs
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    88
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    89
  foo_Base_def:"foo_Base == ([x],[],Skip,LAcc x)"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    90
  BaseC_def:"BaseC == (Base, (Object, 
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    91
			     [(vee, PrimT Boolean)], 
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    92
			     [((foo,[Class Base]),Class Base,foo_Base)]))"
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    93
  foo_Ext_def:"foo_Ext == ([x],[],Expr( {Ext}Cast Ext
9348
f495dba0cb07 corrections (cast relation, Prog.ML -> Decl.ML)
oheimb
parents: 9346
diff changeset
    94
				       (LAcc x)..vee:=Lit (Intg #1)),
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    95
				   Lit Null)"
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
    96
  ExtC_def: "ExtC  == (Ext,  (Base  , 
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    97
			     [(vee, PrimT Integer)], 
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    98
			     [((foo,[Class Base]),Class Ext,foo_Ext)]))"
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
    99
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   100
  test_def:"test == Expr(e::=NewC Ext);; 
10763
08e1610c1dcb added type annotation to Call
oheimb
parents: 10613
diff changeset
   101
                    Expr({Base}LAcc e..foo({[Class Base]}[Lit Null]))"
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
   102
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
   103
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
   104
syntax
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
   105
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   106
  NP	:: xcpt
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   107
  tprg 	::"java_mb prog"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   108
  obj1	:: obj
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   109
  obj2	:: obj
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   110
  s0 	:: state
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   111
  s1 	:: state
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   112
  s2 	:: state
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   113
  s3 	:: state
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   114
  s4 	:: state
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
   115
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
   116
translations
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
   117
9498
b5d6db4111bc minor corrections
oheimb
parents: 9348
diff changeset
   118
  "NP"   == "NullPointer"
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
   119
  "tprg" == "[ObjectC, BaseC, ExtC]"
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   120
  "obj1"    <= "(Ext, empty((vee, Base)\<mapsto>Bool False)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   121
			   ((vee, Ext )\<mapsto>Intg #0))"
9793
2c3d4e03e00c isatool nonascii;
wenzelm
parents: 9498
diff changeset
   122
  "s0" == " Norm    (empty, empty)"
11026
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   123
  "s1" == " Norm    (empty(a\<mapsto>obj1),empty(e\<mapsto>Addr a))"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   124
  "s2" == " Norm    (empty(a\<mapsto>obj1),empty(x\<mapsto>Null)(This\<mapsto>Addr a))"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   125
  "s3" == "(Some NP, empty(a\<mapsto>obj1),empty(e\<mapsto>Addr a))"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   126
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   127
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   128
ML {* bind_thm ("map_of_Cons", hd (tl (thms "map_of.simps"))) *}
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   129
lemma map_of_Cons1 [simp]: "map_of ((aa,bb)#ps) aa = Some bb"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   130
apply (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   131
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   132
lemma map_of_Cons2 [simp]: "aa\<noteq>k ==> map_of ((k,bb)#ps) aa = map_of ps aa"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   133
apply (simp (no_asm_simp))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   134
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   135
declare map_of_Cons [simp del]; (* sic! *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   136
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   137
lemma class_tprg_Object [simp]: "class tprg Object = Some (arbitrary, [], [])"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   138
apply (unfold ObjectC_def class_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   139
apply (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   140
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   141
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   142
lemma class_tprg_Base [simp]: 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   143
"class tprg Base = Some (Object,  
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   144
	  [(vee, PrimT Boolean)],  
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   145
          [((foo, [Class Base]), Class Base, foo_Base)])"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   146
apply (unfold ObjectC_def BaseC_def ExtC_def class_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   147
apply (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   148
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   149
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   150
lemma class_tprg_Ext [simp]: 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   151
"class tprg Ext = Some (Base,  
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   152
	  [(vee, PrimT Integer)],  
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   153
          [((foo, [Class Base]), Class Ext, foo_Ext)])"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   154
apply (unfold ObjectC_def BaseC_def ExtC_def class_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   155
apply (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   156
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   157
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   158
lemma not_Object_subcls [elim!]: "(Object,C) \<in> (subcls1 tprg)^+ ==> R"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   159
apply (auto dest!: tranclD subcls1D)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   160
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   161
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   162
lemma subcls_ObjectD [dest!]: "tprg\<turnstile>Object\<preceq>C C ==> C = Object"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   163
apply (erule rtrancl_induct)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   164
apply  auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   165
apply (drule subcls1D)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   166
apply auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   167
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   168
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   169
lemma not_Base_subcls_Ext [elim!]: "(Base, Ext) \<in> (subcls1 tprg)^+ ==> R"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   170
apply (auto dest!: tranclD subcls1D)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   171
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   172
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   173
lemma class_tprgD: 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   174
"class tprg C = Some z ==> C=Object \<or> C=Base \<or> C=Ext"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   175
apply (unfold ObjectC_def BaseC_def ExtC_def class_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   176
apply (auto split add: split_if_asm simp add: map_of_Cons)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   177
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   178
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   179
lemma not_class_subcls_class [elim!]: "(C,C) \<in> (subcls1 tprg)^+ ==> R"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   180
apply (auto dest!: tranclD subcls1D)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   181
apply (frule class_tprgD)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   182
apply (auto dest!:)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   183
apply (drule rtranclD)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   184
apply auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   185
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   186
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   187
lemma unique_classes: "unique tprg"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   188
apply (simp (no_asm) add: ObjectC_def BaseC_def ExtC_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   189
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   190
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   191
lemmas subcls_direct = subcls1I [THEN r_into_rtrancl]
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   192
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   193
lemma Ext_subcls_Base [simp]: "tprg\<turnstile>Ext\<preceq>C Base"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   194
apply (rule subcls_direct)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   195
apply auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   196
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   197
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   198
lemma Ext_widen_Base [simp]: "tprg\<turnstile>Class Ext\<preceq> Class Base"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   199
apply (rule widen.subcls)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   200
apply (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   201
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   202
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   203
declare ty_expr_ty_exprs_wt_stmt.intros [intro!]
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   204
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   205
lemma acyclic_subcls1_: "acyclic (subcls1 tprg)"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   206
apply (rule acyclicI)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   207
apply safe
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   208
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   209
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   210
lemmas wf_subcls1_ = acyclic_subcls1_ [THEN finite_subcls1 [THEN finite_acyclic_wf_converse]]
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   211
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   212
lemmas fields_rec_ = wf_subcls1_ [THEN [2] fields_rec_lemma]
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   213
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   214
lemma fields_Object [simp]: "fields (tprg, Object) = []"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   215
apply (subst fields_rec_)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   216
apply   auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   217
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   218
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   219
declare is_class_def [simp]
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   220
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   221
lemma fields_Base [simp]: "fields (tprg,Base) = [((vee, Base), PrimT Boolean)]"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   222
apply (subst fields_rec_)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   223
apply   auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   224
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   225
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   226
lemma fields_Ext [simp]: 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   227
  "fields (tprg, Ext)  = [((vee, Ext ), PrimT Integer)] @ fields (tprg, Base)"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   228
apply (rule trans)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   229
apply  (rule fields_rec_)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   230
apply   auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   231
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   232
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   233
lemmas method_rec_ = wf_subcls1_ [THEN [2] method_rec_lemma]
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   234
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   235
lemma method_Object [simp]: "method (tprg,Object) = map_of []"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   236
apply (subst method_rec_)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   237
apply  auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   238
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   239
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   240
lemma method_Base [simp]: "method (tprg, Base) = map_of  
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   241
  [((foo, [Class Base]), Base, (Class Base, foo_Base))]"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   242
apply (rule trans)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   243
apply  (rule method_rec_)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   244
apply  auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   245
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   246
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   247
lemma method_Ext [simp]: "method (tprg, Ext) = (method (tprg, Base) ++ map_of  
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   248
  [((foo, [Class Base]), Ext , (Class Ext, foo_Ext))])"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   249
apply (rule trans)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   250
apply  (rule method_rec_)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   251
apply  auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   252
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   253
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   254
lemma wf_foo_Base: 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   255
"wf_mdecl wf_java_mdecl tprg Base ((foo, [Class Base]), (Class Base, foo_Base))"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   256
apply (unfold wf_mdecl_def wf_mhead_def wf_java_mdecl_def foo_Base_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   257
apply auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   258
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   259
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   260
lemma wf_foo_Ext: 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   261
"wf_mdecl wf_java_mdecl tprg Ext ((foo, [Class Base]), (Class Ext, foo_Ext))"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   262
apply (unfold wf_mdecl_def wf_mhead_def wf_java_mdecl_def foo_Ext_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   263
apply auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   264
apply  (rule ty_expr_ty_exprs_wt_stmt.Cast)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   265
prefer 2
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   266
apply   (simp)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   267
apply   (rule_tac [2] cast.subcls)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   268
apply   (unfold field_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   269
apply   auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   270
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   271
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   272
lemma wf_ObjectC: 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   273
"wf_cdecl wf_java_mdecl tprg ObjectC"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   274
apply (unfold wf_cdecl_def wf_fdecl_def ObjectC_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   275
apply (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   276
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   277
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   278
lemma wf_BaseC: 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   279
"wf_cdecl wf_java_mdecl tprg BaseC"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   280
apply (unfold wf_cdecl_def wf_fdecl_def BaseC_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   281
apply (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   282
apply (fold BaseC_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   283
apply (rule wf_foo_Base [THEN conjI])
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   284
apply auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   285
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   286
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   287
lemma wf_ExtC: 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   288
"wf_cdecl wf_java_mdecl tprg ExtC"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   289
apply (unfold wf_cdecl_def wf_fdecl_def ExtC_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   290
apply (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   291
apply (fold ExtC_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   292
apply (rule wf_foo_Ext [THEN conjI])
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   293
apply auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   294
apply (drule rtranclD)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   295
apply auto
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   296
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   297
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   298
lemma wf_tprg: 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   299
"wf_prog wf_java_mdecl tprg"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   300
apply (unfold wf_prog_def Let_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   301
apply(simp add: wf_ObjectC wf_BaseC wf_ExtC unique_classes)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   302
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   303
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   304
lemma appl_methds_foo_Base: 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   305
"appl_methds tprg Base (foo, [NT]) =  
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   306
  {((Class Base, Class Base), [Class Base])}"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   307
apply (unfold appl_methds_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   308
apply (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   309
apply (subgoal_tac "tprg\<turnstile>NT\<preceq> Class Base")
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   310
apply  (auto simp add: map_of_Cons foo_Base_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   311
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   312
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   313
lemma max_spec_foo_Base: "max_spec tprg Base (foo, [NT]) =  
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   314
  {((Class Base, Class Base), [Class Base])}"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   315
apply (unfold max_spec_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   316
apply (auto simp add: appl_methds_foo_Base)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   317
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   318
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   319
ML {* fun t thm = resolve_tac (thms "ty_expr_ty_exprs_wt_stmt.intros") 1 thm *}
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   320
lemma wt_test: "(tprg, empty(e\<mapsto>Class Base))\<turnstile>  
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   321
  Expr(e::=NewC Ext);; Expr({Base}LAcc e..foo({?pTs'}[Lit Null]))\<surd>"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   322
apply (tactic t) (* ;; *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   323
apply  (tactic t) (* Expr *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   324
apply  (tactic t) (* LAss *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   325
apply    (tactic t) (* LAcc *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   326
apply     (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   327
apply    (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   328
apply   (tactic t) (* NewC *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   329
apply   (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   330
apply  (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   331
apply (tactic t) (* Expr *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   332
apply (tactic t) (* Call *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   333
apply   (tactic t) (* LAcc *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   334
apply    (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   335
apply   (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   336
apply  (tactic t) (* Cons *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   337
apply   (tactic t) (* Lit *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   338
apply   (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   339
apply  (tactic t) (* Nil *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   340
apply (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   341
apply (rule max_spec_foo_Base)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   342
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   343
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   344
ML {* fun e t = resolve_tac (thm "NewCI"::thms "eval_evals_exec.intros") 1 t *}
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   345
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   346
declare split_if [split del]
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   347
declare init_vars_def [simp] c_hupd_def [simp] cast_ok_def [simp]
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   348
lemma exec_test: 
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   349
" [|new_Addr (heap (snd s0)) = (a, None)|] ==>  
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   350
  tprg\<turnstile>s0 -test-> ?s"
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   351
apply (unfold test_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   352
(* ?s = s3 *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   353
apply (tactic e) (* ;; *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   354
apply  (tactic e) (* Expr *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   355
apply  (tactic e) (* LAss *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   356
apply   (tactic e) (* NewC *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   357
apply    force
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   358
apply   force
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   359
apply  (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   360
apply (erule thin_rl)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   361
apply (tactic e) (* Expr *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   362
apply (tactic e) (* Call *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   363
apply       (tactic e) (* LAcc *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   364
apply      force
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   365
apply     (tactic e) (* Cons *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   366
apply      (tactic e) (* Lit *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   367
apply     (tactic e) (* Nil *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   368
apply    (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   369
apply   (force simp add: foo_Ext_def)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   370
apply  (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   371
apply  (tactic e) (* Expr *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   372
apply  (tactic e) (* FAss *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   373
apply       (tactic e) (* Cast *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   374
apply        (tactic e) (* LAcc *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   375
apply       (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   376
apply      (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   377
apply     (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   378
apply     (tactic e) (* XcptE *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   379
apply    (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   380
apply   (rule surjective_pairing [THEN sym, THEN[2]trans], subst Pair_eq, force)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   381
apply  (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   382
apply (simp (no_asm))
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   383
apply (tactic e) (* XcptE *)
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   384
done
a50365d21144 converted to Isar, simplifying recursion on class hierarchy
oheimb
parents: 10763
diff changeset
   385
9346
297dcbf64526 re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
diff changeset
   386
end