[STATEMENT]
lemma vangle_eq_zeroD: "vangle u v = 0 \<Longrightarrow> (\<exists>k. v = k *\<^sub>R u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vangle u v = 0 \<Longrightarrow> \<exists>k. v = k *\<^sub>R u
[PROOF STEP]
apply (auto simp: vangle_def split: if_splits)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>arccos (u \<bullet> v / (norm u * norm v)) = 0; u \<noteq> (0::'a); v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> \<exists>k. v = k *\<^sub>R u
[PROOF STEP]
apply (subst (asm) arccos_eq_zero_iff)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>u \<noteq> (0::'a); v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> - 1 \<le> u \<bullet> v / (norm u * norm v)
 2. \<lbrakk>u \<noteq> (0::'a); v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> u \<bullet> v / (norm u * norm v) \<le> 1
 3. \<lbrakk>u \<bullet> v / (norm u * norm v) = 1; u \<noteq> (0::'a); v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> \<exists>k. v = k *\<^sub>R u
[PROOF STEP]
apply (auto simp: divide_simps mult_less_0_iff split: if_splits)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>u \<noteq> (0::'a); v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> - (norm u * norm v) \<le> u \<bullet> v
 2. \<lbrakk>u \<noteq> (0::'a); v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> u \<bullet> v \<le> norm u * norm v
 3. \<lbrakk>u \<bullet> v = norm u * norm v; u \<noteq> (0::'a); v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> \<exists>k. v = k *\<^sub>R u
[PROOF STEP]
apply (metis Real_Vector_Spaces.norm_minus_cancel inner_minus_left minus_le_iff norm_cauchy_schwarz)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>u \<noteq> (0::'a); v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> u \<bullet> v \<le> norm u * norm v
 2. \<lbrakk>u \<bullet> v = norm u * norm v; u \<noteq> (0::'a); v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> \<exists>k. v = k *\<^sub>R u
[PROOF STEP]
apply (metis norm_cauchy_schwarz)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<bullet> v = norm u * norm v; u \<noteq> (0::'a); v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> \<exists>k. v = k *\<^sub>R u
[PROOF STEP]
by (metis Cauchy_Schwarz_eq2_iff abs_of_pos inner_commute mult.commute mult_sign_intros(5) zero_less_norm_iff)


[STATEMENT]
lemma card_of_Times_mono[simp]:
assumes "|A| \<le>o |B|" and "|C| \<le>o |D|"
shows "|A \<times> C| \<le>o |B \<times> D|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A \<times> C| \<le>o |B \<times> D|
[PROOF STEP]
using assms card_of_Times_mono1[of A B C] card_of_Times_mono2[of C D B]
      ordLeq_transitive[of "|A \<times> C|"]
[PROOF STATE]
proof (prove)
using this:
|A| \<le>o |B|
|C| \<le>o |D|
|A| \<le>o |B| \<Longrightarrow> |A \<times> C| \<le>o |B \<times> C|
|C| \<le>o |D| \<Longrightarrow> |B \<times> C| \<le>o |B \<times> D|
\<lbrakk>|A \<times> C| \<le>o ?r'; ?r' \<le>o ?r''\<rbrakk> \<Longrightarrow> |A \<times> C| \<le>o ?r''

goal (1 subgoal):
 1. |A \<times> C| \<le>o |B \<times> D|
[PROOF STEP]
by blast


[STATEMENT]
lemma bounded_clinear_equal_ket:
  fixes f g :: \<open>'a ell2 \<Rightarrow> _\<close>
  assumes \<open>bounded_clinear f\<close>
  assumes \<open>bounded_clinear g\<close>
  assumes \<open>\<And>i. f (ket i) = g (ket i)\<close>
  shows \<open>f = g\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = g
[PROOF STEP]
apply (rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. f x = g x
[PROOF STEP]
apply (rule bounded_clinear_eq_on[of f g \<open>range ket\<close>])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x. bounded_clinear f
 2. \<And>x. bounded_clinear g
 3. \<And>x xa. xa \<in> range ket \<Longrightarrow> f xa = g xa
 4. \<And>x. x \<in> closure (cspan (range ket))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bounded_clinear f
bounded_clinear g
f (ket ?i) = g (ket ?i)

goal (4 subgoals):
 1. \<And>x. bounded_clinear f
 2. \<And>x. bounded_clinear g
 3. \<And>x xa. xa \<in> range ket \<Longrightarrow> f xa = g xa
 4. \<And>x. x \<in> closure (cspan (range ket))
[PROOF STEP]
by auto


[STATEMENT]
lemma transpose_minus: "A \<in> carrier_mat nr nc \<Longrightarrow> B \<in> carrier_mat nr nc
  \<Longrightarrow> transpose_mat (A - B) = transpose_mat A - transpose_mat B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat nr nc; B \<in> carrier_mat nr nc\<rbrakk> \<Longrightarrow> transpose_mat (A - B) = transpose_mat A - transpose_mat B
[PROOF STEP]
by (intro eq_matI, auto)


[STATEMENT]
lemma inner_prod_mult_mat_vec_left:
  assumes "v \<in> carrier_vec n"
  and "w \<in> carrier_vec n'"
  and "A \<in> carrier_mat m n"
  and "B \<in> carrier_mat m n'"
shows "inner_prod (A *\<^sub>v v) (B *\<^sub>v w) =
  inner_prod (((Complex_Matrix.adjoint B) * A) *\<^sub>v v) w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w
[PROOF STEP]
have "inner_prod (A *\<^sub>v v) (B *\<^sub>v w) =
    inner_prod (Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v)) w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v)) w
[PROOF STEP]
using adjoint_def_alter
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m; ?A \<in> carrier_mat ?n ?m\<rbrakk> \<Longrightarrow> Complex_Matrix.inner_prod ?v (?A *\<^sub>v ?w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint ?A *\<^sub>v ?v) ?w

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v)) w
[PROOF STEP]
by (metis assms mult_mat_vec_carrier)
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v)) w

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v)) w

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w
[PROOF STEP]
have "... = inner_prod (((Complex_Matrix.adjoint B) * A) *\<^sub>v v) w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v)) w = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v)) w = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w
[PROOF STEP]
have "Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v) =
      ((Complex_Matrix.adjoint B) * A) *\<^sub>v v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v) = Complex_Matrix.adjoint B * A *\<^sub>v v
[PROOF STEP]
proof (rule assoc_mult_mat_vec[symmetric], (auto simp add: assms))
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A \<in> carrier_mat (dim_row B) ?n\<^sub>3
 2. v \<in> carrier_vec ?n\<^sub>3
[PROOF STEP]
show "v \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> carrier_vec n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec n
w \<in> carrier_vec n'
A \<in> carrier_mat m n
B \<in> carrier_mat m n'

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

goal (1 subgoal):
 1. A \<in> carrier_mat (dim_row B) n
[PROOF STEP]
show "A \<in> carrier_mat (dim_row B) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat (dim_row B) n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec n
w \<in> carrier_vec n'
A \<in> carrier_mat m n
B \<in> carrier_mat m n'

goal (1 subgoal):
 1. A \<in> carrier_mat (dim_row B) n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat (dim_row B) n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v) = Complex_Matrix.adjoint B * A *\<^sub>v v

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v)) w = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v) = Complex_Matrix.adjoint B * A *\<^sub>v v

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v)) w = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v)) w = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (Complex_Matrix.adjoint B *\<^sub>v (A *\<^sub>v v)) w = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (A *\<^sub>v v) (B *\<^sub>v w) = Complex_Matrix.inner_prod (Complex_Matrix.adjoint B * A *\<^sub>v v) w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tan_minus_45: "tan (-(pi/4)) = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan (- (pi / 4)) = - 1
[PROOF STEP]
unfolding tan_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (- (pi / 4)) / cos (- (pi / 4)) = - 1
[PROOF STEP]
by (simp add: sin_45 cos_45)


[STATEMENT]
lemma cos0_scalprod0:
  assumes "z1 \<noteq> 0" and "z2 \<noteq> 0"
  shows "cos (\<angle> z1 z2) = 0 \<longleftrightarrow> scalprod z1 z2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos (\<angle> z1 z2) = 0) = (scalprod z1 z2 = 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z1 \<noteq> 0
z2 \<noteq> 0

goal (1 subgoal):
 1. (cos (\<angle> z1 z2) = 0) = (scalprod z1 z2 = 0)
[PROOF STEP]
using cnj_mix_real[of z1 z2]
[PROOF STATE]
proof (prove)
using this:
z1 \<noteq> 0
z2 \<noteq> 0
is_real (cnj_mix z1 z2)

goal (1 subgoal):
 1. (cos (\<angle> z1 z2) = 0) = (scalprod z1 z2 = 0)
[PROOF STEP]
using cos_cmod_scalprod[of z1 z2]
[PROOF STATE]
proof (prove)
using this:
z1 \<noteq> 0
z2 \<noteq> 0
is_real (cnj_mix z1 z2)
cmod z1 * cmod z2 * cos (\<angle> z1 z2) = Re (scalprod z1 z2)

goal (1 subgoal):
 1. (cos (\<angle> z1 z2) = 0) = (scalprod z1 z2 = 0)
[PROOF STEP]
by (auto simp add: complex_eq_if_Re_eq)


[STATEMENT]
lemma invertible_mat_four_block_mat_lower_right:
  assumes A: "(A::'a::comm_ring_1 mat) \<in> carrier_mat n n" and inv_A: "invertible_mat A"
  shows "invertible_mat (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_mat (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invertible_mat (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A)
[PROOF STEP]
let ?I = "(four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invertible_mat (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A)
[PROOF STEP]
have "Determinant.det ?I = Determinant.det (1\<^sub>m 1) * Determinant.det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A) = Determinant.det (1\<^sub>m 1) * Determinant.det A
[PROOF STEP]
by (rule det_four_block_mat_lower_left_zero_col, insert assms, auto)
[PROOF STATE]
proof (state)
this:
Determinant.det (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A) = Determinant.det (1\<^sub>m 1) * Determinant.det A

