[STATEMENT]
lemma Hermite_Lindemann_aux2:
  fixes X :: "complex set" and \<beta> :: "complex \<Rightarrow> int"
  assumes "finite X"
  assumes nz:   "\<And>x. x \<in> X \<Longrightarrow> \<beta> x \<noteq> 0"
  assumes alg:  "\<And>x. x \<in> X \<Longrightarrow> algebraic x"
  assumes sum0: "(\<Sum>x\<in>X. of_int (\<beta> x) * exp x) = 0"
  shows   "X = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X = {}
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
assume "X \<noteq> {}"
[PROOF STATE]
proof (state)
this:
X \<noteq> {}

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
note [intro] = \<open>finite X\<close>
[PROOF STATE]
proof (state)
this:
finite X

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    Let \<open>P\<close> be the smallest integer polynomial whose roots are a superset of \<open>X\<close>:
  \<close>
[PROOF STATE]
proof (state)
this:
finite X

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
define P :: "int poly" where "P = \<Prod>(min_int_poly ` X)"
[PROOF STATE]
proof (state)
this:
P = \<Prod>(min_int_poly ` X)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
define Roots :: "complex set" where "Roots = {x. ipoly P x = 0}"
[PROOF STATE]
proof (state)
this:
Roots = {x. ipoly P x = 0}

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have [simp]: "P \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<noteq> 0
[PROOF STEP]
using \<open>finite X\<close>
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. P \<noteq> 0
[PROOF STEP]
by (auto simp: P_def)
[PROOF STATE]
proof (state)
this:
P \<noteq> 0

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have [intro]: "finite Roots"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite Roots
[PROOF STEP]
unfolding Roots_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x. ipoly P x = 0}
[PROOF STEP]
by (intro poly_roots_finite) auto
[PROOF STATE]
proof (state)
this:
finite Roots

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "X \<subseteq> Roots"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<subseteq> Roots
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> x \<in> Roots
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> x \<in> Roots
[PROOF STEP]
assume "x \<in> X"
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> x \<in> Roots
[PROOF STEP]
hence "ipoly (min_int_poly x) x = 0"
[PROOF STATE]
proof (prove)
using this:
x \<in> X

goal (1 subgoal):
 1. ipoly (min_int_poly x) x = 0
[PROOF STEP]
by (intro ipoly_min_int_poly alg)
[PROOF STATE]
proof (state)
this:
ipoly (min_int_poly x) x = 0

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> x \<in> Roots
[PROOF STEP]
thus "x \<in> Roots"
[PROOF STATE]
proof (prove)
using this:
ipoly (min_int_poly x) x = 0

goal (1 subgoal):
 1. x \<in> Roots
[PROOF STEP]
using \<open>finite X\<close> \<open>x \<in> X\<close>
[PROOF STATE]
proof (prove)
using this:
ipoly (min_int_poly x) x = 0
finite X
x \<in> X

goal (1 subgoal):
 1. x \<in> Roots
[PROOF STEP]
by (auto simp: Roots_def P_def of_int_poly_hom.hom_prod poly_prod)
[PROOF STATE]
proof (state)
this:
x \<in> Roots

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
X \<subseteq> Roots

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "squarefree (of_int_poly P :: complex poly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. squarefree (Ring_Hom_Poly.of_int_poly P)
[PROOF STEP]
unfolding P_def of_int_poly_hom.hom_prod
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. squarefree (prod Ring_Hom_Poly.of_int_poly (min_int_poly ` X))
[PROOF STEP]
proof (rule squarefree_prod_coprime; safe)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b x xa. \<lbrakk>min_int_poly x \<noteq> min_int_poly xa; x \<in> X; xa \<in> X\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime (Ring_Hom_Poly.of_int_poly (min_int_poly x)) (Ring_Hom_Poly.of_int_poly (min_int_poly xa))
 2. \<And>a x. x \<in> X \<Longrightarrow> squarefree (Ring_Hom_Poly.of_int_poly (min_int_poly x))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b x xa. \<lbrakk>min_int_poly x \<noteq> min_int_poly xa; x \<in> X; xa \<in> X\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime (Ring_Hom_Poly.of_int_poly (min_int_poly x)) (Ring_Hom_Poly.of_int_poly (min_int_poly xa))
 2. \<And>a x. x \<in> X \<Longrightarrow> squarefree (Ring_Hom_Poly.of_int_poly (min_int_poly x))
[PROOF STEP]
assume "x \<in> X"
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (2 subgoals):
 1. \<And>a b x xa. \<lbrakk>min_int_poly x \<noteq> min_int_poly xa; x \<in> X; xa \<in> X\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime (Ring_Hom_Poly.of_int_poly (min_int_poly x)) (Ring_Hom_Poly.of_int_poly (min_int_poly xa))
 2. \<And>a x. x \<in> X \<Longrightarrow> squarefree (Ring_Hom_Poly.of_int_poly (min_int_poly x))
[PROOF STEP]
thus "squarefree (of_int_poly (min_int_poly x) :: complex poly)"
[PROOF STATE]
proof (prove)
using this:
x \<in> X

goal (1 subgoal):
 1. squarefree (Ring_Hom_Poly.of_int_poly (min_int_poly x))
[PROOF STEP]
by (intro squarefree_of_int_polyI) auto
[PROOF STATE]
proof (state)
this:
squarefree (Ring_Hom_Poly.of_int_poly (min_int_poly x))

goal (1 subgoal):
 1. \<And>a b x xa. \<lbrakk>min_int_poly x \<noteq> min_int_poly xa; x \<in> X; xa \<in> X\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime (Ring_Hom_Poly.of_int_poly (min_int_poly x)) (Ring_Hom_Poly.of_int_poly (min_int_poly xa))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b x xa. \<lbrakk>min_int_poly x \<noteq> min_int_poly xa; x \<in> X; xa \<in> X\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime (Ring_Hom_Poly.of_int_poly (min_int_poly x)) (Ring_Hom_Poly.of_int_poly (min_int_poly xa))
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b x xa. \<lbrakk>min_int_poly x \<noteq> min_int_poly xa; x \<in> X; xa \<in> X\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime (Ring_Hom_Poly.of_int_poly (min_int_poly x)) (Ring_Hom_Poly.of_int_poly (min_int_poly xa))
[PROOF STEP]
assume xy: "x \<in> X" "y \<in> X" "min_int_poly x \<noteq> min_int_poly y"
[PROOF STATE]
proof (state)
this:
x \<in> X
y \<in> X
min_int_poly x \<noteq> min_int_poly y

goal (1 subgoal):
 1. \<And>a b x xa. \<lbrakk>min_int_poly x \<noteq> min_int_poly xa; x \<in> X; xa \<in> X\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime (Ring_Hom_Poly.of_int_poly (min_int_poly x)) (Ring_Hom_Poly.of_int_poly (min_int_poly xa))
[PROOF STEP]
thus "Rings.coprime (of_int_poly (min_int_poly x)) (of_int_poly (min_int_poly y) :: complex poly)"
[PROOF STATE]
proof (prove)
using this:
x \<in> X
y \<in> X
min_int_poly x \<noteq> min_int_poly y

goal (1 subgoal):
 1. algebraic_semidom_class.coprime (Ring_Hom_Poly.of_int_poly (min_int_poly x)) (Ring_Hom_Poly.of_int_poly (min_int_poly y))
[PROOF STEP]
by (intro coprime_of_int_polyI[OF primes_coprime]) auto
[PROOF STATE]
proof (state)
this:
algebraic_semidom_class.coprime (Ring_Hom_Poly.of_int_poly (min_int_poly x)) (Ring_Hom_Poly.of_int_poly (min_int_poly y))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
squarefree (Ring_Hom_Poly.of_int_poly P)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    Since we will need a numbering of these roots, we obtain one:
  \<close>
[PROOF STATE]
proof (state)
this:
squarefree (Ring_Hom_Poly.of_int_poly P)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
define n where "n = card Roots"
[PROOF STATE]
proof (state)
this:
n = card Roots

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
obtain Root where Root: "bij_betw Root {..<n} Roots"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Root. bij_betw Root {..<n} Roots \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ex_bij_betw_nat_finite[OF \<open>finite Roots\<close>]
[PROOF STATE]
proof (prove)
using this:
\<exists>h. bij_betw h {0..<card Roots} Roots

goal (1 subgoal):
 1. (\<And>Root. bij_betw Root {..<n} Roots \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding n_def atLeast0LessThan
[PROOF STATE]
proof (prove)
using this:
\<exists>h. bij_betw h {..<card Roots} Roots

goal (1 subgoal):
 1. (\<And>Root. bij_betw Root {..<card Roots} Roots \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
bij_betw Root {..<n} Roots

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
define unRoot :: "complex \<Rightarrow> nat" where "unRoot = inv_into {..<n} Root"
[PROOF STATE]
proof (state)
this:
unRoot = inv_into {..<n} Root

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have unRoot: "bij_betw unRoot Roots {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw unRoot Roots {..<n}
[PROOF STEP]
unfolding unRoot_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (inv_into {..<n} Root) Roots {..<n}
[PROOF STEP]
by (intro bij_betw_inv_into Root)
[PROOF STATE]
proof (state)
this:
bij_betw unRoot Roots {..<n}

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have unRoot_Root [simp]: "unRoot (Root i) = i" if "i < n" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unRoot (Root i) = i
[PROOF STEP]
unfolding unRoot_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv_into {..<n} Root (Root i) = i
[PROOF STEP]
using Root that
[PROOF STATE]
proof (prove)
using this:
bij_betw Root {..<n} Roots
i < n

goal (1 subgoal):
 1. inv_into {..<n} Root (Root i) = i
[PROOF STEP]
by (subst inv_into_f_f) (auto simp: bij_betw_def)
[PROOF STATE]
proof (state)
this:
?i < n \<Longrightarrow> unRoot (Root ?i) = ?i

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have Root_unRoot [simp]: "Root (unRoot x) = x" if "x \<in> Roots" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Root (unRoot x) = x
[PROOF STEP]
unfolding unRoot_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Root (inv_into {..<n} Root x) = x
[PROOF STEP]
using Root that
[PROOF STATE]
proof (prove)
using this:
bij_betw Root {..<n} Roots
x \<in> Roots

goal (1 subgoal):
 1. Root (inv_into {..<n} Root x) = x
[PROOF STEP]
by (subst f_inv_into_f) (auto simp: bij_betw_def)
[PROOF STATE]
proof (state)
this:
?x \<in> Roots \<Longrightarrow> Root (unRoot ?x) = ?x

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have [simp, intro]: "Root i \<in> Roots" if "i < n" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Root i \<in> Roots
[PROOF STEP]
using Root that
[PROOF STATE]
proof (prove)
using this:
bij_betw Root {..<n} Roots
i < n

goal (1 subgoal):
 1. Root i \<in> Roots
[PROOF STEP]
by (auto simp: bij_betw_def)
[PROOF STATE]
proof (state)
this:
?i < n \<Longrightarrow> Root ?i \<in> Roots

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have [simp, intro]: "unRoot x < n" if "x \<in> Roots" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unRoot x < n
[PROOF STEP]
using unRoot that
[PROOF STATE]
proof (prove)
using this:
bij_betw unRoot Roots {..<n}
x \<in> Roots

goal (1 subgoal):
 1. unRoot x < n
[PROOF STEP]
by (auto simp: bij_betw_def)
[PROOF STATE]
proof (state)
this:
?x \<in> Roots \<Longrightarrow> unRoot ?x < n

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    We will also need to convert between permutations of natural numbers less than \<open>n\<close> and
    permutations of the roots:
  \<close>
[PROOF STATE]
proof (state)
this:
?x \<in> Roots \<Longrightarrow> unRoot ?x < n

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
define convert_perm :: "(nat \<Rightarrow> nat) \<Rightarrow> (complex \<Rightarrow> complex)" where
    "convert_perm = (\<lambda>\<sigma> x. if x \<in> Roots then Root (\<sigma> (unRoot x)) else x)"
[PROOF STATE]
proof (state)
this:
convert_perm = (\<lambda>\<sigma> x. if x \<in> Roots then Root (\<sigma> (unRoot x)) else x)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have bij_convert: "bij_betw convert_perm {\<sigma>. \<sigma> permutes {..<n}} {\<sigma>. \<sigma> permutes Roots}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw convert_perm {\<sigma>. \<sigma> permutes {..<n}} {\<sigma>. \<sigma> permutes Roots}
[PROOF STEP]
using bij_betw_permutations[OF Root]
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>\<pi> x. if x \<in> Roots then Root (\<pi> (inv_into {..<n} Root x)) else x) {\<pi>. \<pi> permutes {..<n}} {\<pi>. \<pi> permutes Roots}

goal (1 subgoal):
 1. bij_betw convert_perm {\<sigma>. \<sigma> permutes {..<n}} {\<sigma>. \<sigma> permutes Roots}
[PROOF STEP]
unfolding convert_perm_def unRoot_def
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>\<pi> x. if x \<in> Roots then Root (\<pi> (inv_into {..<n} Root x)) else x) {\<pi>. \<pi> permutes {..<n}} {\<pi>. \<pi> permutes Roots}

goal (1 subgoal):
 1. bij_betw (\<lambda>\<sigma> x. if x \<in> Roots then Root (\<sigma> (inv_into {..<n} Root x)) else x) {\<sigma>. \<sigma> permutes {..<n}} {\<sigma>. \<sigma> permutes Roots}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
bij_betw convert_perm {\<sigma>. \<sigma> permutes {..<n}} {\<sigma>. \<sigma> permutes Roots}

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have permutes_convert_perm [intro]: "convert_perm \<sigma> permutes Roots" if "\<sigma> permutes {..<n}" for \<sigma>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convert_perm \<sigma> permutes Roots
[PROOF STEP]
using that bij_convert
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes {..<n}
bij_betw convert_perm {\<sigma>. \<sigma> permutes {..<n}} {\<sigma>. \<sigma> permutes Roots}

