instance proof (standard, goal_cases) case 1 show ?caseby (rule less_ivl_def) next case 2 show ?caseby transfer (simp add: le_rep_def split: prod.splits) next case 3 thus ?caseby transfer (auto simp: le_rep_def split: if_splits) next case 4 thus ?caseby transfer (auto simp: le_rep_def eq_ivl_iff split: if_splits) next case 5 thus ?caseby transfer (auto simp add: le_rep_def sup_rep_def is_empty_min_max) next case 6 thus ?caseby transfer (auto simp add: le_rep_def sup_rep_def is_empty_min_max) next case 7 thus ?caseby transfer (auto simp add: le_rep_def sup_rep_def) next case 8 show ?caseby transfer (simp add: le_rep_def is_empty_rep_def) qed
end
text‹Implement (naive) executable equality:› instantiation ivl :: equal begin
lemma γ_inf: "\_ivl (iv1 \ iv2) = \_ivl iv1 \ \_ivl iv2" by transfer (rule γ_inf_rep)
definition"\ = empty_ivl"
instance proof (standard, goal_cases) case 1 thus ?caseby (simp add: γ_inf le_ivl_iff_subset) next case 2 thus ?caseby (simp add: γ_inf le_ivl_iff_subset) next case 3 thus ?caseby (simp add: γ_inf le_ivl_iff_subset) next case 4 show ?case unfolding bot_ivl_def by transfer (auto simp: le_iff_subset) qed
end
lemma eq_ivl_empty: "eq_ivl p empty_rep = is_empty_rep p" by (metis eq_ivl_iff is_empty_empty_rep)
lemma uminus_eq_Minf[simp]: "-x = Minf \ x = Pinf" by(cases x) auto lemma uminus_eq_Pinf[simp]: "-x = Pinf \ x = Minf" by(cases x) auto
lemma uminus_le_Fin_iff: "- x \ Fin(-y) \ Fin y \ (x::'a::ordered_ab_group_add extended)" by(cases x) auto lemma Fin_uminus_le_iff: "Fin(-y) \ -x \ x \ ((Fin y)::'a::ordered_ab_group_add extended)" by(cases x) auto
instantiation ivl :: uminus begin
definition uminus_rep :: "eint2 \ eint2"where "uminus_rep p = (let (l,h) = p in (-h, -l))"
lemma γ_uminus_rep: "i \ \_rep p \ -i \ \_rep(uminus_rep p)" by(auto simp: uminus_rep_def γ_rep_def image_def uminus_le_Fin_iff Fin_uminus_le_iff
split: prod.split)
lemma γ_aboveI: "i \ \_ivl iv \ i \ j \ j \ \_ivl(above iv)" by transfer
(auto simp add: above_rep_def γ_rep_cases is_empty_rep_def
split: extended.splits)
lemma γ_belowI: "i \ \_ivl iv \ j \ i \ j \ \_ivl(below iv)" by transfer
(auto simp add: below_rep_def γ_rep_cases is_empty_rep_def
split: extended.splits)
global_interpretation Val_semilattice where γ = γ_ivl and num' = num_ivl and plus' = "(+)" proof (standard, goal_cases) case 1 thus ?caseby transfer (simp add: le_iff_subset) next case 2 show ?caseby transfer (simp add: γ_rep_def) next case 3 show ?caseby transfer (simp add: γ_rep_def) next case 4 thus ?case apply transfer apply(auto simp: γ_rep_def plus_rep_def add_mono_le_Fin add_mono_Fin_le) by(auto simp: empty_rep_def is_empty_rep_def) qed
global_interpretation Val_lattice_gamma where γ = γ_ivl and num' = num_ivl and plus' = "(+)" defines aval_ivl = aval' proof (standard, goal_cases) case 1 show ?caseby(simp add: γ_inf) next case 2 show ?caseunfolding bot_ivl_def by transfer simp qed
global_interpretation Val_inv where γ = γ_ivl and num' = num_ivl and plus' = "(+)" and test_num' = in_ivl and inv_plus' = inv_plus_ivl and inv_less' = inv_less_ivl proof (standard, goal_cases) case 1 thus ?caseby transfer (auto simp: γ_rep_def) next case (2 _ _ _ _ _ i1 i2) thus ?case unfolding inv_plus_ivl_def minus_ivl_def apply(clarsimp simp add: γ_inf) using gamma_plus'[of "i1+i2" _ "-i1"] gamma_plus'[of "i1+i2" _ "-i2"] by(simp add: γ_uminus) next case (3 i1 i2) thus ?case unfolding inv_less_ivl_def minus_ivl_def one_extended_def apply(clarsimp simp add: γ_inf split: if_splits) using gamma_plus'[of "i1+1" _ "-1"] gamma_plus'[of "i2 - 1" _ "1"] apply(simp add: γ_belowI[of i2] γ_aboveI[of i1]
uminus_ivl.abs_eq uminus_rep_def γ_ivl_nice) apply(simp add: γ_aboveI[of i2] γ_belowI[of i1]) done qed
global_interpretation Abs_Int_inv where γ = γ_ivl and num' = num_ivl and plus' = "(+)" and test_num' = in_ivl and inv_plus' = inv_plus_ivl and inv_less' = inv_less_ivl defines inv_aval_ivl = inv_aval' and inv_bval_ivl = inv_bval' and step_ivl = step' and AI_ivl = AI and aval_ivl' = aval''
..
global_interpretation Abs_Int_inv_mono where γ = γ_ivl and num' = num_ivl and plus' = "(+)" and test_num' = in_ivl and inv_plus' = inv_plus_ivl and inv_less' = inv_less_ivl proof (standard, goal_cases) case 1 thus ?caseby (rule mono_plus_ivl) next case 2 thus ?case 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 3 thus ?case 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
text‹Takes as many iterations as the actual execution. Would diverge if
loop did not terminate. Worse still, as the following example shows: even if
the actual execution terminates, the analysis may not. The value of y keeps
increasing as the analysis is iterated, no matter how long:›
value"show_acom (steps test4_ivl 50)"
text‹Relationships between variables are NOT captured:› value"show_acom_opt (AI_ivl test5_ivl)"
text‹Again, the analysis would not terminate:› value"show_acom (steps test6_ivl 50)"
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.