| author | wenzelm | 
| Sun, 09 Jun 2024 20:37:39 +0200 | |
| changeset 80310 | 6d091c0c252e | 
| parent 71989 | bad75618fb82 | 
| child 80914 | d97fdabd9e2b | 
| permissions | -rw-r--r-- | 
| 59189 | 1  | 
section \<open>The Proof System\<close>  | 
| 13020 | 2  | 
|
| 16417 | 3  | 
theory RG_Hoare imports RG_Tran begin  | 
| 13020 | 4  | 
|
| 59189 | 5  | 
subsection \<open>Proof System for Component Programs\<close>  | 
| 13020 | 6  | 
|
| 54859 | 7  | 
declare Un_subset_iff [simp del] sup.bounded_iff [simp del]  | 
| 15102 | 8  | 
|
| 59189 | 9  | 
definition stable :: "'a set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> bool" where
 | 
10  | 
"stable \<equiv> \<lambda>f g. (\<forall>x y. x \<in> f \<longrightarrow> (x, y) \<in> g \<longrightarrow> y \<in> f)"  | 
|
| 13020 | 11  | 
|
| 23746 | 12  | 
inductive  | 
| 59189 | 13  | 
  rghoare :: "['a com, 'a set, ('a \<times> 'a) set, ('a \<times> 'a) set, 'a set] \<Rightarrow> bool"
 | 
| 23746 | 14  | 
    ("\<turnstile> _ sat [_, _, _, _]" [60,0,0,0,0] 45)
 | 
15  | 
where  | 
|
| 59189 | 16  | 
  Basic: "\<lbrakk> pre \<subseteq> {s. f s \<in> post}; {(s,t). s \<in> pre \<and> (t=f s \<or> t=s)} \<subseteq> guar;
 | 
17  | 
stable pre rely; stable post rely \<rbrakk>  | 
|
| 13020 | 18  | 
\<Longrightarrow> \<turnstile> Basic f sat [pre, rely, guar, post]"  | 
19  | 
||
| 59189 | 20  | 
| Seq: "\<lbrakk> \<turnstile> P sat [pre, rely, guar, mid]; \<turnstile> Q sat [mid, rely, guar, post] \<rbrakk>  | 
| 13020 | 21  | 
\<Longrightarrow> \<turnstile> Seq P Q sat [pre, rely, guar, post]"  | 
22  | 
||
| 23746 | 23  | 
| Cond: "\<lbrakk> stable pre rely; \<turnstile> P1 sat [pre \<inter> b, rely, guar, post];  | 
| 13020 | 24  | 
\<turnstile> P2 sat [pre \<inter> -b, rely, guar, post]; \<forall>s. (s,s)\<in>guar \<rbrakk>  | 
25  | 
\<Longrightarrow> \<turnstile> Cond b P1 P2 sat [pre, rely, guar, post]"  | 
|
26  | 
||
| 23746 | 27  | 
| While: "\<lbrakk> stable pre rely; (pre \<inter> -b) \<subseteq> post; stable post rely;  | 
| 13020 | 28  | 
\<turnstile> P sat [pre \<inter> b, rely, guar, pre]; \<forall>s. (s,s)\<in>guar \<rbrakk>  | 
29  | 
\<Longrightarrow> \<turnstile> While b P sat [pre, rely, guar, post]"  | 
|
30  | 
||
| 59189 | 31  | 
| Await: "\<lbrakk> stable pre rely; stable post rely;  | 
32  | 
            \<forall>V. \<turnstile> P sat [pre \<inter> b \<inter> {V}, {(s, t). s = t},
 | 
|
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
33  | 
                UNIV, {s. (V, s) \<in> guar} \<inter> post] \<rbrakk>
 | 
| 13020 | 34  | 
\<Longrightarrow> \<turnstile> Await b P sat [pre, rely, guar, post]"  | 
| 59189 | 35  | 
|
| 23746 | 36  | 
| Conseq: "\<lbrakk> pre \<subseteq> pre'; rely \<subseteq> rely'; guar' \<subseteq> guar; post' \<subseteq> post;  | 
| 13020 | 37  | 
\<turnstile> P sat [pre', rely', guar', post'] \<rbrakk>  | 
38  | 
\<Longrightarrow> \<turnstile> P sat [pre, rely, guar, post]"  | 
|
39  | 
||
| 
35416
 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 
haftmann 
parents: 
32687 
diff
changeset
 | 
40  | 
definition Pre :: "'a rgformula \<Rightarrow> 'a set" where  | 
| 13020 | 41  | 
"Pre x \<equiv> fst(snd x)"  | 
| 
35416
 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 
haftmann 
parents: 
32687 
diff
changeset
 | 
42  | 
|
| 
 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 
haftmann 
parents: 
32687 
diff
changeset
 | 
43  | 
definition Post :: "'a rgformula \<Rightarrow> 'a set" where  | 
| 13020 | 44  | 
"Post x \<equiv> snd(snd(snd(snd x)))"  | 
| 
35416
 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 
haftmann 
parents: 
32687 
diff
changeset
 | 
45  | 
|
| 
 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 
haftmann 
parents: 
32687 
diff
changeset
 | 
46  | 
definition Rely :: "'a rgformula \<Rightarrow> ('a \<times> 'a) set" where
 | 
| 13020 | 47  | 
"Rely x \<equiv> fst(snd(snd x))"  | 
| 
35416
 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 
haftmann 
parents: 
32687 
diff
changeset
 | 
48  | 
|
| 
 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 
haftmann 
parents: 
32687 
diff
changeset
 | 
49  | 
definition Guar :: "'a rgformula \<Rightarrow> ('a \<times> 'a) set" where
 | 
| 13020 | 50  | 
"Guar x \<equiv> fst(snd(snd(snd x)))"  | 
| 
35416
 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 
haftmann 
parents: 
32687 
diff
changeset
 | 
51  | 
|
| 
 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 
haftmann 
parents: 
32687 
diff
changeset
 | 
52  | 
definition Com :: "'a rgformula \<Rightarrow> 'a com" where  | 
| 13020 | 53  | 
"Com x \<equiv> fst x"  | 
54  | 
||
| 59189 | 55  | 
subsection \<open>Proof System for Parallel Programs\<close>  | 
| 13020 | 56  | 
|
| 42174 | 57  | 
type_synonym 'a par_rgformula =  | 
58  | 
  "('a rgformula) list \<times> 'a set \<times> ('a \<times> 'a) set \<times> ('a \<times> 'a) set \<times> 'a set"
 | 
|
| 13020 | 59  | 
|
| 23746 | 60  | 
inductive  | 
61  | 
  par_rghoare :: "('a rgformula) list \<Rightarrow> 'a set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> 'a set \<Rightarrow> bool"
 | 
|
62  | 
    ("\<turnstile> _ SAT [_, _, _, _]" [60,0,0,0,0] 45)
 | 
|
63  | 
where  | 
|
| 59189 | 64  | 
Parallel:  | 
| 13020 | 65  | 
  "\<lbrakk> \<forall>i<length xs. rely \<union> (\<Union>j\<in>{j. j<length xs \<and> j\<noteq>i}. Guar(xs!j)) \<subseteq> Rely(xs!i);
 | 
66  | 
    (\<Union>j\<in>{j. j<length xs}. Guar(xs!j)) \<subseteq> guar;
 | 
|
| 59189 | 67  | 
     pre \<subseteq> (\<Inter>i\<in>{i. i<length xs}. Pre(xs!i));
 | 
| 13020 | 68  | 
    (\<Inter>i\<in>{i. i<length xs}. Post(xs!i)) \<subseteq> post;
 | 
69  | 
\<forall>i<length xs. \<turnstile> Com(xs!i) sat [Pre(xs!i),Rely(xs!i),Guar(xs!i),Post(xs!i)] \<rbrakk>  | 
|
70  | 
\<Longrightarrow> \<turnstile> xs SAT [pre, rely, guar, post]"  | 
|
71  | 
||
| 59189 | 72  | 
section \<open>Soundness\<close>  | 
| 13020 | 73  | 
|
| 59189 | 74  | 
subsubsection \<open>Some previous lemmas\<close>  | 
| 13020 | 75  | 
|
| 59189 | 76  | 
lemma tl_of_assum_in_assum:  | 
77  | 
"(P, s) # (P, t) # xs \<in> assum (pre, rely) \<Longrightarrow> stable pre rely  | 
|
| 13020 | 78  | 
\<Longrightarrow> (P, t) # xs \<in> assum (pre, rely)"  | 
79  | 
apply(simp add:assum_def)  | 
|
80  | 
apply clarify  | 
|
81  | 
apply(rule conjI)  | 
|
82  | 
apply(erule_tac x=0 in allE)  | 
|
83  | 
apply(simp (no_asm_use)only:stable_def)  | 
|
84  | 
apply(erule allE,erule allE,erule impE,assumption,erule mp)  | 
|
85  | 
apply(simp add:Env)  | 
|
86  | 
apply clarify  | 
|
87  | 
apply(erule_tac x="Suc i" in allE)  | 
|
88  | 
apply simp  | 
|
89  | 
done  | 
|
90  | 
||
| 59189 | 91  | 
lemma etran_in_comm:  | 
| 13020 | 92  | 
"(P, t) # xs \<in> comm(guar, post) \<Longrightarrow> (P, s) # (P, t) # xs \<in> comm(guar, post)"  | 
93  | 
apply(simp add:comm_def)  | 
|
94  | 
apply clarify  | 
|
95  | 
apply(case_tac i,simp+)  | 
|
96  | 
done  | 
|
97  | 
||
| 59189 | 98  | 
lemma ctran_in_comm:  | 
99  | 
"\<lbrakk>(s, s) \<in> guar; (Q, s) # xs \<in> comm(guar, post)\<rbrakk>  | 
|
| 13020 | 100  | 
\<Longrightarrow> (P, s) # (Q, s) # xs \<in> comm(guar, post)"  | 
101  | 
apply(simp add:comm_def)  | 
|
102  | 
apply clarify  | 
|
103  | 
apply(case_tac i,simp+)  | 
|
104  | 
done  | 
|
105  | 
||
| 59189 | 106  | 
lemma takecptn_is_cptn [rule_format, elim!]:  | 
| 13020 | 107  | 
"\<forall>j. c \<in> cptn \<longrightarrow> take (Suc j) c \<in> cptn"  | 
108  | 
apply(induct "c")  | 
|
| 23746 | 109  | 
apply(force elim: cptn.cases)  | 
| 13020 | 110  | 
apply clarify  | 
| 59189 | 111  | 
apply(case_tac j)  | 
| 13020 | 112  | 
apply simp  | 
113  | 
apply(rule CptnOne)  | 
|
114  | 
apply simp  | 
|
| 23746 | 115  | 
apply(force intro:cptn.intros elim:cptn.cases)  | 
| 13020 | 116  | 
done  | 
117  | 
||
| 59189 | 118  | 
lemma dropcptn_is_cptn [rule_format,elim!]:  | 
| 13020 | 119  | 
"\<forall>j<length c. c \<in> cptn \<longrightarrow> drop j c \<in> cptn"  | 
120  | 
apply(induct "c")  | 
|
| 23746 | 121  | 
apply(force elim: cptn.cases)  | 
| 13020 | 122  | 
apply clarify  | 
| 59189 | 123  | 
apply(case_tac j,simp+)  | 
| 23746 | 124  | 
apply(erule cptn.cases)  | 
| 13020 | 125  | 
apply simp  | 
126  | 
apply force  | 
|
127  | 
apply force  | 
|
128  | 
done  | 
|
129  | 
||
| 59189 | 130  | 
lemma takepar_cptn_is_par_cptn [rule_format,elim]:  | 
| 13020 | 131  | 
"\<forall>j. c \<in> par_cptn \<longrightarrow> take (Suc j) c \<in> par_cptn"  | 
132  | 
apply(induct "c")  | 
|
| 23746 | 133  | 
apply(force elim: cptn.cases)  | 
| 13020 | 134  | 
apply clarify  | 
| 59189 | 135  | 
apply(case_tac j,simp)  | 
| 13020 | 136  | 
apply(rule ParCptnOne)  | 
| 23746 | 137  | 
apply(force intro:par_cptn.intros elim:par_cptn.cases)  | 
| 13020 | 138  | 
done  | 
139  | 
||
140  | 
lemma droppar_cptn_is_par_cptn [rule_format]:  | 
|
141  | 
"\<forall>j<length c. c \<in> par_cptn \<longrightarrow> drop j c \<in> par_cptn"  | 
|
142  | 
apply(induct "c")  | 
|
| 23746 | 143  | 
apply(force elim: par_cptn.cases)  | 
| 13020 | 144  | 
apply clarify  | 
| 59189 | 145  | 
apply(case_tac j,simp+)  | 
| 23746 | 146  | 
apply(erule par_cptn.cases)  | 
| 13020 | 147  | 
apply simp  | 
148  | 
apply force  | 
|
149  | 
apply force  | 
|
150  | 
done  | 
|
151  | 
||
152  | 
lemma tl_of_cptn_is_cptn: "\<lbrakk>x # xs \<in> cptn; xs \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> cptn"  | 
|
| 59189 | 153  | 
apply(subgoal_tac "1 < length (x # xs)")  | 
| 13020 | 154  | 
apply(drule dropcptn_is_cptn,simp+)  | 
155  | 
done  | 
|
156  | 
||
| 59189 | 157  | 
lemma not_ctran_None [rule_format]:  | 
| 13020 | 158  | 
"\<forall>s. (None, s)#xs \<in> cptn \<longrightarrow> (\<forall>i<length xs. ((None, s)#xs)!i -e\<rightarrow> xs!i)"  | 
159  | 
apply(induct xs,simp+)  | 
|
160  | 
apply clarify  | 
|
| 23746 | 161  | 
apply(erule cptn.cases,simp)  | 
| 13020 | 162  | 
apply simp  | 
163  | 
apply(case_tac i,simp)  | 
|
164  | 
apply(rule Env)  | 
|
165  | 
apply simp  | 
|
| 23746 | 166  | 
apply(force elim:ctran.cases)  | 
| 13020 | 167  | 
done  | 
168  | 
||
169  | 
lemma cptn_not_empty [simp]:"[] \<notin> cptn"  | 
|
| 23746 | 170  | 
apply(force elim:cptn.cases)  | 
| 13020 | 171  | 
done  | 
172  | 
||
| 59189 | 173  | 
lemma etran_or_ctran [rule_format]:  | 
174  | 
"\<forall>m i. x\<in>cptn \<longrightarrow> m \<le> length x  | 
|
175  | 
\<longrightarrow> (\<forall>i. Suc i < m \<longrightarrow> \<not> x!i -c\<rightarrow> x!Suc i) \<longrightarrow> Suc i < m  | 
|
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
176  | 
\<longrightarrow> x!i -e\<rightarrow> x!Suc i"  | 
| 
71989
 
