[STATEMENT]
lemma fds_abs_convergent_euler_product:
  fixes f :: "'a :: {nat_power, real_normed_field, banach, second_countable_topology} fds"
  assumes "multiplicative_function (fds_nth f)" and "fds_abs_converges f s"
  shows   "abs_convergent_prod
             (\<lambda>p. if prime p then \<Sum>i. fds_nth f (p ^ i) / nat_power (p ^ i) s else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abs_convergent_prod (\<lambda>p. if prime p then \<Sum>i. fds_nth f (p ^ i) / nat_power (p ^ i) s else (1::'a))
[PROOF STEP]
unfolding eval_fds_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abs_convergent_prod (\<lambda>p. if prime p then \<Sum>i. fds_nth f (p ^ i) / nat_power (p ^ i) s else (1::'a))
[PROOF STEP]
proof (rule abs_convergent_euler_product)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. summable (\<lambda>i. norm (fds_nth f i / nat_power i s))
 2. multiplicative_function (\<lambda>a. fds_nth f a / nat_power a s)
[PROOF STEP]
show "multiplicative_function (\<lambda>n. fds_nth f n / nat_power n s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicative_function (\<lambda>n. fds_nth f n / nat_power n s)
[PROOF STEP]
by (rule multiplicative_function_divide_nat_power) fact+
[PROOF STATE]
proof (state)
this:
multiplicative_function (\<lambda>n. fds_nth f n / nat_power n s)

goal (1 subgoal):
 1. summable (\<lambda>i. norm (fds_nth f i / nat_power i s))
[PROOF STEP]
qed (insert assms, auto simp: fds_abs_converges_def)


[STATEMENT]
lemma open_neg_translation:
  fixes S :: "'a::real_normed_vector set"
  assumes "open S"
  shows "open((\<lambda>x. a - x) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open ((-) a ` S)
[PROOF STEP]
using open_translation[OF open_negations[OF assms], of a]
[PROOF STATE]
proof (prove)
using this:
open ((+) a ` uminus ` S)

goal (1 subgoal):
 1. open ((-) a ` S)
[PROOF STEP]
by (auto simp: image_image)


[STATEMENT]
lemma hypext_fun_mult:
  assumes "f twice_field_differentiable_at (Base x)"
      and "g twice_field_differentiable_at (Base x)"
    shows "(*h* (\<lambda>z. f z * g z)) x = (*h* f) x * (*h* g) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*h* (\<lambda>z. f z * g z)) x = (*h* f) x * (*h* g) x
[PROOF STEP]
proof (simp add: hyperdual_eq_iff distrib_left[symmetric], intro conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. Eps1 x * deriv (\<lambda>z. f z * g z) (Base x) = f (Base x) * (Eps1 x * deriv g (Base x)) + Eps1 x * deriv f (Base x) * g (Base x)
 2. Eps2 x * deriv (\<lambda>z. f z * g z) (Base x) = f (Base x) * (Eps2 x * deriv g (Base x)) + Eps2 x * deriv f (Base x) * g (Base x)
 3. Eps12 x * deriv (\<lambda>z. f z * g z) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>z. f z * g z)) (Base x) = (2::'a) * (Eps1 x * (Eps2 x * (deriv f (Base x) * deriv g (Base x)))) + f (Base x) * (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x)) + (Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x)) * g (Base x)
[PROOF STEP]
show "Eps1 x * deriv (\<lambda>z. f z * g z) (Base x) =
        f (Base x) * (Eps1 x * deriv g (Base x)) + Eps1 x * deriv f (Base x) * g (Base x)"
   and "Eps2 x * deriv (\<lambda>z. f z * g z) (Base x) =
        f (Base x) * (Eps2 x * deriv g (Base x)) + Eps2 x * deriv f (Base x) * g (Base x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Eps1 x * deriv (\<lambda>z. f z * g z) (Base x) = f (Base x) * (Eps1 x * deriv g (Base x)) + Eps1 x * deriv f (Base x) * g (Base x) &&& Eps2 x * deriv (\<lambda>z. f z * g z) (Base x) = f (Base x) * (Eps2 x * deriv g (Base x)) + Eps2 x * deriv f (Base x) * g (Base x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f twice_field_differentiable_at Base x
g twice_field_differentiable_at Base x

goal (1 subgoal):
 1. Eps1 x * deriv (\<lambda>z. f z * g z) (Base x) = f (Base x) * (Eps1 x * deriv g (Base x)) + Eps1 x * deriv f (Base x) * g (Base x) &&& Eps2 x * deriv (\<lambda>z. f z * g z) (Base x) = f (Base x) * (Eps2 x * deriv g (Base x)) + Eps2 x * deriv f (Base x) * g (Base x)
[PROOF STEP]
by (simp_all add: once_field_differentiable_at distrib_left)
[PROOF STATE]
proof (state)
this:
Eps1 x * deriv (\<lambda>z. f z * g z) (Base x) = f (Base x) * (Eps1 x * deriv g (Base x)) + Eps1 x * deriv f (Base x) * g (Base x)
Eps2 x * deriv (\<lambda>z. f z * g z) (Base x) = f (Base x) * (Eps2 x * deriv g (Base x)) + Eps2 x * deriv f (Base x) * g (Base x)

goal (1 subgoal):
 1. Eps12 x * deriv (\<lambda>z. f z * g z) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>z. f z * g z)) (Base x) = (2::'a) * (Eps1 x * (Eps2 x * (deriv f (Base x) * deriv g (Base x)))) + f (Base x) * (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x)) + (Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x)) * g (Base x)
[PROOF STEP]
have
    "deriv (deriv (\<lambda>z. f z * g z)) (Base x) =
     f (Base x) * deriv (deriv g) (Base x) + 2 * deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + (2::'a) * deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + (2::'a) * deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)
[PROOF STEP]
have "deriv (deriv (\<lambda>z. f z * g z)) (Base x) = deriv (\<lambda>z. f z * deriv g z + deriv f z * g z) (Base x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (deriv (\<lambda>z. f z * g z)) (Base x) = deriv (\<lambda>z. f z * deriv g z + deriv f z * g z) (Base x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f twice_field_differentiable_at Base x
g twice_field_differentiable_at Base x

goal (1 subgoal):
 1. deriv (deriv (\<lambda>z. f z * g z)) (Base x) = deriv (\<lambda>z. f z * deriv g z + deriv f z * g z) (Base x)
[PROOF STEP]
by (simp add: eventually_deriv_mult deriv_cong_ev)
[PROOF STATE]
proof (state)
this:
deriv (deriv (\<lambda>z. f z * g z)) (Base x) = deriv (\<lambda>z. f z * deriv g z + deriv f z * g z) (Base x)

goal (1 subgoal):
 1. deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + (2::'a) * deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
deriv (deriv (\<lambda>z. f z * g z)) (Base x) = deriv (\<lambda>z. f z * deriv g z + deriv f z * g z) (Base x)

goal (1 subgoal):
 1. deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + (2::'a) * deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)
[PROOF STEP]
have "... = (\<lambda>z. f z * deriv (deriv g) z + deriv f z * deriv g z + deriv f z * deriv g z + deriv (deriv f) z * g z) (Base x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>z. f z * deriv g z + deriv f z * g z) (Base x) = f (Base x) * deriv (deriv g) (Base x) + deriv f (Base x) * deriv g (Base x) + deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)
[PROOF STEP]
by (simp add: assms deriv_field_differentiable_at field_differentiable_mult once_field_differentiable_at)
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>z. f z * deriv g z + deriv f z * g z) (Base x) = f (Base x) * deriv (deriv g) (Base x) + deriv f (Base x) * deriv g (Base x) + deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)

goal (1 subgoal):
 1. deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + (2::'a) * deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + deriv f (Base x) * deriv g (Base x) + deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + deriv f (Base x) * deriv g (Base x) + deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)

goal (1 subgoal):
 1. deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + (2::'a) * deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + (2::'a) * deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + (2::'a) * deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)

goal (1 subgoal):
 1. Eps12 x * deriv (\<lambda>z. f z * g z) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>z. f z * g z)) (Base x) = (2::'a) * (Eps1 x * (Eps2 x * (deriv f (Base x) * deriv g (Base x)))) + f (Base x) * (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x)) + (Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x)) * g (Base x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + (2::'a) * deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)
[PROOF STEP]
show
    "Eps12 x * deriv (\<lambda>z. f z * g z) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>z. f z * g z)) (Base x) =
     2 * (Eps1 x * (Eps2 x * (deriv f (Base x) * deriv g (Base x)))) +
     f (Base x) * (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x)) +
     (Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x)) * g (Base x)"
[PROOF STATE]
proof (prove)
using this:
deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + (2::'a) * deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)

goal (1 subgoal):
 1. Eps12 x * deriv (\<lambda>z. f z * g z) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>z. f z * g z)) (Base x) = (2::'a) * (Eps1 x * (Eps2 x * (deriv f (Base x) * deriv g (Base x)))) + f (Base x) * (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x)) + (Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x)) * g (Base x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
deriv (deriv (\<lambda>z. f z * g z)) (Base x) = f (Base x) * deriv (deriv g) (Base x) + (2::'a) * deriv f (Base x) * deriv g (Base x) + deriv (deriv f) (Base x) * g (Base x)
f twice_field_differentiable_at Base x
g twice_field_differentiable_at Base x

goal (1 subgoal):
 1. Eps12 x * deriv (\<lambda>z. f z * g z) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>z. f z * g z)) (Base x) = (2::'a) * (Eps1 x * (Eps2 x * (deriv f (Base x) * deriv g (Base x)))) + f (Base x) * (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x)) + (Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x)) * g (Base x)
[PROOF STEP]
by (simp add: once_field_differentiable_at field_simps)
[PROOF STATE]
proof (state)
this:
Eps12 x * deriv (\<lambda>z. f z * g z) (Base x) + Eps1 x * Eps2 x * deriv (deriv (\<lambda>z. f z * g z)) (Base x) = (2::'a) * (Eps1 x * (Eps2 x * (deriv f (Base x) * deriv g (Base x)))) + f (Base x) * (Eps12 x * deriv g (Base x) + Eps1 x * Eps2 x * deriv (deriv g) (Base x)) + (Eps12 x * deriv f (Base x) + Eps1 x * Eps2 x * deriv (deriv f) (Base x)) * g (Base x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_set_minus: "card (set xs - X) \<le> length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set xs - X) \<le> length xs
[PROOF STEP]
by (meson Diff_subset List.finite_set card_length card_mono order_trans)


[STATEMENT]
lemma weight_join[simp]: "edges g\<^sub>1 \<inter> edges g\<^sub>2 = {}
  \<Longrightarrow> weight w (graph_join g\<^sub>1 g\<^sub>2) = weight w g\<^sub>1 + weight w g\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edges g\<^sub>1 \<inter> edges g\<^sub>2 = {} \<Longrightarrow> weight w (graph_join g\<^sub>1 g\<^sub>2) = weight w g\<^sub>1 + weight w g\<^sub>2
[PROOF STEP]
unfolding weight_alt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edges g\<^sub>1 \<inter> edges g\<^sub>2 = {} \<Longrightarrow> sum w (uedge ` edges (graph_join g\<^sub>1 g\<^sub>2)) = sum w (uedge ` edges g\<^sub>1) + sum w (uedge ` edges g\<^sub>2)
[PROOF STEP]
by (auto simp: sum.union_disjoint image_Un)


[STATEMENT]
lemma single_eq_single_zmset[simp]: "{#a#}\<^sub>z = {#b#}\<^sub>z \<longleftrightarrow> a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({#a#}\<^sub>z = {#b#}\<^sub>z) = (a = b)
[PROOF STEP]
by (auto simp add: zmultiset_eq_iff)


[STATEMENT]
lemma less_three: "(n::nat) < Suc (Suc (Suc 0)) \<longleftrightarrow> n = 0 \<or> n = 1 \<or> n = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n < Suc (Suc (Suc 0))) = (n = 0 \<or> n = 1 \<or> n = 2)
[PROOF STEP]
by auto


[STATEMENT]
lemma fincomp_Suc2:
  "f \<in> {..Suc n} \<rightarrow> M \<Longrightarrow> fincomp f {..Suc n} = (fincomp (%i. f (Suc i)) {..n} \<cdot> f 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> {..Suc n} \<rightarrow> M \<Longrightarrow> fincomp f {..Suc n} = fincomp (\<lambda>i. f (Suc i)) {..n} \<cdot> f 0
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f \<in> {..Suc 0} \<rightarrow> M \<Longrightarrow> fincomp f {..Suc 0} = fincomp (\<lambda>i. f (Suc i)) {..0} \<cdot> f 0
 2. \<And>n. \<lbrakk>f \<in> {..Suc n} \<rightarrow> M \<Longrightarrow> fincomp f {..Suc n} = fincomp (\<lambda>i. f (Suc i)) {..n} \<cdot> f 0; f \<in> {..Suc (Suc n)} \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp f {..Suc (Suc n)} = fincomp (\<lambda>i. f (Suc i)) {..Suc n} \<cdot> f 0
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
f \<in> {..Suc 0} \<rightarrow> M

goal (2 subgoals):
 1. f \<in> {..Suc 0} \<rightarrow> M \<Longrightarrow> fincomp f {..Suc 0} = fincomp (\<lambda>i. f (Suc i)) {..0} \<cdot> f 0
 2. \<And>n. \<lbrakk>f \<in> {..Suc n} \<rightarrow> M \<Longrightarrow> fincomp f {..Suc n} = fincomp (\<lambda>i. f (Suc i)) {..n} \<cdot> f 0; f \<in> {..Suc (Suc n)} \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp f {..Suc (Suc n)} = fincomp (\<lambda>i. f (Suc i)) {..Suc n} \<cdot> f 0
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
f \<in> {..Suc 0} \<rightarrow> M

goal (1 subgoal):
 1. fincomp f {..Suc 0} = fincomp (\<lambda>i. f (Suc i)) {..0} \<cdot> f 0
[PROOF STEP]
by (simp add: Pi_def)
[PROOF STATE]
proof (state)
this:
fincomp f {..Suc 0} = fincomp (\<lambda>i. f (Suc i)) {..0} \<cdot> f 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>f \<in> {..Suc n} \<rightarrow> M \<Longrightarrow> fincomp f {..Suc n} = fincomp (\<lambda>i. f (Suc i)) {..n} \<cdot> f 0; f \<in> {..Suc (Suc n)} \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp f {..Suc (Suc n)} = fincomp (\<lambda>i. f (Suc i)) {..Suc n} \<cdot> f 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>f \<in> {..Suc n} \<rightarrow> M \<Longrightarrow> fincomp f {..Suc n} = fincomp (\<lambda>i. f (Suc i)) {..n} \<cdot> f 0; f \<in> {..Suc (Suc n)} \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp f {..Suc (Suc n)} = fincomp (\<lambda>i. f (Suc i)) {..Suc n} \<cdot> f 0
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
f \<in> {..Suc n_} \<rightarrow> M \<Longrightarrow> fincomp f {..Suc n_} = fincomp (\<lambda>i. f (Suc i)) {..n_} \<cdot> f 0
f \<in> {..Suc (Suc n_)} \<rightarrow> M

goal (1 subgoal):
 1. \<And>n. \<lbrakk>f \<in> {..Suc n} \<rightarrow> M \<Longrightarrow> fincomp f {..Suc n} = fincomp (\<lambda>i. f (Suc i)) {..n} \<cdot> f 0; f \<in> {..Suc (Suc n)} \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp f {..Suc (Suc n)} = fincomp (\<lambda>i. f (Suc i)) {..Suc n} \<cdot> f 0
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
f \<in> {..Suc n_} \<rightarrow> M \<Longrightarrow> fincomp f {..Suc n_} = fincomp (\<lambda>i. f (Suc i)) {..n_} \<cdot> f 0
f \<in> {..Suc (Suc n_)} \<rightarrow> M

goal (1 subgoal):
 1. fincomp f {..Suc (Suc n_)} = fincomp (\<lambda>i. f (Suc i)) {..Suc n_} \<cdot> f 0
[PROOF STEP]
by (simp add: associative Pi_def)
[PROOF STATE]
proof (state)
this:
fincomp f {..Suc (Suc n_)} = fincomp (\<lambda>i. f (Suc i)) {..Suc n_} \<cdot> f 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lim_in_closed_set:
  assumes "closed S" "eventually (\<lambda>x. f(x) \<in> S) F" "F \<noteq> bot" "(f \<longlongrightarrow> l) F"
  shows "l \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l \<in> S
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
assume "l \<notin> S"
[PROOF STATE]
proof (state)
this:
l \<notin> S

goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
with \<open>closed S\<close>
[PROOF STATE]
proof (chain)
picking this:
closed S
l \<notin> S
[PROOF STEP]
have "open (- S)" "l \<in> - S"
[PROOF STATE]
proof (prove)
using this:
closed S
l \<notin> S

goal (1 subgoal):
 1. open (- S) &&& l \<in> - S
[PROOF STEP]
by (simp_all add: open_Compl)
[PROOF STATE]
proof (state)
this:
open (- S)
l \<in> - S

goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
with assms(4)
[PROOF STATE]
proof (chain)
picking this:
(f \<longlongrightarrow> l) F
open (- S)
l \<in> - S
[PROOF STEP]
have "eventually (\<lambda>x. f x \<in> - S) F"
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> l) F
open (- S)
l \<in> - S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<in> - S
[PROOF STEP]
by (rule topological_tendstoD)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. f x \<in> - S

goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
with assms(2)
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. f x \<in> S
\<forall>\<^sub>F x in F. f x \<in> - S
[PROOF STEP]
have "eventually (\<lambda>x. False) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x \<in> S
\<forall>\<^sub>F x in F. f x \<in> - S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. False
[PROOF STEP]
by (rule eventually_elim2) simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. False

goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
with assms(3)
[PROOF STATE]
proof (chain)
picking this:
F \<noteq> bot
\<forall>\<^sub>F x in F. False
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
F \<noteq> bot
\<forall>\<^sub>F x in F. False

goal (1 subgoal):
 1. False
[PROOF STEP]
by (simp add: eventually_False)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma first_edge_hd_tl: "\<lbrakk> v \<leadsto>xs\<leadsto> w; tl xs \<noteq> Nil \<rbrakk> \<Longrightarrow> first_edge_of_walk xs = (v, hd (tl xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v \<leadsto>xs\<leadsto> w; tl xs \<noteq> []\<rbrakk> \<Longrightarrow> first_edge_of_walk xs = (v, hd (tl xs))
[PROOF STEP]
by (induct "xs" rule: first_edge_of_walk.induct) auto


[STATEMENT]
lemma dim_subspace_orthogonal_to_vectors:
  fixes A :: "'a::euclidean_space set"
  assumes "subspace A" "subspace B" "A \<subseteq> B"
    shows "dim {y \<in> B. \<forall>x \<in> A. orthogonal x y} + dim A = dim B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim {y \<in> B. \<forall>x\<in>A. orthogonal x y} + dim A = dim B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim {y \<in> B. \<forall>x\<in>A. orthogonal x y} + dim A = dim B
[PROOF STEP]
have "dim (span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)) = dim (span B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim (span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)) = dim (span B)
[PROOF STEP]
proof (rule arg_cong [where f=dim, OF subset_antisym])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A) \<subseteq> span B
 2. span B \<subseteq> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)
[PROOF STEP]
show "span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A) \<subseteq> span B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A) \<subseteq> span B
[PROOF STEP]
by (simp add: \<open>A \<subseteq> B\<close> Collect_restrict span_mono)
[PROOF STATE]
proof (state)
this:
span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A) \<subseteq> span B

goal (1 subgoal):
 1. span B \<subseteq> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. span B \<subseteq> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)
