author | haftmann |
Tue, 24 Nov 2009 14:37:23 +0100 | |
changeset 33954 | 1bc3b688548c |
parent 18551 | be0705186ff5 |
child 35416 | d8d7d1b785af |
permissions | -rwxr-xr-x |
8011 | 1 |
(* Title: HOL/MicroJava/J/Decl.thy |
2 |
ID: $Id$ |
|
3 |
Author: David von Oheimb |
|
11372 | 4 |
Copyright 1999 Technische Universitaet Muenchen |
11070 | 5 |
*) |
8011 | 6 |
|
12911 | 7 |
header {* \isaheader{Class Declarations and Programs} *} |
8011 | 8 |
|
16417 | 9 |
theory Decl imports Type begin |
8011 | 10 |
|
12517 | 11 |
types |
12 |
fdecl = "vname \<times> ty" -- "field declaration, cf. 8.3 (, 9.3)" |
|
13 |
||
14 |
sig = "mname \<times> ty list" -- "signature of a method, cf. 8.4.2" |
|
15 |
||
16 |
'c mdecl = "sig \<times> ty \<times> 'c" -- "method declaration in a class" |
|
17 |
||
18551 | 18 |
'c "class" = "cname \<times> fdecl list \<times> 'c mdecl list" |
12517 | 19 |
-- "class = superclass, fields, methods" |
20 |
||
21 |
'c cdecl = "cname \<times> 'c class" -- "class declaration, cf. 8.1" |
|
22 |
||
23 |
'c prog = "'c cdecl list" -- "program" |
|
8011 | 24 |
|
25 |
||
10613
78b1d6c3ee9c
improved superclass entry for classes and definition status of is_class, class
oheimb
parents:
10042
diff
changeset
|
26 |
translations |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
27 |
"fdecl" <= (type) "vname \<times> ty" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
28 |
"sig" <= (type) "mname \<times> ty list" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
29 |
"mdecl c" <= (type) "sig \<times> ty \<times> c" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
30 |
"class c" <= (type) "cname \<times> fdecl list \<times> (c mdecl) list" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
31 |
"cdecl c" <= (type) "cname \<times> (c class)" |
10613
78b1d6c3ee9c
improved superclass entry for classes and definition status of is_class, class
oheimb
parents:
10042
diff
changeset
|
32 |
"prog c" <= (type) "(c cdecl) list" |
78b1d6c3ee9c
improved superclass entry for classes and definition status of is_class, class
oheimb
parents:
10042
diff
changeset
|
33 |
|
9346
297dcbf64526
re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
8011
diff
changeset
|
34 |
|
12517 | 35 |
constdefs |
18551 | 36 |
"class" :: "'c prog => (cname \<rightharpoonup> 'c class)" |
12517 | 37 |
"class \<equiv> map_of" |
38 |
||
39 |
is_class :: "'c prog => cname => bool" |
|
40 |
"is_class G C \<equiv> class G C \<noteq> None" |
|
41 |
||
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
42 |
|
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
43 |
lemma finite_is_class: "finite {C. is_class G C}" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
44 |
apply (unfold is_class_def class_def) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
45 |
apply (fold dom_def) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
46 |
apply (rule finite_dom_map_of) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
47 |
done |
9346
297dcbf64526
re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
8011
diff
changeset
|
48 |
|
10613
78b1d6c3ee9c
improved superclass entry for classes and definition status of is_class, class
oheimb
parents:
10042
diff
changeset
|
49 |
consts |
12517 | 50 |
is_type :: "'c prog => ty => bool" |
9346
297dcbf64526
re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
8011
diff
changeset
|
51 |
primrec |
12517 | 52 |
"is_type G (PrimT pt) = True" |
53 |
"is_type G (RefT t) = (case t of NullT => True | ClassT C => is_class G C)" |
|
9346
297dcbf64526
re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
8011
diff
changeset
|
54 |
|
8011 | 55 |
end |