[STATEMENT]
lemma distinct4_def:
"distinct [A,B,C,D] = ((A \<noteq> B) \<and> (A \<noteq> C) \<and> (A \<noteq> D)\<and> (B \<noteq> C) \<and> (B \<noteq> D) \<and> (C \<noteq> D))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct [A, B, C, D] = (A \<noteq> B \<and> A \<noteq> C \<and> A \<noteq> D \<and> B \<noteq> C \<and> B \<noteq> D \<and> C \<noteq> D)
[PROOF STEP]
by auto


[STATEMENT]
lemma sqrt_has_derivative:
  "((\<lambda>x. sqrt (f x)) has_derivative (\<lambda>xa. (if 0 < f x then 1 else - 1) / (2 * sqrt (f x)) * f' xa)) (at x within S)"
  if "(f has_derivative f') (at x within S)" "f x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. sqrt (f x)) has_derivative (\<lambda>xa. (if 0 < f x then 1 else - 1) / (2 * sqrt (f x)) * f' xa)) (at x within S)
[PROOF STEP]
by (rule has_derivative_eq_rhs[OF has_derivative_compose[OF that(1) real_sqrt_has_derivative_generic, OF that(2)]])
    (auto simp: divide_simps)


[STATEMENT]
lemma aff_dim_halfspace_ge:
  fixes a :: "'a::euclidean_space"
  shows "aff_dim {x. a \<bullet> x \<ge> r} =
        (if a = 0 \<and> r > 0 then -1 else DIM('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim {x. r \<le> a \<bullet> x} = (if a = (0::'a) \<and> 0 < r then - 1 else int DIM('a))
[PROOF STEP]
using aff_dim_halfspace_le [of "-a" "-r"]
[PROOF STATE]
proof (prove)
using this:
aff_dim {x. - a \<bullet> x \<le> - r} = (if - a = (0::'a) \<and> - r < 0 then - 1 else int DIM('a))

goal (1 subgoal):
 1. aff_dim {x. r \<le> a \<bullet> x} = (if a = (0::'a) \<and> 0 < r then - 1 else int DIM('a))
[PROOF STEP]
by simp


[STATEMENT]
lemma lhr_fps:
  fixes f :: "nat \<Rightarrow> 'a :: field" and cs :: "'a list"
  defines "N \<equiv> length cs - 1"
  assumes cs: "cs \<noteq> []"
  assumes "\<And>n. n \<ge> m \<Longrightarrow> (\<Sum>k\<le>N. cs ! k * f (n + k)) = 0"
  assumes cN: "last cs \<noteq> 0"
  shows   "Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) /
              fps_of_poly (lr_fps_denominator cs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) / fps_of_poly (lr_fps_denominator cs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) / fps_of_poly (lr_fps_denominator cs)
[PROOF STEP]
define p and q
    where "p = Poly (map (\<lambda>k. \<Sum>i\<le>min N k. cs ! (N - i) * f (k - i)) [0..<N + m])"
      and "q = Poly (map (\<lambda>k. cs ! (N - k)) [0..<Suc N])"
[PROOF STATE]
proof (state)
this:
p = Poly (map (\<lambda>k. \<Sum>i\<le>min N k. cs ! (N - i) * f (k - i)) [0..<N + m])
q = Poly (map (\<lambda>k. cs ! (N - k)) [0..<Suc N])

goal (1 subgoal):
 1. Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) / fps_of_poly (lr_fps_denominator cs)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
N \<equiv> length cs - 1
cs \<noteq> []
m \<le> ?n \<Longrightarrow> (\<Sum>k\<le>N. cs ! k * f (?n + k)) = (0::'a)
last cs \<noteq> (0::'a)
[PROOF STEP]
have "Abs_fps f = fps_of_poly p / fps_of_poly q"
[PROOF STATE]
proof (prove)
using this:
N \<equiv> length cs - 1
cs \<noteq> []
m \<le> ?n \<Longrightarrow> (\<Sum>k\<le>N. cs ! k * f (?n + k)) = (0::'a)
last cs \<noteq> (0::'a)

goal (1 subgoal):
 1. Abs_fps f = fps_of_poly p / fps_of_poly q
[PROOF STEP]
unfolding p_def q_def
[PROOF STATE]
proof (prove)
using this:
N \<equiv> length cs - 1
cs \<noteq> []
m \<le> ?n \<Longrightarrow> (\<Sum>k\<le>N. cs ! k * f (?n + k)) = (0::'a)
last cs \<noteq> (0::'a)

goal (1 subgoal):
 1. Abs_fps f = fps_of_poly (Poly (map (\<lambda>k. \<Sum>i\<le>min N k. cs ! (N - i) * f (k - i)) [0..<N + m])) / fps_of_poly (Poly (map (\<lambda>k. cs ! (N - k)) [0..<Suc N]))
[PROOF STEP]
by (intro lhr_fps_aux) (simp_all add: last_conv_nth)
[PROOF STATE]
proof (state)
this:
Abs_fps f = fps_of_poly p / fps_of_poly q

goal (1 subgoal):
 1. Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) / fps_of_poly (lr_fps_denominator cs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Abs_fps f = fps_of_poly p / fps_of_poly q

goal (1 subgoal):
 1. Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) / fps_of_poly (lr_fps_denominator cs)
[PROOF STEP]
have "p = lhr_fps_numerator m cs f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = lhr_fps_numerator m cs f
[PROOF STEP]
unfolding p_def lhr_fps_numerator_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Poly (map (\<lambda>k. \<Sum>i\<le>min N k. cs ! (N - i) * f (k - i)) [0..<N + m]) = (let N = length cs - 1 in Poly (map (\<lambda>k. \<Sum>i\<le>min N k. cs ! (N - i) * f (k - i)) [0..<N + m]))
[PROOF STEP]
by (auto simp: Let_def N_def)
[PROOF STATE]
proof (state)
this:
p = lhr_fps_numerator m cs f

goal (1 subgoal):
 1. Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) / fps_of_poly (lr_fps_denominator cs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p = lhr_fps_numerator m cs f

goal (1 subgoal):
 1. Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) / fps_of_poly (lr_fps_denominator cs)
[PROOF STEP]
from cN
[PROOF STATE]
proof (chain)
picking this:
last cs \<noteq> (0::'a)
[PROOF STEP]
have "q = lr_fps_denominator cs"
[PROOF STATE]
proof (prove)
using this:
last cs \<noteq> (0::'a)

goal (1 subgoal):
 1. q = lr_fps_denominator cs
[PROOF STEP]
unfolding q_def lr_fps_denominator_def
[PROOF STATE]
proof (prove)
using this:
last cs \<noteq> (0::'a)

goal (1 subgoal):
 1. Poly (map (\<lambda>k. cs ! (N - k)) [0..<Suc N]) = Poly (rev cs)
[PROOF STEP]
by (intro poly_eqI)
       (auto simp add: nth_default_def rev_nth N_def not_less cs simp del: upt_Suc)
[PROOF STATE]
proof (state)
this:
q = lr_fps_denominator cs

goal (1 subgoal):
 1. Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) / fps_of_poly (lr_fps_denominator cs)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) / fps_of_poly (lr_fps_denominator cs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) / fps_of_poly (lr_fps_denominator cs)

goal (1 subgoal):
 1. Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) / fps_of_poly (lr_fps_denominator cs)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Abs_fps f = fps_of_poly (lhr_fps_numerator m cs f) / fps_of_poly (lr_fps_denominator cs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_fps_expansion_shift [fps_expansion_intros]:
  fixes F :: "'a :: {banach, real_normed_field} fps"
  assumes "f has_fps_expansion F" and "n \<le> subdegree F"
  assumes "c = fps_nth F n"
  shows   "(\<lambda>x. if x = 0 then c else f x / x ^ n) has_fps_expansion (fps_shift n F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / x ^ n) has_fps_expansion fps_shift n F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / x ^ n) has_fps_expansion fps_shift n F
[PROOF STEP]
have "eventually (\<lambda>x. x \<in> eball 0 (fps_conv_radius F)) (nhds 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds (0::'b). x \<in> eball (0::'b) (fps_conv_radius F)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f has_fps_expansion F
n \<le> subdegree F
c = fps_nth F n

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds (0::'b). x \<in> eball (0::'b) (fps_conv_radius F)
[PROOF STEP]
by (intro eventually_nhds_in_open) (auto simp: has_fps_expansion_def zero_ereal_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in nhds (0::?'b1). x \<in> eball (0::?'b1) (fps_conv_radius F)

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / x ^ n) has_fps_expansion fps_shift n F
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in nhds (0::?'b1). x \<in> eball (0::?'b1) (fps_conv_radius F)

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / x ^ n) has_fps_expansion fps_shift n F
[PROOF STEP]
have "eventually (\<lambda>x. eval_fps F x = f x) (nhds 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds (0::'a). eval_fps F x = f x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f has_fps_expansion F
n \<le> subdegree F
c = fps_nth F n

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds (0::'a). eval_fps F x = f x
[PROOF STEP]
by (auto simp: has_fps_expansion_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in nhds (0::'a). eval_fps F x = f x

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / x ^ n) has_fps_expansion fps_shift n F
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in nhds (0::?'b1). x \<in> eball (0::?'b1) (fps_conv_radius F)
\<forall>\<^sub>F x in nhds (0::'a). eval_fps F x = f x
[PROOF STEP]
have "eventually (\<lambda>x. eval_fps (fps_shift n F) x =
                     (if x = 0 then c else f x / x ^ n)) (nhds 0)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds (0::?'b1). x \<in> eball (0::?'b1) (fps_conv_radius F)
\<forall>\<^sub>F x in nhds (0::'a). eval_fps F x = f x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds (0::'a). eval_fps (fps_shift n F) x = (if x = (0::'a) then c else f x / x ^ n)
[PROOF STEP]
by eventually_elim (auto simp: eval_fps_shift assms)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in nhds (0::'a). eval_fps (fps_shift n F) x = (if x = (0::'a) then c else f x / x ^ n)

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / x ^ n) has_fps_expansion fps_shift n F
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
f has_fps_expansion F
n \<le> subdegree F
c = fps_nth F n
\<forall>\<^sub>F x in nhds (0::'a). eval_fps (fps_shift n F) x = (if x = (0::'a) then c else f x / x ^ n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f has_fps_expansion F
n \<le> subdegree F
c = fps_nth F n
\<forall>\<^sub>F x in nhds (0::'a). eval_fps (fps_shift n F) x = (if x = (0::'a) then c else f x / x ^ n)

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / x ^ n) has_fps_expansion fps_shift n F
[PROOF STEP]
by (auto simp: has_fps_expansion_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x = (0::'a) then c else f x / x ^ n) has_fps_expansion fps_shift n F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_eq_dec: "\<And>n::nat. m = n \<or> m \<noteq> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. m = n \<or> m \<noteq> n
[PROOF STEP]
apply (induct m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. 0 = n \<or> 0 \<noteq> n
 2. \<And>m n. (\<And>n. m = n \<or> m \<noteq> n) \<Longrightarrow> Suc m = n \<or> Suc m \<noteq> n
[PROOF STEP]
apply (case_tac n)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n. n = 0 \<Longrightarrow> 0 = n \<or> 0 \<noteq> n
 2. \<And>n nat. n = Suc nat \<Longrightarrow> 0 = n \<or> 0 \<noteq> n
 3. \<And>m n. (\<And>n. m = n \<or> m \<noteq> n) \<Longrightarrow> Suc m = n \<or> Suc m \<noteq> n
[PROOF STEP]
apply (case_tac [3] n)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>n. n = 0 \<Longrightarrow> 0 = n \<or> 0 \<noteq> n
 2. \<And>n nat. n = Suc nat \<Longrightarrow> 0 = n \<or> 0 \<noteq> n
 3. \<And>m n. \<lbrakk>\<And>n. m = n \<or> m \<noteq> n; n = 0\<rbrakk> \<Longrightarrow> Suc m = n \<or> Suc m \<noteq> n
 4. \<And>m n nat. \<lbrakk>\<And>n. m = n \<or> m \<noteq> n; n = Suc nat\<rbrakk> \<Longrightarrow> Suc m = n \<or> Suc m \<noteq> n
[PROOF STEP]
apply (simp only: nat.simps, iprover?)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_integral_powr2_from_0:
  fixes a c :: real
  assumes a_pos: "a > 0" and a_neq_1: "a \<noteq> 1" and c_nneg: "c \<ge> 0"
  shows "((\<lambda>x. a.^x) has_integral ((a.^c - 1) / (ln a))) {0..c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((.^) a has_integral (a .^ c - 1) / ln a) {0..c}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((.^) a has_integral (a .^ c - 1) / ln a) {0..c}
[PROOF STEP]
have "((\<lambda>x. a.^x) has_integral ((a.^c)/(ln a) - (a.^0)/(ln a))) {0..c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((.^) a has_integral a .^ c / ln a - a .^ 0 / ln a) {0..c}
[PROOF STEP]
proof (rule fundamental_theorem_of_calculus[OF c_nneg])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..c} \<Longrightarrow> ((\<lambda>b. a .^ b / ln a) has_vector_derivative a .^ x) (at x within {0..c})
[PROOF STEP]
fix x::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..c} \<Longrightarrow> ((\<lambda>b. a .^ b / ln a) has_vector_derivative a .^ x) (at x within {0..c})
[PROOF STEP]
assume "x \<in> {0..c}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..c}

goal (1 subgoal):
 1. \<And>x. x \<in> {0..c} \<Longrightarrow> ((\<lambda>b. a .^ b / ln a) has_vector_derivative a .^ x) (at x within {0..c})
[PROOF STEP]
show "((\<lambda>y. a.^y / ln a) has_vector_derivative a.^x) (at x within {0..c})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>y. a .^ y / ln a) has_vector_derivative a .^ x) (at x within {0..c})
[PROOF STEP]
using has_real_derivative_powr2[OF a_pos, of x]
[PROOF STATE]
proof (prove)
using this:
((.^) a has_real_derivative a .^ x * ln a) (at x)

goal (1 subgoal):
 1. ((\<lambda>y. a .^ y / ln a) has_vector_derivative a .^ x) (at x within {0..c})
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((.^) a has_real_derivative a .^ x * ln a) (at x) \<Longrightarrow> ((\<lambda>y. a .^ y / ln a) has_vector_derivative a .^ x) (at x within {0..c})
[PROOF STEP]
apply (drule DERIV_cdivide[where c = "ln a"], simp add: assms)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. a .^ x / ln a) has_real_derivative a .^ x) (at x) \<Longrightarrow> ((\<lambda>y. a .^ y / ln a) has_vector_derivative a .^ x) (at x within {0..c})
[PROOF STEP]
apply (rule has_vector_derivative_within_subset[where S=UNIV and T="{0..c}"], auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. a .^ x / ln a) has_real_derivative a .^ x) (at x) \<Longrightarrow> ((\<lambda>y. a .^ y / ln a) has_vector_derivative a .^ x) (at x)
[PROOF STEP]
by (rule iffD1[OF has_real_derivative_iff_has_vector_derivative])
[PROOF STATE]
proof (state)
this:
((\<lambda>y. a .^ y / ln a) has_vector_derivative a .^ x) (at x within {0..c})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((.^) a has_integral a .^ c / ln a - a .^ 0 / ln a) {0..c}

goal (1 subgoal):
 1. ((.^) a has_integral (a .^ c - 1) / ln a) {0..c}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((.^) a has_integral a .^ c / ln a - a .^ 0 / ln a) {0..c}

goal (1 subgoal):
 1. ((.^) a has_integral (a .^ c - 1) / ln a) {0..c}
[PROOF STEP]
using assms powr_zero_eq_one
[PROOF STATE]
proof (prove)
using this:
((.^) a has_integral a .^ c / ln a - a .^ 0 / ln a) {0..c}
0 < a
a \<noteq> 1
0 \<le> c
?x .^ (0::?'a) = (if ?x = (0::?'a) then 0::?'a else (1::?'a))

goal (1 subgoal):
 1. ((.^) a has_integral (a .^ c - 1) / ln a) {0..c}
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
((.^) a has_integral (a .^ c - 1) / ln a) {0..c}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lemma2_6_2_set: assumes "S \<subseteq> T" shows "ds r S \<subseteq> ds r T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<down>s S \<subseteq> r \<down>s T
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> T

goal (1 subgoal):
 1. r \<down>s S \<subseteq> r \<down>s T
[PROOF STEP]
unfolding ds_def
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> T

goal (1 subgoal):
 1. {y. \<exists>x\<in>S. (y, x) \<in> r} \<subseteq> {y. \<exists>x\<in>T. (y, x) \<in> r}
[PROOF STEP]
by auto


[STATEMENT]
lemma sq_norm_poly_of_vec [simp]:
  fixes v :: "'a :: conjugatable_ring vec"
  shows "\<parallel>poly_of_vec v\<parallel>\<^sup>2 = \<parallel>v\<parallel>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>poly_of_vec v\<parallel>\<^sup>2 = \<parallel>v\<parallel>\<^sup>2
[PROOF STEP]
apply (unfold sq_norm_poly_def sq_norm_vec_def coeffs_poly_of_vec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map sq_norm (rev (dropWhile ((=) (0::'a)) (list_of_vec v)))) = sum_list (map sq_norm (list_of_vec v))
[PROOF STEP]
apply (fold rev_map)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (rev (map sq_norm (dropWhile ((=) (0::'a)) (list_of_vec v)))) = sum_list (map sq_norm (list_of_vec v))
[PROOF STEP]
apply (fold sum_mset_sum_list)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># (mset (rev (map sq_norm (dropWhile ((=) (0::'a)) (list_of_vec v))))) = \<Sum>\<^sub># (mset (map sq_norm (list_of_vec v)))
[PROOF STEP]
apply (unfold mset_rev)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># (mset (map sq_norm (dropWhile ((=) (0::'a)) (list_of_vec v)))) = \<Sum>\<^sub># (mset (map sq_norm (list_of_vec v)))
[PROOF STEP]
apply (unfold sum_mset_sum_list)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map sq_norm (dropWhile ((=) (0::'a)) (list_of_vec v))) = sum_list (map sq_norm (list_of_vec v))
[PROOF STEP]
by (auto intro: sum_list_map_dropWhile0)


[STATEMENT]
lemma max0_id_pos: assumes x: "x \<succeq> \<zero>" and wf: "x \<in> carrier R"
  shows "Max \<zero> x = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max \<zero> x = x
[PROOF STEP]
unfolding max_comm[OF zero_closed wf]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max x \<zero> = x
[PROOF STEP]
by (rule max_id[OF wf zero_closed x])


[STATEMENT]
lemma Sup_MPLS_s_lt_if:
  fixes PROB s k
  assumes "(\<forall>x\<in>MPLS_s PROB s. x < k)"
  shows "Sup (MPLS_s PROB s) < k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (MPLS_s PROB s) < k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup (MPLS_s PROB s) < k
[PROOF STEP]
have "MPLS_s PROB s \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPLS_s PROB s \<noteq> {}
[PROOF STEP]
using bound_main_lemma_s_3
[PROOF STATE]
proof (prove)
using this:
MPLS_s ?PROB ?s \<noteq> {}

goal (1 subgoal):
 1. MPLS_s PROB s \<noteq> {}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
MPLS_s PROB s \<noteq> {}

goal (1 subgoal):
 1. Sup (MPLS_s PROB s) < k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
MPLS_s PROB s \<noteq> {}
[PROOF STEP]
have "Sup (MPLS_s PROB s) \<in> MPLS_s PROB s"
[PROOF STATE]
proof (prove)
using this:
MPLS_s PROB s \<noteq> {}

goal (1 subgoal):
 1. Sup (MPLS_s PROB s) \<in> MPLS_s PROB s
[PROOF STEP]
using assms Sup_nat_def bounded_nat_set_is_finite
[PROOF STATE]
proof (prove)
using this:
MPLS_s PROB s \<noteq> {}
\<forall>x\<in>MPLS_s PROB s. x < k
Sup ?X = (if ?X = {} then 0 else Max ?X)
\<forall>i\<in>?N. i < ?n \<Longrightarrow> finite ?N

goal (1 subgoal):
 1. Sup (MPLS_s PROB s) \<in> MPLS_s PROB s
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
Sup (MPLS_s PROB s) \<in> MPLS_s PROB s

goal (1 subgoal):
 1. Sup (MPLS_s PROB s) < k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sup (MPLS_s PROB s) \<in> MPLS_s PROB s
[PROOF STEP]
show "Sup (MPLS_s PROB s) < k"
[PROOF STATE]
proof (prove)
using this:
Sup (MPLS_s PROB s) \<in> MPLS_s PROB s

goal (1 subgoal):
 1. Sup (MPLS_s PROB s) < k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Sup (MPLS_s PROB s) \<in> MPLS_s PROB s
\<forall>x\<in>MPLS_s PROB s. x < k

goal (1 subgoal):
 1. Sup (MPLS_s PROB s) < k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Sup (MPLS_s PROB s) < k

goal:
No subgoals!
[PROOF STEP]
qed

\<comment> \<open>NOTE type of `P` had to be fixed (type mismatch in goal).\<close>


[STATEMENT]
lemma less_length_takeWhile_conv: "i < length (takeWhile P l) \<longleftrightarrow> (i<length l \<and> (\<forall>j\<le>i. P (l!j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < length (takeWhile P l)) = (i < length l \<and> (\<forall>j\<le>i. P (l ! j)))
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. i < length (takeWhile P l) \<Longrightarrow> i < length l
 2. \<And>j. \<lbrakk>i < length (takeWhile P l); j \<le> i\<rbrakk> \<Longrightarrow> P (l ! j)
 3. \<lbrakk>i < length l; \<forall>j\<le>i. P (l ! j)\<rbrakk> \<Longrightarrow> i < length (takeWhile P l)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length (takeWhile P l) \<Longrightarrow> i < length l
[PROOF STEP]
using length_takeWhile_le less_le_trans
[PROOF STATE]
proof (prove)
using this:
length (takeWhile ?P ?xs) \<le> length ?xs
\<lbrakk>?x < ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x < ?z

goal (1 subgoal):
 1. i < length (takeWhile P l) \<Longrightarrow> i < length l
[PROOF STEP]
by blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>j. \<lbrakk>i < length (takeWhile P l); j \<le> i\<rbrakk> \<Longrightarrow> P (l ! j)
 2. \<lbrakk>i < length l; \<forall>j\<le>i. P (l ! j)\<rbrakk> \<Longrightarrow> i < length (takeWhile P l)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length (takeWhile P l); j_ \<le> i\<rbrakk> \<Longrightarrow> P (l ! j_)
[PROOF STEP]
by (metis dual_order.strict_trans2 nth_mem set_takeWhileD takeWhile_nth)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length l; \<forall>j\<le>i. P (l ! j)\<rbrakk> \<Longrightarrow> i < length (takeWhile P l)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length l; \<forall>j\<le>i. P (l ! j)\<rbrakk> \<Longrightarrow> i < length (takeWhile P l)
[PROOF STEP]
by (meson less_le_trans not_le_imp_less nth_length_takeWhile)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sorted_wrt_refl_nth_mono:
  assumes "reflp P" and "sorted_wrt P xs" and "i \<le> j" and "j < length xs"
  shows "P (xs ! i) (xs ! j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (xs ! i) (xs ! j)
[PROOF STEP]
proof (cases "i < j")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i < j \<Longrightarrow> P (xs ! i) (xs ! j)
 2. \<not> i < j \<Longrightarrow> P (xs ! i) (xs ! j)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i < j

goal (2 subgoals):
 1. i < j \<Longrightarrow> P (xs ! i) (xs ! j)
 2. \<not> i < j \<Longrightarrow> P (xs ! i) (xs ! j)
[PROOF STEP]
from assms(2) this assms(4)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt P xs
i < j
j < length xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted_wrt P xs
i < j
j < length xs

goal (1 subgoal):
 1. P (xs ! i) (xs ! j)
[PROOF STEP]
by (rule sorted_wrt_nth_less)
[PROOF STATE]
proof (state)
this:
P (xs ! i) (xs ! j)

goal (1 subgoal):
 1. \<not> i < j \<Longrightarrow> P (xs ! i) (xs ! j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> i < j \<Longrightarrow> P (xs ! i) (xs ! j)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> i < j

goal (1 subgoal):
 1. \<not> i < j \<Longrightarrow> P (xs ! i) (xs ! j)
[PROOF STEP]
with assms(3)
[PROOF STATE]
proof (chain)
picking this:
i \<le> j
\<not> i < j
[PROOF STEP]
have "i = j"
[PROOF STATE]
proof (prove)
using this:
i \<le> j
\<not> i < j

goal (1 subgoal):
 1. i = j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i = j

goal (1 subgoal):
 1. \<not> i < j \<Longrightarrow> P (xs ! i) (xs ! j)
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
reflp P
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
reflp P

goal (1 subgoal):
 1. P (xs ! i) (xs ! j)
[PROOF STEP]
unfolding \<open>i = j\<close>
[PROOF STATE]
proof (prove)
using this:
reflp P

goal (1 subgoal):
 1. P (xs ! j) (xs ! j)
[PROOF STEP]
by (rule reflpD)
[PROOF STATE]
proof (state)
this:
P (xs ! i) (xs ! j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma starlike_convex_subset:
  assumes S: "a \<in> S" "closed_segment b c \<subseteq> S" and subs: "\<And>x. x \<in> S \<Longrightarrow> closed_segment a x \<subseteq> S"
  shows "convex hull {a,b,c} \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull {a, b, c} \<subseteq> S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex hull {a, b, c} \<subseteq> S
[PROOF STEP]
have "convex hull {b, c} \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull {b, c} \<subseteq> S
[PROOF STEP]
using assms(2) segment_convex_hull
[PROOF STATE]
proof (prove)
using this:
closed_segment b c \<subseteq> S
closed_segment ?a ?b = convex hull {?a, ?b}

goal (1 subgoal):
 1. convex hull {b, c} \<subseteq> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
convex hull {b, c} \<subseteq> S

goal (1 subgoal):
 1. convex hull {a, b, c} \<subseteq> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
convex hull {b, c} \<subseteq> S
[PROOF STEP]
have "\<And>u v d. \<lbrakk>0 \<le> u; 0 \<le> v; u + v = 1; d \<in> convex hull {b, c}\<rbrakk> \<Longrightarrow> u *\<^sub>R a + v *\<^sub>R d \<in> S"
[PROOF STATE]
proof (prove)
using this:
convex hull {b, c} \<subseteq> S

goal (1 subgoal):
 1. \<And>u v d. \<lbrakk>0 \<le> u; 0 \<le> v; u + v = 1; d \<in> convex hull {b, c}\<rbrakk> \<Longrightarrow> u *\<^sub>R a + v *\<^sub>R d \<in> S
[PROOF STEP]
by (meson subs convexD convex_closed_segment ends_in_segment subsetCE)
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> ?u; 0 \<le> ?v; ?u + ?v = 1; ?d \<in> convex hull {b, c}\<rbrakk> \<Longrightarrow> ?u *\<^sub>R a + ?v *\<^sub>R ?d \<in> S

goal (1 subgoal):
 1. convex hull {a, b, c} \<subseteq> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 \<le> ?u; 0 \<le> ?v; ?u + ?v = 1; ?d \<in> convex hull {b, c}\<rbrakk> \<Longrightarrow> ?u *\<^sub>R a + ?v *\<^sub>R ?d \<in> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?u; 0 \<le> ?v; ?u + ?v = 1; ?d \<in> convex hull {b, c}\<rbrakk> \<Longrightarrow> ?u *\<^sub>R a + ?v *\<^sub>R ?d \<in> S

goal (1 subgoal):
 1. convex hull {a, b, c} \<subseteq> S
[PROOF STEP]
by (auto simp add: convex_hull_insert [of "{b,c}" a])
[PROOF STATE]
proof (state)
this:
convex hull {a, b, c} \<subseteq> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) commut_normal:
  assumes "subgroup H G" and "N\<lhd>G"
  shows "H<#>N = N<#>H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H <#> N = N <#> H
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. H <#> N = N <#> H
[PROOF STEP]
have aux1: "{H <#> N} = {\<Union>h\<in>H. h <# N }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {H <#> N} = {\<Union>h\<in>H. h <# N}
[PROOF STEP]
unfolding set_mult_def l_coset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<Union>h\<in>H. \<Union>k\<in>N. {h \<otimes> k}} = {\<Union>h\<in>H. \<Union>ha\<in>N. {h \<otimes> ha}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{H <#> N} = {\<Union>h\<in>H. h <# N}

goal (1 subgoal):
 1. H <#> N = N <#> H
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{H <#> N} = {\<Union>h\<in>H. h <# N}

goal (1 subgoal):
 1. H <#> N = N <#> H
[PROOF STEP]
have "... = {\<Union>h\<in>H. N #> h }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<Union>h\<in>H. h <# N} = {\<Union> ((#>) N ` H)}
[PROOF STEP]
using assms normal.coset_eq subgroup.mem_carrier
[PROOF STATE]
proof (prove)
using this:
subgroup H G
N \<lhd> G
?H \<lhd> ?G \<Longrightarrow> \<forall>x\<in>carrier ?G. ?H #>\<^bsub>?G\<^esub> x = x <#\<^bsub>?G\<^esub> ?H
\<lbrakk>subgroup ?H ?G; ?x \<in> ?H\<rbrakk> \<Longrightarrow> ?x \<in> carrier ?G

goal (1 subgoal):
 1. {\<Union>h\<in>H. h <# N} = {\<Union> ((#>) N ` H)}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
{\<Union>h\<in>H. h <# N} = {\<Union> ((#>) N ` H)}

goal (1 subgoal):
 1. H <#> N = N <#> H
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{\<Union>h\<in>H. h <# N} = {\<Union> ((#>) N ` H)}

goal (1 subgoal):
 1. H <#> N = N <#> H
[PROOF STEP]
have aux2: "{N <#> H} = {\<Union>h\<in>H. N #> h }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {N <#> H} = {\<Union> ((#>) N ` H)}
[PROOF STEP]
unfolding set_mult_def r_coset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<Union>h\<in>N. \<Union>k\<in>H. {h \<otimes> k}} = {\<Union>h\<in>H. \<Union>ha\<in>N. {ha \<otimes> h}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{N <#> H} = {\<Union> ((#>) N ` H)}

goal (1 subgoal):
 1. H <#> N = N <#> H
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{H <#> N} = {\<Union>h\<in>H. h <# N}
{\<Union>h\<in>H. h <# N} = {\<Union> ((#>) N ` H)}
{N <#> H} = {\<Union> ((#>) N ` H)}
[PROOF STEP]
show "H<#>N = N<#>H"
[PROOF STATE]
proof (prove)
using this:
{H <#> N} = {\<Union>h\<in>H. h <# N}
{\<Union>h\<in>H. h <# N} = {\<Union> ((#>) N ` H)}
{N <#> H} = {\<Union> ((#>) N ` H)}

goal (1 subgoal):
 1. H <#> N = N <#> H
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
H <#> N = N <#> H

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ic_union_ci_not_closed:
  assumes "a < (b::real)" "b < c"
  shows "\<not> closed ({a..<b} \<union> {b<..c})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> closed ({a..<b} \<union> {b<..c})
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> closed ({a..<b} \<union> {b<..c})
[PROOF STEP]
have "b \<notin> ({a..<b} \<union> {b<..c})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<notin> {a..<b} \<union> {b<..c}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<notin> {a..<b} \<union> {b<..c}

goal (1 subgoal):
 1. \<not> closed ({a..<b} \<union> {b<..c})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<notin> {a..<b} \<union> {b<..c}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b \<notin> {a..<b} \<union> {b<..c}

goal (1 subgoal):
 1. \<not> closed ({a..<b} \<union> {b<..c})
[PROOF STEP]
using assms frontier_subset_eq frontier_ic_union_ci[OF assms]
[PROOF STATE]
proof (prove)
using this:
b \<notin> {a..<b} \<union> {b<..c}
a < b
b < c
(frontier ?S \<subseteq> ?S) = closed ?S
b \<in> frontier ({a..<b} \<union> {b<..c})

goal (1 subgoal):
 1. \<not> closed ({a..<b} \<union> {b<..c})
[PROOF STEP]
by (auto simp only: subset_iff)
[PROOF STATE]
proof (state)
this:
\<not> closed ({a..<b} \<union> {b<..c})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sturm_adjacent_root_propagate_left:
  assumes "i < length (sturm (p :: real poly)) - 1"
  assumes "poly (sturm p ! i) x = 0"
      and "poly (sturm p ! (i + 1)) x = 0"
  shows "\<forall>j\<le>i+1. poly (sturm p ! j) x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>j\<le>i + 1. poly (sturm p ! j) x = 0
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
poly (sturm p ! i) x = 0

goal (1 subgoal):
 1. \<forall>j\<le>i + 1. poly (sturm p ! j) x = 0
[PROOF STEP]
proof (intro sturm_adjacent_root_aux[OF assms(1,2,3)], goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia xa. \<lbrakk>poly (sturm p ! i) x = 0; ia < length (sturm p) - 2; poly (sturm p ! (ia + 1)) xa = 0\<rbrakk> \<Longrightarrow> sgn (poly (sturm p ! (ia + 2)) xa) = - sgn (poly (sturm p ! ia) xa)
[PROOF STEP]
case prems: (1 i x)
[PROOF STATE]
proof (state)
this:
poly (sturm p ! i) x = 0
i < length (sturm p) - 2
poly (sturm p ! (i + 1)) x = 0

goal (1 subgoal):
 1. \<And>ia xa. \<lbrakk>poly (sturm p ! i) x = 0; ia < length (sturm p) - 2; poly (sturm p ! (ia + 1)) xa = 0\<rbrakk> \<Longrightarrow> sgn (poly (sturm p ! (ia + 2)) xa) = - sgn (poly (sturm p ! ia) xa)
[PROOF STEP]
let ?p = "sturm p ! i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia xa. \<lbrakk>poly (sturm p ! i) x = 0; ia < length (sturm p) - 2; poly (sturm p ! (ia + 1)) xa = 0\<rbrakk> \<Longrightarrow> sgn (poly (sturm p ! (ia + 2)) xa) = - sgn (poly (sturm p ! ia) xa)
[PROOF STEP]
let ?q = "sturm p ! (i + 1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia xa. \<lbrakk>poly (sturm p ! i) x = 0; ia < length (sturm p) - 2; poly (sturm p ! (ia + 1)) xa = 0\<rbrakk> \<Longrightarrow> sgn (poly (sturm p ! (ia + 2)) xa) = - sgn (poly (sturm p ! ia) xa)
[PROOF STEP]
let ?r = "sturm p ! (i + 2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia xa. \<lbrakk>poly (sturm p ! i) x = 0; ia < length (sturm p) - 2; poly (sturm p ! (ia + 1)) xa = 0\<rbrakk> \<Longrightarrow> sgn (poly (sturm p ! (ia + 2)) xa) = - sgn (poly (sturm p ! ia) xa)
[PROOF STEP]
from sturm_indices[OF prems(2)]
[PROOF STATE]
proof (chain)
picking this:
sturm p ! (i + 2) = - (sturm p ! i mod sturm p ! (i + 1))
[PROOF STEP]
have "?p = ?p div ?q * ?q - ?r"
[PROOF STATE]
proof (prove)
using this:
sturm p ! (i + 2) = - (sturm p ! i mod sturm p ! (i + 1))

goal (1 subgoal):
 1. sturm p ! i = sturm p ! i div sturm p ! (i + 1) * sturm p ! (i + 1) - sturm p ! (i + 2)
[PROOF STEP]
by (simp add: div_mult_mod_eq)
[PROOF STATE]
proof (state)
this:
sturm p ! i = sturm p ! i div sturm p ! (i + 1) * sturm p ! (i + 1) - sturm p ! (i + 2)

goal (1 subgoal):
 1. \<And>ia xa. \<lbrakk>poly (sturm p ! i) x = 0; ia < length (sturm p) - 2; poly (sturm p ! (ia + 1)) xa = 0\<rbrakk> \<Longrightarrow> sgn (poly (sturm p ! (ia + 2)) xa) = - sgn (poly (sturm p ! ia) xa)
[PROOF STEP]
hence "poly ?p x = poly (?p div ?q * ?q - ?r) x"
[PROOF STATE]
proof (prove)
using this:
sturm p ! i = sturm p ! i div sturm p ! (i + 1) * sturm p ! (i + 1) - sturm p ! (i + 2)

goal (1 subgoal):
 1. poly (sturm p ! i) x = poly (sturm p ! i div sturm p ! (i + 1) * sturm p ! (i + 1) - sturm p ! (i + 2)) x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly (sturm p ! i) x = poly (sturm p ! i div sturm p ! (i + 1) * sturm p ! (i + 1) - sturm p ! (i + 2)) x

goal (1 subgoal):
 1. \<And>ia xa. \<lbrakk>poly (sturm p ! i) x = 0; ia < length (sturm p) - 2; poly (sturm p ! (ia + 1)) xa = 0\<rbrakk> \<Longrightarrow> sgn (poly (sturm p ! (ia + 2)) xa) = - sgn (poly (sturm p ! ia) xa)
[PROOF STEP]
hence "poly ?p x = -poly ?r x"
[PROOF STATE]
proof (prove)
using this:
poly (sturm p ! i) x = poly (sturm p ! i div sturm p ! (i + 1) * sturm p ! (i + 1) - sturm p ! (i + 2)) x

goal (1 subgoal):
 1. poly (sturm p ! i) x = - poly (sturm p ! (i + 2)) x
[PROOF STEP]
using prems(3)
[PROOF STATE]
proof (prove)
using this:
poly (sturm p ! i) x = poly (sturm p ! i div sturm p ! (i + 1) * sturm p ! (i + 1) - sturm p ! (i + 2)) x
poly (sturm p ! (i + 1)) x = 0

goal (1 subgoal):
 1. poly (sturm p ! i) x = - poly (sturm p ! (i + 2)) x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly (sturm p ! i) x = - poly (sturm p ! (i + 2)) x

goal (1 subgoal):
 1. \<And>ia xa. \<lbrakk>poly (sturm p ! i) x = 0; ia < length (sturm p) - 2; poly (sturm p ! (ia + 1)) xa = 0\<rbrakk> \<Longrightarrow> sgn (poly (sturm p ! (ia + 2)) xa) = - sgn (poly (sturm p ! ia) xa)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
poly (sturm p ! i) x = - poly (sturm p ! (i + 2)) x

goal (1 subgoal):
 1. sgn (poly (sturm p ! (i + 2)) x) = - sgn (poly (sturm p ! i) x)
[PROOF STEP]
by (simp add: sgn_minus)
[PROOF STATE]
proof (state)
this:
sgn (poly (sturm p ! (i + 2)) x) = - sgn (poly (sturm p ! i) x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_pow_eone[simp]: assumes x_in_G: "x \<in> carrier G" shows "x [^] (1::nat) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^] 1 = x
[PROOF STEP]
using nat_pow_Suc [of x 0]
[PROOF STATE]
proof (prove)
using this:
x [^] Suc 0 = x [^] 0 \<otimes> x

goal (1 subgoal):
 1. x [^] 1 = x
[PROOF STEP]
unfolding nat_pow_0 [of x]
[PROOF STATE]
proof (prove)
using this:
x [^] Suc 0 = \<one> \<otimes> x

goal (1 subgoal):
 1. x [^] 1 = x
[PROOF STEP]
unfolding l_one [OF x_in_G]
[PROOF STATE]
proof (prove)
using this:
x [^] Suc 0 = x

goal (1 subgoal):
 1. x [^] 1 = x
[PROOF STEP]
by simp


[STATEMENT]
lemma f_chain_in_rtrancl:
  assumes m_le_n: "m \<le> n" and f_chain: "\<forall>i \<in> {m..<n}. (f i, f (Suc i)) \<in> R"
  shows "(f m, f n) \<in> R\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f m, f n) \<in> R\<^sup>*
[PROOF STEP]
proof (rule relpow_imp_rtrancl, rule relpow_fun_conv[THEN iffD2], intro exI conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?f5 0 = f m
 2. ?f5 ?n = f n
 3. \<forall>i<?n. (?f5 i, ?f5 (Suc i)) \<in> R
[PROOF STEP]
let ?g = "\<lambda>i. f (m + i)"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?f5 0 = f m
 2. ?f5 ?n = f n
 3. \<forall>i<?n. (?f5 i, ?f5 (Suc i)) \<in> R
[PROOF STEP]
let ?k = "n - m"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?f5 0 = f m
 2. ?f5 ?n = f n
 3. \<forall>i<?n. (?f5 i, ?f5 (Suc i)) \<in> R
[PROOF STEP]
show "?g 0 = f m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (m + 0) = f m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f (m + 0) = f m

goal (2 subgoals):
 1. f (m + ?n) = f n
 2. \<forall>i<?n. (f (m + i), f (m + Suc i)) \<in> R
[PROOF STEP]
show "?g ?k = f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (m + (n - m)) = f n
[PROOF STEP]
using m_le_n
[PROOF STATE]
proof (prove)
using this:
m \<le> n

goal (1 subgoal):
 1. f (m + (n - m)) = f n
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
f (m + (n - m)) = f n

goal (1 subgoal):
 1. \<forall>i<n - m. (f (m + i), f (m + Suc i)) \<in> R
[PROOF STEP]
show "(\<forall>i < ?k. (?g i, ?g (Suc i)) \<in> R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<n - m. (f (m + i), f (m + Suc i)) \<in> R
[PROOF STEP]
by (simp add: f_chain)
[PROOF STATE]
proof (state)
this:
\<forall>i<n - m. (f (m + i), f (m + Suc i)) \<in> R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  prod_3: "prod f {(1::nat)..3} = f 1 * f 2 * f 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f {1..3} = f 1 * f 2 * f 3
[PROOF STEP]
by (simp add: eval_nat_numeral atLeastAtMostSuc_conv mult.commute)


[STATEMENT]
theorem c_intersect_is_pr: "c_intersect \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_intersect \<in> PrimRec2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_intersect \<in> PrimRec2
[PROOF STEP]
define f where "f u v = c_diff (c_union u v) (c_union (c_diff u v) (c_diff v u))" for u v
[PROOF STATE]
proof (state)
this:
f ?u ?v = c_diff (c_union ?u ?v) (c_union (c_diff ?u ?v) (c_diff ?v ?u))

goal (1 subgoal):
 1. c_intersect \<in> PrimRec2
[PROOF STEP]
from c_diff_is_pr c_union_is_pr
[PROOF STATE]
proof (chain)
picking this:
c_diff \<in> PrimRec2
c_union \<in> PrimRec2
[PROOF STEP]
have f_is_pr: "f \<in> PrimRec2"
[PROOF STATE]
proof (prove)
using this:
c_diff \<in> PrimRec2
c_union \<in> PrimRec2

goal (1 subgoal):
 1. f \<in> PrimRec2
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
using this:
c_diff \<in> PrimRec2
c_union \<in> PrimRec2

goal (1 subgoal):
 1. (\<lambda>u v. c_diff (c_union u v) (c_union (c_diff u v) (c_diff v u))) \<in> PrimRec2
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
f \<in> PrimRec2

goal (1 subgoal):
 1. c_intersect \<in> PrimRec2
[PROOF STEP]
have "\<And> u v. f u v = c_intersect u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u v. f u v = c_intersect u v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u v. f u v = c_intersect u v
[PROOF STEP]
fix u v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u v. f u v = c_intersect u v
[PROOF STEP]
show "f u v = c_intersect u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
let ?A = "nat_to_set u"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
let ?B = "nat_to_set v"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
have A_fin: "finite ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (nat_to_set u)
[PROOF STEP]
by (rule nat_to_set_is_finite)
[PROOF STATE]
proof (state)
this:
finite (nat_to_set u)

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
have B_fin: "finite ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (nat_to_set v)
[PROOF STEP]
by (rule nat_to_set_is_finite)
[PROOF STATE]
proof (state)
this:
finite (nat_to_set v)

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
have S1: "c_union u v = set_to_nat (?A \<union> ?B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_union u v = set_to_nat (nat_to_set u \<union> nat_to_set v)
[PROOF STEP]
by (simp add: c_union_def)
[PROOF STATE]
proof (state)
this:
c_union u v = set_to_nat (nat_to_set u \<union> nat_to_set v)

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
have S2: "c_diff u v = set_to_nat (?A - ?B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_diff u v = set_to_nat (nat_to_set u - nat_to_set v)
[PROOF STEP]
by (simp add: c_diff_def)
[PROOF STATE]
proof (state)
this:
c_diff u v = set_to_nat (nat_to_set u - nat_to_set v)

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
have S3: "c_diff v u = set_to_nat (?B - ?A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_diff v u = set_to_nat (nat_to_set v - nat_to_set u)
[PROOF STEP]
by (simp add: c_diff_def)
[PROOF STATE]
proof (state)
this:
c_diff v u = set_to_nat (nat_to_set v - nat_to_set u)

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
from S2 A_fin B_fin
[PROOF STATE]
proof (chain)
picking this:
c_diff u v = set_to_nat (nat_to_set u - nat_to_set v)
finite (nat_to_set u)
finite (nat_to_set v)
[PROOF STEP]
have S4: "nat_to_set (c_diff u v) = ?A - ?B"
[PROOF STATE]
proof (prove)
using this:
c_diff u v = set_to_nat (nat_to_set u - nat_to_set v)
finite (nat_to_set u)
finite (nat_to_set v)

goal (1 subgoal):
 1. nat_to_set (c_diff u v) = nat_to_set u - nat_to_set v
[PROOF STEP]
by  (simp add: nat_to_set_srj)
[PROOF STATE]
proof (state)
this:
nat_to_set (c_diff u v) = nat_to_set u - nat_to_set v

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
from S3 A_fin B_fin
[PROOF STATE]
proof (chain)
picking this:
c_diff v u = set_to_nat (nat_to_set v - nat_to_set u)
finite (nat_to_set u)
finite (nat_to_set v)
[PROOF STEP]
have S5: "nat_to_set (c_diff v u) = ?B - ?A"
[PROOF STATE]
proof (prove)
using this:
c_diff v u = set_to_nat (nat_to_set v - nat_to_set u)
finite (nat_to_set u)
finite (nat_to_set v)

goal (1 subgoal):
 1. nat_to_set (c_diff v u) = nat_to_set v - nat_to_set u
[PROOF STEP]
by  (simp add: nat_to_set_srj)
[PROOF STATE]
proof (state)
this:
nat_to_set (c_diff v u) = nat_to_set v - nat_to_set u

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
from S4 S5
[PROOF STATE]
proof (chain)
picking this:
nat_to_set (c_diff u v) = nat_to_set u - nat_to_set v
nat_to_set (c_diff v u) = nat_to_set v - nat_to_set u
[PROOF STEP]
have S6: "c_union (c_diff u v) (c_diff v u) = set_to_nat ((?A - ?B) \<union> (?B - ?A))"
[PROOF STATE]
proof (prove)
using this:
nat_to_set (c_diff u v) = nat_to_set u - nat_to_set v
nat_to_set (c_diff v u) = nat_to_set v - nat_to_set u

goal (1 subgoal):
 1. c_union (c_diff u v) (c_diff v u) = set_to_nat (nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u))
[PROOF STEP]
by (simp add: c_union_def)
[PROOF STATE]
proof (state)
this:
c_union (c_diff u v) (c_diff v u) = set_to_nat (nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u))

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
from S1 A_fin B_fin
[PROOF STATE]
proof (chain)
picking this:
c_union u v = set_to_nat (nat_to_set u \<union> nat_to_set v)
finite (nat_to_set u)
finite (nat_to_set v)
[PROOF STEP]
have S7: "nat_to_set (c_union u v) = ?A \<union> ?B"
[PROOF STATE]
proof (prove)
using this:
c_union u v = set_to_nat (nat_to_set u \<union> nat_to_set v)
finite (nat_to_set u)
finite (nat_to_set v)

goal (1 subgoal):
 1. nat_to_set (c_union u v) = nat_to_set u \<union> nat_to_set v
[PROOF STEP]
by  (simp add: nat_to_set_srj)
[PROOF STATE]
proof (state)
this:
nat_to_set (c_union u v) = nat_to_set u \<union> nat_to_set v

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
from S6 A_fin B_fin
[PROOF STATE]
proof (chain)
picking this:
c_union (c_diff u v) (c_diff v u) = set_to_nat (nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u))
finite (nat_to_set u)
finite (nat_to_set v)
[PROOF STEP]
have S8: "nat_to_set (c_union (c_diff u v) (c_diff v u)) = (?A - ?B) \<union> (?B - ?A)"
[PROOF STATE]
proof (prove)
using this:
c_union (c_diff u v) (c_diff v u) = set_to_nat (nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u))
finite (nat_to_set u)
finite (nat_to_set v)

goal (1 subgoal):
 1. nat_to_set (c_union (c_diff u v) (c_diff v u)) = nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u)
[PROOF STEP]
by  (simp add: nat_to_set_srj)
[PROOF STATE]
proof (state)
this:
nat_to_set (c_union (c_diff u v) (c_diff v u)) = nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u)

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
from S7 S8
[PROOF STATE]
proof (chain)
picking this:
nat_to_set (c_union u v) = nat_to_set u \<union> nat_to_set v
nat_to_set (c_union (c_diff u v) (c_diff v u)) = nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u)
[PROOF STEP]
have S9: "f u v = set_to_nat ((?A \<union> ?B) - ((?A - ?B) \<union> (?B - ?A)))"
[PROOF STATE]
proof (prove)
using this:
nat_to_set (c_union u v) = nat_to_set u \<union> nat_to_set v
nat_to_set (c_union (c_diff u v) (c_diff v u)) = nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u)

goal (1 subgoal):
 1. f u v = set_to_nat (nat_to_set u \<union> nat_to_set v - (nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u)))
[PROOF STEP]
by (simp add: c_diff_def f_def)
[PROOF STATE]
proof (state)
this:
f u v = set_to_nat (nat_to_set u \<union> nat_to_set v - (nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u)))

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
have S10: "?A \<inter> ?B = (?A \<union> ?B) - ((?A - ?B) \<union> (?B - ?A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_set u \<inter> nat_to_set v = nat_to_set u \<union> nat_to_set v - (nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_set u \<inter> nat_to_set v = nat_to_set u \<union> nat_to_set v - (nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u))

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
with S9
[PROOF STATE]
proof (chain)
picking this:
f u v = set_to_nat (nat_to_set u \<union> nat_to_set v - (nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u)))
nat_to_set u \<inter> nat_to_set v = nat_to_set u \<union> nat_to_set v - (nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u))
[PROOF STEP]
have S11: "f u v = set_to_nat (?A \<inter> ?B)"
[PROOF STATE]
proof (prove)
using this:
f u v = set_to_nat (nat_to_set u \<union> nat_to_set v - (nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u)))
nat_to_set u \<inter> nat_to_set v = nat_to_set u \<union> nat_to_set v - (nat_to_set u - nat_to_set v \<union> (nat_to_set v - nat_to_set u))

goal (1 subgoal):
 1. f u v = set_to_nat (nat_to_set u \<inter> nat_to_set v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f u v = set_to_nat (nat_to_set u \<inter> nat_to_set v)

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
have "c_intersect u v = set_to_nat (?A \<inter> ?B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_intersect u v = set_to_nat (nat_to_set u \<inter> nat_to_set v)
[PROOF STEP]
by (simp add: c_intersect_def)
[PROOF STATE]
proof (state)
this:
c_intersect u v = set_to_nat (nat_to_set u \<inter> nat_to_set v)

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
with S11
[PROOF STATE]
proof (chain)
picking this:
f u v = set_to_nat (nat_to_set u \<inter> nat_to_set v)
c_intersect u v = set_to_nat (nat_to_set u \<inter> nat_to_set v)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f u v = set_to_nat (nat_to_set u \<inter> nat_to_set v)
c_intersect u v = set_to_nat (nat_to_set u \<inter> nat_to_set v)

goal (1 subgoal):
 1. f u v = c_intersect u v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f u v = c_intersect u v

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f u v = c_intersect u v

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f ?u ?v = c_intersect ?u ?v

goal (1 subgoal):
 1. c_intersect \<in> PrimRec2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f ?u ?v = c_intersect ?u ?v
[PROOF STEP]
have "f = c_intersect"
[PROOF STATE]
proof (prove)
using this:
f ?u ?v = c_intersect ?u ?v

goal (1 subgoal):
 1. f = c_intersect
[PROOF STEP]
by (simp add: ext)
[PROOF STATE]
proof (state)
this:
f = c_intersect

goal (1 subgoal):
 1. c_intersect \<in> PrimRec2
[PROOF STEP]
with f_is_pr
[PROOF STATE]
proof (chain)
picking this:
f \<in> PrimRec2
f = c_intersect
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<in> PrimRec2
f = c_intersect

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem bs_empty_correct: "h=bs_empty \<longleftrightarrow> bs_to_mset h = {#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (h = bs_empty) = (bs_to_mset h = {#})
[PROOF STEP]
apply (unfold bs_empty_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (h = Inl ()) = (bs_to_mset h = {#})
[PROOF STEP]
apply (cases h)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a. h = Inl a \<Longrightarrow> (h = Inl ()) = (bs_to_mset h = {#})
 2. \<And>b. h = Inr b \<Longrightarrow> (h = Inl ()) = (bs_to_mset h = {#})
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. h = Inr b \<Longrightarrow> (h = Inl ()) = (bs_to_mset h = {#})
[PROOF STEP]
apply (case_tac b)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b x1 x2 x3. \<lbrakk>h = Inr b; b = Element x1 x2 x3\<rbrakk> \<Longrightarrow> (h = Inl ()) = (bs_to_mset h = {#})
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma is_moebius_comp [simp]:
  assumes "is_moebius m1" and "is_moebius m2"
  shows "is_moebius (m1 \<circ> m2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_moebius (m1 \<circ> m2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_moebius m1
is_moebius m2

goal (1 subgoal):
 1. is_moebius (m1 \<circ> m2)
[PROOF STEP]
unfolding is_moebius_def
[PROOF STATE]
proof (prove)
using this:
\<exists>M. m1 = moebius_pt M
\<exists>M. m2 = moebius_pt M

goal (1 subgoal):
 1. \<exists>M. m1 \<circ> m2 = moebius_pt M
[PROOF STEP]
using moebius_comp
[PROOF STATE]
proof (prove)
using this:
\<exists>M. m1 = moebius_pt M
\<exists>M. m2 = moebius_pt M
moebius_pt (moebius_comp ?M1.0 ?M2.0) = moebius_pt ?M1.0 \<circ> moebius_pt ?M2.0

goal (1 subgoal):
 1. \<exists>M. m1 \<circ> m2 = moebius_pt M
[PROOF STEP]
by metis


[STATEMENT]
lemma (in jozsa) jozsa_transform_coeff [simp]:
  assumes "i < dim_row U\<^sub>f \<and> j < dim_col U\<^sub>f"
  shows "i = j \<longrightarrow> U\<^sub>f $$ (i,j) = 1 - f (i div 2)"
  and "i = j + 1 \<and> odd i \<longrightarrow> U\<^sub>f $$ (i,j) = f (i div 2)"
  and "j \<ge> 1 \<and> i = j - 1 \<and> even i \<longrightarrow> U\<^sub>f $$ (i,j) = f (i div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i = j \<longrightarrow> U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2)) &&& i = j + 1 \<and> odd i \<longrightarrow> U\<^sub>f $$ (i, j) = of_nat (f (i div 2)) &&& 1 \<le> j \<and> i = j - 1 \<and> even i \<longrightarrow> U\<^sub>f $$ (i, j) = of_nat (f (i div 2))
[PROOF STEP]
using jozsa_transform_def assms
[PROOF STATE]
proof (prove)
using this:
U\<^sub>f \<equiv> Matrix.mat (2 ^ (n + 1)) (2 ^ (n + 1)) (\<lambda>x. of_nat (case x of (i, j) \<Rightarrow> if i = j then 1 - f (i div 2) else if i = j + 1 \<and> odd i then f (i div 2) else if i = j - 1 \<and> even i \<and> 1 \<le> j then f (i div 2) else 0))
i < dim_row U\<^sub>f \<and> j < dim_col U\<^sub>f

goal (1 subgoal):
 1. i = j \<longrightarrow> U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2)) &&& i = j + 1 \<and> odd i \<longrightarrow> U\<^sub>f $$ (i, j) = of_nat (f (i div 2)) &&& 1 \<le> j \<and> i = j - 1 \<and> even i \<longrightarrow> U\<^sub>f $$ (i, j) = of_nat (f (i div 2))
[PROOF STEP]
by auto


[STATEMENT]
lemma rel_frontier_affine_hull:
  fixes S :: "'a::euclidean_space set"
  shows "rel_frontier S \<subseteq> affine hull S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_frontier S \<subseteq> affine hull S
[PROOF STEP]
using closure_affine_hull rel_frontier_def
[PROOF STATE]
proof (prove)
using this:
closure ?S \<subseteq> affine hull ?S
rel_frontier ?S = closure ?S - rel_interior ?S

goal (1 subgoal):
 1. rel_frontier S \<subseteq> affine hull S
[PROOF STEP]
by fastforce


[STATEMENT]
lemma norm_ell2_code [code]:
  \<comment> \<open>Code equation for the norm of a vector\<close>
  "norm \<psi> = (let \<psi>' = vec_of_ell2 \<psi> in
    sqrt (\<Sum> i \<in> {0 ..< dim_vec \<psi>'}. let z = vec_index \<psi>' i in (Re z)\<^sup>2 + (Im z)\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm \<psi> = (let \<psi>' = vec_of_ell2 \<psi> in sqrt (\<Sum>i = 0..<dim_vec \<psi>'. let z = \<psi>' $ i in (Re z)\<^sup>2 + (Im z)\<^sup>2))
[PROOF STEP]
by (simp add: norm_ell2_vec_of_basis_enum vec_of_ell2_def)


[STATEMENT]
lemma cos_pi_minus [simp]: "cos (pi - x) = - (cos x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (pi - x) = - cos x
[PROOF STEP]
by (metis cos_minus cos_periodic_pi uminus_add_conv_diff)


[STATEMENT]
lemma top_comp_linorder_matrix:
  fixes f :: "('a::finite,'b::linorder_stone_relation_algebra_expansion) square"
  shows "(mtop \<odot> f) (i,j) = (\<Squnion>\<^sub>k f (k,j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mtop \<odot> f) (i, j) = sup_monoid.sum (\<lambda>k. f (k, j)) {k. True}
[PROOF STEP]
apply (unfold times_matrix_def top_matrix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case (i, j) of (i, j) \<Rightarrow> sup_monoid.sum (\<lambda>k. top * f (k, j)) {k. True}) = sup_monoid.sum (\<lambda>k. f (k, j)) {k. True}
[PROOF STEP]
by (metis (no_types, lifting) case_prod_conv comp_left_one one_def sup_monoid.sum.cong)


[STATEMENT]
lemma (in cpx_sq_mat) sum_eigen_projector_trace:
  assumes "hermitian A"
  and "hermitian B"
  and "A\<in> fc_mats"
  and "B\<in> fc_mats"
and "R\<in> fc_mats"
  shows "(\<Sum> a \<in> spectrum A.  a *  (\<Sum> b \<in> spectrum B. (b *
    Complex_Matrix.trace(eigen_projector A a * (eigen_projector B b) * R)))) =
    Complex_Matrix.trace(A * B * R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
have "(\<Sum> a \<in> spectrum A.  a *  (\<Sum> b \<in> spectrum B. (b *
    Complex_Matrix.trace(eigen_projector A a * (eigen_projector B b) * R)))) = (\<Sum> a \<in> spectrum A.
    Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R)))
[PROOF STEP]
proof (rule sum.cong, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> spectrum A \<Longrightarrow> x * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A x * eigen_projector B b * R)) = Complex_Matrix.trace (x \<cdot>\<^sub>m eigen_projector A x * (B * R))
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> spectrum A \<Longrightarrow> x * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A x * eigen_projector B b * R)) = Complex_Matrix.trace (x \<cdot>\<^sub>m eigen_projector A x * (B * R))
[PROOF STEP]
assume "a\<in> spectrum A"
[PROOF STATE]
proof (state)
this:
a \<in> spectrum A

goal (1 subgoal):
 1. \<And>x. x \<in> spectrum A \<Longrightarrow> x * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A x * eigen_projector B b * R)) = Complex_Matrix.trace (x \<cdot>\<^sub>m eigen_projector A x * (B * R))
[PROOF STEP]
hence "(\<Sum>b\<in>spectrum B. b *
      Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) =
      Complex_Matrix.trace (eigen_projector A a * B * R)"
[PROOF STATE]
proof (prove)
using this:
a \<in> spectrum A

goal (1 subgoal):
 1. (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) = Complex_Matrix.trace (eigen_projector A a * B * R)
[PROOF STEP]
using
      sum_eigen_projector_trace_dist[of B "eigen_projector A a" R] assms eigen_projector_carrier
[PROOF STATE]
proof (prove)
using this:
a \<in> spectrum A
\<lbrakk>hermitian B; eigen_projector A a \<in> fc_mats; B \<in> fc_mats; R \<in> fc_mats\<rbrakk> \<Longrightarrow> (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) = Complex_Matrix.trace (eigen_projector A a * B * R)
hermitian A
hermitian B
A \<in> fc_mats
B \<in> fc_mats
R \<in> fc_mats
\<lbrakk>?A \<in> fc_mats; ?a \<in> spectrum ?A; hermitian ?A\<rbrakk> \<Longrightarrow> eigen_projector ?A ?a \<in> fc_mats

goal (1 subgoal):
 1. (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) = Complex_Matrix.trace (eigen_projector A a * B * R)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) = Complex_Matrix.trace (eigen_projector A a * B * R)

goal (1 subgoal):
 1. \<And>x. x \<in> spectrum A \<Longrightarrow> x * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A x * eigen_projector B b * R)) = Complex_Matrix.trace (x \<cdot>\<^sub>m eigen_projector A x * (B * R))
[PROOF STEP]
hence "a *  (\<Sum> b \<in> spectrum B. (b *
      Complex_Matrix.trace(eigen_projector A a * (eigen_projector B b) * R))) =
      a * Complex_Matrix.trace (eigen_projector A a * B * R)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) = Complex_Matrix.trace (eigen_projector A a * B * R)

goal (1 subgoal):
 1. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) = a * Complex_Matrix.trace (eigen_projector A a * B * R)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) = a * Complex_Matrix.trace (eigen_projector A a * B * R)

goal (1 subgoal):
 1. \<And>x. x \<in> spectrum A \<Longrightarrow> x * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A x * eigen_projector B b * R)) = Complex_Matrix.trace (x \<cdot>\<^sub>m eigen_projector A x * (B * R))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) = a * Complex_Matrix.trace (eigen_projector A a * B * R)

goal (1 subgoal):
 1. \<And>x. x \<in> spectrum A \<Longrightarrow> x * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A x * eigen_projector B b * R)) = Complex_Matrix.trace (x \<cdot>\<^sub>m eigen_projector A x * (B * R))
[PROOF STEP]
have "... = Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * Complex_Matrix.trace (eigen_projector A a * B * R) = Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R))
[PROOF STEP]
using trace_smult[symmetric, of "eigen_projector A a * B * R" dimR a] assms
       \<open>a \<in> spectrum A\<close> cpx_sq_mat_mult dim_eq fc_mats_carrier eigen_projector_carrier
[PROOF STATE]
proof (prove)
using this:
eigen_projector A a * B * R \<in> carrier_mat dimR dimR \<Longrightarrow> a * Complex_Matrix.trace (eigen_projector A a * B * R) = Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R))
hermitian A
hermitian B
A \<in> fc_mats
B \<in> fc_mats
R \<in> fc_mats
a \<in> spectrum A
\<lbrakk>?A \<in> fc_mats; ?B \<in> fc_mats\<rbrakk> \<Longrightarrow> ?A * ?B \<in> fc_mats
dimR = dimC
fc_mats = carrier_mat dimR dimC
\<lbrakk>?A \<in> fc_mats; ?a \<in> spectrum ?A; hermitian ?A\<rbrakk> \<Longrightarrow> eigen_projector ?A ?a \<in> fc_mats

goal (1 subgoal):
 1. a * Complex_Matrix.trace (eigen_projector A a * B * R) = Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
a * Complex_Matrix.trace (eigen_projector A a * B * R) = Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R))

