11376
|
1 |
(* Title: HOL/NanoJava/Term.thy
|
|
2 |
ID: $Id$
|
|
3 |
Author: David von Oheimb
|
|
4 |
Copyright 2001 Technische Universitaet Muenchen
|
|
5 |
*)
|
|
6 |
|
|
7 |
header "Statements and expression emulations"
|
|
8 |
|
|
9 |
theory Term = Main:
|
|
10 |
|
|
11 |
typedecl cname (* class name *)
|
|
12 |
typedecl vnam (* variable or field name *)
|
|
13 |
typedecl mname (* method name *)
|
|
14 |
arities cname :: "term"
|
|
15 |
vnam :: "term"
|
|
16 |
mname :: "term"
|
|
17 |
|
|
18 |
datatype vname (* variable for special names *)
|
|
19 |
= This (* This pointer *)
|
|
20 |
| Param (* method parameter *)
|
|
21 |
| Res (* method result *)
|
|
22 |
| VName vnam
|
|
23 |
|
|
24 |
datatype stmt
|
|
25 |
= Skip (* empty statement *)
|
11476
|
26 |
| Comp stmt stmt ("_;; _" [91,90 ] 90)
|
|
27 |
| Cond expr stmt stmt ("If '(_') _ Else _" [99,91,91] 91)
|
11376
|
28 |
| Loop vname stmt ("While '(_') _" [99,91 ] 91)
|
11476
|
29 |
| LAss vname expr ("_ :== _" [99, 95] 94) (* local ass. *)
|
|
30 |
| FAss expr vnam expr ("_.._:==_" [95,99,95] 94) (* field ass. *)
|
11376
|
31 |
| Meth cname mname (* virtual method *)
|
|
32 |
| Impl cname mname (* method implementation *)
|
11476
|
33 |
and expr
|
|
34 |
= NewC cname ("new _" [ 99] 95) (* object creation *)
|
|
35 |
| Cast cname expr (* type cast *)
|
|
36 |
| LAcc vname (* local access *)
|
|
37 |
| FAcc expr vnam ("_.._" [95,99] 95) (* field access *)
|
|
38 |
| Call cname expr mname expr (* method call *)
|
|
39 |
("{_}_.._'(_')" [99,95,99,95] 95)
|
11376
|
40 |
|
11476
|
41 |
|
11376
|
42 |
lemma pair_imageI [intro]: "(a, b) \<in> A ==> f a b : (%(a, b). f a b) ` A"
|
|
43 |
apply (rule_tac x = "(a,b)" in image_eqI)
|
|
44 |
apply auto
|
|
45 |
done
|
|
46 |
|
|
47 |
end
|
|
48 |
|