[STATEMENT]
theorem multiplicity_2_diff_pow_4div:
  fixes x y :: int
  assumes "odd x"  "odd y" and "4 dvd x - y" and "n > 0"  "x \<noteq> y"
  shows "multiplicity 2 (x^n - y^n) = multiplicity 2 (x - y) + multiplicity 2 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
have "prime (2::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prime 2

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prime 2
[PROOF STEP]
obtain k where n: "n = 2^multiplicity 2 n * k" and "\<not> 2 dvd k"
[PROOF STATE]
proof (prove)
using this:
prime 2

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>n = 2 ^ multiplicity 2 n * k; odd k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
prime 2
0 < n

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>n = 2 ^ multiplicity 2 n * k; odd k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis neq0_conv not_prime_unit multiplicity_decompose')
[PROOF STATE]
proof (state)
this:
n = 2 ^ multiplicity 2 n * k
odd k

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
have pow2: "multiplicity 2 (x^(2^k) - y^(2^k)) = multiplicity 2 (x - y) + k" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k
[PROOF STEP]
proof (induction k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k

goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
have "x^(2^Suc k) - y^(2^Suc k) = (x^2^k)^2 - (y^2^k)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ 2 ^ Suc k - y ^ 2 ^ Suc k = (x ^ 2 ^ k)\<^sup>2 - (y ^ 2 ^ k)\<^sup>2
[PROOF STEP]
by (simp flip: power_mult algebra_simps)
[PROOF STATE]
proof (state)
this:
x ^ 2 ^ Suc k - y ^ 2 ^ Suc k = (x ^ 2 ^ k)\<^sup>2 - (y ^ 2 ^ k)\<^sup>2

goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x ^ 2 ^ Suc k - y ^ 2 ^ Suc k = (x ^ 2 ^ k)\<^sup>2 - (y ^ 2 ^ k)\<^sup>2

goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
have "... = (x^2^k - y^2^k)*(x^2^k + y^2^k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x ^ 2 ^ k)\<^sup>2 - (y ^ 2 ^ k)\<^sup>2 = (x ^ 2 ^ k - y ^ 2 ^ k) * (x ^ 2 ^ k + y ^ 2 ^ k)
[PROOF STEP]
by (simp add: power2_eq_square algebra_simps)
[PROOF STATE]
proof (state)
this:
(x ^ 2 ^ k)\<^sup>2 - (y ^ 2 ^ k)\<^sup>2 = (x ^ 2 ^ k - y ^ 2 ^ k) * (x ^ 2 ^ k + y ^ 2 ^ k)

goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x ^ 2 ^ Suc k - y ^ 2 ^ Suc k = (x ^ 2 ^ k - y ^ 2 ^ k) * (x ^ 2 ^ k + y ^ 2 ^ k)
[PROOF STEP]
have factor: "x^(2^Suc k) - y^(2^Suc k) = (x^2^k - y^2^k)*(x^2^k + y^2^k)"
[PROOF STATE]
proof (prove)
using this:
x ^ 2 ^ Suc k - y ^ 2 ^ Suc k = (x ^ 2 ^ k - y ^ 2 ^ k) * (x ^ 2 ^ k + y ^ 2 ^ k)

goal (1 subgoal):
 1. x ^ 2 ^ Suc k - y ^ 2 ^ Suc k = (x ^ 2 ^ k - y ^ 2 ^ k) * (x ^ 2 ^ k + y ^ 2 ^ k)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x ^ 2 ^ Suc k - y ^ 2 ^ Suc k = (x ^ 2 ^ k - y ^ 2 ^ k) * (x ^ 2 ^ k + y ^ 2 ^ k)

goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x ^ 2 ^ Suc k - y ^ 2 ^ Suc k = (x ^ 2 ^ k - y ^ 2 ^ k) * (x ^ 2 ^ k + y ^ 2 ^ k)

goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
have m_plus: "multiplicity 2 (x^2^k + y^2^k) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 (x ^ 2 ^ k + y ^ 2 ^ k) = 1
[PROOF STEP]
proof (rule multiplicity_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 2 ^ 1 dvd x ^ 2 ^ k + y ^ 2 ^ k
 2. \<not> 2 ^ Suc 1 dvd x ^ 2 ^ k + y ^ 2 ^ k
[PROOF STEP]
show "2^1 dvd x^2^k + y^2^k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ 1 dvd x ^ 2 ^ k + y ^ 2 ^ k
[PROOF STEP]
using \<open>odd x\<close> and \<open>odd y\<close>
[PROOF STATE]
proof (prove)
using this:
odd x
odd y

goal (1 subgoal):
 1. 2 ^ 1 dvd x ^ 2 ^ k + y ^ 2 ^ k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ 1 dvd x ^ 2 ^ k + y ^ 2 ^ k

goal (1 subgoal):
 1. \<not> 2 ^ Suc 1 dvd x ^ 2 ^ k + y ^ 2 ^ k
[PROOF STEP]
have "[x^2^k + y^2^k = 2] (mod 4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
proof (cases k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = 0 \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
 2. \<And>nat. k = Suc nat \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
k = 0

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
 2. \<And>nat. k = Suc nat \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
from \<open>odd y\<close>
[PROOF STATE]
proof (chain)
picking this:
odd y
[PROOF STEP]
have "[y = 1] (mod 2)"
[PROOF STATE]
proof (prove)
using this:
odd y

goal (1 subgoal):
 1. [y = 1] (mod 2)
[PROOF STEP]
using cong_def
[PROOF STATE]
proof (prove)
using this:
odd y
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. [y = 1] (mod 2)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
[y = 1] (mod 2)

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
 2. \<And>nat. k = Suc nat \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
hence "[2*y = 2] (mod 4)"
[PROOF STATE]
proof (prove)
using this:
[y = 1] (mod 2)

goal (1 subgoal):
 1. [2 * y = 2] (mod 4)
[PROOF STEP]
using cong_scale[where k=2 and b=1 and c=2, simplified]
[PROOF STATE]
proof (prove)
using this:
[y = 1] (mod 2)
(2::?'a1) \<noteq> (0::?'a1) \<Longrightarrow> [?a = 1::?'a1] (mod 2::?'a1) = [(2::?'a1) * ?a = 2::?'a1] (mod 4::?'a1)

goal (1 subgoal):
 1. [2 * y = 2] (mod 4)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
[2 * y = 2] (mod 4)

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
 2. \<And>nat. k = Suc nat \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[2 * y = 2] (mod 4)

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
 2. \<And>nat. k = Suc nat \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
from \<open>4 dvd x - y\<close>
[PROOF STATE]
proof (chain)
picking this:
4 dvd x - y
[PROOF STEP]
have "[x - y = 0] (mod 4)"
[PROOF STATE]
proof (prove)
using this:
4 dvd x - y

goal (1 subgoal):
 1. [x - y = 0] (mod 4)
[PROOF STEP]
by (simp add: cong_0_iff)
[PROOF STATE]
proof (state)
this:
[x - y = 0] (mod 4)

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
 2. \<And>nat. k = Suc nat \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
[2 * y = 2] (mod 4)
[x - y = 0] (mod 4)
[PROOF STEP]
have "[x + y = 2] (mod 4)"
[PROOF STATE]
proof (prove)
using this:
[2 * y = 2] (mod 4)
[x - y = 0] (mod 4)

goal (1 subgoal):
 1. [x + y = 2] (mod 4)
[PROOF STEP]
by (smt cong_add)
[PROOF STATE]
proof (state)
this:
[x + y = 2] (mod 4)

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
 2. \<And>nat. k = Suc nat \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
with \<open>k = 0\<close>
[PROOF STATE]
proof (chain)
picking this:
k = 0
[x + y = 2] (mod 4)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k = 0
[x + y = 2] (mod 4)

goal (1 subgoal):
 1. [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
case (Suc k')
[PROOF STATE]
proof (state)
this:
k = Suc k'

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k = Suc k'
[PROOF STEP]
have "[x^2^k = 1] (mod 4)" and "[y^2^k = 1] (mod 4)"
[PROOF STATE]
proof (prove)
using this:
k = Suc k'

goal (1 subgoal):
 1. [x ^ 2 ^ k = 1] (mod 4) &&& [y ^ 2 ^ k = 1] (mod 4)
[PROOF STEP]
using \<open>odd x\<close> \<open>odd y\<close>
[PROOF STATE]
proof (prove)
using this:
k = Suc k'
odd x
odd y

goal (1 subgoal):
 1. [x ^ 2 ^ k = 1] (mod 4) &&& [y ^ 2 ^ k = 1] (mod 4)
[PROOF STEP]
by (auto simp add: power_mult power_Suc2 simp del: power_Suc intro: odd_square_mod_4)
[PROOF STATE]
proof (state)
this:
[x ^ 2 ^ k = 1] (mod 4)
[y ^ 2 ^ k = 1] (mod 4)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
thus "[x^2^k + y^2^k = 2] (mod 4)"
[PROOF STATE]
proof (prove)
using this:
[x ^ 2 ^ k = 1] (mod 4)
[y ^ 2 ^ k = 1] (mod 4)

goal (1 subgoal):
 1. [x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)
[PROOF STEP]
by (smt cong_add)
[PROOF STATE]
proof (state)
this:
[x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)

goal (1 subgoal):
 1. \<not> 2 ^ Suc 1 dvd x ^ 2 ^ k + y ^ 2 ^ k
[PROOF STEP]
thus "\<not> 2^Suc 1 dvd x^2^k + y^2^k"
[PROOF STATE]
proof (prove)
using this:
[x ^ 2 ^ k + y ^ 2 ^ k = 2] (mod 4)

goal (1 subgoal):
 1. \<not> 2 ^ Suc 1 dvd x ^ 2 ^ k + y ^ 2 ^ k
[PROOF STEP]
by (simp add: cong_dvd_iff)
[PROOF STATE]
proof (state)
this:
\<not> 2 ^ Suc 1 dvd x ^ 2 ^ k + y ^ 2 ^ k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x ^ 2 ^ k + y ^ 2 ^ k) = 1

goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x ^ 2 ^ k + y ^ 2 ^ k) = 1

goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
have "x^2^k + y^2^k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ 2 ^ k + y ^ 2 ^ k \<noteq> 0
[PROOF STEP]
using m_plus multiplicity_zero
[PROOF STATE]
proof (prove)
using this:
multiplicity 2 (x ^ 2 ^ k + y ^ 2 ^ k) = 1
multiplicity ?p (0::?'a) = 0

goal (1 subgoal):
 1. x ^ 2 ^ k + y ^ 2 ^ k \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x ^ 2 ^ k + y ^ 2 ^ k \<noteq> 0

goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x ^ 2 ^ k + y ^ 2 ^ k \<noteq> 0

goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
have "x^2^k - y^2^k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ 2 ^ k - y ^ 2 ^ k \<noteq> 0
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x ^ 2 ^ k - y ^ 2 ^ k = 0 \<Longrightarrow> False
[PROOF STEP]
assume "x^2^k - y^2^k = 0"
[PROOF STATE]
proof (state)
this:
x ^ 2 ^ k - y ^ 2 ^ k = 0

goal (1 subgoal):
 1. x ^ 2 ^ k - y ^ 2 ^ k = 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x ^ 2 ^ k - y ^ 2 ^ k = 0
[PROOF STEP]
have "\<bar>x\<bar> = \<bar>y\<bar>"
[PROOF STATE]
proof (prove)
using this:
x ^ 2 ^ k - y ^ 2 ^ k = 0

goal (1 subgoal):
 1. \<bar>x\<bar> = \<bar>y\<bar>
[PROOF STEP]
by (intro power_eq_abs, simp, simp)
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> = \<bar>y\<bar>

goal (1 subgoal):
 1. x ^ 2 ^ k - y ^ 2 ^ k = 0 \<Longrightarrow> False
[PROOF STEP]
hence "x = y \<or> x = -y"
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> = \<bar>y\<bar>

goal (1 subgoal):
 1. x = y \<or> x = - y
[PROOF STEP]
using abs_eq_iff
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> = \<bar>y\<bar>
(\<bar>?x\<bar> = \<bar>?y\<bar>) = (?x = ?y \<or> ?x = - ?y)

goal (1 subgoal):
 1. x = y \<or> x = - y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = y \<or> x = - y

goal (1 subgoal):
 1. x ^ 2 ^ k - y ^ 2 ^ k = 0 \<Longrightarrow> False
[PROOF STEP]
with \<open>x \<noteq> y\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> y
x = y \<or> x = - y
[PROOF STEP]
have "x = -y"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
x = y \<or> x = - y

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

goal (1 subgoal):
 1. x ^ 2 ^ k - y ^ 2 ^ k = 0 \<Longrightarrow> False
[PROOF STEP]
with \<open>4 dvd x - y\<close>
[PROOF STATE]
proof (chain)
picking this:
4 dvd x - y
x = - y
[PROOF STEP]
have "4 dvd 2*x"
[PROOF STATE]
proof (prove)
using this:
4 dvd x - y
x = - y

goal (1 subgoal):
 1. 4 dvd 2 * x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
4 dvd 2 * x

goal (1 subgoal):
 1. x ^ 2 ^ k - y ^ 2 ^ k = 0 \<Longrightarrow> False
[PROOF STEP]
hence "2 dvd x"
[PROOF STATE]
proof (prove)
using this:
4 dvd 2 * x

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

goal (1 subgoal):
 1. x ^ 2 ^ k - y ^ 2 ^ k = 0 \<Longrightarrow> False
[PROOF STEP]
with \<open>odd x\<close>
[PROOF STATE]
proof (chain)
picking this:
odd x
even x
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
odd x
even x

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x ^ 2 ^ k - y ^ 2 ^ k \<noteq> 0

goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x ^ 2 ^ Suc k - y ^ 2 ^ Suc k = (x ^ 2 ^ k - y ^ 2 ^ k) * (x ^ 2 ^ k + y ^ 2 ^ k)
multiplicity 2 (x ^ 2 ^ k + y ^ 2 ^ k) = 1
x ^ 2 ^ k + y ^ 2 ^ k \<noteq> 0
x ^ 2 ^ k - y ^ 2 ^ k \<noteq> 0
[PROOF STEP]
have "multiplicity 2 (x^2^Suc k - y^2^Suc k) =
            multiplicity 2 (x^2^k - y^2^k) + multiplicity 2 (x^2^k + y^2^k)"
[PROOF STATE]
proof (prove)
using this:
x ^ 2 ^ Suc k - y ^ 2 ^ Suc k = (x ^ 2 ^ k - y ^ 2 ^ k) * (x ^ 2 ^ k + y ^ 2 ^ k)
multiplicity 2 (x ^ 2 ^ k + y ^ 2 ^ k) = 1
x ^ 2 ^ k + y ^ 2 ^ k \<noteq> 0
x ^ 2 ^ k - y ^ 2 ^ k \<noteq> 0

goal (1 subgoal):
 1. multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) + multiplicity 2 (x ^ 2 ^ k + y ^ 2 ^ k)
[PROOF STEP]
by (unfold factor; intro prime_elem_multiplicity_mult_distrib; auto)
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) + multiplicity 2 (x ^ 2 ^ k + y ^ 2 ^ k)

goal (2 subgoals):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
 2. \<And>k. multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k \<Longrightarrow> multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) + multiplicity 2 (x ^ 2 ^ k + y ^ 2 ^ k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) + multiplicity 2 (x ^ 2 ^ k + y ^ 2 ^ k)

goal (1 subgoal):
 1. multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
using m_plus Suc.IH
[PROOF STATE]
proof (prove)
using this:
multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) + multiplicity 2 (x ^ 2 ^ k + y ^ 2 ^ k)
multiplicity 2 (x ^ 2 ^ k + y ^ 2 ^ k) = 1
multiplicity 2 (x ^ 2 ^ k - y ^ 2 ^ k) = multiplicity 2 (x - y) + k

goal (1 subgoal):
 1. multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x ^ 2 ^ Suc k - y ^ 2 ^ Suc k) = multiplicity 2 (x - y) + Suc k

goal (1 subgoal):
 1. multiplicity 2 (x ^ 2 ^ 0 - y ^ 2 ^ 0) = multiplicity 2 (x - y) + 0
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x ^ 2 ^ ?k - y ^ 2 ^ ?k) = multiplicity 2 (x - y) + ?k

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x ^ 2 ^ ?k - y ^ 2 ^ ?k) = multiplicity 2 (x - y) + ?k

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
have even_diff: "int 2 dvd x^2^multiplicity 2 n - y^2^multiplicity 2 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int 2 dvd x ^ 2 ^ multiplicity 2 n - y ^ 2 ^ multiplicity 2 n
[PROOF STEP]
using \<open>odd x\<close> and \<open>odd y\<close>
[PROOF STATE]
proof (prove)
using this:
odd x
odd y

