--- a/src/HOL/IMP/Abs_Int0.thy Mon May 13 22:49:00 2013 +0200
+++ b/src/HOL/IMP/Abs_Int0.thy Tue May 14 06:54:31 2013 +0200
@@ -208,9 +208,9 @@
lemma mono_gamma_c: "C1 \<le> C2 \<Longrightarrow> \<gamma>\<^isub>c C1 \<le> \<gamma>\<^isub>c C2"
by (induction C1 C2 rule: less_eq_acom.induct) (simp_all add:mono_gamma_o)
-text{* Soundness: *}
+text{* Correctness: *}
-lemma aval'_sound: "s : \<gamma>\<^isub>s S \<Longrightarrow> aval a s : \<gamma>(aval' a S)"
+lemma aval'_correct: "s : \<gamma>\<^isub>s S \<Longrightarrow> aval a s : \<gamma>(aval' a S)"
by (induct a) (auto simp: gamma_num' gamma_plus' \<gamma>_fun_def)
lemma in_gamma_update: "\<lbrakk> s : \<gamma>\<^isub>s S; i : \<gamma> a \<rbrakk> \<Longrightarrow> s(x := i) : \<gamma>\<^isub>s(S(x := a))"
@@ -225,9 +225,9 @@
lemma step_step': "step (\<gamma>\<^isub>o S) (\<gamma>\<^isub>c C) \<le> \<gamma>\<^isub>c (step' S C)"
unfolding step_def step'_def
by(rule gamma_Step_subcomm)
- (auto simp: aval'_sound in_gamma_update asem_def split: option.splits)
+ (auto simp: aval'_correct in_gamma_update asem_def split: option.splits)
-lemma AI_sound: "AI c = Some C \<Longrightarrow> CS c \<le> \<gamma>\<^isub>c C"
+lemma AI_correct: "AI c = Some C \<Longrightarrow> CS c \<le> \<gamma>\<^isub>c C"
proof(simp add: CS_def AI_def)
assume 1: "pfp (step' \<top>) (bot c) = Some C"
have pfp': "step' \<top> C \<le> C" by(rule pfp_pfp[OF 1])
--- a/src/HOL/IMP/Abs_Int1.thy Mon May 13 22:49:00 2013 +0200
+++ b/src/HOL/IMP/Abs_Int1.thy Tue May 14 06:54:31 2013 +0200
@@ -16,7 +16,7 @@
"aval' (V x) S = fun S x" |
"aval' (Plus a1 a2) S = plus' (aval' a1 S) (aval' a2 S)"
-lemma aval'_sound: "s : \<gamma>\<^isub>s S \<Longrightarrow> aval a s : \<gamma>(aval' a S)"
+lemma aval'_correct: "s : \<gamma>\<^isub>s S \<Longrightarrow> aval a s : \<gamma>(aval' a S)"
by (induction a) (auto simp: gamma_num' gamma_plus' \<gamma>_st_def)
lemma gamma_Step_subcomm: fixes C1 C2 :: "'a::semilattice_sup acom"
@@ -48,14 +48,14 @@
by(simp add: step'_def)
-text{* Soundness: *}
+text{* Correctness: *}
lemma step_step': "step (\<gamma>\<^isub>o S) (\<gamma>\<^isub>c C) \<le> \<gamma>\<^isub>c (step' S C)"
unfolding step_def step'_def
by(rule gamma_Step_subcomm)
- (auto simp: intro!: aval'_sound in_gamma_update split: option.splits)
+ (auto simp: intro!: aval'_correct in_gamma_update split: option.splits)
-lemma AI_sound: "AI c = Some C \<Longrightarrow> CS c \<le> \<gamma>\<^isub>c C"
+lemma AI_correct: "AI c = Some C \<Longrightarrow> CS c \<le> \<gamma>\<^isub>c C"
proof(simp add: CS_def AI_def)
assume 1: "pfp (step' \<top>) (bot c) = Some C"
have pfp': "step' \<top> C \<le> C" by(rule pfp_pfp[OF 1])
--- a/src/HOL/IMP/Abs_Int2.thy Mon May 13 22:49:00 2013 +0200
+++ b/src/HOL/IMP/Abs_Int2.thy Tue May 14 06:54:31 2013 +0200
@@ -48,12 +48,12 @@
locale Val_abs1 = Val_abs1_gamma where \<gamma> = \<gamma>
for \<gamma> :: "'av::bounded_lattice \<Rightarrow> val set" +
fixes test_num' :: "val \<Rightarrow> 'av \<Rightarrow> bool"
-and constrain_plus' :: "'av \<Rightarrow> 'av \<Rightarrow> 'av \<Rightarrow> 'av * 'av"
-and constrain_less' :: "bool \<Rightarrow> 'av \<Rightarrow> 'av \<Rightarrow> 'av * 'av"
+and inv_plus' :: "'av \<Rightarrow> 'av \<Rightarrow> 'av \<Rightarrow> 'av * 'av"
+and inv_less' :: "bool \<Rightarrow> 'av \<Rightarrow> 'av \<Rightarrow> 'av * 'av"
assumes test_num': "test_num' i a = (i : \<gamma> a)"
-and constrain_plus': "constrain_plus' a a1 a2 = (a\<^isub>1',a\<^isub>2') \<Longrightarrow>
+and inv_plus': "inv_plus' a a1 a2 = (a\<^isub>1',a\<^isub>2') \<Longrightarrow>
i1 : \<gamma> a1 \<Longrightarrow> i2 : \<gamma> a2 \<Longrightarrow> i1+i2 : \<gamma> a \<Longrightarrow> i1 : \<gamma> a\<^isub>1' \<and> i2 : \<gamma> a\<^isub>2'"
-and constrain_less': "constrain_less' (i1<i2) a1 a2 = (a\<^isub>1',a\<^isub>2') \<Longrightarrow>
+and inv_less': "inv_less' (i1<i2) a1 a2 = (a\<^isub>1',a\<^isub>2') \<Longrightarrow>
i1 : \<gamma> a1 \<Longrightarrow> i2 : \<gamma> a2 \<Longrightarrow> i1 : \<gamma> a\<^isub>1' \<and> i2 : \<gamma> a\<^isub>2'"
@@ -69,19 +69,19 @@
"aval'' e None = \<bottom>" |
"aval'' e (Some S) = aval' e S"
-lemma aval''_sound: "s : \<gamma>\<^isub>o S \<Longrightarrow> aval a s : \<gamma>(aval'' a S)"
-by(cases S)(auto simp add: aval'_sound split: option.splits)
+lemma aval''_correct: "s : \<gamma>\<^isub>o S \<Longrightarrow> aval a s : \<gamma>(aval'' a S)"
+by(cases S)(auto simp add: aval'_correct split: option.splits)
subsubsection "Backward analysis"
-fun aconstrain :: "aexp \<Rightarrow> 'av \<Rightarrow> 'av st option \<Rightarrow> 'av st option" where
-"aconstrain (N n) a S = (if test_num' n a then S else None)" |
-"aconstrain (V x) a S = (case S of None \<Rightarrow> None | Some S \<Rightarrow>
+fun inv_aval'' :: "aexp \<Rightarrow> 'av \<Rightarrow> 'av st option \<Rightarrow> 'av st option" where
+"inv_aval'' (N n) a S = (if test_num' n a then S else None)" |
+"inv_aval'' (V x) a S = (case S of None \<Rightarrow> None | Some S \<Rightarrow>
let a' = fun S x \<sqinter> a in
if a' = \<bottom> then None else Some(update S x a'))" |
-"aconstrain (Plus e1 e2) a S =
- (let (a1,a2) = constrain_plus' a (aval'' e1 S) (aval'' e2 S)
- in aconstrain e1 a1 (aconstrain e2 a2 S))"
+"inv_aval'' (Plus e1 e2) a S =
+ (let (a1,a2) = inv_plus' a (aval'' e1 S) (aval'' e2 S)
+ in inv_aval'' e1 a1 (inv_aval'' e2 a2 S))"
text{* The test for @{const bot} in the @{const V}-case is important: @{const
bot} indicates that a variable has no possible values, i.e.\ that the current
@@ -93,17 +93,17 @@
making the analysis less precise. *}
-fun bconstrain :: "bexp \<Rightarrow> bool \<Rightarrow> 'av st option \<Rightarrow> 'av st option" where
-"bconstrain (Bc v) res S = (if v=res then S else None)" |
-"bconstrain (Not b) res S = bconstrain b (\<not> res) S" |
-"bconstrain (And b1 b2) res S =
- (if res then bconstrain b1 True (bconstrain b2 True S)
- else bconstrain b1 False S \<squnion> bconstrain b2 False S)" |
-"bconstrain (Less e1 e2) res S =
- (let (a1,a2) = constrain_less' res (aval'' e1 S) (aval'' e2 S)
- in aconstrain e1 a1 (aconstrain e2 a2 S))"
+fun inv_bval'' :: "bexp \<Rightarrow> bool \<Rightarrow> 'av st option \<Rightarrow> 'av st option" where
+"inv_bval'' (Bc v) res S = (if v=res then S else None)" |
+"inv_bval'' (Not b) res S = inv_bval'' b (\<not> res) S" |
+"inv_bval'' (And b1 b2) res S =
+ (if res then inv_bval'' b1 True (inv_bval'' b2 True S)
+ else inv_bval'' b1 False S \<squnion> inv_bval'' b2 False S)" |
+"inv_bval'' (Less e1 e2) res S =
+ (let (a1,a2) = inv_less' res (aval'' e1 S) (aval'' e2 S)
+ in inv_aval'' e1 a1 (inv_aval'' e2 a2 S))"
-lemma aconstrain_sound: "s : \<gamma>\<^isub>o S \<Longrightarrow> aval e s : \<gamma> a \<Longrightarrow> s : \<gamma>\<^isub>o (aconstrain e a S)"
+lemma inv_aval''_correct: "s : \<gamma>\<^isub>o S \<Longrightarrow> aval e s : \<gamma> a \<Longrightarrow> s : \<gamma>\<^isub>o (inv_aval'' e a S)"
proof(induction e arbitrary: a S)
case N thus ?case by simp (metis test_num')
next
@@ -118,11 +118,11 @@
(metis mono_gamma emptyE in_gamma_inf gamma_bot subset_empty)
next
case (Plus e1 e2) thus ?case
- using constrain_plus'[OF _ aval''_sound aval''_sound]
+ using inv_plus'[OF _ aval''_correct aval''_correct]
by (auto split: prod.split)
qed
-lemma bconstrain_sound: "s : \<gamma>\<^isub>o S \<Longrightarrow> bv = bval b s \<Longrightarrow> s : \<gamma>\<^isub>o(bconstrain b bv S)"
+lemma inv_bval''_correct: "s : \<gamma>\<^isub>o S \<Longrightarrow> bv = bval b s \<Longrightarrow> s : \<gamma>\<^isub>o(inv_bval'' b bv S)"
proof(induction b arbitrary: S bv)
case Bc thus ?case by simp
next
@@ -133,12 +133,12 @@
next
case (Less e1 e2) thus ?case
by(auto split: prod.split)
- (metis (lifting) aconstrain_sound aval''_sound constrain_less')
+ (metis (lifting) inv_aval''_correct aval''_correct inv_less')
qed
definition "step' = Step
(\<lambda>x e S. case S of None \<Rightarrow> None | Some S \<Rightarrow> Some(update S x (aval' e S)))
- (\<lambda>b S. bconstrain b True S)"
+ (\<lambda>b S. inv_bval'' b True S)"
definition AI :: "com \<Rightarrow> 'av st option acom option" where
"AI c = pfp (step' \<top>) (bot c)"
@@ -146,25 +146,25 @@
lemma strip_step'[simp]: "strip(step' S c) = strip c"
by(simp add: step'_def)
-lemma top_on_aconstrain: "\<lbrakk> top_on_opt S X; vars e \<subseteq> -X \<rbrakk> \<Longrightarrow> top_on_opt (aconstrain e a S) X"
+lemma top_on_inv_aval'': "\<lbrakk> top_on_opt S X; vars e \<subseteq> -X \<rbrakk> \<Longrightarrow> top_on_opt (inv_aval'' e a S) X"
by(induction e arbitrary: a S) (auto simp: Let_def split: option.splits prod.split)
-lemma top_on_bconstrain: "\<lbrakk>top_on_opt S X; vars b \<subseteq> -X\<rbrakk> \<Longrightarrow> top_on_opt (bconstrain b r S) X"
-by(induction b arbitrary: r S) (auto simp: top_on_aconstrain top_on_sup split: prod.split)
+lemma top_on_inv_bval'': "\<lbrakk>top_on_opt S X; vars b \<subseteq> -X\<rbrakk> \<Longrightarrow> top_on_opt (inv_bval'' b r S) X"
+by(induction b arbitrary: r S) (auto simp: top_on_inv_aval'' top_on_sup split: prod.split)
lemma top_on_step': "top_on_acom C (- vars C) \<Longrightarrow> top_on_acom (step' \<top> C) (- vars C)"
unfolding step'_def
by(rule top_on_Step)
- (auto simp add: top_on_top top_on_bconstrain split: option.split)
+ (auto simp add: top_on_top top_on_inv_bval'' split: option.split)
-subsubsection "Soundness"
+subsubsection "Correctness"
lemma step_step': "step (\<gamma>\<^isub>o S) (\<gamma>\<^isub>c C) \<le> \<gamma>\<^isub>c (step' S C)"
unfolding step_def step'_def
by(rule gamma_Step_subcomm)
- (auto simp: intro!: aval'_sound bconstrain_sound in_gamma_update split: option.splits)
+ (auto simp: intro!: aval'_correct inv_bval''_correct in_gamma_update split: option.splits)
-lemma AI_sound: "AI c = Some C \<Longrightarrow> CS c \<le> \<gamma>\<^isub>c C"
+lemma AI_correct: "AI c = Some C \<Longrightarrow> CS c \<le> \<gamma>\<^isub>c C"
proof(simp add: CS_def AI_def)
assume 1: "pfp (step' \<top>) (bot c) = Some C"
have pfp': "step' \<top> C \<le> C" by(rule pfp_pfp[OF 1])
@@ -186,10 +186,10 @@
locale Abs_Int1_mono = Abs_Int1 +
assumes mono_plus': "a1 \<le> b1 \<Longrightarrow> a2 \<le> b2 \<Longrightarrow> plus' a1 a2 \<le> plus' b1 b2"
-and mono_constrain_plus': "a1 \<le> b1 \<Longrightarrow> a2 \<le> b2 \<Longrightarrow> r \<le> r' \<Longrightarrow>
- constrain_plus' r a1 a2 \<le> constrain_plus' r' b1 b2"
-and mono_constrain_less': "a1 \<le> b1 \<Longrightarrow> a2 \<le> b2 \<Longrightarrow>
- constrain_less' bv a1 a2 \<le> constrain_less' bv b1 b2"
+and mono_inv_plus': "a1 \<le> b1 \<Longrightarrow> a2 \<le> b2 \<Longrightarrow> r \<le> r' \<Longrightarrow>
+ inv_plus' r a1 a2 \<le> inv_plus' r' b1 b2"
+and mono_inv_less': "a1 \<le> b1 \<Longrightarrow> a2 \<le> b2 \<Longrightarrow>
+ inv_less' bv a1 a2 \<le> inv_less' bv b1 b2"
begin
lemma mono_aval':
@@ -204,28 +204,28 @@
apply simp
by (simp add: mono_aval')
-lemma mono_aconstrain: "r1 \<le> r2 \<Longrightarrow> S1 \<le> S2 \<Longrightarrow> aconstrain e r1 S1 \<le> aconstrain e r2 S2"
+lemma mono_inv_aval'': "r1 \<le> r2 \<Longrightarrow> S1 \<le> S2 \<Longrightarrow> inv_aval'' e r1 S1 \<le> inv_aval'' e r2 S2"
apply(induction e arbitrary: r1 r2 S1 S2)
apply(auto simp: test_num' Let_def inf_mono split: option.splits prod.splits)
apply (metis mono_gamma subsetD)
apply (metis le_bot inf_mono le_st_iff)
apply (metis inf_mono mono_update le_st_iff)
-apply(metis mono_aval'' mono_constrain_plus'[simplified less_eq_prod_def] fst_conv snd_conv)
+apply(metis mono_aval'' mono_inv_plus'[simplified less_eq_prod_def] fst_conv snd_conv)
done
-lemma mono_bconstrain: "S1 \<le> S2 \<Longrightarrow> bconstrain b bv S1 \<le> bconstrain b bv S2"
+lemma mono_inv_bval'': "S1 \<le> S2 \<Longrightarrow> inv_bval'' b bv S1 \<le> inv_bval'' b bv S2"
apply(induction b arbitrary: bv S1 S2)
apply(simp)
apply(simp)
apply simp
apply(metis order_trans[OF _ sup_ge1] order_trans[OF _ sup_ge2])
apply (simp split: prod.splits)
-apply(metis mono_aval'' mono_aconstrain mono_constrain_less'[simplified less_eq_prod_def] fst_conv snd_conv)
+apply(metis mono_aval'' mono_inv_aval'' mono_inv_less'[simplified less_eq_prod_def] fst_conv snd_conv)
done
theorem mono_step': "S1 \<le> S2 \<Longrightarrow> C1 \<le> C2 \<Longrightarrow> step' S1 C1 \<le> step' S2 C2"
unfolding step'_def
-by(rule mono2_Step) (auto simp: mono_aval' mono_bconstrain split: option.split)
+by(rule mono2_Step) (auto simp: mono_aval' mono_inv_bval'' split: option.split)
lemma mono_step'_top: "C1 \<le> C2 \<Longrightarrow> step' \<top> C1 \<le> step' \<top> C2"
by (metis mono_step' order_refl)
--- a/src/HOL/IMP/Abs_Int2_ivl.thy Mon May 13 22:49:00 2013 +0200
+++ b/src/HOL/IMP/Abs_Int2_ivl.thy Tue May 14 06:54:31 2013 +0200
@@ -265,8 +265,8 @@
end
-definition constrain_plus_ivl :: "ivl \<Rightarrow> ivl \<Rightarrow> ivl \<Rightarrow> ivl*ivl" where
-"constrain_plus_ivl iv iv1 iv2 = (iv1 \<sqinter> (iv - iv2), iv2 \<sqinter> (iv - iv1))"
+definition inv_plus_ivl :: "ivl \<Rightarrow> ivl \<Rightarrow> ivl \<Rightarrow> ivl*ivl" where
+"inv_plus_ivl iv iv1 iv2 = (iv1 \<sqinter> (iv - iv2), iv2 \<sqinter> (iv - iv1))"
definition above_rep :: "eint2 \<Rightarrow> eint2" where
"above_rep p = (if is_empty_rep p then empty_rep else let (l,h) = p in (l,\<infinity>))"
@@ -290,8 +290,8 @@
(auto simp add: below_rep_def \<gamma>_rep_cases is_empty_rep_def
split: extended.splits)
-definition constrain_less_ivl :: "bool \<Rightarrow> ivl \<Rightarrow> ivl \<Rightarrow> ivl * ivl" where
-"constrain_less_ivl res iv1 iv2 =
+definition inv_less_ivl :: "bool \<Rightarrow> ivl \<Rightarrow> ivl \<Rightarrow> ivl * ivl" where
+"inv_less_ivl res iv1 iv2 =
(if res
then (iv1 \<sqinter> (below iv2 - [Fin 1,Fin 1]),
iv2 \<sqinter> (above iv1 + [Fin 1,Fin 1]))
@@ -339,18 +339,18 @@
interpretation Val_abs1
where \<gamma> = \<gamma>_ivl and num' = num_ivl and plus' = "op +"
and test_num' = in_ivl
-and constrain_plus' = constrain_plus_ivl and constrain_less' = constrain_less_ivl
+and inv_plus' = inv_plus_ivl and inv_less' = inv_less_ivl
proof
case goal1 thus ?case by transfer (auto simp: \<gamma>_rep_def)
next
case goal2 thus ?case
- unfolding constrain_plus_ivl_def minus_ivl_def
+ unfolding inv_plus_ivl_def minus_ivl_def
apply(clarsimp simp add: \<gamma>_inf)
using gamma_plus'[of "i1+i2" _ "-i1"] gamma_plus'[of "i1+i2" _ "-i2"]
by(simp add: \<gamma>_uminus)
next
case goal3 thus ?case
- unfolding constrain_less_ivl_def minus_ivl_def
+ unfolding inv_less_ivl_def minus_ivl_def
apply(clarsimp simp add: \<gamma>_inf split: if_splits)
using gamma_plus'[of "i1+1" _ "-1"] gamma_plus'[of "i2 - 1" _ "1"]
apply(simp add: \<gamma>_belowI[of i2] \<gamma>_aboveI[of i1]
@@ -362,9 +362,9 @@
interpretation Abs_Int1
where \<gamma> = \<gamma>_ivl and num' = num_ivl and plus' = "op +"
and test_num' = in_ivl
-and constrain_plus' = constrain_plus_ivl and constrain_less' = constrain_less_ivl
-defines aconstrain_ivl is aconstrain
-and bconstrain_ivl is bconstrain
+and inv_plus' = inv_plus_ivl and inv_less' = inv_less_ivl
+defines inv_aval_ivl is inv_aval''
+and inv_bval_ivl is inv_bval''
and step_ivl is step'
and AI_ivl is AI
and aval_ivl' is aval''
@@ -396,16 +396,16 @@
interpretation Abs_Int1_mono
where \<gamma> = \<gamma>_ivl and num' = num_ivl and plus' = "op +"
and test_num' = in_ivl
-and constrain_plus' = constrain_plus_ivl and constrain_less' = constrain_less_ivl
+and inv_plus' = inv_plus_ivl and inv_less' = inv_less_ivl
proof
case goal1 thus ?case by (rule mono_plus_ivl)
next
case goal2 thus ?case
- unfolding constrain_plus_ivl_def minus_ivl_def less_eq_prod_def
+ unfolding inv_plus_ivl_def minus_ivl_def less_eq_prod_def
by (auto simp: le_infI1 le_infI2 mono_plus_ivl mono_minus_ivl)
next
case goal3 thus ?case
- unfolding less_eq_prod_def constrain_less_ivl_def minus_ivl_def
+ unfolding less_eq_prod_def inv_less_ivl_def minus_ivl_def
by (auto simp: le_infI1 le_infI2 mono_plus_ivl mono_above mono_below)
qed
--- a/src/HOL/IMP/Abs_Int3.thy Mon May 13 22:49:00 2013 +0200
+++ b/src/HOL/IMP/Abs_Int3.thy Tue May 14 06:54:31 2013 +0200
@@ -254,7 +254,7 @@
definition AI_wn :: "com \<Rightarrow> 'av st option acom option" where
"AI_wn c = pfp_wn (step' \<top>) (bot c)"
-lemma AI_wn_sound: "AI_wn c = Some C \<Longrightarrow> CS c \<le> \<gamma>\<^isub>c C"
+lemma AI_wn_correct: "AI_wn c = Some C \<Longrightarrow> CS c \<le> \<gamma>\<^isub>c C"
proof(simp add: CS_def AI_wn_def)
assume 1: "pfp_wn (step' \<top>) (bot c) = Some C"
have 2: "strip C = c \<and> step' \<top> C \<le> C"
@@ -277,7 +277,7 @@
interpretation Abs_Int2
where \<gamma> = \<gamma>_ivl and num' = num_ivl and plus' = "op +"
and test_num' = in_ivl
-and constrain_plus' = constrain_plus_ivl and constrain_less' = constrain_less_ivl
+and inv_plus' = inv_plus_ivl and inv_less' = inv_less_ivl
defines AI_wn_ivl is AI_wn
..
@@ -557,7 +557,7 @@
interpretation Abs_Int2_measure
where \<gamma> = \<gamma>_ivl and num' = num_ivl and plus' = "op +"
and test_num' = in_ivl
-and constrain_plus' = constrain_plus_ivl and constrain_less' = constrain_less_ivl
+and inv_plus' = inv_plus_ivl and inv_less' = inv_less_ivl
and m = m_ivl and n = n_ivl and h = 3
proof
case goal2 thus ?case by(rule m_ivl_anti_mono)