[STATEMENT]
lemma Re_Arcsin_bounds: "-pi < Re(Arcsin z) & Re(Arcsin z) \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - pi < Re (Arcsin z) \<and> Re (Arcsin z) \<le> pi
[PROOF STEP]
unfolding Re_Arcsin
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - pi < Im (Ln (\<i> * z + csqrt (1 - z\<^sup>2))) \<and> Im (Ln (\<i> * z + csqrt (1 - z\<^sup>2))) \<le> pi
[PROOF STEP]
by (blast intro!: mpi_less_Im_Ln Im_Ln_le_pi Arcsin_body_lemma)


[STATEMENT]
lemma coeff_div_poly: "coeff (div_poly a f) n = coeff f n div a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (div_poly a f) n = coeff f n div a
[PROOF STEP]
unfolding div_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (map_poly (\<lambda>c. c div a) f) n = coeff f n div a
[PROOF STEP]
by (rule coeff_map_poly, auto)


[STATEMENT]
lemma simple_integral_cmult_indicator:
  assumes A: "A \<in> sets M"
  shows "(\<integral>\<^sup>Sx. c * indicator A x \<partial>M) = c * emeasure M A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>S x. c * indicator A x \<partial>M = c * emeasure M A
[PROOF STEP]
using simple_integral_mult[OF simple_function_indicator[OF A]]
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>S x. ?c * indicator A x \<partial>M = ?c * integral\<^sup>S M (indicator A)

goal (1 subgoal):
 1. \<integral>\<^sup>S x. c * indicator A x \<partial>M = c * emeasure M A
[PROOF STEP]
unfolding simple_integral_indicator_only[OF A]
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>S x. ?c * indicator A x \<partial>M = ?c * emeasure M A

goal (1 subgoal):
 1. \<integral>\<^sup>S x. c * indicator A x \<partial>M = c * emeasure M A
[PROOF STEP]
by simp


[STATEMENT]
lemma matrix_to_iarray_adjugate[code_unfold]:
  "matrix_to_iarray (adjugate A) = adjugate_iarrays (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (adjugate A) = adjugate_iarrays (matrix_to_iarray A)
[PROOF STEP]
unfolding adjugate_def adjugate_iarrays_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Finite_Cartesian_Product.transpose (cofactorM A)) = transpose_iarray (cofactorM_iarrays (matrix_to_iarray A))
[PROOF STEP]
unfolding matrix_to_iarray_cofactorM[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Finite_Cartesian_Product.transpose (cofactorM A)) = transpose_iarray (matrix_to_iarray (cofactorM A))
[PROOF STEP]
unfolding matrix_to_iarray_transpose[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Finite_Cartesian_Product.transpose (cofactorM A)) = matrix_to_iarray (Finite_Cartesian_Product.transpose (cofactorM A))
[PROOF STEP]
..


[STATEMENT]
lemma affine_Inter [intro]: "(\<And>s. s\<in>f \<Longrightarrow> affine s) \<Longrightarrow> affine (\<Inter>f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s. s \<in> f \<Longrightarrow> affine s) \<Longrightarrow> affine (\<Inter> f)
[PROOF STEP]
unfolding affine_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s. s \<in> f \<Longrightarrow> \<forall>x\<in>s. \<forall>y\<in>s. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> s) \<Longrightarrow> \<forall>x\<in>\<Inter> f. \<forall>y\<in>\<Inter> f. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> \<Inter> f
[PROOF STEP]
by auto


[STATEMENT]
lemma e2ennreal_0 [simp]: "e2ennreal 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e2ennreal 0 = 0
[PROOF STEP]
by(simp add: zero_ennreal_def)


[STATEMENT]
lemma ceiling_least_real: "ceiling(r::real) = (LEAST i. r \<le> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>r\<rceil> = (LEAST i. r \<le> real_of_int i)
[PROOF STEP]
by (metis Least_equality ceiling_le le_of_int_ceiling)


[STATEMENT]
lemma [THEN has_vderiv_on_eq_rhs, derivative_intros]:
  fixes f g::"real \<Rightarrow> 'a::real_normed_algebra"
  assumes "(f has_vderiv_on f') T"
  assumes "(g has_vderiv_on g') T"
  shows has_vderiv_on_mult: "((\<lambda>x. f x * g x) has_vderiv_on (\<lambda>x. f x * g' x + f' x * g x)) T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) has_vderiv_on (\<lambda>x. f x * g' x + f' x * g x)) T
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f has_vderiv_on f') T
(g has_vderiv_on g') T

goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) has_vderiv_on (\<lambda>x. f x * g' x + f' x * g x)) T
[PROOF STEP]
by (auto simp: has_vderiv_on_def intro!: derivative_eq_intros)


[STATEMENT]
lemma Nset_Suc0:"{i. i \<le> (Suc 0)} = {0, Suc 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i \<le> Suc 0} = {0, Suc 0}
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {i. i \<le> Suc 0} \<subseteq> {0, Suc 0}
 2. {0, Suc 0} \<subseteq> {i. i \<le> Suc 0}
