src/HOL/Bali/Type.thy
author haftmann
Fri Jun 17 16:12:49 2005 +0200 (2005-06-17)
changeset 16417 9bc16273c2d4
parent 14981 e73f8140af78
child 32960 69916a850301
permissions -rw-r--r--
migrated theory headers to new format
wenzelm@12857
     1
(*  Title:      HOL/Bali/Type.thy
schirmer@12854
     2
    ID:         $Id$
schirmer@12854
     3
    Author:     David von Oheimb
schirmer@12854
     4
*)
schirmer@12854
     5
schirmer@12854
     6
header {* Java types *}
schirmer@12854
     7
haftmann@16417
     8
theory Type imports Name begin
schirmer@12854
     9
schirmer@12854
    10
text {*
schirmer@12854
    11
simplifications:
schirmer@12854
    12
\begin{itemize}
schirmer@12854
    13
\item only the most important primitive types
schirmer@12854
    14
\item the null type is regarded as reference type
schirmer@12854
    15
\end{itemize}
schirmer@12854
    16
*}
schirmer@12854
    17
schirmer@13688
    18
datatype prim_ty       	--{* primitive type, cf. 4.2 *}
schirmer@13688
    19
	= Void    	--{* result type of void methods *}
schirmer@12854
    20
	| Boolean
schirmer@12854
    21
	| Integer
schirmer@12854
    22
schirmer@12854
    23
schirmer@13688
    24
datatype ref_ty		--{* reference type, cf. 4.3 *}
schirmer@13688
    25
	= NullT		--{* null type, cf. 4.1 *}
schirmer@13688
    26
	| IfaceT qtname	--{* interface type *}
schirmer@13688
    27
	| ClassT qtname	--{* class type *}
schirmer@13688
    28
	| ArrayT ty	--{* array type *}
schirmer@12854
    29
schirmer@13688
    30
and ty	    		--{* any type, cf. 4.1 *}
schirmer@13688
    31
	= PrimT prim_ty	--{* primitive type *}
schirmer@13688
    32
	| RefT  ref_ty	--{* reference type *}
schirmer@12854
    33
schirmer@12854
    34
translations
schirmer@12854
    35
  "prim_ty" <= (type) "Type.prim_ty"
schirmer@12854
    36
  "ref_ty"  <= (type) "Type.ref_ty"
schirmer@12854
    37
  "ty"      <= (type) "Type.ty"
schirmer@12854
    38
schirmer@12854
    39
syntax
schirmer@12854
    40
	 NT	:: "       \<spacespace> ty"
schirmer@12854
    41
	 Iface	:: "qtname  \<Rightarrow> ty"
schirmer@12854
    42
	 Class	:: "qtname  \<Rightarrow> ty"
schirmer@12854
    43
	 Array	:: "ty     \<Rightarrow> ty"	("_.[]" [90] 90)
schirmer@12854
    44
schirmer@12854
    45
translations
schirmer@12854
    46
	"NT"      == "RefT   NullT"
schirmer@12854
    47
	"Iface I" == "RefT (IfaceT I)"
schirmer@12854
    48
	"Class C" == "RefT (ClassT C)"
schirmer@12854
    49
	"T.[]"    == "RefT (ArrayT T)"
schirmer@12854
    50
schirmer@12854
    51
constdefs
schirmer@12854
    52
  the_Class :: "ty \<Rightarrow> qtname"
wenzelm@14766
    53
 "the_Class T \<equiv> SOME C. T = Class C" (** primrec not possible here **)
schirmer@12854
    54
 
schirmer@12854
    55
lemma the_Class_eq [simp]: "the_Class (Class C)= C"
schirmer@12854
    56
by (auto simp add: the_Class_def)
schirmer@12854
    57
schirmer@12854
    58
end