src/HOL/HOLCF/IOA/RefMappings.thy
author wenzelm
Thu, 31 Dec 2015 12:43:09 +0100
changeset 62008 cbedaddc9351
parent 62003 src/HOL/HOLCF/IOA/meta_theory/RefMappings.thy@ba465fcd0267
child 62116 bc178c0fe1a1
permissions -rw-r--r--
clarified directory structure;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
62008
cbedaddc9351 clarified directory structure;
wenzelm
parents: 62003
diff changeset
     1
(*  Title:      HOL/HOLCF/IOA/RefMappings.thy
40945
b8703f63bfb2 recoded latin1 as utf8;
wenzelm
parents: 40774
diff changeset
     2
    Author:     Olaf Müller
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
     3
*)
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
     4
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 62001
diff changeset
     5
section \<open>Refinement Mappings in HOLCF/IOA\<close>
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
     6
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
     7
theory RefMappings
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
     8
imports Traces
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
     9
begin
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    10
36452
d37c6eed8117 renamed command 'defaultsort' to 'default_sort';
wenzelm
parents: 35174
diff changeset
    11
default_sort type
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    12
25135
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    13
definition
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    14
  move :: "[('a,'s)ioa,('a,'s)pairs,'s,'a,'s] => bool" where
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    15
  "move ioa ex s a t =
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    16
    (is_exec_frag ioa (s,ex) &  Finite ex &
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    17
     laststate (s,ex)=t  &
62001
1f2788fb0b8b more symbols;
wenzelm
parents: 58880
diff changeset
    18
     mk_trace ioa$ex = (if a:ext(ioa) then a\<leadsto>nil else nil))"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    19
25135
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    20
definition
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    21
  is_ref_map :: "[('s1=>'s2),('a,'s1)ioa,('a,'s2)ioa] => bool" where
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    22
  "is_ref_map f C A =
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    23
   ((!s:starts_of(C). f(s):starts_of(A)) &
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    24
   (!s t a. reachable C s &
62003
ba465fcd0267 more symbols;
wenzelm
parents: 62002
diff changeset
    25
            s \<midarrow>a\<midarrow>C\<rightarrow> t
25135
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    26
            --> (? ex. move A ex (f s) a (f t))))"
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    27
25135
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    28
definition
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    29
  is_weak_ref_map :: "[('s1=>'s2),('a,'s1)ioa,('a,'s2)ioa] => bool" where
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    30
  "is_weak_ref_map f C A =
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    31
   ((!s:starts_of(C). f(s):starts_of(A)) &
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    32
   (!s t a. reachable C s &
62003
ba465fcd0267 more symbols;
wenzelm
parents: 62002
diff changeset
    33
            s \<midarrow>a\<midarrow>C\<rightarrow> t
17233
41eee2e7b465 converted specifications to Isar theories;
wenzelm
parents: 14981
diff changeset
    34
            --> (if a:ext(C)
62003
ba465fcd0267 more symbols;
wenzelm
parents: 62002
diff changeset
    35
                 then (f s) \<midarrow>a\<midarrow>A\<rightarrow> (f t)
25135
4f8176c940cf modernized specifications ('definition', 'axiomatization');
wenzelm
parents: 19741
diff changeset
    36
                 else (f s)=(f t))))"
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
    37
19741
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    38
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    39
subsection "transitions and moves"
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    40
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    41
62003
ba465fcd0267 more symbols;
wenzelm
parents: 62002
diff changeset
    42
lemma transition_is_ex: "s \<midarrow>a\<midarrow>A\<rightarrow> t ==> ? ex. move A ex s a t"
62001
1f2788fb0b8b more symbols;
wenzelm
parents: 58880
diff changeset
    43
apply (rule_tac x = " (a,t) \<leadsto>nil" in exI)
19741
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    44
apply (simp add: move_def)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    45
done
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    46
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    47
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    48
lemma nothing_is_ex: "(~a:ext A) & s=t ==> ? ex. move A ex s a t"
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    49
apply (rule_tac x = "nil" in exI)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    50
apply (simp add: move_def)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    51
done
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    52
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    53
62003
ba465fcd0267 more symbols;
wenzelm
parents: 62002
diff changeset
    54
