[STATEMENT]
lemma divisor_sigma_prime:
  assumes "prime p"
  shows   "divisor_sigma x p = nat_power p x + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_sigma x p = nat_power p x + (1::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. divisor_sigma x p = nat_power p x + (1::'a)
[PROOF STEP]
have "divisor_sigma x p = (\<Sum>d | d dvd p. nat_power d x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_sigma x p = (\<Sum>d | d dvd p. nat_power d x)
[PROOF STEP]
by (simp add: divisor_sigma_def)
[PROOF STATE]
proof (state)
this:
divisor_sigma x p = (\<Sum>d | d dvd p. nat_power d x)

goal (1 subgoal):
 1. divisor_sigma x p = nat_power p x + (1::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
divisor_sigma x p = (\<Sum>d | d dvd p. nat_power d x)

goal (1 subgoal):
 1. divisor_sigma x p = nat_power p x + (1::'a)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime p
[PROOF STEP]
have "{d. d dvd p} = {1, p}"
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. {d. d dvd p} = {1, p}
[PROOF STEP]
by (auto simp: prime_nat_iff)
[PROOF STATE]
proof (state)
this:
{d. d dvd p} = {1, p}

goal (1 subgoal):
 1. divisor_sigma x p = nat_power p x + (1::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{d. d dvd p} = {1, p}

goal (1 subgoal):
 1. divisor_sigma x p = nat_power p x + (1::'a)
[PROOF STEP]
have "(\<Sum>d\<in>\<dots>. nat_power d x) = nat_power p x + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d\<in>{1, p}. nat_power d x) = nat_power p x + (1::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. (\<Sum>d\<in>{1, p}. nat_power d x) = nat_power p x + (1::'a)
[PROOF STEP]
by (subst sum.insert) (auto simp: add_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>d\<in>{1, p}. nat_power d x) = nat_power p x + (1::'a)

goal (1 subgoal):
 1. divisor_sigma x p = nat_power p x + (1::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
divisor_sigma x p = nat_power p x + (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
divisor_sigma x p = nat_power p x + (1::'a)

goal (1 subgoal):
 1. divisor_sigma x p = nat_power p x + (1::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
divisor_sigma x p = nat_power p x + (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unitary_gen_real:
  assumes "unitary_gen M"
  shows "(\<exists> k::real. k > 0 \<and> mat_adj M *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m eye)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k>0. mat_adj M *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m eye
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k>0. mat_adj M *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m eye
[PROOF STEP]
obtain k where *: "mat_adj M *\<^sub>m\<^sub>m M = k *\<^sub>s\<^sub>m eye" "k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. \<lbrakk>mat_adj M *\<^sub>m\<^sub>m M = k *\<^sub>s\<^sub>m eye; k \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
unitary_gen M

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>mat_adj M *\<^sub>m\<^sub>m M = k *\<^sub>s\<^sub>m eye; k \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: unitary_gen_def)
[PROOF STATE]
proof (state)
this:
mat_adj M *\<^sub>m\<^sub>m M = k *\<^sub>s\<^sub>m eye
k \<noteq> 0

goal (1 subgoal):
 1. \<exists>k>0. mat_adj M *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m eye
[PROOF STEP]
obtain a b c d where "M = (a, b, c, d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b c d. M = (a, b, c, d) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases M) auto
[PROOF STATE]
proof (state)
this:
M = (a, b, c, d)

goal (1 subgoal):
 1. \<exists>k>0. mat_adj M *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m eye
[PROOF STEP]
hence "k = cor ((cmod a)\<^sup>2) + cor ((cmod c)\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
M = (a, b, c, d)

goal (1 subgoal):
 1. k = cor ((cmod a)\<^sup>2) + cor ((cmod c)\<^sup>2)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
M = (a, b, c, d)
mat_adj M *\<^sub>m\<^sub>m M = k *\<^sub>s\<^sub>m eye
k \<noteq> 0

goal (1 subgoal):
 1. k = cor ((cmod a)\<^sup>2) + cor ((cmod c)\<^sup>2)
[PROOF STEP]
by (subst  complex_mult_cnj_cmod[symmetric])+ (auto simp add: mat_adj_def mat_cnj_def)
[PROOF STATE]
proof (state)
this:
k = cor ((cmod a)\<^sup>2) + cor ((cmod c)\<^sup>2)

goal (1 subgoal):
 1. \<exists>k>0. mat_adj M *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m eye
[PROOF STEP]
hence "is_real k \<and> Re k > 0"
[PROOF STATE]
proof (prove)
using this:
k = cor ((cmod a)\<^sup>2) + cor ((cmod c)\<^sup>2)

goal (1 subgoal):
 1. is_real k \<and> 0 < Re k
[PROOF STEP]
using \<open>k \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
k = cor ((cmod a)\<^sup>2) + cor ((cmod c)\<^sup>2)
k \<noteq> 0

goal (1 subgoal):
 1. is_real k \<and> 0 < Re k
[PROOF STEP]
by (smt add_cancel_left_left arg_0_iff arg_complex_of_real_positive not_sum_power2_lt_zero of_real_0 plus_complex.simps(1) plus_complex.simps(2))
[PROOF STATE]
proof (state)
this:
is_real k \<and> 0 < Re k

goal (1 subgoal):
 1. \<exists>k>0. mat_adj M *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m eye
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
is_real k \<and> 0 < Re k

goal (1 subgoal):
 1. \<exists>k>0. mat_adj M *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m eye
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
is_real k \<and> 0 < Re k
mat_adj M *\<^sub>m\<^sub>m M = k *\<^sub>s\<^sub>m eye
k \<noteq> 0

goal (1 subgoal):
 1. \<exists>k>0. mat_adj M *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m eye
[PROOF STEP]
by (rule_tac x="Re k" in exI) simp
[PROOF STATE]
proof (state)
this:
\<exists>k>0. mat_adj M *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m eye

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_sum_smaller:
  assumes "n > 0" "finite A"
  shows "(\<And> x. x \<in>A \<Longrightarrow> degree (f x) < n) \<Longrightarrow> degree (\<Sum>x\<in>A. f x) < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> degree (f x) < n) \<Longrightarrow> degree (sum f A) < n
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> degree (f x) < n) \<Longrightarrow> degree (sum f A) < n
[PROOF STEP]
by(induct rule: finite_induct)
    (simp_all add: degree_add_less assms)


[STATEMENT]
lemma topspace_map_topology[simp]: "topspace (map_topology f T) = f ` topspace T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topspace (map_topology f T) = f ` topspace T
[PROOF STEP]
unfolding map_topology_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topspace (final_topology (f ` topspace T) (\<lambda>_. T) (\<lambda>_. f)) = f ` topspace T
[PROOF STEP]
by (subst topspace_final_topology) auto


[STATEMENT]
lemma invertible_iff_is_unit_JNF:
  assumes A: "A \<in> carrier_mat n n"
  shows "invertible_mat A \<longleftrightarrow> (Determinant.det A) dvd 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_mat A = (Determinant.det A dvd (1::'a))
[PROOF STEP]
proof (cases "n=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> invertible_mat A = (Determinant.det A dvd (1::'a))
 2. n \<noteq> 0 \<Longrightarrow> invertible_mat A = (Determinant.det A dvd (1::'a))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> invertible_mat A = (Determinant.det A dvd (1::'a))
 2. n \<noteq> 0 \<Longrightarrow> invertible_mat A = (Determinant.det A dvd (1::'a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. invertible_mat A = (Determinant.det A dvd (1::'a))
[PROOF STEP]
using det_dim_zero invertible_mat_zero A
[PROOF STATE]
proof (prove)
using this:
n = 0
?A \<in> carrier_mat 0 0 \<Longrightarrow> Determinant.det ?A = (1::?'a)
?A \<in> carrier_mat 0 0 \<Longrightarrow> invertible_mat ?A
A \<in> carrier_mat n n

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

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> invertible_mat A = (Determinant.det A dvd (1::'a))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> invertible_mat A = (Determinant.det A dvd (1::'a))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> invertible_mat A = (Determinant.det A dvd (1::'a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. invertible_mat A = (Determinant.det A dvd (1::'a))
[PROOF STEP]
using invertible_iff_is_unit[untransferred, cancel_card_constraint] A
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0
\<lbrakk>?A \<in> carrier_mat ?n0.0 ?n0.0; ?n0.0 \<noteq> 0\<rbrakk> \<Longrightarrow> invertible_mat ?A = (Determinant.det ?A dvd (1::?'b))
A \<in> carrier_mat n n

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Bernstein_Poly_nonneg:
  assumes "c \<le> x" and "x \<le> d"
  shows "poly (Bernstein_Poly j p c d) x \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> poly (Bernstein_Poly j p c d) x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<le> x
x \<le> d

goal (1 subgoal):
 1. 0 \<le> poly (Bernstein_Poly j p c d) x
[PROOF STEP]
by (auto simp: Bernstein_Poly_def poly_pcompose poly_monom)


[STATEMENT]
lemma index_mat_swapcols[simp]:
  "i < dim_row A \<Longrightarrow> j < dim_col A \<Longrightarrow> swapcols k l A $$ (i,j) = (if k = j then A $$ (i,l) else
    if l = j then A $$ (i,k) else A $$ (i,j))"
  "dim_row (swapcols k l A) = dim_row A" "dim_col (swapcols k l A) = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < dim_row A; j < dim_col A\<rbrakk> \<Longrightarrow> swapcols k l A $$ (i, j) = (if k = j then A $$ (i, l) else if l = j then A $$ (i, k) else A $$ (i, j))) &&& dim_row (swapcols k l A) = dim_row A &&& dim_col (swapcols k l A) = dim_col A
[PROOF STEP]
unfolding mat_swapcols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < dim_row A; j < dim_col A\<rbrakk> \<Longrightarrow> mat (dim_row A) (dim_col A) (\<lambda>(i, j). if k = j then A $$ (i, l) else if l = j then A $$ (i, k) else A $$ (i, j)) $$ (i, j) = (if k = j then A $$ (i, l) else if l = j then A $$ (i, k) else A $$ (i, j))) &&& dim_row (mat (dim_row A) (dim_col A) (\<lambda>(i, j). if k = j then A $$ (i, l) else if l = j then A $$ (i, k) else A $$ (i, j))) = dim_row A &&& dim_col (mat (dim_row A) (dim_col A) (\<lambda>(i, j). if k = j then A $$ (i, l) else if l = j then A $$ (i, k) else A $$ (i, j))) = dim_col A
[PROOF STEP]
by auto


[STATEMENT]
lemma set_membership_eq: "A = B \<longleftrightarrow> (\<lambda>x. Set.member x A) = (\<lambda>x. Set.member x B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A = B) = ((\<lambda>x. x \<in> A) = (\<lambda>x. x \<in> B))
[PROOF STEP]
apply standard
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. A = B \<Longrightarrow> (\<lambda>x. x \<in> A) = (\<lambda>x. x \<in> B)
 2. (\<lambda>x. x \<in> A) = (\<lambda>x. x \<in> B) \<Longrightarrow> A = B
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x \<in> A) = (\<lambda>x. x \<in> B) \<Longrightarrow> A = B
[PROOF STEP]
by (meson equalityI subsetI)


[STATEMENT]
lemma vec_norm_eq_cpx_vec_length:
  shows "vec_norm v = cpx_vec_length v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_norm v = complex_of_real \<parallel>v\<parallel>
[PROOF STEP]
using vec_norm_sq_cpx_vec_length_sq
[PROOF STATE]
proof (prove)
using this:
(vec_norm ?v)\<^sup>2 = complex_of_real (\<parallel>?v\<parallel>\<^sup>2)

goal (1 subgoal):
 1. vec_norm v = complex_of_real \<parallel>v\<parallel>
[PROOF STEP]
by (metis cpx_vec_length_inner_prod inner_prod_csqrt power2_csqrt vec_norm_def)


[STATEMENT]
lemma ring_iso_memI:
  fixes R (structure) and S (structure)
  assumes "\<And>x. x \<in> carrier R \<Longrightarrow> h x \<in> carrier S"
      and "\<And>x y. \<lbrakk> x \<in> carrier R; y \<in> carrier R \<rbrakk> \<Longrightarrow> h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y"
      and "\<And>x y. \<lbrakk> x \<in> carrier R; y \<in> carrier R \<rbrakk> \<Longrightarrow> h (x \<oplus> y) = h x \<oplus>\<^bsub>S\<^esub> h y"
      and "h \<one> = \<one>\<^bsub>S\<^esub>"
      and "bij_betw h (carrier R) (carrier S)"
  shows "h \<in> ring_iso R S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h \<in> ring_iso R S
[PROOF STEP]
by (auto simp add: ring_hom_memI assms ring_iso_def)


[STATEMENT]
lemma eventually_in_atLeastAtMostI:
  assumes "eventually (\<lambda>x. f x \<ge> l x) at_top" "eventually (\<lambda>x. f x \<le> u x) at_top"
  shows   "eventually (\<lambda>x. f x \<in> {l x..u x}) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x \<in> {l x..u x}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. l x \<le> f x
\<forall>\<^sub>F x in at_top. f x \<le> u x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x \<in> {l x..u x}
[PROOF STEP]
by eventually_elim simp_all


[STATEMENT]
lemma poly_pos_between_less_less:
  "(\<forall>x::real. a < x \<and> x < b \<longrightarrow> poly p x > 0) \<longleftrightarrow>
    (a \<ge> b \<or> poly p ((a+b)/2) > 0) \<and> (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x) = ((b \<le> a \<or> 0 < poly p ((a + b) / 2)) \<and> (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0))
[PROOF STEP]
proof (intro iffI conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x \<Longrightarrow> b \<le> a \<or> 0 < poly p ((a + b) / 2)
 2. \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
 3. (b \<le> a \<or> 0 < poly p ((a + b) / 2)) \<and> (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x
[PROOF STEP]
assume A: "\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x > 0"
[PROOF STATE]
proof (state)
this:
\<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x

goal (3 subgoals):
 1. \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x \<Longrightarrow> b \<le> a \<or> 0 < poly p ((a + b) / 2)
 2. \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
 3. (b \<le> a \<or> 0 < poly p ((a + b) / 2)) \<and> (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x
[PROOF STEP]
have "\<And>x. poly p (x::real) > 0 \<Longrightarrow> poly p x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < poly p x \<Longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < poly p ?x \<Longrightarrow> poly p ?x \<noteq> 0

goal (3 subgoals):
 1. \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x \<Longrightarrow> b \<le> a \<or> 0 < poly p ((a + b) / 2)
 2. \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
 3. (b \<le> a \<or> 0 < poly p ((a + b) / 2)) \<and> (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x
0 < poly p ?x \<Longrightarrow> poly p ?x \<noteq> 0
[PROOF STEP]
show "\<forall>x::real. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x
0 < poly p ?x \<Longrightarrow> poly p ?x \<noteq> 0

goal (1 subgoal):
 1. \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0

goal (2 subgoals):
 1. \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x \<Longrightarrow> b \<le> a \<or> 0 < poly p ((a + b) / 2)
 2. (b \<le> a \<or> 0 < poly p ((a + b) / 2)) \<and> (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x
[PROOF STEP]
show "a \<ge> b \<or> poly p ((a+b)/2) > 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x

goal (1 subgoal):
 1. b \<le> a \<or> 0 < poly p ((a + b) / 2)
[PROOF STEP]
by (cases "a < b", auto)
[PROOF STATE]
proof (state)
this:
b \<le> a \<or> 0 < poly p ((a + b) / 2)

goal (1 subgoal):
 1. (b \<le> a \<or> 0 < poly p ((a + b) / 2)) \<and> (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (b \<le> a \<or> 0 < poly p ((a + b) / 2)) \<and> (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x
[PROOF STEP]
assume "(b \<le> a \<or> 0 < poly p ((a+b)/2)) \<and> (\<forall>x. a<x \<and> x<b \<longrightarrow> poly p x \<noteq> 0)"
[PROOF STATE]
proof (state)
this:
(b \<le> a \<or> 0 < poly p ((a + b) / 2)) \<and> (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0)

goal (1 subgoal):
 1. (b \<le> a \<or> 0 < poly p ((a + b) / 2)) \<and> (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x
[PROOF STEP]
hence A: "b \<le> a \<or> 0 < poly p ((a+b)/2)" and
        B: "\<forall>x. a<x \<and> x<b \<longrightarrow> poly p x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
(b \<le> a \<or> 0 < poly p ((a + b) / 2)) \<and> (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0)

goal (1 subgoal):
 1. b \<le> a \<or> 0 < poly p ((a + b) / 2) &&& \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
b \<le> a \<or> 0 < poly p ((a + b) / 2)
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. (b \<le> a \<or> 0 < poly p ((a + b) / 2)) \<and> (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x
[PROOF STEP]
show "\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x
[PROOF STEP]
proof (cases "a \<ge> b", simp, clarify, rule_tac ccontr,
         simp only: not_le not_less)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x < b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x < b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "a < b" "a < x" "x < b" "poly p x \<le> 0"
[PROOF STATE]
proof (state)
this:
a < b
a < x
x < b
poly p x \<le> 0

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x < b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with B
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
a < b
a < x
x < b
poly p x \<le> 0
[PROOF STEP]
have "poly p x < 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
a < b
a < x
x < b
poly p x \<le> 0

goal (1 subgoal):
 1. poly p x < 0
[PROOF STEP]
by (simp add: less_eq_real_def)
[PROOF STATE]
proof (state)
this:
poly p x < 0

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x < b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
poly p x < 0

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x < b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from A and \<open>a < b\<close>
[PROOF STATE]
proof (chain)
picking this:
b \<le> a \<or> 0 < poly p ((a + b) / 2)
a < b
[PROOF STEP]
have "poly p ((a+b)/2) > 0"
[PROOF STATE]
proof (prove)
using this:
b \<le> a \<or> 0 < poly p ((a + b) / 2)
a < b

goal (1 subgoal):
 1. 0 < poly p ((a + b) / 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < poly p ((a + b) / 2)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x < b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
poly p x < 0
0 < poly p ((a + b) / 2)
[PROOF STEP]
have "sgn (poly p x) \<noteq> sgn (poly p ((a+b)/2))"
[PROOF STATE]
proof (prove)
using this:
poly p x < 0
0 < poly p ((a + b) / 2)

goal (1 subgoal):
 1. sgn (poly p x) \<noteq> sgn (poly p ((a + b) / 2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sgn (poly p x) \<noteq> sgn (poly p ((a + b) / 2))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x < b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
sgn (poly p x) \<noteq> sgn (poly p ((a + b) / 2))

goal (1 subgoal):
 1. False
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
sgn (poly p x) \<noteq> sgn (poly p ((a + b) / 2))
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. False
[PROOF STEP]
apply (cases x "(a+b)/2" rule: linorder_cases)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>sgn (poly p x) \<noteq> sgn (poly p ((a + b) / 2)); \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0; x < (a + b) / 2\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>sgn (poly p x) \<noteq> sgn (poly p ((a + b) / 2)); \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0; x = (a + b) / 2\<rbrakk> \<Longrightarrow> False
 3. \<lbrakk>sgn (poly p x) \<noteq> sgn (poly p ((a + b) / 2)); \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0; (a + b) / 2 < x\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (drule poly_different_sign_imp_root[of _ _ p], assumption,
              insert \<open>a < b\<close> \<open>a < x\<close> \<open>x < b\<close> , force) []
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>sgn (poly p x) \<noteq> sgn (poly p ((a + b) / 2)); \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0; x = (a + b) / 2\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>sgn (poly p x) \<noteq> sgn (poly p ((a + b) / 2)); \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0; (a + b) / 2 < x\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sgn (poly p x) \<noteq> sgn (poly p ((a + b) / 2)); \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0; (a + b) / 2 < x\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (drule poly_different_sign_imp_root[of _ _ p], simp,
              insert \<open>a < b\<close> \<open>a < x\<close> \<open>x < b\<close> , force)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma partial_order_on_trans:
  "\<lbrakk> partial_order_on A r; (x, y) \<in> r; (y, z) \<in> r \<rbrakk> \<Longrightarrow> (x, z) \<in> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>partial_order_on A r; (x, y) \<in> r; (y, z) \<in> r\<rbrakk> \<Longrightarrow> (x, z) \<in> r
[PROOF STEP]
by(auto simp add: order_on_defs dest: transD)


[STATEMENT]
lemma cvector_fraction_eq_iff [vector_add_divide_simps]:
  fixes x :: "'a :: complex_vector"
  shows "((u / v) *\<^sub>C a = x) \<longleftrightarrow> (if v=0 then x = 0 else u *\<^sub>C a = v *\<^sub>C x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((u / v) *\<^sub>C a = x) = (if v = 0 then x = (0::'a) else u *\<^sub>C a = v *\<^sub>C x)
[PROOF STEP]
by (metis ceq_vector_fraction_iff)


[STATEMENT]
lemma ack_add_bound: "ack i1 j + ack i2 j < ack (4 + (i1 + i2)) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ack i1 j + ack i2 j < ack (4 + (i1 + i2)) j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ack i1 j + ack i2 j < ack (4 + (i1 + i2)) j
[PROOF STEP]
have "ack i1 j \<le> ack (i1 + i2) j" "ack i2 j \<le> ack (i1 + i2) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ack i1 j \<le> ack (i1 + i2) j &&& ack i2 j \<le> ack (i1 + i2) j
[PROOF STEP]
by (simp_all add: ack_le_mono1)
[PROOF STATE]
proof (state)
this:
ack i1 j \<le> ack (i1 + i2) j
ack i2 j \<le> ack (i1 + i2) j

goal (1 subgoal):
 1. ack i1 j + ack i2 j < ack (4 + (i1 + i2)) j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ack i1 j \<le> ack (i1 + i2) j
ack i2 j \<le> ack (i1 + i2) j
[PROOF STEP]
have "ack i1 j + ack i2 j < ack (Suc (Suc 0)) (ack (i1 + i2) j)"
[PROOF STATE]
proof (prove)
using this:
ack i1 j \<le> ack (i1 + i2) j
ack i2 j \<le> ack (i1 + i2) j

goal (1 subgoal):
 1. ack i1 j + ack i2 j < ack (Suc (Suc 0)) (ack (i1 + i2) j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ack i1 j + ack i2 j < ack (Suc (Suc 0)) (ack (i1 + i2) j)

goal (1 subgoal):
 1. ack i1 j + ack i2 j < ack (4 + (i1 + i2)) j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ack i1 j + ack i2 j < ack (Suc (Suc 0)) (ack (i1 + i2) j)

goal (1 subgoal):
 1. ack i1 j + ack i2 j < ack (4 + (i1 + i2)) j
[PROOF STEP]
have "\<dots> < ack (4 + (i1 + i2)) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ack (Suc (Suc 0)) (ack (i1 + i2) j) < ack (4 + (i1 + i2)) j
[PROOF STEP]
by (metis ack_nest_bound add.assoc numeral_2_eq_2 numeral_Bit0)
[PROOF STATE]
proof (state)
this:
ack (Suc (Suc 0)) (ack (i1 + i2) j) < ack (4 + (i1 + i2)) j

goal (1 subgoal):
 1. ack i1 j + ack i2 j < ack (4 + (i1 + i2)) j
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ack i1 j + ack i2 j < ack (4 + (i1 + i2)) j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ack i1 j + ack i2 j < ack (4 + (i1 + i2)) j

goal (1 subgoal):
 1. ack i1 j + ack i2 j < ack (4 + (i1 + i2)) j
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ack i1 j + ack i2 j < ack (4 + (i1 + i2)) j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma changes_sign_var:
  fixes a b c x y:: "real"
  shows "((sign_num (a*x^2 + b*x + c) \<noteq> sign_num (a*y^2 + b*y + c)  \<and> x < y) \<Longrightarrow> (\<exists>q. (a*q^2 + b*q + c = 0 \<and> x \<le> q \<and> q \<le> y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c) \<and> x < y \<Longrightarrow> \<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
proof  clarsimp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c); x < y\<rbrakk> \<Longrightarrow> \<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
assume sn: "sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c)"
[PROOF STATE]
proof (state)
this:
sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c)

goal (1 subgoal):
 1. \<lbrakk>sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c); x < y\<rbrakk> \<Longrightarrow> \<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
assume xy: " x < y"
[PROOF STATE]
proof (state)
this:
x < y

goal (1 subgoal):
 1. \<lbrakk>sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c); x < y\<rbrakk> \<Longrightarrow> \<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
let ?p = "[:c, b, a:]"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c); x < y\<rbrakk> \<Longrightarrow> \<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
have cs: "((sign ?p x \<noteq> sign ?p y  \<and> x < y) \<longrightarrow> (\<exists>c \<in> (root_list ?p). x \<le> c \<and> c \<le> y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign [:c, b, a:] x \<noteq> sign [:c, b, a:] y \<and> x < y \<longrightarrow> (\<exists>c\<in>root_list [:c, b, a:]. x \<le> c \<and> c \<le> y)
[PROOF STEP]
using changes_sign[of ?p]
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. sign [:c, b, a:] x \<noteq> sign [:c, b, a:] y \<and> x < y \<longrightarrow> (\<exists>c\<in>root_list [:c, b, a:]. x \<le> c \<and> c \<le> y)

goal (1 subgoal):
 1. sign [:c, b, a:] x \<noteq> sign [:c, b, a:] y \<and> x < y \<longrightarrow> (\<exists>c\<in>root_list [:c, b, a:]. x \<le> c \<and> c \<le> y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sign [:c, b, a:] x \<noteq> sign [:c, b, a:] y \<and> x < y \<longrightarrow> (\<exists>c\<in>root_list [:c, b, a:]. x \<le> c \<and> c \<le> y)

goal (1 subgoal):
 1. \<lbrakk>sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c); x < y\<rbrakk> \<Longrightarrow> \<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
have "(sign ?p x \<noteq> sign ?p y  \<and> x < y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign [:c, b, a:] x \<noteq> sign [:c, b, a:] y \<and> x < y
[PROOF STEP]
using sn xy
[PROOF STATE]
proof (prove)
using this:
sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c)
x < y

goal (1 subgoal):
 1. sign [:c, b, a:] x \<noteq> sign [:c, b, a:] y \<and> x < y
[PROOF STEP]
unfolding sign_def sign_num_def
[PROOF STATE]
proof (prove)
using this:
(if a * x\<^sup>2 + b * x + c = 0 then 0 else if 0 < a * x\<^sup>2 + b * x + c then 1 else - 1) \<noteq> (if a * y\<^sup>2 + b * y + c = 0 then 0 else if 0 < a * y\<^sup>2 + b * y + c then 1 else - 1)
x < y

goal (1 subgoal):
 1. (if poly [:c, b, a:] x = 0 then 0 else if 0 < poly [:c, b, a:] x then 1 else - 1) \<noteq> (if poly [:c, b, a:] y = 0 then 0 else if 0 < poly [:c, b, a:] y then 1 else - 1) \<and> x < y
[PROOF STEP]
using quadratic_poly_eval
[PROOF STATE]
proof (prove)
using this:
(if a * x\<^sup>2 + b * x + c = 0 then 0 else if 0 < a * x\<^sup>2 + b * x + c then 1 else - 1) \<noteq> (if a * y\<^sup>2 + b * y + c = 0 then 0 else if 0 < a * y\<^sup>2 + b * y + c then 1 else - 1)
x < y
poly [:?c, ?b, ?a:] ?x = ?a * ?x\<^sup>2 + ?b * ?x + ?c

goal (1 subgoal):
 1. (if poly [:c, b, a:] x = 0 then 0 else if 0 < poly [:c, b, a:] x then 1 else - 1) \<noteq> (if poly [:c, b, a:] y = 0 then 0 else if 0 < poly [:c, b, a:] y then 1 else - 1) \<and> x < y
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
sign [:c, b, a:] x \<noteq> sign [:c, b, a:] y \<and> x < y

goal (1 subgoal):
 1. \<lbrakk>sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c); x < y\<rbrakk> \<Longrightarrow> \<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sign [:c, b, a:] x \<noteq> sign [:c, b, a:] y \<and> x < y
[PROOF STEP]
have "(\<exists>c \<in> (root_list ?p). x \<le> c \<and> c \<le> y)"
[PROOF STATE]
proof (prove)
using this:
sign [:c, b, a:] x \<noteq> sign [:c, b, a:] y \<and> x < y

goal (1 subgoal):
 1. \<exists>c\<in>root_list [:c, b, a:]. x \<le> c \<and> c \<le> y
[PROOF STEP]
using cs
[PROOF STATE]
proof (prove)
using this:
sign [:c, b, a:] x \<noteq> sign [:c, b, a:] y \<and> x < y
sign [:c, b, a:] x \<noteq> sign [:c, b, a:] y \<and> x < y \<longrightarrow> (\<exists>c\<in>root_list [:c, b, a:]. x \<le> c \<and> c \<le> y)

goal (1 subgoal):
 1. \<exists>c\<in>root_list [:c, b, a:]. x \<le> c \<and> c \<le> y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>c\<in>root_list [:c, b, a:]. x \<le> c \<and> c \<le> y

goal (1 subgoal):
 1. \<lbrakk>sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c); x < y\<rbrakk> \<Longrightarrow> \<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>c\<in>root_list [:c, b, a:]. x \<le> c \<and> c \<le> y
[PROOF STEP]
obtain q where "q \<in> root_list ?p \<and> x \<le> q \<and> q \<le> y"
[PROOF STATE]
proof (prove)
using this:
\<exists>c\<in>root_list [:c, b, a:]. x \<le> c \<and> c \<le> y

goal (1 subgoal):
 1. (\<And>q. q \<in> root_list [:c, b, a:] \<and> x \<le> q \<and> q \<le> y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q \<in> root_list [:c, b, a:] \<and> x \<le> q \<and> q \<le> y

goal (1 subgoal):
 1. \<lbrakk>sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c); x < y\<rbrakk> \<Longrightarrow> \<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q \<in> root_list [:c, b, a:] \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
have "a*q^2 + b*q + c = 0 \<and> x \<le> q \<and> q \<le> y"
[PROOF STATE]
proof (prove)
using this:
q \<in> root_list [:c, b, a:] \<and> x \<le> q \<and> q \<le> y

goal (1 subgoal):
 1. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
unfolding root_list_def
[PROOF STATE]
proof (prove)
using this:
q \<in> {x. poly [:c, b, a:] x = 0} \<and> x \<le> q \<and> q \<le> y

goal (1 subgoal):
 1. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
using quadratic_poly_eval[of c b a q]
[PROOF STATE]
proof (prove)
using this:
q \<in> {x. poly [:c, b, a:] x = 0} \<and> x \<le> q \<and> q \<le> y
poly [:c, b, a:] q = a * q\<^sup>2 + b * q + c

goal (1 subgoal):
 1. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y

goal (1 subgoal):
 1. \<lbrakk>sign_num (a * x\<^sup>2 + b * x + c) \<noteq> sign_num (a * y\<^sup>2 + b * y + c); x < y\<rbrakk> \<Longrightarrow> \<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
show "\<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y"
[PROOF STATE]
proof (prove)
using this:
a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y

goal (1 subgoal):
 1. \<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>q. a * q\<^sup>2 + b * q + c = 0 \<and> x \<le> q \<and> q \<le> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma divisor_sum_0 [simp]: "divisor_sum 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_sum 0 = 0
[PROOF STEP]
by (simp add: divisor_sum_def)


[STATEMENT]
lemma llist_all2_left: "llist_all2 (\<lambda>x _. P x) xs ys \<longleftrightarrow> llength xs = llength ys \<and> (\<forall>x\<in>lset xs. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llist_all2 (\<lambda>x _. P x) xs ys = (llength xs = llength ys \<and> (\<forall>x\<in>lset xs. P x))
[PROOF STEP]
by(fastforce simp add: llist_all2_conv_all_lnth lset_conv_lnth)


[STATEMENT]
lemma mono_upclosed:
  fixes f :: "'a::order_with_dual \<Rightarrow> 'b::order_with_dual"
  assumes "mono f"
  shows "\<forall>Y. upclosed_set Y \<longrightarrow> upclosed_set (f -` Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>Y. upclosed_set Y \<longrightarrow> upclosed_set (f -` Y)
[PROOF STEP]
by (simp add: assms monoD upclosed_set_iff)


[STATEMENT]
lemma fib_Cassini_nat:
  "fib (Suc (Suc n)) * fib n =
     (if even n then (fib (Suc n))\<^sup>2 - 1 else (fib (Suc n))\<^sup>2 + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib (Suc (Suc n)) * fib n = (if even n then (fib (Suc n))\<^sup>2 - 1 else (fib (Suc n))\<^sup>2 + 1)
[PROOF STEP]
using fib_Cassini_int [of n]
[PROOF STATE]
proof (prove)
using this:
int (fib (Suc (Suc n)) * fib n) - int ((fib (Suc n))\<^sup>2) = - ((- 1) ^ n)

goal (1 subgoal):
 1. fib (Suc (Suc n)) * fib n = (if even n then (fib (Suc n))\<^sup>2 - 1 else (fib (Suc n))\<^sup>2 + 1)
[PROOF STEP]
by (auto simp del: of_nat_mult of_nat_power)


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

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


[STATEMENT]
lemma timesmod3: "((a mod (n::nat)) * b) mod n = (a*b) mod n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a mod n * b mod n = a * b mod n
[PROOF STEP]
by (rule mod_mult_left_eq)


[STATEMENT]
lemma (in comm_group) finite_sub_comp_iff_card_eq_IDirProd:
  assumes "subgroup H G" "subgroup J G" "finite H" "finite J"
  shows "card (IDirProd G H J) = card J * card H  \<longleftrightarrow> complementary H J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card (IDirProd G H J) = card J * card H) = complementary H J
[PROOF STEP]
using finite_sub_comp_iff_card_eq_mult IDirProd_eq_subgroup_mult assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subgroup ?H G; subgroup ?J G; finite ?H; finite ?J\<rbrakk> \<Longrightarrow> (card (?H <#> ?J) = card ?J * card ?H) = complementary ?H ?J
\<lbrakk>subgroup ?H G; subgroup ?J G\<rbrakk> \<Longrightarrow> IDirProd G ?H ?J = ?H <#> ?J
subgroup H G
subgroup J G
finite H
finite J

goal (1 subgoal):
 1. (card (IDirProd G H J) = card J * card H) = complementary H J
[PROOF STEP]
by presburger


[STATEMENT]
theorem effective_well_defined_Tensor:
 assumes "(mat (row_length M1) (length M1) M1)"
     and "(mat (row_length M2) (length M2) M2)"
 shows "mat
            ((row_length M1)*(row_length M2))
            ((length M1)*(length M2))
                               (M1\<otimes>M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)
[PROOF STEP]
using well_defined_Tensor assms
[PROOF STATE]
proof (prove)
using this:
mat (row_length ?M1.0) (length ?M1.0) ?M1.0 \<and> mat (row_length ?M2.0) (length ?M2.0) ?M2.0 \<Longrightarrow> mat (row_length ?M1.0 * row_length ?M2.0) (length ?M1.0 * length ?M2.0) (?M1.0 \<otimes> ?M2.0)
mat (row_length M1) (length M1) M1
mat (row_length M2) (length M2) M2

goal (1 subgoal):
 1. mat (row_length M1 * row_length M2) (length M1 * length M2) (M1 \<otimes> M2)
[PROOF STEP]
by auto


[STATEMENT]
lemma Pair_le [simp]: "(a, b) \<le> (c, d) \<longleftrightarrow> a \<le> c \<and> b \<le> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((a, b) \<le> (c, d)) = (a \<le> c \<and> b \<le> d)
[PROOF STEP]
unfolding less_eq_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fst (a, b) \<le> fst (c, d) \<and> snd (a, b) \<le> snd (c, d)) = (a \<le> c \<and> b \<le> d)
[PROOF STEP]
by simp


[STATEMENT]
lemma tseq_test:
  "p = --p \<Longrightarrow> q = --q \<Longrightarrow> r = --r \<Longrightarrow> tseq p x q r m = --tseq p x q r m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p = - - p; q = - - q; r = - - r\<rbrakk> \<Longrightarrow> tseq p x q r m = - - tseq p x q r m
[PROOF STEP]
apply (induct m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p = - - p; q = - - q; r = - - r\<rbrakk> \<Longrightarrow> tseq p x q r 0 = - - tseq p x q r 0
 2. \<And>m. \<lbrakk>\<lbrakk>p = - - p; q = - - q; r = - - r\<rbrakk> \<Longrightarrow> tseq p x q r m = - - tseq p x q r m; p = - - p; q = - - q; r = - - r\<rbrakk> \<Longrightarrow> tseq p x q r (Suc m) = - - tseq p x q r (Suc m)
[PROOF STEP]
apply (smt tseq_def tfun_test power_zero_id id_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>\<lbrakk>p = - - p; q = - - q; r = - - r\<rbrakk> \<Longrightarrow> tseq p x q r m = - - tseq p x q r m; p = - - p; q = - - q; r = - - r\<rbrakk> \<Longrightarrow> tseq p x q r (Suc m) = - - tseq p x q r (Suc m)
[PROOF STEP]
by (metis tseq_def tfun_test power_succ_unfold_ext)


[STATEMENT]
lemma sup_0_imp_0:
  assumes "sup a (- a) = 0"
  shows "a = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a = (0::'a)
[PROOF STEP]
have pos: "0 \<le> a" if "sup a (- a) = 0" for a :: 'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (0::'a) \<le> a
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
sup a (- a) = (0::'a)
[PROOF STEP]
have "sup a (- a) + a = a"
[PROOF STATE]
proof (prove)
using this:
sup a (- a) = (0::'a)

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

goal (1 subgoal):
 1. (0::'a) \<le> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sup a (- a) + a = a
[PROOF STEP]
have "sup (a + a) 0 = a"
[PROOF STATE]
proof (prove)
using this:
sup a (- a) + a = a

goal (1 subgoal):
 1. sup (a + a) (0::'a) = a
[PROOF STEP]
by (simp add: add_sup_distrib_right)
[PROOF STATE]
proof (state)
this:
sup (a + a) (0::'a) = a

goal (1 subgoal):
 1. (0::'a) \<le> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sup (a + a) (0::'a) = a
[PROOF STEP]
have "sup (a + a) 0 \<le> a"
[PROOF STATE]
proof (prove)
using this:
sup (a + a) (0::'a) = a

goal (1 subgoal):
 1. sup (a + a) (0::'a) \<le> a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sup (a + a) (0::'a) \<le> a

goal (1 subgoal):
 1. (0::'a) \<le> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sup (a + a) (0::'a) \<le> a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sup (a + a) (0::'a) \<le> a

goal (1 subgoal):
 1. (0::'a) \<le> a
[PROOF STEP]
by (blast intro: order_trans inf_sup_ord)
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sup ?a1 (- ?a1) = (0::'a) \<Longrightarrow> (0::'a) \<le> ?a1

goal (1 subgoal):
 1. a = (0::'a)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
sup a (- a) = (0::'a)
[PROOF STEP]
have **: "sup (-a) (-(-a)) = 0"
[PROOF STATE]
proof (prove)
using this:
sup a (- a) = (0::'a)

goal (1 subgoal):
 1. sup (- a) (- (- a)) = (0::'a)
[PROOF STEP]
by (simp add: sup_commute)
[PROOF STATE]
proof (state)
this:
sup (- a) (- (- a)) = (0::'a)

goal (1 subgoal):
 1. a = (0::'a)
[PROOF STEP]
from pos[OF assms] pos[OF **]
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<le> a
(0::'a) \<le> - a
[PROOF STEP]
show "a = 0"
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> a
(0::'a) \<le> - a

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pathimage_offset[simp]:
  fixes g :: "_ \<Rightarrow> 'b::topological_group_add"
  shows "p \<in> path_image (\<lambda>t. g t - z) \<longleftrightarrow> p+z \<in> path_image g "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<in> path_image (\<lambda>t. g t - z)) = (p + z \<in> path_image g)
[PROOF STEP]
unfolding path_image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<in> (\<lambda>t. g t - z) ` {0..1}) = (p + z \<in> g ` {0..1})
[PROOF STEP]
by (auto simp:algebra_simps)


[STATEMENT]
lemma setOfPairsEquality:
  "{(fst pair, {y})| y pair. y \<in> snd pair & pair \<in> X} =
   {(fst pair, Y)| Y pair. Y \<in> finestpart (snd pair) & pair \<in> X}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(fst pair, {y}) |y pair. y \<in> snd pair \<and> pair \<in> X} = {(fst pair, Y) |Y pair. Y \<in> finestpart (snd pair) \<and> pair \<in> X}
[PROOF STEP]
using finestpart_def
[PROOF STATE]
proof (prove)
using this:
finestpart ?X = (\<lambda>x. {x}) ` ?X

goal (1 subgoal):
 1. {(fst pair, {y}) |y pair. y \<in> snd pair \<and> pair \<in> X} = {(fst pair, Y) |Y pair. Y \<in> finestpart (snd pair) \<and> pair \<in> X}
[PROOF STEP]
by fastforce


[STATEMENT]
lemma dim_null_space_iarray[code_unfold]:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}"
  shows "vec.dim (null_space A) = ncols_iarray (matrix_to_iarray A) - rank_iarray (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (null_space A) = ncols_iarray (matrix_to_iarray A) - rank_iarray (matrix_to_iarray A)
[PROOF STEP]
unfolding dim_null_space ncols_eq_card_columns matrix_to_iarray_rank dimension_vector
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('columns) - rank_iarray (matrix_to_iarray A) = CARD('columns) - rank_iarray (matrix_to_iarray A)
[PROOF STEP]
by simp


[STATEMENT]
lemma eventually_all_iff: "eventually (\<lambda>x. \<forall>y. P x y) F = (\<forall>Y. eventually (\<lambda>x. P x (Y x)) F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<^sub>F x in F. \<forall>y. P x y) = (\<forall>Y. \<forall>\<^sub>F x in F. P x (Y x))
[PROOF STEP]
using frequently_all[of P F]
[PROOF STATE]
proof (prove)
using this:
(\<exists>\<^sub>F x in F. \<forall>y. P x y) = (\<forall>Y. \<exists>\<^sub>F x in F. P x (Y x))

goal (1 subgoal):
 1. (\<forall>\<^sub>F x in F. \<forall>y. P x y) = (\<forall>Y. \<forall>\<^sub>F x in F. P x (Y x))
[PROOF STEP]
by (simp add: frequently_eq_eventually)


[STATEMENT]
lemma poly_mult_r_distr:
  assumes "subring K R" "polynomial K p1" "polynomial K p2" "polynomial K p3"
  shows "poly_mult p1 (poly_add p2 p3) = poly_add (poly_mult p1 p2) (poly_mult p1 p3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult p1 (poly_add p2 p3) = poly_add (poly_mult p1 p2) (poly_mult p1 p3)
[PROOF STEP]
using poly_mult_r_distr' polynomial_in_carrier assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?p1.0 \<subseteq> carrier R; set ?p2.0 \<subseteq> carrier R; set ?p3.0 \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ?p1.0 (poly_add ?p2.0 ?p3.0) = poly_add (poly_mult ?p1.0 ?p2.0) (poly_mult ?p1.0 ?p3.0)
\<lbrakk>subring ?K R; polynomial ?K ?p\<rbrakk> \<Longrightarrow> set ?p \<subseteq> carrier R
subring K R
polynomial K p1
polynomial K p2
polynomial K p3

goal (1 subgoal):
 1. poly_mult p1 (poly_add p2 p3) = poly_add (poly_mult p1 p2) (poly_mult p1 p3)
[PROOF STEP]
by auto


[STATEMENT]
lemma isLub_lub: "(\<exists>L. isLub S cl L) = isLub S cl (lub S cl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>L. isLub S cl L) = isLub S cl (lub S cl)
[PROOF STEP]
by (simp add: lub_def least_def isLub_def some_eq_ex [symmetric])


[STATEMENT]
lemma lbound_leq:
  assumes "A \<subseteq> B"
  shows "lbound A \<le>lbound B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lbound A \<le> lbound B
[PROOF STEP]
unfolding lbound_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (principal_subs I ` {S \<in> I. Ball A ((\<subseteq>) S)}) \<le> Inf (principal_subs I ` {S \<in> I. Ball B ((\<subseteq>) S)})
[PROOF STEP]
apply (rule Inf_superset_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. principal_subs I ` {S \<in> I. Ball B ((\<subseteq>) S)} \<subseteq> principal_subs I ` {S \<in> I. Ball A ((\<subseteq>) S)}
[PROOF STEP]
apply (rule image_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {S \<in> I. Ball B ((\<subseteq>) S)} \<subseteq> {S \<in> I. Ball A ((\<subseteq>) S)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B

goal (1 subgoal):
 1. {S \<in> I. Ball B ((\<subseteq>) S)} \<subseteq> {S \<in> I. Ball A ((\<subseteq>) S)}
[PROOF STEP]
by auto


[STATEMENT]
lemma con_Suc_card_arcs_eq_card_verts:
  assumes "graph G"
      and "connected G"
      and "Suc n = card (verts G)"
    shows "Suc (card (arcs T)) = card (verts G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (card (arcs T)) = card (verts G)
[PROOF STEP]
using Suc_card_arcs_eq_card_verts connected_verts_G_eq_T assms
[PROOF STATE]
proof (prove)
using this:
finite (verts T) \<Longrightarrow> Suc (card (arcs T)) = card (verts T)
\<lbrakk>graph G; Digraph_Component.connected G; Suc n = card (verts G)\<rbrakk> \<Longrightarrow> verts T = verts G
graph G
Digraph_Component.connected G
Suc n = card (verts G)

goal (1 subgoal):
 1. Suc (card (arcs T)) = card (verts G)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma  finite_bounded_functions:
  assumes fS: "finite S"
  shows "finite {f. (\<forall>i \<in> {1.. (k::nat)}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1 .. k} \<longrightarrow> f i = i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)}
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite {f. (\<forall>i\<in>{1..0}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..0} \<longrightarrow> f i = i)}
 2. \<And>k. finite {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)} \<Longrightarrow> finite {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. finite {f. (\<forall>i\<in>{1..0}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..0} \<longrightarrow> f i = i)}
 2. \<And>k. finite {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)} \<Longrightarrow> finite {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}
[PROOF STEP]
have *: "{f. \<forall>i. f i = i} = {id}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f. \<forall>i. f i = i} = {id}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{f. \<forall>i. f i = i} = {id}

goal (2 subgoals):
 1. finite {f. (\<forall>i\<in>{1..0}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..0} \<longrightarrow> f i = i)}
 2. \<And>k. finite {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)} \<Longrightarrow> finite {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {f. (\<forall>i\<in>{1..0}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..0} \<longrightarrow> f i = i)}
[PROOF STEP]
by (auto simp: *)
[PROOF STATE]
proof (state)
this:
finite {f. (\<forall>i\<in>{1..0}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..0} \<longrightarrow> f i = i)}

goal (1 subgoal):
 1. \<And>k. finite {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)} \<Longrightarrow> finite {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. finite {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)} \<Longrightarrow> finite {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
finite {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)}

goal (1 subgoal):
 1. \<And>k. finite {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)} \<Longrightarrow> finite {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}
[PROOF STEP]
let ?f = "\<lambda>(y::nat,g) i. if i = Suc k then y else g i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. finite {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)} \<Longrightarrow> finite {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}
[PROOF STEP]
let ?S = "?f ` (S \<times> {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)})"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. finite {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)} \<Longrightarrow> finite {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}
[PROOF STEP]
have "?S = {f. (\<forall>i\<in>{1.. Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1.. Suc k} \<longrightarrow> f i = i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(y, g) i. if i = Suc k then y else g i) ` (S \<times> {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)}) = {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}
[PROOF STEP]
apply (auto simp: image_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i\<in>{Suc 0..Suc k}. x i \<in> S; \<forall>i. (Suc 0 \<le> i \<longrightarrow> \<not> i \<le> Suc k) \<longrightarrow> x i = i\<rbrakk> \<Longrightarrow> \<exists>xa\<in>S. \<exists>y. (\<forall>i\<in>{Suc 0..k}. y i \<in> S) \<and> (\<forall>i. (Suc 0 \<le> i \<longrightarrow> \<not> i \<le> k) \<longrightarrow> y i = i) \<and> x = (\<lambda>i. if i = Suc k then xa else y i)
[PROOF STEP]
apply (rename_tac f)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. \<lbrakk>\<forall>i\<in>{Suc 0..Suc k}. f i \<in> S; \<forall>i. (Suc 0 \<le> i \<longrightarrow> \<not> i \<le> Suc k) \<longrightarrow> f i = i\<rbrakk> \<Longrightarrow> \<exists>x\<in>S. \<exists>y. (\<forall>i\<in>{Suc 0..k}. y i \<in> S) \<and> (\<forall>i. (Suc 0 \<le> i \<longrightarrow> \<not> i \<le> k) \<longrightarrow> y i = i) \<and> f = (\<lambda>i. if i = Suc k then x else y i)
[PROOF STEP]
apply (rule_tac x="f (Suc k)" in bexI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>f. \<lbrakk>\<forall>i\<in>{Suc 0..Suc k}. f i \<in> S; \<forall>i. (Suc 0 \<le> i \<longrightarrow> \<not> i \<le> Suc k) \<longrightarrow> f i = i\<rbrakk> \<Longrightarrow> \<exists>y. (\<forall>i\<in>{Suc 0..k}. y i \<in> S) \<and> (\<forall>i. (Suc 0 \<le> i \<longrightarrow> \<not> i \<le> k) \<longrightarrow> y i = i) \<and> f = (\<lambda>i. if i = Suc k then f (Suc k) else y i)
 2. \<And>f. \<lbrakk>\<forall>i\<in>{Suc 0..Suc k}. f i \<in> S; \<forall>i. (Suc 0 \<le> i \<longrightarrow> \<not> i \<le> Suc k) \<longrightarrow> f i = i\<rbrakk> \<Longrightarrow> f (Suc k) \<in> S
[PROOF STEP]
apply (rule_tac x = "\<lambda>i. if i = Suc k then i else f i" in exI, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<lambda>(y, g) i. if i = Suc k then y else g i) ` (S \<times> {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)}) = {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}

goal (1 subgoal):
 1. \<And>k. finite {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)} \<Longrightarrow> finite {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}
[PROOF STEP]
with finite_imageI[OF finite_cartesian_product[OF fS Suc.hyps(1)], of ?f]
[PROOF STATE]
proof (chain)
picking this:
finite ((\<lambda>(y, g) i. if i = Suc k then y else g i) ` (S \<times> {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)}))
(\<lambda>(y, g) i. if i = Suc k then y else g i) ` (S \<times> {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)}) = {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite ((\<lambda>(y, g) i. if i = Suc k then y else g i) ` (S \<times> {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)}))
(\<lambda>(y, g) i. if i = Suc k then y else g i) ` (S \<times> {f. (\<forall>i\<in>{1..k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..k} \<longrightarrow> f i = i)}) = {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}

goal (1 subgoal):
 1. finite {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
finite {f. (\<forall>i\<in>{1..Suc k}. f i \<in> S) \<and> (\<forall>i. i \<notin> {1..Suc k} \<longrightarrow> f i = i)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma HComplex_inverse: "\<And>x y. inverse (HComplex x y) = HComplex (x / (x\<^sup>2 + y\<^sup>2)) (- y / (x\<^sup>2 + y\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. inverse (HComplex x y) = HComplex (x / (x\<^sup>2 + y\<^sup>2)) (- y / (x\<^sup>2 + y\<^sup>2))
[PROOF STEP]
by transfer (rule complex_inverse)


[STATEMENT]
lemma projection_insert:
  fixes a :: \<open>'a::chilbert_space\<close>
  assumes a1: "\<And>s. s \<in> S \<Longrightarrow> is_orthogonal a s"
  shows "projection (closure (cspan (insert a S))) u
        = projection (cspan {a}) u + projection (closure (cspan S)) u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. projection (closure (cspan (insert a S))) u = projection (cspan {a}) u + projection (closure (cspan S)) u
[PROOF STEP]
using is_projection_on_insert[where S=S, OF a1]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>s. s \<in> S \<Longrightarrow> s \<in> S; is_projection_on ?\<pi> (closure (cspan S)); is_projection_on ?\<pi>a (cspan {a})\<rbrakk> \<Longrightarrow> is_projection_on (\<lambda>x. ?\<pi>a x + ?\<pi> x) (closure (cspan (insert a S)))

goal (1 subgoal):
 1. projection (closure (cspan (insert a S))) u = projection (cspan {a}) u + projection (closure (cspan S)) u
[PROOF STEP]
by (metis (no_types, lifting) closed_closure closed_csubspace.intro closure_is_csubspace complex_vector.subspace_span csubspace_is_convex finite.intros(1) finite.intros(2) finite_cspan_closed_csubspace projection_eqI' projection_is_projection_on')


[STATEMENT]
lemma even_or_odd:
  fixes n :: nat
  shows "\<exists>i. (n = 2*i) \<or> (n=2*i+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. n = 2 * i \<or> n = 2 * i + 1
[PROOF STEP]
by (induct n) (presburger)+


[STATEMENT]
lemma scalar7_triple1: "x \<bullet> (y \<times>\<^sub>7 z) = y \<bullet> (z \<times>\<^sub>7 x)"
 and  scalar7_triple2: "x \<bullet> (y \<times>\<^sub>7 z) = z \<bullet> (x \<times>\<^sub>7 y )   "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bullet> y \<times>\<^sub>7 z = y \<bullet> z \<times>\<^sub>7 x &&& x \<bullet> y \<times>\<^sub>7 z = z \<bullet> x \<times>\<^sub>7 y
[PROOF STEP]
by (simp_all add: cross7_def inner_vec_def sum_7 vec_eq_iff algebra_simps)


[STATEMENT]
lemma mset_neg_diff[simp]:
  "mset_neg (A - B) = (mset_neg A - mset_neg B) + (mset_pos B - mset_pos A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset_neg (A - B) = mset_neg A - mset_neg B + (mset_pos B - mset_pos A)
[PROOF STEP]
by (rule mset_neg_plus[of A "- B", simplified])


[STATEMENT]
lemma subset_oc_segment:
  fixes a :: "'a::euclidean_space"
  shows "open_segment a b \<subseteq> closed_segment c d \<longleftrightarrow>
         a = b \<or> a \<in> closed_segment c d \<and> b \<in> closed_segment c d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (open_segment a b \<subseteq> closed_segment c d) = (a = b \<or> a \<in> closed_segment c d \<and> b \<in> closed_segment c d)
[PROOF STEP]
apply (simp add: subset_open_segment [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (open_segment a b \<subseteq> closed_segment c d) = (open_segment a b \<subseteq> open_segment c d)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. open_segment a b \<subseteq> closed_segment c d \<Longrightarrow> open_segment a b \<subseteq> open_segment c d
 2. open_segment a b \<subseteq> open_segment c d \<Longrightarrow> open_segment a b \<subseteq> closed_segment c d
[PROOF STEP]
apply (metis closure_closed_segment closure_mono closure_open_segment subset_closed_segment subset_open_segment)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment a b \<subseteq> open_segment c d \<Longrightarrow> open_segment a b \<subseteq> closed_segment c d
[PROOF STEP]
apply (meson dual_order.trans segment_open_subset_closed)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sq_mtx_norm_times: "\<parallel>A * B\<parallel> \<le> (\<parallel>A\<parallel>) * (\<parallel>B\<parallel>)" for A :: "'a sq_mtx"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A * B\<parallel> \<le> \<parallel>A\<parallel> * \<parallel>B\<parallel>
[PROOF STEP]
unfolding norm_sq_mtx_def times_sq_mtx_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>to_vec (map_fun to_vec (map_fun to_vec to_mtx) (**) A B)\<parallel>\<^sub>o\<^sub>p \<le> (\<parallel>to_vec A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>to_vec B\<parallel>\<^sub>o\<^sub>p)
[PROOF STEP]
by(simp add: op_norm_matrix_matrix_mult_le)


[STATEMENT]
lemma one_less_floor [simp]: "1 < \<lfloor>x\<rfloor> \<longleftrightarrow> 2 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 < \<lfloor>x\<rfloor>) = ((2::'a) \<le> x)
[PROOF STEP]
by (simp add: less_floor_iff)


[STATEMENT]
lemma monomial_single_power:
  "(monomial c (Poly_Mapping.single x k)) ^ n = monomial (c ^ n) (Poly_Mapping.single x (k * n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monomial c (monomial k x) ^ n = monomial (c ^ n) (monomial (k * n) x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. monomial c (monomial k x) ^ n = monomial (c ^ n) (monomial (k * n) x)
[PROOF STEP]
have eq: "(\<Sum>i = 0..<n. Poly_Mapping.single x k) = Poly_Mapping.single x (k * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. monomial k x) = monomial (k * n) x
[PROOF STEP]
by (induct n, simp_all add: add.commute single_add)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. monomial k x) = monomial (k * n) x

goal (1 subgoal):
 1. monomial c (monomial k x) ^ n = monomial (c ^ n) (monomial (k * n) x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monomial c (monomial k x) ^ n = monomial (c ^ n) (monomial (k * n) x)
[PROOF STEP]
by (simp add: punit.monomial_power eq)
[PROOF STATE]
proof (state)
this:
monomial c (monomial k x) ^ n = monomial (c ^ n) (monomial (k * n) x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "pi / 4 = (4::real) * arctan (1 / 5) - arctan (1 / 239)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi / 4 = 4 * arctan (1 / 5) - arctan (1 / 239)
[PROOF STEP]
by machin


[STATEMENT]
lemma inner_prod_smult_right:
  fixes u v :: "complex vec"
  assumes dimu: "u \<in> carrier_vec n" and dimv:"v \<in> carrier_vec n"
  shows "inner_prod (a \<cdot>\<^sub>v u) v = conjugate a * inner_prod u v" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod (a \<cdot>\<^sub>v u) v = conjugate a * inner_prod u v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<in> carrier_vec n
v \<in> carrier_vec n

goal (1 subgoal):
 1. inner_prod (a \<cdot>\<^sub>v u) v = conjugate a * inner_prod u v
[PROOF STEP]
apply (simp add: scalar_prod_def conjugate_dist_mul)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> carrier_vec n; v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n. v $ i * (cnj a * cnj (u $ i))) = cnj a * (\<Sum>i = 0..<n. v $ i * cnj (u $ i))
[PROOF STEP]
apply (subst sum_distrib_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> carrier_vec n; v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n. v $ i * (cnj a * cnj (u $ i))) = (\<Sum>n = 0..<n. cnj a * (v $ n * cnj (u $ n)))
[PROOF STEP]
by (rule sum.cong, auto)


[STATEMENT]
lemma finite_UNIV_llength_le:
    assumes "finite (UNIV :: 'a set)"
    shows "finite {w :: 'a llist. llength w \<le> enat n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {w. llength w \<le> enat n}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {w. llength w \<le> enat n}
[PROOF STEP]
have 1: "{w. llength w \<le> enat n} = (\<Union> k \<le> n. {w. llength w = enat k})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {w. llength w \<le> enat n} = (\<Union>k\<le>n. {w. llength w = enat k})
[PROOF STEP]
by (auto, metis atMost_iff enat_ile enat_ord_simps(1))
[PROOF STATE]
proof (state)
this:
{w. llength w \<le> enat n} = (\<Union>k\<le>n. {w. llength w = enat k})

goal (1 subgoal):
 1. finite {w. llength w \<le> enat n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {w. llength w \<le> enat n}
[PROOF STEP]
unfolding 1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Union>k\<le>n. {w. llength w = enat k})
[PROOF STEP]
using finite_UNIV_llength_eq assms
[PROOF STATE]
proof (prove)
using this:
finite UNIV \<Longrightarrow> finite {w. llength w = enat ?n}
finite UNIV

goal (1 subgoal):
 1. finite (\<Union>k\<le>n. {w. llength w = enat k})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {w. llength w \<le> enat n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma winding_number_subpath_combine:
  assumes "path g" and notin: "z \<notin> path_image g" and "u \<in> {0..1}" "v \<in> {0..1}" "w \<in> {0..1}"
  shows "winding_number (subpath u v g) z + winding_number (subpath v w g) z =
         winding_number (subpath u w g) z" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u w g) z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u w g) z
[PROOF STEP]
have "?lhs = winding_number (subpath u v g +++ subpath v w g) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u v g +++ subpath v w g) z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
path g
z \<notin> path_image g
u \<in> {0..1}
v \<in> {0..1}
w \<in> {0..1}

goal (1 subgoal):
 1. winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u v g +++ subpath v w g) z
[PROOF STEP]
by (metis (no_types, lifting) path_image_subpath_subset path_subpath pathfinish_subpath pathstart_subpath subsetD winding_number_join)
[PROOF STATE]
proof (state)
this:
winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u v g +++ subpath v w g) z

goal (1 subgoal):
 1. winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u w g) z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u v g +++ subpath v w g) z

goal (1 subgoal):
 1. winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u w g) z
[PROOF STEP]
have "... = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (subpath u v g +++ subpath v w g) z = winding_number (subpath u w g) z
[PROOF STEP]
by (meson assms homotopic_join_subpaths subset_Compl_singleton winding_number_homotopic_paths)
[PROOF STATE]
proof (state)
this:
winding_number (subpath u v g +++ subpath v w g) z = winding_number (subpath u w g) z

goal (1 subgoal):
 1. winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u w g) z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u w g) z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u w g) z

goal (1 subgoal):
 1. winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u w g) z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
winding_number (subpath u v g) z + winding_number (subpath v w g) z = winding_number (subpath u w g) z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_add_commuting: "x * y = y * x \<Longrightarrow> exp (x + y) = exp x * exp y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * y = y * x \<Longrightarrow> exp (x + y) = exp x * exp y
[PROOF STEP]
by (simp only: exp_def Cauchy_product summable_norm_exp exp_series_add_commuting)


[STATEMENT]
lemma coeff_prod_linear_factors:
  fixes f :: "'a \<Rightarrow> 'b :: comm_ring_1"
  assumes [intro]: "finite A"
  shows "Polynomial.coeff (\<Prod>x\<in>A. [:-f x, 1:] ^ e x) i =
           (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X.
             (-1) ^ card X * (\<Prod>x\<in>X. f (fst x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
define poly_X where "poly_X = (Polynomial.monom 1 1 :: 'b poly)"
[PROOF STATE]
proof (state)
this:
poly_X = Polynomial.monom (1::'b) 1

goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
have [simp]: "(- 1) ^ n = [:(- 1) ^ n :: 'b:]" for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ n = [:(- (1::'b)) ^ n:]
[PROOF STEP]
by (simp flip: pCons_one add: poly_const_pow)
[PROOF STATE]
proof (state)
this:
(- 1) ^ ?n = [:(- (1::'b)) ^ ?n:]

goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
have "(\<Prod>x\<in>A. [:-f x, 1:] ^ e x) = (\<Prod>(x,_)\<in>Sigma A (\<lambda>x. {..<e x}). [:-f x, 1:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) = (\<Prod>(x, uu_)\<in>(SIGMA x:A. {..<e x}). [:- f x, 1::'b:])
[PROOF STEP]
by (subst prod.Sigma [symmetric]) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) = (\<Prod>(x, uu_)\<in>(SIGMA x:A. {..<e x}). [:- f x, 1::'b:])

goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) = (\<Prod>(x, uu_)\<in>(SIGMA x:A. {..<e x}). [:- f x, 1::'b:])

goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
have "\<dots> = (\<Prod>(x,_)\<in>Sigma A (\<lambda>x. {..<e x}). poly_X - [:f x:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>(x, uu_)\<in>(SIGMA x:A. {..<e x}). [:- f x, 1::'b:]) = (\<Prod>(x, uu_)\<in>(SIGMA x:A. {..<e x}). poly_X - [:f x:])
[PROOF STEP]
by (intro prod.cong) (auto simp: poly_X_def monom_altdef)
[PROOF STATE]
proof (state)
this:
(\<Prod>(x, uu_)\<in>(SIGMA x:A. {..<e x}). [:- f x, 1::'b:]) = (\<Prod>(x, uu_)\<in>(SIGMA x:A. {..<e x}). poly_X - [:f x:])

goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>(x, uu_)\<in>(SIGMA x:A. {..<e x}). [:- f x, 1::'b:]) = (\<Prod>(x, uu_)\<in>(SIGMA x:A. {..<e x}). poly_X - [:f x:])

goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
have "\<dots> = (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}).
                    Polynomial.smult ((-1) ^ card X * (\<Prod>x\<in>X. f (fst x)))
                    (poly_X ^ card ((SIGMA x:A. {..<e x}) - X)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>(x, uu_)\<in>(SIGMA x:A. {..<e x}). poly_X - [:f x:]) = (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.smult ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (poly_X ^ card ((SIGMA x:A. {..<e x}) - X)))
[PROOF STEP]
unfolding case_prod_unfold
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>(SIGMA x:A. {..<e x}). poly_X - [:f (fst p):]) = (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.smult ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (poly_X ^ card ((SIGMA x:A. {..<e x}) - X)))
[PROOF STEP]
by (subst prod_diff1) (auto simp: mult_ac simp flip: coeff_lift_hom.hom_prod)
[PROOF STATE]
proof (state)
this:
(\<Prod>(x, uu_)\<in>(SIGMA x:A. {..<e x}). poly_X - [:f x:]) = (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.smult ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (poly_X ^ card ((SIGMA x:A. {..<e x}) - X)))

goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>(x, uu_)\<in>(SIGMA x:A. {..<e x}). poly_X - [:f x:]) = (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.smult ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (poly_X ^ card ((SIGMA x:A. {..<e x}) - X)))

goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
have "\<dots> = (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}).
       Polynomial.monom ((- 1) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.smult ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (poly_X ^ card ((SIGMA x:A. {..<e x}) - X))) = (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X)))
[PROOF STEP]
unfolding poly_X_def monom_power Polynomial.smult_monom
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)) * (1::'b) ^ card ((SIGMA x:A. {..<e x}) - X)) (1 * card ((SIGMA x:A. {..<e x}) - X))) = (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.smult ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (poly_X ^ card ((SIGMA x:A. {..<e x}) - X))) = (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X)))

goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.smult ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (poly_X ^ card ((SIGMA x:A. {..<e x}) - X))) = (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X)))

goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
have "Polynomial.coeff \<dots> i = (\<Sum>X\<in>{X\<in>Pow (SIGMA x:A. {..<e x}). i =
               sum e A - card X}. (- 1) ^ card X * (\<Prod>x\<in>X. f (fst x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly.coeff (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X))) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
unfolding Polynomial.coeff_sum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>Pow (SIGMA x:A. {..<e x}). poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i) = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
proof (intro sum.mono_neutral_cong_right ballI, goal_cases)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>ia. ia \<in> Pow (SIGMA x:A. {..<e x}) - {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card ia * (\<Prod>x\<in>ia. f (fst x))) (card ((SIGMA x:A. {..<e x}) - ia))) i = (0::'b)
 4. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
case (3 X)
[PROOF STATE]
proof (state)
this:
X \<in> Pow (SIGMA x:A. {..<e x}) - {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X}

goal (4 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>ia. ia \<in> Pow (SIGMA x:A. {..<e x}) - {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card ia * (\<Prod>x\<in>ia. f (fst x))) (card ((SIGMA x:A. {..<e x}) - ia))) i = (0::'b)
 4. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
hence X: "X \<subseteq> (SIGMA x:A. {..<e x})"
[PROOF STATE]
proof (prove)
using this:
X \<in> Pow (SIGMA x:A. {..<e x}) - {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X}

goal (1 subgoal):
 1. X \<subseteq> (SIGMA x:A. {..<e x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X \<subseteq> (SIGMA x:A. {..<e x})

goal (4 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>ia. ia \<in> Pow (SIGMA x:A. {..<e x}) - {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card ia * (\<Prod>x\<in>ia. f (fst x))) (card ((SIGMA x:A. {..<e x}) - ia))) i = (0::'b)
 4. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
have card_le: "card X \<le> card (SIGMA x:A. {..<e x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card X \<le> card (SIGMA x:A. {..<e x})
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> (SIGMA x:A. {..<e x})

goal (1 subgoal):
 1. card X \<le> card (SIGMA x:A. {..<e x})
[PROOF STEP]
by (intro card_mono) auto
[PROOF STATE]
proof (state)
this:
card X \<le> card (SIGMA x:A. {..<e x})

goal (4 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>ia. ia \<in> Pow (SIGMA x:A. {..<e x}) - {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card ia * (\<Prod>x\<in>ia. f (fst x))) (card ((SIGMA x:A. {..<e x}) - ia))) i = (0::'b)
 4. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
have "finite X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite X
[PROOF STEP]
by (rule finite_subset[OF X]) auto
[PROOF STATE]
proof (state)
this:
finite X

goal (4 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>ia. ia \<in> Pow (SIGMA x:A. {..<e x}) - {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card ia * (\<Prod>x\<in>ia. f (fst x))) (card ((SIGMA x:A. {..<e x}) - ia))) i = (0::'b)
 4. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
hence "card ((SIGMA x:A. {..<e x}) - X) = card (SIGMA x:A. {..<e x}) - card X"
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. card ((SIGMA x:A. {..<e x}) - X) = card (SIGMA x:A. {..<e x}) - card X
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
finite X
X \<in> Pow (SIGMA x:A. {..<e x}) - {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X}

goal (1 subgoal):
 1. card ((SIGMA x:A. {..<e x}) - X) = card (SIGMA x:A. {..<e x}) - card X
[PROOF STEP]
by (intro card_Diff_subset) auto
[PROOF STATE]
proof (state)
this:
card ((SIGMA x:A. {..<e x}) - X) = card (SIGMA x:A. {..<e x}) - card X

goal (4 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>ia. ia \<in> Pow (SIGMA x:A. {..<e x}) - {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card ia * (\<Prod>x\<in>ia. f (fst x))) (card ((SIGMA x:A. {..<e x}) - ia))) i = (0::'b)
 4. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((SIGMA x:A. {..<e x}) - X) = card (SIGMA x:A. {..<e x}) - card X

goal (4 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>ia. ia \<in> Pow (SIGMA x:A. {..<e x}) - {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card ia * (\<Prod>x\<in>ia. f (fst x))) (card ((SIGMA x:A. {..<e x}) - ia))) i = (0::'b)
 4. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
have card_eq: "card (SIGMA x:A. {..<e x}) = sum e A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (SIGMA x:A. {..<e x}) = sum e A
[PROOF STEP]
by (subst card_SigmaI) auto
[PROOF STATE]
proof (state)
this:
card (SIGMA x:A. {..<e x}) = sum e A

goal (4 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>ia. ia \<in> Pow (SIGMA x:A. {..<e x}) - {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card ia * (\<Prod>x\<in>ia. f (fst x))) (card ((SIGMA x:A. {..<e x}) - ia))) i = (0::'b)
 4. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card ((SIGMA x:A. {..<e x}) - X) = sum e A - card X
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card ((SIGMA x:A. {..<e x}) - X) = sum e A - card X

goal (1 subgoal):
 1. poly.coeff (Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X))) i = (0::'b)
[PROOF STEP]
using 3 card_le card_eq
[PROOF STATE]
proof (prove)
using this:
card ((SIGMA x:A. {..<e x}) - X) = sum e A - card X
X \<in> Pow (SIGMA x:A. {..<e x}) - {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X}
card X \<le> card (SIGMA x:A. {..<e x})
card (SIGMA x:A. {..<e x}) = sum e A

goal (1 subgoal):
 1. poly.coeff (Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X))) i = (0::'b)
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
poly.coeff (Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X))) i = (0::'b)

goal (3 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
case (4 X)
[PROOF STATE]
proof (state)
this:
X \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X}

goal (3 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
hence X: "X \<subseteq> (SIGMA x:A. {..<e x})"
[PROOF STATE]
proof (prove)
using this:
X \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X}

goal (1 subgoal):
 1. X \<subseteq> (SIGMA x:A. {..<e x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X \<subseteq> (SIGMA x:A. {..<e x})

goal (3 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
have "finite X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite X
[PROOF STEP]
by (rule finite_subset[OF X]) auto
[PROOF STATE]
proof (state)
this:
finite X

goal (3 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
hence "card ((SIGMA x:A. {..<e x}) - X) = card (SIGMA x:A. {..<e x}) - card X"
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. card ((SIGMA x:A. {..<e x}) - X) = card (SIGMA x:A. {..<e x}) - card X
[PROOF STEP]
using 4
[PROOF STATE]
proof (prove)
using this:
finite X
X \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X}

goal (1 subgoal):
 1. card ((SIGMA x:A. {..<e x}) - X) = card (SIGMA x:A. {..<e x}) - card X
[PROOF STEP]
by (intro card_Diff_subset) auto
[PROOF STATE]
proof (state)
this:
card ((SIGMA x:A. {..<e x}) - X) = card (SIGMA x:A. {..<e x}) - card X

goal (3 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((SIGMA x:A. {..<e x}) - X) = card (SIGMA x:A. {..<e x}) - card X

goal (3 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
have card_eq: "card (SIGMA x:A. {..<e x}) = sum e A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (SIGMA x:A. {..<e x}) = sum e A
[PROOF STEP]
by (subst card_SigmaI) auto
[PROOF STATE]
proof (state)
this:
card (SIGMA x:A. {..<e x}) = sum e A

goal (3 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
 3. \<And>x. x \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<Longrightarrow> poly.coeff (Polynomial.monom ((- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))) (card ((SIGMA x:A. {..<e x}) - x))) i = (- (1::'b)) ^ card x * (\<Prod>x\<in>x. f (fst x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card ((SIGMA x:A. {..<e x}) - X) = sum e A - card X
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card ((SIGMA x:A. {..<e x}) - X) = sum e A - card X

goal (1 subgoal):
 1. poly.coeff (Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X))) i = (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))
[PROOF STEP]
using 4 card_eq
[PROOF STATE]
proof (prove)
using this:
card ((SIGMA x:A. {..<e x}) - X) = sum e A - card X
X \<in> {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X}
card (SIGMA x:A. {..<e x}) = sum e A

goal (1 subgoal):
 1. poly.coeff (Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X))) i = (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
poly.coeff (Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X))) i = (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))

goal (2 subgoals):
 1. finite (Pow (SIGMA x:A. {..<e x}))
 2. {X \<in> Pow (SIGMA x:A. {..<e x}). i = sum e A - card X} \<subseteq> Pow (SIGMA x:A. {..<e x})
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
poly.coeff (\<Sum>X\<in>Pow (SIGMA x:A. {..<e x}). Polynomial.monom ((- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x))) (card ((SIGMA x:A. {..<e x}) - X))) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))

goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))

goal (1 subgoal):
 1. poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poly.coeff (\<Prod>x\<in>A. [:- f x, 1::'b:] ^ e x) i = (\<Sum>X | X \<in> Pow (SIGMA x:A. {..<e x}) \<and> i = sum e A - card X. (- (1::'b)) ^ card X * (\<Prod>x\<in>X. f (fst x)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_vector_derivative_linepath_within [derivative_intros]:
  assumes [derivative_intros]:
    "(f has_vector_derivative f') (at x within S)" "(g has_vector_derivative g') (at x within S)"
    "(h has_real_derivative h') (at x within S)"
  shows "((\<lambda>x. linepath (f x) (g x) (h x)) has_vector_derivative
           (1 - h x) *\<^sub>R f' + h x *\<^sub>R g' - h' *\<^sub>R (f x - g x)) (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. linepath (f x) (g x) (h x)) has_vector_derivative (1 - h x) *\<^sub>R f' + h x *\<^sub>R g' - h' *\<^sub>R (f x - g x)) (at x within S)
[PROOF STEP]
unfolding linepath_def [abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (1 - h x) *\<^sub>R f x + h x *\<^sub>R g x) has_vector_derivative (1 - h x) *\<^sub>R f' + h x *\<^sub>R g' - h' *\<^sub>R (f x - g x)) (at x within S)
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: field_simps scaleR_diff_right)


[STATEMENT]
lemma vector_sub_project_orthogonal_cart: "(b::real^'n) \<bullet> (x - ((b \<bullet> x) / (b \<bullet> b)) *s b) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<bullet> (x - b \<bullet> x / (b \<bullet> b) *s b) = 0
[PROOF STEP]
unfolding inner_simps scalar_mult_eq_scaleR
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<bullet> x - b \<bullet> x / (b \<bullet> b) * (b \<bullet> b) = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma convolution_eq:
  "sum (\<lambda>i. a (i :: nat) * b (n - i)) {0 .. n} =
    sum (\<lambda>(i,j). a i * b j) {(i,j). i \<le> n \<and> j \<le> n \<and> i + j = n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. a i * b (n - i)) = (\<Sum>(i, j)\<in>{(i, j). i \<le> n \<and> j \<le> n \<and> i + j = n}. a i * b j)
[PROOF STEP]
by (rule sum.reindex_bij_witness[where i=fst and j="\<lambda>i. (i, n - i)"]) auto


[STATEMENT]
lemma hyp_inverse_diff:
  fixes a b :: "('a :: {inverse, comm_ring_1, division_ring}) hyperdual"
  assumes a: "Base a \<noteq> 0"
      and b: "Base b \<noteq> 0"
    shows "inverse a - inverse b = inverse a * (b - a) * inverse b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse a - inverse b = inverse a * (b - a) * inverse b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inverse a - inverse b = inverse a * (b - a) * inverse b
[PROOF STEP]
have x: "inverse a - inverse b = inverse b * (inverse a * b - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse a - inverse b = inverse b * (inverse a * b - 1)
[PROOF STEP]
by (simp add: b mult.left_commute right_diff_distrib')
[PROOF STATE]
proof (state)
this:
inverse a - inverse b = inverse b * (inverse a * b - 1)

goal (1 subgoal):
 1. inverse a - inverse b = inverse a * (b - a) * inverse b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse a - inverse b = inverse a * (b - a) * inverse b
[PROOF STEP]
by (simp add: x a mult.commute right_diff_distrib')
[PROOF STATE]
proof (state)
this:
inverse a - inverse b = inverse a * (b - a) * inverse b

goal:
No subgoals!
[PROOF STEP]
qed