bad75618fb82
extraction of equations x = t from premises beneath meta-all
 
haftmann 
parents: 
71836 
diff
changeset
 | 
177  | 
supply [[simproc del: defined_all]]  | 
| 13020 | 178  | 
apply(induct x,simp)  | 
179  | 
apply clarify  | 
|
| 23746 | 180  | 
apply(erule cptn.cases,simp)  | 
| 13020 | 181  | 
apply(case_tac i,simp)  | 
182  | 
apply(rule Env)  | 
|
183  | 
apply simp  | 
|
184  | 
apply(erule_tac x="m - 1" in allE)  | 
|
185  | 
apply(case_tac m,simp,simp)  | 
|
186  | 
apply(subgoal_tac "(\<forall>i. Suc i < nata \<longrightarrow> (((P, t) # xs) ! i, xs ! i) \<notin> ctran)")  | 
|
187  | 
apply force  | 
|
188  | 
apply clarify  | 
|
| 
71989
 
bad75618fb82
extraction of equations x = t from premises beneath meta-all
 
haftmann 
parents: 
71836 
diff
changeset
 | 
189  | 
apply(erule_tac x="Suc ia" in allE,simp)  | 
| 59807 | 190  | 
apply(erule_tac x="0" and P="\<lambda>j. H j \<longrightarrow> (J j) \<notin> ctran" for H J in allE,simp)  | 
| 13020 | 191  | 
done  | 
192  | 
||
| 59189 | 193  | 
lemma etran_or_ctran2 [rule_format]:  | 
| 13020 | 194  | 
"\<forall>i. Suc i<length x \<longrightarrow> x\<in>cptn \<longrightarrow> (x!i -c\<rightarrow> x!Suc i \<longrightarrow> \<not> x!i -e\<rightarrow> x!Suc i)  | 
195  | 
\<or> (x!i -e\<rightarrow> x!Suc i \<longrightarrow> \<not> x!i -c\<rightarrow> x!Suc i)"  | 
|
196  | 
apply(induct x)  | 
|
197  | 
apply simp  | 
|
198  | 
apply clarify  | 
|
| 23746 | 199  | 
apply(erule cptn.cases,simp)  | 
| 13020 | 200  | 
apply(case_tac i,simp+)  | 
201  | 
apply(case_tac i,simp)  | 
|
| 23746 | 202  | 
apply(force elim:etran.cases)  | 
| 13020 | 203  | 
apply simp  | 
204  | 
done  | 
|
205  | 
||
| 59189 | 206  | 
lemma etran_or_ctran2_disjI1:  | 
| 13020 | 207  | 
"\<lbrakk> x\<in>cptn; Suc i<length x; x!i -c\<rightarrow> x!Suc i\<rbrakk> \<Longrightarrow> \<not> x!i -e\<rightarrow> x!Suc i"  | 
208  | 
by(drule etran_or_ctran2,simp_all)  | 
|
209  | 
||
| 59189 | 210  | 
lemma etran_or_ctran2_disjI2:  | 
| 13020 | 211  | 
"\<lbrakk> x\<in>cptn; Suc i<length x; x!i -e\<rightarrow> x!Suc i\<rbrakk> \<Longrightarrow> \<not> x!i -c\<rightarrow> x!Suc i"  | 
212  | 
by(drule etran_or_ctran2,simp_all)  | 
|
213  | 
||
| 59189 | 214  | 
lemma not_ctran_None2 [rule_format]:  | 
| 13020 | 215  | 
"\<lbrakk> (None, s) # xs \<in>cptn; i<length xs\<rbrakk> \<Longrightarrow> \<not> ((None, s) # xs) ! i -c\<rightarrow> xs ! i"  | 
216  | 
apply(frule not_ctran_None,simp)  | 
|
217  | 
apply(case_tac i,simp)  | 
|
| 23746 | 218  | 
apply(force elim:etranE)  | 
| 13020 | 219  | 
apply simp  | 
220  | 
apply(rule etran_or_ctran2_disjI2,simp_all)  | 
|
221  | 
apply(force intro:tl_of_cptn_is_cptn)  | 
|
222  | 
done  | 
|
223  | 
||
| 58860 | 224  | 
lemma Ex_first_occurrence [rule_format]: "P (n::nat) \<longrightarrow> (\<exists>m. P m \<and> (\<forall>i<m. \<not> P i))"  | 
| 13020 | 225  | 
apply(rule nat_less_induct)  | 
226  | 
apply clarify  | 
|
227  | 
apply(case_tac "\<forall>m. m<n \<longrightarrow> \<not> P m")  | 
|
228  | 
apply auto  | 
|
229  | 
done  | 
|
| 59189 | 230  | 
|
231  | 
lemma stability [rule_format]:  | 
|
| 13020 | 232  | 
"\<forall>j k. x \<in> cptn \<longrightarrow> stable p rely \<longrightarrow> j\<le>k \<longrightarrow> k<length x \<longrightarrow> snd(x!j)\<in>p \<longrightarrow>  | 
| 59189 | 233  | 
(\<forall>i. (Suc i)<length x \<longrightarrow>  | 
234  | 
(x!i -e\<rightarrow> x!(Suc i)) \<longrightarrow> (snd(x!i), snd(x!(Suc i))) \<in> rely) \<longrightarrow>  | 
|
| 13020 | 235  | 
(\<forall>i. j\<le>i \<and> i<k \<longrightarrow> x!i -e\<rightarrow> x!Suc i) \<longrightarrow> snd(x!k)\<in>p \<and> fst(x!j)=fst(x!k)"  | 
| 
71989
 
bad75618fb82
extraction of equations x = t from premises beneath meta-all
 
haftmann 
parents: 
71836 
diff
changeset
 | 
236  | 
supply [[simproc del: defined_all]]  | 
| 13020 | 237  | 
apply(induct x)  | 
238  | 
apply clarify  | 
|
| 23746 | 239  | 
apply(force elim:cptn.cases)  | 
| 13020 | 240  | 
apply clarify  | 
| 23746 | 241  | 
apply(erule cptn.cases,simp)  | 
| 13020 | 242  | 
apply simp  | 
243  | 
apply(case_tac k,simp,simp)  | 
|
| 59189 | 244  | 
apply(case_tac j,simp)  | 
| 13020 | 245  | 
apply(erule_tac x=0 in allE)  | 
| 59807 | 246  | 
apply(erule_tac x="nat" and P="\<lambda>j. (0\<le>j) \<longrightarrow> (J j)" for J in allE,simp)  | 
| 13020 | 247  | 
apply(subgoal_tac "t\<in>p")  | 
248  | 
apply(subgoal_tac "(\<forall>i. i < length xs \<longrightarrow> ((P, t) # xs) ! i -e\<rightarrow> xs ! i \<longrightarrow> (snd (((P, t) # xs) ! i), snd (xs ! i)) \<in> rely)")  | 
|
249  | 
apply clarify  | 
|
| 59807 | 250  | 
apply(erule_tac x="Suc i" and P="\<lambda>j. (H j) \<longrightarrow> (J j)\<in>etran" for H J in allE,simp)  | 
| 13020 | 251  | 
apply clarify  | 
| 59807 | 252  | 
apply(erule_tac x="Suc i" and P="\<lambda>j. (H j) \<longrightarrow> (J j) \<longrightarrow> (T j)\<in>rely" for H J T in allE,simp)  | 
253  | 
apply(erule_tac x=0 and P="\<lambda>j. (H j) \<longrightarrow> (J j)\<in>etran \<longrightarrow> T j" for H J T in allE,simp)  | 
|
| 13020 | 254  | 
apply(simp(no_asm_use) only:stable_def)  | 
255  | 
apply(erule_tac x=s in allE)  | 
|
256  | 
apply(erule_tac x=t in allE)  | 
|
| 59189 | 257  | 
apply simp  | 
| 13020 | 258  | 
apply(erule mp)  | 
259  | 
apply(erule mp)  | 
|
260  | 
apply(rule Env)  | 
|
261  | 
apply simp  | 
|
262  | 
apply(erule_tac x="nata" in allE)  | 
|
| 59807 | 263  | 
apply(erule_tac x="nat" and P="\<lambda>j. (s\<le>j) \<longrightarrow> (J j)" for s J in allE,simp)  | 
| 13020 | 264  | 
apply(subgoal_tac "(\<forall>i. i < length xs \<longrightarrow> ((P, t) # xs) ! i -e\<rightarrow> xs ! i \<longrightarrow> (snd (((P, t) # xs) ! i), snd (xs ! i)) \<in> rely)")  | 
265  | 
apply clarify  | 
|
| 59807 | 266  | 
apply(erule_tac x="Suc i" and P="\<lambda>j. (H j) \<longrightarrow> (J j)\<in>etran" for H J in allE,simp)  | 
| 13020 | 267  | 
apply clarify  | 
| 59807 | 268  | 
apply(erule_tac x="Suc i" and P="\<lambda>j. (H j) \<longrightarrow> (J j) \<longrightarrow> (T j)\<in>rely" for H J T in allE,simp)  | 
| 13020 | 269  | 
apply(case_tac k,simp,simp)  | 
270  | 
apply(case_tac j)  | 
|
| 59807 | 271  | 
apply(erule_tac x=0 and P="\<lambda>j. (H j) \<longrightarrow> (J j)\<in>etran" for H J in allE,simp)  | 
| 23746 | 272  | 
apply(erule etran.cases,simp)  | 
| 13020 | 273  | 
apply(erule_tac x="nata" in allE)  | 
| 59807 | 274  | 
apply(erule_tac x="nat" and P="\<lambda>j. (s\<le>j) \<longrightarrow> (J j)" for s J in allE,simp)  | 
| 13020 | 275  | 
apply(subgoal_tac "(\<forall>i. i < length xs \<longrightarrow> ((Q, t) # xs) ! i -e\<rightarrow> xs ! i \<longrightarrow> (snd (((Q, t) # xs) ! i), snd (xs ! i)) \<in> rely)")  | 
276  | 
apply clarify  | 
|
| 59807 | 277  | 
apply(erule_tac x="Suc i" and P="\<lambda>j. (H j) \<longrightarrow> (J j)\<in>etran" for H J in allE,simp)  | 
| 13020 | 278  | 
apply clarify  | 
| 59807 | 279  | 
apply(erule_tac x="Suc i" and P="\<lambda>j. (H j) \<longrightarrow> (J j) \<longrightarrow> (T j)\<in>rely" for H J T in allE,simp)  | 
| 13020 | 280  | 
done  | 
281  | 
||
| 59189 | 282  | 
subsection \<open>Soundness of the System for Component Programs\<close>  | 
| 13020 | 283  | 
|
| 59189 | 284  | 
subsubsection \<open>Soundness of the Basic rule\<close>  | 
| 13020 | 285  | 
|
| 59189 | 286  | 
lemma unique_ctran_Basic [rule_format]:  | 
287  | 
"\<forall>s i. x \<in> cptn \<longrightarrow> x ! 0 = (Some (Basic f), s) \<longrightarrow>  | 
|
288  | 
Suc i<length x \<longrightarrow> x!i -c\<rightarrow> x!Suc i \<longrightarrow>  | 
|
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
289  | 
(\<forall>j. Suc j<length x \<longrightarrow> i\<noteq>j \<longrightarrow> x!j -e\<rightarrow> x!Suc j)"  | 
| 13020 | 290  | 
apply(induct x,simp)  | 
291  | 
apply simp  | 
|
292  | 
apply clarify  | 
|
| 23746 | 293  | 
apply(erule cptn.cases,simp)  | 
| 13020 | 294  | 
apply(case_tac i,simp+)  | 
295  | 
apply clarify  | 
|
296  | 
apply(case_tac j,simp)  | 
|
297  | 
apply(rule Env)  | 
|
298  | 
apply simp  | 
|
299  | 
apply clarify  | 
|
300  | 
apply simp  | 
|
301  | 
apply(case_tac i)  | 
|
302  | 
apply(case_tac j,simp,simp)  | 
|
| 23746 | 303  | 
apply(erule ctran.cases,simp_all)  | 
| 13020 | 304  | 
apply(force elim: not_ctran_None)  | 
| 23746 | 305  | 
apply(ind_cases "((Some (Basic f), sa), Q, t) \<in> ctran" for sa Q t)  | 
| 13020 | 306  | 
apply simp  | 
307  | 
apply(drule_tac i=nat in not_ctran_None,simp)  | 
|
| 23746 | 308  | 
apply(erule etranE,simp)  | 
| 13020 | 309  | 
done  | 
310  | 
||
| 59189 | 311  | 
lemma exists_ctran_Basic_None [rule_format]:  | 
312  | 
"\<forall>s i. x \<in> cptn \<longrightarrow> x ! 0 = (Some (Basic f), s)  | 
|
| 13020 | 313  | 
\<longrightarrow> i<length x \<longrightarrow> fst(x!i)=None \<longrightarrow> (\<exists>j<i. x!j -c\<rightarrow> x!Suc j)"  | 
314  | 
apply(induct x,simp)  | 
|
315  | 
apply simp  | 
|
316  | 
apply clarify  | 
|
| 23746 | 317  | 
apply(erule cptn.cases,simp)  | 
| 13020 | 318  | 
apply(case_tac i,simp,simp)  | 
319  | 
apply(erule_tac x=nat in allE,simp)  | 
|
320  | 
apply clarify  | 
|
321  | 
apply(rule_tac x="Suc j" in exI,simp,simp)  | 
|
322  | 
apply clarify  | 
|
323  | 
apply(case_tac i,simp,simp)  | 
|
324  | 
apply(rule_tac x=0 in exI,simp)  | 
|
325  | 
done  | 
|
326  | 
||
| 59189 | 327  | 
lemma Basic_sound:  | 
328  | 
  " \<lbrakk>pre \<subseteq> {s. f s \<in> post}; {(s, t). s \<in> pre \<and> t = f s} \<subseteq> guar;
 | 