goal (1 subgoal):
 1. \<And>x. x \<in> spectrum A \<Longrightarrow> x * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A x * eigen_projector B b * R)) = Complex_Matrix.trace (x \<cdot>\<^sub>m eigen_projector A x * (B * R))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a * Complex_Matrix.trace (eigen_projector A a * B * R) = Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R))

goal (1 subgoal):
 1. \<And>x. x \<in> spectrum A \<Longrightarrow> x * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A x * eigen_projector B b * R)) = Complex_Matrix.trace (x \<cdot>\<^sub>m eigen_projector A x * (B * R))
[PROOF STEP]
have "... = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))
[PROOF STEP]
have "a \<cdot>\<^sub>m (eigen_projector A a * B * R) = a \<cdot>\<^sub>m (eigen_projector A a * B) * R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<cdot>\<^sub>m (eigen_projector A a * B * R) = a \<cdot>\<^sub>m (eigen_projector A a * B) * R
[PROOF STEP]
proof (rule  mult_smult_assoc_mat[symmetric])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. eigen_projector A a * B \<in> carrier_mat ?nr ?n
 2. R \<in> carrier_mat ?n ?nc
[PROOF STEP]
show "R\<in> carrier_mat dimR dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R \<in> carrier_mat dimR dimR
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
hermitian A
hermitian B
A \<in> fc_mats
B \<in> fc_mats
R \<in> fc_mats
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. R \<in> carrier_mat dimR dimR
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
R \<in> carrier_mat dimR dimR

