src/HOL/IMP/Denotation.ML
author paulson
Tue, 16 Jul 1996 15:49:46 +0200
changeset 1868 836950047d85
parent 1731 2ad693c6cb13
child 1973 8c94c9a5be10
permissions -rw-r--r--
Put in minimal simpset to avoid excessive simplification, just as in revision 1.9 of HOL/indrule.ML
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1266
diff changeset
     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
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
     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
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
     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
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    11
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    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
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    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
5d7a7e439cec expanded tabs
clasohm
parents: 1266
diff changeset
    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
03f096efa26d Modified datatype com.
nipkow
parents: 1465
diff changeset
    23
1696
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    24
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    25
goal Denotation.thy "C(WHILE b DO c) = C(IF b THEN c;WHILE b DO c ELSE SKIP)";
1481
03f096efa26d Modified datatype com.
nipkow
parents: 1465
diff changeset
    26
by(Simp_tac 1);
1696
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    27
by(EVERY[stac (Gamma_mono RS lfp_Tarski) 1,
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    28
          stac (Gamma_def RS meta_eq_to_obj_eq RS fun_cong) 1,
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    29
	  Simp_tac 1,
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    30
	  IF_UNSOLVED no_tac]);
1481
03f096efa26d Modified datatype com.
nipkow
parents: 1465
diff changeset
    31
qed "C_While_If";
03f096efa26d Modified datatype com.
nipkow
parents: 1465
diff changeset
    32
1696
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    33
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    34
(* Operational Semantics implies Denotational Semantics *)
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    35
1731
2ad693c6cb13 Updated for new form of induction rules
paulson
parents: 1696
diff changeset
    36
goal Denotation.thy "!!c s t. <c,s> -c-> t ==> (s,t) : C(c)";
1696
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    37
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    38
(* start with rule induction *)
1731
2ad693c6cb13 Updated for new form of induction rules
paulson
parents: 1696
diff changeset
    39
by (etac evalc.induct 1);
1696
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    40
by (rewrite_tac (Gamma_def::C_simps));
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    41
  (* simplification with HOL_ss too agressive *)
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    42
(* skip *)
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    43
by (fast_tac denotation_cs 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    44
(* assign *)
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    45
by (fast_tac denotation_cs 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    46
(* comp *)
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    47
by (fast_tac denotation_cs 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    48
(* if *)
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    49
by (fast_tac denotation_cs 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    50
by (fast_tac denotation_cs 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    51
(* while *)
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    52
by (rtac (rewrite_rule [Gamma_def] (Gamma_mono RS lfp_Tarski RS ssubst)) 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    53
by (fast_tac denotation_cs 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    54
by (rtac (rewrite_rule [Gamma_def] (Gamma_mono RS lfp_Tarski RS ssubst)) 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    55
by (fast_tac denotation_cs 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    56
1731
2ad693c6cb13 Updated for new form of induction rules
paulson
parents: 1696
diff changeset
    57
qed "com1";
1696
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    58
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    59
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    60
(* Denotational Semantics implies Operational Semantics *)
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    61
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    62
goal Denotation.thy "!s t. (s,t):C(c) --> <c,s> -c-> t";
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    63
by (com.induct_tac "c" 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    64
by (rewrite_tac C_simps);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    65
by (ALLGOALS (TRY o fast_tac denotation_cs));
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    66
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    67
(* while *)
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    68
by (strip_tac 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    69
by (etac (Gamma_mono RSN (2,induct)) 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    70
by (rewtac Gamma_def);  
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    71
by (fast_tac denotation_cs 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    72
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    73
qed_spec_mp "com2";
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    74
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    75
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    76
(**** Proof of Equivalence ****)
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    77
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    78
goal Denotation.thy "(s,t) : C(c)  =  (<c,s> -c-> t)";
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    79
by (fast_tac (set_cs addEs [com2] addDs [com1]) 1);
e84bff5c519b A completely new version of IMP.
nipkow
parents: 1481
diff changeset
    80
qed "denotational_is_natural";