[STATEMENT]
lemma const_poly_dvd_const_poly_iff [simp]: "[:a:] dvd [:b:] \<longleftrightarrow> a dvd b"
  for a b :: "'a::{comm_semiring_1,semiring_no_zero_divisors}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([:a:] dvd [:b:]) = (a dvd b)
[PROOF STEP]
by (subst const_poly_dvd_iff) (auto simp: coeff_pCons split: nat.splits)


[STATEMENT]
lemma finite_supp_map_bset_S_transform [simp]:
  assumes "finite (supp xset)"
  shows "finite (supp (map_bset S_transform xset))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (supp (map_bset S_transform xset))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (supp (map_bset S_transform xset))
[PROOF STEP]
have "eqvt map_bset" and "eqvt S_transform"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eqvt map_bset &&& eqvt S_transform
[PROOF STEP]
by (simp add: eqvtI)+
[PROOF STATE]
proof (state)
this:
eqvt map_bset
eqvt S_transform

goal (1 subgoal):
 1. finite (supp (map_bset S_transform xset))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eqvt map_bset
eqvt S_transform
[PROOF STEP]
have "supp (map_bset S_transform) = {}"
[PROOF STATE]
proof (prove)
using this:
eqvt map_bset
eqvt S_transform

goal (1 subgoal):
 1. supp (map_bset S_transform) = {}
[PROOF STEP]
using supp_fun_eqvt supp_fun_app_eqvt
[PROOF STATE]
proof (prove)
using this:
eqvt map_bset
eqvt S_transform
eqvt ?f \<Longrightarrow> supp ?f = {}
eqvt ?f \<Longrightarrow> supp (?f ?x) \<subseteq> supp ?x

goal (1 subgoal):
 1. supp (map_bset S_transform) = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
supp (map_bset S_transform) = {}

goal (1 subgoal):
 1. finite (supp (map_bset S_transform xset))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
supp (map_bset S_transform) = {}
[PROOF STEP]
have "supp (map_bset S_transform xset) \<subseteq> supp xset"
[PROOF STATE]
proof (prove)
using this:
supp (map_bset S_transform) = {}

goal (1 subgoal):
 1. supp (map_bset S_transform xset) \<subseteq> supp xset
[PROOF STEP]
using supp_fun_app
[PROOF STATE]
proof (prove)
using this:
supp (map_bset S_transform) = {}
supp (?f ?x) \<subseteq> supp ?f \<union> supp ?x

goal (1 subgoal):
 1. supp (map_bset S_transform xset) \<subseteq> supp xset
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
supp (map_bset S_transform xset) \<subseteq> supp xset

goal (1 subgoal):
 1. finite (supp (map_bset S_transform xset))
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite (supp xset)
supp (map_bset S_transform xset) \<subseteq> supp xset
[PROOF STEP]
show "finite (supp (map_bset S_transform xset))"
[PROOF STATE]
proof (prove)
using this:
finite (supp xset)
supp (map_bset S_transform xset) \<subseteq> supp xset

goal (1 subgoal):
 1. finite (supp (map_bset S_transform xset))