[PROOF STEP]
have *: "x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)"
         if "x \<in> B" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)
[PROOF STEP]
obtain y z where "x = y + z" "y \<in> span A" and orth: "\<And>w. w \<in> span A \<Longrightarrow> orthogonal z w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y z. \<lbrakk>x = y + z; y \<in> span A; \<And>w. w \<in> span A \<Longrightarrow> orthogonal z w\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using orthogonal_subspace_decomp_exists [of A x] that
[PROOF STATE]
proof (prove)
using this:
(\<And>y z. \<lbrakk>y \<in> span A; \<And>w. w \<in> span A \<Longrightarrow> orthogonal z w; x = y + z\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
\<lbrakk>x = ?y + ?z; ?y \<in> span A; \<And>w. w \<in> span A \<Longrightarrow> orthogonal ?z w\<rbrakk> \<Longrightarrow> thesis

goal (1 subgoal):
 1. (\<And>y z. \<lbrakk>x = y + z; y \<in> span A; \<And>w. w \<in> span A \<Longrightarrow> orthogonal z w\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = y + z
y \<in> span A
?w \<in> span A \<Longrightarrow> orthogonal z ?w

goal (1 subgoal):
 1. x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)
[PROOF STEP]
have "y \<in> span B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> span B
[PROOF STEP]
using \<open>y \<in> span A\<close> assms(3) span_mono
[PROOF STATE]
proof (prove)
using this:
y \<in> span A
A \<subseteq> B
?A \<subseteq> ?B \<Longrightarrow> span ?A \<subseteq> span ?B

goal (1 subgoal):
 1. y \<in> span B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y \<in> span B

goal (1 subgoal):
 1. x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> span B
[PROOF STEP]
have "z \<in> {a \<in> B. \<forall>x. x \<in> A \<longrightarrow> orthogonal x a}"
[PROOF STATE]
proof (prove)
using this:
y \<in> span B

goal (1 subgoal):
 1. z \<in> {a \<in> B. \<forall>x. x \<in> A \<longrightarrow> orthogonal x a}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> span B \<Longrightarrow> z \<in> B \<and> (\<forall>x. x \<in> A \<longrightarrow> orthogonal x z)
[PROOF STEP]
using \<open>x = y + z\<close> assms(1) assms(2) orth orthogonal_commute span_add_eq
          span_eq_iff that
[PROOF STATE]
proof (prove)
using this:
x = y + z
subspace A
subspace B
?w \<in> span A \<Longrightarrow> orthogonal z ?w
orthogonal ?x ?y = orthogonal ?y ?x
?x \<in> span ?S \<Longrightarrow> (?x + ?y \<in> span ?S) = (?y \<in> span ?S)
(span ?s = ?s) = subspace ?s
x \<in> B

goal (1 subgoal):
 1. y \<in> span B \<Longrightarrow> z \<in> B \<and> (\<forall>x. x \<in> A \<longrightarrow> orthogonal x z)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
z \<in> {a \<in> B. \<forall>x. x \<in> A \<longrightarrow> orthogonal x a}

goal (1 subgoal):
 1. x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> {a \<in> B. \<forall>x. x \<in> A \<longrightarrow> orthogonal x a}
[PROOF STEP]
have z: "z \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y}"
[PROOF STATE]
proof (prove)
using this:
z \<in> {a \<in> B. \<forall>x. x \<in> A \<longrightarrow> orthogonal x a}

goal (1 subgoal):
 1. z \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y}