|
| 13020 | 329  | 
stable pre rely; stable post rely\<rbrakk>  | 
330  | 
\<Longrightarrow> \<Turnstile> Basic f sat [pre, rely, guar, post]"  | 
|
| 
71989
 
bad75618fb82
extraction of equations x = t from premises beneath meta-all
 
haftmann 
parents: 
71836 
diff
changeset
 | 
331  | 
supply [[simproc del: defined_all]]  | 
| 13020 | 332  | 
apply(unfold com_validity_def)  | 
333  | 
apply clarify  | 
|
334  | 
apply(simp add:comm_def)  | 
|
335  | 
apply(rule conjI)  | 
|
336  | 
apply clarify  | 
|
337  | 
apply(simp add:cp_def assum_def)  | 
|
338  | 
apply clarify  | 
|
339  | 
apply(frule_tac j=0 and k=i and p=pre in stability)  | 
|
340  | 
apply simp_all  | 
|
341  | 
apply(erule_tac x=ia in allE,simp)  | 
|
342  | 
apply(erule_tac i=i and f=f in unique_ctran_Basic,simp_all)  | 
|
343  | 
apply(erule subsetD,simp)  | 
|
344  | 
apply(case_tac "x!i")  | 
|
345  | 
apply clarify  | 
|
346  | 
apply(drule_tac s="Some (Basic f)" in sym,simp)  | 
|
| 59807 | 347  | 
apply(thin_tac "\<forall>j. H j" for H)  | 
| 23746 | 348  | 
apply(force elim:ctran.cases)  | 
| 13020 | 349  | 
apply clarify  | 
350  | 
apply(simp add:cp_def)  | 
|
351  | 
apply clarify  | 
|
352  | 
apply(frule_tac i="length x - 1" and f=f in exists_ctran_Basic_None,simp+)  | 
|
353  | 
apply(case_tac x,simp+)  | 
|
354  | 
apply(rule last_fst_esp,simp add:last_length)  | 
|
355  | 
apply (case_tac x,simp+)  | 
|
356  | 
apply(simp add:assum_def)  | 
|
357  | 
apply clarify  | 
|
358  | 
apply(frule_tac j=0 and k="j" and p=pre in stability)  | 
|
359  | 
apply simp_all  | 
|
360  | 
apply(erule_tac x=i in allE,simp)  | 
|
361  | 
apply(erule_tac i=j and f=f in unique_ctran_Basic,simp_all)  | 
|
362  | 
apply(case_tac "x!j")  | 
|
363  | 
apply clarify  | 
|
364  | 
apply simp  | 
|
365  | 
apply(drule_tac s="Some (Basic f)" in sym,simp)  | 
|
366  | 
apply(case_tac "x!Suc j",simp)  | 
|
| 23746 | 367  | 
apply(rule ctran.cases,simp)  | 
| 
20432
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
368  | 
apply(simp_all)  | 
| 13020 | 369  | 
apply(drule_tac c=sa in subsetD,simp)  | 
370  | 
apply clarify  | 
|
371  | 
apply(frule_tac j="Suc j" and k="length x - 1" and p=post in stability,simp_all)  | 
|
| 
20432
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
372  | 
apply(case_tac x,simp+)  | 
| 13020 | 373  | 
apply(erule_tac x=i in allE)  | 
| 
20432
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
374  | 
apply(erule_tac i=j and f=f in unique_ctran_Basic,simp_all)  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
375  | 
apply arith+  | 
| 13020 | 376  | 
apply(case_tac x)  | 
| 
20432
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
377  | 
apply(simp add:last_length)+  | 
| 13020 | 378  | 
done  | 
379  | 
||
| 59189 | 380  | 
subsubsection\<open>Soundness of the Await rule\<close>  | 
| 13020 | 381  | 
|
| 59189 | 382  | 
lemma unique_ctran_Await [rule_format]:  | 
383  | 
"\<forall>s i. x \<in> cptn \<longrightarrow> x ! 0 = (Some (Await b c), s) \<longrightarrow>  | 
|
384  | 
Suc i<length x \<longrightarrow> x!i -c\<rightarrow> x!Suc i \<longrightarrow>  | 
|
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
385  | 
(\<forall>j. Suc j<length x \<longrightarrow> i\<noteq>j \<longrightarrow> x!j -e\<rightarrow> x!Suc j)"  | 
| 13020 | 386  | 
apply(induct x,simp+)  | 
387  | 
apply clarify  | 
|
| 23746 | 388  | 
apply(erule cptn.cases,simp)  | 
| 13020 | 389  | 
apply(case_tac i,simp+)  | 
390  | 
apply clarify  | 
|
391  | 
apply(case_tac j,simp)  | 
|
392  | 
apply(rule Env)  | 
|
393  | 
apply simp  | 
|
394  | 
apply clarify  | 
|
395  | 
apply simp  | 
|
396  | 
apply(case_tac i)  | 
|
397  | 
apply(case_tac j,simp,simp)  | 
|
| 23746 | 398  | 
apply(erule ctran.cases,simp_all)  | 
| 13020 | 399  | 
apply(force elim: not_ctran_None)  | 
| 23746 | 400  | 
apply(ind_cases "((Some (Await b c), sa), Q, t) \<in> ctran" for sa Q t,simp)  | 
| 13020 | 401  | 
apply(drule_tac i=nat in not_ctran_None,simp)  | 
| 23746 | 402  | 
apply(erule etranE,simp)  | 
| 13020 | 403  | 
done  | 
404  | 
||
| 59189 | 405  | 
lemma exists_ctran_Await_None [rule_format]:  | 
406  | 
"\<forall>s i. x \<in> cptn \<longrightarrow> x ! 0 = (Some (Await b c), s)  | 
|
| 13020 | 407  | 
\<longrightarrow> i<length x \<longrightarrow> fst(x!i)=None \<longrightarrow> (\<exists>j<i. x!j -c\<rightarrow> x!Suc j)"  | 
408  | 
apply(induct x,simp+)  | 
|
409  | 
apply clarify  | 
|
| 23746 | 410  | 
apply(erule cptn.cases,simp)  | 
| 13020 | 411  | 
apply(case_tac i,simp+)  | 
412  | 
apply(erule_tac x=nat in allE,simp)  | 
|
413  | 
apply clarify  | 
|
414  | 
apply(rule_tac x="Suc j" in exI,simp,simp)  | 
|
415  | 
apply clarify  | 
|
416  | 
apply(case_tac i,simp,simp)  | 
|
417  | 
apply(rule_tac x=0 in exI,simp)  | 
|
418  | 
done  | 
|
419  | 
||
| 59189 | 420  | 
lemma Star_imp_cptn:  | 
| 13020 | 421  | 
"(P, s) -c*\<rightarrow> (R, t) \<Longrightarrow> \<exists>l \<in> cp P s. (last l)=(R, t)  | 
422  | 
\<and> (\<forall>i. Suc i<length l \<longrightarrow> l!i -c\<rightarrow> l!Suc i)"  | 
|
423  | 
apply (erule converse_rtrancl_induct2)  | 
|
424  | 
apply(rule_tac x="[(R,t)]" in bexI)  | 
|
425  | 
apply simp  | 
|
426  | 
apply(simp add:cp_def)  | 
|
427  | 
apply(rule CptnOne)  | 
|
428  | 
apply clarify  | 
|
429  | 
apply(rule_tac x="(a, b)#l" in bexI)  | 
|
430  | 
apply (rule conjI)  | 
|
431  | 
apply(case_tac l,simp add:cp_def)  | 
|
432  | 
apply(simp add:last_length)  | 
|
433  | 
apply clarify  | 
|
434  | 
apply(case_tac i,simp)  | 
|
435  | 
apply(simp add:cp_def)  | 
|
436  | 
apply force  | 
|
437  | 
apply(simp add:cp_def)  | 
|
438  | 
apply(case_tac l)  | 
|
| 23746 | 439  | 
apply(force elim:cptn.cases)  | 
| 13020 | 440  | 
apply simp  | 
441  | 
apply(erule CptnComp)  | 
|
442  | 
apply clarify  | 
|
443  | 
done  | 
|
| 59189 | 444  | 
|
445  | 
lemma Await_sound:  | 
|
| 13020 | 446  | 
"\<lbrakk>stable pre rely; stable post rely;  | 
| 59189 | 447  | 
  \<forall>V. \<turnstile> P sat [pre \<inter> b \<inter> {s. s = V}, {(s, t). s = t},
 | 
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
448  | 
                 UNIV, {s. (V, s) \<in> guar} \<inter> post] \<and>
 | 
| 59189 | 449  | 
  \<Turnstile> P sat [pre \<inter> b \<inter> {s. s = V}, {(s, t). s = t},
 | 
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
450  | 
                 UNIV, {s. (V, s) \<in> guar} \<inter> post] \<rbrakk>
 | 
| 13020 | 451  | 
\<Longrightarrow> \<Turnstile> Await b P sat [pre, rely, guar, post]"  | 
452  | 
apply(unfold com_validity_def)  | 
|
453  | 
apply clarify  | 
|
454  | 
apply(simp add:comm_def)  | 
|
455  | 
apply(rule conjI)  | 
|
456  | 
apply clarify  | 
|
457  | 
apply(simp add:cp_def assum_def)  | 
|
458  | 
apply clarify  | 
|
459  | 
apply(frule_tac j=0 and k=i and p=pre in stability,simp_all)  | 
|
460  | 
apply(erule_tac x=ia in allE,simp)  | 
|
461  | 
apply(subgoal_tac "x\<in> cp (Some(Await b P)) s")  | 
|
462  | 
apply(erule_tac i=i in unique_ctran_Await,force,simp_all)  | 
|
463  | 
apply(simp add:cp_def)  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
464  | 
\<comment> \<open>here starts the different part.\<close>  | 
| 23746 | 465  | 
apply(erule ctran.cases,simp_all)  | 
| 59189 | 466  | 
apply(drule Star_imp_cptn)  | 
| 13020 | 467  | 
apply clarify  | 
468  | 
apply(erule_tac x=sa in allE)  | 
|
469  | 
apply clarify  | 
|
470  | 
apply(erule_tac x=sa in allE)  | 
|
471  | 
apply(drule_tac c=l in subsetD)  | 
|
472  | 
apply (simp add:cp_def)  | 
|
473  | 
apply clarify  | 
|
| 59807 | 474  | 
apply(erule_tac x=ia and P="\<lambda>i. H i \<longrightarrow> (J i, I i)\<in>ctran" for H J I in allE,simp)  | 
| 23746 | 475  | 
apply(erule etranE,simp)  | 
| 13020 | 476  | 
apply simp  | 
477  | 
apply clarify  | 
|
478  | 
apply(simp add:cp_def)  | 
|
479  | 
apply clarify  | 
|
480  | 
apply(frule_tac i="length x - 1" in exists_ctran_Await_None,force)  | 
|
481  | 
apply (case_tac x,simp+)  | 
|
482  | 
apply(rule last_fst_esp,simp add:last_length)  | 
|
| 
52597
 
a8a81453833d
more precise fact declarations -- fewer warnings;
 
wenzelm 
parents: 
42174 
diff
changeset
 | 
483  | 
apply(case_tac x, simp+)  | 
| 13020 | 484  | 
apply clarify  | 
485  | 
apply(simp add:assum_def)  | 
|
486  | 
apply clarify  | 
|
487  | 
apply(frule_tac j=0 and k="j" and p=pre in stability,simp_all)  | 
|
488  | 
apply(erule_tac x=i in allE,simp)  | 
|
489  | 
apply(erule_tac i=j in unique_ctran_Await,force,simp_all)  | 
|
490  | 
apply(case_tac "x!j")  | 
|
491  | 
apply clarify  | 
|
492  | 
apply simp  | 
|
493  | 
apply(drule_tac s="Some (Await b P)" in sym,simp)  | 
|
494  | 
apply(case_tac "x!Suc j",simp)  | 
|
| 23746 | 495  | 
apply(rule ctran.cases,simp)  | 
| 
20432
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
496  | 
apply(simp_all)  | 
| 59189 | 497  | 
apply(drule Star_imp_cptn)  | 
| 13020 | 498  | 
apply clarify  | 
499  | 
apply(erule_tac x=sa in allE)  | 
|
500  | 
apply clarify  | 
|
501  | 
apply(erule_tac x=sa in allE)  | 
|
502  | 
apply(drule_tac c=l in subsetD)  | 
|
503  | 
apply (simp add:cp_def)  | 
|
504  | 
apply clarify  | 
|
| 59807 | 505  | 
apply(erule_tac x=i and P="\<lambda>i. H i \<longrightarrow> (J i, I i)\<in>ctran" for H J I in allE,simp)  | 
| 23746 | 506  | 
apply(erule etranE,simp)  | 
| 13020 | 507  | 
apply simp  | 
508  | 
apply clarify  | 
|
509  | 
apply(frule_tac j="Suc j" and k="length x - 1" and p=post in stability,simp_all)  | 
|
| 
20432
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
510  | 
apply(case_tac x,simp+)  | 
| 13020 | 511  | 
apply(erule_tac x=i in allE)  | 
| 
20432
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
512  | 
apply(erule_tac i=j in unique_ctran_Await,force,simp_all)  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
513  | 
apply arith+  | 
| 13020 | 514  | 
apply(case_tac x)  | 
| 
20432
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
515  | 
apply(simp add:last_length)+  | 
| 13020 | 516  | 
done  | 
517  | 
||
| 59189 | 518  | 
subsubsection\<open>Soundness of the Conditional rule\<close>  | 
| 13020 | 519  | 
|
| 59189 | 520  | 
lemma Cond_sound:  | 
521  | 
"\<lbrakk> stable pre rely; \<Turnstile> P1 sat [pre \<inter> b, rely, guar, post];  | 
|
| 13020 | 522  | 
\<Turnstile> P2 sat [pre \<inter> - b, rely, guar, post]; \<forall>s. (s,s)\<in>guar\<rbrakk>  | 
523  | 
\<Longrightarrow> \<Turnstile> (Cond b P1 P2) sat [pre, rely, guar, post]"  | 
|
524  | 
apply(unfold com_validity_def)  | 
|
525  | 
apply clarify  | 
|
526  | 
apply(simp add:cp_def comm_def)  | 
|
527  | 
apply(case_tac "\<exists>i. Suc i<length x \<and> x!i -c\<rightarrow> x!Suc i")  | 
|
528  | 
prefer 2  | 
|
529  | 
apply simp  | 
|
530  | 
apply clarify  | 
|
531  | 
apply(frule_tac j="0" and k="length x - 1" and p=pre in stability,simp+)  | 
|
532  | 
apply(case_tac x,simp+)  | 
|
533  | 
apply(simp add:assum_def)  | 
|
534  | 
apply(simp add:assum_def)  | 
|
535  | 
apply(erule_tac m="length x" in etran_or_ctran,simp+)  | 
|
536  | 
apply(case_tac x, (simp add:last_length)+)  | 
|
537  | 
apply(erule exE)  | 
|
| 59807 | 538  | 
apply(drule_tac n=i and P="\<lambda>i. H i \<and> (J i, I i) \<in> ctran" for H J I in Ex_first_occurrence)  | 
| 13020 | 539  | 
apply clarify  | 
540  | 
apply (simp add:assum_def)  | 
|
541  | 
apply(frule_tac j=0 and k="m" and p=pre in stability,simp+)  | 
|
542  | 
apply(erule_tac m="Suc m" in etran_or_ctran,simp+)  | 
|
| 23746 | 543  | 
apply(erule ctran.cases,simp_all)  | 
| 13020 | 544  | 
apply(erule_tac x="sa" in allE)  | 
545  | 
apply(drule_tac c="drop (Suc m) x" in subsetD)  | 
|
546  | 
apply simp  | 
|
547  | 
apply clarify  | 
|
548  | 
apply simp  | 
|
| 
17528
 
