[STATEMENT]
lemma smaller_fermat4:
  assumes abc: "(a::int)^4+b^4=c^2" and abc0: "a*b*c \<noteq> 0" and aodd: "odd a"
    and ab_relprime: "coprime a b"
  shows
  "\<exists> p q r. (p^4+q^4=r^2 \<and> p*q*r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r^2 < c^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
proof -
  \<comment> \<open>put equation in shape of a pythagorean triple and obtain $u$ and $v$\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
from ab_relprime
[PROOF STATE]
proof (chain)
picking this:
coprime a b
[PROOF STEP]
have a2b2relprime: "coprime (a^2) (b^2)"
[PROOF STATE]
proof (prove)
using this:
coprime a b

goal (1 subgoal):
 1. coprime (a\<^sup>2) (b\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coprime (a\<^sup>2) (b\<^sup>2)

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
coprime (a\<^sup>2) (b\<^sup>2)

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
from aodd
[PROOF STATE]
proof (chain)
picking this:
odd a
[PROOF STEP]
have "odd (a^2)"
[PROOF STATE]
proof (prove)
using this:
odd a

goal (1 subgoal):
 1. odd (a\<^sup>2)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
odd (a\<^sup>2)

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
odd (a\<^sup>2)

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
from abc
[PROOF STATE]
proof (chain)
picking this:
a ^ 4 + b ^ 4 = c\<^sup>2
[PROOF STEP]
have "(a^2)^2 + (b^2)^2 = c^2"
[PROOF STATE]
proof (prove)
using this:
a ^ 4 + b ^ 4 = c\<^sup>2

goal (1 subgoal):
 1. (a\<^sup>2)\<^sup>2 + (b\<^sup>2)\<^sup>2 = c\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(a\<^sup>2)\<^sup>2 + (b\<^sup>2)\<^sup>2 = c\<^sup>2

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
coprime (a\<^sup>2) (b\<^sup>2)
odd (a\<^sup>2)
(a\<^sup>2)\<^sup>2 + (b\<^sup>2)\<^sup>2 = c\<^sup>2
[PROOF STEP]
obtain u and v where uvabc:
    "a^2 = u^2-v^2 \<and> b^2 = 2*u*v \<and> \<bar>c\<bar> = u^2 + v^2 \<and> coprime u v"
[PROOF STATE]
proof (prove)
using this:
coprime (a\<^sup>2) (b\<^sup>2)
odd (a\<^sup>2)
(a\<^sup>2)\<^sup>2 + (b\<^sup>2)\<^sup>2 = c\<^sup>2

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

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
with abc0
[PROOF STATE]
proof (chain)
picking this:
a * b * c \<noteq> 0
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v
[PROOF STEP]
have uv0: "u\<noteq>0 \<and> v\<noteq>0"
[PROOF STATE]
proof (prove)
using this:
a * b * c \<noteq> 0
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v

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

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
have av_relprime: "coprime a v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime a v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coprime a v
[PROOF STEP]
have "gcd a v dvd gcd (a^2) v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd a v dvd gcd (a\<^sup>2) v
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
gcd a v dvd gcd (a\<^sup>2) v

goal (1 subgoal):
 1. coprime a v
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
gcd a v dvd gcd (a\<^sup>2) v

goal (1 subgoal):
 1. coprime a v
[PROOF STEP]
from uvabc
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v
[PROOF STEP]
have "gcd v (a^2) dvd gcd (b^2) (a^2)"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v

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

goal (1 subgoal):
 1. coprime a v
[PROOF STEP]
with a2b2relprime
[PROOF STATE]
proof (chain)
picking this:
coprime (a\<^sup>2) (b\<^sup>2)
gcd v (a\<^sup>2) dvd gcd (b\<^sup>2) (a\<^sup>2)
[PROOF STEP]
have "gcd (a^2) v dvd (1::int)"
[PROOF STATE]
proof (prove)
using this:
coprime (a\<^sup>2) (b\<^sup>2)
gcd v (a\<^sup>2) dvd gcd (b\<^sup>2) (a\<^sup>2)

goal (1 subgoal):
 1. is_unit (gcd (a\<^sup>2) v)
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
is_unit (gcd (a\<^sup>2) v)

goal (1 subgoal):
 1. coprime a v
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
gcd a v dvd gcd (a\<^sup>2) v
is_unit (gcd (a\<^sup>2) v)
[PROOF STEP]
have "gcd a v dvd 1"
[PROOF STATE]
proof (prove)
using this:
gcd a v dvd gcd (a\<^sup>2) v
is_unit (gcd (a\<^sup>2) v)

goal (1 subgoal):
 1. is_unit (gcd a v)
[PROOF STEP]
by (rule dvd_trans)
[PROOF STATE]
proof (state)
this:
is_unit (gcd a v)

goal (1 subgoal):
 1. coprime a v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_unit (gcd a v)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
is_unit (gcd a v)

goal (1 subgoal):
 1. coprime a v
[PROOF STEP]
by (simp add: gcd_eq_1_imp_coprime)
[PROOF STATE]
proof (state)
this:
coprime a v

goal:
No subgoals!
[PROOF STEP]
qed
  \<comment> \<open>make again a pythagorean triple and obtain $k$ and $l$\<close>
[PROOF STATE]
proof (state)
this:
coprime a v

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
from uvabc
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v
[PROOF STEP]
have "a^2 + v^2 = u^2"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v

goal (1 subgoal):
 1. a\<^sup>2 + v\<^sup>2 = u\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + v\<^sup>2 = u\<^sup>2

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
with av_relprime and aodd
[PROOF STATE]
proof (chain)
picking this:
coprime a v
odd a
a\<^sup>2 + v\<^sup>2 = u\<^sup>2
[PROOF STEP]
obtain k l where
    klavu: "a = k^2-l^2 \<and> v = 2*k*l \<and> \<bar>u\<bar> = k^2+l^2" and kl_rel: "coprime k l"
[PROOF STATE]
proof (prove)
using this:
coprime a v
odd a
a\<^sup>2 + v\<^sup>2 = u\<^sup>2

goal (1 subgoal):
 1. (\<And>k l. \<lbrakk>a = k\<^sup>2 - l\<^sup>2 \<and> v = 2 * k * l \<and> \<bar>u\<bar> = k\<^sup>2 + l\<^sup>2; coprime k l\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (frule_tac a="a" in int_euclid_pyth_triples, auto)
  \<comment> \<open>prove $b=2m$ and $kl(k^2 + l^2) = m^2$, for coprime $k$, $l$ and $k^2+l^2$\<close>
[PROOF STATE]
proof (state)
this:
a = k\<^sup>2 - l\<^sup>2 \<and> v = 2 * k * l \<and> \<bar>u\<bar> = k\<^sup>2 + l\<^sup>2
coprime k l

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
from uvabc
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v
[PROOF STEP]
have "even (b^2)"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v

goal (1 subgoal):
 1. even (b\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
even (b\<^sup>2)

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
hence "even b"
[PROOF STATE]
proof (prove)
using this:
even (b\<^sup>2)

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

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
even b
[PROOF STEP]
obtain m where bm: "b = 2*m"
[PROOF STATE]
proof (prove)
using this:
even b

goal (1 subgoal):
 1. (\<And>m. b = 2 * m \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using evenE
[PROOF STATE]
proof (prove)
using this:
even b
\<lbrakk>even ?a; \<And>b. ?a = (2::?'a) * b \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>m. b = 2 * m \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b = 2 * m

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
have "\<bar>k\<bar>*\<bar>l\<bar>*\<bar>k^2+l^2\<bar> = m^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
[PROOF STEP]
from bm
[PROOF STATE]
proof (chain)
picking this:
b = 2 * m
[PROOF STEP]
have "4*m^2 = b^2"
[PROOF STATE]
proof (prove)
using this:
b = 2 * m

goal (1 subgoal):
 1. 4 * m\<^sup>2 = b\<^sup>2
[PROOF STEP]
by (simp only: power2_eq_square ac_simps)
[PROOF STATE]
proof (state)
this:
4 * m\<^sup>2 = b\<^sup>2

goal (1 subgoal):
 1. \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
4 * m\<^sup>2 = b\<^sup>2

goal (1 subgoal):
 1. \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
[PROOF STEP]
have "\<dots> = \<bar>b^2\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b\<^sup>2 = \<bar>b\<^sup>2\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b\<^sup>2 = \<bar>b\<^sup>2\<bar>

goal (1 subgoal):
 1. \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b\<^sup>2 = \<bar>b\<^sup>2\<bar>

goal (1 subgoal):
 1. \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
[PROOF STEP]
with uvabc
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v
b\<^sup>2 = \<bar>b\<^sup>2\<bar>
[PROOF STEP]
have "\<dots> = 2*\<bar>v\<bar>*\<bar>\<bar>u\<bar>\<bar>"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v
b\<^sup>2 = \<bar>b\<^sup>2\<bar>

goal (1 subgoal):
 1. \<bar>b\<^sup>2\<bar> = 2 * \<bar>v\<bar> * \<bar>\<bar>u\<bar>\<bar>
[PROOF STEP]
by (simp add: abs_mult)
[PROOF STATE]
proof (state)
this:
\<bar>b\<^sup>2\<bar> = 2 * \<bar>v\<bar> * \<bar>\<bar>u\<bar>\<bar>

goal (1 subgoal):
 1. \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>b\<^sup>2\<bar> = 2 * \<bar>v\<bar> * \<bar>\<bar>u\<bar>\<bar>

goal (1 subgoal):
 1. \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
[PROOF STEP]
with klavu
[PROOF STATE]
proof (chain)
picking this:
a = k\<^sup>2 - l\<^sup>2 \<and> v = 2 * k * l \<and> \<bar>u\<bar> = k\<^sup>2 + l\<^sup>2
\<bar>b\<^sup>2\<bar> = 2 * \<bar>v\<bar> * \<bar>\<bar>u\<bar>\<bar>
[PROOF STEP]
have "\<dots> = 2*\<bar>2*k*l\<bar>*\<bar>k^2+l^2\<bar>"
[PROOF STATE]
proof (prove)
using this:
a = k\<^sup>2 - l\<^sup>2 \<and> v = 2 * k * l \<and> \<bar>u\<bar> = k\<^sup>2 + l\<^sup>2
\<bar>b\<^sup>2\<bar> = 2 * \<bar>v\<bar> * \<bar>\<bar>u\<bar>\<bar>

goal (1 subgoal):
 1. 2 * \<bar>v\<bar> * \<bar>\<bar>u\<bar>\<bar> = 2 * \<bar>2 * k * l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * \<bar>v\<bar> * \<bar>\<bar>u\<bar>\<bar> = 2 * \<bar>2 * k * l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>

goal (1 subgoal):
 1. \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * \<bar>v\<bar> * \<bar>\<bar>u\<bar>\<bar> = 2 * \<bar>2 * k * l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>

goal (1 subgoal):
 1. \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
[PROOF STEP]
have "\<dots> = 4*\<bar>k\<bar>*\<bar>l\<bar>*\<bar>k^2+l^2\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * \<bar>2 * k * l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = 4 * \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>
[PROOF STEP]
by (auto simp add: abs_mult)
[PROOF STATE]
proof (state)
this:
2 * \<bar>2 * k * l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = 4 * \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>

goal (1 subgoal):
 1. \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
4 * m\<^sup>2 = 4 * \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
4 * m\<^sup>2 = 4 * \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>

goal (1 subgoal):
 1. \<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
have "(2::nat) > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 < 2

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 < 2

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
from kl_rel
[PROOF STATE]
proof (chain)
picking this:
coprime k l
[PROOF STEP]
have "coprime \<bar>k\<bar> \<bar>l\<bar>"
[PROOF STATE]
proof (prove)
using this:
coprime k l

goal (1 subgoal):
 1. coprime \<bar>k\<bar> \<bar>l\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coprime \<bar>k\<bar> \<bar>l\<bar>

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
coprime \<bar>k\<bar> \<bar>l\<bar>

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
have "coprime \<bar>l\<bar> (\<bar>k^2+l^2\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime \<bar>l\<bar> \<bar>k\<^sup>2 + l\<^sup>2\<bar>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coprime \<bar>l\<bar> \<bar>k\<^sup>2 + l\<^sup>2\<bar>
[PROOF STEP]
from kl_rel
[PROOF STATE]
proof (chain)
picking this:
coprime k l
[PROOF STEP]
have "coprime (k*k) l"
[PROOF STATE]
proof (prove)
using this:
coprime k l

goal (1 subgoal):
 1. coprime (k * k) l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coprime (k * k) l

goal (1 subgoal):
 1. coprime \<bar>l\<bar> \<bar>k\<^sup>2 + l\<^sup>2\<bar>
[PROOF STEP]
hence "coprime (k*k+l*l) l"
[PROOF STATE]
proof (prove)
using this:
coprime (k * k) l

goal (1 subgoal):
 1. coprime (k * k + l * l) l
[PROOF STEP]
using gcd_add_mult [of l l "k*k"]
[PROOF STATE]
proof (prove)
using this:
coprime (k * k) l
gcd l (l * l + k * k) = gcd l (k * k)

goal (1 subgoal):
 1. coprime (k * k + l * l) l
[PROOF STEP]
by (simp add: ac_simps gcd_eq_1_imp_coprime)
[PROOF STATE]
proof (state)
this:
coprime (k * k + l * l) l

goal (1 subgoal):
 1. coprime \<bar>l\<bar> \<bar>k\<^sup>2 + l\<^sup>2\<bar>
[PROOF STEP]
hence "coprime l (k^2+l^2)"
[PROOF STATE]
proof (prove)
using this:
coprime (k * k + l * l) l

goal (1 subgoal):
 1. coprime l (k\<^sup>2 + l\<^sup>2)
[PROOF STEP]
by (simp add: power2_eq_square ac_simps)
[PROOF STATE]
proof (state)
this:
coprime l (k\<^sup>2 + l\<^sup>2)

goal (1 subgoal):
 1. coprime \<bar>l\<bar> \<bar>k\<^sup>2 + l\<^sup>2\<bar>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
coprime l (k\<^sup>2 + l\<^sup>2)

goal (1 subgoal):
 1. coprime \<bar>l\<bar> \<bar>k\<^sup>2 + l\<^sup>2\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coprime \<bar>l\<bar> \<bar>k\<^sup>2 + l\<^sup>2\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
coprime \<bar>l\<bar> \<bar>k\<^sup>2 + l\<^sup>2\<bar>

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
coprime \<bar>l\<bar> \<bar>k\<^sup>2 + l\<^sup>2\<bar>

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
have "coprime \<bar>k^2+l^2\<bar> \<bar>k\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> \<bar>k\<bar>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> \<bar>k\<bar>
[PROOF STEP]
from kl_rel
[PROOF STATE]
proof (chain)
picking this:
coprime k l
[PROOF STEP]
have "coprime l k"
[PROOF STATE]
proof (prove)
using this:
coprime k l

goal (1 subgoal):
 1. coprime l k
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
coprime l k

goal (1 subgoal):
 1. coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> \<bar>k\<bar>
[PROOF STEP]
hence "coprime (l*l) k"
[PROOF STATE]
proof (prove)
using this:
coprime l k

goal (1 subgoal):
 1. coprime (l * l) k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coprime (l * l) k

goal (1 subgoal):
 1. coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> \<bar>k\<bar>
[PROOF STEP]
hence "coprime (l*l+k*k) k"
[PROOF STATE]
proof (prove)
using this:
coprime (l * l) k

goal (1 subgoal):
 1. coprime (l * l + k * k) k
[PROOF STEP]
using gcd_add_mult[of k k "l*l"]
[PROOF STATE]
proof (prove)
using this:
coprime (l * l) k
gcd k (k * k + l * l) = gcd k (l * l)

goal (1 subgoal):
 1. coprime (l * l + k * k) k
[PROOF STEP]
by (simp add: ac_simps gcd_eq_1_imp_coprime)
[PROOF STATE]
proof (state)
this:
coprime (l * l + k * k) k

goal (1 subgoal):
 1. coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> \<bar>k\<bar>
[PROOF STEP]
hence "coprime (k^2+l^2) k"
[PROOF STATE]
proof (prove)
using this:
coprime (l * l + k * k) k

goal (1 subgoal):
 1. coprime (k\<^sup>2 + l\<^sup>2) k
[PROOF STEP]
by (simp add: power2_eq_square ac_simps)
[PROOF STATE]
proof (state)
this:
coprime (k\<^sup>2 + l\<^sup>2) k

goal (1 subgoal):
 1. coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> \<bar>k\<bar>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
coprime (k\<^sup>2 + l\<^sup>2) k

goal (1 subgoal):
 1. coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> \<bar>k\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> \<bar>k\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> \<bar>k\<bar>

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
1 < 2
coprime \<bar>k\<bar> \<bar>l\<bar>
coprime \<bar>l\<bar> \<bar>k\<^sup>2 + l\<^sup>2\<bar>
coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> \<bar>k\<bar>
[PROOF STEP]
have "\<exists> x y z. \<bar>k\<bar> = x^2 \<and> \<bar>l\<bar> = y^2 \<and> \<bar>k^2+l^2\<bar> = z^2"
[PROOF STATE]
proof (prove)
using this:
\<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
1 < 2
coprime \<bar>k\<bar> \<bar>l\<bar>
coprime \<bar>l\<bar> \<bar>k\<^sup>2 + l\<^sup>2\<bar>
coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> \<bar>k\<bar>

goal (1 subgoal):
 1. \<exists>x y z. \<bar>k\<bar> = x\<^sup>2 \<and> \<bar>l\<bar> = y\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = z\<^sup>2
[PROOF STEP]
using int_relprime_power_divisors[of 2 "\<bar>k\<bar>" "\<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>" m]
      int_relprime_power_divisors[of 2 "\<bar>l\<bar>" "\<bar>k\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>" m]
      int_relprime_power_divisors[of 2 "\<bar>k\<^sup>2 + l\<^sup>2\<bar>" "\<bar>k\<bar>*\<bar>l\<bar>" m]
[PROOF STATE]
proof (prove)
using this:
\<bar>k\<bar> * \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar> = m\<^sup>2
1 < 2
coprime \<bar>k\<bar> \<bar>l\<bar>
coprime \<bar>l\<bar> \<bar>k\<^sup>2 + l\<^sup>2\<bar>
coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> \<bar>k\<bar>
\<lbrakk>0 < 2; 0 \<le> \<bar>k\<bar>; 0 \<le> \<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>; \<bar>k\<bar> * (\<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>) = m\<^sup>2; coprime \<bar>k\<bar> (\<bar>l\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>)\<rbrakk> \<Longrightarrow> \<exists>ka. \<bar>k\<bar> = ka\<^sup>2
\<lbrakk>0 < 2; 0 \<le> \<bar>l\<bar>; 0 \<le> \<bar>k\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>; \<bar>l\<bar> * (\<bar>k\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>) = m\<^sup>2; coprime \<bar>l\<bar> (\<bar>k\<bar> * \<bar>k\<^sup>2 + l\<^sup>2\<bar>)\<rbrakk> \<Longrightarrow> \<exists>k. \<bar>l\<bar> = k\<^sup>2
\<lbrakk>0 < 2; 0 \<le> \<bar>k\<^sup>2 + l\<^sup>2\<bar>; 0 \<le> \<bar>k\<bar> * \<bar>l\<bar>; \<bar>k\<^sup>2 + l\<^sup>2\<bar> * (\<bar>k\<bar> * \<bar>l\<bar>) = m\<^sup>2; coprime \<bar>k\<^sup>2 + l\<^sup>2\<bar> (\<bar>k\<bar> * \<bar>l\<bar>)\<rbrakk> \<Longrightarrow> \<exists>ka. \<bar>k\<^sup>2 + l\<^sup>2\<bar> = ka\<^sup>2

goal (1 subgoal):
 1. \<exists>x y z. \<bar>k\<bar> = x\<^sup>2 \<and> \<bar>l\<bar> = y\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = z\<^sup>2
[PROOF STEP]
by (simp_all add: ac_simps)
[PROOF STATE]
proof (state)
this:
\<exists>x y z. \<bar>k\<bar> = x\<^sup>2 \<and> \<bar>l\<bar> = y\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = z\<^sup>2

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x y z. \<bar>k\<bar> = x\<^sup>2 \<and> \<bar>l\<bar> = y\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = z\<^sup>2
[PROOF STEP]
obtain \<alpha> \<beta> \<gamma> where albega:
    "\<bar>k\<bar> = \<alpha>^2 \<and> \<bar>l\<bar> = \<beta>^2 \<and> \<bar>k^2+l^2\<bar> = \<gamma>^2"
[PROOF STATE]
proof (prove)
using this:
\<exists>x y z. \<bar>k\<bar> = x\<^sup>2 \<and> \<bar>l\<bar> = y\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = z\<^sup>2

goal (1 subgoal):
 1. (\<And>\<alpha> \<beta> \<gamma>. \<bar>k\<bar> = \<alpha>\<^sup>2 \<and> \<bar>l\<bar> = \<beta>\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = \<gamma>\<^sup>2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
  \<comment> \<open>show this is a new solution\<close>
[PROOF STATE]
proof (state)
this:
\<bar>k\<bar> = \<alpha>\<^sup>2 \<and> \<bar>l\<bar> = \<beta>\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = \<gamma>\<^sup>2

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
have "k^2 = \<alpha>^4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k\<^sup>2 = \<alpha> ^ 4
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k\<^sup>2 = \<alpha> ^ 4
[PROOF STEP]
from albega
[PROOF STATE]
proof (chain)
picking this:
\<bar>k\<bar> = \<alpha>\<^sup>2 \<and> \<bar>l\<bar> = \<beta>\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = \<gamma>\<^sup>2
[PROOF STEP]
have "\<bar>k\<bar>^2 = (\<alpha>^2)^2"
[PROOF STATE]
proof (prove)
using this:
\<bar>k\<bar> = \<alpha>\<^sup>2 \<and> \<bar>l\<bar> = \<beta>\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = \<gamma>\<^sup>2

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

goal (1 subgoal):
 1. k\<^sup>2 = \<alpha> ^ 4
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>k\<bar>\<^sup>2 = (\<alpha>\<^sup>2)\<^sup>2

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
k\<^sup>2 = \<alpha> ^ 4

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
k\<^sup>2 = \<alpha> ^ 4

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
have "l^2 = \<beta>^4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l\<^sup>2 = \<beta> ^ 4
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l\<^sup>2 = \<beta> ^ 4
[PROOF STEP]
from albega
[PROOF STATE]
proof (chain)
picking this:
\<bar>k\<bar> = \<alpha>\<^sup>2 \<and> \<bar>l\<bar> = \<beta>\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = \<gamma>\<^sup>2
[PROOF STEP]
have "\<bar>l\<bar>^2 = (\<beta>^2)^2"
[PROOF STATE]
proof (prove)
using this:
\<bar>k\<bar> = \<alpha>\<^sup>2 \<and> \<bar>l\<bar> = \<beta>\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = \<gamma>\<^sup>2

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

goal (1 subgoal):
 1. l\<^sup>2 = \<beta> ^ 4
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>l\<bar>\<^sup>2 = (\<beta>\<^sup>2)\<^sup>2

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
l\<^sup>2 = \<beta> ^ 4

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
l\<^sup>2 = \<beta> ^ 4

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
have gamma2: "k^2 + l^2 = \<gamma>^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k\<^sup>2 + l\<^sup>2 = \<gamma>\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k\<^sup>2 + l\<^sup>2 = \<gamma>\<^sup>2
[PROOF STEP]
have "k^2 \<ge> 0 \<and> l^2 \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> k\<^sup>2 \<and> 0 \<le> l\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> k\<^sup>2 \<and> 0 \<le> l\<^sup>2

goal (1 subgoal):
 1. k\<^sup>2 + l\<^sup>2 = \<gamma>\<^sup>2
[PROOF STEP]
with albega
[PROOF STATE]
proof (chain)
picking this:
\<bar>k\<bar> = \<alpha>\<^sup>2 \<and> \<bar>l\<bar> = \<beta>\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = \<gamma>\<^sup>2
0 \<le> k\<^sup>2 \<and> 0 \<le> l\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>k\<bar> = \<alpha>\<^sup>2 \<and> \<bar>l\<bar> = \<beta>\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = \<gamma>\<^sup>2
0 \<le> k\<^sup>2 \<and> 0 \<le> l\<^sup>2

goal (1 subgoal):
 1. k\<^sup>2 + l\<^sup>2 = \<gamma>\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k\<^sup>2 + l\<^sup>2 = \<gamma>\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
k\<^sup>2 + l\<^sup>2 = \<gamma>\<^sup>2

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
k\<^sup>2 = \<alpha> ^ 4
l\<^sup>2 = \<beta> ^ 4
k\<^sup>2 + l\<^sup>2 = \<gamma>\<^sup>2
[PROOF STEP]
have newabc: "\<alpha>^4 + \<beta>^4 = \<gamma>^2"
[PROOF STATE]
proof (prove)
using this:
k\<^sup>2 = \<alpha> ^ 4
l\<^sup>2 = \<beta> ^ 4
k\<^sup>2 + l\<^sup>2 = \<gamma>\<^sup>2

goal (1 subgoal):
 1. \<alpha> ^ 4 + \<beta> ^ 4 = \<gamma>\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<alpha> ^ 4 + \<beta> ^ 4 = \<gamma>\<^sup>2

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
from uv0 klavu albega
[PROOF STATE]
proof (chain)
picking this:
u \<noteq> 0 \<and> v \<noteq> 0
a = k\<^sup>2 - l\<^sup>2 \<and> v = 2 * k * l \<and> \<bar>u\<bar> = k\<^sup>2 + l\<^sup>2
\<bar>k\<bar> = \<alpha>\<^sup>2 \<and> \<bar>l\<bar> = \<beta>\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = \<gamma>\<^sup>2
[PROOF STEP]
have albega0: "\<alpha> * \<beta> * \<gamma>  \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
u \<noteq> 0 \<and> v \<noteq> 0
a = k\<^sup>2 - l\<^sup>2 \<and> v = 2 * k * l \<and> \<bar>u\<bar> = k\<^sup>2 + l\<^sup>2
\<bar>k\<bar> = \<alpha>\<^sup>2 \<and> \<bar>l\<bar> = \<beta>\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = \<gamma>\<^sup>2

goal (1 subgoal):
 1. \<alpha> * \<beta> * \<gamma> \<noteq> 0
[PROOF STEP]
by auto
  \<comment> \<open>show the coprimality\<close>
[PROOF STATE]
proof (state)
this:
\<alpha> * \<beta> * \<gamma> \<noteq> 0

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
have alphabeta_relprime: "coprime \<alpha> \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime \<alpha> \<beta>
[PROOF STEP]
proof (rule classical)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> coprime \<alpha> \<beta> \<Longrightarrow> coprime \<alpha> \<beta>
[PROOF STEP]
let ?g = "gcd \<alpha> \<beta>"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> coprime \<alpha> \<beta> \<Longrightarrow> coprime \<alpha> \<beta>
[PROOF STEP]
assume "\<not> coprime \<alpha> \<beta>"
[PROOF STATE]
proof (state)
this:
\<not> coprime \<alpha> \<beta>

goal (1 subgoal):
 1. \<not> coprime \<alpha> \<beta> \<Longrightarrow> coprime \<alpha> \<beta>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> coprime \<alpha> \<beta>
[PROOF STEP]
have gnot1: "?g \<noteq> 1"
[PROOF STATE]
proof (prove)
using this:
\<not> coprime \<alpha> \<beta>

goal (1 subgoal):
 1. gcd \<alpha> \<beta> \<noteq> 1
[PROOF STEP]
by (auto intro: gcd_eq_1_imp_coprime)
[PROOF STATE]
proof (state)
this:
gcd \<alpha> \<beta> \<noteq> 1

goal (1 subgoal):
 1. \<not> coprime \<alpha> \<beta> \<Longrightarrow> coprime \<alpha> \<beta>
[PROOF STEP]
have "?g > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < gcd \<alpha> \<beta>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < gcd \<alpha> \<beta>
[PROOF STEP]
have "?g \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd \<alpha> \<beta> \<noteq> 0
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gcd \<alpha> \<beta> = 0 \<Longrightarrow> False
[PROOF STEP]
assume "?g=0"
[PROOF STATE]
proof (state)
this:
gcd \<alpha> \<beta> = 0

goal (1 subgoal):
 1. gcd \<alpha> \<beta> = 0 \<Longrightarrow> False
[PROOF STEP]
hence "nat \<bar>\<alpha>\<bar>=0"
[PROOF STATE]
proof (prove)
using this:
gcd \<alpha> \<beta> = 0

goal (1 subgoal):
 1. nat \<bar>\<alpha>\<bar> = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nat \<bar>\<alpha>\<bar> = 0

goal (1 subgoal):
 1. gcd \<alpha> \<beta> = 0 \<Longrightarrow> False
[PROOF STEP]
hence "\<alpha>=0"
[PROOF STATE]
proof (prove)
using this:
nat \<bar>\<alpha>\<bar> = 0

goal (1 subgoal):
 1. \<alpha> = 0
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<alpha> = 0

goal (1 subgoal):
 1. gcd \<alpha> \<beta> = 0 \<Longrightarrow> False
[PROOF STEP]
with albega0
[PROOF STATE]
proof (chain)
picking this:
\<alpha> * \<beta> * \<gamma> \<noteq> 0
\<alpha> = 0
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<alpha> * \<beta> * \<gamma> \<noteq> 0
\<alpha> = 0

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:
gcd \<alpha> \<beta> \<noteq> 0

goal (1 subgoal):
 1. 1 < gcd \<alpha> \<beta>
[PROOF STEP]
hence "?g>0"
[PROOF STATE]
proof (prove)
using this:
gcd \<alpha> \<beta> \<noteq> 0

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

goal (1 subgoal):
 1. 1 < gcd \<alpha> \<beta>
[PROOF STEP]
with gnot1
[PROOF STATE]
proof (chain)
picking this:
gcd \<alpha> \<beta> \<noteq> 1
0 < gcd \<alpha> \<beta>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gcd \<alpha> \<beta> \<noteq> 1
0 < gcd \<alpha> \<beta>

goal (1 subgoal):
 1. 1 < gcd \<alpha> \<beta>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
1 < gcd \<alpha> \<beta>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
1 < gcd \<alpha> \<beta>

goal (1 subgoal):
 1. \<not> coprime \<alpha> \<beta> \<Longrightarrow> coprime \<alpha> \<beta>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 < gcd \<alpha> \<beta>

goal (1 subgoal):
 1. \<not> coprime \<alpha> \<beta> \<Longrightarrow> coprime \<alpha> \<beta>
[PROOF STEP]
have "?g dvd gcd k l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd \<alpha> \<beta> dvd gcd k l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gcd \<alpha> \<beta> dvd gcd k l
[PROOF STEP]
have "?g dvd \<alpha> \<and> ?g dvd \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd \<alpha> \<beta> dvd \<alpha> \<and> gcd \<alpha> \<beta> dvd \<beta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gcd \<alpha> \<beta> dvd \<alpha> \<and> gcd \<alpha> \<beta> dvd \<beta>

goal (1 subgoal):
 1. gcd \<alpha> \<beta> dvd gcd k l
[PROOF STEP]
with albega
[PROOF STATE]
proof (chain)
picking this:
\<bar>k\<bar> = \<alpha>\<^sup>2 \<and> \<bar>l\<bar> = \<beta>\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = \<gamma>\<^sup>2
gcd \<alpha> \<beta> dvd \<alpha> \<and> gcd \<alpha> \<beta> dvd \<beta>
[PROOF STEP]
have "?g dvd \<bar>k\<bar> \<and> ?g dvd \<bar>l\<bar>"
[PROOF STATE]
proof (prove)
using this:
\<bar>k\<bar> = \<alpha>\<^sup>2 \<and> \<bar>l\<bar> = \<beta>\<^sup>2 \<and> \<bar>k\<^sup>2 + l\<^sup>2\<bar> = \<gamma>\<^sup>2
gcd \<alpha> \<beta> dvd \<alpha> \<and> gcd \<alpha> \<beta> dvd \<beta>

goal (1 subgoal):
 1. gcd \<alpha> \<beta> dvd \<bar>k\<bar> \<and> gcd \<alpha> \<beta> dvd \<bar>l\<bar>
[PROOF STEP]
by (simp add: power2_eq_square mult.commute)
[PROOF STATE]
proof (state)
this:
gcd \<alpha> \<beta> dvd \<bar>k\<bar> \<and> gcd \<alpha> \<beta> dvd \<bar>l\<bar>

goal (1 subgoal):
 1. gcd \<alpha> \<beta> dvd gcd k l
[PROOF STEP]
hence "?g dvd k \<and> ?g dvd l"
[PROOF STATE]
proof (prove)
using this:
gcd \<alpha> \<beta> dvd \<bar>k\<bar> \<and> gcd \<alpha> \<beta> dvd \<bar>l\<bar>

goal (1 subgoal):
 1. gcd \<alpha> \<beta> dvd k \<and> gcd \<alpha> \<beta> dvd l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gcd \<alpha> \<beta> dvd k \<and> gcd \<alpha> \<beta> dvd l

goal (1 subgoal):
 1. gcd \<alpha> \<beta> dvd gcd k l
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
gcd \<alpha> \<beta> dvd k \<and> gcd \<alpha> \<beta> dvd l

goal (1 subgoal):
 1. gcd \<alpha> \<beta> dvd gcd k l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gcd \<alpha> \<beta> dvd gcd k l

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
gcd \<alpha> \<beta> dvd gcd k l

goal (1 subgoal):
 1. \<not> coprime \<alpha> \<beta> \<Longrightarrow> coprime \<alpha> \<beta>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 < gcd \<alpha> \<beta>
gcd \<alpha> \<beta> dvd gcd k l
[PROOF STEP]
have "gcd k l \<noteq> 1"
[PROOF STATE]
proof (prove)
using this:
1 < gcd \<alpha> \<beta>
gcd \<alpha> \<beta> dvd gcd k l

goal (1 subgoal):
 1. gcd k l \<noteq> 1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
gcd k l \<noteq> 1

goal (1 subgoal):
 1. \<not> coprime \<alpha> \<beta> \<Longrightarrow> coprime \<alpha> \<beta>
[PROOF STEP]
with kl_rel
[PROOF STATE]
proof (chain)
picking this:
coprime k l
gcd k l \<noteq> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coprime k l
gcd k l \<noteq> 1

goal (1 subgoal):
 1. coprime \<alpha> \<beta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coprime \<alpha> \<beta>

goal:
No subgoals!
[PROOF STEP]
qed
  \<comment> \<open>choose $p$ and $q$ in the right way\<close>
[PROOF STATE]
proof (state)
this:
coprime \<alpha> \<beta>

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
have "\<exists> p q. p^4 + q^4 = \<gamma>^2 \<and> p*q*\<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
have "odd \<alpha> \<or> odd \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd \<alpha> \<or> odd \<beta>
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (odd \<alpha> \<or> odd \<beta>) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> (odd \<alpha> \<or> odd \<beta>)"
[PROOF STATE]
proof (state)
this:
\<not> (odd \<alpha> \<or> odd \<beta>)

goal (1 subgoal):
 1. \<not> (odd \<alpha> \<or> odd \<beta>) \<Longrightarrow> False
[PROOF STEP]
hence "even \<alpha> \<and> even \<beta>"
[PROOF STATE]
proof (prove)
using this:
\<not> (odd \<alpha> \<or> odd \<beta>)

goal (1 subgoal):
 1. even \<alpha> \<and> even \<beta>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
even \<alpha> \<and> even \<beta>

goal (1 subgoal):
 1. \<not> (odd \<alpha> \<or> odd \<beta>) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
even \<alpha> \<and> even \<beta>
[PROOF STEP]
have "2 dvd \<alpha> \<and> 2 dvd \<beta>"
[PROOF STATE]
proof (prove)
using this:
even \<alpha> \<and> even \<beta>

goal (1 subgoal):
 1. even \<alpha> \<and> even \<beta>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
even \<alpha> \<and> even \<beta>

goal (1 subgoal):
 1. \<not> (odd \<alpha> \<or> odd \<beta>) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
even \<alpha> \<and> even \<beta>
[PROOF STEP]
have "2 dvd gcd \<alpha> \<beta>"
[PROOF STATE]
proof (prove)
using this:
even \<alpha> \<and> even \<beta>

goal (1 subgoal):
 1. even (gcd \<alpha> \<beta>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
even (gcd \<alpha> \<beta>)

goal (1 subgoal):
 1. \<not> (odd \<alpha> \<or> odd \<beta>) \<Longrightarrow> False
[PROOF STEP]
with alphabeta_relprime
[PROOF STATE]
proof (chain)
picking this:
coprime \<alpha> \<beta>
even (gcd \<alpha> \<beta>)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
coprime \<alpha> \<beta>
even (gcd \<alpha> \<beta>)

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:
odd \<alpha> \<or> odd \<beta>

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
odd \<alpha> \<or> odd \<beta>

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
odd \<alpha> \<or> odd \<beta>

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
assume "odd \<alpha>"
[PROOF STATE]
proof (state)
this:
odd \<alpha>

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
with newabc albega0 alphabeta_relprime
[PROOF STATE]
proof (chain)
picking this:
\<alpha> ^ 4 + \<beta> ^ 4 = \<gamma>\<^sup>2
\<alpha> * \<beta> * \<gamma> \<noteq> 0
coprime \<alpha> \<beta>
odd \<alpha>
[PROOF STEP]
obtain p q where
        "p=\<alpha> \<and> q=\<beta> \<and> p^4 + q^4 = \<gamma>^2 \<and> p*q*\<gamma>  \<noteq> 0 \<and> odd p \<and> coprime p q"
[PROOF STATE]
proof (prove)
using this:
\<alpha> ^ 4 + \<beta> ^ 4 = \<gamma>\<^sup>2
\<alpha> * \<beta> * \<gamma> \<noteq> 0
coprime \<alpha> \<beta>
odd \<alpha>

goal (1 subgoal):
 1. (\<And>p q. p = \<alpha> \<and> q = \<beta> \<and> p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = \<alpha> \<and> q = \<beta> \<and> p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
hence ?thesis
[PROOF STATE]
proof (prove)
using this:
p = \<alpha> \<and> q = \<beta> \<and> p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
odd \<alpha> \<Longrightarrow> \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
odd \<alpha> \<Longrightarrow> \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
odd \<alpha> \<Longrightarrow> \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
assume "odd \<beta>"
[PROOF STATE]
proof (state)
this:
odd \<beta>

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
with newabc albega0 alphabeta_relprime
[PROOF STATE]
proof (chain)
picking this:
\<alpha> ^ 4 + \<beta> ^ 4 = \<gamma>\<^sup>2
\<alpha> * \<beta> * \<gamma> \<noteq> 0
coprime \<alpha> \<beta>
odd \<beta>
[PROOF STEP]
obtain p q where
        "q=\<alpha> \<and> p=\<beta> \<and> p^4 + q^4 = \<gamma>^2 \<and> p*q*\<gamma>  \<noteq> 0 \<and> odd p \<and> coprime p q"
[PROOF STATE]
proof (prove)
using this:
\<alpha> ^ 4 + \<beta> ^ 4 = \<gamma>\<^sup>2
\<alpha> * \<beta> * \<gamma> \<noteq> 0
coprime \<alpha> \<beta>
odd \<beta>

goal (1 subgoal):
 1. (\<And>q p. q = \<alpha> \<and> p = \<beta> \<and> p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
q = \<alpha> \<and> p = \<beta> \<and> p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
hence ?thesis
[PROOF STATE]
proof (prove)
using this:
q = \<alpha> \<and> p = \<beta> \<and> p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
odd \<beta> \<Longrightarrow> \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
odd \<alpha> \<or> odd \<beta>
odd \<alpha> \<Longrightarrow> \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
odd \<beta> \<Longrightarrow> \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
odd \<alpha> \<or> odd \<beta>
odd \<alpha> \<Longrightarrow> \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
odd \<beta> \<Longrightarrow> \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal:
No subgoals!
[PROOF STEP]
qed
  \<comment> \<open>show the solution is smaller\<close>
[PROOF STATE]
proof (state)
this:
\<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
have "\<gamma>^2 < c^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
from gamma2 klavu
[PROOF STATE]
proof (chain)
picking this:
k\<^sup>2 + l\<^sup>2 = \<gamma>\<^sup>2
a = k\<^sup>2 - l\<^sup>2 \<and> v = 2 * k * l \<and> \<bar>u\<bar> = k\<^sup>2 + l\<^sup>2
[PROOF STEP]
have "\<gamma>^2 \<le> \<bar>u\<bar>"
[PROOF STATE]
proof (prove)
using this:
k\<^sup>2 + l\<^sup>2 = \<gamma>\<^sup>2
a = k\<^sup>2 - l\<^sup>2 \<and> v = 2 * k * l \<and> \<bar>u\<bar> = k\<^sup>2 + l\<^sup>2

goal (1 subgoal):
 1. \<gamma>\<^sup>2 \<le> \<bar>u\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<gamma>\<^sup>2 \<le> \<bar>u\<bar>

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<gamma>\<^sup>2 \<le> \<bar>u\<bar>

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
have h1: "\<dots> \<le> \<bar>u\<bar>^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>u\<bar> \<le> \<bar>u\<bar>\<^sup>2
[PROOF STEP]
using self_le_power[of "\<bar>u\<bar>" 2] uv0
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<le> \<bar>u\<bar>; 0 < 2\<rbrakk> \<Longrightarrow> \<bar>u\<bar> \<le> \<bar>u\<bar>\<^sup>2
u \<noteq> 0 \<and> v \<noteq> 0

goal (1 subgoal):
 1. \<bar>u\<bar> \<le> \<bar>u\<bar>\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>u\<bar> \<le> \<bar>u\<bar>\<^sup>2

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>u\<bar> \<le> \<bar>u\<bar>\<^sup>2

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
have h2: "\<dots> \<le> u^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>u\<bar>\<^sup>2 \<le> u\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>u\<bar>\<^sup>2 \<le> u\<^sup>2

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>u\<bar>\<^sup>2 \<le> u\<^sup>2

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
have h3: "\<dots> < u^2 + v^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u\<^sup>2 < u\<^sup>2 + v\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u\<^sup>2 < u\<^sup>2 + v\<^sup>2
[PROOF STEP]
from uv0
[PROOF STATE]
proof (chain)
picking this:
u \<noteq> 0 \<and> v \<noteq> 0
[PROOF STEP]
have v2non0: "0 \<noteq> v^2"
[PROOF STATE]
proof (prove)
using this:
u \<noteq> 0 \<and> v \<noteq> 0

goal (1 subgoal):
 1. 0 \<noteq> v\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<noteq> v\<^sup>2

goal (1 subgoal):
 1. u\<^sup>2 < u\<^sup>2 + v\<^sup>2
[PROOF STEP]
have "0 \<le> v^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> v\<^sup>2
[PROOF STEP]
by (rule zero_le_power2)
[PROOF STATE]
proof (state)
this:
0 \<le> v\<^sup>2

goal (1 subgoal):
 1. u\<^sup>2 < u\<^sup>2 + v\<^sup>2
[PROOF STEP]
with v2non0
[PROOF STATE]
proof (chain)
picking this:
0 \<noteq> v\<^sup>2
0 \<le> v\<^sup>2
[PROOF STEP]
have "0 < v^2"
[PROOF STATE]
proof (prove)
using this:
0 \<noteq> v\<^sup>2
0 \<le> v\<^sup>2

goal (1 subgoal):
 1. 0 < v\<^sup>2
[PROOF STEP]
by (auto simp add: less_le)
[PROOF STATE]
proof (state)
this:
0 < v\<^sup>2

goal (1 subgoal):
 1. u\<^sup>2 < u\<^sup>2 + v\<^sup>2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < v\<^sup>2

goal (1 subgoal):
 1. u\<^sup>2 < u\<^sup>2 + v\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u\<^sup>2 < u\<^sup>2 + v\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
u\<^sup>2 < u\<^sup>2 + v\<^sup>2

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
u\<^sup>2 < u\<^sup>2 + v\<^sup>2

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
with uvabc
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v
u\<^sup>2 < u\<^sup>2 + v\<^sup>2
[PROOF STEP]
have "\<dots> \<le> \<bar>c\<bar>"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v
u\<^sup>2 < u\<^sup>2 + v\<^sup>2

goal (1 subgoal):
 1. u\<^sup>2 + v\<^sup>2 \<le> \<bar>c\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u\<^sup>2 + v\<^sup>2 \<le> \<bar>c\<bar>

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
u\<^sup>2 + v\<^sup>2 \<le> \<bar>c\<bar>

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
have "\<dots> \<le> \<bar>c\<bar>^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>c\<bar> \<le> \<bar>c\<bar>\<^sup>2
[PROOF STEP]
using self_le_power[of "\<bar>c\<bar>" 2] h1 h2 h3 uvabc
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<le> \<bar>c\<bar>; 0 < 2\<rbrakk> \<Longrightarrow> \<bar>c\<bar> \<le> \<bar>c\<bar>\<^sup>2
\<bar>u\<bar> \<le> \<bar>u\<bar>\<^sup>2
\<bar>u\<bar>\<^sup>2 \<le> u\<^sup>2
u\<^sup>2 < u\<^sup>2 + v\<^sup>2
a\<^sup>2 = u\<^sup>2 - v\<^sup>2 \<and> b\<^sup>2 = 2 * u * v \<and> \<bar>c\<bar> = u\<^sup>2 + v\<^sup>2 \<and> coprime u v

goal (1 subgoal):
 1. \<bar>c\<bar> \<le> \<bar>c\<bar>\<^sup>2
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<bar>c\<bar> \<le> \<bar>c\<bar>\<^sup>2

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>c\<bar> \<le> \<bar>c\<bar>\<^sup>2

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
have "\<dots> \<le> c^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>c\<bar>\<^sup>2 \<le> c\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>c\<bar>\<^sup>2 \<le> c\<^sup>2

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<gamma>\<^sup>2 < c\<^sup>2

goal (1 subgoal):
 1. \<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<gamma>\<^sup>2 < c\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<gamma>\<^sup>2 < c\<^sup>2

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
\<gamma>\<^sup>2 < c\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>p q. p ^ 4 + q ^ 4 = \<gamma>\<^sup>2 \<and> p * q * \<gamma> \<noteq> 0 \<and> odd p \<and> coprime p q
\<gamma>\<^sup>2 < c\<^sup>2

goal (1 subgoal):
 1. \<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>p q r. p ^ 4 + q ^ 4 = r\<^sup>2 \<and> p * q * r \<noteq> 0 \<and> odd p \<and> coprime p q \<and> r\<^sup>2 < c\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cSup_unique: "(S::'a :: {conditionally_complete_linorder, no_bot} set) *<= b \<Longrightarrow> (\<forall>b'<b. \<exists>x\<in>S. b' < x) \<Longrightarrow> Sup S = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S *<= b; \<forall>b'<b. \<exists>x\<in>S. b' < x\<rbrakk> \<Longrightarrow> Sup S = b
[PROOF STEP]
by (rule cSup_eq) (auto simp: not_le[symmetric] setle_def)


[STATEMENT]
lemma Sup_img_rule_complete:
  "(\<forall>x. x\<in>S \<longrightarrow> f x \<le> SPEC \<Phi>) \<longleftrightarrow> Sup (f`S) \<le> SPEC \<Phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. x \<in> S \<longrightarrow> f x \<le> SPEC \<Phi>) = (Sup (f ` S) \<le> SPEC \<Phi>)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x. x \<in> S \<longrightarrow> f x \<le> SPEC \<Phi> \<Longrightarrow> Sup (f ` S) \<le> SPEC \<Phi>
 2. Sup (f ` S) \<le> SPEC \<Phi> \<Longrightarrow> \<forall>x. x \<in> S \<longrightarrow> f x \<le> SPEC \<Phi>
[PROOF STEP]
apply (rule pw_leI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x. x \<in> S \<longrightarrow> f x \<le> SPEC \<Phi> \<Longrightarrow> nofail (SPEC \<Phi>) \<longrightarrow> nofail (Sup (f ` S)) \<and> (\<forall>x. inres (Sup (f ` S)) x \<longrightarrow> inres (SPEC \<Phi>) x)
 2. Sup (f ` S) \<le> SPEC \<Phi> \<Longrightarrow> \<forall>x. x \<in> S \<longrightarrow> f x \<le> SPEC \<Phi>
[PROOF STEP]
apply (auto simp: pw_le_iff refine_pw_simps) []
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (f ` S) \<le> SPEC \<Phi> \<Longrightarrow> \<forall>x. x \<in> S \<longrightarrow> f x \<le> SPEC \<Phi>
[PROOF STEP]
apply (intro allI impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Sup (f ` S) \<le> SPEC \<Phi>; x \<in> S\<rbrakk> \<Longrightarrow> f x \<le> SPEC \<Phi>
[PROOF STEP]
apply (rule pw_leI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Sup (f ` S) \<le> SPEC \<Phi>; x \<in> S\<rbrakk> \<Longrightarrow> nofail (SPEC \<Phi>) \<longrightarrow> nofail (f x) \<and> (\<forall>xa. inres (f x) xa \<longrightarrow> inres (SPEC \<Phi>) xa)
[PROOF STEP]
apply (auto simp: pw_le_iff refine_pw_simps) []
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem rtl_diff_closed:
  fixes L1 :: "'L tree set"
  assumes A[simp]: "L1 \<in> regular_languages A" "L2\<in>regular_languages A"
  shows "L1-L2 \<in> regular_languages A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L1 - L2 \<in> regular_languages A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. L1 - L2 \<in> regular_languages A
[PROOF STEP]
from rtlE[OF A(1)]
[PROOF STATE]
proof (chain)
picking this:
(\<And>TA. \<lbrakk>L1 = ta_lang TA; ranked_tree_automaton TA A\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain TA1::"(nat,'L) tree_automaton_rec" where
    L1: "L1=ta_lang TA1" and
    RT1: "ranked_tree_automaton TA1 A"
[PROOF STATE]
proof (prove)
using this:
(\<And>TA. \<lbrakk>L1 = ta_lang TA; ranked_tree_automaton TA A\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>TA1. \<lbrakk>L1 = ta_lang TA1; ranked_tree_automaton TA1 A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
L1 = ta_lang TA1
ranked_tree_automaton TA1 A

goal (1 subgoal):
 1. L1 - L2 \<in> regular_languages A
[PROOF STEP]
from rtlE[OF A(2)]
[PROOF STATE]
proof (chain)
picking this:
(\<And>TA. \<lbrakk>L2 = ta_lang TA; ranked_tree_automaton TA A\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain TA2::"(nat,'L) tree_automaton_rec" where
    L2: "L2=ta_lang TA2" and
    RT2: "ranked_tree_automaton TA2 A"
[PROOF STATE]
proof (prove)
using this:
(\<And>TA. \<lbrakk>L2 = ta_lang TA; ranked_tree_automaton TA A\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>TA2. \<lbrakk>L2 = ta_lang TA2; ranked_tree_automaton TA2 A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
L2 = ta_lang TA2
ranked_tree_automaton TA2 A

goal (1 subgoal):
 1. L1 - L2 \<in> regular_languages A
[PROOF STEP]
interpret ta1: ranked_tree_automaton TA1 A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ranked_tree_automaton TA1 A
[PROOF STEP]
using RT1
[PROOF STATE]
proof (prove)
using this:
ranked_tree_automaton TA1 A

goal (1 subgoal):
 1. ranked_tree_automaton TA1 A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. L1 - L2 \<in> regular_languages A
[PROOF STEP]
interpret ta2: ranked_tree_automaton TA2 A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ranked_tree_automaton TA2 A
[PROOF STEP]
using RT2
[PROOF STATE]
proof (prove)
using this:
ranked_tree_automaton TA2 A

goal (1 subgoal):
 1. ranked_tree_automaton TA2 A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. L1 - L2 \<in> regular_languages A
[PROOF STEP]
from ta1.lang_is_ranked
[PROOF STATE]
proof (chain)
picking this:
ta_lang TA1 \<subseteq> ranked_trees A
[PROOF STEP]
have ALT: "L1-L2 = L1 \<inter> (ranked_trees A - L2)"
[PROOF STATE]
proof (prove)
using this:
ta_lang TA1 \<subseteq> ranked_trees A

goal (1 subgoal):
 1. L1 - L2 = L1 \<inter> (ranked_trees A - L2)
[PROOF STEP]
by (auto simp add: L1 L2)
[PROOF STATE]
proof (state)
this:
L1 - L2 = L1 \<inter> (ranked_trees A - L2)

goal (1 subgoal):
 1. L1 - L2 \<in> regular_languages A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L1 - L2 \<in> regular_languages A
[PROOF STEP]
unfolding ALT
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L1 \<inter> (ranked_trees A - L2) \<in> regular_languages A
[PROOF STEP]
by (simp add: rtl_complement_closed rtl_inter_closed)
[PROOF STATE]
proof (state)
this:
L1 - L2 \<in> regular_languages A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nn_integral_indicator_singleton1' [simp]:
  assumes "{y} \<in> sets M"
  shows "(\<integral>\<^sup>+x. indicator {x} y * f x \<partial>M) = emeasure M {y} * f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. indicator {x} y * f x \<partial>M = emeasure M {y} * f y
[PROOF STEP]
by(subst nn_integral_indicator_singleton1[symmetric, OF assms])(rule nn_integral_cong; simp split: split_indicator)


[STATEMENT]
lemma lmeasurable_iff_indicator_has_integral:
  fixes S :: "'a::euclidean_space set"
  shows "S \<in> lmeasurable \<and> m = measure lebesgue S \<longleftrightarrow> (indicat_real S has_integral m) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<in> lmeasurable \<and> m = Sigma_Algebra.measure lebesgue S) = (indicat_real S has_integral m) UNIV
[PROOF STEP]
by (metis has_integral_iff lmeasurable_iff_has_integral measurable_integrable)


[STATEMENT]
lemma powers_subdistl: "(\<Squnion>i. x \<cdot> y ^ i) \<le> x \<cdot> qstar y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>i. x \<cdot> y ^ i) \<le> x \<cdot> qstar y
[PROOF STEP]
by (simp add: SUP_le_iff SUP_upper mult_isol qstar_def)


[STATEMENT]
lemma ex_subset_image_inj:
   "(\<exists>T. T \<subseteq> f ` S \<and> P T) \<longleftrightarrow> (\<exists>T. T \<subseteq> S \<and> inj_on f T \<and> P (f ` T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>T\<subseteq>f ` S. P T) = (\<exists>T\<subseteq>S. inj_on f T \<and> P (f ` T))
[PROOF STEP]
by (auto simp: subset_image_inj)


[STATEMENT]
lemma fixpoints_on_card_eq :
  shows "card(fixpoints_on A \<phi>) = card {x \<in> preimg_img_on A \<phi>. card x = 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (fixpoints_on A \<phi>) = card {x \<in> preimg_img_on A \<phi>. card x = 1}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (fixpoints_on A \<phi>) = card {x \<in> preimg_img_on A \<phi>. card x = 1}
[PROOF STEP]
have "bij_betw (\<lambda>x. {x}) (fixpoints_on A \<phi>)
                           {x. x \<in> preimg_img_on A \<phi> \<and> card x = 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (\<lambda>x. {x}) (fixpoints_on A \<phi>) {x \<in> preimg_img_on A \<phi>. card x = 1}
[PROOF STEP]
by(fastforce simp: bij_betw_def fixpoints_on_def preimg_img_on_def card1)
[PROOF STATE]
proof (state)
this:
bij_betw (\<lambda>x. {x}) (fixpoints_on A \<phi>) {x \<in> preimg_img_on A \<phi>. card x = 1}

goal (1 subgoal):
 1. card (fixpoints_on A \<phi>) = card {x \<in> preimg_img_on A \<phi>. card x = 1}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>x. {x}) (fixpoints_on A \<phi>) {x \<in> preimg_img_on A \<phi>. card x = 1}

goal (1 subgoal):
 1. card (fixpoints_on A \<phi>) = card {x \<in> preimg_img_on A \<phi>. card x = 1}
[PROOF STEP]
by(rule bij_betw_same_card)
[PROOF STATE]
proof (state)
this:
card (fixpoints_on A \<phi>) = card {x \<in> preimg_img_on A \<phi>. card x = 1}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_flat: "set (flat xss) = \<Union> (set ` set xss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (flat xss) = \<Union> (set ` set xss)
[PROOF STEP]
unfolding flat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (fold List.union xss []) = \<Union> (set ` set xss)
[PROOF STEP]
by (auto simp: set_fold_union)


[STATEMENT]
lemma Nset_pre_mem:"\<lbrakk>f:{i. i\<le>(Suc n)} \<rightarrow>{i. i\<le>(Suc n)};
      inj_on f {i. i\<le>(Suc n)}; f (Suc n) = Suc n; k \<le> n\<rbrakk> \<Longrightarrow> f k \<in> {i. i\<le>n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {i. i \<le> Suc n} \<rightarrow> {i. i \<le> Suc n}; inj_on f {i. i \<le> Suc n}; f (Suc n) = Suc n; k \<le> n\<rbrakk> \<Longrightarrow> f k \<in> {i. i \<le> n}
[PROOF STEP]
apply (frule Nset_injTr0[of f n], assumption+, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {i. i \<le> Suc n} \<rightarrow> {i. i \<le> Suc n}; inj_on f {i. i \<le> Suc n}; f (Suc n) = Suc n; k \<le> n; f \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; inj_on f {i. i \<le> n}\<rbrakk> \<Longrightarrow> f k \<in> {i. i \<le> n}
[PROOF STEP]
apply (frule_tac x = k in funcset_mem[of f "{i. i \<le> n}" "{i. i \<le> n}"],
       simp, assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma positive_dim_eq:
  assumes "positive A"
  shows "dim_row A = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row A = dim_col A
[PROOF STEP]
using carrier_matD(1)[of A "dim_col A" "dim_col A"]  assms[unfolded positive_def]
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat (dim_col A) (dim_col A) \<Longrightarrow> dim_row A = dim_col A
A \<in> carrier_mat (dim_col A) (dim_col A) \<and> (\<forall>v. dim_vec v = dim_col A \<longrightarrow> 0 \<le> inner_prod v (A *\<^sub>v v))

goal (1 subgoal):
 1. dim_row A = dim_col A
[PROOF STEP]
by simp


[STATEMENT]
lemma le_ennreal_iff: "0 \<le> r \<Longrightarrow> x \<le> ennreal r \<longleftrightarrow> (\<exists>q\<ge>0. x = ennreal q \<and> q \<le> r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> r \<Longrightarrow> (x \<le> ennreal r) = (\<exists>q\<ge>0. x = ennreal q \<and> q \<le> r)
[PROOF STEP]
by (cases x) (auto simp: top_unique)


[STATEMENT]
lemma (in Ring) mzeromap_mHom:"\<lbrakk>R module M; R module N\<rbrakk> \<Longrightarrow>
                                     mzeromap M N \<in> mHom R M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module M; R module N\<rbrakk> \<Longrightarrow> mzeromap M N \<in> mHom R M N
[PROOF STEP]
apply (simp add:mHom_def aHom_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module M; R module N\<rbrakk> \<Longrightarrow> mzeromap M N \<in> carrier M \<rightarrow> carrier N \<and> mzeromap M N \<in> extensional (carrier M) \<and> (\<forall>a\<in>carrier M. \<forall>b\<in>carrier M. mzeromap M N (a \<plusminus>\<^bsub>M\<^esub> b) = mzeromap M N a \<plusminus>\<^bsub>N\<^esub> mzeromap M N b) \<and> (\<forall>a\<in>carrier R. \<forall>m\<in>carrier M. mzeromap M N (a \<cdot>\<^sub>s\<^bsub>M\<^esub> m) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> mzeromap M N m)
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>R module M; R module N\<rbrakk> \<Longrightarrow> mzeromap M N \<in> carrier M \<rightarrow> carrier N
 2. \<lbrakk>R module M; R module N\<rbrakk> \<Longrightarrow> mzeromap M N \<in> extensional (carrier M) \<and> (\<forall>a\<in>carrier M. \<forall>b\<in>carrier M. mzeromap M N (a \<plusminus>\<^bsub>M\<^esub> b) = mzeromap M N a \<plusminus>\<^bsub>N\<^esub> mzeromap M N b) \<and> (\<forall>a\<in>carrier R. \<forall>m\<in>carrier M. mzeromap M N (a \<cdot>\<^sub>s\<^bsub>M\<^esub> m) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> mzeromap M N m)
[PROOF STEP]
apply (simp add:mzeromap_def, simp add:Module_def aGroup_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module M; R module N\<rbrakk> \<Longrightarrow> mzeromap M N \<in> extensional (carrier M) \<and> (\<forall>a\<in>carrier M. \<forall>b\<in>carrier M. mzeromap M N (a \<plusminus>\<^bsub>M\<^esub> b) = mzeromap M N a \<plusminus>\<^bsub>N\<^esub> mzeromap M N b) \<and> (\<forall>a\<in>carrier R. \<forall>m\<in>carrier M. mzeromap M N (a \<cdot>\<^sub>s\<^bsub>M\<^esub> m) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> mzeromap M N m)
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>R module M; R module N\<rbrakk> \<Longrightarrow> mzeromap M N \<in> extensional (carrier M)
 2. \<lbrakk>R module M; R module N\<rbrakk> \<Longrightarrow> (\<forall>a\<in>carrier M. \<forall>b\<in>carrier M. mzeromap M N (a \<plusminus>\<^bsub>M\<^esub> b) = mzeromap M N a \<plusminus>\<^bsub>N\<^esub> mzeromap M N b) \<and> (\<forall>a\<in>carrier R. \<forall>m\<in>carrier M. mzeromap M N (a \<cdot>\<^sub>s\<^bsub>M\<^esub> m) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> mzeromap M N m)
[PROOF STEP]
apply (simp add:mzeromap_def extensional_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module M; R module N\<rbrakk> \<Longrightarrow> (\<forall>a\<in>carrier M. \<forall>b\<in>carrier M. mzeromap M N (a \<plusminus>\<^bsub>M\<^esub> b) = mzeromap M N a \<plusminus>\<^bsub>N\<^esub> mzeromap M N b) \<and> (\<forall>a\<in>carrier R. \<forall>m\<in>carrier M. mzeromap M N (a \<cdot>\<^sub>s\<^bsub>M\<^esub> m) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> mzeromap M N m)
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>R module M; R module N\<rbrakk> \<Longrightarrow> \<forall>a\<in>carrier M. \<forall>b\<in>carrier M. mzeromap M N (a \<plusminus>\<^bsub>M\<^esub> b) = mzeromap M N a \<plusminus>\<^bsub>N\<^esub> mzeromap M N b
 2. \<lbrakk>R module M; R module N\<rbrakk> \<Longrightarrow> \<forall>a\<in>carrier R. \<forall>m\<in>carrier M. mzeromap M N (a \<cdot>\<^sub>s\<^bsub>M\<^esub> m) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> mzeromap M N m
[PROOF STEP]
apply ((rule ballI)+,
        frule_tac R = R and M = M in Module.module_is_ag,
        frule_tac x = a and y = b in aGroup.ag_pOp_closed [of "M"],
        assumption+,
        simp add:mzeromap_def,
        frule_tac R = R and M = N in Module.module_is_ag,
        rule aGroup.ag_l_zero[THEN sym, of "N"], assumption+,
        simp add:aGroup.ag_inc_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module M; R module N\<rbrakk> \<Longrightarrow> \<forall>a\<in>carrier R. \<forall>m\<in>carrier M. mzeromap M N (a \<cdot>\<^sub>s\<^bsub>M\<^esub> m) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> mzeromap M N m
[PROOF STEP]
apply (rule ballI)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a m. \<lbrakk>R module M; R module N; a \<in> carrier R; m \<in> carrier M\<rbrakk> \<Longrightarrow> mzeromap M N (a \<cdot>\<^sub>s\<^bsub>M\<^esub> m) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> mzeromap M N m
[PROOF STEP]
apply (frule_tac a = a and m = m in Module.sc_mem [of M R], assumption+,
        simp add:mzeromap_def,
        rule Module.sc_a_0 [THEN sym], assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma not_disjoint_union:
      fixes s :: "('a::len) word"
      shows "\<not> disjoint {s..e} {s'..e'} \<Longrightarrow> {s..e} \<union> {s'..e'} = {min s s' .. max e e'}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> disjoint {s..e} {s'..e'} \<Longrightarrow> {s..e} \<union> {s'..e'} = {min s s'..max e e'}
[PROOF STEP]
by(auto simp add: disjoint_def min_def max_def)


[STATEMENT]
lemma implements_trans:
  "\<lbrakk> implements pi1 S1 S2; implements pi2 S2 S3 \<rbrakk>
  \<Longrightarrow> implements (pi1 o pi2) S1 S3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>implements pi1 S1 S2; implements pi2 S2 S3\<rbrakk> \<Longrightarrow> implements (pi1 \<circ> pi2) S1 S3
[PROOF STEP]
by (fastforce simp add: implements_def image_subset_iff)


[STATEMENT]
lemma cross7_mult_left: "(c *\<^sub>R x) \<times>\<^sub>7 y = c *\<^sub>R (x \<times>\<^sub>7 y)"
  and  cross7_mult_right: "x \<times>\<^sub>7 (c *\<^sub>R y) = c *\<^sub>R (x \<times>\<^sub>7 y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c *\<^sub>R x) \<times>\<^sub>7 y = c *\<^sub>R x \<times>\<^sub>7 y &&& x \<times>\<^sub>7 (c *\<^sub>R y) = c *\<^sub>R x \<times>\<^sub>7 y
[PROOF STEP]
by (simp_all add: cross7_simps)


[STATEMENT]
lemma le_filter_frequently: "F \<le> G \<longleftrightarrow> (\<forall>P. frequently P F \<longrightarrow> frequently P G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<le> G) = (\<forall>P. frequently P F \<longrightarrow> frequently P G)
[PROOF STEP]
unfolding frequently_def le_filter_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>P. eventually P G \<longrightarrow> eventually P F) = (\<forall>P. \<not> (\<forall>\<^sub>F x in F. \<not> P x) \<longrightarrow> \<not> (\<forall>\<^sub>F x in G. \<not> P x))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P. \<lbrakk>\<forall>P. \<not> (\<forall>\<^sub>F x in F. \<not> P x) \<longrightarrow> \<not> (\<forall>\<^sub>F x in G. \<not> P x); eventually P G\<rbrakk> \<Longrightarrow> eventually P F
[PROOF STEP]
apply (erule_tac x="\<lambda>x. \<not> P x" in allE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P. \<lbrakk>eventually P G; \<not> (\<forall>\<^sub>F x in F. \<not> \<not> P x) \<longrightarrow> \<not> (\<forall>\<^sub>F x in G. \<not> \<not> P x)\<rbrakk> \<Longrightarrow> eventually P F
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma  expl_cond_expect_const:
  assumes "Y w = Y y"
  shows "expl_cond_expect M Y X w = expl_cond_expect M Y X y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expl_cond_expect M Y X w = expl_cond_expect M Y X y
[PROOF STEP]
unfolding expl_cond_expect_def img_dce_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>y. if Sigma_Algebra.measure M (Y -` {y} \<inter> space M) = 0 then 0 else (LINT w|M. X w * indicat_real (Y -` {y} \<inter> space M) w) / Sigma_Algebra.measure M (Y -` {y} \<inter> space M)) \<circ> Y) w = ((\<lambda>y. if Sigma_Algebra.measure M (Y -` {y} \<inter> space M) = 0 then 0 else (LINT w|M. X w * indicat_real (Y -` {y} \<inter> space M) w) / Sigma_Algebra.measure M (Y -` {y} \<inter> space M)) \<circ> Y) y
[PROOF STEP]
by (simp add: assms)


[STATEMENT]
lemma eint_add_left_cancel_less: "a + b < a + c \<longleftrightarrow> a \<noteq> (\<infinity>::eint) \<and> b < c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + b < a + c) = (a \<noteq> \<infinity> \<and> b < c)
[PROOF STEP]
unfolding plus_eint_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((case a of eint m \<Rightarrow> case b of eint n \<Rightarrow> eint (m + n) | \<infinity> \<Rightarrow> \<infinity> | \<infinity> \<Rightarrow> \<infinity>) < (case a of eint m \<Rightarrow> case c of eint n \<Rightarrow> eint (m + n) | \<infinity> \<Rightarrow> \<infinity> | \<infinity> \<Rightarrow> \<infinity>)) = (a \<noteq> \<infinity> \<and> b < c)
[PROOF STEP]
by (simp split: eint.split)