[STATEMENT]
lemma locally_path_connected_space_im_kleinen:
   "locally_path_connected_space X \<longleftrightarrow>
      (\<forall>V x. openin X V \<and> x \<in> V
             \<longrightarrow> (\<exists>U. openin X U \<and>
                    x \<in> U \<and> U \<subseteq> V \<and>
                    (\<forall>y \<in> U. \<exists>c. path_connectedin X c \<and>
                                c \<subseteq> V \<and> x \<in> c \<and> y \<in> c)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally_path_connected_space X = (\<forall>V x. openin X V \<and> x \<in> V \<longrightarrow> (\<exists>U. openin X U \<and> x \<in> U \<and> U \<subseteq> V \<and> (\<forall>y\<in>U. \<exists>c. path_connectedin X c \<and> c \<subseteq> V \<and> x \<in> c \<and> y \<in> c)))
[PROOF STEP]
apply (simp add: locally_path_connected_space_def neighbourhood_base_of_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>topspace X. neighbourhood_base_at x (path_connectedin X) X) = (\<forall>V x. openin X V \<and> x \<in> V \<longrightarrow> (\<exists>U. openin X U \<and> x \<in> U \<and> U \<subseteq> V \<and> (\<forall>y\<in>U. \<exists>c. path_connectedin X c \<and> c \<subseteq> V \<and> x \<in> c \<and> y \<in> c)))
[PROOF STEP]
apply (simp add: weakly_locally_path_connected_at flip: weakly_locally_path_connected_at_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>topspace X. \<forall>V. openin X V \<and> x \<in> V \<longrightarrow> (\<exists>U. openin X U \<and> x \<in> U \<and> U \<subseteq> V \<and> (\<forall>y\<in>U. \<exists>C. path_connectedin X C \<and> C \<subseteq> V \<and> x \<in> C \<and> y \<in> C))) = (\<forall>V x. openin X V \<and> x \<in> V \<longrightarrow> (\<exists>U. openin X U \<and> x \<in> U \<and> U \<subseteq> V \<and> (\<forall>y\<in>U. \<exists>c. path_connectedin X c \<and> c \<subseteq> V \<and> x \<in> c \<and> y \<in> c)))
[PROOF STEP]
using openin_subset
[PROOF STATE]
proof (prove)
using this:
openin ?U ?S \<Longrightarrow> ?S \<subseteq> topspace ?U

goal (1 subgoal):
 1. (\<forall>x\<in>topspace X. \<forall>V. openin X V \<and> x \<in> V \<longrightarrow> (\<exists>U. openin X U \<and> x \<in> U \<and> U \<subseteq> V \<and> (\<forall>y\<in>U. \<exists>C. path_connectedin X C \<and> C \<subseteq> V \<and> x \<in> C \<and> y \<in> C))) = (\<forall>V x. openin X V \<and> x \<in> V \<longrightarrow> (\<exists>U. openin X U \<and> x \<in> U \<and> U \<subseteq> V \<and> (\<forall>y\<in>U. \<exists>c. path_connectedin X c \<and> c \<subseteq> V \<and> x \<in> c \<and> y \<in> c)))
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma max_Sup_absorb_right:
  fixes f g::\<open>'a \<Rightarrow> real\<close>
  assumes \<open>X \<noteq> {}\<close> and \<open>bdd_above (f ` X)\<close> and \<open>bdd_above (g ` X)\<close> and \<open>Sup (f ` X) \<le> Sup (g ` X)\<close>
  shows \<open>Sup ((pointwise_max f g) ` X) = Sup (g ` X)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (pointwise_max f g ` X) = Sup (g ` X)
[PROOF STEP]
text \<open>
  Explanation: For real-valued functions \<^term>\<open>f\<close> and \<^term>\<open>g\<close> and a nonempty set \<^term>\<open>X\<close>, such that
  the \<^term>\<open>f\<close> and \<^term>\<open>g\<close> are bounded above on \<^term>\<open>X\<close>, if the supremum of \<^term>\<open>f\<close> on \<^term>\<open>X\<close> is
  lower-equal the supremum of \<^term>\<open>g\<close> on \<^term>\<open>X\<close>, then the supremum of \<^term>\<open>pointwise_max f g\<close> on \<^term>\<open>X\<close>
  equals the supremum of \<^term>\<open>g\<close>. This is the right analog of @{text max_Sup_absorb_left}.
\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (pointwise_max f g ` X) = Sup (g ` X)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup (pointwise_max f g ` X) = Sup (g ` X)
[PROOF STEP]
have \<open>Sup ((pointwise_max g f) ` X) = Sup (g ` X)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (pointwise_max g f ` X) = Sup (g ` X)
[PROOF STEP]
using  assms
[PROOF STATE]
proof (prove)
using this:
X \<noteq> {}
bdd_above (f ` X)
bdd_above (g ` X)
Sup (f ` X) \<le> Sup (g ` X)

goal (1 subgoal):
 1. Sup (pointwise_max g f ` X) = Sup (g ` X)
[PROOF STEP]
by (simp add: max_Sup_absorb_left)
[PROOF STATE]
proof (state)
this:
Sup (pointwise_max g f ` X) = Sup (g ` X)

goal (1 subgoal):
 1. Sup (pointwise_max f g ` X) = Sup (g ` X)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Sup (pointwise_max g f ` X) = Sup (g ` X)

goal (1 subgoal):
 1. Sup (pointwise_max f g ` X) = Sup (g ` X)
[PROOF STEP]
have \<open>pointwise_max g f = pointwise_max f g\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pointwise_max g f = pointwise_max f g
[PROOF STEP]
unfolding pointwise_max_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. max (g x) (f x)) = (\<lambda>x. max (f x) (g x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pointwise_max g f = pointwise_max f g

goal (1 subgoal):
 1. Sup (pointwise_max f g ` X) = Sup (g ` X)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Sup (pointwise_max g f ` X) = Sup (g ` X)
pointwise_max g f = pointwise_max f g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sup (pointwise_max g f ` X) = Sup (g ` X)
pointwise_max g f = pointwise_max f g

goal (1 subgoal):
 1. Sup (pointwise_max f g ` X) = Sup (g ` X)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Sup (pointwise_max f g ` X) = Sup (g ` X)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma affine_diff_divide:
    assumes "affine S" "k \<noteq> 0" "k \<noteq> 1" and xy: "x \<in> S" "y /\<^sub>R (1 - k) \<in> S"
      shows "(x - y) /\<^sub>R k \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - y) /\<^sub>R k \<in> S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x - y) /\<^sub>R k \<in> S
[PROOF STEP]
have "inverse(k) *\<^sub>R (x - y) = (1 - inverse k) *\<^sub>R inverse(1 - k) *\<^sub>R y + inverse(k) *\<^sub>R x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - y) /\<^sub>R k = (1 - inverse k) *\<^sub>R (y /\<^sub>R (1 - k)) + x /\<^sub>R k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
affine S
k \<noteq> 0
k \<noteq> 1
x \<in> S
y /\<^sub>R (1 - k) \<in> S

goal (1 subgoal):
 1. (x - y) /\<^sub>R k = (1 - inverse k) *\<^sub>R (y /\<^sub>R (1 - k)) + x /\<^sub>R k
[PROOF STEP]
by (simp add: algebra_simps) (simp add: scaleR_left_distrib [symmetric] field_split_simps)
[PROOF STATE]
proof (state)
this:
(x - y) /\<^sub>R k = (1 - inverse k) *\<^sub>R (y /\<^sub>R (1 - k)) + x /\<^sub>R k

goal (1 subgoal):
 1. (x - y) /\<^sub>R k \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x - y) /\<^sub>R k = (1 - inverse k) *\<^sub>R (y /\<^sub>R (1 - k)) + x /\<^sub>R k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x - y) /\<^sub>R k = (1 - inverse k) *\<^sub>R (y /\<^sub>R (1 - k)) + x /\<^sub>R k

goal (1 subgoal):
 1. (x - y) /\<^sub>R k \<in> S
[PROOF STEP]
using \<open>affine S\<close> xy
[PROOF STATE]
proof (prove)
using this:
(x - y) /\<^sub>R k = (1 - inverse k) *\<^sub>R (y /\<^sub>R (1 - k)) + x /\<^sub>R k
affine S
x \<in> S
y /\<^sub>R (1 - k) \<in> S

goal (1 subgoal):
 1. (x - y) /\<^sub>R k \<in> S
[PROOF STEP]
by (auto simp: affine_alt)
[PROOF STATE]
proof (state)
this:
(x - y) /\<^sub>R k \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma q65_upto_def: "q65 = (\<lambda>k. k\<^sup>2 mod 65) ` {..<65}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q65 = (\<lambda>k. k\<^sup>2 mod 65) ` {..<65}
[PROOF STEP]
by (simp add: q65_def lessThan_nat_numeral lessThan_Suc insert_commute)


[STATEMENT]
lemma double_add_less_zero_iff_single_less_zero [simp]: "a + a < 0 \<longleftrightarrow> a < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + a < (0::'a)) = (a < (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (a + a < (0::'a)) = (a < (0::'a))
[PROOF STEP]
have "a + a < 0 \<longleftrightarrow> 0 < - (a + a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + a < (0::'a)) = ((0::'a) < - (a + a))
[PROOF STEP]
by (subst less_minus_iff) simp
[PROOF STATE]
proof (state)
this:
(a + a < (0::'a)) = ((0::'a) < - (a + a))

goal (1 subgoal):
 1. (a + a < (0::'a)) = (a < (0::'a))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(a + a < (0::'a)) = ((0::'a) < - (a + a))

goal (1 subgoal):
 1. (a + a < (0::'a)) = (a < (0::'a))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> a < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) < - (a + a)) = (a < (0::'a))
[PROOF STEP]
by (simp only: minus_add_distrib zero_less_double_add_iff_zero_less_single_add) simp
[PROOF STATE]
proof (state)
this:
((0::'a) < - (a + a)) = (a < (0::'a))

goal (1 subgoal):
 1. (a + a < (0::'a)) = (a < (0::'a))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(a + a < (0::'a)) = ((0::'a) < - (a + a))
((0::'a) < - (a + a)) = (a < (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(a + a < (0::'a)) = ((0::'a) < - (a + a))
((0::'a) < - (a + a)) = (a < (0::'a))

goal (1 subgoal):
 1. (a + a < (0::'a)) = (a < (0::'a))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(a + a < (0::'a)) = (a < (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma natpermute_finite: "finite (natpermute n k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (natpermute n k)
[PROOF STEP]
proof (induct k arbitrary: n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. finite (natpermute n 0)
 2. \<And>k n. (\<And>n. finite (natpermute n k)) \<Longrightarrow> finite (natpermute n (Suc k))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>n. finite (natpermute n 0)
 2. \<And>k n. (\<And>n. finite (natpermute n k)) \<Longrightarrow> finite (natpermute n (Suc k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (natpermute n 0)
[PROOF STEP]
by (simp add: natpermute_0)
[PROOF STATE]
proof (state)
this:
finite (natpermute n 0)

goal (1 subgoal):
 1. \<And>k n. (\<And>n. finite (natpermute n k)) \<Longrightarrow> finite (natpermute n (Suc k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k n. (\<And>n. finite (natpermute n k)) \<Longrightarrow> finite (natpermute n (Suc k))
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
finite (natpermute ?n k)

goal (1 subgoal):
 1. \<And>k n. (\<And>n. finite (natpermute n k)) \<Longrightarrow> finite (natpermute n (Suc k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (natpermute ?n k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite (natpermute ?n k)

goal (1 subgoal):
 1. finite (natpermute n (Suc k))
[PROOF STEP]
using natpermute_split [of k "Suc k"] finite_UN_I
[PROOF STATE]
proof (prove)
using this:
finite (natpermute ?n k)
k \<le> Suc k \<Longrightarrow> natpermute ?n (Suc k) = (\<Union>m\<in>{0..?n}. {l1 @ l2 |l1 l2. l1 \<in> natpermute m k \<and> l2 \<in> natpermute (?n - m) (Suc k - k)})
\<lbrakk>finite ?A; \<And>a. a \<in> ?A \<Longrightarrow> finite (?B a)\<rbrakk> \<Longrightarrow> finite (\<Union> (?B ` ?A))

goal (1 subgoal):
 1. finite (natpermute n (Suc k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (natpermute n (Suc k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Sum_any_diff:
  assumes "finite {x. f x \<noteq> 0}"
  assumes "finite {x. g x \<noteq> 0}"
  shows   "Sum_any (\<lambda>x. f x - g x :: 'a :: ab_group_add) = Sum_any f - Sum_any g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x. f x - g x) = Sum_any f - Sum_any g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x. f x - g x) = Sum_any f - Sum_any g
[PROOF STEP]
have "{x. f x - g x \<noteq> 0} \<subseteq> {x. f x \<noteq> 0} \<union> {x. g x \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. f x - g x \<noteq> (0::'a)} \<subseteq> {x. f x \<noteq> (0::'a)} \<union> {x. g x \<noteq> (0::'a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x. f x - g x \<noteq> (0::'a)} \<subseteq> {x. f x \<noteq> (0::'a)} \<union> {x. g x \<noteq> (0::'a)}

goal (1 subgoal):
 1. (\<Sum>x. f x - g x) = Sum_any f - Sum_any g
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{x. f x - g x \<noteq> (0::'a)} \<subseteq> {x. f x \<noteq> (0::'a)} \<union> {x. g x \<noteq> (0::'a)}

goal (1 subgoal):
 1. (\<Sum>x. f x - g x) = Sum_any f - Sum_any g
[PROOF STEP]
have "finite ({x. f x \<noteq> 0} \<union> {x. g x \<noteq> 0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ({x. f x \<noteq> (0::'a)} \<union> {x. g x \<noteq> (0::'a)})
[PROOF STEP]
by (subst finite_Un) (insert assms, auto)
[PROOF STATE]
proof (state)
this:
finite ({x. f x \<noteq> (0::'a)} \<union> {x. g x \<noteq> (0::'a)})

goal (1 subgoal):
 1. (\<Sum>x. f x - g x) = Sum_any f - Sum_any g
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{x. f x - g x \<noteq> (0::'a)} \<subseteq> {x. f x \<noteq> (0::'a)} \<union> {x. g x \<noteq> (0::'a)}
finite ({x. f x \<noteq> (0::'a)} \<union> {x. g x \<noteq> (0::'a)})
[PROOF STEP]
have "finite {x. f x - g x \<noteq> 0}"
[PROOF STATE]
proof (prove)
using this:
{x. f x - g x \<noteq> (0::'a)} \<subseteq> {x. f x \<noteq> (0::'a)} \<union> {x. g x \<noteq> (0::'a)}
finite ({x. f x \<noteq> (0::'a)} \<union> {x. g x \<noteq> (0::'a)})

goal (1 subgoal):
 1. finite {x. f x - g x \<noteq> (0::'a)}
[PROOF STEP]
by (rule finite_subset)
[PROOF STATE]
proof (state)
this:
finite {x. f x - g x \<noteq> (0::'a)}

goal (1 subgoal):
 1. (\<Sum>x. f x - g x) = Sum_any f - Sum_any g
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite {x. f x \<noteq> (0::'a)}
finite {x. g x \<noteq> (0::'a)}
finite {x. f x - g x \<noteq> (0::'a)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {x. f x \<noteq> (0::'a)}
finite {x. g x \<noteq> (0::'a)}
finite {x. f x - g x \<noteq> (0::'a)}

goal (1 subgoal):
 1. (\<Sum>x. f x - g x) = Sum_any f - Sum_any g
[PROOF STEP]
by (simp add: algebra_simps Sum_any.distrib [symmetric])
[PROOF STATE]
proof (state)
this:
(\<Sum>x. f x - g x) = Sum_any f - Sum_any g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem ln_lower_1_eq: "0<x \<Longrightarrow> ln_lower_1 x = (x - 1)/x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> ln_lower_1 x = (x - 1) / x
[PROOF STEP]
by (auto simp: ln_lower_1_def divide_simps)


[STATEMENT]
lemma arccos_arcsin_sqrt_pos: "0 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> arccos x = arcsin(sqrt(1 - x\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> arccos x = arcsin (sqrt (1 - x\<^sup>2))
[PROOF STEP]
apply (simp add: abs_square_le_1 arcsin_eq_Re_Arcsin arccos_eq_Re_Arccos)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> Re (Arccos (complex_of_real x)) = Re (Arcsin (complex_of_real (sqrt (1 - x\<^sup>2))))
[PROOF STEP]
apply (subst Arccos_Arcsin_csqrt_pos)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> 0 < Re (complex_of_real x) \<or> Re (complex_of_real x) = 0 \<and> 0 \<le> Im (complex_of_real x)
 2. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> Re (Arcsin (csqrt (1 - (complex_of_real x)\<^sup>2))) = Re (Arcsin (complex_of_real (sqrt (1 - x\<^sup>2))))
[PROOF STEP]
apply (auto simp: power_le_one csqrt_1_diff_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma is_interval_ball_real: "is_interval (ball a b)" for a b::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_interval (ball a b)
[PROOF STEP]
by (simp add: ball_eq_greaterThanLessThan is_interval_def)


[STATEMENT]
lemma summable_rabs_comparison_test: "\<exists>N. \<forall>n\<ge>N. \<bar>f n\<bar> \<le> g n \<Longrightarrow> summable g \<Longrightarrow> summable (\<lambda>n. \<bar>f n\<bar>)"
  for f :: "nat \<Rightarrow> real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>N. \<forall>n\<ge>N. \<bar>f n\<bar> \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable (\<lambda>n. \<bar>f n\<bar>)
[PROOF STEP]
by (rule summable_comparison_test) auto


[STATEMENT]
lemma express_poly :
  assumes h : "MPoly_Type.degree (p::real mpoly) var = 1 \<or> MPoly_Type.degree p var = 2"
  shows "p =
     (isolate_variable_sparse p var 2)*(Var var)^2
    +(isolate_variable_sparse p var 1)*(Var var)
    +(isolate_variable_sparse p var 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0
[PROOF STEP]
have h1a: "MPoly_Type.degree p var = 1 \<longrightarrow> p =
    isolate_variable_sparse p var 0 +
    isolate_variable_sparse p var 1 * Var var"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree p var = 1 \<longrightarrow> p = isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var
[PROOF STEP]
using sum_over_zero[where mp="p",where x="var"]
[PROOF STATE]
proof (prove)
using this:
p = (\<Sum>i\<le>MPoly_Type.degree p var. isolate_variable_sparse p var i * Var var ^ i)

goal (1 subgoal):
 1. MPoly_Type.degree p var = 1 \<longrightarrow> p = isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree p var = 1 \<longrightarrow> p = isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var

goal (1 subgoal):
 1. p = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0
[PROOF STEP]
have h1b: "MPoly_Type.degree p var = 1 \<longrightarrow> isolate_variable_sparse p var 2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree p var = 1 \<longrightarrow> isolate_variable_sparse p var 2 = 0
[PROOF STEP]
using isovar_greater_degree
[PROOF STATE]
proof (prove)
using this:
\<forall>i>MPoly_Type.degree ?p ?var. isolate_variable_sparse ?p ?var i = 0

goal (1 subgoal):
 1. MPoly_Type.degree p var = 1 \<longrightarrow> isolate_variable_sparse p var 2 = 0
[PROOF STEP]
by (simp add: isovar_greater_degree)
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree p var = 1 \<longrightarrow> isolate_variable_sparse p var 2 = 0

goal (1 subgoal):
 1. p = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0
[PROOF STEP]
have h1: "MPoly_Type.degree p var = 1 \<longrightarrow> p =
    isolate_variable_sparse p var 0 +
    isolate_variable_sparse p var 1 * Var var
    + isolate_variable_sparse p var 2 * (Var var)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree p var = 1 \<longrightarrow> p = isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 2 * (Var var)\<^sup>2
[PROOF STEP]
using h1a h1b
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.degree p var = 1 \<longrightarrow> p = isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var
MPoly_Type.degree p var = 1 \<longrightarrow> isolate_variable_sparse p var 2 = 0

goal (1 subgoal):
 1. MPoly_Type.degree p var = 1 \<longrightarrow> p = isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 2 * (Var var)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree p var = 1 \<longrightarrow> p = isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 2 * (Var var)\<^sup>2

goal (1 subgoal):
 1. p = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0
[PROOF STEP]
have h2a: "MPoly_Type.degree p var = 2 \<longrightarrow> p = (\<Sum>i::nat \<le> 2. isolate_variable_sparse p var i * Var var^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree p var = 2 \<longrightarrow> p = (\<Sum>i\<le>2. isolate_variable_sparse p var i * Var var ^ i)
[PROOF STEP]
using sum_over_zero[where mp="p", where x="var"]
[PROOF STATE]
proof (prove)
using this:
p = (\<Sum>i\<le>MPoly_Type.degree p var. isolate_variable_sparse p var i * Var var ^ i)

goal (1 subgoal):
 1. MPoly_Type.degree p var = 2 \<longrightarrow> p = (\<Sum>i\<le>2. isolate_variable_sparse p var i * Var var ^ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree p var = 2 \<longrightarrow> p = (\<Sum>i\<le>2. isolate_variable_sparse p var i * Var var ^ i)

goal (1 subgoal):
 1. p = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0
[PROOF STEP]
have h2b: "(\<Sum>i::nat \<le> 2. isolate_variable_sparse p var i * Var var^i) =
   (\<Sum>i::nat \<le> 1. isolate_variable_sparse p var i * Var var^i) +
   isolate_variable_sparse p var 2 * (Var var)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>2. isolate_variable_sparse p var i * Var var ^ i) = (\<Sum>i\<le>1. isolate_variable_sparse p var i * Var var ^ i) + isolate_variable_sparse p var 2 * (Var var)\<^sup>2
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>2. isolate_variable_sparse p var i * Var var ^ i) = isolate_variable_sparse p var 0 + isolate_variable_sparse p var (Suc 0) * Var var + isolate_variable_sparse p var 2 * (Var var)\<^sup>2
[PROOF STEP]
by (simp add: numerals(2))
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>2. isolate_variable_sparse p var i * Var var ^ i) = (\<Sum>i\<le>1. isolate_variable_sparse p var i * Var var ^ i) + isolate_variable_sparse p var 2 * (Var var)\<^sup>2

goal (1 subgoal):
 1. p = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0
[PROOF STEP]
have h2:  "MPoly_Type.degree p var = 2 \<longrightarrow> p =
    isolate_variable_sparse p var 0 +
    isolate_variable_sparse p var 1 * Var var +
    isolate_variable_sparse p var 2 * (Var var)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree p var = 2 \<longrightarrow> p = isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 2 * (Var var)\<^sup>2
[PROOF STEP]
using h2a h2b
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.degree p var = 2 \<longrightarrow> p = (\<Sum>i\<le>2. isolate_variable_sparse p var i * Var var ^ i)
(\<Sum>i\<le>2. isolate_variable_sparse p var i * Var var ^ i) = (\<Sum>i\<le>1. isolate_variable_sparse p var i * Var var ^ i) + isolate_variable_sparse p var 2 * (Var var)\<^sup>2

goal (1 subgoal):
 1. MPoly_Type.degree p var = 2 \<longrightarrow> p = isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 2 * (Var var)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree p var = 2 \<longrightarrow> p = isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 2 * (Var var)\<^sup>2

goal (1 subgoal):
 1. p = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0
[PROOF STEP]
have h3: "isolate_variable_sparse p var 0 +
    isolate_variable_sparse p var 1 * Var var +
    isolate_variable_sparse p var 2 * (Var var)^2 =
    isolate_variable_sparse p var 2 * (Var var)^2 +
    isolate_variable_sparse p var 1 * Var var +
    isolate_variable_sparse p var 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 2 * (Var var)\<^sup>2 = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0
[PROOF STEP]
by (simp add: add.commute)
[PROOF STATE]
proof (state)
this:
isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 2 * (Var var)\<^sup>2 = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0

goal (1 subgoal):
 1. p = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0
[PROOF STEP]
using h h1 h2 h3
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.degree p var = 1 \<or> MPoly_Type.degree p var = 2
MPoly_Type.degree p var = 1 \<longrightarrow> p = isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 2 * (Var var)\<^sup>2
MPoly_Type.degree p var = 2 \<longrightarrow> p = isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 2 * (Var var)\<^sup>2
isolate_variable_sparse p var 0 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 2 * (Var var)\<^sup>2 = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0

goal (1 subgoal):
 1. p = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
p = isolate_variable_sparse p var 2 * (Var var)\<^sup>2 + isolate_variable_sparse p var 1 * Var var + isolate_variable_sparse p var 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem has_derivative_inverse_on:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'n"
  assumes "open S"
    and derf: "\<And>x. x \<in> S \<Longrightarrow> (f has_derivative f'(x)) (at x)"
    and "\<And>x. x \<in> S \<Longrightarrow> g (f x) = x"
    and "f' x \<circ> g' x = id"
    and "x \<in> S"
  shows "(g has_derivative g'(x)) (at (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_derivative g' x) (at (f x))
[PROOF STEP]
proof (rule has_derivative_inverse_strong[where g'="g' x" and f=f])
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. open ?S
 2. x \<in> ?S
 3. continuous_on ?S f
 4. \<And>x. x \<in> ?S \<Longrightarrow> g (f x) = x
 5. (f has_derivative ?f') (at x)
 6. ?f' \<circ> g' x = id
[PROOF STEP]
show "continuous_on S f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on S f
[PROOF STEP]
unfolding continuous_on_eq_continuous_at[OF \<open>open S\<close>]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>S. isCont f x
[PROOF STEP]
using derf has_derivative_continuous
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> (f has_derivative f' ?x) (at ?x)
(?f has_derivative ?f') (at ?x within ?s) \<Longrightarrow> continuous (at ?x within ?s) ?f

goal (1 subgoal):
 1. \<forall>x\<in>S. isCont f x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on S f

goal (5 subgoals):
 1. open S
 2. x \<in> S
 3. \<And>x. x \<in> S \<Longrightarrow> g (f x) = x
 4. (f has_derivative ?f') (at x)
 5. ?f' \<circ> g' x = id
[PROOF STEP]
qed (use assms in auto)


[STATEMENT]
lemma DERIV_fun_powr2:
  fixes a::real
  assumes a_pos: "a > 0"
    and f: "DERIV f x :> r"
  shows "DERIV (\<lambda>x. a.^(f x)) x :> a.^(f x) * r * ln a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. a .^ f x) has_real_derivative a .^ f x * r * ln a) (at x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. a .^ f x) has_real_derivative a .^ f x * r * ln a) (at x)
[PROOF STEP]
let ?g = "(\<lambda>x. a)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. a .^ f x) has_real_derivative a .^ f x * r * ln a) (at x)
[PROOF STEP]
have g: "DERIV ?g x :> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. a) has_real_derivative 0) (at x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. a) has_real_derivative 0) (at x)

goal (1 subgoal):
 1. ((\<lambda>x. a .^ f x) has_real_derivative a .^ f x * r * ln a) (at x)
[PROOF STEP]
have pos: "?g x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a
[PROOF STEP]
by (simp add: a_pos)
[PROOF STATE]
proof (state)
this:
0 < a

goal (1 subgoal):
 1. ((\<lambda>x. a .^ f x) has_real_derivative a .^ f x * r * ln a) (at x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. a .^ f x) has_real_derivative a .^ f x * r * ln a) (at x)
[PROOF STEP]
using DERIV_powr[OF g pos f] a_pos
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. a .^ f x) has_real_derivative a .^ f x * (r * ln a + 0 * f x / a)) (at x)
0 < a

goal (1 subgoal):
 1. ((\<lambda>x. a .^ f x) has_real_derivative a .^ f x * r * ln a) (at x)
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. a .^ f x) has_real_derivative a .^ f x * r * ln a) (at x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cts_step_uniformly_continuous:
  assumes [arith]: "a < b"
  shows "uniformly_continuous_on UNIV (cts_step a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isUCont (cts_step a b)
[PROOF STEP]
unfolding uniformly_continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e>0. \<exists>d>0. \<forall>x\<in>UNIV. \<forall>x'\<in>UNIV. dist x' x < d \<longrightarrow> dist (cts_step a b x') (cts_step a b x) < e
[PROOF STEP]
proof clarsimp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d>0. \<forall>x x'. dist x' x < d \<longrightarrow> dist (cts_step a b x') (cts_step a b x) < e
[PROOF STEP]
fix e :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d>0. \<forall>x x'. dist x' x < d \<longrightarrow> dist (cts_step a b x') (cts_step a b x) < e
[PROOF STEP]
assume [arith]: "0 < e"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d>0. \<forall>x x'. dist x' x < d \<longrightarrow> dist (cts_step a b x') (cts_step a b x) < e
[PROOF STEP]
let ?d = "min (e * (b - a)) (b - a)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d>0. \<forall>x x'. dist x' x < d \<longrightarrow> dist (cts_step a b x') (cts_step a b x) < e
[PROOF STEP]
have "?d > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < min (e * (b - a)) (b - a)
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
0 < min (e * (b - a)) (b - a)

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d>0. \<forall>x x'. dist x' x < d \<longrightarrow> dist (cts_step a b x') (cts_step a b x) < e
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < min (e * (b - a)) (b - a)

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d>0. \<forall>x x'. dist x' x < d \<longrightarrow> dist (cts_step a b x') (cts_step a b x) < e
[PROOF STEP]
have "dist x' x < ?d \<Longrightarrow> dist (cts_step a b x') (cts_step a b x) < e" for x x'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x' x < min (e * (b - a)) (b - a) \<Longrightarrow> dist (cts_step a b x') (cts_step a b x) < e
[PROOF STEP]
by (auto simp: dist_real_def divide_simps cts_step_def)
[PROOF STATE]
proof (state)
this:
dist ?x' ?x < min (e * (b - a)) (b - a) \<Longrightarrow> dist (cts_step a b ?x') (cts_step a b ?x) < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d>0. \<forall>x x'. dist x' x < d \<longrightarrow> dist (cts_step a b x') (cts_step a b x) < e
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < min (e * (b - a)) (b - a)
dist ?x' ?x < min (e * (b - a)) (b - a) \<Longrightarrow> dist (cts_step a b ?x') (cts_step a b ?x) < e
[PROOF STEP]
show "\<exists>d > 0. \<forall>x x'. dist x' x < d \<longrightarrow> dist (cts_step a b x') (cts_step a b x) < e"
[PROOF STATE]
proof (prove)
using this:
0 < min (e * (b - a)) (b - a)
dist ?x' ?x < min (e * (b - a)) (b - a) \<Longrightarrow> dist (cts_step a b ?x') (cts_step a b ?x) < e

goal (1 subgoal):
 1. \<exists>d>0. \<forall>x x'. dist x' x < d \<longrightarrow> dist (cts_step a b x') (cts_step a b x) < e
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>d>0. \<forall>x x'. dist x' x < d \<longrightarrow> dist (cts_step a b x') (cts_step a b x) < e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_nat_0 [simp]: "length_nat 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length_nat 0 = 0
[PROOF STEP]
by (simp add: length_nat_def Least_equality)


[STATEMENT]
lemma "0 < r \<Longrightarrow> ball x r \<subseteq> ball y s \<Longrightarrow> ball x r \<subseteq> ball z t \<Longrightarrow> dist y z \<le> s + t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; ball x r \<subseteq> ball y s; ball x r \<subseteq> ball z t\<rbrakk> \<Longrightarrow> dist y z \<le> s + t
[PROOF STEP]
by metric


[STATEMENT]
lemma cscalar_prod_conjugate_transpose:
  fixes x y ::"'a :: {conjugatable_ring, comm_ring} vec"
  assumes "A \<in> carrier_mat nr nc"
  assumes "x \<in> carrier_vec nr"
  assumes "y \<in> carrier_vec nc"
  shows "x \<bullet>c (A *\<^sub>v y) = (A\<^sup>H *\<^sub>v x) \<bullet>c y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bullet>c (A *\<^sub>v y) = (A\<^sup>H *\<^sub>v x) \<bullet>c y
[PROOF STEP]
unfolding mult_mat_vec_def scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (conjugate (vec (dim_row A) (\<lambda>i. \<Sum>ia = 0..<dim_vec y. row A i $ ia * y $ ia))). x $ i * conjugate (vec (dim_row A) (\<lambda>i. \<Sum>ia = 0..<dim_vec y. row A i $ ia * y $ ia)) $ i) = (\<Sum>i = 0..<dim_vec (conjugate y). vec (dim_row A\<^sup>H) (\<lambda>i. \<Sum>ia = 0..<dim_vec x. row A\<^sup>H i $ ia * x $ ia) $ i * conjugate y $ i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc
x \<in> carrier_vec nr
y \<in> carrier_vec nc

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (conjugate (vec (dim_row A) (\<lambda>i. \<Sum>ia = 0..<dim_vec y. row A i $ ia * y $ ia))). x $ i * conjugate (vec (dim_row A) (\<lambda>i. \<Sum>ia = 0..<dim_vec y. row A i $ ia * y $ ia)) $ i) = (\<Sum>i = 0..<dim_vec (conjugate y). vec (dim_row A\<^sup>H) (\<lambda>i. \<Sum>ia = 0..<dim_vec x. row A\<^sup>H i $ ia * x $ ia) $ i * conjugate y $ i)
[PROOF STEP]
apply (auto simp add: sum_distrib_left sum_distrib_right sum_conjugate conjugate_dist_mul)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat nr nc; x \<in> carrier_vec nr; y \<in> carrier_vec nc\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<nr. \<Sum>n = 0..<nc. x $ i * (conjugate (A $$ (i, n)) * conjugate (y $ n))) = (\<Sum>i = 0..<nc. \<Sum>n = 0..<nr. conjugate (A $$ (n, i)) * x $ n * conjugate (y $ i))
[PROOF STEP]
apply (subst sum.swap)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat nr nc; x \<in> carrier_vec nr; y \<in> carrier_vec nc\<rbrakk> \<Longrightarrow> (\<Sum>j = 0..<nc. \<Sum>i = 0..<nr. x $ i * (conjugate (A $$ (i, j)) * conjugate (y $ j))) = (\<Sum>i = 0..<nc. \<Sum>n = 0..<nr. conjugate (A $$ (n, i)) * x $ n * conjugate (y $ i))
[PROOF STEP]
by (meson helper mult.assoc mult.left_commute sum.cong)


[STATEMENT]
lemma sq_mtx_inv_unique:
  assumes "A * B = 1" and "B * A = 1"
  shows "A\<^sup>-\<^sup>1 = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A\<^sup>-\<^sup>1 = B
[PROOF STEP]
by (metis (no_types, lifting) assms mtx_invertibleD(2)
      mtx_invertibleI mult.assoc sq_mtx_one_idty(1))


[STATEMENT]
lemma card_partition: "
  \<lbrakk> finite C; \<And>c. c \<in> C \<Longrightarrow> card c = k; \<And>c1 c2. \<lbrakk>c1 \<in> C; c2 \<in> C; c1 \<noteq> c2\<rbrakk> \<Longrightarrow> c1 \<inter> c2 = {} \<rbrakk> \<Longrightarrow>
  card (\<Union>C) = k * card C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite C; \<And>c. c \<in> C \<Longrightarrow> card c = k; \<And>c1 c2. \<lbrakk>c1 \<in> C; c2 \<in> C; c1 \<noteq> c2\<rbrakk> \<Longrightarrow> c1 \<inter> c2 = {}\<rbrakk> \<Longrightarrow> card (\<Union> C) = k * card C
[PROOF STEP]
by (metis card.infinite card_partition finite_Union mult_eq_if)


[STATEMENT]
lemma tan_zero [simp]: "tan 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan (0::'a) = (0::'a)
[PROOF STEP]
by (simp add: tan_def)


[STATEMENT]
lemma deriv_power_fun [simp]:
  assumes "f field_differentiable at x"
    shows "deriv (\<lambda>x. f x ^ n) x = of_nat n * deriv f x * f x ^ (n - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. f x ^ n) x = of_nat n * deriv f x * f x ^ (n - 1)
[PROOF STEP]
using DERIV_power[of f "deriv f x"]
[PROOF STATE]
proof (prove)
using this:
(f has_field_derivative deriv f x) (at ?x within ?s) \<Longrightarrow> ((\<lambda>x. f x ^ ?n) has_field_derivative of_nat ?n * (deriv f x * f ?x ^ (?n - Suc 0))) (at ?x within ?s)

goal (1 subgoal):
 1. deriv (\<lambda>x. f x ^ n) x = of_nat n * deriv f x * f x ^ (n - 1)
[PROOF STEP]
by (simp add:  DERIV_imp_deriv assms field_differentiable_derivI mult.assoc [symmetric])


[STATEMENT]
lemma divisor_count_primorial: "divisor_count (primorial x) = 2 powr primes_pi x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (divisor_count (primorial x)) = 2 powr primes_pi x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (divisor_count (primorial x)) = 2 powr primes_pi x
[PROOF STEP]
have "divisor_count (primorial x) = (\<Prod>p | prime p \<and> real p \<le> x. divisor_count p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_count (primorial x) = prod divisor_count {p. prime p \<and> real p \<le> x}
[PROOF STEP]
unfolding primorial_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_count (\<Prod>{p. prime p \<and> real p \<le> x}) = prod divisor_count {p. prime p \<and> real p \<le> x}
[PROOF STEP]
by (subst divisor_count.prod_coprime) (auto simp: primes_coprime)
[PROOF STATE]
proof (state)
this:
divisor_count (primorial x) = prod divisor_count {p. prime p \<and> real p \<le> x}

goal (1 subgoal):
 1. real (divisor_count (primorial x)) = 2 powr primes_pi x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
divisor_count (primorial x) = prod divisor_count {p. prime p \<and> real p \<le> x}

goal (1 subgoal):
 1. real (divisor_count (primorial x)) = 2 powr primes_pi x
[PROOF STEP]
have "\<dots> = (\<Prod>p | prime p \<and> real p \<le> x. 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod divisor_count {p. prime p \<and> real p \<le> x} = (\<Prod>p\<in>{p. prime p \<and> real p \<le> x}. 2)
[PROOF STEP]
by (intro prod.cong divisor_count.prime) auto
[PROOF STATE]
proof (state)
this:
prod divisor_count {p. prime p \<and> real p \<le> x} = (\<Prod>p\<in>{p. prime p \<and> real p \<le> x}. 2)

goal (1 subgoal):
 1. real (divisor_count (primorial x)) = 2 powr primes_pi x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod divisor_count {p. prime p \<and> real p \<le> x} = (\<Prod>p\<in>{p. prime p \<and> real p \<le> x}. 2)

goal (1 subgoal):
 1. real (divisor_count (primorial x)) = 2 powr primes_pi x
[PROOF STEP]
have "\<dots> = 2 powr primes_pi x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (\<Prod>p\<in>{p. prime p \<and> real p \<le> x}. 2) = 2 powr primes_pi x
[PROOF STEP]
by (simp add: primes_pi_def prime_sum_upto_def powr_realpow)
[PROOF STATE]
proof (state)
this:
real (\<Prod>p\<in>{p. prime p \<and> real p \<le> x}. 2) = 2 powr primes_pi x

goal (1 subgoal):
 1. real (divisor_count (primorial x)) = 2 powr primes_pi x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (divisor_count (primorial x)) = 2 powr primes_pi x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (divisor_count (primorial x)) = 2 powr primes_pi x

goal (1 subgoal):
 1. real (divisor_count (primorial x)) = 2 powr primes_pi x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (divisor_count (primorial x)) = 2 powr primes_pi x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma val_ultrametric':
  assumes "x \<in> carrier Q\<^sub>p"
  assumes "y \<in> carrier Q\<^sub>p"
  shows " min (val x) (val y) \<le> val (x \<ominus> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (val x) (val y) \<le> val (x \<ominus> y)
[PROOF STEP]
using val_ultrametric[of x "\<ominus>y"]
        val_minus[of y]
        assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<in> carrier Q\<^sub>p; \<ominus> y \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> min (val x) (val (\<ominus> y)) \<le> val (x \<oplus> \<ominus> y)
y \<in> carrier Q\<^sub>p \<Longrightarrow> val y = val (\<ominus> y)
x \<in> carrier Q\<^sub>p
y \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. min (val x) (val y) \<le> val (x \<ominus> y)
[PROOF STEP]
by (metis Qp.domain_axioms a_minus_def cring.cring_simprules(3) domain.axioms(1))


[STATEMENT]
lemma iso_hom_induced_relativization_contractible:
  assumes "contractible_space(subtopology X S)" "contractible_space(subtopology X T)" "T \<subseteq> S" "topspace X \<inter> T \<noteq> {}"
  shows "(hom_induced p X T X S id) \<in> iso (relative_homology_group p X T) (relative_homology_group p X S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_induced p X T X S id \<in> Group.iso (relative_homology_group p X T) (relative_homology_group p X S)
[PROOF STEP]
proof (rule very_short_exact_sequence)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. exact_seq ([?D, relative_homology_group p X S, relative_homology_group p X T, ?A], [?h, hom_induced p X T X S id, ?f])
 2. trivial_group ?A
 3. trivial_group ?D
[PROOF STEP]
show "exact_seq
         ([relative_homology_group(p - 1) (subtopology X S) T, relative_homology_group p X S, relative_homology_group p X T, relative_homology_group p (subtopology X S) T],
          [hom_relboundary p X S T, hom_induced p X T X S id, hom_induced p (subtopology X S) T X T id])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exact_seq ([relative_homology_group (p - 1) (subtopology X S) T, relative_homology_group p X S, relative_homology_group p X T, relative_homology_group p (subtopology X S) T], [hom_relboundary p X S T, hom_induced p X T X S id, hom_induced p (subtopology X S) T X T id])
[PROOF STEP]
using homology_exactness_triple_1 [OF \<open>T \<subseteq> S\<close>] homology_exactness_triple_3 [OF \<open>T \<subseteq> S\<close>]
[PROOF STATE]
proof (prove)
using this:
exact_seq ([relative_homology_group (?p - 1) (subtopology ?X S) T, relative_homology_group ?p ?X S, relative_homology_group ?p ?X T], [hom_relboundary ?p ?X S T, hom_induced ?p ?X T ?X S id])
exact_seq ([relative_homology_group ?p ?X S, relative_homology_group ?p ?X T, relative_homology_group ?p (subtopology ?X S) T], [hom_induced ?p ?X T ?X S id, hom_induced ?p (subtopology ?X S) T ?X T id])

goal (1 subgoal):
 1. exact_seq ([relative_homology_group (p - 1) (subtopology X S) T, relative_homology_group p X S, relative_homology_group p X T, relative_homology_group p (subtopology X S) T], [hom_relboundary p X S T, hom_induced p X T X S id, hom_induced p (subtopology X S) T X T id])
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
exact_seq ([relative_homology_group (p - 1) (subtopology X S) T, relative_homology_group p X S, relative_homology_group p X T, relative_homology_group p (subtopology X S) T], [hom_relboundary p X S T, hom_induced p X T X S id, hom_induced p (subtopology X S) T X T id])

goal (2 subgoals):
 1. trivial_group (relative_homology_group p (subtopology X S) T)
 2. trivial_group (relative_homology_group (p - 1) (subtopology X S) T)
[PROOF STEP]
show "trivial_group (relative_homology_group p (subtopology X S) T)" "trivial_group (relative_homology_group(p - 1) (subtopology X S) T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trivial_group (relative_homology_group p (subtopology X S) T) &&& trivial_group (relative_homology_group (p - 1) (subtopology X S) T)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
contractible_space (subtopology X S)
contractible_space (subtopology X T)
T \<subseteq> S
topspace X \<inter> T \<noteq> {}

goal (1 subgoal):
 1. trivial_group (relative_homology_group p (subtopology X S) T) &&& trivial_group (relative_homology_group (p - 1) (subtopology X S) T)
[PROOF STEP]
by (force simp: inf.absorb_iff2 subtopology_subtopology topspace_subtopology intro!: trivial_relative_homology_group_contractible_spaces)+
[PROOF STATE]
proof (state)
this:
trivial_group (relative_homology_group p (subtopology X S) T)
trivial_group (relative_homology_group (p - 1) (subtopology X S) T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rat_floor_lemma: "of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)
[PROOF STEP]
have "Fract a b = of_int (a div b) + Fract (a mod b) b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fract a b = of_int (a div b) + Fract (a mod b) b
[PROOF STEP]
by (cases "b = 0") (simp, simp add: of_int_rat)
[PROOF STATE]
proof (state)
this:
Fract a b = of_int (a div b) + Fract (a mod b) b

goal (1 subgoal):
 1. of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Fract a b = of_int (a div b) + Fract (a mod b) b

goal (1 subgoal):
 1. of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)
[PROOF STEP]
have "0 \<le> Fract (a mod b) b \<and> Fract (a mod b) b < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Fract (a mod b) b \<and> Fract (a mod b) b < 1
[PROOF STEP]
unfolding Fract_of_int_quotient
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> of_int (a mod b) / of_int b \<and> of_int (a mod b) / of_int b < 1
[PROOF STEP]
by (rule linorder_cases [of b 0]) (simp_all add: divide_nonpos_neg)
[PROOF STATE]
proof (state)
this:
0 \<le> Fract (a mod b) b \<and> Fract (a mod b) b < 1

goal (1 subgoal):
 1. of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Fract a b = of_int (a div b) + Fract (a mod b) b
0 \<le> Fract (a mod b) b \<and> Fract (a mod b) b < 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Fract a b = of_int (a div b) + Fract (a mod b) b
0 \<le> Fract (a mod b) b \<and> Fract (a mod b) b < 1

goal (1 subgoal):
 1. of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_Pow_filter_one:
  assumes "finite A"
  shows "card {x \<in> Pow A . card x = 1}  = card (A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x \<in> Pow A. card x = 1} = card A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. card {x \<in> Pow A. card x = 1} = card A
[PROOF STEP]
proof (induct rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card {x \<in> Pow {}. card x = 1} = card {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {x \<in> Pow F. card x = 1} = card F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. card {x \<in> Pow {}. card x = 1} = card {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {x \<in> Pow F. card x = 1} = card F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x \<in> Pow {}. card x = 1} = card {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {x \<in> Pow {}. card x = 1} = card {}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {x \<in> Pow F. card x = 1} = card F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {x \<in> Pow F. card x = 1} = card F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
card {x \<in> Pow F. card x = 1} = card F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {x \<in> Pow F. card x = 1} = card F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
have "Pow (insert x F) = Pow F \<union> insert x ` Pow F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pow (insert x F) = Pow F \<union> insert x ` Pow F
[PROOF STEP]
by (simp add: Pow_insert)
[PROOF STATE]
proof (state)
this:
Pow (insert x F) = Pow F \<union> insert x ` Pow F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {x \<in> Pow F. card x = 1} = card F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Pow (insert x F) = Pow F \<union> insert x ` Pow F
[PROOF STEP]
have split: "{y \<in> Pow (insert x F) . card y = 1} =
      {y \<in> (Pow F) . card y = 1} \<union> {y \<in> (insert x ` Pow F) . card y = 1}"
[PROOF STATE]
proof (prove)
using this:
Pow (insert x F) = Pow F \<union> insert x ` Pow F

goal (1 subgoal):
 1. {y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {y \<in> insert x ` Pow F. card y = 1}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {y \<in> insert x ` Pow F. card y = 1}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {x \<in> Pow F. card x = 1} = card F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
have "\<And> y . y \<in> (insert x ` Pow F) \<Longrightarrow> finite y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. y \<in> insert x ` Pow F \<Longrightarrow> finite y
[PROOF STEP]
using finite_subset insert.hyps(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
finite F

goal (1 subgoal):
 1. \<And>y. y \<in> insert x ` Pow F \<Longrightarrow> finite y
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
?y \<in> insert x ` Pow F \<Longrightarrow> finite ?y

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {x \<in> Pow F. card x = 1} = card F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?y \<in> insert x ` Pow F \<Longrightarrow> finite ?y
[PROOF STEP]
have single: "\<And> y . y \<in> (insert x ` Pow F) \<Longrightarrow> card y = 1 \<Longrightarrow> y = {x}"
[PROOF STATE]
proof (prove)
using this:
?y \<in> insert x ` Pow F \<Longrightarrow> finite ?y

goal (1 subgoal):
 1. \<And>y. \<lbrakk>y \<in> insert x ` Pow F; card y = 1\<rbrakk> \<Longrightarrow> y = {x}
[PROOF STEP]
by (metis card_1_singletonE empty_iff image_iff insertCI insertE)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?y \<in> insert x ` Pow F; card ?y = 1\<rbrakk> \<Longrightarrow> ?y = {x}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {x \<in> Pow F. card x = 1} = card F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?y \<in> insert x ` Pow F; card ?y = 1\<rbrakk> \<Longrightarrow> ?y = {x}
[PROOF STEP]
have "card {y \<in> (insert x ` Pow F) . card y = 1} = 1"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y \<in> insert x ` Pow F; card ?y = 1\<rbrakk> \<Longrightarrow> ?y = {x}

goal (1 subgoal):
 1. card {y \<in> insert x ` Pow F. card y = 1} = 1
[PROOF STEP]
using empty_iff imageI is_singletonI is_singletonI' is_singleton_altdef
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y \<in> insert x ` Pow F; card ?y = 1\<rbrakk> \<Longrightarrow> ?y = {x}
(?c \<in> {}) = False
?x \<in> ?A \<Longrightarrow> ?f ?x \<in> ?f ` ?A
is_singleton {?x}
\<lbrakk>?A \<noteq> {}; \<And>x y. \<lbrakk>x \<in> ?A; y \<in> ?A\<rbrakk> \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> is_singleton ?A
is_singleton ?A = (card ?A = 1)

goal (1 subgoal):
 1. card {y \<in> insert x ` Pow F. card y = 1} = 1
[PROOF STEP]
(* LONG *)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y \<in> insert x ` Pow F; card ?y = 1\<rbrakk> \<Longrightarrow> ?y = {x}
(?c \<in> {}) = False
?x \<in> ?A \<Longrightarrow> ?f ?x \<in> ?f ` ?A
is_singleton {?x}
\<lbrakk>?A \<noteq> {}; \<And>x y. \<lbrakk>x \<in> ?A; y \<in> ?A\<rbrakk> \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> is_singleton ?A
is_singleton ?A = (card ?A = 1)

goal (1 subgoal):
 1. card {y \<in> insert x ` Pow F. card y = 1} = 1
[PROOF STEP]
by (metis (full_types, lifting) Collect_empty_eq_bot Pow_bottom bot_empty_eq  mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
card {y \<in> insert x ` Pow F. card y = 1} = 1

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {x \<in> Pow F. card x = 1} = card F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card {y \<in> insert x ` Pow F. card y = 1} = 1
[PROOF STEP]
have " {y \<in> (insert x ` Pow F) . card y = 1} = {{x}}"
[PROOF STATE]
proof (prove)
using this:
card {y \<in> insert x ` Pow F. card y = 1} = 1

goal (1 subgoal):
 1. {y \<in> insert x ` Pow F. card y = 1} = {{x}}
[PROOF STEP]
using single card_1_singletonE card_eq_0_iff
[PROOF STATE]
proof (prove)
using this:
card {y \<in> insert x ` Pow F. card y = 1} = 1
\<lbrakk>?y \<in> insert x ` Pow F; card ?y = 1\<rbrakk> \<Longrightarrow> ?y = {x}
\<lbrakk>card ?A = 1; \<And>x. ?A = {x} \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
(card ?A = 0) = (?A = {} \<or> infinite ?A)

goal (1 subgoal):
 1. {y \<in> insert x ` Pow F. card y = 1} = {{x}}
[PROOF STEP]
by (smt empty_Collect_eq mem_Collect_eq singletonD zero_neq_one)
[PROOF STATE]
proof (state)
this:
{y \<in> insert x ` Pow F. card y = 1} = {{x}}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {x \<in> Pow F. card x = 1} = card F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{y \<in> insert x ` Pow F. card y = 1} = {{x}}
[PROOF STEP]
have split2:"{y \<in> Pow (insert x F) . card y = 1} = {y \<in> (Pow F) . card y = 1} \<union> {{x}}"
[PROOF STATE]
proof (prove)
using this:
{y \<in> insert x ` Pow F. card y = 1} = {{x}}

goal (1 subgoal):
 1. {y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}
[PROOF STEP]
using split
[PROOF STATE]
proof (prove)
using this:
{y \<in> insert x ` Pow F. card y = 1} = {{x}}
{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {y \<in> insert x ` Pow F. card y = 1}

goal (1 subgoal):
 1. {y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {x \<in> Pow F. card x = 1} = card F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}

goal (1 subgoal):
 1. card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
proof (cases "x \<in> F")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}; x \<in> F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
 2. \<lbrakk>{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}; x \<notin> F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x \<in> F

goal (2 subgoals):
 1. \<lbrakk>{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}; x \<in> F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
 2. \<lbrakk>{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}; x \<notin> F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> F

goal (1 subgoal):
 1. card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
using insert.hyps(2)
[PROOF STATE]
proof (prove)
using this:
x \<in> F
x \<notin> F

goal (1 subgoal):
 1. card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)

goal (1 subgoal):
 1. \<lbrakk>{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}; x \<notin> F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}; x \<notin> F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<notin> F

goal (1 subgoal):
 1. \<lbrakk>{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}; x \<notin> F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<notin> F
[PROOF STEP]
have "{y \<in> (Pow F) . card y = 1} \<inter> {{x}} = {}"
[PROOF STATE]
proof (prove)
using this:
x \<notin> F

goal (1 subgoal):
 1. {y \<in> Pow F. card y = 1} \<inter> {{x}} = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{y \<in> Pow F. card y = 1} \<inter> {{x}} = {}

goal (1 subgoal):
 1. \<lbrakk>{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}; x \<notin> F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{y \<in> Pow F. card y = 1} \<inter> {{x}} = {}
[PROOF STEP]
have fact:"card {y \<in> Pow (insert x F) . card y = 1} =
        card {y \<in> (Pow F) . card y = 1} + card {{x}}"
[PROOF STATE]
proof (prove)
using this:
{y \<in> Pow F. card y = 1} \<inter> {{x}} = {}

goal (1 subgoal):
 1. card {y \<in> Pow (insert x F). card y = 1} = card {y \<in> Pow F. card y = 1} + card {{x}}
[PROOF STEP]
using split2 card_Un_disjoint insert.hyps(1)
[PROOF STATE]
proof (prove)
using this:
{y \<in> Pow F. card y = 1} \<inter> {{x}} = {}
{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}
\<lbrakk>finite ?A; finite ?B; ?A \<inter> ?B = {}\<rbrakk> \<Longrightarrow> card (?A \<union> ?B) = card ?A + card ?B
finite F

goal (1 subgoal):
 1. card {y \<in> Pow (insert x F). card y = 1} = card {y \<in> Pow F. card y = 1} + card {{x}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {y \<in> Pow (insert x F). card y = 1} = card {y \<in> Pow F. card y = 1} + card {{x}}

goal (1 subgoal):
 1. \<lbrakk>{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}; x \<notin> F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
have "card (insert x F) = card F + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (insert x F) = card F + 1
[PROOF STEP]
using False card_insert_disjoint
[PROOF STATE]
proof (prove)
using this:
x \<notin> F
\<lbrakk>finite ?A; ?x \<notin> ?A\<rbrakk> \<Longrightarrow> card (insert ?x ?A) = Suc (card ?A)

goal (1 subgoal):
 1. card (insert x F) = card F + 1
[PROOF STEP]
by (metis Suc_eq_plus1 insert.hyps(1))
[PROOF STATE]
proof (state)
this:
card (insert x F) = card F + 1

goal (1 subgoal):
 1. \<lbrakk>{y \<in> Pow (insert x F). card y = 1} = {y \<in> Pow F. card y = 1} \<union> {{x}}; x \<notin> F\<rbrakk> \<Longrightarrow> card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (insert x F) = card F + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (insert x F) = card F + 1

goal (1 subgoal):
 1. card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
using fact insert.hyps(3)
[PROOF STATE]
proof (prove)
using this:
card (insert x F) = card F + 1
card {y \<in> Pow (insert x F). card y = 1} = card {y \<in> Pow F. card y = 1} + card {{x}}
card {x \<in> Pow F. card x = 1} = card F

goal (1 subgoal):
 1. card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {xa \<in> Pow (insert x F). card xa = 1} = card (insert x F)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ignore_one:
  fixes P :: "_ \<Rightarrow> nat \<Rightarrow> bool"
  assumes "P 1 n" "1 < n"
  shows "card {a \<in> {1..<n}. P a n} = 1 + card {a. 2 \<le> a \<and> a < n \<and> P a n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {a \<in> {1..<n}. P a n} = 1 + card {a. 2 \<le> a \<and> a < n \<and> P a n}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {a \<in> {1..<n}. P a n} = 1 + card {a. 2 \<le> a \<and> a < n \<and> P a n}
[PROOF STEP]
have "insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n} = {a. 1 \<le> a \<and> a < n \<and> P a n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n} = {a. 1 \<le> a \<and> a < n \<and> P a n}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P 1 n
1 < n

goal (1 subgoal):
 1. insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n} = {a. 1 \<le> a \<and> a < n \<and> P a n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n} = {a. 1 \<le> a \<and> a < n \<and> P a n}

goal (1 subgoal):
 1. card {a \<in> {1..<n}. P a n} = 1 + card {a. 2 \<le> a \<and> a < n \<and> P a n}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n} = {a. 1 \<le> a \<and> a < n \<and> P a n}

goal (1 subgoal):
 1. card {a \<in> {1..<n}. P a n} = 1 + card {a. 2 \<le> a \<and> a < n \<and> P a n}
[PROOF STEP]
have "card (insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n}) = Suc (card {a. 2 \<le> a \<and> a < n \<and> P a n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n}) = Suc (card {a. 2 \<le> a \<and> a < n \<and> P a n})
[PROOF STEP]
using card_insert_disjoint
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; ?x \<notin> ?A\<rbrakk> \<Longrightarrow> card (insert ?x ?A) = Suc (card ?A)

goal (1 subgoal):
 1. card (insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n}) = Suc (card {a. 2 \<le> a \<and> a < n \<and> P a n})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n}) = Suc (card {a. 2 \<le> a \<and> a < n \<and> P a n})

goal (1 subgoal):
 1. card {a \<in> {1..<n}. P a n} = 1 + card {a. 2 \<le> a \<and> a < n \<and> P a n}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n} = {a. 1 \<le> a \<and> a < n \<and> P a n}
card (insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n}) = Suc (card {a. 2 \<le> a \<and> a < n \<and> P a n})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n} = {a. 1 \<le> a \<and> a < n \<and> P a n}
card (insert 1 {a. 2 \<le> a \<and> a < n \<and> P a n}) = Suc (card {a. 2 \<le> a \<and> a < n \<and> P a n})

goal (1 subgoal):
 1. card {a \<in> {1..<n}. P a n} = 1 + card {a. 2 \<le> a \<and> a < n \<and> P a n}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
card {a \<in> {1..<n}. P a n} = 1 + card {a. 2 \<le> a \<and> a < n \<and> P a n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma to_fun_smult:
  assumes "f \<in> carrier P"
  assumes "b \<in> carrier R"
  assumes "c \<in> carrier R"
  shows "to_fun (c \<odot>\<^bsub>P\<^esub> f) b = c \<otimes>(to_fun f b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (c \<odot>\<^bsub>P\<^esub> f) b = c \<otimes> to_fun f b
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. to_fun (c \<odot>\<^bsub>P\<^esub> f) b = c \<otimes> to_fun f b
[PROOF STEP]
have "(c \<odot>\<^bsub>P\<^esub> f) = (to_poly c) \<otimes>\<^bsub>P\<^esub> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<odot>\<^bsub>P\<^esub> f = to_polynomial R c \<otimes>\<^bsub>P\<^esub> f
[PROOF STEP]
by (metis P_def assms(1) assms(3) monom_mult_is_smult to_polynomial_def)
[PROOF STATE]
proof (state)
this:
c \<odot>\<^bsub>P\<^esub> f = to_polynomial R c \<otimes>\<^bsub>P\<^esub> f

goal (1 subgoal):
 1. to_fun (c \<odot>\<^bsub>P\<^esub> f) b = c \<otimes> to_fun f b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<odot>\<^bsub>P\<^esub> f = to_polynomial R c \<otimes>\<^bsub>P\<^esub> f
[PROOF STEP]
have "to_fun (c \<odot>\<^bsub>P\<^esub> f) b = to_fun (to_poly c) b \<otimes> to_fun f b"
[PROOF STATE]
proof (prove)
using this:
c \<odot>\<^bsub>P\<^esub> f = to_polynomial R c \<otimes>\<^bsub>P\<^esub> f

goal (1 subgoal):
 1. to_fun (c \<odot>\<^bsub>P\<^esub> f) b = to_fun (to_polynomial R c) b \<otimes> to_fun f b
[PROOF STEP]
by (simp add: assms(1) assms(2) assms(3) to_fun_mult to_poly_closed)
[PROOF STATE]
proof (state)
this:
to_fun (c \<odot>\<^bsub>P\<^esub> f) b = to_fun (to_polynomial R c) b \<otimes> to_fun f b

goal (1 subgoal):
 1. to_fun (c \<odot>\<^bsub>P\<^esub> f) b = c \<otimes> to_fun f b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
to_fun (c \<odot>\<^bsub>P\<^esub> f) b = to_fun (to_polynomial R c) b \<otimes> to_fun f b
[PROOF STEP]
show  ?thesis
[PROOF STATE]
proof (prove)
using this:
to_fun (c \<odot>\<^bsub>P\<^esub> f) b = to_fun (to_polynomial R c) b \<otimes> to_fun f b

goal (1 subgoal):
 1. to_fun (c \<odot>\<^bsub>P\<^esub> f) b = c \<otimes> to_fun f b
[PROOF STEP]
by (simp add: assms(2) assms(3) to_fun_to_poly)
[PROOF STATE]
proof (state)
this:
to_fun (c \<odot>\<^bsub>P\<^esub> f) b = c \<otimes> to_fun f b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma d_OUT_monotone_convergence_SUP:
  assumes "incseq (\<lambda>n y. f n (x, y))"
  shows "d_OUT (\<lambda>e. SUP n. f n e) x = (SUP n. d_OUT (f n) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d_OUT (\<lambda>e. \<Squnion>n. f n e) x = (\<Squnion>n. d_OUT (f n) x)
[PROOF STEP]
unfolding d_OUT_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ y. \<Squnion>n. f n (x, y)) = (\<Squnion>n. \<Sum>\<^sup>+ y. f n (x, y))
[PROOF STEP]
by(rule nn_integral_monotone_convergence_SUP[OF assms]) simp


[STATEMENT]
lemma dist_fs_cvec_zero:
  assumes "z \<noteq> vec_zero" and "w \<noteq> vec_zero"
  shows  "dist_fs_cvec z w = 0 \<longleftrightarrow> (cmod \<langle>z,w\<rangle>)\<^sup>2 = (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist_fs_cvec z w = 0) = ((cmod \<langle>z,w\<rangle>)\<^sup>2 = \<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2)
[PROOF STEP]
using assms norm_cvec_gt_0[of z]  norm_cvec_gt_0[of w]
[PROOF STATE]
proof (prove)
using this:
z \<noteq> vec_zero
w \<noteq> vec_zero
z \<noteq> vec_zero \<Longrightarrow> 0 < \<langle>z\<rangle>
w \<noteq> vec_zero \<Longrightarrow> 0 < \<langle>w\<rangle>

goal (1 subgoal):
 1. (dist_fs_cvec z w = 0) = ((cmod \<langle>z,w\<rangle>)\<^sup>2 = \<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2)
[PROOF STEP]
by (subst dist_fs_cvec_iff) auto


[STATEMENT]
lemma card_gcd_eq_totient:
  "n > 0 \<Longrightarrow> d dvd n \<Longrightarrow> card {k\<in>{0<..n}. gcd k n = d} = totient (n div d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; d dvd n\<rbrakk> \<Longrightarrow> card {k \<in> {0<..n}. gcd k n = d} = totient (n div d)
[PROOF STEP]
unfolding totient_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; d dvd n\<rbrakk> \<Longrightarrow> card {k \<in> {0<..n}. gcd k n = d} = card (totatives (n div d))
[PROOF STEP]
by (rule sym, rule bij_betw_same_card[OF bij_betw_totatives_gcd_eq])


[STATEMENT]
theorem derangements_formula':
  assumes "n \<noteq> 0" "finite S" "card S = n"
  shows "card (derangements S) = nat (round (fact n / exp 1 :: real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (derangements S) = nat (round (fact n / exp 1))
[PROOF STEP]
using derangements_formula[OF assms]
[PROOF STATE]
proof (prove)
using this:
int (card (derangements S)) = round (fact n / exp 1)

goal (1 subgoal):
 1. card (derangements S) = nat (round (fact n / exp 1))
[PROOF STEP]
by simp


[STATEMENT]
lemma mat_adjoint_def': "mat_adjoint M = transpose_mat (map_mat conjugate M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_adjoint M = (map_mat conjugate M)\<^sup>T
[PROOF STEP]
apply (rule mat_eq_iff[THEN iffD2])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat_adjoint M) = dim_row (map_mat conjugate M)\<^sup>T \<and> dim_col (mat_adjoint M) = dim_col (map_mat conjugate M)\<^sup>T \<and> (\<forall>i j. i < dim_row (map_mat conjugate M)\<^sup>T \<longrightarrow> j < dim_col (map_mat conjugate M)\<^sup>T \<longrightarrow> mat_adjoint M $$ (i, j) = (map_mat conjugate M)\<^sup>T $$ (i, j))
[PROOF STEP]
apply (auto simp: mat_adjoint_def transpose_mat_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col M; j < dim_row M\<rbrakk> \<Longrightarrow> mat_of_rows (dim_row M) (map conjugate (cols M)) $$ (i, j) = conjugate (M $$ (j, i))
[PROOF STEP]
apply (subst mat_of_rows_index)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_col M; j < dim_row M\<rbrakk> \<Longrightarrow> i < length (map conjugate (cols M))
 2. \<And>i j. \<lbrakk>i < dim_col M; j < dim_row M\<rbrakk> \<Longrightarrow> j < dim_row M
 3. \<And>i j. \<lbrakk>i < dim_col M; j < dim_row M\<rbrakk> \<Longrightarrow> map conjugate (cols M) ! i $ j = conjugate (M $$ (j, i))
[PROOF STEP]
by auto


[STATEMENT]
lemma d_OUT_current_of_bipartite:
  assumes f: "current (bipartite_web_of \<Gamma>) f"
  shows "d_OUT (current_of_bipartite f) x = d_OUT f (Inl x) - f (Inl x, Inr x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d_OUT (current_of_bipartite f) x = d_OUT f (Inl x) - f (Inl x, Inr x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. d_OUT (current_of_bipartite f) x = d_OUT f (Inl x) - f (Inl x, Inr x)
[PROOF STEP]
have "d_OUT (current_of_bipartite f) x = \<integral>\<^sup>+ y. f (Inl x, y) * indicator \<^bold>E (x, projr y) \<partial>count_space (range Inr)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d_OUT (current_of_bipartite f) x = (\<Sum>\<^sup>+ y\<in>range Inr. f (Inl x, y) * indicator \<^bold>E (x, projr y))
[PROOF STEP]
by(simp add: d_OUT_def nn_integral_count_space_reindex)
[PROOF STATE]
proof (state)
this:
d_OUT (current_of_bipartite f) x = (\<Sum>\<^sup>+ y\<in>range Inr. f (Inl x, y) * indicator \<^bold>E (x, projr y))

goal (1 subgoal):
 1. d_OUT (current_of_bipartite f) x = d_OUT f (Inl x) - f (Inl x, Inr x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
d_OUT (current_of_bipartite f) x = (\<Sum>\<^sup>+ y\<in>range Inr. f (Inl x, y) * indicator \<^bold>E (x, projr y))

goal (1 subgoal):
 1. d_OUT (current_of_bipartite f) x = d_OUT f (Inl x) - f (Inl x, Inr x)
[PROOF STEP]
have "\<dots> = d_OUT f (Inl x) - \<integral>\<^sup>+ y. f (Inl x, y) * indicator {Inr x} y \<partial>count_space UNIV" (is "_ = _ - ?rest")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ y\<in>range Inr. f (Inl x, y) * indicator \<^bold>E (x, projr y)) = d_OUT f (Inl x) - (\<integral>\<^sup>+y\<in>{Inr x}. f (Inl x, y)\<partial>count_space UNIV)
[PROOF STEP]
unfolding d_OUT_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ y\<in>range Inr. f (Inl x, y) * indicator \<^bold>E (x, projr y)) = (\<Sum>\<^sup>+ y. f (Inl x, y)) - (\<integral>\<^sup>+y\<in>{Inr x}. f (Inl x, y)\<partial>count_space UNIV)
[PROOF STEP]
by(subst nn_integral_diff[symmetric])(auto 4 4 simp add: current_bipartite_web_finite[OF f] AE_count_space nn_integral_count_space_indicator no_loop split: split_indicator intro!: nn_integral_cong intro: currentD_outside[OF f] elim: edge_bipartite_webE)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sup>+ y\<in>range Inr. f (Inl x, y) * indicator \<^bold>E (x, projr y)) = d_OUT f (Inl x) - (\<integral>\<^sup>+y\<in>{Inr x}. f (Inl x, y)\<partial>count_space UNIV)

goal (1 subgoal):
 1. d_OUT (current_of_bipartite f) x = d_OUT f (Inl x) - f (Inl x, Inr x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
d_OUT (current_of_bipartite f) x = d_OUT f (Inl x) - (\<integral>\<^sup>+y\<in>{Inr x}. f (Inl x, y)\<partial>count_space UNIV)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
d_OUT (current_of_bipartite f) x = d_OUT f (Inl x) - (\<integral>\<^sup>+y\<in>{Inr x}. f (Inl x, y)\<partial>count_space UNIV)

goal (1 subgoal):
 1. d_OUT (current_of_bipartite f) x = d_OUT f (Inl x) - f (Inl x, Inr x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
d_OUT (current_of_bipartite f) x = d_OUT f (Inl x) - f (Inl x, Inr x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distinct_concat:
  "\<lbrakk> distinct xs;
     \<And> ys. ys \<in> set xs \<Longrightarrow> distinct ys;
     \<And> ys zs. \<lbrakk> ys \<in> set xs ; zs \<in> set xs ; ys \<noteq> zs \<rbrakk> \<Longrightarrow> set ys \<inter> set zs = {}
   \<rbrakk> \<Longrightarrow> distinct (concat xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; \<And>ys. ys \<in> set xs \<Longrightarrow> distinct ys; \<And>ys zs. \<lbrakk>ys \<in> set xs; zs \<in> set xs; ys \<noteq> zs\<rbrakk> \<Longrightarrow> set ys \<inter> set zs = {}\<rbrakk> \<Longrightarrow> distinct (concat xs)
[PROOF STEP]
by (induct xs) auto


[STATEMENT]
lemma "nnf ((Atom (k::nat)) \<^bold>\<rightarrow> (Not ((Atom l) \<^bold>\<or> (Not (Atom m))))) = \<^bold>\<not> (Atom k) \<^bold>\<or> (\<^bold>\<not> (Atom l) \<^bold>\<and> Atom m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nnf (Atom k \<^bold>\<rightarrow> \<^bold>\<not> (Atom l \<^bold>\<or> \<^bold>\<not> (Atom m))) = \<^bold>\<not> (Atom k) \<^bold>\<or> (\<^bold>\<not> (Atom l) \<^bold>\<and> Atom m)
[PROOF STEP]
by code_simp


[STATEMENT]
lemma eval_fps_diff:
  fixes f g :: "'a :: {banach, real_normed_div_algebra} fps"
  assumes "norm z < fps_conv_radius f" "norm z < fps_conv_radius g"
  shows   "eval_fps (f - g) z = eval_fps f z - eval_fps g z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fps (f - g) z = eval_fps f z - eval_fps g z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ereal (norm z) < fps_conv_radius f
ereal (norm z) < fps_conv_radius g

goal (1 subgoal):
 1. eval_fps (f - g) z = eval_fps f z - eval_fps g z
[PROOF STEP]
unfolding eval_fps_def
[PROOF STATE]
proof (prove)
using this:
ereal (norm z) < fps_conv_radius f
ereal (norm z) < fps_conv_radius g

goal (1 subgoal):
 1. (\<Sum>n. fps_nth (f - g) n * z ^ n) = (\<Sum>n. fps_nth f n * z ^ n) - (\<Sum>n. fps_nth g n * z ^ n)
[PROOF STEP]
by (subst suminf_diff) (auto simp: ring_distribs intro!: summable_fps)


[STATEMENT]
lemma infsetsum_cdiv:
  fixes f :: "'a \<Rightarrow> 'b :: {banach, real_normed_field, second_countable_topology}"
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
  shows   "infsetsum (\<lambda>x. f x / c) A = infsetsum f A / c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. f x / c) = infsetsum f A / c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'b) \<Longrightarrow> f abs_summable_on A

goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. f x / c) = infsetsum f A / c
[PROOF STEP]
unfolding infsetsum_def abs_summable_on_def
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'b) \<Longrightarrow> integrable (count_space A) f

goal (1 subgoal):
 1. LINT x|count_space A. f x / c = integral\<^sup>L (count_space A) f / c
[PROOF STEP]
by auto


[STATEMENT]
lemma rec_exec_pr_Suc_simps: "rec_exec (Pr n f g) (xs @ [Suc y])
          = rec_exec g (xs @ [y, rec_exec (Pr n f g) (xs @ [y])])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_exec (Pr n f g) (xs @ [Suc y]) = rec_exec g (xs @ [y, rec_exec (Pr n f g) (xs @ [y])])
[PROOF STEP]
apply(induct y)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. rec_exec (Pr n f g) (xs @ [Suc 0]) = rec_exec g (xs @ [0, rec_exec (Pr n f g) (xs @ [0])])
 2. \<And>y. rec_exec (Pr n f g) (xs @ [Suc y]) = rec_exec g (xs @ [y, rec_exec (Pr n f g) (xs @ [y])]) \<Longrightarrow> rec_exec (Pr n f g) (xs @ [Suc (Suc y)]) = rec_exec g (xs @ [Suc y, rec_exec (Pr n f g) (xs @ [Suc y])])
[PROOF STEP]
apply(simp add: rec_exec.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. rec_exec (Pr n f g) (xs @ [Suc y]) = rec_exec g (xs @ [y, rec_exec (Pr n f g) (xs @ [y])]) \<Longrightarrow> rec_exec (Pr n f g) (xs @ [Suc (Suc y)]) = rec_exec g (xs @ [Suc y, rec_exec (Pr n f g) (xs @ [Suc y])])
[PROOF STEP]
apply(simp add: rec_exec.simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sin_plus_cos_eq_45:
  "sin x + cos x = sqrt 2 * sin (x + pi/4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin x + cos x = sqrt 2 * sin (x + pi / 4)
[PROOF STEP]
apply (simp add: sin_add sin_45 cos_45 )
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin x + cos x = sqrt 2 * (sin x * sqrt 2 / 2 + cos x * sqrt 2 / 2)
[PROOF STEP]
by (simp add: field_simps)


[STATEMENT]
lemma infsetsum_Sigma':
  fixes A :: "'a set" and B :: "'a \<Rightarrow> 'b set"
  assumes [simp]: "countable A" and "\<And>i. countable (B i)"
  assumes summable: "(\<lambda>(x,y). f x y) abs_summable_on (Sigma A B)"
  shows   "infsetsum (\<lambda>x. infsetsum (\<lambda>y. f x y) (B x)) A = infsetsum (\<lambda>(x,y). f x y) (Sigma A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. infsetsum (f x) (B x)) = (\<Sum>\<^sub>a(x, y)\<in>Sigma A B. f x y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
countable A
countable (B ?i)
(\<lambda>(x, y). f x y) abs_summable_on Sigma A B

goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. infsetsum (f x) (B x)) = (\<Sum>\<^sub>a(x, y)\<in>Sigma A B. f x y)
[PROOF STEP]
by (subst infsetsum_Sigma) auto


[STATEMENT]
lemma "listwordinterval_adjacent [(1::16 word, 3), (5, 10), (10,10), (4,4)] = [(10, 10), (1, 10)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. listwordinterval_adjacent [(1, 3), (5, 10), (10, 10), (4, 4)] = [(10, 10), (1, 10)]
[PROOF STEP]
by eval


[STATEMENT]
theorem prim_pyth_triple_iff:
  "prim_pyth_triple x y z \<longleftrightarrow>
     (\<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not>(odd u \<and> odd v) \<and>
            (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2  \<or>  x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2)"
  (is "_ \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prim_pyth_triple x y z = (\<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. prim_pyth_triple x y z \<Longrightarrow> \<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2
 2. \<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2 \<Longrightarrow> prim_pyth_triple x y z
[PROOF STEP]
assume "prim_pyth_triple x y z"
[PROOF STATE]
proof (state)
this:
prim_pyth_triple x y z

goal (2 subgoals):
 1. prim_pyth_triple x y z \<Longrightarrow> \<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2
 2. \<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2 \<Longrightarrow> prim_pyth_triple x y z
[PROOF STEP]
from prim_pyth_tripleE[OF this]
[PROOF STATE]
proof (chain)
picking this:
(\<And>u v. \<lbrakk>0 < v; v < u; coprime u v; \<not> (odd u \<and> odd v); z = u\<^sup>2 + v\<^sup>2; x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
(\<And>u v. \<lbrakk>0 < v; v < u; coprime u v; \<not> (odd u \<and> odd v); z = u\<^sup>2 + v\<^sup>2; x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2

goal (1 subgoal):
 1. \<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2 \<Longrightarrow> prim_pyth_triple x y z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2 \<Longrightarrow> prim_pyth_triple x y z
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
\<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2

goal (1 subgoal):
 1. \<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2 \<Longrightarrow> prim_pyth_triple x y z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2
[PROOF STEP]
obtain u v where uv: "0 < v" "v < u" "coprime u v" "\<not>(odd u \<and> odd v)" "z = u\<^sup>2 + v\<^sup>2" and
                        eq: "x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2  \<or>  x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v"
[PROOF STATE]
proof (prove)
using this:
\<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2

goal (1 subgoal):
 1. (\<And>v u. \<lbrakk>0 < v; v < u; coprime u v; \<not> (odd u \<and> odd v); z = u\<^sup>2 + v\<^sup>2; x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
0 < v
v < u
coprime u v
\<not> (odd u \<and> odd v)
z = u\<^sup>2 + v\<^sup>2
x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v

goal (1 subgoal):
 1. \<exists>u v. 0 < v \<and> v < u \<and> coprime u v \<and> \<not> (odd u \<and> odd v) \<and> (x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v) \<and> z = u\<^sup>2 + v\<^sup>2 \<Longrightarrow> prim_pyth_triple x y z
[PROOF STEP]
thus "prim_pyth_triple x y z"
[PROOF STATE]
proof (prove)
using this:
0 < v
v < u
coprime u v
\<not> (odd u \<and> odd v)
z = u\<^sup>2 + v\<^sup>2
x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v

goal (1 subgoal):
 1. prim_pyth_triple x y z
[PROOF STEP]
using uv prim_pyth_tripleI1[OF uv(1-4)] prim_pyth_tripleI2[OF uv(1-4)] uv(5) eq
[PROOF STATE]
proof (prove)
using this:
0 < v
v < u
coprime u v
\<not> (odd u \<and> odd v)
z = u\<^sup>2 + v\<^sup>2
x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v
0 < v
v < u
coprime u v
\<not> (odd u \<and> odd v)
z = u\<^sup>2 + v\<^sup>2
prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
prim_pyth_triple (u\<^sup>2 - v\<^sup>2) (2 * u * v) (u\<^sup>2 + v\<^sup>2)
z = u\<^sup>2 + v\<^sup>2
x = 2 * u * v \<and> y = u\<^sup>2 - v\<^sup>2 \<or> x = u\<^sup>2 - v\<^sup>2 \<and> y = 2 * u * v

goal (1 subgoal):
 1. prim_pyth_triple x y z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prim_pyth_triple x y z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_at_left_to_right:
  "eventually P (at_left a) \<longleftrightarrow> eventually (\<lambda>x. P (- x)) (at_right (-a))"
  for a :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (at_left a) = (\<forall>\<^sub>F x in at_right (- a). P (- x))
[PROOF STEP]
unfolding at_left_minus[of a]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (filtermap uminus (at_right (- a))) = (\<forall>\<^sub>F x in at_right (- a). P (- x))
[PROOF STEP]
by (simp add: eventually_filtermap)


[STATEMENT]
lemma senior_states_card_le:
  "card (senior_states p n) < card (senior_states q n) \<longleftrightarrow> senior_states p n \<subset> senior_states q n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card (senior_states p n) < card (senior_states q n)) = (senior_states p n \<subset> senior_states q n)
[PROOF STEP]
by (metis card_mono not_less senior_states_cases_subseteq senior_states_finite senior_states_psubset_card_mono subset_not_subset_eq)


[STATEMENT]
lemma mult_ceiling_le:
  assumes "0 \<le> a" and "0 \<le> b"
  shows "\<lceil>a * b\<rceil> \<le> \<lceil>a\<rceil> * \<lceil>b\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>a * b\<rceil> \<le> \<lceil>a\<rceil> * \<lceil>b\<rceil>
[PROOF STEP]
by (metis assms ceiling_le_iff ceiling_mono le_of_int_ceiling mult_mono of_int_mult)


[STATEMENT]
lemma finite_From_empty:
  assumes "\<forall>s. finite (LV r s)"
  shows "finite (LV (From r n) s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (LV (From r n) s)
[PROOF STEP]
apply(rule finite_subset)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. LV (From r n) s \<subseteq> ?B
 2. finite ?B
[PROOF STEP]
apply(rule LV_From_5)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Stars_Append (LV (Star r) s) (\<Union>i\<le>n. LV (From r i) []))
[PROOF STEP]
apply(rule finite_Stars_Append)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (LV (Star r) s)
 2. finite (\<Union>i\<le>n. LV (From r i) [])
[PROOF STEP]
apply(rule LV_STAR_finite)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>s. finite (LV r s)
 2. finite (\<Union>i\<le>n. LV (From r i) [])
[PROOF STEP]
apply(rule assms)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Union>i\<le>n. LV (From r i) [])
[PROOF STEP]
apply(rule finite_UN_I)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {..n}
 2. \<And>i. i \<in> {..n} \<Longrightarrow> finite (LV (From r i) [])
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<le> n \<Longrightarrow> finite (LV (From r i) [])
[PROOF STEP]
by (simp add: assms finite_Stars_Pow LV_From_empty)


[STATEMENT]
lemma rel_interior_interior:
  fixes S :: "'n::euclidean_space set"
  assumes "affine hull S = UNIV"
  shows "rel_interior S = interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior S = interior S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
affine hull S = UNIV

goal (1 subgoal):
 1. rel_interior S = interior S
[PROOF STEP]
unfolding rel_interior interior_def
[PROOF STATE]
proof (prove)
using this:
affine hull S = UNIV

goal (1 subgoal):
 1. {x \<in> S. \<exists>T. open T \<and> x \<in> T \<and> T \<inter> affine hull S \<subseteq> S} = \<Union> {T. open T \<and> T \<subseteq> S}
[PROOF STEP]
by auto


[STATEMENT]
lemma map_uminus_psums:
  fixes xs :: "'a :: ab_group_add list"
  shows "map uminus (psums xs) = psums (map uminus xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map uminus (psums xs) = psums (map uminus xs)
[PROOF STEP]
by (induction xs rule: psums.induct) (simp_all)


[STATEMENT]
lemma  ket_psim_dim:
  shows "dim_vec ket_psim = 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec ket_psim = 4
[PROOF STEP]
using ket_01_dim ket_10_dim
[PROOF STATE]
proof (prove)
using this:
dim_vec ket_01 = 4
dim_vec ket_10 = 4

goal (1 subgoal):
 1. dim_vec ket_psim = 4
[PROOF STEP]
unfolding ket_psim_def
[PROOF STATE]
proof (prove)
using this:
dim_vec ket_01 = 4
dim_vec ket_10 = 4

goal (1 subgoal):
 1. dim_vec (complex_of_real (1 / sqrt 2) \<cdot>\<^sub>v (ket_01 - ket_10)) = 4
[PROOF STEP]
by simp


[STATEMENT]
lemma card_cart_basis: "card (cart_basis::('a::zero_neq_one^'i) set) = CARD('i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card cart_basis = CARD('i)
[PROOF STEP]
unfolding cart_basis_def Setcompr_eq_image
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (range (\<lambda>i. axis i (1::'a))) = CARD('i)
[PROOF STEP]
by (rule card_image) (auto simp: inj_on_def axis_eq_axis)


[STATEMENT]
lemma aHom_inv_inv:"\<lbrakk>aGroup F; aGroup G; f \<in> aHom F G; a \<in> carrier F\<rbrakk> \<Longrightarrow>
                         f (-\<^sub>a\<^bsub>F\<^esub> a) = -\<^sub>a\<^bsub>G\<^esub> (f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup F; aGroup G; f \<in> aHom F G; a \<in> carrier F\<rbrakk> \<Longrightarrow> f (-\<^sub>a\<^bsub>F\<^esub> a) = -\<^sub>a\<^bsub>G\<^esub> f a
[PROOF STEP]
apply (frule aGroup.ag_l_inv1 [of "F" "a"], assumption+,
       frule sym, thin_tac "-\<^sub>a\<^bsub>F\<^esub> a \<plusminus>\<^bsub>F\<^esub> a = \<zero>\<^bsub>F\<^esub>",
       frule aHom_0_0[of "F" "G" "f"], assumption+,
       frule aGroup.ag_mOp_closed[of "F" "a"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup F; aGroup G; f \<in> aHom F G; a \<in> carrier F; \<zero>\<^bsub>F\<^esub> = -\<^sub>a\<^bsub>F\<^esub> a \<plusminus>\<^bsub>F\<^esub> a; f \<zero>\<^bsub>F\<^esub> = \<zero>\<^bsub>G\<^esub>; -\<^sub>a\<^bsub>F\<^esub> a \<in> carrier F\<rbrakk> \<Longrightarrow> f (-\<^sub>a\<^bsub>F\<^esub> a) = -\<^sub>a\<^bsub>G\<^esub> f a
[PROOF STEP]
apply (simp add:aHom_add, thin_tac "\<zero>\<^bsub>F\<^esub> = -\<^sub>a\<^bsub>F\<^esub> a \<plusminus>\<^bsub>F\<^esub> a")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup F; aGroup G; f \<in> aHom F G; a \<in> carrier F; f (-\<^sub>a\<^bsub>F\<^esub> a) \<plusminus>\<^bsub>G\<^esub> f a = \<zero>\<^bsub>G\<^esub>; -\<^sub>a\<^bsub>F\<^esub> a \<in> carrier F\<rbrakk> \<Longrightarrow> f (-\<^sub>a\<^bsub>F\<^esub> a) = -\<^sub>a\<^bsub>G\<^esub> f a
[PROOF STEP]
apply (frule aHom_mem[of "F" "G" "f" "-\<^sub>a\<^bsub>F\<^esub> a"], assumption+,
        frule aHom_mem[of "F" "G" "f" "a"], assumption+,
        simp only:aGroup.ag_pOp_commute[of "G" "f (-\<^sub>a\<^bsub>F\<^esub> a)" "f a"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup F; aGroup G; f \<in> aHom F G; a \<in> carrier F; f a \<plusminus>\<^bsub>G\<^esub> f (-\<^sub>a\<^bsub>F\<^esub> a) = \<zero>\<^bsub>G\<^esub>; -\<^sub>a\<^bsub>F\<^esub> a \<in> carrier F; f (-\<^sub>a\<^bsub>F\<^esub> a) \<in> carrier G; f a \<in> carrier G\<rbrakk> \<Longrightarrow> f (-\<^sub>a\<^bsub>F\<^esub> a) = -\<^sub>a\<^bsub>G\<^esub> f a
[PROOF STEP]
apply (rule aGroup.ag_inv_unique[of "G"], assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma split_float_interval_bounds:
  shows
    lower_split_float_interval1: "lower (fst (split_float_interval X)) = lower X"
  and lower_split_float_interval2: "lower (snd (split_float_interval X)) = mid X"
  and upper_split_float_interval1: "upper (fst (split_float_interval X)) = mid X"
  and upper_split_float_interval2: "upper (snd (split_float_interval X)) = upper X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lower (fst (split_float_interval X)) = lower X &&& lower (snd (split_float_interval X)) = mid X) &&& upper (fst (split_float_interval X)) = mid X &&& upper (snd (split_float_interval X)) = upper X
[PROOF STEP]
using mid_le[of X]
[PROOF STATE]
proof (prove)
using this:
lower X \<le> mid X
mid X \<le> upper X

goal (1 subgoal):
 1. (lower (fst (split_float_interval X)) = lower X &&& lower (snd (split_float_interval X)) = mid X) &&& upper (fst (split_float_interval X)) = mid X &&& upper (snd (split_float_interval X)) = upper X
[PROOF STEP]
by (auto simp: split_float_interval_def mid_def[symmetric] min_def max_def real_of_float_eq
      lower_split_interval1 lower_split_interval2
      upper_split_interval1 upper_split_interval2)


[STATEMENT]
lemma complex_derivative_transform_within_open:
  "\<lbrakk>f holomorphic_on s; g holomorphic_on s; open s; z \<in> s; \<And>w. w \<in> s \<Longrightarrow> f w = g w\<rbrakk>
   \<Longrightarrow> deriv f z = deriv g z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f holomorphic_on s; g holomorphic_on s; open s; z \<in> s; \<And>w. w \<in> s \<Longrightarrow> f w = g w\<rbrakk> \<Longrightarrow> deriv f z = deriv g z
[PROOF STEP]
unfolding holomorphic_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>s. f field_differentiable at x within s; \<forall>x\<in>s. g field_differentiable at x within s; open s; z \<in> s; \<And>w. w \<in> s \<Longrightarrow> f w = g w\<rbrakk> \<Longrightarrow> deriv f z = deriv g z
[PROOF STEP]
by (rule DERIV_imp_deriv)
     (metis DERIV_deriv_iff_field_differentiable has_field_derivative_transform_within_open at_within_open)


[STATEMENT]
lemma isShortestPath_min_dist_def:
  "isShortestPath u p v \<longleftrightarrow> isPath u p v \<and> length p = min_dist u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isShortestPath u p v = (isPath u p v \<and> length p = min_dist u v)
[PROOF STEP]
unfolding isShortestPath_def min_dist_def dist_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (isPath u p v \<and> (\<forall>p'. isPath u p' v \<longrightarrow> length p \<le> length p')) = (isPath u p v \<and> length p = (LEAST d. \<exists>p. isPath u p v \<and> length p = d))
[PROOF STEP]
apply (rule iffI; clarsimp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>isPath u p v; \<forall>p'. isPath u p' v \<longrightarrow> length p \<le> length p'\<rbrakk> \<Longrightarrow> length p = (LEAST d. \<exists>p. isPath u p v \<and> length p = d)
 2. \<And>p'. \<lbrakk>isPath u p v; length p = (LEAST d. \<exists>p. isPath u p v \<and> length p = d); isPath u p' v\<rbrakk> \<Longrightarrow> (LEAST d. \<exists>p. isPath u p v \<and> length p = d) \<le> length p'
[PROOF STEP]
apply (rule Least_equality[symmetric]; auto; fail)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p'. \<lbrakk>isPath u p v; length p = (LEAST d. \<exists>p. isPath u p v \<and> length p = d); isPath u p' v\<rbrakk> \<Longrightarrow> (LEAST d. \<exists>p. isPath u p v \<and> length p = d) \<le> length p'
[PROOF STEP]
apply (rule Least_le; auto; fail)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma dvd_multiplicity_eq:
  "x \<noteq> 0 \<Longrightarrow> y \<noteq> 0 \<Longrightarrow> x dvd y \<longleftrightarrow> (\<forall>p. multiplicity p x \<le> multiplicity p y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<noteq> (0::'a); y \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> (x dvd y) = (\<forall>p. multiplicity p x \<le> multiplicity p y)
[PROOF STEP]
by (auto intro: dvd_imp_multiplicity_le multiplicity_le_imp_dvd)