goal (1 subgoal):
 1. eigen_projector A a * B \<in> carrier_mat ?nr dimR
[PROOF STEP]
show "eigen_projector A a * B \<in> carrier_mat dimR dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eigen_projector A a * B \<in> carrier_mat dimR dimR
[PROOF STEP]
using assms eigen_projector_carrier
            cpx_sq_mat_mult fc_mats_carrier dim_eq \<open>a \<in> spectrum A\<close>
[PROOF STATE]
proof (prove)
using this:
hermitian A
hermitian B
A \<in> fc_mats
B \<in> fc_mats
R \<in> fc_mats
\<lbrakk>?A \<in> fc_mats; ?a \<in> spectrum ?A; hermitian ?A\<rbrakk> \<Longrightarrow> eigen_projector ?A ?a \<in> fc_mats
\<lbrakk>?A \<in> fc_mats; ?B \<in> fc_mats\<rbrakk> \<Longrightarrow> ?A * ?B \<in> fc_mats
fc_mats = carrier_mat dimR dimC
dimR = dimC
a \<in> spectrum A

goal (1 subgoal):
 1. eigen_projector A a * B \<in> carrier_mat dimR dimR
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
eigen_projector A a * B \<in> carrier_mat dimR dimR

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a \<cdot>\<^sub>m (eigen_projector A a * B * R) = a \<cdot>\<^sub>m (eigen_projector A a * B) * R

