[STATEMENT]
lemma path_diff: "\<lbrakk>path f; path g\<rbrakk> \<Longrightarrow> path (\<lambda>t. f t - g t)" for f::"real\<Rightarrow>'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>path f; path g\<rbrakk> \<Longrightarrow> path (\<lambda>t. f t - g t)
[PROOF STEP]
unfolding path_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on {0..1} f; continuous_on {0..1} g\<rbrakk> \<Longrightarrow> continuous_on {0..1} (\<lambda>t. f t - g t)
[PROOF STEP]
by (intro continuous_intros)


[STATEMENT]
lemma card_map_fset_le:
  shows "card_fset (map_fset f xs) \<le> card_fset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_fset (map_fset f xs) \<le> card_fset xs
[PROOF STEP]
unfolding card_fset map_fset_image
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (f ` fset xs) \<le> card (fset xs)
[PROOF STEP]
by (rule card_image_le[OF finite_fset])


[STATEMENT]
lemma dagger_of_ket_is_bra:
  fixes v:: "complex vec"
  shows "( |v\<rangle> )\<^sup>\<dagger> = \<langle>v|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |v\<rangle>\<^sup>\<dagger> = \<langle>|v\<rangle>|
[PROOF STEP]
by (simp add: bra_def dagger_def ket_vec_def)


[STATEMENT]
lemma nn_integral_null_set:
  assumes "N \<in> null_sets M" shows "(\<integral>\<^sup>+ x. u x * indicator N x \<partial>M) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. u x * indicator N x \<partial>M = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. u x * indicator N x \<partial>M = 0
[PROOF STEP]
have "(\<integral>\<^sup>+ x. u x * indicator N x \<partial>M) = (\<integral>\<^sup>+ x. 0 \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. u x * indicator N x \<partial>M = \<integral>\<^sup>+ x. 0 \<partial>M
[PROOF STEP]
proof (intro nn_integral_cong_AE AE_I)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. {x \<in> space M. u x * indicator N x \<noteq> 0} \<subseteq> ?N1
 2. emeasure M ?N1 = 0
 3. ?N1 \<in> sets M
[PROOF STEP]
show "{x \<in> space M. u x * indicator N x \<noteq> 0} \<subseteq> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> space M. u x * indicator N x \<noteq> 0} \<subseteq> N
[PROOF STEP]
by (auto simp: indicator_def)
[PROOF STATE]
proof (state)
this:
{x \<in> space M. u x * indicator N x \<noteq> 0} \<subseteq> N

goal (2 subgoals):
 1. emeasure M N = 0
 2. N \<in> sets M
[PROOF STEP]
show "(emeasure M) N = 0" "N \<in> sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M N = 0 &&& N \<in> sets M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
N \<in> null_sets M

goal (1 subgoal):
 1. emeasure M N = 0 &&& N \<in> sets M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
emeasure M N = 0
N \<in> sets M

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. u x * indicator N x \<partial>M = \<integral>\<^sup>+ x. 0 \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. u x * indicator N x \<partial>M = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. u x * indicator N x \<partial>M = \<integral>\<^sup>+ x. 0 \<partial>M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. u x * indicator N x \<partial>M = \<integral>\<^sup>+ x. 0 \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. u x * indicator N x \<partial>M = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. u x * indicator N x \<partial>M = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma elements_mat_append_rows: "A \<in> carrier_mat nr n \<Longrightarrow> B \<in> carrier_mat nr2 n \<Longrightarrow>
  elements_mat (A @\<^sub>r B) = elements_mat A \<union> elements_mat B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat nr n; B \<in> carrier_mat nr2 n\<rbrakk> \<Longrightarrow> elements_mat (A @\<^sub>r B) = elements_mat A \<union> elements_mat B
[PROOF STEP]
unfolding append_rows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat nr n; B \<in> carrier_mat nr2 n\<rbrakk> \<Longrightarrow> elements_mat (four_block_mat A (0\<^sub>m (dim_row A) 0) B (0\<^sub>m (dim_row B) 0)) = elements_mat A \<union> elements_mat B
[PROOF STEP]
by (subst elements_four_block_mat_id, auto)


[STATEMENT]
lemma par_strict_col2_par_strict:
  assumes "E \<noteq> F" and
    "A B ParStrict C D" and
    "Col C D E" and
    "Col C D F"
  shows "A B ParStrict E F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A B ParStrict E F
[PROOF STEP]
by (smt ParStrict_def assms(1) assms(2) assms(3) assms(4) col2_cop__cop colx not_col_permutation_1 par_strict_neq1 par_strict_symmetry)


[STATEMENT]
lemma turan_mono :
  fixes n p q :: nat
  assumes "0 < q" and "q < p" and "p \<le> n"
  shows "(1 - 1 / q) * n^2 / 2 \<le> (1 - 1 / (p-1)) * n^2 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - 1 / real q) * real (n\<^sup>2) / 2 \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < q
q < p
p \<le> n

goal (1 subgoal):
 1. (1 - 1 / real q) * real (n\<^sup>2) / 2 \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
by (simp add: Extended_Nonnegative_Real.divide_right_mono_ennreal Real.inverse_of_nat_le)


[STATEMENT]
lemma pred_not_lt_is_zero: "(\<not> n - Suc 0 < n) \<longleftrightarrow> n=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> n - Suc 0 < n) = (n = 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma real_gauss_int_norm: "real (gauss_int_norm z) = norm (gauss2complex z) ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (gauss_int_norm z) = (cmod (gauss2complex z))\<^sup>2
[PROOF STEP]
by (auto simp: cmod_def gauss_int_norm_def)


[STATEMENT]
lemma differentiable_divide [simp, derivative_intros]:
  fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_field"
  shows "f differentiable (at x within s) \<Longrightarrow> g differentiable (at x within s) \<Longrightarrow>
    g x \<noteq> 0 \<Longrightarrow> (\<lambda>x. f x / g x) differentiable (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable at x within s; g differentiable at x within s; g x \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> (\<lambda>x. f x / g x) differentiable at x within s
[PROOF STEP]
unfolding divide_inverse
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable at x within s; g differentiable at x within s; g x \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> (\<lambda>x. f x * inverse (g x)) differentiable at x within s
[PROOF STEP]
by simp


[STATEMENT]
lemma mod_eq_imp_diff_mod_eq_divisor: "
  \<lbrakk> a < b; 0 < m; a mod m = b mod m \<rbrakk> \<Longrightarrow>
  Suc ((b - Suc a) mod m) = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < b; 0 < m; a mod m = b mod m\<rbrakk> \<Longrightarrow> Suc ((b - Suc a) mod m) = m
[PROOF STEP]
apply (drule mod_eq_imp_diff_mod_0[of a])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < b; 0 < m; (b - a) mod m = 0\<rbrakk> \<Longrightarrow> Suc ((b - Suc a) mod m) = m
[PROOF STEP]
apply (frule iffD2[OF zero_less_diff])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < b; 0 < m; (b - a) mod m = 0; 0 < b - a\<rbrakk> \<Longrightarrow> Suc ((b - Suc a) mod m) = m
[PROOF STEP]
apply (drule mod_0_imp_mod_pred[of "b-a" m], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < b; 0 < m; (b - a) mod m = 0; (b - a - Suc 0) mod m = m - Suc 0\<rbrakk> \<Longrightarrow> Suc ((b - Suc a) mod m) = m
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma isGlb_dual_isLub: "isGlb S cl = isLub S (dual cl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isGlb S cl = isLub S (dual cl)
[PROOF STEP]
by (simp add: isLub_def isGlb_def dual_def converse_unfold)


[STATEMENT]
lemma fps_dehorner:
  fixes a b c :: "'a :: semiring_1 fps" and d e f :: "'b :: ring_1 fps"
  shows
  "(b + c) * fps_X = b * fps_X + c * fps_X" "(a * fps_X) * fps_X = a * fps_X ^ 2"
  "a * fps_X ^ m * fps_X = a * fps_X ^ (Suc m)" "a * fps_X * fps_X ^ m = a * fps_X ^ (Suc m)"
  "a * fps_X^m * fps_X^n = a * fps_X^(m+n)" "a + (b + c) = a + b + c" "a * 1 = a" "1 * a = a"
  "d + - e = d - e" "(-d) * e = - (d * e)" "d + (e - f) = d + e - f"
  "(d - e) * fps_X = d * fps_X - e * fps_X" "fps_X * fps_X = fps_X^2" "fps_X * fps_X^m = fps_X^(Suc m)" "fps_X^m * fps_X = fps_X^Suc m"
  "fps_X^m * fps_X^n = fps_X^(m + n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((((b + c) * fps_X = b * fps_X + c * fps_X &&& a * fps_X * fps_X = a * fps_X\<^sup>2) &&& a * fps_X ^ m * fps_X = a * fps_X ^ Suc m &&& a * fps_X * fps_X ^ m = a * fps_X ^ Suc m) &&& (a * fps_X ^ m * fps_X ^ n = a * fps_X ^ (m + n) &&& a + (b + c) = a + b + c) &&& a * 1 = a &&& 1 * a = a) &&& ((d + - e = d - e &&& - d * e = - (d * e)) &&& d + (e - f) = d + e - f &&& (d - e) * fps_X = d * fps_X - e * fps_X) &&& (fps_X * fps_X = fps_X\<^sup>2 &&& fps_X * fps_X ^ m = fps_X ^ Suc m) &&& fps_X ^ m * fps_X = fps_X ^ Suc m &&& fps_X ^ m * fps_X ^ n = fps_X ^ (m + n)
[PROOF STEP]
by (simp_all add: algebra_simps power2_eq_square power_add power_commutes)


[STATEMENT]
lemma quasinorm_intersection_assoc:
  "(N1 \<inter>\<^sub>N N2) \<inter>\<^sub>N N3 =\<^sub>N N1 \<inter>\<^sub>N (N2 \<inter>\<^sub>N N3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (N1 \<inter>\<^sub>N N2) \<inter>\<^sub>N N3 =\<^sub>N N1 \<inter>\<^sub>N (N2 \<inter>\<^sub>N N3)
[PROOF STEP]
unfolding quasinorm_equivalent_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (N1 \<inter>\<^sub>N N2) \<inter>\<^sub>N N3 \<subseteq>\<^sub>N N1 \<inter>\<^sub>N (N2 \<inter>\<^sub>N N3) \<and> N1 \<inter>\<^sub>N (N2 \<inter>\<^sub>N N3) \<subseteq>\<^sub>N (N1 \<inter>\<^sub>N N2) \<inter>\<^sub>N N3
[PROOF STEP]
by (meson order_trans quasinorm_intersection_minimum quasinorm_intersection_subset)


[STATEMENT]
lemma path_connected_space_iff_components_eq:
  "path_connected_space X \<longleftrightarrow>
    (\<forall>C \<in> path_components_of X. \<forall>C' \<in> path_components_of X. C = C')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connected_space X = (\<forall>C\<in>path_components_of X. \<forall>C'\<in>path_components_of X. C = C')
[PROOF STEP]
unfolding path_components_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connected_space X = (\<forall>C\<in>path_component_of_set X ` topspace X. \<forall>C'\<in>path_component_of_set X ` topspace X. C = C')
[PROOF STEP]
proof (intro iffI ballI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>C C'. \<lbrakk>path_connected_space X; C \<in> path_component_of_set X ` topspace X; C' \<in> path_component_of_set X ` topspace X\<rbrakk> \<Longrightarrow> C = C'
 2. \<forall>C\<in>path_component_of_set X ` topspace X. \<forall>C'\<in>path_component_of_set X ` topspace X. C = C' \<Longrightarrow> path_connected_space X
[PROOF STEP]
assume "\<forall>C \<in> path_component_of_set X ` topspace X.
             \<forall>C' \<in> path_component_of_set X ` topspace X. C = C'"
[PROOF STATE]
proof (state)
this:
\<forall>C\<in>path_component_of_set X ` topspace X. \<forall>C'\<in>path_component_of_set X ` topspace X. C = C'

goal (2 subgoals):
 1. \<And>C C'. \<lbrakk>path_connected_space X; C \<in> path_component_of_set X ` topspace X; C' \<in> path_component_of_set X ` topspace X\<rbrakk> \<Longrightarrow> C = C'
 2. \<forall>C\<in>path_component_of_set X ` topspace X. \<forall>C'\<in>path_component_of_set X ` topspace X. C = C' \<Longrightarrow> path_connected_space X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>C\<in>path_component_of_set X ` topspace X. \<forall>C'\<in>path_component_of_set X ` topspace X. C = C'
[PROOF STEP]
show "path_connected_space X"
[PROOF STATE]
proof (prove)
using this:
\<forall>C\<in>path_component_of_set X ` topspace X. \<forall>C'\<in>path_component_of_set X ` topspace X. C = C'

goal (1 subgoal):
 1. path_connected_space X
[PROOF STEP]
using path_component_of_refl path_connected_space_iff_path_component
[PROOF STATE]
proof (prove)
using this:
\<forall>C\<in>path_component_of_set X ` topspace X. \<forall>C'\<in>path_component_of_set X ` topspace X. C = C'
path_component_of ?X ?x ?x = (?x \<in> topspace ?X)
path_connected_space ?X = (\<forall>x\<in>topspace ?X. \<forall>y\<in>topspace ?X. path_component_of ?X x y)

goal (1 subgoal):
 1. path_connected_space X
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
path_connected_space X

goal (1 subgoal):
 1. \<And>C C'. \<lbrakk>path_connected_space X; C \<in> path_component_of_set X ` topspace X; C' \<in> path_component_of_set X ` topspace X\<rbrakk> \<Longrightarrow> C = C'
[PROOF STEP]
qed (auto simp: path_connected_space_path_component_set)


[STATEMENT]
lemma kruskal_injective_inv_2:
  assumes "arc e"
      and "acyclic f"
    shows "top * e * f\<^sup>T\<^sup>\<star> * f\<^sup>T \<le> -e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. top * e * f\<^sup>T\<^sup>\<star> * f\<^sup>T \<le> - e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. top * e * f\<^sup>T\<^sup>\<star> * f\<^sup>T \<le> - e
[PROOF STEP]
have "f \<le> -f\<^sup>T\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<le> - f\<^sup>T\<^sup>\<star>
[PROOF STEP]
using assms(2) acyclic_star_below_complement p_antitone_iff
[PROOF STATE]
proof (prove)
using this:
pd_kleene_allegory_class.acyclic f
pd_kleene_allegory_class.acyclic ?w = (?w\<^sup>T\<^sup>\<star> \<le> - ?w)
(?x \<le> - ?y) = (?y \<le> - ?x)

goal (1 subgoal):
 1. f \<le> - f\<^sup>T\<^sup>\<star>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f \<le> - f\<^sup>T\<^sup>\<star>

goal (1 subgoal):
 1. top * e * f\<^sup>T\<^sup>\<star> * f\<^sup>T \<le> - e
[PROOF STEP]
hence "e * f \<le> top * e * -f\<^sup>T\<^sup>\<star>"
[PROOF STATE]
proof (prove)
using this:
f \<le> - f\<^sup>T\<^sup>\<star>

goal (1 subgoal):
 1. e * f \<le> top * e * - f\<^sup>T\<^sup>\<star>
[PROOF STEP]
by (simp add: comp_isotone top_left_mult_increasing)
[PROOF STATE]
proof (state)
this:
e * f \<le> top * e * - f\<^sup>T\<^sup>\<star>

goal (1 subgoal):
 1. top * e * f\<^sup>T\<^sup>\<star> * f\<^sup>T \<le> - e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
e * f \<le> top * e * - f\<^sup>T\<^sup>\<star>

goal (1 subgoal):
 1. top * e * f\<^sup>T\<^sup>\<star> * f\<^sup>T \<le> - e
[PROOF STEP]
have "... = -(top * e * f\<^sup>T\<^sup>\<star>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. top * e * - f\<^sup>T\<^sup>\<star> = - (top * e * f\<^sup>T\<^sup>\<star>)
[PROOF STEP]
by (metis assms(1) comp_mapping_complement conv_dist_comp conv_involutive conv_top)
[PROOF STATE]
proof (state)
this:
top * e * - f\<^sup>T\<^sup>\<star> = - (top * e * f\<^sup>T\<^sup>\<star>)

goal (1 subgoal):
 1. top * e * f\<^sup>T\<^sup>\<star> * f\<^sup>T \<le> - e
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
e * f \<le> - (top * e * f\<^sup>T\<^sup>\<star>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
e * f \<le> - (top * e * f\<^sup>T\<^sup>\<star>)

goal (1 subgoal):
 1. top * e * f\<^sup>T\<^sup>\<star> * f\<^sup>T \<le> - e
[PROOF STEP]
using schroeder_4_p
[PROOF STATE]
proof (prove)
using this:
e * f \<le> - (top * e * f\<^sup>T\<^sup>\<star>)
(?x * ?y \<le> - ?z) = (?z * ?y\<^sup>T \<le> - ?x)

goal (1 subgoal):
 1. top * e * f\<^sup>T\<^sup>\<star> * f\<^sup>T \<le> - e
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
top * e * f\<^sup>T\<^sup>\<star> * f\<^sup>T \<le> - e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unbounded_k_infinite: "\<forall>m>k. \<exists>n>m. n \<in> S \<Longrightarrow> infinite (S::nat set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m>k. \<exists>n>m. n \<in> S \<Longrightarrow> infinite S
[PROOF STEP]
apply (clarsimp simp add: finite_nat_set_iff_bounded)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<forall>m>k. \<exists>n>m. n \<in> S \<Longrightarrow> \<exists>n\<in>S. \<not> n < m
[PROOF STEP]
apply (drule_tac x="Suc (max m k)" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. k < Suc (max m k) \<longrightarrow> (\<exists>n>Suc (max m k). n \<in> S) \<Longrightarrow> \<exists>n\<in>S. \<not> n < m
[PROOF STEP]
using less_Suc_eq
[PROOF STATE]
proof (prove)
using this:
(?m < Suc ?n) = (?m < ?n \<or> ?m = ?n)

goal (1 subgoal):
 1. \<And>m. k < Suc (max m k) \<longrightarrow> (\<exists>n>Suc (max m k). n \<in> S) \<Longrightarrow> \<exists>n\<in>S. \<not> n < m
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma continuous_inner[continuous_intros]:
  assumes "continuous F f"
    and "continuous F g"
  shows "continuous F (\<lambda>x. inner (f x) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F (\<lambda>x. f x \<bullet> g x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous F f
continuous F g

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

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


[STATEMENT]
lemma ideal_UNIV: "ideal UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal UNIV
[PROOF STEP]
unfolding ideal_def left_ideal_def right_ideal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (subgroup UNIV \<and> (\<forall>x\<in>UNIV. \<forall>r. r * x \<in> UNIV)) \<and> subgroup UNIV \<and> (\<forall>x\<in>UNIV. \<forall>r. x * r \<in> UNIV)
[PROOF STEP]
using subgroup_UNIV
[PROOF STATE]
proof (prove)
using this:
subgroup UNIV

goal (1 subgoal):
 1. (subgroup UNIV \<and> (\<forall>x\<in>UNIV. \<forall>r. r * x \<in> UNIV)) \<and> subgroup UNIV \<and> (\<forall>x\<in>UNIV. \<forall>r. x * r \<in> UNIV)
[PROOF STEP]
by auto


[STATEMENT]
lemma mset_mergesort_by_rel_split [simp]:
  "mset (fst (mergesort_by_rel_split (xs1, xs2) xs)) +
   mset (snd (mergesort_by_rel_split (xs1, xs2) xs)) =
   mset xs + mset xs1 + mset xs2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (fst (mergesort_by_rel_split (xs1, xs2) xs)) + mset (snd (mergesort_by_rel_split (xs1, xs2) xs)) = mset xs + mset xs1 + mset xs2
[PROOF STEP]
apply (induct xs arbitrary: xs1 xs2 rule: list_induct_first2)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>xs1 xs2. mset (fst (mergesort_by_rel_split (xs1, xs2) [])) + mset (snd (mergesort_by_rel_split (xs1, xs2) [])) = mset [] + mset xs1 + mset xs2
 2. \<And>x xs1 xs2. mset (fst (mergesort_by_rel_split (xs1, xs2) [x])) + mset (snd (mergesort_by_rel_split (xs1, xs2) [x])) = mset [x] + mset xs1 + mset xs2
 3. \<And>x1 x2 xs xs1 xs2. (\<And>xs1 xs2. mset (fst (mergesort_by_rel_split (xs1, xs2) xs)) + mset (snd (mergesort_by_rel_split (xs1, xs2) xs)) = mset xs + mset xs1 + mset xs2) \<Longrightarrow> mset (fst (mergesort_by_rel_split (xs1, xs2) (x1 # x2 # xs))) + mset (snd (mergesort_by_rel_split (xs1, xs2) (x1 # x2 # xs))) = mset (x1 # x2 # xs) + mset xs1 + mset xs2
[PROOF STEP]
apply (simp_all add: ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma delta_min_append:
  "\<delta>_min (as @ bs) = min (\<delta>_min as) (\<delta>_min bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<delta>_min (as @ bs) = min (\<delta>_min as) (\<delta>_min bs)
[PROOF STEP]
by (induct as, insert delta_le_one[of bs], auto)


[STATEMENT]
lemma euler_liar_mult':
  assumes "1 < n" "coprime y n"
  shows "euler_liar y n \<Longrightarrow> euler_witness x n \<Longrightarrow> euler_witness (x*y) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>euler_liar y n; euler_witness x n\<rbrakk> \<Longrightarrow> euler_witness (x * y) n
[PROOF STEP]
proof(simp add: euler_witness_def power_mult_distrib, rule cong_mult_uneq', goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>[Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n); [Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)\<rbrakk> \<Longrightarrow> coprime (Jacobi y (int n)) (int n)
 2. \<lbrakk>[Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n); [Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)\<rbrakk> \<Longrightarrow> [Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)
 3. \<lbrakk>[Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n); [Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)\<rbrakk> \<Longrightarrow> [Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n)
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
[Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n)
[Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)

goal (3 subgoals):
 1. \<lbrakk>[Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n); [Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)\<rbrakk> \<Longrightarrow> coprime (Jacobi y (int n)) (int n)
 2. \<lbrakk>[Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n); [Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)\<rbrakk> \<Longrightarrow> [Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)
 3. \<lbrakk>[Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n); [Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)\<rbrakk> \<Longrightarrow> [Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n)
[Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
[Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n)
[Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)

goal (1 subgoal):
 1. coprime (Jacobi y (int n)) (int n)
[PROOF STEP]
using Jacobi_eq_0_iff_not_coprime[of n y] Jacobi_values[of y n] and assms
[PROOF STATE]
proof (prove)
using this:
[Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n)
[Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)
\<lbrakk>int n \<noteq> 0; int n \<noteq> 1\<rbrakk> \<Longrightarrow> (Jacobi y (int n) = 0) = (\<not> coprime y (int n))
Jacobi y (int n) \<in> {1, - 1, 0}
1 < n
coprime y (int n)

goal (1 subgoal):
 1. coprime (Jacobi y (int n)) (int n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coprime (Jacobi y (int n)) (int n)

goal (2 subgoals):
 1. \<lbrakk>[Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n); [Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)\<rbrakk> \<Longrightarrow> [Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)
 2. \<lbrakk>[Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n); [Jacobi x (int n) \<noteq> x ^ ((n - Suc 0) div 2)] (mod int n)\<rbrakk> \<Longrightarrow> [Jacobi y (int n) = y ^ ((n - Suc 0) div 2)] (mod int n)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma icard_singleton: "icard {a} = eSuc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. icard {a} = eSuc 0
[PROOF STEP]
by (simp add: icard_finite eSuc_enat)


[STATEMENT]
lemma ceiling_eq_iff: "\<lceil>x\<rceil> = a \<longleftrightarrow> of_int a - 1 < x \<and> x \<le> of_int a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lceil>x\<rceil> = a) = (of_int a - (1::'a) < x \<and> x \<le> of_int a)
[PROOF STEP]
using ceiling_correct ceiling_unique
[PROOF STATE]
proof (prove)
using this:
of_int \<lceil>?x\<rceil> - (1::?'a) < ?x \<and> ?x \<le> of_int \<lceil>?x\<rceil>
\<lbrakk>of_int ?z - (1::?'a) < ?x; ?x \<le> of_int ?z\<rbrakk> \<Longrightarrow> \<lceil>?x\<rceil> = ?z

goal (1 subgoal):
 1. (\<lceil>x\<rceil> = a) = (of_int a - (1::'a) < x \<and> x \<le> of_int a)
[PROOF STEP]
by auto


[STATEMENT]
lemma pi_approx_54_decimals:
  "abs (pi - 3.141592653589793238462643383279502884197169399375105821 :: real) \<le> inverse (10^54)"
  (is "abs (pi - ?pi') \<le> _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
define a :: real
    where "a = 2829469759662002867886529831139137601191652261996513014734415222704732791803 /
           1062141879292765061960538947347721564047051545995266466660439319087625011200"
[PROOF STATE]
proof (state)
this:
a = 2829469759662002867886529831139137601191652261996513014734415222704732791803 / 1062141879292765061960538947347721564047051545995266466660439319087625011200

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
define b :: real
    where "b = 13355545553549848714922837267299490903143206628621657811747118592 /
           23792006023392488526789546722992491355941103837356113731091180925"
[PROOF STATE]
proof (state)
this:
b = 13355545553549848714922837267299490903143206628621657811747118592 / 23792006023392488526789546722992491355941103837356113731091180925

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
define c :: real
    where "c = 28274063397213534906669125255762067746830085389618481175335056 /
           337877029279505250241149903214554249587517250716358486542628059"
[PROOF STATE]
proof (state)
this:
c = 28274063397213534906669125255762067746830085389618481175335056 / 337877029279505250241149903214554249587517250716358486542628059

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
let ?pi'' = "3882327391761098513316067116522233897127356523627918964967729040413954225768920394233198626889767468122598417405434625348404038165437924058179155035564590497837027530349 /
               1235783190199688165469648572769847552336447197542738425378629633275352407743112409829873464564018488572820294102599160968781449606552922108667790799771278860366957772800"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
define eq :: "real \<Rightarrow> real \<Rightarrow> bool" where "eq = (=)"
[PROOF STATE]
proof (state)
this:
eq = (=)

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
have "abs (pi - pi_approx2 4) \<le> inverse (2^183)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>pi - pi_approx2 4\<bar> \<le> inverse (2 ^ 183)
[PROOF STEP]
by (rule pi_approx2') simp_all
[PROOF STATE]
proof (state)
this:
\<bar>pi - pi_approx2 4\<bar> \<le> inverse (2 ^ 183)

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>pi - pi_approx2 4\<bar> \<le> inverse (2 ^ 183)

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
have "pi_approx2 4 = 48 * arctan_approx 24 (1 / 18) +
                            32 * arctan_approx 16 (1 / 57) -
                            20 * arctan_approx 12 (1 / 239)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi_approx2 4 = 48 * arctan_approx 24 (1 / 18) + 32 * arctan_approx 16 (1 / 57) - 20 * arctan_approx 12 (1 / 239)
[PROOF STEP]
unfolding pi_approx2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 48 * arctan_approx (6 * 4) (1 / 18) + 32 * arctan_approx (4 * 4) (1 / 57) - 20 * arctan_approx (3 * 4) (1 / 239) = 48 * arctan_approx 24 (1 / 18) + 32 * arctan_approx 16 (1 / 57) - 20 * arctan_approx 12 (1 / 239)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pi_approx2 4 = 48 * arctan_approx 24 (1 / 18) + 32 * arctan_approx 16 (1 / 57) - 20 * arctan_approx 12 (1 / 239)

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pi_approx2 4 = 48 * arctan_approx 24 (1 / 18) + 32 * arctan_approx 16 (1 / 57) - 20 * arctan_approx 12 (1 / 239)

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
have [unfolded eq_def]: "eq (48 * arctan_approx 24 (1 / 18)) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq (48 * arctan_approx 24 (1 / 18)) a
[PROOF STEP]
by (simp add: arctan_approx_def' power2_eq_square,
        simp add: expand_arctan_approx, unfold a_def eq_def, rule refl)
[PROOF STATE]
proof (state)
this:
48 * arctan_approx 24 (1 / 18) = a

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
48 * arctan_approx 24 (1 / 18) = a

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
have [unfolded eq_def]: "eq (32 * arctan_approx 16 (1 / 57::real)) b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq (32 * arctan_approx 16 (1 / 57)) b
[PROOF STEP]
by (simp add: arctan_approx_def' power2_eq_square,
        simp add: expand_arctan_approx, unfold b_def eq_def, rule refl)
[PROOF STATE]
proof (state)
this:
32 * arctan_approx 16 (1 / 57) = b

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
32 * arctan_approx 16 (1 / 57) = b

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
have [unfolded eq_def]: "eq (20 * arctan_approx 12 (1 / 239::real)) c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq (20 * arctan_approx 12 (1 / 239)) c
[PROOF STEP]
by (simp add: arctan_approx_def' power2_eq_square,
        simp add: expand_arctan_approx, unfold c_def eq_def, rule refl)
[PROOF STATE]
proof (state)
this:
20 * arctan_approx 12 (1 / 239) = c

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
20 * arctan_approx 12 (1 / 239) = c

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
have [unfolded eq_def]:
    "eq (a + b) (34326487387865555303797183505809267914709125998469664969258315922216638779011304447624792548723974104030355722677 /
                 10642967245546718617684989689985787964158885991018703366677373121531695267093031090059801733340658960857196134400)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq (a + b) (34326487387865555303797183505809267914709125998469664969258315922216638779011304447624792548723974104030355722677 / 10642967245546718617684989689985787964158885991018703366677373121531695267093031090059801733340658960857196134400)
[PROOF STEP]
by (unfold a_def b_def c_def, simp, unfold eq_def, rule refl)
[PROOF STATE]
proof (state)
this:
a + b = 34326487387865555303797183505809267914709125998469664969258315922216638779011304447624792548723974104030355722677 / 10642967245546718617684989689985787964158885991018703366677373121531695267093031090059801733340658960857196134400

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a + b = 34326487387865555303797183505809267914709125998469664969258315922216638779011304447624792548723974104030355722677 / 10642967245546718617684989689985787964158885991018703366677373121531695267093031090059801733340658960857196134400

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
have [unfolded eq_def]: "eq (\<dots> - c) ?pi''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq (34326487387865555303797183505809267914709125998469664969258315922216638779011304447624792548723974104030355722677 / 10642967245546718617684989689985787964158885991018703366677373121531695267093031090059801733340658960857196134400 - c) (3882327391761098513316067116522233897127356523627918964967729040413954225768920394233198626889767468122598417405434625348404038165437924058179155035564590497837027530349 / 1235783190199688165469648572769847552336447197542738425378629633275352407743112409829873464564018488572820294102599160968781449606552922108667790799771278860366957772800)
[PROOF STEP]
by (unfold a_def b_def c_def, simp, unfold eq_def, rule refl)
  \<comment> \<open>This is incredibly slow because the numerators and denominators are huge.\<close>
[PROOF STATE]
proof (state)
this:
34326487387865555303797183505809267914709125998469664969258315922216638779011304447624792548723974104030355722677 / 10642967245546718617684989689985787964158885991018703366677373121531695267093031090059801733340658960857196134400 - c = 3882327391761098513316067116522233897127356523627918964967729040413954225768920394233198626889767468122598417405434625348404038165437924058179155035564590497837027530349 / 1235783190199688165469648572769847552336447197542738425378629633275352407743112409829873464564018488572820294102599160968781449606552922108667790799771278860366957772800

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>pi - 3882327391761098513316067116522233897127356523627918964967729040413954225768920394233198626889767468122598417405434625348404038165437924058179155035564590497837027530349 / 1235783190199688165469648572769847552336447197542738425378629633275352407743112409829873464564018488572820294102599160968781449606552922108667790799771278860366957772800\<bar> \<le> inverse (2 ^ 183)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>pi - 3882327391761098513316067116522233897127356523627918964967729040413954225768920394233198626889767468122598417405434625348404038165437924058179155035564590497837027530349 / 1235783190199688165469648572769847552336447197542738425378629633275352407743112409829873464564018488572820294102599160968781449606552922108667790799771278860366957772800\<bar> \<le> inverse (2 ^ 183)

goal (1 subgoal):
 1. \<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)
[PROOF STEP]
by (rule approx_coarsen) simp
[PROOF STATE]
proof (state)
this:
\<bar>pi - 3141592653589793238462643383279502884197169399375105821 / 10 ^ 54\<bar> \<le> inverse (10 ^ 54)

goal:
No subgoals!
[PROOF STEP]
qed


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

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

goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y \<in> s
[PROOF STEP]
by fast


[STATEMENT]
lemma not_coprime_cong_eq_0: "prime p \<Longrightarrow> \<not>coprime a p \<Longrightarrow> [a = 0] (mod p)" for a p :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; \<not> coprime a p\<rbrakk> \<Longrightarrow> [a = 0] (mod p)
[PROOF STEP]
unfolding cong_iff_dvd_diff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; \<not> coprime a p\<rbrakk> \<Longrightarrow> p dvd a - 0
[PROOF STEP]
using prime_imp_coprime[of p a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime p; \<not> p dvd a\<rbrakk> \<Longrightarrow> coprime p a

goal (1 subgoal):
 1. \<lbrakk>prime p; \<not> coprime a p\<rbrakk> \<Longrightarrow> p dvd a - 0
[PROOF STEP]
by (auto simp: coprime_commute)


[STATEMENT]
lemma construct_lhs_matches_solve_for_lhs:
  fixes p:: "real poly"
  fixes qs :: "real poly list"
  fixes subsets :: "nat list list"
  fixes signs :: "rat list list"
  assumes match: "satisfy_equation p qs subsets signs"
  assumes invertible_mat: "invertible_mat (matrix_A signs subsets)"
  shows "(construct_lhs_vector p qs signs) = solve_for_lhs p qs subsets (matrix_A signs subsets)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
have matrix_equation_hyp: "(mult_mat_vec (matrix_A signs subsets) (construct_lhs_vector p qs signs) = (construct_rhs_vector p qs subsets))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M_mat signs subsets *\<^sub>v w_vec p qs signs = v_vec p qs subsets
[PROOF STEP]
using match
[PROOF STATE]
proof (prove)
using this:
satisfy_equation p qs subsets signs

goal (1 subgoal):
 1. M_mat signs subsets *\<^sub>v w_vec p qs signs = v_vec p qs subsets
[PROOF STEP]
unfolding satisfy_equation_def
[PROOF STATE]
proof (prove)
using this:
M_mat signs subsets *\<^sub>v w_vec p qs signs = v_vec p qs subsets

goal (1 subgoal):
 1. M_mat signs subsets *\<^sub>v w_vec p qs signs = v_vec p qs subsets
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M_mat signs subsets *\<^sub>v w_vec p qs signs = v_vec p qs subsets

goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M_mat signs subsets *\<^sub>v w_vec p qs signs = v_vec p qs subsets
[PROOF STEP]
have eqn_hyp: " ((matr_option (dim_row (matrix_A signs subsets))
     (mat_inverse (matrix_A signs subsets))) *\<^sub>v (mult_mat_vec (matrix_A signs subsets) (construct_lhs_vector p qs signs)) =
      mult_mat_vec (matr_option (dim_row (matrix_A signs subsets))
     (mat_inverse (matrix_A signs subsets))) (construct_rhs_vector p qs subsets))"
[PROOF STATE]
proof (prove)
using this:
M_mat signs subsets *\<^sub>v w_vec p qs signs = v_vec p qs subsets

goal (1 subgoal):
 1. matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v v_vec p qs subsets
[PROOF STEP]
using invertible_mat
[PROOF STATE]
proof (prove)
using this:
M_mat signs subsets *\<^sub>v w_vec p qs signs = v_vec p qs subsets
invertible_mat (M_mat signs subsets)

goal (1 subgoal):
 1. matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v v_vec p qs subsets
[PROOF STEP]
by (simp add: matrix_equation_hyp)
[PROOF STATE]
proof (state)
this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v v_vec p qs subsets

goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
have match_hyp: "length subsets = length signs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length subsets = length signs
[PROOF STEP]
using same_size invertible_mat
[PROOF STATE]
proof (prove)
using this:
invertible_mat (M_mat ?signs ?subsets) \<Longrightarrow> length ?subsets = length ?signs
invertible_mat (M_mat signs subsets)

goal (1 subgoal):
 1. length subsets = length signs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length subsets = length signs

goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length subsets = length signs
[PROOF STEP]
have dim_hyp1: "matrix_A signs subsets \<in> carrier_mat (length signs) (length signs)"
[PROOF STATE]
proof (prove)
using this:
length subsets = length signs

goal (1 subgoal):
 1. M_mat signs subsets \<in> carrier_mat (length signs) (length signs)
[PROOF STEP]
using size_of_mat
[PROOF STATE]
proof (prove)
using this:
length subsets = length signs
M_mat ?signs ?subsets \<in> carrier_mat (length ?subsets) (length ?signs)

goal (1 subgoal):
 1. M_mat signs subsets \<in> carrier_mat (length signs) (length signs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)

goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)
[PROOF STEP]
have dim_hyp2: "matr_option (dim_row (matrix_A signs subsets))
     (mat_inverse (matrix_A signs subsets)) \<in> carrier_mat (length signs) (length signs)"
[PROOF STATE]
proof (prove)
using this:
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)

goal (1 subgoal):
 1. matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) \<in> carrier_mat (length signs) (length signs)
[PROOF STEP]
using invertible_mat dim_invertible
[PROOF STATE]
proof (prove)
using this:
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)
invertible_mat (M_mat signs subsets)
\<lbrakk>invertible_mat ?A; ?A \<in> carrier_mat ?n ?n\<rbrakk> \<Longrightarrow> matr_option (dim_row ?A) (mat_inverse ?A) \<in> carrier_mat ?n ?n

goal (1 subgoal):
 1. matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) \<in> carrier_mat (length signs) (length signs)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) \<in> carrier_mat (length signs) (length signs)

goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
have mult_assoc_hyp: "((matr_option (dim_row (matrix_A signs subsets))
     (mat_inverse (matrix_A signs subsets))) *\<^sub>v (mult_mat_vec (matrix_A signs subsets) (construct_lhs_vector p qs signs)))
    = (((matr_option (dim_row (matrix_A signs subsets))
     (mat_inverse (matrix_A signs subsets))) * (matrix_A signs subsets)) *\<^sub>v  (construct_lhs_vector p qs signs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs
[PROOF STEP]
using mult_assoc dim_hyp1 dim_hyp2 size_of_lhs
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?n ?n; ?B \<in> carrier_mat ?n ?n; dim_vec ?v = ?n\<rbrakk> \<Longrightarrow> ?A *\<^sub>v (?B *\<^sub>v ?v) = ?A * ?B *\<^sub>v ?v
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) \<in> carrier_mat (length signs) (length signs)
dim_vec (w_vec ?p ?qs ?signs) = length ?signs

goal (1 subgoal):
 1. matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs

goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
have cancel_helper: "(((matr_option (dim_row (matrix_A signs subsets))
     (mat_inverse (matrix_A signs subsets))) * (matrix_A signs subsets)) *\<^sub>v  (construct_lhs_vector p qs signs))
  = (1\<^sub>m (length signs)) *\<^sub>v   (construct_lhs_vector p qs signs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs = 1\<^sub>m (length signs) *\<^sub>v w_vec p qs signs
[PROOF STEP]
using invertible_means_mult_id[where A= "matrix_A signs subsets"] dim_hyp1
[PROOF STATE]
proof (prove)
using this:
invertible_mat (M_mat signs subsets) \<Longrightarrow> matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets = 1\<^sub>m (dim_row (M_mat signs subsets))
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)

goal (1 subgoal):
 1. matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs = 1\<^sub>m (length signs) *\<^sub>v w_vec p qs signs
[PROOF STEP]
by (simp add: invertible_mat match_hyp)
[PROOF STATE]
proof (state)
this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs = 1\<^sub>m (length signs) *\<^sub>v w_vec p qs signs

goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs = 1\<^sub>m (length signs) *\<^sub>v w_vec p qs signs
[PROOF STEP]
have cancel_hyp: "(((matr_option (dim_row (matrix_A signs subsets))
     (mat_inverse (matrix_A signs subsets))) * (matrix_A signs subsets)) *\<^sub>v  (construct_lhs_vector p qs signs))
  = (construct_lhs_vector p qs signs)"
[PROOF STATE]
proof (prove)
using this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs = 1\<^sub>m (length signs) *\<^sub>v w_vec p qs signs

goal (1 subgoal):
 1. matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs = w_vec p qs signs
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matr_option (length subsets) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs = 1\<^sub>m (length signs) *\<^sub>v w_vec p qs signs \<Longrightarrow> 1\<^sub>m (length signs) *\<^sub>v w_vec p qs signs = w_vec p qs signs
[PROOF STEP]
by (metis carrier_vec_dim_vec one_mult_mat_vec size_of_lhs)
[PROOF STATE]
proof (state)
this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs = w_vec p qs signs

goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs = w_vec p qs signs
[PROOF STEP]
have mult_hyp: "((matr_option (dim_row (matrix_A signs subsets))
     (mat_inverse (matrix_A signs subsets))) *\<^sub>v (mult_mat_vec (matrix_A signs subsets) (construct_lhs_vector p qs signs)))
    = (construct_lhs_vector p qs signs)"
[PROOF STATE]
proof (prove)
using this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs = w_vec p qs signs

goal (1 subgoal):
 1. matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = w_vec p qs signs
[PROOF STEP]
using mult_assoc_hyp cancel_hyp
[PROOF STATE]
proof (prove)
using this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs = w_vec p qs signs
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) * M_mat signs subsets *\<^sub>v w_vec p qs signs = w_vec p qs signs

goal (1 subgoal):
 1. matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = w_vec p qs signs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = w_vec p qs signs

goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = w_vec p qs signs
[PROOF STEP]
have "(construct_lhs_vector p qs signs) =  (mult_mat_vec (matr_option (dim_row (matrix_A signs subsets))
     (mat_inverse (matrix_A signs subsets))) (construct_rhs_vector p qs subsets)) "
[PROOF STATE]
proof (prove)
using this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = w_vec p qs signs

goal (1 subgoal):
 1. w_vec p qs signs = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v v_vec p qs subsets
[PROOF STEP]
using eqn_hyp
[PROOF STATE]
proof (prove)
using this:
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = w_vec p qs signs
matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v (M_mat signs subsets *\<^sub>v w_vec p qs signs) = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v v_vec p qs subsets

goal (1 subgoal):
 1. w_vec p qs signs = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v v_vec p qs subsets
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
w_vec p qs signs = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v v_vec p qs subsets

goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
w_vec p qs signs = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v v_vec p qs subsets
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
w_vec p qs signs = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v v_vec p qs subsets

goal (1 subgoal):
 1. w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)
[PROOF STEP]
unfolding solve_for_lhs_def
[PROOF STATE]
proof (prove)
using this:
w_vec p qs signs = matr_option (dim_row (M_mat signs subsets)) (mat_inverse (M_mat signs subsets)) *\<^sub>v v_vec p qs subsets

goal (1 subgoal):
 1. w_vec p qs signs = matr_option (dim_row (M_mat signs subsets)) (mat_inverse_var (M_mat signs subsets)) *\<^sub>v v_vec p qs subsets
[PROOF STEP]
by (simp add: mat_inverse_same)
[PROOF STATE]
proof (state)
this:
w_vec p qs signs = solve_for_lhs p qs subsets (M_mat signs subsets)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma div_mult_mod_eq_minus:
  fixes i j:: nat
  shows "(i div 2^n) * 2^n + i mod 2^n - (j div 2^n) * 2^n - j mod 2^n = i - j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i div 2 ^ n * 2 ^ n + i mod 2 ^ n - j div 2 ^ n * 2 ^ n - j mod 2 ^ n = i - j
[PROOF STEP]
by (simp add: div_mult_mod_eq algebra_simps)


[STATEMENT]
lemma compute_list_nth: "((x#xs) ! n) = (if n = 0 then x else (xs ! (n - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x # xs) ! n = (if n = 0 then x else xs ! (n - 1))
[PROOF STEP]
by (cases n, auto)


[STATEMENT]
lemma orthogonal_sumlist:
  assumes ortho: "\<And> x. x \<in> set S \<Longrightarrow> v \<bullet> x = 0" and S: "set S \<subseteq> carrier_vec n" and v: "v \<in> carrier_vec n"
  shows "v \<bullet> sumlist S = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<bullet> M.sumlist S = (0::'a)
[PROOF STEP]
by (rule orthocompl_span[OF ortho S v sumlist_in_span[OF S span_mem[OF S]]])


[STATEMENT]
lemma param_mset_minus[param]: "\<lbrakk>single_valued A; single_valued (A\<inverse>)\<rbrakk>
  \<Longrightarrow> ((-), (-)) \<in> \<langle>A\<rangle>mset_rel \<rightarrow> \<langle>A\<rangle>mset_rel \<rightarrow> \<langle>A\<rangle>mset_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>single_valued A; single_valued (A\<inverse>)\<rbrakk> \<Longrightarrow> ((-), (-)) \<in> \<langle>A\<rangle>mset_rel \<rightarrow> \<langle>A\<rangle>mset_rel \<rightarrow> \<langle>A\<rangle>mset_rel
[PROOF STEP]
apply (rule rel2pD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>single_valued A; single_valued (A\<inverse>)\<rbrakk> \<Longrightarrow> rel2p (\<langle>A\<rangle>mset_rel \<rightarrow> \<langle>A\<rangle>mset_rel \<rightarrow> \<langle>A\<rangle>mset_rel) (-) (-)
[PROOF STEP]
apply (simp add: rel2p)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>single_valued A; single_valued (A\<inverse>)\<rbrakk> \<Longrightarrow> rel_fun (rel_mset (rel2p A)) (rel_fun (rel_mset (rel2p A)) (rel_mset (rel2p A))) (-) (-)
[PROOF STEP]
apply (intro rel_funI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y xa ya. \<lbrakk>single_valued A; single_valued (A\<inverse>); rel_mset (rel2p A) x y; rel_mset (rel2p A) xa ya\<rbrakk> \<Longrightarrow> rel_mset (rel2p A) (x - xa) (y - ya)
[PROOF STEP]
apply (rule rel_mset_Minus_gen)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x y xa ya. \<lbrakk>single_valued A; single_valued (A\<inverse>); rel_mset (rel2p A) x y; rel_mset (rel2p A) xa ya\<rbrakk> \<Longrightarrow> bi_unique (rel2p A)
 2. \<And>x y xa ya. \<lbrakk>single_valued A; single_valued (A\<inverse>); rel_mset (rel2p A) x y; rel_mset (rel2p A) xa ya\<rbrakk> \<Longrightarrow> rel_mset (rel2p A) x y
 3. \<And>x y xa ya. \<lbrakk>single_valued A; single_valued (A\<inverse>); rel_mset (rel2p A) x y; rel_mset (rel2p A) xa ya\<rbrakk> \<Longrightarrow> rel_mset (rel2p A) xa ya
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>single_valued A; single_valued (A\<inverse>); rel_mset (rel2p A) x_ y_; rel_mset (rel2p A) xa_ ya_\<rbrakk> \<Longrightarrow> bi_unique (rel2p A)
[PROOF STEP]
apply (unfold IS_LEFT_UNIQUE_def[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>single_valued A; IS_LEFT_UNIQUE A; rel_mset (rel2p A) x_ y_; rel_mset (rel2p A) xa_ ya_\<rbrakk> \<Longrightarrow> bi_unique (rel2p A)
[PROOF STEP]
by (simp add: prop2p bi_unique_alt_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y xa ya. \<lbrakk>single_valued A; single_valued (A\<inverse>); rel_mset (rel2p A) x y; rel_mset (rel2p A) xa ya\<rbrakk> \<Longrightarrow> rel_mset (rel2p A) x y
 2. \<And>x y xa ya. \<lbrakk>single_valued A; single_valued (A\<inverse>); rel_mset (rel2p A) x y; rel_mset (rel2p A) xa ya\<rbrakk> \<Longrightarrow> rel_mset (rel2p A) xa ya
[PROOF STEP]
apply (simp; fail)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y xa ya. \<lbrakk>single_valued A; single_valued (A\<inverse>); rel_mset (rel2p A) x y; rel_mset (rel2p A) xa ya\<rbrakk> \<Longrightarrow> rel_mset (rel2p A) xa ya
[PROOF STEP]
apply (simp; fail)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bezout1_nat: "\<exists>(d::nat) x y. d dvd a \<and> d dvd b \<and> (a * x - b * y = d \<or> b * x - a * y = d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x - b * y = d \<or> b * x - a * y = d)
[PROOF STEP]
using bezout_add_nat[of a b]
[PROOF STATE]
proof (prove)
using this:
\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)

goal (1 subgoal):
 1. \<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x - b * y = d \<or> b * x - a * y = d)
[PROOF STEP]
by (metis add_diff_cancel_left')


[STATEMENT]
lemma cindex_pathE_constI:
  assumes "\<And>t. \<lbrakk>0<t;t<1\<rbrakk> \<Longrightarrow> g t=c"
  shows "cindex_pathE g z = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_pathE g z = 0
[PROOF STEP]
unfolding cindex_pathE_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindexE 0 1 (\<lambda>t. Im (g t - z) / Re (g t - z)) = 0
[PROOF STEP]
apply (rule cindexE_constI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t. \<lbrakk>0 < t; t < 1\<rbrakk> \<Longrightarrow> Im (g t - z) / Re (g t - z) = ?c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?t; ?t < 1\<rbrakk> \<Longrightarrow> g ?t = c

goal (1 subgoal):
 1. \<And>t. \<lbrakk>0 < t; t < 1\<rbrakk> \<Longrightarrow> Im (g t - z) / Re (g t - z) = ?c
[PROOF STEP]
by auto


[STATEMENT]
lemma restrict_fun: "\<lbrakk> f \<in> A \<rightarrow> B; A1 \<subseteq> A \<rbrakk> \<Longrightarrow> restrict f A1 \<in> A1 \<rightarrow> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; A1 \<subseteq> A\<rbrakk> \<Longrightarrow> restrict f A1 \<in> A1 \<rightarrow> B
[PROOF STEP]
apply (simp add:Pi_def restrict_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. x \<in> A \<longrightarrow> f x \<in> B; A1 \<subseteq> A\<rbrakk> \<Longrightarrow> \<forall>x. x \<in> A1 \<longrightarrow> f x \<in> B
[PROOF STEP]
apply (rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>x. x \<in> A \<longrightarrow> f x \<in> B; A1 \<subseteq> A\<rbrakk> \<Longrightarrow> x \<in> A1 \<longrightarrow> f x \<in> B
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>x. x \<in> A \<longrightarrow> f x \<in> B; A1 \<subseteq> A; x \<in> A1\<rbrakk> \<Longrightarrow> f x \<in> B
[PROOF STEP]
apply (simp add:subsetD)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fst_leq_snd_safe_distance:
  assumes "a\<^sub>e < a\<^sub>o"
  shows"fst_safe_distance \<le> snd_safe_distance"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst_safe_distance \<le> snd_safe_distance
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst_safe_distance \<le> snd_safe_distance
[PROOF STEP]
have "0 \<le> (v\<^sub>o / a\<^sub>o - v\<^sub>e / a\<^sub>e)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (v\<^sub>o / a\<^sub>o - v\<^sub>e / a\<^sub>e)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> (v\<^sub>o / a\<^sub>o - v\<^sub>e / a\<^sub>e)\<^sup>2

goal (1 subgoal):
 1. fst_safe_distance \<le> snd_safe_distance
[PROOF STEP]
hence 1: "0 \<le> (v\<^sub>o / a\<^sub>o)\<^sup>2 - 2 * v\<^sub>o * v\<^sub>e / (a\<^sub>o * a\<^sub>e) + (v\<^sub>e / a\<^sub>e)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
0 \<le> (v\<^sub>o / a\<^sub>o - v\<^sub>e / a\<^sub>e)\<^sup>2

goal (1 subgoal):
 1. 0 \<le> (v\<^sub>o / a\<^sub>o)\<^sup>2 - 2 * v\<^sub>o * v\<^sub>e / (a\<^sub>o * a\<^sub>e) + (v\<^sub>e / a\<^sub>e)\<^sup>2
[PROOF STEP]
by (auto simp add: power_def algebra_simps)
[PROOF STATE]
proof (state)
this:
0 \<le> (v\<^sub>o / a\<^sub>o)\<^sup>2 - 2 * v\<^sub>o * v\<^sub>e / (a\<^sub>o * a\<^sub>e) + (v\<^sub>e / a\<^sub>e)\<^sup>2

goal (1 subgoal):
 1. fst_safe_distance \<le> snd_safe_distance
[PROOF STEP]
from hyps
[PROOF STATE]
proof (chain)
picking this:
0 \<le> v\<^sub>e
0 \<le> v\<^sub>o
a\<^sub>e < 0
a\<^sub>o < 0
s\<^sub>e < s\<^sub>o
[PROOF STEP]
have "0 \<le> a\<^sub>o * a\<^sub>e"
[PROOF STATE]
proof (prove)
using this:
0 \<le> v\<^sub>e
0 \<le> v\<^sub>o
a\<^sub>e < 0
a\<^sub>o < 0
s\<^sub>e < s\<^sub>o

goal (1 subgoal):
 1. 0 \<le> a\<^sub>o * a\<^sub>e
[PROOF STEP]
by (simp add: mult_nonpos_nonpos)
[PROOF STATE]
proof (state)
this:
0 \<le> a\<^sub>o * a\<^sub>e

goal (1 subgoal):
 1. fst_safe_distance \<le> snd_safe_distance
[PROOF STEP]
from mult_right_mono[OF 1 this] hyps
[PROOF STATE]
proof (chain)
picking this:
0 * (a\<^sub>o * a\<^sub>e) \<le> ((v\<^sub>o / a\<^sub>o)\<^sup>2 - 2 * v\<^sub>o * v\<^sub>e / (a\<^sub>o * a\<^sub>e) + (v\<^sub>e / a\<^sub>e)\<^sup>2) * (a\<^sub>o * a\<^sub>e)
0 \<le> v\<^sub>e
0 \<le> v\<^sub>o
a\<^sub>e < 0
a\<^sub>o < 0
s\<^sub>e < s\<^sub>o
[PROOF STEP]
have "0 \<le> v\<^sub>o\<^sup>2 * a\<^sub>e / a\<^sub>o - 2 * v\<^sub>o * v\<^sub>e  + v\<^sub>e\<^sup>2 * a\<^sub>o / a\<^sub>e"
[PROOF STATE]
proof (prove)
using this:
0 * (a\<^sub>o * a\<^sub>e) \<le> ((v\<^sub>o / a\<^sub>o)\<^sup>2 - 2 * v\<^sub>o * v\<^sub>e / (a\<^sub>o * a\<^sub>e) + (v\<^sub>e / a\<^sub>e)\<^sup>2) * (a\<^sub>o * a\<^sub>e)
0 \<le> v\<^sub>e
0 \<le> v\<^sub>o
a\<^sub>e < 0
a\<^sub>o < 0
s\<^sub>e < s\<^sub>o

goal (1 subgoal):
 1. 0 \<le> v\<^sub>o\<^sup>2 * a\<^sub>e / a\<^sub>o - 2 * v\<^sub>o * v\<^sub>e + v\<^sub>e\<^sup>2 * a\<^sub>o / a\<^sub>e
[PROOF STEP]
by (auto simp add: power_def algebra_simps)
[PROOF STATE]
proof (state)
this:
0 \<le> v\<^sub>o\<^sup>2 * a\<^sub>e / a\<^sub>o - 2 * v\<^sub>o * v\<^sub>e + v\<^sub>e\<^sup>2 * a\<^sub>o / a\<^sub>e

goal (1 subgoal):
 1. fst_safe_distance \<le> snd_safe_distance
[PROOF STEP]
with hyps
[PROOF STATE]
proof (chain)
picking this:
0 \<le> v\<^sub>e
0 \<le> v\<^sub>o
a\<^sub>e < 0
a\<^sub>o < 0
s\<^sub>e < s\<^sub>o
0 \<le> v\<^sub>o\<^sup>2 * a\<^sub>e / a\<^sub>o - 2 * v\<^sub>o * v\<^sub>e + v\<^sub>e\<^sup>2 * a\<^sub>o / a\<^sub>e
[PROOF STEP]
have 2: "(v\<^sub>o\<^sup>2 / (2 * a\<^sub>o) - v\<^sub>e\<^sup>2 / (2 * a\<^sub>e)) * (2 * (a\<^sub>o - a\<^sub>e)) \<le> (v\<^sub>o - v\<^sub>e)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
0 \<le> v\<^sub>e
0 \<le> v\<^sub>o
a\<^sub>e < 0
a\<^sub>o < 0
s\<^sub>e < s\<^sub>o
0 \<le> v\<^sub>o\<^sup>2 * a\<^sub>e / a\<^sub>o - 2 * v\<^sub>o * v\<^sub>e + v\<^sub>e\<^sup>2 * a\<^sub>o / a\<^sub>e

goal (1 subgoal):
 1. (v\<^sub>o\<^sup>2 / (2 * a\<^sub>o) - v\<^sub>e\<^sup>2 / (2 * a\<^sub>e)) * (2 * (a\<^sub>o - a\<^sub>e)) \<le> (v\<^sub>o - v\<^sub>e)\<^sup>2
[PROOF STEP]
by (auto simp add: power_def field_split_simps)
[PROOF STATE]
proof (state)
this:
(v\<^sub>o\<^sup>2 / (2 * a\<^sub>o) - v\<^sub>e\<^sup>2 / (2 * a\<^sub>e)) * (2 * (a\<^sub>o - a\<^sub>e)) \<le> (v\<^sub>o - v\<^sub>e)\<^sup>2

goal (1 subgoal):
 1. fst_safe_distance \<le> snd_safe_distance
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a\<^sub>e < a\<^sub>o
[PROOF STEP]
have "0 \<le> 2 * (a\<^sub>o - a\<^sub>e)"
[PROOF STATE]
proof (prove)
using this:
a\<^sub>e < a\<^sub>o

goal (1 subgoal):
 1. 0 \<le> 2 * (a\<^sub>o - a\<^sub>e)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> 2 * (a\<^sub>o - a\<^sub>e)

goal (1 subgoal):
 1. fst_safe_distance \<le> snd_safe_distance
[PROOF STEP]
from divide_right_mono[OF 2 this] assms fst_safe_distance_def snd_safe_distance_def
[PROOF STATE]
proof (chain)
picking this:
(v\<^sub>o\<^sup>2 / (2 * a\<^sub>o) - v\<^sub>e\<^sup>2 / (2 * a\<^sub>e)) * (2 * (a\<^sub>o - a\<^sub>e)) / (2 * (a\<^sub>o - a\<^sub>e)) \<le> (v\<^sub>o - v\<^sub>e)\<^sup>2 / (2 * (a\<^sub>o - a\<^sub>e))
a\<^sub>e < a\<^sub>o
fst_safe_distance = v\<^sub>o\<^sup>2 / (2 * a\<^sub>o) - v\<^sub>e\<^sup>2 / (2 * a\<^sub>e)
snd_safe_distance = (v\<^sub>o - v\<^sub>e)\<^sup>2 / (2 * (a\<^sub>o - a\<^sub>e))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(v\<^sub>o\<^sup>2 / (2 * a\<^sub>o) - v\<^sub>e\<^sup>2 / (2 * a\<^sub>e)) * (2 * (a\<^sub>o - a\<^sub>e)) / (2 * (a\<^sub>o - a\<^sub>e)) \<le> (v\<^sub>o - v\<^sub>e)\<^sup>2 / (2 * (a\<^sub>o - a\<^sub>e))
a\<^sub>e < a\<^sub>o
fst_safe_distance = v\<^sub>o\<^sup>2 / (2 * a\<^sub>o) - v\<^sub>e\<^sup>2 / (2 * a\<^sub>e)
snd_safe_distance = (v\<^sub>o - v\<^sub>e)\<^sup>2 / (2 * (a\<^sub>o - a\<^sub>e))

goal (1 subgoal):
 1. fst_safe_distance \<le> snd_safe_distance
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fst_safe_distance \<le> snd_safe_distance

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma negatively_invariant_eq_rev: "negatively_invariant M = rev.positively_invariant M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. negatively_invariant M = rev.positively_invariant M
[PROOF STEP]
unfolding negatively_invariant_def rev.positively_invariant_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>M. trapped_backward x M) = (\<forall>x\<in>M. rev.trapped_forward x M)
[PROOF STEP]
by (simp add: trapped_backward_iff_rev_trapped_forward)


[STATEMENT]
lemma bounded_subset_cball: "bounded S \<longleftrightarrow> (\<exists>e x. S \<subseteq> cball x e \<and> 0 \<le> e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded S = (\<exists>e x. S \<subseteq> cball x e \<and> 0 \<le> e)
[PROOF STEP]
unfolding bounded_def subset_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x e. \<forall>y\<in>S. dist x y \<le> e) = (\<exists>e x. (\<forall>xa\<in>S. xa \<in> cball x e) \<and> 0 \<le> e)
[PROOF STEP]
by auto (meson order_trans zero_le_dist)


[STATEMENT]
lemma rGamma_reflection_complex':
  "rGamma z * rGamma (- z :: complex) = -z * sin (of_real pi * z) / of_real pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma z * rGamma (- z) = - z * sin (complex_of_real pi * z) / complex_of_real pi
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rGamma z * rGamma (- z) = - z * sin (complex_of_real pi * z) / complex_of_real pi
[PROOF STEP]
have "rGamma z * rGamma (-z) = -z * (rGamma z * rGamma (1 - z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma z * rGamma (- z) = - z * (rGamma z * rGamma (1 - z))
[PROOF STEP]
using rGamma_plus1[of "-z", symmetric]
[PROOF STATE]
proof (prove)
using this:
rGamma (- z) = - z * rGamma (- z + 1)

goal (1 subgoal):
 1. rGamma z * rGamma (- z) = - z * (rGamma z * rGamma (1 - z))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rGamma z * rGamma (- z) = - z * (rGamma z * rGamma (1 - z))

goal (1 subgoal):
 1. rGamma z * rGamma (- z) = - z * sin (complex_of_real pi * z) / complex_of_real pi
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rGamma z * rGamma (- z) = - z * (rGamma z * rGamma (1 - z))

goal (1 subgoal):
 1. rGamma z * rGamma (- z) = - z * sin (complex_of_real pi * z) / complex_of_real pi
[PROOF STEP]
have "rGamma z * rGamma (1 - z) = sin (of_real pi * z) / of_real pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma z * rGamma (1 - z) = sin (complex_of_real pi * z) / complex_of_real pi
[PROOF STEP]
by (rule rGamma_reflection_complex)
[PROOF STATE]
proof (state)
this:
rGamma z * rGamma (1 - z) = sin (complex_of_real pi * z) / complex_of_real pi

goal (1 subgoal):
 1. rGamma z * rGamma (- z) = - z * sin (complex_of_real pi * z) / complex_of_real pi
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rGamma z * rGamma (- z) = - z * (sin (complex_of_real pi * z) / complex_of_real pi)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rGamma z * rGamma (- z) = - z * (sin (complex_of_real pi * z) / complex_of_real pi)

goal (1 subgoal):
 1. rGamma z * rGamma (- z) = - z * sin (complex_of_real pi * z) / complex_of_real pi
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rGamma z * rGamma (- z) = - z * sin (complex_of_real pi * z) / complex_of_real pi

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma representation_neg:
  "independent basis \<Longrightarrow> v \<in> span basis \<Longrightarrow> representation basis (- v) = (\<lambda>b. - representation basis v b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>independent basis; v \<in> span basis\<rbrakk> \<Longrightarrow> representation basis (- v) = (\<lambda>b. - representation basis v b)
[PROOF STEP]
using representation_diff[of basis v 0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>independent basis; v \<in> span basis; (0::'b) \<in> span basis\<rbrakk> \<Longrightarrow> representation basis ((0::'b) - v) = (\<lambda>b. representation basis (0::'b) b - representation basis v b)

goal (1 subgoal):
 1. \<lbrakk>independent basis; v \<in> span basis\<rbrakk> \<Longrightarrow> representation basis (- v) = (\<lambda>b. - representation basis v b)
[PROOF STEP]
by (simp add: representation_zero span_zero)


[STATEMENT]
lemma size_fimage: "size (fimage f s) \<le> size s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (f |`| s) \<le> size s
[PROOF STEP]
apply (induct s)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. size (f |`| {||}) \<le> size {||}
 2. \<And>x s. \<lbrakk>x |\<notin>| s; size (f |`| s) \<le> size s\<rbrakk> \<Longrightarrow> size (f |`| finsert x s) \<le> size (finsert x s)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x s. \<lbrakk>x |\<notin>| s; size (f |`| s) \<le> size s\<rbrakk> \<Longrightarrow> size (f |`| finsert x s) \<le> size (finsert x s)
[PROOF STEP]
by (simp add: card_insert_if)


[STATEMENT]
lemma power_over_fact_tendsto_0:
  "(\<lambda>n. (x :: real) ^ n / fact n) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. x ^ n / fact n) \<longlonglongrightarrow> 0
[PROOF STEP]
using summable_exp[of x]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. inverse (fact n) * x ^ n)

goal (1 subgoal):
 1. (\<lambda>n. x ^ n / fact n) \<longlonglongrightarrow> 0
[PROOF STEP]
by (intro summable_LIMSEQ_zero) (simp add: sums_iff field_simps)


[STATEMENT]
lemma minus_mult_distrib_mat_vec[algebra_simps]: assumes A: "(A :: 'a :: ring mat) \<in> carrier_mat nr nc"
  and B: "B \<in> carrier_mat nr nc"
  and v: "v \<in> carrier_vec nc"
shows "(A - B) *\<^sub>v v = A *\<^sub>v v - B *\<^sub>v v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A - B) *\<^sub>v v = A *\<^sub>v v - B *\<^sub>v v
[PROOF STEP]
unfolding minus_add_uminus_mat[OF A B]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A + - B) *\<^sub>v v = A *\<^sub>v v - B *\<^sub>v v
[PROOF STEP]
by (subst add_mult_distrib_mat_vec[OF A _ v], insert A B v, auto)


[STATEMENT]
lemma legacy_Complex_simps:
  shows Complex_eq_0: "Complex a b = 0 \<longleftrightarrow> a = 0 \<and> b = 0"
    and complex_add: "Complex a b + Complex c d = Complex (a + c) (b + d)"
    and complex_minus: "- (Complex a b) = Complex (- a) (- b)"
    and complex_diff: "Complex a b - Complex c d = Complex (a - c) (b - d)"
    and Complex_eq_1: "Complex a b = 1 \<longleftrightarrow> a = 1 \<and> b = 0"
    and Complex_eq_neg_1: "Complex a b = - 1 \<longleftrightarrow> a = - 1 \<and> b = 0"
    and complex_mult: "Complex a b * Complex c d = Complex (a * c - b * d) (a * d + b * c)"
    and complex_inverse: "inverse (Complex a b) = Complex (a / (a\<^sup>2 + b\<^sup>2)) (- b / (a\<^sup>2 + b\<^sup>2))"
    and Complex_eq_numeral: "Complex a b = numeral w \<longleftrightarrow> a = numeral w \<and> b = 0"
    and Complex_eq_neg_numeral: "Complex a b = - numeral w \<longleftrightarrow> a = - numeral w \<and> b = 0"
    and complex_scaleR: "scaleR r (Complex a b) = Complex (r * a) (r * b)"
    and Complex_eq_i: "Complex x y = \<i> \<longleftrightarrow> x = 0 \<and> y = 1"
    and i_mult_Complex: "\<i> * Complex a b = Complex (- b) a"
    and Complex_mult_i: "Complex a b * \<i> = Complex (- b) a"
    and i_complex_of_real: "\<i> * complex_of_real r = Complex 0 r"
    and complex_of_real_i: "complex_of_real r * \<i> = Complex 0 r"
    and Complex_add_complex_of_real: "Complex x y + complex_of_real r = Complex (x+r) y"
    and complex_of_real_add_Complex: "complex_of_real r + Complex x y = Complex (r+x) y"
    and Complex_mult_complex_of_real: "Complex x y * complex_of_real r = Complex (x*r) (y*r)"
    and complex_of_real_mult_Complex: "complex_of_real r * Complex x y = Complex (r*x) (r*y)"
    and complex_eq_cancel_iff2: "(Complex x y = complex_of_real xa) = (x = xa \<and> y = 0)"
    and complex_cnj: "cnj (Complex a b) = Complex a (- b)"
    and Complex_sum': "sum (\<lambda>x. Complex (f x) 0) s = Complex (sum f s) 0"
    and Complex_sum: "Complex (sum f s) 0 = sum (\<lambda>x. Complex (f x) 0) s"
    and complex_of_real_def: "complex_of_real r = Complex r 0"
    and complex_norm: "cmod (Complex x y) = sqrt (x\<^sup>2 + y\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((((Complex a b = 0) = (a = 0 \<and> b = 0) &&& Complex a b + Complex c d = Complex (a + c) (b + d) &&& - Complex a b = Complex (- a) (- b)) &&& Complex a b - Complex c d = Complex (a - c) (b - d) &&& (Complex a b = 1) = (a = 1 \<and> b = 0) &&& (Complex a b = - 1) = (a = - 1 \<and> b = 0)) &&& (Complex a b * Complex c d = Complex (a * c - b * d) (a * d + b * c) &&& inverse (Complex a b) = Complex (a / (a\<^sup>2 + b\<^sup>2)) (- b / (a\<^sup>2 + b\<^sup>2)) &&& (Complex a b = numeral w) = (a = numeral w \<and> b = 0)) &&& ((Complex a b = - numeral w) = (a = - numeral w \<and> b = 0) &&& r *\<^sub>R Complex a b = Complex (r * a) (r * b)) &&& (Complex x y = \<i>) = (x = 0 \<and> y = 1) &&& \<i> * Complex a b = Complex (- b) a) &&& ((Complex a b * \<i> = Complex (- b) a &&& \<i> * complex_of_real r = Complex 0 r &&& complex_of_real r * \<i> = Complex 0 r) &&& Complex x y + complex_of_real r = Complex (x + r) y &&& complex_of_real r + Complex x y = Complex (r + x) y &&& Complex x y * complex_of_real r = Complex (x * r) (y * r)) &&& (complex_of_real r * Complex x y = Complex (r * x) (r * y) &&& (Complex x y = complex_of_real xa) = (x = xa \<and> y = 0) &&& cnj (Complex a b) = Complex a (- b)) &&& ((\<Sum>x\<in>s. Complex (f x) 0) = Complex (sum f s) 0 &&& Complex (sum f s) 0 = (\<Sum>x\<in>s. Complex (f x) 0)) &&& complex_of_real r = Complex r 0 &&& cmod (Complex x y) = sqrt (x\<^sup>2 + y\<^sup>2)
[PROOF STEP]
by (simp_all add: norm_complex_def field_simps complex_eq_iff Re_divide Im_divide)


[STATEMENT]
lemma Gram_Schmidt_upt_k_efficient_induction:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  assumes "Gram_Schmidt_upt_k A k = foldl Gram_Schmidt_column_k_efficient A [0..<Suc k]"
  and suc_k: "Suc k < ncols A"
  shows "Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)
  = Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k) = Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k)
[PROOF STEP]
using column_Gram_Schmidt_column_k_eq_efficient[OF assms]
[PROOF STATE]
proof (prove)
using this:
column ?b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column ?b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))

goal (1 subgoal):
 1. Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k) = Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k)
[PROOF STEP]
unfolding column_def vec_eq_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>i. (\<chi>i. Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k) $ i $ ?b) $ i = (\<chi>i. Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k) $ i $ ?b) $ i

goal (1 subgoal):
 1. \<forall>i ia. Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k) $ i $ ia = Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k) $ i $ ia
[PROOF STEP]
by vector


[STATEMENT]
lemma finite_set_sum:
  assumes "finite A" and "\<forall>i\<in>A. finite (B i)" shows "finite (\<Sum>i\<in>A. B i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (sum B A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
\<forall>i\<in>A. finite (B i)

goal (1 subgoal):
 1. finite (sum B A)
[PROOF STEP]
by (induct set: finite, simp, simp add: finite_set_plus)


[STATEMENT]
lemma infsetsum_Un_disjoint:
  assumes "f abs_summable_on A" "f abs_summable_on B" "A \<inter> B = {}"
  shows   "infsetsum f (A \<union> B) = infsetsum f A + infsetsum f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsetsum f (A \<union> B) = infsetsum f A + infsetsum f B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f abs_summable_on A
f abs_summable_on B
A \<inter> B = {}

goal (1 subgoal):
 1. infsetsum f (A \<union> B) = infsetsum f A + infsetsum f B
[PROOF STEP]
unfolding infsetsum_altdef abs_summable_on_altdef
[PROOF STATE]
proof (prove)
using this:
set_integrable (count_space UNIV) A f
set_integrable (count_space UNIV) B f
A \<inter> B = {}

goal (1 subgoal):
 1. set_lebesgue_integral (count_space UNIV) (A \<union> B) f = set_lebesgue_integral (count_space UNIV) A f + set_lebesgue_integral (count_space UNIV) B f
[PROOF STEP]
by (subst set_integral_Un) auto


[STATEMENT]
lemma invertible_mat_transpose:
  assumes inv_A: "invertible_mat (A::'a::comm_ring_1 mat)"
  shows "invertible_mat A\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_mat A\<^sup>T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invertible_mat A\<^sup>T
[PROOF STEP]
obtain n where A: "A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. A \<in> carrier_mat n n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using inv_A
[PROOF STATE]
proof (prove)
using this:
invertible_mat A

goal (1 subgoal):
 1. (\<And>n. A \<in> carrier_mat n n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding invertible_mat_def square_mat.simps
[PROOF STATE]
proof (prove)
using this:
dim_col A = dim_row A \<and> (\<exists>B. inverts_mat A B \<and> inverts_mat B A)

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

goal (1 subgoal):
 1. invertible_mat A\<^sup>T
[PROOF STEP]
hence At: "A\<^sup>T \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

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

goal (1 subgoal):
 1. invertible_mat A\<^sup>T
[PROOF STEP]
have "Determinant.det A\<^sup>T = Determinant.det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det A\<^sup>T = Determinant.det A
[PROOF STEP]
by (metis Determinant.det_def Determinant.det_transpose carrier_matI
        index_transpose_mat(2) index_transpose_mat(3))
[PROOF STATE]
proof (state)
this:
Determinant.det A\<^sup>T = Determinant.det A

goal (1 subgoal):
 1. invertible_mat A\<^sup>T
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Determinant.det A\<^sup>T = Determinant.det A

goal (1 subgoal):
 1. invertible_mat A\<^sup>T
[PROOF STEP]
have "... dvd 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det A dvd (1::'a)
[PROOF STEP]
using invertible_iff_is_unit_JNF[OF A] inv_A
[PROOF STATE]
proof (prove)
using this:
invertible_mat A = (Determinant.det A dvd (1::'a))
invertible_mat A

goal (1 subgoal):
 1. Determinant.det A dvd (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Determinant.det A dvd (1::'a)

goal (1 subgoal):
 1. invertible_mat A\<^sup>T
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Determinant.det A\<^sup>T dvd (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Determinant.det A\<^sup>T dvd (1::'a)

goal (1 subgoal):
 1. invertible_mat A\<^sup>T
[PROOF STEP]
using invertible_iff_is_unit_JNF[OF At]
[PROOF STATE]
proof (prove)
using this:
Determinant.det A\<^sup>T dvd (1::'a)
invertible_mat A\<^sup>T = (Determinant.det A\<^sup>T dvd (1::'a))

goal (1 subgoal):
 1. invertible_mat A\<^sup>T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
invertible_mat A\<^sup>T

goal:
No subgoals!
[PROOF STEP]
qed