[STATEMENT]
lemma qfN_cube_prime:
  assumes ass: "prime (p^2 + N*q^2::int) \<and> N > 1
  \<and> (p^2 + N*q^2)^3 = a^2 + N*b^2 \<and> coprime a b"
  shows "\<bar>a\<bar> = \<bar>p^3- 3*N*p*q^2\<bar> \<and> \<bar>b\<bar> = \<bar>3*p^2*q-N*q^3\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
let ?P = "p^2 + N*q^2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
let ?A = "a^2 + N*b^2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
from ass
[PROOF STATE]
proof (chain)
picking this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2) ^ 3 = a\<^sup>2 + N * b\<^sup>2 \<and> coprime a b
[PROOF STEP]
have "coprime a b"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2) ^ 3 = a\<^sup>2 + N * b\<^sup>2 \<and> coprime a b

goal (1 subgoal):
 1. coprime a b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
coprime a b

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
from ass
[PROOF STATE]
proof (chain)
picking this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2) ^ 3 = a\<^sup>2 + N * b\<^sup>2 \<and> coprime a b
[PROOF STEP]
have P1: "?P > 1"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2) ^ 3 = a\<^sup>2 + N * b\<^sup>2 \<and> coprime a b

goal (1 subgoal):
 1. 1 < p\<^sup>2 + N * q\<^sup>2
[PROOF STEP]
by (simp add: prime_int_iff)
[PROOF STATE]
proof (state)
this:
1 < p\<^sup>2 + N * q\<^sup>2

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
with ass
[PROOF STATE]
proof (chain)
picking this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2) ^ 3 = a\<^sup>2 + N * b\<^sup>2 \<and> coprime a b
1 < p\<^sup>2 + N * q\<^sup>2
[PROOF STEP]
have APP: "?A = ?P*?P^2"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2) ^ 3 = a\<^sup>2 + N * b\<^sup>2 \<and> coprime a b
1 < p\<^sup>2 + N * q\<^sup>2

goal (1 subgoal):
 1. a\<^sup>2 + N * b\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
[PROOF STEP]
by (simp add: power2_eq_square power3_eq_cube)
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
with ass
[PROOF STATE]
proof (chain)
picking this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2) ^ 3 = a\<^sup>2 + N * b\<^sup>2 \<and> coprime a b
a\<^sup>2 + N * b\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
[PROOF STEP]
have "prime ?P \<and> ?P dvd ?A"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2) ^ 3 = a\<^sup>2 + N * b\<^sup>2 \<and> coprime a b
a\<^sup>2 + N * b\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. prime (p\<^sup>2 + N * q\<^sup>2) \<and> p\<^sup>2 + N * q\<^sup>2 dvd a\<^sup>2 + N * b\<^sup>2
[PROOF STEP]
by (simp add: dvdI)
[PROOF STATE]
proof (state)
this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> p\<^sup>2 + N * q\<^sup>2 dvd a\<^sup>2 + N * b\<^sup>2

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> p\<^sup>2 + N * q\<^sup>2 dvd a\<^sup>2 + N * b\<^sup>2
[PROOF STEP]
obtain u v e where uve:
    "?A = (u^2+N*v^2)*?P \<and> a = p*u+e*N*q*v \<and> b = p*v-e*q*u \<and> \<bar>e\<bar>=1"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> p\<^sup>2 + N * q\<^sup>2 dvd a\<^sup>2 + N * b\<^sup>2

goal (1 subgoal):
 1. (\<And>u v e. a\<^sup>2 + N * b\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> a = p * u + e * N * q * v \<and> b = p * v - e * q * u \<and> \<bar>e\<bar> = 1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (frule_tac p="p" in qfN_div_prime, auto)
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + N * b\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> a = p * u + e * N * q * v \<and> b = p * v - e * q * u \<and> \<bar>e\<bar> = 1

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
have "coprime u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime u v
[PROOF STEP]
proof (rule coprimeI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c. \<lbrakk>c dvd u; c dvd v\<rbrakk> \<Longrightarrow> is_unit c
[PROOF STEP]
fix c
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c. \<lbrakk>c dvd u; c dvd v\<rbrakk> \<Longrightarrow> is_unit c
[PROOF STEP]
assume "c dvd u" "c dvd v"
[PROOF STATE]
proof (state)
this:
c dvd u
c dvd v

goal (1 subgoal):
 1. \<And>c. \<lbrakk>c dvd u; c dvd v\<rbrakk> \<Longrightarrow> is_unit c
[PROOF STEP]
with uve
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 + N * b\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> a = p * u + e * N * q * v \<and> b = p * v - e * q * u \<and> \<bar>e\<bar> = 1
c dvd u
c dvd v
[PROOF STEP]
have "c dvd a" "c dvd b"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 + N * b\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> a = p * u + e * N * q * v \<and> b = p * v - e * q * u \<and> \<bar>e\<bar> = 1
c dvd u
c dvd v

goal (1 subgoal):
 1. c dvd a &&& c dvd b
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
c dvd a
c dvd b

goal (1 subgoal):
 1. \<And>c. \<lbrakk>c dvd u; c dvd v\<rbrakk> \<Longrightarrow> is_unit c
[PROOF STEP]
with \<open>coprime a b\<close>
[PROOF STATE]
proof (chain)
picking this:
coprime a b
c dvd a
c dvd b
[PROOF STEP]
show "is_unit c"
[PROOF STATE]
proof (prove)
using this:
coprime a b
c dvd a
c dvd b

goal (1 subgoal):
 1. is_unit c
[PROOF STEP]
by (rule coprime_common_divisor)
[PROOF STATE]
proof (state)
this:
is_unit c

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

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
with P1 uve APP ass
[PROOF STATE]
proof (chain)
picking this:
1 < p\<^sup>2 + N * q\<^sup>2
a\<^sup>2 + N * b\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> a = p * u + e * N * q * v \<and> b = p * v - e * q * u \<and> \<bar>e\<bar> = 1
a\<^sup>2 + N * b\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2) ^ 3 = a\<^sup>2 + N * b\<^sup>2 \<and> coprime a b
coprime u v
[PROOF STEP]
have "prime ?P \<and> N > 1 \<and> ?P^2 = u^2+N*v^2
    \<and> coprime u v"
[PROOF STATE]
proof (prove)
using this:
1 < p\<^sup>2 + N * q\<^sup>2
a\<^sup>2 + N * b\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> a = p * u + e * N * q * v \<and> b = p * v - e * q * u \<and> \<bar>e\<bar> = 1
a\<^sup>2 + N * b\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2) ^ 3 = a\<^sup>2 + N * b\<^sup>2 \<and> coprime a b
coprime u v

goal (1 subgoal):
 1. prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = u\<^sup>2 + N * v\<^sup>2 \<and> coprime u v