goal (1 subgoal):
 1. Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a \<cdot>\<^sub>m (eigen_projector A a * B * R) = a \<cdot>\<^sub>m (eigen_projector A a * B) * R

goal (1 subgoal):
 1. Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))
[PROOF STEP]
have "... = a \<cdot>\<^sub>m eigen_projector A a * B * R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<cdot>\<^sub>m (eigen_projector A a * B) * R = a \<cdot>\<^sub>m eigen_projector A a * B * R
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<cdot>\<^sub>m (eigen_projector A a * B) * R = a \<cdot>\<^sub>m eigen_projector A a * B * R
[PROOF STEP]
have "a \<cdot>\<^sub>m (eigen_projector A a * B) = a \<cdot>\<^sub>m eigen_projector A a * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<cdot>\<^sub>m (eigen_projector A a * B) = a \<cdot>\<^sub>m eigen_projector A a * B
[PROOF STEP]
using mult_smult_assoc_mat[symmetric]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?nr ?n; ?B \<in> carrier_mat ?n ?nc\<rbrakk> \<Longrightarrow> ?k \<cdot>\<^sub>m (?A * ?B) = ?k \<cdot>\<^sub>m ?A * ?B

goal (1 subgoal):
 1. a \<cdot>\<^sub>m (eigen_projector A a * B) = a \<cdot>\<^sub>m eigen_projector A a * B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>A nr n B nc k. \<lbrakk>A \<in> carrier_mat nr n; B \<in> carrier_mat n nc\<rbrakk> \<Longrightarrow> k \<cdot>\<^sub>m (A * B) = k \<cdot>\<^sub>m A * B) \<Longrightarrow> a \<cdot>\<^sub>m (eigen_projector A a * B) = a \<cdot>\<^sub>m eigen_projector A a * B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<cdot>\<^sub>m (eigen_projector A a * B) = a \<cdot>\<^sub>m eigen_projector A a * B