goal (1 subgoal):
 1. invertible_mat (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Determinant.det (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A) = Determinant.det (1\<^sub>m 1) * Determinant.det A

goal (1 subgoal):
 1. invertible_mat (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A)
[PROOF STEP]
have "... = Determinant.det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (1\<^sub>m 1) * Determinant.det A = Determinant.det A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Determinant.det (1\<^sub>m 1) * Determinant.det A = Determinant.det A

goal (1 subgoal):
 1. invertible_mat (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Determinant.det (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A) = Determinant.det A
[PROOF STEP]
have "Determinant.det ?I = Determinant.det A"
[PROOF STATE]
proof (prove)
using this:
Determinant.det (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A) = Determinant.det A

goal (1 subgoal):
 1. Determinant.det (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A) = Determinant.det A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Determinant.det (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A) = Determinant.det A

goal (1 subgoal):
 1. invertible_mat (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Determinant.det (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A) = Determinant.det A

goal (1 subgoal):
 1. invertible_mat (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A)
[PROOF STEP]
by (metis (no_types, lifting) assms carrier_matD(1) carrier_matD(2) carrier_mat_triv
        index_mat_four_block(2) index_mat_four_block(3) index_one_mat(2) index_one_mat(3)
        invertible_iff_is_unit_JNF)
[PROOF STATE]
proof (state)
this:
invertible_mat (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 n) (0\<^sub>m n 1) A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_orbit_period_nonneg:
  assumes "closed_orbit x"
  shows "period x \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> period x
[PROOF STEP]
unfolding period_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Inf {T \<in> existence_ivl0 x. 0 < T \<and> flow0 x T = x}
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
closed_orbit x

goal (1 subgoal):
 1. 0 \<le> Inf {T \<in> existence_ivl0 x. 0 < T \<and> flow0 x T = x}
[PROOF STEP]
unfolding closed_orbit_def
[PROOF STATE]
proof (prove)
using this:
\<exists>T\<in>existence_ivl0 x. T \<noteq> 0 \<and> flow0 x T = x

goal (1 subgoal):
 1. 0 \<le> Inf {T \<in> existence_ivl0 x. 0 < T \<and> flow0 x T = x}
[PROOF STEP]
apply (auto intro!:cInf_greatest)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>T. \<lbrakk>T \<in> existence_ivl0 x; T \<noteq> 0; flow0 x T = x; \<forall>xa>0. xa \<in> existence_ivl0 x \<longrightarrow> flow0 x xa \<noteq> x\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (smt recurrence_time_flip_sign)


[STATEMENT]
lemma nn_integral_erlang_density:
  assumes [arith]: "0 < l"
  shows "(\<integral>\<^sup>+ x. ennreal (erlang_density k l x) * indicator {.. a} x \<partial>lborel) = erlang_CDF k l a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
proof (cases "0 \<le> a")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
 2. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
case [arith]: True
[PROOF STATE]
proof (state)
this:
0 \<le> a

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
 2. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
have eq: "\<And>x. indicator {0..a} (x / l) = indicator {0..a*l} x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. indicator {0..a} (x / l) = indicator {0..a * l} x
[PROOF STEP]
by (simp add: field_simps split: split_indicator)
[PROOF STATE]
proof (state)
this:
indicator {0..a} (?x / l) = indicator {0..a * l} ?x

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
 2. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
have "(\<integral>\<^sup>+x. ennreal (erlang_density k l x) * indicator {.. a} x \<partial>lborel) =
    (\<integral>\<^sup>+x. (l/fact k) * (ennreal ((l*x)^k * exp (- (l*x))) * indicator {0 .. a} x) \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (l / fact k) * (ennreal ((l * x) ^ k * exp (- (l * x))) * indicator {0..a} x) \<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong)
       (auto simp: erlang_density_def power_mult_distrib ennreal_mult[symmetric] split: split_indicator)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (l / fact k) * (ennreal ((l * x) ^ k * exp (- (l * x))) * indicator {0..a} x) \<partial>lborel

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
 2. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (l / fact k) * (ennreal ((l * x) ^ k * exp (- (l * x))) * indicator {0..a} x) \<partial>lborel

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
 2. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
have "\<dots> = (l/fact k) * (\<integral>\<^sup>+x. ennreal ((l*x)^k * exp (- (l*x))) * indicator {0 .. a} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (l / fact k) * (ennreal ((l * x) ^ k * exp (- (l * x))) * indicator {0..a} x) \<partial>lborel = ennreal (l / fact k) * (\<integral>\<^sup>+x\<in>{0..a}. ennreal ((l * x) ^ k * exp (- (l * x)))\<partial>lborel)
[PROOF STEP]
by (intro nn_integral_cmult) auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (l / fact k) * (ennreal ((l * x) ^ k * exp (- (l * x))) * indicator {0..a} x) \<partial>lborel = ennreal (l / fact k) * (\<integral>\<^sup>+x\<in>{0..a}. ennreal ((l * x) ^ k * exp (- (l * x)))\<partial>lborel)

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
 2. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (l / fact k) * (ennreal ((l * x) ^ k * exp (- (l * x))) * indicator {0..a} x) \<partial>lborel = ennreal (l / fact k) * (\<integral>\<^sup>+x\<in>{0..a}. ennreal ((l * x) ^ k * exp (- (l * x)))\<partial>lborel)

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
 2. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
have "\<dots> = ennreal (l/fact k) * ((1/l) * (\<integral>\<^sup>+x. ennreal (x^k * exp (- x)) * indicator {0 .. l * a} x \<partial>lborel))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (l / fact k) * (\<integral>\<^sup>+x\<in>{0..a}. ennreal ((l * x) ^ k * exp (- (l * x)))\<partial>lborel) = ennreal (l / fact k) * (ennreal (1 / l) * (\<integral>\<^sup>+x\<in>{0..l * a}. ennreal (x ^ k * exp (- x))\<partial>lborel))
[PROOF STEP]
by (subst nn_integral_real_affine[where c="1 / l" and t=0]) (auto simp: field_simps eq)
[PROOF STATE]
proof (state)
this:
ennreal (l / fact k) * (\<integral>\<^sup>+x\<in>{0..a}. ennreal ((l * x) ^ k * exp (- (l * x)))\<partial>lborel) = ennreal (l / fact k) * (ennreal (1 / l) * (\<integral>\<^sup>+x\<in>{0..l * a}. ennreal (x ^ k * exp (- x))\<partial>lborel))

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
 2. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (l / fact k) * (\<integral>\<^sup>+x\<in>{0..a}. ennreal ((l * x) ^ k * exp (- (l * x)))\<partial>lborel) = ennreal (l / fact k) * (ennreal (1 / l) * (\<integral>\<^sup>+x\<in>{0..l * a}. ennreal (x ^ k * exp (- x))\<partial>lborel))

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
 2. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
have "\<dots> = (1 - (\<Sum>n\<le>k. ((l * a)^n * exp (-(l * a))) / fact n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (l / fact k) * (ennreal (1 / l) * (\<integral>\<^sup>+x\<in>{0..l * a}. ennreal (x ^ k * exp (- x))\<partial>lborel)) = ennreal (1 - (\<Sum>n\<le>k. (l * a) ^ n * exp (- (l * a)) / fact n))
[PROOF STEP]
by (subst nn_intergal_power_times_exp_Icc) (auto simp: ennreal_mult'[symmetric])
[PROOF STATE]
proof (state)
this:
ennreal (l / fact k) * (ennreal (1 / l) * (\<integral>\<^sup>+x\<in>{0..l * a}. ennreal (x ^ k * exp (- x))\<partial>lborel)) = ennreal (1 - (\<Sum>n\<le>k. (l * a) ^ n * exp (- (l * a)) / fact n))

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
 2. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (l / fact k) * (ennreal (1 / l) * (\<integral>\<^sup>+x\<in>{0..l * a}. ennreal (x ^ k * exp (- x))\<partial>lborel)) = ennreal (1 - (\<Sum>n\<le>k. (l * a) ^ n * exp (- (l * a)) / fact n))

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
 2. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
have "\<dots> = erlang_CDF k l a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (1 - (\<Sum>n\<le>k. (l * a) ^ n * exp (- (l * a)) / fact n)) = ennreal (erlang_CDF k l a)
[PROOF STEP]
by (auto simp: erlang_CDF_def)
[PROOF STATE]
proof (state)
this:
ennreal (1 - (\<Sum>n\<le>k. (l * a) ^ n * exp (- (l * a)) / fact n)) = ennreal (erlang_CDF k l a)

goal (2 subgoals):
 1. 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
 2. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)

goal (1 subgoal):
 1. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 \<le> a

goal (1 subgoal):
 1. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> 0 \<le> a
[PROOF STEP]
have "(\<integral>\<^sup>+ x. ennreal (erlang_density k l x) * indicator {.. a} x \<partial>lborel) = (\<integral>\<^sup>+x. 0 \<partial>(lborel::real measure))"
[PROOF STATE]
proof (prove)
using this:
\<not> 0 \<le> a

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = \<integral>\<^sup>+ x. 0 \<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong) (auto simp: erlang_density_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = \<integral>\<^sup>+ x. 0 \<partial>lborel

goal (1 subgoal):
 1. \<not> 0 \<le> a \<Longrightarrow> \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> 0 \<le> a
\<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = \<integral>\<^sup>+ x. 0 \<partial>lborel
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> 0 \<le> a
\<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = \<integral>\<^sup>+ x. 0 \<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)
[PROOF STEP]
by (simp add: erlang_CDF_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{..a}. ennreal (erlang_density k l x)\<partial>lborel = ennreal (erlang_CDF k l a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma condition_2_part_1:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}" and k::nat
  defines ia:"ia\<equiv>(if \<forall>m. is_zero_row_upt_k m k A then 0 else to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1)"
  defines B:"B\<equiv>(snd (Gauss_Jordan_column_k (ia,A) k))"
  assumes not_zero_i_suc_k: "\<not> is_zero_row_upt_k i (Suc k) B"
  and all_zero: "\<forall>m. is_zero_row_upt_k m k A"
  and all_zero_k: "\<forall>m. A $ m $ from_nat k = 0"
  shows "A $ i $ (LEAST k. A $ i $ k \<noteq> 0) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
have ia2: "ia = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ia = 0
[PROOF STEP]
using ia all_zero
[PROOF STATE]
proof (prove)
using this:
ia \<equiv> if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1
\<forall>m. is_zero_row_upt_k m k A

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

goal (1 subgoal):
 1. A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
have B_eq_A: "B=A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B = A
[PROOF STEP]
unfolding B Gauss_Jordan_column_k_def Let_def fst_conv snd_conv ia2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (if (\<forall>m\<ge>mod_type_class.from_nat 0. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> 0 = nrows A then (0, A) else (0 + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat 0) (mod_type_class.from_nat k))) = A
[PROOF STEP]
using all_zero_k
[PROOF STATE]
proof (prove)
using this:
\<forall>m. A $ m $ mod_type_class.from_nat k = (0::'a)

goal (1 subgoal):
 1. snd (if (\<forall>m\<ge>mod_type_class.from_nat 0. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> 0 = nrows A then (0, A) else (0 + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat 0) (mod_type_class.from_nat k))) = A
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
B = A

goal (1 subgoal):
 1. A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
using all_zero_k condition_1_part_1[OF _ all_zero] not_zero_i_suc_k
[PROOF STATE]
proof (prove)
using this:
\<forall>m. A $ m $ mod_type_class.from_nat k = (0::'a)
\<forall>m\<ge>mod_type_class.from_nat 0. A $ m $ mod_type_class.from_nat k = (0::'a) \<Longrightarrow> is_zero_row_upt_k ?j (Suc k) A
\<not> is_zero_row_upt_k i (Suc k) B

goal (1 subgoal):
 1. A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
unfolding B_eq_A
[PROOF STATE]
proof (prove)
using this:
\<forall>m. A $ m $ mod_type_class.from_nat k = (0::'a)
\<forall>m\<ge>mod_type_class.from_nat 0. A $ m $ mod_type_class.from_nat k = (0::'a) \<Longrightarrow> is_zero_row_upt_k ?j (Suc k) A
\<not> is_zero_row_upt_k i (Suc k) A

goal (1 subgoal):
 1. A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isometry_on_compose:
  assumes "isometry_on X f"
          "isometry_on (f`X) g"
  shows "isometry_on X (\<lambda>x. g(f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isometry_on X (\<lambda>x. g (f x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isometry_on X f
isometry_on (f ` X) g

goal (1 subgoal):
 1. isometry_on X (\<lambda>x. g (f x))
[PROOF STEP]
unfolding isometry_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>X. \<forall>y\<in>X. dist (f x) (f y) = dist x y
\<forall>x\<in>f ` X. \<forall>y\<in>f ` X. dist (g x) (g y) = dist x y

goal (1 subgoal):
 1. \<forall>x\<in>X. \<forall>y\<in>X. dist (g (f x)) (g (f y)) = dist x y
[PROOF STEP]
by auto


[STATEMENT]
lemma list_eq_prod [simp]:
  fixes xs::"real list"
  shows "\<Prod>:(list_eq xs m) = (m ^ (length (list_eq xs m)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (list_eq xs m) = m ^ length (list_eq xs m)
[PROOF STEP]
apply (induct_tac xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. prod_list (list_eq [] m) = m ^ length (list_eq [] m)
 2. \<And>a list. prod_list (list_eq list m) = m ^ length (list_eq list m) \<Longrightarrow> prod_list (list_eq (a # list) m) = m ^ length (list_eq (a # list) m)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a list. prod_list (list_eq list m) = m ^ length (list_eq list m) \<Longrightarrow> prod_list (list_eq (a # list) m) = m ^ length (list_eq (a # list) m)
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Int_interior_Union_intervals:
    "\<lbrakk>finite \<F>; open S; \<And>T. T\<in>\<F> \<Longrightarrow> \<exists>a b. T = cbox a b; \<And>T. T\<in>\<F> \<Longrightarrow> S \<inter> (interior T) = {}\<rbrakk>
    \<Longrightarrow> S \<inter> interior (\<Union>\<F>) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite \<F>; open S; \<And>T. T \<in> \<F> \<Longrightarrow> \<exists>a b. T = cbox a b; \<And>T. T \<in> \<F> \<Longrightarrow> S \<inter> interior T = {}\<rbrakk> \<Longrightarrow> S \<inter> interior (\<Union> \<F>) = {}
[PROOF STEP]
using interior_Union_subset_cbox[of \<F> "UNIV - S"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite \<F>; \<And>s. s \<in> \<F> \<Longrightarrow> \<exists>a b. s = cbox a b; \<And>s. s \<in> \<F> \<Longrightarrow> interior s \<subseteq> UNIV - S; closed (UNIV - S)\<rbrakk> \<Longrightarrow> interior (\<Union> \<F>) \<subseteq> UNIV - S

goal (1 subgoal):
 1. \<lbrakk>finite \<F>; open S; \<And>T. T \<in> \<F> \<Longrightarrow> \<exists>a b. T = cbox a b; \<And>T. T \<in> \<F> \<Longrightarrow> S \<inter> interior T = {}\<rbrakk> \<Longrightarrow> S \<inter> interior (\<Union> \<F>) = {}
[PROOF STEP]
by auto


[STATEMENT]
lemma cpx_vec_length_inner_prod [simp]:
  "\<parallel>v\<parallel>\<^sup>2 = \<langle>v|v\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (\<parallel>v\<parallel>\<^sup>2) = \<langle>v|v\<rangle>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. complex_of_real (\<parallel>v\<parallel>\<^sup>2) = \<langle>v|v\<rangle>
[PROOF STEP]
have "\<parallel>v\<parallel>\<^sup>2 = (\<Sum>i<dim_vec v. (cmod (v $ i))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>v\<parallel>\<^sup>2 = (\<Sum>i<dim_vec v. (cmod (v $ i))\<^sup>2)
[PROOF STEP]
using cpx_vec_length_def complex_of_real_def
[PROOF STATE]
proof (prove)
using this:
\<parallel>?v\<parallel> \<equiv> sqrt (\<Sum>i<dim_vec ?v. (cmod (?v $ i))\<^sup>2)
complex_of_real ?r = Complex ?r 0

goal (1 subgoal):
 1. \<parallel>v\<parallel>\<^sup>2 = (\<Sum>i<dim_vec v. (cmod (v $ i))\<^sup>2)
[PROOF STEP]
by (metis (no_types, lifting) real_sqrt_power real_sqrt_unique sum_nonneg zero_le_power2)
[PROOF STATE]
proof (state)
this:
\<parallel>v\<parallel>\<^sup>2 = (\<Sum>i<dim_vec v. (cmod (v $ i))\<^sup>2)

goal (1 subgoal):
 1. complex_of_real (\<parallel>v\<parallel>\<^sup>2) = \<langle>v|v\<rangle>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<parallel>v\<parallel>\<^sup>2 = (\<Sum>i<dim_vec v. (cmod (v $ i))\<^sup>2)

goal (1 subgoal):
 1. complex_of_real (\<parallel>v\<parallel>\<^sup>2) = \<langle>v|v\<rangle>
[PROOF STEP]
have "\<dots> = (\<Sum>i<dim_vec v. cnj (v $ i) * (v $ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (\<Sum>i<dim_vec v. (cmod (v $ i))\<^sup>2) = (\<Sum>i<dim_vec v. cnj (v $ i) * v $ i)
[PROOF STEP]
using complex_norm_square mult.commute
[PROOF STATE]
proof (prove)
using this:
complex_of_real ((cmod ?z)\<^sup>2) = ?z * cnj ?z
?a * ?b = ?b * ?a

goal (1 subgoal):
 1. complex_of_real (\<Sum>i<dim_vec v. (cmod (v $ i))\<^sup>2) = (\<Sum>i<dim_vec v. cnj (v $ i) * v $ i)
[PROOF STEP]
by (smt of_real_sum sum.cong)
[PROOF STATE]
proof (state)
this:
complex_of_real (\<Sum>i<dim_vec v. (cmod (v $ i))\<^sup>2) = (\<Sum>i<dim_vec v. cnj (v $ i) * v $ i)

goal (1 subgoal):
 1. complex_of_real (\<parallel>v\<parallel>\<^sup>2) = \<langle>v|v\<rangle>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
complex_of_real (\<parallel>v\<parallel>\<^sup>2) = (\<Sum>i<dim_vec v. cnj (v $ i) * v $ i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
complex_of_real (\<parallel>v\<parallel>\<^sup>2) = (\<Sum>i<dim_vec v. cnj (v $ i) * v $ i)

goal (1 subgoal):
 1. complex_of_real (\<parallel>v\<parallel>\<^sup>2) = \<langle>v|v\<rangle>
[PROOF STEP]
using inner_prod_def
[PROOF STATE]
proof (prove)
using this:
complex_of_real (\<parallel>v\<parallel>\<^sup>2) = (\<Sum>i<dim_vec v. cnj (v $ i) * v $ i)
\<langle>?u|?v\<rangle> \<equiv> \<Sum>i = 0..<dim_vec ?v. cnj (?u $ i) * ?v $ i

goal (1 subgoal):
 1. complex_of_real (\<parallel>v\<parallel>\<^sup>2) = \<langle>v|v\<rangle>
[PROOF STEP]
by (simp add: lessThan_atLeast0)
[PROOF STATE]
proof (state)
this:
complex_of_real (\<parallel>v\<parallel>\<^sup>2) = \<langle>v|v\<rangle>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma irrelevant_set_bit[simp]:
  fixes p m n :: nat
  assumes "n \<le> m"
  shows "(p + 2 ^ m) mod 2 ^ n = p mod 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p + 2 ^ m) mod 2 ^ n = p mod 2 ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (p + 2 ^ m) mod 2 ^ n = p mod 2 ^ n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
n \<le> m
[PROOF STEP]
obtain q :: nat where "2 ^ m = q * 2 ^ n"
[PROOF STATE]
proof (prove)
using this:
n \<le> m

goal (1 subgoal):
 1. (\<And>q. 2 ^ m = q * 2 ^ n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis le_add_diff_inverse mult.commute power_add)
[PROOF STATE]
proof (state)
this:
2 ^ m = q * 2 ^ n

goal (1 subgoal):
 1. (p + 2 ^ m) mod 2 ^ n = p mod 2 ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ m = q * 2 ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 ^ m = q * 2 ^ n

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma L2_set_constant: "L2_set (\<lambda>x. y) A = sqrt (of_nat (card A)) * \<bar>y\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L2_set (\<lambda>x. y) A = sqrt (real (card A)) * \<bar>y\<bar>
[PROOF STEP]
unfolding L2_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>A. y\<^sup>2) = sqrt (real (card A)) * \<bar>y\<bar>
[PROOF STEP]
by (simp add: real_sqrt_mult)


[STATEMENT]
lemma all_less_Suc_eq: "(\<forall>x < Suc n. P x) \<longleftrightarrow> (\<forall>x < n. P x) \<and> P n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x<Suc n. P x) = ((\<forall>x<n. P x) \<and> P n)
[PROOF STEP]
by (auto elim: less_SucE)


[STATEMENT]
lemma diff_leq_zero_weak_preference:
  assumes "p \<in> lotteries_on outcomes"
    and "q \<in> lotteries_on outcomes"
  shows "p \<succeq> q \<longleftrightarrow> ((\<Sum>a\<in>outcomes. pmf q a * u a) - (\<Sum>a\<in>outcomes. pmf p a * u a) \<le> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<succeq> q = ((\<Sum>a\<in>outcomes. pmf q a * u a) - (\<Sum>a\<in>outcomes. pmf p a * u a) \<le> 0)
[PROOF STEP]
using assms(1) assms(2) diff_le_0_iff_le
[PROOF STATE]
proof (prove)
using this:
p \<in> \<P> outcomes
q \<in> \<P> outcomes
(?a - ?b \<le> (0::?'a)) = (?a \<le> ?b)

goal (1 subgoal):
 1. p \<succeq> q = ((\<Sum>a\<in>outcomes. pmf q a * u a) - (\<Sum>a\<in>outcomes. pmf p a * u a) \<le> 0)
[PROOF STEP]
by (metis (mono_tags, lifting) expected_utility_weak_preference)


[STATEMENT]
lemma ln_fact: "ln (fact n) = (\<Sum>d=1..n. ln d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. ln (real d))
[PROOF STEP]
by (induction n) (simp_all add: ln_mult)


[STATEMENT]
lemma proots_card_sphere_axis_eq:
  defines "q1\<equiv>[:\<i>,-1:]" and "q2\<equiv>[:\<i>,1:]"
  assumes "p\<noteq>0"
  shows "card (proots_within p (sphere 0 1 - {- 1}))
            = card (proots_within (fcompose p q1 q2) {x. 0 = Im x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within p (sphere 0 1 - {- 1})) = card (proots_within (fcompose p q1 q2) {x. 0 = Im x})
[PROOF STEP]
unfolding q1_def q2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within p (sphere 0 1 - {- 1})) = card (proots_within (fcompose p [:\<i>, - 1:] [:\<i>, 1:]) {x. 0 = Im x})
[PROOF STEP]
proof (rule proots_card_fcompose_bij_eq[OF _ \<open>p\<noteq>0\<close>])
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. bij_betw (\<lambda>x. poly [:\<i>, - 1:] x / poly [:\<i>, 1:] x) {x. 0 = Im x} (sphere 0 1 - {- 1})
 2. \<forall>x\<in>{x. 0 = Im x}. poly [:\<i>, 1:] x \<noteq> 0
 3. max (degree [:\<i>, - 1:]) (degree [:\<i>, 1:]) \<le> 1
 4. \<forall>c. [:\<i>, - 1:] \<noteq> smult c [:\<i>, 1:]
 5. infinite UNIV
[PROOF STEP]
show "\<forall>x\<in>{x. 0 = Im x}. poly [:\<i>, 1:] x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{x. 0 = Im x}. poly [:\<i>, 1:] x \<noteq> 0
[PROOF STEP]
by (simp add: Complex_eq_0 plus_complex.code)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{x. 0 = Im x}. poly [:\<i>, 1:] x \<noteq> 0

goal (4 subgoals):
 1. bij_betw (\<lambda>x. poly [:\<i>, - 1:] x / poly [:\<i>, 1:] x) {x. 0 = Im x} (sphere 0 1 - {- 1})
 2. max (degree [:\<i>, - 1:]) (degree [:\<i>, 1:]) \<le> 1
 3. \<forall>c. [:\<i>, - 1:] \<noteq> smult c [:\<i>, 1:]
 4. infinite UNIV
[PROOF STEP]
qed (use bij_betw_axis_sphere infinite_UNIV_char_0 in auto)


[STATEMENT]
lemma Digamma_real_three_halves_pos: "Digamma (3/2 :: real) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Digamma (3 / 2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < Digamma (3 / 2)
[PROOF STEP]
have "-Digamma (3/2 :: real) = -Digamma (of_nat 1 + 1/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - Digamma (3 / 2) = - Digamma (real 1 + 1 / 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- Digamma (3 / 2) = - Digamma (real 1 + 1 / 2)

goal (1 subgoal):
 1. 0 < Digamma (3 / 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- Digamma (3 / 2) = - Digamma (real 1 + 1 / 2)

goal (1 subgoal):
 1. 0 < Digamma (3 / 2)
[PROOF STEP]
have "\<dots> = 2 * ln 2 + euler_mascheroni - 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - Digamma (real 1 + 1 / 2) = 2 * ln 2 + euler_mascheroni - 2
[PROOF STEP]
by (subst Digamma_half_integer) simp
[PROOF STATE]
proof (state)
this:
- Digamma (real 1 + 1 / 2) = 2 * ln 2 + euler_mascheroni - 2

goal (1 subgoal):
 1. 0 < Digamma (3 / 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- Digamma (real 1 + 1 / 2) = 2 * ln 2 + euler_mascheroni - 2

goal (1 subgoal):
 1. 0 < Digamma (3 / 2)
[PROOF STEP]
note euler_mascheroni_less_13_over_22
[PROOF STATE]
proof (state)
this:
euler_mascheroni < 13 / 22

goal (1 subgoal):
 1. 0 < Digamma (3 / 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
euler_mascheroni < 13 / 22

goal (1 subgoal):
 1. 0 < Digamma (3 / 2)
[PROOF STEP]
note ln2_le_25_over_36
[PROOF STATE]
proof (state)
this:
ln 2 \<le> 25 / 36

goal (1 subgoal):
 1. 0 < Digamma (3 / 2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>x y. x < y \<Longrightarrow> 2 * ln 2 + x - 2 < 2 * ln 2 + y - 2; \<And>x y. x \<le> y \<Longrightarrow> 2 * x + 13 / 22 - 2 \<le> 2 * y + 13 / 22 - 2\<rbrakk> \<Longrightarrow> - Digamma (3 / 2) < 2 * (25 / 36) + 13 / 22 - 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x y. x < y \<Longrightarrow> 2 * ln 2 + x - 2 < 2 * ln 2 + y - 2; \<And>x y. x \<le> y \<Longrightarrow> 2 * x + 13 / 22 - 2 \<le> 2 * y + 13 / 22 - 2\<rbrakk> \<Longrightarrow> - Digamma (3 / 2) < 2 * (25 / 36) + 13 / 22 - 2

goal (1 subgoal):
 1. 0 < Digamma (3 / 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < Digamma (3 / 2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_poly_mult_rat_main: "coeff (poly_mult_rat_main n d f) i = coeff f i * n ^ (degree f - i) * d ^ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (poly_mult_rat_main n d f) i = coeff f i * n ^ (degree f - i) * d ^ i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeff (poly_mult_rat_main n d f) i = coeff f i * n ^ (degree f - i) * d ^ i
[PROOF STEP]
have id: "coeff (poly_mult_rat_main n d f) i = (coeff f i * d ^ i) * n ^ (length (coeffs f) - Suc i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (poly_mult_rat_main n d f) i = coeff f i * d ^ i * n ^ (length (coeffs f) - Suc i)
[PROOF STEP]
unfolding poly_mult_rat_main_def Let_def poly_of_list_def coeff_Poly
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_default (0::'a) (map2 (\<lambda>fi i. fi * d ^ i * n ^ (length (coeffs f) - Suc i)) (coeffs f) [0..<length (coeffs f)]) i = coeff f i * d ^ i * n ^ (length (coeffs f) - Suc i)
[PROOF STEP]
unfolding nth_default_coeffs_eq[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_default (0::'a) (map2 (\<lambda>fi i. fi * d ^ i * n ^ (length (coeffs f) - Suc i)) (coeffs f) [0..<length (coeffs f)]) i = nth_default (0::'a) (coeffs f) i * d ^ i * n ^ (length (coeffs f) - Suc i)
[PROOF STEP]
unfolding nth_default_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i < length (map2 (\<lambda>fi i. fi * d ^ i * n ^ (length (coeffs f) - Suc i)) (coeffs f) [0..<length (coeffs f)]) then map2 (\<lambda>fi i. fi * d ^ i * n ^ (length (coeffs f) - Suc i)) (coeffs f) [0..<length (coeffs f)] ! i else (0::'a)) = (if i < length (coeffs f) then coeffs f ! i else (0::'a)) * d ^ i * n ^ (length (coeffs f) - Suc i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coeff (poly_mult_rat_main n d f) i = coeff f i * d ^ i * n ^ (length (coeffs f) - Suc i)

goal (1 subgoal):
 1. coeff (poly_mult_rat_main n d f) i = coeff f i * n ^ (degree f - i) * d ^ i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (poly_mult_rat_main n d f) i = coeff f i * n ^ (degree f - i) * d ^ i
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff f i * d ^ i * n ^ (length (coeffs f) - Suc i) = coeff f i * n ^ (degree f - i) * d ^ i
[PROOF STEP]
by (simp add: degree_eq_length_coeffs)
[PROOF STATE]
proof (state)
this:
coeff (poly_mult_rat_main n d f) i = coeff f i * n ^ (degree f - i) * d ^ i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filtermap_Nil_list_ex: "filtermap pred func tr = [] \<longleftrightarrow> \<not> list_ex pred tr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Filtermap.filtermap pred func tr = []) = (\<not> list_ex pred tr)
[PROOF STEP]
proof(induction tr)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (Filtermap.filtermap pred func [] = []) = (\<not> list_ex pred [])
 2. \<And>a tr. (Filtermap.filtermap pred func tr = []) = (\<not> list_ex pred tr) \<Longrightarrow> (Filtermap.filtermap pred func (a # tr) = []) = (\<not> list_ex pred (a # tr))
[PROOF STEP]
case (Cons trn tr)
[PROOF STATE]
proof (state)
this:
(Filtermap.filtermap pred func tr = []) = (\<not> list_ex pred tr)

goal (2 subgoals):
 1. (Filtermap.filtermap pred func [] = []) = (\<not> list_ex pred [])
 2. \<And>a tr. (Filtermap.filtermap pred func tr = []) = (\<not> list_ex pred tr) \<Longrightarrow> (Filtermap.filtermap pred func (a # tr) = []) = (\<not> list_ex pred (a # tr))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
(Filtermap.filtermap pred func tr = []) = (\<not> list_ex pred tr)

goal (1 subgoal):
 1. (Filtermap.filtermap pred func (trn # tr) = []) = (\<not> list_ex pred (trn # tr))
[PROOF STEP]
by (cases "pred trn") auto
[PROOF STATE]
proof (state)
this:
(Filtermap.filtermap pred func (trn # tr) = []) = (\<not> list_ex pred (trn # tr))

goal (1 subgoal):
 1. (Filtermap.filtermap pred func [] = []) = (\<not> list_ex pred [])
[PROOF STEP]
qed auto


[STATEMENT]
lemma hom_into_subgroup_eq_gen:
    "group G \<Longrightarrow>
     h \<in> hom K (subgroup_generated G H)
 \<longleftrightarrow> h \<in> hom K G \<and> h ` (carrier K) \<subseteq> carrier(subgroup_generated G H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group G \<Longrightarrow> (h \<in> hom K (subgroup_generated G H)) = (h \<in> hom K G \<and> h ` carrier K \<subseteq> carrier (subgroup_generated G H))
[PROOF STEP]
using group.carrier_subgroup_generated_subset [of G H]
[PROOF STATE]
proof (prove)
using this:
Group.group G \<Longrightarrow> carrier (subgroup_generated G H) \<subseteq> carrier G

goal (1 subgoal):
 1. Group.group G \<Longrightarrow> (h \<in> hom K (subgroup_generated G H)) = (h \<in> hom K G \<and> h ` carrier K \<subseteq> carrier (subgroup_generated G H))
[PROOF STEP]
by (auto simp: hom_def)


[STATEMENT]
lemma leadsTo_UN_UN:
   "(!! i. i \<in> I ==> F \<in> (A i) leadsTo (A' i))
    ==> F \<in> (\<Union>i \<in> I. A i) leadsTo (\<Union>i \<in> I. A' i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> F \<in> A i \<longmapsto> A' i) \<Longrightarrow> F \<in> \<Union> (A ` I) \<longmapsto> \<Union> (A' ` I)
[PROOF STEP]
apply (blast intro: leadsTo_Union leadsTo_weaken_R)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sin_arctan: "sin (arctan x) = x / sqrt (1 + x\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (arctan x) = x / sqrt (1 + x\<^sup>2)
[PROOF STEP]
using add_pos_nonneg [OF zero_less_one zero_le_power2 [of x]]
[PROOF STATE]
proof (prove)
using this:
0 < 1 + x\<^sup>2

goal (1 subgoal):
 1. sin (arctan x) = x / sqrt (1 + x\<^sup>2)
[PROOF STEP]
using tan_arctan [of x]
[PROOF STATE]
proof (prove)
using this:
0 < 1 + x\<^sup>2
tan (arctan x) = x

goal (1 subgoal):
 1. sin (arctan x) = x / sqrt (1 + x\<^sup>2)
[PROOF STEP]
unfolding tan_def cos_arctan
[PROOF STATE]
proof (prove)
using this:
0 < 1 + x\<^sup>2
sin (arctan x) / (1 / sqrt (1 + x\<^sup>2)) = x

goal (1 subgoal):
 1. sin (arctan x) = x / sqrt (1 + x\<^sup>2)
[PROOF STEP]
by (simp add: eq_divide_eq)


[STATEMENT]
lemma cpx_mat_cnj_prod:
  assumes "dim_col M = dim_row N"
  shows "(M * N)\<^sup>\<star> = (M\<^sup>\<star>) * (N\<^sup>\<star>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M * N\<^sup>\<star> = M\<^sup>\<star> * N\<^sup>\<star>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>); j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)\<rbrakk> \<Longrightarrow> M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
 2. dim_row M * N\<^sup>\<star> = dim_row (M\<^sup>\<star> * N\<^sup>\<star>)
 3. dim_col M * N\<^sup>\<star> = dim_col (M\<^sup>\<star> * N\<^sup>\<star>)
[PROOF STEP]
show "dim_row (M * N)\<^sup>\<star> = dim_row ((M\<^sup>\<star>) * (N\<^sup>\<star>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row M * N\<^sup>\<star> = dim_row (M\<^sup>\<star> * N\<^sup>\<star>)
[PROOF STEP]
by (simp add: cpx_mat_cnj_def)
[PROOF STATE]
proof (state)
this:
dim_row M * N\<^sup>\<star> = dim_row (M\<^sup>\<star> * N\<^sup>\<star>)

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>); j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)\<rbrakk> \<Longrightarrow> M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
 2. dim_col M * N\<^sup>\<star> = dim_col (M\<^sup>\<star> * N\<^sup>\<star>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>); j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)\<rbrakk> \<Longrightarrow> M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
 2. dim_col M * N\<^sup>\<star> = dim_col (M\<^sup>\<star> * N\<^sup>\<star>)
[PROOF STEP]
show "dim_col ((M * N)\<^sup>\<star>) = dim_col ((M\<^sup>\<star>) * (N\<^sup>\<star>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col M * N\<^sup>\<star> = dim_col (M\<^sup>\<star> * N\<^sup>\<star>)
[PROOF STEP]
by (simp add: cpx_mat_cnj_def)
[PROOF STATE]
proof (state)
this:
dim_col M * N\<^sup>\<star> = dim_col (M\<^sup>\<star> * N\<^sup>\<star>)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>); j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)\<rbrakk> \<Longrightarrow> M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>); j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)\<rbrakk> \<Longrightarrow> M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
[PROOF STEP]
fix i j::nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>); j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)\<rbrakk> \<Longrightarrow> M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
[PROOF STEP]
assume a1:"i < dim_row ((M\<^sup>\<star>) * (N\<^sup>\<star>))" and a2:"j < dim_col ((M\<^sup>\<star>) * (N\<^sup>\<star>))"
[PROOF STATE]
proof (state)
this:
i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>)
j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>); j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)\<rbrakk> \<Longrightarrow> M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>)
j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)
[PROOF STEP]
have "(M * N)\<^sup>\<star> $$ (i,j) = cnj (\<Sum>k<(dim_row N). M $$ (i,k) * N $$ (k,j))"
[PROOF STATE]
proof (prove)
using this:
i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>)
j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)