lemma ei_transitions_are_ex: "(s \<midarrow>a\<midarrow>A\<rightarrow> s') & (s' \<midarrow>a'\<midarrow>A\<rightarrow> s'') & (~a':ext A)  
19741
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    55
         ==> ? ex. move A ex s a s''"
62001
1f2788fb0b8b more symbols;
wenzelm
parents: 58880
diff changeset
    56
apply (rule_tac x = " (a,s') \<leadsto> (a',s'') \<leadsto>nil" in exI)
19741
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    57
apply (simp add: move_def)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    58
done
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    59
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    60
62003
ba465fcd0267 more symbols;
wenzelm
parents: 62002
diff changeset
    61
lemma eii_transitions_are_ex: "(s1 \<midarrow>a1\<midarrow>A\<rightarrow> s2) & (s2 \<midarrow>a2\<midarrow>A\<rightarrow> s3) & (s3 \<midarrow>a3\<midarrow>A\<rightarrow> s4) & 
19741
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    62
      (~a2:ext A) & (~a3:ext A) ==>  
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    63
      ? ex. move A ex s1 a1 s4"
62001
1f2788fb0b8b more symbols;
wenzelm
parents: 58880
diff changeset
    64
apply (rule_tac x = " (a1,s2) \<leadsto> (a2,s3) \<leadsto> (a3,s4) \<leadsto>nil" in exI)
19741
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    65
apply (simp add: move_def)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    66
done
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    67
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    68
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    69
subsection "weak_ref_map and ref_map"
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    70
26306
ed3375ac152d proper naming of weak_ref_map2ref_map;
wenzelm
parents: 25135
diff changeset
    71
lemma weak_ref_map2ref_map:
19741
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    72
  "[| ext C = ext A;  
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    73
     is_weak_ref_map f C A |] ==> is_ref_map f C A"
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    74
apply (unfold is_weak_ref_map_def is_ref_map_def)
26359
6d437bde2f1d more antiquotations
haftmann
parents: 26306
diff changeset
    75
apply auto
19741
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    76
apply (case_tac "a:ext A")
26359
6d437bde2f1d more antiquotations
haftmann
parents: 26306
diff changeset
    77
apply (auto intro: transition_is_ex nothing_is_ex)
19741
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    78
done
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    79
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    80
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    81
lemma imp_conj_lemma: "(P ==> Q-->R) ==> P&Q --> R"
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    82
  by blast
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    83
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    84
declare split_if [split del]
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    85
declare if_weak_cong [cong del]
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    86
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    87
lemma rename_through_pmap: "[| is_weak_ref_map f C A |]  
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    88
      ==> (is_weak_ref_map f (rename C g) (rename A g))"
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    89
apply (simp add: is_weak_ref_map_def)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    90
apply (rule conjI)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    91
(* 1: start states *)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    92
apply (simp add: rename_def rename_set_def starts_of_def)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    93
(* 2: reachable transitions *)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    94
apply (rule allI)+
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    95
apply (rule imp_conj_lemma)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    96
apply (simp (no_asm) add: rename_def rename_set_def)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    97
apply (simp add: externals_def asig_inputs_def asig_outputs_def asig_of_def trans_of_def)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    98
apply safe
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
    99
apply (simplesubst split_if)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   100
 apply (rule conjI)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   101
 apply (rule impI)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   102
 apply (erule disjE)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   103
 apply (erule exE)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   104
apply (erule conjE)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   105
(* x is input *)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   106
 apply (drule sym)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   107
 apply (drule sym)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   108
apply simp
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   109
apply hypsubst+
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   110
apply (frule reachable_rename)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   111
apply simp
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   112
(* x is output *)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   113
 apply (erule exE)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   114
apply (erule conjE)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   115
 apply (drule sym)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   116
 apply (drule sym)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   117
apply simp
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   118
apply hypsubst+
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   119
apply (frule reachable_rename)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   120
apply simp
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   121
(* x is internal *)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   122
apply (frule reachable_rename)
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   123
apply auto
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   124
done
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   125
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   126
declare split_if [split]
f65265d71426 removed legacy ML scripts;
wenzelm
parents: 17233
diff changeset
   127
declare if_weak_cong [cong]
4559
8e604d885b54 added files containing temproal logic and abstraction;
mueller
parents: 3433
diff changeset
   128
3071
981258186b71 New meta theory for IOA based on HOLCF.
mueller
parents:
diff changeset
   129
end