inductive valid_intv :: "nat ==> intv ==> bool" where "0 ≤ d ==> d ≤ c ==> valid_intv c (Const d)" | "0 ≤ d ==> d < c ==> valid_intv c (Intv d)" | "valid_intv c (Greater c)"
inductive intv_elem :: "'c ==> ('c,t) cval ==> intv ==> bool" where "u x = d ==> intv_elem x u (Const d)" | "d < u x ==> u x < d + 1 ==> intv_elem x u (Intv d)" | "c < u x ==> intv_elem x u (Greater c)"
abbreviation"total_preorder r ≡ refl r ∧ trans r"
inductive valid_region :: "'c set ==> ('c ==> nat) ==> ('c ==> intv) ==> 'c rel ==> bool" where "[X0 = {x ∈ X. ∃ d. I x = Intv d}; r ⊆ X0× X0; refl_on X0 r; trans r; total_on X0 r; ∀ x ∈ X. valid_intv (k x) (I x)] ==> valid_region X k I r"
inductive_set region for X I r where "∀ x ∈ X. u x ≥ 0 ==>∀ x ∈ X. intv_elem x u (I x) ==> X0 = {x ∈ X. ∃ d. I x = Intv d} ==> ∀ x ∈ X0. ∀ y ∈ X0. (x, y) ∈ r ⟷ frac (u x) ≤ frac (u y) ==> u ∈ region X I r"
text‹Defining the unique element of a partition that contains a valuation›
definition part (‹[_]_› [61,61] 61) where"part v R≡ THE R. R ∈R∧ v ∈ R"
inductive_set Succ forR R where "u ∈ R ==> R ∈R==> R' ∈R==> t ≥ 0 ==> R' = [u ⊕ t]\<R> ==> R' ∈ Succ R R"
text‹
First we need to show that the set of regions is a partition of the set of all clock
assignments. This property is only claimed by P. Bouyer. ›
inductive_cases[elim!]: "intv_elem x u (Const d)" inductive_cases[elim!]: "intv_elem x u (Intv d)" inductive_cases[elim!]: "intv_elem x u (Greater d)" inductive_cases[elim!]: "valid_intv c (Greater d)" inductive_cases[elim!]: "valid_intv c (Const d)" inductive_cases[elim!]: "valid_intv c (Intv d)"
text‹First we show that all valid intervals are distinct.›
lemma valid_intv_distinct: "valid_intv c I ==> valid_intv c I' ==> intv_elem x u I ==> intv_elem x u I' ==> I = I'" by (cases I; cases I'; auto)
text‹From this we show that all valid regions are distinct.›
lemma valid_regions_distinct: "valid_region X k I r ==> valid_region X k I' r' ==> v ∈ region X I r ==> v ∈ region X I' r' ==> region X I r = region X I' r'" proof goal_cases case A: 1
{ fix x assume x: "x ∈ X" with A(1) have"valid_intv (k x) (I x)"by auto moreoverfrom A(2) x have"valid_intv (k x) (I' x)"by auto moreoverfrom A(3) x have"intv_elem x v (I x)"by auto moreoverfrom A(4) x have"intv_elem x v (I' x)"by auto ultimatelyhave"I x = I' x"using valid_intv_distinct by fastforce
} note * = this from A show ?thesis proof (safe, goal_cases) case A: (1 u) have"intv_elem x u (I' x)"if"x ∈ X"for x using A(5) * that by auto thenhave B: "∀ x ∈ X. intv_elem x u (I' x)"by auto let ?X0 = "{x ∈ X. ∃ d. I' x = Intv d}"
{ fix x y assume x: "x ∈ ?X0"and y: "y ∈ ?X0" have"(x, y) ∈ r' ⟷ frac (u x) ≤ frac (u y)" proof assume"frac (u x) ≤ frac (u y)" with A(5) x y * have"(x,y) ∈ r"by auto with A(3) x y * have"frac (v x) ≤ frac (v y)"by auto with A(4) x y show"(x,y) ∈ r'"by auto next assume"(x,y) ∈ r'" with A(4) x y have"frac (v x) ≤ frac (v y)"by auto with A(3) x y * have"(x,y) ∈ r"by auto with A(5) x y * show"frac (u x) ≤ frac (u y)"by auto qed
} thenhave *: "∀ x ∈ ?X0. ∀ y ∈ ?X0. (x, y) ∈ r' ⟷ frac (u x) ≤ frac (u y)"by auto from A(5) have"∀x∈X. 0 ≤ u x"by auto from region.intros[OF this B _ *] show ?caseby auto next case A: (2 u) have"intv_elem x u (I x)"if"x ∈ X"for x using * A(5) that by auto thenhave B: "∀ x ∈ X. intv_elem x u (I x)"by auto let ?X0 = "{x ∈ X. ∃ d. I x = Intv d}"
{ fix x y assume x: "x ∈ ?X0"and y: "y ∈ ?X0" have"(x, y) ∈ r ⟷ frac (u x) ≤ frac (u y)" proof assume"frac (u x) ≤ frac (u y)" with A(5) x y * have"(x,y) ∈ r'"by auto with A(4) x y * have"frac (v x) ≤ frac (v y)"by auto with A(3) x y show"(x,y) ∈ r"by auto next assume"(x,y) ∈ r" with A(3) x y have"frac (v x) ≤ frac (v y)"by auto with A(4) x y * have"(x,y) ∈ r'"by auto with A(5) x y * show"frac (u x) ≤ frac (u y)"by auto qed
} thenhave *:"∀ x ∈ ?X0. ∀ y ∈ ?X0. (x, y) ∈ r ⟷ frac (u x) ≤ frac (u y)"by auto from A(5) have"∀x∈X. 0 ≤ u x"by auto from region.intros[OF this B _ *] show ?caseby auto qed qed
lemmaR_regions_distinct: "[R = {region X I r | I r. valid_region X k I r}; R ∈R; v ∈ R; R' ∈R; R ≠ R']==> v ∉ R'" using valid_regions_distinct by blast
text‹
Secondly, we also need to show that every valuations belongs to a region which is part of
the partition. ›
definition intv_of :: "nat ==> t ==> intv"where "intv_of k c ≡ if (c > k) then Greater k else if (∃ x :: nat. x = c) then (Const (nat (floor c))) else (Intv (nat (floor c)))"
lemma region_cover: "∀ x ∈ X. u x ≥ 0 ==>∃ R. R ∈ {region X I r | I r. valid_region X k I r} ∧ u ∈R" proof (standard, standard) assume assm: "∀ x ∈ X. 0 ≤ u x" let ?I = "λ x. intv_of (k x) (u x)" let ?X0 = "{x ∈ X. ∃ d. ?I x = Intv d}" let ?r = "{(x,y). x ∈ ?X0∧ y ∈ ?X0∧ frac (u x) ≤ frac (u y)}" show"u ∈ region X ?I ?r" proof (standard, auto simp: assm, goal_cases) case (1 x) thus ?caseunfolding intv_of_def proof (auto, goal_cases) case A: (1 a) from A(2) have"⌊u x⌋ = u x"by (metis of_int_floor_cancel of_int_of_nat_eq) with assm A(1) have"u x = real (nat ⌊u x⌋)"by auto thenshow ?caseby auto next case A: 2 from A(1,2) have"real (nat ⌊u x⌋) < u x" by (metis assm floor_less_iff int_nat_eq less_eq_real_def less_irrefl not_less
of_int_of_nat_eq of_nat_0) moreoverfrom assm have"u x < real (nat (⌊u x⌋) + 1)"by linarith ultimatelyshow ?caseby auto qed qed have"valid_intv (k x) (intv_of (k x) (u x))"if"x ∈ X"for x using that proof (auto simp: intv_of_def, goal_cases) case1thenshow ?caseby (intro valid_intv.intros(1)) (auto, linarith) next case2 thenshow ?caseusing assm floor_less_iff nat_less_iff by (intro valid_intv.intros(2)) fastforce+ qed thenhave"valid_region X k ?I ?r" by (intro valid_region.intros) (auto simp: refl_on_def trans_def total_on_def) thenshow"region X ?I ?r ∈ {region X I r | I r. valid_region X k I r}"by auto qed
lemma intv_not_empty: obtains d where"intv_elem x (v(x := d)) (I x)" proof (cases "I x", goal_cases) case (1 d) thenhave"intv_elem x (v(x := d)) (I x)"by auto with1show ?caseby auto next case (2 d) thenhave"intv_elem x (v(x := d + 0.5)) (I x)"by auto with2show ?caseby auto next case (3 d) thenhave"intv_elem x (v(x := d + 0.5)) (I x)"by auto with3show ?caseby auto qed
fun get_intv_val :: "intv ==> real ==> real" where "get_intv_val (Const d) _ = d" | "get_intv_val (Intv d) f = d + f" | "get_intv_val (Greater d) _ = d + 1"
lemma region_not_empty: assumes"finite X""valid_region X k I r" shows"∃ u. u ∈ region X I r" proof - let ?X0 = "{x ∈ X. ∃d. I x = Intv d}" obtain f :: "'a ==> nat"where f: "∀x∈?X0. ∀y∈?X0. f x ≤ f y ⟷ (x, y) ∈ r" apply (rule finite_total_preorder_enumeration) apply (subgoal_tac "finite ?X0") apply assumption using assms by auto let ?M = "if ?X0≠ {} then Max {f x | x. x ∈ ?X0} else 1" let ?f = "λ x. (f x + 1) / (?M + 2)" let ?v = "λ x. get_intv_val (I x) (if x ∈ ?X0 then ?f x else 1)" have frac_intv: "∀x∈?X0. 0 < ?f x ∧ ?f x < 1" proof (standard, goal_cases) case (1 x) thenhave *: "?X0≠ {}"by auto have"f x ≤ Max {f x | x. x ∈ ?X0}"apply (rule Max_ge) using‹finite X›1by auto with1show ?caseby auto qed with region_not_empty_aux have *: "∀x∈?X0. ∀y∈?X0. frac (?v x) ≤ frac (?v y) ⟷ ?f x ≤ ?f y" by force have"∀x∈?X0. ∀y∈?X0. ?f x ≤ ?f y ⟷ f x ≤ f y"by (simp add: divide_le_cancel)+ with f have"∀x∈?X0. ∀y∈?X0. ?f x ≤ ?f y ⟷ (x, y) ∈ r"by auto with * have frac_order: "∀x∈?X0. ∀y∈?X0. frac (?v x) ≤ frac (?v y) ⟷ (x, y) ∈ r"by auto have"?v ∈ region X I r" proof standard show"∀x∈X. intv_elem x ?v (I x)" proof (standard, case_tac "I x", goal_cases) case (2 x d) thenhave *: "x ∈ ?X0"by auto with frac_intv have"0 < ?f x""?f x < 1"by auto moreoverfrom2have"?v x = d + ?f x"by auto ultimatelyhave"?v x < d + 1 ∧ d < ?v x"by linarith thenshow"intv_elem x ?v (I x)"by (subst 2(2)) (intro intv_elem.intros(2), auto) qed auto next show"∀x∈X. 0 ≤ get_intv_val (I x) (if x ∈ ?X0 then ?f x else 1)" by (standard, case_tac "I x") auto next show"{x ∈ X. ∃d. I x = Intv d} = {x ∈ X. ∃d. I x = Intv d}" .. next from frac_order show"∀x∈?X0. ∀y∈?X0. ((x, y) ∈ r) = (frac (?v x) ≤ frac (?v y))"byblast qed thenshow ?thesis by auto qed
text‹
Now we can show that there is always exactly one region a valid valuation belongs to. ›
lemma regions_partition: "R = {region X I r | I r. valid_region X k I r} ==>∀x ∈ X. 0 ≤ u x ==>∃! R ∈R. u ∈ R" proof (goal_cases) case1 note A = this with region_cover[OF A(2)] obtain R where R: "R ∈R∧ u ∈ R"by fastforce moreoverhave"R' = R"if"R' ∈R∧ u ∈ R'"for R' using that R valid_regions_distinct unfolding A(1) by blast ultimatelyshow ?thesis by auto qed
lemma region_unique: "R = {region X I r | I r. valid_region X k I r} ==> u ∈ R ==> R ∈R==> [u]\<R> = R" proof (goal_cases) case1 note A = this from A obtain I r where *: "valid_region X k I r""R = region X I r""u ∈ region X I r"byauto from this(3) have"∀x∈X. 0 ≤ u x"by auto from theI'[OF regions_partition[OF A(1) this]] A(1) obtain I' r' where
v: "valid_region X k I' r'""[u]\<R> = region X I' r'""u ∈ region X I' r'" unfolding part_def by auto from valid_regions_distinct[OF *(1) v(1) *(3) v(3)] v(2) *(2) show ?caseby auto qed
lemma regions_partition': "R = {region X I r | I r. valid_region X k I r} ==>∀x∈X. 0 ≤ v x ==>∀x∈X. 0 ≤v' x ==> v' ∈ [v]\<R> ==> [v']\<R> = [v]\<R>" proof (goal_cases) case1 note A = this from theI'[OF regions_partition[OF A(1,2)]] A(1,4) obtain I r where
v: "valid_region X k I r""[v]\<R> = region X I r""v' ∈ region X I r" unfolding part_def by auto from theI'[OF regions_partition[OF A(1,3)]] A(1) obtain I' r' where
v': "valid_region X k I' r'""[v']\<R> = region X I' r'""v' ∈ region X I' r'" unfolding part_def by auto from valid_regions_distinct[OF v'(1) v(1) v'(3) v(3)] v(2) v'(2) show ?caseby simp qed
lemma regions_closed: "R = {region X I r | I r. valid_region X k I r} ==> R ∈R==> v ∈ R ==> t ≥ 0 ==> [v ⊕ t]\<R> ∈R" proof goal_cases case A: 1 thenobtain I r where"v ∈ region X I r"by auto from this(1) have"∀ x ∈ X. v x ≥ 0"by auto with A(4) have"∀ x ∈ X. (v ⊕ t) x ≥ 0"unfolding cval_add_def by simp from regions_partition[OF A(1) this] obtain R' where"R' ∈R""(v ⊕ t) ∈ R'"by auto with region_unique[OF A(1) this(2,1)] show ?caseby auto qed
lemma regions_closed': "R = {region X I r | I r. valid_region X k I r} ==> R ∈R==> v ∈ R ==> t ≥ 0 ==> (v ⊕ t) ∈ [v ⊕ t]\<R>" proof goal_cases case A: 1 thenobtain I r where"v ∈ region X I r"by auto from this(1) have"∀ x ∈ X. v x ≥ 0"by auto with A(4) have"∀ x ∈ X. (v ⊕ t) x ≥ 0"unfolding cval_add_def by simp from regions_partition[OF A(1) this] obtain R' where"R' ∈R""(v ⊕ t) ∈ R'"by auto with region_unique[OF A(1) this(2,1)] show ?caseby auto qed
lemma valid_regions_I_cong: "valid_region X k I r ==>∀ x ∈ X. I x = I' x ==> region X I r = region X I' r ∧ valid_region X k I' r" proof (safe, goal_cases) case (1 v) note A = this thenhave [simp]:"∧ x. x ∈ X ==> I' x = I x"by metis show ?case proof (standard, goal_cases) case1 from A(3) show ?caseby auto next case2 from A(3) show ?caseby auto next case3 show"{x ∈ X. ∃d. I x = Intv d} = {x ∈ X. ∃d. I' x = Intv d}"by auto next case4 let ?X0 = "{x ∈ X. ∃d. I x = Intv d}" from A(3) show"∀ x ∈ ?X0. ∀ y ∈ ?X0. ((x, y) ∈ r) = (frac (v x) ≤ frac (v y))"by auto qed next case (2 v) note A = this thenhave [simp]:"∧ x. x ∈ X ==> I' x = I x"by metis show ?case proof (standard, goal_cases) case1 from A(3) show ?caseby auto next case2 from A(3) show ?caseby auto next case3 show"{x ∈ X. ∃d. I' x = Intv d} = {x ∈ X. ∃d. I x = Intv d}"by auto next case4 let ?X0 = "{x ∈ X. ∃d. I' x = Intv d}" from A(3) show"∀ x ∈ ?X0. ∀ y ∈ ?X0. ((x, y) ∈ r) = (frac (v x) ≤ frac (v y))"by auto qed next case3 note A = this thenhave [simp]:"∧ x. x ∈ X ==> I' x = I x"by metis show ?case apply rule apply (subgoal_tac "{x ∈ X. ∃d. I x = Intv d} = {x ∈ X. ∃d. I' x = Intv d}") apply assumption using A by auto qed
lemma finite_R: notes [[simproc add: finite_Collect]] finite_subset[intro] fixes X k defines"R≡ {region X I r | I r. valid_region X k I r}" assumes"finite X" shows"finite R" proof -
{ fix I r assume A: "valid_region X k I r" let ?X0 = "{x ∈ X. ∃d. I x = Intv d}" from A have"r ⊆ X × X"by auto thenhave"r ∈ Pow (X × X)"by auto
} thenhave"{r. ∃I. valid_region X k I r} ⊆ Pow (X × X)"by auto with‹finite X›have fin: "finite {r. ∃I. valid_region X k I r}"by auto let ?m = "Max {k x | x. x ∈ X}" let ?I = "{intv. intv_const intv ≤ ?m}" let ?fin_map = "λ I. ∀x. (x ∈ X ⟶ I x ∈ ?I) ∧ (x ∉ X ⟶ I x = Const 0)" let ?R = "{region X I r | I r. valid_region X k I r ∧ ?fin_map I}" have"?I = (Const ` {d. d ≤ ?m}) ∪ (Intv ` {d. d ≤ ?m}) ∪ (Greater ` {d. d ≤ ?m})" by auto (case_tac x, auto) thenhave"finite ?I"by auto from finite_set_of_finite_funs[OF ‹finite X› this] have"finite {I. ?fin_map I}" . with fin have"finite {(I, r). valid_region X k I r ∧ ?fin_map I}" by (fastforce intro: pairwise_finiteI finite_ex_and1 frac_add_le_preservation del: finite_subset) thenhave"finite ?R"by fastforce moreoverhave"R⊆ ?R" proof fix R assume R: "R ∈R" thenobtain I r where I: "R = region X I r""valid_region X k I r"unfoldingR_defby auto let ?I = "λ x. if x ∈ X then I x else Const 0" let ?R = "region X ?I r" from valid_regions_I_cong[OF I(2)] I have"R = ?R""valid_region X k ?I r"by auto moreoverhave"∀x. x ∉ X ⟶ ?I x = Const 0"by auto moreoverhave"∀x. x ∈ X ⟶ intv_const (I x) ≤ ?m" proof auto fix x assume x: "x ∈ X" with I(2) have"valid_intv (k x) (I x)"by auto moreoverfrom‹finite X› x have"k x ≤ ?m"by (auto intro: Max_ge) ultimatelyshow"intv_const (I x) ≤ Max {k x |x. x ∈ X}"by (cases "I x") auto qed ultimatelyshow"R ∈ ?R"by force qed ultimatelyshow"finite R"by blast qed
lemma SuccI2: "R = {region X I r | I r. valid_region X k I r} ==> v ∈ R ==> R ∈R==> t ≥ 0 ==> R' = [v ⊕ t]\<R> ==> R' ∈ Succ R R" proof goal_cases case A: 1 from Succ.intros[OF A(2) A(3) regions_closed[OF A(1,3,2,4)] A(4)] A(5) show ?caseby auto qed
section‹Set of Regions›
text‹
The first property Bouyer shows is that these regions form a 'set of regions'. ›
text‹
For the unbounded region in the upper right corner, the set of successors only
contains itself. ›
lemma Succ_refl: "R = {region X I r |I r. valid_region X k I r} ==> finite X ==> R ∈R==> R ∈ Succ R R" proof goal_cases case A: 1 thenobtain I r where R: "valid_region X k I r""R = region X I r"by auto with A region_not_empty obtain v where v: "v ∈ region X I r"by metis with R have *: "(v ⊕ 0) ∈ R"unfolding cval_add_def by auto from regions_closed'[OF A(1,3-)] v R have"(v ⊕ 0) ∈ [v ⊕ 0]\<R>"by auto from region_unique[OF A(1) * A(3)] A(3) v[unfolded R(2)[symmetric]] show ?caseby auto qed
lemma Succ_refl': "R = {region X I r |I r. valid_region X k I r} ==> finite X ==>∀ x ∈ X. ∃ c. I x = Greater c ==> region X I r ∈R==> Succ R (region X I r) = {region X I r}" proof goal_cases case A: 1 have *: "(v ⊕ t) ∈ region X I r"if v: "v ∈ region X I r"and t: "t ≥ 0"for v and t :: t proof ((rule region.intros), auto, goal_cases) case1 with v t show ?caseunfolding cval_add_def by auto next case (2 x) with A obtain c where c: "I x = Greater c"by auto with v 2have"v x > c"by fastforce with t have"v x + t > c"by auto thenhave"(v ⊕ t) x > c"by (simp add: cval_add_def) from intv_elem.intros(3)[of c "v ⊕ t", OF this] c show ?caseby auto next case (3 x) from this(1) A obtain c where"I x = Greater c"by auto with3(2) show ?caseby auto next case (4 x) from this(1) A obtain c where"I x = Greater c"by auto with4(2) show ?caseby auto qed show ?case proof (standard, standard) fix R assume R: "R ∈ Succ R (region X I r)" thenobtain v t where v: "v ∈ region X I r""R = [v ⊕ t]\<R>""R ∈R""t ≥ 0" by (cases rule: Succ.cases) auto from v(1) have **: "∀x ∈ X. 0 ≤ v x"by auto with v(4) have"∀x ∈ X. 0 ≤ (v ⊕ t) x"unfolding cval_add_def by auto from *[OF v(1,4)] regions_partition'[OF A(1) ** this] region_unique[OF A(1) v(1) A(4)] v(2) show"R ∈ {region X I r}"by auto next from A(4) obtain I' r' where R': "region X I r = region X I' r'""valid_region X k I' r'" unfolding A(1) by auto with region_not_empty[OF A(2) this(2)] obtain v where v: "v ∈ region X I r"by auto from region_unique[OF A(1) this A(4)] have *: "[v ⊕ 0]\<R> = region X I r" unfolding cval_add_def by auto with v A(4) have"[v ⊕ 0]\<R> ∈ Succ R (region X I r)"by (intro Succ.intros; auto) with * show"{region X I r} ⊆ Succ R (region X I r)"by auto qed qed
text‹
Defining the closest successor of a region. Only exists if at least one interval is upper-bounded. ›
definition "succ R R = (SOME R'. R' ∈ Succ R R ∧ (∀ u ∈ R. ∀ t ≥ 0. (u ⊕ t) ∉ R ⟶ (∃ t' ≤ t. (u ⊕ t') ∈ R' ∧ 0 ≤ t')))"
inductive isConst :: "intv ==> bool" where "isConst (Const _)"
inductive isIntv :: "intv ==> bool" where "isIntv (Intv _)"
inductive isGreater :: "intv ==> bool" where "isGreater (Greater _)"
text‹
What Bouyer states at the end. However, we have to be a bit more precise than in her statement. ›
lemma closest_prestable_1: fixes I X k r defines"R≡ {region X I r |I r. valid_region X k I r}" defines"R ≡ region X I r" defines"Z ≡ {x ∈ X . ∃ c. I x = Const c}" assumes"Z ≠ {}" defines"I'≡ λ x. if x ∉ Z then I x else if intv_const (I x) = k x then Greater (k x) else Intv (intv_const (I x))" defines"r' ≡ r ∪ {(x,y) . x ∈ Z ∧ y ∈ X ∧ intv_const (I x) < k x ∧ isIntv (I' y)}" assumes"finite X" assumes"valid_region X k I r" shows"∀ v ∈ R. ∀ t>0. ∃t'≤t. (v ⊕ t') ∈ region X I' r' ∧ t' ≥ 0" and"∀ v ∈ region X I' r'. ∀ t≥0. (v ⊕ t) ∉ R" and"∀ x ∈ X. ¬ isConst (I' x)" and"∀ v ∈ R. ∀ t < 1. ∀ t' ≥ 0. (v ⊕ t') ∈ region X I' r' ⟶ {x. x ∈ X ∧ (∃ c. I x = Intv c ∧ v x + t ≥ c + 1)} = {x. x ∈ X ∧ (∃ c. I' x = Intv c ∧ (v ⊕ t') x + (t - t') ≥ c + 1)}" proof (safe, goal_cases) fix v assume v: "v ∈ R"fix t :: t assume t: "0 < t" have elem: "intv_elem x v (I x)"if x: "x ∈ X"for x using v x unfolding R_def by auto have *: "(v ⊕ t) ∈ region X I' r'"if A: "∀ x ∈ X. ¬ isIntv (I x)"and t: "t > 0""t < 1"for t proof (standard, goal_cases) case1 from v have"∀ x ∈ X. v x ≥ 0"unfolding R_def by auto with t show ?caseunfolding cval_add_def by auto next case2 show ?case proof (standard, case_tac "I x", goal_cases) case (1 x c) with elem[OF ‹x ∈ X›] have"v x = c"by auto show ?case proof (cases "intv_const (I x) = k x", auto simp: 1 I'_def Z_def, goal_cases) case1 with‹v x = c›have"v x = k x"by auto with t show ?caseby (auto simp: cval_add_def) next case2 from assms(8) 1have"c ≤ k x"by (cases rule: valid_region.cases) auto with2have"c < k x"by linarith from t ‹v x = c›show ?caseby (auto simp: cval_add_def) qed next case (2 x c) with A show ?caseby auto next case (3 x c) thenhave"I' x = Greater c"unfolding I'_def Z_def by auto with t 3 elem[OF ‹x ∈ X›] show ?caseby (auto simp: cval_add_def) qed next case3show"{x ∈ X. ∃d. I' x = Intv d} = {x ∈ X. ∃d. I' x = Intv d}" .. next case4 let ?X0' = "{x ∈ X. ∃d. I' x = Intv d}" show"∀x∈?X0'. ∀y∈?X0'. ((x, y) ∈ r') = (frac ((v ⊕ t) x) ≤ frac ((v ⊕ t) y))" proof (safe, goal_cases) case (1 x y d d') note B = this have"x ∈ Z"apply (rule ccontr) using A B by (auto simp: I'_def) with elem[OF B(1)] have"frac (v x) = 0 "unfolding Z_def by auto with frac_distr[of t "v x"] t have *: "frac (v x + t) = t"by auto have"y ∈ Z"apply (rule ccontr) using A B by (auto simp: I'_def) with elem[OF B(3)] have"frac (v y) = 0 "unfolding Z_def by auto with frac_distr[of t "v y"] t have"frac (v y + t) = t"by auto with * show ?caseunfolding cval_add_def by auto next case B: (2 x) have"x ∈ Z"apply (rule ccontr) using A B by (auto simp: I'_def) with B have"intv_const (I x) ≠ k x"unfolding I'_defby auto with B(1) assms(8) have"intv_const (I x) < k x"by (fastforce elim!: valid_intv.cases) with B ‹x ∈ Z›show ?caseunfolding r'_defby auto qed qed let ?S = "{1 - frac (v x) | x. x ∈ X ∧ isIntv (I x)}" let ?t = "Min ?S"
{ assume A: "∃ x ∈ X. isIntv (I x)" from‹finite X›have"finite ?S"by auto from A have"?S ≠ {}"by auto from Min_in[OF ‹finite ?S› this] obtain x where
x: "x ∈ X""isIntv (I x)""?t = 1 - frac (v x)" by force have"frac (v x) < 1"by (simp add: frac_lt_1) thenhave"?t > 0"by (simp add: x(3)) thenhave"?t / 2 > 0"by auto from x(2) obtain c where"I x = Intv c"by (auto) with elem[OF x(1)] have v_x: "c < v x""v x < c + 1"by auto from nat_intv_frac_gt0[OF this] have"frac (v x) > 0" . with x(3) have"?t < 1"by auto
{ fix t :: t assume t: "0 < t""t ≤ ?t / 2"
{ fix y assume"y ∈ X""isIntv (I y)" thenhave"1 - frac (v y) ∈ ?S"by auto from Min_le[OF ‹finite ?S› this] ‹?t > 0› t have"t < 1 - frac (v y)"by linarith
} note frac_bound = this have"(v ⊕ t) ∈ region X I' r'" proof (standard, goal_cases) case1 from v have"∀ x ∈ X. v x ≥ 0"unfolding R_def by auto with‹?t > 0› t show ?caseunfolding cval_add_def by auto next case2 show ?case proof (standard, case_tac "I x", goal_cases) case A: (1 x c) with elem[OF ‹x ∈ X›] have"v x = c"by auto show ?case proof (cases "intv_const (I x) = k x", auto simp: A I'_def Z_def, goal_cases) case1 with‹v x = c›have"v x = k x"by auto with‹?t > 0› t show ?caseby (auto simp: cval_add_def) next case2 from assms(8) A have"c ≤ k x"by (cases rule: valid_region.cases) auto with2have"c < k x"by linarith from‹v x = c›‹?t < 1› t show ?case by (auto simp: cval_add_def) qed next case (2 x c) with elem[OF ‹x ∈ X›] have v: "c < v x""v x < c + 1"by auto with‹?t > 0›have"c < v x + (?t / 2)"by auto from2have"I' x = I x"unfolding I'_def Z_def by auto from frac_bound[OF 2(1)] 2(2) have"t < 1 - frac (v x)"by auto from frac_add_le_preservation[OF v(2) this] t v(1) 2show ?case unfolding cval_add_def ‹I' x = I x›by auto next case (3 x c) thenhave"I' x = Greater c"unfolding I'_def Z_def by auto with3 elem[OF ‹x ∈ X›] t show ?case by (auto simp: cval_add_def) qed next case3show"{x ∈ X. ∃d. I' x = Intv d} = {x ∈ X. ∃d. I' x = Intv d}" .. next case4 let ?X0 = "{x ∈ X. ∃d. I x = Intv d}" let ?X0' = "{x ∈ X. ∃d. I' x = Intv d}" show"∀x∈?X0'. ∀y∈?X0'. ((x, y) ∈ r') = (frac ((v ⊕ t) x) ≤ frac ((v ⊕ t) y))" proof (safe, goal_cases) case (1 x y d d') note B = this show ?case proof (cases "x ∈ Z") case False note F = this show ?thesis proof (cases "y ∈ Z") case False with F B have *: "x ∈ ?X0""y ∈ ?X0"unfolding I'_defby auto from B(5) show ?thesis unfolding r'_def proof (safe, goal_cases) case1 with v * have le: "frac (v x) <= frac (v y)"unfolding R_def by auto from frac_bound * have"t < 1 - frac (v x)""t < 1 - frac (v y)"by fastforce+ with frac_distr t have "frac (v x) + t = frac (v x + t)""frac (v y) + t = frac (v y + t)" by simp+ with le show ?caseunfolding cval_add_def by fastforce next case2 from this(1) elem have **: "frac (v x) = 0"unfolding Z_def by force from2(4) obtain c where"I' y = Intv c"by (auto ) thenhave"y ∈ Z ∨ I y = Intv c"unfolding I'_defby presburger thenshow ?case proof assume"y ∈ Z" with elem[OF 2(2)] have ***: "frac (v y) = 0"unfolding Z_def by force show ?thesis by (simp add: ** *** frac_add cval_add_def) next assume A: "I y = Intv c" have le: "frac (v x) <= frac (v y)"by (simp add: **) from frac_bound * have"t < 1 - frac (v x)""t < 1 - frac (v y)"by fastforce+ with2 t have "frac (v x) + t = frac (v x + t)""frac (v y) + t = frac (v y + t)" using F by blast+ with le show ?caseunfolding cval_add_def by fastforce qed qed next case True thenobtain d' where d': "I y = Const d'"unfolding Z_def by auto from B(5) show ?thesis unfolding r'_def proof (safe, goal_cases) case1 from d' have"y ∉ ?X0"by auto with assms(8) show ?caseusing1by auto next case2 with F show ?caseby simp qed qed next case True with elem have **: "frac (v x) = 0"unfolding Z_def by force from B(4) have"y ∈ Z ∨ I y = Intv d'"unfolding I'_defby presburger thenshow ?thesis proof assume"y ∈ Z" with elem[OF B(3)] have ***: "frac (v y) = 0"unfolding Z_def by force show ?thesis by (simp add: ** *** frac_add cval_add_def) next assume A: "I y = Intv d'" with B(3) have"y ∈ ?X0"by auto with frac_bound have"t < 1 - frac (v y)"by fastforce+ moreoverfrom ** ‹?t < 1›have"?t / 2 < 1 - frac (v x)"by linarith ultimatelyhave "frac (v x) + t = frac (v x + t)""frac (v y) + t = frac (v y + t)" using frac_distr t by simp+ moreoverhave"frac (v x) <= frac (v y)"by (simp add: **) ultimatelyshow ?thesis unfolding cval_add_def by fastforce qed qed next case B: (2 x y d d') show ?case proof (cases "x ∈ Z", goal_cases) case True with B(1,2) have"intv_const (I x) ≠ k x"unfolding I'_defby auto with B(1) assms(8) have"intv_const (I x) < k x"by (fastforce elim!: valid_intv.cases) with B True show ?thesis unfolding r'_defby auto next case (False) with B(1,2) have x_intv: "isIntv (I x)"unfolding Z_def I'_defby auto show ?thesis proof (cases "y ∈ Z") case False with B(3,4) have y_intv: "isIntv (I y)"unfolding Z_def I'_defby auto with frac_bound x_intv B(1,3) have"t < 1 - frac (v x)""t < 1 - frac (v y)"by auto from frac_add_leD[OF _ this] B(5) t have "frac (v x) ≤ frac (v y)" by (auto simp: cval_add_def) with v assms(2) B(1,3) x_intv y_intv have"(x, y) ∈ r"by (auto ) thenshow ?thesis by (simp add: r'_def) next case True from frac_bound x_intv B(1) have b: "t < 1 - frac (v x)"by auto from x_intv obtain c where"I x = Intv c"by auto with elem[OF ‹x ∈ X›] have v: "c < v x""v x < c + 1"by auto from True elem[OF ‹y ∈ X›] have *: "frac (v y) = 0"unfolding Z_def by auto with t ‹?t < 1› floor_frac_add_preservation'[of t "v y"] have "floor (v y + t) = floor (v y)" by auto thenhave"frac (v y + t) = t" by (metis * add_diff_cancel_left' diff_add_cancel diff_self frac_def) moreoverfrom nat_intv_frac_gt0[OF v] have"0 < frac (v x)" . moreoverfrom frac_distr[OF _ b] t have"frac (v x + t) = frac (v x) + t"by auto ultimatelyshow ?thesis using B(5) unfolding cval_add_def by auto qed qed qed qed
} with‹?t/2 > 0›have"0 < ?t/2 ∧ (∀ t. 0 < t ∧ t ≤ ?t/2 ⟶ (v ⊕ t) ∈ region X I' r')"by auto
} note ** = this show"∃t'≤t. (v ⊕ t') ∈ region X I' r' ∧ 0 ≤ t'" proof (cases "∃ x ∈ X. isIntv (I x)") case True note T = this show ?thesis proof (cases "t ≤ ?t/2") case True with T t ** show ?thesis by auto next case False thenhave"?t/2 ≤ t"by auto moreoverfrom T ** have"(v ⊕ ?t/2) ∈ region X I' r'""?t/2 > 0"by auto ultimatelyshow ?thesis by (fastforce del: region.cases) qed next case False note F = this show ?thesis proof (cases "t < 1") case True with F t * show ?thesis by auto next case False thenhave"0.5 ≤ t"by auto moreoverfrom F * have"(v ⊕ 0.5) ∈ region X I' r'"by auto ultimatelyshow ?thesis by (fastforce del: region.cases) qed qed next fix v t assume A: "v ∈ region X I' r'""0 ≤ t""(v ⊕ t) ∈ R" from assms(3,4) obtain x c where x: "I x = Const c""x ∈ Z""x ∈ X"by auto with A(1) have"intv_elem x v (I' x)"by auto with x have"v x > c"unfolding I'_def apply (auto elim: intv_elem.cases) apply (cases "c = k x") by auto moreoverfrom A(3) x(1,3) have"v x + t = c" by (fastforce elim!: intv_elem.cases simp: cval_add_def R_def) ultimatelyshow False using A(2) by auto next fix x c assume"x ∈ X""I' x = Const c" thenshow False apply (auto simp: I'_def Z_def) apply (cases "∀c. I x ≠ Const c") apply auto apply (rename_tac c') apply (case_tac "c' = k x") by auto next case (4 v t t' x c) note A = this thenhave"I' x = Intv c"unfolding I'_def Z_def by auto moreoverfrom A have"real (c + 1) ≤ (v ⊕ t') x + (t - t')"unfolding cval_add_def by auto ultimatelyshow ?caseby blast next case A: (5 v t t' x c) show ?case proof (cases "x ∈ Z") case False with A have"I x = Intv c"unfolding I'_defby auto with A show ?thesis unfolding cval_add_def by auto next case True with A(6) have"I x = Const c" apply (auto simp: I'_def) apply (cases "intv_const (I x) = k x") by (auto simp: Z_def) with A(1,5) R_def have"v x = c"by fastforce with A(2,7) show ?thesis by (auto simp: cval_add_def) qed qed
lemma closest_valid_1: fixes I X k r defines"R≡ {region X I r |I r. valid_region X k I r}" defines"R ≡ region X I r" defines"Z ≡ {x ∈ X . ∃ c. I x = Const c}" assumes"Z ≠ {}" defines"I'≡ λ x. if x ∉ Z then I x else if intv_const (I x) = k x then Greater (k x) else Intv (intv_const (I x))" defines"r' ≡ r ∪ {(x,y) . x ∈ Z ∧ y ∈ X ∧ intv_const (I x) < k x ∧ isIntv (I' y)}" assumes"finite X" assumes"valid_region X k I r" shows"valid_region X k I' r'" proof let ?X0 = "{x ∈ X. ∃d. I x = Intv d}" let ?X0' = "{x ∈ X. ∃d. I' x = Intv d}" let ?S = "{(x, y). x ∈ Z ∧ y ∈ X ∧ intv_const (I x) < k x ∧ isIntv (I' y)}" show"?X0' = ?X0'" .. have r_subset: "r ⊆ ?X0× ?X0"and refl: "refl_on ?X0 r"and total: "total_on ?X0 r"and
trans: "trans r"and valid: "∧ x. x ∈ X ==> valid_intv (k x) (I x)" using assms(8) by auto thenhave"r ⊆ ?X0' × ?X0'"unfolding I'_def Z_def by auto moreoverhave"?S ⊆ ?X0' × ?X0'" apply (auto) apply (auto simp: Z_def)[] apply (auto simp: I'_def)[] done ultimatelyshow"r'⊆ ?X0' × ?X0'"unfolding r'_defby auto
show"refl_on ?X0' r'"unfolding refl_on_def proof auto fix x d assume A: "x ∈ X""I' x = Intv d" show"(x, x) ∈ r'" proof (cases "x ∈ Z") case True with A have"intv_const (I x) ≠ k x"unfolding I'_defby auto with assms(8) A(1) have"intv_const (I x) < k x"by (fastforce elim!: valid_intv.cases) with True A show"(x,x) ∈ r'"by (auto simp: r'_def) next case False with A refl show"(x,x) ∈ r'"by (auto simp: I'_def refl_on_def r'_def) qed qed show"total_on ?X0' r'"unfolding total_on_def proof (standard, standard, standard) fix x y assume"x ∈ ?X0'""y ∈ ?X0'""x ≠ y" thenobtain d d' where A: "x∈X""y∈X""I' x = (Intv d)""I' y = (Intv d')""x ≠ y"by auto let ?thesis = "(x, y) ∈ r' ∨ (y, x) ∈ r'" show ?thesis proof (cases "x ∈ Z") case True with A have"intv_const (I x) ≠ k x"unfolding I'_defby auto with assms(8) A(1) have"intv_const (I x) < k x"by (fastforce elim!: valid_intv.cases) with True A show ?thesis by (auto simp: r'_def) next case F: False show ?thesis proof (cases "y ∈ Z") case True with A have"intv_const (I y) ≠ k y"unfolding I'_defby auto with assms(8) A(2) have"intv_const (I y) < k y"by (fastforce elim!: valid_intv.cases) with True A show ?thesis by (auto simp: r'_def) next case False with A F have"I x = Intv d""I y = Intv d'"by (auto simp: I'_def) with A(1,2,5) total show ?thesis unfolding total_on_def r'_defby auto qed qed qed show"trans r'"unfolding trans_def proof safe fix x y z assume A: "(x, y) ∈ r'""(y, z) ∈ r'" show"(x, z) ∈ r'" proof (cases "(x,y) ∈ r") case True thenhave"y ∉ Z"using r_subset unfolding Z_def by auto thenhave"(y, z) ∈ r"using A unfolding r'_defby auto with trans True show ?thesis unfolding trans_def r'_defby blast next case False with A(1) have F: "x ∈ Z""intv_const (I x) < k x"unfolding r'_defby auto moreoverfrom A(2) r_subset have"z ∈ X""isIntv (I' z)" by (auto simp: r'_def) (auto simp: I'_def Z_def) ultimatelyshow ?thesis unfolding r'_defby auto qed qed show"∀x∈X. valid_intv (k x) (I' x)" proof (auto simp: I'_def intro: valid, goal_cases) case (1 x) with assms(8) have"intv_const (I x) < k x"by (fastforce elim!: valid_intv.cases) thenshow ?caseby auto qed qed
lemma closest_prestable_2: fixes I X k r defines"R≡ {region X I r |I r. valid_region X k I r}" defines"R ≡ region X I r" assumes"∀ x ∈ X. ¬ isConst (I x)" defines"X0≡ {x ∈ X. isIntv (I x)}" defines"M ≡ {x ∈ X0. ∀ y ∈ X0. (x, y) ∈ r ⟶ (y, x) ∈ r}" defines"I'≡ λ x. if x ∉ M then I x else Const (intv_const (I x) + 1)" defines"r' ≡ {(x,y) ∈ r. x ∉ M ∧ y ∉ M}" assumes"finite X" assumes"valid_region X k I r" assumes"M ≠ {}" shows"∀ v ∈ R. ∀ t≥0. (v ⊕ t) ∉ R ⟶ (∃t'≤t. (v ⊕ t') ∈ region X I' r' ∧ t' ≥ 0)" and"∀ v ∈ region X I' r'. ∀ t≥0. (v ⊕ t) ∉ R" and"∀ v ∈ R. ∀ t'. {x. x ∈ X ∧ (∃ c. I' x = Intv c ∧ (v ⊕ t') x + (t - t') ≥ real (c + 1))} = {x. x ∈ X ∧ (∃ c. I x = Intv c ∧ v x + t ≥ real (c + 1))} - M" and"∃ x ∈ X. isConst (I' x)" proof (safe, goal_cases) fix v assume v: "v ∈ R"fix t :: t assume t: "t ≥ 0""(v ⊕ t) ∉ R" note M = assms(10) thenobtain x c where x: "x ∈ M""I x = Intv c""x ∈ X""x ∈ X0"unfolding M_def X0_defby force let ?t = "1 - frac (v x)" let ?v = "v ⊕ ?t" have elem: "intv_elem x v (I x)"if"x ∈ X"for x using that v unfolding R_def by auto from assms(9) have *: "trans r""total_on {x ∈ X. ∃d. I x = Intv d} r"by auto thenhave trans[intro]: "∧x y z. (x, y) ∈ r ==> (y, z) ∈ r ==> (x, z) ∈ r"unfoldingtrans_def by blast have"{x ∈ X. ∃d. I x = Intv d} = X0"unfolding X0_defby auto with *(2) have total: "total_on X0 r"by auto
{ fix y assume y: "y ∉ M""y ∈ X0" have"¬ (x, y) ∈ r"using x y unfolding M_def by auto moreoverwith total x y have"(y, x) ∈ r"unfolding total_on_def by auto ultimatelyhave"¬ (x, y) ∈ r ∧ (y, x) ∈ r" ..
} note M_max = this
{ fix y assume T1: "y ∈ M""x ≠ y" thenhave T2: "y ∈ X0"unfolding M_def by auto with total x T1 have"(x, y) ∈ r ∨ (y, x) ∈ r"by (auto simp: total_on_def) with T1(1) x(1) have"(x, y) ∈ r""(y, x) ∈ r"unfolding M_def by auto
} note M_eq = this
{ fix y assume y: "y ∉ M""y ∈ X0" with M_max have"¬ (x, y) ∈ r""(y, x) ∈ r"by auto with v[unfolded R_def] X0_def x(4) y(2) have"frac (v y) < frac (v x)"by auto thenhave"?t < 1 - frac (v y)"by auto
} note t_bound' = this
{ fix y assume y: "y ∈ X0" have"?t ≤ 1 - frac (v y)" proof (cases "x = y") case True thus ?thesis by simp next case False have"(y, x) ∈ r" proof (cases "y ∈ M") case False with M_max y show ?thesis by auto next case True with False M_eq y show ?thesis by auto qed with v[unfolded R_def] X0_def x(4) y have"frac (v y) ≤ frac (v x)"by auto thenshow"?t ≤ 1 - frac (v y)"by auto qed
} note t_bound''' = this have"frac (v x) < 1"by (simp add: frac_lt_1) thenhave"?t > 0"by (simp add: x(3))
{ fix c y fix t :: t assume y: "y ∉ M""I y = Intv c""y ∈ X"and t: "t ≥ 0""t ≤ ?t" thenhave"y ∈ X0"unfolding X0_defby auto with t_bound' y have"?t < 1 - frac (v y)"by auto with t have"t < 1 - frac (v y)"by auto moreoverfrom elem[OF ‹y ∈ X›] y have"c < v y""v y < c + 1"by auto ultimatelyhave"(v y + t) < c + 1"using frac_add_le_preservation by blast with‹c < v y› t have"intv_elem y (v ⊕ t) (I y)"by (auto simp: cval_add_def y)
} note t_bound = this from elem[OF x(3)] x(2) have v_x: "c < v x""v x < c + 1"by auto thenhave"floor (v x) = c"by linarith thenhave shift: "v x + ?t = c + 1"unfolding frac_def by auto have"v x + t ≥ c + 1" proof (rule ccontr, goal_cases) case1 thenhave AA: "v x + t < c + 1"by simp with shift have lt: "t < ?t"by auto let ?v = "v ⊕ t" have"?v ∈ region X I r" proof (standard, goal_cases) case1 from v have"∀ x ∈ X. v x ≥ 0"unfolding R_def by auto with t show ?caseunfolding cval_add_def by auto next case2 show ?case proof (safe, goal_cases) case (1 y) note A = this with elem have e: "intv_elem y v (I y)"by auto show ?case proof (cases "y ∈ M") case False thenhave [simp]: "I' y = I y"by (auto simp: I'_def) show ?thesis proof (cases "I y", goal_cases) case1with assms(3) A show ?caseby auto next case (2 c) from t_bound[OF False this A t(1)] lt show ?caseby (auto simp: cval_add_def 2) next case (3 c) with e have"v y > c"by auto with3 t(1) show ?caseby (auto simp: cval_add_def) qed next case True thenhave"y ∈ X0"by (auto simp: M_def) note T = this True show ?thesis proof (cases "x = y") case False with M_eq T have"(x, y) ∈ r""(y, x) ∈ r"by presburger+ with v[unfolded R_def] X0_def x(4) T(1) have *: "frac (v y) = frac (v x)"by auto from T(1) obtain c where c: "I y = Intv c"by (auto simp: X0_def) with elem T(1) have"c < v y""v y < c + 1"by (fastforce simp: X0_def)+ thenhave"floor (v y) = c"by linarith with * lt have"(v y + t) < c + 1"unfolding frac_def by auto with‹c < v y› t show ?thesis by (auto simp: c cval_add_def) next case True with‹c < v x› t AA x show ?thesis by (auto simp: cval_add_def) qed qed qed next show"X0 = {x ∈ X. ∃d. I x = Intv d}"by (auto simp add: X0_def) next have"t > 0" proof (rule ccontr, goal_cases) case1with t v show False unfolding cval_add_def by auto qed show"∀y∈X0. ∀z∈X0. ((y, z) ∈ r) = (frac ((v ⊕ t)y) ≤ frac ((v ⊕ t) z))" proof (auto simp: X0_def, goal_cases) case (1 y z d d') note A = this from A have [simp]: "y ∈ X0""z ∈ X0"unfolding X0_def I'_defby auto from A v[unfolded R_def] have le: "frac (v y) ≤ frac (v z)"by (auto simp: r'_def) from t_bound''' have"?t ≤ 1 - frac (v y)""?t ≤ 1 - frac (v z)"by auto with lt have"t < 1 - frac (v y)""t < 1 - frac (v z)"by auto with frac_distr[OF ‹t > 0›] have "frac (v y) + t = frac (v y + t)""frac (v z) + t = frac (v z + t)" by auto with le show ?caseby (auto simp: cval_add_def) next case (2 y z d d') note A = this from A have [simp]: "y ∈ X0""z ∈ X0"unfolding X0_defby auto from t_bound''' have"?t ≤ 1 - frac (v y)""?t ≤ 1 - frac (v z)"by auto with lt have"t < 1 - frac (v y)""t < 1 - frac (v z)"by auto from frac_add_leD[OF ‹t > 0› this] A(5) have "frac (v y) ≤ frac (v z)" by (auto simp: cval_add_def) with v[unfolded R_def] A show ?caseby auto qed qed with t R_def show False by simp qed with shift have"t ≥ ?t"by simp let ?R = "region X I' r'" let ?X0 = "{x ∈ X. ∃d. I' x = Intv d}" have"(v ⊕ ?t) ∈ ?R" proof (standard, goal_cases) case1 from v have"∀ x ∈ X. v x ≥ 0"unfolding R_def by auto with‹?t > 0› t show ?caseunfolding cval_add_def by auto next case2 show ?case proof (safe, goal_cases) case (1 y) note A = this with elem have e: "intv_elem y v (I y)"by auto show ?case proof (cases "y ∈ M") case False thenhave [simp]: "I' y = I y"by (auto simp: I'_def) show ?thesis proof (cases "I y", goal_cases) case1with assms(3) A show ?caseby auto next case (2 c) from t_bound[OF False this A] ‹?t > 0›show ?caseby (auto simp: cval_add_def 2) next case (3 c) with e have"v y > c"by auto with3‹?t > 0›show ?caseby (auto simp: cval_add_def) qed next case True thenhave"y ∈ X0"by (auto simp: M_def) note T = this True show ?thesis proof (cases "x = y") case False with M_eq T(2) have"(x, y) ∈ r""(y, x) ∈ r"by auto with v[unfolded R_def] X0_def x(4) T(1) have *: "frac (v y) = frac (v x)"by auto from T(1) obtain c where c: "I y = Intv c"by (auto simp: X0_def) with elem T(1) have"c < v y""v y < c + 1"by (fastforce simp: X0_def)+ thenhave"floor (v y) = c"by linarith with * have"(v y + ?t) = c + 1"unfolding frac_def by auto with T(2) show ?thesis by (auto simp: c cval_add_def I'_def) next case True with shift x show ?thesis by (auto simp: cval_add_def I'_def) qed qed qed next show"?X0 = ?X0" .. next show"∀y∈?X0. ∀z∈?X0. ((y, z) ∈ r') = (frac ((v ⊕ 1 - frac (v x))y) ≤ frac ((v ⊕1 - frac (v x)) z))" proof (safe, goal_cases) case (1 y z d d') note A = this thenhave"y ∉ M""z ∉ M"unfolding I'_defby auto with A have [simp]: "I' y = I y""I' z = I z""y ∈ X0""z ∈ X0"unfolding X0_def I'_defby auto from A v[unfolded R_def] have le: "frac (v y) ≤ frac (v z)"by (auto simp: r'_def) from t_bound' ‹y ∉ M›‹z ∉ M›have"?t < 1 - frac (v y)""?t < 1 - frac (v z)"by auto with frac_distr[OF ‹?t > 0›] have "frac (v y) + ?t = frac (v y + ?t)""frac (v z) + ?t = frac (v z + ?t)" by auto with le show ?caseby (auto simp: cval_add_def) next case (2 y z d d') note A = this thenhave M: "y ∉ M""z ∉ M"unfolding I'_defby auto with A have [simp]: "I' y = I y""I' z = I z""y ∈ X0""z ∈ X0"unfolding X0_def I'_defby auto from t_bound' ‹y ∉ M›‹z ∉ M›have"?t < 1 - frac (v y)""?t < 1 - frac (v z)"by auto from frac_add_leD[OF ‹?t > 0› this] A(5) have "frac (v y) ≤ frac (v z)" by (auto simp: cval_add_def) with v[unfolded R_def] A M show ?caseby (auto simp: r'_def) qed qed with‹?t > 0›‹?t ≤ t›show"∃t'≤t. (v ⊕ t') ∈ region X I' r' ∧ 0 ≤ t'"by auto next fix v t assume A: "v ∈ region X I' r'""0 ≤ t""(v ⊕ t) ∈ R" from assms(10) obtain x c where x: "x ∈ X0""I x = Intv c""x ∈ X""x ∈ M" unfolding M_def X0_defby force with A(1) have"intv_elem x v (I' x)"by auto with x have"v x = c + 1"unfolding I'_defby auto moreoverfrom A(3) x(2,3) have"v x + t < c + 1"by (fastforce simp: cval_add_def R_def) ultimatelyshow False using A(2) by auto next case A: (3 v t' x c) from A(3) have"I x = Intv c"by (auto simp: I'_def) (cases "x ∈ M", auto) with A(4) show ?caseby (auto simp: cval_add_def) next case4 thenshow ?caseunfolding I'_defby auto next case A: (5 v t' x c) thenhave"I' x = Intv c"unfolding I'_defby auto moreoverfrom A have"real (c + 1) ≤ (v ⊕ t') x + (t - t')"by (auto simp: cval_add_def) ultimatelyshow ?caseby blast next from assms(5,10) obtain x where x: "x ∈ M"by blast thenhave"isConst (I' x)"by (auto simp: I'_def) with x show"∃x∈X. isConst (I' x)"unfolding M_def X0_defby force qed
lemma closest_valid_2: fixes I X k r defines"R≡ {region X I r |I r. valid_region X k I r}" defines"R ≡ region X I r" assumes"∀ x ∈ X. ¬ isConst (I x)" defines"X0≡ {x ∈ X. isIntv (I x)}" defines"M ≡ {x ∈ X0. ∀ y ∈ X0. (x, y) ∈ r ⟶ (y, x) ∈ r}" defines"I'≡ λ x. if x ∉ M then I x else Const (intv_const (I x) + 1)" defines"r' ≡ {(x,y) ∈ r. x ∉ M ∧ y ∉ M}" assumes"finite X" assumes"valid_region X k I r" assumes"M ≠ {}" shows"valid_region X k I' r'" proof let ?X0 = "{x ∈ X. ∃d. I x = Intv d}" let ?X0' = "{x ∈ X. ∃d. I' x = Intv d}" show"?X0' = ?X0'" .. have r_subset: "r ⊆ ?X0× ?X0"and refl: "refl_on ?X0 r"and total: "total_on ?X0 r"and
trans: "trans r"and valid: "∧ x. x ∈ X ==> valid_intv (k x) (I x)" using assms(9) by auto have subs: "r' ⊆ r"unfolding r'_defby auto show"r'⊆ ?X0' × ?X0'"using r_subset unfolding r'_def I'_defby auto
show"refl_on ?X0' r'"unfolding refl_on_def proof auto fix x d assume A: "x ∈ X""I' x = Intv d" thenhave"x ∉ M"by (force simp: I'_def) with A have"I x = Intv d"by (force simp: I'_def) with A refl have"(x,x) ∈ r"by (auto simp: refl_on_def) thenshow"(x, x) ∈ r'"by (auto simp: r'_def‹x ∉ M›) qed show"total_on ?X0' r'"unfolding total_on_def proof (safe, goal_cases) case (1 x y d d') note A = this thenhave *: "x ∉ M""y ∉ M"by (force simp: I'_def)+ with A have"I x = Intv d""I y = Intv d'"by (force simp: I'_def)+ with A total have"(x, y) ∈ r ∨ (y, x) ∈ r"by (auto simp: total_on_def) with A(6) * show ?caseunfolding r'_defby auto qed show"trans r'"unfolding trans_def proof safe fix x y z assume A: "(x, y) ∈ r'""(y, z) ∈ r'" from trans have [intro]: "∧ x y z. (x,y) ∈ r ==> (y, z) ∈ r ==> (x, z) ∈ r" unfolding trans_def by blast from A show"(x, z) ∈ r'"by (auto simp: r'_def) qed show"∀x∈X. valid_intv (k x) (I' x)" using valid unfolding I'_def proof (auto simp: I'_def intro: valid, goal_cases) case (1 x) with assms(9) have"intv_const (I x) < k x"by (fastforce simp: M_def X0_def) thenshow ?caseby auto qed qed
subsection‹Putting the Proof for the 'Set of Regions' Property Together›
subsubsection‹Misc›
lemma total_finite_trans_max: "X ≠ {} ==> finite X ==> total_on X r ==> trans r ==>∃ x ∈ X. ∀ y ∈ X. x ≠ y ⟶(y, x) ∈ r" proof (induction"card X" arbitrary: X) case0 thenshow ?caseby auto next case (Suc n) thenobtain x where x: "x ∈ X"by blast show ?case proof (cases "n = 0") case True with Suc.hyps(2) ‹finite X› x have"X = {x}"by (metis card_Suc_eq empty_iff insertE) thenshow ?thesis by auto next case False show ?thesis proof (cases "∀y∈X. x ≠ y ⟶ (y, x) ∈ r") case True with x show ?thesis by auto next case False thenobtain y where y: "y ∈ X""x ≠ y""¬ (y, x) ∈ r"by auto with x Suc.prems(3) have"(x, y) ∈ r"unfolding total_on_def by blast let ?X = "X - {x}" have tot: "total_on ?X r"using‹total_on X r›unfolding total_on_def by auto from x Suc.hyps(2) ‹finite X›have card: "n = card ?X"by auto with‹finite X›‹n ≠ 0›have"?X ≠ {}"by auto from Suc.hyps(1)[OF card this _ tot ‹trans r›] ‹finite X›obtain x' where
IH: "x' ∈ ?X""∀ y ∈ ?X. x' ≠ y ⟶ (y, x') ∈ r" by auto have"(x', x) ∉ r" proof (rule ccontr, auto) assume A: "(x', x) ∈ r" with y(3) have"x' ≠ y"by auto with y IH have"(y, x') ∈ r"by auto with‹trans r› A have"(y, x) ∈ r"unfolding trans_def by blast with y show False by auto qed with‹x ∈ X›‹x' ∈ ?X›‹total_on X r›have"(x, x') ∈ r"unfolding total_on_def by auto with IH show ?thesis by auto qed qed qed
lemma card_mono_strict_subset: "finite A ==> finite B ==> finite C ==> A ∩ B ≠ {} ==> C = A - B ==> card C < card A" by (metis Diff_disjoint Diff_subset inf_commute less_le psubset_card_mono)
subsubsection‹Proof›
text‹
First we show that a shift by a non-negative integer constant means that any two valuations from
the same region are being shifted to the same region. ›
lemma int_shift_equiv: fixes X k fixes t :: int defines"R≡ {region X I r |I r. valid_region X k I r}" assumes"v ∈ R""v' ∈ R""R ∈R""t ≥ 0" shows"(v' ⊕ t) ∈ [v ⊕ t]\<R>"using assms proof - from assms obtain I r where A: "R = region X I r""valid_region X k I r"by auto from regions_closed[OF _ assms(4,2), of X k t] assms(1,5) obtain I' r' where RR: "[v ⊕ t]\<R> = region X I' r'""valid_region X k I' r'" by auto from regions_closed'[OF _ assms(4,2), of X k t] assms(1,5) have RR': "(v ⊕ t) ∈ [v ⊕ t]\<R>"by auto show ?thesis proof (simp add: RR(1), rule, goal_cases) case1 from‹v' ∈ R› A(1) have"∀x∈X. 0 ≤ v' x"by auto with‹t ≥ 0›show ?caseunfolding cval_add_def by auto next case2 show ?case proof safe fix x assume x: "x ∈ X" with‹v' ∈ R›‹v ∈ R› A(1) have I: "intv_elem x v (I x)""intv_elem x v' (I x)"by auto from x RR RR' have I': "intv_elem x (v ⊕ t) (I' x)"by auto show"intv_elem x (v' ⊕ t) (I' x)" proof (cases "I' x") case (Const c) from Const I' have"v x + t = c"unfolding cval_add_def by auto with x A(1) ‹v ∈ R›‹t ≥ 0›have *: "v x = c - nat t""t ≤ c"by fastforce+ have"I x = Const (c - nat t)" proof (cases "I x") case (Greater c') with RR(2) Const ‹x ∈ X›have"c ≤ k x"by fastforce with * ‹t ≥ 0›have *: "v x ≤ k x"by auto from Greater A(2) ‹x ∈ X›have"c' = k x"by fastforce moreoverfrom I(1) Greater have"v x > c'"by auto ultimatelyshow ?thesis using‹c ≤ k x› * by auto qed (use I in‹auto simp: *›) with I ‹t ≥ 0› *(2) have"v' x + t = c"by auto with Const show ?thesis unfolding cval_add_def by auto next case (Intv c) with I' have"c < v x + t""v x + t < c + 1"unfolding cval_add_def by auto with x A(1) ‹v ∈ R›‹t ≥ 0› have *: "c - nat t < v x""v x < c - nat t + 1""t ≤ c" by fastforce+ have"I x = Intv (c - nat t)" proof (cases "I x") case (Greater c') with RR(2) Intv ‹x ∈ X›have"c ≤ k x"by fastforce with * have *: "v x ≤ k x"using Intv RR(2) x by fastforce from Greater A(2) ‹x ∈ X›have"c' = k x"by fastforce moreoverfrom I(1) Greater have"v x > c'"by auto ultimatelyshow ?thesis using‹c ≤ k x› * by auto qed (use I * in‹auto simp del: of_nat_diff›) with I ‹t ≤ c›have"c < v' x + nat t""v' x + t < c + 1"by auto with Intv ‹t ≥ 0›show ?thesis unfolding cval_add_def by auto next case (Greater c) with I' have *: "c < v x + t"unfolding cval_add_def by auto show ?thesis proof (cases "I x") case (Const c') with x A(1) I(2) ‹v ∈ R›‹v' ∈ R›have"v x = v' x"by fastforce with Greater * show ?thesis unfolding cval_add_def by auto next case (Intv c') with x A(1) I(2) ‹v ∈ R›‹v' ∈ R›have **: "c' < v x""v x < c' + 1""c' < v' x" by fastforce+ thenhave"c' + t < v x + t""v x + t < c' + t + 1"by auto with * have"c ≤ c' + t"by auto with **(3) have"v' x + t > c"by auto with Greater * show ?thesis unfolding cval_add_def by auto next fix c' assume c': "I x = Greater c'" with x A(1) I(2) ‹v ∈ R›‹v' ∈ R›have **: "c' < v x""c' < v' x"by fastforce+ from Greater RR(2) c' A(2) ‹x ∈ X›have"c' = k x""c = k x"by fastforce+ with‹t ≥ 0› **(2) Greater show"intv_elem x (v' ⊕ real_of_int t) (I' x)" unfolding cval_add_def by auto qed qed qed next show"{x ∈ X. ∃d. I' x = Intv d} = {x ∈ X. ∃d. I' x = Intv d}" .. next let ?X0 = "{x ∈ X. ∃d. I' x = Intv d}"
{ fix x y :: real have"frac (x + t) ≤ frac (y + t) ⟷ frac x ≤ frac y"by (simp add: frac_def)
} note frac_equiv = this
{ fix x y have"frac ((v ⊕ t) x) ≤ frac ((v ⊕ t) y) ⟷ frac (v x) ≤ frac (v y)" unfolding cval_add_def using frac_equiv by auto
} note frac_equiv' = this
{ fix x y have"frac ((v' ⊕ t) x) ≤ frac ((v' ⊕ t) y) ⟷ frac (v' x) ≤ frac (v' y)" unfolding cval_add_def using frac_equiv by auto
} note frac_equiv'' = this
{ fix x y assume x: "x ∈ X"and y: "y ∈ X"and B: "¬ isGreater(I x)""¬ isGreater(I y)" have"frac (v x) ≤ frac (v y) ⟷ frac (v' x) ≤ frac (v' y)" proof (cases "I x") case (Const c) with x ‹v ∈ R›‹v' ∈ R› A(1) have"v x = c""v' x = c"by fastforce+ thenhave"frac (v x) ≤ frac (v y)""frac (v' x) ≤ frac (v' y)"unfolding frac_def by simp+ thenshow ?thesis by auto next case (Intv c) with x ‹v ∈ R› A(1) have v: "c < v x""v x < c + 1"by fastforce+ from Intv x ‹v' ∈ R› A(1) have v':"c < v' x""v' x < c + 1"by fastforce+ show ?thesis proof (cases "I y", goal_cases) case (Const c') with y ‹v ∈ R›‹v' ∈ R› A(1) have"v y = c'""v' y = c'"by fastforce+ thenhave"frac (v y) = 0""frac (v' y) = 0"by auto with nat_intv_frac_gt0[OF v] nat_intv_frac_gt0[OF v'] have"¬ frac (v x) ≤ frac (v y)""¬ frac (v' x) ≤ frac (v' y)"by linarith+ thenshow ?thesis by auto next case2: (Intv c') with x y Intv ‹v ∈ R›‹v' ∈ R› A(1) have "(x, y) ∈ r ⟷ frac (v x) ≤ frac (v y)" "(x, y) ∈ r ⟷ frac (v' x) ≤ frac (v' y)" by auto thenshow ?thesis by auto next case Greater with B show ?thesis by auto qed next case Greater with B show ?thesis by auto qed
} note frac_cong = this have not_greater: "¬ isGreater (I x)"if x: "x ∈ X""¬ isGreater (I' x)"for x proof (rule ccontr, auto, goal_cases) case (1 c) with x ‹v ∈ R› A(1,2) have"c < v x"by fastforce+ moreoverfrom x A(2) 1have"c = k x"by fastforce+ ultimatelyhave *: "k x < v x + t"using‹t ≥ 0›by simp from RR(1,2) RR' x have I': "intv_elem x (v ⊕ t) (I' x)""valid_intv (k x) (I' x)"by auto from x show False proof (cases "I' x", auto) case (Const c') with I' * show False by (auto simp: cval_add_def) next case (Intv c') with I' * show False by (auto simp: cval_add_def) qed qed show"∀ x ∈ ?X0. ∀y ∈ ?X0. ((x, y) ∈ r') = (frac ((v' ⊕ t) x) ≤ frac ((v' ⊕ t) y))" proof (standard, standard) fix x y assume x: "x ∈ ?X0" and y: "y ∈ ?X0" then have B: "¬ OpenFlow_Matches with x not_greater have "notisGreater (I x)" "¬ isGreater (I y)" by auto with x y frac have "frac)< frac (v y) ⟷ (v x) <e (v' y)" by auto moreover from xy (1) RR' have ")< r t) yjava.lang.StringIndexOutOfBoundsException: Index 132 out of bounds for length 132 by ultimatelyshow"(x, y) ∈ s)" nfoldingby using ' frac_equiv blast qed qed qed
text‹ m ∧ m)" (* IPv6 nah *) |
Now,
The induction principle is not at all obvious: the induction is over the set of clocks for
which the valuation is shifted beyond the current interval boundaries.
Using the two successor operations, we can see that either the set of these clocks
same (Z ~= {}) or strictly decreases (Z = {}). › (casejava.lang.StringIndexOutOfBoundsException: Index 110 out of bounds for length 110
lemmaotoRightarrowa ≤ b | fixes X k I defines"R if a2 = b2 then a1 ≤ b2 | defines "C ≡ X ∧ c. I x = Intv c ∧ c + 1)}" assumes hows ws ∃0. (v' ⊕ [v ⊕R"using assms proofction C" arbitrary: C I r v v' t rule: leless_in) case less let ?R = "region X I r" ?C = "{ \in X.∃ real (c + 1) ≤ from lesshave: "?\in> R"by auto
{fix I k rfixt : t assume no_constsc ) p p_sport assume v:v <> prerequisites s then (match_no_prereq) None assume t: "t ≥ 0" let ?C = "{x ∈ X. ∃c. I x = Intv c ∧ real (c + 1) ≤ v x + t}" assume C: "?C = {}" let ?R = "region X I r"
have(v \oplus )<>Rjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 proof,goal_cases case with\opent \ge> 0›v ∈ ?R›) next case2 show all_prerequisites_def auto proof (standard, case_tac "I x", goal_cases case xc) with no_consts showcaseby auto next case (2 x c)
OF_match_fields_alt OF_match_fields with‹ m. match_no_prereq f p then Some True else SomeFalse) lemmaof_match_fields_safe_eq2:assumes"all_prerequisitesm"shows"OF_match_fields_safemp\<longleftrightarrow>OF_match_fieldsmp=SomeTrue" ultimatelyshow?caseby(autosimp:2cval_add_def) next case(3xc) with\<open>v\<in>?R\<close>have"c<vx"byfastforce with\<open>t\<ge>0\<close>have"c<vx+t"byauto thenshow?caseby(autosimp:3cval_add_def) qed next show"{x\<in>X.\<exists>d.Ix=Intvd}={x\<in>X.\<exists>d.Ix=Intvd}".. next let?X\<^sub>0="{x\<in>X.\<exists>d.Ix=Intvd}" {fixxd::realfixc::natassumeA:"c<x""x+d<c+1""d\<ge>0" thenhave"d<1-fracx"unfoldingfrac_defusingfloor_eq3of_nat_Sucbyfastforce }noteintv_frac=this {fixxassumex:"x\<in>?X\<^sub>0" thenobtaincwherex:"x\<in>X""Ix=Intvc"byauto with\<open>v\<in>?R\<close>have*:"c<vx"byfastforce with\<open>t\<ge>0\<close>have"c<vx+t"byauto fromxChave"vx+t<c+1"byauto fromintv_frac[OF*this\<open>t\<ge>0\<close>]have"t<1-frac(vx)"byauto }noteintv_frac=this {fixxyassumex:"x\<in>?X\<^sub>0"andy:"y\<in>?X\<^sub>0" fromfrac_add_leIFF[OF\<open>t\<ge>0\<close>intv_frac[OFx]intv_frac[OFy]] have"frac(vx)\<le>frac(vy)\<longleftrightarrow>frac((v\<oplus>t)x)\<le>frac((v\<oplus>t)y)" by(autosimp:cval_add_def) }notefrac_cong=this show"\<forall>x\<in>?X\<^sub>0.\<forall>y\<in>?X\<^sub>0.(x,y)\<in>r\<longleftrightarrow>frac((v\<oplus>t)x)\<le>frac((v\<oplus>t)y)" proof(standard,standard,goal_cases) case(1xy) with\<open>v\<in>?R\<close>have"(x,y)\<in>r\<longleftrightarrow>frac(vx)\<le>frac(vy)"byauto withfrac_cong[OF1]show?casebysimp qed qed }notecritical_empty_intro=this {assumeconst:"\<exists>x\<in>X.isConst(Ix)" assumet:"t>0" fromconsthave"{x\<in>X.\<exists>c.Ix=Constc}\<noteq>{}"byauto fromclosest_prestable_1[OFthisless.prems(4)less(3)]Rclosest_valid_1[OFthisless.prems(4)less(3)] obtainI''r'' wherestability:"\<forall>v\<in>?R.\<forall>t>0.\<exists>t'\<le>t.(v\<oplus>t')\<in>regionXI''r''\<and>t'\<ge>0" andsucc_not_refl:"\<forall>v\<in>regionXI''r''.\<forall>t\<ge>0.(v\<oplus>t)\<notin>?R" andno_consts:"\<forall>x\<in>X.\<not>isConst(I''x)" andcrit_mono:"\<forall>v\<in>?R.\<forall>t<1.\<forall>t'\<ge>0.(v\<oplus>t')\<in>regionXI''r'' \<longrightarrow>{x.x\<in>X\<and>(\<exists>c.Ix=Intvc\<and>vx+t\<ge>c+1)} ={x.x\<in>X\<and>(\<exists>c.I''x=Intvc\<and>(v\<oplus>t')x+(t-t')\<ge>c+1)}" andsucc_valid:"valid_regionXkI''r''" byauto let?R''="regionXI''r''" fromstabilityless(4)\<open>t>0\<close>obtaint1wheret1:"t1\<ge>0""t1\<le>t""(v\<oplus>t1)\<in>?R''"byauto fromstabilityless(5)\<open>t>0\<close>obtaint2wheret2:"t2\<ge>0""t2\<le>t""(v'\<oplus>t2)\<in>?R''"byauto let?v="v\<oplus>t1" let?t="t-t1" let?C'="{x\<in>X.\<exists>c.I''x=Intvc\<and>real(c+1)\<le>?vx+?t}" fromt1\<open>t<1\<close>havett:"0\<le>?t""?t<1"byauto fromcrit_mono\<open>t<1\<close>t1(1,3)\<open>v\<in>?R\<close>havecrit: "?C=?C'" byauto witht1t2succ_validno_constshave "\<exists>t1\<ge>0.\<exists>t2\<ge>0.\<exists>I'r'.t1\<le>t\<and>(v\<oplus>t1)\<in>regionXI'r' \<and>t2\<le>t\<and>(v'\<oplus>t2)\<in>regionXI'r' \<and>valid_regionXkI'r' \<and>(\<forall>x\<in>X.\<not>isConst(I'x)) \<and>?C={x\<in>X.\<exists>c.I'x=Intvc\<and>real(c+1)\<le>(v\<oplus>t1)x+(t-t1)}" byblast }noteconst_dest=this {fixt::realfixvIrxcv' let?R="regionXIr" assumev:"v\<in>?R" assumev':"v'\<in>?R" assumevalid:"valid_regionXkIr" assumet:"t>0""t<1" let?C="{x\<in>X.\<exists>c.Ix=Intvc\<and>real(c+1)\<le>vx+t}" assumeC:"?C={}" assumeconst:"\<exists>x\<in>X.isConst(Ix)" thenhave"{x\<in>X.\<exists>c.Ix=Constc}\<noteq>{}"byauto fromclosest_prestable_1[OFthisless.prems(4)valid]Rclosest_valid_1[OFthisless.prems(4)valid] obtainI''r'' wherestability:"\<forall>v\<in>?R.\<forall>t>0.\<exists>t'\<le>t.(v\<oplus>t')\<in>regionXI''r''\<and>t'\<ge>0" andsucc_not_refl:"\<forall>v\<in>regionXI''r''.\<forall>t\<ge>0.(v\<oplus>t)\<notin>?R" andno_consts:"\<forall>x\<in>X.\<not>isConst(I''x)" andcrit_mono:"\<forall>v\<in>?R.\<forall>t<1.\<forall>t'\<ge>0.(v\<oplus>t')\<in>regionXI''r'' \<longrightarrow>{x.x\<in>X\<and>(\<exists>c.Ix=Intvc\<and>vx+t\<ge>c+1)} ={x.x\<in>X\<and>(\<exists>c.I''x=Intvc\<and>(v\<oplus>t')x+(t-t')\<ge>c+1)}" andsucc_valid:"valid_regionXkI''r''" byauto let?R''="regionXI''r''" fromstabilityv\<open>t>0\<close>obtaint1wheret1:"t1\<ge>0""t1\<le>t""(v\<oplus>t1)\<in>?R''"byauto fromstabilityv'\<open>t>0\<close>obtaint2wheret2:"t2\<ge>0""t2\<le>t""(v'\<oplus>t2)\<in>?R''"byauto let?v="v\<oplus>t1" let?t="t-t1" let?C'="{x\<in>X.\<exists>c.I''x=Intvc\<and>real(c+1)\<le>?vx+?t}" fromt1\<open>t<1\<close>havett:"0\<le>?t""?t<1"byauto fromcrit_mono\<open>t<1\<close>t1(1,3)\<open>v\<in>?R\<close>havecrit: "{x\<in>X.\<exists>c.Ix=Intvc\<and>real(c+1)\<le>vx+t} ={x\<in>X.\<exists>c.I''x=Intvc\<and>real(c+1)\<le>(v\<oplus>t1)x+(t-t1)}" byauto withChaveC:"?C'={}"byblast fromcritical_empty_intro[OFno_constst1(3)tt(1)this]have"((v\<oplus>t1)\<oplus>?t)\<in>?R''". fromregion_unique[OFless(2)this]less(2)succ_validt2have"\<exists>t'\<ge>0.(v'\<oplus>t')\<in>[v\<oplus>t]\<^sub>\<R>" by(autosimp:cval_add_def) }noteintro_const=this {fixvIrtxcv' let?R="regionXIr" assumev:"v\<in>?R" assumev':"v'\<in>?R" assumeF2:"\<forall>x\<in>X.\<not>isConst(Ix)" assumex:"x\<in>X""Ix=Intvc""vx+t\<ge>c+1" assumevalid:"valid_regionXkIr" assumet:"t\<ge>0""t<1" let?C'="{x\<in>X.\<exists>c.Ix=Intvc\<and>real(c+1)\<le>vx+t}" assumeC:"?C=?C'" havenot_in_R:"(v\<oplus>t)\<notin>?R" proof(ruleccontr,auto) assume"(v\<oplus>t)\<in>?R" withx(1,2)have"vx+t<c+1"by(fastforcesimp:cval_add_def) withx(3)showFalsebysimp qed havenot_in_R':"(v'\<oplus>1)\<notin>?R" proof(ruleccontr,auto) assume"(v'\<oplus>1)\<in>?R" withxhave"v'x+1<c+1"by(fastforcesimp:cval_add_def) moreoverfromxv'have"c<v'x"byfastforce ultimatelyshowFalsebysimp qed let?X\<^sub>0="{x\<in>X.isIntv(Ix)}" let?M="{x\<in>?X\<^sub>0.\<forall>y\<in>?X\<^sub>0.(x,y)\<in>r\<longrightarrow>(y,x)\<in>r}" fromxhavex:"x\<in>X""\<not>isGreater(Ix)"andc:"Ix=Intvc"byauto with\<open>x\<in>X\<close>have*:"?X\<^sub>0\<noteq>{}"byauto have"?X\<^sub>0={x\<in>X.\<exists>d.Ix=Intvd}"byauto withvalidhaver:"total_on?X\<^sub>0r""transr"byauto fromtotal_finite_trans_max[OF*_this]\<open>finiteX\<close> obtainx'wherex':"x'\<in>?X\<^sub>0""\<forall>y\<in>?X\<^sub>0.x'\<noteq>y\<longrightarrow>(y,x')\<in>r"byfastforce fromthis(2)have"\<forall>y\<in>?X\<^sub>0.(x',y)\<in>r\<longrightarrow>(y,x')\<in>r"byauto withx'(1)have"?M\<noteq>{}"byfastforce fromclosest_prestable_2[OFF2less.prems(4)validthis]closest_valid_2[OFF2less.prems(4)validthis] obtainI'r' wherestability: "\<forall>v\<in>regionXIr.\<forall>t\<ge>0.(v\<oplus>t)\<notin>regionXIr\<longrightarrow>(\<exists>t'\<le>t.(v\<oplus>t')\<in>regionXI'r'\<and>t'\<ge>0)" andcritical_mono:"\<forall>v\<in>regionXIr.\<forall>t.\<forall>t'. {x.x\<in>X\<and>(\<exists>c.I'x=Intvc\<and>(v\<oplus>t')x+(t-t')\<ge>real(c+1))} ={x.x\<in>X\<and>(\<exists>c.Ix=Intvc\<and>vx+t\<ge>real(c+1))}-?M" andconst_ex:"\<exists>x\<in>X.isConst(I'x)" andsucc_valid:"valid_regionXkI'r'" byauto let?R'="regionXI'r'" fromnot_in_Rstability\<open>t\<ge>0\<close>vobtaint'where t':"t'\<ge>0""t'\<le>t""(v\<oplus>t')\<in>?R'" byblast have"(1::t)\<ge>0"byauto withnot_in_R'stabilityv'obtaint1where t1:"t1\<ge>0""t1\<le>1""(v'\<oplus>t1)\<in>?R'" byblast let?v="v\<oplus>t'" let?t="t-t'" let?C''="{x\<in>X.\<exists>c.I'x=Intvc\<and>real(c+1)\<le>?vx+?t}" have"\<exists>t'\<ge>0.(v'\<oplus>t')\<in>[v\<oplus>t]\<^sub>\<R>" proof(cases"t=t'") caseTrue witht'have"(v\<oplus>t)\<in>?R'"byauto fromregion_unique[OFless(2)this]succ_valid\<R>_defhave"[v\<oplus>t]\<^sub>\<R>=?R'"byblast witht1(1,3)show?thesisbyauto next caseFalse with\<open>t<1\<close>t'havett:"0\<le>?t""?t<1""?t>0"byauto fromcritical_mono\<open>v\<in>?R\<close>haveC_eq:"?C''=?C'-?M"byauto show"\<exists>t'\<ge>0.(v'\<oplus>t')\<in>[v\<oplus>t]\<^sub>\<R>" proof(cases"?C'\<inter>?M={}") caseFalse from\<open>finiteX\<close>have"finite?C''""finite?C'""finite?M"byauto thenhave"card?C''<card?C"usingC_eqCFalseby(introcard_mono_strict_subset)auto fromless(1)[OFthisless(2)succ_validt'(3)t1(3)\<open>finiteX\<close>tt(1,2)] obtaint2where"t2\<ge>0""((v'\<oplus>t1)\<oplus>t2)\<in>[(v\<oplus>t)]\<^sub>\<R>"by(autosimp:cval_add_def) moreoverhave"(v'\<oplus>(t1+t2))=((v'\<oplus>t1)\<oplus>t2)"by(autosimp:cval_add_def) moreoverhave"t1+t2\<ge>0"using\<open>t2\<ge>0\<close>t1(1)byauto ultimatelyshow?thesisbymetis next caseTrue {fixxcassumex:"x\<in>X""Ix=Intvc""real(c+1)\<le>vx+t" withTruehave"x\<notin>?M"byforce fromxhave"x\<in>?X\<^sub>0"byauto fromx(1,2)\<open>v\<in>?R\<close>have*:"c<vx""vx<c+1"byfastforce+ with\<open>t<1\<close>have"vx+t<c+2"byauto havege_1:"frac(vx)+t\<ge>1" proof(ruleccontr,goal_cases) case1 thenhaveA:"frac(vx)+t<1"byauto from*have"floor(vx)+frac(vx)<c+1"unfoldingfrac_defbyauto withnat_intv_frac_gt0[OF*]have"floor(vx)\<le>c"bylinarith withAhave"vx+t<c+1"by(autosimp:frac_def) withx(3)showFalsebyauto qed from\<open>?M\<noteq>{}\<close>obtainywhere"y\<in>?M"byforce with\<open>x\<in>?X\<^sub>0\<close>havey:"y\<in>?X\<^sub>0""(y,x)\<in>r\<longrightarrow>(x,y)\<in>r"byauto fromyobtainc'wherec':"y\<in>X""Iy=Intvc'"byauto with\<open>v\<in>?R\<close>have"c'<vy"byfastforce from\<open>y\<in>?M\<close>\<open>x\<notin>?M\<close>have"x\<noteq>y"byauto withyr(1)x(1,2)have"(x,y)\<in>r"unfoldingtotal_on_defbyfastforce with\<open>v\<in>?R\<close>c'xhave"frac(vx)\<le>frac(vy)"byfastforce withge_1havefrac:"frac(vy)+t\<ge>1"byauto have"real(c'+1)\<le>vy+t" proof(ruleccontr,goal_cases) case1 from\<open>c'<vy\<close>have"floor(vy)\<ge>c'"bylinarith withfrachave"vy+t\<ge>c'+1"unfoldingfrac_defbylinarith with1showFalsebysimp qed withc'True\<open>y\<in>?M\<close>haveFalsebyauto } thenhaveC:"?C'={}"byauto withC_eqhaveC'':"?C''={}"byauto fromintro_const[OFt'(3)t1(3)succ_validtt(3)tt(2)C''const_ex] obtaint2where"t2\<ge>0""((v'\<oplus>t1)\<oplus>t2)\<in>[v\<oplus>t]\<^sub>\<R>"by(autosimp:cval_add_def) moreoverhave"(v'\<oplus>(t1+t2))=((v'\<oplus>t1)\<oplus>t2)"by(autosimp:cval_add_def) moreoverhave"t1+t2\<ge>0"using\<open>t2\<ge>0\<close>t1(1)byauto ultimatelyshow?thesisbymetis qed qed }noteintro_intv=this fromregions_closed[OFless(2)Rless(4,7)]less(2)obtainI'r'whereR': "[v\<oplus>t]\<^sub>\<R>=regionXI'r'""valid_regionXkI'r'" byauto withregions_closed'[OFless(2)Rless(4,7)]assms(1)have R'2:"(v\<oplus>t)\<in>[v\<oplus>t]\<^sub>\<R>""(v\<oplus>t)\<in>regionXI'r'" byauto let?R'="regionXI'r'" fromless(2)R'have"?R'\<in>\<R>"byauto show?case proof(cases"?R'=?R") caseTruewithless(3,5)R'(1)have"(v'\<oplus>0)\<in>[v\<oplus>t]\<^sub>\<R>"by(autosimp:cval_add_def) thenshow?thesisbyauto next caseFalse have"t>0" proof(ruleccontr) assume"\<not>0<t" withR'\<open>t\<ge>0\<close>have"[v]\<^sub>\<R>=?R'"by(simpadd:cval_add_def) withregion_unique[OFless(2)less(4)R]\<open>?R'\<noteq>?R\<close>showFalsebyauto qed show?thesis proof(cases"?C={}") caseTrue show?thesis proof(cases"\<exists>x\<in>X.isConst(Ix)") caseFalse thenhaveno_consts:"\<forall>x\<in>X.\<not>isConst(Ix)"byauto fromcritical_empty_intro[OFthis\<open>v\<in>?R\<close>\<open>t\<ge>0\<close>True]have"(v\<oplus>t)\<in>?R". fromregion_unique[OFless(2)thisR]less(5)have"(v'\<oplus>0)\<in>[v\<oplus>t]\<^sub>\<R>" by(autosimp:cval_add_def) thenshow?thesisbyblast next caseTrue fromconst_dest[OFthis\<open>t>0\<close>]obtaint1t2I'r' wheret1:"t1\<ge>0""t1\<le>t""(v\<oplus>t1)\<in>regionXI'r'" andt2:"t2\<ge>0""t2\<le>t""(v'\<oplus>t2)\<in>regionXI'r'" andvalid:"valid_regionXkI'r'" andno_consts:"\<forall>x\<in>X.\<not>isConst(I'x)" andC:"?C={x\<in>X.\<exists>c.I'x=Intvc\<and>real(c+1)\<le>(v\<oplus>t1)x+(t-t1)}" byauto let?v="v\<oplus>t1" let?t="t-t1" let?C'="{x\<in>X.\<exists>c.I'x=Intvc\<and>real(c+1)\<le>?vx+?t}" let?R'="regionXI'r'" fromC\<open>?C={}\<close>have"?C'={}"byblast fromcritical_empty_intro[OFno_constst1(3)_this]t1have"(?v\<oplus>?t)\<in>?R'"byauto fromregion_unique[OFless(2)this]less(2)validt2show?thesis by(autosimp:cval_add_def) qed next caseFalse thenobtainxcwherex:"x\<in>X""Ix=Intvc""vx+t\<ge>c+1"byauto thenhaveF:"\<not>(\<forall>x\<in>X.\<exists>c.Ix=Greaterc)"byforce show?thesis proof(cases"\<exists>x\<in>X.isConst(Ix)") caseFalse thenhave"\<forall>x\<in>X.\<not>isConst(Ix)"byauto fromintro_intv[OF\<open>v\<in>?R\<close>\<open>v'\<in>?R\<close>thisxless(3,7,8)]show?thesisbyauto next caseTrue thenhave"{x\<in>X.\<exists>c.Ix=Constc}\<noteq>{}"byauto fromconst_dest[OFTrue\<open>t>0\<close>]obtaint1t2I'r' wheret1:"t1\<ge>0""t1\<le>t""(v\<oplus>t1)\<in>regionXI'r'" andt2:"t2\<ge>0""t2\<le>t""(v'\<oplus>t2)\<in>regionXI'r'" andvalid:"valid_regionXkI'r'" andno_consts:"\<forall>x\<in>X.\<not>isConst(I'x)" andC:"?C={x\<in>X.\<exists>c.I'x=Intvc\<and>real(c+1)\<le>(v\<oplus>t1)x+(t-t1)}" byauto let?v="v\<oplus>t1" let?t="t-t1" let?C'="{x\<in>X.\<exists>c.I'x=Intvc\<and>real(c+1)\<le>?vx+?t}" let?R'="regionXI'r'" show?thesis proof(cases"?C'={}") caseFalse withintro_intv[OFt1(3)t2(3)no_consts___valid__C]\<open>t<1\<close>t1obtaint'where "t'\<ge>0""((v'\<oplus>t2)\<oplus>t')\<in>[(v\<oplus>t)]\<^sub>\<R>" by(autosimp:cval_add_def) moreoverhave"((v'\<oplus>t2)\<oplus>t')=(v'\<oplus>(t2+t'))"by(autosimp:cval_add_def) moreoverhave"t2+t'\<ge>0"using\<open>t'\<ge>0\<close>\<open>t2\<ge>0\<close>byauto ultimatelyshow?thesisbymetis next caseTrue fromcritical_empty_intro[OFno_constst1(3)_this]t1have"((v\<oplus>t1)\<oplus>?t)\<in>?R'"byauto fromregion_unique[OFless(2)this]less(2)validt2show?thesis by(autosimp:cval_add_def) qed qed qed qed qed
definitionacompatible where "acompatible\<R>ac\<equiv>\<forall>R\<in>\<R>.R\<subseteq>{v.v\<turnstile>\<^sub>aac}\<or>{v.v\<turnstile>\<^sub>aac}\<inter>R={}"
havevalid:"valid_regionXk?I?r" proof show"?X\<^sub>0-{x}=?X\<^sub>0'"byauto next show"?r\<subseteq>(?X\<^sub>0-{x})\<times>(?X\<^sub>0-{x})" usingr_subsetbyblast next fromreflshow"refl_on(?X\<^sub>0-{x})?r"unfoldingrefl_on_defbyauto next fromtransshow"trans?r"unfoldingtrans_defbyblast next fromtotalshow"total_on(?X\<^sub>0-{x})?r"unfoldingtotal_on_defbyauto next fromR(2)have"\<forall>x\<in>X.valid_intv(kx)(Ix)"byauto with\<open>c\<le>kx\<close>show"\<forall>x\<in>X.valid_intv(kx)(?Ix)"byauto qed
{fixvassumev:"v\<in>region_setRxc" withR(1)obtainv'wherev':"v'\<in>regionXIr""v=v'(x:=c)"unfoldingregion_set_defbyauto have"v\<in>regionX?I?r" proof(standard,goal_cases) case1 fromv'\<open>0\<le>c\<close>show?casebyauto next case2 fromv'show?case proof(auto,goal_cases) case(1y) thenhave"intv_elemyv'(Iy)"byauto with\<open>x\<noteq>y\<close>show"intv_elemy(v'(x:=c))(Iy)"by(cases"Iy")auto qed next show"?X\<^sub>0-{x}=?X\<^sub>0'"byauto next fromv'show"\<forall>y\<in>?X\<^sub>0-{x}.\<forall>z\<in>?X\<^sub>0-{x}.(y,z)\<in>?r\<longleftrightarrow>frac(vy)\<le>frac(vz)"byauto qed }moreover {fixvassumev:"v\<in>regionX?I?r" have"\<exists>c.v(x:=c)\<in>regionXIr" proof(cases"Ix") case(Constc) fromR(2)have"c\<ge>0"byauto let?v="v(x:=c)" have"?v\<in>regionXIr" proof(standard,goal_cases) case1 from\<open>c\<ge>0\<close>vshow?casebyauto next case2 show?case proof(auto,goal_cases) case(1y) withvhave"intv_elemyv(?Iy)"byfast withConstshow"intv_elemy?v(Iy)"by(cases"x=y",auto)(cases"Iy",auto) qed next fromConstshow"?X\<^sub>0'=?X\<^sub>0"byauto withr_subsethave"r\<subseteq>?X\<^sub>0'\<times>?X\<^sub>0'"byauto thenhaver:"?r=r"byauto fromvhave"\<forall>y\<in>?X\<^sub>0'.\<forall>z\<in>?X\<^sub>0'.(y,z)\<in>?r\<longleftrightarrow>frac(vy)\<le>frac(vz)"byfastforce withrshow"\<forall>y\<in>?X\<^sub>0'.\<forall>z\<in>?X\<^sub>0'.(y,z)\<in>r\<longleftrightarrow>frac(?vy)\<le>frac(?vz)" byauto qed thenshow?thesisbyauto next case(Greaterc) fromR(2)have"c\<ge>0"byauto let?v="v(x:=c+1)" have"?v\<in>regionXIr" proof(standard,goal_cases) case1 from\<open>c\<ge>0\<close>vshow?casebyauto next case2 show?case proof(standard,goal_cases) case(1y) withvhave"intv_elemyv(?Iy)"byfast withGreatershow"intv_elemy?v(Iy)"by(cases"x=y",auto)(cases"Iy",auto) qed next fromGreatershow"?X\<^sub>0'=?X\<^sub>0"byauto withr_subsethave"r\<subseteq>?X\<^sub>0'\<times>?X\<^sub>0'"byauto thenhaver:"?r=r"byauto fromvhave"\<forall>y\<in>?X\<^sub>0'.\<forall>z\<in>?X\<^sub>0'.(y,z)\<in>?r\<longleftrightarrow>frac(vy)\<le>frac(vz)"byfastforce withrshow"\<forall>y\<in>?X\<^sub>0'.\<forall>z\<in>?X\<^sub>0'.(y,z)\<in>r\<longleftrightarrow>frac(?vy)\<le>frac(?vz)" byauto qed thenshow?thesisbyauto next case(Intvc) fromR(2)have"c\<ge>0"byauto let?L="{frac(vy)|y.y\<in>?X\<^sub>0\<and>x\<noteq>y\<and>(y,x)\<in>r}" let?U="{frac(vy)|y.y\<in>?X\<^sub>0\<and>x\<noteq>y\<and>(x,y)\<in>r}" let?l="if?L\<noteq>{}thenc+Max?Lelseif?U\<noteq>{}thencelsec+0.5" let?u="if?U\<noteq>{}thenc+Min?Uelseif?L\<noteq>{}thenc+1elsec+0.5" from\<open>finiteX\<close>havefin:"finite?L""finite?U"byauto {fixyassumey:"y\<in>?X\<^sub>0""x\<noteq>y""(y,x)\<in>r" thenhaveL:"frac(vy)\<in>?L"byauto withMax_in[OFfin(1)]haveIn:"Max?L\<in>?L"byauto thenhave"frac(Max?L)=(Max?L)"usingfrac_fracbyfastforce fromMax_ge[OFfin(1)L]have"frac(vy)\<le>Max?L". alsohave"\<dots>=frac(Max?L)"usingInfrac_frac[symmetric]byfastforce alsohave"\<dots>=frac(c+Max?L)"by(autosimp:frac_nat_add_id) finallyhave"frac(vy)\<le>frac?l"usingLbyauto }noteL_bound=this {fixyassumey:"y\<in>?X\<^sub>0""x\<noteq>y""(x,y)\<in>r" thenhaveU:"frac(vy)\<in>?U"byauto withMin_in[OFfin(2)]haveIn:"Min?U\<in>?U"byauto thenhave"frac(Min?U)=(Min?U)"usingfrac_fracbyfastforce have"frac(c+Min?U)=frac(Min?U)"by(autosimp:frac_nat_add_id) alsohave"\<dots>=Min?U"usingInfrac_fracbyfastforce alsofromMin_le[OFfin(2)U]have"Min?U\<le>frac(vy)". finallyhave"frac?u\<le>frac(vy)"usingUbyauto }noteU_bound=this {assume"?L\<noteq>{}" fromMax_in[OFfin(1)this]obtainldwherel: "Max?L=frac(vl)""l\<in>X""x\<noteq>l""Il=Intvd" byauto withvhave"d<vl""vl<d+1"byfastforce+ withnat_intv_frac_gt0[OFthis]frac_lt_1l(1)have"0<Max?L""Max?L<1"byauto thenhave"c<c+Max?L""c+Max?L<c+1"bysimp+ }noteL_intv=this {assume"?U\<noteq>{}" fromMin_in[OFfin(2)this]obtainudwhereu: "Min?U=frac(vu)""u\<in>X""x\<noteq>u""Iu=Intvd" byauto withvhave"d<vu""vu<d+1"byfastforce+ withnat_intv_frac_gt0[OFthis]frac_lt_1u(1)have"0<Min?U""Min?U<1"byauto thenhave"c<c+Min?U""c+Min?U<c+1"bysimp+ }noteU_intv=this havel_bound:"c\<le>?l" proof(cases"?L={}") caseTrue noteT=this show?thesis proof(cases"?U={}") caseTrue withTshow?thesisbysimp next caseFalse withU_intvTshow?thesisbysimp qed next caseFalse withL_intvshow?thesisbysimp qed havel_bound':"c<?u" proof(cases"?L={}") caseTrue noteT=this show?thesis proof(cases"?U={}") caseTrue withTshow?thesisbysimp next caseFalse withU_intvTshow?thesisbysimp qed next caseFalse withU_intvshow?thesisbysimp qed haveu_bound:"?u\<le>c+1" proof(cases"?U={}") caseTrue noteT=this show?thesis proof(cases"?L={}") caseTrue withTshow?thesisbysimp next caseFalse withL_intvTshow?thesisbysimp qed next caseFalse withU_intvshow?thesisbysimp qed haveu_bound':"?l<c+1" proof(cases"?U={}") caseTrue noteT=this show?thesis proof(cases"?L={}") caseTrue withTshow?thesisbysimp next caseFalse withL_intvTshow?thesisbysimp qed next caseFalse withL_intvshow?thesisbysimp qed havefrac_c:"fracc=0""frac(c+1)=0"byauto havel_u:"?l\<le>?u" proof(cases"?L={}") caseTrue noteT=this show?thesis proof(cases"?U={}") caseTrue withTshow?thesisbysimp next caseFalse withTshow?thesisusingMin_in[OFfin(2)False]by(autosimp:frac_c) qed next caseFalse withMax_in[OFfin(1)this]havel:"?l=c+Max?L""Max?L\<in>?L"byauto noteF=False froml(1)have*:"Max?L<1"usingFalseL_intv(2)bylinarith show?thesis proof(cases"?U={}") caseTrue withFl*show?thesisbysimp next caseFalse fromMin_in[OFfin(2)this]l(2)obtainluwherel_u: "Max?L=frac(vl)""Min?U=frac(vu)""l\<in>?X\<^sub>0""u\<in>?X\<^sub>0""(l,x)\<in>r""(x,u)\<in>r" "x\<noteq>l""x\<noteq>u" byauto fromtransl_u(5-)have"(l,u)\<in>?r"unfoldingtrans_defbyblast withl_u(1-4)vhave*:"Max?L\<le>Min?U"byfastforce withl_u(1,2)have"frac(Max?L)\<le>frac(Min?U)"by(simpadd:frac_frac) withfrac_nat_add_idl(1)Falsehave"frac?l\<le>frac?u"bysimp withl(1)*Falseshow?thesisbysimp qed qed obtaindwhered:"d=(?l+?u)/2"byblast withl_uhaved2:"?l\<le>d""d\<le>?u"bysimp+ fromdl_boundl_bound'u_boundu_bound'haved3:"c<d""d<c+1""d\<ge>0"bysimp+ have"floor?l=c" proof(cases"?L={}") caseFalse fromL_intv[OFFalse]have"0\<le>Max?L""Max?L<1"byauto fromfloor_nat_add_id[OFthis]Falseshow?thesisbysimp next caseTrue noteT=this show?thesis proof(cases"?U={}") caseTrue withTshow?thesisby(simpadd:floor_nat_add_id) next caseFalse fromU_intv[OFFalse]have"0\<le>Min?U""Min?U<1"byauto fromfloor_nat_add_id[OFthis]TFalseshow?thesisbysimp qed qed havefloor_u:"floor?u=(if?U={}\<and>?L\<noteq>{}thenc+1elsec)" proof(cases"?U={}") caseFalse fromU_intv[OFFalse]have"0\<le>Min?U""Min?U<1"byauto fromfloor_nat_add_id[OFthis]Falseshow?thesisbysimp next caseTrue noteT=this show?thesis proof(cases"?L={}") caseTrue withTshow?thesisby(simpadd:floor_nat_add_id) next caseFalse fromL_intv[OFFalse]have"0\<le>Max?L""Max?L<1"byauto fromfloor_nat_add_id[OFthis]TFalseshow?thesisbyauto qed qed {assume"?L\<noteq>{}""?U\<noteq>{}" fromMax_in[OFfin(1)\<open>?L\<noteq>{}\<close>]obtainwwherew: "w\<in>?X\<^sub>0""x\<noteq>w""(w,x)\<in>r""Max?L=frac(vw)" byauto fromMin_in[OFfin(2)\<open>?U\<noteq>{}\<close>]obtainzwherez: "z\<in>?X\<^sub>0""x\<noteq>z""(x,z)\<in>r""Min?U=frac(vz)" byauto fromwztranshave"(w,z)\<in>r"unfoldingtrans_defbyblast withvwzhave"Max?L\<le>Min?U"byfastforce }notel_le_u=this {fixyassumey:"y\<in>?X\<^sub>0""x\<noteq>y" fromtotaly\<open>x\<in>X\<close>Intvhavetotal:"(x,y)\<in>r\<or>(y,x)\<in>r"unfoldingtotal_on_defbyauto have"frac(vy)=fracd\<longleftrightarrow>(y,x)\<in>r\<and>(x,y)\<in>r" proofsafe assumeA:"(y,x)\<in>r""(x,y)\<in>r" fromL_bound[OFyA(1)]U_bound[OFyA(2)]have*: "frac(vy)\<le>frac?l""frac?u\<le>frac(vy)" byauto fromAyhave**:"?L\<noteq>{}""?U\<noteq>{}"byauto withL_intv[OFthis(1)]U_intv[OFthis(2)]have"frac?l=Max?L""frac?u=Min?U" by(autosimp:frac_nat_add_idfrac_eq) with***l_le_uhave"frac?l=frac?u""frac(vy)=frac?l"byauto withdhave"d=((floor?l+floor?u)+(frac(vy)+frac(vy)))/2" unfoldingfrac_defbyauto alsohave"\<dots>=c+frac(vy)"using\<open>floor?l=c\<close>floor_u\<open>?U\<noteq>{}\<close>byauto finallyshow"frac(vy)=fracd"usingfrac_nat_add_idfrac_fracbymetis next assumeA:"frac(vy)=fracd" show"(y,x)\<in>r" proof(ruleccontr) assumeB:"(y,x)\<notin>r" withtotalhaveB':"(x,y)\<in>r"byauto fromU_bound[OFythis]haveu_y:"frac?u\<le>frac(vy)"byauto fromyB'haveU:"?U\<noteq>{}"and"frac(vy)\<in>?U"byauto thenhaveu:"frac?u=Min?U"usingMin_in[OFfin(2)\<open>?U\<noteq>{}\<close>] by(autosimp:frac_nat_add_idfrac_frac) showFalse proof(cases"?L={}") caseTrue fromU_intv[OFU]have"0<Min?U""Min?U<1"byauto thenhave*:"frac(Min?U/2)=Min?U/2"unfoldingfrac_eqbysimp fromdUTruehave"d=((c+c)+Min?U)/2"byauto alsohave"\<dots>=c+Min?U/2"bysimp finallyhave"fracd=Min?U/2"using*by(simpadd:frac_nat_add_id) alsohave"\<dots><Min?U"using\<open>0<Min?U\<close>byauto finallyhave"fracd<frac?u"usingubyauto withu_yAshowFalsebyauto next caseFalse thenhavel:"?l=c+Max?L"bysimp fromMax_in[OFfin(1)\<open>?L\<noteq>{}\<close>] obtainwwherew: "w\<in>?X\<^sub>0""x\<noteq>w""(w,x)\<in>r""Max?L=frac(vw)" byauto with\<open>(y,x)\<notin>r\<close>transhave**:"(y,w)\<notin>r"unfoldingtrans_defbyblast fromMin_in[OFfin(2)\<open>?U\<noteq>{}\<close>]Max_in[OFfin(1)\<open>?L\<noteq>{}\<close>]frac_lt_1 have"0\<le>Max?L""Max?L<1""0\<le>Min?U""Min?U<1"byauto thenhave"0\<le>(Max?L+Min?U)/2""(Max?L+Min?U)/2<1"byauto thenhave***:"frac((Max?L+Min?U)/2)=(Max?L+Min?U)/2"unfoldingfrac_eq.. fromywhave"y\<in>?X\<^sub>0'""w\<in>?X\<^sub>0'"byauto withv**havelt:"frac(vy)>frac(vw)"byfastforce fromdUlhave"d=((c+c)+(Max?L+Min?U))/2"byauto alsohave"\<dots>=c+(Max?L+Min?U)/2"bysimp finallyhave"fracd=frac((Max?L+Min?U)/2)"by(simpadd:frac_nat_add_id) alsohave"\<dots>=(Max?L+Min?U)/2"using***bysimp alsohave"\<dots><(frac(vy)+Min?U)/2"usingltw(4)byauto alsohave"\<dots>\<le>frac(vy)"usingMin_le[OFfin(2)\<open>frac(vy)\<in>?U\<close>]byauto finallyshowFalseusingAbyauto qed qed next assumeA:"frac(vy)=fracd" show"(x,y)\<in>r" proof(ruleccontr) assumeB:"(x,y)\<notin>r" withtotalhaveB':"(y,x)\<in>r"byauto fromL_bound[OFythis]havel_y:"frac?l\<ge>frac(vy)"byauto fromyB'haveL:"?L\<noteq>{}"and"frac(vy)\<in>?L"byauto thenhavel:"frac?l=Max?L"usingMax_in[OFfin(1)\<open>?L\<noteq>{}\<close>] by(autosimp:frac_nat_add_idfrac_frac) showFalse proof(cases"?U={}") caseTrue fromL_intv[OFL]have*:"0<Max?L""Max?L<1"byauto fromdLTruehave"d=((c+c)+(1+Max?L))/2"byauto alsohave"\<dots>=c+(1+Max?L)/2"bysimp finallyhave"fracd=frac((1+Max?L)/2)"by(simpadd:frac_nat_add_id) alsohave"\<dots>=(1+Max?L)/2"using*unfoldingfrac_eqbyauto alsohave"\<dots>>Max?L"using*byauto finallyhave"fracd>frac?l"usinglbyauto withl_yAshowFalsebyauto next caseFalse thenhaveu:"?u=c+Min?U"bysimp fromMin_in[OFfin(2)\<open>?U\<noteq>{}\<close>] obtainwwherew: "w\<in>?X\<^sub>0""x\<noteq>w""(x,w)\<in>r""Min?U=frac(vw)" byauto with\<open>(x,y)\<notin>r\<close>transhave**:"(w,y)\<notin>r"unfoldingtrans_defbyblast fromMin_in[OFfin(2)\<open>?U\<noteq>{}\<close>]Max_in[OFfin(1)\<open>?L\<noteq>{}\<close>]frac_lt_1 have"0\<le>Max?L""Max?L<1""0\<le>Min?U""Min?U<1"byauto thenhave"0\<le>(Max?L+Min?U)/2""(Max?L+Min?U)/2<1"byauto thenhave***:"frac((Max?L+Min?U)/2)=(Max?L+Min?U)/2"unfoldingfrac_eq.. fromywhave"y\<in>?X\<^sub>0'""w\<in>?X\<^sub>0'"byauto withv**havelt:"frac(vy)<frac(vw)"byfastforce fromdLuhave"d=((c+c)+(Max?L+Min?U))/2"byauto alsohave"\<dots>=c+(Max?L+Min?U)/2"bysimp finallyhave"fracd=frac((Max?L+Min?U)/2)"by(simpadd:frac_nat_add_id) alsohave"\<dots>=(Max?L+Min?U)/2"using***bysimp alsohave"\<dots>>(Max?L+frac(vy))/2"usingltw(4)byauto finallyhave"fracd>frac(vy)"usingMax_ge[OFfin(1)\<open>frac(vy)\<in>?L\<close>]byauto thenshowFalseusingAbyauto qed qed qed }noted_frac_equiv=this havefrac_l:"frac?l\<le>fracd" proof(cases"?L={}") caseTrue noteT=this show?thesis proof(cases"?U={}") caseTrue withThave"?l=?u"byauto withdhave"d=?l"byauto thenshow?thesisbyauto next caseFalse withThave"frac?l=0"byauto moreoverhave"fracd\<ge>0"byauto ultimatelyshow?thesisbylinarith qed next caseFalse noteF=this thenhavel:"?l=c+Max?L""frac?l=Max?L"usingMax_in[OFfin(1)\<open>?L\<noteq>{}\<close>] by(autosimp:frac_nat_add_idfrac_frac) fromL_intv[OFF]have*:"0<Max?L""Max?L<1"byauto show?thesis proof(cases"?U={}") caseTrue fromTrueFhave"?u=c+1"byauto withldhave"d=((c+c)+(Max?L+1))/2"byauto alsohave"\<dots>=c+(1+Max?L)/2"bysimp finallyhave"fracd=frac((1+Max?L)/2)"by(simpadd:frac_nat_add_id) alsohave"\<dots>=(1+Max?L)/2"using*unfoldingfrac_eqbyauto alsohave"\<dots>>Max?L"using*byauto finallyshow"fracd\<ge>frac?l"usinglbyauto next caseFalse thenhaveu:"?u=c+Min?U""frac?u=Min?U"usingMin_in[OFfin(2)False] by(autosimp:frac_nat_add_idfrac_frac) fromU_intv[OFFalse]have**:"0<Min?U""Min?U<1"byauto fromludhave"d=((c+c)+(Max?L+Min?U))/2"byauto alsohave"\<dots>=c+(Max?L+Min?U)/2"bysimp finallyhave"fracd=frac((Max?L+Min?U)/2)"by(simpadd:frac_nat_add_id) alsohave"\<dots>=(Max?L+Min?U)/2"using***unfoldingfrac_eqbyauto alsohave"\<dots>\<ge>Max?L"usingl_le_u[OFFFalse]byauto finallyshow?thesisusinglbyauto qed qed havefrac_u:"?U\<noteq>{}\<or>?L={}\<longrightarrow>fracd\<le>frac?u" proof(cases"?U={}") caseTrue noteT=this show?thesis proof(cases"?L={}") caseTrue withThave"?l=?u"byauto withdhave"d=?u"byauto thenshow?thesisbyauto next caseFalse withTshow?thesisbyauto qed next caseFalse noteF=this thenhaveu:"?u=c+Min?U""frac?u=Min?U"usingMin_in[OFfin(2)\<open>?U\<noteq>{}\<close>] by(autosimp:frac_nat_add_idfrac_frac) fromU_intv[OFF]have*:"0<Min?U""Min?U<1"byauto show?thesis proof(cases"?L={}") caseTrue fromTrueFhave"?l=c"byauto withudhave"d=((c+c)+Min?U)/2"byauto alsohave"\<dots>=c+Min?U/2"bysimp finallyhave"fracd=frac(Min?U/2)"by(simpadd:frac_nat_add_id) alsohave"\<dots>=Min?U/2"unfoldingfrac_equsing*byauto alsohave"\<dots>\<le>Min?U"using\<open>0<Min?U\<close>byauto finallyhave"fracd\<le>frac?u"usingubyauto thenshow?thesisbyauto next caseFalse thenhavel:"?l=c+Max?L""frac?l=Max?L"usingMax_in[OFfin(1)False] by(autosimp:frac_nat_add_idfrac_frac) fromL_intv[OFFalse]have**:"0<Max?L""Max?L<1"byauto fromludhave"d=((c+c)+(Max?L+Min?U))/2"byauto alsohave"\<dots>=c+(Max?L+Min?U)/2"bysimp finallyhave"fracd=frac((Max?L+Min?U)/2)"by(simpadd:frac_nat_add_id) alsohave"\<dots>=(Max?L+Min?U)/2"using***unfoldingfrac_eqbyauto alsohave"\<dots>\<le>Min?U"usingl_le_u[OFFalseF]byauto finallyshow?thesisusingubyauto qed qed have"\<forall>y\<in>?X\<^sub>0-{x}.(y,x)\<in>r\<longleftrightarrow>frac(vy)\<le>fracd" proof(safe,goal_cases) case(1yk) withL_bound[ofy]frac_lshow?casebyauto next case(2yk) show?case proof(ruleccontr,goal_cases) case1 withtotal2\<open>x\<in>X\<close>Intvhave"(x,y)\<in>r"unfoldingtotal_on_defbyauto with2U_bound[ofy]have"?U\<noteq>{}""frac?u\<le>frac(vy)"byauto withfrac_uhave"fracd\<le>frac(vy)"byauto with2d_frac_equiv1showFalsebyauto qed qed moreoverhave"\<forall>y\<in>?X\<^sub>0-{x}.(x,y)\<in>r\<longleftrightarrow>fracd\<le>frac(vy)" proof(safe,goal_cases) case(1yk) thenhave"?U\<noteq>{}"byauto with1U_bound[ofy]frac_ushow?casebyauto next case(2yk) show?case proof(ruleccontr,goal_cases) case1 withtotal2\<open>x\<in>X\<close>Intvhave"(y,x)\<in>r"unfoldingtotal_on_defbyauto with2L_bound[ofy]have"frac(vy)\<le>frac?l"byauto withfrac_lhave"frac(vy)\<le>fracd"byauto with2d_frac_equiv1showFalsebyauto qed qed ultimatelyhaved: "c<d""d<c+1""\<forall>y\<in>?X\<^sub>0-{x}.(y,x)\<in>r\<longleftrightarrow>frac(vy)\<le>fracd" "\<forall>y\<in>?X\<^sub>0-{x}.(x,y)\<in>r\<longleftrightarrow>fracd\<le>frac(vy)" usingd3byauto let?v="v(x:=d)" have"?v\<in>regionXIr" proof(standard,goal_cases) case1 from\<open>d\<ge>0\<close>vshow?casebyauto next case2 show?case proof(safe,goal_cases) case(1y) withvhave"intv_elemyv(?Iy)"byfast withIntvd(1,2)show"intv_elemy?v(Iy)"by(cases"x=y",auto)(cases"Iy",auto) qed next from\<open>x\<in>X\<close>Intvshow"?X\<^sub>0'\<union>{x}=?X\<^sub>0"byauto withr_subsethave"r\<subseteq>(?X\<^sub>0'\<union>{x})\<times>(?X\<^sub>0'\<union>{x})"byauto have"\<forall>x\<in>?X\<^sub>0'.\<forall>y\<in>?X\<^sub>0'.(x,y)\<in>r\<longleftrightarrow>(x,y)\<in>?r"byauto withvhave"\<forall>x\<in>?X\<^sub>0'.\<forall>y\<in>?X\<^sub>0'.(x,y)\<in>r\<longleftrightarrow>frac(vx)\<le>frac(vy)"byfastforce thenhave"\<forall>x\<in>?X\<^sub>0'.\<forall>y\<in>?X\<^sub>0'.(x,y)\<in>r\<longleftrightarrow>frac(?vx)\<le>frac(?vy)"byauto withd(3,4)show"\<forall>y\<in>?X\<^sub>0'\<union>{x}.\<forall>z\<in>?X\<^sub>0'\<union>{x}.(y,z)\<in>r\<longleftrightarrow>frac(?vy)\<le>frac(?vz)" proof(auto,goal_cases) case1 fromrefl\<open>x\<in>X\<close>Intvshow?caseby(autosimp:refl_on_def) qed qed thenshow?thesisbyauto qed thenobtaindwhere"v(x:=d)\<in>R"usingRbyauto thenhave"(v(x:=d))(x:=c)\<in>region_setRxc"unfoldingregion_set_defbyblast moreoverfromv\<open>x\<in>X\<close>have"(v(x:=d))(x:=c)=v"byfastforce ultimatelyhave"v\<in>region_setRxc"bysimp }
ultimatelyhave"region_setRxc=regionX?I?r"byblast withvalid\<R>_defhave*:"region_setRxc\<in>\<R>"byauto moreoverfromassmshave**:"v(x:=c)\<in>region_setRxc"unfoldingregion_set_defbyauto ultimatelyshow"[v(x:=c)]\<^sub>\<R>=region_setRxc""[v(x:=c)]\<^sub>\<R>\<in>\<R>""v(x:=c)\<in>[v(x:=c)]\<^sub>\<R>" usingregion_unique[OF_***]\<R>_defbyauto qed
definitionregion_set' where "region_set'Rrc={[r\<rightarrow>c]v|v.v\<in>R}"
lemmaregion_set'_id: fixesXkandc::nat defines"\<R>\<equiv>{regionXIr|Ir.valid_regionXkIr}" assumes"R\<in>\<R>""v\<in>R""finiteX""0\<le>c""\<forall>x\<in>setr.c\<le>kx""setr\<subseteq>X" shows"[[r\<rightarrow>c]v]\<^sub>\<R>=region_set'Rrc\<and>[[r\<rightarrow>c]v]\<^sub>\<R>\<in>\<R>\<and>[r\<rightarrow>c]v\<in>[[r\<rightarrow>c]v]\<^sub>\<R>"usingassms proof(inductionr) caseNil fromregions_closed[OF_Nil(2,3)]regions_closed'[OF_Nil(2,3)]region_unique[OF_Nil(3,2)]Nil(1) have"[v]\<^sub>\<R>=R""[v\<oplus>0]\<^sub>\<R>\<in>\<R>""(v\<oplus>0)\<in>[v\<oplus>0]\<^sub>\<R>"byauto thenshow?caseunfoldingregion_set'_defcval_add_defbysimp next case(Consxxs) thenhave"[[xs\<rightarrow>c]v]\<^sub>\<R>=region_set'Rxsc""[[xs\<rightarrow>c]v]\<^sub>\<R>\<in>\<R>""[xs\<rightarrow>c]v\<in>[[xs\<rightarrow>c]v]\<^sub>\<R>"byforce+ noteIH=this[unfolded\<R>_def] let?v="([xs\<rightarrow>c]v)(x:=c)" fromregion_set_id[OFIH(2,3)\<open>finiteX\<close>\<open>c\<ge>0\<close>,ofx]\<R>_defCons.prems(5,6) have"[?v]\<^sub>\<R>=region_set([[xs\<rightarrow>realc]v]\<^sub>\<R>)xc""[?v]\<^sub>\<R>\<in>\<R>""?v\<in>[?v]\<^sub>\<R>"byauto moreoverhave"region_set'R(x#xs)(realc)=region_set([[xs\<rightarrow>realc]v]\<^sub>\<R>)xc" unfoldingregion_set_defregion_set'_def proof(safe,goal_cases) case(1yu) let?u="[xs\<rightarrow>realc]u" have"[x#xs\<rightarrow>realc]u=?u(x:=realc)"byauto moreoverfromIH(1)1have"?u\<in>[[xs\<rightarrow>realc]v]\<^sub>\<R>"unfolding\<R>_defregion_set'_defbyauto ultimatelyshow?casebyauto next case(2yu) withIH(1)[unfoldedregion_set'_def\<R>_def[symmetric]]show?casebyauto qed moreoverhave"[x#xs\<rightarrow>realc]v=?v"bysimp ultimatelyshow?casebypresburger qed
havevalid:"valid_regionXk'?I?r" proof show"?X\<^sub>0'=?X\<^sub>0'"byauto next show"?r\<subseteq>?X\<^sub>0'\<times>?X\<^sub>0'" usingr_subsetbyauto next fromreflshow"refl_on?X\<^sub>0'?r"unfoldingrefl_on_defbyauto next fromtransshow"trans?r"unfoldingtrans_defbyauto next fromtotalshow"total_on?X\<^sub>0'?r"unfoldingtotal_on_defbyauto next fromR(2)have"\<forall>x\<in>X.valid_intv(kx)(Ix)"byauto thenshow"\<forall>x\<in>X.valid_intv(k'x)(?Ix)" applysafe subgoalforx' using\<open>\<forall>y.y\<notin>setcs\<longrightarrow>ky\<ge>k'y\<close> by(cases"Ix'";force) done qed
{fixvassumev:"v\<in>region_set'Rcsc" withR(1)obtainv'wherev':"v'\<in>regionXIr""v=[cs\<rightarrow>c]v'" unfoldingregion_set'_defbyauto have"v\<in>regionX?I?r" proof(standard,goal_cases) case1 fromv'\<open>0\<le>c\<close>show?case apply- applyrule subgoalforx by(cases"x\<in>setcs")auto done next case2 fromv'show?case apply- applyrule subgoalforx' by(cases"Ix'";cases"x'\<in>setcs";force) done next show"?X\<^sub>0'=?X\<^sub>0'"byauto next fromv'show"\<forall>y\<in>?X\<^sub>0'.\<forall>z\<in>?X\<^sub>0'.(y,z)\<in>?r\<longleftrightarrow>frac(vy)\<le>frac(vz)"byauto qed } thenhave"region_set'Rcsc\<subseteq>regionX?I?r"byblast moreoverfromvalidhave*:"regionX?I?r\<in>\<R>'"unfolding\<R>'_defbyblast moreoverfromassmshave**:"[cs\<rightarrow>c]v\<in>region_set'Rcsc"unfoldingregion_set'_defbyauto ultimatelyshow "[[cs\<rightarrow>c]v]\<^sub>\<R>'\<supseteq>region_set'Rcsc""[[cs\<rightarrow>c]v]\<^sub>\<R>'\<in>\<R>'""[cs\<rightarrow>c]v\<in>[[cs\<rightarrow>c]v]\<^sub>\<R>'" usingregion_unique[of\<R>',OF__*,unfolded\<R>'_def,OFHOL.refl] unfolding\<R>'_def[symmetric]byauto qed
section\<open>ASemanticsBasedonRegions\<close>
subsection\<open>Singlestep\<close>
inductivestep_r:: "('a,'c,t,'s)ta\<Rightarrow>('c,t)zoneset\<Rightarrow>'s\<Rightarrow>('c,t)zone\<Rightarrow>'s\<Rightarrow>('c,t)zone\<Rightarrow>bool" (\<open>_,_\<turnstile>\<langle>_,_\<rangle>\<leadsto>\<langle>_,_\<rangle>\<close>[61,61,61,61]61) where step_t_r: "\<lbrakk>\<R>={regionXIr|Ir.valid_regionXkIr};valid_abstractionAXk;R\<in>\<R>;R'\<in>Succ\<R>R; R'\<subseteq>\<lbrace>inv_ofAl\<rbrace>\<rbrakk>\<Longrightarrow>A,\<R>\<turnstile>\<langle>l,R\<rangle>\<leadsto>\<langle>l,R'\<rangle>"| step_a_r: "\<lbrakk>\<R>={regionXIr|Ir.valid_regionXkIr};valid_abstractionAXk;A\<turnstile>l\<longrightarrow>\<^bsup>g,a,r\<^esup>l';R\<in>\<R>\<rbrakk> \<Longrightarrow>A,\<R>\<turnstile>\<langle>l,R\<rangle>\<leadsto>\<langle>l',region_set'(R\<inter>{u.u\<turnstile>g})r0\<inter>{u.u\<turnstile>inv_ofAl'}\<rangle>"
lemma: "\>n1\<le>nMsg. \>x\<in>X.ux\<ge>0\<rbrakk>\<Longrightarrow>\<exists>R'.A,\<R>\<turnstile>\<langle>l,([u]\<^sub>\<R>)\<rangle>\<leadsto>*\<langle>l',R'\<rangle>\<and>u'\<in>R'" proof(inductionrule:steps.induct) case(reflAlu) fromregion_covercex!" next tep''lu) fromstep_r_complete[OFstephaveCond1:"nMsg-)-1" "A,\<Suc_eq_plus1less_diff_convnMsgNotZeroneq0_convjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 bycexmsgInSetSet1java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 withstep(4)\<open>u'\<in>R'\<close>have"\<forallexecution.firstOccurrence_def[oftrans"sends withstepobtainR''whereR'':"A,\<R>\<turnstile>\<langle>l',([u']\<^sub>\<R>)\<rangle>\<leadsto>*\<langle>l'',R''\haveShorterTrace:"lengthftindex withregion_unique[OFstep(4)R'(2,3)]R'(1)have"A,\<R>\<turnstile>\<langle<longrightarrowmsg\<noteq>((ftindex)!n')" by(subststeps_r_alt)auto withR'java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 qed
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.