2a602a8462d5
fixed proof script of lemma Cond_sound (Why did it stop working anyway?);
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
549  | 
apply clarify  | 
| 
 
2a602a8462d5
fixed proof script of lemma Cond_sound (Why did it stop working anyway?);
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
550  | 
apply(case_tac "i\<le>m")  | 
| 
 
2a602a8462d5
fixed proof script of lemma Cond_sound (Why did it stop working anyway?);
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
551  | 
apply(drule le_imp_less_or_eq)  | 
| 
 
2a602a8462d5
fixed proof script of lemma Cond_sound (Why did it stop working anyway?);
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
552  | 
apply(erule disjE)  | 
| 
 
2a602a8462d5
fixed proof script of lemma Cond_sound (Why did it stop working anyway?);
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
553  | 
apply(erule_tac x=i in allE, erule impE, assumption)  | 
| 
 
2a602a8462d5
fixed proof script of lemma Cond_sound (Why did it stop working anyway?);
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
554  | 
apply simp+  | 
| 59807 | 555  | 
apply(erule_tac x="i - (Suc m)" and P="\<lambda>j. H j \<longrightarrow> J j \<longrightarrow> (I j)\<in>guar" for H J I in allE)  | 
| 
20432
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
556  | 
apply(subgoal_tac "(Suc m)+(i - Suc m) \<le> length x")  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
557  | 
apply(subgoal_tac "(Suc m)+Suc (i - Suc m) \<le> length x")  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
558  | 
apply(rotate_tac -2)  | 
| 13020 | 559  | 
apply simp  | 
560  | 
apply arith  | 
|
561  | 
apply arith  | 
|
| 
20432
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
562  | 
apply(case_tac "length (drop (Suc m) x)",simp)  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
563  | 
apply(erule_tac x="sa" in allE)  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
564  | 
back  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
565  | 
apply(drule_tac c="drop (Suc m) x" in subsetD,simp)  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
566  | 
apply clarify  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
567  | 
apply simp  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
568  | 
apply clarify  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
569  | 
apply(case_tac "i\<le>m")  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
570  | 
apply(drule le_imp_less_or_eq)  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
571  | 
apply(erule disjE)  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
572  | 
apply(erule_tac x=i in allE, erule impE, assumption)  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
573  | 
apply simp  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
574  | 
apply simp  | 
| 59807 | 575  | 
apply(erule_tac x="i - (Suc m)" and P="\<lambda>j. H j \<longrightarrow> J j \<longrightarrow> (I j)\<in>guar" for H J I in allE)  | 
| 
20432
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
576  | 
apply(subgoal_tac "(Suc m)+(i - Suc m) \<le> length x")  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
577  | 
apply(subgoal_tac "(Suc m)+Suc (i - Suc m) \<le> length x")  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
578  | 
apply(rotate_tac -2)  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
579  | 
apply simp  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
580  | 
apply arith  | 
| 
 
07ec57376051
lin_arith_prover: splitting reverted because of performance loss
 
webertj 
parents: 
20272 
diff
changeset
 | 
581  | 
apply arith  | 
| 
20217
 
25b068a99d2b
linear arithmetic splits certain operators (e.g. min, max, abs)
 
webertj 
parents: 
18576 
diff
changeset
 | 
582  | 
done  | 
| 13020 | 583  | 
|
| 59189 | 584  | 
subsubsection\<open>Soundness of the Sequential rule\<close>  | 
| 13020 | 585  | 
|
586  | 
inductive_cases Seq_cases [elim!]: "(Some (Seq P Q), s) -c\<rightarrow> t"  | 
|
587  | 
||
588  | 
lemma last_lift_not_None: "fst ((lift Q) ((x#xs)!(length xs))) \<noteq> None"  | 
|
589  | 
apply(subgoal_tac "length xs<length (x # xs)")  | 
|
590  | 
apply(drule_tac Q=Q in lift_nth)  | 
|
591  | 
apply(erule ssubst)  | 
|
592  | 
apply (simp add:lift_def)  | 
|
593  | 
apply(case_tac "(x # xs) ! length xs",simp)  | 
|
594  | 
apply simp  | 
|
595  | 
done  | 
|
596  | 
||
| 59189 | 597  | 
lemma Seq_sound1 [rule_format]:  | 
598  | 
"x\<in> cptn_mod \<Longrightarrow> \<forall>s P. x !0=(Some (Seq P Q), s) \<longrightarrow>  | 
|
599  | 
(\<forall>i<length x. fst(x!i)\<noteq>Some Q) \<longrightarrow>  | 
|
| 13020 | 600  | 
(\<exists>xs\<in> cp (Some P) s. x=map (lift Q) xs)"  | 
| 
71989
 
bad75618fb82
extraction of equations x = t from premises beneath meta-all
 
haftmann 
parents: 
71836 
diff
changeset
 | 
601  | 
supply [[simproc del: defined_all]]  | 
| 13020 | 602  | 
apply(erule cptn_mod.induct)  | 
603  | 
apply(unfold cp_def)  | 
|
604  | 
apply safe  | 
|
605  | 
apply simp_all  | 
|
606  | 
apply(simp add:lift_def)  | 
|
607  | 
apply(rule_tac x="[(Some Pa, sa)]" in exI,simp add:CptnOne)  | 
|
608  | 
apply(subgoal_tac "(\<forall>i < Suc (length xs). fst (((Some (Seq Pa Q), t) # xs) ! i) \<noteq> Some Q)")  | 
|
609  | 
apply clarify  | 
|
| 14025 | 610  | 
apply(rule_tac x="(Some Pa, sa) #(Some Pa, t) # zs" in exI,simp)  | 
| 13020 | 611  | 
apply(rule conjI,erule CptnEnv)  | 
| 13601 | 612  | 
apply(simp (no_asm_use) add:lift_def)  | 
| 13020 | 613  | 
apply clarify  | 
614  | 
apply(erule_tac x="Suc i" in allE, simp)  | 
|
| 23746 | 615  | 
apply(ind_cases "((Some (Seq Pa Q), sa), None, t) \<in> ctran" for Pa sa t)  | 
| 13020 | 616  | 
apply(rule_tac x="(Some P, sa) # xs" in exI, simp add:cptn_iff_cptn_mod lift_def)  | 
617  | 
apply(erule_tac x="length xs" in allE, simp)  | 
|
618  | 
apply(simp only:Cons_lift_append)  | 
|
619  | 
apply(subgoal_tac "length xs < length ((Some P, sa) # xs)")  | 
|
620  | 
apply(simp only :nth_append length_map last_length nth_map)  | 
|
621  | 
apply(case_tac "last((Some P, sa) # xs)")  | 
|
622  | 
apply(simp add:lift_def)  | 
|
623  | 
apply simp  | 
|
624  | 
done  | 
|
625  | 
||
| 59189 | 626  | 
lemma Seq_sound2 [rule_format]:  | 
627  | 
"x \<in> cptn \<Longrightarrow> \<forall>s P i. x!0=(Some (Seq P Q), s) \<longrightarrow> i<length x  | 
|
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
628  | 
\<longrightarrow> fst(x!i)=Some Q \<longrightarrow>  | 
| 13020 | 629  | 
(\<forall>j<i. fst(x!j)\<noteq>(Some Q)) \<longrightarrow>  | 
| 59189 | 630  | 
(\<exists>xs ys. xs \<in> cp (Some P) s \<and> length xs=Suc i  | 
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
631  | 
\<and> ys \<in> cp (Some Q) (snd(xs !i)) \<and> x=(map (lift Q) xs)@tl ys)"  | 
| 
71989
 
bad75618fb82
extraction of equations x = t from premises beneath meta-all
 
haftmann 
parents: 
71836 
diff
changeset
 | 
632  | 
supply [[simproc del: defined_all]]  | 
| 13020 | 633  | 
apply(erule cptn.induct)  | 
634  | 
apply(unfold cp_def)  | 
|
635  | 
apply safe  | 
|
636  | 
apply simp_all  | 
|
637  | 
apply(case_tac i,simp+)  | 
|
638  | 
apply(erule allE,erule impE,assumption,simp)  | 
|
639  | 
apply clarify  | 
|
640  | 
apply(subgoal_tac "(\<forall>j < nat. fst (((Some (Seq Pa Q), t) # xs) ! j) \<noteq> Some Q)",clarify)  | 
|
641  | 
prefer 2  | 
|
642  | 
apply force  | 
|
643  | 
apply(case_tac xsa,simp,simp)  | 
|
| 
55417
 
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
 
blanchet 
parents: 
54859 
diff
changeset
 | 
644  | 
apply(rename_tac list)  | 
| 13020 | 645  | 
apply(rule_tac x="(Some Pa, sa) #(Some Pa, t) # list" in exI,simp)  | 
646  | 
apply(rule conjI,erule CptnEnv)  | 
|
| 13601 | 647  | 
apply(simp (no_asm_use) add:lift_def)  | 
| 13020 | 648  | 
apply(rule_tac x=ys in exI,simp)  | 
| 23746 | 649  | 
apply(ind_cases "((Some (Seq Pa Q), sa), t) \<in> ctran" for Pa sa t)  | 
| 13020 | 650  | 
apply simp  | 
651  | 
apply(rule_tac x="(Some Pa, sa)#[(None, ta)]" in exI,simp)  | 
|
652  | 
apply(rule conjI)  | 
|
653  | 
apply(drule_tac xs="[]" in CptnComp,force simp add:CptnOne,simp)  | 
|
654  | 
apply(case_tac i, simp+)  | 
|
655  | 
apply(case_tac nat,simp+)  | 
|
656  | 
apply(rule_tac x="(Some Q,ta)#xs" in exI,simp add:lift_def)  | 
|
657  | 
apply(case_tac nat,simp+)  | 
|
658  | 
apply(force)  | 
|
659  | 
apply(case_tac i, simp+)  | 
|
660  | 
apply(case_tac nat,simp+)  | 
|
661  | 
apply(erule_tac x="Suc nata" in allE,simp)  | 
|
662  | 
apply clarify  | 
|
663  | 
apply(subgoal_tac "(\<forall>j<Suc nata. fst (((Some (Seq P2 Q), ta) # xs) ! j) \<noteq> Some Q)",clarify)  | 
|
664  | 
prefer 2  | 
|
665  | 
apply clarify  | 
|
666  | 
apply force  | 
|
667  | 
apply(rule_tac x="(Some Pa, sa)#(Some P2, ta)#(tl xsa)" in exI,simp)  | 
|
668  | 
apply(rule conjI,erule CptnComp)  | 
|
669  | 
apply(rule nth_tl_if,force,simp+)  | 
|
670  | 
apply(rule_tac x=ys in exI,simp)  | 
|
671  | 
apply(rule conjI)  | 
|
672  | 
apply(rule nth_tl_if,force,simp+)  | 
|
673  | 
apply(rule tl_zero,simp+)  | 
|
674  | 
apply force  | 
|
675  | 
apply(rule conjI,simp add:lift_def)  | 
|
| 59189 | 676  | 
apply(subgoal_tac "lift Q (Some P2, ta) =(Some (Seq P2 Q), ta)")  | 
| 55465 | 677  | 
apply(simp add:Cons_lift del:list.map)  | 
| 13020 | 678  | 
apply(rule nth_tl_if)  | 
679  | 
apply force  | 
|
680  | 
apply simp+  | 
|
681  | 
apply(simp add:lift_def)  | 
|
682  | 
done  | 
|
683  | 
(*  | 
|
684  | 
lemma last_lift_not_None3: "fst (last (map (lift Q) (x#xs))) \<noteq> None"  | 
|
685  | 
apply(simp only:last_length [THEN sym])  | 
|
686  | 
apply(subgoal_tac "length xs<length (x # xs)")  | 
|
687  | 
apply(drule_tac Q=Q in lift_nth)  | 
|
688  | 
apply(erule ssubst)  | 
|
689  | 
apply (simp add:lift_def)  | 
|
690  | 
apply(case_tac "(x # xs) ! length xs",simp)  | 
|
691  | 
apply simp  | 
|
692  | 
done  | 
|
693  | 
*)  | 
|
694  | 
||
695  | 
lemma last_lift_not_None2: "fst ((lift Q) (last (x#xs))) \<noteq> None"  | 
|
696  | 
apply(simp only:last_length [THEN sym])  | 
|
697  | 
apply(subgoal_tac "length xs<length (x # xs)")  | 
|
698  | 
apply(drule_tac Q=Q in lift_nth)  | 
|
699  | 
apply(erule ssubst)  | 
|
700  | 
apply (simp add:lift_def)  | 
|
701  | 
apply(case_tac "(x # xs) ! length xs",simp)  | 
|
702  | 
apply simp  | 
|
703  | 
done  | 
|
704  | 
||
| 59189 | 705  | 
lemma Seq_sound:  | 
| 13020 | 706  | 
"\<lbrakk>\<Turnstile> P sat [pre, rely, guar, mid]; \<Turnstile> Q sat [mid, rely, guar, post]\<rbrakk>  | 
707  | 
\<Longrightarrow> \<Turnstile> Seq P Q sat [pre, rely, guar, post]"  | 
|
708  | 
apply(unfold com_validity_def)  | 
|
709  | 
apply clarify  | 
|
710  | 
apply(case_tac "\<exists>i<length x. fst(x!i)=Some Q")  | 
|
711  | 
prefer 2  | 
|
712  | 
apply (simp add:cp_def cptn_iff_cptn_mod)  | 
|
713  | 
apply clarify  | 
|
714  | 
apply(frule_tac Seq_sound1,force)  | 
|
715  | 
apply force  | 
|
716  | 
apply clarify  | 
|
717  | 
apply(erule_tac x=s in allE,simp)  | 
|
718  | 
apply(drule_tac c=xs in subsetD,simp add:cp_def cptn_iff_cptn_mod)  | 
|
719  | 
apply(simp add:assum_def)  | 
|
720  | 
apply clarify  | 
|
| 59807 | 721  | 
apply(erule_tac P="\<lambda>j. H j \<longrightarrow> J j \<longrightarrow> I j" for H J I in allE,erule impE, assumption)  | 
| 13020 | 722  | 
apply(simp add:snd_lift)  | 
723  | 
apply(erule mp)  | 
|
| 23746 | 724  | 
apply(force elim:etranE intro:Env simp add:lift_def)  | 
| 13020 | 725  | 
apply(simp add:comm_def)  | 
726  | 
apply(rule conjI)  | 
|
727  | 
apply clarify  | 
|
| 59807 | 728  | 
apply(erule_tac P="\<lambda>j. H j \<longrightarrow> J j \<longrightarrow> I j" for H J I in allE,erule impE, assumption)  | 
| 13020 | 729  | 
apply(simp add:snd_lift)  | 
730  | 
apply(erule mp)  | 
|
731  | 
apply(case_tac "(xs!i)")  | 
|
732  | 
apply(case_tac "(xs! Suc i)")  | 
|
733  | 
apply(case_tac "fst(xs!i)")  | 
|
734  | 
apply(erule_tac x=i in allE, simp add:lift_def)  | 
|
735  | 
apply(case_tac "fst(xs!Suc i)")  | 
|
736  | 
apply(force simp add:lift_def)  | 
|
737  | 
apply(force simp add:lift_def)  | 
|
738  | 
apply clarify  | 
|
739  | 
apply(case_tac xs,simp add:cp_def)  | 
|
740  | 
apply clarify  | 
|
| 55465 | 741  | 
apply (simp del:list.map)  | 
| 
55417
 
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
 
