@@ -393,7 +393,7 @@ proof -
393
393
(* XXX *)
394
394
lemma leadsto_impl_hnr' :
395
395
"(uncurry0
396
- (leadsto_impl TYPE('bb) TYPE('cc) TYPE('dd) state_copy_impl
396
+ (leadsto_impl state_copy_impl
397
397
(succs_P_impl' Q_fun) a\<^sub>0_impl subsumes_impl (return \<circ> fst)
398
398
succs_impl' emptiness_check_impl F_impl (Q_impl Q_fun)),
399
399
uncurry0
@@ -477,13 +477,13 @@ lemma F_reachable_correct_new':
477
477
using prod_conv p_p p_gt_0 by simp +
478
478
479
479
definition
480
- "Alw_ev_checker = dfs_map_impl' TYPE('bb) TYPE('cc) TYPE('dd)
480
+ "Alw_ev_checker = dfs_map_impl'
481
481
(impl.succs_P_impl' final_fun) impl.a\<^sub>0_impl impl.subsumes_impl (return \<circ> fst)
482
482
impl.state_copy_impl"
483
483
484
484
definition
485
485
"leadsto_checker \<psi> = do {
486
- r \<leftarrow> leadsto_impl TYPE('bb) TYPE('cc) TYPE('dd)
486
+ r \<leftarrow> leadsto_impl
487
487
impl.state_copy_impl (impl.succs_P_impl' (\<lambda> (L, s). \<not> check_bexp \<psi> L s))
488
488
impl.a\<^sub>0_impl impl.subsumes_impl (return \<circ> fst)
489
489
impl.succs_impl' impl.emptiness_check_impl impl.F_impl
@@ -501,15 +501,15 @@ definition
501
501
} |
502
502
formula.AX _ \<Rightarrow> do {
503
503
r \<leftarrow> if PR_CONST (\<lambda>(x, y). F x y) (init, s\<^sub>0)
504
- then Alw_ev_checker TYPE('bb) TYPE('cc) TYPE('dd)
504
+ then Alw_ev_checker
505
505
else return False;
506
506
return (\<not> r)
507
507
} |
508
508
formula.EG _ \<Rightarrow>
509
509
if PR_CONST (\<lambda>(x, y). F x y) (init, s\<^sub>0)
510
- then Alw_ev_checker TYPE('bb) TYPE('cc) TYPE('dd)
510
+ then Alw_ev_checker
511
511
else return False |
512
- formula.Leadsto _ \<psi> \<Rightarrow> leadsto_checker TYPE('bb) TYPE('cc) TYPE('dd) \<psi>
512
+ formula.Leadsto _ \<psi> \<Rightarrow> leadsto_checker \<psi>
513
513
)
514
514
"
515
515
@@ -673,7 +673,7 @@ lemma deadlock_start_iff:
673
673
by - ( rule deadlock_iff [ of _ "(init, s\<^sub>0, u\<^sub>0)" , symmetric ] ; simp )
674
674
675
675
theorem model_check' :
676
- "(uncurry0 ( model_checker TYPE('bb) TYPE('cc) TYPE('dd)) ,
676
+ "(uncurry0 model_checker,
677
677
uncurry0 (
678
678
SPEC (\<lambda> r.
679
679
\<not> Graph_Defs.deadlock
@@ -797,7 +797,7 @@ proof -
797
797
798
798
-- \<open>\<open>EG\<close> \<close>
799
799
subgoal premises prems for \<phi>
800
- using impl.Alw_ev_impl_hnr [ where 'bb = 'bb and 'cc = 'cc and 'dd = 'dd ,
800
+ using impl.Alw_ev_impl_hnr [
801
801
to_hnr , unfolded hn_refine_def
802
802
]
803
803
unfolding final_fun_def F_def prems ( 2 )
@@ -824,9 +824,7 @@ proof -
824
824
825
825
-- \<open>\<open>AX\<close> \<close>
826
826
subgoal premises prems for \<phi>
827
- using impl.Alw_ev_impl_hnr [ where 'bb = 'bb and 'cc = 'cc and 'dd = 'dd ,
828
- to_hnr , unfolded hn_refine_def
829
- ]
827
+ using impl.Alw_ev_impl_hnr [ to_hnr , unfolded hn_refine_def ]
830
828
unfolding final_fun_def F_def
831
829
unfolding UPPAAL_Reachability_Problem_precompiled_defs.F_def
832
830
apply ( subst
@@ -874,30 +872,30 @@ qed
874
872
875
873
theorem model_check'_hoare :
876
874
"<emp>
877
- model_checker TYPE('bb) TYPE('cc) TYPE('dd)
875
+ model_checker
878
876
<\<lambda>r. \<up> ((\<not> Bisim_A.B.deadlock (init, s\<^sub>0, \<lambda>_. 0)) \<longrightarrow> r = (
879
877
conv N,(init, s\<^sub>0, u\<^sub>0) \<Turnstile>\<^sub>max_steps formula
880
878
))>\<^sub>t"
881
- using model_check' [ to_hnr , unfolded hn_refine_def , where 'bb = 'bb and 'cc = 'cc and 'dd = 'dd ]
879
+ using model_check' [ to_hnr , unfolded hn_refine_def ]
882
880
by ( sep_auto simp : pure_def elim !: cons_post_rule )
883
881
884
882
lemma Alw_ev_checker_alt_def' :
885
- "Alw_ev_checker TYPE('bb) TYPE('cc) TYPE('dd) \<equiv>
883
+ "Alw_ev_checker \<equiv>
886
884
do {
887
885
x \<leftarrow> let
888
886
key = return \<circ> fst;
889
887
sub = impl.subsumes_impl;
890
888
copy = impl.state_copy_impl;
891
889
start = impl.a\<^sub>0_impl;
892
890
succs = impl.succs_P_impl' final_fun
893
- in dfs_map_impl' TYPE('bb) TYPE('cc) TYPE('dd) succs start sub key copy;
891
+ in dfs_map_impl' succs start sub key copy;
894
892
_ \<leftarrow> return ();
895
893
return x
896
894
}"
897
895
unfolding Alw_ev_checker_def by simp
898
896
899
897
lemma leadsto_checker_alt_def' :
900
- "leadsto_checker TYPE('bb) TYPE('cc) TYPE('dd) \<psi> \<equiv>
898
+ "leadsto_checker \<psi> \<equiv>
901
899
do {
902
900
r \<leftarrow> let
903
901
key = return \<circ> fst;
@@ -910,8 +908,7 @@ lemma leadsto_checker_alt_def':
910
908
succs' = impl.succs_impl';
911
909
empty = impl.emptiness_check_impl
912
910
in
913
- leadsto_impl TYPE('bb) TYPE('cc) TYPE('dd)
914
- copy succs start sub key succs' empty final final';
911
+ leadsto_impl copy succs start sub key succs' empty final final';
915
912
return (\<not> r)
916
913
}"
917
914
unfolding leadsto_checker_def by simp
@@ -982,7 +979,7 @@ schematic_goal reachability_checker'_alt_def:
982
979
by ( rule Pure.reflexive )
983
980
984
981
schematic_goal Alw_ev_checker_alt_def :
985
- "Alw_ev_checker TYPE('bb) TYPE('cc) TYPE('dd) \<equiv> ?impl"
982
+ "Alw_ev_checker \<equiv> ?impl"
986
983
unfolding Alw_ev_checker_alt_def' final_fun_def
987
984
impl.succs_P_impl_def [ OF final_fun_final ] impl.succs_P_impl'_def [ OF final_fun_final ]
988
985
unfolding impl.E_op''_impl_def impl.abstr_repair_impl_def impl.abstra_repair_impl_def
@@ -1002,7 +999,7 @@ schematic_goal Alw_ev_checker_alt_def:
1002
999
by ( rule Pure.reflexive )
1003
1000
1004
1001
schematic_goal leadsto_checker_alt_def :
1005
- "leadsto_checker TYPE('bb) TYPE('cc) TYPE('dd) \<equiv> ?impl"
1002
+ "leadsto_checker \<equiv> ?impl"
1006
1003
unfolding leadsto_checker_alt_def'
1007
1004
unfolding impl.F_impl_def impl.Q_impl_def [ OF final_fun_final ]
1008
1005
unfolding impl.succs_P_impl'_def [ OF final_fun_final ]
@@ -1051,7 +1048,7 @@ schematic_goal reachability_checker'_alt_def_refined:
1051
1048
by ( rule Pure.reflexive )
1052
1049
1053
1050
schematic_goal Alw_ev_checker_alt_def_refined :
1054
- "Alw_ev_checker TYPE('bb) TYPE('cc) TYPE('dd) \<equiv> ?impl"
1051
+ "Alw_ev_checker \<equiv> ?impl"
1055
1052
unfolding Alw_ev_checker_alt_def
1056
1053
unfolding fw_impl'_int
1057
1054
unfolding inv_fun_def trans_fun_def trans_s_fun_def trans_i_fun_def
@@ -1079,7 +1076,7 @@ schematic_goal Alw_ev_checker_alt_def_refined:
1079
1076
by ( rule Pure.reflexive )
1080
1077
1081
1078
schematic_goal leadsto_checker_alt_def_refined :
1082
- "leadsto_checker TYPE('bb) TYPE('cc) TYPE('dd) \<equiv> ?impl"
1079
+ "leadsto_checker \<equiv> ?impl"
1083
1080
unfolding leadsto_checker_alt_def
1084
1081
unfolding fw_impl'_int
1085
1082
unfolding inv_fun_def trans_fun_def trans_s_fun_def trans_i_fun_def
@@ -1135,12 +1132,58 @@ definition [code]:
1135
1132
"precond_mc p m k max_steps I T prog final bounds P s\<^sub>0 na \<equiv>
1136
1133
if UPPAAL_Reachability_Problem_precompiled' p m max_steps I T prog bounds P s\<^sub>0 na k
1137
1134
then
1138
- model_checker TYPE('bb) TYPE('cc) TYPE('dd) p m max_steps I T prog bounds P s\<^sub>0 na k final
1135
+ model_checker p m max_steps I T prog bounds P s\<^sub>0 na k final
1139
1136
\<bind> (\<lambda> x. return (Some x))
1140
1137
else return None"
1141
1138
1142
1139
theorem model_check :
1143
- "<emp> precond_mc TYPE('bb) TYPE('cc) TYPE('dd) p m k max_steps I T prog formula bounds P s\<^sub>0 na
1140
+ "<emp> precond_mc p m k max_steps I T prog formula bounds P s\<^sub>0 na
1141
+ <\<lambda> Some r \<Rightarrow> \<up>(
1142
+ UPPAAL_Reachability_Problem_precompiled' p m max_steps I T prog bounds P s\<^sub>0 na k \<and>
1143
+ (\<not> Graph_Defs.deadlock
1144
+ (\<lambda> (L, s, u) (L', s', u').
1145
+ conv (N p I P T prog bounds) \<turnstile>\<^sup>max_steps \<langle>L, s, u\<rangle> \<rightarrow> \<langle>L', s', u'\<rangle>
1146
+ )
1147
+ (repeat 0 p, s\<^sub>0, \<lambda>_ . 0) \<longrightarrow>
1148
+ r = conv (N p I P T prog bounds),(repeat 0 p, s\<^sub>0, \<lambda>_ . 0) \<Turnstile>\<^sub>max_steps formula
1149
+ ))
1150
+ | None \<Rightarrow> \<up>(\<not> UPPAAL_Reachability_Problem_precompiled' p m max_steps I T prog bounds P s\<^sub>0 na k)
1151
+ >\<^sub>t"
1152
+ proof -
1153
+ define A where "A \<equiv> conv (N p I P T prog bounds)"
1154
+ define no_deadlock where
1155
+ "no_deadlock \<equiv> (\<forall>u\<^sub>0. (\<forall>c\<in>{1..m}. u\<^sub>0 c = 0) \<longrightarrow> \<not> Graph_Defs.deadlock
1156
+ (\<lambda>(l, u) (l', u').
1157
+ (case Prod_TA_Defs.prod_ta
1158
+ (Equiv_TA_Defs.state_ta
1159
+ (N p I P T prog bounds) max_steps) of
1160
+ (T, I) \<Rightarrow>
1161
+ ((\<lambda>(l, g, a, r, l').
1162
+ (l, map conv_ac g, a, r, l')) `
1163
+ T,
1164
+ map conv_ac \<circ> I)) \<turnstile>' \<langle>l, u\<rangle> \<rightarrow> \<langle>l', u'\<rangle>)
1165
+ ((repeat 0 p,
1166
+ s\<^sub>0),
1167
+ u\<^sub>0))"
1168
+ define check where
1169
+ "check \<equiv>
1170
+ A,(repeat 0 p, s\<^sub>0, \<lambda>_ . 0) \<Turnstile>\<^sub>max_steps formula"
1171
+ note [ sep_heap_rules ] =
1172
+ UPPAAL_Reachability_Problem_precompiled'.model_check'_hoare [
1173
+ of p m max_steps I T prog bounds P s \<^sub >0 na k formula ,
1174
+ unfolded UPPAAL_Reachability_Problem_precompiled_defs.init_def ,
1175
+ folded A_def check_def no_deadlock_def
1176
+ ]
1177
+ have *: "(no_deadlock \<longrightarrow> r = Some check) \<longleftrightarrow> (if no_deadlock then r = Some check else True)" for r
1178
+ by auto
1179
+ show ?thesis
1180
+ unfolding UPPAAL_Reachability_Problem_precompiled_defs.init_def
1181
+ unfolding A_def [ symmetric ] check_def [ symmetric ] no_deadlock_def [ symmetric ]
1182
+ unfolding precond_mc_def * by ( sep_auto simp : model_checker.refine [ symmetric ])
1183
+ qed
1184
+
1185
+ theorem model_check_alt :
1186
+ "<emp> precond_mc p m k max_steps I T prog formula bounds P s\<^sub>0 na
1144
1187
<\<lambda> r. \<up> (
1145
1188
if UPPAAL_Reachability_Problem_precompiled' p m max_steps I T prog bounds P s\<^sub>0 na k
1146
1189
then r \<noteq> None \<and>
@@ -1177,8 +1220,7 @@ proof -
1177
1220
UPPAAL_Reachability_Problem_precompiled'.model_check'_hoare [
1178
1221
of p m max_steps I T prog bounds P s \<^sub >0 na k formula ,
1179
1222
unfolded UPPAAL_Reachability_Problem_precompiled_defs.init_def ,
1180
- folded A_def check_def no_deadlock_def ,
1181
- where 'bb = 'bb and 'cc = 'cc and 'dd = 'dd
1223
+ folded A_def check_def no_deadlock_def
1182
1224
]
1183
1225
have *: "(no_deadlock \<longrightarrow> r = Some check) \<longleftrightarrow> (if no_deadlock then r = Some check else True)" for r
1184
1226
by auto
0 commit comments