[STATEMENT]
lemma calc_ideal_point2_on_circline:
  assumes "(z1, z2) = calc_ideal_point2_cvec A B" "is_real A" "(cmod B)\<^sup>2 > (cmod A)\<^sup>2"
  shows "A*z1*cnj z1 + B*cnj z1*z2 + cnj B*z1*cnj z2 + A*z2*cnj z2 = 0" (is "?lhs = 0")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * z1 * cnj z1 + B * cnj z1 * z2 + cnj B * z1 * cnj z2 + A * z2 * cnj z2 = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A * z1 * cnj z1 + B * cnj z1 * z2 + cnj B * z1 * cnj z2 + A * z2 * cnj z2 = 0
[PROOF STEP]
have "?lhs = A * (z1 * cnj z1 + z2 * cnj z2) + (B * cnj z1 * z2 + cnj B * z1 * cnj z2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * z1 * cnj z1 + B * cnj z1 * z2 + cnj B * z1 * cnj z2 + A * z2 * cnj z2 = A * (z1 * cnj z1 + z2 * cnj z2) + (B * cnj z1 * z2 + cnj B * z1 * cnj z2)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
A * z1 * cnj z1 + B * cnj z1 * z2 + cnj B * z1 * cnj z2 + A * z2 * cnj z2 = A * (z1 * cnj z1 + z2 * cnj z2) + (B * cnj z1 * z2 + cnj B * z1 * cnj z2)

goal (1 subgoal):
 1. A * z1 * cnj z1 + B * cnj z1 * z2 + cnj B * z1 * cnj z2 + A * z2 * cnj z2 = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A * z1 * cnj z1 + B * cnj z1 * z2 + cnj B * z1 * cnj z2 + A * z2 * cnj z2 = A * (z1 * cnj z1 + z2 * cnj z2) + (B * cnj z1 * z2 + cnj B * z1 * cnj z2)

goal (1 subgoal):
 1. A * z1 * cnj z1 + B * cnj z1 * z2 + cnj B * z1 * cnj z2 + A * z2 * cnj z2 = 0
[PROOF STEP]
have "... = 2*A*(B*cnj B)\<^sup>2 + (-2*A*(B*cnj B)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * (z1 * cnj z1 + z2 * cnj z2) + (B * cnj z1 * z2 + cnj B * z1 * cnj z2) = 2 * A * (B * cnj B)\<^sup>2 + - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
using calc_ideal_point2_sq[OF assms]
[PROOF STATE]
proof (prove)
using this:
z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2

goal (1 subgoal):
 1. A * (z1 * cnj z1 + z2 * cnj z2) + (B * cnj z1 * z2 + cnj B * z1 * cnj z2) = 2 * A * (B * cnj B)\<^sup>2 + - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
using calc_ideal_point2_mix[OF assms]
[PROOF STATE]
proof (prove)
using this:
z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2
B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2

goal (1 subgoal):
 1. A * (z1 * cnj z1 + z2 * cnj z2) + (B * cnj z1 * z2 + cnj B * z1 * cnj z2) = 2 * A * (B * cnj B)\<^sup>2 + - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A * (z1 * cnj z1 + z2 * cnj z2) + (B * cnj z1 * z2 + cnj B * z1 * cnj z2) = 2 * A * (B * cnj B)\<^sup>2 + - 2 * A * (B * cnj B)\<^sup>2

goal (1 subgoal):
 1. A * z1 * cnj z1 + B * cnj z1 * z2 + cnj B * z1 * cnj z2 + A * z2 * cnj z2 = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A * z1 * cnj z1 + B * cnj z1 * z2 + cnj B * z1 * cnj z2 + A * z2 * cnj z2 = 2 * A * (B * cnj B)\<^sup>2 + - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A * z1 * cnj z1 + B * cnj z1 * z2 + cnj B * z1 * cnj z2 + A * z2 * cnj z2 = 2 * A * (B * cnj B)\<^sup>2 + - 2 * A * (B * cnj B)\<^sup>2

goal (1 subgoal):
 1. A * z1 * cnj z1 + B * cnj z1 * z2 + cnj B * z1 * cnj z2 + A * z2 * cnj z2 = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A * z1 * cnj z1 + B * cnj z1 * z2 + cnj B * z1 * cnj z2 + A * z2 * cnj z2 = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_polymul:
  assumes "SORT_CONSTRAINT('a::field_char_0)"
    and np: "isnpolyh p n0"
    and nq: "isnpolyh q n1"
  shows "degree (p *\<^sub>p q) \<le> degree p + degree q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Reflected_Multivariate_Polynomial.degree (p *\<^sub>p q) \<le> Reflected_Multivariate_Polynomial.degree p + Reflected_Multivariate_Polynomial.degree q
[PROOF STEP]
using polymul_degreen[OF np nq, where m="0"]  degree_eq_degreen0
[PROOF STATE]
proof (prove)
using this:
0 \<le> min n0 n1 \<Longrightarrow> degreen (p *\<^sub>p q) 0 = (if p = 0\<^sub>p \<or> q = 0\<^sub>p then 0 else degreen p 0 + degreen q 0)
Reflected_Multivariate_Polynomial.degree ?p = degreen ?p 0

goal (1 subgoal):
 1. Reflected_Multivariate_Polynomial.degree (p *\<^sub>p q) \<le> Reflected_Multivariate_Polynomial.degree p + Reflected_Multivariate_Polynomial.degree q
[PROOF STEP]
by simp


[STATEMENT]
lemma rank_mat_mul_left:
  fixes A::"'a::{conjugatable_ordered_field} mat"
  assumes "A \<in> carrier_mat n d"
  assumes "B \<in> carrier_mat d nc"
  shows "vec_space.rank n (A * B) \<le> vec_space.rank d B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_space.rank n (A * B) \<le> vec_space.rank d B
[PROOF STEP]
by (metis (no_types, lifting) Matrix.transpose_transpose assms(1) assms(2) carrier_matD(1) carrier_matD(2) carrier_mat_triv conjugatable_vec_space.rank_conjugate conjugate_transpose_rank index_mult_mat(3) index_transpose_mat(3) transpose_mult vec_space.rank_mat_mul_right)


[STATEMENT]
lemma walras_law:
  assumes "\<And>i. i \<in> agents \<Longrightarrow> local_nonsatiation consumption_set Pr[i]"
  assumes "comp_equilib_endow P X \<E>"
  shows "(\<Sum>i\<in>agents. P \<bullet> (X i)) - (\<Sum>i\<in>agents. P \<bullet> \<E>[i]) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>agents. P \<bullet> X i) - (\<Sum>i\<in>agents. P \<bullet> \<E>[i]) = 0
[PROOF STEP]
using assms walras_law_per_agent
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> agents \<Longrightarrow> local_nonsatiation consumption_set Pr[?i1]
comp_equilib_endow P X \<E>
\<lbrakk>\<And>i. i \<in> agents \<Longrightarrow> local_nonsatiation consumption_set Pr[i]; comp_equilib_endow ?P ?X \<E>\<rbrakk> \<Longrightarrow> \<forall>i\<in>agents. ?P \<bullet> ?X i = ?P \<bullet> \<E>[i]

goal (1 subgoal):
 1. (\<Sum>i\<in>agents. P \<bullet> X i) - (\<Sum>i\<in>agents. P \<bullet> \<E>[i]) = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma deriv_real_sqrt [simp]: "x > 0 \<Longrightarrow> deriv sqrt x = inverse (sqrt x) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> deriv sqrt x = inverse (sqrt x) / 2
[PROOF STEP]
using DERIV_imp_deriv DERIV_real_sqrt
[PROOF STATE]
proof (prove)
using this:
(?f has_field_derivative ?f') (at ?x) \<Longrightarrow> deriv ?f ?x = ?f'
0 < ?x \<Longrightarrow> (sqrt has_real_derivative inverse (sqrt ?x) / 2) (at ?x)

goal (1 subgoal):
 1. 0 < x \<Longrightarrow> deriv sqrt x = inverse (sqrt x) / 2
[PROOF STEP]
by blast


[STATEMENT]
lemma subtuple_rtranclp_intro:
  assumes "\<And>xm ym. R (f xm) (f ym) \<Longrightarrow> subtuple R xm ym"
      and "bij_on_trancl R f"
      and "R\<^sup>*\<^sup>* (f xm) (f ym)"
    shows "subtuple R\<^sup>*\<^sup>* xm ym"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtuple R\<^sup>*\<^sup>* xm ym
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subtuple R\<^sup>*\<^sup>* xm ym
[PROOF STEP]
have "(\<lambda>xm ym. R (f xm) (f ym))\<^sup>*\<^sup>* xm ym"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>xm ym. R (f xm) (f ym))\<^sup>*\<^sup>* xm ym
[PROOF STEP]
apply (insert assms(2) assms(3))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bij_on_trancl R f; R\<^sup>*\<^sup>* (f xm) (f ym)\<rbrakk> \<Longrightarrow> (\<lambda>xm ym. R (f xm) (f ym))\<^sup>*\<^sup>* xm ym
[PROOF STEP]
by (rule reflect_rtranclp; auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>xm ym. R (f xm) (f ym))\<^sup>*\<^sup>* xm ym

goal (1 subgoal):
 1. subtuple R\<^sup>*\<^sup>* xm ym
[PROOF STEP]
with assms(1)
[PROOF STATE]
proof (chain)
picking this:
R (f ?xm) (f ?ym) \<Longrightarrow> subtuple R ?xm ?ym
(\<lambda>xm ym. R (f xm) (f ym))\<^sup>*\<^sup>* xm ym
[PROOF STEP]
have "(subtuple R)\<^sup>*\<^sup>* xm ym"
[PROOF STATE]
proof (prove)
using this:
R (f ?xm) (f ?ym) \<Longrightarrow> subtuple R ?xm ?ym
(\<lambda>xm ym. R (f xm) (f ym))\<^sup>*\<^sup>* xm ym

goal (1 subgoal):
 1. (subtuple R)\<^sup>*\<^sup>* xm ym
[PROOF STEP]
by (metis (mono_tags, lifting) mono_rtranclp)
[PROOF STATE]
proof (state)
this:
(subtuple R)\<^sup>*\<^sup>* xm ym

goal (1 subgoal):
 1. subtuple R\<^sup>*\<^sup>* xm ym
[PROOF STEP]
hence "subtuple R\<^sup>*\<^sup>* xm ym"
[PROOF STATE]
proof (prove)
using this:
(subtuple R)\<^sup>*\<^sup>* xm ym

goal (1 subgoal):
 1. subtuple R\<^sup>*\<^sup>* xm ym
