author | wenzelm |
Wed, 30 Dec 2015 21:57:52 +0100 | |
changeset 62002 | f1599e98c4d0 |
parent 62001 | 1f2788fb0b8b |
child 62003 | ba465fcd0267 |
permissions | -rw-r--r-- |
42151 | 1 |
(* Title: HOL/HOLCF/IOA/meta_theory/TLS.thy |
40945 | 2 |
Author: Olaf Müller |
17233 | 3 |
*) |
4559 | 4 |
|
62002 | 5 |
section \<open>Temporal Logic of Steps -- tailored for I/O automata\<close> |
4559 | 6 |
|
17233 | 7 |
theory TLS |
8 |
imports IOA TL |
|
9 |
begin |
|
4559 | 10 |
|
36452 | 11 |
default_sort type |
4559 | 12 |
|
41476 | 13 |
type_synonym |
17233 | 14 |
('a, 's) ioa_temp = "('a option,'s)transition temporal" |
41476 | 15 |
|
16 |
type_synonym |
|
17233 | 17 |
('a, 's) step_pred = "('a option,'s)transition predicate" |
41476 | 18 |
|
19 |
type_synonym |
|
17233 | 20 |
's state_pred = "'s predicate" |
4559 | 21 |
|
22 |
consts |
|
23 |
||
24 |
option_lift :: "('a => 'b) => 'b => ('a option => 'b)" |
|
25 |
plift :: "('a => bool) => ('a option => bool)" |
|
17233 | 26 |
|
62000 | 27 |
temp_sat :: "('a,'s)execution => ('a,'s)ioa_temp => bool" (infixr "\<TTurnstile>" 22) |
4559 | 28 |
xt1 :: "'s predicate => ('a,'s)step_pred" |
29 |
xt2 :: "'a option predicate => ('a,'s)step_pred" |
|
30 |
||
31 |
validTE :: "('a,'s)ioa_temp => bool" |
|
32 |
validIOA :: "('a,'s)ioa => ('a,'s)ioa_temp => bool" |
|
33 |
||
5677
4feffde494cf
another little bug ;-) and minor changes in TLS.*;
mueller
parents:
4577
diff
changeset
|
34 |
mkfin :: "'a Seq => 'a Seq" |
4559 | 35 |
|
36 |
ex2seq :: "('a,'s)execution => ('a option,'s)transition Seq" |
|
17233 | 37 |
ex2seqC :: "('a,'s)pairs -> ('s => ('a option,'s)transition Seq)" |
4559 | 38 |
|
39 |
||
40 |
defs |
|
41 |
||
17233 | 42 |
mkfin_def: |
5677
4feffde494cf
another little bug ;-) and minor changes in TLS.*;
mueller
parents:
4577
diff
changeset
|
43 |
"mkfin s == if Partial s then @t. Finite t & s = t @@ UU |
4feffde494cf
another little bug ;-) and minor changes in TLS.*;
mueller
parents:
4577
diff
changeset
|
44 |
else s" |
4feffde494cf
another little bug ;-) and minor changes in TLS.*;
mueller
parents:
4577
diff
changeset
|
45 |
|
17233 | 46 |
option_lift_def: |
4559 | 47 |
"option_lift f s y == case y of None => s | Some x => (f x)" |
48 |
||
17233 | 49 |
(* plift is used to determine that None action is always false in |
4559 | 50 |
transition predicates *) |
17233 | 51 |
plift_def: |
4559 | 52 |
"plift P == option_lift P False" |
53 |
||
17233 | 54 |
temp_sat_def: |
62000 | 55 |
"ex \<TTurnstile> P == ((ex2seq ex) \<Turnstile> P)" |
4559 | 56 |
|
17233 | 57 |
xt1_def: |
4559 | 58 |
"xt1 P tr == P (fst tr)" |
59 |
||
17233 | 60 |
xt2_def: |
4559 | 61 |
"xt2 P tr == P (fst (snd tr))" |
62 |
||
17233 | 63 |
ex2seq_def: |
10835 | 64 |
"ex2seq ex == ((ex2seqC $(mkfin (snd ex))) (fst ex))" |
4559 | 65 |
|
17233 | 66 |
ex2seqC_def: |
67 |
"ex2seqC == (fix$(LAM h ex. (%s. case ex of |
|
62001 | 68 |
nil => (s,None,s)\<leadsto>nil |
4559 | 69 |
| x##xs => (flift1 (%pr. |
62001 | 70 |
(s,Some (fst pr), snd pr)\<leadsto> (h$xs) (snd pr)) |
10835 | 71 |
$x) |
4559 | 72 |
)))" |
73 |
||
17233 | 74 |
validTE_def: |
62000 | 75 |
"validTE P == ! ex. (ex \<TTurnstile> P)" |
4559 | 76 |
|
17233 | 77 |
validIOA_def: |
62000 | 78 |
"validIOA A P == ! ex : executions A . (ex \<TTurnstile> P)" |
4559 | 79 |
|
5976 | 80 |
|
47026 | 81 |
axiomatization where |
5976 | 82 |
|
17233 | 83 |
mkfin_UU: |
47026 | 84 |
"mkfin UU = nil" and |
5677
4feffde494cf
another little bug ;-) and minor changes in TLS.*;
mueller
parents:
4577
diff
changeset
|
85 |
|
17233 | 86 |
mkfin_nil: |
47026 | 87 |
"mkfin nil =nil" and |
5677
4feffde494cf
another little bug ;-) and minor changes in TLS.*;
mueller
parents:
4577
diff
changeset
|
88 |
|
17233 | 89 |
mkfin_cons: |
62001 | 90 |
"(mkfin (a\<leadsto>s)) = (a\<leadsto>(mkfin s))" |
5677
4feffde494cf
another little bug ;-) and minor changes in TLS.*;
mueller
parents:
4577
diff
changeset
|
91 |
|
19741 | 92 |
|
37598 | 93 |
lemmas [simp del] = HOL.ex_simps HOL.all_simps split_paired_Ex |
19741 | 94 |
|
62002 | 95 |
setup \<open>map_theory_claset (fn ctxt => ctxt delSWrapper "split_all_tac")\<close> |
19741 | 96 |
|
97 |
||
62002 | 98 |
subsection \<open>ex2seqC\<close> |
19741 | 99 |
|
100 |
lemma ex2seqC_unfold: "ex2seqC = (LAM ex. (%s. case ex of |
|
62001 | 101 |
nil => (s,None,s)\<leadsto>nil |
19741 | 102 |
| x##xs => (flift1 (%pr. |
62001 | 103 |
(s,Some (fst pr), snd pr)\<leadsto> (ex2seqC$xs) (snd pr)) |
19741 | 104 |
$x) |
105 |
))" |
|
106 |
apply (rule trans) |
|
107 |
apply (rule fix_eq2) |
|
108 |
apply (rule ex2seqC_def) |
|
109 |
apply (rule beta_cfun) |
|
110 |
apply (simp add: flift1_def) |
|
111 |
done |
|
112 |
||
113 |
lemma ex2seqC_UU: "(ex2seqC $UU) s=UU" |
|
114 |
apply (subst ex2seqC_unfold) |
|
115 |
apply simp |
|
116 |
done |
|
117 |
||
62001 | 118 |
lemma ex2seqC_nil: "(ex2seqC $nil) s = (s,None,s)\<leadsto>nil" |
19741 | 119 |
apply (subst ex2seqC_unfold) |
120 |
apply simp |
|
121 |
done |
|
122 |
||
62001 | 123 |
lemma ex2seqC_cons: "(ex2seqC $((a,t)\<leadsto>xs)) s = |
124 |
(s,Some a,t)\<leadsto> ((ex2seqC$xs) t)" |
|
19741 | 125 |
apply (rule trans) |
126 |
apply (subst ex2seqC_unfold) |
|
127 |
apply (simp add: Consq_def flift1_def) |
|
128 |
apply (simp add: Consq_def flift1_def) |
|
129 |
done |
|
130 |
||
131 |
declare ex2seqC_UU [simp] ex2seqC_nil [simp] ex2seqC_cons [simp] |
|
132 |
||
133 |
||
134 |
||
135 |
declare mkfin_UU [simp] mkfin_nil [simp] mkfin_cons [simp] |
|
136 |
||
62001 | 137 |
lemma ex2seq_UU: "ex2seq (s, UU) = (s,None,s)\<leadsto>nil" |
19741 | 138 |
apply (simp add: ex2seq_def) |
139 |
done |
|
140 |
||
62001 | 141 |
lemma ex2seq_nil: "ex2seq (s, nil) = (s,None,s)\<leadsto>nil" |
19741 | 142 |
apply (simp add: ex2seq_def) |
143 |
done |
|
144 |
||
62001 | 145 |
lemma ex2seq_cons: "ex2seq (s, (a,t)\<leadsto>ex) = (s,Some a,t) \<leadsto> ex2seq (t, ex)" |
19741 | 146 |
apply (simp add: ex2seq_def) |
147 |
done |
|
148 |
||
149 |
declare ex2seqC_UU [simp del] ex2seqC_nil [simp del] ex2seqC_cons [simp del] |
|
150 |
declare ex2seq_UU [simp] ex2seq_nil [simp] ex2seq_cons [simp] |
|
151 |
||
152 |
||
153 |
lemma ex2seq_nUUnnil: "ex2seq exec ~= UU & ex2seq exec ~= nil" |
|
62002 | 154 |
apply (tactic \<open>pair_tac @{context} "exec" 1\<close>) |
155 |
apply (tactic \<open>Seq_case_simp_tac @{context} "x2" 1\<close>) |
|
156 |
apply (tactic \<open>pair_tac @{context} "a" 1\<close>) |
|
19741 | 157 |
done |
158 |
||
159 |
||
62002 | 160 |
subsection \<open>Interface TL -- TLS\<close> |
19741 | 161 |
|
162 |
(* uses the fact that in executions states overlap, which is lost in |
|
163 |
after the translation via ex2seq !! *) |
|
164 |
||
165 |
lemma TL_TLS: |
|
166 |
"[| ! s a t. (P s) & s-a--A-> t --> (Q t) |] |
|
62000 | 167 |
==> ex \<TTurnstile> (Init (%(s,a,t). P s) \<^bold>\<and> Init (%(s,a,t). s -a--A-> t) |
168 |
\<^bold>\<longrightarrow> (Next (Init (%(s,a,t).Q s))))" |
|
19741 | 169 |
apply (unfold Init_def Next_def temp_sat_def satisfies_def IMPLIES_def AND_def) |
170 |
||
26359 | 171 |
apply clarify |
19741 | 172 |
apply (simp split add: split_if) |
173 |
(* TL = UU *) |
|
174 |
apply (rule conjI) |
|
62002 | 175 |
apply (tactic \<open>pair_tac @{context} "ex" 1\<close>) |
176 |
apply (tactic \<open>Seq_case_simp_tac @{context} "x2" 1\<close>) |
|
177 |
apply (tactic \<open>pair_tac @{context} "a" 1\<close>) |
|
178 |
apply (tactic \<open>Seq_case_simp_tac @{context} "s" 1\<close>) |
|
179 |
apply (tactic \<open>pair_tac @{context} "a" 1\<close>) |
|
19741 | 180 |
(* TL = nil *) |
181 |
apply (rule conjI) |
|
62002 | 182 |
apply (tactic \<open>pair_tac @{context} "ex" 1\<close>) |
183 |
apply (tactic \<open>Seq_case_tac @{context} "x2" 1\<close>) |
|
19741 | 184 |
apply (simp add: unlift_def) |
185 |
apply fast |
|
186 |
apply (simp add: unlift_def) |
|
187 |
apply fast |
|
188 |
apply (simp add: unlift_def) |
|
62002 | 189 |
apply (tactic \<open>pair_tac @{context} "a" 1\<close>) |
190 |
apply (tactic \<open>Seq_case_simp_tac @{context} "s" 1\<close>) |
|
191 |
apply (tactic \<open>pair_tac @{context} "a" 1\<close>) |
|
19741 | 192 |
(* TL =cons *) |
193 |
apply (simp add: unlift_def) |
|
194 |
||
62002 | 195 |
apply (tactic \<open>pair_tac @{context} "ex" 1\<close>) |
196 |
apply (tactic \<open>Seq_case_simp_tac @{context} "x2" 1\<close>) |
|
197 |
apply (tactic \<open>pair_tac @{context} "a" 1\<close>) |
|
198 |
apply (tactic \<open>Seq_case_simp_tac @{context} "s" 1\<close>) |
|
199 |
apply (tactic \<open>pair_tac @{context} "a" 1\<close>) |
|
19741 | 200 |
done |
4559 | 201 |
|
202 |
end |