482
|
1 |
(* Title: ZF/IMP/Denotation.ML
|
|
2 |
ID: $Id$
|
|
3 |
Author: Heiko Loetzbeyer & Robert Sandner, TUM
|
|
4 |
Copyright 1994 TUM
|
|
5 |
*)
|
|
6 |
|
|
7 |
open Denotation;
|
|
8 |
|
511
|
9 |
(**** Rewrite Rules for A,B,C ****)
|
482
|
10 |
|
|
11 |
val A_rewrite_rules =
|
|
12 |
[A_nat_def,A_loc_def,A_op1_def,A_op2_def];
|
|
13 |
|
|
14 |
val B_rewrite_rules =
|
|
15 |
[B_true_def,B_false_def,B_op_def,B_not_def,B_and_def,B_or_def]
|
|
16 |
|
|
17 |
val C_rewrite_rules =
|
|
18 |
[C_skip_def,C_assign_def,C_comp_def,C_if_def,C_while_def];
|
|
19 |
|
|
20 |
(**** Type_intr for A ****)
|
|
21 |
|
|
22 |
val A_type = prove_goal Denotation.thy
|
|
23 |
"!!a.[|a:aexp; sigma:loc->nat|] ==> A(a,sigma):nat"
|
511
|
24 |
(fn _ => [(etac aexp.induct 1),
|
482
|
25 |
(rewrite_goals_tac A_rewrite_rules),
|
|
26 |
(ALLGOALS (fast_tac (ZF_cs addSIs [apply_type])))]);
|
|
27 |
|
|
28 |
(**** Type_intr for B ****)
|
|
29 |
|
|
30 |
val B_type = prove_goal Denotation.thy
|
|
31 |
"!!b. [|b:bexp; sigma:loc->nat|] ==> B(b,sigma):bool"
|
511
|
32 |
(fn _ => [(etac bexp.induct 1),
|
482
|
33 |
(rewrite_goals_tac B_rewrite_rules),
|
|
34 |
(ALLGOALS (fast_tac (ZF_cs
|
|
35 |
addSIs [apply_type,A_type]@bool_typechecks)))]);
|
|
36 |
|
|
37 |
(**** C_subset ****)
|
|
38 |
|
|
39 |
val C_subset = prove_goal Denotation.thy
|
|
40 |
"!!c. c:com ==> C(c) <= (loc->nat)*(loc->nat)"
|
511
|
41 |
(fn _ => [(etac com.induct 1),
|
482
|
42 |
(rewrite_tac C_rewrite_rules),
|
|
43 |
(ALLGOALS (fast_tac (comp_cs addDs [lfp_subset RS subsetD])))]);
|
|
44 |
|
|
45 |
(**** Type_elims for C ****)
|
|
46 |
|
|
47 |
val C_type = prove_goal Denotation.thy
|
|
48 |
"[| <x,y>:C(c); c:com; \
|
|
49 |
\ !!c. [| x:loc->nat; y:loc->nat |] ==> R |] \
|
|
50 |
\ ==> R"
|
|
51 |
(fn prems => [(cut_facts_tac prems 1),
|
|
52 |
(fast_tac (ZF_cs addSIs prems
|
|
53 |
addDs [(C_subset RS subsetD)]) 1)]);
|
|
54 |
|
|
55 |
val C_type_fst = prove_goal Denotation.thy
|
|
56 |
"[| x:C(c); c:com; \
|
|
57 |
\ !!c. [| fst(x):loc->nat |] ==> R |] \
|
|
58 |
\ ==> R"
|
|
59 |
(fn prems => [(cut_facts_tac prems 1),
|
|
60 |
(resolve_tac prems 1),
|
|
61 |
(dtac (C_subset RS subsetD) 1),
|
|
62 |
(atac 1),
|
|
63 |
(etac SigmaE 1),
|
|
64 |
(asm_simp_tac ZF_ss 1)]);
|
|
65 |
|
|
66 |
|
|
67 |
(**** bnd_mono (nat->nat*nat->nat,Gamma(b,c) ****)
|
|
68 |
|
|
69 |
val Gamma_bnd_mono = prove_goalw Denotation.thy [bnd_mono_def,Gamma_def]
|
|
70 |
"!!c. c:com ==> bnd_mono ((loc->nat)*(loc->nat),Gamma(b,c))"
|
500
|
71 |
(fn prems => [(best_tac (comp_cs addEs [C_type]) 1)]);
|
482
|
72 |
|
|
73 |
(**** End ***)
|