[PROOF STEP]
apply (rule subsetI, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<le> Suc 0 \<Longrightarrow> x = 0 \<or> x = Suc 0
 2. {0, Suc 0} \<subseteq> {i. i \<le> Suc 0}
[PROOF STEP]
apply (case_tac "x = 0", simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>x \<le> Suc 0; x \<noteq> 0\<rbrakk> \<Longrightarrow> x = 0 \<or> x = Suc 0
 2. {0, Suc 0} \<subseteq> {i. i \<le> Suc 0}
[PROOF STEP]
apply simp+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma card_bij:
  assumes "f \<in> A \<rightarrow> B" "inj_on f A"
    and "g \<in> B \<rightarrow> A" "inj_on g B"
    and "finite A" "finite B"
  shows "card A = card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A = card B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> A \<rightarrow> B
inj_on f A
g \<in> B \<rightarrow> A
inj_on g B
finite A
finite B

goal (1 subgoal):
 1. card A = card B
[PROOF STEP]
by (blast intro: card_inj order_antisym)


[STATEMENT]
lemma nat_mult_le_one:
  fixes m n::nat
  assumes "m \<le> 1" "n \<le> 1"
  shows "m * n \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m * n \<le> 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m \<le> 1
n \<le> 1

goal (1 subgoal):
 1. m * n \<le> 1
[PROOF STEP]
by (induct n) (auto)


[STATEMENT]
theorem set_vebt_maxt': "invar_vebt t n \<Longrightarrow> vebt_maxt t = Some x \<longleftrightarrow> (x\<in>set_vebt t \<and> (\<forall>y\<in>set_vebt t. x\<ge>y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> (vebt_maxt t = Some x) = (x \<in> set_vebt t \<and> (\<forall>y\<in>set_vebt t. y \<le> x))
[PROOF STEP]
using set_vebt_maxt
[PROOF STATE]
proof (prove)
using this:
invar_vebt ?t n \<Longrightarrow> (vebt_maxt ?t = Some ?x) = max_in_set (set_vebt ?t) ?x

goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> (vebt_maxt t = Some x) = (x \<in> set_vebt t \<and> (\<forall>y\<in>set_vebt t. y \<le> x))
[PROOF STEP]
unfolding max_in_set_def
[PROOF STATE]
proof (prove)
using this:
invar_vebt ?t n \<Longrightarrow> (vebt_maxt ?t = Some ?x) = (?x \<in> set_vebt ?t \<and> (\<forall>y\<in>set_vebt ?t. y \<le> ?x))

goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> (vebt_maxt t = Some x) = (x \<in> set_vebt t \<and> (\<forall>y\<in>set_vebt t. y \<le> x))
[PROOF STEP]
by blast


[STATEMENT]
lemma gen_boolean_algebra_finite_intersection:
  assumes "\<And>a. a \<in> A \<Longrightarrow> a \<in> gen_boolean_algebra S B"
  assumes "finite A"
  assumes "A \<noteq> {}"
  shows "\<Inter>A \<in> gen_boolean_algebra S B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> A \<in> gen_boolean_algebra S B
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Inter> A \<in> gen_boolean_algebra S B
[PROOF STEP]
have "(\<forall>a \<in> A. a \<in> gen_boolean_algebra S B) \<and> A \<noteq> {} \<longrightarrow> \<Inter>A \<in> gen_boolean_algebra S B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<and> A \<noteq> {} \<longrightarrow> \<Inter> A \<in> gen_boolean_algebra S B
[PROOF STEP]
apply(rule finite.induct[of A])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite A
 2. (\<forall>a\<in>{}. a \<in> gen_boolean_algebra S B) \<and> {} \<noteq> {} \<longrightarrow> \<Inter> {} \<in> gen_boolean_algebra S B
 3. \<And>A a. \<lbrakk>finite A; (\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<and> A \<noteq> {} \<longrightarrow> \<Inter> A \<in> gen_boolean_algebra S B\<rbrakk> \<Longrightarrow> (\<forall>a\<in>insert a A. a \<in> gen_boolean_algebra S B) \<and> insert a A \<noteq> {} \<longrightarrow> \<Inter> (insert a A) \<in> gen_boolean_algebra S B
[PROOF STEP]
apply (simp add: assms(2))
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>a\<in>{}. a \<in> gen_boolean_algebra S B) \<and> {} \<noteq> {} \<longrightarrow> \<Inter> {} \<in> gen_boolean_algebra S B
 2. \<And>A a. \<lbrakk>finite A; (\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<and> A \<noteq> {} \<longrightarrow> \<Inter> A \<in> gen_boolean_algebra S B\<rbrakk> \<Longrightarrow> (\<forall>a\<in>insert a A. a \<in> gen_boolean_algebra S B) \<and> insert a A \<noteq> {} \<longrightarrow> \<Inter> (insert a A) \<in> gen_boolean_algebra S B
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; (\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<and> A \<noteq> {} \<longrightarrow> \<Inter> A \<in> gen_boolean_algebra S B\<rbrakk> \<Longrightarrow> (\<forall>a\<in>insert a A. a \<in> gen_boolean_algebra S B) \<and> insert a A \<noteq> {} \<longrightarrow> \<Inter> (insert a A) \<in> gen_boolean_algebra S B
[PROOF STEP]
using gen_boolean_algebra_intersect
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> gen_boolean_algebra ?S ?B; ?C \<in> gen_boolean_algebra ?S ?B\<rbrakk> \<Longrightarrow> ?A \<inter> ?C \<in> gen_boolean_algebra ?S ?B

goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; (\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<and> A \<noteq> {} \<longrightarrow> \<Inter> A \<in> gen_boolean_algebra S B\<rbrakk> \<Longrightarrow> (\<forall>a\<in>insert a A. a \<in> gen_boolean_algebra S B) \<and> insert a A \<noteq> {} \<longrightarrow> \<Inter> (insert a A) \<in> gen_boolean_algebra S B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<and> A \<noteq> {} \<longrightarrow> \<Inter> A \<in> gen_boolean_algebra S B

goal (1 subgoal):
 1. \<Inter> A \<in> gen_boolean_algebra S B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<and> A \<noteq> {} \<longrightarrow> \<Inter> A \<in> gen_boolean_algebra S B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<and> A \<noteq> {} \<longrightarrow> \<Inter> A \<in> gen_boolean_algebra S B

goal (1 subgoal):
 1. \<Inter> A \<in> gen_boolean_algebra S B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<forall>a\<in>A. a \<in> gen_boolean_algebra S B) \<and> A \<noteq> {} \<longrightarrow> \<Inter> A \<in> gen_boolean_algebra S B
?a \<in> A \<Longrightarrow> ?a \<in> gen_boolean_algebra S B
finite A
A \<noteq> {}

goal (1 subgoal):
 1. \<Inter> A \<in> gen_boolean_algebra S B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<Inter> A \<in> gen_boolean_algebra S B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conjugate_preserve_poincare_distance [simp]:
  assumes "u \<in> unit_disc" and "v \<in> unit_disc"
  shows "poincare_distance (conjugate u) (conjugate v) = poincare_distance u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_distance (conjugate u) (conjugate v) = poincare_distance u v
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poincare_distance (conjugate u) (conjugate v) = poincare_distance u v
[PROOF STEP]
obtain u' v' where *: "u = of_complex u'" "v = of_complex v'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u' v'. \<lbrakk>u = of_complex u'; v = of_complex v'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms inf_or_of_complex[of u] inf_or_of_complex[of v]
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
u = \<infinity>\<^sub>h \<or> (\<exists>x. u = of_complex x)
v = \<infinity>\<^sub>h \<or> (\<exists>x. v = of_complex x)

goal (1 subgoal):
 1. (\<And>u' v'. \<lbrakk>u = of_complex u'; v = of_complex v'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u = of_complex u'
v = of_complex v'

goal (1 subgoal):
 1. poincare_distance (conjugate u) (conjugate v) = poincare_distance u v
[PROOF STEP]
have **: "conjugate u \<in> unit_disc" "conjugate v \<in> unit_disc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate u \<in> unit_disc &&& conjugate v \<in> unit_disc
[PROOF STEP]
using * assms
[PROOF STATE]
proof (prove)
using this:
u = of_complex u'
v = of_complex v'
u \<in> unit_disc
v \<in> unit_disc

goal (1 subgoal):
 1. conjugate u \<in> unit_disc &&& conjugate v \<in> unit_disc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
conjugate u \<in> unit_disc
conjugate v \<in> unit_disc

goal (1 subgoal):
 1. poincare_distance (conjugate u) (conjugate v) = poincare_distance u v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_distance (conjugate u) (conjugate v) = poincare_distance u v
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
u = of_complex u'
v = of_complex v'

goal (1 subgoal):
 1. poincare_distance (conjugate u) (conjugate v) = poincare_distance u v
[PROOF STEP]
using poincare_distance_formula[OF assms]
[PROOF STATE]
proof (prove)
using this:
u = of_complex u'
v = of_complex v'
poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)

goal (1 subgoal):
 1. poincare_distance (conjugate u) (conjugate v) = poincare_distance u v
[PROOF STEP]
using poincare_distance_formula[OF **]
[PROOF STATE]
proof (prove)
using this:
u = of_complex u'
v = of_complex v'
poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)
poincare_distance (conjugate u) (conjugate v) = poincare_distance_formula (to_complex (conjugate u)) (to_complex (conjugate v))

goal (1 subgoal):
 1. poincare_distance (conjugate u) (conjugate v) = poincare_distance u v
[PROOF STEP]
by (metis complex_cnj_diff complex_mod_cnj conjugate_of_complex poincare_distance_def poincare_distance_formula'_def poincare_distance_formula_def to_complex_of_complex)
[PROOF STATE]
proof (state)
this:
poincare_distance (conjugate u) (conjugate v) = poincare_distance u v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_le_floor [simp]: "1 \<le> \<lfloor>x\<rfloor> \<longleftrightarrow> 1 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 \<le> \<lfloor>x\<rfloor>) = ((1::'a) \<le> x)
[PROOF STEP]
by (simp add: le_floor_iff)


[STATEMENT]
lemma flow_isCont_state_space: "t \<in> existence_ivl t0 x0 \<Longrightarrow> isCont (\<lambda>(x, t). flow t0 x t) (x0, t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> existence_ivl t0 x0 \<Longrightarrow> isCont (\<lambda>(x, t). flow t0 x t) (x0, t)
[PROOF STEP]
using flow_continuous_on_state_space[of] mem_existence_ivl_iv_defined[of t x0]
[PROOF STATE]
proof (prove)
using this:
continuous_on (Sigma X (existence_ivl t0)) (\<lambda>(x, t). flow t0 x t)
t \<in> existence_ivl t0 x0 \<Longrightarrow> t0 \<in> T
t \<in> existence_ivl t0 x0 \<Longrightarrow> x0 \<in> X

goal (1 subgoal):
 1. t \<in> existence_ivl t0 x0 \<Longrightarrow> isCont (\<lambda>(x, t). flow t0 x t) (x0, t)
[PROOF STEP]
using continuous_on_eq_continuous_at open_state_space
[PROOF STATE]
proof (prove)
using this:
continuous_on (Sigma X (existence_ivl t0)) (\<lambda>(x, t). flow t0 x t)
t \<in> existence_ivl t0 x0 \<Longrightarrow> t0 \<in> T
t \<in> existence_ivl t0 x0 \<Longrightarrow> x0 \<in> X
open ?s \<Longrightarrow> continuous_on ?s ?f = (\<forall>x\<in>?s. isCont ?f x)
open (Sigma X (existence_ivl t0))

goal (1 subgoal):
 1. t \<in> existence_ivl t0 x0 \<Longrightarrow> isCont (\<lambda>(x, t). flow t0 x t) (x0, t)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma p_binom: assumes sk: "s \<le> k"
  shows "of_nat (k choose s) = poly (p s) (of_nat k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (k choose s) = poly (p s) (real k)
[PROOF STEP]
unfolding binomial_altdef_of_nat[OF assms] p_def poly_prod
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<s. real (k - i) / real (s - i)) = (\<Prod>ka = 0..<s. poly [:- real ka / real (s - ka), 1 / real (s - ka):] (real k))
[PROOF STEP]
by (rule prod.cong[OF refl], insert sk, auto simp: field_simps)


[STATEMENT]
lemma connected_UNIV[simp]: "connected (UNIV::'a::linear_continuum_topology set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected UNIV
[PROOF STEP]
by (simp add: connected_iff_interval)


[STATEMENT]
lemma cauchy_schwarz_col [simp]:
  assumes "dim_vec v = dim_vec w" and "(cmod(\<langle>v|w\<rangle>))\<^sup>2 = Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)"
  shows "\<exists>l. v = (l \<cdot>\<^sub>v w) \<or> w = (l \<cdot>\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
proof (cases "\<langle>v|v\<rangle> = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<langle>v|v\<rangle> = 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
 2. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
case c0:True
[PROOF STATE]
proof (state)
this:
\<langle>v|v\<rangle> = 0

goal (2 subgoals):
 1. \<langle>v|v\<rangle> = 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
 2. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<langle>v|v\<rangle> = 0
[PROOF STEP]
have "\<And>i. i < dim_vec v \<Longrightarrow> v $ i = 0"
[PROOF STATE]
proof (prove)
using this:
\<langle>v|v\<rangle> = 0

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> v $ i = 0
[PROOF STEP]
by(metis index_zero_vec(1) inner_prod_with_itself_nonneg_reals_non0)
[PROOF STATE]
proof (state)
this:
?i < dim_vec v \<Longrightarrow> v $ ?i = 0

goal (2 subgoals):
 1. \<langle>v|v\<rangle> = 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
 2. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < dim_vec v \<Longrightarrow> v $ ?i = 0
[PROOF STEP]
have "v = 0 \<cdot>\<^sub>v w"
[PROOF STATE]
proof (prove)
using this:
?i < dim_vec v \<Longrightarrow> v $ ?i = 0

goal (1 subgoal):
 1. v = 0 \<cdot>\<^sub>v w
[PROOF STEP]
by (auto simp: assms)
[PROOF STATE]
proof (state)
this:
v = 0 \<cdot>\<^sub>v w

goal (2 subgoals):
 1. \<langle>v|v\<rangle> = 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
 2. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v = 0 \<cdot>\<^sub>v w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
v = 0 \<cdot>\<^sub>v w

goal (1 subgoal):
 1. \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
case c1:False
[PROOF STATE]
proof (state)
this:
\<langle>v|v\<rangle> \<noteq> 0

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
have f0:"dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)
[PROOF STEP]
by (simp add: assms(1))
[PROOF STATE]
proof (state)
this:
dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)
[PROOF STEP]
have "\<langle>w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> +
\<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>"
[PROOF STATE]
proof (prove)
using this:
dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
[PROOF STEP]
using inner_prod_expand[of "w" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v" "w" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v"]
[PROOF STATE]
proof (prove)
using this:
dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)
\<lbrakk>dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v); dim_vec w = dim_vec w; dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)\<rbrakk> \<Longrightarrow> \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>