[PROOF STEP]
by (metis finite_subset)
[PROOF STATE]
proof (state)
this:
finite (supp (map_bset S_transform xset))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zip_null_gr: "\<lbrakk>length xs = k; length ys = k; zip xs ys \<noteq> []\<rbrakk> \<Longrightarrow> 0 < k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = k; length ys = k; zip xs ys \<noteq> []\<rbrakk> \<Longrightarrow> 0 < k
[PROOF STEP]
apply(cases xs, simp, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma foldr_option_Cons_SomeE:
  assumes "foldr_option f (x#xs) e = Some y"
  obtains y' where "foldr_option f xs e = Some y'" and "f x y' = Some y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y'. \<lbrakk>foldr_option f xs e = Some y'; f x y' = Some y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
foldr_option f (x # xs) e = Some y

goal (1 subgoal):
 1. (\<And>y'. \<lbrakk>foldr_option f xs e = Some y'; f x y' = Some y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding foldr_option_def
[PROOF STATE]
proof (prove)
using this:
foldr (\<lambda>a b. Option.bind b (f a)) (x # xs) (Some e) = Some y

goal (1 subgoal):
 1. (\<And>y'. \<lbrakk>foldr (\<lambda>a b. Option.bind b (f a)) xs (Some e) = Some y'; f x y' = Some y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: bind_eq_SomeE)


[STATEMENT]
lemma block_sum_sadd_bound:
  shows "\<forall>t. (\<Sum>S+ p j (\<lambda>k. nth_digit (s k) t b)) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t. \<Sum>S+ p j (\<lambda>k. nth_digit (s k) t b)  \<le> 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>t. \<Sum>S+ p j (\<lambda>k. nth_digit (s k) t b)  \<le> 1
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>t. \<Sum>S+ p j (\<lambda>k. nth_digit (s k) t b)  \<le> 1
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>t. \<Sum>S+ p j (\<lambda>k. nth_digit (s k) t b)  \<le> 1
[PROOF STEP]
have "(\<Sum>S+ p j (\<lambda>k. Seq k t)) \<le> (\<Sum>k\<le>length p - 1. Seq k t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>S+ p j (\<lambda>k. Seq k t)  \<le> (\<Sum>k\<le>length p - 1. Seq k t)
[PROOF STEP]
unfolding sum_sadd.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..length p - 1. if isadd (p ! k) \<and> j = goes_to (p ! k) then Seq k t else 0) \<le> (\<Sum>k\<le>length p - 1. Seq k t)
[PROOF STEP]
by (simp add: atMost_atLeast0 sum_mono)
[PROOF STATE]
proof (state)
this:
\<Sum>S+ p j (\<lambda>k. Seq k t)  \<le> (\<Sum>k\<le>length p - 1. Seq k t)

goal (1 subgoal):
 1. \<forall>t. \<Sum>S+ p j (\<lambda>k. nth_digit (s k) t b)  \<le> 1
[PROOF STEP]
hence "(\<Sum>S+ p j (\<lambda>k. Seq k t)) \<le> 1"
[PROOF STATE]
proof (prove)
using this:
\<Sum>S+ p j (\<lambda>k. Seq k t)  \<le> (\<Sum>k\<le>length p - 1. Seq k t)

goal (1 subgoal):
 1. \<Sum>S+ p j (\<lambda>k. Seq k t)  \<le> 1
[PROOF STEP]
using sum_sk_bound[of t] Seq_def
[PROOF STATE]
proof (prove)
using this:
\<Sum>S+ p j (\<lambda>k. Seq k t)  \<le> (\<Sum>k\<le>length p - 1. Seq k t)
(\<Sum>k\<le>length p - 1. nth_digit (s k) t b) \<le> 1
Seq = (\<lambda>k t. nth_digit (s k) t b)

goal (1 subgoal):
 1. \<Sum>S+ p j (\<lambda>k. Seq k t)  \<le> 1
[PROOF STEP]
using dual_order.trans
[PROOF STATE]
proof (prove)
using this:
\<Sum>S+ p j (\<lambda>k. Seq k t)  \<le> (\<Sum>k\<le>length p - 1. Seq k t)
(\<Sum>k\<le>length p - 1. nth_digit (s k) t b) \<le> 1
Seq = (\<lambda>k t. nth_digit (s k) t b)
\<lbrakk>?b \<le> ?a; ?c \<le> ?b\<rbrakk> \<Longrightarrow> ?c \<le> ?a

goal (1 subgoal):
 1. \<Sum>S+ p j (\<lambda>k. Seq k t)  \<le> 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<Sum>S+ p j (\<lambda>k. Seq k t)  \<le> 1

goal (1 subgoal):
 1. \<forall>t. \<Sum>S+ p j (\<lambda>k. nth_digit (s k) t b)  \<le> 1
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<Sum>S+ p j (\<lambda>k. Seq k ?t2)  \<le> 1

goal (1 subgoal):
 1. \<forall>t. \<Sum>S+ p j (\<lambda>k. nth_digit (s k) t b)  \<le> 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Sum>S+ p j (\<lambda>k. Seq k ?t2)  \<le> 1

goal (1 subgoal):
 1. \<forall>t. \<Sum>S+ p j (\<lambda>k. nth_digit (s k) t b)  \<le> 1
[PROOF STEP]
using Seq_def
[PROOF STATE]
proof (prove)
using this:
\<Sum>S+ p j (\<lambda>k. Seq k ?t2)  \<le> 1
Seq = (\<lambda>k t. nth_digit (s k) t b)

goal (1 subgoal):
 1. \<forall>t. \<Sum>S+ p j (\<lambda>k. nth_digit (s k) t b)  \<le> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>t. \<Sum>S+ p j (\<lambda>k. nth_digit (s k) t b)  \<le> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vector_add_component [simp]: "(x + y)$i = x$i + y$i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) $ i = x $ i + y $ i
[PROOF STEP]
unfolding plus_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i. x $ i + y $ i) $ i = x $ i + y $ i
[PROOF STEP]
by simp


[STATEMENT]
lemma filterlim_tendsto_add_at_bot_iff:
  fixes c::real
  assumes f: "(f \<longlongrightarrow> c) F"
  shows "(LIM x F. f x + g x :> at_bot) \<longleftrightarrow> (LIM x F. g x :> at_bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LIM x F. f x + g x :> at_bot) = filterlim g at_bot F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (LIM x F. f x + g x :> at_bot) = filterlim g at_bot F
[PROOF STEP]
have "(LIM x F. f x + g x :> at_bot)
        \<longleftrightarrow>  (LIM x F. - f x + (- g x)  :> at_top)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LIM x F. f x + g x :> at_bot) = (LIM x F. - f x + - g x :> at_top)
[PROOF STEP]
apply (subst filterlim_uminus_at_top)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LIM x F. f x + g x :> at_bot) = (LIM x F. - (- f x + - g x) :> at_bot)
[PROOF STEP]
by (rule filterlim_cong,auto)
[PROOF STATE]
proof (state)
this:
(LIM x F. f x + g x :> at_bot) = (LIM x F. - f x + - g x :> at_top)

goal (1 subgoal):
 1. (LIM x F. f x + g x :> at_bot) = filterlim g at_bot F
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(LIM x F. f x + g x :> at_bot) = (LIM x F. - f x + - g x :> at_top)

goal (1 subgoal):
 1. (LIM x F. f x + g x :> at_bot) = filterlim g at_bot F
[PROOF STEP]
have "... = (LIM x F. - g x  :> at_top)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LIM x F. - f x + - g x :> at_top) = (LIM x F. - g x :> at_top)
[PROOF STEP]
apply (subst filterlim_tendsto_add_at_top_iff[of _ "-c"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((\<lambda>x. - f x) \<longlongrightarrow> - c) F
 2. (LIM x F. - g x :> at_top) = (LIM x F. - g x :> at_top)
[PROOF STEP]
by (auto intro:tendsto_intros simp add:f)
[PROOF STATE]
proof (state)
this:
(LIM x F. - f x + - g x :> at_top) = (LIM x F. - g x :> at_top)

goal (1 subgoal):
 1. (LIM x F. f x + g x :> at_bot) = filterlim g at_bot F
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(LIM x F. - f x + - g x :> at_top) = (LIM x F. - g x :> at_top)

goal (1 subgoal):
 1. (LIM x F. f x + g x :> at_bot) = filterlim g at_bot F
[PROOF STEP]
have "... = (LIM x F. g x  :> at_bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LIM x F. - g x :> at_top) = filterlim g at_bot F
[PROOF STEP]
apply (subst filterlim_uminus_at_top)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LIM x F. - (- g x) :> at_bot) = filterlim g at_bot F
[PROOF STEP]
by (rule filterlim_cong,auto)
[PROOF STATE]
proof (state)
this:
(LIM x F. - g x :> at_top) = filterlim g at_bot F

goal (1 subgoal):
 1. (LIM x F. f x + g x :> at_bot) = filterlim g at_bot F
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(LIM x F. f x + g x :> at_bot) = filterlim g at_bot F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(LIM x F. f x + g x :> at_bot) = filterlim g at_bot F

goal (1 subgoal):
 1. (LIM x F. f x + g x :> at_bot) = filterlim g at_bot F
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(LIM x F. f x + g x :> at_bot) = filterlim g at_bot F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_Taylor_1_lower_bound:
  fixes x :: real
  assumes "0 \<le> x"
    shows "(x - x ^ 3 / 6) \<le> sin x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - x ^ 3 / 6 \<le> sin x
[PROOF STEP]
apply (rule gen_lower_bound_increasing [OF assms])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> ((\<lambda>x. x - x ^ 3 / 6 - sin x) has_real_derivative ?g y) (at y)
 2. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> ?g y \<le> 0
 3. 0 - 0 ^ 3 / 6 = sin 0
[PROOF STEP]
apply (intro derivative_eq_intros)
[PROOF STATE]
proof (prove)
goal (12 subgoals):
 1. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> 1 = ?f'11 y
 2. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> 1 = ?D18 y
 3. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> real 3 * (?D18 y * y ^ (3 - Suc 0)) = ?D13 y
 4. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> 0 = ?E13 y
 5. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> 6 \<noteq> 0
 6. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> (?D13 y * 6 - y ^ 3 * ?E13 y) / (6 * 6) = ?g'11 y
 7. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> ?f'11 y - ?g'11 y = ?f'5 y
 8. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> 1 = ?Db7 y
 9. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> cos y * ?Db7 y = ?g'5 y
 10. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> ?f'5 y - ?g'5 y = ?g y
A total of 12 subgoals...
[PROOF STEP]
apply (rule refl | simp add: cos_Taylor_1_lower_bound)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem LT3: assumes h: "\<turnstile> F \<longrightarrow> G" shows "\<turnstile> F \<leadsto> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> F \<leadsto> G
[PROOF STEP]
unfolding leadsto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<box>(F \<longrightarrow> \<diamond>G)
[PROOF STEP]
by (rule alw[OF LT2[OF h]])


[STATEMENT]
lemma UP_one_not_zero:
  "\<one>\<^bsub>P\<^esub> \<noteq> \<zero>\<^bsub>P\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one>\<^bsub>P\<^esub> \<noteq> \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<one>\<^bsub>P\<^esub> = \<zero>\<^bsub>P\<^esub> \<Longrightarrow> False
[PROOF STEP]
assume "\<one>\<^bsub>P\<^esub> = \<zero>\<^bsub>P\<^esub>"
[PROOF STATE]
proof (state)
this:
\<one>\<^bsub>P\<^esub> = \<zero>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. \<one>\<^bsub>P\<^esub> = \<zero>\<^bsub>P\<^esub> \<Longrightarrow> False
[PROOF STEP]
hence "coeff P \<one>\<^bsub>P\<^esub> 0 = (coeff P \<zero>\<^bsub>P\<^esub> 0)"
[PROOF STATE]
proof (prove)
using this:
\<one>\<^bsub>P\<^esub> = \<zero>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. coeff P \<one>\<^bsub>P\<^esub> 0 = coeff P \<zero>\<^bsub>P\<^esub> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coeff P \<one>\<^bsub>P\<^esub> 0 = coeff P \<zero>\<^bsub>P\<^esub> 0

goal (1 subgoal):
 1. \<one>\<^bsub>P\<^esub> = \<zero>\<^bsub>P\<^esub> \<Longrightarrow> False
[PROOF STEP]
hence "\<one> = \<zero>"
[PROOF STATE]
proof (prove)
using this:
coeff P \<one>\<^bsub>P\<^esub> 0 = coeff P \<zero>\<^bsub>P\<^esub> 0

goal (1 subgoal):
 1. \<one> = \<zero>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<one> = \<zero>

goal (1 subgoal):
 1. \<one>\<^bsub>P\<^esub> = \<zero>\<^bsub>P\<^esub> \<Longrightarrow> False
[PROOF STEP]
with R.one_not_zero
[PROOF STATE]
proof (chain)
picking this:
\<one> \<noteq> \<zero>
\<one> = \<zero>
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
\<one> \<noteq> \<zero>
\<one> = \<zero>

goal (1 subgoal):
 1. False
[PROOF STEP]
by contradiction
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma C_merge_adj: "\<forall>xs \<in> set xss. length xs = m \<Longrightarrow> C_merge_adj xss \<le> m * length xss"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xs\<in>set xss. length xs = m \<Longrightarrow> C_merge_adj xss \<le> m * length xss
[PROOF STEP]
proof(induction xss rule: C_merge_adj.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<forall>xs\<in>set []. length xs = m \<Longrightarrow> C_merge_adj [] \<le> m * length []
 2. \<And>xs. \<forall>xs\<in>set [xs]. length xs = m \<Longrightarrow> C_merge_adj [xs] \<le> m * length [xs]
 3. \<And>xs ys zss. \<lbrakk>\<forall>xs\<in>set zss. length xs = m \<Longrightarrow> C_merge_adj zss \<le> m * length zss; \<forall>xs\<in>set (xs # ys # zss). length xs = m\<rbrakk> \<Longrightarrow> C_merge_adj (xs # ys # zss) \<le> m * length (xs # ys # zss)
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
\<forall>xs\<in>set []. length xs = m

goal (3 subgoals):
 1. \<forall>xs\<in>set []. length xs = m \<Longrightarrow> C_merge_adj [] \<le> m * length []
 2. \<And>xs. \<forall>xs\<in>set [xs]. length xs = m \<Longrightarrow> C_merge_adj [xs] \<le> m * length [xs]
 3. \<And>xs ys zss. \<lbrakk>\<forall>xs\<in>set zss. length xs = m \<Longrightarrow> C_merge_adj zss \<le> m * length zss; \<forall>xs\<in>set (xs # ys # zss). length xs = m\<rbrakk> \<Longrightarrow> C_merge_adj (xs # ys # zss) \<le> m * length (xs # ys # zss)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>xs\<in>set []. length xs = m

goal (1 subgoal):
 1. C_merge_adj [] \<le> m * length []
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
C_merge_adj [] \<le> m * length []

goal (2 subgoals):
 1. \<And>xs. \<forall>xs\<in>set [xs]. length xs = m \<Longrightarrow> C_merge_adj [xs] \<le> m * length [xs]
 2. \<And>xs ys zss. \<lbrakk>\<forall>xs\<in>set zss. length xs = m \<Longrightarrow> C_merge_adj zss \<le> m * length zss; \<forall>xs\<in>set (xs # ys # zss). length xs = m\<rbrakk> \<Longrightarrow> C_merge_adj (xs # ys # zss) \<le> m * length (xs # ys # zss)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. \<forall>xs\<in>set [xs]. length xs = m \<Longrightarrow> C_merge_adj [xs] \<le> m * length [xs]
 2. \<And>xs ys zss. \<lbrakk>\<forall>xs\<in>set zss. length xs = m \<Longrightarrow> C_merge_adj zss \<le> m * length zss; \<forall>xs\<in>set (xs # ys # zss). length xs = m\<rbrakk> \<Longrightarrow> C_merge_adj (xs # ys # zss) \<le> m * length (xs # ys # zss)
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
\<forall>xs\<in>set [xs_]. length xs = m

goal (2 subgoals):
 1. \<And>xs. \<forall>xs\<in>set [xs]. length xs = m \<Longrightarrow> C_merge_adj [xs] \<le> m * length [xs]
 2. \<And>xs ys zss. \<lbrakk>\<forall>xs\<in>set zss. length xs = m \<Longrightarrow> C_merge_adj zss \<le> m * length zss; \<forall>xs\<in>set (xs # ys # zss). length xs = m\<rbrakk> \<Longrightarrow> C_merge_adj (xs # ys # zss) \<le> m * length (xs # ys # zss)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>xs\<in>set [xs_]. length xs = m

goal (1 subgoal):
 1. C_merge_adj [xs_] \<le> m * length [xs_]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
C_merge_adj [xs_] \<le> m * length [xs_]

goal (1 subgoal):
 1. \<And>xs ys zss. \<lbrakk>\<forall>xs\<in>set zss. length xs = m \<Longrightarrow> C_merge_adj zss \<le> m * length zss; \<forall>xs\<in>set (xs # ys # zss). length xs = m\<rbrakk> \<Longrightarrow> C_merge_adj (xs # ys # zss) \<le> m * length (xs # ys # zss)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs ys zss. \<lbrakk>\<forall>xs\<in>set zss. length xs = m \<Longrightarrow> C_merge_adj zss \<le> m * length zss; \<forall>xs\<in>set (xs # ys # zss). length xs = m\<rbrakk> \<Longrightarrow> C_merge_adj (xs # ys # zss) \<le> m * length (xs # ys # zss)
[PROOF STEP]
case (3 x y)
[PROOF STATE]
proof (state)
this:
\<forall>xs\<in>set zss_. length xs = m \<Longrightarrow> C_merge_adj zss_ \<le> m * length zss_
\<forall>xs\<in>set (x # y # zss_). length xs = m

goal (1 subgoal):
 1. \<And>xs ys zss. \<lbrakk>\<forall>xs\<in>set zss. length xs = m \<Longrightarrow> C_merge_adj zss \<le> m * length zss; \<forall>xs\<in>set (xs # ys # zss). length xs = m\<rbrakk> \<Longrightarrow> C_merge_adj (xs # ys # zss) \<le> m * length (xs # ys # zss)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>xs\<in>set zss_. length xs = m \<Longrightarrow> C_merge_adj zss_ \<le> m * length zss_
\<forall>xs\<in>set (x # y # zss_). length xs = m

goal (1 subgoal):
 1. C_merge_adj (x # y # zss_) \<le> m * length (x # y # zss_)
[PROOF STEP]
using C_merge_ub[of x y]
[PROOF STATE]
proof (prove)
using this:
\<forall>xs\<in>set zss_. length xs = m \<Longrightarrow> C_merge_adj zss_ \<le> m * length zss_
\<forall>xs\<in>set (x # y # zss_). length xs = m
C_merge x y \<le> length x + length y

goal (1 subgoal):
 1. C_merge_adj (x # y # zss_) \<le> m * length (x # y # zss_)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
C_merge_adj (x # y # zss_) \<le> m * length (x # y # zss_)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Int_dir_image:
assumes "inj_on f (Field r1 \<union> Field r2)"
shows "dir_image (r1 Int r2) f = (dir_image r1 f) Int (dir_image r2 f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dir_image (r1 \<inter> r2) f = dir_image r1 f \<inter> dir_image r2 f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dir_image (r1 \<inter> r2) f \<subseteq> dir_image r1 f \<inter> dir_image r2 f
 2. dir_image r1 f \<inter> dir_image r2 f \<subseteq> dir_image (r1 \<inter> r2) f
[PROOF STEP]
show "dir_image (r1 Int r2) f \<le> (dir_image r1 f) Int (dir_image r2 f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dir_image (r1 \<inter> r2) f \<subseteq> dir_image r1 f \<inter> dir_image r2 f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
inj_on f (Field r1 \<union> Field r2)

goal (1 subgoal):
 1. dir_image (r1 \<inter> r2) f \<subseteq> dir_image r1 f \<inter> dir_image r2 f
[PROOF STEP]
unfolding dir_image_def inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>Field r1 \<union> Field r2. \<forall>y\<in>Field r1 \<union> Field r2. f x = f y \<longrightarrow> x = y

goal (1 subgoal):
 1. {(f a, f b) |a b. (a, b) \<in> r1 \<inter> r2} \<subseteq> {(f a, f b) |a b. (a, b) \<in> r1} \<inter> {(f a, f b) |a b. (a, b) \<in> r2}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dir_image (r1 \<inter> r2) f \<subseteq> dir_image r1 f \<inter> dir_image r2 f

goal (1 subgoal):
 1. dir_image r1 f \<inter> dir_image r2 f \<subseteq> dir_image (r1 \<inter> r2) f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dir_image r1 f \<inter> dir_image r2 f \<subseteq> dir_image (r1 \<inter> r2) f
[PROOF STEP]
show "(dir_image r1 f) Int (dir_image r2 f) \<le> dir_image (r1 Int r2) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dir_image r1 f \<inter> dir_image r2 f \<subseteq> dir_image (r1 \<inter> r2) f
[PROOF STEP]
proof(clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>(a, b) \<in> dir_image r1 f; (a, b) \<in> dir_image r2 f\<rbrakk> \<Longrightarrow> (a, b) \<in> dir_image (r1 \<inter> r2) f
[PROOF STEP]
fix a' b'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>(a, b) \<in> dir_image r1 f; (a, b) \<in> dir_image r2 f\<rbrakk> \<Longrightarrow> (a, b) \<in> dir_image (r1 \<inter> r2) f
[PROOF STEP]
assume "(a',b') \<in> dir_image r1 f" "(a',b') \<in> dir_image r2 f"
[PROOF STATE]
proof (state)
this:
(a', b') \<in> dir_image r1 f
(a', b') \<in> dir_image r2 f

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>(a, b) \<in> dir_image r1 f; (a, b) \<in> dir_image r2 f\<rbrakk> \<Longrightarrow> (a, b) \<in> dir_image (r1 \<inter> r2) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(a', b') \<in> dir_image r1 f
(a', b') \<in> dir_image r2 f
[PROOF STEP]
obtain a1 b1 a2 b2
    where 1: "a' = f a1 \<and> b' = f b1 \<and> a' = f a2 \<and> b' = f b2" and
          2: "(a1,b1) \<in> r1 \<and> (a2,b2) \<in> r2" and
          3: "{a1,b1} \<le> Field r1 \<and> {a2,b2} \<le> Field r2"
[PROOF STATE]
proof (prove)
using this:
(a', b') \<in> dir_image r1 f
(a', b') \<in> dir_image r2 f

goal (1 subgoal):
 1. (\<And>a1 b1 a2 b2. \<lbrakk>a' = f a1 \<and> b' = f b1 \<and> a' = f a2 \<and> b' = f b2; (a1, b1) \<in> r1 \<and> (a2, b2) \<in> r2; {a1, b1} \<subseteq> Field r1 \<and> {a2, b2} \<subseteq> Field r2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding dir_image_def Field_def
[PROOF STATE]
proof (prove)
using this:
(a', b') \<in> {(f a, f b) |a b. (a, b) \<in> r1}
(a', b') \<in> {(f a, f b) |a b. (a, b) \<in> r2}

goal (1 subgoal):
 1. (\<And>a1 b1 a2 b2. \<lbrakk>a' = f a1 \<and> b' = f b1 \<and> a' = f a2 \<and> b' = f b2; (a1, b1) \<in> r1 \<and> (a2, b2) \<in> r2; {a1, b1} \<subseteq> Domain r1 \<union> Range r1 \<and> {a2, b2} \<subseteq> Domain r2 \<union> Range r2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a' = f a1 \<and> b' = f b1 \<and> a' = f a2 \<and> b' = f b2
(a1, b1) \<in> r1 \<and> (a2, b2) \<in> r2
{a1, b1} \<subseteq> Field r1 \<and> {a2, b2} \<subseteq> Field r2

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>(a, b) \<in> dir_image r1 f; (a, b) \<in> dir_image r2 f\<rbrakk> \<Longrightarrow> (a, b) \<in> dir_image (r1 \<inter> r2) f
[PROOF STEP]
hence "a1 = a2 \<and> b1 = b2"
[PROOF STATE]
proof (prove)
using this:
a' = f a1 \<and> b' = f b1 \<and> a' = f a2 \<and> b' = f b2
(a1, b1) \<in> r1 \<and> (a2, b2) \<in> r2
{a1, b1} \<subseteq> Field r1 \<and> {a2, b2} \<subseteq> Field r2

goal (1 subgoal):
 1. a1 = a2 \<and> b1 = b2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a' = f a1 \<and> b' = f b1 \<and> a' = f a2 \<and> b' = f b2
(a1, b1) \<in> r1 \<and> (a2, b2) \<in> r2
{a1, b1} \<subseteq> Field r1 \<and> {a2, b2} \<subseteq> Field r2
inj_on f (Field r1 \<union> Field r2)

goal (1 subgoal):
 1. a1 = a2 \<and> b1 = b2
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
a' = f a1 \<and> b' = f b1 \<and> a' = f a2 \<and> b' = f b2
(a1, b1) \<in> r1 \<and> (a2, b2) \<in> r2
{a1, b1} \<subseteq> Field r1 \<and> {a2, b2} \<subseteq> Field r2
\<forall>x\<in>Field r1 \<union> Field r2. \<forall>y\<in>Field r1 \<union> Field r2. f x = f y \<longrightarrow> x = y

goal (1 subgoal):
 1. a1 = a2 \<and> b1 = b2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a1 = a2 \<and> b1 = b2

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>(a, b) \<in> dir_image r1 f; (a, b) \<in> dir_image r2 f\<rbrakk> \<Longrightarrow> (a, b) \<in> dir_image (r1 \<inter> r2) f
[PROOF STEP]
hence "a' = f a1 \<and> b' = f b1 \<and> (a1,b1) \<in> r1 Int r2 \<and> (a2,b2) \<in> r1 Int r2"
[PROOF STATE]
proof (prove)
using this:
a1 = a2 \<and> b1 = b2

goal (1 subgoal):
 1. a' = f a1 \<and> b' = f b1 \<and> (a1, b1) \<in> r1 \<inter> r2 \<and> (a2, b2) \<in> r1 \<inter> r2
[PROOF STEP]
using 1 2
[PROOF STATE]
proof (prove)
using this:
a1 = a2 \<and> b1 = b2
a' = f a1 \<and> b' = f b1 \<and> a' = f a2 \<and> b' = f b2
(a1, b1) \<in> r1 \<and> (a2, b2) \<in> r2

goal (1 subgoal):
 1. a' = f a1 \<and> b' = f b1 \<and> (a1, b1) \<in> r1 \<inter> r2 \<and> (a2, b2) \<in> r1 \<inter> r2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a' = f a1 \<and> b' = f b1 \<and> (a1, b1) \<in> r1 \<inter> r2 \<and> (a2, b2) \<in> r1 \<inter> r2

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>(a, b) \<in> dir_image r1 f; (a, b) \<in> dir_image r2 f\<rbrakk> \<Longrightarrow> (a, b) \<in> dir_image (r1 \<inter> r2) f
[PROOF STEP]
thus "(a',b') \<in> dir_image (r1 \<inter> r2) f"
[PROOF STATE]
proof (prove)
using this:
a' = f a1 \<and> b' = f b1 \<and> (a1, b1) \<in> r1 \<inter> r2 \<and> (a2, b2) \<in> r1 \<inter> r2

goal (1 subgoal):
 1. (a', b') \<in> dir_image (r1 \<inter> r2) f
[PROOF STEP]
unfolding dir_image_def
[PROOF STATE]
proof (prove)
using this:
a' = f a1 \<and> b' = f b1 \<and> (a1, b1) \<in> r1 \<inter> r2 \<and> (a2, b2) \<in> r1 \<inter> r2

goal (1 subgoal):
 1. (a', b') \<in> {(f a, f b) |a b. (a, b) \<in> r1 \<inter> r2}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(a', b') \<in> dir_image (r1 \<inter> r2) f

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dir_image r1 f \<inter> dir_image r2 f \<subseteq> dir_image (r1 \<inter> r2) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma split_compose:
  "(case_prod f) \<circ> (\<lambda> (a,b). ((fa a), (fb b))) = (\<lambda> (a,b). (f (fa a) (fb b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). f x y) \<circ> (\<lambda>(a, b). (fa a, fb b)) = (\<lambda>(a, b). f (fa a) (fb b))
[PROOF STEP]
by (simp add: split_def o_def)


[STATEMENT]
lemma seg_start_less_end: "i<length B \<Longrightarrow> seg_start i < seg_end i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length B \<Longrightarrow> seg_start i < seg_end i
[PROOF STEP]
unfolding seg_start_def seg_end_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length B \<Longrightarrow> B ! i < (if i + 1 = length B then length S else B ! (i + 1))
[PROOF STEP]
using B_in_bound' distinct_sorted_mono[OF B_sorted B_distinct]
[PROOF STATE]
proof (prove)
using this:
?i < length B \<Longrightarrow> B ! ?i < length S
\<lbrakk>?i < ?j; ?j < length B\<rbrakk> \<Longrightarrow> B ! ?i < B ! ?j

goal (1 subgoal):
 1. i < length B \<Longrightarrow> B ! i < (if i + 1 = length B then length S else B ! (i + 1))
[PROOF STEP]
by auto


[STATEMENT]
lemma pos_sym_diff_neg_meas_set:
  assumes "hahn_space_decomp M1 M2"
    and "hahn_space_decomp N1 N2"
  shows "neg_meas_set ((sym_diff M1 N1) \<inter> space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. neg_meas_set (sym_diff M1 N1 \<inter> space M)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hahn_space_decomp M1 M2
hahn_space_decomp N1 N2

goal (1 subgoal):
 1. neg_meas_set (sym_diff M1 N1 \<inter> space M)
[PROOF STEP]
unfolding hahn_space_decomp_def
[PROOF STATE]
proof (prove)
using this:
pos_meas_set M1 \<and> neg_meas_set M2 \<and> space M = M1 \<union> M2 \<and> M1 \<inter> M2 = {}
pos_meas_set N1 \<and> neg_meas_set N2 \<and> space M = N1 \<union> N2 \<and> N1 \<inter> N2 = {}

goal (1 subgoal):
 1. neg_meas_set (sym_diff M1 N1 \<inter> space M)
[PROOF STEP]
by (metis Int_Un_distrib2 neg_meas_set_union pos_meas_setD1
      pos_diff_neg_meas_set)


[STATEMENT]
lemma wf_less:
  "wf {(x, y). x <\<^sub>v y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf {(x, y). x <\<^sub>v y}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wf {(x, y). x <\<^sub>v y}
[PROOF STEP]
have "wf (measure sum_list)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf (measure sum_list)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
wf (measure sum_list)

goal (1 subgoal):
 1. wf {(x, y). x <\<^sub>v y}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
wf (measure sum_list)

goal (1 subgoal):
 1. wf {(x, y). x <\<^sub>v y}
[PROOF STEP]
have "{(x, y). x <\<^sub>v y} \<subseteq> measure sum_list"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, y). x <\<^sub>v y} \<subseteq> measure sum_list
[PROOF STEP]
by (auto simp: less_vec_sum_list_less)
[PROOF STATE]
proof (state)
this:
{(x, y). x <\<^sub>v y} \<subseteq> measure sum_list

goal (1 subgoal):
 1. wf {(x, y). x <\<^sub>v y}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
wf (measure sum_list)
{(x, y). x <\<^sub>v y} \<subseteq> measure sum_list
[PROOF STEP]
show "wf {(x, y). x <\<^sub>v y}"
[PROOF STATE]
proof (prove)
using this:
wf (measure sum_list)
{(x, y). x <\<^sub>v y} \<subseteq> measure sum_list

goal (1 subgoal):
 1. wf {(x, y). x <\<^sub>v y}
[PROOF STEP]
by (rule wf_subset)
[PROOF STATE]
proof (state)
this:
wf {(x, y). x <\<^sub>v y}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma absolutely_integrable_component_ubound:
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space"
  assumes f: "f integrable_on A" and g: "g absolutely_integrable_on A"
      and comp: "\<And>x b. \<lbrakk>x \<in> A; b \<in> Basis\<rbrakk> \<Longrightarrow> f x \<bullet> b \<le> g x \<bullet> b"
  shows "f absolutely_integrable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f absolutely_integrable_on A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f absolutely_integrable_on A
[PROOF STEP]
have "(\<lambda>x. g x - (g x - f x)) absolutely_integrable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. g x - (g x - f x)) absolutely_integrable_on A
[PROOF STEP]
proof (rule set_integral_diff [OF g nonnegative_absolutely_integrable])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. g x - f x) integrable_on A
 2. \<And>x b. \<lbrakk>x \<in> A; b \<in> Basis\<rbrakk> \<Longrightarrow> 0 \<le> (g x - f x) \<bullet> b
[PROOF STEP]
show "(\<lambda>x. g x - f x) integrable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. g x - f x) integrable_on A
[PROOF STEP]
using Henstock_Kurzweil_Integration.integrable_diff absolutely_integrable_on_def f g
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f integrable_on ?S; ?g integrable_on ?S\<rbrakk> \<Longrightarrow> (\<lambda>x. ?f x - ?g x) integrable_on ?S
(?f absolutely_integrable_on ?S) = (?f integrable_on ?S \<and> (\<lambda>x. norm (?f x)) integrable_on ?S)
f integrable_on A
g absolutely_integrable_on A

goal (1 subgoal):
 1. (\<lambda>x. g x - f x) integrable_on A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. g x - f x) integrable_on A

goal (1 subgoal):
 1. \<And>x b. \<lbrakk>x \<in> A; b \<in> Basis\<rbrakk> \<Longrightarrow> 0 \<le> (g x - f x) \<bullet> b
[PROOF STEP]
qed (simp add: comp inner_diff_left)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. g x - (g x - f x)) absolutely_integrable_on A

goal (1 subgoal):
 1. f absolutely_integrable_on A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. g x - (g x - f x)) absolutely_integrable_on A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. g x - (g x - f x)) absolutely_integrable_on A

goal (1 subgoal):
 1. f absolutely_integrable_on A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f absolutely_integrable_on A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma chain_boundary_simplicial_cone_of':
  assumes "f = oriented_simplex p l"
  shows "chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) =
         frag_of f
         - (if p = 0 then frag_of (\<lambda>u\<in>standard_simplex p. v)
            else simplicial_cone (p -1) v (chain_boundary p (frag_of f)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - (if p = 0 then frag_of (\<lambda>u\<in>standard_simplex p. v) else simplicial_cone (p - 1) v (chain_boundary p (frag_of f)))
[PROOF STEP]
proof (simp, intro impI conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> chain_boundary (Suc 0) (simplicial_cone 0 v (frag_of f)) = frag_of f - frag_of (\<lambda>u\<in>standard_simplex 0. v)
 2. 0 < p \<Longrightarrow> chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))
[PROOF STEP]
assume "p = 0"
[PROOF STATE]
proof (state)
this:
p = 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> chain_boundary (Suc 0) (simplicial_cone 0 v (frag_of f)) = frag_of f - frag_of (\<lambda>u\<in>standard_simplex 0. v)
 2. 0 < p \<Longrightarrow> chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))
[PROOF STEP]
have eq: "(oriented_simplex 0 (\<lambda>j. if j = 0 then v else l j)) = (\<lambda>u\<in>standard_simplex 0. v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. oriented_simplex 0 (\<lambda>j. if j = 0 then v else l j) = (\<lambda>u\<in>standard_simplex 0. v)
[PROOF STEP]
by (force simp: oriented_simplex_def standard_simplex_def)
[PROOF STATE]
proof (state)
this:
oriented_simplex 0 (\<lambda>j. if j = 0 then v else l j) = (\<lambda>u\<in>standard_simplex 0. v)

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> chain_boundary (Suc 0) (simplicial_cone 0 v (frag_of f)) = frag_of f - frag_of (\<lambda>u\<in>standard_simplex 0. v)
 2. 0 < p \<Longrightarrow> chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))
[PROOF STEP]
show "chain_boundary (Suc 0) (simplicial_cone 0 v (frag_of f))
        = frag_of f - frag_of (\<lambda>u\<in>standard_simplex 0. v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chain_boundary (Suc 0) (simplicial_cone 0 v (frag_of f)) = frag_of f - frag_of (\<lambda>u\<in>standard_simplex 0. v)
[PROOF STEP]
by (simp add: assms simplicial_cone_def chain_boundary_of \<open>p = 0\<close> simplex_cone singular_face_oriented_simplex eq cong: if_cong)
[PROOF STATE]
proof (state)
this:
chain_boundary (Suc 0) (simplicial_cone 0 v (frag_of f)) = frag_of f - frag_of (\<lambda>u\<in>standard_simplex 0. v)

goal (1 subgoal):
 1. 0 < p \<Longrightarrow> chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < p \<Longrightarrow> chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))
[PROOF STEP]
assume "0 < p"
[PROOF STATE]
proof (state)
this:
0 < p

goal (1 subgoal):
 1. 0 < p \<Longrightarrow> chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))
[PROOF STEP]
have 0: "simplex_cone (p - Suc 0) v (singular_face p x (oriented_simplex p l))
         = oriented_simplex p
              (\<lambda>j. if j < Suc x
                   then if j = 0 then v else l (j -1)
                   else if Suc j = 0 then v else l (Suc j -1))" if "x \<le> p" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simplex_cone (p - Suc 0) v (singular_face p x (oriented_simplex p l)) = oriented_simplex p (\<lambda>j. if j < Suc x then if j = 0 then v else l (j - 1) else if Suc j = 0 then v else l (Suc j - 1))
[PROOF STEP]
using \<open>0 < p\<close> that
[PROOF STATE]
proof (prove)
using this:
0 < p
x \<le> p

goal (1 subgoal):
 1. simplex_cone (p - Suc 0) v (singular_face p x (oriented_simplex p l)) = oriented_simplex p (\<lambda>j. if j < Suc x then if j = 0 then v else l (j - 1) else if Suc j = 0 then v else l (Suc j - 1))
[PROOF STEP]
by (auto simp: Suc_leI singular_face_oriented_simplex simplex_cone oriented_simplex_eq)
[PROOF STATE]
proof (state)
this:
?x \<le> p \<Longrightarrow> simplex_cone (p - Suc 0) v (singular_face p ?x (oriented_simplex p l)) = oriented_simplex p (\<lambda>j. if j < Suc ?x then if j = 0 then v else l (j - 1) else if Suc j = 0 then v else l (Suc j - 1))

goal (1 subgoal):
 1. 0 < p \<Longrightarrow> chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))
[PROOF STEP]
have 1: "frag_extend (frag_of \<circ> simplex_cone (p - Suc 0) v)
                     (\<Sum>k = 0..p. frag_cmul ((-1) ^ k) (frag_of (singular_face p k (oriented_simplex p l))))
         = - (\<Sum>k = Suc 0..Suc p. frag_cmul ((-1) ^ k)
               (frag_of (singular_face (Suc p) k (simplex_cone p v (oriented_simplex p l)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frag_extend (frag_of \<circ> simplex_cone (p - Suc 0) v) (\<Sum>k = 0..p. frag_cmul ((- 1) ^ k) (frag_of (singular_face p k (oriented_simplex p l)))) = - (\<Sum>k = Suc 0..Suc p. frag_cmul ((- 1) ^ k) (frag_of (singular_face (Suc p) k (simplex_cone p v (oriented_simplex p l)))))
[PROOF STEP]
unfolding sum.atLeast_Suc_atMost_Suc_shift
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frag_extend (frag_of \<circ> simplex_cone (p - Suc 0) v) (\<Sum>k = 0..p. frag_cmul ((- 1) ^ k) (frag_of (singular_face p k (oriented_simplex p l)))) = - sum ((\<lambda>k. frag_cmul ((- 1) ^ k) (frag_of (singular_face (Suc p) k (simplex_cone p v (oriented_simplex p l))))) \<circ> Suc) {0..p}
[PROOF STEP]
by (auto simp: 0 simplex_cone singular_face_oriented_simplex frag_extend_sum frag_extend_cmul simp flip: sum_negf)
[PROOF STATE]
proof (state)
this:
frag_extend (frag_of \<circ> simplex_cone (p - Suc 0) v) (\<Sum>k = 0..p. frag_cmul ((- 1) ^ k) (frag_of (singular_face p k (oriented_simplex p l)))) = - (\<Sum>k = Suc 0..Suc p. frag_cmul ((- 1) ^ k) (frag_of (singular_face (Suc p) k (simplex_cone p v (oriented_simplex p l)))))

goal (1 subgoal):
 1. 0 < p \<Longrightarrow> chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
frag_extend (frag_of \<circ> simplex_cone (p - Suc 0) v) (\<Sum>k = 0..p. frag_cmul ((- 1) ^ k) (frag_of (singular_face p k (oriented_simplex p l)))) = - (\<Sum>k = Suc 0..Suc p. frag_cmul ((- 1) ^ k) (frag_of (singular_face (Suc p) k (simplex_cone p v (oriented_simplex p l)))))

goal (1 subgoal):
 1. 0 < p \<Longrightarrow> chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))
[PROOF STEP]
have 2: "singular_face (Suc p) 0 (simplex_cone p v (oriented_simplex p l))
                    = oriented_simplex p l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. singular_face (Suc p) 0 (simplex_cone p v (oriented_simplex p l)) = oriented_simplex p l
[PROOF STEP]
by (simp add: simplex_cone singular_face_oriented_simplex)
[PROOF STATE]
proof (state)
this:
singular_face (Suc p) 0 (simplex_cone p v (oriented_simplex p l)) = oriented_simplex p l

goal (1 subgoal):
 1. 0 < p \<Longrightarrow> chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))
[PROOF STEP]
show "chain_boundary (Suc p) (simplicial_cone p v (frag_of f))
        = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))
[PROOF STEP]
using \<open>p > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < p

goal (1 subgoal):
 1. chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))
