src/HOL/Bali/Type.thy
author wenzelm
Sun, 02 Nov 2014 18:16:19 +0100
changeset 58887 38db8ddc0f57
parent 58310 91ea607a34d8
child 62042 6c6ccf573479
permissions -rw-r--r--
modernized header;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12857
a4386cc9b1c3 tuned header;
wenzelm
parents: 12854
diff changeset
     1
(*  Title:      HOL/Bali/Type.thy
12854
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
     2
    Author:     David von Oheimb
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
     3
*)
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
     4
58887
38db8ddc0f57 modernized header;
wenzelm
parents: 58310
diff changeset
     5
subsection {* Java types *}
12854
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
     6
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 14981
diff changeset
     7
theory Type imports Name begin
12854
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
     8
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
     9
text {*
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    10
simplifications:
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    11
\begin{itemize}
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    12
\item only the most important primitive types
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    13
\item the null type is regarded as reference type
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    14
\end{itemize}
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    15
*}
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    16
58310
91ea607a34d8 updated news
blanchet
parents: 58249
diff changeset
    17
datatype prim_ty        --{* primitive type, cf. 4.2 *}
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 16417
diff changeset
    18
        = Void          --{* result type of void methods *}
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 16417
diff changeset
    19
        | Boolean
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 16417
diff changeset
    20
        | Integer
12854
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    21
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    22
58310
91ea607a34d8 updated news
blanchet
parents: 58249
diff changeset
    23
datatype ref_ty         --{* reference type, cf. 4.3 *}
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 16417
diff changeset
    24
        = NullT         --{* null type, cf. 4.1 *}
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 16417
diff changeset
    25
        | IfaceT qtname --{* interface type *}
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 16417
diff changeset
    26
        | ClassT qtname --{* class type *}
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 16417
diff changeset
    27
        | ArrayT ty     --{* array type *}
12854
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    28
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 16417
diff changeset
    29
and ty                  --{* any type, cf. 4.1 *}
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 16417
diff changeset
    30
        = PrimT prim_ty --{* primitive type *}
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 16417
diff changeset
    31
        | RefT  ref_ty  --{* reference type *}
12854
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    32
35067
af4c18c30593 modernized syntax translations, using mostly abbreviation/notation;
wenzelm
parents: 32960
diff changeset
    33
abbreviation "NT == RefT NullT"
af4c18c30593 modernized syntax translations, using mostly abbreviation/notation;
wenzelm
parents: 32960
diff changeset
    34
abbreviation "Iface I == RefT (IfaceT I)"
af4c18c30593 modernized syntax translations, using mostly abbreviation/notation;
wenzelm
parents: 32960
diff changeset
    35
abbreviation "Class C == RefT (ClassT C)"
af4c18c30593 modernized syntax translations, using mostly abbreviation/notation;
wenzelm
parents: 32960
diff changeset
    36
abbreviation Array :: "ty \<Rightarrow> ty"  ("_.[]" [90] 90)
af4c18c30593 modernized syntax translations, using mostly abbreviation/notation;
wenzelm
parents: 32960
diff changeset
    37
  where "T.[] == RefT (ArrayT T)"
12854
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    38
37956
ee939247b2fb modernized/unified some specifications;
wenzelm
parents: 35431
diff changeset
    39
definition
ee939247b2fb modernized/unified some specifications;
wenzelm
parents: 35431
diff changeset
    40
  the_Class :: "ty \<Rightarrow> qtname"
ee939247b2fb modernized/unified some specifications;
wenzelm
parents: 35431
diff changeset
    41
  where "the_Class T = (SOME C. T = Class C)" (** primrec not possible here **)
12854
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    42
 
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    43
lemma the_Class_eq [simp]: "the_Class (Class C)= C"
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    44
by (auto simp add: the_Class_def)
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    45
00d4a435777f Isabelle/Bali sources;
schirmer
parents:
diff changeset
    46
end