goal (1 subgoal):
 1. convert_perm \<sigma> permutes Roots
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes {..<n}
inj_on convert_perm {\<sigma>. \<sigma> permutes {..<n}} \<and> convert_perm ` {\<sigma>. \<sigma> permutes {..<n}} = {\<sigma>. \<sigma> permutes Roots}

goal (1 subgoal):
 1. convert_perm \<sigma> permutes Roots
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?\<sigma> permutes {..<n} \<Longrightarrow> convert_perm ?\<sigma> permutes Roots

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have convert_perm_compose: "convert_perm (\<pi> \<circ> \<sigma>) = convert_perm \<pi> \<circ> convert_perm \<sigma>"
    if "\<pi> permutes {..<n}" "\<sigma> permutes {..<n}" for \<sigma> \<pi>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convert_perm (\<pi> \<circ> \<sigma>) = convert_perm \<pi> \<circ> convert_perm \<sigma>
[PROOF STEP]
proof (intro ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x
[PROOF STEP]
show "convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x
[PROOF STEP]
proof (cases "x \<in> Roots")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> Roots \<Longrightarrow> convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x
 2. x \<notin> Roots \<Longrightarrow> convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x \<in> Roots

goal (2 subgoals):
 1. x \<in> Roots \<Longrightarrow> convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x
 2. x \<notin> Roots \<Longrightarrow> convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> Roots

goal (1 subgoal):
 1. convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x
[PROOF STEP]
using permutes_in_image[OF that(2), of "unRoot x"]
[PROOF STATE]
proof (prove)
using this:
x \<in> Roots
(\<sigma> (unRoot x) \<in> {..<n}) = (unRoot x \<in> {..<n})

goal (1 subgoal):
 1. convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x
[PROOF STEP]
by (auto simp: convert_perm_def bij_betw_def)
[PROOF STATE]
proof (state)
this:
convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x

goal (1 subgoal):
 1. x \<notin> Roots \<Longrightarrow> convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x
[PROOF STEP]
qed (auto simp: convert_perm_def)
[PROOF STATE]
proof (state)
this:
convert_perm (\<pi> \<circ> \<sigma>) x = (convert_perm \<pi> \<circ> convert_perm \<sigma>) x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?\<pi> permutes {..<n}; ?\<sigma> permutes {..<n}\<rbrakk> \<Longrightarrow> convert_perm (?\<pi> \<circ> ?\<sigma>) = convert_perm ?\<pi> \<circ> convert_perm ?\<sigma>

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    We extend the coefficient vector to the new roots by setting their coefficients to 0:
  \<close>
[PROOF STATE]
proof (state)
this:
\<lbrakk>?\<pi> permutes {..<n}; ?\<sigma> permutes {..<n}\<rbrakk> \<Longrightarrow> convert_perm (?\<pi> \<circ> ?\<sigma>) = convert_perm ?\<pi> \<circ> convert_perm ?\<sigma>

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
define \<beta>' where "\<beta>' = (\<lambda>x. if x \<in> X then \<beta> x else 0)"
[PROOF STATE]
proof (state)
this:
\<beta>' = (\<lambda>x. if x \<in> X then \<beta> x else 0)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    We now define the set of all permutations of our roots:
  \<close>
[PROOF STATE]
proof (state)
this:
\<beta>' = (\<lambda>x. if x \<in> X then \<beta> x else 0)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
define perms where "perms = {\<pi>. \<pi> permutes Roots}"
[PROOF STATE]
proof (state)
this:
perms = {\<pi>. \<pi> permutes Roots}

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have [intro]: "finite perms"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite perms
[PROOF STEP]
unfolding perms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {\<pi>. \<pi> permutes Roots}
[PROOF STEP]
by (rule finite_permutations) auto
[PROOF STATE]
proof (state)
this:
finite perms

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have [simp]: "card perms = fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card perms = fact n
[PROOF STEP]
unfolding perms_def n_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {\<pi>. \<pi> permutes Roots} = fact (card Roots)
[PROOF STEP]
by (intro card_permutations) auto
[PROOF STATE]
proof (state)
this:
card perms = fact n

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    The following is the set of all \<open>n!\<close>-tuples of roots, disregarding permutation of components.
    In other words: all multisets of roots with size \<open>n!\<close>.
  \<close>
[PROOF STATE]
proof (state)
this:
card perms = fact n

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
define Roots_ms :: "complex multiset set" where
    "Roots_ms = {X. set_mset X \<subseteq> Roots \<and> size X = fact n}"
[PROOF STATE]
proof (state)
this:
Roots_ms = {X. set_mset X \<subseteq> Roots \<and> size X = fact n}

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have [intro]: "finite Roots_ms"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite Roots_ms
[PROOF STEP]
unfolding Roots_ms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {X. set_mset X \<subseteq> Roots \<and> size X = fact n}
[PROOF STEP]
by (rule finite_multisets_of_size) auto
[PROOF STATE]
proof (state)
this:
finite Roots_ms

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    Next, the following is the set of \<open>n!\<close>-tuples whose entries are precisely the multiset \<open>X\<close>:
  \<close>
[PROOF STATE]
proof (state)
this:
finite Roots_ms

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
define tuples :: "complex multiset \<Rightarrow> ((complex \<Rightarrow> complex) \<Rightarrow> complex) set" where
    "tuples = (\<lambda>X. {f\<in>perms \<rightarrow>\<^sub>E Roots. image_mset f (mset_set perms) = X})"
[PROOF STATE]
proof (state)
this:
tuples = (\<lambda>X. {f \<in> perms \<rightarrow>\<^sub>E Roots. image_mset f (mset_set perms) = X})

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have fin_tuples [intro]: "finite (tuples X)" for X
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (tuples X)
[PROOF STEP]
unfolding tuples_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {f \<in> perms \<rightarrow>\<^sub>E Roots. image_mset f (mset_set perms) = X}
[PROOF STEP]
by (rule finite_subset[of _ "perms \<rightarrow>\<^sub>E Roots", OF _ finite_PiE]) auto
[PROOF STATE]
proof (state)
this:
finite (tuples ?X)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
define tuples' :: "(complex multiset \<times> ((complex \<Rightarrow> complex) \<Rightarrow> complex)) set" where
    "tuples' = (SIGMA X:Roots_ms. tuples X)"
[PROOF STATE]
proof (state)
this:
tuples' = Sigma Roots_ms tuples

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    The following shows that our \<^term>\<open>tuples\<close> definition is stable under permutation of
    the roots.
  \<close>
[PROOF STATE]
proof (state)
this:
tuples' = Sigma Roots_ms tuples

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have bij_convert': "bij_betw (\<lambda>f. f \<circ> (\<lambda>g. \<sigma> \<circ> g)) (tuples X) (tuples X)"
    if \<sigma>: "\<sigma> permutes Roots" for \<sigma> X
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (\<lambda>f. f \<circ> (\<circ>) \<sigma>) (tuples X) (tuples X)
[PROOF STEP]
proof (rule bij_betwI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (\<lambda>f. f \<circ> (\<circ>) \<sigma>) \<in> tuples X \<rightarrow> tuples X
 2. ?g \<in> tuples X \<rightarrow> tuples X
 3. \<And>x. x \<in> tuples X \<Longrightarrow> ?g (x \<circ> (\<circ>) \<sigma>) = x
 4. \<And>y. y \<in> tuples X \<Longrightarrow> ?g y \<circ> (\<circ>) \<sigma> = y
[PROOF STEP]
have *: "(\<lambda>f. f \<circ> (\<circ>) \<sigma>) \<in> tuples X \<rightarrow> tuples X" if \<sigma>: "\<sigma> permutes Roots" for \<sigma>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f. f \<circ> (\<circ>) \<sigma>) \<in> tuples X \<rightarrow> tuples X
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> tuples X \<Longrightarrow> x \<circ> (\<circ>) \<sigma> \<in> tuples X
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> tuples X \<Longrightarrow> x \<circ> (\<circ>) \<sigma> \<in> tuples X
[PROOF STEP]
assume f: "f \<in> tuples X"
[PROOF STATE]
proof (state)
this:
f \<in> tuples X

goal (1 subgoal):
 1. \<And>x. x \<in> tuples X \<Longrightarrow> x \<circ> (\<circ>) \<sigma> \<in> tuples X
[PROOF STEP]
show "f \<circ> (\<circ>) \<sigma> \<in> tuples X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> (\<circ>) \<sigma> \<in> tuples X
[PROOF STEP]
unfolding tuples_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> (\<circ>) \<sigma> \<in> {f \<in> perms \<rightarrow>\<^sub>E Roots. image_mset f (mset_set perms) = X}
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> perms \<Longrightarrow> (f \<circ> (\<circ>) \<sigma>) x \<in> Roots
 2. \<And>x. x \<notin> perms \<Longrightarrow> (f \<circ> (\<circ>) \<sigma>) x = undefined
 3. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
fix \<sigma>'
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> perms \<Longrightarrow> (f \<circ> (\<circ>) \<sigma>) x \<in> Roots
 2. \<And>x. x \<notin> perms \<Longrightarrow> (f \<circ> (\<circ>) \<sigma>) x = undefined
 3. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
assume \<sigma>': "\<sigma>' \<in> perms"
[PROOF STATE]
proof (state)
this:
\<sigma>' \<in> perms

goal (3 subgoals):
 1. \<And>x. x \<in> perms \<Longrightarrow> (f \<circ> (\<circ>) \<sigma>) x \<in> Roots
 2. \<And>x. x \<notin> perms \<Longrightarrow> (f \<circ> (\<circ>) \<sigma>) x = undefined
 3. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
show "(f \<circ> (\<circ>) \<sigma>) \<sigma>' \<in> Roots"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<circ> (\<circ>) \<sigma>) \<sigma>' \<in> Roots
[PROOF STEP]
using permutes_compose[OF _ \<sigma>, of \<sigma>'] \<sigma> \<sigma>' f
[PROOF STATE]
proof (prove)
using this:
\<sigma>' permutes Roots \<Longrightarrow> \<sigma> \<circ> \<sigma>' permutes Roots
\<sigma> permutes Roots
\<sigma>' \<in> perms
f \<in> tuples X

goal (1 subgoal):
 1. (f \<circ> (\<circ>) \<sigma>) \<sigma>' \<in> Roots
[PROOF STEP]
by (auto simp: perms_def tuples_def)
[PROOF STATE]
proof (state)
this:
(f \<circ> (\<circ>) \<sigma>) \<sigma>' \<in> Roots

goal (2 subgoals):
 1. \<And>x. x \<notin> perms \<Longrightarrow> (f \<circ> (\<circ>) \<sigma>) x = undefined
 2. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<notin> perms \<Longrightarrow> (f \<circ> (\<circ>) \<sigma>) x = undefined
 2. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
fix \<sigma>'
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<notin> perms \<Longrightarrow> (f \<circ> (\<circ>) \<sigma>) x = undefined
 2. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
assume \<sigma>': "\<sigma>' \<notin> perms"
[PROOF STATE]
proof (state)
this:
\<sigma>' \<notin> perms

goal (2 subgoals):
 1. \<And>x. x \<notin> perms \<Longrightarrow> (f \<circ> (\<circ>) \<sigma>) x = undefined
 2. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
have "\<not>(\<sigma> \<circ> \<sigma>') permutes Roots"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> \<sigma> \<circ> \<sigma>' permutes Roots
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<sigma> \<circ> \<sigma>' permutes Roots \<Longrightarrow> False
[PROOF STEP]
assume "(\<sigma> \<circ> \<sigma>') permutes Roots"
[PROOF STATE]
proof (state)
this:
\<sigma> \<circ> \<sigma>' permutes Roots

goal (1 subgoal):
 1. \<sigma> \<circ> \<sigma>' permutes Roots \<Longrightarrow> False
[PROOF STEP]
hence "inv_into UNIV \<sigma> \<circ> (\<sigma> \<circ> \<sigma>') permutes Roots"
[PROOF STATE]
proof (prove)
using this:
\<sigma> \<circ> \<sigma>' permutes Roots

goal (1 subgoal):
 1. inv \<sigma> \<circ> (\<sigma> \<circ> \<sigma>') permutes Roots
[PROOF STEP]
by (rule permutes_compose) (use permutes_inv[OF \<sigma>] in simp_all)
[PROOF STATE]
proof (state)
this:
inv \<sigma> \<circ> (\<sigma> \<circ> \<sigma>') permutes Roots

goal (1 subgoal):
 1. \<sigma> \<circ> \<sigma>' permutes Roots \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inv \<sigma> \<circ> (\<sigma> \<circ> \<sigma>') permutes Roots

goal (1 subgoal):
 1. \<sigma> \<circ> \<sigma>' permutes Roots \<Longrightarrow> False
[PROOF STEP]
have "inv_into UNIV \<sigma> \<circ> (\<sigma> \<circ> \<sigma>') = \<sigma>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv \<sigma> \<circ> (\<sigma> \<circ> \<sigma>') = \<sigma>'
[PROOF STEP]
by (auto simp: fun_eq_iff permutes_inverses[OF \<sigma>])
[PROOF STATE]
proof (state)
this:
inv \<sigma> \<circ> (\<sigma> \<circ> \<sigma>') = \<sigma>'

goal (1 subgoal):
 1. \<sigma> \<circ> \<sigma>' permutes Roots \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<sigma>' permutes Roots
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<sigma>' permutes Roots

goal (1 subgoal):
 1. False
[PROOF STEP]
using \<sigma>'
[PROOF STATE]
proof (prove)
using this:
\<sigma>' permutes Roots
\<sigma>' \<notin> perms

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> \<sigma> \<circ> \<sigma>' permutes Roots

goal (2 subgoals):
 1. \<And>x. x \<notin> perms \<Longrightarrow> (f \<circ> (\<circ>) \<sigma>) x = undefined
 2. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
thus "(f \<circ> (\<circ>) \<sigma>) \<sigma>' = undefined"
[PROOF STATE]
proof (prove)
using this:
\<not> \<sigma> \<circ> \<sigma>' permutes Roots

goal (1 subgoal):
 1. (f \<circ> (\<circ>) \<sigma>) \<sigma>' = undefined
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
\<not> \<sigma> \<circ> \<sigma>' permutes Roots
f \<in> tuples X

goal (1 subgoal):
 1. (f \<circ> (\<circ>) \<sigma>) \<sigma>' = undefined
[PROOF STEP]
by (auto simp: perms_def tuples_def)
[PROOF STATE]
proof (state)
this:
(f \<circ> (\<circ>) \<sigma>) \<sigma>' = undefined

goal (1 subgoal):
 1. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
have "image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) =
              image_mset f (image_mset ((\<circ>) \<sigma>) (mset_set perms))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = image_mset f (image_mset ((\<circ>) \<sigma>) (mset_set perms))
[PROOF STEP]
by (rule multiset.map_comp [symmetric])
[PROOF STATE]
proof (state)
this:
image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = image_mset f (image_mset ((\<circ>) \<sigma>) (mset_set perms))

goal (1 subgoal):
 1. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = image_mset f (image_mset ((\<circ>) \<sigma>) (mset_set perms))

goal (1 subgoal):
 1. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
have "image_mset ((\<circ>) \<sigma>) (mset_set perms) = mset_set perms"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset ((\<circ>) \<sigma>) (mset_set perms) = mset_set perms
[PROOF STEP]
using bij_betw_permutes_compose_left[OF \<sigma>]
[PROOF STATE]
proof (prove)
using this:
bij_betw ((\<circ>) \<sigma>) {\<sigma>. \<sigma> permutes Roots} {\<sigma>. \<sigma> permutes Roots}

goal (1 subgoal):
 1. image_mset ((\<circ>) \<sigma>) (mset_set perms) = mset_set perms
[PROOF STEP]
by (subst image_mset_mset_set) (auto simp: bij_betw_def perms_def)
[PROOF STATE]
proof (state)
this:
image_mset ((\<circ>) \<sigma>) (mset_set perms) = mset_set perms

goal (1 subgoal):
 1. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
image_mset ((\<circ>) \<sigma>) (mset_set perms) = mset_set perms

goal (1 subgoal):
 1. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
have "image_mset f \<dots> = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset f (mset_set perms) = X
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
f \<in> tuples X

goal (1 subgoal):
 1. image_mset f (mset_set perms) = X
[PROOF STEP]
by (auto simp: tuples_def)
[PROOF STATE]
proof (state)
this:
image_mset f (mset_set perms) = X

goal (1 subgoal):
 1. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
show "image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X"
[PROOF STATE]
proof (prove)
using this:
image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X

goal (1 subgoal):
 1. image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
image_mset (f \<circ> (\<circ>) \<sigma>) (mset_set perms) = X

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f \<circ> (\<circ>) \<sigma> \<in> tuples X

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?\<sigma> permutes Roots \<Longrightarrow> (\<lambda>f. f \<circ> (\<circ>) ?\<sigma>) \<in> tuples X \<rightarrow> tuples X

goal (4 subgoals):
 1. (\<lambda>f. f \<circ> (\<circ>) \<sigma>) \<in> tuples X \<rightarrow> tuples X
 2. ?g \<in> tuples X \<rightarrow> tuples X
 3. \<And>x. x \<in> tuples X \<Longrightarrow> ?g (x \<circ> (\<circ>) \<sigma>) = x
 4. \<And>y. y \<in> tuples X \<Longrightarrow> ?g y \<circ> (\<circ>) \<sigma> = y
[PROOF STEP]
show "(\<lambda>f. f \<circ> (\<circ>) \<sigma>) \<in> tuples X \<rightarrow> tuples X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f. f \<circ> (\<circ>) \<sigma>) \<in> tuples X \<rightarrow> tuples X
[PROOF STEP]
by (rule *) fact
[PROOF STATE]
proof (state)
this:
(\<lambda>f. f \<circ> (\<circ>) \<sigma>) \<in> tuples X \<rightarrow> tuples X

goal (3 subgoals):
 1. ?g \<in> tuples X \<rightarrow> tuples X
 2. \<And>x. x \<in> tuples X \<Longrightarrow> ?g (x \<circ> (\<circ>) \<sigma>) = x
 3. \<And>y. y \<in> tuples X \<Longrightarrow> ?g y \<circ> (\<circ>) \<sigma> = y
[PROOF STEP]
show "(\<lambda>f. f \<circ> (\<circ>) (inv_into UNIV \<sigma>)) \<in> tuples X \<rightarrow> tuples X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f. f \<circ> (\<circ>) (inv \<sigma>)) \<in> tuples X \<rightarrow> tuples X
[PROOF STEP]
by (intro * permutes_inv) fact
[PROOF STATE]
proof (state)
this:
(\<lambda>f. f \<circ> (\<circ>) (inv \<sigma>)) \<in> tuples X \<rightarrow> tuples X

goal (2 subgoals):
 1. \<And>x. x \<in> tuples X \<Longrightarrow> x \<circ> (\<circ>) \<sigma> \<circ> (\<circ>) (inv \<sigma>) = x
 2. \<And>y. y \<in> tuples X \<Longrightarrow> y \<circ> (\<circ>) (inv \<sigma>) \<circ> (\<circ>) \<sigma> = y
[PROOF STEP]
show "f \<circ> (\<circ>) \<sigma> \<circ> (\<circ>) (inv_into UNIV \<sigma>) = f" if "f \<in> tuples X" for f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> (\<circ>) \<sigma> \<circ> (\<circ>) (inv \<sigma>) = f
[PROOF STEP]
by (auto simp: fun_eq_iff o_def permutes_inverses[OF \<sigma>])
[PROOF STATE]
proof (state)
this:
?f \<in> tuples X \<Longrightarrow> ?f \<circ> (\<circ>) \<sigma> \<circ> (\<circ>) (inv \<sigma>) = ?f

goal (1 subgoal):
 1. \<And>y. y \<in> tuples X \<Longrightarrow> y \<circ> (\<circ>) (inv \<sigma>) \<circ> (\<circ>) \<sigma> = y
[PROOF STEP]
show "f \<circ> (\<circ>) (inv_into UNIV \<sigma>) \<circ> (\<circ>) \<sigma> = f" if "f \<in> tuples X" for f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> (\<circ>) (inv \<sigma>) \<circ> (\<circ>) \<sigma> = f
[PROOF STEP]
by (auto simp: fun_eq_iff o_def permutes_inverses[OF \<sigma>])
[PROOF STATE]
proof (state)
this:
?f \<in> tuples X \<Longrightarrow> ?f \<circ> (\<circ>) (inv \<sigma>) \<circ> (\<circ>) \<sigma> = ?f

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?\<sigma> permutes Roots \<Longrightarrow> bij_betw (\<lambda>f. f \<circ> (\<circ>) ?\<sigma>) (tuples ?X) (tuples ?X)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    Next, we define the multiset of of possible exponents that we can get for a given
    \<open>n!\<close>-multiset of roots,
  \<close>
[PROOF STATE]
proof (state)
this:
?\<sigma> permutes Roots \<Longrightarrow> bij_betw (\<lambda>f. f \<circ> (\<circ>) ?\<sigma>) (tuples ?X) (tuples ?X)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
define R :: "complex multiset \<Rightarrow> complex multiset" where
    "R = (\<lambda>X. image_mset (\<lambda>f. \<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) (mset_set (tuples X)))"
[PROOF STATE]
proof (state)
this:
R = (\<lambda>X. {#\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>). f \<in># mset_set (tuples X)#})

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    We show that, for each such multiset, there is a content-free integer polynomial that has
    exactly these exponents as roots. This shows that they form a full set of conjugates (but
    note this polynomial is not necessarily squarefree).

    The proof is yet another application of the fundamental theorem of symmetric polynomials.
  \<close>
[PROOF STATE]
proof (state)
this:
R = (\<lambda>X. {#\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>). f \<in># mset_set (tuples X)#})

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
obtain Q :: "complex multiset \<Rightarrow> int poly"
    where Q: "\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (of_int_poly (Q X)) = R X"
             "\<And>X. X \<in> Roots_ms \<Longrightarrow> content (Q X) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
fix X :: "complex multiset"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
assume X: "X \<in> Roots_ms"
[PROOF STATE]
proof (state)
this:
X \<in> Roots_ms

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define Q :: "complex poly mpoly" where
        "Q = (\<Prod>f\<in>tuples X. Const [:0, 1:] -
                 (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>))))))"
[PROOF STATE]
proof (state)
this:
Q = (\<Prod>f\<in>tuples X. Const [:0, 1:] - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>))))))

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define Q1 where "Q1 = (\<Prod>f\<in>tuples X. [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (f \<sigma>)), 1:])"
[PROOF STATE]
proof (state)
this:
Q1 = (\<Prod>f\<in>tuples X. [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (f \<sigma>)), 1:])

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define ratpolys :: "complex poly set" where "ratpolys = {p. \<forall>i. poly.coeff p i \<in> \<rat>}"
[PROOF STATE]
proof (state)
this:
ratpolys = {p. \<forall>i. poly.coeff p i \<in> \<rat>}

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "insertion (\<lambda>x. [:Root x:]) Q \<in> ratpolys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion (\<lambda>x. [:Root x:]) Q \<in> ratpolys
[PROOF STEP]
proof (rule symmetric_poly_of_roots_in_subring[where l = "\<lambda>x. [:x:]"])
[PROOF STATE]
proof (state)
goal (10 subgoals):
 1. ring_closed ratpolys
 2. \<forall>m. MPoly_Type.coeff Q m \<in> ratpolys
 3. ring_homomorphism (\<lambda>x. [:x:])
 4. finite ?A
 5. symmetric_mpoly ?A Q
 6. vars Q \<subseteq> ?A
 7. ?cinv * [:?c:] = 1
 8. ?cinv \<in> ratpolys
 9. ?p = Polynomial.smult ?c (\<Prod>i\<in>?A. [:- Root i, 1:])
 10. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
show "ring_closed ratpolys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_closed ratpolys
[PROOF STEP]
unfolding ratpolys_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_closed {p. \<forall>i. poly.coeff p i \<in> \<rat>}
[PROOF STEP]
by standard (auto intro: coeff_mult_semiring_closed)
[PROOF STATE]
proof (state)
this:
ring_closed ratpolys

goal (9 subgoals):
 1. \<forall>m. MPoly_Type.coeff Q m \<in> ratpolys
 2. ring_homomorphism (\<lambda>x. [:x:])
 3. finite ?A
 4. symmetric_mpoly ?A Q
 5. vars Q \<subseteq> ?A
 6. ?cinv * [:?c:] = 1
 7. ?cinv \<in> ratpolys
 8. ?p = Polynomial.smult ?c (\<Prod>i\<in>?A. [:- Root i, 1:])
 9. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ring_closed ratpolys
[PROOF STEP]
interpret ratpolys: ring_closed ratpolys
[PROOF STATE]
proof (prove)
using this:
ring_closed ratpolys

goal (1 subgoal):
 1. ring_closed ratpolys
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (9 subgoals):
 1. \<forall>m. MPoly_Type.coeff Q m \<in> ratpolys
 2. ring_homomorphism (\<lambda>x. [:x:])
 3. finite ?A
 4. symmetric_mpoly ?A Q
 5. vars Q \<subseteq> ?A
 6. ?cinv * [:?c:] = 1
 7. ?cinv \<in> ratpolys
 8. ?p = Polynomial.smult ?c (\<Prod>i\<in>?A. [:- Root i, 1:])
 9. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
have "pCons 0 1 \<in> ratpolys "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pCons 0 1 \<in> ratpolys
[PROOF STEP]
by (auto simp: ratpolys_def coeff_pCons split: nat.splits)
[PROOF STATE]
proof (state)
this:
pCons 0 1 \<in> ratpolys

goal (9 subgoals):
 1. \<forall>m. MPoly_Type.coeff Q m \<in> ratpolys
 2. ring_homomorphism (\<lambda>x. [:x:])
 3. finite ?A
 4. symmetric_mpoly ?A Q
 5. vars Q \<subseteq> ?A
 6. ?cinv * [:?c:] = 1
 7. ?cinv \<in> ratpolys
 8. ?p = Polynomial.smult ?c (\<Prod>i\<in>?A. [:- Root i, 1:])
 9. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
thus "\<forall>m. MPoly_Type.coeff Q m \<in> ratpolys"
[PROOF STATE]
proof (prove)
using this:
pCons 0 1 \<in> ratpolys

goal (1 subgoal):
 1. \<forall>m. MPoly_Type.coeff Q m \<in> ratpolys
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
using this:
pCons 0 1 \<in> ratpolys

goal (1 subgoal):
 1. \<forall>m. MPoly_Type.coeff (\<Prod>f\<in>tuples X. Const [:0, 1:] - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>)))))) m \<in> ratpolys
[PROOF STEP]
by (intro allI ratpolys.coeff_prod_closed)
             (auto intro!: ratpolys.minus_closed ratpolys.sum_closed ratpolys.uminus_closed simp: coeff_Var mpoly_coeff_Const when_def)
[PROOF STATE]
proof (state)
this:
\<forall>m. MPoly_Type.coeff Q m \<in> ratpolys

goal (8 subgoals):
 1. ring_homomorphism (\<lambda>x. [:x:])
 2. finite ?A
 3. symmetric_mpoly ?A Q
 4. vars Q \<subseteq> ?A
 5. ?cinv * [:?c:] = 1
 6. ?cinv \<in> ratpolys
 7. ?p = Polynomial.smult ?c (\<Prod>i\<in>?A. [:- Root i, 1:])
 8. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (8 subgoals):
 1. ring_homomorphism (\<lambda>x. [:x:])
 2. finite ?A
 3. symmetric_mpoly ?A Q
 4. vars Q \<subseteq> ?A
 5. ?cinv * [:?c:] = 1
 6. ?cinv \<in> ratpolys
 7. ?p = Polynomial.smult ?c (\<Prod>i\<in>?A. [:- Root i, 1:])
 8. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
show "ring_homomorphism (\<lambda>x::complex. [:x:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_homomorphism (\<lambda>x. [:x:])
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
ring_homomorphism (\<lambda>x. [:x:])

goal (7 subgoals):
 1. finite ?A
 2. symmetric_mpoly ?A Q
 3. vars Q \<subseteq> ?A
 4. ?cinv * [:?c:] = 1
 5. ?cinv \<in> ratpolys
 6. ?p = Polynomial.smult ?c (\<Prod>i\<in>?A. [:- Root i, 1:])
 7. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. finite ?A
 2. symmetric_mpoly ?A Q
 3. vars Q \<subseteq> ?A
 4. ?cinv * [:?c:] = 1
 5. ?cinv \<in> ratpolys
 6. ?p = Polynomial.smult ?c (\<Prod>i\<in>?A. [:- Root i, 1:])
 7. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
have "\<sigma> (unRoot (f (convert_perm \<sigma>))) < n" if "f \<in> tuples X" "\<sigma> permutes {..<n}" for f \<sigma>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<sigma> (unRoot (f (convert_perm \<sigma>))) < n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<sigma> (unRoot (f (convert_perm \<sigma>))) < n
[PROOF STEP]
have "convert_perm \<sigma> \<in> perms"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convert_perm \<sigma> \<in> perms
[PROOF STEP]
using bij_convert that(2)
[PROOF STATE]
proof (prove)
using this:
bij_betw convert_perm {\<sigma>. \<sigma> permutes {..<n}} {\<sigma>. \<sigma> permutes Roots}
\<sigma> permutes {..<n}

goal (1 subgoal):
 1. convert_perm \<sigma> \<in> perms
[PROOF STEP]
by (auto simp: bij_betw_def perms_def)
[PROOF STATE]
proof (state)
this:
convert_perm \<sigma> \<in> perms

goal (1 subgoal):
 1. \<sigma> (unRoot (f (convert_perm \<sigma>))) < n
[PROOF STEP]
hence "f (convert_perm \<sigma>) \<in> Roots"
[PROOF STATE]
proof (prove)
using this:
convert_perm \<sigma> \<in> perms

goal (1 subgoal):
 1. f (convert_perm \<sigma>) \<in> Roots
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
convert_perm \<sigma> \<in> perms
f \<in> tuples X
\<sigma> permutes {..<n}

goal (1 subgoal):
 1. f (convert_perm \<sigma>) \<in> Roots
[PROOF STEP]
by (auto simp: tuples_def)
[PROOF STATE]
proof (state)
this:
f (convert_perm \<sigma>) \<in> Roots

goal (1 subgoal):
 1. \<sigma> (unRoot (f (convert_perm \<sigma>))) < n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f (convert_perm \<sigma>) \<in> Roots

goal (1 subgoal):
 1. \<sigma> (unRoot (f (convert_perm \<sigma>))) < n
[PROOF STEP]
using permutes_in_image[OF that(2)]
[PROOF STATE]
proof (prove)
using this:
f (convert_perm \<sigma>) \<in> Roots
(\<sigma> ?x \<in> {..<n}) = (?x \<in> {..<n})

goal (1 subgoal):
 1. \<sigma> (unRoot (f (convert_perm \<sigma>))) < n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<sigma> (unRoot (f (convert_perm \<sigma>))) < n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?f \<in> tuples X; ?\<sigma> permutes {..<n}\<rbrakk> \<Longrightarrow> ?\<sigma> (unRoot (?f (convert_perm ?\<sigma>))) < n

goal (7 subgoals):
 1. finite ?A
 2. symmetric_mpoly ?A Q
 3. vars Q \<subseteq> ?A
 4. ?cinv * [:?c:] = 1
 5. ?cinv \<in> ratpolys
 6. ?p = Polynomial.smult ?c (\<Prod>i\<in>?A. [:- Root i, 1:])
 7. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
thus "vars Q \<subseteq> {..<n}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f \<in> tuples X; ?\<sigma> permutes {..<n}\<rbrakk> \<Longrightarrow> ?\<sigma> (unRoot (?f (convert_perm ?\<sigma>))) < n

goal (1 subgoal):
 1. vars Q \<subseteq> {..<n}
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f \<in> tuples X; ?\<sigma> permutes {..<n}\<rbrakk> \<Longrightarrow> ?\<sigma> (unRoot (?f (convert_perm ?\<sigma>))) < n

goal (1 subgoal):
 1. vars (\<Prod>f\<in>tuples X. Const [:0, 1:] - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>)))))) \<subseteq> {..<n}
[PROOF STEP]
by (intro order.trans[OF vars_prod] UN_least order.trans[OF vars_sum]
                order.trans[OF vars_diff] Un_least) (auto simp: vars_Var)
[PROOF STATE]
proof (state)
this:
vars Q \<subseteq> {..<n}

goal (6 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
 3. ?cinv * [:?c:] = 1
 4. ?cinv \<in> ratpolys
 5. ?p = Polynomial.smult ?c (\<Prod>i<n. [:- Root i, 1:])
 6. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
 3. ?cinv * [:?c:] = 1
 4. ?cinv \<in> ratpolys
 5. ?p = Polynomial.smult ?c (\<Prod>i<n. [:- Root i, 1:])
 6. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
define lc :: complex where "lc = of_int (Polynomial.lead_coeff P)"
[PROOF STATE]
proof (state)
this:
lc = of_int (Polynomial.lead_coeff P)

goal (6 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
 3. ?cinv * [:?c:] = 1
 4. ?cinv \<in> ratpolys
 5. ?p = Polynomial.smult ?c (\<Prod>i<n. [:- Root i, 1:])
 6. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
show "[:inverse lc:] \<in> ratpolys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:inverse lc:] \<in> ratpolys
[PROOF STEP]
by (auto simp: ratpolys_def coeff_pCons lc_def split: nat.splits)
[PROOF STATE]
proof (state)
this:
[:inverse lc:] \<in> ratpolys

goal (5 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
 3. [:inverse (of_int (Polynomial.lead_coeff P)):] * [:?c:] = 1
 4. ?p = Polynomial.smult ?c (\<Prod>i<n. [:- Root i, 1:])
 5. \<forall>i. [:poly.coeff ?p i:] \<in> ratpolys
[PROOF STEP]
show "\<forall>i. [:poly.coeff (of_int_poly P) i:] \<in> ratpolys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. [:poly.coeff (Ring_Hom_Poly.of_int_poly P) i:] \<in> ratpolys
[PROOF STEP]
by (auto simp: ratpolys_def coeff_pCons split: nat.splits)
[PROOF STATE]
proof (state)
this:
\<forall>i. [:poly.coeff (Ring_Hom_Poly.of_int_poly P) i:] \<in> ratpolys

goal (4 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
 3. [:inverse (of_int (Polynomial.lead_coeff P)):] * [:?c:] = 1
 4. Ring_Hom_Poly.of_int_poly P = Polynomial.smult ?c (\<Prod>i<n. [:- Root i, 1:])
[PROOF STEP]
have "lc \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lc \<noteq> 0
[PROOF STEP]
by (auto simp: lc_def)
[PROOF STATE]
proof (state)
this:
lc \<noteq> 0

goal (4 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
 3. [:inverse (of_int (Polynomial.lead_coeff P)):] * [:?c:] = 1
 4. Ring_Hom_Poly.of_int_poly P = Polynomial.smult ?c (\<Prod>i<n. [:- Root i, 1:])
[PROOF STEP]
thus "[:inverse lc:] * [:lc:] = 1"
[PROOF STATE]
proof (prove)
using this:
lc \<noteq> 0

goal (1 subgoal):
 1. [:inverse lc:] * [:lc:] = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[:inverse lc:] * [:lc:] = 1

goal (3 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
 3. Ring_Hom_Poly.of_int_poly P = Polynomial.smult (of_int (Polynomial.lead_coeff P)) (\<Prod>i<n. [:- Root i, 1:])
[PROOF STEP]
have "rsquarefree (of_int_poly P :: complex poly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rsquarefree (Ring_Hom_Poly.of_int_poly P)
[PROOF STEP]
using \<open>squarefree (of_int_poly P :: complex poly)\<close>
[PROOF STATE]
proof (prove)
using this:
squarefree (Ring_Hom_Poly.of_int_poly P)

goal (1 subgoal):
 1. rsquarefree (Ring_Hom_Poly.of_int_poly P)
[PROOF STEP]
by (intro squarefree_imp_rsquarefree)
[PROOF STATE]
proof (state)
this:
rsquarefree (Ring_Hom_Poly.of_int_poly P)

goal (3 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
 3. Ring_Hom_Poly.of_int_poly P = Polynomial.smult (of_int (Polynomial.lead_coeff P)) (\<Prod>i<n. [:- Root i, 1:])
[PROOF STEP]
hence "of_int_poly P = Polynomial.smult lc (\<Prod>x\<in>Roots. [:-x, 1:])"
[PROOF STATE]
proof (prove)
using this:
rsquarefree (Ring_Hom_Poly.of_int_poly P)

goal (1 subgoal):
 1. Ring_Hom_Poly.of_int_poly P = Polynomial.smult lc (\<Prod>x\<in>Roots. [:- x, 1:])
[PROOF STEP]
unfolding lc_def Roots_def of_int_hom.hom_lead_coeff[symmetric]
[PROOF STATE]
proof (prove)
using this:
rsquarefree (Ring_Hom_Poly.of_int_poly P)

goal (1 subgoal):
 1. Ring_Hom_Poly.of_int_poly P = Polynomial.smult (Polynomial.lead_coeff (Ring_Hom_Poly.of_int_poly P)) (\<Prod>x\<in>{x. ipoly P x = 0}. [:- x, 1:])
[PROOF STEP]
by (rule complex_poly_decompose_rsquarefree [symmetric])
[PROOF STATE]
proof (state)
this:
Ring_Hom_Poly.of_int_poly P = Polynomial.smult lc (\<Prod>x\<in>Roots. [:- x, 1:])

goal (3 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
 3. Ring_Hom_Poly.of_int_poly P = Polynomial.smult (of_int (Polynomial.lead_coeff P)) (\<Prod>i<n. [:- Root i, 1:])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Ring_Hom_Poly.of_int_poly P = Polynomial.smult lc (\<Prod>x\<in>Roots. [:- x, 1:])

goal (3 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
 3. Ring_Hom_Poly.of_int_poly P = Polynomial.smult (of_int (Polynomial.lead_coeff P)) (\<Prod>i<n. [:- Root i, 1:])
[PROOF STEP]
have "(\<Prod>x\<in>Roots. [:-x, 1:]) = (\<Prod>i<n. [:-Root i, 1:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>Roots. [:- x, 1:]) = (\<Prod>i<n. [:- Root i, 1:])
[PROOF STEP]
by (rule prod.reindex_bij_betw[OF Root, symmetric])
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>Roots. [:- x, 1:]) = (\<Prod>i<n. [:- Root i, 1:])

goal (3 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
 3. Ring_Hom_Poly.of_int_poly P = Polynomial.smult (of_int (Polynomial.lead_coeff P)) (\<Prod>i<n. [:- Root i, 1:])
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Ring_Hom_Poly.of_int_poly P = Polynomial.smult lc (\<Prod>i<n. [:- Root i, 1:])
[PROOF STEP]
show "of_int_poly P = Polynomial.smult lc (\<Prod>i<n. [:- Root i, 1:])"
[PROOF STATE]
proof (prove)
using this:
Ring_Hom_Poly.of_int_poly P = Polynomial.smult lc (\<Prod>i<n. [:- Root i, 1:])

goal (1 subgoal):
 1. Ring_Hom_Poly.of_int_poly P = Polynomial.smult lc (\<Prod>i<n. [:- Root i, 1:])
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Ring_Hom_Poly.of_int_poly P = Polynomial.smult lc (\<Prod>i<n. [:- Root i, 1:])

goal (2 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite {..<n}
 2. symmetric_mpoly {..<n} Q
[PROOF STEP]
show "symmetric_mpoly {..<n} Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. symmetric_mpoly {..<n} Q
[PROOF STEP]
unfolding symmetric_mpoly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<pi>. \<pi> permutes {..<n} \<longrightarrow> mpoly_map_vars \<pi> Q = Q
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes {..<n} \<Longrightarrow> mpoly_map_vars \<pi> Q = Q
[PROOF STEP]
fix \<pi>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes {..<n} \<Longrightarrow> mpoly_map_vars \<pi> Q = Q
[PROOF STEP]
assume \<pi>: "\<pi> permutes {..<n}"
[PROOF STATE]
proof (state)
this:
\<pi> permutes {..<n}

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes {..<n} \<Longrightarrow> mpoly_map_vars \<pi> Q = Q
[PROOF STEP]
have "mpoly_map_vars \<pi> Q = (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum> \<sigma> | \<sigma> permutes {..<n}.
                  Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm \<sigma>))))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mpoly_map_vars \<pi> Q = (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm \<sigma>))))))
[PROOF STEP]
by (simp add: Q_def permutes_bij[OF \<pi>])
[PROOF STATE]
proof (state)
this:
mpoly_map_vars \<pi> Q = (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm \<sigma>))))))

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes {..<n} \<Longrightarrow> mpoly_map_vars \<pi> Q = Q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mpoly_map_vars \<pi> Q = (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm \<sigma>))))))

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes {..<n} \<Longrightarrow> mpoly_map_vars \<pi> Q = Q
[PROOF STEP]
have "\<dots> = (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum> \<sigma> | \<sigma> permutes {..<n}.
                  Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<lambda>\<sigma>. convert_perm \<pi> \<circ> \<sigma>)) (convert_perm \<sigma>))))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm \<sigma>)))))) = (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))))
[PROOF STEP]
using \<pi>
[PROOF STATE]
proof (prove)
using this:
\<pi> permutes {..<n}

goal (1 subgoal):
 1. (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm \<sigma>)))))) = (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))))
[PROOF STEP]
by (intro prod.reindex_bij_betw [OF bij_convert', symmetric]) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm \<sigma>)))))) = (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))))

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes {..<n} \<Longrightarrow> mpoly_map_vars \<pi> Q = Q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm \<sigma>)))))) = (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))))

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes {..<n} \<Longrightarrow> mpoly_map_vars \<pi> Q = Q
[PROOF STEP]
have "\<dots> = Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>)))))) = Q
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>)))))) = (\<Prod>f\<in>tuples X. Const [:0, 1:] - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>))))))
[PROOF STEP]
proof (rule prod.cong, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. tuples X = tuples X
 2. \<And>x. x \<in> tuples X \<Longrightarrow> Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((x \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = Const [:0, 1:] - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (x (convert_perm \<sigma>)))))
[PROOF STEP]
case (2 f)
[PROOF STATE]
proof (state)
this:
f \<in> tuples X

goal (2 subgoals):
 1. tuples X = tuples X
 2. \<And>x. x \<in> tuples X \<Longrightarrow> Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((x \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = Const [:0, 1:] - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (x (convert_perm \<sigma>)))))
[PROOF STEP]
have "(\<Sum> \<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<lambda>\<sigma>. convert_perm \<pi> \<circ> \<sigma>)) (convert_perm \<sigma>))))) =
                  (\<Sum> \<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm (\<pi> \<circ> \<sigma>))))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm (\<pi> \<circ> \<sigma>))))))
[PROOF STEP]
using \<pi>
[PROOF STATE]
proof (prove)
using this:
\<pi> permutes {..<n}

goal (1 subgoal):
 1. (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm (\<pi> \<circ> \<sigma>))))))
[PROOF STEP]
by (intro sum.cong refl, subst convert_perm_compose) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm (\<pi> \<circ> \<sigma>))))))

goal (2 subgoals):
 1. tuples X = tuples X
 2. \<And>x. x \<in> tuples X \<Longrightarrow> Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((x \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = Const [:0, 1:] - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (x (convert_perm \<sigma>)))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm (\<pi> \<circ> \<sigma>))))))

goal (2 subgoals):
 1. tuples X = tuples X
 2. \<And>x. x \<in> tuples X \<Longrightarrow> Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((x \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = Const [:0, 1:] - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (x (convert_perm \<sigma>)))))
[PROOF STEP]
have "\<dots> = (\<Sum> \<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm (\<pi> \<circ> \<sigma>)))))) = (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>)))))
[PROOF STEP]
using \<pi>
[PROOF STATE]
proof (prove)
using this:
\<pi> permutes {..<n}

goal (1 subgoal):
 1. (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm (\<pi> \<circ> \<sigma>)))))) = (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>)))))
[PROOF STEP]
by (rule setum_permutations_compose_left [symmetric])
[PROOF STATE]
proof (state)
this:
(\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot (f (convert_perm (\<pi> \<circ> \<sigma>)))))) = (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>)))))

goal (2 subgoals):
 1. tuples X = tuples X
 2. \<And>x. x \<in> tuples X \<Longrightarrow> Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((x \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = Const [:0, 1:] - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (x (convert_perm \<sigma>)))))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>)))))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>)))))

goal (1 subgoal):
 1. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = Const [:0, 1:] - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>)))))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>))))) = Const [:0, 1:] - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var (\<sigma> (unRoot (f (convert_perm \<sigma>)))))

goal (1 subgoal):
 1. tuples X = tuples X
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Prod>f\<in>tuples X. Const (pCons 0 1) - (\<Sum>\<sigma> | \<sigma> permutes {..<n}. Var ((\<pi> \<circ> \<sigma>) (unRoot ((f \<circ> (\<circ>) (convert_perm \<pi>)) (convert_perm \<sigma>)))))) = Q

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes {..<n} \<Longrightarrow> mpoly_map_vars \<pi> Q = Q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mpoly_map_vars \<pi> Q = Q
[PROOF STEP]
show "mpoly_map_vars \<pi> Q = Q"
[PROOF STATE]
proof (prove)
using this:
mpoly_map_vars \<pi> Q = Q

goal (1 subgoal):
 1. mpoly_map_vars \<pi> Q = Q
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mpoly_map_vars \<pi> Q = Q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
symmetric_mpoly {..<n} Q

goal (1 subgoal):
 1. finite {..<n}
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
insertion (\<lambda>x. [:Root x:]) Q \<in> ratpolys

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
insertion (\<lambda>x. [:Root x:]) Q \<in> ratpolys

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "insertion (\<lambda>x. [:Root x:]) Q = Q1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion (\<lambda>x. [:Root x:]) Q = Q1
[PROOF STEP]
unfolding Q_def Q1_def insertion_prod insertion_sum insertion_diff insertion_Const insertion_Var
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>tuples X. [:0, 1:] - (\<Sum>xa\<in>{\<sigma>. \<sigma> permutes {..<n}}. [:Root (xa (unRoot (x (convert_perm xa)))):])) = (\<Prod>f\<in>tuples X. [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (f \<sigma>)), 1:])
[PROOF STEP]
proof (intro prod.cong, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. tuples X = tuples X
 2. \<And>x. x \<in> tuples X \<Longrightarrow> [:0, 1:] - (\<Sum>xa\<in>{\<sigma>. \<sigma> permutes {..<n}}. [:Root (xa (unRoot (x (convert_perm xa)))):]) = [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (x \<sigma>)), 1:]
[PROOF STEP]
case f: (2 f)
[PROOF STATE]
proof (state)
this:
f \<in> tuples X

goal (2 subgoals):
 1. tuples X = tuples X
 2. \<And>x. x \<in> tuples X \<Longrightarrow> [:0, 1:] - (\<Sum>xa\<in>{\<sigma>. \<sigma> permutes {..<n}}. [:Root (xa (unRoot (x (convert_perm xa)))):]) = [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (x \<sigma>)), 1:]
[PROOF STEP]
have "(\<Sum>\<sigma> | \<sigma> permutes {..<n}. [:Root (\<sigma> (unRoot (f (convert_perm \<sigma>)))):]) =
              (\<Sum>\<sigma> | \<sigma> permutes {..<n}. [:convert_perm \<sigma> (f (convert_perm \<sigma>)):])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<sigma> | \<sigma> permutes {..<n}. [:Root (\<sigma> (unRoot (f (convert_perm \<sigma>)))):]) = (\<Sum>\<sigma> | \<sigma> permutes {..<n}. [:convert_perm \<sigma> (f (convert_perm \<sigma>)):])
[PROOF STEP]
proof (rule sum.cong, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {\<sigma>. \<sigma> permutes {..<n}} = {\<sigma>. \<sigma> permutes {..<n}}
 2. \<And>x. x \<in> {\<sigma>. \<sigma> permutes {..<n}} \<Longrightarrow> [:Root (x (unRoot (f (convert_perm x)))):] = [:convert_perm x (f (convert_perm x)):]
[PROOF STEP]
case (2 \<sigma>)
[PROOF STATE]
proof (state)
this:
\<sigma> \<in> {\<sigma>. \<sigma> permutes {..<n}}

goal (2 subgoals):
 1. {\<sigma>. \<sigma> permutes {..<n}} = {\<sigma>. \<sigma> permutes {..<n}}
 2. \<And>x. x \<in> {\<sigma>. \<sigma> permutes {..<n}} \<Longrightarrow> [:Root (x (unRoot (f (convert_perm x)))):] = [:convert_perm x (f (convert_perm x)):]
[PROOF STEP]
have "convert_perm \<sigma> permutes Roots"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convert_perm \<sigma> permutes Roots
[PROOF STEP]
using bij_convert 2
[PROOF STATE]
proof (prove)
using this:
bij_betw convert_perm {\<sigma>. \<sigma> permutes {..<n}} {\<sigma>. \<sigma> permutes Roots}
\<sigma> \<in> {\<sigma>. \<sigma> permutes {..<n}}

goal (1 subgoal):
 1. convert_perm \<sigma> permutes Roots
[PROOF STEP]
by (auto simp: bij_betw_def)
[PROOF STATE]
proof (state)
this:
convert_perm \<sigma> permutes Roots

goal (2 subgoals):
 1. {\<sigma>. \<sigma> permutes {..<n}} = {\<sigma>. \<sigma> permutes {..<n}}
 2. \<And>x. x \<in> {\<sigma>. \<sigma> permutes {..<n}} \<Longrightarrow> [:Root (x (unRoot (f (convert_perm x)))):] = [:convert_perm x (f (convert_perm x)):]
[PROOF STEP]
hence "f (convert_perm \<sigma>) \<in> Roots"
[PROOF STATE]
proof (prove)
using this:
convert_perm \<sigma> permutes Roots

goal (1 subgoal):
 1. f (convert_perm \<sigma>) \<in> Roots
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
convert_perm \<sigma> permutes Roots
f \<in> tuples X

goal (1 subgoal):
 1. f (convert_perm \<sigma>) \<in> Roots
[PROOF STEP]
by (auto simp: tuples_def perms_def)
[PROOF STATE]
proof (state)
this:
f (convert_perm \<sigma>) \<in> Roots

goal (2 subgoals):
 1. {\<sigma>. \<sigma> permutes {..<n}} = {\<sigma>. \<sigma> permutes {..<n}}
 2. \<And>x. x \<in> {\<sigma>. \<sigma> permutes {..<n}} \<Longrightarrow> [:Root (x (unRoot (f (convert_perm x)))):] = [:convert_perm x (f (convert_perm x)):]
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
f (convert_perm \<sigma>) \<in> Roots

goal (1 subgoal):
 1. [:Root (\<sigma> (unRoot (f (convert_perm \<sigma>)))):] = [:convert_perm \<sigma> (f (convert_perm \<sigma>)):]
[PROOF STEP]
by (simp add: convert_perm_def)
[PROOF STATE]
proof (state)
this:
[:Root (\<sigma> (unRoot (f (convert_perm \<sigma>)))):] = [:convert_perm \<sigma> (f (convert_perm \<sigma>)):]

goal (1 subgoal):
 1. {\<sigma>. \<sigma> permutes {..<n}} = {\<sigma>. \<sigma> permutes {..<n}}
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>\<sigma> | \<sigma> permutes {..<n}. [:Root (\<sigma> (unRoot (f (convert_perm \<sigma>)))):]) = (\<Sum>\<sigma> | \<sigma> permutes {..<n}. [:convert_perm \<sigma> (f (convert_perm \<sigma>)):])

goal (2 subgoals):
 1. tuples X = tuples X
 2. \<And>x. x \<in> tuples X \<Longrightarrow> [:0, 1:] - (\<Sum>xa\<in>{\<sigma>. \<sigma> permutes {..<n}}. [:Root (xa (unRoot (x (convert_perm xa)))):]) = [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (x \<sigma>)), 1:]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>\<sigma> | \<sigma> permutes {..<n}. [:Root (\<sigma> (unRoot (f (convert_perm \<sigma>)))):]) = (\<Sum>\<sigma> | \<sigma> permutes {..<n}. [:convert_perm \<sigma> (f (convert_perm \<sigma>)):])

goal (2 subgoals):
 1. tuples X = tuples X
 2. \<And>x. x \<in> tuples X \<Longrightarrow> [:0, 1:] - (\<Sum>xa\<in>{\<sigma>. \<sigma> permutes {..<n}}. [:Root (xa (unRoot (x (convert_perm xa)))):]) = [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (x \<sigma>)), 1:]
[PROOF STEP]
have "\<dots> = (\<Sum>\<sigma> | \<sigma> permutes Roots. [:\<sigma> (f \<sigma>):])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<sigma> | \<sigma> permutes {..<n}. [:convert_perm \<sigma> (f (convert_perm \<sigma>)):]) = (\<Sum>\<sigma> | \<sigma> permutes Roots. [:\<sigma> (f \<sigma>):])
[PROOF STEP]
by (rule sum.reindex_bij_betw[OF bij_convert])
[PROOF STATE]
proof (state)
this:
(\<Sum>\<sigma> | \<sigma> permutes {..<n}. [:convert_perm \<sigma> (f (convert_perm \<sigma>)):]) = (\<Sum>\<sigma> | \<sigma> permutes Roots. [:\<sigma> (f \<sigma>):])

goal (2 subgoals):
 1. tuples X = tuples X
 2. \<And>x. x \<in> tuples X \<Longrightarrow> [:0, 1:] - (\<Sum>xa\<in>{\<sigma>. \<sigma> permutes {..<n}}. [:Root (xa (unRoot (x (convert_perm xa)))):]) = [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (x \<sigma>)), 1:]
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>\<sigma> | \<sigma> permutes {..<n}. [:Root (\<sigma> (unRoot (f (convert_perm \<sigma>)))):]) = (\<Sum>\<sigma> | \<sigma> permutes Roots. [:\<sigma> (f \<sigma>):])
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>\<sigma> | \<sigma> permutes {..<n}. [:Root (\<sigma> (unRoot (f (convert_perm \<sigma>)))):]) = (\<Sum>\<sigma> | \<sigma> permutes Roots. [:\<sigma> (f \<sigma>):])

goal (1 subgoal):
 1. [:0, 1:] - (\<Sum>x\<in>{\<sigma>. \<sigma> permutes {..<n}}. [:Root (x (unRoot (f (convert_perm x)))):]) = [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (f \<sigma>)), 1:]
[PROOF STEP]
by (simp flip: pCons_one coeff_lift_hom.hom_sum)
[PROOF STATE]
proof (state)
this:
[:0, 1:] - (\<Sum>x\<in>{\<sigma>. \<sigma> permutes {..<n}}. [:Root (x (unRoot (f (convert_perm x)))):]) = [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (f \<sigma>)), 1:]

goal (1 subgoal):
 1. tuples X = tuples X
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
insertion (\<lambda>x. [:Root x:]) Q = Q1

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Q1 \<in> ratpolys
[PROOF STEP]
have "Q1 \<in> ratpolys"
[PROOF STATE]
proof (prove)
using this:
Q1 \<in> ratpolys

goal (1 subgoal):
 1. Q1 \<in> ratpolys
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Q1 \<in> ratpolys

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Q1 \<in> ratpolys
[PROOF STEP]
obtain Q2 :: "rat poly" where Q2: "Q1 = map_poly of_rat Q2"
[PROOF STATE]
proof (prove)
using this:
Q1 \<in> ratpolys

goal (1 subgoal):
 1. (\<And>Q2. Q1 = map_poly of_rat Q2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding ratpolys_def
[PROOF STATE]
proof (prove)
using this:
Q1 \<in> {p. \<forall>i. poly.coeff p i \<in> \<rat>}

goal (1 subgoal):
 1. (\<And>Q2. Q1 = map_poly of_rat Q2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ratpolyE[of Q1]
[PROOF STATE]
proof (prove)
using this:
Q1 \<in> {p. \<forall>i. poly.coeff p i \<in> \<rat>}
\<lbrakk>\<forall>i. poly.coeff Q1 i \<in> \<rat>; \<And>q. Q1 = map_poly of_rat q \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>Q2. Q1 = map_poly of_rat Q2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Q1 = map_poly of_rat Q2

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "Q1 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q1 \<noteq> 0
[PROOF STEP]
unfolding Q1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>f\<in>tuples X. [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (f \<sigma>)), 1:]) \<noteq> 0
[PROOF STEP]
using fin_tuples[of X]
[PROOF STATE]
proof (prove)
using this:
finite (tuples X)

goal (1 subgoal):
 1. (\<Prod>f\<in>tuples X. [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (f \<sigma>)), 1:]) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Q1 \<noteq> 0

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with Q2
[PROOF STATE]
proof (chain)
picking this:
Q1 = map_poly of_rat Q2
Q1 \<noteq> 0
[PROOF STEP]
have "Q2 \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
Q1 = map_poly of_rat Q2
Q1 \<noteq> 0

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

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain Q3 :: "int poly" and lc :: rat
        where Q3: "Q2 = Polynomial.smult lc (of_int_poly Q3)" and "lc > 0" and "content Q3 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>lc Q3. \<lbrakk>Q2 = Polynomial.smult lc (Ring_Hom_Poly.of_int_poly Q3); 0 < lc; Polynomial.content Q3 = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using rat_to_normalized_int_poly_exists[OF \<open>Q2 \<noteq> 0\<close>]
[PROOF STATE]
proof (prove)
using this:
(\<And>q lc. \<lbrakk>Q2 = Polynomial.smult lc (Ring_Hom_Poly.of_int_poly q); 0 < lc; Polynomial.content q = 1\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>lc Q3. \<lbrakk>Q2 = Polynomial.smult lc (Ring_Hom_Poly.of_int_poly Q3); 0 < lc; Polynomial.content Q3 = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
Q2 = Polynomial.smult lc (Ring_Hom_Poly.of_int_poly Q3)
0 < lc
Polynomial.content Q3 = 1

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "poly_roots (of_int_poly Q3) = poly_roots (map_poly (of_rat \<circ> of_int) Q3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (Ring_Hom_Poly.of_int_poly Q3) = poly_roots (map_poly (of_rat \<circ> rat_of_int) Q3)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_roots (Ring_Hom_Poly.of_int_poly Q3) = poly_roots (map_poly (of_rat \<circ> rat_of_int) Q3)

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_roots (Ring_Hom_Poly.of_int_poly Q3) = poly_roots (map_poly (of_rat \<circ> rat_of_int) Q3)

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "map_poly (of_rat \<circ> of_int) Q3 = map_poly of_rat (map_poly of_int Q3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly (of_rat \<circ> rat_of_int) Q3 = map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)
[PROOF STEP]
by (subst map_poly_map_poly) auto
[PROOF STATE]
proof (state)
this:
map_poly (of_rat \<circ> rat_of_int) Q3 = map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_poly (of_rat \<circ> rat_of_int) Q3 = map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "poly_roots \<dots> = poly_roots (Polynomial.smult (of_rat lc) \<dots>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)) = poly_roots (Polynomial.smult (of_rat lc) (map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)))
[PROOF STEP]
using \<open>lc > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < lc

goal (1 subgoal):
 1. poly_roots (map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)) = poly_roots (Polynomial.smult (of_rat lc) (map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_roots (map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)) = poly_roots (Polynomial.smult (of_rat lc) (map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)))

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_roots (map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)) = poly_roots (Polynomial.smult (of_rat lc) (map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)))

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "Polynomial.smult (of_rat lc) (map_poly of_rat (map_poly of_int Q3)) =
                 map_poly of_rat (Polynomial.smult lc (map_poly of_int Q3))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult (of_rat lc) (map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)) = map_poly of_rat (Polynomial.smult lc (Ring_Hom_Poly.of_int_poly Q3))
[PROOF STEP]
by (simp add: of_rat_hom.map_poly_hom_smult)
[PROOF STATE]
proof (state)
this:
Polynomial.smult (of_rat lc) (map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)) = map_poly of_rat (Polynomial.smult lc (Ring_Hom_Poly.of_int_poly Q3))

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Polynomial.smult (of_rat lc) (map_poly of_rat (Ring_Hom_Poly.of_int_poly Q3)) = map_poly of_rat (Polynomial.smult lc (Ring_Hom_Poly.of_int_poly Q3))

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "\<dots> = Q1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly of_rat (Polynomial.smult lc (Ring_Hom_Poly.of_int_poly Q3)) = Q1
[PROOF STEP]
by (simp only: Q3 [symmetric] Q2 [symmetric])
[PROOF STATE]
proof (state)
this:
map_poly of_rat (Polynomial.smult lc (Ring_Hom_Poly.of_int_poly Q3)) = Q1

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_poly of_rat (Polynomial.smult lc (Ring_Hom_Poly.of_int_poly Q3)) = Q1

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "poly_roots Q1 = R X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots Q1 = R X
[PROOF STEP]
unfolding Q1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (\<Prod>f\<in>tuples X. [:- (\<Sum>\<sigma> | \<sigma> permutes Roots. \<sigma> (f \<sigma>)), 1:]) = R X
[PROOF STEP]
by (subst poly_roots_prod, force, subst poly_roots_linear)
           (auto simp: R_def perms_def sum_mset_image_mset_singleton sum_unfold_sum_mset)
[PROOF STATE]
proof (state)
this:
poly_roots Q1 = R X

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly_roots (Ring_Hom_Poly.of_int_poly Q3) = R X
[PROOF STEP]
have "\<exists>Q. poly_roots (of_int_poly Q) = R X \<and> content Q = 1"
[PROOF STATE]
proof (prove)
using this:
poly_roots (Ring_Hom_Poly.of_int_poly Q3) = R X

goal (1 subgoal):
 1. \<exists>Q. poly_roots (Ring_Hom_Poly.of_int_poly Q) = R X \<and> Polynomial.content Q = 1
[PROOF STEP]
using \<open>content Q3 = 1\<close>
[PROOF STATE]
proof (prove)
using this:
poly_roots (Ring_Hom_Poly.of_int_poly Q3) = R X
Polynomial.content Q3 = 1

goal (1 subgoal):
 1. \<exists>Q. poly_roots (Ring_Hom_Poly.of_int_poly Q) = R X \<and> Polynomial.content Q = 1
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>Q. poly_roots (Ring_Hom_Poly.of_int_poly Q) = R X \<and> Polynomial.content Q = 1

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?Xa2 \<in> Roots_ms \<Longrightarrow> \<exists>Q. poly_roots (Ring_Hom_Poly.of_int_poly Q) = R ?Xa2 \<and> Polynomial.content Q = 1

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
hence "\<exists>Q. \<forall>X\<in>Roots_ms. poly_roots (of_int_poly (Q X)) = R X \<and> content (Q X) = 1"
[PROOF STATE]
proof (prove)
using this:
?Xa2 \<in> Roots_ms \<Longrightarrow> \<exists>Q. poly_roots (Ring_Hom_Poly.of_int_poly Q) = R ?Xa2 \<and> Polynomial.content Q = 1

goal (1 subgoal):
 1. \<exists>Q. \<forall>X\<in>Roots_ms. poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X \<and> Polynomial.content (Q X) = 1
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>Q. \<forall>X\<in>Roots_ms. poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X \<and> Polynomial.content (Q X) = 1

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q X) = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>Q. \<forall>X\<in>Roots_ms. poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X \<and> Polynomial.content (Q X) = 1

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<exists>Q. \<forall>X\<in>Roots_ms. poly_roots (Ring_Hom_Poly.of_int_poly (Q X)) = R X \<and> Polynomial.content (Q X) = 1
\<lbrakk>\<And>X. X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (?Q X)) = R X; \<And>X. X \<in> Roots_ms \<Longrightarrow> Polynomial.content (?Q X) = 1\<rbrakk> \<Longrightarrow> thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q ?X)) = R ?X
?X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q ?X) = 1

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    We can now collect all the $e^{\sum \alpha_i}$ that happen to be equal and let the following
    be their coefficients:
  \<close>
[PROOF STATE]
proof (state)
this:
?X \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q ?X)) = R ?X
?X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q ?X) = 1

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
define \<beta>'' :: "int poly \<Rightarrow> int"
    where "\<beta>'' = (\<lambda>q. \<Sum>X\<in>Roots_ms. int (count (prime_factorization (Q X)) q) * (\<Prod>x\<in>#X. \<beta>' x))"
[PROOF STATE]
proof (state)
this:
\<beta>'' = (\<lambda>q. \<Sum>X\<in>Roots_ms. int (count (prime_factorization (Q X)) q) * \<Prod>\<^sub># (image_mset \<beta>' X))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have supp_\<beta>'': "{q. \<beta>'' q \<noteq> 0} \<subseteq> (\<Union>X\<in>Roots_ms. prime_factors (Q X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<subseteq> (\<Union>X\<in>Roots_ms. prime_factors (Q X))
[PROOF STEP]
unfolding \<beta>''_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {q. (\<Sum>X\<in>Roots_ms. int (count (prime_factorization (Q X)) q) * \<Prod>\<^sub># (image_mset \<beta>' X)) \<noteq> 0} \<subseteq> (\<Union>X\<in>Roots_ms. prime_factors (Q X))
[PROOF STEP]
using sum.not_neutral_contains_not_neutral
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>sum ?g ?A \<noteq> (0::?'a); \<And>a. \<lbrakk>a \<in> ?A; ?g a \<noteq> (0::?'a)\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. {q. (\<Sum>X\<in>Roots_ms. int (count (prime_factorization (Q X)) q) * \<Prod>\<^sub># (image_mset \<beta>' X)) \<noteq> 0} \<subseteq> (\<Union>X\<in>Roots_ms. prime_factors (Q X))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
{q. \<beta>'' q \<noteq> 0} \<subseteq> (\<Union>X\<in>Roots_ms. prime_factors (Q X))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    We have to prove that \<open>\<beta>''\<close> is not zero everywhere. We do this by selecting the nonzero term
    with the maximal exponent (w.r.t. the lexicographic ordering on the complex numbers) in every
    factor of the product and show that there is no other summand corresponding to these, so
    that their non-zero coefficient cannot get cancelled.
  \<close>
[PROOF STATE]
proof (state)
this:
{q. \<beta>'' q \<noteq> 0} \<subseteq> (\<Union>X\<in>Roots_ms. prime_factors (Q X))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "{q. \<beta>'' q \<noteq> 0} \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
define f where "f = restrict (\<lambda>\<sigma>. inv_into UNIV \<sigma> (complex_lex.Max (\<sigma> ` X))) perms"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>\<sigma>\<in>perms. inv \<sigma> (complex_lex.Max (\<sigma> ` X)))

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
have f: "f \<in> perms \<rightarrow> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> perms \<rightarrow> X
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> perms \<Longrightarrow> f x \<in> X
[PROOF STEP]
fix \<sigma>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> perms \<Longrightarrow> f x \<in> X
[PROOF STEP]
assume \<sigma>: "\<sigma> \<in> perms"
[PROOF STATE]
proof (state)
this:
\<sigma> \<in> perms