[PROOF STEP]
by (metis \<open>\<And>nr nc n k B A. \<lbrakk>A \<in> carrier_mat nr n; B \<in> carrier_mat n nc\<rbrakk> \<Longrightarrow>
              k \<cdot>\<^sub>m (A * B) = k \<cdot>\<^sub>m A * B\<close> \<open>a \<in> spectrum A\<close> assms(1) assms(3) assms(4) dim_eq
                fc_mats_carrier eigen_projector_carrier)
[PROOF STATE]
proof (state)
this:
a \<cdot>\<^sub>m (eigen_projector A a * B) = a \<cdot>\<^sub>m eigen_projector A a * B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a \<cdot>\<^sub>m (eigen_projector A a * B) = a \<cdot>\<^sub>m eigen_projector A a * B

goal (1 subgoal):
 1. a \<cdot>\<^sub>m (eigen_projector A a * B) * R = a \<cdot>\<^sub>m eigen_projector A a * B * R
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<cdot>\<^sub>m (eigen_projector A a * B) = a \<cdot>\<^sub>m eigen_projector A a * B

goal (1 subgoal):
 1. a \<cdot>\<^sub>m (eigen_projector A a * B) * R = a \<cdot>\<^sub>m eigen_projector A a * B * R
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<cdot>\<^sub>m (eigen_projector A a * B) * R = a \<cdot>\<^sub>m eigen_projector A a * B * R

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a \<cdot>\<^sub>m (eigen_projector A a * B) * R = a \<cdot>\<^sub>m eigen_projector A a * B * R

