author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Thu, 27 Mar 2014 11:50:37 +0000 | |
changeset 11 | f8b2bf858caf |
parent 8 | dcbf7888a070 |
child 12 | 457240e42972 |
permissions | -rwxr-xr-x |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
header {* |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2 |
Generic Separation Logic |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
*} |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
theory Hoare_gen |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
imports Main |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
"../Separation_Algebra/Sep_Tactics" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
begin |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
9 |
|
8
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
10 |
|
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
11 |
definition |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
12 |
pasrt :: "bool \<Rightarrow> 'a::sep_algebra \<Rightarrow> bool" ("<_>" [72] 71) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
13 |
where "pasrt b = (\<lambda> s . s = 0 \<and> b)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
14 |
|
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
15 |
|
5
6c722e960f2e
minor changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3
diff
changeset
|
16 |
(* same as sep.mult.left_commute *) |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
17 |
lemma sep_conj_cond1: |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
18 |
"(p \<and>* <cond> \<and>* q) = (<cond> \<and>* p \<and>* q)" |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
19 |
by (rule sep.mult.left_commute) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
20 |
|
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
21 |
(* same as sep.mult.commute *) |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
22 |
lemma sep_conj_cond2: |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
23 |
"(p \<and>* <cond>) = (<cond> \<and>* p)" |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
24 |
by(rule sep.mult.commute) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
25 |
|
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
26 |
(* same as sep.mult_assoc *) |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
27 |
lemma sep_conj_cond3: |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
28 |
"((<cond> \<and>* p) \<and>* r) = (<cond> \<and>* p \<and>* r)" |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
29 |
by (rule sep.mult_assoc) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
30 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
31 |
lemmas sep_conj_cond = sep_conj_cond1 sep_conj_cond2 sep_conj_cond3 |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
32 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
33 |
lemma cond_true_eq[simp]: "<True> = \<box>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
34 |
by(unfold sep_empty_def pasrt_def, auto) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
35 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
36 |
lemma cond_true_eq1: "(<True> \<and>* p) = p" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
37 |
by(simp) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
38 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
39 |
lemma false_simp [simp]: "<False> = sep_false" (* move *) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
40 |
by (simp add:pasrt_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
41 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
42 |
lemma cond_true_eq2: "(p \<and>* <True>) = p" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
43 |
by simp |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
44 |
|
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
45 |
lemma condD: "(<b> \<and>* r) s \<Longrightarrow> b \<and> r s" |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
46 |
by (unfold sep_conj_def pasrt_def, auto) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
47 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
48 |
locale sep_exec = |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
49 |
fixes step :: "'conf \<Rightarrow> 'conf" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
50 |
and recse:: "'conf \<Rightarrow> 'a::sep_algebra" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
51 |
begin |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
52 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
53 |
definition "run n = step ^^ n" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
54 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
55 |
lemma run_add: "run (n1 + n2) s = run n1 (run n2 s)" |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
56 |
unfolding run_def |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
57 |
by (simp add: funpow_add) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
58 |
|
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
59 |
(* separation Hoare tripple *) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
60 |
definition |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
61 |
Hoare_gen :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool" ("(\<lbrace>(1_)\<rbrace>/ (_)/ \<lbrace>(1_)\<rbrace>)" 50) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
62 |
where |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
63 |
"\<lbrace>p\<rbrace> c \<lbrace>q\<rbrace> \<equiv> |
8
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
64 |
\<forall>s r. (p \<and>* c \<and>* r) (recse s) \<longrightarrow> (\<exists>k. (q \<and>* c \<and>* r) (recse (run (Suc k) s)))" |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
65 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
66 |
lemma HoareI [case_names Pre]: |
8
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
67 |
assumes h: "\<And> r s. (p \<and>* c \<and>* r) (recse s) \<Longrightarrow> \<exists>k. (q \<and>* c \<and>* r) (recse (run (Suc k) s))" |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
68 |
shows "\<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
69 |
using h |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
70 |
unfolding Hoare_gen_def |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
71 |
by simp |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
72 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
73 |
lemma frame_rule: |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
74 |
assumes "\<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
75 |
shows "\<lbrace>p \<and>* r\<rbrace> c \<lbrace>q \<and>* r\<rbrace>" |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
76 |
using assms |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
77 |
unfolding Hoare_gen_def |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
78 |
by (metis sep_conj_assoc sep_conj_left_commute) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
79 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
80 |
lemma sequencing: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
81 |
assumes h1: "\<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
82 |
and h2: "\<lbrace>q\<rbrace> c \<lbrace>r\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
83 |
shows "\<lbrace>p\<rbrace> c \<lbrace>r\<rbrace>" |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
84 |
proof(induct rule: HoareI) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
85 |
case (Pre r' s') |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
86 |
have "(p \<and>* c \<and>* r') (recse s')" by fact |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
87 |
with h1[unfolded Hoare_gen_def] |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
88 |
obtain k1 where "(q \<and>* c \<and>* r') (recse (run (Suc k1) s'))" by auto |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
89 |
with h2[unfolded Hoare_gen_def] |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
90 |
obtain k2 where "(r \<and>* c \<and>* r') (recse (run (Suc k2) (run (Suc k1) s')))" by auto |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
91 |
thus "\<exists>k. (r \<and>* c \<and>* r') (recse (run (Suc k) s'))" |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
92 |
by (auto simp add: run_add[symmetric]) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
93 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
94 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
95 |
lemma pre_stren: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
96 |
assumes h1: "\<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
97 |
and h2: "\<And>s. r s \<Longrightarrow> p s" |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
98 |
shows "\<lbrace>r\<rbrace> c \<lbrace>q\<rbrace>" |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
99 |
using assms |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
100 |
unfolding Hoare_gen_def |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
101 |
by (metis sep_globalise) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
102 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
103 |
lemma post_weaken: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
104 |
assumes h1: "\<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
105 |
and h2: "\<And> s. q s \<Longrightarrow> r s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
106 |
shows "\<lbrace>p\<rbrace> c \<lbrace>r\<rbrace>" |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
107 |
using assms |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
108 |
unfolding Hoare_gen_def |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
109 |
by (metis sep_globalise) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
110 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
111 |
lemma hoare_adjust: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
112 |
assumes h1: "\<lbrace>p1\<rbrace> c \<lbrace>q1\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
113 |
and h2: "\<And>s. p s \<Longrightarrow> p1 s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
114 |
and h3: "\<And>s. q1 s \<Longrightarrow> q s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
115 |
shows "\<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
116 |
using h1 h2 h3 post_weaken pre_stren |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
117 |
by (blast) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
118 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
119 |
lemma code_exI: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
120 |
assumes h: "\<And> k. \<lbrace>p\<rbrace> c(k) \<lbrace>q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
121 |
shows "\<lbrace>p\<rbrace> EXS k. c(k) \<lbrace>q\<rbrace>" |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
122 |
unfolding pred_ex_def |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
123 |
proof(induct rule:HoareI) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
124 |
case (Pre r' s') |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
125 |
then obtain k where "(p \<and>* (\<lambda> s. c k s) \<and>* r') (recse s')" |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
126 |
by (auto elim!: sep_conjE intro!: sep_conjI) |
8
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
127 |
with h[unfolded Hoare_gen_def] |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
128 |
show "\<exists>k. (q \<and>* (\<lambda>s. \<exists>x. c x s) \<and>* r') (recse (run (Suc k) s'))" |
8
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
129 |
by (blast elim!: sep_conjE intro!: sep_conjI) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
130 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
131 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
132 |
lemma code_extension: |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
133 |
assumes "\<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
134 |
shows "\<lbrace>p\<rbrace> c \<and>* e \<lbrace>q\<rbrace>" |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
135 |
using assms |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
136 |
unfolding Hoare_gen_def |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
137 |
by (metis sep_conj_assoc) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
138 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
139 |
lemma code_extension1: |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
140 |
assumes "\<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
141 |
shows "\<lbrace>p\<rbrace> e \<and>* c \<lbrace>q\<rbrace>" |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
142 |
using assms |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
143 |
unfolding Hoare_gen_def |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
144 |
by (metis sep_conj_commute sep_conj_left_commute) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
145 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
146 |
lemma composition: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
147 |
assumes h1: "\<lbrace>p\<rbrace> c1 \<lbrace>q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
148 |
and h2: "\<lbrace>q\<rbrace> c2 \<lbrace>r\<rbrace>" |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
149 |
shows "\<lbrace>p\<rbrace> c1 \<and>* c2 \<lbrace>r\<rbrace>" |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
150 |
using assms |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
151 |
by (auto intro: sequencing code_extension code_extension1) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
152 |
|
11
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
153 |
lemma pre_condI: |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
154 |
assumes h: "cond \<Longrightarrow> \<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
155 |
shows "\<lbrace><cond> \<and>* p\<rbrace> c \<lbrace>q\<rbrace>" |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
156 |
proof(induct rule:HoareI) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
157 |
case (Pre r s) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
158 |
hence "cond" "(p \<and>* c \<and>* r) (recse s)" |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
159 |
apply (metis pasrt_def sep_conjD) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
160 |
by (smt Pre.hyps pasrt_def sep_add_zero sep_conj_commute sep_conj_def) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
161 |
from h[OF this(1), unfolded Hoare_gen_def, rule_format, OF this(2)] |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
162 |
show ?case . |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
163 |
qed |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
164 |
|
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
165 |
lemma code_condI: |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
166 |
assumes h: "b \<Longrightarrow> \<lbrace>p\<rbrace> c \<lbrace>q\<rbrace>" |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
167 |
shows "\<lbrace>p\<rbrace> <b> \<and>* c \<lbrace>q\<rbrace>" |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
168 |
proof(induct rule: HoareI) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
169 |
case (Pre r s) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
170 |
hence h1: "b" "(p \<and>* c \<and>* r) (recse s)" |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
171 |
apply (metis condD sep_conjD sep_conj_assoc) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
172 |
by (smt Pre.hyps condD sep_conj_impl) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
173 |
from h[OF h1(1), unfolded Hoare_gen_def, rule_format, OF h1(2)] |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
174 |
and h1(1) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
175 |
show ?case |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
176 |
by (metis (full_types) cond_true_eq1) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
177 |
qed |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
178 |
|
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
179 |
lemma precond_exI: |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
180 |
assumes h:"\<And>x. \<lbrace>p x\<rbrace> c \<lbrace>q\<rbrace>" |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
181 |
shows "\<lbrace>EXS x. p x\<rbrace> c \<lbrace>q\<rbrace>" |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
182 |
proof(induct rule: HoareI) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
183 |
case (Pre r s) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
184 |
then obtain x where "(p x \<and>* c \<and>* r) (recse s)" |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
185 |
by (unfold pred_ex_def, auto elim!:sep_conjE intro!:sep_conjI) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
186 |
from h[of x, unfolded Hoare_gen_def, rule_format, OF this] |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
187 |
show ?case . |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
188 |
qed |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
189 |
|
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
190 |
lemma hoare_sep_false: |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
191 |
"\<lbrace>sep_false\<rbrace> c \<lbrace>q\<rbrace>" |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
192 |
by(unfold Hoare_gen_def, clarify, simp) |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
193 |
|
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
194 |
|
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
195 |
lemma pred_exI: |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
196 |
assumes "(P(x) \<and>* r) s" |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
197 |
shows "((EXS x. P(x)) \<and>* r) s" |
f8b2bf858caf
moved some lemmas
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
198 |
by (metis assms pred_ex_def sep_globalise) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
199 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
200 |
definition |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
201 |
IHoare :: "('b::sep_algebra \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> bool) \<Rightarrow> bool" |
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
202 |
("(1_).(\<lbrace>(1_)\<rbrace>/ (_)/ \<lbrace>(1_)\<rbrace>)" 50) |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
203 |
where |
8
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
204 |
"I. \<lbrace>P\<rbrace> c \<lbrace>Q\<rbrace> = (\<forall>s'. \<lbrace>EXS s. <P s> \<and>* <(s ## s')> \<and>* I(s + s')\<rbrace> c |
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
205 |
\<lbrace>EXS s. <Q s> \<and>* <(s ## s')> \<and>* I(s + s')\<rbrace>)" |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
206 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
207 |
lemma IHoareI [case_names IPre]: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
208 |
assumes h: "\<And>s' s r cnf . (<P s> \<and>* <(s ## s')> \<and>* I(s + s') \<and>* c \<and>* r) (recse cnf) \<Longrightarrow> |
8
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
209 |
\<exists>k t. (<Q t> \<and>* <(t ## s')> \<and>* I(t + s') \<and>* c \<and>* r) (recse (run (Suc k) cnf))" |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
210 |
shows "I. \<lbrace>P\<rbrace> c \<lbrace>Q\<rbrace>" |
3
545fef826fa9
some tiny changes (does not affect anything else)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
2
diff
changeset
|
211 |
unfolding IHoare_def |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
212 |
proof |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
213 |
fix s' |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
214 |
show " \<lbrace>EXS s. <P s> \<and>* <(s ## s')> \<and>* I (s + s')\<rbrace> c |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
215 |
\<lbrace>EXS s. <Q s> \<and>* <(s ## s')> \<and>* I (s + s')\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
216 |
proof(unfold pred_ex_def, induct rule:HoareI) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
217 |
case (Pre r s) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
218 |
then obtain sa where "(<P sa> \<and>* <(sa ## s')> \<and>* I (sa + s') \<and>* c \<and>* r) (recse s)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
219 |
by (auto elim!:sep_conjE intro!:sep_conjI simp:sep_conj_ac) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
220 |
hence " (\<exists>k t. (<Q t> \<and>* <(t##s')> \<and>* I(t + s') \<and>* c \<and>* r) (recse (run (Suc k) s)))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
221 |
by (rule h) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
222 |
then obtain k t where h2: "(<Q t> \<and>* <(t ## s')> \<and>* I(t + s') \<and>* c \<and>* r) (recse (run (Suc k) s))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
223 |
by auto |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
224 |
thus "\<exists>k. ((\<lambda>s. \<exists>sa. (<Q sa> \<and>* <(sa ## s')> \<and>* I (sa + s')) s) \<and>* c \<and>* r) (recse (run (Suc k) s))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
225 |
apply (rule_tac x = k in exI) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
226 |
by (auto intro!:sep_conjI elim!:sep_conjE simp:sep_conj_ac) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
227 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
228 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
229 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
230 |
lemma I_frame_rule: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
231 |
assumes h: "I. \<lbrace>P\<rbrace> c \<lbrace>Q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
232 |
shows "I. \<lbrace>P \<and>* R\<rbrace> c \<lbrace>Q \<and>* R\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
233 |
proof(induct rule:IHoareI) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
234 |
case (IPre s' s r cnf) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
235 |
hence "((<(P \<and>* R) s> \<and>* <(s##s')> \<and>* I (s + s')) \<and>* c \<and>* r) (recse cnf)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
236 |
by (auto simp:sep_conj_ac) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
237 |
then obtain s1 s2 |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
238 |
where h1: "((<P s1> \<and>* <((s1 + s2) ## s')> \<and>*I (s1 + s2 + s')) \<and>* c \<and>* r) (recse cnf)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
239 |
"s1 ## s2" "s1 + s2 ## s'" "P s1" "R s2" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
240 |
by (unfold pasrt_def, auto elim!:sep_conjE intro!:sep_conjI) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
241 |
hence "((EXS s. <P s> \<and>* <(s ## s2 +s')> \<and>*I (s + (s2 + s'))) \<and>* c \<and>* r) (recse cnf)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
242 |
apply (sep_cancel, unfold pred_ex_def, auto intro!:sep_conjI sep_disj_addI3 elim!:sep_conjE) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
243 |
apply (rule_tac x = s1 in exI, unfold pasrt_def, |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
244 |
auto intro!:sep_conjI sep_disj_addI3 elim!:sep_conjE simp:sep_conj_ac) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
245 |
by (metis sep_add_assoc sep_add_disjD) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
246 |
from h[unfolded IHoare_def Hoare_gen_def, rule_format, OF this] |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
247 |
obtain k s where |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
248 |
"((<Q s> \<and>* <(s ## s2 + s')> \<and>* I (s + (s2 + s'))) \<and>* c \<and>* r) (recse (run (Suc k) cnf))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
249 |
by (unfold pasrt_def pred_ex_def, auto elim!:sep_conjE intro!:sep_conjI) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
250 |
thus ?case |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
251 |
proof(rule_tac x = k in exI, rule_tac x = "s + s2" in exI, sep_cancel+) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
252 |
fix h ha |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
253 |
assume hh: "(<Q s> \<and>* <(s ## s2 + s')> \<and>* I (s + (s2 + s'))) ha" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
254 |
show " (<(Q \<and>* R) (s + s2)> \<and>* <(s + s2 ## s')> \<and>* I (s + s2 + s')) ha" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
255 |
proof - |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
256 |
from hh have h0: "s ## s2 + s'" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
257 |
by (metis pasrt_def sep_conjD) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
258 |
with h1(2, 3) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
259 |
have h2: "s + s2 ## s'" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
260 |
by (metis sep_add_disjD sep_disj_addI1) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
261 |
moreover from h1(2, 3) h2 have h3: "(s + (s2 + s')) = (s + s2 + s')" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
262 |
by (metis `s ## s2 + s'` sep_add_assoc sep_add_disjD sep_disj_addD1) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
263 |
moreover from hh have "Q s" by (metis pasrt_def sep_conjD) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
264 |
moreover from h0 h1(2) h1(3) have "s ## s2" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
265 |
by (metis sep_add_disjD sep_disj_addD) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
266 |
moreover note h1(5) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
267 |
ultimately show ?thesis |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
268 |
by (smt h0 hh sep_conjI) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
269 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
270 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
271 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
272 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
273 |
lemma I_sequencing: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
274 |
assumes h1: "I. \<lbrace>P\<rbrace> c \<lbrace>Q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
275 |
and h2: "I. \<lbrace>Q\<rbrace> c \<lbrace>R\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
276 |
shows "I. \<lbrace>P\<rbrace> c \<lbrace>R\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
277 |
using h1 h2 sequencing |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
278 |
by (smt IHoare_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
279 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
280 |
lemma I_pre_stren: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
281 |
assumes h1: "I. \<lbrace>P\<rbrace> c \<lbrace>Q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
282 |
and h2: "\<And>s. R s \<Longrightarrow> P s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
283 |
shows "I. \<lbrace>R\<rbrace> c \<lbrace>Q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
284 |
proof(unfold IHoare_def, default) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
285 |
fix s' |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
286 |
show "\<lbrace>EXS s. <R s> \<and>* <(s ## s')> \<and>* I (s + s')\<rbrace> c |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
287 |
\<lbrace>EXS s. <Q s> \<and>* <(s ## s')> \<and>* I (s + s')\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
288 |
proof(rule pre_stren) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
289 |
from h1[unfolded IHoare_def, rule_format, of s'] |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
290 |
show "\<lbrace>EXS s. <P s> \<and>* <(s ## s')> \<and>* I (s + s')\<rbrace> c |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
291 |
\<lbrace>EXS s. <Q s> \<and>* <(s ## s')> \<and>* I (s + s')\<rbrace>" . |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
292 |
next |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
293 |
fix s |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
294 |
show "(EXS s. <R s> \<and>* <(s ## s')> \<and>* I (s + s')) s \<Longrightarrow> |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
295 |
(EXS s. <P s> \<and>* <(s ## s')> \<and>* I (s + s')) s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
296 |
apply (unfold pred_ex_def, clarify) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
297 |
apply (rule_tac x = sa in exI, sep_cancel+) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
298 |
by (insert h2, auto simp:pasrt_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
299 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
300 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
301 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
302 |
lemma I_post_weaken: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
303 |
assumes h1: "I. \<lbrace>P\<rbrace> c \<lbrace>Q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
304 |
and h2: "\<And> s. Q s \<Longrightarrow> R s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
305 |
shows "I. \<lbrace>P\<rbrace> c \<lbrace>R\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
306 |
proof(unfold IHoare_def, default) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
307 |
fix s' |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
308 |
show "\<lbrace>EXS s. <P s> \<and>* <(s ## s')> \<and>* I (s + s')\<rbrace> c |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
309 |
\<lbrace>EXS s. <R s> \<and>* <(s ## s')> \<and>* I (s + s')\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
310 |
proof(rule post_weaken) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
311 |
from h1[unfolded IHoare_def, rule_format, of s'] |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
312 |
show "\<lbrace>EXS s. <P s> \<and>* <(s ## s')> \<and>* I (s + s')\<rbrace> c |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
313 |
\<lbrace>EXS s. <Q s> \<and>* <(s ## s')> \<and>* I (s + s')\<rbrace>" . |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
314 |
next |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
315 |
fix s |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
316 |
show "(EXS s. <Q s> \<and>* <(s ## s')> \<and>* I (s + s')) s \<Longrightarrow> |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
317 |
(EXS s. <R s> \<and>* <(s ## s')> \<and>* I (s + s')) s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
318 |
apply (unfold pred_ex_def, clarify) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
319 |
apply (rule_tac x = sa in exI, sep_cancel+) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
320 |
by (insert h2, auto simp:pasrt_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
321 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
322 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
323 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
324 |
lemma I_hoare_adjust: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
325 |
assumes h1: "I. \<lbrace>P1\<rbrace> c \<lbrace>Q1\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
326 |
and h2: "\<And>s. P s \<Longrightarrow> P1 s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
327 |
and h3: "\<And>s. Q1 s \<Longrightarrow> Q s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
328 |
shows "I. \<lbrace>P\<rbrace> c \<lbrace>Q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
329 |
using h1 h2 h3 I_post_weaken I_pre_stren |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
330 |
by (metis) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
331 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
332 |
lemma I_code_exI: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
333 |
assumes h: "\<And> k. I. \<lbrace>P\<rbrace> c(k) \<lbrace>Q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
334 |
shows "I. \<lbrace>P\<rbrace> EXS k. c(k) \<lbrace>Q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
335 |
using h |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
336 |
by (smt IHoare_def code_exI) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
337 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
338 |
lemma I_code_extension: |
5
6c722e960f2e
minor changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3
diff
changeset
|
339 |
assumes h: "I. \<lbrace>P\<rbrace> c \<lbrace>Q\<rbrace>" |
6c722e960f2e
minor changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3
diff
changeset
|
340 |
shows "I. \<lbrace>P\<rbrace> c \<and>* e \<lbrace>Q\<rbrace>" |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
341 |
using h |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
342 |
by (smt IHoare_def sep_exec.code_extension) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
343 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
344 |
lemma I_composition: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
345 |
assumes h1: "I. \<lbrace>P\<rbrace> c1 \<lbrace>Q\<rbrace>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
346 |
and h2: "I. \<lbrace>Q\<rbrace> c2 \<lbrace>R\<rbrace>" |
5
6c722e960f2e
minor changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3
diff
changeset
|
347 |
shows "I. \<lbrace>P\<rbrace> c1 \<and>* c2 \<lbrace>R\<rbrace>" |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
348 |
using h1 h2 |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
349 |
by (smt IHoare_def sep_exec.composition) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
350 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
351 |
lemma I_pre_condI: |
8
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
352 |
assumes h: "cond \<Longrightarrow> I. \<lbrace>P\<rbrace> c \<lbrace>Q\<rbrace>" |
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
353 |
shows "I. \<lbrace><cond> \<and>* P\<rbrace> c \<lbrace>Q\<rbrace>" |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
354 |
using h |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
355 |
by (smt IHoareI condD cond_true_eq2 sep.mult_commute) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
356 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
357 |
lemma I_code_condI: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
358 |
assumes h: "b \<Longrightarrow> I. \<lbrace>P\<rbrace> c \<lbrace>Q\<rbrace>" |
8
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
359 |
shows "I. \<lbrace>P\<rbrace> <b> \<and>* c \<lbrace>Q\<rbrace>" |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
360 |
using h |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
361 |
by (smt IHoareI condD cond_true_eq2 sep.mult_commute sep_conj_cond1) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
362 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
363 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
364 |
lemma I_precond_exI: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
365 |
assumes h:"\<And>x. I. \<lbrace>P x\<rbrace> c \<lbrace>Q\<rbrace>" |
8
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
366 |
shows "I. \<lbrace>EXS x. P x\<rbrace> c \<lbrace>Q\<rbrace>" |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
367 |
proof(induct rule:IHoareI) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
368 |
case (IPre s' s r cnf) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
369 |
then obtain x |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
370 |
where "((EXS s. <P x s> \<and>* <(s ## s')> \<and>* I (s + s')) \<and>* c \<and>* r) (recse cnf)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
371 |
by ( auto elim!:sep_conjE intro!:sep_conjI simp:pred_ex_def pasrt_def sep_conj_ac) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
372 |
from h[unfolded IHoare_def Hoare_gen_def, rule_format, OF this] |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
373 |
obtain k t |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
374 |
where "((<Q t> \<and>* <(t ## s')> \<and>* I (t + s')) \<and>* c \<and>* r) (recse (run (Suc k) cnf))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
375 |
by (unfold pred_ex_def, auto elim!:sep_conjE intro!:sep_conjI) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
376 |
thus ?case |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
377 |
by (auto simp:sep_conj_ac) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
378 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
379 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
380 |
lemma I_hoare_sep_false: |
8
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
381 |
"I. \<lbrace>sep_false\<rbrace> c \<lbrace>Q\<rbrace>" |
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
382 |
by (smt IHoareI condD) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
383 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
384 |
end |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
385 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
386 |
instantiation set :: (type)sep_algebra |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
387 |
begin |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
388 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
389 |
definition set_zero_def: "0 = {}" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
390 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
391 |
definition plus_set_def: "s1 + s2 = s1 \<union> s2" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
392 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
393 |
definition sep_disj_set_def: "sep_disj s1 s2 = (s1 \<inter> s2 = {})" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
394 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
395 |
lemmas set_ins_def = sep_disj_set_def plus_set_def set_zero_def |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
396 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
397 |
instance |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
398 |
apply(default) |
8
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
399 |
apply(auto simp: set_ins_def) |
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
400 |
done |
dcbf7888a070
some small modifications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
5
diff
changeset
|
401 |
|
0
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
402 |
end |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
403 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
404 |
section {* A big operator of infinite separation conjunction *} |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
405 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
406 |
definition "fam_conj I cpt s = (\<exists> p. (s = (\<Union> i \<in> I. p(i))) \<and> |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
407 |
(\<forall> i \<in> I. cpt i (p i)) \<and> |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
408 |
(\<forall> i \<in> I. \<forall> j \<in> I. i \<noteq> j \<longrightarrow> p(i) ## p(j)))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
409 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
410 |
lemma fam_conj_zero_simp: "fam_conj {} cpt = <True>" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
411 |
proof |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
412 |
fix s |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
413 |
show "fam_conj {} cpt s = (<True>) s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
414 |
proof |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
415 |
assume "fam_conj {} cpt s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
416 |
then obtain p where "s = (\<Union> i \<in> {}. p(i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
417 |
by (unfold fam_conj_def, auto) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
418 |
hence "s = {}" by auto |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
419 |
thus "(<True>) s" by (metis pasrt_def set_zero_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
420 |
next |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
421 |
assume "(<True>) s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
422 |
hence eq_s: "s = {}" by (metis pasrt_def set_zero_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
423 |
let ?p = "\<lambda> i. {}" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
424 |
have "(s = (\<Union> i \<in> {}. ?p(i)))" by (unfold eq_s, auto) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
425 |
moreover have "(\<forall> i \<in> {}. cpt i (?p i))" by auto |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
426 |
moreover have "(\<forall> i \<in> {}. \<forall> j \<in> {}. i \<noteq> j \<longrightarrow> ?p(i) ## ?p(j))" by auto |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
427 |
ultimately show "fam_conj {} cpt s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
428 |
by (unfold eq_s fam_conj_def, auto) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
429 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
430 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
431 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
432 |
lemma fam_conj_disj_simp_pre: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
433 |
assumes h1: "I = I1 + I2" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
434 |
and h2: "I1 ## I2" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
435 |
shows "fam_conj I cpt = (fam_conj I1 cpt \<and>* fam_conj I2 cpt)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
436 |
proof |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
437 |
fix s |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
438 |
let ?fm = "fam_conj I cpt" and ?fm1 = "fam_conj I1 cpt" and ?fm2 = "fam_conj I2 cpt" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
439 |
show "?fm s = (?fm1 \<and>* ?fm2) s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
440 |
proof |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
441 |
assume "?fm s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
442 |
then obtain p where pre: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
443 |
"s = (\<Union> i \<in> I. p(i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
444 |
"(\<forall> i \<in> I. cpt i (p i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
445 |
"(\<forall> i \<in> I. \<forall> j \<in> I. i \<noteq> j \<longrightarrow> p(i) ## p(j))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
446 |
unfolding fam_conj_def by metis |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
447 |
from pre(1) h1 h2 have "s = (\<Union> i \<in> I1. p(i)) + (\<Union> i \<in> I2. p(i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
448 |
by (auto simp:set_ins_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
449 |
moreover from pre h1 have "?fm1 (\<Union> i \<in> I1. p(i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
450 |
by (unfold fam_conj_def, rule_tac x = p in exI, auto simp:set_ins_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
451 |
moreover from pre h1 have "?fm2 (\<Union> i \<in> I2. p(i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
452 |
by (unfold fam_conj_def, rule_tac x = p in exI, auto simp:set_ins_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
453 |
moreover have "(\<Union> i \<in> I1. p(i)) ## (\<Union> i \<in> I2. p(i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
454 |
proof - |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
455 |
{ fix x xa xb |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
456 |
assume h: "I1 \<inter> I2 = {}" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
457 |
"\<forall>i\<in>I1 \<union> I2. \<forall>j\<in>I1 \<union> I2. i \<noteq> j \<longrightarrow> p i \<inter> p j = {}" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
458 |
"xa \<in> I1" "x \<in> p xa" "xb \<in> I2" "x \<in> p xb" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
459 |
have "p xa \<inter> p xb = {}" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
460 |
proof(rule h(2)[rule_format]) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
461 |
from h(1, 3, 5) show "xa \<in> I1 \<union> I2" by auto |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
462 |
next |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
463 |
from h(1, 3, 5) show "xb \<in> I1 \<union> I2" by auto |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
464 |
next |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
465 |
from h(1, 3, 5) show "xa \<noteq> xb" by auto |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
466 |
qed with h(4, 6) have False by auto |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
467 |
} with h1 h2 pre(3) show ?thesis by (auto simp:set_ins_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
468 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
469 |
ultimately show "(?fm1 \<and>* ?fm2) s" by (auto intro!:sep_conjI) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
470 |
next |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
471 |
assume "(?fm1 \<and>* ?fm2) s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
472 |
then obtain s1 s2 where pre: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
473 |
"s = s1 + s2" "s1 ## s2" "?fm1 s1" "?fm2 s2" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
474 |
by (auto dest!:sep_conjD) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
475 |
from pre(3) obtain p1 where pre1: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
476 |
"s1 = (\<Union> i \<in> I1. p1(i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
477 |
"(\<forall> i \<in> I1. cpt i (p1 i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
478 |
"(\<forall> i \<in> I1. \<forall> j \<in> I1. i \<noteq> j \<longrightarrow> p1(i) ## p1(j))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
479 |
unfolding fam_conj_def by metis |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
480 |
from pre(4) obtain p2 where pre2: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
481 |
"s2 = (\<Union> i \<in> I2. p2(i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
482 |
"(\<forall> i \<in> I2. cpt i (p2 i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
483 |
"(\<forall> i \<in> I2. \<forall> j \<in> I2. i \<noteq> j \<longrightarrow> p2(i) ## p2(j))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
484 |
unfolding fam_conj_def by metis |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
485 |
let ?p = "\<lambda> i. if i \<in> I1 then p1 i else p2 i" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
486 |
from h2 pre(2) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
487 |
have "s = (\<Union> i \<in> I. ?p(i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
488 |
apply (unfold h1 pre(1) pre1(1) pre2(1) set_ins_def, auto split:if_splits) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
489 |
by (metis disjoint_iff_not_equal) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
490 |
moreover from h2 pre1(2) pre2(2) have "(\<forall> i \<in> I. cpt i (?p i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
491 |
by (unfold h1 set_ins_def, auto split:if_splits) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
492 |
moreover from pre1(1, 3) pre2(1, 3) pre(2) h2 |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
493 |
have "(\<forall> i \<in> I. \<forall> j \<in> I. i \<noteq> j \<longrightarrow> ?p(i) ## ?p(j))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
494 |
apply (unfold h1 set_ins_def, auto split:if_splits) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
495 |
by (metis IntI empty_iff) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
496 |
ultimately show "?fm s" by (unfold fam_conj_def, auto) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
497 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
498 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
499 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
500 |
lemma fam_conj_disj_simp: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
501 |
assumes h: "I1 ## I2" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
502 |
shows "fam_conj (I1 + I2) cpt = (fam_conj I1 cpt \<and>* fam_conj I2 cpt)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
503 |
proof - |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
504 |
from fam_conj_disj_simp_pre[OF _ h, of "I1 + I2"] |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
505 |
show ?thesis by simp |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
506 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
507 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
508 |
lemma fam_conj_elm_simp: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
509 |
assumes h: "i \<in> I" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
510 |
shows "fam_conj I cpt = (cpt(i) \<and>* fam_conj (I - {i}) cpt)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
511 |
proof |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
512 |
fix s |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
513 |
show "fam_conj I cpt s = (cpt i \<and>* fam_conj (I - {i}) cpt) s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
514 |
proof |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
515 |
assume pre: "fam_conj I cpt s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
516 |
show "(cpt i \<and>* fam_conj (I - {i}) cpt) s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
517 |
proof - |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
518 |
from pre obtain p where pres: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
519 |
"s = (\<Union> i \<in> I. p(i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
520 |
"(\<forall> i \<in> I. cpt i (p i))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
521 |
"(\<forall> i \<in> I. \<forall> j \<in> I. i \<noteq> j \<longrightarrow> p(i) ## p(j))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
522 |
unfolding fam_conj_def by metis |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
523 |
let ?s = "(\<Union>i\<in>(I - {i}). p i)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
524 |
from pres(3) h have disj: "(p i) ## ?s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
525 |
by (auto simp:set_ins_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
526 |
moreover from pres(1) h have eq_s: "s = (p i) + ?s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
527 |
by (auto simp:set_ins_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
528 |
moreover from pres(2) h have "cpt i (p i)" by auto |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
529 |
moreover from pres have "(fam_conj (I - {i}) cpt) ?s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
530 |
by (unfold fam_conj_def, rule_tac x = p in exI, auto) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
531 |
ultimately show ?thesis by (auto intro!:sep_conjI) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
532 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
533 |
next |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
534 |
let ?fam = "fam_conj (I - {i}) cpt" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
535 |
assume "(cpt i \<and>* ?fam) s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
536 |
then obtain s1 s2 where pre: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
537 |
"s = s1 + s2" "s1 ## s2" "cpt i s1" "?fam s2" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
538 |
by (auto dest!:sep_conjD) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
539 |
from pre(4) obtain p where pres: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
540 |
"s2 = (\<Union> ia \<in> I - {i}. p(ia))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
541 |
"(\<forall> ia \<in> I - {i}. cpt ia (p ia))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
542 |
"(\<forall> ia \<in> I - {i}. \<forall> j \<in> I - {i}. ia \<noteq> j \<longrightarrow> p(ia) ## p(j))" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
543 |
unfolding fam_conj_def by metis |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
544 |
let ?p = "p(i:=s1)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
545 |
from h pres(3) pre(2)[unfolded pres(1)] |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
546 |
have " \<forall>ia\<in>I. \<forall>j\<in>I. ia \<noteq> j \<longrightarrow> ?p ia ## ?p j" by (auto simp:set_ins_def) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
547 |
moreover from pres(1) pre(1) h pre(2) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
548 |
have "(s = (\<Union> i \<in> I. ?p(i)))" by (auto simp:set_ins_def split:if_splits) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
549 |
moreover from pre(3) pres(2) h |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
550 |
have "(\<forall> i \<in> I. cpt i (?p i))" by (auto simp:set_ins_def split:if_splits) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
551 |
ultimately show "fam_conj I cpt s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
552 |
by (unfold fam_conj_def, auto) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
553 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
554 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
555 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
556 |
lemma fam_conj_insert_simp: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
557 |
assumes h:"i \<notin> I" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
558 |
shows "fam_conj (insert i I) cpt = (cpt(i) \<and>* fam_conj I cpt)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
559 |
proof - |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
560 |
have "i \<in> insert i I" by auto |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
561 |
from fam_conj_elm_simp[OF this] and h |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
562 |
show ?thesis by auto |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
563 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
564 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
565 |
lemmas fam_conj_simps = fam_conj_insert_simp fam_conj_zero_simp |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
566 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
567 |
lemma "fam_conj {0, 2, 3} cpt = (cpt 2 \<and>* cpt (0::int) \<and>* cpt 3)" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
568 |
by (simp add:fam_conj_simps sep_conj_ac) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
569 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
570 |
lemma fam_conj_ext_eq: |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
571 |
assumes h: "\<And> i . i \<in> I \<Longrightarrow> f i = g i" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
572 |
shows "fam_conj I f = fam_conj I g" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
573 |
proof |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
574 |
fix s |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
575 |
show "fam_conj I f s = fam_conj I g s" |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
576 |
by (unfold fam_conj_def, auto simp:h) |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
577 |
qed |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
578 |
|
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
579 |
end |
1378b654acde
initial commit for Isabelle 2013-1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
580 |