goal (1 subgoal):
 1. int 2 dvd x ^ 2 ^ multiplicity 2 n - y ^ 2 ^ multiplicity 2 n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int 2 dvd x ^ 2 ^ multiplicity 2 n - y ^ 2 ^ multiplicity 2 n

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
int 2 dvd x ^ 2 ^ multiplicity 2 n - y ^ 2 ^ multiplicity 2 n

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
have odd_parts: "\<not> int 2 dvd x^2^multiplicity 2 n"   "\<not> int 2 dvd y^2^multiplicity 2 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> int 2 dvd x ^ 2 ^ multiplicity 2 n &&& \<not> int 2 dvd y ^ 2 ^ multiplicity 2 n
[PROOF STEP]
using \<open>odd x\<close> and \<open>odd y\<close>
[PROOF STATE]
proof (prove)
using this:
odd x
odd y

goal (1 subgoal):
 1. \<not> int 2 dvd x ^ 2 ^ multiplicity 2 n &&& \<not> int 2 dvd y ^ 2 ^ multiplicity 2 n
[PROOF STEP]
by simp+
[PROOF STATE]
proof (state)
this:
\<not> int 2 dvd x ^ 2 ^ multiplicity 2 n
\<not> int 2 dvd y ^ 2 ^ multiplicity 2 n

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> int 2 dvd x ^ 2 ^ multiplicity 2 n
\<not> int 2 dvd y ^ 2 ^ multiplicity 2 n

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
have coprime: "coprime 2 k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime 2 k
[PROOF STEP]
using \<open>\<not> 2 dvd k\<close>
[PROOF STATE]
proof (prove)
using this:
odd k

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

goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
apply (subst (1) n)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 (x ^ (2 ^ multiplicity 2 n * k) - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
apply (subst (2) n)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 (x ^ (2 ^ multiplicity 2 n * k) - y ^ (2 ^ multiplicity 2 n * k)) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
apply (simp only: power_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 ((x ^ 2 ^ multiplicity 2 n) ^ k - (y ^ 2 ^ multiplicity 2 n) ^ k) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
apply (simp only: multiplicity_diff_pow_coprime[OF \<open>prime 2\<close> even_diff odd_parts coprime, simplified])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 (x ^ 2 ^ multiplicity 2 n - y ^ 2 ^ multiplicity 2 n) = multiplicity 2 (x - y) + multiplicity 2 n
[PROOF STEP]
by (rule pow2)
[PROOF STATE]
proof (state)
this:
multiplicity 2 (x ^ n - y ^ n) = multiplicity 2 (x - y) + multiplicity 2 n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powhr_le_cancel_iff [simp]: "1 < x \<Longrightarrow> x powhr a \<le> x powhr b \<longleftrightarrow> a \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> (x powhr a \<le> x powhr b) = (a \<le> b)
[PROOF STEP]
by (simp add: linorder_not_less [symmetric])


[STATEMENT]
lemma cos_Arg2pi: "cmod z * cos (Arg2pi z) = Re z" and sin_Arg2pi: "cmod z * sin (Arg2pi z) = Im z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod z * cos (Arg2pi z) = Re z &&& cmod z * sin (Arg2pi z) = Im z
[PROOF STEP]
using Arg2pi_eq [of z] cis_conv_exp Re_rcis Im_rcis
[PROOF STATE]
proof (prove)
using this:
z = complex_of_real (cmod z) * exp (\<i> * complex_of_real (Arg2pi z))
cis ?b = exp (\<i> * complex_of_real ?b)
Re (rcis ?r ?a) = ?r * cos ?a
Im (rcis ?r ?a) = ?r * sin ?a

goal (1 subgoal):
 1. cmod z * cos (Arg2pi z) = Re z &&& cmod z * sin (Arg2pi z) = Im z
[PROOF STEP]
unfolding rcis_def
[PROOF STATE]
proof (prove)
using this:
z = complex_of_real (cmod z) * exp (\<i> * complex_of_real (Arg2pi z))
cis ?b = exp (\<i> * complex_of_real ?b)
Re (complex_of_real ?r * cis ?a) = ?r * cos ?a
Im (complex_of_real ?r * cis ?a) = ?r * sin ?a

goal (1 subgoal):
 1. cmod z * cos (Arg2pi z) = Re z &&& cmod z * sin (Arg2pi z) = Im z
[PROOF STEP]
by metis+


[STATEMENT]
lemma inj_on_Bij_nat_from_nat: "inj_on (Bij_Nat.from_nat::nat \<Rightarrow> 'a) {0..<CARD('a::finite)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on Bij_Nat.from_nat {0..<CARD('a)}
[PROOF STEP]
by (auto simp add: inj_on_def Bij_Nat.from_nat_def length_univ_list_card
      nth_eq_iff_index_eq univ_list(1))


[STATEMENT]
lemma H2_UNION:
  shows "(\<Union>h. P h) = (\<Union>h\<in>{H1, H2}. P h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (range P) = \<Union> (P ` {H1, H2})
[PROOF STEP]
using H2_UNIV
[PROOF STATE]
proof (prove)
using this:
UNIV = set [H1, H2]

goal (1 subgoal):
 1. \<Union> (range P) = \<Union> (P ` {H1, H2})
[PROOF STEP]
by auto


[STATEMENT]
lemma dual_complement_commute:
  "-(x\<^sup>d) = (-x)\<^sup>d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - x\<^sup>d = (- x)\<^sup>d
[PROOF STEP]
by (metis compl_unique dual_dist_sup dual_dist_inf dual_top dual_zero inf_complement sup_compl_top)


[STATEMENT]
lemma divisor_sum_altdef: "divisor_sum n = divisor_sigma 1 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_sum n = divisor_sigma 1 n
[PROOF STEP]
by (simp add: divisor_sigma_1_left_nat)


[STATEMENT]
theorem MPair_MPair_eq [iff]: "(MPair X Y = MPair X' Y') = (X=X' & Y=Y')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MPair X Y = MPair X' Y') = (X = X' \<and> Y = Y')
[PROOF STEP]
by (blast dest: MPair_imp_eq_left MPair_imp_eq_right)


[STATEMENT]
lemma nat_of_natural_max [simp]:
  "nat_of_natural (max k l) = max (nat_of_natural k) (nat_of_natural l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_of_natural (max k l) = max (nat_of_natural k) (nat_of_natural l)
[PROOF STEP]
by transfer rule


[STATEMENT]
lemma (in Module) finitesum_sprod:"\<lbrakk>f \<in> I \<rightarrow> {X. submodule R M X}; I \<noteq> {};
      r \<in> carrier R; g \<in>{j. j \<le> (n::nat)} \<rightarrow> (finitesum_base M I f) \<rbrakk> \<Longrightarrow>
                       r \<cdot>\<^sub>s (nsum M g n) =  nsum M (\<lambda>x. r \<cdot>\<^sub>s (g x)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> I \<rightarrow> {X. submodule R M X}; I \<noteq> {}; r \<in> carrier R; g \<in> {j. j \<le> n} \<rightarrow> finitesum_base M I f\<rbrakk> \<Longrightarrow> r \<cdot>\<^sub>s \<Sigma>\<^sub>e M g n = \<Sigma>\<^sub>e M (\<lambda>x. r \<cdot>\<^sub>s g x) n
[PROOF STEP]
apply (simp add:finitesum_sprodTr)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sum_two_rw: "(\<Sum>i = 0..<2. f i) = (\<Sum>i \<in> {0,1::nat}. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {0..<2} = sum f {0, 1}
[PROOF STEP]
by (rule sum.cong, auto)


[STATEMENT]
lemma Qp_fpoly_to_Qp_poly_is_hom:
  assumes "a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  shows "(Qp_fpoly_to_Qp_poly n a) \<in> ring_hom (UP (Fun\<^bsub>n\<^esub> Q\<^sub>p)) (Q\<^sub>p_x) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Qp_fpoly_to_Qp_poly n a \<in> ring_hom (UP (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)) (UP Q\<^sub>p)
[PROOF STEP]
unfolding Qp_fpoly_to_Qp_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_lift_hom (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p) Q\<^sub>p (eval_hom a) \<in> ring_hom (UP (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)) (UP Q\<^sub>p)
[PROOF STEP]
apply(rule UP_cring.poly_lift_hom_is_hom)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. UP_cring (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
 2. cring Q\<^sub>p
 3. eval_hom a \<in> ring_hom (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p) Q\<^sub>p
[PROOF STEP]
unfolding UP_cring_def
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. cring (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
 2. cring Q\<^sub>p
 3. eval_hom a \<in> ring_hom (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p) Q\<^sub>p
[PROOF STEP]
apply (simp add: Qp_funs_is_cring)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. cring Q\<^sub>p
 2. eval_hom a \<in> ring_hom (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p) Q\<^sub>p
[PROOF STEP]
apply (simp add: UPQ.R_cring)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_hom a \<in> ring_hom (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p) Q\<^sub>p
[PROOF STEP]
using assms eval_hom_is_hom[of a] ring_hom_ring.homh
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
a \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>) \<Longrightarrow> ring_hom_ring (function_ring (carrier (Q\<^sub>p\<^bsup>?n\<^esup>)) Q\<^sub>p) Q\<^sub>p (eval_hom a)
ring_hom_ring ?R ?S ?h \<Longrightarrow> ?h \<in> ring_hom ?R ?S

goal (1 subgoal):
 1. eval_hom a \<in> ring_hom (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p) Q\<^sub>p
[PROOF STEP]
by blast


[STATEMENT]
lemma cycle_free_altD:
  assumes "cycle_free g"
  assumes "(u,v)\<in>edges g"
  shows "(u,v)\<notin>(edges g - {(u,v),(v,u)})\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u, v) \<notin> (edges g - {(u, v), (v, u)})\<^sup>*
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
cycle_free g
(u, v) \<in> edges g

goal (1 subgoal):
 1. (u, v) \<notin> (edges g - {(u, v), (v, u)})\<^sup>*
[PROOF STEP]
unfolding cycle_free_alt
[PROOF STATE]
proof (prove)
using this:
\<forall>e\<in>edges g. e \<notin> (edges (restrict_edges g (- {e, prod.swap e})))\<^sup>*
(u, v) \<in> edges g

goal (1 subgoal):
 1. (u, v) \<notin> (edges g - {(u, v), (v, u)})\<^sup>*
[PROOF STEP]
by (auto)


[STATEMENT]
lemma not_iAll[simp]: "(\<not> (\<box> t I. P t)) = (\<diamond> t I. \<not> P t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (\<box> t I. P t)) = (\<diamond> t I. \<not> P t)
[PROOF STEP]
by blast


[STATEMENT]
lemma blinfun_of_list_id2: "blinfun_of_list [1, 0, 0, 1] = (id_blinfun::(real*real)\<Rightarrow>\<^sub>L(real*real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. blinfun_of_list [1, 0, 0, 1] = 1\<^sub>L
[PROOF STEP]
apply (auto intro!: blinfun_euclidean_eqI simp: Basis_prod_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. blinfun_apply (blinfun_of_list [1, 0, 0, 1]) (0, 1) = (0, 1)
 2. blinfun_apply (blinfun_of_list [1, 0, 0, 1]) (1, 0) = (1, 0)
[PROOF STEP]
apply (auto simp: blinfun_of_list_def blinfun_of_matrix_apply)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. ((0, 1) \<bullet> j * [1, 0, 0, 1] ! (index Basis_list i + index Basis_list i + index Basis_list j)) *\<^sub>R i) = (0, 1)
 2. (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. ((1, 0) \<bullet> j * [1, 0, 0, 1] ! (index Basis_list i + index Basis_list i + index Basis_list j)) *\<^sub>R i) = (1, 0)
[PROOF STEP]
apply (auto simp: Basis_prod_def Basis_list_real_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in PolynRg) polyn_add_n1:"\<lbrakk>pol_coeff S (n, f); pol_coeff S (n, g)\<rbrakk> \<Longrightarrow>
      (polyn_expr R X n (n, f)) \<plusminus> (polyn_expr R X n (n, g)) =
                                polyn_expr R X n (add_cf S (n, f) (n, g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S (n, f); pol_coeff S (n, g)\<rbrakk> \<Longrightarrow> polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = polyn_expr R X n (add_cf S (n, f) (n, g))
[PROOF STEP]
apply (subst polyn_add_n, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S (n, f); pol_coeff S (n, g)\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n = polyn_expr R X n (add_cf S (n, f) (n, g))
[PROOF STEP]
apply (simp add:polyn_expr_def add_cf_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bigo_sum1: "\<forall>x y. 0 \<le> h x y \<Longrightarrow>
    \<exists>c. \<forall>x y. \<bar>f x y\<bar> \<le> c * h x y \<Longrightarrow>
      (\<lambda>x. \<Sum>y \<in> A x. f x y) =o O(\<lambda>x. \<Sum>y \<in> A x. h x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x y. (0::'c) \<le> h x y; \<exists>c. \<forall>x y. \<bar>f x y\<bar> \<le> c * h x y\<rbrakk> \<Longrightarrow> (\<lambda>x. sum (f x) (A x)) \<in> O(\<lambda>x. sum (h x) (A x))
[PROOF STEP]
apply (rule bigo_sum_main)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>x y. (0::'c) \<le> h x y; \<exists>c. \<forall>x y. \<bar>f x y\<bar> \<le> c * h x y\<rbrakk> \<Longrightarrow> \<forall>x. \<forall>y\<in>A x. (0::'c) \<le> h x y
 2. \<lbrakk>\<forall>x y. (0::'c) \<le> h x y; \<exists>c. \<forall>x y. \<bar>f x y\<bar> \<le> c * h x y\<rbrakk> \<Longrightarrow> \<exists>c. \<forall>x. \<forall>y\<in>A x. \<bar>f x y\<bar> \<le> c * h x y
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x y. (0::'c) \<le> h x y; \<exists>c. \<forall>x y. \<bar>f x y\<bar> \<le> c * h x y\<rbrakk> \<Longrightarrow> \<exists>c. \<forall>x. \<forall>y\<in>A x. \<bar>f x y\<bar> \<le> c * h x y
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c. \<lbrakk>\<forall>x y. (0::'c) \<le> h x y; \<forall>x y. \<bar>f x y\<bar> \<le> c * h x y\<rbrakk> \<Longrightarrow> \<exists>c. \<forall>x. \<forall>y\<in>A x. \<bar>f x y\<bar> \<le> c * h x y
[PROOF STEP]
apply (rule_tac x = c in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c. \<lbrakk>\<forall>x y. (0::'c) \<le> h x y; \<forall>x y. \<bar>f x y\<bar> \<le> c * h x y\<rbrakk> \<Longrightarrow> \<forall>x. \<forall>y\<in>A x. \<bar>f x y\<bar> \<le> c * h x y
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma H1_H2_commute: "H1 o H2 = H2 o H1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H1 \<circ> H2 = H2 \<circ> H1
[PROOF STEP]
by (auto simp: design_defs fun_eq_iff split: cond_splits)


[STATEMENT]
lemma scaleR_vector_matrix_assoc:
  fixes k :: real and x :: "real^'n" and A :: "real^'m^'n"
  shows "(k *\<^sub>R x) v* A = k *\<^sub>R (x v* A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k *\<^sub>R x v* A = k *\<^sub>R (x v* A)
[PROOF STEP]
by (metis matrix_vector_mult_scaleR transpose_matrix_vector)


[STATEMENT]
lemma item_dot_of_inc_item[simp]: "item_dot (inc_item x k) = (item_dot x) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. item_dot (inc_item x k) = item_dot x + 1
[PROOF STEP]
by (simp add: inc_item_def)


[STATEMENT]
lemma xor_comm: "\<lbrakk> x \<in> carrier L; y \<in> carrier L \<rbrakk> \<Longrightarrow> x \<oplus> y = y \<oplus> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier L; y \<in> carrier L\<rbrakk> \<Longrightarrow> x \<oplus> y = y \<oplus> x
[PROOF STEP]
by(simp add: xor_def meet_join_distrib join_comm)


[STATEMENT]
lemma signed_measure_add:
  assumes "signed_measure M \<mu>"
    and "a\<in> sets M"
    and "b\<in> sets M"
    and "a\<inter> b = {}"
  shows "\<mu> (a\<union> b) = \<mu> a + \<mu> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<mu> (a \<union> b) = \<mu> a + \<mu> b
[PROOF STEP]
using additiveD[OF signed_measure_additive]
    assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>signed_measure ?M1 ?f; ?x \<inter> ?y = {}; ?x \<in> sets ?M1; ?y \<in> sets ?M1\<rbrakk> \<Longrightarrow> ?f (?x \<union> ?y) = ?f ?x + ?f ?y
signed_measure M \<mu>
a \<in> sets M
b \<in> sets M
a \<inter> b = {}

goal (1 subgoal):
 1. \<mu> (a \<union> b) = \<mu> a + \<mu> b
[PROOF STEP]
by auto


[STATEMENT]
lemma size_Iff [simp]: "size (A IFF B) = 2*(size A + size B) + 8"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (A IFF B) = 2 * (size A + size B) + 8
[PROOF STEP]
by (simp add: Iff_def)


[STATEMENT]
lemma cardlt:
  shows "card  {i. i < (n::nat)} \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. i < n} \<le> n
[PROOF STEP]
by simp


[STATEMENT]
lemma (in Ring) bilinear_r_add1:"\<lbrakk>R module M1; R module M2; R module N;
       m \<in> carrier M1; m21 \<in> carrier M2; m22 \<in> carrier M2;
       bilinear_map f R M1 M2 N\<rbrakk> \<Longrightarrow>
       f (m, m21 \<plusminus>\<^bsub>M2\<^esub> m22) \<plusminus>\<^bsub>N\<^esub> -\<^sub>a\<^bsub>N\<^esub> (f (m, m21) \<plusminus>\<^bsub>N\<^esub> (f (m, m22))) = \<zero>\<^bsub>N\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module M1; R module M2; R module N; m \<in> carrier M1; m21 \<in> carrier M2; m22 \<in> carrier M2; bilinear_map f R M1 M2 N\<rbrakk> \<Longrightarrow> f (m, m21 \<plusminus>\<^bsub>M2\<^esub> m22) \<plusminus>\<^bsub>N\<^esub> -\<^sub>a\<^bsub>N\<^esub> (f (m, m21) \<plusminus>\<^bsub>N\<^esub> f (m, m22)) = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (frule Module.module_is_ag[of N],
       frule Module.module_is_ag[of M2],
       subst aGroup.ag_eq_diffzero[of N, THEN sym], assumption+,
       frule_tac x = m21 and y = m22 in aGroup.ag_pOp_closed, assumption+)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>R module M1; R module M2; R module N; m \<in> carrier M1; m21 \<in> carrier M2; m22 \<in> carrier M2; bilinear_map f R M1 M2 N; aGroup N; aGroup M2; m21 \<plusminus>\<^bsub>M2\<^esub> m22 \<in> carrier M2\<rbrakk> \<Longrightarrow> f (m, m21 \<plusminus>\<^bsub>M2\<^esub> m22) \<in> carrier N
 2. \<lbrakk>R module M1; R module M2; R module N; m \<in> carrier M1; m21 \<in> carrier M2; m22 \<in> carrier M2; bilinear_map f R M1 M2 N; aGroup N; aGroup M2\<rbrakk> \<Longrightarrow> f (m, m21) \<plusminus>\<^bsub>N\<^esub> f (m, m22) \<in> carrier N
 3. \<lbrakk>R module M1; R module M2; R module N; m \<in> carrier M1; m21 \<in> carrier M2; m22 \<in> carrier M2; bilinear_map f R M1 M2 N; aGroup N; aGroup M2\<rbrakk> \<Longrightarrow> f (m, m21 \<plusminus>\<^bsub>M2\<^esub> m22) = f (m, m21) \<plusminus>\<^bsub>N\<^esub> f (m, m22)
[PROOF STEP]
apply (simp add:bilinear_mem,
       rule aGroup.ag_pOp_closed, assumption+)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>R module M1; R module M2; R module N; m \<in> carrier M1; m21 \<in> carrier M2; m22 \<in> carrier M2; bilinear_map f R M1 M2 N; aGroup N; aGroup M2\<rbrakk> \<Longrightarrow> f (m, m21) \<in> carrier N
 2. \<lbrakk>R module M1; R module M2; R module N; m \<in> carrier M1; m21 \<in> carrier M2; m22 \<in> carrier M2; bilinear_map f R M1 M2 N; aGroup N; aGroup M2\<rbrakk> \<Longrightarrow> f (m, m22) \<in> carrier N
 3. \<lbrakk>R module M1; R module M2; R module N; m \<in> carrier M1; m21 \<in> carrier M2; m22 \<in> carrier M2; bilinear_map f R M1 M2 N; aGroup N; aGroup M2\<rbrakk> \<Longrightarrow> f (m, m21 \<plusminus>\<^bsub>M2\<^esub> m22) = f (m, m21) \<plusminus>\<^bsub>N\<^esub> f (m, m22)
[PROOF STEP]
apply ((simp add:bilinear_mem)+, simp add:bilinear_r_add)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma qbs_prob_var_indep_plus':
  assumes "qbs_integrable p f"
          "qbs_integrable p (\<lambda>x. (f x)\<^sup>2)"
          "qbs_integrable q g"
      and "qbs_integrable q (\<lambda>x. (g x)\<^sup>2)"
    shows "qbs_prob_var (p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q) (\<lambda>z. f (fst z) + g (snd z)) = qbs_prob_var p f + qbs_prob_var q g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qbs_prob_var (p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q) (\<lambda>z. f (fst z) + g (snd z)) = qbs_prob_var p f + qbs_prob_var q g
[PROOF STEP]
using qbs_prob_var_indep_plus[OF qbs_integrable_indep1[OF assms(1)] qbs_integrable_indep1[OF assms(2)] qbs_integrable_indep2[OF assms(3)] qbs_integrable_indep2[OF assms(4)] qbs_integrable_indep_mult[OF assms(1) assms(3)] qbs_prob_integral_indep_mult[OF assms(1) assms(3),simplified  qbs_prob_integral_indep1[OF assms(1),of q,symmetric] qbs_prob_integral_indep2[OF assms(3),of p,symmetric]]]
        qbs_prob_integral_indep1[OF qbs_integrable_sq[OF assms(1,2)],of q "\<integral>\<^sub>Q z. f (fst z) \<partial>(p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q)"] qbs_prob_integral_indep2[OF qbs_integrable_sq[OF assms(3,4)],of p "\<integral>\<^sub>Q z. g (snd z) \<partial>(p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q)"]
[PROOF STATE]
proof (prove)
using this:
qbs_prob_var (p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q) (\<lambda>z. f (fst z) + g (snd z)) = qbs_prob_var (p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q) (\<lambda>z. f (fst z)) + qbs_prob_var (p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q) (\<lambda>z. g (snd z))
\<integral>\<^sub>Q z. (f (fst z) - \<integral>\<^sub>Q z. f (fst z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q)\<^sup>2 \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = \<integral>\<^sub>Q x. (f x - \<integral>\<^sub>Q z. f (fst z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q)\<^sup>2 \<partial>p
\<integral>\<^sub>Q z. (g (snd z) - \<integral>\<^sub>Q z. g (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q)\<^sup>2 \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = \<integral>\<^sub>Q y. (g y - \<integral>\<^sub>Q z. g (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q)\<^sup>2 \<partial>q

goal (1 subgoal):
 1. qbs_prob_var (p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q) (\<lambda>z. f (fst z) + g (snd z)) = qbs_prob_var p f + qbs_prob_var q g
[PROOF STEP]
by(simp add: qbs_prob_var_def qbs_prob_integral_indep1[OF assms(1)] qbs_prob_integral_indep2[OF assms(3)])


[STATEMENT]
lemma final_lemma6:
     "(\<Inter>v \<in> V. \<Inter>w \<in> V.
       (reachable v <==> {s. (root,v) \<in> REACHABLE}) \<inter> nmsg_eq 0 (v,w))
      \<subseteq> final"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>v\<in>V. \<Inter>w\<in>V. (Reachability.reachable v <==> {s. (root, v) \<in> REACHABLE}) \<inter> nmsg_eq 0 (v, w)) \<subseteq> final
[PROOF STEP]
apply (simp (no_asm) add: Eq_lemma2 Int_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>x\<in>V. \<Inter>xa\<in>V. {xb. (xb \<in> Reachability.reachable x) = ((root, x) \<in> REACHABLE) \<and> xb \<in> nmsg_eq 0 (x, xa)}) \<subseteq> final
[PROOF STEP]
apply (rule final_lemma1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma left_commute: "\<lbrakk> a \<in> M; b \<in> M; c \<in> M \<rbrakk> \<Longrightarrow> b \<cdot> (a \<cdot> c) = a \<cdot> (b \<cdot> c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> M; b \<in> M; c \<in> M\<rbrakk> \<Longrightarrow> b \<cdot> (a \<cdot> c) = a \<cdot> (b \<cdot> c)
[PROOF STEP]
using commutative
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> M; ?y \<in> M\<rbrakk> \<Longrightarrow> ?x \<cdot> ?y = ?y \<cdot> ?x

goal (1 subgoal):
 1. \<lbrakk>a \<in> M; b \<in> M; c \<in> M\<rbrakk> \<Longrightarrow> b \<cdot> (a \<cdot> c) = a \<cdot> (b \<cdot> c)
[PROOF STEP]
by force


[STATEMENT]
lemma [measurable]:
  fixes a b :: "'a::linorder_topology"
  shows lessThan_borel: "{..< a} \<in> sets borel"
    and greaterThan_borel: "{a <..} \<in> sets borel"
    and greaterThanLessThan_borel: "{a<..<b} \<in> sets borel"
    and atMost_borel: "{..a} \<in> sets borel"
    and atLeast_borel: "{a..} \<in> sets borel"
    and atLeastAtMost_borel: "{a..b} \<in> sets borel"
    and greaterThanAtMost_borel: "{a<..b} \<in> sets borel"
    and atLeastLessThan_borel: "{a..<b} \<in> sets borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (({..<a} \<in> sets borel &&& {a<..} \<in> sets borel) &&& {a<..<b} \<in> sets borel &&& {..a} \<in> sets borel) &&& ({a..} \<in> sets borel &&& {a..b} \<in> sets borel) &&& {a<..b} \<in> sets borel &&& {a..<b} \<in> sets borel
[PROOF STEP]
unfolding greaterThanAtMost_def atLeastLessThan_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (({..<a} \<in> sets borel &&& {a<..} \<in> sets borel) &&& {a<..<b} \<in> sets borel &&& {..a} \<in> sets borel) &&& ({a..} \<in> sets borel &&& {a..b} \<in> sets borel) &&& {a<..} \<inter> {..b} \<in> sets borel &&& {a..} \<inter> {..<b} \<in> sets borel
[PROOF STEP]
by (blast intro: borel_open borel_closed open_lessThan open_greaterThan open_greaterThanLessThan
                   closed_atMost closed_atLeast closed_atLeastAtMost)+


[STATEMENT]
lemma GS_rec_eq: "GS_rec v $ s = (\<Squnion>a \<in> A s. r (s, a) + l * (
  (P_lower (d(s := a)) *v (GS_rec v)) $ s + (P_upper (d(s := a)) *v v) $ s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GS_rec v $ s = (\<Squnion>a\<in>A s. r (s, a) + l * ((P_lower (d(s := a)) *v GS_rec v) $ s + (P_upper (d(s := a)) *v v) $ s))
[PROOF STEP]
unfolding GS_rec_def'[of v s] P_lower_def P_upper_def P_dec_elem matrix_vector_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>a\<in>A s. r (s, a) + l * ((\<Sum>s'<s. pmf (K (s, a)) s' * GS_rec v $ s') + (\<Sum>s'\<in>Collect ((\<le>) s). pmf (K (s, a)) s' * v $ s'))) = (\<Squnion>a\<in>A s. r (s, a) + l * ((\<chi>i. \<Sum>j\<in>UNIV. (\<chi>i j. if j < i then pmf (K (i, (d(s := a)) i)) j else 0) $ i $ j * GS_rec v $ j) $ s + (\<chi>i. \<Sum>j\<in>UNIV. (\<chi>i j. if i \<le> j then pmf (K (i, (d(s := a)) i)) j else 0) $ i $ j * v $ j) $ s))
[PROOF STEP]
by (auto simp: if_distrib[where f = "\<lambda>x. x * _ $ _"] sum.If_cases lessThan_def)


[STATEMENT]
lemma Cauchy_theorem_null_homotopic:
     "\<lbrakk>f holomorphic_on S; open S; valid_path g; homotopic_loops S g (linepath a a)\<rbrakk>
      \<Longrightarrow> (f has_contour_integral 0) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f holomorphic_on S; open S; valid_path g; homotopic_loops S g (linepath a a)\<rbrakk> \<Longrightarrow> (f has_contour_integral 0) g
[PROOF STEP]
by (metis Cauchy_theorem_homotopic_loops contour_integrable_holomorphic_simple valid_path_linepath
            contour_integral_trivial has_contour_integral_integral homotopic_loops_imp_subset)


[STATEMENT]
lemma powreal_add:
   "a pow\<^sub>\<real> (x + y) = a pow\<^sub>\<real> x * a pow\<^sub>\<real> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a pow\<^sub>\<real> (x + y) = a pow\<^sub>\<real> x * a pow\<^sub>\<real> y
[PROOF STEP]
by (metis minus_add_distrib mult_zero_right powa_add
       powreal_def real_inverse_ge_one_lemma)