blanchet 
parents: 
54859 
diff
changeset
 | 
742  | 
apply (rename_tac list)  | 
| 13020 | 743  | 
apply(subgoal_tac "(map (lift Q) ((a, b) # list))\<noteq>[]")  | 
| 17588 | 744  | 
apply(drule last_conv_nth)  | 
| 55465 | 745  | 
apply (simp del:list.map)  | 
| 13020 | 746  | 
apply(simp only:last_lift_not_None)  | 
747  | 
apply simp  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
748  | 
\<comment> \<open>\<open>\<exists>i<length x. fst (x ! i) = Some Q\<close>\<close>  | 
| 13020 | 749  | 
apply(erule exE)  | 
750  | 
apply(drule_tac n=i and P="\<lambda>i. i < length x \<and> fst (x ! i) = Some Q" in Ex_first_occurrence)  | 
|
751  | 
apply clarify  | 
|
752  | 
apply (simp add:cp_def)  | 
|
753  | 
apply clarify  | 
|
754  | 
apply(frule_tac i=m in Seq_sound2,force)  | 
|
755  | 
apply simp+  | 
|
756  | 
apply clarify  | 
|
757  | 
apply(simp add:comm_def)  | 
|
758  | 
apply(erule_tac x=s in allE)  | 
|
759  | 
apply(drule_tac c=xs in subsetD,simp)  | 
|
760  | 
apply(case_tac "xs=[]",simp)  | 
|
761  | 
apply(simp add:cp_def assum_def nth_append)  | 
|
762  | 
apply clarify  | 
|
763  | 
apply(erule_tac x=i in allE)  | 
|
| 59189 | 764  | 
back  | 
| 13020 | 765  | 
apply(simp add:snd_lift)  | 
766  | 
apply(erule mp)  | 
|
| 23746 | 767  | 
apply(force elim:etranE intro:Env simp add:lift_def)  | 
| 13020 | 768  | 
apply simp  | 
769  | 
apply clarify  | 
|
770  | 
apply(erule_tac x="snd(xs!m)" in allE)  | 
|
771  | 
apply(drule_tac c=ys in subsetD,simp add:cp_def assum_def)  | 
|
772  | 
apply(case_tac "xs\<noteq>[]")  | 
|
| 17588 | 773  | 
apply(drule last_conv_nth,simp)  | 
| 13020 | 774  | 
apply(rule conjI)  | 
775  | 
apply(erule mp)  | 
|
776  | 
apply(case_tac "xs!m")  | 
|
777  | 
apply(case_tac "fst(xs!m)",simp)  | 
|
778  | 
apply(simp add:lift_def nth_append)  | 
|
779  | 
apply clarify  | 
|
780  | 
apply(erule_tac x="m+i" in allE)  | 
|
781  | 
back  | 
|
782  | 
back  | 
|
783  | 
apply(case_tac ys,(simp add:nth_append)+)  | 
|
784  | 
apply (case_tac i, (simp add:snd_lift)+)  | 
|
785  | 
apply(erule mp)  | 
|
786  | 
apply(case_tac "xs!m")  | 
|
| 23746 | 787  | 
apply(force elim:etran.cases intro:Env simp add:lift_def)  | 
| 59189 | 788  | 
apply simp  | 
| 13020 | 789  | 
apply simp  | 
790  | 
apply clarify  | 
|
791  | 
apply(rule conjI,clarify)  | 
|
792  | 
apply(case_tac "i<m",simp add:nth_append)  | 
|
793  | 
apply(simp add:snd_lift)  | 
|
794  | 
apply(erule allE, erule impE, assumption, erule mp)  | 
|
795  | 
apply(case_tac "(xs ! i)")  | 
|
| 59189 | 796  | 
apply(case_tac "(xs ! Suc i)")  | 
797  | 
apply(case_tac "fst(xs ! i)",force simp add:lift_def)  | 
|
| 13020 | 798  | 
apply(case_tac "fst(xs ! Suc i)")  | 
799  | 
apply (force simp add:lift_def)  | 
|
800  | 
apply (force simp add:lift_def)  | 
|
| 59189 | 801  | 
apply(erule_tac x="i-m" in allE)  | 
| 13020 | 802  | 
back  | 
803  | 
back  | 
|
804  | 
apply(subgoal_tac "Suc (i - m) < length ys",simp)  | 
|
805  | 
prefer 2  | 
|
806  | 
apply arith  | 
|
807  | 
apply(simp add:nth_append snd_lift)  | 
|
808  | 
apply(rule conjI,clarify)  | 
|
809  | 
apply(subgoal_tac "i=m")  | 
|
810  | 
prefer 2  | 
|
811  | 
apply arith  | 
|
812  | 
apply clarify  | 
|
813  | 
apply(simp add:cp_def)  | 
|
814  | 
apply(rule tl_zero)  | 
|
815  | 
apply(erule mp)  | 
|
816  | 
apply(case_tac "lift Q (xs!m)",simp add:snd_lift)  | 
|
817  | 
apply(case_tac "xs!m",case_tac "fst(xs!m)",simp add:lift_def snd_lift)  | 
|
818  | 
apply(case_tac ys,simp+)  | 
|
819  | 
apply(simp add:lift_def)  | 
|
| 59189 | 820  | 
apply simp  | 
| 13020 | 821  | 
apply force  | 
822  | 
apply clarify  | 
|
823  | 
apply(rule tl_zero)  | 
|
824  | 
apply(rule tl_zero)  | 
|
825  | 
apply (subgoal_tac "i-m=Suc(i-Suc m)")  | 
|
826  | 
apply simp  | 
|
827  | 
apply(erule mp)  | 
|
828  | 
apply(case_tac ys,simp+)  | 
|
829  | 
apply force  | 
|
830  | 
apply arith  | 
|
831  | 
apply force  | 
|
832  | 
apply clarify  | 
|
833  | 
apply(case_tac "(map (lift Q) xs @ tl ys)\<noteq>[]")  | 
|
| 17588 | 834  | 
apply(drule last_conv_nth)  | 
| 13020 | 835  | 
apply(simp add: snd_lift nth_append)  | 
836  | 
apply(rule conjI,clarify)  | 
|
837  | 
apply(case_tac ys,simp+)  | 
|
838  | 
apply clarify  | 
|
839  | 
apply(case_tac ys,simp+)  | 
|
840  | 
done  | 
|
841  | 
||
| 59189 | 842  | 
subsubsection\<open>Soundness of the While rule\<close>  | 
| 13020 | 843  | 
|
844  | 
lemma last_append[rule_format]:  | 
|
845  | 
"\<forall>xs. ys\<noteq>[] \<longrightarrow> ((xs@ys)!(length (xs@ys) - (Suc 0)))=(ys!(length ys - (Suc 0)))"  | 
|
846  | 
apply(induct ys)  | 
|
847  | 
apply simp  | 
|
848  | 
apply clarify  | 
|
| 
52597
 
a8a81453833d
more precise fact declarations -- fewer warnings;
 
wenzelm 
parents: 
42174 
diff
changeset
 | 