goal (1 subgoal):
 1. M * N\<^sup>\<star> $$ (i, j) = cnj (\<Sum>k<dim_row N. M $$ (i, k) * N $$ (k, j))
[PROOF STEP]
using assms cpx_mat_cnj_def index_mat times_mat_def scalar_prod_def row_def col_def
dim_row_of_cjn_prod dim_col_of_cjn_prod
[PROOF STATE]
proof (prove)
using this:
i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>)
j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)
dim_col M = dim_row N
?M\<^sup>\<star> \<equiv> mat (dim_row ?M) (dim_col ?M) (\<lambda>(i, j). cnj (?M $$ (i, j)))
\<lbrakk>?i < ?nr; ?j < ?nc\<rbrakk> \<Longrightarrow> mat ?nr ?nc ?f $$ (?i, ?j) = ?f (?i, ?j)
\<lbrakk>?i < ?nr; ?j < ?nc\<rbrakk> \<Longrightarrow> mat\<^sub>r ?nr ?nc ?g $$ (?i, ?j) = ?g ?i $ ?j
?A * ?B \<equiv> mat (dim_row ?A) (dim_col ?B) (\<lambda>(i, j). row ?A i \<bullet> col ?B j)
?v \<bullet> ?w \<equiv> \<Sum>i = 0..<dim_vec ?w. ?v $ i * ?w $ i
row ?A ?i = vec (dim_col ?A) (\<lambda>j. ?A $$ (?i, j))
col ?A ?j = vec (dim_row ?A) (\<lambda>i. ?A $$ (i, ?j))
dim_row (?M\<^sup>\<star> * ?N\<^sup>\<star>) = dim_row ?M
dim_col (?M\<^sup>\<star> * ?N\<^sup>\<star>) = dim_col ?N