goal (1 subgoal):
 1. Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a \<cdot>\<^sub>m (eigen_projector A a * B) * R = a \<cdot>\<^sub>m eigen_projector A a * B * R

goal (1 subgoal):
 1. Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))
[PROOF STEP]
have "... = a \<cdot>\<^sub>m eigen_projector A a * (B * R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<cdot>\<^sub>m eigen_projector A a * B * R = a \<cdot>\<^sub>m eigen_projector A a * (B * R)
[PROOF STEP]
by (metis \<open>a \<in> spectrum A\<close> assms(1) assms(3) assms(4) assms(5) assoc_mult_mat
            cpx_sq_mat_smult dim_eq fc_mats_carrier eigen_projector_carrier)
[PROOF STATE]
proof (state)
this:
a \<cdot>\<^sub>m eigen_projector A a * B * R = a \<cdot>\<^sub>m eigen_projector A a * (B * R)

goal (1 subgoal):
 1. Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a \<cdot>\<^sub>m (eigen_projector A a * B * R) = a \<cdot>\<^sub>m eigen_projector A a * (B * R)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<cdot>\<^sub>m (eigen_projector A a * B * R) = a \<cdot>\<^sub>m eigen_projector A a * (B * R)

goal (1 subgoal):
 1. Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (a \<cdot>\<^sub>m (eigen_projector A a * B * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))

goal (1 subgoal):
 1. \<And>x. x \<in> spectrum A \<Longrightarrow> x * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A x * eigen_projector B b * R)) = Complex_Matrix.trace (x \<cdot>\<^sub>m eigen_projector A x * (B * R))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))
[PROOF STEP]
show "a *  (\<Sum> b \<in> spectrum B. (b *
      Complex_Matrix.trace(eigen_projector A a * (eigen_projector B b) * R))) =
      Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))"
[PROOF STATE]
proof (prove)
using this:
a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))

goal (1 subgoal):
 1. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R)) = Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R)))

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R)))

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
have "... = Complex_Matrix.trace (A * (B * R))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))) = Complex_Matrix.trace (A * (B * R))
[PROOF STEP]
using sum_eigen_projector_trace_right[of A "B * R"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>hermitian A; A \<in> fc_mats; B * R \<in> fc_mats\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))) = Complex_Matrix.trace (A * (B * R))
hermitian A
hermitian B
A \<in> fc_mats
B \<in> fc_mats
R \<in> fc_mats

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))) = Complex_Matrix.trace (A * (B * R))
[PROOF STEP]
by (simp add: cpx_sq_mat_mult)
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))) = Complex_Matrix.trace (A * (B * R))

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * (B * R))) = Complex_Matrix.trace (A * (B * R))

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
have "... = Complex_Matrix.trace (A * B * R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (A * (B * R)) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.trace (A * (B * R)) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
have "A * (B * R) = A * B * R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * (B * R) = A * B * R
[PROOF STEP]
proof (rule assoc_mult_mat[symmetric])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. A \<in> carrier_mat ?n\<^sub>1 ?n\<^sub>2
 2. B \<in> carrier_mat ?n\<^sub>2 ?n\<^sub>3
 3. R \<in> carrier_mat ?n\<^sub>3 ?n\<^sub>4
[PROOF STEP]
show "A\<in>  carrier_mat dimR dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat dimR dimR
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
hermitian A
hermitian B
A \<in> fc_mats
B \<in> fc_mats
R \<in> fc_mats
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. A \<in> carrier_mat dimR dimR
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat dimR dimR

goal (2 subgoals):
 1. B \<in> carrier_mat dimR ?n\<^sub>3
 2. R \<in> carrier_mat ?n\<^sub>3 ?n\<^sub>4
[PROOF STEP]
show "B\<in>  carrier_mat dimR dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<in> carrier_mat dimR dimR
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
hermitian A
hermitian B
A \<in> fc_mats
B \<in> fc_mats
R \<in> fc_mats
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. B \<in> carrier_mat dimR dimR
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B \<in> carrier_mat dimR dimR

goal (1 subgoal):
 1. R \<in> carrier_mat dimR ?n\<^sub>4