goal (1 subgoal):
 1. \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
have "\<langle>w|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> * \<langle>w|v\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>
[PROOF STEP]
using assms(1) inner_prod_distrib_right[of "w" "v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"]
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_vec w
dim_vec w = dim_vec v \<Longrightarrow> \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>

goal (1 subgoal):
 1. \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
have "\<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj(-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>) * \<langle>v|w\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>
[PROOF STEP]
using assms(1) inner_prod_distrib_left[of "v" "w" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"]
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_vec w
dim_vec v = dim_vec w \<Longrightarrow> \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>

goal (1 subgoal):
 1. \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
have "\<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj(-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>) * (-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>) * \<langle>v|v\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|v\<rangle>
[PROOF STEP]
using inner_prod_distrib_left[of "v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"]
inner_prod_distrib_right[of "v" "v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"]
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v) \<Longrightarrow> \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
dim_vec v = dim_vec v \<Longrightarrow> \<langle>v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|v\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
\<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|v\<rangle>
[PROOF STEP]
have "\<langle>w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> -  cmod(\<langle>v|w\<rangle>)^2 / \<langle>v|v\<rangle>"
[PROOF STATE]
proof (prove)
using this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
\<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>
[PROOF STEP]
using inner_prod_cnj[of "w" "v"] inner_prod_cnj[of "v" "v"] assms(1) complex_norm_square
[PROOF STATE]
proof (prove)
using this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
\<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|v\<rangle>
dim_vec w = dim_vec v \<Longrightarrow> \<langle>v|w\<rangle> = cnj \<langle>w|v\<rangle>
dim_vec v = dim_vec v \<Longrightarrow> \<langle>v|v\<rangle> = cnj \<langle>v|v\<rangle>
dim_vec v = dim_vec w
complex_of_real ((cmod ?z)\<^sup>2) = ?z * cnj ?z

goal (1 subgoal):
 1. \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
have "\<langle>w|w\<rangle> = cmod(\<langle>v|w\<rangle>)^2 / \<langle>v|v\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>w|w\<rangle> = complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>
[PROOF STEP]
using assms(2) inner_prod_with_itself_real
[PROOF STATE]
proof (prove)
using this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 = Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
\<langle>?u|?u\<rangle> \<in> \<real>

goal (1 subgoal):
 1. \<langle>w|w\<rangle> = complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>
[PROOF STEP]
by(metis Reals_mult c1 nonzero_mult_div_cancel_left of_real_Re)
[PROOF STATE]
proof (state)
this:
\<langle>w|w\<rangle> = complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>
\<langle>w|w\<rangle> = complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>
[PROOF STEP]
have "\<langle>w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = 0"
[PROOF STATE]
proof (prove)
using this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>
\<langle>w|w\<rangle> = complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = 0

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = 0
[PROOF STEP]
have "\<And>i. i<dim_vec w \<Longrightarrow> (w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v) $ i = 0"
[PROOF STATE]
proof (prove)
using this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = 0

goal (1 subgoal):
 1. \<And>i. i < dim_vec w \<Longrightarrow> (w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v) $ i = 0
[PROOF STEP]
by (metis f0 index_add_vec(2) index_zero_vec(1) inner_prod_with_itself_nonneg_reals_non0)
[PROOF STATE]
proof (state)
this:
?i < dim_vec w \<Longrightarrow> (w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v) $ ?i = 0

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < dim_vec w \<Longrightarrow> (w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v) $ ?i = 0
[PROOF STEP]
have "\<And>i. i<dim_vec w \<Longrightarrow> w $ i + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> * v $ i = 0"
[PROOF STATE]
proof (prove)
using this:
?i < dim_vec w \<Longrightarrow> (w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v) $ ?i = 0

goal (1 subgoal):
 1. \<And>i. i < dim_vec w \<Longrightarrow> w $ i + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * v $ i = 0
[PROOF STEP]
by (metis assms(1) f0 index_add_vec(1) index_smult_vec(1))
[PROOF STATE]
proof (state)
this:
?i < dim_vec w \<Longrightarrow> w $ ?i + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * v $ ?i = 0

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < dim_vec w \<Longrightarrow> w $ ?i + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * v $ ?i = 0
[PROOF STEP]
have "\<And>i. i<dim_vec w \<Longrightarrow> w $ i = \<langle>v|w\<rangle>/\<langle>v|v\<rangle> * v $ i"
[PROOF STATE]
proof (prove)
using this:
?i < dim_vec w \<Longrightarrow> w $ ?i + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * v $ ?i = 0

goal (1 subgoal):
 1. \<And>i. i < dim_vec w \<Longrightarrow> w $ i = \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * v $ i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i < dim_vec w \<Longrightarrow> w $ ?i = \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * v $ ?i

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < dim_vec w \<Longrightarrow> w $ ?i = \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * v $ ?i
[PROOF STEP]
have "w = \<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v"
[PROOF STATE]
proof (prove)
using this:
?i < dim_vec w \<Longrightarrow> w $ ?i = \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * v $ ?i

goal (1 subgoal):
 1. w = \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v
[PROOF STEP]
by (auto simp add: assms(1))
[PROOF STATE]
proof (state)
this:
w = \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
w = \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v

goal (1 subgoal):
 1. \<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>l. v = l \<cdot>\<^sub>v w \<or> w = l \<cdot>\<^sub>v v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_pow2_le[simp]:
  fixes n :: nat
  shows "finite {i. 2 ^ i \<le> n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. 2 ^ i \<le> n}
[PROOF STEP]
by (induct n) (auto simp: le_Suc_eq finite_pow2_eq)


[STATEMENT]
lemma wordinterval_sort: "wordinterval_to_set (wordinterval_sort w) = wordinterval_to_set w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (wordinterval_sort w) = wordinterval_to_set w
[PROOF STEP]
by (simp add: wordinterval_sort_def wi2l l2wi mergesort_remdups_correct)


[STATEMENT]
lemma iprev_le_mono_rev: "
  \<lbrakk> iprev a I \<le> iprev b I; a \<in> I; b \<in> I; iMin I \<noteq> iprev b I \<rbrakk> \<Longrightarrow> a \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>iprev a I \<le> iprev b I; a \<in> I; b \<in> I; iMin I \<noteq> iprev b I\<rbrakk> \<Longrightarrow> a \<le> b
[PROOF STEP]
apply (rule ccontr, simp add: linorder_not_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>iprev a I \<le> iprev b I; a \<in> I; b \<in> I; iMin I \<noteq> iprev b I; b < a\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (metis iprev_fix_iff iprev_less_mono_if_neq_iMin less_le_not_le)


[STATEMENT]
lemma distinct_sorted_difference[simp]:
  "\<lbrakk> distinct xs; distinct ys; sorted xs; sorted ys \<rbrakk>
     \<Longrightarrow> distinct (difference xs ys) \<and> sorted (difference xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; distinct ys; sorted xs; sorted ys\<rbrakk> \<Longrightarrow> distinct (difference xs ys) \<and> sorted (difference xs ys)
[PROOF STEP]
by (induct xs ys rule: difference.induct) (auto)


[STATEMENT]
lemma isCont_iff: "isCont f x = (\<lambda>h. f (x + h)) \<midarrow>0\<rightarrow> f x"
  for f :: "'a::real_normed_vector \<Rightarrow> 'b::topological_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont f x = (\<lambda>h. f (x + h)) \<midarrow>0::'a\<rightarrow> f x
[PROOF STEP]
by (simp add: isCont_def LIM_isCont_iff)


[STATEMENT]
lemma hermitian_decomp_unitary:
  assumes "hermitian_decomp A B U"
  shows "unitary U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.unitary U
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hermitian_decomp A B U

goal (1 subgoal):
 1. Complex_Matrix.unitary U
[PROOF STEP]
unfolding hermitian_decomp_def
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A B U (Complex_Matrix.adjoint U) \<and> diagonal_mat B \<and> diag_mat B = eigvals A \<and> Complex_Matrix.unitary U \<and> (\<forall>i<dim_row B. B $$ (i, i) \<in> \<real>)

goal (1 subgoal):
 1. Complex_Matrix.unitary U
[PROOF STEP]
by simp


[STATEMENT]
lemma NSLIMSEQ_rabs_zero: "(\<lambda>n. \<bar>f n\<bar>) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0 \<longleftrightarrow> f \<longlonglongrightarrow>\<^sub>N\<^sub>S (0::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<bar>f n\<bar>) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0 = f \<longlonglongrightarrow>\<^sub>N\<^sub>S 0
[PROOF STEP]
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] tendsto_rabs_zero_iff)


