src/HOL/MicroJava/J/WellType.thy
author oheimb
Tue, 04 Jul 2000 10:54:32 +0200
changeset 9240 f4d76cb26433
parent 8178 a6a4fb7b819b
child 9246 91423cd08c6f
permissions -rw-r--r--
added BinOp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/MicroJava/J/WellType.thy
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
     2
    ID:         $Id$
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
     3
    Author:     David von Oheimb
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
     4
    Copyright   1999 Technische Universitaet Muenchen
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
     5
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
     6
Well-typedness of Java programs
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
     7
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
     8
the formulation of well-typedness of method calls given below (as well as
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
     9
the Java Specification 1.0) is a little too restrictive: Is does not allow
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    10
methods of class Object to be called upon references of interface type.
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    11
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    12
simplifications:
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    13
* the type rules include all static checks on expressions and statements, e.g.
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    14
  definedness of names (of parameters, locals, fields, methods)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    15
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    16
*)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    17
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    18
WellType = Term + WellForm +
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    19
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    20
types	lenv (* local variables, including method parameters and This *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    21
	= "vname \\<leadsto> ty"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    22
        'c env
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    23
	= "'c prog \\<times> lenv"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    24
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    25
syntax
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    26
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    27
  prg		:: "'c env \\<Rightarrow> 'c prog"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    28
  localT	:: "'c env \\<Rightarrow> (vname \\<leadsto> ty)"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    29
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    30
translations	
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    31
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    32
  "prg"		=> "fst"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    33
  "localT"	=> "snd"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    34
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    35
consts
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    36
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    37
  more_spec	:: "'c prog \\<Rightarrow> (ty \\<times> 'x) \\<times> ty list \\<Rightarrow>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    38
		               (ty \\<times> 'x) \\<times> ty list \\<Rightarrow> bool"
8085
dce06445aafd new arg type for max_spec etc.
oheimb
parents: 8082
diff changeset
    39
  appl_methds	:: "'c prog \\<Rightarrow>  cname \\<Rightarrow> sig \\<Rightarrow> ((ty \\<times> ty) \\<times> ty list) set"
dce06445aafd new arg type for max_spec etc.
oheimb
parents: 8082
diff changeset
    40
  max_spec	:: "'c prog \\<Rightarrow>  cname \\<Rightarrow> sig \\<Rightarrow> ((ty \\<times> ty) \\<times> ty list) set"
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    41
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    42
defs
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    43
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    44
  more_spec_def	  "more_spec G \\<equiv> \\<lambda>((d,h),pTs). \\<lambda>((d',h'),pTs'). G\\<turnstile>d\\<preceq>d' \\<and>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    45
		                  list_all2 (\\<lambda>T T'. G\\<turnstile>T\\<preceq>T') pTs pTs'"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    46
  
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    47
  (* applicable methods, cf. 15.11.2.1 *)
8105
2dda3e88d23f simplified definition of appl_methds, removing m_head
oheimb
parents: 8085
diff changeset
    48
  appl_methds_def "appl_methds G C \\<equiv> \\<lambda>(mn, pTs).
2dda3e88d23f simplified definition of appl_methds, removing m_head
oheimb
parents: 8085
diff changeset
    49
		                 {((Class md,rT),pTs') |md rT mb pTs'.
2dda3e88d23f simplified definition of appl_methds, removing m_head
oheimb
parents: 8085
diff changeset
    50
		                  method (G,C)  (mn, pTs') = Some (md,rT,mb) \\<and>
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    51
		                  list_all2 (\\<lambda>T T'. G\\<turnstile>T\\<preceq>T') pTs pTs'}"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    52
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    53
  (* maximally specific methods, cf. 15.11.2.2 *)
8085
dce06445aafd new arg type for max_spec etc.
oheimb
parents: 8082
diff changeset
    54
   max_spec_def	  "max_spec G C sig \\<equiv> {m. m \\<in>appl_methds G C sig \\<and> 
dce06445aafd new arg type for max_spec etc.
oheimb
parents: 8082
diff changeset
    55
				          (\\<forall>m'\\<in>appl_methds G C sig.
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    56
				                   more_spec G m' m \\<longrightarrow> m' = m)}"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    57
consts
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    58
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    59
  typeof :: "(loc \\<Rightarrow> ty option) \\<Rightarrow> val \\<Rightarrow> ty option"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    60
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    61
primrec
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    62
	"typeof dt  Unit    = Some (PrimT Void)"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    63
	"typeof dt  Null    = Some NT"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    64
	"typeof dt (Bool b) = Some (PrimT Boolean)"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    65
	"typeof dt (Intg i) = Some (PrimT Integer)"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    66
	"typeof dt (Addr a) = dt a"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    67
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    68
types
8082
381716a86fcb removed inj_eq from the default simpset again
oheimb
parents: 8034
diff changeset
    69
	java_mb = "vname list \\<times> (vname \\<times> ty) list \\<times> stmt \\<times> expr"
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    70
	(* method body with parameter names, local variables, block, result expression *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    71
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    72
consts
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    73
8082
381716a86fcb removed inj_eq from the default simpset again
oheimb
parents: 8034
diff changeset
    74
  ty_expr :: "java_mb env \\<Rightarrow> (expr      \\<times> ty     ) set"
381716a86fcb removed inj_eq from the default simpset again
oheimb
parents: 8034
diff changeset
    75
  ty_exprs:: "java_mb env \\<Rightarrow> (expr list \\<times> ty list) set"
381716a86fcb removed inj_eq from the default simpset again
oheimb
parents: 8034
diff changeset
    76
  wt_stmt :: "java_mb env \\<Rightarrow>  stmt                 set"
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    77
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    78
syntax
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    79
8082
381716a86fcb removed inj_eq from the default simpset again
oheimb
parents: 8034
diff changeset
    80
ty_expr :: "java_mb env \\<Rightarrow> [expr     , ty     ] \\<Rightarrow> bool" ("_\\<turnstile>_\\<Colon>_"  [51,51,51]50)
381716a86fcb removed inj_eq from the default simpset again
oheimb
parents: 8034
diff changeset
    81
ty_exprs:: "java_mb env \\<Rightarrow> [expr list, ty list] \\<Rightarrow> bool" ("_\\<turnstile>_[\\<Colon>]_"[51,51,51]50)
381716a86fcb removed inj_eq from the default simpset again
oheimb
parents: 8034
diff changeset
    82
wt_stmt :: "java_mb env \\<Rightarrow>  stmt                \\<Rightarrow> bool" ("_\\<turnstile>_ \\<surd>" [51,51   ]50)
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    83
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    84
translations
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    85
	"E\\<turnstile>e \\<Colon> T" == "(e,T) \\<in> ty_expr  E"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    86
	"E\\<turnstile>e[\\<Colon>]T" == "(e,T) \\<in> ty_exprs E"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    87
	"E\\<turnstile>c \\<surd>"    == "c     \\<in> wt_stmt  E"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    88
  
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    89
inductive "ty_expr E" "ty_exprs E" "wt_stmt E" intrs
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    90
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    91
(* well-typed expressions *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    92
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    93
  (* cf. 15.8 *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    94
  NewC	"\\<lbrakk>is_class (prg E) C\\<rbrakk> \\<Longrightarrow>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    95
						 E\\<turnstile>NewC C\\<Colon>Class C"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    96
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    97
  (* cf. 15.15 *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    98
  Cast	"\\<lbrakk>E\\<turnstile>e\\<Colon>T;
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
    99
	  prg E\\<turnstile>T\\<Rightarrow>? T'\\<rbrakk> \\<Longrightarrow>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   100
						 E\\<turnstile>Cast T' e\\<Colon>T'"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   101
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   102
  (* cf. 15.7.1 *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   103
  Lit	"\\<lbrakk>typeof (\\<lambda>v. None) x = Some T\\<rbrakk> \\<Longrightarrow>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   104
						 E\\<turnstile>Lit x\\<Colon>T"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   105
9240
f4d76cb26433 added BinOp
oheimb
parents: 8178
diff changeset
   106
  
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   107
  (* cf. 15.13.1 *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   108
  LAcc	"\\<lbrakk>localT E v = Some T; is_type (prg E) T\\<rbrakk> \\<Longrightarrow>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   109
						 E\\<turnstile>LAcc v\\<Colon>T"
9240
f4d76cb26433 added BinOp
oheimb
parents: 8178
diff changeset
   110
f4d76cb26433 added BinOp
oheimb
parents: 8178
diff changeset
   111
  BinOp "\\<lbrakk>E\\<turnstile>e1\\<Colon>T;
f4d76cb26433 added BinOp
oheimb
parents: 8178
diff changeset
   112
	  E\\<turnstile>e2\\<Colon>T;
f4d76cb26433 added BinOp
oheimb
parents: 8178
diff changeset
   113
	  if bop = Eq then T' = PrimT Boolean
f4d76cb26433 added BinOp
oheimb
parents: 8178
diff changeset
   114
	              else T' = T \\<and> T = PrimT Integer\\<rbrakk> \\<Longrightarrow>
f4d76cb26433 added BinOp
oheimb
parents: 8178
diff changeset
   115
						 E\\<turnstile>BinOp bop e1 e2\\<Colon>T'"
f4d76cb26433 added BinOp
oheimb
parents: 8178
diff changeset
   116
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   117
  (* cf. 15.25, 15.25.1 *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   118
  LAss  "\\<lbrakk>E\\<turnstile>LAcc v\\<Colon>T;
9240
f4d76cb26433 added BinOp
oheimb
parents: 8178
diff changeset
   119
	  E\\<turnstile>e\\<Colon>T';
f4d76cb26433 added BinOp
oheimb
parents: 8178
diff changeset
   120
	  prg E\\<turnstile>T'\\<preceq>T\\<rbrakk> \\<Longrightarrow>
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   121
						 E\\<turnstile>v\\<Colon>=e\\<Colon>T'"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   122
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   123
  (* cf. 15.10.1 *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   124
  FAcc	"\\<lbrakk>E\\<turnstile>a\\<Colon>Class C; 
8034
6fc37b5c5e98 Various little changes like cmethd -> method and cfield -> field.
nipkow
parents: 8011
diff changeset
   125
	  field (prg E,C) fn = Some (fd,fT)\\<rbrakk> \\<Longrightarrow>
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   126
						 E\\<turnstile>{fd}a..fn\\<Colon>fT"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   127
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   128
  (* cf. 15.25, 15.25.1 *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   129
  FAss  "\\<lbrakk>E\\<turnstile>{fd}a..fn\\<Colon>T;
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   130
	  E\\<turnstile>v       \\<Colon>T';
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   131
	  prg E\\<turnstile>T'\\<preceq>T\\<rbrakk> \\<Longrightarrow>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   132
					 	 E\\<turnstile>{fd}a..fn\\<in>=v\\<Colon>T'"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   133
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   134
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   135
  (* cf. 15.11.1, 15.11.2, 15.11.3 *)
8085
dce06445aafd new arg type for max_spec etc.
oheimb
parents: 8082
diff changeset
   136
  Call	"\\<lbrakk>E\\<turnstile>a\\<Colon>Class C;
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   137
	  E\\<turnstile>ps[\\<Colon>]pTs;
8085
dce06445aafd new arg type for max_spec etc.
oheimb
parents: 8082
diff changeset
   138
	  max_spec (prg E) C (mn, pTs) = {((md,rT),pTs')}\\<rbrakk> \\<Longrightarrow>
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   139
						 E\\<turnstile>a..mn({pTs'}ps)\\<Colon>rT"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   140
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   141
(* well-typed expression lists *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   142
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   143
  (* cf. 15.11.??? *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   144
  Nil						"E\\<turnstile>[][\\<Colon>][]"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   145
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   146
  (* cf. 15.11.??? *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   147
  Cons	"\\<lbrakk>E\\<turnstile>e\\<Colon>T;
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   148
	   E\\<turnstile>es[\\<Colon>]Ts\\<rbrakk> \\<Longrightarrow>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   149
						 E\\<turnstile>e#es[\\<Colon>]T#Ts"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   150
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   151
(* well-typed statements *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   152
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   153
  Skip					"E\\<turnstile>Skip\\<surd>"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   154
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   155
  Expr	"\\<lbrakk>E\\<turnstile>e\\<Colon>T\\<rbrakk> \\<Longrightarrow>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   156
					 E\\<turnstile>Expr e\\<surd>"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   157
9240
f4d76cb26433 added BinOp
oheimb
parents: 8178
diff changeset
   158
  Comp	"\\<lbrakk>E\\<turnstile>s1\\<surd>; 
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   159
	  E\\<turnstile>s2\\<surd>\\<rbrakk> \\<Longrightarrow>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   160
					 E\\<turnstile>s1;; s2\\<surd>"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   161
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   162
  (* cf. 14.8 *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   163
  Cond	"\\<lbrakk>E\\<turnstile>e\\<Colon>PrimT Boolean;
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   164
	  E\\<turnstile>s1\\<surd>;
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   165
	  E\\<turnstile>s2\\<surd>\\<rbrakk> \\<Longrightarrow>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   166
					 E\\<turnstile>If(e) s1 Else s2\\<surd>"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   167
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   168
  (* cf. 14.10 *)
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   169
  Loop "\\<lbrakk>E\\<turnstile>e\\<Colon>PrimT Boolean;
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   170
	 E\\<turnstile>s\\<surd>\\<rbrakk> \\<Longrightarrow>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   171
					 E\\<turnstile>While(e) s\\<surd>"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   172
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   173
constdefs
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   174
8082
381716a86fcb removed inj_eq from the default simpset again
oheimb
parents: 8034
diff changeset
   175
 wf_java_mdecl :: java_mb prog => cname => java_mb mdecl => bool
381716a86fcb removed inj_eq from the default simpset again
oheimb
parents: 8034
diff changeset
   176
"wf_java_mdecl G C \\<equiv> \\<lambda>((mn,pTs),rT,(pns,lvars,blk,res)).
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   177
	length pTs = length pns \\<and>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   178
	nodups pns \\<and>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   179
	unique lvars \\<and>
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   180
	(\\<forall>pn\\<in>set pns. map_of lvars pn = None) \\<and>
8178
a6a4fb7b819b eliminated nonascii;
wenzelm
parents: 8105
diff changeset
   181
	(\\<forall>(vn,T)\\<in>set lvars. is_type G T) &
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   182
	(let E = (G,map_of lvars(pns[\\<mapsto>]pTs)(This\\<mapsto>Class C)) in
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   183
	 E\\<turnstile>blk\\<surd> \\<and> (\\<exists>T. E\\<turnstile>res\\<Colon>T \\<and> G\\<turnstile>T\\<preceq>rT))"
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   184
8082
381716a86fcb removed inj_eq from the default simpset again
oheimb
parents: 8034
diff changeset
   185
 wf_java_prog :: java_mb prog => bool
381716a86fcb removed inj_eq from the default simpset again
oheimb
parents: 8034
diff changeset
   186
"wf_java_prog G \\<equiv> wf_prog wf_java_mdecl G"
8011
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   187
d14c4e9e9c8e *** empty log message ***
nipkow
parents:
diff changeset
   188
end