[PROOF STEP]
show "R\<in>  carrier_mat dimR dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R \<in> carrier_mat dimR dimR
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
hermitian A
hermitian B
A \<in> fc_mats
B \<in> fc_mats
R \<in> fc_mats
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. R \<in> carrier_mat dimR dimR
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
R \<in> carrier_mat dimR dimR

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
A * (B * R) = A * B * R

goal (1 subgoal):
 1. Complex_Matrix.trace (A * (B * R)) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
A * (B * R) = A * B * R

goal (1 subgoal):
 1. Complex_Matrix.trace (A * (B * R)) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (A * (B * R)) = Complex_Matrix.trace (A * B * R)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (A * (B * R)) = Complex_Matrix.trace (A * B * R)

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = Complex_Matrix.trace (A * B * R)

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = Complex_Matrix.trace (A * B * R)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>spectrum A. a * (\<Sum>b\<in>spectrum B. b * Complex_Matrix.trace (eigen_projector A a * eigen_projector B b * R))) = Complex_Matrix.trace (A * B * R)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_det:
  assumes "\<And>j. j permutes UNIV \<Longrightarrow> j \<noteq> id \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun A i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun A i i)"
  shows "degree (det A) = degree (\<Prod>i\<in>UNIV. to_fun A i i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (Square_Matrix.det A) = degree (\<Prod>i\<in>UNIV. to_fun A i i)
[PROOF STEP]
unfolding det_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. to_fun A i (p i))) = degree (\<Prod>i\<in>UNIV. to_fun A i i)
[PROOF STEP]
by (subst degree_sum_unique[where i=id])
     (simp_all add: sign_permut permutes_id assms)


[STATEMENT]
lemma relImage_relInvImage:
  assumes "R \<subseteq> f ` A \<times> f ` A"
  shows "relImage (relInvImage A R f) f = R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. relImage (relInvImage A R f) f = R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
R \<subseteq> f ` A \<times> f ` A

goal (1 subgoal):
 1. relImage (relInvImage A R f) f = R
[PROOF STEP]
unfolding relImage_def relInvImage_def
[PROOF STATE]
proof (prove)
using this:
R \<subseteq> f ` A \<times> f ` A

goal (1 subgoal):
 1. {(f a1, f a2) |a1 a2. (a1, a2) \<in> {(a1, a2) |a1 a2. a1 \<in> A \<and> a2 \<in> A \<and> (f a1, f a2) \<in> R}} = R
[PROOF STEP]
by fast


[STATEMENT]
lemma finite_lists_length_le2: "finite {xs. length xs + 1 \<le> i \<and> set xs \<subseteq> {0..(n::nat)}}" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. length xs + 1 \<le> i \<and> set xs \<subseteq> {0..n}}
[PROOF STEP]
by (auto intro: finite_subset[OF _ finite_lists_length_le1[of "i"]])


[STATEMENT]
lemma map_of_concat: "map_of (concat xss) = foldr (\<lambda>xs f. f ++ map_of xs) xss Map.empty"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_of (concat xss) = foldr (\<lambda>xs f. f ++ map_of xs) xss Map.empty
[PROOF STEP]
by(induct xss) simp_all


[STATEMENT]
lemma size_drop_first_sub: "\<lbrakk>0 < size current; invar current \<rbrakk>
   \<Longrightarrow> size (drop_first current) = size current - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < size current; invar current\<rbrakk> \<Longrightarrow> size (drop_first current) = size current - 1
[PROOF STEP]
by(induction current rule: pop.induct) auto


[STATEMENT]
lemma csin_eq_1:
  fixes z::complex
  shows "sin z = 1 \<longleftrightarrow> (\<exists>n::int. z = of_real(2 * n * pi) + of_real pi/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin z = 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real pi / 2)
[PROOF STEP]
using cos_eq_1 [of "z - of_real pi/2"]
[PROOF STATE]
proof (prove)
using this:
(cos (z - complex_of_real pi / 2) = 1) = (\<exists>x. z - complex_of_real pi / 2 = complex_of_real (2 * real_of_int x * pi))

goal (1 subgoal):
 1. (sin z = 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real pi / 2)
[PROOF STEP]
by (simp add: cos_diff algebra_simps)


[STATEMENT]
lemma inverse_less_iff_less [simp]:
  "0 < a \<Longrightarrow> 0 < b \<Longrightarrow> inverse a < inverse b \<longleftrightarrow> b < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) < a; (0::'a) < b\<rbrakk> \<Longrightarrow> (inverse a < inverse b) = (b < a)
[PROOF STEP]
by (blast intro: less_imp_inverse_less dest: inverse_less_imp_less)


[STATEMENT]
lemma powreal_power_eq2:
   "0 \<le> a \<Longrightarrow> 0 < n \<Longrightarrow> a ^ n = (if a = 0 then 0 else a pow\<^sub>\<real> (real n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> a; 0 < n\<rbrakk> \<Longrightarrow> a ^ n = (if a = 0 then 0 else a pow\<^sub>\<real> real n)
[PROOF STEP]
by (auto simp add:  powreal_power_eq)