[PROOF STEP]
apply (simp add: assms simplicial_cone_def chain_boundary_of atMost_atLeast0 del: sum.atMost_Suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < p \<Longrightarrow> (\<Sum>k = 0..p. frag_cmul ((- 1) ^ k) (frag_of (singular_face (Suc p) k (simplex_cone p v (oriented_simplex p l))))) + frag_cmul (- ((- 1) ^ p)) (frag_of (singular_face (Suc p) (Suc p) (simplex_cone p v (oriented_simplex p l)))) = frag_of (oriented_simplex p l) - frag_extend (frag_of \<circ> simplex_cone (p - Suc 0) v) (\<Sum>k = 0..p. frag_cmul ((- 1) ^ k) (frag_of (singular_face p k (oriented_simplex p l))))
[PROOF STEP]
apply (subst sum.atLeast_Suc_atMost [of 0])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < p \<Longrightarrow> 0 \<le> p
 2. 0 < p \<Longrightarrow> frag_cmul ((- 1) ^ 0) (frag_of (singular_face (Suc p) 0 (simplex_cone p v (oriented_simplex p l)))) + (\<Sum>k = Suc 0..p. frag_cmul ((- 1) ^ k) (frag_of (singular_face (Suc p) k (simplex_cone p v (oriented_simplex p l))))) + frag_cmul (- ((- 1) ^ p)) (frag_of (singular_face (Suc p) (Suc p) (simplex_cone p v (oriented_simplex p l)))) = frag_of (oriented_simplex p l) - frag_extend (frag_of \<circ> simplex_cone (p - Suc 0) v) (\<Sum>k = 0..p. frag_cmul ((- 1) ^ k) (frag_of (singular_face p k (oriented_simplex p l))))
[PROOF STEP]
apply (simp_all add: 1 2 del: sum.atMost_Suc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_ereal_one[simp]: "\<bar>1\<bar> = (1::ereal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>1\<bar> = 1
[PROOF STEP]
unfolding one_ereal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>ereal 1\<bar> = ereal 1
[PROOF STEP]
by simp


[STATEMENT]
lemma poly_lift_0_iff[simp]: "poly_lift p = 0 \<longleftrightarrow> p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly_lift p = 0) = (p = 0)
[PROOF STEP]
unfolding poly_lift_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map_poly (\<lambda>a. [:a:]) p = 0) = (p = 0)
[PROOF STEP]
by(induct p;simp)


[STATEMENT]
lemma right_translate_sum : "g \<in> G \<Longrightarrow> (\<Sum>h\<in>G. f h) = (\<Sum>h\<in>G. f (h + g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<in> G \<Longrightarrow> sum f G = (\<Sum>h\<in>G. f (h + g))
[PROOF STEP]
using right_translate_bij[of g] bij_betw_def[of "\<lambda>h. h + g"]
        sum.reindex[of "\<lambda>h. h + g" G]
[PROOF STATE]
proof (prove)
using this:
g \<in> G \<Longrightarrow> bij_betw (\<lambda>x. x + g) G G
bij_betw (\<lambda>h. h + g) ?A ?B = (inj_on (\<lambda>h. h + g) ?A \<and> (\<lambda>h. h + g) ` ?A = ?B)
inj_on (\<lambda>h. h + g) G \<Longrightarrow> sum ?g ((\<lambda>h. h + g) ` G) = sum (?g \<circ> (\<lambda>h. h + g)) G

goal (1 subgoal):
 1. g \<in> G \<Longrightarrow> sum f G = (\<Sum>h\<in>G. f (h + g))
[PROOF STEP]
by    simp


[STATEMENT]
lemma rt_Some_sqn [dest]:
    fixes rt and ip dsn dsk flag hops nhip
  assumes "rt ip = Some (dsn, dsk, flag, hops, nhip)"
    shows "sqn rt ip = dsn"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqn rt ip = dsn
[PROOF STEP]
unfolding sqn_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case rt ip of None \<Rightarrow> 0 | Some r \<Rightarrow> \<pi>\<^sub>2 r) = dsn
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
rt ip = Some (dsn, dsk, flag, hops, nhip)