goal (1 subgoal):
 1. M * N\<^sup>\<star> $$ (i, j) = cnj (\<Sum>k<dim_row N. M $$ (i, k) * N $$ (k, j))
[PROOF STEP]
by (smt case_prod_conv dim_col index_mult_mat(2) index_mult_mat(3) index_vec lessThan_atLeast0
        lessThan_iff sum.cong)
[PROOF STATE]
proof (state)
this:
M * N\<^sup>\<star> $$ (i, j) = cnj (\<Sum>k<dim_row N. M $$ (i, k) * N $$ (k, j))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>); j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)\<rbrakk> \<Longrightarrow> M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M * N\<^sup>\<star> $$ (i, j) = cnj (\<Sum>k<dim_row N. M $$ (i, k) * N $$ (k, j))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>); j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)\<rbrakk> \<Longrightarrow> M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
[PROOF STEP]
have "\<dots> = (\<Sum>k<(dim_row N). cnj(M $$ (i,k)) * cnj(N $$ (k,j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (\<Sum>k<dim_row N. M $$ (i, k) * N $$ (k, j)) = (\<Sum>k<dim_row N. cnj (M $$ (i, k)) * cnj (N $$ (k, j)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cnj (\<Sum>k<dim_row N. M $$ (i, k) * N $$ (k, j)) = (\<Sum>k<dim_row N. cnj (M $$ (i, k)) * cnj (N $$ (k, j)))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>); j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)\<rbrakk> \<Longrightarrow> M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cnj (\<Sum>k<dim_row N. M $$ (i, k) * N $$ (k, j)) = (\<Sum>k<dim_row N. cnj (M $$ (i, k)) * cnj (N $$ (k, j)))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>); j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)\<rbrakk> \<Longrightarrow> M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
[PROOF STEP]
have "((M\<^sup>\<star>) * (N\<^sup>\<star>)) $$ (i,j) =
    (\<Sum>k<(dim_row N). cnj(M $$ (i,k)) * cnj(N $$ (k,j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j) = (\<Sum>k<dim_row N. cnj (M $$ (i, k)) * cnj (N $$ (k, j)))
[PROOF STEP]
using assms a1 a2 cpx_mat_cnj_def index_mat times_mat_def scalar_prod_def row_def col_def
[PROOF STATE]
proof (prove)
using this:
dim_col M = dim_row N
i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>)
j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)
?M\<^sup>\<star> \<equiv> mat (dim_row ?M) (dim_col ?M) (\<lambda>(i, j). cnj (?M $$ (i, j)))
\<lbrakk>?i < ?nr; ?j < ?nc\<rbrakk> \<Longrightarrow> mat ?nr ?nc ?f $$ (?i, ?j) = ?f (?i, ?j)
\<lbrakk>?i < ?nr; ?j < ?nc\<rbrakk> \<Longrightarrow> mat\<^sub>r ?nr ?nc ?g $$ (?i, ?j) = ?g ?i $ ?j
?A * ?B \<equiv> mat (dim_row ?A) (dim_col ?B) (\<lambda>(i, j). row ?A i \<bullet> col ?B j)
?v \<bullet> ?w \<equiv> \<Sum>i = 0..<dim_vec ?w. ?v $ i * ?w $ i
row ?A ?i = vec (dim_col ?A) (\<lambda>j. ?A $$ (?i, j))
col ?A ?j = vec (dim_row ?A) (\<lambda>i. ?A $$ (i, ?j))

