| 6470 |      1 | (*  Title:      HOLCF/IOA/TrivEx.thy
 | 
|  |      2 |     ID:         $Id$
 | 
| 12218 |      3 |     Author:     Olaf Müller
 | 
| 6470 |      4 | *)
 | 
|  |      5 | 
 | 
| 17244 |      6 | header {* Trivial Abstraction Example *}
 | 
|  |      7 | 
 | 
|  |      8 | theory TrivEx
 | 
|  |      9 | imports Abstraction
 | 
|  |     10 | begin
 | 
| 6470 |     11 | 
 | 
|  |     12 | datatype action = INC
 | 
|  |     13 | 
 | 
|  |     14 | consts
 | 
|  |     15 | 
 | 
|  |     16 | C_asig   ::  "action signature"
 | 
| 17244 |     17 | C_trans  :: "(action, nat)transition set"
 | 
|  |     18 | C_ioa    :: "(action, nat)ioa"
 | 
| 6470 |     19 | 
 | 
|  |     20 | A_asig   :: "action signature"
 | 
| 17244 |     21 | A_trans  :: "(action, bool)transition set"
 | 
|  |     22 | A_ioa    :: "(action, bool)ioa"
 | 
| 6470 |     23 | 
 | 
|  |     24 | h_abs    :: "nat => bool"
 | 
|  |     25 | 
 | 
|  |     26 | defs
 | 
|  |     27 | 
 | 
| 17244 |     28 | C_asig_def:
 | 
| 6470 |     29 |   "C_asig == ({},{INC},{})"
 | 
|  |     30 | 
 | 
| 17244 |     31 | C_trans_def: "C_trans ==
 | 
|  |     32 |  {tr. let s = fst(tr);
 | 
|  |     33 |           t = snd(snd(tr))
 | 
|  |     34 |       in case fst(snd(tr))
 | 
|  |     35 |       of
 | 
| 6470 |     36 |       INC       => t = Suc(s)}"
 | 
|  |     37 | 
 | 
| 17244 |     38 | C_ioa_def: "C_ioa ==
 | 
| 6470 |     39 |  (C_asig, {0}, C_trans,{},{})"
 | 
|  |     40 | 
 | 
| 17244 |     41 | A_asig_def:
 | 
| 6470 |     42 |   "A_asig == ({},{INC},{})"
 | 
|  |     43 | 
 | 
| 17244 |     44 | A_trans_def: "A_trans ==
 | 
|  |     45 |  {tr. let s = fst(tr);
 | 
|  |     46 |           t = snd(snd(tr))
 | 
|  |     47 |       in case fst(snd(tr))
 | 
|  |     48 |       of
 | 
| 6470 |     49 |       INC       => t = True}"
 | 
|  |     50 | 
 | 
| 17244 |     51 | A_ioa_def: "A_ioa ==
 | 
| 6470 |     52 |  (A_asig, {False}, A_trans,{},{})"
 | 
|  |     53 | 
 | 
| 17244 |     54 | h_abs_def:
 | 
| 6470 |     55 |   "h_abs n == n~=0"
 | 
|  |     56 | 
 | 
| 17244 |     57 | axioms
 | 
| 6470 |     58 | 
 | 
| 17244 |     59 | MC_result:
 | 
| 6470 |     60 |   "validIOA A_ioa (<>[] <%(b,a,c). b>)"
 | 
|  |     61 | 
 | 
| 19740 |     62 | lemma h_abs_is_abstraction:
 | 
|  |     63 |   "is_abstraction h_abs C_ioa A_ioa"
 | 
|  |     64 | apply (unfold is_abstraction_def)
 | 
|  |     65 | apply (rule conjI)
 | 
|  |     66 | txt {* start states *}
 | 
|  |     67 | apply (simp (no_asm) add: h_abs_def starts_of_def C_ioa_def A_ioa_def)
 | 
|  |     68 | txt {* step case *}
 | 
|  |     69 | apply (rule allI)+
 | 
|  |     70 | apply (rule imp_conj_lemma)
 | 
|  |     71 | apply (simp (no_asm) add: trans_of_def C_ioa_def A_ioa_def C_trans_def A_trans_def)
 | 
|  |     72 | apply (induct_tac "a")
 | 
|  |     73 | apply (simp add: h_abs_def)
 | 
|  |     74 | done
 | 
|  |     75 | 
 | 
|  |     76 | lemma TrivEx_abstraction: "validIOA C_ioa (<>[] <%(n,a,m). n~=0>)"
 | 
|  |     77 | apply (rule AbsRuleT1)
 | 
|  |     78 | apply (rule h_abs_is_abstraction)
 | 
|  |     79 | apply (rule MC_result)
 | 
|  |     80 | apply (tactic "abstraction_tac 1")
 | 
|  |     81 | apply (simp add: h_abs_def)
 | 
|  |     82 | done
 | 
| 17244 |     83 | 
 | 
|  |     84 | end
 |