[STATEMENT]
lemma Frct_inverse: "inverse (Frct (a, b)) = Frct (b, a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (Frct (a, b)) = Frct (b, a)
[PROOF STEP]
by simp


[STATEMENT]
lemma convex_on_ereal_mem:
  assumes "convex_on s f"
  assumes "x:s" "y:s"
  assumes "u\<ge>0" "v\<ge>0" "u+v=1"
  shows "f (u *\<^sub>R x + v *\<^sub>R y) \<le> ereal u * f x + ereal v * f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> ereal u * f x + ereal v * f y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Lower_Semicontinuous.convex_on s f
x \<in> s
y \<in> s
0 \<le> u
0 \<le> v
u + v = 1

goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> ereal u * f x + ereal v * f y
[PROOF STEP]
unfolding convex_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>s. \<forall>y\<in>s. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> f (u *\<^sub>R x + v *\<^sub>R y) \<le> ereal u * f x + ereal v * f y
x \<in> s
y \<in> s
0 \<le> u
0 \<le> v
u + v = 1

goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> ereal u * f x + ereal v * f y
[PROOF STEP]
by auto


[STATEMENT]
lemma seteqI : "(\<And>a. a \<in> A \<Longrightarrow> a \<in> B) \<Longrightarrow> (\<And>b. b \<in> B \<Longrightarrow> b \<in> A) \<Longrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>a. a \<in> A \<Longrightarrow> a \<in> B; \<And>b. b \<in> B \<Longrightarrow> b \<in> A\<rbrakk> \<Longrightarrow> A = B
[PROOF STEP]
using subset_antisym subsetI
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<subseteq> ?B; ?B \<subseteq> ?A\<rbrakk> \<Longrightarrow> ?A = ?B
(\<And>x. x \<in> ?A \<Longrightarrow> x \<in> ?B) \<Longrightarrow> ?A \<subseteq> ?B

goal (1 subgoal):
 1. \<lbrakk>\<And>a. a \<in> A \<Longrightarrow> a \<in> B; \<And>b. b \<in> B \<Longrightarrow> b \<in> A\<rbrakk> \<Longrightarrow> A = B
[PROOF STEP]
by fast


[STATEMENT]
lemma minus_cis: "-cis x = cis (x + pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - cis x = cis (x + pi)
[PROOF STEP]
by (simp add: complex_eq_iff)


[STATEMENT]
lemma matrix_to_iarray_option_inverse_matrix_code[code_unfold]:
fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}"
shows "matrix_to_iarray_option (inverse_matrix A) = (let matrix_to_iarray_A = matrix_to_iarray A; GJ = Gauss_Jordan_iarrays_PA matrix_to_iarray_A
  in if nrows_iarray matrix_to_iarray_A = length [x\<leftarrow>IArray.list_of (snd GJ) . \<not> is_zero_iarray x] then Some (fst GJ) else None)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray_option (inverse_matrix A) = (let matrix_to_iarray_A = matrix_to_iarray A; GJ = Gauss_Jordan_iarrays_PA matrix_to_iarray_A in if nrows_iarray matrix_to_iarray_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))) then Some (fst GJ) else None)
[PROOF STEP]
unfolding matrix_to_iarray_option_inverse_matrix
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse_matrix_iarray (matrix_to_iarray A) = (let matrix_to_iarray_A = matrix_to_iarray A; GJ = Gauss_Jordan_iarrays_PA matrix_to_iarray_A in if nrows_iarray matrix_to_iarray_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))) then Some (fst GJ) else None)
[PROOF STEP]
unfolding inverse_matrix_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if invertible_iarray (matrix_to_iarray A) then Some (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))) else None) = (let matrix_to_iarray_A = matrix_to_iarray A; GJ = Gauss_Jordan_iarrays_PA matrix_to_iarray_A in if nrows_iarray matrix_to_iarray_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))) then Some (fst GJ) else None)
[PROOF STEP]
unfolding invertible_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if rank_iarray (matrix_to_iarray A) = nrows_iarray (matrix_to_iarray A) then Some (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))) else None) = (let matrix_to_iarray_A = matrix_to_iarray A; GJ = Gauss_Jordan_iarrays_PA matrix_to_iarray_A in if nrows_iarray matrix_to_iarray_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))) then Some (fst GJ) else None)
[PROOF STEP]
unfolding rank_iarrays_code
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A)))) = nrows_iarray (matrix_to_iarray A) then Some (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))) else None) = (let matrix_to_iarray_A = matrix_to_iarray A; GJ = Gauss_Jordan_iarrays_PA matrix_to_iarray_A in if nrows_iarray matrix_to_iarray_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))) then Some (fst GJ) else None)
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A)))) = nrows_iarray (matrix_to_iarray A) then Some (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))) else None) = (if nrows_iarray (matrix_to_iarray A) = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))))) then Some (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))) else None)
[PROOF STEP]
unfolding matrix_to_iarray_snd_Gauss_Jordan_PA[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A)))) = nrows_iarray (matrix_to_iarray A) then Some (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))) else None) = (if nrows_iarray (matrix_to_iarray A) = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (matrix_to_iarray (snd (Gauss_Jordan_PA A))))) then Some (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))) else None)
[PROOF STEP]
unfolding Gauss_Jordan_PA_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A)))) = nrows_iarray (matrix_to_iarray A) then Some (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))) else None) = (if nrows_iarray (matrix_to_iarray A) = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (matrix_to_iarray (Gauss_Jordan A)))) then Some (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))) else None)
[PROOF STEP]
unfolding matrix_to_iarray_Gauss_Jordan
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A)))) = nrows_iarray (matrix_to_iarray A) then Some (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))) else None) = (if nrows_iarray (matrix_to_iarray A) = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A)))) then Some (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))) else None)
[PROOF STEP]
by presburger


[STATEMENT]
lemma finite_iff_cardOf_nat:
"finite A = ( |A| <o |UNIV :: nat set| )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A = (|A| <o |UNIV|)
[PROOF STEP]
using infinite_iff_card_of_nat[of A]
not_ordLeq_iff_ordLess[of "|A|" "|UNIV :: nat set|"]
[PROOF STATE]
proof (prove)
using this:
infinite A = (|UNIV| \<le>o |A|)
\<lbrakk>Well_order |A|; Well_order |UNIV|\<rbrakk> \<Longrightarrow> ((|UNIV|, |A|) \<notin> ordLeq) = (|A| <o |UNIV|)

goal (1 subgoal):
 1. finite A = (|A| <o |UNIV|)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma fps_mult_right_fps_X_plus_1_nth:
  fixes a :: "'a :: semiring_1 fps"
  shows "(a*(1+fps_X)) $ n = (if n = 0 then a$n else a$n + a$(n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * (1 + fps_X)) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
using fps_mult_fps_X_plus_1_nth
[PROOF STATE]
proof (prove)
using this:
((1 + fps_X) * ?a) $ ?n = (if ?n = 0 then ?a $ ?n else ?a $ ?n + ?a $ (?n - 1))

goal (1 subgoal):
 1. (a * (1 + fps_X)) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
by    (simp add: distrib_left fps_mult_fps_X_commute distrib_right)


[STATEMENT]
lemma homotopic_paths_imp_subset:
     "homotopic_paths s p q \<Longrightarrow> path_image p \<subseteq> s \<and> path_image q \<subseteq> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homotopic_paths s p q \<Longrightarrow> path_image p \<subseteq> s \<and> path_image q \<subseteq> s
[PROOF STEP]
by (metis (mono_tags) continuous_map_subtopology_eu homotopic_paths_def homotopic_with_imp_continuous_maps path_image_def)


[STATEMENT]
lemma sup_inf_distributive_dual:
  "sup_distributive x \<longleftrightarrow> inf_distributive (x\<^sup>d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sup_distributive x = inf_distributive (x\<^sup>d)
[PROOF STEP]
by (smt (verit, ccfv_threshold) sup_distributive_def dual_dist_sup dual_dist_comp dual_dist_inf dual_involutive inf_distributive_def)


[STATEMENT]
lemma has_integral_bound_:
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
  assumes "a < b"
    and "0 \<le> B"
    and f: "(f has_integral i) (cbox a b)"
    and "finite s"
    and "\<forall>x\<in>(cbox a b)-s. norm (f x) \<le> B"
  shows "norm i \<le> B * content (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm i \<le> B * content (cbox a b)