goal (1 subgoal):
 1. (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j) = (\<Sum>k<dim_row N. cnj (M $$ (i, k)) * cnj (N $$ (k, j)))
[PROOF STEP]
by (smt case_prod_conv dim_col dim_col_mat(1) dim_row_mat(1) index_vec lessThan_atLeast0
        lessThan_iff sum.cong)
[PROOF STATE]
proof (state)
this:
(M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j) = (\<Sum>k<dim_row N. cnj (M $$ (i, k)) * cnj (N $$ (k, j)))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (M\<^sup>\<star> * N\<^sup>\<star>); j < dim_col (M\<^sup>\<star> * N\<^sup>\<star>)\<rbrakk> \<Longrightarrow> M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j) = M * N\<^sup>\<star> $$ (i, j)
[PROOF STEP]
show "(M * N)\<^sup>\<star> $$ (i, j) = ((M\<^sup>\<star>) * (N\<^sup>\<star>)) $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
(M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j) = M * N\<^sup>\<star> $$ (i, j)

goal (1 subgoal):
 1. M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
M * N\<^sup>\<star> $$ (i, j) = (M\<^sup>\<star> * N\<^sup>\<star>) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arcs_undir_G_eq_2vertsG:
  "\<lbrakk>undirected_tree G; Suc n = card (verts G)\<rbrakk> \<Longrightarrow> card (arcs G) = 2 * (card (verts G) - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>undirected_tree G; Suc n = card (verts G)\<rbrakk> \<Longrightarrow> card (arcs G) = 2 * (card (verts G) - 1)