goal (1 subgoal):
 1. \<And>x. x \<in> perms \<Longrightarrow> f x \<in> X
[PROOF STEP]
have "complex_lex.Max (\<sigma> ` X) \<in> \<sigma> ` X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_lex.Max (\<sigma> ` X) \<in> \<sigma> ` X
[PROOF STEP]
using \<open>X \<noteq> {}\<close>
[PROOF STATE]
proof (prove)
using this:
X \<noteq> {}

goal (1 subgoal):
 1. complex_lex.Max (\<sigma> ` X) \<in> \<sigma> ` X
[PROOF STEP]
by (intro complex_lex.Max_in finite_imageI) auto
[PROOF STATE]
proof (state)
this:
complex_lex.Max (\<sigma> ` X) \<in> \<sigma> ` X

goal (1 subgoal):
 1. \<And>x. x \<in> perms \<Longrightarrow> f x \<in> X
[PROOF STEP]
thus "f \<sigma> \<in> X"
[PROOF STATE]
proof (prove)
using this:
complex_lex.Max (\<sigma> ` X) \<in> \<sigma> ` X

goal (1 subgoal):
 1. f \<sigma> \<in> X
[PROOF STEP]
using \<sigma>
[PROOF STATE]
proof (prove)
using this:
complex_lex.Max (\<sigma> ` X) \<in> \<sigma> ` X
\<sigma> \<in> perms

goal (1 subgoal):
 1. f \<sigma> \<in> X
[PROOF STEP]
by (auto simp: f_def permutes_inverses[of \<sigma> Roots] perms_def)
[PROOF STATE]
proof (state)
this:
f \<sigma> \<in> X

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f \<in> perms \<rightarrow> X

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
hence f': "f \<in> perms \<rightarrow>\<^sub>E Roots"
[PROOF STATE]
proof (prove)
using this:
f \<in> perms \<rightarrow> X

goal (1 subgoal):
 1. f \<in> perms \<rightarrow>\<^sub>E Roots
[PROOF STEP]
using \<open>X \<subseteq> Roots\<close>
[PROOF STATE]
proof (prove)
using this:
f \<in> perms \<rightarrow> X
X \<subseteq> Roots

goal (1 subgoal):
 1. f \<in> perms \<rightarrow>\<^sub>E Roots
[PROOF STEP]
by (auto simp: f_def PiE_def)
[PROOF STATE]
proof (state)
this:
f \<in> perms \<rightarrow>\<^sub>E Roots

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
define Y where "Y = image_mset f (mset_set perms)"
[PROOF STATE]
proof (state)
this:
Y = image_mset f (mset_set perms)

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
have "Y \<in> Roots_ms"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y \<in> Roots_ms
[PROOF STEP]
using f' \<open>finite perms\<close>
[PROOF STATE]
proof (prove)
using this:
f \<in> perms \<rightarrow>\<^sub>E Roots
finite perms

goal (1 subgoal):
 1. Y \<in> Roots_ms
[PROOF STEP]
by (auto simp: Roots_ms_def Y_def)
[PROOF STATE]
proof (state)
this:
Y \<in> Roots_ms

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
have "(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># R Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># R Y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># R Y
[PROOF STEP]
from f'
[PROOF STATE]
proof (chain)
picking this:
f \<in> perms \<rightarrow>\<^sub>E Roots
[PROOF STEP]
have "f \<in> tuples Y"
[PROOF STATE]
proof (prove)
using this:
f \<in> perms \<rightarrow>\<^sub>E Roots

goal (1 subgoal):
 1. f \<in> tuples Y
[PROOF STEP]
unfolding tuples_def Y_def
[PROOF STATE]
proof (prove)
using this:
f \<in> perms \<rightarrow>\<^sub>E Roots

goal (1 subgoal):
 1. f \<in> {fa \<in> perms \<rightarrow>\<^sub>E Roots. image_mset fa (mset_set perms) = image_mset f (mset_set perms)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f \<in> tuples Y

goal (1 subgoal):
 1. (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># R Y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<in> tuples Y

goal (1 subgoal):
 1. (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># R Y
[PROOF STEP]
unfolding R_def
[PROOF STATE]
proof (prove)
using this:
f \<in> tuples Y

goal (1 subgoal):
 1. (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># {#\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>). f \<in># mset_set (tuples Y)#}
[PROOF STEP]
using fin_tuples[of Y]
[PROOF STATE]
proof (prove)
using this:
f \<in> tuples Y
finite (tuples Y)

goal (1 subgoal):
 1. (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># {#\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>). f \<in># mset_set (tuples Y)#}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># R Y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># R Y

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># R Y

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
have "R Y = poly_roots (of_int_poly (Q Y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R Y = poly_roots (Ring_Hom_Poly.of_int_poly (Q Y))
[PROOF STEP]
by (rule Q(1) [symmetric]) fact
[PROOF STATE]
proof (state)
this:
R Y = poly_roots (Ring_Hom_Poly.of_int_poly (Q Y))

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
R Y = poly_roots (Ring_Hom_Poly.of_int_poly (Q Y))

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
have "\<dots> = (\<Sum>p\<in>#prime_factorization (Q Y). poly_roots (of_int_poly p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (Ring_Hom_Poly.of_int_poly (Q Y)) = (\<Sum>p\<in>#prime_factorization (Q Y). poly_roots (Ring_Hom_Poly.of_int_poly p))
[PROOF STEP]
by (rule poly_roots_of_int_conv_sum_prime_factors)
[PROOF STATE]
proof (state)
this:
poly_roots (Ring_Hom_Poly.of_int_poly (Q Y)) = (\<Sum>p\<in>#prime_factorization (Q Y). poly_roots (Ring_Hom_Poly.of_int_poly p))

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># (\<Sum>p\<in>#prime_factorization (Q Y). poly_roots (Ring_Hom_Poly.of_int_poly p))
[PROOF STEP]
obtain q where q: "q \<in> prime_factors (Q Y)" "(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># poly_roots (of_int_poly q)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># (\<Sum>p\<in>#prime_factorization (Q Y). poly_roots (Ring_Hom_Poly.of_int_poly p))

goal (1 subgoal):
 1. (\<And>q. \<lbrakk>q \<in># prime_factorization (Q Y); (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># poly_roots (Ring_Hom_Poly.of_int_poly q)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q \<in># prime_factorization (Q Y)
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># poly_roots (Ring_Hom_Poly.of_int_poly q)

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
have "\<beta>'' q = (\<Sum>X\<in>{Y}. int (count (prime_factorization (Q X)) q) * prod_mset (image_mset \<beta>' X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<beta>'' q = (\<Sum>X\<in>{Y}. int (count (prime_factorization (Q X)) q) * \<Prod>\<^sub># (image_mset \<beta>' X))
[PROOF STEP]
unfolding \<beta>''_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>X\<in>Roots_ms. int (count (prime_factorization (Q X)) q) * \<Prod>\<^sub># (image_mset \<beta>' X)) = (\<Sum>X\<in>{Y}. int (count (prime_factorization (Q X)) q) * \<Prod>\<^sub># (image_mset \<beta>' X))
[PROOF STEP]
proof (intro sum.mono_neutral_right ballI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite Roots_ms
 2. {Y} \<subseteq> Roots_ms
 3. \<And>i. i \<in> Roots_ms - {Y} \<Longrightarrow> int (count (prime_factorization (Q i)) q) * \<Prod>\<^sub># (image_mset \<beta>' i) = 0
[PROOF STEP]
fix Y'
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite Roots_ms
 2. {Y} \<subseteq> Roots_ms
 3. \<And>i. i \<in> Roots_ms - {Y} \<Longrightarrow> int (count (prime_factorization (Q i)) q) * \<Prod>\<^sub># (image_mset \<beta>' i) = 0
[PROOF STEP]
assume Y': "Y' \<in> Roots_ms - {Y}"
[PROOF STATE]
proof (state)
this:
Y' \<in> Roots_ms - {Y}

goal (3 subgoals):
 1. finite Roots_ms
 2. {Y} \<subseteq> Roots_ms
 3. \<And>i. i \<in> Roots_ms - {Y} \<Longrightarrow> int (count (prime_factorization (Q i)) q) * \<Prod>\<^sub># (image_mset \<beta>' i) = 0
[PROOF STEP]
show "int (count (prime_factorization (Q Y')) q) * \<Prod>\<^sub># (image_mset \<beta>' Y') = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (count (prime_factorization (Q Y')) q) * \<Prod>\<^sub># (image_mset \<beta>' Y') = 0
[PROOF STEP]
proof (cases "set_mset Y' \<subseteq> X")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set_mset Y' \<subseteq> X \<Longrightarrow> int (count (prime_factorization (Q Y')) q) * \<Prod>\<^sub># (image_mset \<beta>' Y') = 0
 2. \<not> set_mset Y' \<subseteq> X \<Longrightarrow> int (count (prime_factorization (Q Y')) q) * \<Prod>\<^sub># (image_mset \<beta>' Y') = 0
[PROOF STEP]
case Y'_subset: True
[PROOF STATE]
proof (state)
this:
set_mset Y' \<subseteq> X

goal (2 subgoals):
 1. set_mset Y' \<subseteq> X \<Longrightarrow> int (count (prime_factorization (Q Y')) q) * \<Prod>\<^sub># (image_mset \<beta>' Y') = 0
 2. \<not> set_mset Y' \<subseteq> X \<Longrightarrow> int (count (prime_factorization (Q Y')) q) * \<Prod>\<^sub># (image_mset \<beta>' Y') = 0
