author | kleing |
Sun, 16 Dec 2001 00:18:17 +0100 | |
changeset 12517 | 360e3215f029 |
parent 11372 | 648795477bb5 |
child 12911 | 704713ca07ea |
permissions | -rw-r--r-- |
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 |
|
12517 | 7 |
header "Class Declarations and Programs" |
8011 | 8 |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
9 |
theory Decl = Type: |
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 |
||
18 |
'c class = "cname \<times> fdecl list \<times> 'c mdecl list" |
|
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 |
||
12517 | 26 |
constdefs |
27 |
ObjectC :: "'c cdecl" -- "decl of root class" |
|
28 |
"ObjectC \<equiv> (Object, (arbitrary, [], []))" |
|
9346
297dcbf64526
re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
8011
diff
changeset
|
29 |
|
10613
78b1d6c3ee9c
improved superclass entry for classes and definition status of is_class, class
oheimb
parents:
10042
diff
changeset
|
30 |
|
78b1d6c3ee9c
improved superclass entry for classes and definition status of is_class, class
oheimb
parents:
10042
diff
changeset
|
31 |
translations |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
32 |
"fdecl" <= (type) "vname \<times> ty" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
33 |
"sig" <= (type) "mname \<times> ty list" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
34 |
"mdecl c" <= (type) "sig \<times> ty \<times> c" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
35 |
"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
|
36 |
"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
|
37 |
"prog c" <= (type) "(c cdecl) list" |
78b1d6c3ee9c
improved superclass entry for classes and definition status of is_class, class
oheimb
parents:
10042
diff
changeset
|
38 |
|
9346
297dcbf64526
re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
8011
diff
changeset
|
39 |
|
12517 | 40 |
constdefs |
41 |
class :: "'c prog => (cname \<leadsto> 'c class)" |
|
42 |
"class \<equiv> map_of" |
|
43 |
||
44 |
is_class :: "'c prog => cname => bool" |
|
45 |
"is_class G C \<equiv> class G C \<noteq> None" |
|
46 |
||
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
47 |
|
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
48 |
lemma finite_is_class: "finite {C. is_class G C}" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
49 |
apply (unfold is_class_def class_def) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
50 |
apply (fold dom_def) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
51 |
apply (rule finite_dom_map_of) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10925
diff
changeset
|
52 |
done |
9346
297dcbf64526
re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
8011
diff
changeset
|
53 |
|
10613
78b1d6c3ee9c
improved superclass entry for classes and definition status of is_class, class
oheimb
parents:
10042
diff
changeset
|
54 |
consts |
12517 | 55 |
is_type :: "'c prog => ty => bool" |
9346
297dcbf64526
re-structuring MicroJava; added Example; corrected := syntax; simplfied cast
oheimb
parents:
8011
diff
changeset
|
56 |
primrec |
12517 | 57 |
"is_type G (PrimT pt) = True" |
58 |
"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
|
59 |
|
8011 | 60 |
end |