[PROOF STEP]
using arcs_graph_G_ge_2vertsG undirected_tree.acyclic undirected_tree.axioms(1)
    undirected_tree.connected
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>graph G; Digraph_Component.connected G; Suc n = card (verts G)\<rbrakk> \<Longrightarrow> 2 * (card (verts G) - 1) \<le> card (arcs G)
undirected_tree ?G \<Longrightarrow> card (arcs ?G) \<le> 2 * (card (verts ?G) - 1)
undirected_tree ?G \<Longrightarrow> graph ?G
undirected_tree ?G \<Longrightarrow> Digraph_Component.connected ?G

goal (1 subgoal):
 1. \<lbrakk>undirected_tree G; Suc n = card (verts G)\<rbrakk> \<Longrightarrow> card (arcs G) = 2 * (card (verts G) - 1)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma fps_divide_deriv:
  assumes "b dvd (a :: 'a :: field fps)"
  shows   "fps_deriv (a / b) = (fps_deriv a * b - a * fps_deriv b) / b^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv (a / b) = (fps_deriv a * b - a * fps_deriv b) / b\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_deriv (a / b) = (fps_deriv a * b - a * fps_deriv b) / b\<^sup>2
[PROOF STEP]
have eq_divide_imp: "c \<noteq> 0 \<Longrightarrow> a * c = b \<Longrightarrow> a = b div c" for a b c :: "'a :: field fps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<noteq> 0; a * c = b\<rbrakk> \<Longrightarrow> a = b / c
[PROOF STEP]
by (drule sym) (simp add: mult.assoc)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?c \<noteq> 0; ?a * ?c = ?b\<rbrakk> \<Longrightarrow> ?a = ?b / ?c

goal (1 subgoal):
 1. fps_deriv (a / b) = (fps_deriv a * b - a * fps_deriv b) / b\<^sup>2
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
b dvd a
[PROOF STEP]
have "a = a / b * b"
[PROOF STATE]
proof (prove)
using this:
b dvd a

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

goal (1 subgoal):
 1. fps_deriv (a / b) = (fps_deriv a * b - a * fps_deriv b) / b\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a = a / b * b

goal (1 subgoal):
 1. fps_deriv (a / b) = (fps_deriv a * b - a * fps_deriv b) / b\<^sup>2
[PROOF STEP]
have "fps_deriv (a / b * b) = fps_deriv (a / b) * b + a / b * fps_deriv b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv (a / b * b) = fps_deriv (a / b) * b + a / b * fps_deriv b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_deriv (a / b * b) = fps_deriv (a / b) * b + a / b * fps_deriv b

goal (1 subgoal):
 1. fps_deriv (a / b) = (fps_deriv a * b - a * fps_deriv b) / b\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fps_deriv a = fps_deriv (a / b) * b + a / b * fps_deriv b
[PROOF STEP]
have "fps_deriv (a / b) * b^2 = fps_deriv a * b - a * fps_deriv b"
[PROOF STATE]
proof (prove)
using this:
fps_deriv a = fps_deriv (a / b) * b + a / b * fps_deriv b

goal (1 subgoal):
 1. fps_deriv (a / b) * b\<^sup>2 = fps_deriv a * b - a * fps_deriv b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
fps_deriv a = fps_deriv (a / b) * b + a / b * fps_deriv b
b dvd a

goal (1 subgoal):
 1. fps_deriv (a / b) * b\<^sup>2 = fps_deriv a * b - a * fps_deriv b
[PROOF STEP]
by (simp add: power2_eq_square algebra_simps)
[PROOF STATE]
proof (state)
this:
fps_deriv (a / b) * b\<^sup>2 = fps_deriv a * b - a * fps_deriv b

goal (1 subgoal):
 1. fps_deriv (a / b) = (fps_deriv a * b - a * fps_deriv b) / b\<^sup>2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
fps_deriv (a / b) * b\<^sup>2 = fps_deriv a * b - a * fps_deriv b

goal (1 subgoal):
 1. fps_deriv (a / b) = (fps_deriv a * b - a * fps_deriv b) / b\<^sup>2
[PROOF STEP]
by (cases "b = 0") (simp_all add: eq_divide_imp)
[PROOF STATE]
proof (state)
this:
fps_deriv (a / b) = (fps_deriv a * b - a * fps_deriv b) / b\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma count_take_less: assumes "n\<le>m"
  shows "count_list (take n cs) x \<le> count_list (take m cs) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list (take n cs) x \<le> count_list (take m cs) x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. count_list (take n cs) x \<le> count_list (take m cs) x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
n \<le> m
[PROOF STEP]
have "count_list (take n cs) x = count_list (take n (take m cs)) x"
[PROOF STATE]
proof (prove)
using this:
n \<le> m

goal (1 subgoal):
 1. count_list (take n cs) x = count_list (take n (take m cs)) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
count_list (take n cs) x = count_list (take n (take m cs)) x

goal (1 subgoal):
 1. count_list (take n cs) x \<le> count_list (take m cs) x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_list (take n cs) x = count_list (take n (take m cs)) x

goal (1 subgoal):
 1. count_list (take n cs) x \<le> count_list (take m cs) x
[PROOF STEP]
have "\<dots> \<le> count_list (take n (take m cs) @ drop n (take m cs)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list (take n (take m cs)) x \<le> count_list (take n (take m cs) @ drop n (take m cs)) x
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
count_list (take n (take m cs)) x \<le> count_list (take n (take m cs) @ drop n (take m cs)) x

goal (1 subgoal):
 1. count_list (take n cs) x \<le> count_list (take m cs) x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_list (take n (take m cs)) x \<le> count_list (take n (take m cs) @ drop n (take m cs)) x

goal (1 subgoal):
 1. count_list (take n cs) x \<le> count_list (take m cs) x
[PROOF STEP]
have "\<dots> = count_list (take m cs) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list (take n (take m cs) @ drop n (take m cs)) x = count_list (take m cs) x
[PROOF STEP]
by(simp only: append_take_drop_id)
[PROOF STATE]
proof (state)
this:
count_list (take n (take m cs) @ drop n (take m cs)) x = count_list (take m cs) x

goal (1 subgoal):
 1. count_list (take n cs) x \<le> count_list (take m cs) x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
count_list (take n cs) x \<le> count_list (take m cs) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count_list (take n cs) x \<le> count_list (take m cs) x

goal (1 subgoal):
 1. count_list (take n cs) x \<le> count_list (take m cs) x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
count_list (take n cs) x \<le> count_list (take m cs) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Arg_eq_Im_Ln:
  assumes "z \<noteq> 0" shows "Arg z = Im (Ln z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg z = Im (Ln z)
[PROOF STEP]
proof (rule cis_Arg_unique)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. sgn z = cis (Im (Ln z))
 2. - pi < Im (Ln z)
 3. Im (Ln z) \<le> pi
[PROOF STEP]
show "sgn z = cis (Im (Ln z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn z = cis (Im (Ln z))
[PROOF STEP]
by (metis assms exp_Ln exp_eq_polar nonzero_mult_div_cancel_left norm_eq_zero
              norm_exp_eq_Re of_real_eq_0_iff sgn_eq)
[PROOF STATE]
proof (state)
this:
sgn z = cis (Im (Ln z))

goal (2 subgoals):
 1. - pi < Im (Ln z)
 2. Im (Ln z) \<le> pi
[PROOF STEP]
show "- pi < Im (Ln z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - pi < Im (Ln z)
[PROOF STEP]
by (simp add: assms mpi_less_Im_Ln)
[PROOF STATE]
proof (state)
this:
- pi < Im (Ln z)

goal (1 subgoal):
 1. Im (Ln z) \<le> pi
[PROOF STEP]
show "Im (Ln z) \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (Ln z) \<le> pi
[PROOF STEP]
by (simp add: Im_Ln_le_pi assms)
[PROOF STATE]
proof (state)
this:
Im (Ln z) \<le> pi

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_intv_frac_decomp:
  fixes c :: nat and d :: real
  assumes "c < d" "d < c + 1"
  shows "d = c + frac d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d = real c + frac d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. d = real c + frac d
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
real c < d
d < real (c + 1)
[PROOF STEP]
have "int c = \<lfloor>d\<rfloor>"
[PROOF STATE]
proof (prove)
using this:
real c < d
d < real (c + 1)

goal (1 subgoal):
 1. int c = \<lfloor>d\<rfloor>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
int c = \<lfloor>d\<rfloor>