[PROOF STEP]
by (meson span_superset subset_iff)
[PROOF STATE]
proof (state)
this:
z \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y}

goal (1 subgoal):
 1. x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y}

goal (1 subgoal):
 1. x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)
[PROOF STEP]
apply (auto simp: span_Un image_def  \<open>x = y + z\<close> \<open>y \<in> span A\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y} \<Longrightarrow> \<exists>x ya. y + z = x + ya \<and> x \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y} \<and> ya \<in> span A
[PROOF STEP]
using \<open>y \<in> span A\<close> add.commute
[PROOF STATE]
proof (prove)
using this:
y \<in> span A
?a + ?b = ?b + ?a

goal (1 subgoal):
 1. z \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y} \<Longrightarrow> \<exists>x ya. y + z = x + ya \<and> x \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y} \<and> ya \<in> span A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> B \<Longrightarrow> ?x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)

goal (1 subgoal):
 1. span B \<subseteq> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)
[PROOF STEP]
show "span B \<subseteq> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span B \<subseteq> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)
[PROOF STEP]
by (rule span_minimal) (auto intro: * span_minimal)
[PROOF STATE]
proof (state)
this:
span B \<subseteq> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dim (span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)) = dim (span B)

goal (1 subgoal):
 1. dim {y \<in> B. \<forall>x\<in>A. orthogonal x y} + dim A = dim B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim (span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)) = dim (span B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dim (span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)) = dim (span B)

goal (1 subgoal):
 1. dim {y \<in> B. \<forall>x\<in>A. orthogonal x y} + dim A = dim B
[PROOF STEP]
by (metis (no_types, lifting) dim_orthogonal_sum dim_span mem_Collect_eq
        orthogonal_commute orthogonal_def)
[PROOF STATE]
proof (state)
this:
dim {y \<in> B. \<forall>x\<in>A. orthogonal x y} + dim A = dim B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_connected_UNION:
  assumes "\<And>i. i \<in> A \<Longrightarrow> path_connected (S i)"
    and "\<And>i. i \<in> A \<Longrightarrow> z \<in> S i"
  shows "path_connected (\<Union>i\<in>A. S i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connected (\<Union> (S ` A))