849  | 
apply (simp add:nth_append)  | 
| 13020 | 850  | 
done  | 
851  | 
||
| 59189 | 852  | 
lemma assum_after_body:  | 
853  | 
"\<lbrakk> \<Turnstile> P sat [pre \<inter> b, rely, guar, pre];  | 
|
| 13020 | 854  | 
(Some P, s) # xs \<in> cptn_mod; fst (last ((Some P, s) # xs)) = None; s \<in> b;  | 
| 59189 | 855  | 
(Some (While b P), s) # (Some (Seq P (While b P)), s) #  | 
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
856  | 
map (lift (While b P)) xs @ ys \<in> assum (pre, rely)\<rbrakk>  | 
| 13020 | 857  | 
\<Longrightarrow> (Some (While b P), snd (last ((Some P, s) # xs))) # ys \<in> assum (pre, rely)"  | 
858  | 
apply(simp add:assum_def com_validity_def cp_def cptn_iff_cptn_mod)  | 
|
859  | 
apply clarify  | 
|
860  | 
apply(erule_tac x=s in allE)  | 
|
861  | 
apply(drule_tac c="(Some P, s) # xs" in subsetD,simp)  | 
|
862  | 
apply clarify  | 
|
863  | 
apply(erule_tac x="Suc i" in allE)  | 
|
864  | 
apply simp  | 
|
| 55465 | 865  | 
apply(simp add:Cons_lift_append nth_append snd_lift del:list.map)  | 
| 13020 | 866  | 
apply(erule mp)  | 
| 23746 | 867  | 
apply(erule etranE,simp)  | 
| 13020 | 868  | 
apply(case_tac "fst(((Some P, s) # xs) ! i)")  | 
869  | 
apply(force intro:Env simp add:lift_def)  | 
|
870  | 
apply(force intro:Env simp add:lift_def)  | 
|
871  | 
apply(rule conjI)  | 
|
872  | 
apply clarify  | 
|
873  | 
apply(simp add:comm_def last_length)  | 
|
874  | 
apply clarify  | 
|
875  | 
apply(rule conjI)  | 
|
876  | 
apply(simp add:comm_def)  | 
|
877  | 
apply clarify  | 
|
878  | 
apply(erule_tac x="Suc(length xs + i)" in allE,simp)  | 
|
| 41842 | 879  | 
apply(case_tac i, simp add:nth_append Cons_lift_append snd_lift last_conv_nth lift_def split_def)  | 
880  | 
apply(simp add:Cons_lift_append nth_append snd_lift)  | 
|
| 13020 | 881  | 
done  | 
882  | 
||
| 59189 | 883  | 
lemma While_sound_aux [rule_format]:  | 
| 13020 | 884  | 
"\<lbrakk> pre \<inter> - b \<subseteq> post; \<Turnstile> P sat [pre \<inter> b, rely, guar, pre]; \<forall>s. (s, s) \<in> guar;  | 
| 59189 | 885  | 
stable pre rely; stable post rely; x \<in> cptn_mod \<rbrakk>  | 
| 13020 | 886  | 
\<Longrightarrow> \<forall>s xs. x=(Some(While b P),s)#xs \<longrightarrow> x\<in>assum(pre, rely) \<longrightarrow> x \<in> comm (guar, post)"  | 
| 
71989
 
bad75618fb82
extraction of equations x = t from premises beneath meta-all
 
haftmann 
parents: 
71836 
diff
changeset
 | 
887  | 
supply [[simproc del: defined_all]]  | 
| 13020 | 888  | 
apply(erule cptn_mod.induct)  | 
889  | 
apply safe  | 
|
890  | 
apply (simp_all del:last.simps)  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
891  | 
\<comment> \<open>5 subgoals left\<close>  | 
| 13020 | 892  | 
apply(simp add:comm_def)  | 
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
893  | 
\<comment> \<open>4 subgoals left\<close>  | 
| 13020 | 894  | 
apply(rule etran_in_comm)  | 
895  | 
apply(erule mp)  | 
|
896  | 
apply(erule tl_of_assum_in_assum,simp)  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
897  | 
\<comment> \<open>While-None\<close>  | 
| 23746 | 898  | 
apply(ind_cases "((Some (While b P), s), None, t) \<in> ctran" for s t)  | 
| 13020 | 899  | 
apply(simp add:comm_def)  | 
900  | 
apply(simp add:cptn_iff_cptn_mod [THEN sym])  | 
|
901  | 
apply(rule conjI,clarify)  | 
|
902  | 
apply(force simp add:assum_def)  | 
|
903  | 
apply clarify  | 
|
904  | 
apply(rule conjI, clarify)  | 
|
905  | 
apply(case_tac i,simp,simp)  | 
|
906  | 
apply(force simp add:not_ctran_None2)  | 
|
| 23746 | 907  | 
apply(subgoal_tac "\<forall>i. Suc i < length ((None, t) # xs) \<longrightarrow> (((None, t) # xs) ! i, ((None, t) # xs) ! Suc i)\<in> etran")  | 
| 13020 | 908  | 
prefer 2  | 
909  | 
apply clarify  | 
|
910  | 
apply(rule_tac m="length ((None, s) # xs)" in etran_or_ctran,simp+)  | 
|
911  | 
apply(erule not_ctran_None2,simp)  | 
|
912  | 
apply simp+  | 
|
913  | 
apply(frule_tac j="0" and k="length ((None, s) # xs) - 1" and p=post in stability,simp+)  | 
|
914  | 
apply(force simp add:assum_def subsetD)  | 
|
915  | 
apply(simp add:assum_def)  | 
|
916  | 
apply clarify  | 
|
| 59189 | 917  | 
apply(erule_tac x="i" in allE,simp)  | 
918  | 
apply(erule_tac x="Suc i" in allE,simp)  | 
|
| 13020 | 919  | 
apply simp  | 
920  | 
apply clarify  | 
|
921  | 
apply (simp add:last_length)  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
922  | 
\<comment> \<open>WhileOne\<close>  | 
| 13020 | 923  | 
apply(rule ctran_in_comm,simp)  | 
| 55465 | 924  | 
apply(simp add:Cons_lift del:list.map)  | 
925  | 
apply(simp add:comm_def del:list.map)  | 
|
| 13020 | 926  | 
apply(rule conjI)  | 
927  | 
apply clarify  | 
|
928  | 
apply(case_tac "fst(((Some P, sa) # xs) ! i)")  | 
|
929  | 
apply(case_tac "((Some P, sa) # xs) ! i")  | 
|
930  | 
apply (simp add:lift_def)  | 
|
| 23746 | 931  | 
apply(ind_cases "(Some (While b P), ba) -c\<rightarrow> t" for ba t)  | 
| 13020 | 932  | 
apply simp  | 
933  | 
apply simp  | 
|
| 55465 | 934  | 
apply(simp add:snd_lift del:list.map)  | 
| 13020 | 935  | 
apply(simp only:com_validity_def cp_def cptn_iff_cptn_mod)  | 
936  | 
apply(erule_tac x=sa in allE)  | 
|
937  | 
apply(drule_tac c="(Some P, sa) # xs" in subsetD)  | 
|
| 55465 | 938  | 
apply (simp add:assum_def del:list.map)  | 
| 13020 | 939  | 
apply clarify  | 
| 55465 | 940  | 
apply(erule_tac x="Suc ia" in allE,simp add:snd_lift del:list.map)  | 
| 13020 | 941  | 
apply(erule mp)  | 
942  | 
apply(case_tac "fst(((Some P, sa) # xs) ! ia)")  | 
|
| 23746 | 943  | 
apply(erule etranE,simp add:lift_def)  | 
| 13020 | 944  | 
apply(rule Env)  | 
| 23746 | 945  | 
apply(erule etranE,simp add:lift_def)  | 
| 13020 | 946  | 
apply(rule Env)  | 
| 55465 | 947  | 
apply (simp add:comm_def del:list.map)  | 
| 13020 | 948  | 
apply clarify  | 
949  | 
apply(erule allE,erule impE,assumption)  | 
|
950  | 
apply(erule mp)  | 
|
951  | 
apply(case_tac "((Some P, sa) # xs) ! i")  | 
|
952  | 
apply(case_tac "xs!i")  | 
|
953  | 
apply(simp add:lift_def)  | 
|
954  | 
apply(case_tac "fst(xs!i)")  | 
|
955  | 
apply force  | 
|
956  | 
apply force  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
957  | 
\<comment> \<open>last=None\<close>  | 
| 13020 | 958  | 
apply clarify  | 
959  | 
apply(subgoal_tac "(map (lift (While b P)) ((Some P, sa) # xs))\<noteq>[]")  | 
|
| 17588 | 960  | 
apply(drule last_conv_nth)  | 
| 55465 | 961  | 
apply (simp del:list.map)  | 
| 13020 | 962  | 
apply(simp only:last_lift_not_None)  | 
963  | 
apply simp  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
964  | 
\<comment> \<open>WhileMore\<close>  | 
| 13020 | 965  | 
apply(rule ctran_in_comm,simp del:last.simps)  | 
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
966  | 
\<comment> \<open>metiendo la hipotesis antes de dividir la conclusion.\<close>  | 
| 13020 | 967  | 
apply(subgoal_tac "(Some (While b P), snd (last ((Some P, sa) # xs))) # ys \<in> assum (pre, rely)")  | 
968  | 
apply (simp del:last.simps)  | 
|
969  | 
prefer 2  | 
|
970  | 
apply(erule assum_after_body)  | 
|
971  | 
apply (simp del:last.simps)+  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
972  | 
\<comment> \<open>lo de antes.\<close>  | 
| 55465 | 973  | 
apply(simp add:comm_def del:list.map last.simps)  | 
| 13020 | 974  | 
apply(rule conjI)  | 
975  | 
apply clarify  | 
|
976  | 
apply(simp only:Cons_lift_append)  | 
|
977  | 
apply(case_tac "i<length xs")  | 
|
| 55465 | 978  | 
apply(simp add:nth_append del:list.map last.simps)  | 
| 13020 | 979  | 
apply(case_tac "fst(((Some P, sa) # xs) ! i)")  | 
980  | 
apply(case_tac "((Some P, sa) # xs) ! i")  | 
|
981  | 
apply (simp add:lift_def del:last.simps)  | 
|
| 23746 | 982  | 
apply(ind_cases "(Some (While b P), ba) -c\<rightarrow> t" for ba t)  | 
| 13020 | 983  | 
apply simp  | 
984  | 
apply simp  | 
|
| 55465 | 985  | 
apply(simp add:snd_lift del:list.map last.simps)  | 
| 59807 | 986  | 
apply(thin_tac " \<forall>i. i < length ys \<longrightarrow> P i" for P)  | 
| 13020 | 987  | 
apply(simp only:com_validity_def cp_def cptn_iff_cptn_mod)  | 
988  | 
apply(erule_tac x=sa in allE)  | 
|
989  | 
apply(drule_tac c="(Some P, sa) # xs" in subsetD)  | 
|
| 55465 | 990  | 
apply (simp add:assum_def del:list.map last.simps)  | 
| 13020 | 991  | 
apply clarify  | 
| 55465 | 992  | 
apply(erule_tac x="Suc ia" in allE,simp add:nth_append snd_lift del:list.map last.simps, erule mp)  | 
| 13020 | 993  | 
apply(case_tac "fst(((Some P, sa) # xs) ! ia)")  | 
| 23746 | 994  | 
apply(erule etranE,simp add:lift_def)  | 
| 13020 | 995  | 
apply(rule Env)  | 
| 23746 | 996  | 
apply(erule etranE,simp add:lift_def)  | 
| 13020 | 997  | 
apply(rule Env)  | 
| 55465 | 998  | 
apply (simp add:comm_def del:list.map)  | 
| 13020 | 999  | 
apply clarify  | 
1000  | 
apply(erule allE,erule impE,assumption)  | 
|
1001  | 
apply(erule mp)  | 
|
1002  | 
apply(case_tac "((Some P, sa) # xs) ! i")  | 
|
1003  | 
apply(case_tac "xs!i")  | 
|
1004  | 
apply(simp add:lift_def)  | 
|
1005  | 
apply(case_tac "fst(xs!i)")  | 
|
1006  | 
apply force  | 
|
1007  | 
apply force  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
1008  | 
\<comment> \<open>\<open>i \<ge> length xs\<close>\<close>  | 
| 59189 | 1009  | 
apply(subgoal_tac "i-length xs <length ys")  | 
| 13020 | 1010  | 
prefer 2  | 
1011  | 
apply arith  | 
|
1012  | 
apply(erule_tac x="i-length xs" in allE,clarify)  | 
|
1013  | 
apply(case_tac "i=length xs")  | 
|
| 55465 | 1014  | 
apply (simp add:nth_append snd_lift del:list.map last.simps)  | 
| 13020 | 1015  | 
apply(simp add:last_length del:last.simps)  | 
1016  | 
apply(erule mp)  | 
|
1017  | 
apply(case_tac "last((Some P, sa) # xs)")  | 
|
1018  | 
apply(simp add:lift_def del:last.simps)  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
1019  | 
\<comment> \<open>\<open>i>length xs\<close>\<close>  | 
| 13020 | 1020  | 
apply(case_tac "i-length xs")  | 
1021  | 
apply arith  | 
|
| 55465 | 1022  | 
apply(simp add:nth_append del:list.map last.simps)  | 
| 13187 | 1023  | 
apply(rotate_tac -3)  | 
| 13020 | 1024  | 
apply(subgoal_tac "i- Suc (length xs)=nat")  | 
1025  | 
prefer 2  | 
|
1026  | 
apply arith  | 
|
1027  | 
apply simp  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
1028  | 
\<comment> \<open>last=None\<close>  | 
| 13020 | 1029  | 
apply clarify  | 
1030  | 
apply(case_tac ys)  | 
|
| 55465 | 1031  | 
apply(simp add:Cons_lift del:list.map last.simps)  | 
| 13020 | 1032  | 
apply(subgoal_tac "(map (lift (While b P)) ((Some P, sa) # xs))\<noteq>[]")  | 
| 17588 | 1033  | 
apply(drule last_conv_nth)  | 
| 55465 | 1034  | 
apply (simp del:list.map)  | 
| 13020 | 1035  | 
apply(simp only:last_lift_not_None)  | 
1036  | 
apply simp  | 
|
1037  | 
apply(subgoal_tac "((Some (Seq P (While b P)), sa) # map (lift (While b P)) xs @ ys)\<noteq>[]")  | 
|
| 17588 | 1038  | 
apply(drule last_conv_nth)  | 
| 55465 | 1039  | 
apply (simp del:list.map last.simps)  | 
| 13020 | 1040  | 
apply(simp add:nth_append del:last.simps)  | 
| 
55417
 
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
 
blanchet 
parents: 
54859 
diff
changeset
 | 
1041  | 
apply(rename_tac a list)  | 
| 13020 | 1042  | 
apply(subgoal_tac "((Some (While b P), snd (last ((Some P, sa) # xs))) # a # list)\<noteq>[]")  | 
| 17588 | 1043  | 
apply(drule last_conv_nth)  | 
| 55465 | 1044  | 
apply (simp del:list.map last.simps)  | 
| 13020 | 1045  | 
apply simp  | 
1046  | 
apply simp  | 
|
1047  | 
done  | 
|
1048  | 
||
| 59189 | 1049  | 
lemma While_sound:  | 
| 13020 | 1050  | 
"\<lbrakk>stable pre rely; pre \<inter> - b \<subseteq> post; stable post rely;  | 
1051  | 
\<Turnstile> P sat [pre \<inter> b, rely, guar, pre]; \<forall>s. (s,s)\<in>guar\<rbrakk>  | 
|
1052  | 
\<Longrightarrow> \<Turnstile> While b P sat [pre, rely, guar, post]"  | 
|
1053  | 
apply(unfold com_validity_def)  | 
|
1054  | 
apply clarify  | 
|
1055  | 
apply(erule_tac xs="tl x" in While_sound_aux)  | 
|
1056  | 
apply(simp add:com_validity_def)  | 
|
1057  | 
apply force  | 
|
1058  | 
apply simp_all  | 
|
1059  | 
apply(simp add:cptn_iff_cptn_mod cp_def)  | 
|
1060  | 
apply(simp add:cp_def)  | 
|
1061  | 
apply clarify  | 
|
1062  | 
apply(rule nth_equalityI)  | 
|
1063  | 
apply simp_all  | 
|
1064  | 
apply(case_tac x,simp+)  | 
|
1065  | 
apply(case_tac i,simp+)  | 
|
1066  | 
apply(case_tac x,simp+)  | 
|
1067  | 
done  | 
|
1068  | 
||
| 59189 | 1069  | 
subsubsection\<open>Soundness of the Rule of Consequence\<close>  | 
| 13020 | 1070  | 
|
| 59189 | 1071  | 
lemma Conseq_sound:  | 
1072  | 
"\<lbrakk>pre \<subseteq> pre'; rely \<subseteq> rely'; guar' \<subseteq> guar; post' \<subseteq> post;  | 
|
| 13020 | 1073  | 
\<Turnstile> P sat [pre', rely', guar', post']\<rbrakk>  | 
1074  | 
\<Longrightarrow> \<Turnstile> P sat [pre, rely, guar, post]"  | 
|
1075  | 
apply(simp add:com_validity_def assum_def comm_def)  | 
|
1076  | 
apply clarify  | 
|
1077  | 
apply(erule_tac x=s in allE)  | 
|
1078  | 
apply(drule_tac c=x in subsetD)  | 
|
1079  | 
apply force  | 
|
1080  | 
apply force  | 
|
1081  | 
done  | 
|
1082  | 
||
| 59189 | 1083  | 
subsubsection \<open>Soundness of the system for sequential component programs\<close>  | 
| 13020 | 1084  | 
|
| 59189 | 1085  | 
theorem rgsound:  | 
| 13020 | 1086  | 
"\<turnstile> P sat [pre, rely, guar, post] \<Longrightarrow> \<Turnstile> P sat [pre, rely, guar, post]"  | 
1087  | 
apply(erule rghoare.induct)  | 
|
1088  | 
apply(force elim:Basic_sound)  | 
|
1089  | 
apply(force elim:Seq_sound)  | 
|
1090  | 
apply(force elim:Cond_sound)  | 
|
1091  | 
apply(force elim:While_sound)  | 
|
1092  | 
apply(force elim:Await_sound)  | 
|
1093  | 
apply(erule Conseq_sound,simp+)  | 
|
| 59189 | 1094  | 
done  | 
| 13020 | 1095  | 
|
| 59189 | 1096  | 
subsection \<open>Soundness of the System for Parallel Programs\<close>  | 
| 13020 | 1097  | 
|
| 
35416
 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 
haftmann 
parents: 
32687 
diff
changeset
 | 
1098  | 
definition ParallelCom :: "('a rgformula) list \<Rightarrow> 'a par_com" where
 | 
| 59189 | 1099  | 
"ParallelCom Ps \<equiv> map (Some \<circ> fst) Ps"  | 
| 13020 | 1100  | 
|
| 59189 | 1101  | 
lemma two:  | 
1102  | 
  "\<lbrakk> \<forall>i<length xs. rely \<union> (\<Union>j\<in>{j. j < length xs \<and> j \<noteq> i}. Guar (xs ! j))
 | 
|
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1103  | 
\<subseteq> Rely (xs ! i);  | 
| 
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1104  | 
   pre \<subseteq> (\<Inter>i\<in>{i. i < length xs}. Pre (xs ! i));
 | 
| 59189 | 1105  | 
\<forall>i<length xs.  | 
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1106  | 
\<Turnstile> Com (xs ! i) sat [Pre (xs ! i), Rely (xs ! i), Guar (xs ! i), Post (xs ! i)];  | 
| 
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1107  | 
length xs=length clist; x \<in> par_cp (ParallelCom xs) s; x\<in>par_assum(pre, rely);  | 
| 13020 | 1108  | 
\<forall>i<length clist. clist!i\<in>cp (Some(Com(xs!i))) s; x \<propto> clist \<rbrakk>  | 
| 59189 | 1109  | 
\<Longrightarrow> \<forall>j i. i<length clist \<and> Suc j<length x \<longrightarrow> (clist!i!j) -c\<rightarrow> (clist!i!Suc j)  | 
| 13020 | 1110  | 
\<longrightarrow> (snd(clist!i!j), snd(clist!i!Suc j)) \<in> Guar(xs!i)"  | 
1111  | 
apply(unfold par_cp_def)  | 
|
| 59189 | 1112  | 
apply (rule ccontr)  | 
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
1113  | 
\<comment> \<open>By contradiction:\<close>  | 
| 
52597
 
a8a81453833d
more precise fact declarations -- fewer warnings;
 
wenzelm 
parents: 
42174 
diff
changeset
 | 
1114  | 
apply simp  | 
| 13020 | 1115  | 
apply(erule exE)  | 
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
1116  | 
\<comment> \<open>the first c-tran that does not satisfy the guarantee-condition is from \<open>\<sigma>_i\<close> at step \<open>m\<close>.\<close>  | 
| 59807 | 1117  | 
apply(drule_tac n=j and P="\<lambda>j. \<exists>i. H i j" for H in Ex_first_occurrence)  | 
| 13020 | 1118  | 
apply(erule exE)  | 
1119  | 
apply clarify  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
1120  | 
\<comment> \<open>\<open>\<sigma>_i \<in> A(pre, rely_1)\<close>\<close>  | 
| 13020 | 1121  | 
apply(subgoal_tac "take (Suc (Suc m)) (clist!i) \<in> assum(Pre(xs!i), Rely(xs!i))")  | 
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
1122  | 
\<comment> \<open>but this contradicts \<open>\<Turnstile> \<sigma>_i sat [pre_i,rely_i,guar_i,post_i]\<close>\<close>  | 
| 59807 | 1123  | 
apply(erule_tac x=i and P="\<lambda>i. H i \<longrightarrow> \<Turnstile> (J i) sat [I i,K i,M i,N i]" for H J I K M N in allE,erule impE,assumption)  | 
| 13020 | 1124  | 
apply(simp add:com_validity_def)  | 
1125  | 
apply(erule_tac x=s in allE)  | 
|
1126  | 
apply(simp add:cp_def comm_def)  | 
|
1127  | 
apply(drule_tac c="take (Suc (Suc m)) (clist ! i)" in subsetD)  | 
|
1128  | 
apply simp  | 
|
| 59189 | 1129  | 
apply (blast intro: takecptn_is_cptn)  | 
| 13020 | 1130  | 
apply simp  | 
1131  | 
apply clarify  | 
|
| 59807 | 1132  | 
apply(erule_tac x=m and P="\<lambda>j. I j \<and> J j \<longrightarrow> H j" for I J H in allE)  | 
| 13020 | 1133  | 
apply (simp add:conjoin_def same_length_def)  | 
| 
52597
 
a8a81453833d
more precise fact declarations -- fewer warnings;
 
wenzelm 
parents: 
42174 
diff
changeset
 | 
1134  | 
apply(simp add:assum_def)  | 
| 13020 | 1135  | 
apply(rule conjI)  | 
| 59807 | 1136  | 
apply(erule_tac x=i and P="\<lambda>j. H j \<longrightarrow> I j \<in>cp (K j) (J j)" for H I K J in allE)  | 
| 13020 | 1137  | 
apply(simp add:cp_def par_assum_def)  | 
1138  | 
apply(drule_tac c="s" in subsetD,simp)  | 
|
1139  | 
apply simp  | 
|
1140  | 
apply clarify  | 
|
| 69313 | 1141  | 
apply(erule_tac x=i and P="\<lambda>j. H j \<longrightarrow> M \<union> \<Union>((T j) ` (S j)) \<subseteq> (L j)" for H M S T L in allE)  | 
| 
52597
 
a8a81453833d
more precise fact declarations -- fewer warnings;
 
wenzelm 
parents: 
42174 
diff
changeset
 | 
1142  | 
apply simp  | 
| 13020 | 1143  | 
apply(erule subsetD)  | 
1144  | 
apply simp  | 
|
1145  | 
apply(simp add:conjoin_def compat_label_def)  | 
|
1146  | 
apply clarify  | 
|
| 59807 | 1147  | 
apply(erule_tac x=ia and P="\<lambda>j. H j \<longrightarrow> (P j) \<or> Q j" for H P Q in allE,simp)  | 
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
1148  | 
\<comment> \<open>each etran in \<open>\<sigma>_1[0\<dots>m]\<close> corresponds to\<close>  | 
| 13020 | 1149  | 
apply(erule disjE)  | 
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
1150  | 
\<comment> \<open>a c-tran in some \<open>\<sigma>_{ib}\<close>\<close>
 | 
| 13020 | 1151  | 
apply clarify  | 
1152  | 
apply(case_tac "i=ib",simp)  | 
|
| 23746 | 1153  | 
apply(erule etranE,simp)  | 
| 59807 | 1154  | 
apply(erule_tac x="ib" and P="\<lambda>i. H i \<longrightarrow> (I i) \<or> (J i)" for H I J in allE)  | 
| 23746 | 1155  | 
apply (erule etranE)  | 
| 13020 | 1156  | 
apply(case_tac "ia=m",simp)  | 
| 13601 | 1157  | 
apply simp  | 
| 59807 | 1158  | 
apply(erule_tac x=ia and P="\<lambda>j. H j \<longrightarrow> (\<forall>i. P i j)" for H P in allE)  | 
| 13020 | 1159  | 
apply(subgoal_tac "ia<m",simp)  | 
1160  | 
prefer 2  | 
|
1161  | 
apply arith  | 
|
| 59807 | 1162  | 
apply(erule_tac x=ib and P="\<lambda>j. (I j, H j) \<in> ctran \<longrightarrow> P i j" for I H P in allE,simp)  | 
| 13020 | 1163  | 
apply(simp add:same_state_def)  | 
| 59807 | 1164  | 
apply(erule_tac x=i and P="\<lambda>j. (T j) \<longrightarrow> (\<forall>i. (H j i) \<longrightarrow> (snd (d j i))=(snd (e j i)))" for T H d e in all_dupE)  | 
1165  | 
apply(erule_tac x=ib and P="\<lambda>j. (T j) \<longrightarrow> (\<forall>i. (H j i) \<longrightarrow> (snd (d j i))=(snd (e j i)))" for T H d e in allE,simp)  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
62343 
diff
changeset
 | 
1166  | 
\<comment> \<open>or an e-tran in \<open>\<sigma>\<close>,  | 
| 62042 | 1167  | 
therefore it satisfies \<open>rely \<or> guar_{ib}\<close>\<close>
 | 
| 13020 | 1168  | 
apply (force simp add:par_assum_def same_state_def)  | 
1169  | 
done  | 
|
1170  | 
||
| 15102 | 1171  | 
|
| 59189 | 1172  | 
lemma three [rule_format]:  | 
1173  | 
  "\<lbrakk> xs\<noteq>[]; \<forall>i<length xs. rely \<union> (\<Union>j\<in>{j. j < length xs \<and> j \<noteq> i}. Guar (xs ! j))
 | 
|
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1174  | 
\<subseteq> Rely (xs ! i);  | 
| 
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1175  | 
   pre \<subseteq> (\<Inter>i\<in>{i. i < length xs}. Pre (xs ! i));
 | 
| 59189 | 1176  | 
\<forall>i<length xs.  | 
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1177  | 
\<Turnstile> Com (xs ! i) sat [Pre (xs ! i), Rely (xs ! i), Guar (xs ! i), Post (xs ! i)];  | 
| 
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1178  | 
length xs=length clist; x \<in> par_cp (ParallelCom xs) s; x \<in> par_assum(pre, rely);  | 
| 13020 | 1179  | 
\<forall>i<length clist. clist!i\<in>cp (Some(Com(xs!i))) s; x \<propto> clist \<rbrakk>  | 
| 59189 | 1180  | 
\<Longrightarrow> \<forall>j i. i<length clist \<and> Suc j<length x \<longrightarrow> (clist!i!j) -e\<rightarrow> (clist!i!Suc j)  | 
| 13020 | 1181  | 
  \<longrightarrow> (snd(clist!i!j), snd(clist!i!Suc j)) \<in> rely \<union> (\<Union>j\<in>{j. j < length xs \<and> j \<noteq> i}. Guar (xs ! j))"
 | 
1182  | 
apply(drule two)  | 
|
1183  | 
apply simp_all  | 
|
1184  | 
apply clarify  | 
|
1185  | 
apply(simp add:conjoin_def compat_label_def)  | 
|
1186  | 
apply clarify  | 
|
| 59807 | 1187  | 
apply(erule_tac x=j and P="\<lambda>j. H j \<longrightarrow> (J j \<and> (\<exists>i. P i j)) \<or> I j" for H J P I in allE,simp)  | 
| 13020 | 1188  | 
apply(erule disjE)  | 
1189  | 
prefer 2  | 
|
1190  | 
apply(force simp add:same_state_def par_assum_def)  | 
|
1191  | 
apply clarify  | 
|
1192  | 
apply(case_tac "i=ia",simp)  | 
|
| 23746 | 1193  | 
apply(erule etranE,simp)  | 
| 59807 | 1194  | 
apply(erule_tac x="ia" and P="\<lambda>i. H i \<longrightarrow> (I i) \<or> (J i)" for H I J in allE,simp)  | 
1195  | 
apply(erule_tac x=j and P="\<lambda>j. \<forall>i. S j i \<longrightarrow> (I j i, H j i) \<in> ctran \<longrightarrow> P i j" for S I H P in allE)  | 
|
1196  | 
apply(erule_tac x=ia and P="\<lambda>j. S j \<longrightarrow> (I j, H j) \<in> ctran \<longrightarrow> P j" for S I H P in allE)  | 
|
| 13020 | 1197  | 
apply(simp add:same_state_def)  | 
| 59807 | 1198  | 
apply(erule_tac x=i and P="\<lambda>j. T j \<longrightarrow> (\<forall>i. H j i \<longrightarrow> (snd (d j i))=(snd (e j i)))" for T H d e in all_dupE)  | 
1199  | 
apply(erule_tac x=ia and P="\<lambda>j. T j \<longrightarrow> (\<forall>i. H j i \<longrightarrow> (snd (d j i))=(snd (e j i)))" for T H d e in allE,simp)  | 
|
| 13020 | 1200  | 
done  | 
1201  | 
||
| 59189 | 1202  | 
lemma four:  | 
1203  | 
  "\<lbrakk>xs\<noteq>[]; \<forall>i < length xs. rely \<union> (\<Union>j\<in>{j. j < length xs \<and> j \<noteq> i}. Guar (xs ! j))
 | 
|
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1204  | 
\<subseteq> Rely (xs ! i);  | 
| 59189 | 1205  | 
   (\<Union>j\<in>{j. j < length xs}. Guar (xs ! j)) \<subseteq> guar;
 | 
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1206  | 
   pre \<subseteq> (\<Inter>i\<in>{i. i < length xs}. Pre (xs ! i));
 | 
| 
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1207  | 
\<forall>i < length xs.  | 
| 
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1208  | 
\<Turnstile> Com (xs ! i) sat [Pre (xs ! i), Rely (xs ! i), Guar (xs ! i), Post (xs ! i)];  | 
| 59189 | 1209  | 
x \<in> par_cp (ParallelCom xs) s; x \<in> par_assum (pre, rely); Suc i < length x;  | 
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1210  | 
x ! i -pc\<rightarrow> x ! Suc i\<rbrakk>  | 
| 13020 | 1211  | 
\<Longrightarrow> (snd (x ! i), snd (x ! Suc i)) \<in> guar"  | 
| 
52597
 
a8a81453833d
more precise fact declarations -- fewer warnings;
 
wenzelm 
parents: 
42174 
diff
changeset
 | 
1212  | 
apply(simp add: ParallelCom_def)  | 
| 13020 | 1213  | 
apply(subgoal_tac "(map (Some \<circ> fst) xs)\<noteq>[]")  | 
1214  | 
prefer 2  | 
|
1215  | 
apply simp  | 
|
1216  | 
apply(frule rev_subsetD)  | 
|
1217  | 
apply(erule one [THEN equalityD1])  | 
|
1218  | 
apply(erule subsetD)  | 
|
| 
52597
 
a8a81453833d
more precise fact declarations -- fewer warnings;
 
wenzelm 
parents: 
42174 
diff
changeset
 | 
1219  | 
apply simp  | 
| 13020 | 1220  | 
apply clarify  | 
1221  | 
apply(drule_tac pre=pre and rely=rely and x=x and s=s and xs=xs and clist=clist in two)  | 
|
1222  | 
apply(assumption+)  | 
|
1223  | 
apply(erule sym)  | 
|
1224  | 
apply(simp add:ParallelCom_def)  | 
|
1225  | 
apply assumption  | 
|
1226  | 
apply(simp add:Com_def)  | 
|
1227  | 
apply assumption  | 
|
1228  | 
apply(simp add:conjoin_def same_program_def)  | 
|
1229  | 
apply clarify  | 
|
| 59807 | 1230  | 
apply(erule_tac x=i and P="\<lambda>j. H j \<longrightarrow> fst(I j)=(J j)" for H I J in all_dupE)  | 
1231  | 
apply(erule_tac x="Suc i" and P="\<lambda>j. H j \<longrightarrow> fst(I j)=(J j)" for H I J in allE)  | 
|
| 23746 | 1232  | 
apply(erule par_ctranE,simp)  | 
| 59807 | 1233  | 
apply(erule_tac x=i and P="\<lambda>j. \<forall>i. S j i \<longrightarrow> (I j i, H j i) \<in> ctran \<longrightarrow> P i j" for S I H P in allE)  | 
1234  | 
apply(erule_tac x=ia and P="\<lambda>j. S j \<longrightarrow> (I j, H j) \<in> ctran \<longrightarrow> P j" for S I H P in allE)  | 
|
| 13020 | 1235  | 
apply(rule_tac x=ia in exI)  | 
1236  | 
apply(simp add:same_state_def)  | 
|
| 59807 | 1237  | 
apply(erule_tac x=ia and P="\<lambda>j. T j \<longrightarrow> (\<forall>i. H j i \<longrightarrow> (snd (d j i))=(snd (e j i)))" for T H d e in all_dupE,simp)  | 
1238  | 
apply(erule_tac x=ia and P="\<lambda>j. T j \<longrightarrow> (\<forall>i. H j i \<longrightarrow> (snd (d j i))=(snd (e j i)))" for T H d e in allE,simp)  | 
|
1239  | 
apply(erule_tac x=i and P="\<lambda>j. H j \<longrightarrow> (snd (d j))=(snd (e j))" for H d e in all_dupE)  | 
|
1240  | 
apply(erule_tac x=i and P="\<lambda>j. H j \<longrightarrow> (snd (d j))=(snd (e j))" for H d e in all_dupE,simp)  | 
|
1241  | 
apply(erule_tac x="Suc i" and P="\<lambda>j. H j \<longrightarrow> (snd (d j))=(snd (e j))" for H d e in allE,simp)  | 
|
| 13020 | 1242  | 
apply(erule mp)  | 
1243  | 
apply(subgoal_tac "r=fst(clist ! ia ! Suc i)",simp)  | 
|
1244  | 
apply(drule_tac i=ia in list_eq_if)  | 
|
1245  | 
back  | 
|
1246  | 
apply simp_all  | 
|
1247  | 
done  | 
|
1248  | 
||
1249  | 
lemma parcptn_not_empty [simp]:"[] \<notin> par_cptn"  | 
|
| 23746 | 1250  | 
apply(force elim:par_cptn.cases)  | 
| 13020 | 1251  | 
done  | 
1252  | 
||
| 59189 | 1253  | 
lemma five:  | 
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1254  | 
  "\<lbrakk>xs\<noteq>[]; \<forall>i<length xs. rely \<union> (\<Union>j\<in>{j. j < length xs \<and> j \<noteq> i}. Guar (xs ! j))
 | 
| 
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1255  | 
\<subseteq> Rely (xs ! i);  | 
| 59189 | 1256  | 
   pre \<subseteq> (\<Inter>i\<in>{i. i < length xs}. Pre (xs ! i));
 | 
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1257  | 
   (\<Inter>i\<in>{i. i < length xs}. Post (xs ! i)) \<subseteq> post;
 | 
| 
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1258  | 
\<forall>i < length xs.  | 
| 
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1259  | 
\<Turnstile> Com (xs ! i) sat [Pre (xs ! i), Rely (xs ! i), Guar (xs ! i), Post (xs ! i)];  | 
| 59189 | 1260  | 
x \<in> par_cp (ParallelCom xs) s; x \<in> par_assum (pre, rely);  | 
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1261  | 
All_None (fst (last x)) \<rbrakk> \<Longrightarrow> snd (last x) \<in> post"  | 
| 
52597
 
a8a81453833d
more precise fact declarations -- fewer warnings;
 
wenzelm 
parents: 
42174 
diff
changeset
 | 
1262  | 
apply(simp add: ParallelCom_def)  | 
| 13020 | 1263  | 
apply(subgoal_tac "(map (Some \<circ> fst) xs)\<noteq>[]")  | 
1264  | 
prefer 2  | 
|
1265  | 
apply simp  | 
|
1266  | 
apply(frule rev_subsetD)  | 
|
1267  | 
apply(erule one [THEN equalityD1])  | 
|
1268  | 
apply(erule subsetD)  | 
|
| 
52597
 
a8a81453833d
more precise fact declarations -- fewer warnings;
 
wenzelm 
parents: 
42174 
diff
changeset
 | 
1269  | 
apply simp  | 
| 13020 | 1270  | 
apply clarify  | 
1271  | 
apply(subgoal_tac "\<forall>i<length clist. clist!i\<in>assum(Pre(xs!i), Rely(xs!i))")  | 
|
| 
62343
 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 
haftmann 
parents: 
62042 
diff
changeset
 | 
1272  | 
apply(erule_tac x=xa and P="\<lambda>i. H i \<longrightarrow> \<Turnstile> (J i) sat [I i,K i,M i,N i]" for H J I K M N in allE,erule impE,assumption)  | 
| 13020 | 1273  | 
apply(simp add:com_validity_def)  | 
1274  | 
apply(erule_tac x=s in allE)  | 
|
| 
62343
 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 
haftmann 
parents: 
62042 
diff
changeset
 | 
1275  | 
apply(erule_tac x=xa and P="\<lambda>j. H j \<longrightarrow> (I j) \<in> cp (J j) s" for H I J in allE,simp)  | 
| 
 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 
haftmann 
parents: 
62042 
diff
changeset
 | 
1276  | 
apply(drule_tac c="clist!xa" in subsetD)  | 
| 13020 | 1277  | 
apply (force simp add:Com_def)  | 
1278  | 
apply(simp add:comm_def conjoin_def same_program_def del:last.simps)  | 
|
1279  | 
apply clarify  | 
|
| 59807 | 1280  | 
apply(erule_tac x="length x - 1" and P="\<lambda>j. H j \<longrightarrow> fst(I j)=(J j)" for H I J in allE)  | 
| 13020 | 1281  | 
apply (simp add:All_None_def same_length_def)  | 
| 
62343
 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 
haftmann 
parents: 
62042 
diff
changeset
 | 
1282  | 
apply(erule_tac x=xa and P="\<lambda>j. H j \<longrightarrow> length(J j)=(K j)" for H J K in allE)  | 
| 13020 | 1283  | 
apply(subgoal_tac "length x - 1 < length x",simp)  | 
1284  | 
apply(case_tac "x\<noteq>[]")  | 
|
| 17588 | 1285  | 
apply(simp add: last_conv_nth)  | 
| 
62343
 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 
haftmann 
parents: 
62042 
diff
changeset
 | 
1286  | 
apply(erule_tac x="clist!xa" in ballE)  | 
| 13020 | 1287  | 
apply(simp add:same_state_def)  | 
| 
62343
 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 
haftmann 
parents: 
62042 
diff
changeset
 | 
1288  | 
apply(subgoal_tac "clist!xa\<noteq>[]")  | 
| 17588 | 1289  | 
apply(simp add: last_conv_nth)  | 
| 13020 | 1290  | 
apply(case_tac x)  | 
1291  | 
apply (force simp add:par_cp_def)  | 
|
1292  | 
apply (force simp add:par_cp_def)  | 
|
1293  | 
apply force  | 
|
1294  | 
apply (force simp add:par_cp_def)  | 
|
1295  | 
apply(case_tac x)  | 
|
1296  | 
apply (force simp add:par_cp_def)  | 
|
1297  | 
apply (force simp add:par_cp_def)  | 
|
1298  | 
apply clarify  | 
|
1299  | 
apply(simp add:assum_def)  | 
|
1300  | 
apply(rule conjI)  | 
|
1301  | 
apply(simp add:conjoin_def same_state_def par_cp_def)  | 
|
1302  | 
apply clarify  | 
|
| 
62343
 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 
haftmann 
parents: 
62042 
diff
changeset
 | 
1303  | 
apply(erule_tac x=i and P="\<lambda>j. T j \<longrightarrow> (\<forall>i. H j i \<longrightarrow> (snd (d j i))=(snd (e j i)))" for T H d e in allE,simp)  | 
| 59807 | 1304  | 
apply(erule_tac x=0 and P="\<lambda>j. H j \<longrightarrow> (snd (d j))=(snd (e j))" for H d e in allE)  | 
| 13020 | 1305  | 
apply(case_tac x,simp+)  | 
1306  | 
apply (simp add:par_assum_def)  | 
|
1307  | 
apply clarify  | 
|
| 
62343
 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 
haftmann 
parents: 
62042 
diff
changeset
 | 
1308  | 
apply(drule_tac c="snd (clist ! i ! 0)" in subsetD)  | 
| 13020 | 1309  | 
apply assumption  | 
1310  | 
apply simp  | 
|
1311  | 
apply clarify  | 
|
| 
62343
 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 
haftmann 
parents: 
62042 
diff
changeset
 | 
1312  | 
apply(erule_tac x=i in all_dupE)  | 
| 13601 | 1313  | 
apply(rule subsetD, erule mp, assumption)  | 
| 13020 | 1314  | 
apply(erule_tac pre=pre and rely=rely and x=x and s=s in three)  | 
| 
62343
 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 
haftmann 
parents: 
62042 
diff
changeset
 | 
1315  | 
apply(erule_tac x=ib in allE,erule mp)  | 
| 13020 | 1316  | 
apply simp_all  | 
1317  | 
apply(simp add:ParallelCom_def)  | 
|
1318  | 
apply(force simp add:Com_def)  | 
|
1319  | 
apply(simp add:conjoin_def same_length_def)  | 
|
1320  | 
done  | 
|
1321  | 
||
| 59189 | 1322  | 
lemma ParallelEmpty [rule_format]:  | 
1323  | 
"\<forall>i s. x \<in> par_cp (ParallelCom []) s \<longrightarrow>  | 
|
| 13020 | 1324  | 
Suc i < length x \<longrightarrow> (x ! i, x ! Suc i) \<notin> par_ctran"  | 
1325  | 
apply(induct_tac x)  | 
|
1326  | 
apply(simp add:par_cp_def ParallelCom_def)  | 
|
1327  | 
apply clarify  | 
|
1328  | 
apply(case_tac list,simp,simp)  | 
|
1329  | 
apply(case_tac i)  | 
|
1330  | 
apply(simp add:par_cp_def ParallelCom_def)  | 
|
| 23746 | 1331  | 
apply(erule par_ctranE,simp)  | 
| 13020 | 1332  | 
apply(simp add:par_cp_def ParallelCom_def)  | 
1333  | 
apply clarify  | 
|
| 23746 | 1334  | 
apply(erule par_cptn.cases,simp)  | 
| 13020 | 1335  | 
apply simp  | 
| 23746 | 1336  | 
apply(erule par_ctranE)  | 
| 13020 | 1337  | 
back  | 
1338  | 
apply simp  | 
|
1339  | 
done  | 
|
1340  | 
||
| 59189 | 1341  | 
theorem par_rgsound:  | 
1342  | 
"\<turnstile> c SAT [pre, rely, guar, post] \<Longrightarrow>  | 
|
| 
13022
 
b115b305612f
New order in the loading of theories (Quote-antiquote right before the OG_Syntax and RG_Syntax respectively)
 
prensani 
parents: 
13020 
diff
changeset
 | 
1343  | 
\<Turnstile> (ParallelCom c) SAT [pre, rely, guar, post]"  | 
| 13020 | 1344  | 
apply(erule par_rghoare.induct)  | 
1345  | 
apply(case_tac xs,simp)  | 
|
1346  | 
apply(simp add:par_com_validity_def par_comm_def)  | 
|
1347  | 
apply clarify  | 
|
1348  | 
apply(case_tac "post=UNIV",simp)  | 
|
1349  | 
apply clarify  | 
|
1350  | 
apply(drule ParallelEmpty)  | 
|
1351  | 
apply assumption  | 
|
1352  | 
apply simp  | 
|
1353  | 
apply clarify  | 
|
1354  | 
apply simp  | 
|
1355  | 
apply(subgoal_tac "xs\<noteq>[]")  | 
|
1356  | 
prefer 2  | 
|
1357  | 
apply simp  | 
|
| 
55417
 
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
 
blanchet 
parents: 
54859 
diff
changeset
 | 
1358  | 
apply(rename_tac a list)  | 
| 13020 | 1359  | 
apply(thin_tac "xs = a # list")  | 
1360  | 
apply(simp add:par_com_validity_def par_comm_def)  | 
|
1361  | 
apply clarify  | 
|
1362  | 
apply(rule conjI)  | 
|
1363  | 
apply clarify  | 
|
1364  | 
apply(erule_tac pre=pre and rely=rely and guar=guar and x=x and s=s and xs=xs in four)  | 
|
1365  | 
apply(assumption+)  | 
|
1366  | 
apply clarify  | 
|
1367  | 
apply (erule allE, erule impE, assumption,erule rgsound)  | 
|
1368  | 
apply(assumption+)  | 
|
1369  | 
apply clarify  | 
|
1370  | 
apply(erule_tac pre=pre and rely=rely and post=post and x=x and s=s and xs=xs in five)  | 
|
1371  | 
apply(assumption+)  | 
|
1372  | 
apply clarify  | 
|
1373  | 
apply (erule allE, erule impE, assumption,erule rgsound)  | 
|
| 59189 | 1374  | 
apply(assumption+)  | 
| 13020 | 1375  | 
done  | 
1376  | 
||
| 13187 | 1377  | 
end  |