goal (1 subgoal):
 1. d = real c + frac d
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
int c = \<lfloor>d\<rfloor>

goal (1 subgoal):
 1. d = real c + frac d
[PROOF STEP]
by (simp add: frac_def)
[PROOF STATE]
proof (state)
this:
d = real c + frac d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ceiling_one [simp]: "\<lceil>1\<rceil> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>1::'a\<rceil> = 1
[PROOF STEP]
using ceiling_of_int [of 1]
[PROOF STATE]
proof (prove)
using this:
\<lceil>of_int 1\<rceil> = 1

goal (1 subgoal):
 1. \<lceil>1::'a\<rceil> = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma sum_of_cubes: "4 * (\<Sum>i=0..n. i * i * i) = n * n * Suc n * Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 * (\<Sum>i = 0..n. i * i * i) = n * n * Suc n * Suc n
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma col_scalar_prod_as_sum:
assumes "dim_vec v = dim_row A"
shows "col A j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i,j) * v $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col A j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_row A

goal (1 subgoal):
 1. col A j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)
[PROOF STEP]
unfolding col_def scalar_prod_def
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_row A

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec v. vec (dim_row A) (\<lambda>i. A $$ (i, j)) $ i * v $ i) = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)
[PROOF STEP]
by transfer' (rule sum.cong, transfer', auto simp add: mk_vec_def mk_mat_def )


[STATEMENT]
lemma DERIV_gf_U:
  fixes z :: real assumes z: "0 < z" "z < 1"
  shows "DERIV (gf_U x y) z :> gf_U' x y z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (gf_U x y has_real_derivative gf_U' x y z) (at z)
[PROOF STEP]
unfolding gf_U_def[abs_def]  gf_U'_def real_scaleR_def u_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>z. \<Sum>n. u x y n * z ^ Suc n) has_real_derivative (\<Sum>n. u x y n * real (Suc n) * z ^ n)) (at z)
[PROOF STEP]
using z
[PROOF STATE]
proof (prove)
using this:
0 < z
z < 1

goal (1 subgoal):
 1. ((\<lambda>z. \<Sum>n. u x y n * z ^ Suc n) has_real_derivative (\<Sum>n. u x y n * real (Suc n) * z ^ n)) (at z)
[PROOF STEP]
by (intro DERIV_power_series'[where R=1] summable_gf_U') auto


[STATEMENT]
lemma minus_log_convex:
  fixes b :: real
  assumes "b > 1"
  shows "convex_on {0 <..} (\<lambda> x. - log b x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_on {0<..} (\<lambda>x. - log b x)
[PROOF STEP]
using assms concave_on_def log_concave
[PROOF STATE]
proof (prove)
using this:
1 < b
concave_on ?S ?f \<equiv> convex_on ?S (\<lambda>x. - ?f x)
1 < ?b \<Longrightarrow> concave_on {0<..} (log ?b)

goal (1 subgoal):
 1. convex_on {0<..} (\<lambda>x. - log b x)
[PROOF STEP]
by blast


[STATEMENT]
lemma card_bijections_domain_permutation:
  assumes "finite A" "finite B"
  shows "card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_permutation A B) = iverson (card A = card B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_permutation A B) = iverson (card A = card B)
