author | nipkow |
Wed, 19 Oct 2011 16:32:12 +0200 | |
changeset 45200 | 1f1897ac7877 |
parent 45127 | d2eb07a1e01b |
child 45623 | f682f3f7b726 |
permissions | -rw-r--r-- |
45111 | 1 |
(* Author: Tobias Nipkow *) |
2 |
||
3 |
theory Abs_Int1 |
|
4 |
imports Abs_Int0_const |
|
5 |
begin |
|
6 |
||
7 |
instantiation prod :: (preord,preord) preord |
|
8 |
begin |
|
9 |
||
10 |
definition "le_prod p1 p2 = (fst p1 \<sqsubseteq> fst p2 \<and> snd p1 \<sqsubseteq> snd p2)" |
|
11 |
||
12 |
instance |
|
13 |
proof |
|
14 |
case goal1 show ?case by(simp add: le_prod_def) |
|
15 |
next |
|
16 |
case goal2 thus ?case unfolding le_prod_def by(metis le_trans) |
|
17 |
qed |
|
18 |
||
19 |
end |
|
20 |
||
21 |
||
22 |
subsection "Backward Analysis of Expressions" |
|
23 |
||
24 |
hide_const bot |
|
25 |
||
26 |
class L_top_bot = SL_top + |
|
27 |
fixes meet :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<sqinter>" 65) |
|
28 |
and bot :: "'a" ("\<bottom>") |
|
29 |
assumes meet_le1 [simp]: "x \<sqinter> y \<sqsubseteq> x" |
|
30 |
and meet_le2 [simp]: "x \<sqinter> y \<sqsubseteq> y" |
|
31 |
and meet_greatest: "x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> z \<Longrightarrow> x \<sqsubseteq> y \<sqinter> z" |
|
32 |
assumes bot[simp]: "\<bottom> \<sqsubseteq> x" |
|
45127
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
33 |
begin |
45111 | 34 |
|
45127
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
35 |
lemma mono_meet: "x \<sqsubseteq> x' \<Longrightarrow> y \<sqsubseteq> y' \<Longrightarrow> x \<sqinter> y \<sqsubseteq> x' \<sqinter> y'" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
36 |
by (metis meet_greatest meet_le1 meet_le2 le_trans) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
37 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
38 |
end |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
39 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
40 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
41 |
locale Val_abs1_rep = |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
42 |
Val_abs rep num' plus' |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
43 |
for rep :: "'a::L_top_bot \<Rightarrow> val set" and num' plus' + |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
44 |
assumes inter_rep_subset_rep_meet: |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
45 |
"rep a1 \<inter> rep a2 \<subseteq> rep(a1 \<sqinter> a2)" |
45111 | 46 |
and rep_Bot: "rep \<bottom> = {}" |
47 |
begin |
|
48 |
||
49 |
lemma in_rep_meet: "x <: a1 \<Longrightarrow> x <: a2 \<Longrightarrow> x <: a1 \<sqinter> a2" |
|
50 |
by (metis IntI inter_rep_subset_rep_meet set_mp) |
|
51 |
||
52 |
lemma rep_meet[simp]: "rep(a1 \<sqinter> a2) = rep a1 \<inter> rep a2" |
|
53 |
by (metis equalityI inter_rep_subset_rep_meet le_inf_iff le_rep meet_le1 meet_le2) |
|
54 |
||
55 |
end |
|
56 |
||
57 |
||
45127
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
58 |
locale Val_abs1 = Val_abs1_rep + |
45111 | 59 |
fixes filter_plus' :: "'a \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'a * 'a" |
60 |
and filter_less' :: "bool \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'a * 'a" |
|
61 |
assumes filter_plus': "filter_plus' a a1 a2 = (a1',a2') \<Longrightarrow> |
|
62 |
n1 <: a1 \<Longrightarrow> n2 <: a2 \<Longrightarrow> n1+n2 <: a \<Longrightarrow> n1 <: a1' \<and> n2 <: a2'" |
|
63 |
and filter_less': "filter_less' (n1<n2) a1 a2 = (a1',a2') \<Longrightarrow> |
|
64 |
n1 <: a1 \<Longrightarrow> n2 <: a2 \<Longrightarrow> n1 <: a1' \<and> n2 <: a2'" |
|
45127
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
65 |
|
45111 | 66 |
|
45127
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
67 |
locale Abs_Int1 = Val_abs1 |
45111 | 68 |
begin |
69 |
||
70 |
lemma in_rep_join_UpI: "s <:up S1 | s <:up S2 \<Longrightarrow> s <:up S1 \<squnion> S2" |
|
71 |
by (metis join_ge1 join_ge2 up_fun_in_rep_le) |
|
72 |
||
73 |
fun aval' :: "aexp \<Rightarrow> 'a st up \<Rightarrow> 'a" where |
|
74 |
"aval' _ Bot = \<bottom>" | |
|
75 |
"aval' (N n) _ = num' n" | |
|
76 |
"aval' (V x) (Up S) = lookup S x" | |
|
77 |
"aval' (Plus a1 a2) S = plus' (aval' a1 S) (aval' a2 S)" |
|
78 |
||
79 |
lemma aval'_sound: "s <:up S \<Longrightarrow> aval a s <: aval' a S" |
|
45127
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
80 |
by(induct a)(auto simp: rep_num' rep_plus' in_rep_up_iff lookup_def rep_st_def) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
81 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
82 |
subsubsection "Backward analysis" |
45111 | 83 |
|
84 |
fun afilter :: "aexp \<Rightarrow> 'a \<Rightarrow> 'a st up \<Rightarrow> 'a st up" where |
|
85 |
"afilter (N n) a S = (if n <: a then S else Bot)" | |
|
86 |
"afilter (V x) a S = (case S of Bot \<Rightarrow> Bot | Up S \<Rightarrow> |
|
87 |
let a' = lookup S x \<sqinter> a in |
|
88 |
if a' \<sqsubseteq> \<bottom> then Bot else Up(update S x a'))" | |
|
89 |
"afilter (Plus e1 e2) a S = |
|
90 |
(let (a1,a2) = filter_plus' a (aval' e1 S) (aval' e2 S) |
|
91 |
in afilter e1 a1 (afilter e2 a2 S))" |
|
92 |
||
93 |
text{* The test for @{const Bot} in the @{const V}-case is important: @{const |
|
94 |
Bot} indicates that a variable has no possible values, i.e.\ that the current |
|
95 |
program point is unreachable. But then the abstract state should collapse to |
|
96 |
@{const bot}. Put differently, we maintain the invariant that in an abstract |
|
97 |
state all variables are mapped to non-@{const Bot} values. Otherwise the |
|
98 |
(pointwise) join of two abstract states, one of which contains @{const Bot} |
|
99 |
values, may produce too large a result, thus making the analysis less |
|
100 |
precise. *} |
|
101 |
||
102 |
||
103 |
fun bfilter :: "bexp \<Rightarrow> bool \<Rightarrow> 'a st up \<Rightarrow> 'a st up" where |
|
45200 | 104 |
"bfilter (Bc v) res S = (if v=res then S else Bot)" | |
45111 | 105 |
"bfilter (Not b) res S = bfilter b (\<not> res) S" | |
106 |
"bfilter (And b1 b2) res S = |
|
107 |
(if res then bfilter b1 True (bfilter b2 True S) |
|
108 |
else bfilter b1 False S \<squnion> bfilter b2 False S)" | |
|
109 |
"bfilter (Less e1 e2) res S = |
|
110 |
(let (res1,res2) = filter_less' res (aval' e1 S) (aval' e2 S) |
|
111 |
in afilter e1 res1 (afilter e2 res2 S))" |
|
112 |
||
113 |
lemma afilter_sound: "s <:up S \<Longrightarrow> aval e s <: a \<Longrightarrow> s <:up afilter e a S" |
|
114 |
proof(induction e arbitrary: a S) |
|
115 |
case N thus ?case by simp |
|
116 |
next |
|
117 |
case (V x) |
|
118 |
obtain S' where "S = Up S'" and "s <:f S'" using `s <:up S` |
|
119 |
by(auto simp: in_rep_up_iff) |
|
120 |
moreover hence "s x <: lookup S' x" by(simp add: rep_st_def) |
|
121 |
moreover have "s x <: a" using V by simp |
|
122 |
ultimately show ?case using V(1) |
|
123 |
by(simp add: lookup_update Let_def rep_st_def) |
|
124 |
(metis le_rep emptyE in_rep_meet rep_Bot subset_empty) |
|
125 |
next |
|
126 |
case (Plus e1 e2) thus ?case |
|
127 |
using filter_plus'[OF _ aval'_sound[OF Plus(3)] aval'_sound[OF Plus(3)]] |
|
128 |
by (auto split: prod.split) |
|
129 |
qed |
|
130 |
||
131 |
lemma bfilter_sound: "s <:up S \<Longrightarrow> bv = bval b s \<Longrightarrow> s <:up bfilter b bv S" |
|
132 |
proof(induction b arbitrary: S bv) |
|
45200 | 133 |
case Bc thus ?case by simp |
45111 | 134 |
next |
135 |
case (Not b) thus ?case by simp |
|
136 |
next |
|
137 |
case (And b1 b2) thus ?case by(fastforce simp: in_rep_join_UpI) |
|
138 |
next |
|
139 |
case (Less e1 e2) thus ?case |
|
140 |
by (auto split: prod.split) |
|
141 |
(metis afilter_sound filter_less' aval'_sound Less) |
|
142 |
qed |
|
143 |
||
144 |
||
45127
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
145 |
fun step :: "'a st up \<Rightarrow> 'a st up acom \<Rightarrow> 'a st up acom" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
146 |
where |
45111 | 147 |
"step S (SKIP {P}) = (SKIP {S})" | |
148 |
"step S (x ::= e {P}) = |
|
149 |
x ::= e {case S of Bot \<Rightarrow> Bot |
|
150 |
| Up S \<Rightarrow> Up(update S x (aval' e (Up S)))}" | |
|
151 |
"step S (c1; c2) = step S c1; step (post c1) c2" | |
|
152 |
"step S (IF b THEN c1 ELSE c2 {P}) = |
|
153 |
(let c1' = step (bfilter b True S) c1; c2' = step (bfilter b False S) c2 |
|
154 |
in IF b THEN c1' ELSE c2' {post c1 \<squnion> post c2})" | |
|
155 |
"step S ({Inv} WHILE b DO c {P}) = |
|
156 |
{S \<squnion> post c} |
|
157 |
WHILE b DO step (bfilter b True Inv) c |
|
158 |
{bfilter b False Inv}" |
|
159 |
||
45127
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
160 |
definition AI :: "com \<Rightarrow> 'a st up acom option" where |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
161 |
"AI = lpfp\<^isub>c (step \<top>)" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
162 |
|
45111 | 163 |
lemma strip_step[simp]: "strip(step S c) = strip c" |
164 |
by(induct c arbitrary: S) (simp_all add: Let_def) |
|
165 |
||
166 |
||
167 |
subsubsection "Soundness" |
|
168 |
||
169 |
lemma in_rep_update: "\<lbrakk> s <:f S; i <: a \<rbrakk> \<Longrightarrow> s(x := i) <:f update S x a" |
|
170 |
by(simp add: rep_st_def lookup_update) |
|
171 |
||
172 |
lemma While_final_False: "(WHILE b DO c, s) \<Rightarrow> t \<Longrightarrow> \<not> bval b t" |
|
173 |
by(induct "WHILE b DO c" s t rule: big_step_induct) simp_all |
|
174 |
||
175 |
lemma step_sound: |
|
176 |
"step S c \<sqsubseteq> c \<Longrightarrow> (strip c,s) \<Rightarrow> t \<Longrightarrow> s <:up S \<Longrightarrow> t <:up post c" |
|
177 |
proof(induction c arbitrary: S s t) |
|
178 |
case SKIP thus ?case |
|
179 |
by simp (metis skipE up_fun_in_rep_le) |
|
180 |
next |
|
181 |
case Assign thus ?case |
|
182 |
apply (auto simp del: fun_upd_apply split: up.splits) |
|
183 |
by (metis aval'_sound fun_in_rep_le in_rep_update rep_up.simps(2)) |
|
184 |
next |
|
185 |
case Semi thus ?case by simp blast |
|
186 |
next |
|
187 |
case (If b c1 c2 S0) |
|
188 |
show ?case |
|
189 |
proof cases |
|
190 |
assume "bval b s" |
|
191 |
with If.prems have 1: "step (bfilter b True S) c1 \<sqsubseteq> c1" |
|
192 |
and 2: "(strip c1, s) \<Rightarrow> t" and 3: "post c1 \<sqsubseteq> S0" by(auto simp: Let_def) |
|
193 |
from If.IH(1)[OF 1 2 bfilter_sound[OF `s <:up S`]] `bval b s` 3 |
|
194 |
show ?thesis by simp (metis up_fun_in_rep_le) |
|
195 |
next |
|
196 |
assume "\<not> bval b s" |
|
197 |
with If.prems have 1: "step (bfilter b False S) c2 \<sqsubseteq> c2" |
|
198 |
and 2: "(strip c2, s) \<Rightarrow> t" and 3: "post c2 \<sqsubseteq> S0" by(auto simp: Let_def) |
|
199 |
from If.IH(2)[OF 1 2 bfilter_sound[OF `s <:up S`]] `\<not> bval b s` 3 |
|
200 |
show ?thesis by simp (metis up_fun_in_rep_le) |
|
201 |
qed |
|
202 |
next |
|
203 |
case (While Inv b c P) |
|
204 |
from While.prems have inv: "step (bfilter b True Inv) c \<sqsubseteq> c" |
|
205 |
and "post c \<sqsubseteq> Inv" and "S \<sqsubseteq> Inv" and "bfilter b False Inv \<sqsubseteq> P" |
|
206 |
by(auto simp: Let_def) |
|
207 |
{ fix s t have "(WHILE b DO strip c,s) \<Rightarrow> t \<Longrightarrow> s <:up Inv \<Longrightarrow> t <:up Inv" |
|
208 |
proof(induction "WHILE b DO strip c" s t rule: big_step_induct) |
|
209 |
case WhileFalse thus ?case by simp |
|
210 |
next |
|
211 |
case (WhileTrue s1 s2 s3) |
|
212 |
from WhileTrue.hyps(5)[OF up_fun_in_rep_le[OF While.IH[OF inv `(strip c, s1) \<Rightarrow> s2` bfilter_sound[OF `s1 <:up Inv`]] `post c \<sqsubseteq> Inv`]] `bval b s1` |
|
213 |
show ?case by simp |
|
214 |
qed |
|
215 |
} note Inv = this |
|
216 |
from While.prems(2) have "(WHILE b DO strip c, s) \<Rightarrow> t" and "\<not> bval b t" |
|
217 |
by(auto dest: While_final_False) |
|
218 |
from Inv[OF this(1) up_fun_in_rep_le[OF `s <:up S` `S \<sqsubseteq> Inv`]] |
|
219 |
have "t <:up Inv" . |
|
220 |
from up_fun_in_rep_le[OF bfilter_sound[OF this] `bfilter b False Inv \<sqsubseteq> P`] |
|
221 |
show ?case using `\<not> bval b t` by simp |
|
222 |
qed |
|
223 |
||
45127
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
224 |
lemma AI_sound: "\<lbrakk> AI c = Some c'; (c,s) \<Rightarrow> t \<rbrakk> \<Longrightarrow> t <:up post c'" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
225 |
unfolding AI_def |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
226 |
by (metis in_rep_Top_up lpfpc_pfp step_sound strip_lpfpc strip_step) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
227 |
(* |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
228 |
by(metis step_sound[of "\<top>" c' s t] strip_lpfp strip_step |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
229 |
lpfp_pfp mono_def mono_step[OF le_refl] in_rep_Top_up) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
230 |
*) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
231 |
end |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
232 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
233 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
234 |
subsubsection "Monotonicity" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
235 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
236 |
locale Abs_Int1_mono = Abs_Int1 + |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
237 |
assumes mono_plus': "a1 \<sqsubseteq> b1 \<Longrightarrow> a2 \<sqsubseteq> b2 \<Longrightarrow> plus' a1 a2 \<sqsubseteq> plus' b1 b2" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
238 |
and mono_filter_plus': "a1 \<sqsubseteq> b1 \<Longrightarrow> a2 \<sqsubseteq> b2 \<Longrightarrow> r \<sqsubseteq> r' \<Longrightarrow> |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
239 |
filter_plus' r a1 a2 \<sqsubseteq> filter_plus' r' b1 b2" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
240 |
and mono_filter_less': "a1 \<sqsubseteq> b1 \<Longrightarrow> a2 \<sqsubseteq> b2 \<Longrightarrow> |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
241 |
filter_less' bv a1 a2 \<sqsubseteq> filter_less' bv b1 b2" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
242 |
begin |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
243 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
244 |
lemma mono_aval': "S \<sqsubseteq> S' \<Longrightarrow> aval' e S \<sqsubseteq> aval' e S'" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
245 |
apply(cases S) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
246 |
apply simp |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
247 |
apply(cases S') |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
248 |
apply simp |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
249 |
apply simp |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
250 |
by(induction e) (auto simp: le_st_def lookup_def mono_plus') |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
251 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
252 |
lemma mono_afilter: "r \<sqsubseteq> r' \<Longrightarrow> S \<sqsubseteq> S' \<Longrightarrow> afilter e r S \<sqsubseteq> afilter e r' S'" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
253 |
apply(induction e arbitrary: r r' S S') |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
254 |
apply(auto simp: Let_def split: up.splits prod.splits) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
255 |
apply (metis le_rep subsetD) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
256 |
apply(drule_tac x = "list" in mono_lookup) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
257 |
apply (metis mono_meet le_trans) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
258 |
apply (metis mono_meet mono_lookup mono_update le_trans) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
259 |
apply(metis mono_aval' mono_filter_plus'[simplified le_prod_def] fst_conv snd_conv) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
260 |
done |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
261 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
262 |
lemma mono_bfilter: "S \<sqsubseteq> S' \<Longrightarrow> bfilter b r S \<sqsubseteq> bfilter b r S'" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
263 |
apply(induction b arbitrary: r S S') |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
264 |
apply(auto simp: le_trans[OF _ join_ge1] le_trans[OF _ join_ge2] split: prod.splits) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
265 |
apply(metis mono_aval' mono_afilter mono_filter_less'[simplified le_prod_def] fst_conv snd_conv) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
266 |
done |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
267 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
268 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
269 |
lemma post_le_post: "c \<sqsubseteq> c' \<Longrightarrow> post c \<sqsubseteq> post c'" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
270 |
by (induction c c' rule: le_acom.induct) simp_all |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
271 |
|
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
272 |
lemma mono_step: "S \<sqsubseteq> S' \<Longrightarrow> c \<sqsubseteq> c' \<Longrightarrow> step S c \<sqsubseteq> step S' c'" |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
273 |
apply(induction c c' arbitrary: S S' rule: le_acom.induct) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
274 |
apply (auto simp: post_le_post Let_def mono_bfilter mono_update mono_aval' le_join_disj |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
275 |
split: up.split) |
d2eb07a1e01b
separated monotonicity reasoning and defined narrowing with while_option
nipkow
parents:
45111
diff
changeset
|
276 |
done |
45111 | 277 |
|
278 |
end |
|
279 |
||
280 |
end |