[PROOF STEP]
have "q \<notin> prime_factors (Q Y')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q \<notin> prime_factors (Q Y')
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q \<in># prime_factorization (Q Y') \<Longrightarrow> False
[PROOF STEP]
assume q': "q \<in> prime_factors (Q Y')"
[PROOF STATE]
proof (state)
this:
q \<in># prime_factorization (Q Y')

goal (1 subgoal):
 1. q \<in># prime_factorization (Q Y') \<Longrightarrow> False
[PROOF STEP]
have "poly_roots (of_int_poly q :: complex poly) \<subseteq>#
                         poly_roots (of_int_poly (Q Y'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (Ring_Hom_Poly.of_int_poly q) \<subseteq># poly_roots (Ring_Hom_Poly.of_int_poly (Q Y'))
[PROOF STEP]
using q'
[PROOF STATE]
proof (prove)
using this:
q \<in># prime_factorization (Q Y')

goal (1 subgoal):
 1. poly_roots (Ring_Hom_Poly.of_int_poly q) \<subseteq># poly_roots (Ring_Hom_Poly.of_int_poly (Q Y'))
[PROOF STEP]
by (intro dvd_imp_poly_roots_subset of_int_poly_hom.hom_dvd) auto
[PROOF STATE]
proof (state)
this:
poly_roots (Ring_Hom_Poly.of_int_poly q) \<subseteq># poly_roots (Ring_Hom_Poly.of_int_poly (Q Y'))