[STATEMENT]
lemma len_glue_le: assumes "us = \<epsilon> \<or> last us \<noteq> w" shows "\<^bold>|glue w us\<^bold>| \<le> \<^bold>|us\<^bold>|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>|glue w us\<^bold>| \<le> \<^bold>|us\<^bold>|
[PROOF STEP]
using len_glue[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<^bold>|glue w us\<^bold>| + count_list us w = \<^bold>|us\<^bold>|

goal (1 subgoal):
 1. \<^bold>|glue w us\<^bold>| \<le> \<^bold>|us\<^bold>|
[PROOF STEP]
unfolding nat_le_iff_add eq_commute[of "\<^bold>|us\<^bold>|"]
[PROOF STATE]
proof (prove)
using this:
\<^bold>|glue w us\<^bold>| + count_list us w = \<^bold>|us\<^bold>|

goal (1 subgoal):
 1. \<exists>k. \<^bold>|glue w us\<^bold>| + k = \<^bold>|us\<^bold>|
[PROOF STEP]
by blast


[STATEMENT]
lemma Pi_mono: "(\<And>x. x \<in> A \<Longrightarrow> B x \<subseteq> C x) \<Longrightarrow> Pi A B \<subseteq> Pi A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> B x \<subseteq> C x) \<Longrightarrow> Pi A B \<subseteq> Pi A C
[PROOF STEP]
by auto


[STATEMENT]
lemma elliptic_isometryD:
  assumes "elliptic_isometry f"
  shows "bounded {(f^^n) x |n. True}"
        "isometry f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded {(f ^^ n) x |n. True} &&& isometry f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
elliptic_isometry f

goal (1 subgoal):
 1. bounded {(f ^^ n) x |n. True} &&& isometry f
[PROOF STEP]
unfolding elliptic_isometry_def
[PROOF STATE]
proof (prove)
using this:
isometry f \<and> (\<forall>x. bounded {(f ^^ n) x |n. True})

goal (1 subgoal):
 1. bounded {(f ^^ n) x |n. True} &&& isometry f
[PROOF STEP]
by auto


[STATEMENT]
lemma LIMSEQ_divide_realpow_zero: "1 < x \<Longrightarrow> (\<lambda>n. a / (x ^ n) :: real) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> (\<lambda>n. a / x ^ n) \<longlonglongrightarrow> 0
[PROOF STEP]
by (rule tendsto_divide_0 [OF tendsto_const filterlim_realpow_sequentially_gt1]) simp


[STATEMENT]
lemma graph_union_vertices[simp]:
"vertices (graph_union G\<^sub>1 G\<^sub>2) = vertices G\<^sub>1 \<union> vertices G\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vertices (graph_union G\<^sub>1 G\<^sub>2) = vertices G\<^sub>1 \<union> vertices G\<^sub>2
[PROOF STEP]
unfolding graph_union_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vertices (LG (edges G\<^sub>1 \<union> edges G\<^sub>2) (vertices G\<^sub>1 \<union> vertices G\<^sub>2)) = vertices G\<^sub>1 \<union> vertices G\<^sub>2
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_Stars_Pow:
  assumes "finite Vs"
  shows "finite (Stars_Pow Vs n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Stars_Pow Vs n)
[PROOF STEP]
by (induct n) (simp_all add: finite_Stars_Cons assms)


[STATEMENT]
lemma icard_Diff1_le: "icard (A - {x}) \<le> icard A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. icard (A - {x}) \<le> icard A
[PROOF STEP]
by (rule icard_mono, rule Diff_subset)


[STATEMENT]
lemma cauchy_minus [simp]:
  assumes X: "cauchy X"
  shows "cauchy (\<lambda>n. - X n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cauchy (\<lambda>n. - X n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
cauchy X

goal (1 subgoal):
 1. cauchy (\<lambda>n. - X n)
[PROOF STEP]
unfolding cauchy_def
[PROOF STATE]
proof (prove)
using this:
\<forall>r>0. \<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>X m - X n\<bar> < r

goal (1 subgoal):
 1. \<forall>r>0. \<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>- X m - - X n\<bar> < r
[PROOF STEP]
unfolding minus_diff_minus abs_minus_cancel
[PROOF STATE]
proof (prove)
using this:
\<forall>r>0. \<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>X m - X n\<bar> < r

goal (1 subgoal):
 1. \<forall>r>0. \<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>X m - X n\<bar> < r
[PROOF STEP]
.


[STATEMENT]
lemma openin_closedin_eq: "openin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> closedin U (topspace U - S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin U S = (S \<subseteq> topspace U \<and> closedin U (topspace U - S))
[PROOF STEP]
by (metis Diff_subset closedin_def double_diff equalityD1 openin_subset)


[STATEMENT]
lemma normalize_gcd_right: "gcd a (normalize b) = gcd a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd a (normalize b) = gcd a b
[PROOF STEP]
by (fact gcd.normalize_right_idem)


[STATEMENT]
lemma midpoint_plus_self [simp]: "midpoint a b + midpoint a b = a + b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. midpoint a b + midpoint a b = a + b
[PROOF STEP]
using midpoint_eq_iff
[PROOF STATE]
proof (prove)
using this:
(midpoint ?a ?b = ?c) = (?a + ?b = ?c + ?c)

goal (1 subgoal):
 1. midpoint a b + midpoint a b = a + b
[PROOF STEP]
by metis


[STATEMENT]
lemma word_sint_msb_eq: "sint x = uint x - (if msb x then 2 ^ size x else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sint x = uint x - (if msb x then 2 ^ size x else 0)
[PROOF STEP]
apply (cases \<open>LENGTH('a)\<close>)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. LENGTH('a) = 0 \<Longrightarrow> sint x = uint x - (if msb x then 2 ^ size x else 0)
 2. \<And>nat. LENGTH('a) = Suc nat \<Longrightarrow> sint x = uint x - (if msb x then 2 ^ size x else 0)
[PROOF STEP]
apply (simp_all add: msb_word_iff_bit word_size)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. LENGTH('a) = Suc nat \<Longrightarrow> (bit x nat \<longrightarrow> sint x = uint x - 2 * 2 ^ nat) \<and> (\<not> bit x nat \<longrightarrow> sint x = uint x)
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat x. LENGTH('a) = Suc nat \<Longrightarrow> (nat < LENGTH('a) \<and> bit x nat \<longrightarrow> signed_take_bit (LENGTH('a) - Suc 0) x = take_bit LENGTH('a) x - 2 * 2 ^ nat) \<and> (\<not> (nat < LENGTH('a) \<and> bit x nat) \<longrightarrow> signed_take_bit (LENGTH('a) - Suc 0) x = take_bit LENGTH('a) x)
[PROOF STEP]
apply (simp add: signed_take_bit_eq_take_bit_minus)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma negligible_Union_nat:
  assumes "\<And>n::nat. negligible(S n)"
  shows "negligible(\<Union>n. S n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. negligible (\<Union> (range S))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. negligible (\<Union> (range S))
[PROOF STEP]
have "negligible (\<Union>m\<le>k. S m)" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. negligible (\<Union> (S ` {..k}))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
negligible (S ?n)

goal (1 subgoal):
 1. negligible (\<Union> (S ` {..k}))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
negligible (\<Union> (S ` {..?k}))

goal (1 subgoal):
 1. negligible (\<Union> (range S))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
negligible (\<Union> (S ` {..?k}))
[PROOF STEP]
have 0:  "integral UNIV (indicat_real (\<Union>m\<le>k. S m)) = 0"
    and 1: "(indicat_real (\<Union>m\<le>k. S m)) integrable_on UNIV" for k
[PROOF STATE]
proof (prove)
using this:
negligible (\<Union> (S ` {..?k}))

goal (1 subgoal):
 1. integral UNIV (indicat_real (\<Union> (S ` {..k}))) = 0 &&& indicat_real (\<Union> (S ` {..k})) integrable_on UNIV
[PROOF STEP]
by (auto simp: negligible has_integral_iff)
[PROOF STATE]
proof (state)
this:
integral UNIV (indicat_real (\<Union> (S ` {..?k}))) = 0
indicat_real (\<Union> (S ` {..?k})) integrable_on UNIV

goal (1 subgoal):
 1. negligible (\<Union> (range S))
[PROOF STEP]
have 2: "\<And>k x. indicat_real (\<Union>m\<le>k. S m) x \<le> (indicat_real (\<Union>m\<le>Suc k. S m) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k x. indicat_real (\<Union> (S ` {..k})) x \<le> indicat_real (\<Union> (S ` {..Suc k})) x
[PROOF STEP]
by (auto simp add: indicator_def)
[PROOF STATE]
proof (state)
this:
indicat_real (\<Union> (S ` {..?k})) ?x \<le> indicat_real (\<Union> (S ` {..Suc ?k})) ?x

goal (1 subgoal):
 1. negligible (\<Union> (range S))
[PROOF STEP]
have 3: "\<And>x. (\<lambda>k. indicat_real (\<Union>m\<le>k. S m) x) \<longlonglongrightarrow> (indicat_real (\<Union>n. S n) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (\<lambda>k. indicat_real (\<Union> (S ` {..k})) x) \<longlonglongrightarrow> indicat_real (\<Union> (range S)) x
[PROOF STEP]
by (force simp: indicator_def eventually_sequentially intro: tendsto_eventually)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. indicat_real (\<Union> (S ` {..k})) ?x) \<longlonglongrightarrow> indicat_real (\<Union> (range S)) ?x

goal (1 subgoal):
 1. negligible (\<Union> (range S))
[PROOF STEP]
have 4: "bounded (range (\<lambda>k. integral UNIV (indicat_real (\<Union>m\<le>k. S m))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (range (\<lambda>k. integral UNIV (indicat_real (\<Union> (S ` {..k})))))
[PROOF STEP]
by (simp add: 0)
[PROOF STATE]
proof (state)
this:
bounded (range (\<lambda>k. integral UNIV (indicat_real (\<Union> (S ` {..k})))))

goal (1 subgoal):
 1. negligible (\<Union> (range S))
[PROOF STEP]
have *: "indicat_real (\<Union>n. S n) integrable_on UNIV \<and>
        (\<lambda>k. integral UNIV (indicat_real (\<Union>m\<le>k. S m))) \<longlonglongrightarrow> (integral UNIV (indicat_real (\<Union>n. S n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indicat_real (\<Union> (range S)) integrable_on UNIV \<and> (\<lambda>k. integral UNIV (indicat_real (\<Union> (S ` {..k})))) \<longlonglongrightarrow> integral UNIV (indicat_real (\<Union> (range S)))
[PROOF STEP]
by (intro monotone_convergence_increasing 1 2 3 4)
[PROOF STATE]
proof (state)
this:
indicat_real (\<Union> (range S)) integrable_on UNIV \<and> (\<lambda>k. integral UNIV (indicat_real (\<Union> (S ` {..k})))) \<longlonglongrightarrow> integral UNIV (indicat_real (\<Union> (range S)))

goal (1 subgoal):
 1. negligible (\<Union> (range S))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
indicat_real (\<Union> (range S)) integrable_on UNIV \<and> (\<lambda>k. integral UNIV (indicat_real (\<Union> (S ` {..k})))) \<longlonglongrightarrow> integral UNIV (indicat_real (\<Union> (range S)))
[PROOF STEP]
have "integral UNIV (indicat_real (\<Union>n. S n)) = (0::real)"
[PROOF STATE]
proof (prove)
using this:
indicat_real (\<Union> (range S)) integrable_on UNIV \<and> (\<lambda>k. integral UNIV (indicat_real (\<Union> (S ` {..k})))) \<longlonglongrightarrow> integral UNIV (indicat_real (\<Union> (range S)))

goal (1 subgoal):
 1. integral UNIV (indicat_real (\<Union> (range S))) = 0
[PROOF STEP]
using LIMSEQ_unique
[PROOF STATE]
proof (prove)
using this:
indicat_real (\<Union> (range S)) integrable_on UNIV \<and> (\<lambda>k. integral UNIV (indicat_real (\<Union> (S ` {..k})))) \<longlonglongrightarrow> integral UNIV (indicat_real (\<Union> (range S)))
\<lbrakk>?X \<longlonglongrightarrow> ?a; ?X \<longlonglongrightarrow> ?b\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. integral UNIV (indicat_real (\<Union> (range S))) = 0
[PROOF STEP]
by (auto simp: 0)
[PROOF STATE]
proof (state)
this:
integral UNIV (indicat_real (\<Union> (range S))) = 0

goal (1 subgoal):
 1. negligible (\<Union> (range S))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integral UNIV (indicat_real (\<Union> (range S))) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral UNIV (indicat_real (\<Union> (range S))) = 0

goal (1 subgoal):
 1. negligible (\<Union> (range S))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
integral UNIV (indicat_real (\<Union> (range S))) = 0
indicat_real (\<Union> (range S)) integrable_on UNIV \<and> (\<lambda>k. integral UNIV (indicat_real (\<Union> (S ` {..k})))) \<longlonglongrightarrow> integral UNIV (indicat_real (\<Union> (range S)))

goal (1 subgoal):
 1. negligible (\<Union> (range S))
[PROOF STEP]
by (simp add: negligible_UNIV has_integral_iff)
[PROOF STATE]
proof (state)
this:
negligible (\<Union> (range S))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_unfold_sum_mset:
  "sum f A = sum_mset (image_mset f (mset_set A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f A = sum_mset (image_mset f (mset_set A))
[PROOF STEP]
by (cases "finite A") (induct A rule: finite_induct, simp_all)


[STATEMENT]
lemma zero_spaceN_cmult:
  assumes "x \<in> zero_space\<^sub>N N"
  shows "c *\<^sub>R x \<in> zero_space\<^sub>N N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c *\<^sub>R x \<in> zero_space\<^sub>N N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> zero_space\<^sub>N N

goal (1 subgoal):
 1. c *\<^sub>R x \<in> zero_space\<^sub>N N
[PROOF STEP]
unfolding zero_spaceN_iff
[PROOF STATE]
proof (prove)
using this:
eNorm N x = 0

goal (1 subgoal):
 1. eNorm N (c *\<^sub>R x) = 0
[PROOF STEP]
using eNorm_cmult[of N c x]
[PROOF STATE]
proof (prove)
using this:
eNorm N x = 0
eNorm N (c *\<^sub>R x) = ennreal \<bar>c\<bar> * eNorm N x

goal (1 subgoal):
 1. eNorm N (c *\<^sub>R x) = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma mat_of_rows_list_dim[simp]:
  "mat_of_rows_list n vs \<in> carrier_mat (length vs) n"
  "dim_row (mat_of_rows_list n vs) = length vs"
  "dim_col (mat_of_rows_list n vs) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows_list n vs \<in> carrier_mat (length vs) n &&& dim_row (mat_of_rows_list n vs) = length vs &&& dim_col (mat_of_rows_list n vs) = n
[PROOF STEP]
unfolding mat_of_rows_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (length vs) n (\<lambda>(i, y). vs ! i ! y) \<in> carrier_mat (length vs) n &&& dim_row (mat (length vs) n (\<lambda>(i, y). vs ! i ! y)) = length vs &&& dim_col (mat (length vs) n (\<lambda>(i, y). vs ! i ! y)) = n
[PROOF STEP]
by auto


[STATEMENT]
lemma nth_prime_nonzero[simp]:"nth_prime n \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_prime n \<noteq> 0
[PROOF STEP]
by (simp add: prime_gt_0_nat prime_nth_prime)


[STATEMENT]
lemma last_0[simp]:
  "\<lbrakk>Suc n \<le> ba - aa;  length lm2 = Suc n;
    length lm3 = ba - Suc (aa + n)\<rbrakk>
  \<Longrightarrow> (last lm2 # lm3 @ butlast lm2 @ 0 # lm4) ! (ba - aa) = (0::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Suc n \<le> ba - aa; length lm2 = Suc n; length lm3 = ba - Suc (aa + n)\<rbrakk> \<Longrightarrow> (last lm2 # lm3 @ butlast lm2 @ 0 # lm4) ! (ba - aa) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>Suc n \<le> ba - aa; length lm2 = Suc n; length lm3 = ba - Suc (aa + n)\<rbrakk> \<Longrightarrow> (last lm2 # lm3 @ butlast lm2 @ 0 # lm4) ! (ba - aa) = 0
[PROOF STEP]
assume h: "Suc n \<le> ba - aa"
    and g: "length lm2 = Suc n" "length lm3 = ba - Suc (aa + n)"
[PROOF STATE]
proof (state)
this:
Suc n \<le> ba - aa
length lm2 = Suc n
length lm3 = ba - Suc (aa + n)

goal (1 subgoal):
 1. \<lbrakk>Suc n \<le> ba - aa; length lm2 = Suc n; length lm3 = ba - Suc (aa + n)\<rbrakk> \<Longrightarrow> (last lm2 # lm3 @ butlast lm2 @ 0 # lm4) ! (ba - aa) = 0
[PROOF STEP]
from h and g
[PROOF STATE]
proof (chain)
picking this:
Suc n \<le> ba - aa
length lm2 = Suc n
length lm3 = ba - Suc (aa + n)
[PROOF STEP]
have k: "ba - aa = Suc (length lm3 + n)"
[PROOF STATE]
proof (prove)
using this:
Suc n \<le> ba - aa
length lm2 = Suc n
length lm3 = ba - Suc (aa + n)

goal (1 subgoal):
 1. ba - aa = Suc (length lm3 + n)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
ba - aa = Suc (length lm3 + n)

goal (1 subgoal):
 1. \<lbrakk>Suc n \<le> ba - aa; length lm2 = Suc n; length lm3 = ba - Suc (aa + n)\<rbrakk> \<Longrightarrow> (last lm2 # lm3 @ butlast lm2 @ 0 # lm4) ! (ba - aa) = 0
[PROOF STEP]
from  k
[PROOF STATE]
proof (chain)
picking this:
ba - aa = Suc (length lm3 + n)
[PROOF STEP]
show
    "(last lm2 # lm3 @ butlast lm2 @ 0 # lm4) ! (ba - aa) = 0"
[PROOF STATE]
proof (prove)
using this:
ba - aa = Suc (length lm3 + n)

goal (1 subgoal):
 1. (last lm2 # lm3 @ butlast lm2 @ 0 # lm4) ! (ba - aa) = 0
[PROOF STEP]
apply(simp, insert g)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ba - aa = Suc (length lm3 + n); length lm2 = Suc n; length lm3 = ba - Suc (aa + n)\<rbrakk> \<Longrightarrow> (butlast lm2 @ 0 # lm4) ! n = 0
[PROOF STEP]
apply(simp add: nth_append)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(last lm2 # lm3 @ butlast lm2 @ 0 # lm4) ! (ba - aa) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma meet_domain:
  "x \<sqinter> d(y) * z = d(y) * (x \<sqinter> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter> d y * z = d y * (x \<sqinter> z)
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<sqinter> d y * z \<le> d y * (x \<sqinter> z)
 2. d y * (x \<sqinter> z) \<le> x \<sqinter> d y * z
[PROOF STEP]
apply (metis domain_meet_domain d_mult_below d_restrict_equals inf_mono mult_isotone)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d y * (x \<sqinter> z) \<le> x \<sqinter> d y * z
[PROOF STEP]
by (meson d_mult_below le_inf_iff mult_left_sub_dist_inf_right)


[STATEMENT]
lemma finite_set_pmf_of_list:
  assumes "pmf_of_list_wf xs"
  shows   "finite (set_pmf (pmf_of_list xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set_pmf (pmf_of_list xs))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
pmf_of_list_wf xs

goal (1 subgoal):
 1. finite (set_pmf (pmf_of_list xs))
[PROOF STEP]
by (rule finite_subset[OF set_pmf_of_list]) simp_all


[STATEMENT]
lemma vector_mul_rcancel[simp]: "a *s x = b *s x \<longleftrightarrow> (a::'a::field) = b \<or> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a *s x = b *s x) = (a = b \<or> x = 0)
[PROOF STEP]
by (subst eq_iff_diff_eq_0, subst vector_sub_rdistrib [symmetric]) simp