[PROOF STEP]
by (rule rtrancl_to_subtuple)
[PROOF STATE]
proof (state)
this:
subtuple R\<^sup>*\<^sup>* xm ym

goal (1 subgoal):
 1. subtuple R\<^sup>*\<^sup>* xm ym
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
subtuple R\<^sup>*\<^sup>* xm ym

goal (1 subgoal):
 1. subtuple R\<^sup>*\<^sup>* xm ym
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
subtuple R\<^sup>*\<^sup>* xm ym

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powrat_less_cancel:
  "\<lbrakk> x  pow\<^sub>\<rat> r < x  pow\<^sub>\<rat> s; 1 < x \<rbrakk> \<Longrightarrow> r < s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x pow\<^sub>\<rat> r < x pow\<^sub>\<rat> s; 1 < x\<rbrakk> \<Longrightarrow> r < s
[PROOF STEP]
by (metis not_less_iff_gr_or_eq powrat_less_mono)


[STATEMENT]
lemma Hadamard's_inequality_int:
  fixes A::"int mat"
  assumes A: "A \<in> carrier_mat n n"
  shows "\<bar>det A\<bar> \<le> sqrt (of_int (prod_list (map sq_norm (rows A))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<bar>det A\<bar> \<le> sqrt (real_of_int (prod_list (map sq_norm (rows A))))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of_int \<bar>det A\<bar> \<le> sqrt (real_of_int (prod_list (map sq_norm (rows A))))
[PROOF STEP]
let ?A = "map_mat real_of_int A"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of_int \<bar>det A\<bar> \<le> sqrt (real_of_int (prod_list (map sq_norm (rows A))))
[PROOF STEP]
have "\<bar>det A\<bar> = \<bar>det ?A\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<bar>det A\<bar> = \<bar>det (of_int_hom.mat_hom A)\<bar>
[PROOF STEP]
unfolding of_int_hom.hom_det
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<bar>det A\<bar> = \<bar>real_of_int (det A)\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int \<bar>det A\<bar> = \<bar>det (of_int_hom.mat_hom A)\<bar>