goal (1 subgoal):
 1. q \<in># prime_factorization (Q Y') \<Longrightarrow> False
[PROOF STEP]
with q(2)
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># poly_roots (Ring_Hom_Poly.of_int_poly q)
poly_roots (Ring_Hom_Poly.of_int_poly q) \<subseteq># poly_roots (Ring_Hom_Poly.of_int_poly (Q Y'))
[PROOF STEP]
have "(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># poly_roots (of_int_poly (Q Y'))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># poly_roots (Ring_Hom_Poly.of_int_poly q)
poly_roots (Ring_Hom_Poly.of_int_poly q) \<subseteq># poly_roots (Ring_Hom_Poly.of_int_poly (Q Y'))

goal (1 subgoal):
 1. (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># poly_roots (Ring_Hom_Poly.of_int_poly (Q Y'))
[PROOF STEP]
by (meson mset_subset_eqD)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># poly_roots (Ring_Hom_Poly.of_int_poly (Q Y'))

goal (1 subgoal):
 1. q \<in># prime_factorization (Q Y') \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># poly_roots (Ring_Hom_Poly.of_int_poly (Q Y'))

goal (1 subgoal):
 1. q \<in># prime_factorization (Q Y') \<Longrightarrow> False
[PROOF STEP]
have "poly_roots (of_int_poly (Q Y')) = R Y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (Ring_Hom_Poly.of_int_poly (Q Y')) = R Y'
[PROOF STEP]
using Q(1)[of Y'] Y'
[PROOF STATE]
proof (prove)
using this:
Y' \<in> Roots_ms \<Longrightarrow> poly_roots (Ring_Hom_Poly.of_int_poly (Q Y')) = R Y'
Y' \<in> Roots_ms - {Y}