[PROOF STEP]
by (auto simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = u\<^sup>2 + N * v\<^sup>2 \<and> coprime u v

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
hence "\<bar>u\<bar> = \<bar>p^2-N*q^2\<bar> \<and> \<bar>v\<bar> = \<bar>2*p*q\<bar>"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = u\<^sup>2 + N * v\<^sup>2 \<and> coprime u v

goal (1 subgoal):
 1. \<bar>u\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>v\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
by (rule qfN_square_prime)
[PROOF STATE]
proof (state)
this:
\<bar>u\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>v\<bar> = \<bar>2 * p * q\<bar>

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>u\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>v\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
obtain f g where f: "u = f*(p^2-N*q^2) \<and> \<bar>f\<bar> = 1"
    and g: "v = g*(2*p*q) \<and> \<bar>g\<bar> = 1"
[PROOF STATE]
proof (prove)
using this:
\<bar>u\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>v\<bar> = \<bar>2 * p * q\<bar>

goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>u = f * (p\<^sup>2 - N * q\<^sup>2) \<and> \<bar>f\<bar> = 1; v = g * (2 * p * q) \<and> \<bar>g\<bar> = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (blast dest: abs_eq_impl_unitfactor)
[PROOF STATE]
proof (state)
this:
u = f * (p\<^sup>2 - N * q\<^sup>2) \<and> \<bar>f\<bar> = 1
v = g * (2 * p * q) \<and> \<bar>g\<bar> = 1

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
with uve
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 + N * b\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> a = p * u + e * N * q * v \<and> b = p * v - e * q * u \<and> \<bar>e\<bar> = 1
u = f * (p\<^sup>2 - N * q\<^sup>2) \<and> \<bar>f\<bar> = 1
v = g * (2 * p * q) \<and> \<bar>g\<bar> = 1
[PROOF STEP]
have "a = p*f*(p^2-N*q^2) + e*N*q*g*2*p*q
    \<and> b = p*g*2*p*q -e*q*f*(p^2-N*q^2)"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 + N * b\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> a = p * u + e * N * q * v \<and> b = p * v - e * q * u \<and> \<bar>e\<bar> = 1
u = f * (p\<^sup>2 - N * q\<^sup>2) \<and> \<bar>f\<bar> = 1
v = g * (2 * p * q) \<and> \<bar>g\<bar> = 1

goal (1 subgoal):
 1. a = p * f * (p\<^sup>2 - N * q\<^sup>2) + e * N * q * g * 2 * p * q \<and> b = p * g * 2 * p * q - e * q * f * (p\<^sup>2 - N * q\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a = p * f * (p\<^sup>2 - N * q\<^sup>2) + e * N * q * g * 2 * p * q \<and> b = p * g * 2 * p * q - e * q * f * (p\<^sup>2 - N * q\<^sup>2)

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
hence ab: "a = f*p*p^2 + -f*N*p*q^2 + 2*e*g*N*p*q^2
    \<and> b = 2*g*p^2*q - e*f*p^2*q + e*f*N*q*q^2"
[PROOF STATE]
proof (prove)
using this:
a = p * f * (p\<^sup>2 - N * q\<^sup>2) + e * N * q * g * 2 * p * q \<and> b = p * g * 2 * p * q - e * q * f * (p\<^sup>2 - N * q\<^sup>2)

goal (1 subgoal):
 1. a = f * p * p\<^sup>2 + - f * N * p * q\<^sup>2 + 2 * e * g * N * p * q\<^sup>2 \<and> b = 2 * g * p\<^sup>2 * q - e * f * p\<^sup>2 * q + e * f * N * q * q\<^sup>2
[PROOF STEP]
by (auto simp add: ac_simps right_diff_distrib power2_eq_square)
[PROOF STATE]
proof (state)
this:
a = f * p * p\<^sup>2 + - f * N * p * q\<^sup>2 + 2 * e * g * N * p * q\<^sup>2 \<and> b = 2 * g * p\<^sup>2 * q - e * f * p\<^sup>2 * q + e * f * N * q * q\<^sup>2

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
from f
[PROOF STATE]
proof (chain)
picking this:
u = f * (p\<^sup>2 - N * q\<^sup>2) \<and> \<bar>f\<bar> = 1
[PROOF STEP]
have f2: "f\<^sup>2 = 1"
[PROOF STATE]
proof (prove)
using this:
u = f * (p\<^sup>2 - N * q\<^sup>2) \<and> \<bar>f\<bar> = 1

goal (1 subgoal):
 1. f\<^sup>2 = 1
[PROOF STEP]
using abs_mult_self_eq [of f]
[PROOF STATE]
proof (prove)
using this:
u = f * (p\<^sup>2 - N * q\<^sup>2) \<and> \<bar>f\<bar> = 1
\<bar>f\<bar> * \<bar>f\<bar> = f * f

goal (1 subgoal):
 1. f\<^sup>2 = 1
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
f\<^sup>2 = 1

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
from g
[PROOF STATE]
proof (chain)
picking this:
v = g * (2 * p * q) \<and> \<bar>g\<bar> = 1
[PROOF STEP]
have g2: "g\<^sup>2 = 1"
[PROOF STATE]
proof (prove)
using this:
v = g * (2 * p * q) \<and> \<bar>g\<bar> = 1

goal (1 subgoal):
 1. g\<^sup>2 = 1
[PROOF STEP]
using abs_mult_self_eq [of g]
[PROOF STATE]
proof (prove)
using this:
v = g * (2 * p * q) \<and> \<bar>g\<bar> = 1
\<bar>g\<bar> * \<bar>g\<bar> = g * g

goal (1 subgoal):
 1. g\<^sup>2 = 1
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
g\<^sup>2 = 1

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
have "e \<noteq> f*g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e \<noteq> f * g
[PROOF STEP]
proof (rule ccontr, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. e = f * g \<Longrightarrow> False
[PROOF STEP]
assume efg: "e = f*g"
[PROOF STATE]
proof (state)
this:
e = f * g

goal (1 subgoal):
 1. e = f * g \<Longrightarrow> False
[PROOF STEP]
with ab g2
[PROOF STATE]
proof (chain)
picking this:
a = f * p * p\<^sup>2 + - f * N * p * q\<^sup>2 + 2 * e * g * N * p * q\<^sup>2 \<and> b = 2 * g * p\<^sup>2 * q - e * f * p\<^sup>2 * q + e * f * N * q * q\<^sup>2
g\<^sup>2 = 1
e = f * g
[PROOF STEP]
have "a = f*p*p^2+f*N*p*q^2"
[PROOF STATE]
proof (prove)
using this:
a = f * p * p\<^sup>2 + - f * N * p * q\<^sup>2 + 2 * e * g * N * p * q\<^sup>2 \<and> b = 2 * g * p\<^sup>2 * q - e * f * p\<^sup>2 * q + e * f * N * q * q\<^sup>2
g\<^sup>2 = 1
e = f * g

goal (1 subgoal):
 1. a = f * p * p\<^sup>2 + f * N * p * q\<^sup>2
[PROOF STEP]
by (auto simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
a = f * p * p\<^sup>2 + f * N * p * q\<^sup>2

goal (1 subgoal):
 1. e = f * g \<Longrightarrow> False
[PROOF STEP]
hence "a = (f*p)*?P"
[PROOF STATE]
proof (prove)
using this:
a = f * p * p\<^sup>2 + f * N * p * q\<^sup>2

goal (1 subgoal):
 1. a = f * p * (p\<^sup>2 + N * q\<^sup>2)
[PROOF STEP]
by (auto simp add: distrib_left ac_simps)
[PROOF STATE]
proof (state)
this:
a = f * p * (p\<^sup>2 + N * q\<^sup>2)

goal (1 subgoal):
 1. e = f * g \<Longrightarrow> False
[PROOF STEP]
hence Pa: "?P dvd a"
[PROOF STATE]
proof (prove)
using this:
a = f * p * (p\<^sup>2 + N * q\<^sup>2)

goal (1 subgoal):
 1. p\<^sup>2 + N * q\<^sup>2 dvd a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p\<^sup>2 + N * q\<^sup>2 dvd a

goal (1 subgoal):
 1. e = f * g \<Longrightarrow> False
[PROOF STEP]
have "e * f = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * f = g
[PROOF STEP]
using f2 power2_eq_square[of f] efg
[PROOF STATE]
proof (prove)
using this:
f\<^sup>2 = 1
f\<^sup>2 = f * f
e = f * g

goal (1 subgoal):
 1. e * f = g
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
e * f = g

goal (1 subgoal):
 1. e = f * g \<Longrightarrow> False
[PROOF STEP]
with ab
[PROOF STATE]
proof (chain)
picking this:
a = f * p * p\<^sup>2 + - f * N * p * q\<^sup>2 + 2 * e * g * N * p * q\<^sup>2 \<and> b = 2 * g * p\<^sup>2 * q - e * f * p\<^sup>2 * q + e * f * N * q * q\<^sup>2
e * f = g
[PROOF STEP]
have "b = g*p^2*q+g*N*q*q^2"
[PROOF STATE]
proof (prove)
using this:
a = f * p * p\<^sup>2 + - f * N * p * q\<^sup>2 + 2 * e * g * N * p * q\<^sup>2 \<and> b = 2 * g * p\<^sup>2 * q - e * f * p\<^sup>2 * q + e * f * N * q * q\<^sup>2
e * f = g

goal (1 subgoal):
 1. b = g * p\<^sup>2 * q + g * N * q * q\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b = g * p\<^sup>2 * q + g * N * q * q\<^sup>2

goal (1 subgoal):
 1. e = f * g \<Longrightarrow> False
[PROOF STEP]
hence "b = (g*q)*?P"
[PROOF STATE]
proof (prove)
using this:
b = g * p\<^sup>2 * q + g * N * q * q\<^sup>2

goal (1 subgoal):
 1. b = g * q * (p\<^sup>2 + N * q\<^sup>2)
[PROOF STEP]
by (auto simp add: distrib_left ac_simps)
[PROOF STATE]
proof (state)
this:
b = g * q * (p\<^sup>2 + N * q\<^sup>2)

goal (1 subgoal):
 1. e = f * g \<Longrightarrow> False
[PROOF STEP]
hence "?P dvd b"
[PROOF STATE]
proof (prove)
using this:
b = g * q * (p\<^sup>2 + N * q\<^sup>2)

goal (1 subgoal):
 1. p\<^sup>2 + N * q\<^sup>2 dvd b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p\<^sup>2 + N * q\<^sup>2 dvd b

goal (1 subgoal):
 1. e = f * g \<Longrightarrow> False
[PROOF STEP]
with Pa
[PROOF STATE]
proof (chain)
picking this:
p\<^sup>2 + N * q\<^sup>2 dvd a
p\<^sup>2 + N * q\<^sup>2 dvd b
[PROOF STEP]
have "?P dvd gcd a b"
[PROOF STATE]
proof (prove)
using this:
p\<^sup>2 + N * q\<^sup>2 dvd a
p\<^sup>2 + N * q\<^sup>2 dvd b

goal (1 subgoal):
 1. p\<^sup>2 + N * q\<^sup>2 dvd gcd a b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p\<^sup>2 + N * q\<^sup>2 dvd gcd a b

goal (1 subgoal):
 1. e = f * g \<Longrightarrow> False
[PROOF STEP]
with ass
[PROOF STATE]
proof (chain)
picking this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2) ^ 3 = a\<^sup>2 + N * b\<^sup>2 \<and> coprime a b
p\<^sup>2 + N * q\<^sup>2 dvd gcd a b
[PROOF STEP]
have "?P dvd 1"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2) ^ 3 = a\<^sup>2 + N * b\<^sup>2 \<and> coprime a b
p\<^sup>2 + N * q\<^sup>2 dvd gcd a b

goal (1 subgoal):
 1. is_unit (p\<^sup>2 + N * q\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_unit (p\<^sup>2 + N * q\<^sup>2)

goal (1 subgoal):
 1. e = f * g \<Longrightarrow> False
[PROOF STEP]
with P1
[PROOF STATE]
proof (chain)
picking this:
1 < p\<^sup>2 + N * q\<^sup>2
is_unit (p\<^sup>2 + N * q\<^sup>2)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
1 < p\<^sup>2 + N * q\<^sup>2
is_unit (p\<^sup>2 + N * q\<^sup>2)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
e \<noteq> f * g

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
e \<noteq> f * g

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
from f g uve
[PROOF STATE]
proof (chain)
picking this:
u = f * (p\<^sup>2 - N * q\<^sup>2) \<and> \<bar>f\<bar> = 1
v = g * (2 * p * q) \<and> \<bar>g\<bar> = 1
a\<^sup>2 + N * b\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> a = p * u + e * N * q * v \<and> b = p * v - e * q * u \<and> \<bar>e\<bar> = 1
[PROOF STEP]
have "\<bar>e\<bar> = \<bar>f*g\<bar>"
[PROOF STATE]
proof (prove)
using this:
u = f * (p\<^sup>2 - N * q\<^sup>2) \<and> \<bar>f\<bar> = 1
v = g * (2 * p * q) \<and> \<bar>g\<bar> = 1
a\<^sup>2 + N * b\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> a = p * u + e * N * q * v \<and> b = p * v - e * q * u \<and> \<bar>e\<bar> = 1

goal (1 subgoal):
 1. \<bar>e\<bar> = \<bar>f * g\<bar>
[PROOF STEP]
unfolding abs_mult
[PROOF STATE]
proof (prove)
using this:
u = f * (p\<^sup>2 - N * q\<^sup>2) \<and> \<bar>f\<bar> = 1
v = g * (2 * p * q) \<and> \<bar>g\<bar> = 1
a\<^sup>2 + N * b\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> a = p * u + e * N * q * v \<and> b = p * v - e * q * u \<and> \<bar>e\<bar> = 1

goal (1 subgoal):
 1. \<bar>e\<bar> = \<bar>f\<bar> * \<bar>g\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>e\<bar> = \<bar>f * g\<bar>

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
e \<noteq> f * g
\<bar>e\<bar> = \<bar>f * g\<bar>
[PROOF STEP]
have "e = -(f*g)"
[PROOF STATE]
proof (prove)
using this:
e \<noteq> f * g
\<bar>e\<bar> = \<bar>f * g\<bar>

goal (1 subgoal):
 1. e = - (f * g)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
e = - (f * g)

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
hence "e * g = -f" "e * f = -g"
[PROOF STATE]
proof (prove)
using this:
e = - (f * g)

goal (1 subgoal):
 1. e * g = - f &&& e * f = - g
[PROOF STEP]
using f2 g2
[PROOF STATE]
proof (prove)
using this:
e = - (f * g)
f\<^sup>2 = 1
g\<^sup>2 = 1

goal (1 subgoal):
 1. e * g = - f &&& e * f = - g
[PROOF STEP]
unfolding power2_eq_square
[PROOF STATE]
proof (prove)
using this:
e = - (f * g)
f * f = 1
g * g = 1

goal (1 subgoal):
 1. e * g = - f &&& e * f = - g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e * g = - f
e * f = - g

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
with ab
[PROOF STATE]
proof (chain)
picking this:
a = f * p * p\<^sup>2 + - f * N * p * q\<^sup>2 + 2 * e * g * N * p * q\<^sup>2 \<and> b = 2 * g * p\<^sup>2 * q - e * f * p\<^sup>2 * q + e * f * N * q * q\<^sup>2
e * g = - f
e * f = - g
[PROOF STEP]
have "a = f*p*p^2 - 3*f*N*p*q^2 \<and> b = 3*g*p^2*q - g*N*q*q^2"
[PROOF STATE]
proof (prove)
using this:
a = f * p * p\<^sup>2 + - f * N * p * q\<^sup>2 + 2 * e * g * N * p * q\<^sup>2 \<and> b = 2 * g * p\<^sup>2 * q - e * f * p\<^sup>2 * q + e * f * N * q * q\<^sup>2
e * g = - f
e * f = - g

goal (1 subgoal):
 1. a = f * p * p\<^sup>2 - 3 * f * N * p * q\<^sup>2 \<and> b = 3 * g * p\<^sup>2 * q - g * N * q * q\<^sup>2
[PROOF STEP]
by (simp add: mult.assoc)
[PROOF STATE]
proof (state)
this:
a = f * p * p\<^sup>2 - 3 * f * N * p * q\<^sup>2 \<and> b = 3 * g * p\<^sup>2 * q - g * N * q * q\<^sup>2

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
hence "a = f*(p^3 - 3*N*p*q^2) \<and> b = g*( 3*p^2*q - N*q^3 )"
[PROOF STATE]
proof (prove)
using this:
a = f * p * p\<^sup>2 - 3 * f * N * p * q\<^sup>2 \<and> b = 3 * g * p\<^sup>2 * q - g * N * q * q\<^sup>2

goal (1 subgoal):
 1. a = f * (p ^ 3 - 3 * N * p * q\<^sup>2) \<and> b = g * (3 * p\<^sup>2 * q - N * q ^ 3)
[PROOF STEP]
by (auto simp only: right_diff_distrib ac_simps power2_eq_square power3_eq_cube)
[PROOF STATE]
proof (state)
this:
a = f * (p ^ 3 - 3 * N * p * q\<^sup>2) \<and> b = g * (3 * p\<^sup>2 * q - N * q ^ 3)

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
with f g
[PROOF STATE]
proof (chain)
picking this:
u = f * (p\<^sup>2 - N * q\<^sup>2) \<and> \<bar>f\<bar> = 1
v = g * (2 * p * q) \<and> \<bar>g\<bar> = 1
a = f * (p ^ 3 - 3 * N * p * q\<^sup>2) \<and> b = g * (3 * p\<^sup>2 * q - N * q ^ 3)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u = f * (p\<^sup>2 - N * q\<^sup>2) \<and> \<bar>f\<bar> = 1
v = g * (2 * p * q) \<and> \<bar>g\<bar> = 1
a = f * (p ^ 3 - 3 * N * p * q\<^sup>2) \<and> b = g * (3 * p\<^sup>2 * q - N * q ^ 3)

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>
[PROOF STEP]
by (auto simp add: abs_mult)
[PROOF STATE]
proof (state)
this:
\<bar>a\<bar> = \<bar>p ^ 3 - 3 * N * p * q\<^sup>2\<bar> \<and> \<bar>b\<bar> = \<bar>3 * p\<^sup>2 * q - N * q ^ 3\<bar>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in infinite_coin_toss_space) pseudo_proj_False_singleton:
  assumes "w = pseudo_proj_False n w"
  shows "(pseudo_proj_False n) -`{w} \<inter> (space (bernoulli_stream p)) \<in> sets (bernoulli_stream p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
proof (cases "{m. (Suc m) \<le> n} = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
 2. {m. Suc m \<le> n} \<noteq> {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
{m. Suc m \<le> n} \<noteq> {}

goal (2 subgoals):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
 2. {m. Suc m \<le> n} \<noteq> {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
have "\<And>i. (\<lambda>x. snth x i) \<in> measurable (bernoulli_stream p) (count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. Measurable.pred (bernoulli_stream p) (\<lambda>x. x !! i)
[PROOF STEP]
by (simp add: measurable_snth_count_space)
[PROOF STATE]
proof (state)
this:
Measurable.pred (bernoulli_stream p) (\<lambda>x. x !! ?i1)

goal (2 subgoals):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
 2. {m. Suc m \<le> n} \<noteq> {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
have fi: "\<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. snth w i) -` {snth w i} \<inter> (space (bernoulli_stream p)) \<in> sets (bernoulli_stream p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
assume "Suc i \<le> n"
[PROOF STATE]
proof (state)
this:
Suc i \<le> n

goal (1 subgoal):
 1. \<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
have "(\<lambda>x. snth x i) \<in> measurable (bernoulli_stream p) (count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Measurable.pred (bernoulli_stream p) (\<lambda>x. x !! i)
[PROOF STEP]
by (simp add: measurable_snth_count_space)
[PROOF STATE]
proof (state)
this:
Measurable.pred (bernoulli_stream p) (\<lambda>x. x !! i)

goal (1 subgoal):
 1. \<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Measurable.pred (bernoulli_stream p) (\<lambda>x. x !! i)

goal (1 subgoal):
 1. \<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
have "{snth w i} \<in> sets (count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {w !! i} \<in> sets (count_space UNIV)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{w !! i} \<in> sets (count_space UNIV)

goal (1 subgoal):
 1. \<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Measurable.pred (bernoulli_stream p) (\<lambda>x. x !! i)
{w !! i} \<in> sets (count_space UNIV)
[PROOF STEP]
show "(\<lambda>x. snth x i) -` {snth w i}\<inter> (space (bernoulli_stream p)) \<in> sets (bernoulli_stream p)"
[PROOF STATE]
proof (prove)
using this:
Measurable.pred (bernoulli_stream p) (\<lambda>x. x !! i)
{w !! i} \<in> sets (count_space UNIV)

goal (1 subgoal):
 1. (\<lambda>x. x !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
unfolding measurable_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. x !! i) \<in> {f \<in> space (bernoulli_stream p) \<rightarrow> space (count_space UNIV). \<forall>y\<in>sets (count_space UNIV). f -` y \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)}
{w !! i} \<in> sets (count_space UNIV)

goal (1 subgoal):
 1. (\<lambda>x. x !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
by (simp add: measurable_snth_count_space)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Suc ?i1 \<le> n \<Longrightarrow> (\<lambda>w. w !! ?i1) -` {w !! ?i1} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)

goal (2 subgoals):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
 2. {m. Suc m \<le> n} \<noteq> {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
have "(\<Inter>i\<in> {m. (Suc m) \<le> n}. (\<lambda>w. snth w i) -` {snth w i}\<inter> (space (bernoulli_stream p))) \<in> sets (bernoulli_stream p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p)) \<in> sets (bernoulli_stream p)
[PROOF STEP]
proof ((rule sigma_algebra.countable_INT''), auto)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. sigma_algebra ?\<Omega> (sets (bernoulli_stream p))
 2. UNIV \<in> sets (bernoulli_stream p)
 3. \<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
show "sigma_algebra (space (bernoulli_stream p)) (sets (bernoulli_stream p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_algebra (space (bernoulli_stream p)) (sets (bernoulli_stream p))
[PROOF STEP]
using measure_space measure_space_def
[PROOF STATE]
proof (prove)
using this:
measure_space (space ?M) (sets ?M) (emeasure ?M)
measure_space ?\<Omega> ?A ?\<mu> = (sigma_algebra ?\<Omega> ?A \<and> positive ?A ?\<mu> \<and> countably_additive ?A ?\<mu>)

goal (1 subgoal):
 1. sigma_algebra (space (bernoulli_stream p)) (sets (bernoulli_stream p))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sigma_algebra (space (bernoulli_stream p)) (sets (bernoulli_stream p))

goal (2 subgoals):
 1. UNIV \<in> sets (bernoulli_stream p)
 2. \<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
show "UNIV \<in> sets (bernoulli_stream p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV \<in> sets (bernoulli_stream p)
[PROOF STEP]
by (metis bernoulli_stream_space sets.top streams_UNIV)
[PROOF STATE]
proof (state)
this:
UNIV \<in> sets (bernoulli_stream p)

goal (1 subgoal):
 1. \<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
show "\<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
using fi
[PROOF STATE]
proof (prove)
using this:
Suc ?i1 \<le> n \<Longrightarrow> (\<lambda>w. w !! ?i1) -` {w !! ?i1} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)

goal (1 subgoal):
 1. \<And>i. Suc i \<le> n \<Longrightarrow> (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc ?i1 \<le> n \<Longrightarrow> (\<lambda>w. w !! ?i1) -` {w !! ?i1} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p)) \<in> sets (bernoulli_stream p)

goal (2 subgoals):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
 2. {m. Suc m \<le> n} \<noteq> {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p)) \<in> sets (bernoulli_stream p)

goal (2 subgoals):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
 2. {m. Suc m \<le> n} \<noteq> {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
have "(\<Inter>i\<in> {m. (Suc m) \<le> n}. (\<lambda>w. snth w i) -` {snth w i}\<inter> (space (bernoulli_stream p))) =
    (\<Inter>i\<in> {m. (Suc m) \<le> n}. (\<lambda>w. snth w i) -` {snth w i})\<inter> (space (bernoulli_stream p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p)) = (\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i}) \<inter> space (bernoulli_stream p)
[PROOF STEP]
using False Inter_nonempty_distrib
[PROOF STATE]
proof (prove)
using this:
{m. Suc m \<le> n} \<noteq> {}
?A \<noteq> {} \<Longrightarrow> \<Inter> ?A \<inter> ?B = (\<Inter>C\<in>?A. C \<inter> ?B)

goal (1 subgoal):
 1. (\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p)) = (\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i}) \<inter> space (bernoulli_stream p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p)) = (\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i}) \<inter> space (bernoulli_stream p)

goal (2 subgoals):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
 2. {m. Suc m \<le> n} \<noteq> {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p)) \<in> sets (bernoulli_stream p)
(\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p)) = (\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i}) \<inter> space (bernoulli_stream p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p)) \<in> sets (bernoulli_stream p)
(\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p)) = (\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i}) \<inter> space (bernoulli_stream p)

goal (1 subgoal):
 1. pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
using assms pseudo_proj_False_preimage[of w n]
[PROOF STATE]
proof (prove)
using this:
(\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p)) \<in> sets (bernoulli_stream p)
(\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i} \<inter> space (bernoulli_stream p)) = (\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i}) \<inter> space (bernoulli_stream p)
w = pseudo_proj_False n w
w = pseudo_proj_False n w \<Longrightarrow> pseudo_proj_False n -` {w} = (\<Inter>i\<in>{m. Suc m \<le> n}. (\<lambda>w. w !! i) -` {w !! i})

goal (1 subgoal):
 1. pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)

goal (1 subgoal):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
{m. Suc m \<le> n} = {}

goal (1 subgoal):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
hence "n = 0"
[PROOF STATE]
proof (prove)
using this:
{m. Suc m \<le> n} = {}

goal (1 subgoal):
 1. n = 0
[PROOF STEP]
using less_eq_Suc_le
[PROOF STATE]
proof (prove)
using this:
{m. Suc m \<le> n} = {}
(?n < ?m) = (Suc ?n \<le> ?m)

goal (1 subgoal):
 1. n = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n = 0

goal (1 subgoal):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
hence "pseudo_proj_False n = (\<lambda>w. False ## sconst True)"
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. pseudo_proj_False n = (\<lambda>w. False ## sconst True)
[PROOF STEP]
by (simp add: pseudo_proj_False_def)
[PROOF STATE]
proof (state)
this:
pseudo_proj_False n = (\<lambda>w. False ## sconst True)

goal (1 subgoal):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
hence "w = False ## sconst True"
[PROOF STATE]
proof (prove)
using this:
pseudo_proj_False n = (\<lambda>w. False ## sconst True)

goal (1 subgoal):
 1. w = False ## sconst True
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
pseudo_proj_False n = (\<lambda>w. False ## sconst True)
w = pseudo_proj_False n w

goal (1 subgoal):
 1. w = False ## sconst True
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
w = False ## sconst True

goal (1 subgoal):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
hence "(pseudo_proj_False n) -`{w} \<inter> (space (bernoulli_stream p)) = (space (bernoulli_stream p))"
[PROOF STATE]
proof (prove)
using this:
w = False ## sconst True

goal (1 subgoal):
 1. pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) = space (bernoulli_stream p)
[PROOF STEP]
by (simp add: \<open>pseudo_proj_False n = (\<lambda>w. False##sconst True)\<close>)
[PROOF STATE]
proof (state)
this:
pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) = space (bernoulli_stream p)

goal (1 subgoal):
 1. {m. Suc m \<le> n} = {} \<Longrightarrow> pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
thus "(pseudo_proj_False n) -`{w} \<inter> (space (bernoulli_stream p))\<in> sets (bernoulli_stream p)"
[PROOF STATE]
proof (prove)
using this:
pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) = space (bernoulli_stream p)

goal (1 subgoal):
 1. pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pseudo_proj_False n -` {w} \<inter> space (bernoulli_stream p) \<in> sets (bernoulli_stream p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Image_runiq_eq_eval:
  assumes "x \<in> Domain R" "runiq R"
  shows "R `` {x} = {R ,, x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R `` {x} = {R ,, x}
[PROOF STEP]
using assms rightUniqueSetCardinality
[PROOF STATE]
proof (prove)
using this:
x \<in> Domain R
runiq R
\<lbrakk>?x \<in> Domain ?R; runiq ?R\<rbrakk> \<Longrightarrow> card (?R `` {?x}) = 1

goal (1 subgoal):
 1. R `` {x} = {R ,, x}
[PROOF STEP]
by (metis eval_rel.simps cardinalityOneTheElemIdentity)


[STATEMENT]
lemma exists_factorization_prod_list:
fixes P::"'b::field poly list"
assumes "degree (prod_list P) > 0"
  and "\<And> u. u \<in> set P \<Longrightarrow> degree u > 0 \<and> monic u"
  and "square_free (prod_list P)"
shows "\<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q
           \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < degree (prod_list P)
?u \<in> set P \<Longrightarrow> 0 < degree ?u \<and> monic ?u
square_free (prod_list P)

goal (1 subgoal):
 1. \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
proof (induct P)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>0 < degree (prod_list []); \<And>u. u \<in> set [] \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list [])\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list [] \<and> length [] \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
 2. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
0 < degree (prod_list [])
?u \<in> set [] \<Longrightarrow> 0 < degree ?u \<and> monic ?u
square_free (prod_list [])

goal (2 subgoals):
 1. \<lbrakk>0 < degree (prod_list []); \<And>u. u \<in> set [] \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list [])\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list [] \<and> length [] \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
 2. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
0 < degree (prod_list [])
?u \<in> set [] \<Longrightarrow> 0 < degree ?u \<and> monic ?u
square_free (prod_list [])

goal (1 subgoal):
 1. \<exists>Q. prod_list Q = prod_list [] \<and> length [] \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>Q. prod_list Q = prod_list [] \<and> length [] \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)

goal (1 subgoal):
 1. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
case (Cons x P)
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
0 < degree (prod_list (x # P))
?u \<in> set (x # P) \<Longrightarrow> 0 < degree ?u \<and> monic ?u
square_free (prod_list (x # P))

goal (1 subgoal):
 1. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
have sf_P: "square_free (prod_list P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_free (prod_list P)
[PROOF STEP]
by (metis Cons.prems(3) dvd_triv_left prod_list.Cons mult.commute square_free_factor)
[PROOF STATE]
proof (state)
this:
square_free (prod_list P)

goal (1 subgoal):
 1. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
have deg_x: "degree x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < degree x
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
0 < degree (prod_list (x # P))
?u \<in> set (x # P) \<Longrightarrow> 0 < degree ?u \<and> monic ?u
square_free (prod_list (x # P))

goal (1 subgoal):
 1. 0 < degree x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < degree x

goal (1 subgoal):
 1. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
have distinct_P: "distinct P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct P
[PROOF STEP]
by (meson Cons.prems(2) Cons.prems(3) distinct.simps(2) square_free_prod_list_distinct)
[PROOF STATE]
proof (state)
this:
distinct P

goal (1 subgoal):
 1. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
have "\<exists>A. finite A \<and> x = \<Prod>A \<and> A \<subseteq> {q. irreducible q \<and> monic q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>A. finite A \<and> x = \<Prod>A \<and> A \<subseteq> {q. irreducible q \<and> monic q}
[PROOF STEP]
proof (rule monic_square_free_irreducible_factorization)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. monic x
 2. square_free x
[PROOF STEP]
show "monic x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monic x
[PROOF STEP]
by (simp add: Cons.prems(2))
[PROOF STATE]
proof (state)
this:
monic x

goal (1 subgoal):
 1. square_free x
[PROOF STEP]
show "square_free x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_free x
[PROOF STEP]
by (metis Cons.prems(3) dvd_triv_left prod_list.Cons square_free_factor)
[PROOF STATE]
proof (state)
this:
square_free x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>A. finite A \<and> x = \<Prod>A \<and> A \<subseteq> {q. irreducible q \<and> monic q}

goal (1 subgoal):
 1. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>A. finite A \<and> x = \<Prod>A \<and> A \<subseteq> {q. irreducible q \<and> monic q}
[PROOF STEP]
obtain A where fin_A: "finite A"
    and xA: "x = \<Prod>A"
    and A: "A \<subseteq> {q. irreducible\<^sub>d q \<and> monic q}"
[PROOF STATE]
proof (prove)
using this:
\<exists>A. finite A \<and> x = \<Prod>A \<and> A \<subseteq> {q. irreducible q \<and> monic q}

goal (1 subgoal):
 1. (\<And>A. \<lbrakk>finite A; x = \<Prod>A; A \<subseteq> {q. irreducible\<^sub>d q \<and> monic q}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite A
x = \<Prod>A
A \<subseteq> {q. irreducible\<^sub>d q \<and> monic q}

goal (1 subgoal):
 1. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
obtain A' where s: "set A' = A" and length_A': "length A' = card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>set A' = A; length A' = card A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>finite A\<close> distinct_card finite_distinct_list
[PROOF STATE]
proof (prove)
using this:
finite A
distinct ?xs \<Longrightarrow> card (set ?xs) = length ?xs
finite ?A \<Longrightarrow> \<exists>xs. set xs = ?A \<and> distinct xs

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>set A' = A; length A' = card A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
set A' = A
length A' = card A

goal (1 subgoal):
 1. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
have A_not_empty: "A \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> {}
[PROOF STEP]
using xA deg_x
[PROOF STATE]
proof (prove)
using this:
x = \<Prod>A
0 < degree x

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

goal (1 subgoal):
 1. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
have x_prod_list_A': "x = prod_list A'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = prod_list A'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = prod_list A'
[PROOF STEP]
have "x = \<Prod>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = \<Prod>A
[PROOF STEP]
using xA
[PROOF STATE]
proof (prove)
using this:
x = \<Prod>A

goal (1 subgoal):
 1. x = \<Prod>A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = \<Prod>A

goal (1 subgoal):
 1. x = prod_list A'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x = \<Prod>A

goal (1 subgoal):
 1. x = prod_list A'
[PROOF STEP]
have "... = prod id A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>A = prod id A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Prod>A = prod id A

goal (1 subgoal):
 1. x = prod_list A'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Prod>A = prod id A

goal (1 subgoal):
 1. x = prod_list A'
[PROOF STEP]
have "... = prod id (set A')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod id A = prod id (set A')
[PROOF STEP]
unfolding s
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod id A = prod id A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod id A = prod id (set A')

goal (1 subgoal):
 1. x = prod_list A'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod id A = prod id (set A')

goal (1 subgoal):
 1. x = prod_list A'
[PROOF STEP]
have "... = prod_list (map id A')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod id (set A') = prod_list (map id A')
[PROOF STEP]
by (rule prod.distinct_set_conv_list, simp add: card_distinct length_A' s)
[PROOF STATE]
proof (state)
this:
prod id (set A') = prod_list (map id A')

goal (1 subgoal):
 1. x = prod_list A'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod id (set A') = prod_list (map id A')

goal (1 subgoal):
 1. x = prod_list A'
[PROOF STEP]
have "... =  prod_list A'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map id A') = prod_list A'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prod_list (map id A') = prod_list A'

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

goal (1 subgoal):
 1. x = prod_list A'
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x = prod_list A'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x = prod_list A'

goal (1 subgoal):
 1. \<And>a P. \<lbrakk>\<lbrakk>0 < degree (prod_list P); \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list P)\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u); 0 < degree (prod_list (a # P)); \<And>u. u \<in> set (a # P) \<Longrightarrow> 0 < degree u \<and> monic u; square_free (prod_list (a # P))\<rbrakk> \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (a # P) \<and> length (a # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
proof (cases "P = []")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. P = [] \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
 2. P \<noteq> [] \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
P = []

goal (2 subgoals):
 1. P = [] \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
 2. P \<noteq> [] \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
proof (rule exI[of _ "A'"], auto simp add: True)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. prod_list A' = x
 2. Suc 0 \<le> length A'
 3. \<And>u. u \<in> set A' \<Longrightarrow> irreducible u
 4. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
show "prod_list A' = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list A' = x
[PROOF STEP]
using x_prod_list_A'
[PROOF STATE]
proof (prove)
using this:
x = prod_list A'

goal (1 subgoal):
 1. prod_list A' = x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod_list A' = x

goal (3 subgoals):
 1. Suc 0 \<le> length A'
 2. \<And>u. u \<in> set A' \<Longrightarrow> irreducible u
 3. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
show "Suc 0 \<le> length A'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 \<le> length A'
[PROOF STEP]
using A_not_empty
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}

goal (1 subgoal):
 1. Suc 0 \<le> length A'
[PROOF STEP]
using s length_A'
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}
set A' = A
length A' = card A

goal (1 subgoal):
 1. Suc 0 \<le> length A'
[PROOF STEP]
by (simp add: Suc_leI card_gt_0_iff fin_A)
[PROOF STATE]
proof (state)
this:
Suc 0 \<le> length A'

goal (2 subgoals):
 1. \<And>u. u \<in> set A' \<Longrightarrow> irreducible u
 2. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
show "\<And>u. u \<in> set A' \<Longrightarrow> irreducible u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u. u \<in> set A' \<Longrightarrow> irreducible u
[PROOF STEP]
using s A
[PROOF STATE]
proof (prove)
using this:
set A' = A
A \<subseteq> {q. irreducible\<^sub>d q \<and> monic q}

goal (1 subgoal):
 1. \<And>u. u \<in> set A' \<Longrightarrow> irreducible u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?u \<in> set A' \<Longrightarrow> irreducible ?u

goal (1 subgoal):
 1. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
show "\<And>u. u \<in> set A' \<Longrightarrow> monic u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
using s A
[PROOF STATE]
proof (prove)
using this:
set A' = A
A \<subseteq> {q. irreducible\<^sub>d q \<and> monic q}

goal (1 subgoal):
 1. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?u \<in> set A' \<Longrightarrow> monic ?u

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)

goal (1 subgoal):
 1. P \<noteq> [] \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P \<noteq> [] \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
P \<noteq> []

goal (1 subgoal):
 1. P \<noteq> [] \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
have hyp: "\<exists>Q. prod_list Q = prod_list P
    \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
proof (rule Cons.hyps[OF _ _ sf_P])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
have set_P: "set P \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set P \<noteq> {}
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
P \<noteq> []

goal (1 subgoal):
 1. set P \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set P \<noteq> {}

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
have "prod_list P = prod_list (map id P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list P = prod_list (map id P)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod_list P = prod_list (map id P)

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod_list P = prod_list (map id P)

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
have "... = prod id (set P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map id P) = prod id (set P)
[PROOF STEP]
using prod.distinct_set_conv_list[OF distinct_P, of id]
[PROOF STATE]
proof (prove)
using this:
prod id (set P) = prod_list (map id P)

goal (1 subgoal):
 1. prod_list (map id P) = prod id (set P)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod_list (map id P) = prod id (set P)

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod_list (map id P) = prod id (set P)

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
have "... = \<Prod>(set P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod id (set P) = \<Prod>(set P)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod id (set P) = \<Prod>(set P)

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prod_list P = \<Prod>(set P)
[PROOF STEP]
have "prod_list P = \<Prod>(set P)"
[PROOF STATE]
proof (prove)
using this:
prod_list P = \<Prod>(set P)

goal (1 subgoal):
 1. prod_list P = \<Prod>(set P)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
prod_list P = \<Prod>(set P)

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
hence "degree (prod_list P) = degree (\<Prod>(set P))"
[PROOF STATE]
proof (prove)
using this:
prod_list P = \<Prod>(set P)

goal (1 subgoal):
 1. degree (prod_list P) = degree (\<Prod>(set P))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree (prod_list P) = degree (\<Prod>(set P))

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (prod_list P) = degree (\<Prod>(set P))

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
have "... = degree (prod id (set P))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (\<Prod>(set P)) = degree (prod id (set P))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree (\<Prod>(set P)) = degree (prod id (set P))

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (\<Prod>(set P)) = degree (prod id (set P))

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
have "... = (\<Sum>i\<in>(set P). degree (id i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (prod id (set P)) = (\<Sum>i\<in>set P. degree (id i))
[PROOF STEP]
proof (rule degree_prod_eq_sum_degree)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i\<in>set P. id i \<noteq> 0
[PROOF STEP]
show "\<forall>i\<in>set P. id i \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>set P. id i \<noteq> 0
[PROOF STEP]
using Cons.prems(2)
[PROOF STATE]
proof (prove)
using this:
?u \<in> set (x # P) \<Longrightarrow> 0 < degree ?u \<and> monic ?u

goal (1 subgoal):
 1. \<forall>i\<in>set P. id i \<noteq> 0
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>set P. id i \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (prod id (set P)) = (\<Sum>i\<in>set P. degree (id i))

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (prod id (set P)) = (\<Sum>i\<in>set P. degree (id i))

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
have "... > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < (\<Sum>i\<in>set P. degree (id i))
[PROOF STEP]
by (metis Cons.prems(2) List.finite_set set_P gr0I id_apply insert_iff list.set(2) sum_pos)
[PROOF STATE]
proof (state)
this:
0 < (\<Sum>i\<in>set P. degree (id i))

goal (2 subgoals):
 1. 0 < degree (prod_list P)
 2. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 < degree (prod_list P)
[PROOF STEP]
show "degree (prod_list P) > 0"
[PROOF STATE]
proof (prove)
using this:
0 < degree (prod_list P)

goal (1 subgoal):
 1. 0 < degree (prod_list P)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < degree (prod_list P)

goal (1 subgoal):
 1. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
show "\<And>u. u \<in> set P \<Longrightarrow> degree u > 0 \<and> monic u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
0 < degree (prod_list (x # P))
?u \<in> set (x # P) \<Longrightarrow> 0 < degree ?u \<and> monic ?u
square_free (prod_list (x # P))

goal (1 subgoal):
 1. \<And>u. u \<in> set P \<Longrightarrow> 0 < degree u \<and> monic u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?u \<in> set P \<Longrightarrow> 0 < degree ?u \<and> monic ?u

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)

goal (1 subgoal):
 1. P \<noteq> [] \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
obtain Q where QP: "prod_list Q = prod_list P" and length_PQ: "length P \<le> length Q"
  and monic_irr_Q: "(\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)"
[PROOF STATE]
proof (prove)
using this:
\<exists>Q. prod_list Q = prod_list P \<and> length P \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>prod_list Q = prod_list P; length P \<le> length Q; \<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
prod_list Q = prod_list P
length P \<le> length Q
\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u

goal (1 subgoal):
 1. P \<noteq> [] \<Longrightarrow> \<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)
[PROOF STEP]
proof (rule exI[of _ "A' @ Q"], auto simp add: monic_irr_Q)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. prod_list A' * prod_list Q = x * prod_list P
 2. Suc (length P) \<le> length A' + length Q
 3. \<And>u. u \<in> set A' \<Longrightarrow> irreducible u
 4. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
show "prod_list A' * prod_list Q = x * prod_list P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list A' * prod_list Q = x * prod_list P
[PROOF STEP]
unfolding QP x_prod_list_A'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list A' * prod_list P = prod_list A' * prod_list P
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prod_list A' * prod_list Q = x * prod_list P

goal (3 subgoals):
 1. Suc (length P) \<le> length A' + length Q
 2. \<And>u. u \<in> set A' \<Longrightarrow> irreducible u
 3. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
have "length A' \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length A' \<noteq> 0
[PROOF STEP]
using A_not_empty
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}

goal (1 subgoal):
 1. length A' \<noteq> 0
[PROOF STEP]
using s length_A'
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}
set A' = A
length A' = card A

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

goal (3 subgoals):
 1. Suc (length P) \<le> length A' + length Q
 2. \<And>u. u \<in> set A' \<Longrightarrow> irreducible u
 3. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
thus "Suc (length P) \<le> length A' + length Q"
[PROOF STATE]
proof (prove)
using this:
length A' \<noteq> 0

goal (1 subgoal):
 1. Suc (length P) \<le> length A' + length Q
[PROOF STEP]
using QP length_PQ
[PROOF STATE]
proof (prove)
using this:
length A' \<noteq> 0
prod_list Q = prod_list P
length P \<le> length Q

goal (1 subgoal):
 1. Suc (length P) \<le> length A' + length Q
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
Suc (length P) \<le> length A' + length Q

goal (2 subgoals):
 1. \<And>u. u \<in> set A' \<Longrightarrow> irreducible u
 2. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
show "\<And>u. u \<in> set A' \<Longrightarrow> irreducible u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u. u \<in> set A' \<Longrightarrow> irreducible u
[PROOF STEP]
using s A
[PROOF STATE]
proof (prove)
using this:
set A' = A
A \<subseteq> {q. irreducible\<^sub>d q \<and> monic q}

goal (1 subgoal):
 1. \<And>u. u \<in> set A' \<Longrightarrow> irreducible u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?u \<in> set A' \<Longrightarrow> irreducible ?u

goal (1 subgoal):
 1. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
show "\<And>u. u \<in> set A' \<Longrightarrow> monic u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
using s A
[PROOF STATE]
proof (prove)
using this:
set A' = A
A \<subseteq> {q. irreducible\<^sub>d q \<and> monic q}

goal (1 subgoal):
 1. \<And>u. u \<in> set A' \<Longrightarrow> monic u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?u \<in> set A' \<Longrightarrow> monic ?u

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>Q. prod_list Q = prod_list (x # P) \<and> length (x # P) \<le> length Q \<and> (\<forall>u. u \<in> set Q \<longrightarrow> irreducible u \<and> monic u)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smult_0_right [simp]: "smult a 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult a 0 = 0
[PROOF STEP]
by (rule poly_eqI) simp


[STATEMENT]
lemma Gramian_determinant_of_int: assumes fs: "set fs \<subseteq> carrier_vec n"
  and j: "j \<le> length fs"
shows "of_int (gram_schmidt.Gramian_determinant n fs j)
  = gram_schmidt.Gramian_determinant n (map (map_vec rat_of_int) fs) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int (gram_schmidt.Gramian_determinant n fs j) = gram_schmidt.Gramian_determinant n (map of_int_hom.vec_hom fs) j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rat_of_int (gram_schmidt.Gramian_determinant n fs j) = gram_schmidt.Gramian_determinant n (map of_int_hom.vec_hom fs) j
[PROOF STEP]
from j
[PROOF STATE]
proof (chain)
picking this:
j \<le> length fs
[PROOF STEP]
have j: "k < j \<Longrightarrow> k < length fs" for k
[PROOF STATE]
proof (prove)
using this:
j \<le> length fs

goal (1 subgoal):
 1. k < j \<Longrightarrow> k < length fs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k < j \<Longrightarrow> ?k < length fs

goal (1 subgoal):
 1. rat_of_int (gram_schmidt.Gramian_determinant n fs j) = gram_schmidt.Gramian_determinant n (map of_int_hom.vec_hom fs) j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int (gram_schmidt.Gramian_determinant n fs j) = gram_schmidt.Gramian_determinant n (map of_int_hom.vec_hom fs) j
[PROOF STEP]
unfolding gram_schmidt.Gramian_determinant_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int (det (gram_schmidt.Gramian_matrix n fs j)) = det (gram_schmidt.Gramian_matrix n (map of_int_hom.vec_hom fs) j)
[PROOF STEP]
by (subst of_int_hom.hom_det[symmetric], rule arg_cong[of _ _ det],
      unfold gram_schmidt.Gramian_matrix_def Let_def, subst of_int_hom.mat_hom_mult, force, force,
      unfold map_mat_transpose[symmetric],
      rule arg_cong2[of _ _ _ _ "\<lambda> x y. x * y\<^sup>T"], insert fs[unfolded set_conv_nth]
      j, (fastforce intro!: eq_matI)+)
[PROOF STATE]
proof (state)
this:
rat_of_int (gram_schmidt.Gramian_determinant n fs j) = gram_schmidt.Gramian_determinant n (map of_int_hom.vec_hom fs) j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gauss_i_times_i [simp]: "\<i>\<^sub>\<int> * \<i>\<^sub>\<int> = (-1 :: gauss_int)"
  and gauss_cnj_i [simp]: "gauss_cnj \<i>\<^sub>\<int> = -\<i>\<^sub>\<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i>\<^sub>\<int> * \<i>\<^sub>\<int> = - 1 &&& gauss_cnj \<i>\<^sub>\<int> = - \<i>\<^sub>\<int>
[PROOF STEP]
by (simp_all add: gauss_int_eq_iff)


[STATEMENT]
lemma separated_eq_distinguishable:
   "separatedin X {x} {y} \<longleftrightarrow>
        x \<in> topspace X \<and> y \<in> topspace X \<and>
        (\<exists>U. openin X U \<and> x \<in> U \<and> (y \<notin> U)) \<and>
        (\<exists>v. openin X v \<and> y \<in> v \<and> (x \<notin> v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. separatedin X {x} {y} = (x \<in> topspace X \<and> y \<in> topspace X \<and> (\<exists>U. openin X U \<and> x \<in> U \<and> y \<notin> U) \<and> (\<exists>v. openin X v \<and> y \<in> v \<and> x \<notin> v))
[PROOF STEP]
by (force simp: separatedin_def closure_of_def)


[STATEMENT]
lemma lcm_mult_distrib_int: "abs (k::int) * lcm m n = lcm (k * m) (k * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>k\<bar> * lcm m n = lcm (k * m) (k * n)
[PROOF STEP]
by (simp add: lcm_mult_left abs_mult)


[STATEMENT]
theorem inverse_zeta_sums:
  assumes s: "Re s > 1"
  shows   "(\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)
[PROOF STEP]
have "fds_converges (fds moebius_mu) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_converges (fds moebius_mu) s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < Re s

goal (1 subgoal):
 1. fds_converges (fds moebius_mu) s
[PROOF STEP]
by (auto intro!: fds_abs_converges_moebius_mu)
[PROOF STATE]
proof (state)
this:
fds_converges (fds moebius_mu) s

goal (1 subgoal):
 1. (\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)
[PROOF STEP]
hence "(\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums eval_fds (fds moebius_mu) s"
[PROOF STATE]
proof (prove)
using this:
fds_converges (fds moebius_mu) s

goal (1 subgoal):
 1. (\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums eval_fds (fds moebius_mu) s
[PROOF STEP]
by (simp add: fds_converges_altdef)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums eval_fds (fds moebius_mu) s

goal (1 subgoal):
 1. (\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums eval_fds (fds moebius_mu) s

goal (1 subgoal):
 1. (\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)
[PROOF STEP]
have "fds moebius_mu = inverse (fds_zeta :: complex fds)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds moebius_mu = inverse fds_zeta
[PROOF STEP]
by (rule fds_moebius_inverse_zeta)
[PROOF STATE]
proof (state)
this:
fds moebius_mu = inverse fds_zeta

goal (1 subgoal):
 1. (\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fds moebius_mu = inverse fds_zeta

goal (1 subgoal):
 1. (\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)
[PROOF STEP]
from s
[PROOF STATE]
proof (chain)
picking this:
1 < Re s
[PROOF STEP]
have "eval_fds \<dots> s = inverse (zeta s)"
[PROOF STATE]
proof (prove)
using this:
1 < Re s

goal (1 subgoal):
 1. eval_fds (inverse fds_zeta) s = inverse (zeta s)
[PROOF STEP]
by (subst eval_fds_inverse)
       (auto simp: fds_moebius_inverse_zeta [symmetric] eval_fds_zeta
             intro!: fds_abs_converges_moebius_mu)
[PROOF STATE]
proof (state)
this:
eval_fds (inverse fds_zeta) s = inverse (zeta s)

goal (1 subgoal):
 1. (\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)

goal (1 subgoal):
 1. (\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. moebius_mu (Suc n) / of_nat (Suc n) powr s) sums inverse (zeta s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "\<not> (\<forall>x (y::'a::linordered_field). x < y \<longrightarrow> 10 * x < 11 * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>x y. x < y \<longrightarrow> (10::'a) * x < (11::'a) * y)
[PROOF STEP]
by ferrack