[PROOF STEP]
using has_integral_bound_spike_finite assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?B; finite ?S; (?f has_integral ?i) (cbox ?a ?b); \<And>x. x \<in> cbox ?a ?b - ?S \<Longrightarrow> norm (?f x) \<le> ?B\<rbrakk> \<Longrightarrow> norm ?i \<le> ?B * content (cbox ?a ?b)
a < b
0 \<le> B
(f has_integral i) (cbox a b)
finite s
\<forall>x\<in>cbox a b - s. norm (f x) \<le> B

goal (1 subgoal):
 1. norm i \<le> B * content (cbox a b)
[PROOF STEP]
by blast


[STATEMENT]
lemma "(1359 + 93746*\<i>) - (2468 + 46375*\<i>) = -1109 + 47371*\<i>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1359 + 93746 * \<i> - (2468 + 46375 * \<i>) = - 1109 + 47371 * \<i>
[PROOF STEP]
by simp


[STATEMENT]
lemma eventually_going_to_at_top_linorder:
  fixes f :: "'a \<Rightarrow> 'b :: linorder"
  shows "eventually P (f going_to at_top within A) \<longleftrightarrow> (\<exists>C. \<forall>x\<in>A. f x \<ge> C \<longrightarrow> P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (f going_to at_top within A) = (\<exists>C. \<forall>x\<in>A. C \<le> f x \<longrightarrow> P x)
[PROOF STEP]
unfolding going_to_within_def eventually_filtercomap
    eventually_inf_principal eventually_at_top_linorder
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>Q. (\<exists>N. \<forall>n\<ge>N. Q n) \<and> (\<forall>x. Q (f x) \<longrightarrow> x \<in> A \<longrightarrow> P x)) = (\<exists>C. \<forall>x\<in>A. C \<le> f x \<longrightarrow> P x)
[PROOF STEP]
by fast


[STATEMENT]
theorem CK_nf_real_card:
  shows "card ((\<lambda> f. f RRR) ` {f . CK_nf f}) = 14"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>f. f RRR) ` {f. CK_nf f}) = 14
[PROOF STEP]
by (simp add: CK_nf_set) ((subst card_insert_disjoint; auto dest!: RRR_test simp: nf_RRR id_def[symmetric])[1])+


[STATEMENT]
lemma has_prod_If_finite:
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
  shows "finite {r. P r} \<Longrightarrow> (\<lambda>r. if P r then f r else 1) has_prod (\<Prod>r | P r. f r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {r. P r} \<Longrightarrow> (\<lambda>r. if P r then f r else (1::'a)) has_prod prod f {r. P r}
[PROOF STEP]
using has_prod_If_finite_set[of "{r. P r}"]
[PROOF STATE]
proof (prove)
using this:
finite {r. P r} \<Longrightarrow> (\<lambda>r. if r \<in> {r. P r} then ?f r else (1::?'a)) has_prod prod ?f {r. P r}

goal (1 subgoal):
 1. finite {r. P r} \<Longrightarrow> (\<lambda>r. if P r then f r else (1::'a)) has_prod prod f {r. P r}
[PROOF STEP]
by simp


[STATEMENT]
lemma (in domain) poly_add_degree_le:
  assumes "x \<in> carrier (poly_ring R)" "degree x \<le> n"
  assumes "y \<in> carrier (poly_ring R)" "degree y \<le> n"
  shows "degree (x \<oplus>\<^bsub>poly_ring R\<^esub> y) \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (x \<oplus>\<^bsub>poly_ring R\<^esub> y) \<le> n
[PROOF STEP]
using assms poly_add_degree
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (poly_ring R)
degree x \<le> n
y \<in> carrier (poly_ring R)
degree y \<le> n
degree (poly_add ?p1.0 ?p2.0) \<le> max (degree ?p1.0) (degree ?p2.0)

goal (1 subgoal):
 1. degree (x \<oplus>\<^bsub>poly_ring R\<^esub> y) \<le> n
[PROOF STEP]
by (metis dual_order.trans max.bounded_iff univ_poly_add)


[STATEMENT]
lemma of_nat_divide_in_Ints_iff:
  assumes "b \<noteq> 0"
  shows   "(of_nat a / of_nat b :: 'a :: field_char_0) \<in> \<int> \<longleftrightarrow> b dvd a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_nat a / of_nat b \<in> \<int>) = (b dvd a)
[PROOF STEP]
using of_int_divide_in_Ints_iff[of "int b" "int a"] assms
[PROOF STATE]
proof (prove)
using this:
int b \<noteq> 0 \<Longrightarrow> (of_int (int a) / of_int (int b) \<in> \<int>) = (int b dvd int a)
b \<noteq> 0

goal (1 subgoal):
 1. (of_nat a / of_nat b \<in> \<int>) = (b dvd a)
[PROOF STEP]
by simp


[STATEMENT]
lemma gbinomial_absorb_comp: "(a - of_nat k) * (a gchoose k) = a * ((a - 1) gchoose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - of_nat k) * (a gchoose k) = a * (a - (1::'a) gchoose k)
[PROOF STEP]
using pochhammer_absorb_comp[of a k]
[PROOF STATE]
proof (prove)
using this:
(a - of_nat k) * pochhammer (- a) k = a * pochhammer (- a + (1::'a)) k

goal (1 subgoal):
 1. (a - of_nat k) * (a gchoose k) = a * (a - (1::'a) gchoose k)
[PROOF STEP]
by (simp add: gbinomial_pochhammer)


[STATEMENT]
lemma nsets_2_eq: "nsets A 2 = (\<Union>x\<in>A. \<Union>y\<in>A - {x}. {{x, y}})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [A]\<^bsup>2\<^esup> = (\<Union>x\<in>A. \<Union>y\<in>A - {x}. {{x, y}})
[PROOF STEP]
by (auto simp: nsets_def card_2_iff)


[STATEMENT]
lemma stopping_time_SUP_enat:
  fixes T :: "nat \<Rightarrow> ('a \<Rightarrow> enat)"
  shows "(\<And>i. stopping_time F (T i)) \<Longrightarrow> stopping_time F (SUP i. T i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. stopping_time F (T i)) \<Longrightarrow> stopping_time F (Sup (range T))
[PROOF STEP]
unfolding stopping_time_def SUP_apply SUP_le_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. \<forall>t. Measurable.pred (F t) (\<lambda>x. T i x \<le> t)) \<Longrightarrow> \<forall>t. Measurable.pred (F t) (\<lambda>x. \<forall>i\<in>UNIV. T i x \<le> t)
[PROOF STEP]
by (auto intro!: pred_intros_countable)


[STATEMENT]
lemma eventually_nonneg_mult [eventually_nonzero_simps]:
  assumes "eventually_nonneg F f" "eventually_nonneg F g"
  shows   "eventually_nonneg F (\<lambda>x. f x * g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually_nonneg F (\<lambda>x. f x * g x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
eventually_nonneg F f
eventually_nonneg F g

goal (1 subgoal):
 1. eventually_nonneg F (\<lambda>x. f x * g x)
[PROOF STEP]
unfolding eventually_nonneg_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. (0::'b) \<le> f x
\<forall>\<^sub>F x in F. (0::'b) \<le> g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. (0::'b) \<le> f x * g x
[PROOF STEP]
by eventually_elim simp


[STATEMENT]
lemma cmp_inj_1: "\<lbrakk> f \<in> A \<rightarrow> B; inj_on f A; g \<in> B \<rightarrow> C; inj_on g B \<rbrakk>
              \<Longrightarrow> inj_on (cmp g f) A "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; g \<in> B \<rightarrow> C; inj_on g B\<rbrakk> \<Longrightarrow> inj_on (cmp g f) A
[PROOF STEP]
apply (simp add:inj_on_def [of "cmp g f"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; g \<in> B \<rightarrow> C; inj_on g B\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. \<forall>y\<in>A. cmp g f x = cmp g f y \<longrightarrow> x = y
[PROOF STEP]
apply (rule ballI)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; g \<in> B \<rightarrow> C; inj_on g B; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> cmp g f x = cmp g f y \<longrightarrow> x = y
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; g \<in> B \<rightarrow> C; inj_on g B; x \<in> A; y \<in> A; cmp g f x = cmp g f y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply (simp add:cmp_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; g \<in> B \<rightarrow> C; inj_on g B; x \<in> A; y \<in> A; g (f x) = g (f y)\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply (frule_tac x = x in funcset_mem [of "f" "A" "B"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; g \<in> B \<rightarrow> C; inj_on g B; x \<in> A; y \<in> A; g (f x) = g (f y); f x \<in> B\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply (frule_tac x = y in funcset_mem [of "f" "A" "B"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; g \<in> B \<rightarrow> C; inj_on g B; x \<in> A; y \<in> A; g (f x) = g (f y); f x \<in> B; f y \<in> B\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply (frule_tac x = "f x" and y = "f y" in inj_onTr1 [of "g" "B"],
                       assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; g \<in> B \<rightarrow> C; inj_on g B; x \<in> A; y \<in> A; g (f x) = g (f y); f x \<in> B; f y \<in> B; f x = f y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply (rule_tac x = x and y = y in inj_onTr1 [of "f" "A"], assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma on_closure_leI:
  fixes f g :: \<open>'a::topological_space \<Rightarrow> 'b::linorder_topology\<close>
  assumes eq: \<open>\<And>x. x \<in> S \<Longrightarrow> f x \<le> g x\<close>
  assumes xS: \<open>x \<in> closure S\<close>
  assumes cont: \<open>continuous_on UNIV f\<close> \<open>continuous_on UNIV g\<close> (* Is "isCont f x" "isCont g x" sufficient? *)
  shows \<open>f x \<le> g x\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x \<le> g x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f x \<le> g x
[PROOF STEP]
define X where \<open>X = {x. f x \<le> g x}\<close>
[PROOF STATE]
proof (state)
this:
X = {x. f x \<le> g x}

goal (1 subgoal):
 1. f x \<le> g x
[PROOF STEP]
have \<open>closed X\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed X
[PROOF STEP]
using cont
[PROOF STATE]
proof (prove)
using this:
continuous_on UNIV f
continuous_on UNIV g

goal (1 subgoal):
 1. closed X
[PROOF STEP]
by (simp add: X_def closed_Collect_le)
[PROOF STATE]
proof (state)
this:
closed X

goal (1 subgoal):
 1. f x \<le> g x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
closed X

goal (1 subgoal):
 1. f x \<le> g x
[PROOF STEP]
have \<open>S \<subseteq> X\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> X
[PROOF STEP]
by (simp add: X_def eq subsetI)
[PROOF STATE]
proof (state)
this:
S \<subseteq> X

goal (1 subgoal):
 1. f x \<le> g x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
closed X
S \<subseteq> X
[PROOF STEP]
have \<open>closure S \<subseteq> X\<close>
[PROOF STATE]
proof (prove)
using this:
closed X
S \<subseteq> X

goal (1 subgoal):
 1. closure S \<subseteq> X
[PROOF STEP]
using closure_minimal
[PROOF STATE]
proof (prove)
using this:
closed X
S \<subseteq> X
\<lbrakk>?S \<subseteq> ?T; closed ?T\<rbrakk> \<Longrightarrow> closure ?S \<subseteq> ?T

goal (1 subgoal):
 1. closure S \<subseteq> X
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
closure S \<subseteq> X

goal (1 subgoal):
 1. f x \<le> g x
[PROOF STEP]
with xS
[PROOF STATE]
proof (chain)
picking this:
x \<in> closure S
closure S \<subseteq> X
[PROOF STEP]
have \<open>x \<in> X\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> closure S
closure S \<subseteq> X

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

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

goal (1 subgoal):
 1. f x \<le> g x
[PROOF STEP]
using X_def
[PROOF STATE]
proof (prove)
using this:
x \<in> X
X = {x. f x \<le> g x}

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_INF_in:
  fixes f :: "'a \<Rightarrow> ereal"
  assumes "finite S"
  assumes "S \<noteq> {}"
  shows "(INF s\<in> S. f s) \<in> f ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (f ` S) \<in> f ` S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Inf (f ` S) \<in> f ` S
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite S
S \<noteq> {}
[PROOF STEP]
have "finite (f ` S)" "f ` S \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
finite S
S \<noteq> {}

goal (1 subgoal):
 1. finite (f ` S) &&& f ` S \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (f ` S)