goal (1 subgoal):
 1. poly_roots (Ring_Hom_Poly.of_int_poly (Q Y')) = R Y'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_roots (Ring_Hom_Poly.of_int_poly (Q Y')) = R Y'

goal (1 subgoal):
 1. q \<in># prime_factorization (Q Y') \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># R Y'
[PROOF STEP]
obtain g where g: "g \<in> tuples Y'" "(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) = (\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># R Y'

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>g \<in> tuples Y'; (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) = (\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding R_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># {#\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>). f \<in># mset_set (tuples Y')#}

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>g \<in> tuples Y'; (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) = (\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using fin_tuples[of Y']
[PROOF STATE]
proof (prove)
using this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># {#\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>). f \<in># mset_set (tuples Y')#}
finite (tuples Y')

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>g \<in> tuples Y'; (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) = (\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g \<in> tuples Y'
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) = (\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>))

goal (1 subgoal):
 1. q \<in># prime_factorization (Q Y') \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
g \<in> tuples Y'
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) = (\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>))

goal (1 subgoal):
 1. q \<in># prime_factorization (Q Y') \<Longrightarrow> False
[PROOF STEP]
have "(\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>)) <\<^sub>\<complex> (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>)) <\<^sub>\<complex> (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))
[PROOF STEP]
proof (rule sum_strict_mono_ex1_complex_lex)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite perms
 2. \<forall>x\<in>perms. x (g x) \<le>\<^sub>\<complex> x (f x)
 3. \<exists>a\<in>perms. a (g a) <\<^sub>\<complex> a (f a)
[PROOF STEP]
show le: "\<forall>\<sigma>\<in>perms. \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<sigma>\<in>perms. \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<sigma>. \<sigma> \<in> perms \<Longrightarrow> \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
fix \<sigma>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<sigma>. \<sigma> \<in> perms \<Longrightarrow> \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
assume \<sigma>: "\<sigma> \<in> perms"
[PROOF STATE]
proof (state)
this:
\<sigma> \<in> perms

goal (1 subgoal):
 1. \<And>\<sigma>. \<sigma> \<in> perms \<Longrightarrow> \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
hence \<sigma>': "\<sigma> permutes Roots"
[PROOF STATE]
proof (prove)
using this:
\<sigma> \<in> perms

goal (1 subgoal):
 1. \<sigma> permutes Roots
[PROOF STEP]
by (auto simp: perms_def)
[PROOF STATE]
proof (state)
this:
\<sigma> permutes Roots

goal (1 subgoal):
 1. \<And>\<sigma>. \<sigma> \<in> perms \<Longrightarrow> \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
have "image_mset g (mset_set perms) = Y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset g (mset_set perms) = Y'
[PROOF STEP]
using g
[PROOF STATE]
proof (prove)
using this:
g \<in> tuples Y'
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) = (\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>))

goal (1 subgoal):
 1. image_mset g (mset_set perms) = Y'
[PROOF STEP]
by (auto simp: tuples_def)
[PROOF STATE]
proof (state)
this:
image_mset g (mset_set perms) = Y'

goal (1 subgoal):
 1. \<And>\<sigma>. \<sigma> \<in> perms \<Longrightarrow> \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
image_mset g (mset_set perms) = Y'

goal (1 subgoal):
 1. \<And>\<sigma>. \<sigma> \<in> perms \<Longrightarrow> \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
have "set_mset \<dots> \<subseteq> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_mset Y' \<subseteq> X
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
set_mset Y' \<subseteq> X

goal (1 subgoal):
 1. \<And>\<sigma>. \<sigma> \<in> perms \<Longrightarrow> \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set_mset (image_mset g (mset_set perms)) \<subseteq> X
[PROOF STEP]
have "g ` perms \<subseteq> X"
[PROOF STATE]
proof (prove)
using this:
set_mset (image_mset g (mset_set perms)) \<subseteq> X

goal (1 subgoal):
 1. g ` perms \<subseteq> X
[PROOF STEP]
using \<open>finite perms\<close>
[PROOF STATE]
proof (prove)
using this:
set_mset (image_mset g (mset_set perms)) \<subseteq> X
finite perms

goal (1 subgoal):
 1. g ` perms \<subseteq> X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g ` perms \<subseteq> X

goal (1 subgoal):
 1. \<And>\<sigma>. \<sigma> \<in> perms \<Longrightarrow> \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
hence "\<sigma> (g \<sigma>) \<le>\<^sub>\<complex> complex_lex.Max (\<sigma> ` X)"
[PROOF STATE]
proof (prove)
using this:
g ` perms \<subseteq> X

goal (1 subgoal):
 1. \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> complex_lex.Max (\<sigma> ` X)
[PROOF STEP]
using \<open>finite perms\<close> \<sigma>
[PROOF STATE]
proof (prove)
using this:
g ` perms \<subseteq> X
finite perms
\<sigma> \<in> perms

goal (1 subgoal):
 1. \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> complex_lex.Max (\<sigma> ` X)
[PROOF STEP]
by (intro complex_lex.Max.coboundedI finite_imageI imageI)
                   (auto simp: tuples_def)
[PROOF STATE]
proof (state)
this:
\<sigma> (g \<sigma>) \<le>\<^sub>\<complex> complex_lex.Max (\<sigma> ` X)

goal (1 subgoal):
 1. \<And>\<sigma>. \<sigma> \<in> perms \<Longrightarrow> \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<sigma> (g \<sigma>) \<le>\<^sub>\<complex> complex_lex.Max (\<sigma> ` X)

goal (1 subgoal):
 1. \<And>\<sigma>. \<sigma> \<in> perms \<Longrightarrow> \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
have "\<dots> = \<sigma> (f \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_lex.Max (\<sigma> ` X) = \<sigma> (f \<sigma>)
[PROOF STEP]
using \<sigma>
[PROOF STATE]
proof (prove)
using this:
\<sigma> \<in> perms

goal (1 subgoal):
 1. complex_lex.Max (\<sigma> ` X) = \<sigma> (f \<sigma>)
[PROOF STEP]
by (simp add: f_def permutes_inverses[OF \<sigma>'])
[PROOF STATE]
proof (state)
this:
complex_lex.Max (\<sigma> ` X) = \<sigma> (f \<sigma>)

goal (1 subgoal):
 1. \<And>\<sigma>. \<sigma> \<in> perms \<Longrightarrow> \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
show "\<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)"
[PROOF STATE]
proof (prove)
using this:
\<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)

goal (1 subgoal):
 1. \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<sigma>\<in>perms. \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)

goal (2 subgoals):
 1. finite perms
 2. \<exists>a\<in>perms. a (g a) <\<^sub>\<complex> a (f a)
[PROOF STEP]
have "image_mset g (mset_set perms) \<noteq> image_mset f (mset_set perms)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset g (mset_set perms) \<noteq> image_mset f (mset_set perms)
[PROOF STEP]
using Y' g
[PROOF STATE]
proof (prove)
using this:
Y' \<in> Roots_ms - {Y}
g \<in> tuples Y'
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) = (\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>))

goal (1 subgoal):
 1. image_mset g (mset_set perms) \<noteq> image_mset f (mset_set perms)
[PROOF STEP]
by (auto simp: tuples_def Y_def)
[PROOF STATE]
proof (state)
this:
image_mset g (mset_set perms) \<noteq> image_mset f (mset_set perms)

goal (2 subgoals):
 1. finite perms
 2. \<exists>a\<in>perms. a (g a) <\<^sub>\<complex> a (f a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
image_mset g (mset_set perms) \<noteq> image_mset f (mset_set perms)
[PROOF STEP]
obtain \<sigma> where \<sigma>: "\<sigma> \<in># mset_set perms" "g \<sigma> \<noteq> f \<sigma>"
[PROOF STATE]
proof (prove)
using this:
image_mset g (mset_set perms) \<noteq> image_mset f (mset_set perms)

goal (1 subgoal):
 1. (\<And>\<sigma>. \<lbrakk>\<sigma> \<in># mset_set perms; g \<sigma> \<noteq> f \<sigma>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson multiset.map_cong)
[PROOF STATE]
proof (state)
this:
\<sigma> \<in># mset_set perms
g \<sigma> \<noteq> f \<sigma>

goal (2 subgoals):
 1. finite perms
 2. \<exists>a\<in>perms. a (g a) <\<^sub>\<complex> a (f a)
[PROOF STEP]
have "\<sigma> permutes Roots"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<sigma> permutes Roots
[PROOF STEP]
using \<sigma> \<open>finite perms\<close>
[PROOF STATE]
proof (prove)
using this:
\<sigma> \<in># mset_set perms
g \<sigma> \<noteq> f \<sigma>
finite perms

goal (1 subgoal):
 1. \<sigma> permutes Roots
[PROOF STEP]
by (auto simp: perms_def)
[PROOF STATE]
proof (state)
this:
\<sigma> permutes Roots

goal (2 subgoals):
 1. finite perms
 2. \<exists>a\<in>perms. a (g a) <\<^sub>\<complex> a (f a)
[PROOF STEP]
have "\<sigma> (g \<sigma>) \<noteq> \<sigma> (f \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<sigma> (g \<sigma>) \<noteq> \<sigma> (f \<sigma>)
[PROOF STEP]
using permutes_inj[OF \<open>\<sigma> permutes Roots\<close>] \<sigma>
[PROOF STATE]
proof (prove)
using this:
inj \<sigma>
\<sigma> \<in># mset_set perms
g \<sigma> \<noteq> f \<sigma>

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

goal (2 subgoals):
 1. finite perms
 2. \<exists>a\<in>perms. a (g a) <\<^sub>\<complex> a (f a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<sigma> (g \<sigma>) \<noteq> \<sigma> (f \<sigma>)

goal (2 subgoals):
 1. finite perms
 2. \<exists>a\<in>perms. a (g a) <\<^sub>\<complex> a (f a)
[PROOF STEP]
have "\<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
using le \<sigma> \<open>finite perms\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>\<sigma>\<in>perms. \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
\<sigma> \<in># mset_set perms
g \<sigma> \<noteq> f \<sigma>
finite perms

goal (1 subgoal):
 1. \<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)

goal (2 subgoals):
 1. finite perms
 2. \<exists>a\<in>perms. a (g a) <\<^sub>\<complex> a (f a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<sigma> (g \<sigma>) \<noteq> \<sigma> (f \<sigma>)
\<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
have "\<sigma> (g \<sigma>) <\<^sub>\<complex> \<sigma> (f \<sigma>)"
[PROOF STATE]
proof (prove)
using this:
\<sigma> (g \<sigma>) \<noteq> \<sigma> (f \<sigma>)
\<sigma> (g \<sigma>) \<le>\<^sub>\<complex> \<sigma> (f \<sigma>)

goal (1 subgoal):
 1. \<sigma> (g \<sigma>) <\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<sigma> (g \<sigma>) <\<^sub>\<complex> \<sigma> (f \<sigma>)

goal (2 subgoals):
 1. finite perms
 2. \<exists>a\<in>perms. a (g a) <\<^sub>\<complex> a (f a)
[PROOF STEP]
thus "\<exists>\<sigma>\<in>perms. \<sigma> (g \<sigma>) <\<^sub>\<complex> \<sigma> (f \<sigma>)"
[PROOF STATE]
proof (prove)
using this:
\<sigma> (g \<sigma>) <\<^sub>\<complex> \<sigma> (f \<sigma>)

goal (1 subgoal):
 1. \<exists>\<sigma>\<in>perms. \<sigma> (g \<sigma>) <\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
using \<sigma> \<open>finite perms\<close>
[PROOF STATE]
proof (prove)
using this:
\<sigma> (g \<sigma>) <\<^sub>\<complex> \<sigma> (f \<sigma>)
\<sigma> \<in># mset_set perms
g \<sigma> \<noteq> f \<sigma>
finite perms

goal (1 subgoal):
 1. \<exists>\<sigma>\<in>perms. \<sigma> (g \<sigma>) <\<^sub>\<complex> \<sigma> (f \<sigma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>\<sigma>\<in>perms. \<sigma> (g \<sigma>) <\<^sub>\<complex> \<sigma> (f \<sigma>)

goal (1 subgoal):
 1. finite perms
[PROOF STEP]
qed (use \<open>finite perms\<close> in simp_all)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>)) <\<^sub>\<complex> (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))

goal (1 subgoal):
 1. q \<in># prime_factorization (Q Y') \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
g \<in> tuples Y'
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) = (\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>))
(\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>)) <\<^sub>\<complex> (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
g \<in> tuples Y'
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) = (\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>))
(\<Sum>\<sigma>\<in>perms. \<sigma> (g \<sigma>)) <\<^sub>\<complex> (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
q \<notin> prime_factors (Q Y')

goal (2 subgoals):
 1. set_mset Y' \<subseteq> X \<Longrightarrow> int (count (prime_factorization (Q Y')) q) * \<Prod>\<^sub># (image_mset \<beta>' Y') = 0
 2. \<not> set_mset Y' \<subseteq> X \<Longrightarrow> int (count (prime_factorization (Q Y')) q) * \<Prod>\<^sub># (image_mset \<beta>' Y') = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