[PROOF STEP]
unfolding path_connected_component
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>\<Union> (S ` A). Ball (\<Union> (S ` A)) (path_component (\<Union> (S ` A)) x)
[PROOF STEP]
proof clarify
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa xb xc. \<lbrakk>xa \<in> A; x \<in> S xa; xc \<in> A; xb \<in> S xc\<rbrakk> \<Longrightarrow> path_component (\<Union> (S ` A)) x xb
[PROOF STEP]
fix x i y j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa xb xc. \<lbrakk>xa \<in> A; x \<in> S xa; xc \<in> A; xb \<in> S xc\<rbrakk> \<Longrightarrow> path_component (\<Union> (S ` A)) x xb
[PROOF STEP]
assume *: "i \<in> A" "x \<in> S i" "j \<in> A" "y \<in> S j"
[PROOF STATE]
proof (state)
this:
i \<in> A
x \<in> S i
j \<in> A
y \<in> S j

goal (1 subgoal):
 1. \<And>x xa xb xc. \<lbrakk>xa \<in> A; x \<in> S xa; xc \<in> A; xb \<in> S xc\<rbrakk> \<Longrightarrow> path_component (\<Union> (S ` A)) x xb
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> A
x \<in> S i
j \<in> A
y \<in> S j
[PROOF STEP]
have "path_component (S i) x z" and "path_component (S j) z y"
[PROOF STATE]
proof (prove)
using this:
i \<in> A
x \<in> S i
j \<in> A
y \<in> S j

goal (1 subgoal):
 1. path_component (S i) x z &&& path_component (S j) z y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<in> A
x \<in> S i
j \<in> A
y \<in> S j
?i \<in> A \<Longrightarrow> path_connected (S ?i)
?i \<in> A \<Longrightarrow> z \<in> S ?i

goal (1 subgoal):
 1. path_component (S i) x z &&& path_component (S j) z y
[PROOF STEP]
by (simp_all add: path_connected_component)
[PROOF STATE]
proof (state)
this:
path_component (S i) x z
path_component (S j) z y

goal (1 subgoal):
 1. \<And>x xa xb xc. \<lbrakk>xa \<in> A; x \<in> S xa; xc \<in> A; xb \<in> S xc\<rbrakk> \<Longrightarrow> path_component (\<Union> (S ` A)) x xb
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path_component (S i) x z
path_component (S j) z y
[PROOF STEP]
have "path_component (\<Union>i\<in>A. S i) x z" and "path_component (\<Union>i\<in>A. S i) z y"
[PROOF STATE]
proof (prove)
using this:
path_component (S i) x z
path_component (S j) z y

goal (1 subgoal):
 1. path_component (\<Union> (S ` A)) x z &&& path_component (\<Union> (S ` A)) z y
[PROOF STEP]
using *(1,3)
[PROOF STATE]
proof (prove)
using this:
path_component (S i) x z
path_component (S j) z y
i \<in> A
j \<in> A

goal (1 subgoal):
 1. path_component (\<Union> (S ` A)) x z &&& path_component (\<Union> (S ` A)) z y
[PROOF STEP]
by (auto elim!: path_component_of_subset [rotated])
[PROOF STATE]
proof (state)
this:
path_component (\<Union> (S ` A)) x z
path_component (\<Union> (S ` A)) z y

goal (1 subgoal):
 1. \<And>x xa xb xc. \<lbrakk>xa \<in> A; x \<in> S xa; xc \<in> A; xb \<in> S xc\<rbrakk> \<Longrightarrow> path_component (\<Union> (S ` A)) x xb
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path_component (\<Union> (S ` A)) x z
path_component (\<Union> (S ` A)) z y
[PROOF STEP]
show "path_component (\<Union>i\<in>A. S i) x y"
[PROOF STATE]
proof (prove)
using this:
path_component (\<Union> (S ` A)) x z
path_component (\<Union> (S ` A)) z y

goal (1 subgoal):
 1. path_component (\<Union> (S ` A)) x y
[PROOF STEP]
by (rule path_component_trans)
[PROOF STATE]
proof (state)
this:
path_component (\<Union> (S ` A)) x y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_ex_int_real01:
  shows "(\<exists> (x::real). P x) = (\<exists> (i::int) (u::real). 0\<le> u \<and> u< 1 \<and> P (real_of_int i + u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. P x) = (\<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u))
[PROOF STEP]
proof(auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
assume Px: "P x"
[PROOF STATE]
proof (state)
this:
P x

goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
let ?i = "\<lfloor>x\<rfloor>"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
let ?u = "x - real_of_int ?i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
have "x = real_of_int ?i + ?u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = real_of_int \<lfloor>x\<rfloor> + (x - real_of_int \<lfloor>x\<rfloor>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = real_of_int \<lfloor>x\<rfloor> + (x - real_of_int \<lfloor>x\<rfloor>)

goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
hence "P (real_of_int ?i + ?u)"
[PROOF STATE]
proof (prove)
using this:
x = real_of_int \<lfloor>x\<rfloor> + (x - real_of_int \<lfloor>x\<rfloor>)

goal (1 subgoal):
 1. P (real_of_int \<lfloor>x\<rfloor> + (x - real_of_int \<lfloor>x\<rfloor>))
[PROOF STEP]
using Px
[PROOF STATE]
proof (prove)
using this:
x = real_of_int \<lfloor>x\<rfloor> + (x - real_of_int \<lfloor>x\<rfloor>)
P x

goal (1 subgoal):
 1. P (real_of_int \<lfloor>x\<rfloor> + (x - real_of_int \<lfloor>x\<rfloor>))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P (real_of_int \<lfloor>x\<rfloor> + (x - real_of_int \<lfloor>x\<rfloor>))

goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
P (real_of_int \<lfloor>x\<rfloor> + (x - real_of_int \<lfloor>x\<rfloor>))

goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
have "real_of_int ?i \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<lfloor>x\<rfloor> \<le> x
[PROOF STEP]
using of_int_floor_le
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>?x\<rfloor> \<le> ?x

goal (1 subgoal):
 1. real_of_int \<lfloor>x\<rfloor> \<le> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int \<lfloor>x\<rfloor> \<le> x

goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
hence "0 \<le> ?u"
[PROOF STATE]
proof (prove)
using this:
real_of_int \<lfloor>x\<rfloor> \<le> x

goal (1 subgoal):
 1. 0 \<le> x - real_of_int \<lfloor>x\<rfloor>
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
0 \<le> x - real_of_int \<lfloor>x\<rfloor>

goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 \<le> x - real_of_int \<lfloor>x\<rfloor>

goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
have "?u < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - real_of_int \<lfloor>x\<rfloor> < 1
[PROOF STEP]
using real_of_int_floor_add_one_gt[where r="x"]
[PROOF STATE]
proof (prove)
using this:
x < real_of_int \<lfloor>x\<rfloor> + 1

goal (1 subgoal):
 1. x - real_of_int \<lfloor>x\<rfloor> < 1
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
x - real_of_int \<lfloor>x\<rfloor> < 1

goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
P (real_of_int \<lfloor>x\<rfloor> + (x - real_of_int \<lfloor>x\<rfloor>))
0 \<le> x - real_of_int \<lfloor>x\<rfloor>
x - real_of_int \<lfloor>x\<rfloor> < 1
[PROOF STEP]
show "(\<exists> (i::int) (u::real). 0\<le> u \<and> u< 1 \<and> P (real_of_int i + u))"
[PROOF STATE]
proof (prove)
using this:
P (real_of_int \<lfloor>x\<rfloor> + (x - real_of_int \<lfloor>x\<rfloor>))
0 \<le> x - real_of_int \<lfloor>x\<rfloor>
x - real_of_int \<lfloor>x\<rfloor> < 1

goal (1 subgoal):
 1. \<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>i u. 0 \<le> u \<and> u < 1 \<and> P (real_of_int i + u)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma normal_quotient_add_well_defined:
  assumes "Subgroup H" "normal H" "g\<in>G" "g'\<in>G"
  shows   "LCoset_rel H `` {g} + LCoset_rel H `` {g'} = LCoset_rel H `` {g+g'}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LCoset_rel H `` {g} + LCoset_rel H `` {g'} = LCoset_rel H `` {g + g'}
[PROOF STEP]
proof (rule seteqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g + g'}
 2. \<And>x. x \<in> LCoset_rel H `` {g + g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g + g'}
 2. \<And>x. x \<in> LCoset_rel H `` {g + g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
assume "x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}"
[PROOF STATE]
proof (state)
this:
x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}

goal (2 subgoals):
 1. \<And>x. x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g + g'}
 2. \<And>x. x \<in> LCoset_rel H `` {g + g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
obtain y z
    where     "y \<in> LCoset_rel H `` {g}" "z \<in> LCoset_rel H `` {g'}" "x = y+z"
[PROOF STATE]
proof (prove)
using this:
x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}

goal (1 subgoal):
 1. (\<And>y z. \<lbrakk>y \<in> LCoset_rel H `` {g}; z \<in> LCoset_rel H `` {g'}; x = y + z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding set_plus_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {c. \<exists>a\<in>LCoset_rel H `` {g}. \<exists>b\<in>LCoset_rel H `` {g'}. c = a + b}

goal (1 subgoal):
 1. (\<And>y z. \<lbrakk>y \<in> LCoset_rel H `` {g}; z \<in> LCoset_rel H `` {g'}; x = y + z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by        fast
[PROOF STATE]
proof (state)
this:
y \<in> LCoset_rel H `` {g}
z \<in> LCoset_rel H `` {g'}
x = y + z

goal (2 subgoals):
 1. \<And>x. x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g + g'}
 2. \<And>x. x \<in> LCoset_rel H `` {g + g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
Subgroup H
normal H
g \<in> G
g' \<in> G
y \<in> LCoset_rel H `` {g}
z \<in> LCoset_rel H `` {g'}
x = y + z
[PROOF STEP]
show "x \<in> LCoset_rel H `` {g + g'}"
[PROOF STATE]
proof (prove)
using this:
Subgroup H
normal H
g \<in> G
g' \<in> G
y \<in> LCoset_rel H `` {g}
z \<in> LCoset_rel H `` {g'}
x = y + z

goal (1 subgoal):
 1. x \<in> LCoset_rel H `` {g + g'}
[PROOF STEP]
using lcoset_rel_def[of H] normal_lconjby_closed[of H g' "-g'+z"]
          Group.add_closed
          normal_rconjby_closed[of H g' "-g + y + (z - g')"]
          add.assoc[of "-g'" "-g"]
          add_closed lcoset_relI[of "g+g'" "y+z"]
[PROOF STATE]
proof (prove)
using this:
Subgroup H
normal H
g \<in> G
g' \<in> G
y \<in> LCoset_rel H `` {g}
z \<in> LCoset_rel H `` {g'}
x = y + z
lcoset_rel H \<equiv> {(x, y). - x + y \<in> H}
\<lbrakk>Subgroup H; normal H; g' \<in> G; - g' + z \<in> H\<rbrakk> \<Longrightarrow> lconjby g' (- g' + z) \<in> H
\<lbrakk>Group ?G; ?g \<in> ?G; ?h \<in> ?G\<rbrakk> \<Longrightarrow> ?g + ?h \<in> ?G
\<lbrakk>Subgroup H; normal H; g' \<in> G; - g + y + (z - g') \<in> H\<rbrakk> \<Longrightarrow> rconjby g' (- g + y + (z - g')) \<in> H
- g' + - g + ?c = - g' + (- g + ?c)
\<lbrakk>?g \<in> G; ?h \<in> G\<rbrakk> \<Longrightarrow> ?g + ?h \<in> G
- (g + g') + (y + z) \<in> ?A \<Longrightarrow> (g + g', y + z) \<in> lcoset_rel ?A

goal (1 subgoal):
 1. x \<in> LCoset_rel H `` {g + g'}
[PROOF STEP]
by    (fastforce simp add: add.assoc minus_add)
[PROOF STATE]
proof (state)
this:
x \<in> LCoset_rel H `` {g + g'}

goal (1 subgoal):
 1. \<And>x. x \<in> LCoset_rel H `` {g + g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> LCoset_rel H `` {g + g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> LCoset_rel H `` {g + g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
assume "x \<in> LCoset_rel H `` {g + g'}"
[PROOF STATE]
proof (state)
this:
x \<in> LCoset_rel H `` {g + g'}

goal (1 subgoal):
 1. \<And>x. x \<in> LCoset_rel H `` {g + g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> LCoset_rel H `` {g + g'}

goal (1 subgoal):
 1. \<And>x. x \<in> LCoset_rel H `` {g + g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
define h where "h \<equiv> -(g+g') + x"
[PROOF STATE]
proof (state)
this:
h \<equiv> - (g + g') + x

goal (1 subgoal):
 1. \<And>x. x \<in> LCoset_rel H `` {g + g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
h \<equiv> - (g + g') + x

goal (1 subgoal):
 1. \<And>x. x \<in> LCoset_rel H `` {g + g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
hence "x = g + (g' + h)"
[PROOF STATE]
proof (prove)
using this:
h \<equiv> - (g + g') + x

goal (1 subgoal):
 1. x = g + (g' + h)
[PROOF STEP]
using add.assoc[of "-g'" "-g" x]
[PROOF STATE]
proof (prove)
using this:
h \<equiv> - (g + g') + x
- g' + - g + x = - g' + (- g + x)

goal (1 subgoal):
 1. x = g + (g' + h)
[PROOF STEP]
by (simp add: add.assoc minus_add)
[PROOF STATE]
proof (state)
this:
x = g + (g' + h)

goal (1 subgoal):
 1. \<And>x. x \<in> LCoset_rel H `` {g + g'} \<Longrightarrow> x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> LCoset_rel H `` {g + g'}
h \<equiv> - (g + g') + x
x = g + (g' + h)
[PROOF STEP]
show "x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}"
[PROOF STATE]
proof (prove)
using this:
x \<in> LCoset_rel H `` {g + g'}
h \<equiv> - (g + g') + x
x = g + (g' + h)

goal (1 subgoal):
 1. x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
using assms(1,3,4) lcoset_rel_def[of H] add_closed
          refl_onD[OF subgroup_refl_on_LCoset_rel, of H]
[PROOF STATE]
proof (prove)
using this:
x \<in> LCoset_rel H `` {g + g'}
h \<equiv> - (g + g') + x
x = g + (g' + h)
Subgroup H
g \<in> G
g' \<in> G
lcoset_rel H \<equiv> {(x, y). - x + y \<in> H}
\<lbrakk>?g \<in> G; ?h \<in> G\<rbrakk> \<Longrightarrow> ?g + ?h \<in> G
\<lbrakk>Subgroup H; ?a \<in> G\<rbrakk> \<Longrightarrow> (?a, ?a) \<in> LCoset_rel H

goal (1 subgoal):
 1. x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}
[PROOF STEP]
by    force
[PROOF STATE]
proof (state)
this:
x \<in> LCoset_rel H `` {g} + LCoset_rel H `` {g'}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gcd_degree_le_min:
  assumes "p\<noteq>0" "q\<noteq>0"
  shows "degree (gcd p q) \<le> min (degree p) (degree q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (gcd p q) \<le> min (degree p) (degree q)
[PROOF STEP]
by (simp add: assms(1) assms(2) dvd_imp_degree_le)


[STATEMENT]
lemma in_closure_connected_component:
  fixes S :: "'a::real_normed_vector set"
  assumes x: "x \<in> S" and S: "open S"
  shows "x \<in> closure (connected_component_set S y) \<longleftrightarrow>  x \<in> connected_component_set S y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> closure (connected_component_set S y)) = (x \<in> connected_component_set S y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x \<in> closure (connected_component_set S y)) = (x \<in> connected_component_set S y)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x \<in> closure (connected_component_set S y)) = (x \<in> connected_component_set S y)
[PROOF STEP]
assume "x \<in> closure (connected_component_set S y)"
[PROOF STATE]
proof (state)
this:
x \<in> closure (connected_component_set S y)

goal (1 subgoal):
 1. (x \<in> closure (connected_component_set S y)) = (x \<in> connected_component_set S y)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> closure (connected_component_set S y)

goal (1 subgoal):
 1. (x \<in> closure (connected_component_set S y)) = (x \<in> connected_component_set S y)
[PROOF STEP]
have "x \<in> connected_component_set S x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> connected_component_set S x
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
x \<in> S

goal (1 subgoal):
 1. x \<in> connected_component_set S x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> connected_component_set S x

goal (1 subgoal):
 1. (x \<in> closure (connected_component_set S y)) = (x \<in> connected_component_set S y)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> closure (connected_component_set S y)
x \<in> connected_component_set S x
[PROOF STEP]
have "x \<in> connected_component_set S y"
[PROOF STATE]
proof (prove)
using this:
x \<in> closure (connected_component_set S y)
x \<in> connected_component_set S x

goal (1 subgoal):
 1. x \<in> connected_component_set S y
[PROOF STEP]
using S
[PROOF STATE]
proof (prove)
using this:
x \<in> closure (connected_component_set S y)
x \<in> connected_component_set S x
open S

goal (1 subgoal):
 1. x \<in> connected_component_set S y
[PROOF STEP]
by (meson Compl_disjoint closure_iff_nhds_not_empty connected_component_disjoint disjoint_eq_subset_Compl open_connected_component)
[PROOF STATE]
proof (state)
this:
x \<in> connected_component_set S y

goal (1 subgoal):
 1. (x \<in> closure (connected_component_set S y)) = (x \<in> connected_component_set S y)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
x \<in> closure (connected_component_set S y) \<Longrightarrow> x \<in> connected_component_set S y

goal (1 subgoal):
 1. (x \<in> closure (connected_component_set S y)) = (x \<in> connected_component_set S y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> closure (connected_component_set S y) \<Longrightarrow> x \<in> connected_component_set S y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> closure (connected_component_set S y) \<Longrightarrow> x \<in> connected_component_set S y

goal (1 subgoal):
 1. (x \<in> closure (connected_component_set S y)) = (x \<in> connected_component_set S y)
[PROOF STEP]
by (auto simp: closure_def)
[PROOF STATE]
proof (state)
this:
(x \<in> closure (connected_component_set S y)) = (x \<in> connected_component_set S y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rational_root_test:
  "rational_root_test p = Some x \<Longrightarrow> poly p x = 0"
  "rational_root_test p = None \<Longrightarrow> \<not> (\<exists> x. poly p x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rational_root_test p = Some x \<Longrightarrow> poly p x = 0) &&& (rational_root_test p = None \<Longrightarrow> \<nexists>x. poly p x = 0)
[PROOF STEP]
using rational_root_test_main(1) rational_root_test_main(2)[OF divisors_fun_int divisors_pos_fun_int]
[PROOF STATE]
proof (prove)
using this:
rational_root_test_main ?df ?dp ?p = Some ?x \<Longrightarrow> poly ?p ?x = 0
rational_root_test_main divisors_int divisors_int_pos ?p = None \<Longrightarrow> \<nexists>x. poly ?p x = 0

goal (1 subgoal):
 1. (rational_root_test p = Some x \<Longrightarrow> poly p x = 0) &&& (rational_root_test p = None \<Longrightarrow> \<nexists>x. poly p x = 0)
[PROOF STEP]
unfolding rational_root_test_def
[PROOF STATE]
proof (prove)
using this:
rational_root_test_main ?df ?dp ?p = Some ?x \<Longrightarrow> poly ?p ?x = 0
rational_root_test_main divisors_int divisors_int_pos ?p = None \<Longrightarrow> \<nexists>x. poly ?p x = 0

goal (1 subgoal):
 1. (rational_root_test_main divisors_int divisors_int_pos p = Some x \<Longrightarrow> poly p x = 0) &&& (rational_root_test_main divisors_int divisors_int_pos p = None \<Longrightarrow> \<nexists>x. poly p x = 0)
[PROOF STEP]
by blast+


[STATEMENT]
lemma abs_round_down_le: "\<bar>f - (round_down e f)\<bar> \<le> 2 powr -e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f - round_down e f\<bar> \<le> 2 powr - real_of_int e
[PROOF STEP]
using round_down_correct[of f e]
[PROOF STATE]
proof (prove)
using this:
f - round_down e f \<in> {0..2 powr - real_of_int e}

goal (1 subgoal):
 1. \<bar>f - round_down e f\<bar> \<le> 2 powr - real_of_int e
[PROOF STEP]
by simp


[STATEMENT]
lemma ninv_r_inv:"\<lbrakk>f \<in> {i. i \<le> (n::nat)} \<rightarrow> {i. i \<le> n}; inj_on f {i. i \<le> n};
      b \<le> n\<rbrakk>  \<Longrightarrow>  f (ninv n f b) = b "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; inj_on f {i. i \<le> n}; b \<le> n\<rbrakk> \<Longrightarrow> f (ninv n f b) = b
[PROOF STEP]
apply (simp add:ninv_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; inj_on f {i. i \<le> n}; b \<le> n\<rbrakk> \<Longrightarrow> f (SOME x. x \<le> n \<and> b = f x) = b
[PROOF STEP]
apply (frule inj_surj, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; inj_on f {i. i \<le> n}; b \<le> n; f ` {i. i \<le> n} = {i. i \<le> n}\<rbrakk> \<Longrightarrow> f (SOME x. x \<le> n \<and> b = f x) = b
[PROOF STEP]
apply (cut_tac a = b in eq_set_inc[of _ "{i. i \<le> n}" "f ` {i. i \<le> n}"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>f \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; inj_on f {i. i \<le> n}; b \<le> n; f ` {i. i \<le> n} = {i. i \<le> n}\<rbrakk> \<Longrightarrow> b \<in> {i. i \<le> n}
 2. \<lbrakk>f \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; inj_on f {i. i \<le> n}; b \<le> n; f ` {i. i \<le> n} = {i. i \<le> n}\<rbrakk> \<Longrightarrow> {i. i \<le> n} = f ` {i. i \<le> n}
 3. \<lbrakk>f \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; inj_on f {i. i \<le> n}; b \<le> n; f ` {i. i \<le> n} = {i. i \<le> n}; b \<in> f ` {i. i \<le> n}\<rbrakk> \<Longrightarrow> f (SOME x. x \<le> n \<and> b = f x) = b
[PROOF STEP]
apply (simp, rule sym, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; inj_on f {i. i \<le> n}; b \<le> n; f ` {i. i \<le> n} = {i. i \<le> n}; b \<in> f ` {i. i \<le> n}\<rbrakk> \<Longrightarrow> f (SOME x. x \<le> n \<and> b = f x) = b
[PROOF STEP]
apply (thin_tac "f ` {i. i \<le> n} = {i. i \<le> n}", simp add:image_def,
         erule exE, erule conjE, frule sym, thin_tac "b = f x")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>f \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; inj_on f {i. i \<le> n}; b \<le> n; x \<le> n; f x = b\<rbrakk> \<Longrightarrow> f (SOME x. x \<le> n \<and> b = f x) = b
[PROOF STEP]
apply (rule someI2_ex, blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>f \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; inj_on f {i. i \<le> n}; b \<le> n; x \<le> n; f x = b; xa \<le> n \<and> b = f xa\<rbrakk> \<Longrightarrow> f xa = b
[PROOF STEP]
apply (erule conjE, rule sym, assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma replace_coeff_monom:
assumes "f 0 = 0"
shows "replace_coeff f (monom m a) = monom m (f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. replace_coeff f (monom m a) = monom m (f a)
[PROOF STEP]
unfolding replace_coeff_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly (Abs_poly_mapping (\<lambda>ma. f (lookup (mapping_of (monom m a)) ma))) = monom m (f a)
[PROOF STEP]
unfolding  mapping_of_inject[symmetric] lookup_inject[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (mapping_of (MPoly (Abs_poly_mapping (\<lambda>ma. f (lookup (mapping_of (monom m a)) ma))))) = lookup (mapping_of (monom m (f a)))
[PROOF STEP]
apply (rule HOL.ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. lookup (mapping_of (MPoly (Abs_poly_mapping (\<lambda>ma. f (lookup (mapping_of (monom m a)) ma))))) x = lookup (mapping_of (monom m (f a))) x
[PROOF STEP]
unfolding lookup_single  mapping_of_monom fun_when[of f, OF \<open>f 0 = 0\<close>]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. lookup (mapping_of (MPoly (Abs_poly_mapping (\<lambda>ma. f a when m = ma)))) x = (f a when m = x)
[PROOF STEP]
by (metis coeff_def coeff_monom lookup_single lookup_single_not_eq monom.abs_eq single.abs_eq)


[STATEMENT]
lemma preserve_rtranclp':
  "(\<And>x y. R x y \<Longrightarrow> S (f x) (f y)) \<Longrightarrow>
   (\<And>y. S (f y) (g y)) \<Longrightarrow>
   R\<^sup>*\<^sup>* x y \<Longrightarrow> S\<^sup>*\<^sup>* (f x) (g y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. R x y \<Longrightarrow> S (f x) (f y); \<And>y. S (f y) (g y); R\<^sup>*\<^sup>* x y\<rbrakk> \<Longrightarrow> S\<^sup>*\<^sup>* (f x) (g y)
[PROOF STEP]
by (metis preserve_rtranclp rtranclp.rtrancl_into_rtrancl)


[STATEMENT]
lemma  rotation_exists_1:
  fixes a :: "real^'n"
  assumes "2 \<le> CARD('n)" "norm a = 1" "norm b = 1"
  obtains f where "orthogonal_transformation f" "det(matrix f) = 1" "f a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>orthogonal_transformation f; det (matrix f) = 1; f a = b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>orthogonal_transformation f; det (matrix f) = 1; f a = b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain k::'n where True
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (True \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
True

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>orthogonal_transformation f; det (matrix f) = 1; f a = b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain A B where AB: "rotation_matrix A" "rotation_matrix B"
               and eq: "A *v (axis k 1) = a" "B *v (axis k 1) = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>rotation_matrix A; rotation_matrix B; A *v axis k 1 = a; B *v axis k 1 = b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using rotation_matrix_exists_basis assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>2 \<le> CARD(?'n); norm ?a = 1; \<And>A. \<lbrakk>rotation_matrix A; A *v axis ?k 1 = ?a\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
2 \<le> CARD('n)
norm a = 1
norm b = 1

goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>rotation_matrix A; rotation_matrix B; A *v axis k 1 = a; B *v axis k 1 = b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
rotation_matrix A
rotation_matrix B
A *v axis k 1 = a
B *v axis k 1 = b

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>orthogonal_transformation f; det (matrix f) = 1; f a = b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
let ?f = "\<lambda>x. (B ** transpose A) *v x"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>orthogonal_transformation f; det (matrix f) = 1; f a = b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. orthogonal_transformation ?f
 2. det (matrix ?f) = 1
 3. ?f a = b
[PROOF STEP]
show "orthogonal_transformation ?f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_transformation ((*v) (B ** Finite_Cartesian_Product.transpose A))
[PROOF STEP]
using AB orthogonal_matrix_mul orthogonal_transformation_matrix rotation_matrix_def matrix_vector_mul_linear
[PROOF STATE]
proof (prove)
using this:
rotation_matrix A
rotation_matrix B
\<lbrakk>orthogonal_matrix ?A; orthogonal_matrix ?B\<rbrakk> \<Longrightarrow> orthogonal_matrix (?A ** ?B)
orthogonal_transformation ?f = (linear ?f \<and> orthogonal_matrix (matrix ?f))
rotation_matrix ?Q = (orthogonal_matrix ?Q \<and> det ?Q = (1::?'a))
linear ((*v) ?A)

goal (1 subgoal):
 1. orthogonal_transformation ((*v) (B ** Finite_Cartesian_Product.transpose A))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
orthogonal_transformation ((*v) (B ** Finite_Cartesian_Product.transpose A))

goal (2 subgoals):
 1. det (matrix ((*v) (B ** Finite_Cartesian_Product.transpose A))) = 1
 2. B ** Finite_Cartesian_Product.transpose A *v a = b
[PROOF STEP]
show "det (matrix ?f) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (matrix ((*v) (B ** Finite_Cartesian_Product.transpose A))) = 1
[PROOF STEP]
using AB
[PROOF STATE]
proof (prove)
using this:
rotation_matrix A
rotation_matrix B

goal (1 subgoal):
 1. det (matrix ((*v) (B ** Finite_Cartesian_Product.transpose A))) = 1
[PROOF STEP]
by (auto simp: det_mul rotation_matrix_def)
[PROOF STATE]
proof (state)
this:
det (matrix ((*v) (B ** Finite_Cartesian_Product.transpose A))) = 1

goal (1 subgoal):
 1. B ** Finite_Cartesian_Product.transpose A *v a = b
[PROOF STEP]
show "?f a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B ** Finite_Cartesian_Product.transpose A *v a = b
[PROOF STEP]
using AB
[PROOF STATE]
proof (prove)
using this:
rotation_matrix A
rotation_matrix B

goal (1 subgoal):
 1. B ** Finite_Cartesian_Product.transpose A *v a = b
[PROOF STEP]
unfolding orthogonal_matrix_def rotation_matrix_def
[PROOF STATE]
proof (prove)
using this:
(Finite_Cartesian_Product.transpose A ** A = mat 1 \<and> A ** Finite_Cartesian_Product.transpose A = mat 1) \<and> det A = 1
(Finite_Cartesian_Product.transpose B ** B = mat 1 \<and> B ** Finite_Cartesian_Product.transpose B = mat 1) \<and> det B = 1

goal (1 subgoal):
 1. B ** Finite_Cartesian_Product.transpose A *v a = b
[PROOF STEP]
by (metis eq matrix_mul_rid matrix_vector_mul_assoc)
[PROOF STATE]
proof (state)
this:
B ** Finite_Cartesian_Product.transpose A *v a = b

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_interval_minus: "real_interval (a - b) = real_interval a - real_interval b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_interval (a - b) = real_interval a - real_interval b
[PROOF STEP]
using real_interval_plus[of a "-b"] real_interval_uminus[of b]
[PROOF STATE]
proof (prove)
using this:
real_interval (a + - b) = real_interval a + real_interval (- b)
real_interval (- b) = - real_interval b

goal (1 subgoal):
 1. real_interval (a - b) = real_interval a - real_interval b
[PROOF STEP]
by (auto simp: interval_eq_iff)


[STATEMENT]
lemma poly_deg_map_indets:
  assumes "inj_on f (indets p)"
  shows "poly_deg (map_indets f p) = poly_deg p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_deg (map_indets f p) = poly_deg p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_deg (map_indets f p) = poly_deg p
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
inj_on f (indets p)
[PROOF STEP]
have "deg_pm ` keys (map_indets f p) = deg_pm ` keys p"
[PROOF STATE]
proof (prove)
using this:
inj_on f (indets p)

goal (1 subgoal):
 1. deg_pm ` keys (map_indets f p) = deg_pm ` keys p
[PROOF STEP]
by (simp add: keys_map_indets image_image deg_pm_sum deg_pm_single
          flip: deg_pm_superset[OF subset_refl])
[PROOF STATE]
proof (state)
this:
deg_pm ` keys (map_indets f p) = deg_pm ` keys p

goal (1 subgoal):
 1. poly_deg (map_indets f p) = poly_deg p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
deg_pm ` keys (map_indets f p) = deg_pm ` keys p

goal (1 subgoal):
 1. poly_deg (map_indets f p) = poly_deg p
[PROOF STEP]
by (auto simp: poly_deg_def)
[PROOF STATE]
proof (state)
this:
poly_deg (map_indets f p) = poly_deg p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_root_abs: "0 < n \<Longrightarrow> root n \<bar>x\<bar> = \<bar>root n x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> root n \<bar>x\<bar> = \<bar>root n x\<bar>
[PROOF STEP]
by (simp add: abs_if real_root_minus)


[STATEMENT]
theorem translation_composition_eq [simp]:
  assumes [simp]: "a \<in> M" "b \<in> M"
  shows "compose M (a)\<^sub>L (b)\<^sub>L = (a \<cdot> b)\<^sub>L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compose M (a)\<^sub>L (b)\<^sub>L = (a \<cdot> b)\<^sub>L
[PROOF STEP]
unfolding translation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compose M ((\<lambda>a\<in>M. restrict ((\<cdot>) a) M) a) ((\<lambda>a\<in>M. restrict ((\<cdot>) a) M) b) = (\<lambda>a\<in>M. restrict ((\<cdot>) a) M) (a \<cdot> b)
[PROOF STEP]
by rule (simp add: associative compose_def)


[STATEMENT]
lemma set_quicksort [simp]: "set (quicksort xs) = set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (quicksort xs) = set xs
[PROOF STEP]
by(simp add: quicksort_def)


[STATEMENT]
lemma semilat_Def:
"semilat(A,r,f) \<longleftrightarrow> order r \<and> closed A f \<and>
                 (\<forall>x\<in>A. \<forall>y\<in>A. x \<sqsubseteq>\<^sub>r x \<squnion>\<^sub>f y) \<and>
                 (\<forall>x\<in>A. \<forall>y\<in>A. y \<sqsubseteq>\<^sub>r x \<squnion>\<^sub>f y) \<and>
                 (\<forall>x\<in>A. \<forall>y\<in>A. \<forall>z\<in>A. x \<sqsubseteq>\<^sub>r z \<and> y \<sqsubseteq>\<^sub>r z \<longrightarrow> x \<squnion>\<^sub>f y \<sqsubseteq>\<^sub>r z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. semilat (A, r, f) = (order r \<and> closed A f \<and> (\<forall>x\<in>A. \<forall>y\<in>A. x \<sqsubseteq>\<^bsub>r\<^esub> x \<squnion>\<^bsub>f\<^esub> y) \<and> (\<forall>x\<in>A. \<forall>y\<in>A. y \<sqsubseteq>\<^bsub>r\<^esub> x \<squnion>\<^bsub>f\<^esub> y) \<and> (\<forall>x\<in>A. \<forall>y\<in>A. \<forall>z\<in>A. x \<sqsubseteq>\<^bsub>r\<^esub> z \<and> y \<sqsubseteq>\<^bsub>r\<^esub> z \<longrightarrow> x \<squnion>\<^bsub>f\<^esub> y \<sqsubseteq>\<^bsub>r\<^esub> z))
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. semilat (A, r, f) = (order r \<and> closed A f \<and> (\<forall>x\<in>A. \<forall>y\<in>A. x \<sqsubseteq>\<^bsub>r\<^esub> x \<squnion>\<^bsub>f\<^esub> y) \<and> (\<forall>x\<in>A. \<forall>y\<in>A. y \<sqsubseteq>\<^bsub>r\<^esub> x \<squnion>\<^bsub>f\<^esub> y) \<and> (\<forall>x\<in>A. \<forall>y\<in>A. \<forall>z\<in>A. x \<sqsubseteq>\<^bsub>r\<^esub> z \<and> y \<sqsubseteq>\<^bsub>r\<^esub> z \<longrightarrow> x \<squnion>\<^bsub>f\<^esub> y \<sqsubseteq>\<^bsub>r\<^esub> z))
[PROOF STEP]
by (unfold semilat_def) clarsimp


[STATEMENT]
lemma  (in Module) mHom_l_inv:"\<lbrakk>R module N; f \<in> mHom R M N\<rbrakk>
       \<Longrightarrow> tOp_mHom R M N (iOp_mHom R M N f) f = mzeromap M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N\<rbrakk> \<Longrightarrow> tOp_mHom R M N (iOp_mHom R M N f) f = mzeromap M N
[PROOF STEP]
apply (frule mHom_ex_zero [of N])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N; mzeromap M N \<in> mHom R M N\<rbrakk> \<Longrightarrow> tOp_mHom R M N (iOp_mHom R M N f) f = mzeromap M N
[PROOF STEP]
apply (frule_tac f = f in iOp_mHom_closed [of N], assumption,
       frule_tac f = "iOp_mHom R M N f" and g = f in tOp_mHom_closed [of N],
        assumption+,
       frule mHom_ex_zero [of N])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N; mzeromap M N \<in> mHom R M N; iOp_mHom R M N f \<in> mHom R M N; tOp_mHom R M N (iOp_mHom R M N f) f \<in> mHom R M N; mzeromap M N \<in> mHom R M N\<rbrakk> \<Longrightarrow> tOp_mHom R M N (iOp_mHom R M N f) f = mzeromap M N
[PROOF STEP]
apply (rule mHom_eq, assumption+, rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>R module N; f \<in> mHom R M N; mzeromap M N \<in> mHom R M N; iOp_mHom R M N f \<in> mHom R M N; tOp_mHom R M N (iOp_mHom R M N f) f \<in> mHom R M N; mzeromap M N \<in> mHom R M N; m \<in> carrier M\<rbrakk> \<Longrightarrow> tOp_mHom R M N (iOp_mHom R M N f) f m = mzeromap M N m
[PROOF STEP]
apply (simp add:tOp_mHom_def iOp_mHom_def, simp add:mzeromap_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>R module N; f \<in> mHom R M N; (\<lambda>x\<in>carrier M. -\<^sub>a\<^bsub>N\<^esub> f x) \<in> mHom R M N; (\<lambda>x\<in>carrier M. (if x \<in> carrier M then -\<^sub>a\<^bsub>N\<^esub> f x else undefined) \<plusminus>\<^bsub>N\<^esub> f x) \<in> mHom R M N; (\<lambda>x\<in>carrier M. \<zero>\<^bsub>N\<^esub>) \<in> mHom R M N; m \<in> carrier M\<rbrakk> \<Longrightarrow> -\<^sub>a\<^bsub>N\<^esub> f m \<plusminus>\<^bsub>N\<^esub> f m = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (frule_tac f = f and m = m in mHom_mem [of N], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>R module N; f \<in> mHom R M N; (\<lambda>x\<in>carrier M. -\<^sub>a\<^bsub>N\<^esub> f x) \<in> mHom R M N; (\<lambda>x\<in>carrier M. (if x \<in> carrier M then -\<^sub>a\<^bsub>N\<^esub> f x else undefined) \<plusminus>\<^bsub>N\<^esub> f x) \<in> mHom R M N; (\<lambda>x\<in>carrier M. \<zero>\<^bsub>N\<^esub>) \<in> mHom R M N; m \<in> carrier M; f m \<in> carrier N\<rbrakk> \<Longrightarrow> -\<^sub>a\<^bsub>N\<^esub> f m \<plusminus>\<^bsub>N\<^esub> f m = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (frule Module.module_is_ag [of N])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>R module N; f \<in> mHom R M N; (\<lambda>x\<in>carrier M. -\<^sub>a\<^bsub>N\<^esub> f x) \<in> mHom R M N; (\<lambda>x\<in>carrier M. (if x \<in> carrier M then -\<^sub>a\<^bsub>N\<^esub> f x else undefined) \<plusminus>\<^bsub>N\<^esub> f x) \<in> mHom R M N; (\<lambda>x\<in>carrier M. \<zero>\<^bsub>N\<^esub>) \<in> mHom R M N; m \<in> carrier M; f m \<in> carrier N; aGroup N\<rbrakk> \<Longrightarrow> -\<^sub>a\<^bsub>N\<^esub> f m \<plusminus>\<^bsub>N\<^esub> f m = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (simp add:aGroup.ag_l_inv1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma resultant_iff_coprime_main:
  fixes f g :: "'a :: field poly"
  assumes deg: "degree f > 0 \<or> degree g > 0"
shows "resultant f g = 0 \<longleftrightarrow> \<not> coprime f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)
[PROOF STEP]
proof (cases "resultant f g = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. resultant f g = (0::'a) \<Longrightarrow> (resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)
 2. resultant f g \<noteq> (0::'a) \<Longrightarrow> (resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
resultant f g = (0::'a)

goal (2 subgoals):
 1. resultant f g = (0::'a) \<Longrightarrow> (resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)
 2. resultant f g \<noteq> (0::'a) \<Longrightarrow> (resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)
[PROOF STEP]
from resultant_zero_imp_common_factor[OF deg True] True
[PROOF STATE]
proof (chain)
picking this:
\<not> comm_monoid_mult_class.coprime f g
resultant f g = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> comm_monoid_mult_class.coprime f g
resultant f g = (0::'a)

goal (1 subgoal):
 1. (resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)

goal (1 subgoal):
 1. resultant f g \<noteq> (0::'a) \<Longrightarrow> (resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. resultant f g \<noteq> (0::'a) \<Longrightarrow> (resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
resultant f g \<noteq> (0::'a)

goal (1 subgoal):
 1. resultant f g \<noteq> (0::'a) \<Longrightarrow> (resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)
[PROOF STEP]
from deg
[PROOF STATE]
proof (chain)
picking this:
0 < degree f \<or> 0 < degree g
[PROOF STEP]
have fg: "f \<noteq> 0 \<or> g \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < degree f \<or> 0 < degree g

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

goal (1 subgoal):
 1. resultant f g \<noteq> (0::'a) \<Longrightarrow> (resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)
[PROOF STEP]
from resultant_non_zero_imp_coprime[OF False fg] deg False
[PROOF STATE]
proof (chain)
picking this:
comm_monoid_mult_class.coprime f g
0 < degree f \<or> 0 < degree g
resultant f g \<noteq> (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
comm_monoid_mult_class.coprime f g
0 < degree f \<or> 0 < degree g
resultant f g \<noteq> (0::'a)

goal (1 subgoal):
 1. (resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(resultant f g = (0::'a)) = (\<not> comm_monoid_mult_class.coprime f g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_remove_all_mset[simp]: "mset (list_remove_all xs ys) = mset xs - mset ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (list_remove_all xs ys) = mset xs - mset ys
[PROOF STEP]
unfolding list_remove_all_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (fold list_remove1 ys xs) = mset xs - mset ys
[PROOF STEP]
by (induction ys arbitrary: xs) (auto simp: algebra_simps)


[STATEMENT]
lemma Fourier_sum_limit_Dirichlet_kernel_half:
  assumes f: "f absolutely_integrable_on {-pi..pi}"
    and periodic: "\<And>x. f(x + 2*pi) = f x"
  shows "(\<lambda>n. (\<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t)) \<longlonglongrightarrow> l
     \<longleftrightarrow> (\<lambda>n. (LINT x|lebesgue_on {0..pi}. Dirichlet_kernel n x * (f(t+x) + f(t-x) - 2*l))) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {0..pi}. Dirichlet_kernel n x * (f (t + x) + f (t - x) - 2 * l)) \<longlonglongrightarrow> 0
[PROOF STEP]
apply (simp flip: Fourier_sum_limit_pair [OF f])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {0..pi}. Dirichlet_kernel n x * (f (t + x) + f (t - x) - 2 * l)) \<longlonglongrightarrow> 0
[PROOF STEP]
apply (simp add: Lim_null [where l=l] Fourier_sum_offset_Dirichlet_kernel_half assms)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma smult_vec_nonneg_eq: fixes c :: "'a :: field"
  shows "c \<noteq> 0 \<Longrightarrow> (c \<cdot>\<^sub>v x = c \<cdot>\<^sub>v y) = (x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> (c \<cdot>\<^sub>v x = c \<cdot>\<^sub>v y) = (x = y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> (c \<cdot>\<^sub>v x = c \<cdot>\<^sub>v y) = (x = y)
[PROOF STEP]
have "c \<noteq> 0 \<Longrightarrow> c \<cdot>\<^sub>v x = c \<cdot>\<^sub>v y \<Longrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<noteq> (0::'a); c \<cdot>\<^sub>v x = c \<cdot>\<^sub>v y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
by (metis smult_smult_assoc[of "1 / c" "c"] nonzero_divide_eq_eq one_smult_vec)
[PROOF STATE]
proof (state)
this:
\<lbrakk>c \<noteq> (0::'a); c \<cdot>\<^sub>v x = c \<cdot>\<^sub>v y\<rbrakk> \<Longrightarrow> x = y

goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> (c \<cdot>\<^sub>v x = c \<cdot>\<^sub>v y) = (x = y)
[PROOF STEP]
thus "c \<noteq> 0 \<Longrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>c \<noteq> (0::'a); c \<cdot>\<^sub>v x = c \<cdot>\<^sub>v y\<rbrakk> \<Longrightarrow> x = y

goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> (c \<cdot>\<^sub>v x = c \<cdot>\<^sub>v y) = (x = y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'a) \<Longrightarrow> (c \<cdot>\<^sub>v x = c \<cdot>\<^sub>v y) = (x = y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Ln'_of_real_pos:
  assumes "x > 0"
  shows   "Ln' (of_real x) = of_real (ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln' (complex_of_real x) = complex_of_real (ln x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Ln' (complex_of_real x) = complex_of_real (ln x)
[PROOF STEP]
have "Ln' (of_real x) = Ln (of_real x * (-\<i>)) + \<i> * pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln' (complex_of_real x) = Ln (complex_of_real x * - \<i>) + \<i> * complex_of_real pi / 2
[PROOF STEP]
by (simp add: Ln'_def mult_ac)
[PROOF STATE]
proof (state)
this:
Ln' (complex_of_real x) = Ln (complex_of_real x * - \<i>) + \<i> * complex_of_real pi / 2

goal (1 subgoal):
 1. Ln' (complex_of_real x) = complex_of_real (ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Ln' (complex_of_real x) = Ln (complex_of_real x * - \<i>) + \<i> * complex_of_real pi / 2

goal (1 subgoal):
 1. Ln' (complex_of_real x) = complex_of_real (ln x)
[PROOF STEP]
have "\<dots> = of_real (ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (complex_of_real x * - \<i>) + \<i> * complex_of_real pi / 2 = complex_of_real (ln x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. Ln (complex_of_real x * - \<i>) + \<i> * complex_of_real pi / 2 = complex_of_real (ln x)
[PROOF STEP]
by (subst Ln_times_of_real) (auto simp: Ln_of_real)
[PROOF STATE]
proof (state)
this:
Ln (complex_of_real x * - \<i>) + \<i> * complex_of_real pi / 2 = complex_of_real (ln x)

goal (1 subgoal):
 1. Ln' (complex_of_real x) = complex_of_real (ln x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Ln' (complex_of_real x) = complex_of_real (ln x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Ln' (complex_of_real x) = complex_of_real (ln x)

goal (1 subgoal):
 1. Ln' (complex_of_real x) = complex_of_real (ln x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Ln' (complex_of_real x) = complex_of_real (ln x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gbinomial_int_mono:
  assumes "0 \<le> x" and "x \<le> (y::int)"
  shows "x gchoose k \<le> y gchoose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x gchoose k \<le> y gchoose k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x gchoose k \<le> y gchoose k
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x
x \<le> y
[PROOF STEP]
have "nat x \<le> nat y"
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
x \<le> y

goal (1 subgoal):
 1. nat x \<le> nat y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nat x \<le> nat y

goal (1 subgoal):
 1. x gchoose k \<le> y gchoose k
[PROOF STEP]
hence "nat x choose k \<le> nat y choose k"
[PROOF STATE]
proof (prove)
using this:
nat x \<le> nat y

goal (1 subgoal):
 1. nat x choose k \<le> nat y choose k
[PROOF STEP]
by (rule binomial_mono)
[PROOF STATE]
proof (state)
this:
nat x choose k \<le> nat y choose k

goal (1 subgoal):
 1. x gchoose k \<le> y gchoose k
[PROOF STEP]
hence "int (nat x choose k) \<le> int (nat y choose k)"
[PROOF STATE]
proof (prove)
using this:
nat x choose k \<le> nat y choose k

goal (1 subgoal):
 1. int (nat x choose k) \<le> int (nat y choose k)
[PROOF STEP]
by (simp only: zle_int)
[PROOF STATE]
proof (state)
this:
int (nat x choose k) \<le> int (nat y choose k)

goal (1 subgoal):
 1. x gchoose k \<le> y gchoose k
[PROOF STEP]
hence "int (nat x) gchoose k \<le> int (nat y) gchoose k"
[PROOF STATE]
proof (prove)
using this:
int (nat x choose k) \<le> int (nat y choose k)

goal (1 subgoal):
 1. int (nat x) gchoose k \<le> int (nat y) gchoose k
[PROOF STEP]
by (simp only: int_binomial)
[PROOF STATE]
proof (state)
this:
int (nat x) gchoose k \<le> int (nat y) gchoose k

goal (1 subgoal):
 1. x gchoose k \<le> y gchoose k
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x
x \<le> y
int (nat x) gchoose k \<le> int (nat y) gchoose k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
x \<le> y
int (nat x) gchoose k \<le> int (nat y) gchoose k

goal (1 subgoal):
 1. x gchoose k \<le> y gchoose k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x gchoose k \<le> y gchoose k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma samp_uni_spmf_mod_q:
  shows "spmf (sample_uniform q) (x mod q) = 1/q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. spmf (sample_uniform q) (x mod q) = 1 / real q
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. spmf (sample_uniform q) (x mod q) = 1 / real q
[PROOF STEP]
have "indicator {..< q} (x mod q) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indicator {..<q} (x mod q) = (1::'a)
[PROOF STEP]
using q_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < q

goal (1 subgoal):
 1. indicator {..<q} (x mod q) = (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
indicator {..<q} (x mod q) = (1::?'a2)

goal (1 subgoal):
 1. spmf (sample_uniform q) (x mod q) = 1 / real q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
indicator {..<q} (x mod q) = (1::?'a2)

goal (1 subgoal):
 1. spmf (sample_uniform q) (x mod q) = 1 / real q
[PROOF STEP]
have "real (card {..< q}) = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card {..<q}) = real q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (card {..<q}) = real q

goal (1 subgoal):
 1. spmf (sample_uniform q) (x mod q) = 1 / real q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
indicator {..<q} (x mod q) = (1::?'a2)
real (card {..<q}) = real q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
indicator {..<q} (x mod q) = (1::?'a2)
real (card {..<q}) = real q

goal (1 subgoal):
 1. spmf (sample_uniform q) (x mod q) = 1 / real q
[PROOF STEP]
by(auto simp add: spmf_of_set sample_uniform_def)
[PROOF STATE]
proof (state)
this:
spmf (sample_uniform q) (x mod q) = 1 / real q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_sgnx_times[sgnx_intros]:
  assumes "(f has_sgnx c1) F" "(g has_sgnx c2) F"
  shows "((\<lambda>x. f x* g x) has_sgnx c1 * c2) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) has_sgnx c1 * c2) F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) has_sgnx c1 * c2) F
[PROOF STEP]
have "\<forall>\<^sub>F x in F. sgn (f x) = c1 \<and> sgn (g x) = c2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. sgn (f x) = c1 \<and> sgn (g x) = c2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f has_sgnx c1) F
(g has_sgnx c2) F

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. sgn (f x) = c1 \<and> sgn (g x) = c2
[PROOF STEP]
unfolding has_sgnx_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. sgn (f x) = c1
\<forall>\<^sub>F x in F. sgn (g x) = c2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. sgn (f x) = c1 \<and> sgn (g x) = c2
[PROOF STEP]
by (intro eventually_conj,auto)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. sgn (f x) = c1 \<and> sgn (g x) = c2

goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) has_sgnx c1 * c2) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. sgn (f x) = c1 \<and> sgn (g x) = c2
[PROOF STEP]
have "\<forall>\<^sub>F x in F. sgn (f x * g x) = c1 * c2"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. sgn (f x) = c1 \<and> sgn (g x) = c2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. sgn (f x * g x) = c1 * c2
[PROOF STEP]
apply (elim eventually_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. sgn (f x) = c1 \<and> sgn (g x) = c2 \<Longrightarrow> sgn (f x * g x) = c1 * c2
[PROOF STEP]
by (simp add: sgn_mult)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. sgn (f x * g x) = c1 * c2

goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) has_sgnx c1 * c2) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. sgn (f x * g x) = c1 * c2
[PROOF STEP]
show "((\<lambda>x. f x* g x) has_sgnx c1 * c2) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. sgn (f x * g x) = c1 * c2

goal (1 subgoal):
 1. ((\<lambda>x. f x * g x) has_sgnx c1 * c2) F
[PROOF STEP]
unfolding has_sgnx_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. sgn (f x * g x) = c1 * c2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. sgn (f x * g x) = c1 * c2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f x * g x) has_sgnx c1 * c2) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_primepow_factors:
  assumes "x \<noteq> (0 :: 'a :: factorial_semiring_multiplicative)"
  shows   "finite (primepow_factors x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (primepow_factors x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (primepow_factors x)
[PROOF STEP]
have "finite (SIGMA p:prime_factors x. {0<..multiplicity p x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (SIGMA p:prime_factors x. {0<..multiplicity p x})
[PROOF STEP]
by (intro finite_SigmaI) simp_all
[PROOF STATE]
proof (state)
this:
finite (SIGMA p:prime_factors x. {0<..multiplicity p x})

goal (1 subgoal):
 1. finite (primepow_factors x)
[PROOF STEP]
hence "finite ((\<lambda>(p,k). p ^ k) ` \<dots>)" (is "finite ?A")
[PROOF STATE]
proof (prove)
using this:
finite (SIGMA p:prime_factors x. {0<..multiplicity p x})

goal (1 subgoal):
 1. finite ((\<lambda>(p, k). p ^ k) ` (SIGMA p:prime_factors x. {0<..multiplicity p x}))
[PROOF STEP]
by (rule finite_imageI)
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>(p, k). p ^ k) ` (SIGMA p:prime_factors x. {0<..multiplicity p x}))

goal (1 subgoal):
 1. finite (primepow_factors x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>(p, k). p ^ k) ` (SIGMA p:prime_factors x. {0<..multiplicity p x}))

goal (1 subgoal):
 1. finite (primepow_factors x)
[PROOF STEP]
have "?A = primepow_factors x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(p, k). p ^ k) ` (SIGMA p:prime_factors x. {0<..multiplicity p x}) = primepow_factors x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<lambda>(p, k). p ^ k) ` (SIGMA p:prime_factors x. {0<..multiplicity p x}) = primepow_factors x
[PROOF STEP]
by (subst primepow_factors_altdef) fast+
[PROOF STATE]
proof (state)
this:
(\<lambda>(p, k). p ^ k) ` (SIGMA p:prime_factors x. {0<..multiplicity p x}) = primepow_factors x

goal (1 subgoal):
 1. finite (primepow_factors x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
finite (primepow_factors x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (primepow_factors x)

goal (1 subgoal):
 1. finite (primepow_factors x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite (primepow_factors x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma least_power_dvd:
  assumes "permutation p" shows "(least_power p a) dvd n \<longleftrightarrow> (p ^^ n) a = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (least_power p a dvd n) = ((p ^^ n) a = a)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. least_power p a dvd n \<Longrightarrow> (p ^^ n) a = a
 2. (p ^^ n) a = a \<Longrightarrow> least_power p a dvd n
[PROOF STEP]
show "(p ^^ n) a = a \<Longrightarrow> (least_power p a) dvd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p ^^ n) a = a \<Longrightarrow> least_power p a dvd n
[PROOF STEP]
using least_power_minimal[of _ p]
[PROOF STATE]
proof (prove)
using this:
(p ^^ ?n) ?a = ?a \<Longrightarrow> least_power p ?a dvd ?n

goal (1 subgoal):
 1. (p ^^ n) a = a \<Longrightarrow> least_power p a dvd n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(p ^^ n) a = a \<Longrightarrow> least_power p a dvd n

goal (1 subgoal):
 1. least_power p a dvd n \<Longrightarrow> (p ^^ n) a = a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. least_power p a dvd n \<Longrightarrow> (p ^^ n) a = a
[PROOF STEP]
have "(p ^^ ((least_power p a) * k)) a = a" for k :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p ^^ (least_power p a * k)) a = a
[PROOF STEP]
using least_power_of_permutation(1)[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
(p ^^ least_power p ?a) ?a = ?a

goal (1 subgoal):
 1. (p ^^ (least_power p a * k)) a = a
[PROOF STEP]
by (induct k) (simp_all add: funpow_add)
[PROOF STATE]
proof (state)
this:
(p ^^ (least_power p a * ?k)) a = a

goal (1 subgoal):
 1. least_power p a dvd n \<Longrightarrow> (p ^^ n) a = a
[PROOF STEP]
thus "(least_power p a) dvd n \<Longrightarrow> (p ^^ n) a = a"
[PROOF STATE]
proof (prove)
using this:
(p ^^ (least_power p a * ?k)) a = a

goal (1 subgoal):
 1. least_power p a dvd n \<Longrightarrow> (p ^^ n) a = a
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
least_power p a dvd n \<Longrightarrow> (p ^^ n) a = a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powi_mod:
  "x powi m = x powi (m mod n)" if "x ^ n = 1" "n > 0" for x::complex and m::int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x powi m = x powi (m mod int n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x powi m = x powi (m mod int n)
[PROOF STEP]
have xnz: "x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x ^ n = 1
0 < n

goal (1 subgoal):
 1. x \<noteq> 0
[PROOF STEP]
by (metis zero_neq_one zero_power)
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (1 subgoal):
 1. x powi m = x powi (m mod int n)
[PROOF STEP]
obtain k::int where k: "m = k*n + (m mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. m = k * int n + m mod int n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using div_mod_decomp_int
[PROOF STATE]
proof (prove)
using this:
?A = ?A div ?n * ?n + ?A mod ?n

goal (1 subgoal):
 1. (\<And>k. m = k * int n + m mod int n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
m = k * int n + m mod int n

goal (1 subgoal):
 1. x powi m = x powi (m mod int n)
[PROOF STEP]
have "x powi m = x powi (k*n) * x powi (m mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x powi m = x powi (k * int n) * x powi (m mod int n)
[PROOF STEP]
by (subst k, intro power_int_add, use xnz in auto)
[PROOF STATE]
proof (state)
this:
x powi m = x powi (k * int n) * x powi (m mod int n)

goal (1 subgoal):
 1. x powi m = x powi (m mod int n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x powi m = x powi (k * int n) * x powi (m mod int n)

goal (1 subgoal):
 1. x powi m = x powi (m mod int n)
[PROOF STEP]
have "x powi (k*n) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x powi (k * int n) = 1
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x ^ n = 1
0 < n

goal (1 subgoal):
 1. x powi (k * int n) = 1
[PROOF STEP]
by (metis mult.commute power_int_1_left power_int_mult power_int_of_nat)
[PROOF STATE]
proof (state)
this:
x powi (k * int n) = 1

goal (1 subgoal):
 1. x powi m = x powi (m mod int n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x powi m = x powi (k * int n) * x powi (m mod int n)
x powi (k * int n) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x powi m = x powi (k * int n) * x powi (m mod int n)
x powi (k * int n) = 1

goal (1 subgoal):
 1. x powi m = x powi (m mod int n)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
x powi m = x powi (m mod int n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma stable_insort_equiv:
  "stable_segment cmp y (insort cmp x xs) = x # stable_segment cmp y xs"
    if "compare cmp y x = Equiv"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs
[PROOF STEP]
proof (induction xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x []) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) []
 2. \<And>a xs. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs \<Longrightarrow> filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x (a # xs)) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) (a # xs)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x []) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) []
 2. \<And>a xs. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs \<Longrightarrow> filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x (a # xs)) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) (a # xs)
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
compare cmp y x = Equiv
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
compare cmp y x = Equiv

goal (1 subgoal):
 1. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x []) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) []
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x []) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) []

goal (1 subgoal):
 1. \<And>a xs. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs \<Longrightarrow> filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x (a # xs)) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) (a # xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs \<Longrightarrow> filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x (a # xs)) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) (a # xs)
[PROOF STEP]
case (Cons z xs)
[PROOF STATE]
proof (state)
this:
filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs

goal (1 subgoal):
 1. \<And>a xs. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs \<Longrightarrow> filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x (a # xs)) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) (a # xs)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs

goal (1 subgoal):
 1. \<And>a xs. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs \<Longrightarrow> filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x (a # xs)) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) (a # xs)
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
compare cmp y x = Equiv
[PROOF STEP]
have "compare cmp y z = Equiv \<Longrightarrow> compare cmp z x = Equiv"
[PROOF STATE]
proof (prove)
using this:
compare cmp y x = Equiv

goal (1 subgoal):
 1. compare cmp y z = Equiv \<Longrightarrow> compare cmp z x = Equiv
[PROOF STEP]
by (auto intro: compare.trans_equiv simp add: compare.sym)
[PROOF STATE]
proof (state)
this:
compare cmp y z = Equiv \<Longrightarrow> compare cmp z x = Equiv

goal (1 subgoal):
 1. \<And>a xs. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs \<Longrightarrow> filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x (a # xs)) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) (a # xs)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs
compare cmp y z = Equiv \<Longrightarrow> compare cmp z x = Equiv
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs
compare cmp y z = Equiv \<Longrightarrow> compare cmp z x = Equiv

goal (1 subgoal):
 1. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x (z # xs)) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) (z # xs)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x xs) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) xs
compare cmp y z = Equiv \<Longrightarrow> compare cmp z x = Equiv
compare cmp y x = Equiv

goal (1 subgoal):
 1. filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x (z # xs)) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) (z # xs)
[PROOF STEP]
by (auto simp add: compare.greater_iff_sym_less)
[PROOF STATE]
proof (state)
this:
filter (\<lambda>ya. compare cmp y ya = Equiv) (Sorting_Algorithms.insort cmp x (z # xs)) = x # filter (\<lambda>ya. compare cmp y ya = Equiv) (z # xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diagonal_mat_sq_index:
  fixes B::"'a::{ring} Matrix.mat"
  assumes "diagonal_mat B"
  and "B \<in> carrier_mat n n"
  and "i < n"
  and "j < n"
  shows "(B * B) $$ (i,j) = B$$(i,i) * B$$(j,i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (B * B) $$ (i, j) = B $$ (i, i) * B $$ (j, i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (B * B) $$ (i, j) = B $$ (i, i) * B $$ (j, i)
[PROOF STEP]
have "(B * B) $$ (i,j) = B$$(i,i) * B$$(i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (B * B) $$ (i, j) = B $$ (i, i) * B $$ (i, j)
[PROOF STEP]
using assms diagonal_mat_mult_index[of B]
[PROOF STATE]
proof (prove)
using this:
diagonal_mat B
B \<in> carrier_mat n n
i < n
j < n
\<lbrakk>diagonal_mat B; B \<in> carrier_mat ?n ?n; ?B \<in> carrier_mat ?n ?n; ?i < ?n; ?j < ?n\<rbrakk> \<Longrightarrow> (B * ?B) $$ (?i, ?j) = B $$ (?i, ?i) * ?B $$ (?i, ?j)

goal (1 subgoal):
 1. (B * B) $$ (i, j) = B $$ (i, i) * B $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(B * B) $$ (i, j) = B $$ (i, i) * B $$ (i, j)

goal (1 subgoal):
 1. (B * B) $$ (i, j) = B $$ (i, i) * B $$ (j, i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(B * B) $$ (i, j) = B $$ (i, i) * B $$ (i, j)

goal (1 subgoal):
 1. (B * B) $$ (i, j) = B $$ (i, i) * B $$ (j, i)
[PROOF STEP]
have "... = B$$(i,i) * B$$(j,i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B $$ (i, i) * B $$ (i, j) = B $$ (i, i) * B $$ (j, i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
diagonal_mat B
B \<in> carrier_mat n n
i < n
j < n

goal (1 subgoal):
 1. B $$ (i, i) * B $$ (i, j) = B $$ (i, i) * B $$ (j, i)
[PROOF STEP]
unfolding diagonal_mat_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i<dim_row B. \<forall>j<dim_col B. i \<noteq> j \<longrightarrow> B $$ (i, j) = (0::'a)
B \<in> carrier_mat n n
i < n
j < n

goal (1 subgoal):
 1. B $$ (i, i) * B $$ (i, j) = B $$ (i, i) * B $$ (j, i)
[PROOF STEP]
by (metis carrier_matD(1) carrier_matD(2))
[PROOF STATE]
proof (state)
this:
B $$ (i, i) * B $$ (i, j) = B $$ (i, i) * B $$ (j, i)

goal (1 subgoal):
 1. (B * B) $$ (i, j) = B $$ (i, i) * B $$ (j, i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(B * B) $$ (i, j) = B $$ (i, i) * B $$ (j, i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(B * B) $$ (i, j) = B $$ (i, i) * B $$ (j, i)

goal (1 subgoal):
 1. (B * B) $$ (i, j) = B $$ (i, i) * B $$ (j, i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(B * B) $$ (i, j) = B $$ (i, i) * B $$ (j, i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma range_add_nat: "range (\<lambda>n. n + c) = {(c::nat)..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range (\<lambda>n. n + c) = {c..}
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x n. n \<in> UNIV \<Longrightarrow> c \<le> n + c
 2. \<And>x. c \<le> x \<Longrightarrow> x \<in> range (\<lambda>n. n + c)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x n. n \<in> UNIV \<Longrightarrow> c \<le> n + c
 2. \<And>x. c \<le> x \<Longrightarrow> x \<in> range (\<lambda>n. n + c)
[PROOF STEP]
assume "x \<ge> c"
[PROOF STATE]
proof (state)
this:
c \<le> x

goal (2 subgoals):
 1. \<And>x n. n \<in> UNIV \<Longrightarrow> c \<le> n + c
 2. \<And>x. c \<le> x \<Longrightarrow> x \<in> range (\<lambda>n. n + c)
[PROOF STEP]
hence "x = x - c + c"
[PROOF STATE]
proof (prove)
using this:
c \<le> x

goal (1 subgoal):
 1. x = x - c + c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = x - c + c

goal (2 subgoals):
 1. \<And>x n. n \<in> UNIV \<Longrightarrow> c \<le> n + c
 2. \<And>x. c \<le> x \<Longrightarrow> x \<in> range (\<lambda>n. n + c)
[PROOF STEP]
thus "x \<in> range (\<lambda>n. n + c)"
[PROOF STATE]
proof (prove)
using this:
x = x - c + c

goal (1 subgoal):
 1. x \<in> range (\<lambda>n. n + c)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> range (\<lambda>n. n + c)

goal (1 subgoal):
 1. \<And>x n. n \<in> UNIV \<Longrightarrow> c \<le> n + c
[PROOF STEP]
qed auto