f ` S \<noteq> {}

goal (1 subgoal):
 1. Inf (f ` S) \<in> f ` S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (f ` S)
f ` S \<noteq> {}
[PROOF STEP]
show "Inf (f ` S) \<in> f ` S"
[PROOF STATE]
proof (prove)
using this:
finite (f ` S)
f ` S \<noteq> {}

goal (1 subgoal):
 1. Inf (f ` S) \<in> f ` S
[PROOF STEP]
using ereal_Inf_finite_Min [of "f ` S"]
[PROOF STATE]
proof (prove)
using this:
finite (f ` S)
f ` S \<noteq> {}
\<lbrakk>finite (f ` S); f ` S \<noteq> {}\<rbrakk> \<Longrightarrow> Inf (f ` S) = Min (f ` S)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_snd_helper:
  assumes "finite xs"
  shows "finite {z. ((q, p), z) \<in> xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {z. ((q, p), z) \<in> xs}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {z. ((q, p), z) \<in> xs}
[PROOF STEP]
have "{z. ((q, p), z) \<in> xs} \<subseteq> (\<lambda>((a,b),c) . c) ` xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {z. ((q, p), z) \<in> xs} \<subseteq> (\<lambda>((a, b), c). c) ` xs
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {z. ((q, p), z) \<in> xs} \<Longrightarrow> x \<in> (\<lambda>((a, b), c). c) ` xs
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {z. ((q, p), z) \<in> xs} \<Longrightarrow> x \<in> (\<lambda>((a, b), c). c) ` xs
[PROOF STEP]
assume "x \<in> {z. ((q, p), z) \<in> xs}"
[PROOF STATE]
proof (state)
this:
x \<in> {z. ((q, p), z) \<in> xs}

goal (1 subgoal):
 1. \<And>x. x \<in> {z. ((q, p), z) \<in> xs} \<Longrightarrow> x \<in> (\<lambda>((a, b), c). c) ` xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {z. ((q, p), z) \<in> xs}
[PROOF STEP]
have "((q,p),x) \<in> xs"
[PROOF STATE]
proof (prove)
using this:
x \<in> {z. ((q, p), z) \<in> xs}

goal (1 subgoal):
 1. ((q, p), x) \<in> xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((q, p), x) \<in> xs

goal (1 subgoal):
 1. \<And>x. x \<in> {z. ((q, p), z) \<in> xs} \<Longrightarrow> x \<in> (\<lambda>((a, b), c). c) ` xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((q, p), x) \<in> xs
[PROOF STEP]
show "x \<in> (\<lambda>((a,b),c) . c) ` xs"
[PROOF STATE]
proof (prove)
using this:
((q, p), x) \<in> xs

goal (1 subgoal):
 1. x \<in> (\<lambda>((a, b), c). c) ` xs
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
x \<in> (\<lambda>((a, b), c). c) ` xs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{z. ((q, p), z) \<in> xs} \<subseteq> (\<lambda>((a, b), c). c) ` xs

goal (1 subgoal):
 1. finite {z. ((q, p), z) \<in> xs}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{z. ((q, p), z) \<in> xs} \<subseteq> (\<lambda>((a, b), c). c) ` xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{z. ((q, p), z) \<in> xs} \<subseteq> (\<lambda>((a, b), c). c) ` xs

goal (1 subgoal):
 1. finite {z. ((q, p), z) \<in> xs}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
{z. ((q, p), z) \<in> xs} \<subseteq> (\<lambda>((a, b), c). c) ` xs
finite xs

goal (1 subgoal):
 1. finite {z. ((q, p), z) \<in> xs}
[PROOF STEP]
using finite_surj
[PROOF STATE]
proof (prove)
using this:
{z. ((q, p), z) \<in> xs} \<subseteq> (\<lambda>((a, b), c). c) ` xs
finite xs
\<lbrakk>finite ?A; ?B \<subseteq> ?f ` ?A\<rbrakk> \<Longrightarrow> finite ?B

goal (1 subgoal):
 1. finite {z. ((q, p), z) \<in> xs}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite {z. ((q, p), z) \<in> xs}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma truncate_down_pos:
  assumes "x > 0"
  shows "truncate_down p x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < truncate_down p x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < truncate_down p x
[PROOF STEP]
have "0 \<le> log 2 x - real_of_int \<lfloor>log 2 x\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> log 2 x - real_of_int \<lfloor>log 2 x\<rfloor>
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
0 \<le> log 2 x - real_of_int \<lfloor>log 2 x\<rfloor>

goal (1 subgoal):
 1. 0 < truncate_down p x
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < x
0 \<le> log 2 x - real_of_int \<lfloor>log 2 x\<rfloor>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < x
0 \<le> log 2 x - real_of_int \<lfloor>log 2 x\<rfloor>

goal (1 subgoal):
 1. 0 < truncate_down p x
[PROOF STEP]
apply (auto simp: truncate_down_def round_down_def mult_powr_eq
      intro!: ge_one_powr_ge_zero mult_pos_pos)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> 0 \<le> real p - real_of_int \<lfloor>log 2 x\<rfloor> + log 2 x
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 < truncate_down p x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_Digamma:
  assumes "(z :: 'a :: {real_normed_field,banach}) \<noteq> 0"
  shows   "summable (\<lambda>n. inverse (of_nat (Suc n)) - inverse (z + of_nat n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat (Suc n)) - inverse (z + of_nat n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat (Suc n)) - inverse (z + of_nat n))
[PROOF STEP]
have sums: "(\<lambda>n. inverse (z + of_nat (Suc n)) - inverse (z + of_nat n)) sums
                       (0 - inverse (z + of_nat 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. inverse (z + of_nat (Suc n)) - inverse (z + of_nat n)) sums ((0::'a) - inverse (z + of_nat 0))
[PROOF STEP]
by (intro telescope_sums filterlim_compose[OF tendsto_inverse_0]
              tendsto_add_filterlim_at_infinity[OF tendsto_const] tendsto_of_nat)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. inverse (z + of_nat (Suc n)) - inverse (z + of_nat n)) sums ((0::'a) - inverse (z + of_nat 0))

goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat (Suc n)) - inverse (z + of_nat n))
[PROOF STEP]
from summable_add[OF summable_deriv_ln_Gamma[OF assms] sums_summable[OF sums]]
[PROOF STATE]
proof (chain)
picking this:
summable (\<lambda>n. inverse (of_nat (Suc n)) - inverse (z + of_nat (Suc n)) + (inverse (z + of_nat (Suc n)) - inverse (z + of_nat n)))
[PROOF STEP]
show "summable (\<lambda>n. inverse (of_nat (Suc n)) - inverse (z + of_nat n))"
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. inverse (of_nat (Suc n)) - inverse (z + of_nat (Suc n)) + (inverse (z + of_nat (Suc n)) - inverse (z + of_nat n)))

goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat (Suc n)) - inverse (z + of_nat n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. inverse (of_nat (Suc n)) - inverse (z + of_nat n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_dropWhile_takeWhile:
  assumes "x < length (dropWhile P xs)"
  shows "x + length (takeWhile P xs) < length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + length (takeWhile P xs) < length xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x < length (dropWhile P xs)

goal (1 subgoal):
 1. x + length (takeWhile P xs) < length xs
[PROOF STEP]
by (induct xs) auto


[STATEMENT]
lemma primmultgreater2: fixes p::nat shows "\<lbrakk>prime p; prime q; p \<noteq> q\<rbrakk> \<Longrightarrow>  2 < p*q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; prime q; p \<noteq> q\<rbrakk> \<Longrightarrow> 2 < p * q
[PROOF STEP]
apply (cases "p = 2")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>prime p; prime q; p \<noteq> q; p = 2\<rbrakk> \<Longrightarrow> 2 < p * q
 2. \<lbrakk>prime p; prime q; p \<noteq> q; p \<noteq> 2\<rbrakk> \<Longrightarrow> 2 < p * q
[PROOF STEP]
apply simp+
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>prime q; q \<noteq> 2; p = 2\<rbrakk> \<Longrightarrow> Suc 0 < q
 2. \<lbrakk>prime p; prime q; p \<noteq> q; p \<noteq> 2\<rbrakk> \<Longrightarrow> 2 < p * q
[PROOF STEP]
apply (simp add: prime_nat_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; prime q; p \<noteq> q; p \<noteq> 2\<rbrakk> \<Longrightarrow> 2 < p * q
[PROOF STEP]
apply (cases "q = 2")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>prime p; prime q; p \<noteq> q; p \<noteq> 2; q = 2\<rbrakk> \<Longrightarrow> 2 < p * q
 2. \<lbrakk>prime p; prime q; p \<noteq> q; p \<noteq> 2; q \<noteq> 2\<rbrakk> \<Longrightarrow> 2 < p * q
[PROOF STEP]
apply (simp add: prime_nat_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; prime q; p \<noteq> q; p \<noteq> 2; q \<noteq> 2\<rbrakk> \<Longrightarrow> 2 < p * q
[PROOF STEP]
apply (erule primmultgreater)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>prime q; p \<noteq> q; p \<noteq> 2; q \<noteq> 2\<rbrakk> \<Longrightarrow> prime q
 2. \<lbrakk>prime q; p \<noteq> q; p \<noteq> 2; q \<noteq> 2\<rbrakk> \<Longrightarrow> p \<noteq> 2
 3. \<lbrakk>prime q; p \<noteq> q; p \<noteq> 2; q \<noteq> 2\<rbrakk> \<Longrightarrow> q \<noteq> 2
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma tendsto_ennreal_1 [tendsto_intros]:
  assumes "(u \<longlongrightarrow> 1) F"
  shows "((\<lambda>n. ennreal(u n)) \<longlongrightarrow> 1) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. ennreal (u n)) \<longlongrightarrow> 1) F
[PROOF STEP]
unfolding ennreal_1[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. ennreal (u n)) \<longlongrightarrow> ennreal 1) F
[PROOF STEP]
by (intro tendsto_intros assms)


[STATEMENT]
lemma word_of_nat_eq_0_iff:
  \<open>word_of_nat n = (0 :: 'a::len word) \<longleftrightarrow> 2 ^ LENGTH('a) dvd n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (word_of_nat n = 0) = (2 ^ LENGTH('a) dvd n)
[PROOF STEP]
using word_of_nat_eq_iff [where ?'a = 'a, of n 0]
[PROOF STATE]
proof (prove)
using this:
(word_of_nat n = word_of_nat 0) = (take_bit LENGTH('a) n = take_bit LENGTH('a) 0)

goal (1 subgoal):
 1. (word_of_nat n = 0) = (2 ^ LENGTH('a) dvd n)
[PROOF STEP]
by (simp add: take_bit_eq_0_iff)


[STATEMENT]
lemma eucl_of_list_map_uminus[simp]:
  assumes [simp]: "length xs = DIM('a::executable_euclidean_space)"
  shows "(eucl_of_list (map (\<lambda>x. - f x) xs)::'a) = - eucl_of_list (map f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list (map (\<lambda>x. - f x) xs) = - eucl_of_list (map f xs)
[PROOF STEP]
by (auto intro!: euclidean_eqI[where 'a='a] simp: algebra_simps eucl_of_list_inner)


[STATEMENT]
lemma fUnionM_funion [simp]: "fUnionM (A |\<union>| B) = funionM (fUnionM A) (fUnionM B)" for A B
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fUnionM (A |\<union>| B) = funionM (fUnionM A) (fUnionM B)
[PROOF STEP]
by(subst funionM_fUnionM2)(simp add: fUnionM_def ffold_set_union)


[STATEMENT]
lemma diag_four_block_mat: assumes c: "A \<in> carrier_mat n1 n1"
   "D \<in> carrier_mat n2 n2"
  shows "diag_mat (four_block_mat A B C D) = diag_mat A @ diag_mat D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_mat (four_block_mat A B C D) = diag_mat A @ diag_mat D
[PROOF STEP]
by (rule nth_equalityI, insert c, auto simp: diag_mat_def nth_append)


[STATEMENT]
lemma zmult_neg_pos:"\<lbrakk>i < (0::int); 0 < j\<rbrakk> \<Longrightarrow> i * j < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < 0; 0 < j\<rbrakk> \<Longrightarrow> i * j < 0
[PROOF STEP]
apply (frule int_mult_mono[of "i" "0" "j"], assumption+,
       simp add:mult.commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma insert_into_member_partition1:
  fixes elem::'a
    and P::"'a set set"
    and set::"'a set"
  shows "\<Union> (insert_into_member elem P set) = \<Union> (insert (set \<union> {elem}) (P - {set}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (insert_into_member elem P set) = \<Union> (insert (set \<union> {elem}) (P - {set}))
[PROOF STEP]
(* CL: The following takes 12 ms in Isabelle2013-1-RC1:
   by (metis insert_into_member_def). MC: possibly useful for TPTP *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (insert_into_member elem P set) = \<Union> (insert (set \<union> {elem}) (P - {set}))
[PROOF STEP]
unfolding insert_into_member_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (insert (set \<union> {elem}) (P - {set})) = \<Union> (insert (set \<union> {elem}) (P - {set}))
[PROOF STEP]
by fast


[STATEMENT]
lemma sup_least:
  assumes "A \<subseteq> carrier L" "z \<in> carrier L"
          "(\<And>x. x \<in> A \<Longrightarrow> x \<sqsubseteq> z)"
  shows "\<Squnion>A \<sqsubseteq> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion>A \<sqsubseteq> z
[PROOF STEP]
by (metis Upper_memI assms least_le sup_lub)


[STATEMENT]
lemma listsum_const[simp]:
  "(\<Sum>\<^bsub>x \<in> xs\<^esub> k) = length xs * k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^bsub>x\<in>xs\<^esub> k) = |xs| * k
[PROOF STEP]
by (induct xs) (simp_all add: ring_distribs)


[STATEMENT]
lemma (in group) one_in_subset:
  "[| H \<subseteq> carrier G; H \<noteq> {}; \<forall>a \<in> H. inv a \<in> H; \<forall>a\<in>H. \<forall>b\<in>H. a \<otimes> b \<in> H |]
   ==> \<one> \<in> H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<subseteq> carrier G; H \<noteq> {}; \<forall>a\<in>H. inv a \<in> H; \<forall>a\<in>H. \<forall>b\<in>H. a \<otimes> b \<in> H\<rbrakk> \<Longrightarrow> \<one> \<in> H
[PROOF STEP]
by force


[STATEMENT]
lemma analz_subset_iff [simp]: "(analz G \<subseteq> analz H) = (G \<subseteq> analz H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (analz G \<subseteq> analz H) = (G \<subseteq> analz H)
[PROOF STEP]
by (metis analz_idem analz_increasing analz_mono subset_trans)


[STATEMENT]
lemma zero_search_time: "VARS A i t
 {t=0}
 i := 0; t := t+1;
 WHILE i < length A \<and> A!i \<noteq> key
 INV {(\<forall>j. j<i \<longrightarrow> A!j \<noteq> key) \<and> i \<le> length A \<and> t = i+1}
 DO i := i+1; t := t+1 OD
 {(i < length A \<longrightarrow> A!i = key) \<and>
  (i = length A \<longrightarrow> (\<forall>j. j < length A --> A!j \<noteq> key)) \<and> t \<le> length A + 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {t = 0}
i := 0; t := t + 1; WHILE i < length A \<and> A ! i \<noteq> key INV {(\<forall>j<i. A ! j \<noteq> key) \<and> i \<le> length A \<and> t = i + 1}  VAR {0}
DO i := i + 1; t := t + 1 OD
{(i < length A \<longrightarrow> A ! i = key) \<and> (i = length A \<longrightarrow> (\<forall>j<length A. A ! j \<noteq> key)) \<and> t \<le> length A + 1}
[PROOF STEP]
apply vcg_simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A i. (\<forall>j<i. A ! j \<noteq> key) \<and> i \<le> length A \<and> i < length A \<and> A ! i \<noteq> key \<Longrightarrow> \<forall>j<Suc i. A ! j \<noteq> key
[PROOF STEP]
apply(blast elim!: less_SucE)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma evnodd_insert: "evnodd (insert (i, j) C) b =
    (if (i + j) mod 2 = b
      then insert (i, j) (evnodd C b) else evnodd C b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. evnodd (insert (i, j) C) b = (if (i + j) mod 2 = b then insert (i, j) (evnodd C b) else evnodd C b)
[PROOF STEP]
by (simp add: evnodd_def)


[STATEMENT]
lemma distinct_concat_iff: "distinct (concat xs) \<longleftrightarrow>
  distinct (removeAll [] xs) \<and>
  (\<forall>ys. ys \<in> set xs \<longrightarrow> distinct ys) \<and>
  (\<forall>ys zs. ys \<in> set xs \<and> zs \<in> set xs \<and> ys \<noteq> zs \<longrightarrow> set ys \<inter> set zs = {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (concat xs) = (distinct (removeAll [] xs) \<and> (\<forall>ys. ys \<in> set xs \<longrightarrow> distinct ys) \<and> (\<forall>ys zs. ys \<in> set xs \<and> zs \<in> set xs \<and> ys \<noteq> zs \<longrightarrow> set ys \<inter> set zs = {}))
[PROOF STEP]
apply (induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. distinct (concat []) = (distinct (removeAll [] []) \<and> (\<forall>ys. ys \<in> set [] \<longrightarrow> distinct ys) \<and> (\<forall>ys zs. ys \<in> set [] \<and> zs \<in> set [] \<and> ys \<noteq> zs \<longrightarrow> set ys \<inter> set zs = {}))
 2. \<And>a xs. distinct (concat xs) = (distinct (removeAll [] xs) \<and> (\<forall>ys. ys \<in> set xs \<longrightarrow> distinct ys) \<and> (\<forall>ys zs. ys \<in> set xs \<and> zs \<in> set xs \<and> ys \<noteq> zs \<longrightarrow> set ys \<inter> set zs = {})) \<Longrightarrow> distinct (concat (a # xs)) = (distinct (removeAll [] (a # xs)) \<and> (\<forall>ys. ys \<in> set (a # xs) \<longrightarrow> distinct ys) \<and> (\<forall>ys zs. ys \<in> set (a # xs) \<and> zs \<in> set (a # xs) \<and> ys \<noteq> zs \<longrightarrow> set ys \<inter> set zs = {}))
[PROOF STEP]
apply(simp_all, safe, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct (concat xs); [] \<noteq> a; distinct (removeAll [] xs); \<forall>ys. ys \<in> set xs \<longrightarrow> distinct ys; \<forall>ys zs. ys \<in> set xs \<and> zs \<in> set xs \<and> ys \<noteq> zs \<longrightarrow> set ys \<inter> set zs = {}; set a \<inter> \<Union> (set ` set xs) = {}; a \<in> set xs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (metis Int_iff UN_I empty_iff equals0I set_empty)


[STATEMENT]
lemma sigma2_lemma [simp]:
  shows "rec_eval (rec_sigma2 f) [x, y1, y2] = (\<Sum> z \<le> x. rec_eval f  [z, y1, y2])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_eval (rec_sigma2 f) [x, y1, y2] = (\<Sum>z\<le>x. rec_eval f [z, y1, y2])
[PROOF STEP]
by (induct x) (simp_all add: rec_sigma2_def)


[STATEMENT]
lemma sorted_list_of_set_UN_lessThan:
  fixes k::nat
  assumes sm: "strict_mono_sets {..<k} A" and "\<And>i. i < k \<Longrightarrow> finite (A i)"
  shows "sorted_list_of_set (\<Union>i<k. A i) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k}))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
strict_mono_sets {..<k} A
?i < k \<Longrightarrow> finite (A ?i)

goal (1 subgoal):
 1. sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k}))
[PROOF STEP]
proof (induction k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>strict_mono_sets {..<0} A; \<And>i. i < 0 \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<0})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<0}))
 2. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
strict_mono_sets {..<0} A
?i < 0 \<Longrightarrow> finite (A ?i)

goal (2 subgoals):
 1. \<lbrakk>strict_mono_sets {..<0} A; \<And>i. i < 0 \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<0})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<0}))
 2. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
strict_mono_sets {..<0} A
?i < 0 \<Longrightarrow> finite (A ?i)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
strict_mono_sets {..<0} A
?i < 0 \<Longrightarrow> finite (A ?i)

goal (1 subgoal):
 1. sorted_list_of_set (\<Union> (A ` {..<0})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<0}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (\<Union> (A ` {..<0})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<0}))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k}))
strict_mono_sets {..<Suc k} A
?i < Suc k \<Longrightarrow> finite (A ?i)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
have ls: "less_sets (\<Union> (A ` {..<k})) (A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (A ` {..<k}) \<lless> A k
[PROOF STEP]
using sm Suc.prems(1) strict_mono_setsD
[PROOF STATE]
proof (prove)
using this:
strict_mono_sets {..<k} A
strict_mono_sets {..<Suc k} A
\<lbrakk>strict_mono_sets ?A ?f; ?x < ?y; ?x \<in> ?A; ?y \<in> ?A\<rbrakk> \<Longrightarrow> ?f ?x \<lless> ?f ?y

goal (1 subgoal):
 1. \<Union> (A ` {..<k}) \<lless> A k
[PROOF STEP]
by (force simp: less_sets_UN1)
[PROOF STATE]
proof (state)
this:
\<Union> (A ` {..<k}) \<lless> A k

goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
have "sorted_list_of_set (\<Union> (A ` {..<Suc k})) = sorted_list_of_set (\<Union> (A ` {..<k}) \<union> A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set (\<Union> (A ` {..<Suc k})) = sorted_list_of_set (\<Union> (A ` {..<k}) \<union> A k)
[PROOF STEP]
by (simp add: Un_commute lessThan_Suc)
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (\<Union> (A ` {..<Suc k})) = sorted_list_of_set (\<Union> (A ` {..<k}) \<union> A k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (\<Union> (A ` {..<Suc k})) = sorted_list_of_set (\<Union> (A ` {..<k}) \<union> A k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
have "\<dots> = sorted_list_of_set (\<Union> (A ` {..<k})) @ sorted_list_of_set (A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set (\<Union> (A ` {..<k}) \<union> A k) = sorted_list_of_set (\<Union> (A ` {..<k})) @ sorted_list_of_set (A k)
[PROOF STEP]
by (rule sorted_list_of_set_Un) (auto simp: Suc.prems ls)
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (\<Union> (A ` {..<k}) \<union> A k) = sorted_list_of_set (\<Union> (A ` {..<k})) @ sorted_list_of_set (A k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (\<Union> (A ` {..<k}) \<union> A k) = sorted_list_of_set (\<Union> (A ` {..<k})) @ sorted_list_of_set (A k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
have "\<dots> = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})) @ sorted_list_of_set (A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set (\<Union> (A ` {..<k})) @ sorted_list_of_set (A k) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})) @ sorted_list_of_set (A k)
[PROOF STEP]
using Suc strict_mono_sets_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k}))
strict_mono_sets {..<Suc k} A
?i < Suc k \<Longrightarrow> finite (A ?i)
strict_mono_sets ?A ?f \<equiv> \<forall>x\<in>?A. \<forall>y\<in>?A. x < y \<longrightarrow> ?f x \<lless> ?f y

goal (1 subgoal):
 1. sorted_list_of_set (\<Union> (A ` {..<k})) @ sorted_list_of_set (A k) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})) @ sorted_list_of_set (A k)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (\<Union> (A ` {..<k})) @ sorted_list_of_set (A k) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})) @ sorted_list_of_set (A k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (\<Union> (A ` {..<k})) @ sorted_list_of_set (A k) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})) @ sorted_list_of_set (A k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
have "\<dots> = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})) @ sorted_list_of_set (A k) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
using strict_mono_sets_def
[PROOF STATE]
proof (prove)
using this:
strict_mono_sets ?A ?f \<equiv> \<forall>x\<in>?A. \<forall>y\<in>?A. x < y \<longrightarrow> ?f x \<lless> ?f y

goal (1 subgoal):
 1. concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})) @ sorted_list_of_set (A k) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})) @ sorted_list_of_set (A k) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<lbrakk>strict_mono_sets {..<k} A; \<And>i. i < k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<k})); strict_mono_sets {..<Suc k} A; \<And>i. i < Suc k \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))

goal (1 subgoal):
 1. sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (\<Union> (A ` {..<Suc k})) = concat (map (sorted_list_of_set \<circ> A) (sorted_list_of_set {..<Suc k}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_diff: "f integrable_on S \<Longrightarrow> g integrable_on S \<Longrightarrow>
    integral S (\<lambda>x. f x - g x) = integral S f - integral S g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f integrable_on S; g integrable_on S\<rbrakk> \<Longrightarrow> integral S (\<lambda>x. f x - g x) = integral S f - integral S g
[PROOF STEP]
by (rule integral_unique) (metis integrable_integral has_integral_diff)