q \<notin> prime_factors (Q Y')

goal (1 subgoal):
 1. int (count (prime_factorization (Q Y')) q) * \<Prod>\<^sub># (image_mset \<beta>' Y') = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int (count (prime_factorization (Q Y')) q) * \<Prod>\<^sub># (image_mset \<beta>' Y') = 0

goal (1 subgoal):
 1. \<not> set_mset Y' \<subseteq> X \<Longrightarrow> int (count (prime_factorization (Q Y')) q) * \<Prod>\<^sub># (image_mset \<beta>' Y') = 0
[PROOF STEP]
qed (auto simp: \<beta>'_def)
[PROOF STATE]
proof (state)
this:
int (count (prime_factorization (Q Y')) q) * \<Prod>\<^sub># (image_mset \<beta>' Y') = 0

goal (2 subgoals):
 1. finite Roots_ms
 2. {Y} \<subseteq> Roots_ms
[PROOF STEP]
qed (use \<open>Y \<in> Roots_ms\<close> in auto)
[PROOF STATE]
proof (state)
this:
\<beta>'' q = (\<Sum>X\<in>{Y}. int (count (prime_factorization (Q X)) q) * \<Prod>\<^sub># (image_mset \<beta>' X))

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<beta>'' q = (\<Sum>X\<in>{Y}. int (count (prime_factorization (Q X)) q) * \<Prod>\<^sub># (image_mset \<beta>' X))

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
have "\<dots> = int (count (prime_factorization (Q Y)) q) * prod_mset (image_mset \<beta>' Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>X\<in>{Y}. int (count (prime_factorization (Q X)) q) * \<Prod>\<^sub># (image_mset \<beta>' X)) = int (count (prime_factorization (Q Y)) q) * \<Prod>\<^sub># (image_mset \<beta>' Y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>{Y}. int (count (prime_factorization (Q X)) q) * \<Prod>\<^sub># (image_mset \<beta>' X)) = int (count (prime_factorization (Q Y)) q) * \<Prod>\<^sub># (image_mset \<beta>' Y)

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>{Y}. int (count (prime_factorization (Q X)) q) * \<Prod>\<^sub># (image_mset \<beta>' X)) = int (count (prime_factorization (Q Y)) q) * \<Prod>\<^sub># (image_mset \<beta>' Y)

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
have "\<dots> \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (count (prime_factorization (Q Y)) q) * \<Prod>\<^sub># (image_mset \<beta>' Y) \<noteq> 0
[PROOF STEP]
using q nz \<open>finite X\<close> \<open>X \<noteq> {}\<close> \<open>finite perms\<close> f
[PROOF STATE]
proof (prove)
using this:
q \<in># prime_factorization (Q Y)
(\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) \<in># poly_roots (Ring_Hom_Poly.of_int_poly q)
?x \<in> X \<Longrightarrow> \<beta> ?x \<noteq> 0
finite X
X \<noteq> {}
finite perms
f \<in> perms \<rightarrow> X

goal (1 subgoal):
 1. int (count (prime_factorization (Q Y)) q) * \<Prod>\<^sub># (image_mset \<beta>' Y) \<noteq> 0
[PROOF STEP]
by (auto simp: \<beta>'_def Y_def)
[PROOF STATE]
proof (state)
this:
int (count (prime_factorization (Q Y)) q) * \<Prod>\<^sub># (image_mset \<beta>' Y) \<noteq> 0

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<beta>'' q \<noteq> 0
[PROOF STEP]
show "{q. \<beta>'' q \<noteq> 0} \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
\<beta>'' q \<noteq> 0

goal (1 subgoal):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{q. \<beta>'' q \<noteq> 0} \<noteq> {}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{q. \<beta>'' q \<noteq> 0} \<noteq> {}

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    We are now ready for the final push: we start with the original sum that we know to be zero,
    multiply it with the other permutations, and then multiply out the sum.
  \<close>
[PROOF STATE]
proof (state)
this:
{q. \<beta>'' q \<noteq> 0} \<noteq> {}

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "0 = (\<Sum>x\<in>X. \<beta> x * exp x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = (\<Sum>x\<in>X. of_int (\<beta> x) * exp x)
[PROOF STEP]
using sum0
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>X. of_int (\<beta> x) * exp x) = 0

goal (1 subgoal):
 1. 0 = (\<Sum>x\<in>X. of_int (\<beta> x) * exp x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
0 = (\<Sum>x\<in>X. of_int (\<beta> x) * exp x)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 = (\<Sum>x\<in>X. of_int (\<beta> x) * exp x)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>Roots. \<beta>' x * exp x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>X. of_int (\<beta> x) * exp x) = (\<Sum>x\<in>Roots. of_int (\<beta>' x) * exp x)
[PROOF STEP]
by (intro sum.mono_neutral_cong_left \<open>X \<subseteq> Roots\<close>) (auto simp: \<beta>'_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. of_int (\<beta> x) * exp x) = (\<Sum>x\<in>Roots. of_int (\<beta>' x) * exp x)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. of_int (\<beta> x) * exp x) = (\<Sum>x\<in>Roots. of_int (\<beta>' x) * exp x)

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> dvd (\<Prod>\<sigma>\<in>perms. \<Sum>x\<in>Roots. \<beta>' x * exp (\<sigma> x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>Roots. of_int (\<beta>' x) * exp x) dvd (\<Prod>\<sigma>\<in>perms. \<Sum>x\<in>Roots. of_int (\<beta>' x) * exp (\<sigma> x))
[PROOF STEP]
by (rule dvd_prodI[OF \<open>finite perms\<close>])
       (use permutes_id[of Roots] in \<open>simp_all add: id_def perms_def\<close>)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>Roots. of_int (\<beta>' x) * exp x) dvd (\<Prod>\<sigma>\<in>perms. \<Sum>x\<in>Roots. of_int (\<beta>' x) * exp (\<sigma> x))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>Roots. of_int (\<beta>' x) * exp x) dvd (\<Prod>\<sigma>\<in>perms. \<Sum>x\<in>Roots. of_int (\<beta>' x) * exp (\<sigma> x))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. \<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>) * exp (\<sigma> (f \<sigma>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>\<sigma>\<in>perms. \<Sum>x\<in>Roots. of_int (\<beta>' x) * exp (\<sigma> x)) = (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. \<Prod>\<sigma>\<in>perms. of_int (\<beta>' (f \<sigma>)) * exp (\<sigma> (f \<sigma>)))
[PROOF STEP]
by (rule prod_sum_PiE) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>\<sigma>\<in>perms. \<Sum>x\<in>Roots. of_int (\<beta>' x) * exp (\<sigma> x)) = (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. \<Prod>\<sigma>\<in>perms. of_int (\<beta>' (f \<sigma>)) * exp (\<sigma> (f \<sigma>)))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>\<sigma>\<in>perms. \<Sum>x\<in>Roots. of_int (\<beta>' x) * exp (\<sigma> x)) = (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. \<Prod>\<sigma>\<in>perms. of_int (\<beta>' (f \<sigma>)) * exp (\<sigma> (f \<sigma>)))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. \<Prod>\<sigma>\<in>perms. of_int (\<beta>' (f \<sigma>)) * exp (\<sigma> (f \<sigma>))) = (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))
[PROOF STEP]
using \<open>finite perms\<close>
[PROOF STATE]
proof (prove)
using this:
finite perms

goal (1 subgoal):
 1. (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. \<Prod>\<sigma>\<in>perms. of_int (\<beta>' (f \<sigma>)) * exp (\<sigma> (f \<sigma>))) = (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))
[PROOF STEP]
by (simp add: prod.distrib exp_sum)
[PROOF STATE]
proof (state)
this:
(\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. \<Prod>\<sigma>\<in>perms. of_int (\<beta>' (f \<sigma>)) * exp (\<sigma> (f \<sigma>))) = (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. \<Prod>\<sigma>\<in>perms. of_int (\<beta>' (f \<sigma>)) * exp (\<sigma> (f \<sigma>))) = (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>(X,f)\<in>tuples'. (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))
[PROOF STEP]
using \<open>finite perms\<close>
[PROOF STATE]
proof (prove)
using this:
finite perms

goal (1 subgoal):
 1. (\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))
[PROOF STEP]
by (intro sum.reindex_bij_witness[of _ snd "\<lambda>f. (image_mset f (mset_set perms), f)"])
       (auto simp: tuples'_def tuples_def Roots_ms_def PiE_def Pi_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>f\<in>perms \<rightarrow>\<^sub>E Roots. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>(X,f)\<in>tuples'. (\<Prod>x\<in>#X. \<beta>' x) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))
[PROOF STEP]
proof (safe intro!: sum.cong)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> tuples' \<Longrightarrow> of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (b \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>)) = of_int (\<Prod>\<^sub># (image_mset \<beta>' a)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>))
[PROOF STEP]
fix X :: "complex multiset" and f :: "(complex \<Rightarrow> complex) \<Rightarrow> complex"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> tuples' \<Longrightarrow> of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (b \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>)) = of_int (\<Prod>\<^sub># (image_mset \<beta>' a)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>))
[PROOF STEP]
assume "(X, f) \<in> tuples'"
[PROOF STATE]
proof (state)
this:
(X, f) \<in> tuples'

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> tuples' \<Longrightarrow> of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (b \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>)) = of_int (\<Prod>\<^sub># (image_mset \<beta>' a)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>))
[PROOF STEP]
hence X: "X \<in> Roots_ms" "X = image_mset f (mset_set perms)" and f: "f \<in> perms \<rightarrow>\<^sub>E Roots"
[PROOF STATE]
proof (prove)
using this:
(X, f) \<in> tuples'

goal (1 subgoal):
 1. (X \<in> Roots_ms &&& X = image_mset f (mset_set perms)) &&& f \<in> perms \<rightarrow>\<^sub>E Roots
[PROOF STEP]
by (auto simp: tuples'_def tuples_def)
[PROOF STATE]
proof (state)
this:
X \<in> Roots_ms
X = image_mset f (mset_set perms)
f \<in> perms \<rightarrow>\<^sub>E Roots

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> tuples' \<Longrightarrow> of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (b \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>)) = of_int (\<Prod>\<^sub># (image_mset \<beta>' a)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>))
[PROOF STEP]
have "(\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) = (\<Prod>\<sigma>\<in>#mset_set perms. \<beta>' (f \<sigma>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) = (\<Prod>\<sigma>\<in>#mset_set perms. \<beta>' (f \<sigma>))
[PROOF STEP]
by (meson prod_unfold_prod_mset)
[PROOF STATE]
proof (state)
this:
(\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) = (\<Prod>\<sigma>\<in>#mset_set perms. \<beta>' (f \<sigma>))

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> tuples' \<Longrightarrow> of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (b \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>)) = of_int (\<Prod>\<^sub># (image_mset \<beta>' a)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) = (\<Prod>\<sigma>\<in>#mset_set perms. \<beta>' (f \<sigma>))

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> tuples' \<Longrightarrow> of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (b \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>)) = of_int (\<Prod>\<^sub># (image_mset \<beta>' a)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>))
[PROOF STEP]
have "\<dots> = (\<Prod>x\<in>#X. \<beta>' x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>\<sigma>\<in>#mset_set perms. \<beta>' (f \<sigma>)) = \<Prod>\<^sub># (image_mset \<beta>' X)
[PROOF STEP]
unfolding X(2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>\<sigma>\<in>#mset_set perms. \<beta>' (f \<sigma>)) = \<Prod>\<^sub># (image_mset \<beta>' (image_mset f (mset_set perms)))
[PROOF STEP]
by (simp add: multiset.map_comp o_def)
[PROOF STATE]
proof (state)
this:
(\<Prod>\<sigma>\<in>#mset_set perms. \<beta>' (f \<sigma>)) = \<Prod>\<^sub># (image_mset \<beta>' X)

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> tuples' \<Longrightarrow> of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (b \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>)) = of_int (\<Prod>\<^sub># (image_mset \<beta>' a)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (b \<sigma>))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) = \<Prod>\<^sub># (image_mset \<beta>' X)
[PROOF STEP]
show "(\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) =
                  (\<Prod>x\<in>#X. \<beta>' x) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) = \<Prod>\<^sub># (image_mset \<beta>' X)

goal (1 subgoal):
 1. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) = of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)) = of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<sigma>\<in>perms. \<beta>' (f \<sigma>)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>X\<in>Roots_ms. \<Sum>f\<in>tuples X. (\<Prod>x\<in>#X. \<beta>' x) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>X\<in>Roots_ms. \<Sum>f\<in>tuples X. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))