goal (1 subgoal):
 1. (case rt ip of None \<Rightarrow> 0 | Some r \<Rightarrow> \<pi>\<^sub>2 r) = dsn
[PROOF STEP]
by simp


[STATEMENT]
lemma add_positive_le_reduce1:
  assumes dA: "A \<in> carrier_mat n n" and dB: "B \<in> carrier_mat n n" and dC: "C \<in> carrier_mat n n"
    and pB: "positive B" and le: "A + B \<le>\<^sub>L C"
  shows "A \<le>\<^sub>L C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<le>\<^sub>L C
[PROOF STEP]
unfolding lowner_le_def positive_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row A = dim_row C \<and> dim_col A = dim_col C \<and> C - A \<in> carrier_mat (dim_col (C - A)) (dim_col (C - A)) \<and> (\<forall>v. dim_vec v = dim_col (C - A) \<longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v))
[PROOF STEP]
proof (auto simp add: carrier_matD[OF dA] carrier_matD[OF dC] simp del: less_eq_complex_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
have eq: "C - (A + B) = (C - A + (-B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C - (A + B) = C - A + - B
[PROOF STEP]
using dA dB dC
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. C - (A + B) = C - A + - B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C - (A + B) = C - A + - B

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
have "positive (C - (A + B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positive (C - (A + B))
[PROOF STEP]
using le lowner_le_def dA dB dC
[PROOF STATE]
proof (prove)
using this:
A + B \<le>\<^sub>L C
(?A \<le>\<^sub>L ?B) = (dim_row ?A = dim_row ?B \<and> dim_col ?A = dim_col ?B \<and> positive (?B - ?A))
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. positive (C - (A + B))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
positive (C - (A + B))

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
with eq
[PROOF STATE]
proof (chain)
picking this:
C - (A + B) = C - A + - B
positive (C - (A + B))
[PROOF STEP]
have p: "positive (C - A + (-B))"
[PROOF STATE]
proof (prove)
using this:
C - (A + B) = C - A + - B
positive (C - (A + B))

goal (1 subgoal):
 1. positive (C - A + - B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
positive (C - A + - B)

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
fix v :: "complex vec"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
assume " n = dim_vec v"
[PROOF STATE]
proof (state)
this:
n = dim_vec v

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = dim_vec v
[PROOF STEP]
have dv: "v \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
n = dim_vec v

goal (1 subgoal):
 1. v \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> carrier_vec n

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
have ge: "inner_prod v (B *\<^sub>v v) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> inner_prod v (B *\<^sub>v v)
[PROOF STEP]
using pB dv dB positive_def
[PROOF STATE]
proof (prove)
using this:
positive B
v \<in> carrier_vec n
B \<in> carrier_mat n n
positive ?A = (?A \<in> carrier_mat (dim_col ?A) (dim_col ?A) \<and> (\<forall>v. dim_vec v = dim_col ?A \<longrightarrow> 0 \<le> inner_prod v (?A *\<^sub>v v)))

goal (1 subgoal):
 1. 0 \<le> inner_prod v (B *\<^sub>v v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> inner_prod v (B *\<^sub>v v)

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
have "0 \<le> inner_prod v ((C - A + (-B)) *\<^sub>v v) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> inner_prod v ((C - A + - B) *\<^sub>v v)
[PROOF STEP]
using p positive_def dv dA dB dC
[PROOF STATE]
proof (prove)
using this:
positive (C - A + - B)
positive ?A = (?A \<in> carrier_mat (dim_col ?A) (dim_col ?A) \<and> (\<forall>v. dim_vec v = dim_col ?A \<longrightarrow> 0 \<le> inner_prod v (?A *\<^sub>v v)))
v \<in> carrier_vec n
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. 0 \<le> inner_prod v ((C - A + - B) *\<^sub>v v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> inner_prod v ((C - A + - B) *\<^sub>v v)

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 \<le> inner_prod v ((C - A + - B) *\<^sub>v v)

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
have "\<dots> = inner_prod v ((C - A)*\<^sub>v v + (-B) *\<^sub>v v) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod v ((C - A + - B) *\<^sub>v v) = inner_prod v ((C - A) *\<^sub>v v + - B *\<^sub>v v)
[PROOF STEP]
using dv dA dB dC add_mult_distrib_mat_vec[OF minus_carrier_mat[OF dA]]
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec n
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n
\<lbrakk>?B \<in> carrier_mat n n; ?v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> (?A1 - A + ?B) *\<^sub>v ?v = (?A1 - A) *\<^sub>v ?v + ?B *\<^sub>v ?v

goal (1 subgoal):
 1. inner_prod v ((C - A + - B) *\<^sub>v v) = inner_prod v ((C - A) *\<^sub>v v + - B *\<^sub>v v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inner_prod v ((C - A + - B) *\<^sub>v v) = inner_prod v ((C - A) *\<^sub>v v + - B *\<^sub>v v)

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inner_prod v ((C - A + - B) *\<^sub>v v) = inner_prod v ((C - A) *\<^sub>v v + - B *\<^sub>v v)

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
have "\<dots> = inner_prod v ((C - A) *\<^sub>v v) + inner_prod v ((-B) *\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod v ((C - A) *\<^sub>v v + - B *\<^sub>v v) = inner_prod v ((C - A) *\<^sub>v v) + inner_prod v (- B *\<^sub>v v)
[PROOF STEP]
apply (subst inner_prod_distrib_right)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. v \<in> carrier_vec ?n
 2. (C - A) *\<^sub>v v \<in> carrier_vec ?n
 3. - B *\<^sub>v v \<in> carrier_vec ?n
 4. inner_prod v ((C - A) *\<^sub>v v) + inner_prod v (- B *\<^sub>v v) = inner_prod v ((C - A) *\<^sub>v v) + inner_prod v (- B *\<^sub>v v)
[PROOF STEP]
by (rule dv, auto simp add: mult_mat_vec_carrier[OF minus_carrier_mat[OF dA]] mult_mat_vec_carrier[OF uminus_carrier_mat[OF dB]] dv)
[PROOF STATE]
proof (state)
this:
inner_prod v ((C - A) *\<^sub>v v + - B *\<^sub>v v) = inner_prod v ((C - A) *\<^sub>v v) + inner_prod v (- B *\<^sub>v v)

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inner_prod v ((C - A) *\<^sub>v v + - B *\<^sub>v v) = inner_prod v ((C - A) *\<^sub>v v) + inner_prod v (- B *\<^sub>v v)

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
have "\<dots> = inner_prod v ((C - A) *\<^sub>v v) - inner_prod v (B *\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod v ((C - A) *\<^sub>v v) + inner_prod v (- B *\<^sub>v v) = inner_prod v ((C - A) *\<^sub>v v) - inner_prod v (B *\<^sub>v v)
[PROOF STEP]
using dB dv
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat n n
v \<in> carrier_vec n

goal (1 subgoal):
 1. inner_prod v ((C - A) *\<^sub>v v) + inner_prod v (- B *\<^sub>v v) = inner_prod v ((C - A) *\<^sub>v v) - inner_prod v (B *\<^sub>v v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inner_prod v ((C - A) *\<^sub>v v) + inner_prod v (- B *\<^sub>v v) = inner_prod v ((C - A) *\<^sub>v v) - inner_prod v (B *\<^sub>v v)

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inner_prod v ((C - A) *\<^sub>v v) + inner_prod v (- B *\<^sub>v v) = inner_prod v ((C - A) *\<^sub>v v) - inner_prod v (B *\<^sub>v v)

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
have "\<dots> \<le> inner_prod v ((C - A) *\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod v ((C - A) *\<^sub>v v) - inner_prod v (B *\<^sub>v v) \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
using ge
[PROOF STATE]
proof (prove)
using this:
0 \<le> inner_prod v (B *\<^sub>v v)

goal (1 subgoal):
 1. inner_prod v ((C - A) *\<^sub>v v) - inner_prod v (B *\<^sub>v v) \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inner_prod v ((C - A) *\<^sub>v v) - inner_prod v (B *\<^sub>v v) \<le> inner_prod v ((C - A) *\<^sub>v v)

goal (1 subgoal):
 1. \<And>v. n = dim_vec v \<Longrightarrow> 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
show "0 \<le> inner_prod v ((C - A) *\<^sub>v v)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> inner_prod v ((C - A) *\<^sub>v v)

goal (1 subgoal):
 1. 0 \<le> inner_prod v ((C - A) *\<^sub>v v)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
0 \<le> inner_prod v ((C - A) *\<^sub>v v)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_poly_smult:
  assumes "f 0 = 0""\<And>c x. f (c * x) = f c * f x"
  shows "map_poly f (smult c p) = smult (f c) (map_poly f p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly f (smult c p) = smult (f c) (map_poly f p)
[PROOF STEP]
by (intro poly_eqI) (simp_all add: assms coeff_map_poly)


[STATEMENT]
lemma is_mset_setI[intro]:
  assumes "\<And>x. x \<in># X \<Longrightarrow> count X x = 1"
  shows "is_mset_set X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct_mset X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in># X \<Longrightarrow> count X ?x = 1

goal (1 subgoal):
 1. distinct_mset X
[PROOF STEP]
unfolding is_mset_set_def
[PROOF STATE]
proof (prove)
using this:
?x \<in># X \<Longrightarrow> count X ?x = 1

goal (1 subgoal):
 1. \<forall>x\<in>#X. count X x = 1
[PROOF STEP]
by auto


[STATEMENT]
lemma graph_Suc[simp]: "graph A w (Suc k) = (if even k then clean A w else prune A w) (graph A w k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph A w (Suc k) = (if even k then clean A w else prune A w) (graph A w k)
[PROOF STEP]
unfolding graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. alternate (clean A w) (prune A w) (Suc k) (gunodes A w) = (if even k then clean A w else prune A w) (alternate (clean A w) (prune A w) k (gunodes A w))
[PROOF STEP]
by simp


[STATEMENT]
lemma monic_factor:
  fixes p q :: "'a :: idom poly"
  assumes "monic (p * q)" "monic p"
  shows "monic q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monic q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. monic q
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
monic (p * q)
monic p
[PROOF STEP]
have nz: "p \<noteq> 0" "q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
monic (p * q)
monic p

goal (1 subgoal):
 1. p \<noteq> 0 &&& q \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<noteq> 0
q \<noteq> 0

goal (1 subgoal):
 1. monic q
[PROOF STEP]
from assms[unfolded degree_mult_eq[OF nz] coeff_mult_degree_sum \<open>monic p\<close>]
[PROOF STATE]
proof (chain)
picking this:
(1::'a) * lead_coeff q = (1::'a)
(1::'a) = (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(1::'a) * lead_coeff q = (1::'a)
(1::'a) = (1::'a)

goal (1 subgoal):
 1. monic q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
monic q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sqrt_rat_pos: assumes sqrt: "sqrt_rat x = Cons s ms"
  shows "s \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
obtain z n where q: "quotient_of x = (z,n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z n. quotient_of x = (z, n) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
quotient_of x = (z, n)

goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
note sqrt = sqrt[unfolded sqrt_rat_code q, simplified]
[PROOF STATE]
proof (state)
this:
(case sqrt_int n of [] \<Rightarrow> [] | sn # xs \<Rightarrow> map (\<lambda>sz. rat_of_int sz / rat_of_int sn) (sqrt_int z)) = s # ms

goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
let ?sz = "sqrt_int z"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
let ?sn = "sqrt_int n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
from q
[PROOF STATE]
proof (chain)
picking this:
quotient_of x = (z, n)
[PROOF STEP]
have n: "n > 0"
[PROOF STATE]
proof (prove)
using this:
quotient_of x = (z, n)

goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
by (rule quotient_of_denom_pos)
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
from sqrt
[PROOF STATE]
proof (chain)
picking this:
(case sqrt_int n of [] \<Rightarrow> [] | sn # xs \<Rightarrow> map (\<lambda>sz. rat_of_int sz / rat_of_int sn) (sqrt_int z)) = s # ms
[PROOF STEP]
obtain sz mz where sz: "?sz = sz # mz"
[PROOF STATE]
proof (prove)
using this:
(case sqrt_int n of [] \<Rightarrow> [] | sn # xs \<Rightarrow> map (\<lambda>sz. rat_of_int sz / rat_of_int sn) (sqrt_int z)) = s # ms

goal (1 subgoal):
 1. (\<And>sz mz. sqrt_int z = sz # mz \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases ?sn, auto)
[PROOF STATE]
proof (state)
this:
sqrt_int z = sz # mz

goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
from sqrt
[PROOF STATE]
proof (chain)
picking this:
(case sqrt_int n of [] \<Rightarrow> [] | sn # xs \<Rightarrow> map (\<lambda>sz. rat_of_int sz / rat_of_int sn) (sqrt_int z)) = s # ms
[PROOF STEP]
obtain sn mn where sn: "?sn = sn # mn"
[PROOF STATE]
proof (prove)
using this:
(case sqrt_int n of [] \<Rightarrow> [] | sn # xs \<Rightarrow> map (\<lambda>sz. rat_of_int sz / rat_of_int sn) (sqrt_int z)) = s # ms

goal (1 subgoal):
 1. (\<And>sn mn. sqrt_int n = sn # mn \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases ?sn, auto)
[PROOF STATE]
proof (state)
this:
sqrt_int n = sn # mn

goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
from sqrt_int_pos[OF sz] sqrt_int_pos[OF sn]
[PROOF STATE]
proof (chain)
picking this:
0 \<le> sz
0 \<le> sn
[PROOF STEP]
have pos: "0 \<le> sz" "0 \<le> sn"
[PROOF STATE]
proof (prove)
using this:
0 \<le> sz
0 \<le> sn

goal (1 subgoal):
 1. 0 \<le> sz &&& 0 \<le> sn
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> sz
0 \<le> sn

goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
from sqrt sz sn
[PROOF STATE]
proof (chain)
picking this:
(case sqrt_int n of [] \<Rightarrow> [] | sn # xs \<Rightarrow> map (\<lambda>sz. rat_of_int sz / rat_of_int sn) (sqrt_int z)) = s # ms
sqrt_int z = sz # mz
sqrt_int n = sn # mn
[PROOF STEP]
have s: "s = of_int sz / of_int sn"
[PROOF STATE]
proof (prove)
using this:
(case sqrt_int n of [] \<Rightarrow> [] | sn # xs \<Rightarrow> map (\<lambda>sz. rat_of_int sz / rat_of_int sn) (sqrt_int z)) = s # ms
sqrt_int z = sz # mz
sqrt_int n = sn # mn

goal (1 subgoal):
 1. s = rat_of_int sz / rat_of_int sn
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s = rat_of_int sz / rat_of_int sn

goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
unfolding s
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> rat_of_int sz / rat_of_int sn
[PROOF STEP]
using pos
[PROOF STATE]
proof (prove)
using this:
0 \<le> sz
0 \<le> sn

goal (1 subgoal):
 1. 0 \<le> rat_of_int sz / rat_of_int sn
[PROOF STEP]
by (metis of_int_0_le_iff zero_le_divide_iff)
[PROOF STATE]
proof (state)
this:
0 \<le> s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma equiintegrable_minus:
  assumes "F equiintegrable_on I"
  shows "(\<Union>f \<in> F. {(\<lambda>x. - f x)}) equiintegrable_on I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>f\<in>F. {\<lambda>x. - f x}) equiintegrable_on I
[PROOF STEP]
by (force intro: equiintegrable_on_subset [OF equiintegrable_cmul [OF assms, of 1]])


[STATEMENT]
lemma remove1_mset_eqE:
  "remove1_mset L x1 = M \<Longrightarrow>
    (L \<in># x1 \<Longrightarrow> x1 = M + {#L#} \<Longrightarrow> P) \<Longrightarrow>
    (L \<notin># x1 \<Longrightarrow> x1 = M \<Longrightarrow> P) \<Longrightarrow>
  P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>remove1_mset L x1 = M; \<lbrakk>L \<in># x1; x1 = M + {#L#}\<rbrakk> \<Longrightarrow> P; \<lbrakk>L \<notin># x1; x1 = M\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by (cases "L \<in># x1") auto


[STATEMENT]
lemma field_differentiable_divide [derivative_intros]:
  assumes "f field_differentiable (at a within S)"
          "g field_differentiable (at a within S)"
          "g a \<noteq> 0"
    shows "(\<lambda>z. f z / g z) field_differentiable (at a within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>z. f z / g z) field_differentiable at a within S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f field_differentiable at a within S
g field_differentiable at a within S
g a \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<lambda>z. f z / g z) field_differentiable at a within S
[PROOF STEP]
unfolding field_differentiable_def
[PROOF STATE]
proof (prove)
using this:
\<exists>f'. (f has_field_derivative f') (at a within S)
\<exists>f'. (g has_field_derivative f') (at a within S)
g a \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>f'. ((\<lambda>z. f z / g z) has_field_derivative f') (at a within S)
[PROOF STEP]
by (metis DERIV_divide [of f _ a S g])


[STATEMENT]
lemma orthogonal_complement_mono:
  assumes A_in_B: "A \<subseteq> B"
  shows "orthogonal_complement B \<subseteq> orthogonal_complement A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement B \<subseteq> orthogonal_complement A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> orthogonal_complement B \<Longrightarrow> x \<in> orthogonal_complement A
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> orthogonal_complement B \<Longrightarrow> x \<in> orthogonal_complement A
[PROOF STEP]
assume x: "x \<in> orthogonal_complement B"
[PROOF STATE]
proof (state)
this:
x \<in> orthogonal_complement B

goal (1 subgoal):
 1. \<And>x. x \<in> orthogonal_complement B \<Longrightarrow> x \<in> orthogonal_complement A
[PROOF STEP]
show "x \<in> orthogonal_complement A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> orthogonal_complement A
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
x \<in> orthogonal_complement B

goal (1 subgoal):
 1. x \<in> orthogonal_complement A
[PROOF STEP]
unfolding orthogonal_complement_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {x. Ball B (orthogonal x)}

goal (1 subgoal):
 1. x \<in> {x. Ball A (orthogonal x)}
[PROOF STEP]
by (simp add: orthogonal_def, metis A_in_B in_mono)
[PROOF STATE]
proof (state)
this:
x \<in> orthogonal_complement A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma step_list_reverse2 [simp]:
  assumes
    "small = (Reverse2 current aux big new count)"
    "invar small"
  shows
    "list (step small) = list small"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Small.list (step small) = Small.list small
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Small.list (step small) = Small.list small
[PROOF STEP]
have size_not_empty: "(0 < size big) = (\<not> is_empty big)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < size big) = (\<not> is_empty big)
[PROOF STEP]
by (simp add: Stack_Proof.size_not_empty)
[PROOF STATE]
proof (state)
this:
(0 < size big) = (\<not> is_empty big)

goal (1 subgoal):
 1. Small.list (step small) = Small.list small
[PROOF STEP]
have "\<not> is_empty big
     \<Longrightarrow> rev (Stack.list (Stack.pop big)) @ [Stack.first big] = rev (Stack.list big)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> is_empty big \<Longrightarrow> rev (Stack.list (Stack.pop big)) @ [Stack.first big] = rev (Stack.list big)
[PROOF STEP]
by(induction big rule: Stack.pop.induct) auto
[PROOF STATE]
proof (state)
this:
\<not> is_empty big \<Longrightarrow> rev (Stack.list (Stack.pop big)) @ [Stack.first big] = rev (Stack.list big)

goal (1 subgoal):
 1. Small.list (step small) = Small.list small
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
small = Reverse2 current aux big new count
invar small
\<not> is_empty big \<Longrightarrow> rev (Stack.list (Stack.pop big)) @ [Stack.first big] = rev (Stack.list big)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
small = Reverse2 current aux big new count
invar small
\<not> is_empty big \<Longrightarrow> rev (Stack.list (Stack.pop big)) @ [Stack.first big] = rev (Stack.list big)

goal (1 subgoal):
 1. Small.list (step small) = Small.list small
[PROOF STEP]
using Stack_Proof.size_pop[of big] size_not_empty
[PROOF STATE]
proof (prove)
using this:
small = Reverse2 current aux big new count
invar small
\<not> is_empty big \<Longrightarrow> rev (Stack.list (Stack.pop big)) @ [Stack.first big] = rev (Stack.list big)
size (Stack.pop big) = size big - Suc 0
(0 < size big) = (\<not> is_empty big)

goal (1 subgoal):
 1. Small.list (step small) = Small.list small
[PROOF STEP]
by(auto simp: Stack_Proof.list_empty split: current.splits)
[PROOF STATE]
proof (state)
this:
Small.list (step small) = Small.list small

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma S_idx_of_correct:
    assumes A: "v\<in>\<Union>(set p_\<alpha>)"
    shows "S_idx_of v < length S" and "S!S_idx_of v = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S_idx_of v < length S &&& S ! S_idx_of v = v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S_idx_of v < length S
 2. S ! S_idx_of v = v
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
v \<in> \<Union> (set p_\<alpha>)
[PROOF STEP]
have "v\<in>set S"
[PROOF STATE]
proof (prove)
using this:
v \<in> \<Union> (set p_\<alpha>)

goal (1 subgoal):
 1. v \<in> set S
[PROOF STEP]
by (simp add: set_p_\<alpha>_is_set_S)
[PROOF STATE]
proof (state)
this:
v \<in> set S

goal (2 subgoals):
 1. S_idx_of v < length S
 2. S ! S_idx_of v = v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v \<in> set S
[PROOF STEP]
obtain j where G1: "j<length S" "v=S!j"
[PROOF STATE]
proof (prove)
using this:
v \<in> set S

goal (1 subgoal):
 1. (\<And>j. \<lbrakk>j < length S; v = S ! j\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: in_set_conv_nth)
[PROOF STATE]
proof (state)
this:
j < length S
v = S ! j

goal (2 subgoals):
 1. S_idx_of v < length S
 2. S ! S_idx_of v = v
[PROOF STEP]
with I_consistent
[PROOF STATE]
proof (chain)
picking this:
(I ?v = Some (STACK ?j)) = (?j < length S \<and> ?v = S ! ?j)
j < length S
v = S ! j
[PROOF STEP]
have "I v = Some (STACK j)"
[PROOF STATE]
proof (prove)
using this:
(I ?v = Some (STACK ?j)) = (?j < length S \<and> ?v = S ! ?j)
j < length S
v = S ! j

goal (1 subgoal):
 1. I v = Some (STACK j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
I v = Some (STACK j)

goal (2 subgoals):
 1. S_idx_of v < length S
 2. S ! S_idx_of v = v
[PROOF STEP]
hence "S_idx_of v = j"
[PROOF STATE]
proof (prove)
using this:
I v = Some (STACK j)

goal (1 subgoal):
 1. S_idx_of v = j
[PROOF STEP]
by (simp add: S_idx_of_def)
[PROOF STATE]
proof (state)
this:
S_idx_of v = j

goal (2 subgoals):
 1. S_idx_of v < length S
 2. S ! S_idx_of v = v
[PROOF STEP]
with G1
[PROOF STATE]
proof (chain)
picking this:
j < length S
v = S ! j
S_idx_of v = j
[PROOF STEP]
show "S_idx_of v < length S" and "S!S_idx_of v = v"
[PROOF STATE]
proof (prove)
using this:
j < length S
v = S ! j
S_idx_of v = j

goal (1 subgoal):
 1. S_idx_of v < length S &&& S ! S_idx_of v = v
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
S_idx_of v < length S
S ! S_idx_of v = v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem pr_1_eq_1': "PrimRec1 = PrimRec1'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. PrimRec1 = PrimRec1'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. PrimRec1 = PrimRec1'
[PROOF STEP]
have S1: "\<And> f. f \<in> PrimRec1 \<longrightarrow> f \<in> PrimRec1'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. f \<in> PrimRec1 \<longrightarrow> f \<in> PrimRec1'
[PROOF STEP]
by (simp add: lm')
[PROOF STATE]
proof (state)
this:
?f \<in> PrimRec1 \<longrightarrow> ?f \<in> PrimRec1'

goal (1 subgoal):
 1. PrimRec1 = PrimRec1'
[PROOF STEP]
have S2: "\<And> f. f \<in> PrimRec1' \<longrightarrow> f \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. f \<in> PrimRec1' \<longrightarrow> f \<in> PrimRec1
[PROOF STEP]
by (simp add: primrec'_into_primrec)
[PROOF STATE]
proof (state)
this:
?f \<in> PrimRec1' \<longrightarrow> ?f \<in> PrimRec1

goal (1 subgoal):
 1. PrimRec1 = PrimRec1'
[PROOF STEP]
from S1 S2
[PROOF STATE]
proof (chain)
picking this:
?f \<in> PrimRec1 \<longrightarrow> ?f \<in> PrimRec1'
?f \<in> PrimRec1' \<longrightarrow> ?f \<in> PrimRec1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?f \<in> PrimRec1 \<longrightarrow> ?f \<in> PrimRec1'
?f \<in> PrimRec1' \<longrightarrow> ?f \<in> PrimRec1

goal (1 subgoal):
 1. PrimRec1 = PrimRec1'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
PrimRec1 = PrimRec1'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma code_value_iteration[code]: "value_iteration eps (vec_to_bfun v) =
  (if eps \<le> 0 then \<L>\<^sub>b (vec_to_bfun v) else value_iteration_partial eps (vec_to_bfun v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. value_iteration eps (vec_to_bfun v) = (if eps \<le> 0 then \<L>\<^sub>b (vec_to_bfun v) else value_iteration_partial eps (vec_to_bfun v))
[PROOF STEP]
by (simp add: value_iteration.simps vi_eq_partial)


[STATEMENT]
lemma chain_subdiv_path_pathimg_subset:
  assumes "chain_subdiv_path \<gamma> subdiv"
  shows "\<forall>(k',\<gamma>')\<in>subdiv. (path_image \<gamma>') \<subseteq> path_image \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>(k', \<gamma>')\<in>subdiv. path_image \<gamma>' \<subseteq> path_image \<gamma>
[PROOF STEP]
using assms chain_subdiv_path.simps path_image_rec_join
[PROOF STATE]
proof (prove)
using this:
chain_subdiv_path \<gamma> subdiv
chain_subdiv_path ?a1.0 ?a2.0 = (\<exists>l \<gamma>. ?a1.0 = \<gamma> \<and> ?a2.0 = set l \<and> distinct l \<and> rec_join l = \<gamma> \<and> valid_chain_list l)
\<lbrakk>(?k, ?\<gamma>) \<in> set ?l; valid_chain_list ?l\<rbrakk> \<Longrightarrow> path_image ?\<gamma> \<subseteq> path_image (rec_join ?l)

goal (1 subgoal):
 1. \<forall>(k', \<gamma>')\<in>subdiv. path_image \<gamma>' \<subseteq> path_image \<gamma>
[PROOF STEP]
by(auto simp add: chain_subdiv_path.simps)


[STATEMENT]
lemma enat_in_INF:
  fixes f :: "'a \<Rightarrow> enat"
  assumes "(INF x\<in> S. f x) \<noteq> top"
  obtains x where "x \<in> S" and "(INF x\<in> S. f x) = f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> S; Inf (f ` S) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> S; Inf (f ` S) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
Inf (f ` S) \<noteq> top
[PROOF STEP]
have "(INF x\<in> S. f x) \<in> f ` S"
[PROOF STATE]
proof (prove)
using this:
Inf (f ` S) \<noteq> top

goal (1 subgoal):
 1. Inf (f ` S) \<in> f ` S
[PROOF STEP]
using enat_in_Inf [of "f ` S"]
[PROOF STATE]
proof (prove)
using this:
Inf (f ` S) \<noteq> top
Inf (f ` S) \<noteq> top \<Longrightarrow> Inf (f ` S) \<in> f ` S

goal (1 subgoal):
 1. Inf (f ` S) \<in> f ` S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Inf (f ` S) \<in> f ` S

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> S; Inf (f ` S) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Inf (f ` S) \<in> f ` S
[PROOF STEP]
obtain x where "x \<in> S" "(INF x\<in> S. f x) = f x"
[PROOF STATE]
proof (prove)
using this:
Inf (f ` S) \<in> f ` S

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> S; Inf (f ` S) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> S
Inf (f ` S) = f x

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> S; Inf (f ` S) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> S
Inf (f ` S) = f x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> S
Inf (f ` S) = f x

goal (1 subgoal):
 1. thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wsorted_nth_mono: assumes "wsorted L" "i\<le>j" "j<length L"
  shows "weight (L!i) \<le> weight (L!j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weight (L ! i) \<le> weight (L ! j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wsorted L
i \<le> j
j < length L

goal (1 subgoal):
 1. weight (L ! i) \<le> weight (L ! j)
[PROOF STEP]
by (induct L arbitrary: i j rule: list.induct, auto simp: nth_Cons')


[STATEMENT]
theorem well_defined_compose:
 assumes "is_tangle_diagram x"
     and "is_tangle_diagram y"
 shows "(Abs_Tangle_Diagram x) \<otimes> (Abs_Tangle_Diagram y) = (Abs_Tangle_Diagram (x \<otimes> y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_Tangle_Diagram x \<otimes> Abs_Tangle_Diagram y = Abs_Tangle_Diagram (x \<otimes> y)
[PROOF STEP]
using  Abs_Tangle_Diagram_inverse assms(1) assms(2)
      mem_Collect_eq tensor_preserves_is_tangle
     tensor_Tangle_def
[PROOF STATE]
proof (prove)
using this:
?y \<in> {x. is_tangle_diagram x} \<Longrightarrow> Rep_Tangle_Diagram (Abs_Tangle_Diagram ?y) = ?y
is_tangle_diagram x
is_tangle_diagram y
(?a \<in> Collect ?P) = ?P ?a
\<lbrakk>is_tangle_diagram ?x; is_tangle_diagram ?y\<rbrakk> \<Longrightarrow> is_tangle_diagram (?x \<otimes> ?y)
?x \<otimes> ?y = Abs_Tangle_Diagram (Rep_Tangle_Diagram ?x \<otimes> Rep_Tangle_Diagram ?y)

goal (1 subgoal):
 1. Abs_Tangle_Diagram x \<otimes> Abs_Tangle_Diagram y = Abs_Tangle_Diagram (x \<otimes> y)
[PROOF STEP]
by auto


[STATEMENT]
lemma octo_inner_e5_left [simp]: "inner e5 x  = Im5 x"
 and  octo_inner_e5_right [simp]: "inner x e5 = Im5 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e5 \<bullet> x = Im5 x &&& x \<bullet> e5 = Im5 x
[PROOF STEP]
unfolding inner_octo_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ree e5 * Ree x + Im1 e5 * Im1 x + Im2 e5 * Im2 x + Im3 e5 * Im3 x + Im4 e5 * Im4 x + Im5 e5 * Im5 x + Im6 e5 * Im6 x + Im7 e5 * Im7 x = Im5 x &&& Ree x * Ree e5 + Im1 x * Im1 e5 + Im2 x * Im2 e5 + Im3 x * Im3 e5 + Im4 x * Im4 e5 + Im5 x * Im5 e5 + Im6 x * Im6 e5 + Im7 x * Im7 e5 = Im5 x
[PROOF STEP]
by simp_all


[STATEMENT]
lemma less_succ_self: "x < succ x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < ZFC_in_HOL.succ x
[PROOF STEP]
by (simp add: less_eq_V_def order_neq_le_trans subset_insertI)


[STATEMENT]
lemma finite_Sts0_RP: "finite (clss_of_state (lhd (lmap state_of_wstate Sts)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (N_of_state (lhd (lmap state_of_wstate Sts)) \<union> P_of_state (lhd (lmap state_of_wstate Sts)) \<union> Q_of_state (lhd (lmap state_of_wstate Sts)))
[PROOF STEP]
using finite_Sts0 chain_length_pos[OF deriv]
[PROOF STATE]
proof (prove)
using this:
finite (N_of_wstate (lhd Sts) \<union> P_of_wstate (lhd Sts) \<union> Q_of_wstate (lhd Sts))
0 < llength Sts

goal (1 subgoal):
 1. finite (N_of_state (lhd (lmap state_of_wstate Sts)) \<union> P_of_state (lhd (lmap state_of_wstate Sts)) \<union> Q_of_state (lhd (lmap state_of_wstate Sts)))
[PROOF STEP]
by auto


[STATEMENT]
lemma index_mat_swaprows_mat[simp]:
  "i < n \<Longrightarrow> j < n \<Longrightarrow> swaprows_mat n k l $$ (i,j) =
    (if k = i \<and> l = j \<or> k = j \<and> l = i \<or> i = j \<and> i \<noteq> k \<and> i \<noteq> l then 1 else 0)"
  "dim_row (swaprows_mat n k l) = n" "dim_col (swaprows_mat n k l) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> swaprows_mat n k l $$ (i, j) = (if k = i \<and> l = j \<or> k = j \<and> l = i \<or> i = j \<and> i \<noteq> k \<and> i \<noteq> l then 1::'a else (0::'a))) &&& dim_row (swaprows_mat n k l) = n &&& dim_col (swaprows_mat n k l) = n
[PROOF STEP]
unfolding swaprows_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> mat n n (\<lambda>(i, j). if k = i \<and> l = j \<or> k = j \<and> l = i \<or> i = j \<and> i \<noteq> k \<and> i \<noteq> l then 1::'a else (0::'a)) $$ (i, j) = (if k = i \<and> l = j \<or> k = j \<and> l = i \<or> i = j \<and> i \<noteq> k \<and> i \<noteq> l then 1::'a else (0::'a))) &&& dim_row (mat n n (\<lambda>(i, j). if k = i \<and> l = j \<or> k = j \<and> l = i \<or> i = j \<and> i \<noteq> k \<and> i \<noteq> l then 1::'b else (0::'b))) = n &&& dim_col (mat n n (\<lambda>(i, j). if k = i \<and> l = j \<or> k = j \<and> l = i \<or> i = j \<and> i \<noteq> k \<and> i \<noteq> l then 1::'c else (0::'c))) = n
[PROOF STEP]
by auto


[STATEMENT]
lemma bernoulli_inequality: assumes x: "-1 \<le> (x :: 'a :: linordered_field)"
  shows "1 + of_nat n * x \<le> (1 + x) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (1::'a) + of_nat 0 * x \<le> ((1::'a) + x) ^ 0
 2. \<And>n. (1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n \<Longrightarrow> (1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n

goal (2 subgoals):
 1. (1::'a) + of_nat 0 * x \<le> ((1::'a) + x) ^ 0
 2. \<And>n. (1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n \<Longrightarrow> (1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
have "1 + of_nat (Suc n) * x = 1 + x + of_nat n * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) + of_nat (Suc n) * x = (1::'a) + x + of_nat n * x
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(1::'a) + of_nat (Suc n) * x = (1::'a) + x + of_nat n * x

goal (2 subgoals):
 1. (1::'a) + of_nat 0 * x \<le> ((1::'a) + x) ^ 0
 2. \<And>n. (1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n \<Longrightarrow> (1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) + of_nat (Suc n) * x = (1::'a) + x + of_nat n * x

goal (2 subgoals):
 1. (1::'a) + of_nat 0 * x \<le> ((1::'a) + x) ^ 0
 2. \<And>n. (1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n \<Longrightarrow> (1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
have "\<dots> \<le> \<dots> + of_nat n * x ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) + x + of_nat n * x \<le> (1::'a) + x + of_nat n * x + of_nat n * x\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1::'a) + x + of_nat n * x \<le> (1::'a) + x + of_nat n * x + of_nat n * x\<^sup>2

goal (2 subgoals):
 1. (1::'a) + of_nat 0 * x \<le> ((1::'a) + x) ^ 0
 2. \<And>n. (1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n \<Longrightarrow> (1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) + x + of_nat n * x \<le> (1::'a) + x + of_nat n * x + of_nat n * x\<^sup>2

goal (2 subgoals):
 1. (1::'a) + of_nat 0 * x \<le> ((1::'a) + x) ^ 0
 2. \<And>n. (1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n \<Longrightarrow> (1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
have "\<dots> = (1 + of_nat n * x) * (1 + x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) + x + of_nat n * x + of_nat n * x\<^sup>2 = ((1::'a) + of_nat n * x) * ((1::'a) + x)
[PROOF STEP]
by (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
(1::'a) + x + of_nat n * x + of_nat n * x\<^sup>2 = ((1::'a) + of_nat n * x) * ((1::'a) + x)

goal (2 subgoals):
 1. (1::'a) + of_nat 0 * x \<le> ((1::'a) + x) ^ 0
 2. \<And>n. (1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n \<Longrightarrow> (1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) + x + of_nat n * x + of_nat n * x\<^sup>2 = ((1::'a) + of_nat n * x) * ((1::'a) + x)

goal (2 subgoals):
 1. (1::'a) + of_nat 0 * x \<le> ((1::'a) + x) ^ 0
 2. \<And>n. (1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n \<Longrightarrow> (1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
have "\<dots> \<le> (1 + x) ^ n * (1 + x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((1::'a) + of_nat n * x) * ((1::'a) + x) \<le> ((1::'a) + x) ^ n * ((1::'a) + x)
[PROOF STEP]
by (rule mult_right_mono[OF Suc], insert x, auto)
[PROOF STATE]
proof (state)
this:
((1::'a) + of_nat n * x) * ((1::'a) + x) \<le> ((1::'a) + x) ^ n * ((1::'a) + x)

goal (2 subgoals):
 1. (1::'a) + of_nat 0 * x \<le> ((1::'a) + x) ^ 0
 2. \<And>n. (1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n \<Longrightarrow> (1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((1::'a) + of_nat n * x) * ((1::'a) + x) \<le> ((1::'a) + x) ^ n * ((1::'a) + x)

goal (2 subgoals):
 1. (1::'a) + of_nat 0 * x \<le> ((1::'a) + x) ^ 0
 2. \<And>n. (1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n \<Longrightarrow> (1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
have "\<dots> = (1 + x) ^ (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((1::'a) + x) ^ n * ((1::'a) + x) = ((1::'a) + x) ^ Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((1::'a) + x) ^ n * ((1::'a) + x) = ((1::'a) + x) ^ Suc n

goal (2 subgoals):
 1. (1::'a) + of_nat 0 * x \<le> ((1::'a) + x) ^ 0
 2. \<And>n. (1::'a) + of_nat n * x \<le> ((1::'a) + x) ^ n \<Longrightarrow> (1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n

goal (1 subgoal):
 1. (1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(1::'a) + of_nat (Suc n) * x \<le> ((1::'a) + x) ^ Suc n

goal (1 subgoal):
 1. (1::'a) + of_nat 0 * x \<le> ((1::'a) + x) ^ 0
[PROOF STEP]
qed simp


[STATEMENT]
lemma wp_g_ode_ivl: "t \<ge> 0 \<Longrightarrow> t \<in> T \<Longrightarrow> wp (x\<acute>= (\<lambda>t. f) & G on (\<lambda>s. {0..t}) S @ 0) \<lceil>Q\<rceil> =
  \<lceil>\<lambda>s. s \<in> S \<longrightarrow> (\<forall>t\<in>{0..t}. (\<forall>\<tau>\<in>{0..t}. G (\<phi> \<tau> s)) \<longrightarrow> Q (\<phi> t s))\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> t; s2p T t\<rbrakk> \<Longrightarrow> wp x\<acute>= \<lambda>t. f & G on \<lambda>s. {0..t} S @ 0 \<lceil>Q\<rceil> = \<lceil>\<lambda>s. s2p S s \<longrightarrow> (\<forall>t\<in>{0..t}. (\<forall>\<tau>\<in>{0..t}. G (\<phi> \<tau> s)) \<longrightarrow> Q (\<phi> t s))\<rceil>
[PROOF STEP]
apply(subst wp_g_ode_subset, simp_all add: subintervalI init_time real_Icc_closed_segment)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> t; s2p T t\<rbrakk> \<Longrightarrow> \<forall>s. (s2p S s \<longrightarrow> (\<forall>ta\<in>{0--t}. (\<forall>\<tau>. s2p {0--t} \<tau> \<and> \<tau> \<le> ta \<longrightarrow> G (\<phi> \<tau> s)) \<longrightarrow> Q (\<phi> ta s))) = (s2p S s \<longrightarrow> (\<forall>t\<in>{0--t}. (\<forall>\<tau>\<in>{0..t}. G (\<phi> \<tau> s)) \<longrightarrow> Q (\<phi> t s)))
[PROOF STEP]
by (auto simp: closed_segment_eq_real_ivl)


[STATEMENT]
lemma inext_less_mono: "
  \<lbrakk> a < b; a \<in> I; b \<in> I; \<exists>x\<in>I. b < x \<rbrakk> \<Longrightarrow> inext a I < inext b I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < b; a \<in> I; b \<in> I; \<exists>x\<in>I. b < x\<rbrakk> \<Longrightarrow> inext a I < inext b I
[PROOF STEP]
apply (rule le_less_trans[of _ b])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a < b; a \<in> I; b \<in> I; \<exists>x\<in>I. b < x\<rbrakk> \<Longrightarrow> inext a I \<le> b
 2. \<lbrakk>a < b; a \<in> I; b \<in> I; \<exists>x\<in>I. b < x\<rbrakk> \<Longrightarrow> b < inext b I
[PROOF STEP]
apply (rule ccontr, simp add: linorder_not_le)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a < b; a \<in> I; b \<in> I; \<exists>x\<in>I. b < x; b < inext a I\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>a < b; a \<in> I; b \<in> I; \<exists>x\<in>I. b < x\<rbrakk> \<Longrightarrow> b < inext b I
[PROOF STEP]
apply (blast dest: inext_min_step)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < b; a \<in> I; b \<in> I; \<exists>x\<in>I. b < x\<rbrakk> \<Longrightarrow> b < inext b I
[PROOF STEP]
by (rule inext_mono2)


[STATEMENT]
lemma gen_dfs_pre_imp_fin:
  assumes "gen_dfs_pre E U S V u0"
  shows "finite (E `` {u0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (E `` {u0})
[PROOF STEP]
apply (rule finite_subset[where B="U"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. E `` {u0} \<subseteq> U
 2. finite U
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
gen_dfs_pre E U S V u0

goal (2 subgoals):
 1. E `` {u0} \<subseteq> U
 2. finite U
[PROOF STEP]
unfolding gen_dfs_pre_def
[PROOF STATE]
proof (prove)
using this:
E `` U \<subseteq> U \<and> finite U \<and> V \<subseteq> U \<and> u0 \<in> U \<and> E `` (V - S) \<subseteq> V \<and> u0 \<notin> V \<and> S \<subseteq> V \<and> (\<forall>v\<in>S. (v, u0) \<in> (E \<inter> S \<times> UNIV)\<^sup>*)

goal (2 subgoals):
 1. E `` {u0} \<subseteq> U
 2. finite U
[PROOF STEP]
by auto


[STATEMENT]
lemma vball_vifunion[simp]: "(\<forall>z\<in>\<^sub>\<circ>(\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. f i). P z) \<longleftrightarrow> (\<forall>x\<in>\<^sub>\<circ>I. \<forall>z\<in>\<^sub>\<circ>f x. P z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>z\<in>elts (\<Union>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I)). P z) = (\<forall>x\<in>elts I. \<forall>z\<in>elts (f x). P z)
[PROOF STEP]
by force


[STATEMENT]
lemma int_of_real_sub: "real_is_int a \<Longrightarrow> real_is_int b \<Longrightarrow> (int_of_real (a-b)) = (int_of_real a) - (int_of_real b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>real_is_int a; real_is_int b\<rbrakk> \<Longrightarrow> int_of_real (a - b) = int_of_real a - int_of_real b
[PROOF STEP]
by (auto simp add: int_of_real_def real_is_int_def)


[STATEMENT]
lemma integrable_sin_cx:
  "integrable (lebesgue_on {-pi..pi}) (\<lambda>x. sin(x * c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on {- pi..pi}) (\<lambda>x. sin (x * c))
[PROOF STEP]
by (intro continuous_imp_integrable_real continuous_intros)


[STATEMENT]
lemma  nmi_conj[no_atp]: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists>u\<in> U. u \<le> x) ;
  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists>u\<in> U. u \<le> x)\<rbrakk> \<Longrightarrow>
  \<forall>x. \<not>(P1' \<and> P2') \<and> (P1 x \<and> P2 x) \<longrightarrow>  (\<exists>u\<in> U. u \<le> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. \<not> P1' \<and> P1 x \<longrightarrow> (\<exists>u\<in>U. u \<le> x); \<forall>x. \<not> P2' \<and> P2 x \<longrightarrow> (\<exists>u\<in>U. u \<le> x)\<rbrakk> \<Longrightarrow> \<forall>x. \<not> (P1' \<and> P2') \<and> P1 x \<and> P2 x \<longrightarrow> (\<exists>u\<in>U. u \<le> x)
[PROOF STEP]
by auto


[STATEMENT]
lemma llast_ltake:
  assumes "enat (Suc n) < llength xs"
  shows "llast (ltake (enat (Suc n)) xs) = lnth xs n" (is "llast ?A = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llast (ltake (enat (Suc n)) xs) = lnth xs n
[PROOF STEP]
unfolding llast_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case llength (ltake (enat (Suc n)) xs) of enat (Suc xa) \<Rightarrow> lnth (ltake (enat (Suc n)) xs) xa) = lnth xs n
[PROOF STEP]
using llength_ltake'[OF assms]
[PROOF STATE]
proof (prove)
using this:
llength (ltake (enat (Suc n)) xs) = enat (Suc n)

goal (1 subgoal):
 1. (case llength (ltake (enat (Suc n)) xs) of enat (Suc xa) \<Rightarrow> lnth (ltake (enat (Suc n)) xs) xa) = lnth xs n
[PROOF STEP]
by (auto simp add: lnth_ltake)


[STATEMENT]
lemma expands_to_arctan_ms_pos_exp_pos:
  assumes "e > 0" "trimmed_pos (MS (MSLCons (C, e) xs) g)" "basis_wf basis"
          "(f expands_to MS (MSLCons (C, e) xs) g) basis"
  shows   "((\<lambda>x. arctan (f x)) expands_to MS (minus_ms_aux (const_ms_aux (pi / 2))
             (arctan_ms_aux (inverse_ms_aux (MSLCons (C, e) xs))))
               (\<lambda>x. arctan (g x))) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. arctan (f x)) expands_to MS (minus_ms_aux (const_ms_aux (pi / 2)) (arctan_ms_aux (inverse_ms_aux (MSLCons (C, e) xs)))) (\<lambda>x. arctan (g x))) basis
[PROOF STEP]
using arctan_ms_aux_inf[of "MSLCons (C, e) xs" basis g] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<exists>ea>0. ms_aux_hd_exp (MSLCons (C, e) xs) = Some ea; 0 < fst (dominant_term_ms_aux (MSLCons (C, e) xs)); trimmed_ms_aux (MSLCons (C, e) xs); basis_wf basis; is_expansion_aux (MSLCons (C, e) xs) g basis\<rbrakk> \<Longrightarrow> is_expansion_aux (minus_ms_aux (const_ms_aux (pi / 2)) (arctan_ms_aux (inverse_ms_aux (MSLCons (C, e) xs)))) (\<lambda>x. arctan (g x)) basis
0 < e
trimmed_pos (MS (MSLCons (C, e) xs) g)
basis_wf basis
(f expands_to MS (MSLCons (C, e) xs) g) basis

goal (1 subgoal):
 1. ((\<lambda>x. arctan (f x)) expands_to MS (minus_ms_aux (const_ms_aux (pi / 2)) (arctan_ms_aux (inverse_ms_aux (MSLCons (C, e) xs)))) (\<lambda>x. arctan (g x))) basis
[PROOF STEP]
by (auto simp: expands_to.simps snd_dominant_term_ms_aux_MSLCons o_def
                 dominant_term_ms_aux_MSLCons trimmed_pos_def elim: eventually_mono)


[STATEMENT]
lemma ord_congruence_set_memI:
  assumes "x \<in> nonzero Q\<^sub>p"
  assumes "ord x mod n = a"
  shows "x \<in> ord_congruence_set n a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> ord_congruence_set n a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> nonzero Q\<^sub>p
ord x mod n = a

goal (1 subgoal):
 1. x \<in> ord_congruence_set n a
[PROOF STEP]
by (metis (mono_tags, lifting) mem_Collect_eq ord_congruence_set_def)


[STATEMENT]
lemma ftranclD2:
  "(x, y) |\<in>| R|\<^sup>+| \<Longrightarrow> \<exists>z. (x = z \<or> (x, z) |\<in>| R|\<^sup>+|) \<and> (z, y) |\<in>| R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, y) |\<in>| R|\<^sup>+| \<Longrightarrow> \<exists>z. (x = z \<or> (x, z) |\<in>| R|\<^sup>+|) \<and> (z, y) |\<in>| R
[PROOF STEP]
by (induct rule: ftrancl_induct) auto


[STATEMENT]
lemma fls_regpart_plus [simp]: "fls_regpart (f + g) = fls_regpart f + fls_regpart g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_regpart (f + g) = fls_regpart f + fls_regpart g
[PROOF STEP]
by (intro fps_ext) simp


[STATEMENT]
lemma filter_sorted_list_of_set:
  "finite B \<Longrightarrow> A \<subseteq> B \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set B) = sorted_list_of_set A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite B; A \<subseteq> B\<rbrakk> \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set B) = sorted_list_of_set A
[PROOF STEP]
proof (induct B arbitrary: A rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. A \<subseteq> {} \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set {}) = sorted_list_of_set A
 2. \<And>x F A. \<lbrakk>finite F; x \<notin> F; \<And>A. A \<subseteq> F \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set F) = sorted_list_of_set A; A \<subseteq> insert x F\<rbrakk> \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x F)) = sorted_list_of_set A
[PROOF STEP]
case (insert x B)
[PROOF STATE]
proof (state)
this:
finite B
x \<notin> B
?A \<subseteq> B \<Longrightarrow> filter (\<lambda>x. x \<in> ?A) (sorted_list_of_set B) = sorted_list_of_set ?A
A \<subseteq> insert x B

goal (2 subgoals):
 1. \<And>A. A \<subseteq> {} \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set {}) = sorted_list_of_set A
 2. \<And>x F A. \<lbrakk>finite F; x \<notin> F; \<And>A. A \<subseteq> F \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set F) = sorted_list_of_set A; A \<subseteq> insert x F\<rbrakk> \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x F)) = sorted_list_of_set A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite B
x \<notin> B
?A \<subseteq> B \<Longrightarrow> filter (\<lambda>x. x \<in> ?A) (sorted_list_of_set B) = sorted_list_of_set ?A
A \<subseteq> insert x B
[PROOF STEP]
have "finite A"
[PROOF STATE]
proof (prove)
using this:
finite B
x \<notin> B
?A \<subseteq> B \<Longrightarrow> filter (\<lambda>x. x \<in> ?A) (sorted_list_of_set B) = sorted_list_of_set ?A
A \<subseteq> insert x B

goal (1 subgoal):
 1. finite A
[PROOF STEP]
by (auto simp: finite_subset)
[PROOF STATE]
proof (state)
this:
finite A

goal (2 subgoals):
 1. \<And>A. A \<subseteq> {} \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set {}) = sorted_list_of_set A
 2. \<And>x F A. \<lbrakk>finite F; x \<notin> F; \<And>A. A \<subseteq> F \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set F) = sorted_list_of_set A; A \<subseteq> insert x F\<rbrakk> \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x F)) = sorted_list_of_set A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite A

goal (2 subgoals):
 1. \<And>A. A \<subseteq> {} \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set {}) = sorted_list_of_set A
 2. \<And>x F A. \<lbrakk>finite F; x \<notin> F; \<And>A. A \<subseteq> F \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set F) = sorted_list_of_set A; A \<subseteq> insert x F\<rbrakk> \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x F)) = sorted_list_of_set A
[PROOF STEP]
from insert(1,2)
[PROOF STATE]
proof (chain)
picking this:
finite B
x \<notin> B
[PROOF STEP]
have "filter (\<lambda>y. y \<in> A - {x}) (sorted_list_of_set B) =
             filter (\<lambda>x. x \<in> A) (sorted_list_of_set B)"
[PROOF STATE]
proof (prove)
using this:
finite B
x \<notin> B

goal (1 subgoal):
 1. filter (\<lambda>y. y \<in> A - {x}) (sorted_list_of_set B) = filter (\<lambda>x. x \<in> A) (sorted_list_of_set B)
[PROOF STEP]
by (intro filter_cong) auto
[PROOF STATE]
proof (state)
this:
filter (\<lambda>y. y \<in> A - {x}) (sorted_list_of_set B) = filter (\<lambda>x. x \<in> A) (sorted_list_of_set B)

goal (2 subgoals):
 1. \<And>A. A \<subseteq> {} \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set {}) = sorted_list_of_set A
 2. \<And>x F A. \<lbrakk>finite F; x \<notin> F; \<And>A. A \<subseteq> F \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set F) = sorted_list_of_set A; A \<subseteq> insert x F\<rbrakk> \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x F)) = sorted_list_of_set A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite A
filter (\<lambda>y. y \<in> A - {x}) (sorted_list_of_set B) = filter (\<lambda>x. x \<in> A) (sorted_list_of_set B)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite A
filter (\<lambda>y. y \<in> A - {x}) (sorted_list_of_set B) = filter (\<lambda>x. x \<in> A) (sorted_list_of_set B)

goal (1 subgoal):
 1. filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x B)) = sorted_list_of_set A
[PROOF STEP]
using insert(1,2,4) insert(3)[of "A - {x}"] sorted_list_of_set_insert_remove[of A x]
[PROOF STATE]
proof (prove)
using this:
finite A
filter (\<lambda>y. y \<in> A - {x}) (sorted_list_of_set B) = filter (\<lambda>x. x \<in> A) (sorted_list_of_set B)
finite B
x \<notin> B
A \<subseteq> insert x B
A - {x} \<subseteq> B \<Longrightarrow> filter (\<lambda>xa. xa \<in> A - {x}) (sorted_list_of_set B) = sorted_list_of_set (A - {x})
finite A \<Longrightarrow> sorted_list_of_set (insert x A) = insort x (sorted_list_of_set (A - {x}))

goal (1 subgoal):
 1. filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x B)) = sorted_list_of_set A
[PROOF STEP]
by (cases "x \<in> A") (auto  simp: filter_insort filter_insort_triv subset_insert_iff insert_absorb)
[PROOF STATE]
proof (state)
this:
filter (\<lambda>x. x \<in> A) (sorted_list_of_set (insert x B)) = sorted_list_of_set A

goal (1 subgoal):
 1. \<And>A. A \<subseteq> {} \<Longrightarrow> filter (\<lambda>x. x \<in> A) (sorted_list_of_set {}) = sorted_list_of_set A
[PROOF STEP]
qed simp


[STATEMENT]
lemma concat_take_Suc_app_nth:
  assumes "x < length l"
  shows "concat (take (Suc x) l) = concat (take x l) @ l ! x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (take (Suc x) l) = concat (take x l) @ l ! x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x < length l

goal (1 subgoal):
 1. concat (take (Suc x) l) = concat (take x l) @ l ! x
[PROOF STEP]
by (auto simp: take_Suc_conv_app_nth)