[STATEMENT]
lemma finite_nonempty_carrier_has_minimum:
  assumes "carrier \<noteq> {}"
  shows "\<exists>e \<in> carrier. \<forall>m \<in> carrier. m \<succeq>[relation] e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>e\<in>carrier. \<forall>m\<in>carrier. m \<succeq> e
[PROOF STEP]
using finite_nempty_preorder_has_min[of carrier relation] assms
     \<open>finite carrier\<close> reflexivity total transitivity
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite carrier; carrier \<noteq> {}; refl_on carrier relation; trans relation; total_on carrier relation\<rbrakk> \<Longrightarrow> \<exists>x\<in>carrier. \<forall>y\<in>carrier. y \<succeq> x
carrier \<noteq> {}
finite carrier
refl_on carrier relation
total_on carrier relation
trans relation

goal (1 subgoal):
 1. \<exists>e\<in>carrier. \<forall>m\<in>carrier. m \<succeq> e
[PROOF STEP]
by blast


[STATEMENT]
lemma inj_on_mult:
  assumes coprime: "coprime x (q::nat)"
  shows "inj_on (\<lambda> b. x*b mod q) {..<q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>b. x * b mod q) {..<q}
[PROOF STEP]
apply(auto simp add: inj_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa y. \<lbrakk>xa < q; y < q; x * xa mod q = x * y mod q\<rbrakk> \<Longrightarrow> xa = y
[PROOF STEP]
using coprime
[PROOF STATE]
proof (prove)
using this:
coprime x q

goal (1 subgoal):
 1. \<And>xa y. \<lbrakk>xa < q; y < q; x * xa mod q = x * y mod q\<rbrakk> \<Longrightarrow> xa = y
[PROOF STEP]
by(simp only: mult_inj_eq)


[STATEMENT]
lemma permutation_mat_id_2: assumes p: "p permutes {..<n}"
  shows "permutation_mat n (inv p) * permutation_mat n p = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_mat n (inv p) * permutation_mat n p = 1\<^sub>m n
[PROOF STEP]
by (subst permutation_mat_right[OF _ p, of _ n], force, unfold permutation_mat_def, rule eq_matI,
   insert p, auto simp: permutes_lt[OF p] permutes_inverses)


[STATEMENT]
lemma one_add_floor: "\<lfloor>x\<rfloor> + 1 = \<lfloor>x + 1\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>x\<rfloor> + 1 = \<lfloor>x + (1::'a)\<rfloor>
[PROOF STEP]
using floor_add_int [of x 1]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>x\<rfloor> + 1 = \<lfloor>x + of_int 1\<rfloor>

goal (1 subgoal):
 1. \<lfloor>x\<rfloor> + 1 = \<lfloor>x + (1::'a)\<rfloor>
[PROOF STEP]
by simp


[STATEMENT]
lemma cindex_poly_smult_1:
  fixes p q::"real poly" and c::real
  shows "cindex_poly a b (smult c q) p =  (sign c) * cindex_poly a b q p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_poly a b (smult c q) p = sign c * cindex_poly a b q p
[PROOF STEP]
unfolding cindex_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < b. jump_poly (smult c q) p x) = sign c * (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < b. jump_poly q p x)
[PROOF STEP]
using sum_distrib_left[THEN sym, of "sign c" "\<lambda>x. jump_poly q p x"
    "{x. poly p x = (0::real) \<and> a < x \<and> x < b}"] jump_poly_smult_1
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n\<in>{x. poly p x = 0 \<and> a < x \<and> x < b}. sign c * jump_poly q p n) = sign c * (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < b. jump_poly q p x)
jump_poly (smult ?c ?q) ?p ?x = sign ?c * jump_poly ?q ?p ?x

goal (1 subgoal):
 1. (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < b. jump_poly (smult c q) p x) = sign c * (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < b. jump_poly q p x)
[PROOF STEP]
by auto


[STATEMENT]
lemma dist_stereographic_infinite:
  assumes "stereographic M1 = \<infinity>\<^sub>h" and "stereographic M2 = of_complex m2"
  shows "dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
have *: "M1 = inv_stereographic \<infinity>\<^sub>h"  "M2 = inv_stereographic (of_complex m2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M1 = inv_stereographic \<infinity>\<^sub>h &&& M2 = inv_stereographic (of_complex m2)
[PROOF STEP]
using inv_stereographic_is_inv assms
[PROOF STATE]
proof (prove)
using this:
inv_stereographic = inv stereographic
stereographic M1 = \<infinity>\<^sub>h
stereographic M2 = of_complex m2

goal (1 subgoal):
 1. M1 = inv_stereographic \<infinity>\<^sub>h &&& M2 = inv_stereographic (of_complex m2)
[PROOF STEP]
by (metis inv_stereographic_stereographic)+
[PROOF STATE]
proof (state)
this:
M1 = inv_stereographic \<infinity>\<^sub>h
M2 = inv_stereographic (of_complex m2)

goal (1 subgoal):
 1. dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
have "(1 + (cmod m2)\<^sup>2) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + (cmod m2)\<^sup>2 \<noteq> 0
[PROOF STEP]
by (smt power2_less_0)
[PROOF STATE]
proof (state)
this:
1 + (cmod m2)\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
have "(1 + (cmod m2)\<^sup>2) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 + (cmod m2)\<^sup>2
[PROOF STEP]
by (smt realpow_square_minus_le)+
[PROOF STATE]
proof (state)
this:
0 < 1 + (cmod m2)\<^sup>2

goal (1 subgoal):
 1. dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
hence "sqrt (1 + cmod m2 * cmod m2) > 0"
[PROOF STATE]
proof (prove)
using this:
0 < 1 + (cmod m2)\<^sup>2

goal (1 subgoal):
 1. 0 < sqrt (1 + cmod m2 * cmod m2)
[PROOF STEP]
using real_sqrt_gt_0_iff
[PROOF STATE]
proof (prove)
using this:
0 < 1 + (cmod m2)\<^sup>2
(0 < sqrt ?y) = (0 < ?y)

goal (1 subgoal):
 1. 0 < sqrt (1 + cmod m2 * cmod m2)
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
0 < sqrt (1 + cmod m2 * cmod m2)

goal (1 subgoal):
 1. dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
hence **: "2 / sqrt (1 + cmod m2 * cmod m2) > 0"
[PROOF STATE]
proof (prove)
using this:
0 < sqrt (1 + cmod m2 * cmod m2)