[PROOF STEP]
unfolding tuples'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(X, f)\<in>Sigma Roots_ms tuples. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>X\<in>Roots_ms. \<Sum>f\<in>tuples X. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))
[PROOF STEP]
by (intro sum.Sigma [symmetric]) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>X\<in>Roots_ms. \<Sum>f\<in>tuples X. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(X, f)\<in>tuples'. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>X\<in>Roots_ms. \<Sum>f\<in>tuples X. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>x\<in>#X. \<beta>' x) * (\<Sum>f\<in>tuples X. exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>X\<in>Roots_ms. \<Sum>f\<in>tuples X. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>f\<in>tuples X. exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))))
[PROOF STEP]
by (simp add: sum_distrib_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Roots_ms. \<Sum>f\<in>tuples X. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>f\<in>tuples X. exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Roots_ms. \<Sum>f\<in>tuples X. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))) = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>f\<in>tuples X. exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>))))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>x\<in>#X. \<beta>' x) * (\<Sum>x\<in>#R X. exp x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>f\<in>tuples X. exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))) = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (R X)))
[PROOF STEP]
by (simp only: R_def multiset.map_comp o_def sum_unfold_sum_mset)
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>f\<in>tuples X. exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))) = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (R X)))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>f\<in>tuples X. exp (\<Sum>\<sigma>\<in>perms. \<sigma> (f \<sigma>)))) = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (R X)))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>x\<in>#X. \<beta>' x) * (\<Sum>x\<in>#poly_roots (of_int_poly (Q X)). exp x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (R X))) = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X)))))
[PROOF STEP]
by (intro sum.cong) (simp_all flip: Q)
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (R X))) = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X)))))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    Our problem now is that the polynomials \<open>Q X\<close> can still contain multiple roots and that their
    roots might not be disjoint. We therefore split them all into irreducible factors and collect
    equal terms.
  \<close>
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (R X))) = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X)))))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (R X))) = (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X)))))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>X\<in>Roots_ms. (\<Sum>p. of_int (int (count (prime_factorization (Q X)) p) *
                      (\<Prod>x\<in>#X. \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X))))) = (\<Sum>X\<in>Roots_ms. \<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
proof (rule sum.cong, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Roots_ms = Roots_ms
 2. \<And>x. x \<in> Roots_ms \<Longrightarrow> of_int (\<Prod>\<^sub># (image_mset \<beta>' x)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q x)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q x)) p) * \<Prod>\<^sub># (image_mset \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
case (2 X)
[PROOF STATE]
proof (state)
this:
X \<in> Roots_ms

goal (2 subgoals):
 1. Roots_ms = Roots_ms
 2. \<And>x. x \<in> Roots_ms \<Longrightarrow> of_int (\<Prod>\<^sub># (image_mset \<beta>' x)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q x)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q x)) p) * \<Prod>\<^sub># (image_mset \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
have "(\<Sum>x\<in>#poly_roots (of_int_poly (Q X) :: complex poly). exp x) =
          (\<Sum>x \<in># (\<Sum>p\<in>#prime_factorization (Q X). poly_roots (of_int_poly p)). exp x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X)))) = \<Sum>\<^sub># (image_mset exp (\<Sum>p\<in>#prime_factorization (Q X). poly_roots (Ring_Hom_Poly.of_int_poly p)))
[PROOF STEP]
by (subst poly_roots_of_int_conv_sum_prime_factors) (rule refl)
[PROOF STATE]
proof (state)
this:
\<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X)))) = \<Sum>\<^sub># (image_mset exp (\<Sum>p\<in>#prime_factorization (Q X). poly_roots (Ring_Hom_Poly.of_int_poly p)))

goal (2 subgoals):
 1. Roots_ms = Roots_ms
 2. \<And>x. x \<in> Roots_ms \<Longrightarrow> of_int (\<Prod>\<^sub># (image_mset \<beta>' x)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q x)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q x)) p) * \<Prod>\<^sub># (image_mset \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X)))) = \<Sum>\<^sub># (image_mset exp (\<Sum>p\<in>#prime_factorization (Q X). poly_roots (Ring_Hom_Poly.of_int_poly p)))

goal (2 subgoals):
 1. Roots_ms = Roots_ms
 2. \<And>x. x \<in> Roots_ms \<Longrightarrow> of_int (\<Prod>\<^sub># (image_mset \<beta>' x)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q x)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q x)) p) * \<Prod>\<^sub># (image_mset \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
have "\<dots> = (\<Sum>p\<in>#prime_factorization (Q X). \<Sum>x\<in>#poly_roots (of_int_poly p). exp x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># (image_mset exp (\<Sum>p\<in>#prime_factorization (Q X). poly_roots (Ring_Hom_Poly.of_int_poly p))) = (\<Sum>p\<in>#prime_factorization (Q X). \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly p))))
[PROOF STEP]
by (rule sum_mset_image_mset_sum_mset_image_mset)
[PROOF STATE]
proof (state)
this:
\<Sum>\<^sub># (image_mset exp (\<Sum>p\<in>#prime_factorization (Q X). poly_roots (Ring_Hom_Poly.of_int_poly p))) = (\<Sum>p\<in>#prime_factorization (Q X). \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly p))))

goal (2 subgoals):
 1. Roots_ms = Roots_ms
 2. \<And>x. x \<in> Roots_ms \<Longrightarrow> of_int (\<Prod>\<^sub># (image_mset \<beta>' x)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q x)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q x)) p) * \<Prod>\<^sub># (image_mset \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sum>\<^sub># (image_mset exp (\<Sum>p\<in>#prime_factorization (Q X). poly_roots (Ring_Hom_Poly.of_int_poly p))) = (\<Sum>p\<in>#prime_factorization (Q X). \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly p))))

goal (2 subgoals):
 1. Roots_ms = Roots_ms
 2. \<And>x. x \<in> Roots_ms \<Longrightarrow> of_int (\<Prod>\<^sub># (image_mset \<beta>' x)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q x)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q x)) p) * \<Prod>\<^sub># (image_mset \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
have "rsquarefree (of_int_poly p :: complex poly)" if "p \<in> prime_factors (Q X)" for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rsquarefree (Ring_Hom_Poly.of_int_poly p)
[PROOF STEP]
proof (rule irreducible_imp_rsquarefree_of_int_poly)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. irreducible p
 2. 0 < Polynomial.degree p
[PROOF STEP]
have "prime p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
p \<in># prime_factorization (Q X)

goal (1 subgoal):
 1. prime p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime p

goal (2 subgoals):
 1. irreducible p
 2. 0 < Polynomial.degree p
[PROOF STEP]
thus "irreducible p"
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. irreducible p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
irreducible p

goal (1 subgoal):
 1. 0 < Polynomial.degree p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < Polynomial.degree p
[PROOF STEP]
show "Polynomial.degree p > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Polynomial.degree p
[PROOF STEP]
by (intro content_1_imp_nonconstant_prime_factors[OF Q(2) that] 2)
[PROOF STATE]
proof (state)
this:
0 < Polynomial.degree p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?p \<in># prime_factorization (Q X) \<Longrightarrow> rsquarefree (Ring_Hom_Poly.of_int_poly ?p)

goal (2 subgoals):
 1. Roots_ms = Roots_ms
 2. \<And>x. x \<in> Roots_ms \<Longrightarrow> of_int (\<Prod>\<^sub># (image_mset \<beta>' x)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q x)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q x)) p) * \<Prod>\<^sub># (image_mset \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
hence "(\<Sum>p\<in>#prime_factorization (Q X). \<Sum>x\<in>#poly_roots (of_int_poly p). exp x) =
           (\<Sum>p\<in>#prime_factorization (Q X). \<Sum>x | ipoly p x = 0. exp (x :: complex))"
[PROOF STATE]
proof (prove)
using this:
?p \<in># prime_factorization (Q X) \<Longrightarrow> rsquarefree (Ring_Hom_Poly.of_int_poly ?p)

goal (1 subgoal):
 1. (\<Sum>p\<in>#prime_factorization (Q X). \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly p)))) = (\<Sum>p\<in>#prime_factorization (Q X). \<Sum>x | ipoly p x = 0. exp x)
[PROOF STEP]
unfolding sum_unfold_sum_mset
[PROOF STATE]
proof (prove)
using this:
?p \<in># prime_factorization (Q X) \<Longrightarrow> rsquarefree (Ring_Hom_Poly.of_int_poly ?p)

goal (1 subgoal):
 1. (\<Sum>p\<in>#prime_factorization (Q X). \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly p)))) = (\<Sum>p\<in>#prime_factorization (Q X). \<Sum>\<^sub># (image_mset exp (mset_set {x. ipoly p x = 0})))
[PROOF STEP]
by (intro arg_cong[of _ _ sum_mset] image_mset_cong sum.cong refl,
          subst rsquarefree_poly_roots_eq) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>#prime_factorization (Q X). \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly p)))) = (\<Sum>p\<in>#prime_factorization (Q X). \<Sum>x | ipoly p x = 0. exp x)

goal (2 subgoals):
 1. Roots_ms = Roots_ms
 2. \<And>x. x \<in> Roots_ms \<Longrightarrow> of_int (\<Prod>\<^sub># (image_mset \<beta>' x)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q x)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q x)) p) * \<Prod>\<^sub># (image_mset \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>#prime_factorization (Q X). \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly p)))) = (\<Sum>p\<in>#prime_factorization (Q X). \<Sum>x | ipoly p x = 0. exp x)

goal (2 subgoals):
 1. Roots_ms = Roots_ms
 2. \<And>x. x \<in> Roots_ms \<Longrightarrow> of_int (\<Prod>\<^sub># (image_mset \<beta>' x)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q x)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q x)) p) * \<Prod>\<^sub># (image_mset \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
have "\<dots> = (\<Sum>p. count (prime_factorization (Q X)) p * (\<Sum>x | ipoly p x = 0. exp (x :: complex)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p\<in>#prime_factorization (Q X). \<Sum>x | ipoly p x = 0. exp x) = (\<Sum>p. of_nat (count (prime_factorization (Q X)) p) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
by (rule sum_mset_conv_Sum_any)
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>#prime_factorization (Q X). \<Sum>x | ipoly p x = 0. exp x) = (\<Sum>p. of_nat (count (prime_factorization (Q X)) p) * (\<Sum>x | ipoly p x = 0. exp x))

goal (2 subgoals):
 1. Roots_ms = Roots_ms
 2. \<And>x. x \<in> Roots_ms \<Longrightarrow> of_int (\<Prod>\<^sub># (image_mset \<beta>' x)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q x)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q x)) p) * \<Prod>\<^sub># (image_mset \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>#prime_factorization (Q X). \<Sum>x | ipoly p x = 0. exp x) = (\<Sum>p. of_nat (count (prime_factorization (Q X)) p) * (\<Sum>x | ipoly p x = 0. exp x))

goal (2 subgoals):
 1. Roots_ms = Roots_ms
 2. \<And>x. x \<in> Roots_ms \<Longrightarrow> of_int (\<Prod>\<^sub># (image_mset \<beta>' x)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q x)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q x)) p) * \<Prod>\<^sub># (image_mset \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
have "of_int (\<Prod>x\<in>#X. \<beta>' x) * \<dots> =
               (\<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * (\<Prod>x\<in>#X. \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>p. of_nat (count (prime_factorization (Q X)) p) * (\<Sum>x | ipoly p x = 0. exp x)) = (\<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
by (subst Sum_any_right_distrib) (auto simp: mult_ac)
[PROOF STATE]
proof (state)
this:
of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>p. of_nat (count (prime_factorization (Q X)) p) * (\<Sum>x | ipoly p x = 0. exp x)) = (\<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x))

goal (2 subgoals):
 1. Roots_ms = Roots_ms
 2. \<And>x. x \<in> Roots_ms \<Longrightarrow> of_int (\<Prod>\<^sub># (image_mset \<beta>' x)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q x)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q x)) p) * \<Prod>\<^sub># (image_mset \<beta>' x)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x))

goal (1 subgoal):
 1. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X)))) = (\<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x))

goal (1 subgoal):
 1. Roots_ms = Roots_ms
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X))))) = (\<Sum>X\<in>Roots_ms. \<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Roots_ms. of_int (\<Prod>\<^sub># (image_mset \<beta>' X)) * \<Sum>\<^sub># (image_mset exp (poly_roots (Ring_Hom_Poly.of_int_poly (Q X))))) = (\<Sum>X\<in>Roots_ms. \<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>q. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>X\<in>Roots_ms. \<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x)) = (\<Sum>q. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x))
[PROOF STEP]
unfolding \<beta>''_def of_int_sum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>X\<in>Roots_ms. \<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x)) = (\<Sum>q. (\<Sum>x\<in>Roots_ms. of_int (int (count (prime_factorization (Q x)) q) * \<Prod>\<^sub># (image_mset \<beta>' x))) * (\<Sum>x | ipoly q x = 0. exp x))
[PROOF STEP]
by (subst Sum_any_sum_swap [symmetric]) (auto simp: sum_distrib_right)
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Roots_ms. \<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x)) = (\<Sum>q. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>X\<in>Roots_ms. \<Sum>p. of_int (int (count (prime_factorization (Q X)) p) * \<Prod>\<^sub># (image_mset \<beta>' X)) * (\<Sum>x | ipoly p x = 0. exp x)) = (\<Sum>q. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x)) = (\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x))
[PROOF STEP]
by (intro Sum_any.expand_superset finite_subset[OF supp_\<beta>'']) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>q. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x)) = (\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x))

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 dvd (\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x))
[PROOF STEP]
have "(\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp (x :: complex))) = 0"
[PROOF STATE]
proof (prove)
using this:
0 dvd (\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x))

goal (1 subgoal):
 1. (\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x)) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x)) = 0

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
text \<open>
    We are now in the situation of our the specialised Hermite--Lindemann Theorem we proved
    earlier and can easily derive a contradiction.
  \<close>
[PROOF STATE]
proof (state)
this:
(\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x)) = 0

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x)) = 0

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "(\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp (x :: complex))) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x)) \<noteq> 0
[PROOF STEP]
proof (rule Hermite_Lindemann_aux1)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. finite {q. \<beta>'' q \<noteq> 0}
 2. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
 3. pairwise algebraic_semidom_class.coprime {q. \<beta>'' q \<noteq> 0}
 4. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> irreducible q
 5. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> 0 < Polynomial.degree q
 6. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> \<beta>'' q \<noteq> 0
[PROOF STEP]
show "finite {q. \<beta>'' q \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {q. \<beta>'' q \<noteq> 0}
[PROOF STEP]
by (rule finite_subset[OF supp_\<beta>'']) auto
[PROOF STATE]
proof (state)
this:
finite {q. \<beta>'' q \<noteq> 0}

goal (5 subgoals):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
 2. pairwise algebraic_semidom_class.coprime {q. \<beta>'' q \<noteq> 0}
 3. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> irreducible q
 4. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> 0 < Polynomial.degree q
 5. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> \<beta>'' q \<noteq> 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
 2. pairwise algebraic_semidom_class.coprime {q. \<beta>'' q \<noteq> 0}
 3. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> irreducible q
 4. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> 0 < Polynomial.degree q
 5. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> \<beta>'' q \<noteq> 0
[PROOF STEP]
show "pairwise Rings.coprime {q. \<beta>'' q \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise algebraic_semidom_class.coprime {q. \<beta>'' q \<noteq> 0}
[PROOF STEP]
proof (rule pairwiseI, clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<noteq> y; \<beta>'' x \<noteq> 0; \<beta>'' y \<noteq> 0\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime x y
[PROOF STEP]
fix p q
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<noteq> y; \<beta>'' x \<noteq> 0; \<beta>'' y \<noteq> 0\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime x y
[PROOF STEP]
assume pq: "p \<noteq> q" "\<beta>'' p \<noteq> 0" "\<beta>'' q \<noteq> 0"
[PROOF STATE]
proof (state)
this:
p \<noteq> q
\<beta>'' p \<noteq> 0
\<beta>'' q \<noteq> 0

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<noteq> y; \<beta>'' x \<noteq> 0; \<beta>'' y \<noteq> 0\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime x y
[PROOF STEP]
hence "prime p" "prime q"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> q
\<beta>'' p \<noteq> 0
\<beta>'' q \<noteq> 0

goal (1 subgoal):
 1. prime p &&& prime q
[PROOF STEP]
using supp_\<beta>'' Q(2)
[PROOF STATE]
proof (prove)
using this:
p \<noteq> q
\<beta>'' p \<noteq> 0
\<beta>'' q \<noteq> 0
{q. \<beta>'' q \<noteq> 0} \<subseteq> (\<Union>X\<in>Roots_ms. prime_factors (Q X))
?X \<in> Roots_ms \<Longrightarrow> Polynomial.content (Q ?X) = 1

goal (1 subgoal):
 1. prime p &&& prime q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime p
prime q

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<noteq> y; \<beta>'' x \<noteq> 0; \<beta>'' y \<noteq> 0\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime x y
[PROOF STEP]
with pq
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> q
\<beta>'' p \<noteq> 0
\<beta>'' q \<noteq> 0
prime p
prime q
[PROOF STEP]
show "Rings.coprime p q"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> q
\<beta>'' p \<noteq> 0
\<beta>'' q \<noteq> 0
prime p
prime q

goal (1 subgoal):
 1. algebraic_semidom_class.coprime p q
[PROOF STEP]
by (simp add: primes_coprime)
[PROOF STATE]
proof (state)
this:
algebraic_semidom_class.coprime p q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
pairwise algebraic_semidom_class.coprime {q. \<beta>'' q \<noteq> 0}

goal (4 subgoals):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
 2. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> irreducible q
 3. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> 0 < Polynomial.degree q
 4. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> \<beta>'' q \<noteq> 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
 2. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> irreducible q
 3. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> 0 < Polynomial.degree q
 4. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> \<beta>'' q \<noteq> 0
[PROOF STEP]
fix q :: "int poly"
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
 2. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> irreducible q
 3. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> 0 < Polynomial.degree q
 4. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> \<beta>'' q \<noteq> 0
[PROOF STEP]
assume q: "q \<in> {q. \<beta>'' q \<noteq> 0}"
[PROOF STATE]
proof (state)
this:
q \<in> {q. \<beta>'' q \<noteq> 0}

goal (4 subgoals):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
 2. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> irreducible q
 3. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> 0 < Polynomial.degree q
 4. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> \<beta>'' q \<noteq> 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
q \<in> {q. \<beta>'' q \<noteq> 0}

goal (4 subgoals):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
 2. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> irreducible q
 3. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> 0 < Polynomial.degree q
 4. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> \<beta>'' q \<noteq> 0
[PROOF STEP]
note supp_\<beta>''
[PROOF STATE]
proof (state)
this:
{q. \<beta>'' q \<noteq> 0} \<subseteq> (\<Union>X\<in>Roots_ms. prime_factors (Q X))

goal (4 subgoals):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
 2. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> irreducible q
 3. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> 0 < Polynomial.degree q
 4. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> \<beta>'' q \<noteq> 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
q \<in> (\<Union>X\<in>Roots_ms. prime_factors (Q X))
[PROOF STEP]
obtain X where X: "X \<in> Roots_ms" "q \<in> prime_factors (Q X)"
[PROOF STATE]
proof (prove)
using this:
q \<in> (\<Union>X\<in>Roots_ms. prime_factors (Q X))

goal (1 subgoal):
 1. (\<And>X. \<lbrakk>X \<in> Roots_ms; q \<in># prime_factorization (Q X)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
X \<in> Roots_ms
q \<in># prime_factorization (Q X)

goal (4 subgoals):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
 2. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> irreducible q
 3. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> 0 < Polynomial.degree q
 4. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> \<beta>'' q \<noteq> 0
[PROOF STEP]
show "irreducible q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible q
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
X \<in> Roots_ms
q \<in># prime_factorization (Q X)

goal (1 subgoal):
 1. irreducible q
[PROOF STEP]
by (intro prime_elem_imp_irreducible prime_imp_prime_elem) auto
[PROOF STATE]
proof (state)
this:
irreducible q

goal (3 subgoals):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
 2. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> 0 < Polynomial.degree q
 3. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> \<beta>'' q \<noteq> 0
[PROOF STEP]
show "Polynomial.degree q > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Polynomial.degree q
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
X \<in> Roots_ms
q \<in># prime_factorization (Q X)

goal (1 subgoal):
 1. 0 < Polynomial.degree q
[PROOF STEP]
by (intro content_1_imp_nonconstant_prime_factors[OF Q(2)[of X]])
[PROOF STATE]
proof (state)
this:
0 < Polynomial.degree q

goal (2 subgoals):
 1. {q. \<beta>'' q \<noteq> 0} \<noteq> {}
 2. \<And>q. q \<in> {q. \<beta>'' q \<noteq> 0} \<Longrightarrow> \<beta>'' q \<noteq> 0
[PROOF STEP]
qed (use \<open>{x. \<beta>'' x \<noteq> 0} \<noteq> {}\<close> in auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x)) \<noteq> 0

goal (1 subgoal):
 1. X \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x)) = 0
(\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x)) \<noteq> 0
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
(\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x)) = 0
(\<Sum>q | \<beta>'' q \<noteq> 0. of_int (\<beta>'' q) * (\<Sum>x | ipoly q x = 0. exp x)) \<noteq> 0

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

goal:
No subgoals!
[PROOF STEP]
qed