[PROOF STEP]
using assms card_bijections_domain_permutation_eq_0 card_bijections_domain_permutation_eq_1
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
card ?A \<noteq> card ?B \<Longrightarrow> card ({f \<in> ?A \<rightarrow>\<^sub>E ?B. bij_betw f ?A ?B} // domain_permutation ?A ?B) = 0
\<lbrakk>finite ?A; finite ?B; card ?A = card ?B\<rbrakk> \<Longrightarrow> card ({f \<in> ?A \<rightarrow>\<^sub>E ?B. bij_betw f ?A ?B} // domain_permutation ?A ?B) = 1

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_permutation A B) = iverson (card A = card B)
[PROOF STEP]
unfolding iverson_def
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
card ?A \<noteq> card ?B \<Longrightarrow> card ({f \<in> ?A \<rightarrow>\<^sub>E ?B. bij_betw f ?A ?B} // domain_permutation ?A ?B) = 0
\<lbrakk>finite ?A; finite ?B; card ?A = card ?B\<rbrakk> \<Longrightarrow> card ({f \<in> ?A \<rightarrow>\<^sub>E ?B. bij_betw f ?A ?B} // domain_permutation ?A ?B) = 1

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_permutation A B) = (if card A = card B then 1 else 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_right_invertible_independent_rows:
  fixes A :: "'a::{field}^'n^'m"
  shows "(\<exists>(B::'a^'m^'n). A ** B = mat 1) \<longleftrightarrow>
    (\<forall>c. sum (\<lambda>i. c i *s row i A) (UNIV :: 'm set) = 0 \<longrightarrow> (\<forall>i. c i = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (\<forall>c. (\<Sum>i\<in>UNIV. c i *s row i A) = 0 \<longrightarrow> (\<forall>i. c i = (0::'a)))
[PROOF STEP]
unfolding left_invertible_transpose[symmetric]
    matrix_left_invertible_independent_columns
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>c. (\<Sum>i\<in>UNIV. c i *s column i (Finite_Cartesian_Product.transpose A)) = 0 \<longrightarrow> (\<forall>i. c i = (0::'a))) = (\<forall>c. (\<Sum>i\<in>UNIV. c i *s row i A) = 0 \<longrightarrow> (\<forall>i. c i = (0::'a)))
[PROOF STEP]
by (simp add:)


[STATEMENT]
lemma powr_nat_bounds_ge_neg:
  assumes "powr_nat (abs x) y \<le> u"
  shows   "powr_nat x y \<ge> -u" "powr_nat x y \<le> u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - u \<le> powr_nat x y &&& powr_nat x y \<le> u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. - u \<le> powr_nat x y
 2. powr_nat x y \<le> u
[PROOF STEP]
have "abs (powr_nat x y) \<le> powr_nat (abs x) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>powr_nat x y\<bar> \<le> powr_nat \<bar>x\<bar> y
[PROOF STEP]
by (rule abs_powr_nat_le)
[PROOF STATE]
proof (state)
this:
\<bar>powr_nat x y\<bar> \<le> powr_nat \<bar>x\<bar> y

goal (2 subgoals):
 1. - u \<le> powr_nat x y
 2. powr_nat x y \<le> u
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>powr_nat x y\<bar> \<le> powr_nat \<bar>x\<bar> y

goal (2 subgoals):
 1. - u \<le> powr_nat x y
 2. powr_nat x y \<le> u
[PROOF STEP]
have "\<dots> \<le> u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. powr_nat \<bar>x\<bar> y \<le> u
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
powr_nat \<bar>x\<bar> y \<le> u

goal (1 subgoal):
 1. powr_nat \<bar>x\<bar> y \<le> u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
powr_nat \<bar>x\<bar> y \<le> u

goal (2 subgoals):
 1. - u \<le> powr_nat x y
 2. powr_nat x y \<le> u
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>powr_nat x y\<bar> \<le> u
[PROOF STEP]
show "powr_nat x y \<ge> -u" "powr_nat x y \<le> u"
[PROOF STATE]
proof (prove)
using this:
\<bar>powr_nat x y\<bar> \<le> u

goal (1 subgoal):
 1. - u \<le> powr_nat x y &&& powr_nat x y \<le> u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- u \<le> powr_nat x y
powr_nat x y \<le> u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_zero_divisor_mult:
  fixes a b :: "'a :: {ab_semigroup_mult, mult_zero}"
  assumes "\<not> zero_divisor (a * b)"
  shows "\<not> zero_divisor a" and "\<not> zero_divisor b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> zero_divisor a &&& \<not> zero_divisor b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> zero_divisor (a * b)

goal (1 subgoal):
 1. \<not> zero_divisor a &&& \<not> zero_divisor b
[PROOF STEP]
by (auto dest: zero_divisor_mult_right zero_divisor_mult_left)


[STATEMENT]
lemma DERIV_cot [simp]: "sin x \<noteq> 0 \<Longrightarrow> DERIV cot x :> -inverse ((sin x)\<^sup>2)"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin x \<noteq> (0::'a) \<Longrightarrow> (cot has_field_derivative - inverse ((sin x)\<^sup>2)) (at x)
[PROOF STEP]
unfolding cot_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin x \<noteq> (0::'a) \<Longrightarrow> ((\<lambda>x. cos x / sin x) has_field_derivative - inverse ((sin x)\<^sup>2)) (at x)
[PROOF STEP]
using cos_squared_eq[of x]
[PROOF STATE]
proof (prove)
using this:
(cos x)\<^sup>2 = (1::'a) - (sin x)\<^sup>2

goal (1 subgoal):
 1. sin x \<noteq> (0::'a) \<Longrightarrow> ((\<lambda>x. cos x / sin x) has_field_derivative - inverse ((sin x)\<^sup>2)) (at x)
[PROOF STEP]
by (auto intro!: derivative_eq_intros) (simp add: divide_inverse power2_eq_square)


[STATEMENT]
lemma prime_factorization_unique':
  assumes "\<forall>p \<in># M. prime p" "\<forall>p \<in># N. prime p" "(\<Prod>i \<in># M. i) = (\<Prod>i \<in># N. i)"
  shows   "M = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M = N
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M = N
[PROOF STEP]
have "prime_factorization (\<Prod>i \<in># M. i) = prime_factorization (\<Prod>i \<in># N. i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (\<Prod>i\<in>#M. i) = prime_factorization (\<Prod>i\<in>#N. i)
[PROOF STEP]
by (simp only: assms)
[PROOF STATE]
proof (state)
this:
prime_factorization (\<Prod>i\<in>#M. i) = prime_factorization (\<Prod>i\<in>#N. i)

goal (1 subgoal):
 1. M = N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factorization (\<Prod>i\<in>#M. i) = prime_factorization (\<Prod>i\<in>#N. i)

goal (1 subgoal):
 1. M = N
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<forall>p\<in>#M. prime p
\<forall>p\<in>#N. prime p
(\<Prod>i\<in>#M. i) = (\<Prod>i\<in>#N. i)
[PROOF STEP]
have "prime_factorization (\<Prod>i \<in># M. i) = M"
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>#M. prime p
\<forall>p\<in>#N. prime p
(\<Prod>i\<in>#M. i) = (\<Prod>i\<in>#N. i)

goal (1 subgoal):
 1. prime_factorization (\<Prod>i\<in>#M. i) = M
[PROOF STEP]
by (subst prime_factorization_prod_mset_primes) simp_all
[PROOF STATE]
proof (state)
this:
prime_factorization (\<Prod>i\<in>#M. i) = M

goal (1 subgoal):
 1. M = N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factorization (\<Prod>i\<in>#M. i) = M

goal (1 subgoal):
 1. M = N
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<forall>p\<in>#M. prime p
\<forall>p\<in>#N. prime p
(\<Prod>i\<in>#M. i) = (\<Prod>i\<in>#N. i)
[PROOF STEP]
have "prime_factorization (\<Prod>i \<in># N. i) = N"
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>#M. prime p
\<forall>p\<in>#N. prime p
(\<Prod>i\<in>#M. i) = (\<Prod>i\<in>#N. i)

goal (1 subgoal):
 1. prime_factorization (\<Prod>i\<in>#N. i) = N
[PROOF STEP]
by (subst prime_factorization_prod_mset_primes) simp_all
[PROOF STATE]
proof (state)
this:
prime_factorization (\<Prod>i\<in>#N. i) = N

goal (1 subgoal):
 1. M = N
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
M = N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
M = N

goal (1 subgoal):
 1. M = N
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
M = N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iT_Plus_mem_iff: "x \<in> (I \<oplus> k) = (k \<le> x \<and> (x - k) \<in> I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> I \<oplus> k) = (k \<le> x \<and> x - k \<in> I)
[PROOF STEP]
apply (simp add: iT_Plus_def image_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>xa\<in>I. x = xa + k) = (k \<le> x \<and> x - k \<in> I)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<exists>xa\<in>I. x = xa + k \<Longrightarrow> k \<le> x \<and> x - k \<in> I
 2. k \<le> x \<and> x - k \<in> I \<Longrightarrow> \<exists>xa\<in>I. x = xa + k
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> x \<and> x - k \<in> I \<Longrightarrow> \<exists>xa\<in>I. x = xa + k
[PROOF STEP]
apply (rule_tac x="x - k" in bexI, simp+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem kleene_qfp_is_dual_extreme:
  assumes comp: "omega_complete A (\<sqsubseteq>)"
    and cont: "omega_continuous A (\<sqsubseteq>) f" and bA: "b \<in> A" and bot: "\<forall>x \<in> A. b \<sqsubseteq> x"
  shows "extreme_bound A (\<sqsubseteq>) {f^n b |. n :: nat} = extreme {s \<in> A. f s \<sim> s} (\<sqsupseteq>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extreme_bound A (\<sqsubseteq>) {f^n b |. n} = extreme {s \<in> A. f s \<sim> s} (\<lambda>x y. y \<sqsubseteq> x)
[PROOF STEP]
apply (rule kleene_qfp_iff_least[OF bA bot cont comp])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>q\<in>A. \<forall>x\<in>A. f q \<sim> q \<longrightarrow> x \<sqsubseteq> f q \<longrightarrow> x \<sqsubseteq> q
 2. \<forall>p\<in>A. \<forall>q\<in>A. \<forall>x\<in>A. p \<sim> q \<longrightarrow> q \<sqsubseteq> x \<longrightarrow> p \<sqsubseteq> x
[PROOF STEP]
using cont[THEN omega_continuousDdom]
[PROOF STATE]
proof (prove)
using this:
f ` A \<subseteq> A

goal (2 subgoals):
 1. \<forall>q\<in>A. \<forall>x\<in>A. f q \<sim> q \<longrightarrow> x \<sqsubseteq> f q \<longrightarrow> x \<sqsubseteq> q
 2. \<forall>p\<in>A. \<forall>q\<in>A. \<forall>x\<in>A. p \<sim> q \<longrightarrow> q \<sqsubseteq> x \<longrightarrow> p \<sqsubseteq> x
[PROOF STEP]
by (auto dest: sym_order_trans order_sym_trans)


[STATEMENT]
lemma measure_closure:
  assumes "bounded S" and neg: "negligible (frontier S)"
  shows "measure lebesgue (closure S) = measure lebesgue S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (closure S) = Sigma_Algebra.measure lebesgue S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (closure S) = Sigma_Algebra.measure lebesgue S
[PROOF STEP]
have "measure lebesgue (frontier S) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (frontier S) = 0
[PROOF STEP]
by (metis neg negligible_imp_measure0)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure lebesgue (frontier S) = 0

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (closure S) = Sigma_Algebra.measure lebesgue S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sigma_Algebra.measure lebesgue (frontier S) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure lebesgue (frontier S) = 0

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (closure S) = Sigma_Algebra.measure lebesgue S
[PROOF STEP]
by (metis assms lmeasurable_iff_integrable_on eq_iff_diff_eq_0 has_integral_interior integrable_on_def integral_unique lmeasurable_interior lmeasure_integral measure_frontier)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure lebesgue (closure S) = Sigma_Algebra.measure lebesgue S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma or_dfa_accepts:
  assumes "wf_dfa M n" and "wf_dfa N n"
  and "list_all (is_alph n) bs"
  shows "dfa_accepts (or_dfa M N) bs = (dfa_accepts M bs \<or> dfa_accepts N bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dfa_accepts (or_dfa M N) bs = (dfa_accepts M bs \<or> dfa_accepts N bs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wf_dfa M n
wf_dfa N n
list_all (is_alph n) bs

goal (1 subgoal):
 1. dfa_accepts (or_dfa M N) bs = (dfa_accepts M bs \<or> dfa_accepts N bs)
[PROOF STEP]
by (simp add: binop_dfa_accepts or_dfa_def)


[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: inj_mult)


[STATEMENT]
lemma mset_set_Union:
  "finite A \<Longrightarrow> finite B \<Longrightarrow> A \<inter> B = {} \<Longrightarrow> mset_set (A \<union> B) = mset_set A + mset_set B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B; A \<inter> B = {}\<rbrakk> \<Longrightarrow> mset_set (A \<union> B) = mset_set A + mset_set B
[PROOF STEP]
by (induction A rule: finite_induct) auto


[STATEMENT]
lemma card_minus_fset:
  shows "card_fset (A - B) = card_fset A - card_fset (A |\<inter>| B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_fset (A - B) = card_fset A - card_fset (A |\<inter>| B)
[PROOF STEP]
by (simp add: card_fset card_Diff_subset_Int)


[STATEMENT]
lemma differentiable_mult [simp, derivative_intros]:
  fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_algebra"
  shows "f differentiable (at x within s) \<Longrightarrow> g differentiable (at x within s) \<Longrightarrow>
    (\<lambda>x. f x * g x) differentiable (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable at x within s; g differentiable at x within s\<rbrakk> \<Longrightarrow> (\<lambda>x. f x * g x) differentiable at x within s
[PROOF STEP]
unfolding differentiable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>D. (f has_derivative D) (at x within s); \<exists>D. (g has_derivative D) (at x within s)\<rbrakk> \<Longrightarrow> \<exists>D. ((\<lambda>x. f x * g x) has_derivative D) (at x within s)
[PROOF STEP]
by (blast intro: has_derivative_mult)


[STATEMENT]
lemma open_Collect_less_Int:
  fixes f g :: "'a::topological_space \<Rightarrow> real"
  assumes f: "continuous_on s f"
    and g: "continuous_on s g"
  shows "\<exists>A. open A \<and> A \<inter> s = {x\<in>s. f x < g x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>A. open A \<and> A \<inter> s = {x \<in> s. f x < g x}
[PROOF STEP]
using open_Collect_positive[OF continuous_on_diff[OF g f]]
[PROOF STATE]
proof (prove)
using this:
\<exists>A. open A \<and> A \<inter> s = {x \<in> s. 0 < g x - f x}

goal (1 subgoal):
 1. \<exists>A. open A \<and> A \<inter> s = {x \<in> s. f x < g x}
[PROOF STEP]
by (simp add: field_simps)


[STATEMENT]
lemma (in strategic_space_2p) U\<^sub>B_is_gate:
  shows "gate 1 U\<^sub>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gate 1 (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = 2 ^ 1
 2. square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
 3. unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
show "dim_row U\<^sub>B = 2^1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = 2 ^ 1
[PROOF STEP]
using mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = 2 ^ 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = 2 ^ 1

goal (2 subgoals):
 1. square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
 2. unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = 2 ^ 1

goal (2 subgoals):
 1. square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
 2. unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
show "square_mat U\<^sub>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
using mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])

goal (1 subgoal):
 1. unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = 2 ^ 1
square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
show "unitary U\<^sub>B"
[PROOF STATE]
proof (prove)
using this:
dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = 2 ^ 1
square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])

goal (1 subgoal):
 1. unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
using mat_of_cols_list_def unitary_def U\<^sub>B_cnj_times_U\<^sub>B U\<^sub>B_times_U\<^sub>B_cnj
[PROOF STATE]
proof (prove)
using this:
dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = 2 ^ 1
square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)
unitary ?M \<equiv> ?M\<^sup>\<dagger> * ?M = 1\<^sub>m (dim_col ?M) \<and> ?M * ?M\<^sup>\<dagger> = 1\<^sub>m (dim_row ?M)
Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]] = 1\<^sub>m 2
Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> = 1\<^sub>m 2

goal (1 subgoal):
 1. unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_poly_sum_commute:
  assumes "h 0 = 0" "\<forall>p q. h (p + q) = h p + h q"
  shows "sum (\<lambda>i. map_poly h (f i)) S = map_poly h (sum f S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>S. map_poly h (f i)) = map_poly h (sum f S)
[PROOF STEP]
apply(induct S rule: infinite_finite_induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> (\<Sum>i\<in>A. map_poly h (f i)) = map_poly h (sum f A)
 2. (\<Sum>i\<in>{}. map_poly h (f i)) = map_poly h (sum f {})
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<Sum>i\<in>F. map_poly h (f i)) = map_poly h (sum f F)\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. map_poly h (f i)) = map_poly h (sum f (insert x F))
[PROOF STEP]
using map_poly_add[OF assms]
[PROOF STATE]
proof (prove)
using this:
map_poly h (?p + ?q) = map_poly h ?p + map_poly h ?q

goal (3 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> (\<Sum>i\<in>A. map_poly h (f i)) = map_poly h (sum f A)
 2. (\<Sum>i\<in>{}. map_poly h (f i)) = map_poly h (sum f {})
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<Sum>i\<in>F. map_poly h (f i)) = map_poly h (sum f F)\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. map_poly h (f i)) = map_poly h (sum f (insert x F))
[PROOF STEP]
by auto