goal (1 subgoal):
 1. 0 < 2 / sqrt (1 + cmod m2 * cmod m2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < 2 / sqrt (1 + cmod m2 * cmod m2)

goal (1 subgoal):
 1. dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
have "(dist_riemann_sphere' M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist_riemann_sphere' M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
M1 = inv_stereographic \<infinity>\<^sub>h
M2 = inv_stereographic (of_complex m2)

goal (1 subgoal):
 1. (dist_riemann_sphere' M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>M1 M2 m2. \<lbrakk>M1 \<in> unit_sphere; M1 = inv_stereographic_hcoords_r3 \<infinity>\<^sub>h\<^sub>c; M2 \<in> unit_sphere; M2 = inv_stereographic_hcoords_r3 (of_complex_hcoords m2)\<rbrakk> \<Longrightarrow> (dist_riemann_sphere_r3 M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>M1 M2 m2. \<lbrakk>M1 \<in> unit_sphere; M1 = inv_stereographic_cvec_r3 \<infinity>\<^sub>v; M2 \<in> unit_sphere; M2 = inv_stereographic_cvec_r3 (of_complex_cvec m2)\<rbrakk> \<Longrightarrow> (dist_riemann_sphere_r3 M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>M1 M2 m2. \<lbrakk>M1 \<in> unit_sphere; M1 = inv_stereographic_cvec_r3 \<infinity>\<^sub>v; M2 \<in> unit_sphere; M2 = inv_stereographic_cvec_r3 (of_complex_cvec m2)\<rbrakk> \<Longrightarrow> (dist_riemann_sphere_r3 M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4
[PROOF STEP]
fix M1 M2 m2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>M1 M2 m2. \<lbrakk>M1 \<in> unit_sphere; M1 = inv_stereographic_cvec_r3 \<infinity>\<^sub>v; M2 \<in> unit_sphere; M2 = inv_stereographic_cvec_r3 (of_complex_cvec m2)\<rbrakk> \<Longrightarrow> (dist_riemann_sphere_r3 M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4
[PROOF STEP]
assume us: "M1 \<in> unit_sphere" "M2 \<in> unit_sphere" and
           *: "M1 = inv_stereographic_cvec_r3 \<infinity>\<^sub>v" "M2 = inv_stereographic_cvec_r3 (of_complex_cvec m2)"
[PROOF STATE]
proof (state)
this:
M1 \<in> unit_sphere
M2 \<in> unit_sphere
M1 = inv_stereographic_cvec_r3 \<infinity>\<^sub>v
M2 = inv_stereographic_cvec_r3 (of_complex_cvec m2)

goal (1 subgoal):
 1. \<And>M1 M2 m2. \<lbrakk>M1 \<in> unit_sphere; M1 = inv_stereographic_cvec_r3 \<infinity>\<^sub>v; M2 \<in> unit_sphere; M2 = inv_stereographic_cvec_r3 (of_complex_cvec m2)\<rbrakk> \<Longrightarrow> (dist_riemann_sphere_r3 M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4
[PROOF STEP]
have "(1 + (cmod m2)\<^sup>2) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + (cmod m2)\<^sup>2 \<noteq> 0
[PROOF STEP]
by (smt power2_less_0)
[PROOF STATE]
proof (state)
this:
1 + (cmod m2)\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. \<And>M1 M2 m2. \<lbrakk>M1 \<in> unit_sphere; M1 = inv_stereographic_cvec_r3 \<infinity>\<^sub>v; M2 \<in> unit_sphere; M2 = inv_stereographic_cvec_r3 (of_complex_cvec m2)\<rbrakk> \<Longrightarrow> (dist_riemann_sphere_r3 M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4
[PROOF STEP]
thus "(dist_riemann_sphere_r3 M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4"
[PROOF STATE]
proof (prove)
using this:
1 + (cmod m2)\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. (dist_riemann_sphere_r3 M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4
[PROOF STEP]
apply (subst dist_riemann_sphere_r3_inner[OF us])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + (cmod m2)\<^sup>2 \<noteq> 0 \<Longrightarrow> (2 - 2 * inner M1 M2) * (1 + (cmod m2)\<^sup>2) = 4
[PROOF STEP]
apply (subst *)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + (cmod m2)\<^sup>2 \<noteq> 0 \<Longrightarrow> (2 - 2 * inner (inv_stereographic_cvec_r3 \<infinity>\<^sub>v) (inv_stereographic_cvec_r3 (of_complex_cvec m2))) * (1 + (cmod m2)\<^sup>2) = 4
[PROOF STEP]
apply (simp add: complex_mult_cnj_cmod)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + (cmod m2)\<^sup>2 \<noteq> 0 \<Longrightarrow> (2 - (2 * (cmod m2)\<^sup>2 - 2) / (1 + (cmod m2)\<^sup>2)) * (1 + (cmod m2)\<^sup>2) = 4
[PROOF STEP]
apply (subst left_diff_distrib[of 2], simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(dist_riemann_sphere_r3 M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(dist_riemann_sphere' M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4

goal (1 subgoal):
 1. dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
hence "(dist_riemann_sphere' M1 M2)\<^sup>2 = 4 / (1 + (cmod m2)\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
(dist_riemann_sphere' M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4

goal (1 subgoal):
 1. (dist_riemann_sphere' M1 M2)\<^sup>2 = 4 / (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
using \<open>(1 + (cmod m2)\<^sup>2) \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
(dist_riemann_sphere' M1 M2)\<^sup>2 * (1 + (cmod m2)\<^sup>2) = 4
1 + (cmod m2)\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. (dist_riemann_sphere' M1 M2)\<^sup>2 = 4 / (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(dist_riemann_sphere' M1 M2)\<^sup>2 = 4 / (1 + (cmod m2)\<^sup>2)

goal (1 subgoal):
 1. dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
thus "dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
(dist_riemann_sphere' M1 M2)\<^sup>2 = 4 / (1 + (cmod m2)\<^sup>2)

goal (1 subgoal):
 1. dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
using power2_eq_iff[of "dist_riemann_sphere' M1 M2" "2 / sqrt (1 + (cmod m2)\<^sup>2)"]
[PROOF STATE]
proof (prove)
using this:
(dist_riemann_sphere' M1 M2)\<^sup>2 = 4 / (1 + (cmod m2)\<^sup>2)
((dist_riemann_sphere' M1 M2)\<^sup>2 = (2 / sqrt (1 + (cmod m2)\<^sup>2))\<^sup>2) = (dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2) \<or> dist_riemann_sphere' M1 M2 = - (2 / sqrt (1 + (cmod m2)\<^sup>2)))

goal (1 subgoal):
 1. dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
using \<open>(1 + (cmod m2)\<^sup>2) > 0\<close>
[PROOF STATE]
proof (prove)
using this:
(dist_riemann_sphere' M1 M2)\<^sup>2 = 4 / (1 + (cmod m2)\<^sup>2)
((dist_riemann_sphere' M1 M2)\<^sup>2 = (2 / sqrt (1 + (cmod m2)\<^sup>2))\<^sup>2) = (dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2) \<or> dist_riemann_sphere' M1 M2 = - (2 / sqrt (1 + (cmod m2)\<^sup>2)))
0 < 1 + (cmod m2)\<^sup>2

goal (1 subgoal):
 1. dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)
[PROOF STEP]
apply (auto simp add: power2_eq_square real_sqrt_mult[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < 1 + cmod m2 * cmod m2; dist_riemann_sphere' M1 M2 = - (2 / sqrt (1 + cmod m2 * cmod m2))\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using dist_riemann_sphere_ge_0[of M1 M2] **
[PROOF STATE]
proof (prove)
using this:
0 \<le> dist_riemann_sphere' M1 M2
0 < 2 / sqrt (1 + cmod m2 * cmod m2)

goal (1 subgoal):
 1. \<lbrakk>0 < 1 + cmod m2 * cmod m2; dist_riemann_sphere' M1 M2 = - (2 / sqrt (1 + cmod m2 * cmod m2))\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dist_riemann_sphere' M1 M2 = 2 / sqrt (1 + (cmod m2)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linear_continuous_compose:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" and g :: "'b \<Rightarrow> 'c::real_normed_vector"
  assumes "continuous F f" "linear g"
  shows "continuous F (\<lambda>x. g(f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F (\<lambda>x. g (f x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous F f
linear g

goal (1 subgoal):
 1. continuous F (\<lambda>x. g (f x))
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F
linear g

goal (1 subgoal):
 1. ((\<lambda>x. g (f x)) \<longlongrightarrow> g (f (Lim F (\<lambda>x. x)))) F
[PROOF STEP]
by (rule Lim_linear)


[STATEMENT]
lemma independent_card_le_dim: assumes "B \<subseteq> V" and "independent B" shows "card B \<le> dim V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card B \<le> dim V
[PROOF STEP]
by (subst dim_eq_card[symmetric, OF refl \<open>independent B\<close>]) (rule dim_subset[OF \<open>B \<subseteq> V\<close>])


[STATEMENT]
lemma square_integrable_imp_integrable_product:
  assumes "f square_integrable S" "g square_integrable S"
  shows  "integrable (lebesgue_on S) (\<lambda>x. f x * g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on S) (\<lambda>x. f x * g x)
[PROOF STEP]
using absolutely_integrable_measurable assms integrable_abs_iff
[PROOF STATE]
proof (prove)
using this:
?S \<in> sets lebesgue \<Longrightarrow> (?f absolutely_integrable_on ?S) = (?f \<in> borel_measurable (lebesgue_on ?S) \<and> integrable (lebesgue_on ?S) (norm \<circ> ?f))
f square_integrable S
g square_integrable S
?f \<in> borel_measurable ?M \<Longrightarrow> integrable ?M (\<lambda>x. \<bar>?f x\<bar>) = integrable ?M ?f

goal (1 subgoal):
 1. integrable (lebesgue_on S) (\<lambda>x. f x * g x)
[PROOF STEP]
by (metis (full_types) absolutely_integrable_measurable_real square_integrable_def square_integrable_imp_absolutely_integrable_product)


[STATEMENT]
lemma subgroup_Int:
  assumes "subgroup I G" "subgroup J G"
  shows "subgroup (I \<inter> J) G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup (I \<inter> J) G
[PROOF STEP]
using subgroup_Inter[ where ?A = "{I,J}"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>H. H \<in> {I, J} \<Longrightarrow> subgroup H ?G; {I, J} \<noteq> {}\<rbrakk> \<Longrightarrow> subgroup (\<Inter> {I, J}) ?G
subgroup I G
subgroup J G

goal (1 subgoal):
 1. subgroup (I \<inter> J) G
[PROOF STEP]
by auto


[STATEMENT]
theorem mset_quicksort [simp]: "mset (quicksort R xs) = mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (quicksort R xs) = mset xs
[PROOF STEP]
by (induction R xs rule: quicksort.induct) (simp_all)


[STATEMENT]
lemma mtx_times_scaleR_commute: "A * (c *\<^sub>R B) = c *\<^sub>R (A * B)" for A::"('n::finite) sq_mtx"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * c *\<^sub>R B = c *\<^sub>R (A * B)
[PROOF STEP]
unfolding sq_mtx_scaleR_eq sq_mtx_times_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_mtx (\<chi>i j. \<Sum>k\<in>UNIV. A $$ i $ k * to_mtx (\<chi>i j. c *\<^sub>R B $$ i $ j) $$ k $ j) = to_mtx (\<chi>i j. c *\<^sub>R to_mtx (\<chi>i j. \<Sum>k\<in>UNIV. A $$ i $ k * B $$ k $ j) $$ i $ j)
[PROOF STEP]
apply(simp add: to_mtx_inject)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. \<chi>j. \<Sum>k\<in>UNIV. A $$ i $ k * (c * B $$ k $ j)) = (\<lambda>i. \<chi>j. c * (\<Sum>k\<in>UNIV. A $$ i $ k * B $$ k $ j))
[PROOF STEP]
apply(simp add: vec_eq_iff fun_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x i. (\<Sum>k\<in>UNIV. A $$ x $ k * (c * B $$ k $ i)) = c * (\<Sum>k\<in>UNIV. A $$ x $ k * B $$ k $ i)
[PROOF STEP]
by (simp add: semiring_normalization_rules(19) vector_space_over_itself.scale_sum_right)


[STATEMENT]
lemma comp_assoc:"\<lbrakk>f \<in> A \<rightarrow> B; g \<in> B \<rightarrow> C; h \<in> C \<rightarrow> D \<rbrakk> \<Longrightarrow>
     compose A h (compose A g f) = compose A (compose B h g) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; g \<in> B \<rightarrow> C; h \<in> C \<rightarrow> D\<rbrakk> \<Longrightarrow> compose A h (compose A g f) = compose A (compose B h g) f
[PROOF STEP]
apply (rule funcset_eq[of _ "A"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>f \<in> A \<rightarrow> B; g \<in> B \<rightarrow> C; h \<in> C \<rightarrow> D\<rbrakk> \<Longrightarrow> compose A h (compose A g f) \<in> extensional A
 2. \<lbrakk>f \<in> A \<rightarrow> B; g \<in> B \<rightarrow> C; h \<in> C \<rightarrow> D\<rbrakk> \<Longrightarrow> compose A (compose B h g) f \<in> extensional A
 3. \<lbrakk>f \<in> A \<rightarrow> B; g \<in> B \<rightarrow> C; h \<in> C \<rightarrow> D\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. compose A h (compose A g f) x = compose A (compose B h g) f x
[PROOF STEP]
apply (simp add:compose_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>f \<in> A \<rightarrow> B; g \<in> B \<rightarrow> C; h \<in> C \<rightarrow> D\<rbrakk> \<Longrightarrow> compose A (compose B h g) f \<in> extensional A
 2. \<lbrakk>f \<in> A \<rightarrow> B; g \<in> B \<rightarrow> C; h \<in> C \<rightarrow> D\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. compose A h (compose A g f) x = compose A (compose B h g) f x
[PROOF STEP]
apply (simp add:compose_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; g \<in> B \<rightarrow> C; h \<in> C \<rightarrow> D\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. compose A h (compose A g f) x = compose A (compose B h g) f x
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>f \<in> A \<rightarrow> B; g \<in> B \<rightarrow> C; h \<in> C \<rightarrow> D; x \<in> A\<rbrakk> \<Longrightarrow> compose A h (compose A g f) x = compose A (compose B h g) f x
[PROOF STEP]
apply (simp add:funcset_mem[of "f" "A" "B"] compose_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sum_list_mono:
  fixes xs ys::"'a::ordered_ab_group_add list"
  shows
    "length xs = length ys \<Longrightarrow> (\<And>x y. (x, y) \<in> set (zip xs ys) \<Longrightarrow> x \<le> y) \<Longrightarrow>
      sum_list xs \<le> sum_list ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = length ys; \<And>x y. (x, y) \<in> set (zip xs ys) \<Longrightarrow> x \<le> y\<rbrakk> \<Longrightarrow> sum_list xs \<le> sum_list ys
[PROOF STEP]
by (induct xs ys rule: list_induct2) (auto simp: algebra_simps intro: add_mono)


[STATEMENT]
lemma gbinomial_r_part_sum: "(\<Sum>k\<le>m. (2 * (of_nat m) + 1 gchoose k)) = 2 ^ (2 * m)"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((gchoose) ((2::'a) * of_nat m + (1::'a))) {..m} = (2::'a) ^ (2 * m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum ((gchoose) ((2::'a) * of_nat m + (1::'a))) {..m} = (2::'a) ^ (2 * m)
[PROOF STEP]
have "?lhs = of_nat (\<Sum>k\<le>m. (2 * m + 1) choose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((gchoose) ((2::'a) * of_nat m + (1::'a))) {..m} = of_nat (sum ((choose) (2 * m + 1)) {..m})
[PROOF STEP]
by (simp add: binomial_gbinomial add_ac)
[PROOF STATE]
proof (state)
this:
sum ((gchoose) ((2::'a) * of_nat m + (1::'a))) {..m} = of_nat (sum ((choose) (2 * m + 1)) {..m})

goal (1 subgoal):
 1. sum ((gchoose) ((2::'a) * of_nat m + (1::'a))) {..m} = (2::'a) ^ (2 * m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((gchoose) ((2::'a) * of_nat m + (1::'a))) {..m} = of_nat (sum ((choose) (2 * m + 1)) {..m})

goal (1 subgoal):
 1. sum ((gchoose) ((2::'a) * of_nat m + (1::'a))) {..m} = (2::'a) ^ (2 * m)
[PROOF STEP]
have "\<dots> = of_nat (2 ^ (2 * m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (sum ((choose) (2 * m + 1)) {..m}) = of_nat (2 ^ (2 * m))
[PROOF STEP]
by (subst binomial_r_part_sum) (rule refl)
[PROOF STATE]
proof (state)
this:
of_nat (sum ((choose) (2 * m + 1)) {..m}) = of_nat (2 ^ (2 * m))

goal (1 subgoal):
 1. sum ((gchoose) ((2::'a) * of_nat m + (1::'a))) {..m} = (2::'a) ^ (2 * m)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum ((gchoose) ((2::'a) * of_nat m + (1::'a))) {..m} = of_nat (2 ^ (2 * m))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum ((gchoose) ((2::'a) * of_nat m + (1::'a))) {..m} = of_nat (2 ^ (2 * m))

goal (1 subgoal):
 1. sum ((gchoose) ((2::'a) * of_nat m + (1::'a))) {..m} = (2::'a) ^ (2 * m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum ((gchoose) ((2::'a) * of_nat m + (1::'a))) {..m} = (2::'a) ^ (2 * m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arsinh_real_has_field_derivative [derivative_intros]:
  fixes x :: real
  shows "(arsinh has_field_derivative (1 / (sqrt (x ^ 2 + 1)))) (at x within A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (arsinh has_real_derivative 1 / sqrt (x\<^sup>2 + 1)) (at x within A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (arsinh has_real_derivative 1 / sqrt (x\<^sup>2 + 1)) (at x within A)
[PROOF STEP]
have pos: "1 + x ^ 2 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 + x\<^sup>2
[PROOF STEP]
by (intro add_pos_nonneg) auto
[PROOF STATE]
proof (state)
this:
0 < 1 + x\<^sup>2

goal (1 subgoal):
 1. (arsinh has_real_derivative 1 / sqrt (x\<^sup>2 + 1)) (at x within A)
[PROOF STEP]
from pos arsinh_real_aux[of x]
[PROOF STATE]
proof (chain)
picking this:
0 < 1 + x\<^sup>2
0 < x + sqrt (x\<^sup>2 + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < 1 + x\<^sup>2
0 < x + sqrt (x\<^sup>2 + 1)

goal (1 subgoal):
 1. (arsinh has_real_derivative 1 / sqrt (x\<^sup>2 + 1)) (at x within A)
[PROOF STEP]
unfolding arsinh_def [abs_def]
[PROOF STATE]
proof (prove)
using this:
0 < 1 + x\<^sup>2
0 < x + sqrt (x\<^sup>2 + 1)

goal (1 subgoal):
 1. ((\<lambda>x. ln (x + (x\<^sup>2 + 1) powr of_real (1 / 2))) has_real_derivative 1 / sqrt (x\<^sup>2 + 1)) (at x within A)
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: powr_minus powr_half_sqrt field_split_simps)
[PROOF STATE]
proof (state)
this:
(arsinh has_real_derivative 1 / sqrt (x\<^sup>2 + 1)) (at x within A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma chinese_remainder_nat:
  fixes m1 m2 :: nat
  assumes a: "coprime m1 m2"
  shows "\<exists>x. x mod m1 = u1 mod m1 \<and> x mod m2 = u2 mod m2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. x mod m1 = u1 mod m1 \<and> x mod m2 = u2 mod m2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. x mod m1 = u1 mod m1 \<and> x mod m2 = u2 mod m2
[PROOF STEP]
from chinese_remainder_aux_nat [OF a]
[PROOF STATE]
proof (chain)
picking this:
\<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2
[PROOF STEP]
obtain b1 b2 where "b1 mod m1 = 1 mod m1" and "b1 mod m2 = 0 mod m2" and
"b2 mod m1 = 0 mod m1" and "b2 mod m2 = 1 mod m2"
[PROOF STATE]
proof (prove)
using this:
\<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2

goal (1 subgoal):
 1. (\<And>b1 b2. \<lbrakk>b1 mod m1 = 1 mod m1; b1 mod m2 = 0 mod m2; b2 mod m1 = 0 mod m1; b2 mod m2 = 1 mod m2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
b1 mod m1 = 1 mod m1
b1 mod m2 = 0 mod m2
b2 mod m1 = 0 mod m1
b2 mod m2 = 1 mod m2

goal (1 subgoal):
 1. \<exists>x. x mod m1 = u1 mod m1 \<and> x mod m2 = u2 mod m2
[PROOF STEP]
let ?x = "u1*b1+u2*b2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. x mod m1 = u1 mod m1 \<and> x mod m2 = u2 mod m2
[PROOF STEP]
have "?x mod m1 = (u1*1+u2*0) mod m1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u1 * b1 + u2 * b2) mod m1 = (u1 * 1 + u2 * 0) mod m1
[PROOF STEP]
apply (rule mod_add_cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. u1 * b1 mod m1 = u1 * 1 mod m1
 2. u2 * b2 mod m1 = u2 * 0 mod m1
[PROOF STEP]
apply(rule cong_scalar2_nat)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. b1 mod m1 = 1 mod m1
 2. u2 * b2 mod m1 = u2 * 0 mod m1
[PROOF STEP]
apply (rule \<open>b1 mod m1 = 1 mod m1\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u2 * b2 mod m1 = u2 * 0 mod m1
[PROOF STEP]
apply(rule cong_scalar2_nat)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b2 mod m1 = 0 mod m1
[PROOF STEP]
apply (rule \<open>b2 mod m1 = 0 mod m1\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(u1 * b1 + u2 * b2) mod m1 = (u1 * 1 + u2 * 0) mod m1

goal (1 subgoal):
 1. \<exists>x. x mod m1 = u1 mod m1 \<and> x mod m2 = u2 mod m2
[PROOF STEP]
hence 1:"?x mod m1 = u1 mod m1"
[PROOF STATE]
proof (prove)
using this:
(u1 * b1 + u2 * b2) mod m1 = (u1 * 1 + u2 * 0) mod m1

goal (1 subgoal):
 1. (u1 * b1 + u2 * b2) mod m1 = u1 mod m1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(u1 * b1 + u2 * b2) mod m1 = u1 mod m1

goal (1 subgoal):
 1. \<exists>x. x mod m1 = u1 mod m1 \<and> x mod m2 = u2 mod m2
[PROOF STEP]
have "?x mod m2 = (u1*0+u2*1) mod m2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u1 * b1 + u2 * b2) mod m2 = (u1 * 0 + u2 * 1) mod m2
[PROOF STEP]
apply (rule mod_add_cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. u1 * b1 mod m2 = u1 * 0 mod m2
 2. u2 * b2 mod m2 = u2 * 1 mod m2
[PROOF STEP]
apply(rule cong_scalar2_nat)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. b1 mod m2 = 0 mod m2
 2. u2 * b2 mod m2 = u2 * 1 mod m2
[PROOF STEP]
apply (rule \<open>b1 mod m2 = 0 mod m2\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u2 * b2 mod m2 = u2 * 1 mod m2
[PROOF STEP]
apply(rule cong_scalar2_nat)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b2 mod m2 = 1 mod m2
[PROOF STEP]
apply (rule \<open>b2 mod m2 = 1 mod m2\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(u1 * b1 + u2 * b2) mod m2 = (u1 * 0 + u2 * 1) mod m2

goal (1 subgoal):
 1. \<exists>x. x mod m1 = u1 mod m1 \<and> x mod m2 = u2 mod m2
[PROOF STEP]
hence "?x mod m2 = u2 mod m2"
[PROOF STATE]
proof (prove)
using this:
(u1 * b1 + u2 * b2) mod m2 = (u1 * 0 + u2 * 1) mod m2

goal (1 subgoal):
 1. (u1 * b1 + u2 * b2) mod m2 = u2 mod m2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(u1 * b1 + u2 * b2) mod m2 = u2 mod m2

goal (1 subgoal):
 1. \<exists>x. x mod m1 = u1 mod m1 \<and> x mod m2 = u2 mod m2
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
(u1 * b1 + u2 * b2) mod m1 = u1 mod m1
(u1 * b1 + u2 * b2) mod m2 = u2 mod m2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(u1 * b1 + u2 * b2) mod m1 = u1 mod m1
(u1 * b1 + u2 * b2) mod m2 = u2 mod m2

goal (1 subgoal):
 1. \<exists>x. x mod m1 = u1 mod m1 \<and> x mod m2 = u2 mod m2
[PROOF STEP]
by  blast
[PROOF STATE]
proof (state)
this:
\<exists>x. x mod m1 = u1 mod m1 \<and> x mod m2 = u2 mod m2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma GDERIV_mult:
  "\<lbrakk>cGDERIV f x :> df; cGDERIV g x :> dg\<rbrakk>
     \<Longrightarrow> cGDERIV (\<lambda>x. f x * g x) x :> cnj (f x) *\<^sub>C dg + cnj (g x) *\<^sub>C df"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cGDERIV f x :> df; cGDERIV g x :> dg\<rbrakk> \<Longrightarrow> cGDERIV (\<lambda>x. f x * g x) x :> cnj (f x) *\<^sub>C dg + cnj (g x) *\<^sub>C df
[PROOF STEP]
unfolding cgderiv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_derivative cinner df) (at x); (g has_derivative cinner dg) (at x)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) has_derivative cinner (cnj (f x) *\<^sub>C dg + cnj (g x) *\<^sub>C df)) (at x)
[PROOF STEP]
apply (rule has_derivative_subst)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(f has_derivative cinner df) (at x); (g has_derivative cinner dg) (at x)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) has_derivative ?df) (at x)
 2. \<lbrakk>(f has_derivative cinner df) (at x); (g has_derivative cinner dg) (at x)\<rbrakk> \<Longrightarrow> ?df = cinner (cnj (f x) *\<^sub>C dg + cnj (g x) *\<^sub>C df)
[PROOF STEP]
apply (erule (1) has_derivative_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_derivative cinner df) (at x); (g has_derivative cinner dg) (at x)\<rbrakk> \<Longrightarrow> (\<lambda>h. f x * cinner dg h + cinner df h * g x) = cinner (cnj (f x) *\<^sub>C dg + cnj (g x) *\<^sub>C df)
[PROOF STEP]
apply (rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>h. \<lbrakk>(f has_derivative cinner df) (at x); (g has_derivative cinner dg) (at x)\<rbrakk> \<Longrightarrow> f x * cinner dg h + cinner df h * g x = cinner (cnj (f x) *\<^sub>C dg + cnj (g x) *\<^sub>C df) h
[PROOF STEP]
by (simp add: cinner_add ac_simps)


[STATEMENT]
lemma sqrt2_less_2: "sqrt 2 < (2::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt 2 < 2
[PROOF STEP]
by (metis not_less not_less_iff_gr_or_eq numeral_less_iff real_sqrt_four
      real_sqrt_le_iff semiring_norm(75) semiring_norm(78) semiring_norm(85))


[STATEMENT]
lemma Max_Int_le2: "\<lbrakk> (A \<inter> B) \<noteq> {}; finite B \<rbrakk> \<Longrightarrow> Max (A \<inter> B) \<le> Max B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<inter> B \<noteq> {}; finite B\<rbrakk> \<Longrightarrow> Max (A \<inter> B) \<le> Max B
[PROOF STEP]
by (rule Max_subset[OF _ Int_lower2])


[STATEMENT]
lemma aff_dim_convex_hull:
  fixes S :: "'n::euclidean_space set"
  shows "aff_dim (convex hull S) = aff_dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (convex hull S) = aff_dim S
[PROOF STEP]
using aff_dim_affine_hull[of S] convex_hull_subset_affine_hull[of S]
    hull_subset[of S "convex"] aff_dim_subset[of S "convex hull S"]
    aff_dim_subset[of "convex hull S" "affine hull S"]
[PROOF STATE]
proof (prove)
using this:
aff_dim (affine hull S) = aff_dim S
convex hull S \<subseteq> affine hull S
S \<subseteq> convex hull S
S \<subseteq> convex hull S \<Longrightarrow> aff_dim S \<le> aff_dim (convex hull S)
convex hull S \<subseteq> affine hull S \<Longrightarrow> aff_dim (convex hull S) \<le> aff_dim (affine hull S)

goal (1 subgoal):
 1. aff_dim (convex hull S) = aff_dim S
[PROOF STEP]
by auto


[STATEMENT]
lemma complex_mod_mult_cnj: "cmod (z * cnj z) = (cmod z)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (z * cnj z) = (cmod z)\<^sup>2
[PROOF STEP]
by (simp add: norm_mult power2_eq_square)


[STATEMENT]
lemma inversion_id_iff:
  shows "a = inversion a \<longleftrightarrow> a \<noteq> \<infinity>\<^sub>h \<and> (to_complex a) * cnj (to_complex a) = 1" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a = inversion a) = (a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = inversion a \<Longrightarrow> a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1
 2. a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1 \<Longrightarrow> a = inversion a
[PROOF STEP]
assume "a = inversion a"
[PROOF STATE]
proof (state)
this:
a = inversion a

goal (2 subgoals):
 1. a = inversion a \<Longrightarrow> a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1
 2. a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1 \<Longrightarrow> a = inversion a
[PROOF STEP]
thus ?rhs
[PROOF STATE]
proof (prove)
using this:
a = inversion a

goal (1 subgoal):
 1. a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1
[PROOF STEP]
unfolding inversion_def
[PROOF STATE]
proof (prove)
using this:
a = (conjugate \<circ> reciprocal) a

goal (1 subgoal):
 1. a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1
[PROOF STEP]
using inf_or_of_complex[of a]
[PROOF STATE]
proof (prove)
using this:
a = (conjugate \<circ> reciprocal) a
a = \<infinity>\<^sub>h \<or> (\<exists>x. a = of_complex x)

goal (1 subgoal):
 1. a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1
[PROOF STEP]
by (metis (full_types) comp_apply complex_cnj_cancel_iff complex_cnj_zero inversion_def inversion_infty inversion_of_complex inversion_sym nonzero_eq_divide_eq of_complex_zero reciprocal_zero to_complex_of_complex zero_one_infty_not_equal(5))
[PROOF STATE]
proof (state)
this:
a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1

goal (1 subgoal):
 1. a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1 \<Longrightarrow> a = inversion a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1 \<Longrightarrow> a = inversion a
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1

goal (1 subgoal):
 1. a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1 \<Longrightarrow> a = inversion a
[PROOF STEP]
thus ?lhs
[PROOF STATE]
proof (prove)
using this:
a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1

goal (1 subgoal):
 1. a = inversion a
[PROOF STEP]
using inf_or_of_complex[of a]
[PROOF STATE]
proof (prove)
using this:
a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1
a = \<infinity>\<^sub>h \<or> (\<exists>x. a = of_complex x)

goal (1 subgoal):
 1. a = inversion a
[PROOF STEP]
by (metis inversion_of_complex mult_not_zero nonzero_mult_div_cancel_right one_neq_zero to_complex_of_complex)
[PROOF STATE]
proof (state)
this:
a = inversion a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem join_commute: "x \<squnion> y = y \<squnion> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> y = y \<squnion> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<squnion> y = y \<squnion> x
[PROOF STEP]
have "dual (x \<squnion> y) = dual x \<sqinter> dual y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dual (x \<squnion> y) = dual x \<sqinter> dual y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
dual (x \<squnion> y) = dual x \<sqinter> dual y

goal (1 subgoal):
 1. x \<squnion> y = y \<squnion> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dual (x \<squnion> y) = dual x \<sqinter> dual y

goal (1 subgoal):
 1. x \<squnion> y = y \<squnion> x
[PROOF STEP]
have "\<dots> = dual y \<sqinter> dual x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dual x \<sqinter> dual y = dual y \<sqinter> dual x
[PROOF STEP]
by (rule meet_commute)
[PROOF STATE]
proof (state)
this:
dual x \<sqinter> dual y = dual y \<sqinter> dual x

goal (1 subgoal):
 1. x \<squnion> y = y \<squnion> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dual x \<sqinter> dual y = dual y \<sqinter> dual x

goal (1 subgoal):
 1. x \<squnion> y = y \<squnion> x
[PROOF STEP]
have "\<dots> = dual (y \<squnion> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dual y \<sqinter> dual x = dual (y \<squnion> x)
[PROOF STEP]
by (simp only: dual_join)
[PROOF STATE]
proof (state)
this:
dual y \<sqinter> dual x = dual (y \<squnion> x)

goal (1 subgoal):
 1. x \<squnion> y = y \<squnion> x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dual (x \<squnion> y) = dual (y \<squnion> x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dual (x \<squnion> y) = dual (y \<squnion> x)

goal (1 subgoal):
 1. x \<squnion> y = y \<squnion> x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x \<squnion> y = y \<squnion> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_on_path_cball:
  fixes g :: "real \<Rightarrow> 'a::heine_borel"
  assumes "path g"
    and "z \<notin> path_image g"
  shows "\<exists>e>0. cball z e \<inter> (path_image g) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>e>0. cball z e \<inter> path_image g = {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>e>0. cball z e \<inter> path_image g = {}
[PROOF STEP]
obtain e where "ball z e \<inter> path_image g = {}" "e > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>e. \<lbrakk>ball z e \<inter> path_image g = {}; 0 < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using not_on_path_ball[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>e>0. ball z e \<inter> path_image g = {}

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>ball z e \<inter> path_image g = {}; 0 < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ball z e \<inter> path_image g = {}
0 < e

goal (1 subgoal):
 1. \<exists>e>0. cball z e \<inter> path_image g = {}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ball z e \<inter> path_image g = {}
0 < e

goal (1 subgoal):
 1. \<exists>e>0. cball z e \<inter> path_image g = {}
[PROOF STEP]
have "cball z (e/2) \<subseteq> ball z e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cball z (e / 2) \<subseteq> ball z e
[PROOF STEP]
using \<open>e > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. cball z (e / 2) \<subseteq> ball z e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cball z (e / 2) \<subseteq> ball z e

goal (1 subgoal):
 1. \<exists>e>0. cball z e \<inter> path_image g = {}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ball z e \<inter> path_image g = {}
0 < e
cball z (e / 2) \<subseteq> ball z e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ball z e \<inter> path_image g = {}
0 < e
cball z (e / 2) \<subseteq> ball z e

goal (1 subgoal):
 1. \<exists>e>0. cball z e \<inter> path_image g = {}
[PROOF STEP]
by (rule_tac x="e/2" in exI) auto
[PROOF STATE]
proof (state)
this:
\<exists>e>0. cball z e \<inter> path_image g = {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma choose_two: "n choose 2 = n * (n - 1) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose 2 = n * (n - 1) div 2
[PROOF STEP]
proof (cases "n \<ge> 2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
 2. \<not> 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 2 \<le> n

goal (2 subgoals):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
 2. \<not> 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> 2 \<le> n
[PROOF STEP]
have "n = 0 \<or> n = 1"
[PROOF STATE]
proof (prove)
using this:
\<not> 2 \<le> n

goal (1 subgoal):
 1. n = 0 \<or> n = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n = 0 \<or> n = 1

goal (2 subgoals):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
 2. \<not> 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 0 \<or> n = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0 \<or> n = 1

goal (1 subgoal):
 1. n choose 2 = n * (n - 1) div 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n choose 2 = n * (n - 1) div 2

goal (1 subgoal):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
2 \<le> n

goal (1 subgoal):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
define m where "m = n - 2"
[PROOF STATE]
proof (state)
this:
m = n - 2

goal (1 subgoal):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
2 \<le> n
m = n - 2
[PROOF STEP]
have "n = m + 2"
[PROOF STATE]
proof (prove)
using this:
2 \<le> n
m = n - 2

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

goal (1 subgoal):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = m + 2
[PROOF STEP]
have "fact n = n * (n - 1) * fact (n - 2)"
[PROOF STATE]
proof (prove)
using this:
n = m + 2

goal (1 subgoal):
 1. fact n = n * (n - 1) * fact (n - 2)
[PROOF STEP]
by (simp add: fact_prod_Suc atLeast0_lessThan_Suc algebra_simps)
[PROOF STATE]
proof (state)
this:
fact n = n * (n - 1) * fact (n - 2)

goal (1 subgoal):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
2 \<le> n
fact n = n * (n - 1) * fact (n - 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 \<le> n
fact n = n * (n - 1) * fact (n - 2)

goal (1 subgoal):
 1. n choose 2 = n * (n - 1) div 2
[PROOF STEP]
by (simp add: binomial_fact')
[PROOF STATE]
proof (state)
this:
n choose 2 = n * (n - 1) div 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powreal_IVT_lower_lemma:
  assumes "a > (1::real)"
  and "x > 0"
  shows "\<exists>n::nat. x < a pow\<^sub>\<real> (real n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. x < a pow\<^sub>\<real> real n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>n. x < a pow\<^sub>\<real> real n
[PROOF STEP]
have invx0: "0 < inverse x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < inverse x
[PROOF STEP]
by (simp add: assms(2))
[PROOF STATE]
proof (state)
this:
0 < inverse x

goal (1 subgoal):
 1. \<exists>n. x < a pow\<^sub>\<real> real n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < inverse x
[PROOF STEP]
have "\<exists>n. a pow\<^sub>\<real> - real n < inverse x"
[PROOF STATE]
proof (prove)
using this:
0 < inverse x

goal (1 subgoal):
 1. \<exists>n. a pow\<^sub>\<real> - real n < inverse x
[PROOF STEP]
using assms(1) powreal_IVT_upper_lemma
[PROOF STATE]
proof (prove)
using this:
0 < inverse x
1 < a
\<lbrakk>1 < ?a; 0 < ?x\<rbrakk> \<Longrightarrow> \<exists>n. ?a pow\<^sub>\<real> - real n < ?x

goal (1 subgoal):
 1. \<exists>n. a pow\<^sub>\<real> - real n < inverse x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>n. a pow\<^sub>\<real> - real n < inverse x

goal (1 subgoal):
 1. \<exists>n. x < a pow\<^sub>\<real> real n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>n. a pow\<^sub>\<real> - real n < inverse x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>n. a pow\<^sub>\<real> - real n < inverse x

goal (1 subgoal):
 1. \<exists>n. x < a pow\<^sub>\<real> real n
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<exists>n. a pow\<^sub>\<real> - real n < inverse x
1 < a

goal (1 subgoal):
 1. \<exists>n. x < a pow\<^sub>\<real> real n
[PROOF STEP]
by (auto dest: inverse_less_imp_less
         simp add: powreal_minus powreal_gt_zero )
[PROOF STATE]
proof (state)
this:
\<exists>n. x < a pow\<^sub>\<real> real n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cpx_vec_length_square:
  shows "\<parallel>v\<parallel>\<^sup>2 = (\<Sum>i = 0..<dim_vec v. (cmod (Matrix.vec_index v i))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>v\<parallel>\<^sup>2 = (\<Sum>i = 0..<dim_vec v. (cmod (v $ i))\<^sup>2)
[PROOF STEP]
unfolding cpx_vec_length_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sqrt (\<Sum>i<dim_vec v. (cmod (v $ i))\<^sup>2))\<^sup>2 = (\<Sum>i = 0..<dim_vec v. (cmod (v $ i))\<^sup>2)
[PROOF STEP]
by (simp add: lessThan_atLeast0 sum_nonneg)


[STATEMENT]
lemma adjoint_linear:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
  assumes lf: "linear f"
  shows "linear (adjoint f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear (adjoint f)
[PROOF STEP]
by (simp add: lf linear_iff euclidean_eq_iff[where 'a='n] euclidean_eq_iff[where 'a='m]
    adjoint_clauses[OF lf] inner_distrib)


[STATEMENT]
lemma higher_pderiv_monom:
  "m \<le> n + 1 \<Longrightarrow> (pderiv ^^ m) (monom c n) = monom (pochhammer (int n - int m + 1) m * c) (n - m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n + 1 \<Longrightarrow> (pderiv ^^ m) (Polynomial.monom c n) = Polynomial.monom (pochhammer (int n - int m + 1) m * c) (n - m)
[PROOF STEP]
proof (induction m arbitrary: c n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>c n. 0 \<le> n + 1 \<Longrightarrow> (pderiv ^^ 0) (Polynomial.monom c n) = Polynomial.monom (pochhammer (int n - int 0 + 1) 0 * c) (n - 0)
 2. \<And>m c n. \<lbrakk>\<And>c n. m \<le> n + 1 \<Longrightarrow> (pderiv ^^ m) (Polynomial.monom c n) = Polynomial.monom (pochhammer (int n - int m + 1) m * c) (n - m); Suc m \<le> n + 1\<rbrakk> \<Longrightarrow> (pderiv ^^ Suc m) (Polynomial.monom c n) = Polynomial.monom (pochhammer (int n - int (Suc m) + 1) (Suc m) * c) (n - Suc m)
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
m \<le> ?n + 1 \<Longrightarrow> (pderiv ^^ m) (Polynomial.monom ?c ?n) = Polynomial.monom (pochhammer (int ?n - int m + 1) m * ?c) (?n - m)
Suc m \<le> n + 1

goal (2 subgoals):
 1. \<And>c n. 0 \<le> n + 1 \<Longrightarrow> (pderiv ^^ 0) (Polynomial.monom c n) = Polynomial.monom (pochhammer (int n - int 0 + 1) 0 * c) (n - 0)
 2. \<And>m c n. \<lbrakk>\<And>c n. m \<le> n + 1 \<Longrightarrow> (pderiv ^^ m) (Polynomial.monom c n) = Polynomial.monom (pochhammer (int n - int m + 1) m * c) (n - m); Suc m \<le> n + 1\<rbrakk> \<Longrightarrow> (pderiv ^^ Suc m) (Polynomial.monom c n) = Polynomial.monom (pochhammer (int n - int (Suc m) + 1) (Suc m) * c) (n - Suc m)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
m \<le> ?n + 1 \<Longrightarrow> (pderiv ^^ m) (Polynomial.monom ?c ?n) = Polynomial.monom (pochhammer (int ?n - int m + 1) m * ?c) (?n - m)
Suc m \<le> n + 1

goal (1 subgoal):
 1. (pderiv ^^ Suc m) (Polynomial.monom c n) = Polynomial.monom (pochhammer (int n - int (Suc m) + 1) (Suc m) * c) (n - Suc m)
[PROOF STEP]
by (cases n)
       (simp_all del: funpow.simps add: funpow_Suc_right pderiv_monom pochhammer_rec' Suc.IH)
[PROOF STATE]
proof (state)
this:
(pderiv ^^ Suc m) (Polynomial.monom c n) = Polynomial.monom (pochhammer (int n - int (Suc m) + 1) (Suc m) * c) (n - Suc m)

goal (1 subgoal):
 1. \<And>c n. 0 \<le> n + 1 \<Longrightarrow> (pderiv ^^ 0) (Polynomial.monom c n) = Polynomial.monom (pochhammer (int n - int 0 + 1) 0 * c) (n - 0)
[PROOF STEP]
qed simp_all


[STATEMENT]
theorem (in group) action_by_conjugation:
  "group_action G (carrier G) (\<lambda>g. (\<lambda>h \<in> carrier G. g \<otimes> h \<otimes> (inv g)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. group_action G (carrier G) (\<lambda>g. \<lambda>h\<in>carrier G. g \<otimes> h \<otimes> inv g)
[PROOF STEP]
unfolding group_action_def group_hom_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group G \<and> Group.group (BijGroup (carrier G)) \<and> group_hom_axioms G (BijGroup (carrier G)) (\<lambda>g. \<lambda>h\<in>carrier G. g \<otimes> h \<otimes> inv g)
[PROOF STEP]
using conjugation_is_hom
[PROOF STATE]
proof (prove)
using this:
(\<lambda>g. \<lambda>h\<in>carrier G. g \<otimes> h \<otimes> inv g) \<in> hom G (BijGroup (carrier G))

goal (1 subgoal):
 1. Group.group G \<and> Group.group (BijGroup (carrier G)) \<and> group_hom_axioms G (BijGroup (carrier G)) (\<lambda>g. \<lambda>h\<in>carrier G. g \<otimes> h \<otimes> inv g)
[PROOF STEP]
by (simp add: group_BijGroup group_hom_axioms.intro is_group)


[STATEMENT]
lemma le_add_right_mono:
  assumes
  "a <= b + (c::'a::ordered_ab_group_add)"
  "c <= d"
  shows "a <= b + d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b + d
[PROOF STEP]
apply (rule_tac order_trans[where y = "b+c"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<le> b + c
 2. b + c \<le> b + d
[PROOF STEP]
apply (simp_all add: assms)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cos_cmod_scalprod:
  shows "cmod z1 * cmod z2 * (cos (\<angle> z1 z2)) = Re (scalprod z1 z2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)
[PROOF STEP]
proof (cases "z1 = 0 \<or> z2 = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z1 = 0 \<or> z2 = 0 \<Longrightarrow> cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)
 2. \<not> (z1 = 0 \<or> z2 = 0) \<Longrightarrow> cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
z1 = 0 \<or> z2 = 0

goal (2 subgoals):
 1. z1 = 0 \<or> z2 = 0 \<Longrightarrow> cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)
 2. \<not> (z1 = 0 \<or> z2 = 0) \<Longrightarrow> cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
z1 = 0 \<or> z2 = 0

goal (1 subgoal):
 1. cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)

goal (1 subgoal):
 1. \<not> (z1 = 0 \<or> z2 = 0) \<Longrightarrow> cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (z1 = 0 \<or> z2 = 0) \<Longrightarrow> cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (z1 = 0 \<or> z2 = 0)

goal (1 subgoal):
 1. \<not> (z1 = 0 \<or> z2 = 0) \<Longrightarrow> cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (z1 = 0 \<or> z2 = 0)

goal (1 subgoal):
 1. cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)
[PROOF STEP]
by (simp add: cos_diff cos_arg sin_arg field_simps)
[PROOF STATE]
proof (state)
this:
cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_image_subset_interior:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "continuous_on S f" "inj_on f S" "DIM('b) \<le> DIM('a)"
  shows "f ` (interior S) \<subseteq> interior(f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` interior S \<subseteq> interior (f ` S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ` interior S \<subseteq> interior (f ` S)
[PROOF STEP]
have "open (f ` interior S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (f ` interior S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_on S f
inj_on f S
DIM('b) \<le> DIM('a)

goal (1 subgoal):
 1. open (f ` interior S)
[PROOF STEP]
by (intro invariance_of_domain_gen) (auto simp: subset_inj_on interior_subset continuous_on_subset)
[PROOF STATE]
proof (state)
this:
open (f ` interior S)

goal (1 subgoal):
 1. f ` interior S \<subseteq> interior (f ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open (f ` interior S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
open (f ` interior S)

goal (1 subgoal):
 1. f ` interior S \<subseteq> interior (f ` S)
[PROOF STEP]
by (simp add: image_mono interior_maximal interior_subset)
[PROOF STATE]
proof (state)
this:
f ` interior S \<subseteq> interior (f ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem n_sequences_card:
  assumes "finite A"
  shows "card (n_sequences A n) = card A ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (n_sequences A n) = card A ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (n_sequences A n) = card A ^ n
[PROOF STEP]
obtain xs where set: "set xs = A" and dis: "distinct xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>set xs = A; distinct xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms finite_distinct_list
[PROOF STATE]
proof (prove)
using this:
finite A
finite ?A \<Longrightarrow> \<exists>xs. set xs = ?A \<and> distinct xs

goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>set xs = A; distinct xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set xs = A
distinct xs

goal (1 subgoal):
 1. card (n_sequences A n) = card A ^ n
[PROOF STEP]
have "length (n_sequence_enum xs n) = (length xs) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (n_sequence_enum xs n) = length xs ^ n
[PROOF STEP]
using n_sequence_enum_distinct n_sequence_enum_length
[PROOF STATE]
proof (prove)
using this:
distinct ?xs \<Longrightarrow> distinct (n_sequence_enum ?xs ?n)
length (n_sequence_enum ?xs ?n) = length ?xs ^ ?n

goal (1 subgoal):
 1. length (n_sequence_enum xs n) = length xs ^ n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (n_sequence_enum xs n) = length xs ^ n

goal (1 subgoal):
 1. card (n_sequences A n) = card A ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (n_sequence_enum xs n) = length xs ^ n
[PROOF STEP]
have "card (set (n_sequence_enum xs n)) = card (set xs) ^ n"
[PROOF STATE]
proof (prove)
using this:
length (n_sequence_enum xs n) = length xs ^ n

goal (1 subgoal):
 1. card (set (n_sequence_enum xs n)) = card (set xs) ^ n
[PROOF STEP]
by (simp add: dis distinct_card n_sequence_enum_distinct)
[PROOF STATE]
proof (state)
this:
card (set (n_sequence_enum xs n)) = card (set xs) ^ n

goal (1 subgoal):
 1. card (n_sequences A n) = card A ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (set (n_sequence_enum xs n)) = card (set xs) ^ n
[PROOF STEP]
have "card (n_sequences (set xs) n) = card (set xs) ^ n"
[PROOF STATE]
proof (prove)
using this:
card (set (n_sequence_enum xs n)) = card (set xs) ^ n

goal (1 subgoal):
 1. card (n_sequences (set xs) n) = card (set xs) ^ n
[PROOF STEP]
by (simp add: n_sequence_enum_correct)
[PROOF STATE]
proof (state)
this:
card (n_sequences (set xs) n) = card (set xs) ^ n

goal (1 subgoal):
 1. card (n_sequences A n) = card A ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (n_sequences (set xs) n) = card (set xs) ^ n
[PROOF STEP]
show "card (n_sequences A n) = card A ^ n"
[PROOF STATE]
proof (prove)
using this:
card (n_sequences (set xs) n) = card (set xs) ^ n

goal (1 subgoal):
 1. card (n_sequences A n) = card A ^ n
[PROOF STEP]
using set
[PROOF STATE]
proof (prove)
using this:
card (n_sequences (set xs) n) = card (set xs) ^ n
set xs = A

goal (1 subgoal):
 1. card (n_sequences A n) = card A ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (n_sequences A n) = card A ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_integral0_by_parts:
  fixes a b :: "'a::{division_ring,ring_char_0} fps"
  shows
    "fps_integral0 (a * b) =
      a * fps_integral0 b - fps_integral0 (fps_deriv a * fps_integral0 b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_integral0 (a * b) = a * fps_integral0 b - fps_integral0 (fps_deriv a * fps_integral0 b)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_integral0 (a * b) = a * fps_integral0 b - fps_integral0 (fps_deriv a * fps_integral0 b)
[PROOF STEP]
have "fps_integral0 (fps_deriv (a * fps_integral0 b)) = a * fps_integral0 b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_integral0 (fps_deriv (a * fps_integral0 b)) = a * fps_integral0 b
[PROOF STEP]
using fps_integral0_deriv[of "(a * fps_integral0 b)"]
[PROOF STATE]
proof (prove)
using this:
fps_integral0 (fps_deriv (a * fps_integral0 b)) = a * fps_integral0 b - fps_const ((a * fps_integral0 b) $ 0)

goal (1 subgoal):
 1. fps_integral0 (fps_deriv (a * fps_integral0 b)) = a * fps_integral0 b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_integral0 (fps_deriv (a * fps_integral0 b)) = a * fps_integral0 b

goal (1 subgoal):
 1. fps_integral0 (a * b) = a * fps_integral0 b - fps_integral0 (fps_deriv a * fps_integral0 b)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
fps_integral0 (fps_deriv (a * fps_integral0 b)) = a * fps_integral0 b

goal (1 subgoal):
 1. fps_integral0 (a * b) = a * fps_integral0 b - fps_integral0 (fps_deriv a * fps_integral0 b)
[PROOF STEP]
have
    "fps_integral0 (a * b) =
      fps_integral0 (fps_deriv (a * fps_integral0 b)) -
      fps_integral0 (fps_deriv a * fps_integral0 b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_integral0 (a * b) = fps_integral0 (fps_deriv (a * fps_integral0 b)) - fps_integral0 (fps_deriv a * fps_integral0 b)
[PROOF STEP]
by (auto simp: fps_deriv_fps_integral fps_integral0_sub[symmetric])
[PROOF STATE]
proof (state)
this:
fps_integral0 (a * b) = fps_integral0 (fps_deriv (a * fps_integral0 b)) - fps_integral0 (fps_deriv a * fps_integral0 b)

goal (1 subgoal):
 1. fps_integral0 (a * b) = a * fps_integral0 b - fps_integral0 (fps_deriv a * fps_integral0 b)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
fps_integral0 (fps_deriv (a * fps_integral0 b)) = a * fps_integral0 b
fps_integral0 (a * b) = fps_integral0 (fps_deriv (a * fps_integral0 b)) - fps_integral0 (fps_deriv a * fps_integral0 b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fps_integral0 (fps_deriv (a * fps_integral0 b)) = a * fps_integral0 b
fps_integral0 (a * b) = fps_integral0 (fps_deriv (a * fps_integral0 b)) - fps_integral0 (fps_deriv a * fps_integral0 b)

goal (1 subgoal):
 1. fps_integral0 (a * b) = a * fps_integral0 b - fps_integral0 (fps_deriv a * fps_integral0 b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_integral0 (a * b) = a * fps_integral0 b - fps_integral0 (fps_deriv a * fps_integral0 b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Union_atLeastAtMost_real_of_nat:
  assumes "a < b"
  shows   "(\<Union>n\<in>{a..<b}. {real n..real (n + 1)}) = {real a..real b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>n\<in>{a..<b}. {real n..real (n + 1)}) = {real a..real b}
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)}) \<Longrightarrow> x \<in> {real a..real b}
 2. \<And>x. x \<in> {real a..real b} \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)}) \<Longrightarrow> x \<in> {real a..real b}
 2. \<And>x. x \<in> {real a..real b} \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
assume x: "x \<in> {real a..real b}"
[PROOF STATE]
proof (state)
this:
x \<in> {real a..real b}

goal (2 subgoals):
 1. \<And>x. x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)}) \<Longrightarrow> x \<in> {real a..real b}
 2. \<And>x. x \<in> {real a..real b} \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
thus "x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})"
[PROOF STATE]
proof (prove)
using this:
x \<in> {real a..real b}

goal (1 subgoal):
 1. x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
proof (cases "x = real b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>x \<in> {real a..real b}; x = real b\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
 2. \<lbrakk>x \<in> {real a..real b}; x \<noteq> real b\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = real b

goal (2 subgoals):
 1. \<lbrakk>x \<in> {real a..real b}; x = real b\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
 2. \<lbrakk>x \<in> {real a..real b}; x \<noteq> real b\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
a < b
x = real b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a < b
x = real b

goal (1 subgoal):
 1. x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
by (auto intro!: bexI[of _ "b - 1"])
[PROOF STATE]
proof (state)
this:
x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})

goal (1 subgoal):
 1. \<lbrakk>x \<in> {real a..real b}; x \<noteq> real b\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>x \<in> {real a..real b}; x \<noteq> real b\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> real b

goal (1 subgoal):
 1. \<lbrakk>x \<in> {real a..real b}; x \<noteq> real b\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
with x
[PROOF STATE]
proof (chain)
picking this:
x \<in> {real a..real b}
x \<noteq> real b
[PROOF STEP]
have x: "x \<ge> real a" "x < real b"
[PROOF STATE]
proof (prove)
using this:
x \<in> {real a..real b}
x \<noteq> real b

goal (1 subgoal):
 1. real a \<le> x &&& x < real b
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
real a \<le> x
x < real b

goal (1 subgoal):
 1. \<lbrakk>x \<in> {real a..real b}; x \<noteq> real b\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
hence "x \<ge> real (nat \<lfloor>x\<rfloor>)" "x \<le> real (Suc (nat \<lfloor>x\<rfloor>))"
[PROOF STATE]
proof (prove)
using this:
real a \<le> x
x < real b

goal (1 subgoal):
 1. real (nat \<lfloor>x\<rfloor>) \<le> x &&& x \<le> real (Suc (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
by linarith+
[PROOF STATE]
proof (state)
this:
real (nat \<lfloor>x\<rfloor>) \<le> x
x \<le> real (Suc (nat \<lfloor>x\<rfloor>))

goal (1 subgoal):
 1. \<lbrakk>x \<in> {real a..real b}; x \<noteq> real b\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (nat \<lfloor>x\<rfloor>) \<le> x
x \<le> real (Suc (nat \<lfloor>x\<rfloor>))

goal (1 subgoal):
 1. \<lbrakk>x \<in> {real a..real b}; x \<noteq> real b\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
real a \<le> x
x < real b
[PROOF STEP]
have "nat \<lfloor>x\<rfloor> \<ge> a" "nat \<lfloor>x\<rfloor> < b"
[PROOF STATE]
proof (prove)
using this:
real a \<le> x
x < real b

goal (1 subgoal):
 1. a \<le> nat \<lfloor>x\<rfloor> &&& nat \<lfloor>x\<rfloor> < b
[PROOF STEP]
by linarith+
[PROOF STATE]
proof (state)
this:
a \<le> nat \<lfloor>x\<rfloor>
nat \<lfloor>x\<rfloor> < b

goal (1 subgoal):
 1. \<lbrakk>x \<in> {real a..real b}; x \<noteq> real b\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real (nat \<lfloor>x\<rfloor>) \<le> x
x \<le> real (Suc (nat \<lfloor>x\<rfloor>))
a \<le> nat \<lfloor>x\<rfloor>
nat \<lfloor>x\<rfloor> < b
[PROOF STEP]
have "\<exists>n\<in>{a..<b}. x \<in> {real n..real (n + 1)}"
[PROOF STATE]
proof (prove)
using this:
real (nat \<lfloor>x\<rfloor>) \<le> x
x \<le> real (Suc (nat \<lfloor>x\<rfloor>))
a \<le> nat \<lfloor>x\<rfloor>
nat \<lfloor>x\<rfloor> < b

goal (1 subgoal):
 1. \<exists>n\<in>{a..<b}. x \<in> {real n..real (n + 1)}
[PROOF STEP]
by (intro bexI[of _ "nat \<lfloor>x\<rfloor>"]) simp_all
[PROOF STATE]
proof (state)
this:
\<exists>n\<in>{a..<b}. x \<in> {real n..real (n + 1)}

goal (1 subgoal):
 1. \<lbrakk>x \<in> {real a..real b}; x \<noteq> real b\<rbrakk> \<Longrightarrow> x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>n\<in>{a..<b}. x \<in> {real n..real (n + 1)}

goal (1 subgoal):
 1. x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)})

goal (1 subgoal):
 1. \<And>x. x \<in> (\<Union>n\<in>{a..<b}. {real n..real (n + 1)}) \<Longrightarrow> x \<in> {real a..real b}
[PROOF STEP]
qed auto


[STATEMENT]
lemma BMax_rec_eq2:
  "BMax_rec R x = Max ({z. z \<le> x \<and> R z} \<union> {0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. BMax_rec R x = Max ({z. z \<le> x \<and> R z} \<union> {0})
[PROOF STEP]
apply(induct x)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. BMax_rec R 0 = Max ({z. z \<le> 0 \<and> R z} \<union> {0})
 2. \<And>x. BMax_rec R x = Max ({z. z \<le> x \<and> R z} \<union> {0}) \<Longrightarrow> BMax_rec R (Suc x) = Max ({z. z \<le> Suc x \<and> R z} \<union> {0})
[PROOF STEP]
apply(auto intro: Max_eqI Max_eqI[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>BMax_rec R x = Max (insert 0 {z. z \<le> x \<and> R z}); \<not> R (Suc x)\<rbrakk> \<Longrightarrow> Max (insert 0 {z. z \<le> x \<and> R z}) = Max (insert 0 {z. z \<le> Suc x \<and> R z})
[PROOF STEP]
apply(simp add: le_Suc_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>BMax_rec R x = Max (insert 0 {z. z \<le> x \<and> R z}); \<not> R (Suc x)\<rbrakk> \<Longrightarrow> Max (insert 0 {z. z \<le> x \<and> R z}) = Max (insert 0 {z. (z \<le> x \<or> z = Suc x) \<and> R z})
[PROOF STEP]
by metis


[STATEMENT]
lemma sum_less_split:
assumes "l1<(l2::nat)"
shows "sum f {..<l2} = sum f {..l1} + sum f {l1<..<l2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<l2} = sum f {..l1} + sum f {l1<..<l2}
[PROOF STEP]
by (subst sum.subset_diff[of "{..l1}" "{..<l2}" f])
   (auto simp add: assms add.commute order_le_less_trans less_diff[OF assms])


[STATEMENT]
lemma poincare_line_minus_one_one [simp]:
  shows "poincare_line (of_complex (-1)) (of_complex 1) = x_axis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_line (of_complex (- 1)) (of_complex 1) = x_axis
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poincare_line (of_complex (- 1)) (of_complex 1) = x_axis
[PROOF STEP]
have "0\<^sub>h \<in> circline_set (poincare_line (of_complex (-1)) (of_complex 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>h \<in> circline_set (poincare_line (of_complex (- 1)) (of_complex 1))
[PROOF STEP]
unfolding circline_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>h \<in> Collect (on_circline (poincare_line (of_complex (- 1)) (of_complex 1)))
[PROOF STEP]
by simp (transfer, transfer,  simp add: vec_cnj_def)
[PROOF STATE]
proof (state)
this:
0\<^sub>h \<in> circline_set (poincare_line (of_complex (- 1)) (of_complex 1))

goal (1 subgoal):
 1. poincare_line (of_complex (- 1)) (of_complex 1) = x_axis
[PROOF STEP]
hence "poincare_line 0\<^sub>h (of_complex 1) = poincare_line (of_complex (-1)) (of_complex 1)"
[PROOF STATE]
proof (prove)
using this:
0\<^sub>h \<in> circline_set (poincare_line (of_complex (- 1)) (of_complex 1))

goal (1 subgoal):
 1. poincare_line 0\<^sub>h (of_complex 1) = poincare_line (of_complex (- 1)) (of_complex 1)
[PROOF STEP]
by (metis is_poincare_line_poincare_line is_poincare_line_trough_zero_trough_infty not_zero_on_unit_circle of_complex_inj of_complex_one one_neq_neg_one one_on_unit_circle poincare_line_0_real_is_x_axis poincare_line_circline_set(2) reciprocal_involution reciprocal_one reciprocal_zero unique_circline_01inf')
[PROOF STATE]
proof (state)
this:
poincare_line 0\<^sub>h (of_complex 1) = poincare_line (of_complex (- 1)) (of_complex 1)

goal (1 subgoal):
 1. poincare_line (of_complex (- 1)) (of_complex 1) = x_axis
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
poincare_line 0\<^sub>h (of_complex 1) = poincare_line (of_complex (- 1)) (of_complex 1)

goal (1 subgoal):
 1. poincare_line (of_complex (- 1)) (of_complex 1) = x_axis
[PROOF STEP]
using poincare_line_0_real_is_x_axis[of "of_complex 1"]
[PROOF STATE]
proof (prove)
using this:
poincare_line 0\<^sub>h (of_complex 1) = poincare_line (of_complex (- 1)) (of_complex 1)
\<lbrakk>of_complex 1 \<in> circline_set x_axis; of_complex 1 \<noteq> 0\<^sub>h; of_complex 1 \<noteq> \<infinity>\<^sub>h\<rbrakk> \<Longrightarrow> poincare_line 0\<^sub>h (of_complex 1) = x_axis

goal (1 subgoal):
 1. poincare_line (of_complex (- 1)) (of_complex 1) = x_axis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poincare_line (of_complex (- 1)) (of_complex 1) = x_axis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_summable_on_add [intro]:
  assumes "f abs_summable_on A" and "g abs_summable_on A"
  shows   "(\<lambda>x. f x + g x) abs_summable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x + g x) abs_summable_on A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f abs_summable_on A
g abs_summable_on A

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) abs_summable_on A
[PROOF STEP]
unfolding abs_summable_on_def
[PROOF STATE]
proof (prove)
using this:
integrable (count_space A) f
integrable (count_space A) g

goal (1 subgoal):
 1. integrable (count_space A) (\<lambda>x. f x + g x)
[PROOF STEP]
by (rule Bochner_Integration.integrable_add)


[STATEMENT]
lemma LIMSEQ_inv_powr:
  assumes "0 < c" "0 < d"
  shows "(\<lambda>n :: nat. (c / n) powr d) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (c / real n) powr d) \<longlonglongrightarrow> 0
[PROOF STEP]
proof (rule tendsto_zero_powrI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (\<lambda>x. c / real x) \<longlonglongrightarrow> 0
 2. (\<lambda>x. d) \<longlonglongrightarrow> ?b
 3. \<forall>\<^sup>\<infinity>n. 0 \<le> c / real n
 4. 0 < ?b
[PROOF STEP]
from \<open>0 < c\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < c
[PROOF STEP]
have "\<And>x. 0 < x \<Longrightarrow> 0 < c / x"
[PROOF STATE]
proof (prove)
using this:
0 < c

goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> 0 < c / x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < ?x \<Longrightarrow> 0 < c / ?x

goal (4 subgoals):
 1. (\<lambda>x. c / real x) \<longlonglongrightarrow> 0
 2. (\<lambda>x. d) \<longlonglongrightarrow> ?b
 3. \<forall>\<^sup>\<infinity>n. 0 \<le> c / real n
 4. 0 < ?b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < ?x \<Longrightarrow> 0 < c / ?x
[PROOF STEP]
show "\<forall>\<^sup>\<infinity>n. 0 \<le> c / real n"
[PROOF STATE]
proof (prove)
using this:
0 < ?x \<Longrightarrow> 0 < c / ?x

goal (1 subgoal):
 1. \<forall>\<^sup>\<infinity>n. 0 \<le> c / real n
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
0 < ?x \<Longrightarrow> 0 < c / ?x
0 < c

goal (1 subgoal):
 1. \<forall>\<^sup>\<infinity>n. 0 \<le> c / real n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sup>\<infinity>n. 0 \<le> c / real n

goal (3 subgoals):
 1. (\<lambda>x. c / real x) \<longlonglongrightarrow> 0
 2. (\<lambda>x. d) \<longlonglongrightarrow> ?b
 3. 0 < ?b
[PROOF STEP]
show "(\<lambda>x. c / real x) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c / real x) \<longlonglongrightarrow> 0
[PROOF STEP]
by (intro tendsto_divide_0[OF tendsto_const] filterlim_at_top_imp_at_infinity
              filterlim_real_sequentially tendsto_divide_0)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. c / real x) \<longlonglongrightarrow> 0

goal (2 subgoals):
 1. (\<lambda>x. d) \<longlonglongrightarrow> ?b
 2. 0 < ?b
[PROOF STEP]
show "0 < d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < d
[PROOF STEP]
by (rule assms)
[PROOF STATE]
proof (state)
this:
0 < d

goal (1 subgoal):
 1. (\<lambda>x. d) \<longlonglongrightarrow> d
[PROOF STEP]
show "(\<lambda>x. d) \<longlonglongrightarrow> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. d) \<longlonglongrightarrow> d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. d) \<longlonglongrightarrow> d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_of_bin_rep_aux:
  fixes n m:: nat
  assumes "m < 2^n"
  shows "length (bin_rep_aux n m) = n+1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (bin_rep_aux n m) = n + 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m < 2 ^ n

goal (1 subgoal):
 1. length (bin_rep_aux n m) = n + 1
[PROOF STEP]
proof(induction n arbitrary: m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m. m < 2 ^ 0 \<Longrightarrow> length (bin_rep_aux 0 m) = 0 + 1
 2. \<And>n m. \<lbrakk>\<And>m. m < 2 ^ n \<Longrightarrow> length (bin_rep_aux n m) = n + 1; m < 2 ^ Suc n\<rbrakk> \<Longrightarrow> length (bin_rep_aux (Suc n) m) = Suc n + 1
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
m < 2 ^ 0

goal (2 subgoals):
 1. \<And>m. m < 2 ^ 0 \<Longrightarrow> length (bin_rep_aux 0 m) = 0 + 1
 2. \<And>n m. \<lbrakk>\<And>m. m < 2 ^ n \<Longrightarrow> length (bin_rep_aux n m) = n + 1; m < 2 ^ Suc n\<rbrakk> \<Longrightarrow> length (bin_rep_aux (Suc n) m) = Suc n + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m < 2 ^ 0
[PROOF STEP]
show "length (bin_rep_aux 0 m) = 0 + 1"
[PROOF STATE]
proof (prove)
using this:
m < 2 ^ 0

goal (1 subgoal):
 1. length (bin_rep_aux 0 m) = 0 + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (bin_rep_aux 0 m) = 0 + 1

goal (1 subgoal):
 1. \<And>n m. \<lbrakk>\<And>m. m < 2 ^ n \<Longrightarrow> length (bin_rep_aux n m) = n + 1; m < 2 ^ Suc n\<rbrakk> \<Longrightarrow> length (bin_rep_aux (Suc n) m) = Suc n + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. \<lbrakk>\<And>m. m < 2 ^ n \<Longrightarrow> length (bin_rep_aux n m) = n + 1; m < 2 ^ Suc n\<rbrakk> \<Longrightarrow> length (bin_rep_aux (Suc n) m) = Suc n + 1
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
?m < 2 ^ n \<Longrightarrow> length (bin_rep_aux n ?m) = n + 1
m < 2 ^ Suc n

goal (1 subgoal):
 1. \<And>n m. \<lbrakk>\<And>m. m < 2 ^ n \<Longrightarrow> length (bin_rep_aux n m) = n + 1; m < 2 ^ Suc n\<rbrakk> \<Longrightarrow> length (bin_rep_aux (Suc n) m) = Suc n + 1
[PROOF STEP]
assume a0:"\<And>m. m < 2^n \<Longrightarrow> length (bin_rep_aux n m) = n + 1" and "m < 2^(Suc n)"
[PROOF STATE]
proof (state)
this:
?m < 2 ^ n \<Longrightarrow> length (bin_rep_aux n ?m) = n + 1
m < 2 ^ Suc n

goal (1 subgoal):
 1. \<And>n m. \<lbrakk>\<And>m. m < 2 ^ n \<Longrightarrow> length (bin_rep_aux n m) = n + 1; m < 2 ^ Suc n\<rbrakk> \<Longrightarrow> length (bin_rep_aux (Suc n) m) = Suc n + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?m < 2 ^ n \<Longrightarrow> length (bin_rep_aux n ?m) = n + 1
m < 2 ^ Suc n
[PROOF STEP]
show "length (bin_rep_aux (Suc n) m) = Suc n + 1"
[PROOF STATE]
proof (prove)
using this:
?m < 2 ^ n \<Longrightarrow> length (bin_rep_aux n ?m) = n + 1
m < 2 ^ Suc n

goal (1 subgoal):
 1. length (bin_rep_aux (Suc n) m) = Suc n + 1
[PROOF STEP]
using a0
[PROOF STATE]
proof (prove)
using this:
?m < 2 ^ n \<Longrightarrow> length (bin_rep_aux n ?m) = n + 1
m < 2 ^ Suc n
?m < 2 ^ n \<Longrightarrow> length (bin_rep_aux n ?m) = n + 1

goal (1 subgoal):
 1. length (bin_rep_aux (Suc n) m) = Suc n + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (bin_rep_aux (Suc n) m) = Suc n + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem mset_quicksort [simp]: "mset (quicksort R xs) = mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (quicksort R xs) = mset xs
[PROOF STEP]
by (induction R xs rule: quicksort.induct) simp_all


[STATEMENT]
lemma card_set [simp]: "CARD('a set) = 2 ^ CARD('a::finite)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a set) = 2 ^ CARD('a)
[PROOF STEP]
by(simp add: card_UNIV_set)


[STATEMENT]
lemma real_sqrt_sum_squares_less: "\<bar>x\<bar> < u / sqrt 2 \<Longrightarrow> \<bar>y\<bar> < u / sqrt 2 \<Longrightarrow> sqrt (x\<^sup>2 + y\<^sup>2) < u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<bar>x\<bar> < u / sqrt 2; \<bar>y\<bar> < u / sqrt 2\<rbrakk> \<Longrightarrow> sqrt (x\<^sup>2 + y\<^sup>2) < u
[PROOF STEP]
apply (rule power2_less_imp_less)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<bar>x\<bar> < u / sqrt 2; \<bar>y\<bar> < u / sqrt 2\<rbrakk> \<Longrightarrow> (sqrt (x\<^sup>2 + y\<^sup>2))\<^sup>2 < u\<^sup>2
 2. \<lbrakk>\<bar>x\<bar> < u / sqrt 2; \<bar>y\<bar> < u / sqrt 2\<rbrakk> \<Longrightarrow> 0 \<le> u
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<bar>x\<bar> < u / sqrt 2; \<bar>y\<bar> < u / sqrt 2\<rbrakk> \<Longrightarrow> x\<^sup>2 + y\<^sup>2 < u\<^sup>2
 2. \<lbrakk>\<bar>x\<bar> < u / sqrt 2; \<bar>y\<bar> < u / sqrt 2\<rbrakk> \<Longrightarrow> 0 \<le> u
[PROOF STEP]
apply (drule power_strict_mono [OF _ abs_ge_zero pos2])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<bar>y\<bar> < u / sqrt 2; \<bar>x\<bar>\<^sup>2 < (u / sqrt 2)\<^sup>2\<rbrakk> \<Longrightarrow> x\<^sup>2 + y\<^sup>2 < u\<^sup>2
 2. \<lbrakk>\<bar>x\<bar> < u / sqrt 2; \<bar>y\<bar> < u / sqrt 2\<rbrakk> \<Longrightarrow> 0 \<le> u
[PROOF STEP]
apply (drule power_strict_mono [OF _ abs_ge_zero pos2])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<bar>x\<bar>\<^sup>2 < (u / sqrt 2)\<^sup>2; \<bar>y\<bar>\<^sup>2 < (u / sqrt 2)\<^sup>2\<rbrakk> \<Longrightarrow> x\<^sup>2 + y\<^sup>2 < u\<^sup>2
 2. \<lbrakk>\<bar>x\<bar> < u / sqrt 2; \<bar>y\<bar> < u / sqrt 2\<rbrakk> \<Longrightarrow> 0 \<le> u
[PROOF STEP]
apply (simp add: power_divide)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<bar>x\<bar> < u / sqrt 2; \<bar>y\<bar> < u / sqrt 2\<rbrakk> \<Longrightarrow> 0 \<le> u
[PROOF STEP]
apply (drule order_le_less_trans [OF abs_ge_zero])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<bar>y\<bar> < u / sqrt 2; 0 < u / sqrt 2\<rbrakk> \<Longrightarrow> 0 \<le> u
[PROOF STEP]
apply (simp add: zero_less_divide_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lists_of_length_list_set :
  "set (lists_of_length xs k) = {xs' . length xs' = k \<and> set xs' \<subseteq> set xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (lists_of_length xs k) = {xs'. length xs' = k \<and> set xs' \<subseteq> set xs}
[PROOF STEP]
using lists_of_length_containment[of _ xs k]
        lists_of_length_length[of _ xs k]
        lists_of_length_elems[of _ xs k]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?xs \<subseteq> set xs; length ?xs = k\<rbrakk> \<Longrightarrow> ?xs \<in> set (lists_of_length xs k)
?xs \<in> set (lists_of_length xs k) \<Longrightarrow> length ?xs = k
?xs \<in> set (lists_of_length xs k) \<Longrightarrow> set ?xs \<subseteq> set xs

goal (1 subgoal):
 1. set (lists_of_length xs k) = {xs'. length xs' = k \<and> set xs' \<subseteq> set xs}
[PROOF STEP]
by blast


[STATEMENT]
lemma frontier_straddle:
  fixes a :: "'a::metric_space"
  shows "a \<in> frontier S \<longleftrightarrow> (\<forall>e>0. (\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in> frontier S) = (\<forall>e>0. (\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e))
[PROOF STEP]
unfolding frontier_def closure_interior
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in> - interior (- S) - interior S) = (\<forall>e>0. (\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e))
[PROOF STEP]
by (auto simp: mem_interior subset_eq ball_def)


[STATEMENT]
lemma set_le_two [simp]: "card {a, b} \<le> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {a, b} \<le> 2
[PROOF STEP]
by (simp add: card_insert_if)


[STATEMENT]
lemma det_mult: "mat_det (mat_mul M1 M2) = (mat_det M1) * (mat_det M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_det (mat_mul M1 M2) = mat_det M1 * mat_det M2
[PROOF STEP]
by (auto simp: mat_det.simps algebra_simps)


[STATEMENT]
lemma upper_bound:
  fixes b::nat
    and c::int
  assumes "b > 0"
      and "c < 2^(b-1)"
    shows "c + 2^(b-1) < 2^b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c + 2 ^ (b - 1) < 2 ^ b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c + 2 ^ (b - 1) < 2 ^ b
[PROOF STEP]
have a1: "\<And>P. (\<forall>b::nat. P b) \<Longrightarrow> (\<forall>b>0. P ((b-1)::nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P. \<forall>b. P b \<Longrightarrow> \<forall>b>0. P (b - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>b. ?P b \<Longrightarrow> \<forall>b>0. ?P (b - 1)

goal (1 subgoal):
 1. c + 2 ^ (b - 1) < 2 ^ b
[PROOF STEP]
have b2: "\<forall>b::nat. (\<forall>(c::int)<2^b. (c + 2^b) < 2^(Suc b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b c. c < 2 ^ b \<longrightarrow> c + 2 ^ b < 2 ^ Suc b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>b c. c < 2 ^ b \<longrightarrow> c + 2 ^ b < 2 ^ Suc b

goal (1 subgoal):
 1. c + 2 ^ (b - 1) < 2 ^ b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c + 2 ^ (b - 1) < 2 ^ b
[PROOF STEP]
using a1[OF b2] assms
[PROOF STATE]
proof (prove)
using this:
\<forall>b>0. \<forall>c<2 ^ (b - 1). c + 2 ^ (b - 1) < 2 ^ Suc (b - 1)
0 < b
c < 2 ^ (b - 1)

goal (1 subgoal):
 1. c + 2 ^ (b - 1) < 2 ^ b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c + 2 ^ (b - 1) < 2 ^ b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_countable_subset_image_inj:
   "(\<exists>T. countable T \<and> T \<subseteq> f ` S \<and> P T) \<longleftrightarrow>
    (\<exists>T. countable T \<and> T \<subseteq> S \<and> inj_on f T \<and> P (f ` T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>T. countable T \<and> T \<subseteq> f ` S \<and> P T) = (\<exists>T. countable T \<and> T \<subseteq> S \<and> inj_on f T \<and> P (f ` T))
[PROOF STEP]
by (metis countable_image_inj_eq subset_image_inj)


[STATEMENT]
lemma "((\<lambda>x::real. exp (exp x) / exp (exp x - exp (-exp (exp x)))) \<longlongrightarrow> 1) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. exp (exp x) / exp (exp x - exp (- exp (exp x)))) \<longlongrightarrow> 1) at_top
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma rank_Gauss_Jordan_code[code]:
  fixes A::"'a::{field}^'n::{mod_type}^'m::{mod_type}"
  shows "rank A = (if A = 0 then 0 else (let A'=(Gauss_Jordan A) in to_nat (GREATEST a. row a A' \<noteq> 0) + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = (if A = 0 then 0 else let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)
[PROOF STEP]
proof (cases "A = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A = 0 \<Longrightarrow> rank A = (if A = 0 then 0 else let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)
 2. A \<noteq> 0 \<Longrightarrow> rank A = (if A = 0 then 0 else let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A = 0

goal (2 subgoals):
 1. A = 0 \<Longrightarrow> rank A = (if A = 0 then 0 else let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)
 2. A \<noteq> 0 \<Longrightarrow> rank A = (if A = 0 then 0 else let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = (if A = 0 then 0 else let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)
[PROOF STEP]
unfolding if_P[OF True]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = 0
[PROOF STEP]
unfolding True  rank_0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = 0
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
rank A = (if A = 0 then 0 else let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)

goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> rank A = (if A = 0 then 0 else let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> rank A = (if A = 0 then 0 else let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
A \<noteq> 0

goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> rank A = (if A = 0 then 0 else let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = (if A = 0 then 0 else let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)
[PROOF STEP]
unfolding if_not_P[OF False]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = (let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)
[PROOF STEP]
unfolding rank_eq_suc_to_nat_greatest[OF False] Let_def is_zero_row_eq_row_zero
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (GREATEST a. row a (Gauss_Jordan A) \<noteq> 0) + 1 = mod_type_class.to_nat (GREATEST a. row a (Gauss_Jordan A) \<noteq> 0) + 1
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
rank A = (if A = 0 then 0 else let A' = Gauss_Jordan A in mod_type_class.to_nat (GREATEST a. row a A' \<noteq> 0) + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in lower_semilattice) meet_assoc:
  assumes L: "x \<in> carrier L"  "y \<in> carrier L"  "z \<in> carrier L"
  shows "(x \<sqinter> y) \<sqinter> z = x \<sqinter> (y \<sqinter> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter> y \<sqinter> z = x \<sqinter> (y \<sqinter> z)
[PROOF STEP]
using weak_meet_assoc L
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier L; ?y \<in> carrier L; ?z \<in> carrier L\<rbrakk> \<Longrightarrow> ?x \<sqinter> ?y \<sqinter> ?z .= ?x \<sqinter> (?y \<sqinter> ?z)
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L

goal (1 subgoal):
 1. x \<sqinter> y \<sqinter> z = x \<sqinter> (y \<sqinter> z)
[PROOF STEP]
unfolding eq_is_equal
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier L; ?y \<in> carrier L; ?z \<in> carrier L\<rbrakk> \<Longrightarrow> ?x \<sqinter> ?y \<sqinter> ?z = ?x \<sqinter> (?y \<sqinter> ?z)
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L

goal (1 subgoal):
 1. x \<sqinter> y \<sqinter> z = x \<sqinter> (y \<sqinter> z)
[PROOF STEP]
.


[STATEMENT]
lemma exp_sin_cos_squared_add:
  fixes x y :: real
  shows "exp (- (\<i> * x)) * cos (y) * (exp (\<i> * x) * cos (y)) + sin(y) * sin(y) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (- (\<i> * complex_of_real x)) * complex_of_real (cos y) * (exp (\<i> * complex_of_real x) * complex_of_real (cos y)) + complex_of_real (sin y * sin y) = 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. exp (- (\<i> * complex_of_real x)) * complex_of_real (cos y) * (exp (\<i> * complex_of_real x) * complex_of_real (cos y)) + complex_of_real (sin y * sin y) = 1
[PROOF STEP]
have "exp (- (\<i> * x)) * cos (y) * (exp (\<i> * x) * cos (y)) = cos(y) * cos(y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (- (\<i> * complex_of_real x)) * complex_of_real (cos y) * (exp (\<i> * complex_of_real x) * complex_of_real (cos y)) = complex_of_real (cos y * cos y)
[PROOF STEP]
using exp_minus_inverse
[PROOF STATE]
proof (prove)
using this:
exp ?x * exp (- ?x) = (1::?'a)

goal (1 subgoal):
 1. exp (- (\<i> * complex_of_real x)) * complex_of_real (cos y) * (exp (\<i> * complex_of_real x) * complex_of_real (cos y)) = complex_of_real (cos y * cos y)
[PROOF STEP]
by (auto simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
exp (- (\<i> * complex_of_real x)) * complex_of_real (cos y) * (exp (\<i> * complex_of_real x) * complex_of_real (cos y)) = complex_of_real (cos y * cos y)

goal (1 subgoal):
 1. exp (- (\<i> * complex_of_real x)) * complex_of_real (cos y) * (exp (\<i> * complex_of_real x) * complex_of_real (cos y)) + complex_of_real (sin y * sin y) = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
exp (- (\<i> * complex_of_real x)) * complex_of_real (cos y) * (exp (\<i> * complex_of_real x) * complex_of_real (cos y)) = complex_of_real (cos y * cos y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
exp (- (\<i> * complex_of_real x)) * complex_of_real (cos y) * (exp (\<i> * complex_of_real x) * complex_of_real (cos y)) = complex_of_real (cos y * cos y)

goal (1 subgoal):
 1. exp (- (\<i> * complex_of_real x)) * complex_of_real (cos y) * (exp (\<i> * complex_of_real x) * complex_of_real (cos y)) + complex_of_real (sin y * sin y) = 1
[PROOF STEP]
by (metis of_real_add of_real_hom.hom_one sin_cos_squared_add3)
[PROOF STATE]
proof (state)
this:
exp (- (\<i> * complex_of_real x)) * complex_of_real (cos y) * (exp (\<i> * complex_of_real x) * complex_of_real (cos y)) + complex_of_real (sin y * sin y) = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_mult_limit:
  fixes X :: "nat \<Rightarrow> complex mat" and A B :: "complex mat" and m :: nat
  assumes dimB: "B \<in> carrier_mat m m" and limX: "limit_mat X A m"
  shows "limit_mat (mat_mult_seq B X) (B * A) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limit_mat (mat_mult_seq B X) (B * A) m
[PROOF STEP]
unfolding mat_mult_seq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limit_mat (\<lambda>n. B * X n) (B * A) m
[PROOF STEP]
using limit_mat_mult limit_mat_const[OF dimB] limX
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>limit_mat ?X ?A ?m; limit_mat ?Y ?B ?m\<rbrakk> \<Longrightarrow> limit_mat (\<lambda>k. ?X k * ?Y k) (?A * ?B) ?m
limit_mat (\<lambda>k. B) B m
limit_mat X A m

goal (1 subgoal):
 1. limit_mat (\<lambda>n. B * X n) (B * A) m
[PROOF STEP]
by auto


[STATEMENT]
lemma UNIV_subtract:
  shows "UNIV - EVEN = ODD"
  and   "UNIV - ODD  = EVEN"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV - EVEN = ODD &&& UNIV - ODD = EVEN
[PROOF STEP]
using EVEN_union_ODD EVEN_intersect_ODD
[PROOF STATE]
proof (prove)
using this:
EVEN \<union> ODD = UNIV
EVEN \<inter> ODD = {}

goal (1 subgoal):
 1. UNIV - EVEN = ODD &&& UNIV - ODD = EVEN
[PROOF STEP]
by (blast)+


[STATEMENT]
lemma collinear_inv_rotation:
  assumes "collinear (Ax, Ay) (Bx, By) (Cx, Cy)" and "c\<^sup>2 + s\<^sup>2 = 1"
  shows "collinear (Ax * c - Ay * s, Ay * c + Ax * s)
    (Bx * c - By * s, By * c + Bx * s) (Cx * c - Cy * s, Cy * c + Cx * s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear (Ax * c - Ay * s, Ay * c + Ax * s) (Bx * c - By * s, By * c + Bx * s) (Cx * c - Cy * s, Cy * c + Cx * s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
collinear (Ax, Ay) (Bx, By) (Cx, Cy)
c\<^sup>2 + s\<^sup>2 = 1

goal (1 subgoal):
 1. collinear (Ax * c - Ay * s, Ay * c + Ax * s) (Bx * c - By * s, By * c + Bx * s) (Cx * c - Cy * s, Cy * c + Cx * s)
[PROOF STEP]
by (algebra add: collinear_def split_def fst_conv snd_conv)


[STATEMENT]
theorem IFNTT_inv_FNTT:
  assumes "length numbers = n"
  shows "IFNTT (FNTT numbers) = map ((*) (of_int_mod_ring (int n))) numbers"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IFNTT (FNTT numbers) = map ((*) (of_int_mod_ring (int n))) numbers
[PROOF STEP]
by (simp add: FNTT_correct IFNTT_correct assms length_NTT ntt_correct)


[STATEMENT]
lemma unitary_adj_eq_inv:
  shows "unitary M \<longleftrightarrow> mat_det M \<noteq> 0 \<and> mat_adj M = mat_inv M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary M = (mat_det M \<noteq> 0 \<and> mat_adj M = mat_inv M)
[PROOF STEP]
using  unitary_regular[of M] mult_mm_inv_r[of M "mat_adj M" eye]  mat_eye_l[of "mat_inv M"] mat_inv_l[of M]
[PROOF STATE]
proof (prove)
using this:
unitary M \<Longrightarrow> mat_det M \<noteq> 0
\<lbrakk>mat_det M \<noteq> 0; mat_adj M *\<^sub>m\<^sub>m M = eye\<rbrakk> \<Longrightarrow> mat_adj M = eye *\<^sub>m\<^sub>m mat_inv M
eye *\<^sub>m\<^sub>m mat_inv M = mat_inv M
mat_det M \<noteq> 0 \<Longrightarrow> mat_inv M *\<^sub>m\<^sub>m M = eye

goal (1 subgoal):
 1. unitary M = (mat_det M \<noteq> 0 \<and> mat_adj M = mat_inv M)
[PROOF STEP]
unfolding unitary_def
[PROOF STATE]
proof (prove)
using this:
mat_adj M *\<^sub>m\<^sub>m M = eye \<Longrightarrow> mat_det M \<noteq> 0
\<lbrakk>mat_det M \<noteq> 0; mat_adj M *\<^sub>m\<^sub>m M = eye\<rbrakk> \<Longrightarrow> mat_adj M = eye *\<^sub>m\<^sub>m mat_inv M
eye *\<^sub>m\<^sub>m mat_inv M = mat_inv M
mat_det M \<noteq> 0 \<Longrightarrow> mat_inv M *\<^sub>m\<^sub>m M = eye

goal (1 subgoal):
 1. (mat_adj M *\<^sub>m\<^sub>m M = eye) = (mat_det M \<noteq> 0 \<and> mat_adj M = mat_inv M)
[PROOF STEP]
by - (rule, simp_all)