author | paulson |
Tue, 16 Jul 1996 15:49:46 +0200 | |
changeset 1868 | 836950047d85 |
parent 1731 | 2ad693c6cb13 |
child 1973 | 8c94c9a5be10 |
permissions | -rw-r--r-- |
1465 | 1 |
(* Title: HOL/IMP/Denotation.ML |
924
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
2 |
ID: $Id$ |
1696 | 3 |
Author: Heiko Loetzbeyer & Robert Sandner & Tobias Nipkow, TUM |
924
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
4 |
Copyright 1994 TUM |
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
5 |
*) |
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
6 |
|
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
7 |
open Denotation; |
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
8 |
|
1696 | 9 |
val denotation_cs = comp_cs addss (!simpset addsimps evalc.intrs); |
924
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
10 |
|
1696 | 11 |
|
12 |
(**** Rewrite Rules for C ****) |
|
924
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
13 |
|
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
14 |
val C_simps = map (fn t => t RS eq_reflection) |
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
15 |
[C_skip,C_assign,C_comp,C_if,C_while]; |
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
16 |
|
1696 | 17 |
|
924
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
18 |
(**** mono (Gamma(b,c)) ****) |
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
19 |
|
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
20 |
qed_goalw "Gamma_mono" Denotation.thy [mono_def,Gamma_def] |
1465 | 21 |
"mono (Gamma b c)" |
924
806721cfbf46
new version of HOL/IMP with curried function application
clasohm
parents:
diff
changeset
|
22 |
(fn _ => [(best_tac comp_cs 1)]); |
1481 | 23 |
|
1696 | 24 |
|
25 |
goal Denotation.thy "C(WHILE b DO c) = C(IF b THEN c;WHILE b DO c ELSE SKIP)"; |
|
1481 | 26 |
by(Simp_tac 1); |
1696 | 27 |
by(EVERY[stac (Gamma_mono RS lfp_Tarski) 1, |
28 |
stac (Gamma_def RS meta_eq_to_obj_eq RS fun_cong) 1, |
|
29 |
Simp_tac 1, |
|
30 |
IF_UNSOLVED no_tac]); |
|
1481 | 31 |
qed "C_While_If"; |
32 |
||
1696 | 33 |
|
34 |
(* Operational Semantics implies Denotational Semantics *) |
|
35 |
||
1731 | 36 |
goal Denotation.thy "!!c s t. <c,s> -c-> t ==> (s,t) : C(c)"; |
1696 | 37 |
|
38 |
(* start with rule induction *) |
|
1731 | 39 |
by (etac evalc.induct 1); |
1696 | 40 |
by (rewrite_tac (Gamma_def::C_simps)); |
41 |
(* simplification with HOL_ss too agressive *) |
|
42 |
(* skip *) |
|
43 |
by (fast_tac denotation_cs 1); |
|
44 |
(* assign *) |
|
45 |
by (fast_tac denotation_cs 1); |
|
46 |
(* comp *) |
|
47 |
by (fast_tac denotation_cs 1); |
|
48 |
(* if *) |
|
49 |
by (fast_tac denotation_cs 1); |
|
50 |
by (fast_tac denotation_cs 1); |
|
51 |
(* while *) |
|
52 |
by (rtac (rewrite_rule [Gamma_def] (Gamma_mono RS lfp_Tarski RS ssubst)) 1); |
|
53 |
by (fast_tac denotation_cs 1); |
|
54 |
by (rtac (rewrite_rule [Gamma_def] (Gamma_mono RS lfp_Tarski RS ssubst)) 1); |
|
55 |
by (fast_tac denotation_cs 1); |
|
56 |
||
1731 | 57 |
qed "com1"; |
1696 | 58 |
|
59 |
||
60 |
(* Denotational Semantics implies Operational Semantics *) |
|
61 |
||
62 |
goal Denotation.thy "!s t. (s,t):C(c) --> <c,s> -c-> t"; |
|
63 |
by (com.induct_tac "c" 1); |
|
64 |
by (rewrite_tac C_simps); |
|
65 |
by (ALLGOALS (TRY o fast_tac denotation_cs)); |
|
66 |
||
67 |
(* while *) |
|
68 |
by (strip_tac 1); |
|
69 |
by (etac (Gamma_mono RSN (2,induct)) 1); |
|
70 |
by (rewtac Gamma_def); |
|
71 |
by (fast_tac denotation_cs 1); |
|
72 |
||
73 |
qed_spec_mp "com2"; |
|
74 |
||
75 |
||
76 |
(**** Proof of Equivalence ****) |
|
77 |
||
78 |
goal Denotation.thy "(s,t) : C(c) = (<c,s> -c-> t)"; |
|
79 |
by (fast_tac (set_cs addEs [com2] addDs [com1]) 1); |
|
80 |
qed "denotational_is_natural"; |