src/HOL/Hoare_Parallel/OG_Tactics.thy
author wenzelm
Mon, 24 Oct 2016 11:42:39 +0200
changeset 64367 a424f2737646
parent 62042 6c6ccf573479
permissions -rw-r--r--
updated for release;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
     1
section \<open>Generation of Verification Conditions\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
     2
27104
791607529f6d rep_datatype command now takes list of constructors as input arguments
haftmann
parents: 23894
diff changeset
     3
theory OG_Tactics
791607529f6d rep_datatype command now takes list of constructors as input arguments
haftmann
parents: 23894
diff changeset
     4
imports OG_Hoare
15425
6356d2523f73 [ .. (] -> [ ..< ]
nipkow
parents: 13187
diff changeset
     5
begin
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
     6
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
     7
lemmas ann_hoare_intros=AnnBasic AnnSeq AnnCond1 AnnCond2 AnnWhile AnnAwait AnnConseq
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
     8
lemmas oghoare_intros=Parallel Basic Seq Cond While Conseq
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
     9
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
    10
lemma ParallelConseqRule:
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
    11
 "\<lbrakk> p \<subseteq> (\<Inter>i\<in>{i. i<length Ts}. pre(the(com(Ts ! i))));
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
    12
  \<parallel>- (\<Inter>i\<in>{i. i<length Ts}. pre(the(com(Ts ! i))))
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
    13
      (Parallel Ts)
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
    14
     (\<Inter>i\<in>{i. i<length Ts}. post(Ts ! i));
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
    15
  (\<Inter>i\<in>{i. i<length Ts}. post(Ts ! i)) \<subseteq> q \<rbrakk>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    16
  \<Longrightarrow> \<parallel>- p (Parallel Ts) q"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    17
apply (rule Conseq)
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
    18
prefer 2
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    19
 apply fast
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    20
apply assumption+
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    21
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    22
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    23
lemma SkipRule: "p \<subseteq> q \<Longrightarrow> \<parallel>- p (Basic id) q"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    24
apply(rule oghoare_intros)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    25
  prefer 2 apply(rule Basic)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    26
 prefer 2 apply(rule subset_refl)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    27
apply(simp add:Id_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    28
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    29
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    30
lemma BasicRule: "p \<subseteq> {s. (f s)\<in>q} \<Longrightarrow> \<parallel>- p (Basic f) q"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    31
apply(rule oghoare_intros)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    32
  prefer 2 apply(rule oghoare_intros)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    33
 prefer 2 apply(rule subset_refl)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    34
apply assumption
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    35
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    36
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    37
lemma SeqRule: "\<lbrakk> \<parallel>- p c1 r; \<parallel>- r c2 q \<rbrakk> \<Longrightarrow> \<parallel>- p (Seq c1 c2) q"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    38
apply(rule Seq)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    39
apply fast+
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    40
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    41
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
    42
lemma CondRule:
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
    43
 "\<lbrakk> p \<subseteq> {s. (s\<in>b \<longrightarrow> s\<in>w) \<and> (s\<notin>b \<longrightarrow> s\<in>w')}; \<parallel>- w c1 q; \<parallel>- w' c2 q \<rbrakk>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    44
  \<Longrightarrow> \<parallel>- p (Cond b c1 c2) q"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    45
apply(rule Cond)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    46
 apply(rule Conseq)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    47
 prefer 4 apply(rule Conseq)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    48
apply simp_all
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    49
apply force+
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    50
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    51
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
    52
lemma WhileRule: "\<lbrakk> p \<subseteq> i; \<parallel>- (i \<inter> b) c i ; (i \<inter> (-b)) \<subseteq> q \<rbrakk>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    53
        \<Longrightarrow> \<parallel>- p (While b i c) q"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    54
apply(rule Conseq)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    55
 prefer 2 apply(rule While)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    56
apply assumption+
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    57
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    58
62042
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
    59
text \<open>Three new proof rules for special instances of the \<open>AnnBasic\<close> and the \<open>AnnAwait\<close> commands when the transformation
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
    60
performed on the state is the identity, and for an \<open>AnnAwait\<close>
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
    61
command where the boolean condition is \<open>{s. True}\<close>:\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    62
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    63
lemma AnnatomRule:
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    64
  "\<lbrakk> atom_com(c); \<parallel>- r c q \<rbrakk>  \<Longrightarrow> \<turnstile> (AnnAwait r {s. True} c) q"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    65
apply(rule AnnAwait)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    66
apply simp_all
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    67
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    68
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    69
lemma AnnskipRule:
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    70
  "r \<subseteq> q \<Longrightarrow> \<turnstile> (AnnBasic r id) q"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    71
apply(rule AnnBasic)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    72
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    73
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    74
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    75
lemma AnnwaitRule:
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    76
  "\<lbrakk> (r \<inter> b) \<subseteq> q \<rbrakk> \<Longrightarrow> \<turnstile> (AnnAwait r b (Basic id)) q"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    77
apply(rule AnnAwait)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    78
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    79
apply(rule BasicRule)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    80
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    81
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    82
62042
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
    83
text \<open>Lemmata to avoid using the definition of \<open>map_ann_hoare\<close>, \<open>interfree_aux\<close>, \<open>interfree_swap\<close> and
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
    84
\<open>interfree\<close> by splitting it into different cases:\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    85
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    86
lemma interfree_aux_rule1: "interfree_aux(co, q, None)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    87
by(simp add:interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    88
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
    89
lemma interfree_aux_rule2:
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    90
  "\<forall>(R,r)\<in>(atomics a). \<parallel>- (q \<inter> R) r q \<Longrightarrow> interfree_aux(None, q, Some a)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    91
apply(simp add:interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    92
apply(force elim:oghoare_sound)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    93
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    94
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
    95
lemma interfree_aux_rule3:
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    96
  "(\<forall>(R, r)\<in>(atomics a). \<parallel>- (q \<inter> R) r q \<and> (\<forall>p\<in>(assertions c). \<parallel>- (p \<inter> R) r p))
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    97
  \<Longrightarrow> interfree_aux(Some c, q, Some a)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    98
apply(simp add:interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
    99
apply(force elim:oghoare_sound)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   100
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   101
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   102
lemma AnnBasic_assertions:
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   103
  "\<lbrakk>interfree_aux(None, r, Some a); interfree_aux(None, q, Some a)\<rbrakk> \<Longrightarrow>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   104
    interfree_aux(Some (AnnBasic r f), q, Some a)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   105
apply(simp add: interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   106
by force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   107
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   108
lemma AnnSeq_assertions:
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   109
  "\<lbrakk> interfree_aux(Some c1, q, Some a); interfree_aux(Some c2, q, Some a)\<rbrakk>\<Longrightarrow>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   110
   interfree_aux(Some (AnnSeq c1 c2), q, Some a)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   111
apply(simp add: interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   112
by force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   113
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   114
lemma AnnCond1_assertions:
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   115
  "\<lbrakk> interfree_aux(None, r, Some a); interfree_aux(Some c1, q, Some a);
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   116
  interfree_aux(Some c2, q, Some a)\<rbrakk>\<Longrightarrow>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   117
  interfree_aux(Some(AnnCond1 r b c1 c2), q, Some a)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   118
apply(simp add: interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   119
by force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   120
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   121
lemma AnnCond2_assertions:
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   122
  "\<lbrakk> interfree_aux(None, r, Some a); interfree_aux(Some c, q, Some a)\<rbrakk>\<Longrightarrow>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   123
  interfree_aux(Some (AnnCond2 r b c), q, Some a)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   124
apply(simp add: interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   125
by force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   126
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   127
lemma AnnWhile_assertions:
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   128
  "\<lbrakk> interfree_aux(None, r, Some a); interfree_aux(None, i, Some a);
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   129
  interfree_aux(Some c, q, Some a)\<rbrakk>\<Longrightarrow>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   130
  interfree_aux(Some (AnnWhile r b i c), q, Some a)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   131
apply(simp add: interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   132
by force
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   133
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   134
lemma AnnAwait_assertions:
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   135
  "\<lbrakk> interfree_aux(None, r, Some a); interfree_aux(None, q, Some a)\<rbrakk>\<Longrightarrow>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   136
  interfree_aux(Some (AnnAwait r b c), q, Some a)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   137
apply(simp add: interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   138
by force
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   139
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   140
lemma AnnBasic_atomics:
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   141
  "\<parallel>- (q \<inter> r) (Basic f) q \<Longrightarrow> interfree_aux(None, q, Some (AnnBasic r f))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   142
by(simp add: interfree_aux_def oghoare_sound)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   143
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   144
lemma AnnSeq_atomics:
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   145
  "\<lbrakk> interfree_aux(Any, q, Some a1); interfree_aux(Any, q, Some a2)\<rbrakk>\<Longrightarrow>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   146
  interfree_aux(Any, q, Some (AnnSeq a1 a2))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   147
apply(simp add: interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   148
by force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   149
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   150
lemma AnnCond1_atomics:
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   151
  "\<lbrakk> interfree_aux(Any, q, Some a1); interfree_aux(Any, q, Some a2)\<rbrakk>\<Longrightarrow>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   152
   interfree_aux(Any, q, Some (AnnCond1 r b a1 a2))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   153
apply(simp add: interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   154
by force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   155
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   156
lemma AnnCond2_atomics:
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   157
  "interfree_aux (Any, q, Some a)\<Longrightarrow> interfree_aux(Any, q, Some (AnnCond2 r b a))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   158
by(simp add: interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   159
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   160
lemma AnnWhile_atomics: "interfree_aux (Any, q, Some a)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   161
     \<Longrightarrow> interfree_aux(Any, q, Some (AnnWhile r b i a))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   162
by(simp add: interfree_aux_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   163
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   164
lemma Annatom_atomics:
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   165
  "\<parallel>- (q \<inter> r) a q \<Longrightarrow> interfree_aux (None, q, Some (AnnAwait r {x. True} a))"
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   166
by(simp add: interfree_aux_def oghoare_sound)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   167
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   168
lemma AnnAwait_atomics:
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   169
  "\<parallel>- (q \<inter> (r \<inter> b)) a q \<Longrightarrow> interfree_aux (None, q, Some (AnnAwait r b a))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   170
by(simp add: interfree_aux_def oghoare_sound)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   171
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 32621
diff changeset
   172
definition interfree_swap :: "('a ann_triple_op * ('a ann_triple_op) list) \<Rightarrow> bool" where
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   173
  "interfree_swap == \<lambda>(x, xs). \<forall>y\<in>set xs. interfree_aux (com x, post x, com y)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   174
  \<and> interfree_aux(com y, post y, com x)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   175
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   176
lemma interfree_swap_Empty: "interfree_swap (x, [])"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   177
by(simp add:interfree_swap_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   178
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   179
lemma interfree_swap_List:
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   180
  "\<lbrakk> interfree_aux (com x, post x, com y);
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   181
  interfree_aux (com y, post y ,com x); interfree_swap (x, xs) \<rbrakk>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   182
  \<Longrightarrow> interfree_swap (x, y#xs)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   183
by(simp add:interfree_swap_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   184
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   185
lemma interfree_swap_Map: "\<forall>k. i\<le>k \<and> k<j \<longrightarrow> interfree_aux (com x, post x, c k)
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   186
 \<and> interfree_aux (c k, Q k, com x)
15425
6356d2523f73 [ .. (] -> [ ..< ]
nipkow
parents: 13187
diff changeset
   187
 \<Longrightarrow> interfree_swap (x, map (\<lambda>k. (c k, Q k)) [i..<j])"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   188
by(force simp add: interfree_swap_def less_diff_conv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   189
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   190
lemma interfree_Empty: "interfree []"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   191
by(simp add:interfree_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   192
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   193
lemma interfree_List:
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   194
  "\<lbrakk> interfree_swap(x, xs); interfree xs \<rbrakk> \<Longrightarrow> interfree (x#xs)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   195
apply(simp add:interfree_def interfree_swap_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   196
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   197
apply(case_tac i)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   198
 apply(case_tac j)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   199
  apply simp_all
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   200
apply(case_tac j,simp+)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   201
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   202
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   203
lemma interfree_Map:
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   204
  "(\<forall>i j. a\<le>i \<and> i<b \<and> a\<le>j \<and> j<b  \<and> i\<noteq>j \<longrightarrow> interfree_aux (c i, Q i, c j))
15425
6356d2523f73 [ .. (] -> [ ..< ]
nipkow
parents: 13187
diff changeset
   205
  \<Longrightarrow> interfree (map (\<lambda>k. (c k, Q k)) [a..<b])"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   206
by(force simp add: interfree_def less_diff_conv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   207
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 32621
diff changeset
   208
definition map_ann_hoare :: "(('a ann_com_op * 'a assn) list) \<Rightarrow> bool " ("[\<turnstile>] _" [0] 45) where
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   209
  "[\<turnstile>] Ts == (\<forall>i<length Ts. \<exists>c q. Ts!i=(Some c, q) \<and> \<turnstile> c q)"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   210
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   211
lemma MapAnnEmpty: "[\<turnstile>] []"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   212
by(simp add:map_ann_hoare_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   213
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   214
lemma MapAnnList: "\<lbrakk> \<turnstile> c q ; [\<turnstile>] xs \<rbrakk> \<Longrightarrow> [\<turnstile>] (Some c,q)#xs"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   215
apply(simp add:map_ann_hoare_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   216
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   217
apply(case_tac i,simp+)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   218
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   219
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   220
lemma MapAnnMap:
15425
6356d2523f73 [ .. (] -> [ ..< ]
nipkow
parents: 13187
diff changeset
   221
  "\<forall>k. i\<le>k \<and> k<j \<longrightarrow> \<turnstile> (c k) (Q k) \<Longrightarrow> [\<turnstile>] map (\<lambda>k. (Some (c k), Q k)) [i..<j]"
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   222
apply(simp add: map_ann_hoare_def less_diff_conv)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   223
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   224
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   225
lemma ParallelRule:"\<lbrakk> [\<turnstile>] Ts ; interfree Ts \<rbrakk>
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   226
  \<Longrightarrow> \<parallel>- (\<Inter>i\<in>{i. i<length Ts}. pre(the(com(Ts!i))))
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   227
          Parallel Ts
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   228
        (\<Inter>i\<in>{i. i<length Ts}. post(Ts!i))"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   229
apply(rule Parallel)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   230
 apply(simp add:map_ann_hoare_def)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   231
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   232
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   233
(*
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   234
lemma ParamParallelRule:
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   235
 "\<lbrakk> \<forall>k<n. \<turnstile> (c k) (Q k);
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   236
   \<forall>k l. k<n \<and> l<n  \<and> k\<noteq>l \<longrightarrow> interfree_aux (Some(c k), Q k, Some(c l)) \<rbrakk>
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   237
  \<Longrightarrow> \<parallel>- (\<Inter>i\<in>{i. i<n} . pre(c i)) COBEGIN SCHEME [0\<le>i<n] (c i) (Q i) COEND  (\<Inter>i\<in>{i. i<n} . Q i )"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   238
apply(rule ParallelConseqRule)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   239
  apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   240
  apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   241
  apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   242
 apply(rule ParallelRule)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   243
  apply(rule MapAnnMap)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   244
  apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   245
 apply(rule interfree_Map)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   246
 apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   247
apply simp
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   248
apply clarify
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   249
apply force
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   250
done
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   251
*)
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   252
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   253
text \<open>The following are some useful lemmas and simplification
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   254
tactics to control which theorems are used to simplify at each moment,
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   255
so that the original input does not suffer any unexpected
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   256
transformation.\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   257
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   258
lemma Compl_Collect: "-(Collect b) = {x. \<not>(b x)}"
52597
a8a81453833d more precise fact declarations -- fewer warnings;
wenzelm
parents: 51717
diff changeset
   259
  by fast
a8a81453833d more precise fact declarations -- fewer warnings;
wenzelm
parents: 51717
diff changeset
   260
a8a81453833d more precise fact declarations -- fewer warnings;
wenzelm
parents: 51717
diff changeset
   261
lemma list_length: "length []=0" "length (x#xs) = Suc(length xs)"
a8a81453833d more precise fact declarations -- fewer warnings;
wenzelm
parents: 51717
diff changeset
   262
  by simp_all
a8a81453833d more precise fact declarations -- fewer warnings;
wenzelm
parents: 51717
diff changeset
   263
lemma list_lemmas: "length []=0" "length (x#xs) = Suc(length xs)"
a8a81453833d more precise fact declarations -- fewer warnings;
wenzelm
parents: 51717
diff changeset
   264
    "(x#xs) ! 0 = x" "(x#xs) ! Suc n = xs ! n"
a8a81453833d more precise fact declarations -- fewer warnings;
wenzelm
parents: 51717
diff changeset
   265
  by simp_all
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   266
lemma le_Suc_eq_insert: "{i. i <Suc n} = insert n {i. i< n}"
52597
a8a81453833d more precise fact declarations -- fewer warnings;
wenzelm
parents: 51717
diff changeset
   267
  by auto
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   268
lemmas primrecdef_list = "pre.simps" "assertions.simps" "atomics.simps" "atom_com.simps"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   269
lemmas my_simp_list = list_lemmas fst_conv snd_conv
27104
791607529f6d rep_datatype command now takes list of constructors as input arguments
haftmann
parents: 23894
diff changeset
   270
not_less0 refl le_Suc_eq_insert Suc_not_Zero Zero_not_Suc nat.inject
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   271
Collect_mem_eq ball_simps option.simps primrecdef_list
52597
a8a81453833d more precise fact declarations -- fewer warnings;
wenzelm
parents: 51717
diff changeset
   272
lemmas ParallelConseq_list = INTER_eq Collect_conj_eq length_map length_upt length_append
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   273
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   274
ML \<open>
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   275
fun before_interfree_simp_tac ctxt =
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   276
  simp_tac (put_simpset HOL_basic_ss ctxt addsimps [@{thm com.simps}, @{thm post.simps}])
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   277
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   278
fun interfree_simp_tac ctxt =
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   279
  asm_simp_tac (put_simpset HOL_ss ctxt
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   280
    addsimps [@{thm split}, @{thm ball_Un}, @{thm ball_empty}] @ @{thms my_simp_list})
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   281
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   282
fun ParallelConseq ctxt =
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   283
  simp_tac (put_simpset HOL_basic_ss ctxt
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   284
    addsimps @{thms ParallelConseq_list} @ @{thms my_simp_list})
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   285
\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   286
62042
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
   287
text \<open>The following tactic applies \<open>tac\<close> to each conjunct in a
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
   288
subgoal of the form \<open>A \<Longrightarrow> a1 \<and> a2 \<and> .. \<and> an\<close>  returning
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
   289
\<open>n\<close> subgoals, one for each conjunct:\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   290
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   291
ML \<open>
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   292
fun conjI_Tac ctxt tac i st = st |>
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   293
       ( (EVERY [resolve_tac ctxt [conjI] i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   294
          conjI_Tac ctxt tac (i+1),
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   295
          tac i]) ORELSE (tac i) )
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   296
\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   297
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   298
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   299
subsubsection \<open>Tactic for the generation of the verification conditions\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   300
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   301
text \<open>The tactic basically uses two subtactics:
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   302
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   303
\begin{description}
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   304
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   305
\item[HoareRuleTac] is called at the level of parallel programs, it
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   306
 uses the ParallelTac to solve parallel composition of programs.
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   307
 This verification has two parts, namely, (1) all component programs are
62042
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
   308
 correct and (2) they are interference free.  \<open>HoareRuleTac\<close> is
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
   309
 also called at the level of atomic regions, i.e.  \<open>\<langle> \<rangle>\<close> and
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
   310
 \<open>AWAIT b THEN _ END\<close>, and at each interference freedom test.
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   311
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   312
\item[AnnHoareRuleTac] is for component programs which
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   313
 are annotated programs and so, there are not unknown assertions
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   314
 (no need to use the parameter precond, see NOTE).
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   315
62042
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
   316
 NOTE: precond(::bool) informs if the subgoal has the form \<open>\<parallel>- ?p c q\<close>,
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   317
 in this case we have precond=False and the generated  verification
62042
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
   318
 condition would have the form \<open>?p \<subseteq> \<dots>\<close> which can be solved by
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
   319
 \<open>rtac subset_refl\<close>, if True we proceed to simplify it using
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   320
 the simplification tactics above.
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   321
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   322
\end{description}
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   323
\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   324
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   325
ML \<open>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   326
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   327
fun WlpTac ctxt i = resolve_tac ctxt @{thms SeqRule} i THEN HoareRuleTac ctxt false (i + 1)
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   328
and HoareRuleTac ctxt precond i st = st |>
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   329
    ( (WlpTac ctxt i THEN HoareRuleTac ctxt precond i)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   330
      ORELSE
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   331
      (FIRST[resolve_tac ctxt @{thms SkipRule} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   332
             resolve_tac ctxt @{thms BasicRule} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   333
             EVERY[resolve_tac ctxt @{thms ParallelConseqRule} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   334
                   ParallelConseq ctxt (i+2),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   335
                   ParallelTac ctxt (i+1),
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   336
                   ParallelConseq ctxt i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   337
             EVERY[resolve_tac ctxt @{thms CondRule} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   338
                   HoareRuleTac ctxt false (i+2),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   339
                   HoareRuleTac ctxt false (i+1)],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   340
             EVERY[resolve_tac ctxt @{thms WhileRule} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   341
                   HoareRuleTac ctxt true (i+1)],
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   342
             K all_tac i ]
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   343
       THEN (if precond then (K all_tac i) else resolve_tac ctxt @{thms subset_refl} i)))
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   344
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   345
and AnnWlpTac ctxt i = resolve_tac ctxt @{thms AnnSeq} i THEN AnnHoareRuleTac ctxt (i + 1)
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   346
and AnnHoareRuleTac ctxt i st = st |>
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   347
    ( (AnnWlpTac ctxt i THEN AnnHoareRuleTac ctxt i )
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   348
     ORELSE
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   349
      (FIRST[(resolve_tac ctxt @{thms AnnskipRule} i),
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   350
             EVERY[resolve_tac ctxt @{thms AnnatomRule} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   351
                   HoareRuleTac ctxt true (i+1)],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   352
             (resolve_tac ctxt @{thms AnnwaitRule} i),
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   353
             resolve_tac ctxt @{thms AnnBasic} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   354
             EVERY[resolve_tac ctxt @{thms AnnCond1} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   355
                   AnnHoareRuleTac ctxt (i+3),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   356
                   AnnHoareRuleTac ctxt (i+1)],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   357
             EVERY[resolve_tac ctxt @{thms AnnCond2} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   358
                   AnnHoareRuleTac ctxt (i+1)],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   359
             EVERY[resolve_tac ctxt @{thms AnnWhile} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   360
                   AnnHoareRuleTac ctxt (i+2)],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   361
             EVERY[resolve_tac ctxt @{thms AnnAwait} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   362
                   HoareRuleTac ctxt true (i+1)],
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   363
             K all_tac i]))
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   364
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   365
and ParallelTac ctxt i = EVERY[resolve_tac ctxt @{thms ParallelRule} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   366
                          interfree_Tac ctxt (i+1),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   367
                           MapAnn_Tac ctxt i]
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   368
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   369
and MapAnn_Tac ctxt i st = st |>
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   370
    (FIRST[resolve_tac ctxt @{thms MapAnnEmpty} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   371
           EVERY[resolve_tac ctxt @{thms MapAnnList} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   372
                 MapAnn_Tac ctxt (i+1),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   373
                 AnnHoareRuleTac ctxt i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   374
           EVERY[resolve_tac ctxt @{thms MapAnnMap} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   375
                 resolve_tac ctxt @{thms allI} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   376
                 resolve_tac ctxt @{thms impI} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   377
                 AnnHoareRuleTac ctxt i]])
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   378
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   379
and interfree_swap_Tac ctxt i st = st |>
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   380
    (FIRST[resolve_tac ctxt @{thms interfree_swap_Empty} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   381
           EVERY[resolve_tac ctxt @{thms interfree_swap_List} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   382
                 interfree_swap_Tac ctxt (i+2),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   383
                 interfree_aux_Tac ctxt (i+1),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   384
                 interfree_aux_Tac ctxt i ],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   385
           EVERY[resolve_tac ctxt @{thms interfree_swap_Map} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   386
                 resolve_tac ctxt @{thms allI} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   387
                 resolve_tac ctxt @{thms impI} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   388
                 conjI_Tac ctxt (interfree_aux_Tac ctxt) i]])
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   389
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   390
and interfree_Tac ctxt i st = st |>
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   391
   (FIRST[resolve_tac ctxt @{thms interfree_Empty} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   392
          EVERY[resolve_tac ctxt @{thms interfree_List} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   393
                interfree_Tac ctxt (i+1),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   394
                interfree_swap_Tac ctxt i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   395
          EVERY[resolve_tac ctxt @{thms interfree_Map} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   396
                resolve_tac ctxt @{thms allI} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   397
                resolve_tac ctxt @{thms allI} i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   398
                resolve_tac ctxt @{thms impI} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   399
                interfree_aux_Tac ctxt i ]])
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   400
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   401
and interfree_aux_Tac ctxt i = (before_interfree_simp_tac ctxt i ) THEN
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   402
        (FIRST[resolve_tac ctxt @{thms interfree_aux_rule1} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   403
               dest_assertions_Tac ctxt i])
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   404
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   405
and dest_assertions_Tac ctxt i st = st |>
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   406
    (FIRST[EVERY[resolve_tac ctxt @{thms AnnBasic_assertions} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   407
                 dest_atomics_Tac ctxt (i+1),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   408
                 dest_atomics_Tac ctxt i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   409
           EVERY[resolve_tac ctxt @{thms AnnSeq_assertions} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   410
                 dest_assertions_Tac ctxt (i+1),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   411
                 dest_assertions_Tac ctxt i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   412
           EVERY[resolve_tac ctxt @{thms AnnCond1_assertions} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   413
                 dest_assertions_Tac ctxt (i+2),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   414
                 dest_assertions_Tac ctxt (i+1),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   415
                 dest_atomics_Tac ctxt i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   416
           EVERY[resolve_tac ctxt @{thms AnnCond2_assertions} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   417
                 dest_assertions_Tac ctxt (i+1),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   418
                 dest_atomics_Tac ctxt i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   419
           EVERY[resolve_tac ctxt @{thms AnnWhile_assertions} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   420
                 dest_assertions_Tac ctxt (i+2),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   421
                 dest_atomics_Tac ctxt (i+1),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   422
                 dest_atomics_Tac ctxt i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   423
           EVERY[resolve_tac ctxt @{thms AnnAwait_assertions} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   424
                 dest_atomics_Tac ctxt (i+1),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   425
                 dest_atomics_Tac ctxt i],
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   426
           dest_atomics_Tac ctxt i])
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   427
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   428
and dest_atomics_Tac ctxt i st = st |>
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   429
    (FIRST[EVERY[resolve_tac ctxt @{thms AnnBasic_atomics} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   430
                 HoareRuleTac ctxt true i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   431
           EVERY[resolve_tac ctxt @{thms AnnSeq_atomics} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   432
                 dest_atomics_Tac ctxt (i+1),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   433
                 dest_atomics_Tac ctxt i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   434
           EVERY[resolve_tac ctxt @{thms AnnCond1_atomics} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   435
                 dest_atomics_Tac ctxt (i+1),
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   436
                 dest_atomics_Tac ctxt i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   437
           EVERY[resolve_tac ctxt @{thms AnnCond2_atomics} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   438
                 dest_atomics_Tac ctxt i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   439
           EVERY[resolve_tac ctxt @{thms AnnWhile_atomics} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   440
                 dest_atomics_Tac ctxt i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   441
           EVERY[resolve_tac ctxt @{thms Annatom_atomics} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   442
                 HoareRuleTac ctxt true i],
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   443
           EVERY[resolve_tac ctxt @{thms AnnAwait_atomics} i,
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   444
                 HoareRuleTac ctxt true i],
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   445
                 K all_tac i])
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   446
\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   447
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   448
62042
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
   449
text \<open>The final tactic is given the name \<open>oghoare\<close>:\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   450
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   451
ML \<open>
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   452
fun oghoare_tac ctxt = SUBGOAL (fn (_, i) => HoareRuleTac ctxt true i)
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   453
\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   454
62042
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
   455
text \<open>Notice that the tactic for parallel programs \<open>oghoare_tac\<close> is initially invoked with the value \<open>true\<close> for
6c6ccf573479 isabelle update_cartouches -c -t;
wenzelm
parents: 60754
diff changeset
   456
the parameter \<open>precond\<close>.
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   457
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   458
Parts of the tactic can be also individually used to generate the
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   459
verification conditions for annotated sequential programs and to
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   460
generate verification conditions out of interference freedom tests:\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   461
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   462
ML \<open>
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   463
fun annhoare_tac ctxt = SUBGOAL (fn (_, i) => AnnHoareRuleTac ctxt i)
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   464
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 44928
diff changeset
   465
fun interfree_aux_tac ctxt = SUBGOAL (fn (_, i) => interfree_aux_Tac ctxt i)
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   466
\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   467
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   468
text \<open>The so defined ML tactics are then ``exported'' to be used in
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   469
Isabelle proofs.\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   470
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   471
method_setup oghoare = \<open>
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   472
  Scan.succeed (SIMPLE_METHOD' o oghoare_tac)\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   473
  "verification condition generator for the oghoare logic"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   474
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   475
method_setup annhoare = \<open>
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   476
  Scan.succeed (SIMPLE_METHOD' o annhoare_tac)\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   477
  "verification condition generator for the ann_hoare logic"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   478
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   479
method_setup interfree_aux = \<open>
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   480
  Scan.succeed (SIMPLE_METHOD' o interfree_aux_tac)\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   481
  "verification condition generator for interference freedom tests"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   482
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   483
text \<open>Tactics useful for dealing with the generated verification conditions:\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   484
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   485
method_setup conjI_tac = \<open>
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   486
  Scan.succeed (fn ctxt => SIMPLE_METHOD' (conjI_Tac ctxt (K all_tac)))\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   487
  "verification condition generator for interference freedom tests"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   488
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   489
ML \<open>
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   490
fun disjE_Tac ctxt tac i st = st |>
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   491
       ( (EVERY [eresolve_tac ctxt [disjE] i,
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   492
          disjE_Tac ctxt tac (i+1),
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   493
          tac i]) ORELSE (tac i) )
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   494
\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   495
59189
ad8e0a789af6 update_cartouches;
wenzelm
parents: 58884
diff changeset
   496
method_setup disjE_tac = \<open>
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59189
diff changeset
   497
  Scan.succeed (fn ctxt => SIMPLE_METHOD' (disjE_Tac ctxt (K all_tac)))\<close>
13020
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   498
  "verification condition generator for interference freedom tests"
791e3b4c4039 HoareParallel Theories
prensani
parents:
diff changeset
   499
13187
e5434b822a96 Modifications due to enhanced linear arithmetic.
nipkow
parents: 13020
diff changeset
   500
end