goal (1 subgoal):
 1. real_of_int \<bar>det A\<bar> \<le> sqrt (real_of_int (prod_list (map sq_norm (rows A))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int \<bar>det A\<bar> = \<bar>det (of_int_hom.mat_hom A)\<bar>

goal (1 subgoal):
 1. real_of_int \<bar>det A\<bar> \<le> sqrt (real_of_int (prod_list (map sq_norm (rows A))))
[PROOF STEP]
have "\<dots> \<le> sqrt (prod_list (map sq_norm (rows ?A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>det (of_int_hom.mat_hom A)\<bar> \<le> sqrt (prod_list (map sq_norm (rows (of_int_hom.mat_hom A))))
[PROOF STEP]
by (rule Hadamard's_inequality[of ?A n], insert A, auto)
[PROOF STATE]
proof (state)
this:
\<bar>det (of_int_hom.mat_hom A)\<bar> \<le> sqrt (prod_list (map sq_norm (rows (of_int_hom.mat_hom A))))

goal (1 subgoal):
 1. real_of_int \<bar>det A\<bar> \<le> sqrt (real_of_int (prod_list (map sq_norm (rows A))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>det (of_int_hom.mat_hom A)\<bar> \<le> sqrt (prod_list (map sq_norm (rows (of_int_hom.mat_hom A))))

goal (1 subgoal):
 1. real_of_int \<bar>det A\<bar> \<le> sqrt (real_of_int (prod_list (map sq_norm (rows A))))
[PROOF STEP]
have "\<dots> = sqrt (of_int (prod_list (map sq_norm (rows A))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (prod_list (map sq_norm (rows (of_int_hom.mat_hom A)))) = sqrt (real_of_int (prod_list (map sq_norm (rows A))))
[PROOF STEP]
unfolding of_int_hom.hom_prod_list map_map
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (prod_list (map sq_norm (rows (of_int_hom.mat_hom A)))) = sqrt (prod_list (map (real_of_int \<circ> sq_norm) (rows A)))
[PROOF STEP]
by (rule arg_cong[of _ _ "\<lambda> x. sqrt (prod_list x)"], rule nth_equalityI, force,
      auto simp: sq_norm_of_int[symmetric] row_def intro!: arg_cong[of _ _ sq_norm_vec])
[PROOF STATE]
proof (state)
this:
sqrt (prod_list (map sq_norm (rows (of_int_hom.mat_hom A)))) = sqrt (real_of_int (prod_list (map sq_norm (rows A))))

goal (1 subgoal):
 1. real_of_int \<bar>det A\<bar> \<le> sqrt (real_of_int (prod_list (map sq_norm (rows A))))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int \<bar>det A\<bar> \<le> sqrt (real_of_int (prod_list (map sq_norm (rows A))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int \<bar>det A\<bar> \<le> sqrt (real_of_int (prod_list (map sq_norm (rows A))))

goal (1 subgoal):
 1. real_of_int \<bar>det A\<bar> \<le> sqrt (real_of_int (prod_list (map sq_norm (rows A))))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real_of_int \<bar>det A\<bar> \<le> sqrt (real_of_int (prod_list (map sq_norm (rows A))))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_mod_exp_eq_one [simp]:
  "1 mod (2 * 2 ^ n) = (1::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 mod (2 * 2 ^ n) = 1
[PROOF STEP]
using power_gt1 [of 2 n]
[PROOF STATE]
proof (prove)
using this:
(1::?'a1) < (2::?'a1) \<Longrightarrow> (1::?'a1) < (2::?'a1) ^ Suc n

goal (1 subgoal):
 1. 1 mod (2 * 2 ^ n) = 1
[PROOF STEP]
by (auto intro: mod_pos_pos_trivial)


[STATEMENT]
lemma cnj_add_mult_eq_Re: "z * cnj w + cnj z * w = 2 * Re (z * cnj w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z * cnj w + cnj z * w = complex_of_real (2 * Re (z * cnj w))
[PROOF STEP]
by (rule complex_eqI) auto


[STATEMENT]
theorem MM11: "\<turnstile> \<box>[\<not>(P \<and> Q)]_v \<longrightarrow> \<box>[P]_v \<longrightarrow> \<box>[P \<and> \<not>Q]_v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<box>[\<not> (P \<and> Q)]_v \<longrightarrow> \<box>[P]_v \<longrightarrow> \<box>[P \<and> \<not> Q]_v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<turnstile> \<box>[\<not> (P \<and> Q)]_v \<longrightarrow> \<box>[P]_v \<longrightarrow> \<box>[P \<and> \<not> Q]_v
[PROOF STEP]
have "\<turnstile> \<box>[\<not>(P \<and> Q)]_v \<longrightarrow> \<box>[P \<longrightarrow> P \<and> \<not>Q]_v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<box>[\<not> (P \<and> Q)]_v \<longrightarrow> \<box>[P \<longrightarrow> P \<and> \<not> Q]_v
[PROOF STEP]
by (rule M2) auto
[PROOF STATE]
proof (state)
this:
\<turnstile> \<box>[\<not> (P \<and> Q)]_v \<longrightarrow> \<box>[P \<longrightarrow> P \<and> \<not> Q]_v

goal (1 subgoal):
 1. \<turnstile> \<box>[\<not> (P \<and> Q)]_v \<longrightarrow> \<box>[P]_v \<longrightarrow> \<box>[P \<and> \<not> Q]_v
[PROOF STEP]
from this ax4
[PROOF STATE]
proof (chain)
picking this:
\<turnstile> \<box>[\<not> (P \<and> Q)]_v \<longrightarrow> \<box>[P \<longrightarrow> P \<and> \<not> Q]_v
\<turnstile> \<box>[?P \<longrightarrow> ?Q]_?v \<longrightarrow> \<box>[?P]_?v \<longrightarrow> \<box>[?Q]_?v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<turnstile> \<box>[\<not> (P \<and> Q)]_v \<longrightarrow> \<box>[P \<longrightarrow> P \<and> \<not> Q]_v
\<turnstile> \<box>[?P \<longrightarrow> ?Q]_?v \<longrightarrow> \<box>[?P]_?v \<longrightarrow> \<box>[?Q]_?v

goal (1 subgoal):
 1. \<turnstile> \<box>[\<not> (P \<and> Q)]_v \<longrightarrow> \<box>[P]_v \<longrightarrow> \<box>[P \<and> \<not> Q]_v
[PROOF STEP]
by (rule lift_imp_trans)
[PROOF STATE]
proof (state)
this:
\<turnstile> \<box>[\<not> (P \<and> Q)]_v \<longrightarrow> \<box>[P]_v \<longrightarrow> \<box>[P \<and> \<not> Q]_v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem mojmir_accept_iff_token_set_accept:
  "accept \<longleftrightarrow> (\<exists>i < max_rank. finite fail \<and> finite (merge i) \<and> infinite (succeed i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. accept\<^sub>M = (\<exists>i<max_rank. finite fail \<and> finite (local.merge i) \<and> infinite (succeed i))
[PROOF STEP]
using mojmir_accept_token_set_def1 mojmir_accept_token_set_def2
[PROOF STATE]
proof (prove)
using this:
accept\<^sub>M \<Longrightarrow> \<exists>i<max_rank. finite fail \<and> finite (local.merge i) \<and> infinite (succeed i) \<and> (\<forall>j<i. finite (succeed j))
\<lbrakk>finite fail; finite (local.merge ?i); infinite (succeed ?i)\<rbrakk> \<Longrightarrow> accept\<^sub>M

goal (1 subgoal):
 1. accept\<^sub>M = (\<exists>i<max_rank. finite fail \<and> finite (local.merge i) \<and> infinite (succeed i))
[PROOF STEP]
by blast


[STATEMENT]
theorem sum_Stirling_binomial:
  "Stirling (Suc n) (Suc m) = (\<Sum>i = 0..n. Stirling i m * (n choose i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Stirling (Suc n) (Suc m) = (\<Sum>i = 0..n. Stirling i m * (n choose i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Stirling (Suc n) (Suc m) = (\<Sum>i = 0..n. Stirling i m * (n choose i))
[PROOF STEP]
have "real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))
[PROOF STEP]
proof (induction n arbitrary: m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
case (Suc n m)
[PROOF STATE]
proof (state)
this:
real (Stirling (Suc n) (Suc ?m)) = real (\<Sum>i = 0..n. Stirling i ?m * (n choose i))

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
have "real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i)) =
            real (\<Sum>i = 0..n. Stirling (Suc i) m * (Suc n choose Suc i)) + real (Stirling 0 m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i)) = real (\<Sum>i = 0..n. Stirling (Suc i) m * (Suc n choose Suc i)) + real (Stirling 0 m)
[PROOF STEP]
by (subst sum.atLeast0_atMost_Suc_shift) simp_all
[PROOF STATE]
proof (state)
this:
real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i)) = real (\<Sum>i = 0..n. Stirling (Suc i) m * (Suc n choose Suc i)) + real (Stirling 0 m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i)) = real (\<Sum>i = 0..n. Stirling (Suc i) m * (Suc n choose Suc i)) + real (Stirling 0 m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
have "real (\<Sum>i = 0..n. Stirling (Suc i) m * (Suc n choose Suc i)) =
                 real (\<Sum>i = 0..n. (n choose i) * Stirling (Suc i) m) +
                 real (\<Sum>i = 0..n. (n choose Suc i) * Stirling (Suc i) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (\<Sum>i = 0..n. Stirling (Suc i) m * (Suc n choose Suc i)) = real (\<Sum>i = 0..n. (n choose i) * Stirling (Suc i) m) + real (\<Sum>i = 0..n. (n choose Suc i) * Stirling (Suc i) m)
[PROOF STEP]
by (simp add: algebra_simps sum.distrib)
[PROOF STATE]
proof (state)
this:
real (\<Sum>i = 0..n. Stirling (Suc i) m * (Suc n choose Suc i)) = real (\<Sum>i = 0..n. (n choose i) * Stirling (Suc i) m) + real (\<Sum>i = 0..n. (n choose Suc i) * Stirling (Suc i) m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (\<Sum>i = 0..n. Stirling (Suc i) m * (Suc n choose Suc i)) = real (\<Sum>i = 0..n. (n choose i) * Stirling (Suc i) m) + real (\<Sum>i = 0..n. (n choose Suc i) * Stirling (Suc i) m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
have "(\<Sum>i = 0..n. (n choose Suc i) * Stirling (Suc i) m) =
                 (\<Sum>i = Suc 0..Suc n. (n choose i) * Stirling i m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. (n choose Suc i) * Stirling (Suc i) m) = (\<Sum>i = Suc 0..Suc n. (n choose i) * Stirling i m)
[PROOF STEP]
by (subst sum.shift_bounds_cl_Suc_ivl) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. (n choose Suc i) * Stirling (Suc i) m) = (\<Sum>i = Suc 0..Suc n. (n choose i) * Stirling i m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. (n choose Suc i) * Stirling (Suc i) m) = (\<Sum>i = Suc 0..Suc n. (n choose i) * Stirling i m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
have "\<dots> = (\<Sum>i = Suc 0..n. (n choose i) * Stirling i m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = Suc 0..Suc n. (n choose i) * Stirling i m) = (\<Sum>i = Suc 0..n. (n choose i) * Stirling i m)
[PROOF STEP]
by (intro sum.mono_neutral_right) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = Suc 0..Suc n. (n choose i) * Stirling i m) = (\<Sum>i = Suc 0..n. (n choose i) * Stirling i m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = Suc 0..Suc n. (n choose i) * Stirling i m) = (\<Sum>i = Suc 0..n. (n choose i) * Stirling i m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
have "\<dots> = real (\<Sum>i = 0..n.  Stirling i m * (n choose i)) - real (Stirling 0 m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (\<Sum>i = Suc 0..n. (n choose i) * Stirling i m) = real (\<Sum>i = 0..n. Stirling i m * (n choose i)) - real (Stirling 0 m)
[PROOF STEP]
by (simp add: sum.atLeast_Suc_atMost mult_ac)
[PROOF STATE]
proof (state)
this:
real (\<Sum>i = Suc 0..n. (n choose i) * Stirling i m) = real (\<Sum>i = 0..n. Stirling i m * (n choose i)) - real (Stirling 0 m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (\<Sum>i = Suc 0..n. (n choose i) * Stirling i m) = real (\<Sum>i = 0..n. Stirling i m * (n choose i)) - real (Stirling 0 m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
have "real (\<Sum>i = 0..n. Stirling i m * (n choose i)) = real (Stirling (Suc n) (Suc m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (\<Sum>i = 0..n. Stirling i m * (n choose i)) = real (Stirling (Suc n) (Suc m))
[PROOF STEP]
by (rule Suc.IH [symmetric])
[PROOF STATE]
proof (state)
this:
real (\<Sum>i = 0..n. Stirling i m * (n choose i)) = real (Stirling (Suc n) (Suc m))

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (\<Sum>i = 0..n. Stirling i m * (n choose i)) = real (Stirling (Suc n) (Suc m))

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
have "real (\<Sum>i = 0..n. (n choose i) * Stirling (Suc i) m) =
                 real m * real (Stirling (Suc n) (Suc m)) + real (Stirling (Suc n) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (\<Sum>i = 0..n. (n choose i) * Stirling (Suc i) m) = real m * real (Stirling (Suc n) (Suc m)) + real (Stirling (Suc n) m)
[PROOF STEP]
by (cases m; (simp only: Suc.IH, simp add: algebra_simps sum.distrib
                      sum_distrib_left sum_distrib_right))
[PROOF STATE]
proof (state)
this:
real (\<Sum>i = 0..n. (n choose i) * Stirling (Suc i) m) = real m * real (Stirling (Suc n) (Suc m)) + real (Stirling (Suc n) m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (\<Sum>i = 0..n. (n choose i) * Stirling (Suc i) m) = real m * real (Stirling (Suc n) (Suc m)) + real (Stirling (Suc n) m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
have "\<dots> + (real (Stirling (Suc n) (Suc m)) - real (Stirling 0 m)) + real (Stirling 0 m) =
                 real (Suc m * Stirling (Suc n) (Suc m) + Stirling (Suc n) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real m * real (Stirling (Suc n) (Suc m)) + real (Stirling (Suc n) m) + (real (Stirling (Suc n) (Suc m)) - real (Stirling 0 m)) + real (Stirling 0 m) = real (Suc m * Stirling (Suc n) (Suc m) + Stirling (Suc n) m)
[PROOF STEP]
by (simp add: algebra_simps del: Stirling.simps)
[PROOF STATE]
proof (state)
this:
real m * real (Stirling (Suc n) (Suc m)) + real (Stirling (Suc n) m) + (real (Stirling (Suc n) (Suc m)) - real (Stirling 0 m)) + real (Stirling 0 m) = real (Suc m * Stirling (Suc n) (Suc m) + Stirling (Suc n) m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real m * real (Stirling (Suc n) (Suc m)) + real (Stirling (Suc n) m) + (real (Stirling (Suc n) (Suc m)) - real (Stirling 0 m)) + real (Stirling 0 m) = real (Suc m * Stirling (Suc n) (Suc m) + Stirling (Suc n) m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
have "Suc m * Stirling (Suc n) (Suc m) + Stirling (Suc n) m =
                 Stirling (Suc (Suc n)) (Suc m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc m * Stirling (Suc n) (Suc m) + Stirling (Suc n) m = Stirling (Suc (Suc n)) (Suc m)
[PROOF STEP]
by (rule Stirling.simps(4) [symmetric])
[PROOF STATE]
proof (state)
this:
Suc m * Stirling (Suc n) (Suc m) + Stirling (Suc n) m = Stirling (Suc (Suc n)) (Suc m)

goal (2 subgoals):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
 2. \<And>n m. (\<And>m. real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))) \<Longrightarrow> real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i)) = real (Stirling (Suc (Suc n)) (Suc m))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i)) = real (Stirling (Suc (Suc n)) (Suc m))

goal (1 subgoal):
 1. real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
real (Stirling (Suc (Suc n)) (Suc m)) = real (\<Sum>i = 0..Suc n. Stirling i m * (Suc n choose i))

goal (1 subgoal):
 1. \<And>m. real (Stirling (Suc 0) (Suc m)) = real (\<Sum>i = 0..0. Stirling i m * (0 choose i))
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))

goal (1 subgoal):
 1. Stirling (Suc n) (Suc m) = (\<Sum>i = 0..n. Stirling i m * (n choose i))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
real (Stirling (Suc n) (Suc m)) = real (\<Sum>i = 0..n. Stirling i m * (n choose i))

goal (1 subgoal):
 1. Stirling (Suc n) (Suc m) = (\<Sum>i = 0..n. Stirling i m * (n choose i))
[PROOF STEP]
by (subst (asm) of_nat_eq_iff)
[PROOF STATE]
proof (state)
this:
Stirling (Suc n) (Suc m) = (\<Sum>i = 0..n. Stirling i m * (n choose i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_lessSucSuc0_conv: "(n < Suc (Suc 0)) = (n = 0 \<or> n = Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n < Suc (Suc 0)) = (n = 0 \<or> n = Suc 0)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma prime_factorization_unique_nat:
  fixes f :: "nat \<Rightarrow> _"
  assumes S_eq: "S = {p. 0 < f p}"
    and "finite S"
    and S: "\<forall>p\<in>S. prime p" "n = (\<Prod>p\<in>S. p ^ f p)"
  shows "S = prime_factors n \<and> (\<forall>p. prime p \<longrightarrow> f p = multiplicity p n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = prime_factors n \<and> (\<forall>p. prime p \<longrightarrow> f p = multiplicity p n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
S = {p. 0 < f p}
finite S
\<forall>p\<in>S. prime p
n = (\<Prod>p\<in>S. p ^ f p)

goal (1 subgoal):
 1. S = prime_factors n \<and> (\<forall>p. prime p \<longrightarrow> f p = multiplicity p n)
[PROOF STEP]
by (intro prime_factorization_unique'') auto


[STATEMENT]
lemma char_less_iff_nat_of_char: "x < y \<longleftrightarrow> of_char x < (of_char y :: nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x < y) = (of_char x < of_char y)
[PROOF STEP]
by (fact less_char_def)


[STATEMENT]
lemma vec_of_basis_enum_add:
  "vec_of_basis_enum (b1 + b2) = vec_of_basis_enum b1 + vec_of_basis_enum b2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum (b1 + b2) = vec_of_basis_enum b1 + vec_of_basis_enum b2
[PROOF STEP]
by (auto simp: vec_of_basis_enum_def complex_vector.representation_add)


[STATEMENT]
lemma mulfact:
  fixes c:: real and a:: complex and b:: complex
  assumes "c\<ge>0" "a \<le> b"
  shows "c * a \<le> c * b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real c * a \<le> complex_of_real c * b
[PROOF STEP]
using assms mult_le_cancel_iff2
[PROOF STATE]
proof (prove)
using this:
0 \<le> c
a \<le> b
(0::?'a) < ?z \<Longrightarrow> (?z * ?x \<le> ?z * ?y) = (?x \<le> ?y)

goal (1 subgoal):
 1. complex_of_real c * a \<le> complex_of_real c * b
[PROOF STEP]
unfolding less_eq_complex_def
[PROOF STATE]
proof (prove)
using this:
0 \<le> c
Re a \<le> Re b \<and> Im a = Im b
(0::?'a) < ?z \<Longrightarrow> (?z * ?x \<le> ?z * ?y) = (?x \<le> ?y)

goal (1 subgoal):
 1. Re (complex_of_real c * a) \<le> Re (complex_of_real c * b) \<and> Im (complex_of_real c * a) = Im (complex_of_real c * b)
[PROOF STEP]
by force


[STATEMENT]
lemma not_exp_less_zero [simp]: "\<not> exp x < 0"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> exp x < 0
[PROOF STEP]
by (simp add: not_less)


[STATEMENT]
theorem inj_tm_to_nat: "inj tm_to_nat"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj tm_to_nat
[PROOF STEP]
unfolding tm_to_nat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (list_encode \<circ> tm_to_nat_list)
[PROOF STEP]
proof  (rule inj_compose)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj list_encode
 2. inj tm_to_nat_list
[PROOF STEP]
show "inj list_encode"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj list_encode
[PROOF STEP]
by (rule inj_list_encode)
[PROOF STATE]
proof (state)
this:
inj list_encode

goal (1 subgoal):
 1. inj tm_to_nat_list
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj tm_to_nat_list
[PROOF STEP]
show "inj tm_to_nat_list"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj tm_to_nat_list
[PROOF STEP]
unfolding inj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. tm_to_nat_list x = tm_to_nat_list y \<longrightarrow> x = y
[PROOF STEP]
by (auto simp add: inj_tm_to_nat_list)
[PROOF STATE]
proof (state)
this:
inj tm_to_nat_list

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Finite_Graph) sum_outgoing_extend:
  assumes "\<And>v. \<lbrakk> v\<in>V; (u,v)\<notin>E \<rbrakk> \<Longrightarrow> g (u,v) = 0"
  shows "(\<Sum>e\<in>outgoing u. g e) = (\<Sum>v\<in>V. g (u,v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum g (outgoing u) = (\<Sum>v\<in>V. g (u, v))
[PROOF STEP]
apply (subst sum_outgoing_pointwise)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>E `` {u}. g (u, v)) = (\<Sum>v\<in>V. g (u, v))
[PROOF STEP]
apply (rule sum.mono_neutral_left)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite V
 2. E `` {u} \<subseteq> V
 3. \<forall>i\<in>V - E `` {u}. g (u, i) = (0::'b)
[PROOF STEP]
using assms succ_ss_V
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> V; (u, ?v) \<notin> E\<rbrakk> \<Longrightarrow> g (u, ?v) = (0::'b)
E `` {?u} \<subseteq> V

goal (3 subgoals):
 1. finite V
 2. E `` {u} \<subseteq> V
 3. \<forall>i\<in>V - E `` {u}. g (u, i) = (0::'b)
[PROOF STEP]
by auto


[STATEMENT]
lemma lmap_lconcat: "lmap f (lconcat' xss) = lconcat' (lmap (lmap f) (xss::'a llist llist))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lmap f (lconcat' xss) = lconcat' (lmap (lmap f) xss)
[PROOF STEP]
proof (rule tendsto_closed[where x=xss, OF closed_Collect_eq_isCont])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. isCont (\<lambda>a. lmap f (lconcat' a)) x
 2. \<And>x. isCont (\<lambda>a. lconcat' (lmap (lmap f) a)) x
 3. \<And>ys. \<lbrakk>lfinite ys; ys \<le> xss\<rbrakk> \<Longrightarrow> lmap f (lconcat' ys) = lconcat' (lmap (lmap f) ys)
[PROOF STEP]
fix xs :: "'a llist llist"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. isCont (\<lambda>a. lmap f (lconcat' a)) x
 2. \<And>x. isCont (\<lambda>a. lconcat' (lmap (lmap f) a)) x
 3. \<And>ys. \<lbrakk>lfinite ys; ys \<le> xss\<rbrakk> \<Longrightarrow> lmap f (lconcat' ys) = lconcat' (lmap (lmap f) ys)
[PROOF STEP]
assume "lfinite xs"
[PROOF STATE]
proof (state)
this:
lfinite xs

goal (3 subgoals):
 1. \<And>x. isCont (\<lambda>a. lmap f (lconcat' a)) x
 2. \<And>x. isCont (\<lambda>a. lconcat' (lmap (lmap f) a)) x
 3. \<And>ys. \<lbrakk>lfinite ys; ys \<le> xss\<rbrakk> \<Longrightarrow> lmap f (lconcat' ys) = lconcat' (lmap (lmap f) ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
lfinite xs
[PROOF STEP]
show "lmap f (lconcat' xs) = lconcat' (lmap (lmap f) xs)"
[PROOF STATE]
proof (prove)
using this:
lfinite xs

goal (1 subgoal):
 1. lmap f (lconcat' xs) = lconcat' (lmap (lmap f) xs)
[PROOF STEP]
by (induct xs rule: lfinite.induct) (auto simp: lmap_lappend_distrib)
[PROOF STATE]
proof (state)
this:
lmap f (lconcat' xs) = lconcat' (lmap (lmap f) xs)

goal (2 subgoals):
 1. \<And>x. isCont (\<lambda>a. lmap f (lconcat' a)) x
 2. \<And>x. isCont (\<lambda>a. lconcat' (lmap (lmap f) a)) x
[PROOF STEP]
qed (intro isCont_lconcat' isCont_lappend isCont_LCons continuous_ident isCont_lmap)+


[STATEMENT]
lemma times_empty_iff: "VSigma A B = 0 \<longleftrightarrow> A=0 \<or> (\<forall>x \<in> elts A. B x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (VSigma A B = 0) = (A = 0 \<or> (\<forall>x\<in>elts A. B x = 0))
[PROOF STEP]
by (metis VSigmaE VSigmaI elts_0 empty_iff trad_foundation)


[STATEMENT]
lemma caratheodory_aff_dim:
  fixes p :: "('a::euclidean_space) set"
  shows "convex hull p = {x. \<exists>S. finite S \<and> S \<subseteq> p \<and> card S \<le> aff_dim p + 1 \<and> x \<in> convex hull S}"
        (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull p = {x. \<exists>S. finite S \<and> S \<subseteq> p \<and> int (card S) \<le> aff_dim p + 1 \<and> x \<in> convex hull S}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. convex hull p \<subseteq> {x. \<exists>S. finite S \<and> S \<subseteq> p \<and> int (card S) \<le> aff_dim p + 1 \<and> x \<in> convex hull S}
 2. {x. \<exists>S. finite S \<and> S \<subseteq> p \<and> int (card S) \<le> aff_dim p + 1 \<and> x \<in> convex hull S} \<subseteq> convex hull p
[PROOF STEP]
have "\<And>x S u. \<lbrakk>finite S; S \<subseteq> p; int (card S) \<le> aff_dim p + 1; \<forall>x\<in>S. 0 \<le> u x; sum u S = 1\<rbrakk>
                \<Longrightarrow> (\<Sum>v\<in>S. u v *\<^sub>R v) \<in> convex hull S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x S u. \<lbrakk>finite S; S \<subseteq> p; int (card S) \<le> aff_dim p + 1; \<forall>x\<in>S. 0 \<le> u x; sum u S = 1\<rbrakk> \<Longrightarrow> (\<Sum>v\<in>S. u v *\<^sub>R v) \<in> convex hull S
[PROOF STEP]
by (simp add: hull_subset convex_explicit [THEN iffD1, OF convex_convex_hull])
[PROOF STATE]
proof (state)
this:
\<lbrakk>finite ?S; ?S \<subseteq> p; int (card ?S) \<le> aff_dim p + 1; \<forall>x\<in>?S. 0 \<le> ?u x; sum ?u ?S = 1\<rbrakk> \<Longrightarrow> (\<Sum>v\<in>?S. ?u v *\<^sub>R v) \<in> convex hull ?S

goal (2 subgoals):
 1. convex hull p \<subseteq> {x. \<exists>S. finite S \<and> S \<subseteq> p \<and> int (card S) \<le> aff_dim p + 1 \<and> x \<in> convex hull S}
 2. {x. \<exists>S. finite S \<and> S \<subseteq> p \<and> int (card S) \<le> aff_dim p + 1 \<and> x \<in> convex hull S} \<subseteq> convex hull p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>finite ?S; ?S \<subseteq> p; int (card ?S) \<le> aff_dim p + 1; \<forall>x\<in>?S. 0 \<le> ?u x; sum ?u ?S = 1\<rbrakk> \<Longrightarrow> (\<Sum>v\<in>?S. ?u v *\<^sub>R v) \<in> convex hull ?S
[PROOF STEP]
show "?lhs \<subseteq> ?rhs"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?S; ?S \<subseteq> p; int (card ?S) \<le> aff_dim p + 1; \<forall>x\<in>?S. 0 \<le> ?u x; sum ?u ?S = 1\<rbrakk> \<Longrightarrow> (\<Sum>v\<in>?S. ?u v *\<^sub>R v) \<in> convex hull ?S

goal (1 subgoal):
 1. convex hull p \<subseteq> {x. \<exists>S. finite S \<and> S \<subseteq> p \<and> int (card S) \<le> aff_dim p + 1 \<and> x \<in> convex hull S}
[PROOF STEP]
by (subst convex_hull_caratheodory_aff_dim, auto)
[PROOF STATE]
proof (state)
this:
convex hull p \<subseteq> {x. \<exists>S. finite S \<and> S \<subseteq> p \<and> int (card S) \<le> aff_dim p + 1 \<and> x \<in> convex hull S}

goal (1 subgoal):
 1. {x. \<exists>S. finite S \<and> S \<subseteq> p \<and> int (card S) \<le> aff_dim p + 1 \<and> x \<in> convex hull S} \<subseteq> convex hull p
[PROOF STEP]
qed (use hull_mono in auto)


[STATEMENT]
lemma powrat_divide:
     "(x / y) pow\<^sub>\<rat> r = (x pow\<^sub>\<rat> r)/(y pow\<^sub>\<rat> r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x / y) pow\<^sub>\<rat> r = x pow\<^sub>\<rat> r / y pow\<^sub>\<rat> r
[PROOF STEP]
proof (cases r)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> (x / y) pow\<^sub>\<rat> r = x pow\<^sub>\<rat> r / y pow\<^sub>\<rat> r
[PROOF STEP]
case (Fract a b)
[PROOF STATE]
proof (state)
this:
r = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> (x / y) pow\<^sub>\<rat> r = x pow\<^sub>\<rat> r / y pow\<^sub>\<rat> r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r = Fract a b
0 < b
coprime a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. (x / y) pow\<^sub>\<rat> r = x pow\<^sub>\<rat> r / y pow\<^sub>\<rat> r
[PROOF STEP]
using powrat_def quotient_of_Fract real_root_divide [symmetric]
          power_divide
[PROOF STATE]
proof (prove)
using this:
r = Fract a b
0 < b
coprime a b
?x pow\<^sub>\<rat> ?r = (if 0 < ?r then root (nat (snd (quotient_of ?r))) (?x ^ nat (fst (quotient_of ?r))) else root (nat (snd (quotient_of ?r))) (1 / ?x ^ nat (- fst (quotient_of ?r))))
quotient_of (Fract ?a ?b) = Rat.normalize (?a, ?b)
root ?n ?x / root ?n ?y = root ?n (?x / ?y)
(?a / ?b) ^ ?n = ?a ^ ?n / ?b ^ ?n

goal (1 subgoal):
 1. (x / y) pow\<^sub>\<rat> r = x pow\<^sub>\<rat> r / y pow\<^sub>\<rat> r
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(x / y) pow\<^sub>\<rat> r = x pow\<^sub>\<rat> r / y pow\<^sub>\<rat> r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cardSuc_mono_ordLess[simp]:
assumes CARD: "Card_order r" and CARD': "Card_order r'"
shows "(cardSuc r <o cardSuc r') = (r <o r')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cardSuc r <o cardSuc r') = (r <o r')
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (cardSuc r <o cardSuc r') = (r <o r')
[PROOF STEP]
have 0: "Well_order r \<and> Well_order r' \<and> Well_order(cardSuc r) \<and> Well_order(cardSuc r')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Well_order r \<and> Well_order r' \<and> Well_order (cardSuc r) \<and> Well_order (cardSuc r')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Card_order r
Card_order r'

goal (1 subgoal):
 1. Well_order r \<and> Well_order r' \<and> Well_order (cardSuc r) \<and> Well_order (cardSuc r')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Well_order r \<and> Well_order r' \<and> Well_order (cardSuc r) \<and> Well_order (cardSuc r')

goal (1 subgoal):
 1. (cardSuc r <o cardSuc r') = (r <o r')
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Well_order r \<and> Well_order r' \<and> Well_order (cardSuc r) \<and> Well_order (cardSuc r')

goal (1 subgoal):
 1. (cardSuc r <o cardSuc r') = (r <o r')
[PROOF STEP]
using not_ordLeq_iff_ordLess not_ordLeq_iff_ordLess[of r r']
[PROOF STATE]
proof (prove)
using this:
Well_order r \<and> Well_order r' \<and> Well_order (cardSuc r) \<and> Well_order (cardSuc r')
\<lbrakk>Well_order ?r; Well_order ?r'\<rbrakk> \<Longrightarrow> ((?r', ?r) \<notin> ordLeq) = (?r <o ?r')
\<lbrakk>Well_order r; Well_order r'\<rbrakk> \<Longrightarrow> ((r', r) \<notin> ordLeq) = (r <o r')

goal (1 subgoal):
 1. (cardSuc r <o cardSuc r') = (r <o r')
[PROOF STEP]
using cardSuc_mono_ordLeq[of r' r] assms
[PROOF STATE]
proof (prove)
using this:
Well_order r \<and> Well_order r' \<and> Well_order (cardSuc r) \<and> Well_order (cardSuc r')
\<lbrakk>Well_order ?r; Well_order ?r'\<rbrakk> \<Longrightarrow> ((?r', ?r) \<notin> ordLeq) = (?r <o ?r')
\<lbrakk>Well_order r; Well_order r'\<rbrakk> \<Longrightarrow> ((r', r) \<notin> ordLeq) = (r <o r')
\<lbrakk>Card_order r'; Card_order r\<rbrakk> \<Longrightarrow> (cardSuc r' \<le>o cardSuc r) = (r' \<le>o r)
Card_order r
Card_order r'

goal (1 subgoal):
 1. (cardSuc r <o cardSuc r') = (r <o r')
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(cardSuc r <o cardSuc r') = (r <o r')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma min_dist_split:
  assumes D1: "dist u d1 w" and D2: "dist w d2 v" and MIN: "min_dist u v = d1+d2"
  shows "min_dist u w = d1" "min_dist w v = d2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_dist u w = d1 &&& min_dist w v = d2
[PROOF STEP]
apply (metis assms ab_semigroup_add_class.add.commute add_le_cancel_left
    dist_trans min_distI_eq min_dist_minD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_dist w v = d2
[PROOF STEP]
by (metis assms add_le_cancel_left dist_trans min_distI_eq min_dist_minD)


[STATEMENT]
lemma Red_F_eq_Red_F_diff_Red_F: "Red_F N = Red_F (N - Red_F N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Red_F N = Red_F (N - Red_F N)
[PROOF STEP]
unfolding Red_F_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fin_std_red_F.Red_F N = fin_std_red_F.Red_F (N - fin_std_red_F.Red_F N)
[PROOF STEP]
by (rule fin_std_red_F.Red_F_eq_Red_F_diff_Red_F)


[STATEMENT]
lemma Re_exp: "Re (exp z) = exp (Re z) * cos (Im z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (exp z) = exp (Re z) * cos (Im z)
[PROOF STEP]
unfolding exp_eq_polar
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (complex_of_real (exp (Re z)) * cis (Im z)) = exp (Re z) * cos (Im z)
[PROOF STEP]
by simp


[STATEMENT]
lemma Union_included_multiset:
  fixes M::"('a::fs multiset)"
  shows "(\<Union>{supp x | x. x \<in># M}) \<subseteq> supp M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> {supp x |x. x \<in># M} \<subseteq> supp M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Union> {supp x |x. x \<in># M} \<subseteq> supp M
[PROOF STEP]
have "(\<Union>{supp x | x. x \<in># M}) = (\<Union>x \<in> set_mset M. supp x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> {supp x |x. x \<in># M} = \<Union> (supp ` set_mset M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> {supp x |x. x \<in># M} = \<Union> (supp ` set_mset M)

goal (1 subgoal):
 1. \<Union> {supp x |x. x \<in># M} \<subseteq> supp M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Union> {supp x |x. x \<in># M} = \<Union> (supp ` set_mset M)

goal (1 subgoal):
 1. \<Union> {supp x |x. x \<in># M} \<subseteq> supp M
[PROOF STEP]
have "... = supp (set_mset M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (supp ` set_mset M) = supp (set_mset M)
[PROOF STEP]
by (simp add: supp_of_finite_sets)
[PROOF STATE]
proof (state)
this:
\<Union> (supp ` set_mset M) = supp (set_mset M)

goal (1 subgoal):
 1. \<Union> {supp x |x. x \<in># M} \<subseteq> supp M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Union> (supp ` set_mset M) = supp (set_mset M)

goal (1 subgoal):
 1. \<Union> {supp x |x. x \<in># M} \<subseteq> supp M
[PROOF STEP]
have " ... \<subseteq> supp M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp (set_mset M) \<subseteq> supp M
[PROOF STEP]
by (rule supp_set_mset)
[PROOF STATE]
proof (state)
this:
supp (set_mset M) \<subseteq> supp M

goal (1 subgoal):
 1. \<Union> {supp x |x. x \<in># M} \<subseteq> supp M
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Union> {supp x |x. x \<in># M} \<subseteq> supp M
[PROOF STEP]
show "(\<Union>{supp x | x. x \<in># M}) \<subseteq> supp M"
[PROOF STATE]
proof (prove)
using this:
\<Union> {supp x |x. x \<in># M} \<subseteq> supp M

goal (1 subgoal):
 1. \<Union> {supp x |x. x \<in># M} \<subseteq> supp M
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Union> {supp x |x. x \<in># M} \<subseteq> supp M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nlcons_list: "toList (nlcons a t) = (nodeToList a) @ (toList t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. toList (nlcons a t) = nodeToList a @ toList t
[PROOF STEP]
apply (induct t arbitrary: a rule: nlcons.induct)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<And>a aa. toList (nlcons aa Empty) = nodeToList aa @ toList Empty
 2. \<And>a b aa. toList (nlcons aa (Single b)) = nodeToList aa @ toList (Single b)
 3. \<And>a uu_ b m sf aa. toList (nlcons aa (Deep uu_ (One b) m sf)) = nodeToList aa @ toList (Deep uu_ (One b) m sf)
 4. \<And>a uv_ b c m sf aa. toList (nlcons aa (Deep uv_ (Two b c) m sf)) = nodeToList aa @ toList (Deep uv_ (Two b c) m sf)
 5. \<And>a uw_ b c d m sf aa. toList (nlcons aa (Deep uw_ (Three b c d) m sf)) = nodeToList aa @ toList (Deep uw_ (Three b c d) m sf)
 6. \<And>a ux_ b c d e m sf aa. (\<And>a. toList (nlcons a m) = nodeToList a @ toList m) \<Longrightarrow> toList (nlcons aa (Deep ux_ (Four b c d e) m sf)) = nodeToList aa @ toList (Deep ux_ (Four b c d e) m sf)
[PROOF STEP]
apply (auto simp add: deep_def toList_def node3_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Sup_dual_upset_var: "(\<Inter>x \<in> X. \<up>x) = \<up>(\<Squnion>X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> (\<up> ` X) = \<up> (\<Squnion> X)
[PROOF STEP]
unfolding upset_prop
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>x\<in>X. Collect ((\<le>) x)) = Collect ((\<le>) (\<Squnion> X))
[PROOF STEP]
by (safe, simp_all add: Sup_le_iff)


[STATEMENT]
lemma homotopic_into_contractible:
  fixes S :: "'a::real_normed_vector set" and T:: "'b::real_normed_vector set"
  assumes f: "continuous_on S f" "f ` S \<subseteq> T"
      and g: "continuous_on S g" "g ` S \<subseteq> T"
      and T: "contractible T"
    shows "homotopic_with_canon (\<lambda>h. True) S T f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>h. True) S T f g
[PROOF STEP]
using homotopic_through_contractible [of S f T id T g id]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on S f; f ` S \<subseteq> T; continuous_on T id; id ` T \<subseteq> T; continuous_on S g; g ` S \<subseteq> T; continuous_on T id; id ` T \<subseteq> T; contractible T; path_connected T\<rbrakk> \<Longrightarrow> homotopic_with_canon (\<lambda>h. True) S T (id \<circ> f) (id \<circ> g)

goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>h. True) S T f g
[PROOF STEP]
by (simp add: assms contractible_imp_path_connected)


[STATEMENT]
theorem checker_SNF_soudness:
  assumes A: "A \<in> carrier_mat m n"
    and c: "checker_SNF A = (P,S,Q)"
  shows "is_SNF A (P,S,Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_SNF A (P, S, Q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_SNF A (P, S, Q)
[PROOF STEP]
let ?ext = "external_SNF (mat_to_list A)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_SNF A (P, S, Q)
[PROOF STEP]
obtain P_ext S_ext Q_ext P'_ext Q'_ext where ext: "?ext = (P_ext,S_ext,Q_ext,P'_ext,Q'_ext)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P_ext S_ext Q_ext P'_ext Q'_ext. external_SNF (mat_to_list A) = (P_ext, S_ext, Q_ext, P'_ext, Q'_ext) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "?ext", auto)
[PROOF STATE]
proof (state)
this:
external_SNF (mat_to_list A) = (P_ext, S_ext, Q_ext, P'_ext, Q'_ext)

goal (1 subgoal):
 1. is_SNF A (P, S, Q)
[PROOF STEP]
let ?case_external = "let
          P = mat_of_rows_list m P_ext;
          S = mat_of_rows_list m S_ext;
          Q = mat_of_rows_list n Q_ext;
          P' = mat_of_rows_list m P'_ext;
          Q' = mat_of_rows_list n Q'_ext in
            (dim_row P = m \<and> dim_col P = m
              \<and> dim_row S = m \<and> dim_col S = n
              \<and> dim_row Q = n \<and> dim_col Q = n
              \<and> dim_row P' = m \<and> dim_col P' = m
              \<and> dim_row Q' = n \<and> dim_col Q' = n
              \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n
              \<and> Smith_normal_form_mat S \<and> (S = P*A*Q))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_SNF A (P, S, Q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_SNF A (P, S, Q)
[PROOF STEP]
proof (cases ?case_external)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q \<Longrightarrow> is_SNF A (P, S, Q)
 2. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q

goal (2 subgoals):
 1. let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q \<Longrightarrow> is_SNF A (P, S, Q)
 2. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
define P' where "P' = mat_of_rows_list m P'_ext"
[PROOF STATE]
proof (state)
this:
P' = mat_of_rows_list m P'_ext

goal (2 subgoals):
 1. let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q \<Longrightarrow> is_SNF A (P, S, Q)
 2. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
define Q' where "Q' = mat_of_rows_list m Q'_ext"
[PROOF STATE]
proof (state)
this:
Q' = mat_of_rows_list m Q'_ext

goal (2 subgoals):
 1. let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q \<Longrightarrow> is_SNF A (P, S, Q)
 2. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
have S_PAQ: "S = P * A * Q "
      and SNF_S: "Smith_normal_form_mat S" and PP'_1: "P * P' = 1\<^sub>m m" and QQ'_1: "Q * Q' = 1\<^sub>m n"
      and sm_P: "square_mat P" and sm_Q: "square_mat Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S = P * A * Q &&& Smith_normal_form_mat S &&& P * P' = 1\<^sub>m m) &&& Q * Q' = 1\<^sub>m n &&& square_mat P &&& square_mat Q
[PROOF STEP]
using ext True c A
[PROOF STATE]
proof (prove)
using this:
external_SNF (mat_to_list A) = (P_ext, S_ext, Q_ext, P'_ext, Q'_ext)
let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q
checker_SNF A = (P, S, Q)
A \<in> carrier_mat m n

goal (1 subgoal):
 1. (S = P * A * Q &&& Smith_normal_form_mat S &&& P * P' = 1\<^sub>m m) &&& Q * Q' = 1\<^sub>m n &&& square_mat P &&& square_mat Q
[PROOF STEP]
unfolding checker_SNF_def Let_def mat_of_rows_list_def P'_def Q'_def
[PROOF STATE]
proof (prove)
using this:
external_SNF (mat_to_list A) = (P_ext, S_ext, Q_ext, P'_ext, Q'_ext)
dim_row (Matrix.mat (length P_ext) m (\<lambda>(i, y). P_ext ! i ! y)) = m \<and> dim_col (Matrix.mat (length P_ext) m (\<lambda>(i, y). P_ext ! i ! y)) = m \<and> dim_row (Matrix.mat (length S_ext) m (\<lambda>(i, y). S_ext ! i ! y)) = m \<and> dim_col (Matrix.mat (length S_ext) m (\<lambda>(i, y). S_ext ! i ! y)) = n \<and> dim_row (Matrix.mat (length Q_ext) n (\<lambda>(i, y). Q_ext ! i ! y)) = n \<and> dim_col (Matrix.mat (length Q_ext) n (\<lambda>(i, y). Q_ext ! i ! y)) = n \<and> dim_row (Matrix.mat (length P'_ext) m (\<lambda>(i, y). P'_ext ! i ! y)) = m \<and> dim_col (Matrix.mat (length P'_ext) m (\<lambda>(i, y). P'_ext ! i ! y)) = m \<and> dim_row (Matrix.mat (length Q'_ext) n (\<lambda>(i, y). Q'_ext ! i ! y)) = n \<and> dim_col (Matrix.mat (length Q'_ext) n (\<lambda>(i, y). Q'_ext ! i ! y)) = n \<and> Matrix.mat (length P_ext) m (\<lambda>(i, y). P_ext ! i ! y) * Matrix.mat (length P'_ext) m (\<lambda>(i, y). P'_ext ! i ! y) = 1\<^sub>m m \<and> Matrix.mat (length Q_ext) n (\<lambda>(i, y). Q_ext ! i ! y) * Matrix.mat (length Q'_ext) n (\<lambda>(i, y). Q'_ext ! i ! y) = 1\<^sub>m n \<and> Smith_normal_form_mat (Matrix.mat (length S_ext) m (\<lambda>(i, y). S_ext ! i ! y)) \<and> Matrix.mat (length S_ext) m (\<lambda>(i, y). S_ext ! i ! y) = Matrix.mat (length P_ext) m (\<lambda>(i, y). P_ext ! i ! y) * A * Matrix.mat (length Q_ext) n (\<lambda>(i, y). Q_ext ! i ! y)
(case external_SNF (mat_to_list A) of (P_ext, S_ext, Q_ext, P'_ext, Q'_ext) \<Rightarrow> if dim_row (Matrix.mat (length P_ext) (dim_row A) (\<lambda>(i, y). P_ext ! i ! y)) = dim_row A \<and> dim_col (Matrix.mat (length P_ext) (dim_row A) (\<lambda>(i, y). P_ext ! i ! y)) = dim_row A \<and> dim_row (Matrix.mat (length S_ext) (dim_row A) (\<lambda>(i, y). S_ext ! i ! y)) = dim_row A \<and> dim_col (Matrix.mat (length S_ext) (dim_row A) (\<lambda>(i, y). S_ext ! i ! y)) = dim_col A \<and> dim_row (Matrix.mat (length Q_ext) (dim_row A) (\<lambda>(i, y). Q_ext ! i ! y)) = dim_col A \<and> dim_col (Matrix.mat (length Q_ext) (dim_row A) (\<lambda>(i, y). Q_ext ! i ! y)) = dim_col A \<and> dim_row (Matrix.mat (length P'_ext) (dim_row A) (\<lambda>(i, y). P'_ext ! i ! y)) = dim_row A \<and> dim_col (Matrix.mat (length P'_ext) (dim_row A) (\<lambda>(i, y). P'_ext ! i ! y)) = dim_row A \<and> dim_row (Matrix.mat (length Q'_ext) (dim_row A) (\<lambda>(i, y). Q'_ext ! i ! y)) = dim_col A \<and> dim_col (Matrix.mat (length Q'_ext) (dim_row A) (\<lambda>(i, y). Q'_ext ! i ! y)) = dim_col A \<and> Matrix.mat (length P_ext) (dim_row A) (\<lambda>(i, y). P_ext ! i ! y) * Matrix.mat (length P'_ext) (dim_row A) (\<lambda>(i, y). P'_ext ! i ! y) = 1\<^sub>m (dim_row A) \<and> Matrix.mat (length Q_ext) (dim_row A) (\<lambda>(i, y). Q_ext ! i ! y) * Matrix.mat (length Q'_ext) (dim_row A) (\<lambda>(i, y). Q'_ext ! i ! y) = 1\<^sub>m (dim_col A) \<and> Smith_normal_form_mat (Matrix.mat (length S_ext) (dim_row A) (\<lambda>(i, y). S_ext ! i ! y)) \<and> Matrix.mat (length S_ext) (dim_row A) (\<lambda>(i, y). S_ext ! i ! y) = Matrix.mat (length P_ext) (dim_row A) (\<lambda>(i, y). P_ext ! i ! y) * A * Matrix.mat (length Q_ext) (dim_row A) (\<lambda>(i, y). Q_ext ! i ! y) then (Matrix.mat (length P_ext) (dim_row A) (\<lambda>(i, y). P_ext ! i ! y), Matrix.mat (length S_ext) (dim_row A) (\<lambda>(i, y). S_ext ! i ! y), Matrix.mat (length Q_ext) (dim_row A) (\<lambda>(i, y). Q_ext ! i ! y)) else Code.abort STR ''Certification failed'' (\<lambda>_. Smith_ED_mxn A)) = (P, S, Q)
A \<in> carrier_mat m n

goal (1 subgoal):
 1. (S = P * A * Q &&& Smith_normal_form_mat S &&& P * Matrix.mat (length P'_ext) m (\<lambda>(i, y). P'_ext ! i ! y) = 1\<^sub>m m) &&& Q * Matrix.mat (length Q'_ext) m (\<lambda>(i, y). Q'_ext ! i ! y) = 1\<^sub>m n &&& square_mat P &&& square_mat Q
[PROOF STEP]
by (auto split: if_splits)
[PROOF STATE]
proof (state)
this:
S = P * A * Q
Smith_normal_form_mat S
P * P' = 1\<^sub>m m
Q * Q' = 1\<^sub>m n
square_mat P
square_mat Q

goal (2 subgoals):
 1. let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q \<Longrightarrow> is_SNF A (P, S, Q)
 2. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
have inv_P: "invertible_mat P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_mat P
[PROOF STEP]
proof (unfold invertible_mat_def, rule conjI, rule sm_P,
        unfold inverts_mat_def, rule exI[of _ P'], rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. P * P' = 1\<^sub>m (dim_row P)
 2. P' * P = 1\<^sub>m (dim_row P')
[PROOF STEP]
show *: "P * P' = 1\<^sub>m (dim_row P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P * P' = 1\<^sub>m (dim_row P)
[PROOF STEP]
by (metis PP'_1 True index_mult_mat(2))
[PROOF STATE]
proof (state)
this:
P * P' = 1\<^sub>m (dim_row P)

goal (1 subgoal):
 1. P' * P = 1\<^sub>m (dim_row P')
[PROOF STEP]
show "P' * P = 1\<^sub>m (dim_row P')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P' * P = 1\<^sub>m (dim_row P')
[PROOF STEP]
proof (rule mat_mult_left_right_inverse)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. P \<in> carrier_mat (dim_row P') (dim_row P')
 2. P' \<in> carrier_mat (dim_row P') (dim_row P')
 3. P * P' = 1\<^sub>m (dim_row P')
[PROOF STEP]
show "P \<in> carrier_mat (dim_row P') (dim_row P')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<in> carrier_mat (dim_row P') (dim_row P')
[PROOF STEP]
by (metis * P'_def PP'_1 True carrier_mat_triv index_one_mat(2) sm_P square_mat.elims(2))
[PROOF STATE]
proof (state)
this:
P \<in> carrier_mat (dim_row P') (dim_row P')

goal (2 subgoals):
 1. P' \<in> carrier_mat (dim_row P') (dim_row P')
 2. P * P' = 1\<^sub>m (dim_row P')
[PROOF STEP]
show "P' \<in> carrier_mat (dim_row P') (dim_row P')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P' \<in> carrier_mat (dim_row P') (dim_row P')
[PROOF STEP]
by (metis P'_def True carrier_mat_triv)
[PROOF STATE]
proof (state)
this:
P' \<in> carrier_mat (dim_row P') (dim_row P')

goal (1 subgoal):
 1. P * P' = 1\<^sub>m (dim_row P')
[PROOF STEP]
show "P * P' = 1\<^sub>m (dim_row P')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P * P' = 1\<^sub>m (dim_row P')
[PROOF STEP]
by (metis P'_def PP'_1 True)
[PROOF STATE]
proof (state)
this:
P * P' = 1\<^sub>m (dim_row P')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P' * P = 1\<^sub>m (dim_row P')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
invertible_mat P

goal (2 subgoals):
 1. let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q \<Longrightarrow> is_SNF A (P, S, Q)
 2. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
have inv_Q: "invertible_mat Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_mat Q
[PROOF STEP]
proof (unfold invertible_mat_def, rule conjI, rule sm_Q,
        unfold inverts_mat_def, rule exI[of _ Q'], rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Q * Q' = 1\<^sub>m (dim_row Q)
 2. Q' * Q = 1\<^sub>m (dim_row Q')
[PROOF STEP]
show *: "Q * Q' = 1\<^sub>m (dim_row Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q * Q' = 1\<^sub>m (dim_row Q)
[PROOF STEP]
by (metis QQ'_1 True index_mult_mat(2))
[PROOF STATE]
proof (state)
this:
Q * Q' = 1\<^sub>m (dim_row Q)

goal (1 subgoal):
 1. Q' * Q = 1\<^sub>m (dim_row Q')
[PROOF STEP]
show "Q' * Q = 1\<^sub>m (dim_row Q')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q' * Q = 1\<^sub>m (dim_row Q')
[PROOF STEP]
proof (rule mat_mult_left_right_inverse)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. Q \<in> carrier_mat (dim_row Q') (dim_row Q')
 2. Q' \<in> carrier_mat (dim_row Q') (dim_row Q')
 3. Q * Q' = 1\<^sub>m (dim_row Q')
[PROOF STEP]
show 1: "Q \<in> carrier_mat (dim_row Q') (dim_row Q')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q \<in> carrier_mat (dim_row Q') (dim_row Q')
[PROOF STEP]
by (metis Q'_def QQ'_1 True carrier_mat_triv dim_row_mat(1) index_mult_mat(2)
              mat_of_rows_list_def sm_Q square_mat.simps)
[PROOF STATE]
proof (state)
this:
Q \<in> carrier_mat (dim_row Q') (dim_row Q')

goal (2 subgoals):
 1. Q' \<in> carrier_mat (dim_row Q') (dim_row Q')
 2. Q * Q' = 1\<^sub>m (dim_row Q')
[PROOF STEP]
thus "Q' \<in> carrier_mat (dim_row Q') (dim_row Q')"
[PROOF STATE]
proof (prove)
using this:
Q \<in> carrier_mat (dim_row Q') (dim_row Q')

goal (1 subgoal):
 1. Q' \<in> carrier_mat (dim_row Q') (dim_row Q')
[PROOF STEP]
by (metis * carrier_matD(1) carrier_mat_triv index_mult_mat(3) index_one_mat(3))
[PROOF STATE]
proof (state)
this:
Q' \<in> carrier_mat (dim_row Q') (dim_row Q')

goal (1 subgoal):
 1. Q * Q' = 1\<^sub>m (dim_row Q')
[PROOF STEP]
show "Q * Q' = 1\<^sub>m (dim_row Q')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q * Q' = 1\<^sub>m (dim_row Q')
[PROOF STEP]
using * 1
[PROOF STATE]
proof (prove)
using this:
Q * Q' = 1\<^sub>m (dim_row Q)
Q \<in> carrier_mat (dim_row Q') (dim_row Q')

goal (1 subgoal):
 1. Q * Q' = 1\<^sub>m (dim_row Q')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Q * Q' = 1\<^sub>m (dim_row Q')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Q' * Q = 1\<^sub>m (dim_row Q')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
invertible_mat Q

goal (2 subgoals):
 1. let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q \<Longrightarrow> is_SNF A (P, S, Q)
 2. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
have "P \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<in> carrier_mat m m
[PROOF STEP]
by (metis PP'_1 True carrier_matI index_mult_mat(2) sm_P square_mat.simps)
[PROOF STATE]
proof (state)
this:
P \<in> carrier_mat m m

goal (2 subgoals):
 1. let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q \<Longrightarrow> is_SNF A (P, S, Q)
 2. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
P \<in> carrier_mat m m

goal (2 subgoals):
 1. let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q \<Longrightarrow> is_SNF A (P, S, Q)
 2. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
have  "Q \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q \<in> carrier_mat n n
[PROOF STEP]
by (metis QQ'_1 True carrier_matI index_mult_mat(2) sm_Q square_mat.simps)
[PROOF STATE]
proof (state)
this:
Q \<in> carrier_mat n n

goal (2 subgoals):
 1. let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q \<Longrightarrow> is_SNF A (P, S, Q)
 2. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
P \<in> carrier_mat m m
Q \<in> carrier_mat n n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier_mat m m
Q \<in> carrier_mat n n

goal (1 subgoal):
 1. is_SNF A (P, S, Q)
[PROOF STEP]
unfolding is_SNF_def
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier_mat m m
Q \<in> carrier_mat n n

goal (1 subgoal):
 1. case (P, S, Q) of (P, S, Q) \<Rightarrow> P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_col A) (dim_col A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat S \<and> S = P * A * Q
[PROOF STEP]
using inv_P inv_Q SNF_S S_PAQ A
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier_mat m m
Q \<in> carrier_mat n n
invertible_mat P
invertible_mat Q
Smith_normal_form_mat S
S = P * A * Q
A \<in> carrier_mat m n

goal (1 subgoal):
 1. case (P, S, Q) of (P, S, Q) \<Rightarrow> P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_col A) (dim_col A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat S \<and> S = P * A * Q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_SNF A (P, S, Q)

goal (1 subgoal):
 1. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q)

goal (1 subgoal):
 1. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
hence "checker_SNF A = Smith_ED_mxn A"
[PROOF STATE]
proof (prove)
using this:
\<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q)

goal (1 subgoal):
 1. checker_SNF A = Smith_ED_mxn A
[PROOF STEP]
using ext False c A
[PROOF STATE]
proof (prove)
using this:
\<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q)
external_SNF (mat_to_list A) = (P_ext, S_ext, Q_ext, P'_ext, Q'_ext)
\<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q)
checker_SNF A = (P, S, Q)
A \<in> carrier_mat m n

goal (1 subgoal):
 1. checker_SNF A = Smith_ED_mxn A
[PROOF STEP]
unfolding checker_SNF_def Let_def Code.abort_def
[PROOF STATE]
proof (prove)
using this:
\<not> (dim_row (mat_of_rows_list m P_ext) = m \<and> dim_col (mat_of_rows_list m P_ext) = m \<and> dim_row (mat_of_rows_list m S_ext) = m \<and> dim_col (mat_of_rows_list m S_ext) = n \<and> dim_row (mat_of_rows_list n Q_ext) = n \<and> dim_col (mat_of_rows_list n Q_ext) = n \<and> dim_row (mat_of_rows_list m P'_ext) = m \<and> dim_col (mat_of_rows_list m P'_ext) = m \<and> dim_row (mat_of_rows_list n Q'_ext) = n \<and> dim_col (mat_of_rows_list n Q'_ext) = n \<and> mat_of_rows_list m P_ext * mat_of_rows_list m P'_ext = 1\<^sub>m m \<and> mat_of_rows_list n Q_ext * mat_of_rows_list n Q'_ext = 1\<^sub>m n \<and> Smith_normal_form_mat (mat_of_rows_list m S_ext) \<and> mat_of_rows_list m S_ext = mat_of_rows_list m P_ext * A * mat_of_rows_list n Q_ext)
external_SNF (mat_to_list A) = (P_ext, S_ext, Q_ext, P'_ext, Q'_ext)
\<not> (dim_row (mat_of_rows_list m P_ext) = m \<and> dim_col (mat_of_rows_list m P_ext) = m \<and> dim_row (mat_of_rows_list m S_ext) = m \<and> dim_col (mat_of_rows_list m S_ext) = n \<and> dim_row (mat_of_rows_list n Q_ext) = n \<and> dim_col (mat_of_rows_list n Q_ext) = n \<and> dim_row (mat_of_rows_list m P'_ext) = m \<and> dim_col (mat_of_rows_list m P'_ext) = m \<and> dim_row (mat_of_rows_list n Q'_ext) = n \<and> dim_col (mat_of_rows_list n Q'_ext) = n \<and> mat_of_rows_list m P_ext * mat_of_rows_list m P'_ext = 1\<^sub>m m \<and> mat_of_rows_list n Q_ext * mat_of_rows_list n Q'_ext = 1\<^sub>m n \<and> Smith_normal_form_mat (mat_of_rows_list m S_ext) \<and> mat_of_rows_list m S_ext = mat_of_rows_list m P_ext * A * mat_of_rows_list n Q_ext)
(case external_SNF (mat_to_list A) of (P_ext, S_ext, Q_ext, P'_ext, Q'_ext) \<Rightarrow> if dim_row (mat_of_rows_list (dim_row A) P_ext) = dim_row A \<and> dim_col (mat_of_rows_list (dim_row A) P_ext) = dim_row A \<and> dim_row (mat_of_rows_list (dim_row A) S_ext) = dim_row A \<and> dim_col (mat_of_rows_list (dim_row A) S_ext) = dim_col A \<and> dim_row (mat_of_rows_list (dim_row A) Q_ext) = dim_col A \<and> dim_col (mat_of_rows_list (dim_row A) Q_ext) = dim_col A \<and> dim_row (mat_of_rows_list (dim_row A) P'_ext) = dim_row A \<and> dim_col (mat_of_rows_list (dim_row A) P'_ext) = dim_row A \<and> dim_row (mat_of_rows_list (dim_row A) Q'_ext) = dim_col A \<and> dim_col (mat_of_rows_list (dim_row A) Q'_ext) = dim_col A \<and> mat_of_rows_list (dim_row A) P_ext * mat_of_rows_list (dim_row A) P'_ext = 1\<^sub>m (dim_row A) \<and> mat_of_rows_list (dim_row A) Q_ext * mat_of_rows_list (dim_row A) Q'_ext = 1\<^sub>m (dim_col A) \<and> Smith_normal_form_mat (mat_of_rows_list (dim_row A) S_ext) \<and> mat_of_rows_list (dim_row A) S_ext = mat_of_rows_list (dim_row A) P_ext * A * mat_of_rows_list (dim_row A) Q_ext then (mat_of_rows_list (dim_row A) P_ext, mat_of_rows_list (dim_row A) S_ext, mat_of_rows_list (dim_row A) Q_ext) else Smith_ED_mxn A) = (P, S, Q)
A \<in> carrier_mat m n

goal (1 subgoal):
 1. (case external_SNF (mat_to_list A) of (P_ext, S_ext, Q_ext, P'_ext, Q'_ext) \<Rightarrow> if dim_row (mat_of_rows_list (dim_row A) P_ext) = dim_row A \<and> dim_col (mat_of_rows_list (dim_row A) P_ext) = dim_row A \<and> dim_row (mat_of_rows_list (dim_row A) S_ext) = dim_row A \<and> dim_col (mat_of_rows_list (dim_row A) S_ext) = dim_col A \<and> dim_row (mat_of_rows_list (dim_row A) Q_ext) = dim_col A \<and> dim_col (mat_of_rows_list (dim_row A) Q_ext) = dim_col A \<and> dim_row (mat_of_rows_list (dim_row A) P'_ext) = dim_row A \<and> dim_col (mat_of_rows_list (dim_row A) P'_ext) = dim_row A \<and> dim_row (mat_of_rows_list (dim_row A) Q'_ext) = dim_col A \<and> dim_col (mat_of_rows_list (dim_row A) Q'_ext) = dim_col A \<and> mat_of_rows_list (dim_row A) P_ext * mat_of_rows_list (dim_row A) P'_ext = 1\<^sub>m (dim_row A) \<and> mat_of_rows_list (dim_row A) Q_ext * mat_of_rows_list (dim_row A) Q'_ext = 1\<^sub>m (dim_col A) \<and> Smith_normal_form_mat (mat_of_rows_list (dim_row A) S_ext) \<and> mat_of_rows_list (dim_row A) S_ext = mat_of_rows_list (dim_row A) P_ext * A * mat_of_rows_list (dim_row A) Q_ext then (mat_of_rows_list (dim_row A) P_ext, mat_of_rows_list (dim_row A) S_ext, mat_of_rows_list (dim_row A) Q_ext) else Smith_ED_mxn A) = Smith_ED_mxn A
[PROOF STEP]
by (smt carrier_matD case_prod_conv dim_col_mat(1) mat_of_rows_list_def)
[PROOF STATE]
proof (state)
this:
checker_SNF A = Smith_ED_mxn A

goal (1 subgoal):
 1. \<not> (let P = mat_of_rows_list m P_ext; S = mat_of_rows_list m S_ext; Q = mat_of_rows_list n Q_ext; P' = mat_of_rows_list m P'_ext; Q' = mat_of_rows_list n Q'_ext in dim_row P = m \<and> dim_col P = m \<and> dim_row S = m \<and> dim_col S = n \<and> dim_row Q = n \<and> dim_col Q = n \<and> dim_row P' = m \<and> dim_col P' = m \<and> dim_row Q' = n \<and> dim_col Q' = n \<and> P * P' = 1\<^sub>m m \<and> Q * Q' = 1\<^sub>m n \<and> Smith_normal_form_mat S \<and> S = P * A * Q) \<Longrightarrow> is_SNF A (P, S, Q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
checker_SNF A = Smith_ED_mxn A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
checker_SNF A = Smith_ED_mxn A

goal (1 subgoal):
 1. is_SNF A (P, S, Q)
[PROOF STEP]
using Smith_ED.is_SNF_Smith_mxn[OF A] c
[PROOF STATE]
proof (prove)
using this:
checker_SNF A = Smith_ED_mxn A
is_SNF A (Smith_ED_mxn A)
checker_SNF A = (P, S, Q)

goal (1 subgoal):
 1. is_SNF A (P, S, Q)
[PROOF STEP]
unfolding is_SNF_def
[PROOF STATE]
proof (prove)
using this:
checker_SNF A = Smith_ED_mxn A
case Smith_ED_mxn A of (P, S, Q) \<Rightarrow> P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_col A) (dim_col A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat S \<and> S = P * A * Q
checker_SNF A = (P, S, Q)

goal (1 subgoal):
 1. case (P, S, Q) of (P, S, Q) \<Rightarrow> P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_col A) (dim_col A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat S \<and> S = P * A * Q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_SNF A (P, S, Q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
is_SNF A (P, S, Q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma take_bit_Suc_minus_1_eq:
  \<open>take_bit (Suc n) (- 1) = 2 ^ Suc n - 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (Suc n) (- (1::'a)) = (2::'a) ^ Suc n - (1::'a)
[PROOF STEP]
by (simp add: mask_eq_exp_minus_1)


[STATEMENT]
lemma fps_const_inverse:
  fixes     a :: "'a::{comm_monoid_add,inverse,mult_zero,uminus}"
  shows     "inverse (fps_const a) = fps_const (inverse a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (fps_const a) = fps_const (inverse a)
[PROOF STEP]
unfolding fps_inverse_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_right_inverse (fps_const a) (inverse (fps_const a $ 0)) = fps_const (inverse a)
[PROOF STEP]
by        (simp add: fps_const_lr_inverse(2))


[STATEMENT]
lemma fps_sum_rep_nth: "(sum (\<lambda>i. fps_const(a$i)*fps_X^i) {0..m})$n = (if n \<le> m then a$n else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..m. fps_const (a $ i) * fps_X ^ i) $ n = (if n \<le> m then a $ n else (0::'a))
[PROOF STEP]
by (simp add: fps_sum_nth if_distrib cong del: if_weak_cong)


[STATEMENT]
lemma onorm_case_prod_plus: \<open>onorm (case_prod plus :: _ \<Rightarrow> 'a::{real_normed_vector, not_singleton}) = sqrt 2\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>(x, y). x + y) = sqrt 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. onorm (\<lambda>(x, y). x + y) = sqrt 2
[PROOF STEP]
obtain x :: 'a where \<open>x \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<noteq> (0::'a) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
apply atomize_elim
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. x \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<noteq> (0::'a)

goal (1 subgoal):
 1. onorm (\<lambda>(x, y). x + y) = sqrt 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>(x, y). x + y) = sqrt 2
[PROOF STEP]
apply (rule onormI[where x=\<open>(x,x)\<close>])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. norm (case x of (x, xa) \<Rightarrow> x + xa) \<le> sqrt 2 * norm x
 2. (x, x) \<noteq> 0
 3. norm (case (x, x) of (x, xa) \<Rightarrow> x + xa) = sqrt 2 * norm (x, x)
[PROOF STEP]
using norm_plus_leq_norm_prod
[PROOF STATE]
proof (prove)
using this:
norm (?a + ?b) \<le> sqrt 2 * norm (?a, ?b)

goal (3 subgoals):
 1. \<And>x. norm (case x of (x, xa) \<Rightarrow> x + xa) \<le> sqrt 2 * norm x
 2. (x, x) \<noteq> 0
 3. norm (case (x, x) of (x, xa) \<Rightarrow> x + xa) = sqrt 2 * norm (x, x)
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (x, x) \<noteq> 0
 2. norm (case (x, x) of (x, xa) \<Rightarrow> x + xa) = sqrt 2 * norm (x, x)
[PROOF STEP]
using  \<open>x \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)

goal (2 subgoals):
 1. (x, x) \<noteq> 0
 2. norm (case (x, x) of (x, xa) \<Rightarrow> x + xa) = sqrt 2 * norm (x, x)
[PROOF STEP]
by (auto simp add: zero_prod_def norm_prod_def real_sqrt_mult
        simp flip: scaleR_2)
[PROOF STATE]
proof (state)
this:
onorm (\<lambda>(x, y). x + y) = sqrt 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma span_eq_iff[simp]: "span s = s \<longleftrightarrow> subspace s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (span s = s) = subspace s
[PROOF STEP]
unfolding span_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (subspace hull s = s) = subspace s
[PROOF STEP]
by (rule hull_eq) (rule subspace_Inter)


[STATEMENT]
lemma bt_map_reflect: "bt_map f (reflect t) = reflect (bt_map f t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bt_map f (reflect t) = reflect (bt_map f t)
[PROOF STEP]
apply (induct t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. bt_map f (reflect Lf) = reflect (bt_map f Lf)
 2. \<And>x1 t1 t2. \<lbrakk>bt_map f (reflect t1) = reflect (bt_map f t1); bt_map f (reflect t2) = reflect (bt_map f t2)\<rbrakk> \<Longrightarrow> bt_map f (reflect (Br x1 t1 t2)) = reflect (bt_map f (Br x1 t1 t2))
[PROOF STEP]
apply (metis bt_map.simps(1) reflect.simps(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 t1 t2. \<lbrakk>bt_map f (reflect t1) = reflect (bt_map f t1); bt_map f (reflect t2) = reflect (bt_map f t2)\<rbrakk> \<Longrightarrow> bt_map f (reflect (Br x1 t1 t2)) = reflect (bt_map f (Br x1 t1 t2))
[PROOF STEP]
by (metis bt_map.simps(2) reflect.simps(2))