[STATEMENT]
lemma multiplicity_diff_self_pow:
  assumes "p > 2" and "x \<noteq> y"
  shows "multiplicity p (x^p - y^p) = Suc (multiplicity p (x - y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity (int p) (x ^ p - y ^ p) = Suc (multiplicity (int p) (x - y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity (int p) (x ^ p - y ^ p) = Suc (multiplicity (int p) (x - y))
[PROOF STEP]
have *: "multiplicity p (\<Sum>i<p. y^(p - Suc i) * x^i) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity (int p) (\<Sum>i<p. y ^ (p - Suc i) * x ^ i) = 1
[PROOF STEP]
proof (rule multiplicity_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. int p ^ 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
 2. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
have "[(\<Sum>t<p. y^(p - Suc t) * x^t) = p * x^(p-1)] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * x ^ (p - 1)] (mod int p)
[PROOF STEP]
by (rule decompose_mod_p)
[PROOF STATE]
proof (state)
this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * x ^ (p - 1)] (mod int p)

goal (2 subgoals):
 1. int p ^ 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
 2. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * x ^ (p - 1)] (mod int p)

goal (2 subgoals):
 1. int p ^ 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
 2. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
have "[p * x^(p-1) = 0] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [int p * x ^ (p - 1) = 0] (mod int p)
[PROOF STEP]
by (simp add: cong_mult_self_left)
[PROOF STATE]
proof (state)
this:
[int p * x ^ (p - 1) = 0] (mod int p)

goal (2 subgoals):
 1. int p ^ 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
 2. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = 0] (mod int p)
[PROOF STEP]
show "(int p)^1 dvd (\<Sum>i<p. y^(p - Suc i) * x^i)"
[PROOF STATE]
proof (prove)
using this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = 0] (mod int p)

goal (1 subgoal):
 1. int p ^ 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
by (simp add: cong_0_iff)
[PROOF STATE]
proof (state)
this:
int p ^ 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
from \<open>p dvd x - y\<close>
[PROOF STATE]
proof (chain)
picking this:
int p dvd x - y
[PROOF STEP]
obtain k::int where kp: "x = y + k * p"
[PROOF STATE]
proof (prove)
using this:
int p dvd x - y

goal (1 subgoal):
 1. (\<And>k. x = y + k * int p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis add.commute diff_add_cancel dvd_def mult.commute)
[PROOF STATE]
proof (state)
this:
x = y + k * int p

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
have "[y^(p - Suc t) * x^t = y^(p-1) + t*k*p*y^(p-2)] (mod p^2)" if "t < p" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
proof (cases "t = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t = 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
 2. t \<noteq> 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
t \<noteq> 0

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
 2. t \<noteq> 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
have "y^(p - Suc t) * x^t = y^(p - Suc t) * (y + k*p)^t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y ^ (p - Suc t) * x ^ t = y ^ (p - Suc t) * (y + k * int p) ^ t
[PROOF STEP]
unfolding kp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y ^ (p - Suc t) * (y + k * int p) ^ t = y ^ (p - Suc t) * (y + k * int p) ^ t
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
y ^ (p - Suc t) * x ^ t = y ^ (p - Suc t) * (y + k * int p) ^ t

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
 2. t \<noteq> 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
y ^ (p - Suc t) * x ^ t = y ^ (p - Suc t) * (y + k * int p) ^ t

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
 2. t \<noteq> 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
have "... = y^(p - Suc t) * (\<Sum>i\<le>t. (t choose i) * (k*p)^i * y^(t-i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y ^ (p - Suc t) * (y + k * int p) ^ t = y ^ (p - Suc t) * (\<Sum>i\<le>t. int (t choose i) * (k * int p) ^ i * y ^ (t - i))
[PROOF STEP]
by (simp flip: binomial_ring add: add.commute)
[PROOF STATE]
proof (state)
this:
y ^ (p - Suc t) * (y + k * int p) ^ t = y ^ (p - Suc t) * (\<Sum>i\<le>t. int (t choose i) * (k * int p) ^ i * y ^ (t - i))

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
 2. t \<noteq> 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
y ^ (p - Suc t) * (y + k * int p) ^ t = y ^ (p - Suc t) * (\<Sum>i\<le>t. int (t choose i) * (k * int p) ^ i * y ^ (t - i))

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
 2. t \<noteq> 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
have "[... = y^(p - Suc t) * (\<Sum>i\<le>1. (t choose i) * (k*p)^i * y^(t-i))] (mod p^2)"
        \<comment> \<open>discard \<open>i > 1\<close>\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [y ^ (p - Suc t) * (\<Sum>i\<le>t. int (t choose i) * (k * int p) ^ i * y ^ (t - i)) = y ^ (p - Suc t) * (\<Sum>i\<le>1. int (t choose i) * (k * int p) ^ i * y ^ (t - i))] (mod int (p\<^sup>2))
[PROOF STEP]
proof (intro cong_scalar_left cong_sum_mono_neutral_right; rule)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 \<le> t
 2. \<And>i. i \<in> {..t} - {..1} \<Longrightarrow> [int (t choose i) * (k * int p) ^ i * y ^ (t - i) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 \<le> t
 2. \<And>i. i \<in> {..t} - {..1} \<Longrightarrow> [int (t choose i) * (k * int p) ^ i * y ^ (t - i) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
assume "i \<in> {..t} - {..1}"
[PROOF STATE]
proof (state)
this:
i \<in> {..t} - {..1}

goal (2 subgoals):
 1. 1 \<le> t
 2. \<And>i. i \<in> {..t} - {..1} \<Longrightarrow> [int (t choose i) * (k * int p) ^ i * y ^ (t - i) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> {..t} - {..1}
[PROOF STEP]
have "i \<ge> 2"
[PROOF STATE]
proof (prove)
using this:
i \<in> {..t} - {..1}

goal (1 subgoal):
 1. 2 \<le> i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 \<le> i

goal (2 subgoals):
 1. 1 \<le> t
 2. \<And>i. i \<in> {..t} - {..1} \<Longrightarrow> [int (t choose i) * (k * int p) ^ i * y ^ (t - i) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 \<le> i
[PROOF STEP]
obtain i' where "i = i' + 2"
[PROOF STATE]
proof (prove)
using this:
2 \<le> i

goal (1 subgoal):
 1. (\<And>i'. i = i' + 2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using add.commute le_Suc_ex
[PROOF STATE]
proof (prove)
using this:
2 \<le> i
?a + ?b = ?b + ?a
?k \<le> ?l \<Longrightarrow> \<exists>n. ?l = ?k + n

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

goal (2 subgoals):
 1. 1 \<le> t
 2. \<And>i. i \<in> {..t} - {..1} \<Longrightarrow> [int (t choose i) * (k * int p) ^ i * y ^ (t - i) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
hence "(k*p)^i = (k*p)^i' * k^2 * p^2"
[PROOF STATE]
proof (prove)
using this:
i = i' + 2

goal (1 subgoal):
 1. (k * int p) ^ i = (k * int p) ^ i' * k\<^sup>2 * int (p\<^sup>2)
[PROOF STEP]
by (simp add: ac_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
(k * int p) ^ i = (k * int p) ^ i' * k\<^sup>2 * int (p\<^sup>2)

goal (2 subgoals):
 1. 1 \<le> t
 2. \<And>i. i \<in> {..t} - {..1} \<Longrightarrow> [int (t choose i) * (k * int p) ^ i * y ^ (t - i) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
hence "[(k*p)^i = 0] (mod p^2)"
[PROOF STATE]
proof (prove)
using this:
(k * int p) ^ i = (k * int p) ^ i' * k\<^sup>2 * int (p\<^sup>2)

goal (1 subgoal):
 1. [(k * int p) ^ i = 0] (mod int (p\<^sup>2))
[PROOF STEP]
by (simp add: cong_mult_self_right)
[PROOF STATE]
proof (state)
this:
[(k * int p) ^ i = 0] (mod int (p\<^sup>2))

goal (2 subgoals):
 1. 1 \<le> t
 2. \<And>i. i \<in> {..t} - {..1} \<Longrightarrow> [int (t choose i) * (k * int p) ^ i * y ^ (t - i) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
thus "[(t choose i) * (k*p)^i * y^(t-i) = 0] (mod p^2)"
[PROOF STATE]
proof (prove)
using this:
[(k * int p) ^ i = 0] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. [int (t choose i) * (k * int p) ^ i * y ^ (t - i) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
by (simp add: cong_0_iff)
[PROOF STATE]
proof (state)
this:
[int (t choose i) * (k * int p) ^ i * y ^ (t - i) = 0] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. 1 \<le> t
[PROOF STEP]
qed (use \<open>t \<noteq> 0\<close> in auto)
[PROOF STATE]
proof (state)
this:
[y ^ (p - Suc t) * (\<Sum>i\<le>t. int (t choose i) * (k * int p) ^ i * y ^ (t - i)) = y ^ (p - Suc t) * (\<Sum>i\<le>1. int (t choose i) * (k * int p) ^ i * y ^ (t - i))] (mod int (p\<^sup>2))

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
 2. t \<noteq> 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[y ^ (p - Suc t) * (\<Sum>i\<le>t. int (t choose i) * (k * int p) ^ i * y ^ (t - i)) = y ^ (p - Suc t) * (\<Sum>i\<le>1. int (t choose i) * (k * int p) ^ i * y ^ (t - i))] (mod int (p\<^sup>2))

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
 2. t \<noteq> 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
have "(\<Sum>i\<le>1. (t choose i) * (k*p)^i * y^(t-i)) = y^t + t*k*p*y^(t-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>1. int (t choose i) * (k * int p) ^ i * y ^ (t - i)) = y ^ t + int t * k * int p * y ^ (t - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>1. int (t choose i) * (k * int p) ^ i * y ^ (t - i)) = y ^ t + int t * k * int p * y ^ (t - 1)

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
 2. t \<noteq> 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>1. int (t choose i) * (k * int p) ^ i * y ^ (t - i)) = y ^ t + int t * k * int p * y ^ (t - 1)

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
 2. t \<noteq> 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
have "y^(p - Suc t) * ... = y^(p-1) + t*k*p*y^(p-2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y ^ (p - Suc t) * (y ^ t + int t * k * int p * y ^ (t - 1)) = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)
[PROOF STEP]
using \<open>t < p\<close> \<open>t \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
t < p
t \<noteq> 0

goal (1 subgoal):
 1. y ^ (p - Suc t) * (y ^ t + int t * k * int p * y ^ (t - 1)) = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)
[PROOF STEP]
by (auto simp add: algebra_simps numeral_eq_Suc simp flip: power_add)
[PROOF STATE]
proof (state)
this:
y ^ (p - Suc t) * (y ^ t + int t * k * int p * y ^ (t - 1)) = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)

goal (2 subgoals):
 1. t = 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
 2. t \<noteq> 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
[y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. t = 0 \<Longrightarrow> [y ^ (p - Suc t) * x ^ t = y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
?t < p \<Longrightarrow> [y ^ (p - Suc ?t) * x ^ ?t = y ^ (p - 1) + int ?t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
hence "[(\<Sum>t<p. y^(p - Suc t) * x^t) = (\<Sum>t<p. y^(p-1) + t*k*p*y^(p-2))] (mod p^2)"
[PROOF STATE]
proof (prove)
using this:
?t < p \<Longrightarrow> [y ^ (p - Suc ?t) * x ^ ?t = y ^ (p - 1) + int ?t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. [\<Sum>t<p. y ^ (p - Suc t) * x ^ t = \<Sum>t<p. y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
by (auto intro: cong_sum)
[PROOF STATE]
proof (state)
this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = \<Sum>t<p. y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = \<Sum>t<p. y ^ (p - 1) + int t * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
have "(\<Sum>t<p. y^(p-1) + t*k*p*y^(p-2)) = p*y^(p-1) + (\<Sum>t<p. t) * k*p*y^(p-2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t<p. y ^ (p - 1) + int t * k * int p * y ^ (p - 2)) = int p * y ^ (p - 1) + int (\<Sum> {..<p}) * k * int p * y ^ (p - 2)
[PROOF STEP]
by (simp add: sum.distrib sum_distrib_right)
[PROOF STATE]
proof (state)
this:
(\<Sum>t<p. y ^ (p - 1) + int t * k * int p * y ^ (p - 2)) = int p * y ^ (p - 1) + int (\<Sum> {..<p}) * k * int p * y ^ (p - 2)

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>t<p. y ^ (p - 1) + int t * k * int p * y ^ (p - 2)) = int p * y ^ (p - 1) + int (\<Sum> {..<p}) * k * int p * y ^ (p - 2)

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
have "(\<Sum>t<p. t) = p*(p - 1) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {..<p} = p * (p - 1) div 2
[PROOF STEP]
by (simp add: Sum_Ico_nat lessThan_atLeast0)
[PROOF STATE]
proof (state)
this:
\<Sum> {..<p} = p * (p - 1) div 2

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * y ^ (p - 1) + int (p * (p - 1) div 2) * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
have "[(\<Sum>t<p. y^(p - Suc t) * x^t) = p*y^(p-1) + (p*(p - 1) div 2) * k*p*y^(p-2)] (mod p^2)"
[PROOF STATE]
proof (prove)
using this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * y ^ (p - 1) + int (p * (p - 1) div 2) * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. [\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * y ^ (p - 1) + int (p * (p - 1) div 2) * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * y ^ (p - 1) + int (p * (p - 1) div 2) * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * y ^ (p - 1) + int (p * (p - 1) div 2) * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
have "[(p*(p - 1) div 2) * k*p*y^(p-2) = 0] (mod p^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [int (p * (p - 1) div 2) * k * int p * y ^ (p - 2) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [int (p * (p - 1) div 2) * k * int p * y ^ (p - 2) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
have "[(p * (p - 1) div 2) * p = 0] (mod p^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [p * (p - 1) div 2 * p = 0] (mod p\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [p * (p - 1) div 2 * p = 0] (mod p\<^sup>2)
[PROOF STEP]
from \<open>p > 2\<close> and \<open>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
2 < p
prime p
[PROOF STEP]
have "odd p"
[PROOF STATE]
proof (prove)
using this:
2 < p
prime p

goal (1 subgoal):
 1. odd p
[PROOF STEP]
using prime_odd_nat
[PROOF STATE]
proof (prove)
using this:
2 < p
prime p
\<lbrakk>prime ?p; 2 < ?p\<rbrakk> \<Longrightarrow> odd ?p

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

goal (1 subgoal):
 1. [p * (p - 1) div 2 * p = 0] (mod p\<^sup>2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
odd p

goal (1 subgoal):
 1. [p * (p - 1) div 2 * p = 0] (mod p\<^sup>2)
[PROOF STEP]
by (metis (no_types, lifting) cong_0_iff div_mult_swap dvd_times_left_cancel_iff
              dvd_triv_left le_0_eq linorder_not_less mult.commute odd_pos odd_two_times_div_two_nat
              one_add_one power_add power_one_right)
[PROOF STATE]
proof (state)
this:
[p * (p - 1) div 2 * p = 0] (mod p\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[p * (p - 1) div 2 * p = 0] (mod p\<^sup>2)

goal (1 subgoal):
 1. [int (p * (p - 1) div 2) * k * int p * y ^ (p - 2) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
hence "[int ((p*(p - 1) div 2) * p)*k*y^(p-2) = 0] (mod p^2)"
[PROOF STATE]
proof (prove)
using this:
[p * (p - 1) div 2 * p = 0] (mod p\<^sup>2)

goal (1 subgoal):
 1. [int (p * (p - 1) div 2 * p) * k * y ^ (p - 2) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
unfolding cong_0_iff
[PROOF STATE]
proof (prove)
using this:
p\<^sup>2 dvd p * (p - 1) div 2 * p

goal (1 subgoal):
 1. int (p\<^sup>2) dvd int (p * (p - 1) div 2 * p) * k * y ^ (p - 2)
[PROOF STEP]
using int_dvd_int_iff
[PROOF STATE]
proof (prove)
using this:
p\<^sup>2 dvd p * (p - 1) div 2 * p
(int ?m dvd int ?n) = (?m dvd ?n)

goal (1 subgoal):
 1. int (p\<^sup>2) dvd int (p * (p - 1) div 2 * p) * k * y ^ (p - 2)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
[int (p * (p - 1) div 2 * p) * k * y ^ (p - 2) = 0] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. [int (p * (p - 1) div 2) * k * int p * y ^ (p - 2) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
[int (p * (p - 1) div 2 * p) * k * y ^ (p - 2) = 0] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. [int (p * (p - 1) div 2) * k * int p * y ^ (p - 2) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
[int (p * (p - 1) div 2) * k * int p * y ^ (p - 2) = 0] (mod int (p\<^sup>2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[int (p * (p - 1) div 2) * k * int p * y ^ (p - 2) = 0] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * y ^ (p - 1) + int (p * (p - 1) div 2) * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[int (p * (p - 1) div 2) * k * int p * y ^ (p - 2) = 0] (mod int (p\<^sup>2))
[PROOF STEP]
have "[(\<Sum>t<p. y^(p - Suc t) * x^t) = p*y^(p-1)] (mod p^2)"
[PROOF STATE]
proof (prove)
using this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * y ^ (p - 1) + int (p * (p - 1) div 2) * k * int p * y ^ (p - 2)] (mod int (p\<^sup>2))
[int (p * (p - 1) div 2) * k * int p * y ^ (p - 2) = 0] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. [\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * y ^ (p - 1)] (mod int (p\<^sup>2))
[PROOF STEP]
by (smt cong_add cong_iff_dvd_diff)
[PROOF STATE]
proof (state)
this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * y ^ (p - 1)] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * y ^ (p - 1)] (mod int (p\<^sup>2))

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
have "\<not> p^2 dvd p*y^(p-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> int (p\<^sup>2) dvd int p * y ^ (p - 1)
[PROOF STEP]
using \<open>p > 2\<close> \<open>prime p\<close> \<open>\<not> p dvd y\<close>
[PROOF STATE]
proof (prove)
using this:
2 < p
prime p
\<not> int p dvd y

goal (1 subgoal):
 1. \<not> int (p\<^sup>2) dvd int p * y ^ (p - 1)
[PROOF STEP]
by (simp add: power2_eq_square prime_dvd_power_int_iff)
[PROOF STATE]
proof (state)
this:
\<not> int (p\<^sup>2) dvd int p * y ^ (p - 1)

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * y ^ (p - 1)] (mod int (p\<^sup>2))
\<not> int (p\<^sup>2) dvd int p * y ^ (p - 1)
[PROOF STEP]
show "\<not> int p^(Suc 1) dvd (\<Sum>t<p. y^(p - Suc t) * x^t)"
[PROOF STATE]
proof (prove)
using this:
[\<Sum>t<p. y ^ (p - Suc t) * x ^ t = int p * y ^ (p - 1)] (mod int (p\<^sup>2))
\<not> int (p\<^sup>2) dvd int p * y ^ (p - 1)

goal (1 subgoal):
 1. \<not> int p ^ Suc 1 dvd (\<Sum>t<p. y ^ (p - Suc t) * x ^ t)
[PROOF STEP]
by (metis (no_types, lifting) Suc_1 of_nat_power cong_dvd_iff)
[PROOF STATE]
proof (state)
this:
\<not> int p ^ Suc 1 dvd (\<Sum>t<p. y ^ (p - Suc t) * x ^ t)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
multiplicity (int p) (\<Sum>i<p. y ^ (p - Suc i) * x ^ i) = 1

goal (1 subgoal):
 1. multiplicity (int p) (x ^ p - y ^ p) = Suc (multiplicity (int p) (x - y))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
multiplicity (int p) (\<Sum>i<p. y ^ (p - Suc i) * x ^ i) = 1

goal (1 subgoal):
 1. multiplicity (int p) (x ^ p - y ^ p) = Suc (multiplicity (int p) (x - y))
[PROOF STEP]
have "multiplicity p (x^p - y^p) = multiplicity p (x - y) + multiplicity p (\<Sum>i<p. y^(p - Suc i) * x^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity (int p) (x ^ p - y ^ p) = multiplicity (int p) (x - y) + multiplicity (int p) (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
apply (unfold power_diff_sumr2, intro prime_elem_multiplicity_mult_distrib)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. prime_elem (int p)
 2. x - y \<noteq> 0
 3. (\<Sum>i<p. y ^ (p - Suc i) * x ^ i) \<noteq> 0
[PROOF STEP]
using \<open>prime p\<close> \<open>x \<noteq> y\<close> multiplicity_zero *
[PROOF STATE]
proof (prove)
using this:
prime p
x \<noteq> y
multiplicity ?p (0::?'a) = 0
multiplicity (int p) (\<Sum>i<p. y ^ (p - Suc i) * x ^ i) = 1

goal (3 subgoals):
 1. prime_elem (int p)
 2. x - y \<noteq> 0
 3. (\<Sum>i<p. y ^ (p - Suc i) * x ^ i) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
multiplicity (int p) (x ^ p - y ^ p) = multiplicity (int p) (x - y) + multiplicity (int p) (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)

goal (1 subgoal):
 1. multiplicity (int p) (x ^ p - y ^ p) = Suc (multiplicity (int p) (x - y))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
multiplicity (int p) (\<Sum>i<p. y ^ (p - Suc i) * x ^ i) = 1
multiplicity (int p) (x ^ p - y ^ p) = multiplicity (int p) (x - y) + multiplicity (int p) (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
multiplicity (int p) (\<Sum>i<p. y ^ (p - Suc i) * x ^ i) = 1
multiplicity (int p) (x ^ p - y ^ p) = multiplicity (int p) (x - y) + multiplicity (int p) (\<Sum>i<p. y ^ (p - Suc i) * x ^ i)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eln_tendsto [tendsto_intros]:
  assumes "((\<lambda>n. u n) \<longlongrightarrow> l) F"
  shows "((\<lambda>n. eln(u n)) \<longlongrightarrow> eln l) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. eln (u n)) \<longlongrightarrow> eln l) F
[PROOF STEP]
using eln_continuous assms
[PROOF STATE]
proof (prove)
using this:
continuous_on UNIV eln
(u \<longlongrightarrow> l) F

goal (1 subgoal):
 1. ((\<lambda>n. eln (u n)) \<longlongrightarrow> eln l) F
[PROOF STEP]
by (metis UNIV_I continuous_on tendsto_compose)


[STATEMENT]
lemma DERIV_sum[derivative_intros]:
  "(\<And> n. n \<in> S \<Longrightarrow> ((\<lambda>x. f x n) has_field_derivative (f' x n)) F) \<Longrightarrow>
    ((\<lambda>x. sum (f x) S) has_field_derivative sum (f' x) S) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. n \<in> S \<Longrightarrow> ((\<lambda>x. f x n) has_field_derivative f' x n) F) \<Longrightarrow> ((\<lambda>x. sum (f x) S) has_field_derivative sum (f' x) S) F
[PROOF STEP]
by (rule has_derivative_imp_has_field_derivative [OF has_derivative_sum])
     (auto simp: sum_distrib_left mult_commute_abs dest: has_field_derivative_imp_has_derivative)


[STATEMENT]
lemma Joints_appendD1:
  "ys@xs\<in>Joints (YS@XS) \<Longrightarrow> length xs = length XS \<Longrightarrow> xs \<in> Joints XS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ys @ xs \<in> Joints (YS @ XS); length xs = length XS\<rbrakk> \<Longrightarrow> xs \<in> Joints XS
[PROOF STEP]
by (force simp: Joints_def valuate_def)


[STATEMENT]
lemma GreenThm_typeI_twoCube:
  shows "integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j  a) = one_chain_line_integral F {i} (boundary twoC)"
    "\<forall>(k,\<gamma>) \<in> boundary twoC. line_integral_exists F {i} \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC) &&& \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC)
 2. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
let ?bottom_edge = "(\<lambda>x. twoC(x, 0))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC)
 2. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
let ?right_edge = "(\<lambda>y. twoC(1, y))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC)
 2. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
let ?top_edge = "(\<lambda>x. twoC(x, 1))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC)
 2. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
let ?left_edge = "(\<lambda>y. twoC(0, y))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC)
 2. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
have line_integral_around_boundary:
    "one_chain_line_integral F {i} (boundary twoC) =
     line_integral F {i} ?bottom_edge + line_integral F {i} ?right_edge
     -  line_integral F {i} ?top_edge - line_integral F {i} ?left_edge"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. one_chain_line_integral F {i} (boundary twoC) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))
[PROOF STEP]
proof (simp add: one_chain_line_integral_def horizontal_boundary_def vertical_boundary_def boundary_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))
[PROOF STEP]
have finite1: "finite {(- 1::int, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))}

goal (1 subgoal):
 1. (\<Sum>x\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))
[PROOF STEP]
have sum_step1: "(\<Sum>(k, g)\<in>{(- (1::int), \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. k * line_integral F {i} g) =
                       line_integral F {i} (\<lambda>x. twoC (x, 0)) + (\<Sum>(k, g)\<in>{(- (1::int), \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))}. k * line_integral F {i} g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))}. real_of_int k * line_integral F {i} g)
[PROOF STEP]
using sum.insert_remove [OF finite1] valid_two_cube
[PROOF STATE]
proof (prove)
using this:
sum ?g {?x, (- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))} = ?g ?x + sum ?g ({(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))} - {?x})
valid_two_cube twoC

goal (1 subgoal):
 1. (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))}. real_of_int k * line_integral F {i} g)
[PROOF STEP]
by (auto simp: horizontal_boundary_def vertical_boundary_def boundary_def valid_two_cube_def card_insert_if split: if_split_asm)
[PROOF STATE]
proof (state)
this:
(\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))}. real_of_int k * line_integral F {i} g)

goal (1 subgoal):
 1. (\<Sum>x\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))
[PROOF STEP]
have three_distinct_edges: "card {(- 1::int, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))} = 3
[PROOF STEP]
using valid_two_cube
[PROOF STATE]
proof (prove)
using this:
valid_two_cube twoC

goal (1 subgoal):
 1. card {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))} = 3
[PROOF STEP]
apply (simp add: one_chain_line_integral_def horizontal_boundary_def vertical_boundary_def boundary_def valid_two_cube_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))} = 4 \<Longrightarrow> card {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))} = 3
[PROOF STEP]
by (auto simp: card_insert_if split: if_split_asm)
[PROOF STATE]
proof (state)
this:
card {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))} = 3

goal (1 subgoal):
 1. (\<Sum>x\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))
[PROOF STEP]
have finite2: "finite {(- 1::int, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}

goal (1 subgoal):
 1. (\<Sum>x\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))
[PROOF STEP]
have sum_step2: "(\<Sum>(k, g)\<in>{(- (1::int), \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (-1, \<lambda>x. twoC (x, 1))}. k * line_integral F {i} g) =
                          (- line_integral F {i} (\<lambda>x. twoC (x, 1))) + (\<Sum>(k, g)\<in>{(- (1::int), \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}. k * line_integral F {i} g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))}. real_of_int k * line_integral F {i} g) = - line_integral F {i} (\<lambda>x. twoC (x, 1)) + (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}. real_of_int k * line_integral F {i} g)
[PROOF STEP]
using sum.insert_remove [OF finite2] three_distinct_edges
[PROOF STATE]
proof (prove)
using this:
sum ?g {?x, (- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))} = ?g ?x + sum ?g ({(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))} - {?x})
card {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))} = 3

goal (1 subgoal):
 1. (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))}. real_of_int k * line_integral F {i} g) = - line_integral F {i} (\<lambda>x. twoC (x, 1)) + (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}. real_of_int k * line_integral F {i} g)
[PROOF STEP]
by (auto simp: card_insert_if split: if_split_asm)
[PROOF STATE]
proof (state)
this:
(\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))}. real_of_int k * line_integral F {i} g) = - line_integral F {i} (\<lambda>x. twoC (x, 1)) + (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}. real_of_int k * line_integral F {i} g)

goal (1 subgoal):
 1. (\<Sum>x\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))
[PROOF STEP]
have two_distinct_edges: "card {(- 1::int, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))} = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))} = 2
[PROOF STEP]
using three_distinct_edges
[PROOF STATE]
proof (prove)
using this:
card {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))} = 3

goal (1 subgoal):
 1. card {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))} = 2
[PROOF STEP]
by (simp add: one_chain_line_integral_def horizontal_boundary_def vertical_boundary_def boundary_def)
[PROOF STATE]
proof (state)
this:
card {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))} = 2

goal (1 subgoal):
 1. (\<Sum>x\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))
[PROOF STEP]
have finite3: "finite {(- 1::int, \<lambda>y. twoC (0, y))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {(- 1, \<lambda>y. twoC (0, y))}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {(- 1, \<lambda>y. twoC (0, y))}

goal (1 subgoal):
 1. (\<Sum>x\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))
[PROOF STEP]
have sum_step3: "(\<Sum>(k, g)\<in>{(- (1::int), \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}. k * line_integral F {i} g) =
                          (line_integral F {i} (\<lambda>y. twoC (1, y))) + (\<Sum>(k, g)\<in>{(- (1::real), \<lambda>y. twoC (0, y))}. k * line_integral F {i} g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}. real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>y. twoC (1, y)) + (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y))}. k * line_integral F {i} g)
[PROOF STEP]
using sum.insert_remove [OF finite2] three_distinct_edges
[PROOF STATE]
proof (prove)
using this:
sum ?g {?x, (- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))} = ?g ?x + sum ?g ({(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))} - {?x})
card {(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))} = 3

goal (1 subgoal):
 1. (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}. real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>y. twoC (1, y)) + (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y))}. k * line_integral F {i} g)
[PROOF STEP]
by (auto simp: card_insert_if split: if_split_asm)
[PROOF STATE]
proof (state)
this:
(\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}. real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>y. twoC (1, y)) + (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y))}. k * line_integral F {i} g)

goal (1 subgoal):
 1. (\<Sum>x\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))
[PROOF STEP]
show "(\<Sum>x\<in>{(- 1::int, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> k * line_integral F {i} g) =
                               line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))
[PROOF STEP]
using sum_step1 sum_step2 sum_step3
[PROOF STATE]
proof (prove)
using this:
(\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))}. real_of_int k * line_integral F {i} g)
(\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (- 1, \<lambda>x. twoC (x, 1))}. real_of_int k * line_integral F {i} g) = - line_integral F {i} (\<lambda>x. twoC (x, 1)) + (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}. real_of_int k * line_integral F {i} g)
(\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y))}. real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>y. twoC (1, y)) + (\<Sum>(k, g)\<in>{(- 1, \<lambda>y. twoC (0, y))}. k * line_integral F {i} g)

goal (1 subgoal):
 1. (\<Sum>x\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{(- 1, \<lambda>y. twoC (0, y)), (1, \<lambda>y. twoC (1, y)), (1, \<lambda>x. twoC (x, 0)), (- 1, \<lambda>x. twoC (x, 1))}. case x of (k, g) \<Rightarrow> real_of_int k * line_integral F {i} g) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
one_chain_line_integral F {i} (boundary twoC) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))

goal (2 subgoals):
 1. integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC)
 2. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
obtain a b g1 g2 where
    twoCisTypeI: "a < b"
    "(\<forall>x \<in> cbox a b. g2 x \<le> g1 x)"
    "cubeImage twoC = {(x,y). x \<in> cbox a b \<and> y \<in> cbox (g2 x) (g1 x)}"
    "twoC = (\<lambda>(x, y). ((1 - x) * a + x * b, (1 - y) * g2 ((1 - x) * a + x * b) + y * g1 ((1 - x) * a + x * b)))"
    "g1 piecewise_C1_differentiable_on {a .. b}"
    "g2 piecewise_C1_differentiable_on {a .. b}"
    "(\<lambda>x. twoC(x, 0)) = (\<lambda>x. (a + (b - a) * x, g2 (a + (b - a) * x)))"
    "(\<lambda>y. twoC(1, y)) = (\<lambda>x. (b, g2 b + x *\<^sub>R (g1 b - g2 b)))"
    "(\<lambda>x. twoC(x, 1)) = (\<lambda>x. (a + (b - a) * x, g1 (a + (b - a) * x)))"
    "(\<lambda>y. twoC(0, y)) = (\<lambda>x. (a, g2 a + x *\<^sub>R (g1 a - g2 a)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b g2 g1. \<lbrakk>a < b; \<forall>x\<in>cbox a b. g2 x \<le> g1 x; cubeImage twoC = {(x, y). x \<in> cbox a b \<and> y \<in> cbox (g2 x) (g1 x)}; twoC = (\<lambda>(x, y). ((1 - x) * a + x * b, (1 - y) * g2 ((1 - x) * a + x * b) + y * g1 ((1 - x) * a + x * b))); g1 piecewise_C1_differentiable_on {a..b}; g2 piecewise_C1_differentiable_on {a..b}; (\<lambda>x. twoC (x, 0)) = (\<lambda>x. (a + (b - a) * x, g2 (a + (b - a) * x))); (\<lambda>y. twoC (1, y)) = (\<lambda>x. (b, g2 b + x *\<^sub>R (g1 b - g2 b))); (\<lambda>x. twoC (x, 1)) = (\<lambda>x. (a + (b - a) * x, g1 (a + (b - a) * x))); (\<lambda>y. twoC (0, y)) = (\<lambda>x. (a, g2 a + x *\<^sub>R (g1 a - g2 a)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using two_cube and typeI_cube_explicit_spec[of"twoC"]
[PROOF STATE]
proof (prove)
using this:
typeI_twoCube twoC
typeI_twoCube twoC \<Longrightarrow> \<exists>a b g1 g2. a < b \<and> (\<forall>x\<in>{a..b}. g2 x \<le> g1 x) \<and> cubeImage twoC = {(x, y). x \<in> {a..b} \<and> y \<in> {g2 x..g1 x}} \<and> twoC = (\<lambda>(x, y). ((1 - x) * a + x * b, (1 - y) * g2 ((1 - x) * a + x * b) + y * g1 ((1 - x) * a + x * b))) \<and> g1 piecewise_C1_differentiable_on {a..b} \<and> g2 piecewise_C1_differentiable_on {a..b} \<and> (\<lambda>x. twoC (x, 0)) = (\<lambda>x. (a + (b - a) * x, g2 (a + (b - a) * x))) \<and> (\<lambda>y. twoC (1, y)) = (\<lambda>x. (b, g2 b + x *\<^sub>R (g1 b - g2 b))) \<and> (\<lambda>x. twoC (x, 1)) = (\<lambda>x. (a + (b - a) * x, g1 (a + (b - a) * x))) \<and> (\<lambda>y. twoC (0, y)) = (\<lambda>x. (a, g2 a + x *\<^sub>R (g1 a - g2 a)))

goal (1 subgoal):
 1. (\<And>a b g2 g1. \<lbrakk>a < b; \<forall>x\<in>cbox a b. g2 x \<le> g1 x; cubeImage twoC = {(x, y). x \<in> cbox a b \<and> y \<in> cbox (g2 x) (g1 x)}; twoC = (\<lambda>(x, y). ((1 - x) * a + x * b, (1 - y) * g2 ((1 - x) * a + x * b) + y * g1 ((1 - x) * a + x * b))); g1 piecewise_C1_differentiable_on {a..b}; g2 piecewise_C1_differentiable_on {a..b}; (\<lambda>x. twoC (x, 0)) = (\<lambda>x. (a + (b - a) * x, g2 (a + (b - a) * x))); (\<lambda>y. twoC (1, y)) = (\<lambda>x. (b, g2 b + x *\<^sub>R (g1 b - g2 b))); (\<lambda>x. twoC (x, 1)) = (\<lambda>x. (a + (b - a) * x, g1 (a + (b - a) * x))); (\<lambda>y. twoC (0, y)) = (\<lambda>x. (a, g2 a + x *\<^sub>R (g1 a - g2 a)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a < b
\<forall>x\<in>cbox a b. g2 x \<le> g1 x
cubeImage twoC = {(x, y). x \<in> cbox a b \<and> y \<in> cbox (g2 x) (g1 x)}
twoC = (\<lambda>(x, y). ((1 - x) * a + x * b, (1 - y) * g2 ((1 - x) * a + x * b) + y * g1 ((1 - x) * a + x * b)))
g1 piecewise_C1_differentiable_on {a..b}
g2 piecewise_C1_differentiable_on {a..b}
(\<lambda>x. twoC (x, 0)) = (\<lambda>x. (a + (b - a) * x, g2 (a + (b - a) * x)))
(\<lambda>y. twoC (1, y)) = (\<lambda>x. (b, g2 b + x *\<^sub>R (g1 b - g2 b)))
(\<lambda>x. twoC (x, 1)) = (\<lambda>x. (a + (b - a) * x, g1 (a + (b - a) * x)))
(\<lambda>y. twoC (0, y)) = (\<lambda>x. (a, g2 a + x *\<^sub>R (g1 a - g2 a)))

goal (2 subgoals):
 1. integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC)
 2. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
have bottom_edge_smooth: "(\<lambda>x. twoC (x, 0)) piecewise_C1_differentiable_on {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. twoC (x, 0)) piecewise_C1_differentiable_on {0..1}
[PROOF STEP]
using typeI_twoCube_smooth_edges two_cube boundary_def vertical_boundary_def horizontal_boundary_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>typeI_twoCube ?twoC; (?k, ?\<gamma>) \<in> boundary ?twoC\<rbrakk> \<Longrightarrow> ?\<gamma> piecewise_C1_differentiable_on {0..1}
typeI_twoCube twoC
boundary ?twoC \<equiv> horizontal_boundary ?twoC \<union> vertical_boundary ?twoC
vertical_boundary ?twoC \<equiv> {(- 1, \<lambda>y. ?twoC (0, y)), (1, \<lambda>y. ?twoC (1, y))}
horizontal_boundary ?twoC \<equiv> {(1, \<lambda>x. ?twoC (x, 0)), (- 1, \<lambda>x. ?twoC (x, 1))}

goal (1 subgoal):
 1. (\<lambda>x. twoC (x, 0)) piecewise_C1_differentiable_on {0..1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. twoC (x, 0)) piecewise_C1_differentiable_on {0..1}

goal (2 subgoals):
 1. integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC)
 2. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
have top_edge_smooth: "?top_edge piecewise_C1_differentiable_on {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. twoC (x, 1)) piecewise_C1_differentiable_on {0..1}
[PROOF STEP]
using typeI_twoCube_smooth_edges two_cube boundary_def vertical_boundary_def horizontal_boundary_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>typeI_twoCube ?twoC; (?k, ?\<gamma>) \<in> boundary ?twoC\<rbrakk> \<Longrightarrow> ?\<gamma> piecewise_C1_differentiable_on {0..1}
typeI_twoCube twoC
boundary ?twoC \<equiv> horizontal_boundary ?twoC \<union> vertical_boundary ?twoC
vertical_boundary ?twoC \<equiv> {(- 1, \<lambda>y. ?twoC (0, y)), (1, \<lambda>y. ?twoC (1, y))}
horizontal_boundary ?twoC \<equiv> {(1, \<lambda>x. ?twoC (x, 0)), (- 1, \<lambda>x. ?twoC (x, 1))}

goal (1 subgoal):
 1. (\<lambda>x. twoC (x, 1)) piecewise_C1_differentiable_on {0..1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. twoC (x, 1)) piecewise_C1_differentiable_on {0..1}

goal (2 subgoals):
 1. integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC)
 2. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
show "integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j  a) = one_chain_line_integral F {i} (boundary twoC)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC)
[PROOF STEP]
using Greens_thm_type_I[OF twoCisTypeI(3) twoCisTypeI(7) bottom_edge_smooth
        twoCisTypeI(8) twoCisTypeI(9) top_edge_smooth
        twoCisTypeI(10) f_analytically_valid twoCisTypeI(2) twoCisTypeI(1)]
        line_integral_around_boundary
[PROOF STATE]
proof (prove)
using this:
line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y)) = integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a)
line_integral_exists F {i} (\<lambda>y. twoC (0, y))
line_integral_exists F {i} (\<lambda>x. twoC (x, 1))
line_integral_exists F {i} (\<lambda>y. twoC (1, y))
line_integral_exists F {i} (\<lambda>x. twoC (x, 0))
one_chain_line_integral F {i} (boundary twoC) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))

goal (1 subgoal):
 1. integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a) = one_chain_line_integral F {i} (boundary twoC)

goal (1 subgoal):
 1. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
have "line_integral_exists F {i} (\<lambda>y. twoC (0, y))"
       "line_integral_exists F {i} (\<lambda>x. twoC (x, 1))"
       "line_integral_exists F {i} (\<lambda>y. twoC (1, y))"
       "line_integral_exists F {i} (\<lambda>x. twoC (x, 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (line_integral_exists F {i} (\<lambda>y. twoC (0, y)) &&& line_integral_exists F {i} (\<lambda>x. twoC (x, 1))) &&& line_integral_exists F {i} (\<lambda>y. twoC (1, y)) &&& line_integral_exists F {i} (\<lambda>x. twoC (x, 0))
[PROOF STEP]
using Greens_thm_type_I[OF twoCisTypeI(3) twoCisTypeI(7) bottom_edge_smooth
        twoCisTypeI(8) twoCisTypeI(9) top_edge_smooth
        twoCisTypeI(10) f_analytically_valid twoCisTypeI(2) twoCisTypeI(1)]
      line_integral_around_boundary
[PROOF STATE]
proof (prove)
using this:
line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y)) = integral (cubeImage twoC) (\<lambda>a. - partial_vector_derivative (\<lambda>p. F p \<bullet> i) j a)
line_integral_exists F {i} (\<lambda>y. twoC (0, y))
line_integral_exists F {i} (\<lambda>x. twoC (x, 1))
line_integral_exists F {i} (\<lambda>y. twoC (1, y))
line_integral_exists F {i} (\<lambda>x. twoC (x, 0))
one_chain_line_integral F {i} (boundary twoC) = line_integral F {i} (\<lambda>x. twoC (x, 0)) + line_integral F {i} (\<lambda>y. twoC (1, y)) - line_integral F {i} (\<lambda>x. twoC (x, 1)) - line_integral F {i} (\<lambda>y. twoC (0, y))

goal (1 subgoal):
 1. (line_integral_exists F {i} (\<lambda>y. twoC (0, y)) &&& line_integral_exists F {i} (\<lambda>x. twoC (x, 1))) &&& line_integral_exists F {i} (\<lambda>y. twoC (1, y)) &&& line_integral_exists F {i} (\<lambda>x. twoC (x, 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
line_integral_exists F {i} (\<lambda>y. twoC (0, y))
line_integral_exists F {i} (\<lambda>x. twoC (x, 1))
line_integral_exists F {i} (\<lambda>y. twoC (1, y))
line_integral_exists F {i} (\<lambda>x. twoC (x, 0))

goal (1 subgoal):
 1. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
line_integral_exists F {i} (\<lambda>y. twoC (0, y))
line_integral_exists F {i} (\<lambda>x. twoC (x, 1))
line_integral_exists F {i} (\<lambda>y. twoC (1, y))
line_integral_exists F {i} (\<lambda>x. twoC (x, 0))
[PROOF STEP]
have "line_integral_exists F {i} \<gamma>" if "(k,\<gamma>) \<in> boundary twoC" for k \<gamma>
[PROOF STATE]
proof (prove)
using this:
line_integral_exists F {i} (\<lambda>y. twoC (0, y))
line_integral_exists F {i} (\<lambda>x. twoC (x, 1))
line_integral_exists F {i} (\<lambda>y. twoC (1, y))
line_integral_exists F {i} (\<lambda>x. twoC (x, 0))

goal (1 subgoal):
 1. line_integral_exists F {i} \<gamma>
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
line_integral_exists F {i} (\<lambda>y. twoC (0, y))
line_integral_exists F {i} (\<lambda>x. twoC (x, 1))
line_integral_exists F {i} (\<lambda>y. twoC (1, y))
line_integral_exists F {i} (\<lambda>x. twoC (x, 0))
(k, \<gamma>) \<in> boundary twoC

goal (1 subgoal):
 1. line_integral_exists F {i} \<gamma>
[PROOF STEP]
by (auto simp add: boundary_def horizontal_boundary_def vertical_boundary_def)
[PROOF STATE]
proof (state)
this:
(?k, ?\<gamma>) \<in> boundary twoC \<Longrightarrow> line_integral_exists F {i} ?\<gamma>

goal (1 subgoal):
 1. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(?k, ?\<gamma>) \<in> boundary twoC \<Longrightarrow> line_integral_exists F {i} ?\<gamma>
[PROOF STEP]
show "\<forall>(k,\<gamma>) \<in> boundary twoC. line_integral_exists F {i} \<gamma>"
[PROOF STATE]
proof (prove)
using this:
(?k, ?\<gamma>) \<in> boundary twoC \<Longrightarrow> line_integral_exists F {i} ?\<gamma>

goal (1 subgoal):
 1. \<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>(k, \<gamma>)\<in>boundary twoC. line_integral_exists F {i} \<gamma>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma numer_cf7_deriv:
  shows "(numer_cf7 has_field_derivative numer_cf7_deriv x) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (numer_cf7 has_real_derivative numer_cf7_deriv x) (at x)
[PROOF STEP]
unfolding numer_cf7_def numer_cf7_deriv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x ^ 7 + 56 * x ^ 6 + 1512 * x ^ 5 + 25200 * x ^ 4 + 277200 * x ^ 3 + 1995840 * x\<^sup>2 + 8648640 * x + 17297280) has_real_derivative 7 * x ^ 6 + 336 * x ^ 5 + 7560 * x ^ 4 + 100800 * x ^ 3 + 831600 * x\<^sup>2 + 3991680 * x + 8648640) (at x)
[PROOF STEP]
by (intro derivative_eq_intros | simp)+


[STATEMENT]
lemma strong_del_point_index_alt:
  assumes "ps \<subseteq> (del_point p)"
  shows "(str_del_point_blocks p) index ps =
    \<B> index ps - {# bl \<in># \<B> . p \<in> bl#} index ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. str_del_point_blocks p index ps = \<B> index ps - filter_mset ((\<in>) p) \<B> index ps
[PROOF STEP]
using str_del_point_blocks_alt points_index_def
[PROOF STATE]
proof (prove)
using this:
str_del_point_blocks ?p = \<B> - filter_mset ((\<in>) ?p) \<B>
?B index ?ps \<equiv> size (filter_mset ((\<subseteq>) ?ps) ?B)

goal (1 subgoal):
 1. str_del_point_blocks p index ps = \<B> index ps - filter_mset ((\<in>) p) \<B> index ps
[PROOF STEP]
by (metis filter_diff_mset multiset_filter_mono multiset_filter_subset  size_Diff_submset)


[STATEMENT]
lemma "a \<noteq> 0 \<Longrightarrow> D (\<lambda>t. t/a) = (\<lambda>t. 1/a) on T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow>  D (\<lambda>t. t / a) = (\<lambda>t. 1 / a) on T
[PROOF STEP]
by (auto intro!: poly_derivatives simp: power2_eq_square)


[STATEMENT]
lemma Sup_least:
  fixes z::V shows "(\<And>x. x \<in> A \<Longrightarrow> x \<le> z) \<Longrightarrow> \<Squnion>A \<le> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> x \<le> z) \<Longrightarrow> \<Squnion> A \<le> z
[PROOF STEP]
by (auto simp: Sup_V_def SUP_least less_eq_V_def)


[STATEMENT]
lemma first_map_add_submap: "(\<And>x. x \<in> dom m1 \<and> x \<in> dom m2 \<Longrightarrow> m1 x = m2 x) \<Longrightarrow>
        m1 ++ m2 \<subseteq>\<^sub>m x \<Longrightarrow> m1 \<subseteq>\<^sub>m x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in> dom m1 \<and> x \<in> dom m2 \<Longrightarrow> m1 x = m2 x; m1 ++ m2 \<subseteq>\<^sub>m x\<rbrakk> \<Longrightarrow> m1 \<subseteq>\<^sub>m x
[PROOF STEP]
using map_add_le_mapE map_add_comm
[PROOF STATE]
proof (prove)
using this:
?f ++ ?g \<subseteq>\<^sub>m ?h \<Longrightarrow> ?g \<subseteq>\<^sub>m ?h
(\<And>x. x \<in> dom ?m1.0 \<and> x \<in> dom ?m2.0 \<Longrightarrow> ?m1.0 x = ?m2.0 x) \<Longrightarrow> ?m1.0 ++ ?m2.0 = ?m2.0 ++ ?m1.0

goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in> dom m1 \<and> x \<in> dom m2 \<Longrightarrow> m1 x = m2 x; m1 ++ m2 \<subseteq>\<^sub>m x\<rbrakk> \<Longrightarrow> m1 \<subseteq>\<^sub>m x
[PROOF STEP]
by force


[STATEMENT]
lemma jump_cong:
  assumes "x=y" and "eventually (\<lambda>x. f x=g x) (at x)"
  shows "jump f x = jump g y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jump f x = jump g y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jump f x = jump g y
[PROOF STEP]
have left:"eventually (\<lambda>x. f x=g x) (at_left x)"
    and right:"eventually (\<lambda>x. f x=g x) (at_right x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_left x. f x = g x &&& \<forall>\<^sub>F x in at_right x. f x = g x
[PROOF STEP]
using assms(2) eventually_at_split
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at x. f x = g x
eventually ?P (at ?x) = (eventually ?P (at_left ?x) \<and> eventually ?P (at_right ?x))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_left x. f x = g x &&& \<forall>\<^sub>F x in at_right x. f x = g x
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_left x. f x = g x
\<forall>\<^sub>F x in at_right x. f x = g x

goal (1 subgoal):
 1. jump f x = jump g y
[PROOF STEP]
from filterlim_cong[OF _ _ this(1)] filterlim_cong[OF _ _ this(2)]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?F1.0 = ?F1'; at_left x = ?F2'\<rbrakk> \<Longrightarrow> filterlim f ?F1.0 (at_left x) = filterlim g ?F1' ?F2'
\<lbrakk>?F1.0 = ?F1'; at_right x = ?F2'\<rbrakk> \<Longrightarrow> filterlim f ?F1.0 (at_right x) = filterlim g ?F1' ?F2'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?F1.0 = ?F1'; at_left x = ?F2'\<rbrakk> \<Longrightarrow> filterlim f ?F1.0 (at_left x) = filterlim g ?F1' ?F2'
\<lbrakk>?F1.0 = ?F1'; at_right x = ?F2'\<rbrakk> \<Longrightarrow> filterlim f ?F1.0 (at_right x) = filterlim g ?F1' ?F2'

goal (1 subgoal):
 1. jump f x = jump g y
[PROOF STEP]
unfolding jump_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?F1.0 = ?F1'; at_left x = ?F2'\<rbrakk> \<Longrightarrow> filterlim f ?F1.0 (at_left x) = filterlim g ?F1' ?F2'
\<lbrakk>?F1.0 = ?F1'; at_right x = ?F2'\<rbrakk> \<Longrightarrow> filterlim f ?F1.0 (at_right x) = filterlim g ?F1' ?F2'

goal (1 subgoal):
 1. (if filterlim f at_bot (at_left x) \<and> filterlim f at_top (at_right x) then 1 else if filterlim f at_top (at_left x) \<and> filterlim f at_bot (at_right x) then - 1 else 0) = (if filterlim g at_bot (at_left y) \<and> filterlim g at_top (at_right y) then 1 else if filterlim g at_top (at_left y) \<and> filterlim g at_bot (at_right y) then - 1 else 0)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?F1.0 = ?F1'; at_left x = ?F2'\<rbrakk> \<Longrightarrow> filterlim f ?F1.0 (at_left x) = filterlim g ?F1' ?F2'
\<lbrakk>?F1.0 = ?F1'; at_right x = ?F2'\<rbrakk> \<Longrightarrow> filterlim f ?F1.0 (at_right x) = filterlim g ?F1' ?F2'
x = y

goal (1 subgoal):
 1. (if filterlim f at_bot (at_left x) \<and> filterlim f at_top (at_right x) then 1 else if filterlim f at_top (at_left x) \<and> filterlim f at_bot (at_right x) then - 1 else 0) = (if filterlim g at_bot (at_left y) \<and> filterlim g at_top (at_right y) then 1 else if filterlim g at_top (at_left y) \<and> filterlim g at_bot (at_right y) then - 1 else 0)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
jump f x = jump g y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_emb_iff:
  "f \<in> prod_emb I M K X \<longleftrightarrow> f \<in> extensional I \<and> (restrict f K \<in> X) \<and> (\<forall>i\<in>I. f i \<in> space (M i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> prod_emb I M K X) = (f \<in> extensional I \<and> restrict f K \<in> X \<and> (\<forall>i\<in>I. f i \<in> space (M i)))
[PROOF STEP]
unfolding prod_emb_def PiE_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> (\<lambda>x. restrict x K) -` X \<inter> ((\<Pi> i\<in>I. space (M i)) \<inter> extensional I)) = (f \<in> extensional I \<and> restrict f K \<in> X \<and> (\<forall>i\<in>I. f i \<in> space (M i)))
[PROOF STEP]
by auto


[STATEMENT]
lemma exist_matrix'_implies_equivalent:
  assumes A: "matrix' X Y f = A"
  and B: "matrix' X' Y' f = B"
  and X: "is_basis (set_of_vector X)"
  and Y: "is_basis (set_of_vector Y)"
  and X': "is_basis (set_of_vector X')"
  and Y': "is_basis (set_of_vector Y')"
  and linear_f: "linear ((*s)) ((*s)) f"
  shows "equivalent_matrices A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equivalent_matrices A B
[PROOF STEP]
proof (unfold equivalent_matrices_def, rule exI[of _ "matrix_change_of_basis Y' Y"], rule exI[of _ "matrix_change_of_basis X' X"], auto)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. invertible (matrix_change_of_basis Y' Y)
 2. invertible (matrix_change_of_basis X' X)
 3. B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X
[PROOF STEP]
have inv: "matrix_change_of_basis Y Y' = matrix_inv (matrix_change_of_basis Y' Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis Y Y' = matrix_inv (matrix_change_of_basis Y' Y)
[PROOF STEP]
using matrix_inv_matrix_change_of_basis[OF Y' Y]
[PROOF STATE]
proof (prove)
using this:
matrix_change_of_basis Y Y' = matrix_inv (matrix_change_of_basis Y' Y)

goal (1 subgoal):
 1. matrix_change_of_basis Y Y' = matrix_inv (matrix_change_of_basis Y' Y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis Y Y' = matrix_inv (matrix_change_of_basis Y' Y)

goal (3 subgoals):
 1. invertible (matrix_change_of_basis Y' Y)
 2. invertible (matrix_change_of_basis X' X)
 3. B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X
[PROOF STEP]
show "invertible (matrix_change_of_basis Y' Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (matrix_change_of_basis Y' Y)
[PROOF STEP]
using invertible_matrix_change_of_basis[OF Y' Y]
[PROOF STATE]
proof (prove)
using this:
invertible (matrix_change_of_basis Y' Y)

goal (1 subgoal):
 1. invertible (matrix_change_of_basis Y' Y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
invertible (matrix_change_of_basis Y' Y)

goal (2 subgoals):
 1. invertible (matrix_change_of_basis X' X)
 2. B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X
[PROOF STEP]
show "invertible (matrix_change_of_basis X' X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (matrix_change_of_basis X' X)
[PROOF STEP]
using invertible_matrix_change_of_basis[OF X' X]
[PROOF STATE]
proof (prove)
using this:
invertible (matrix_change_of_basis X' X)

goal (1 subgoal):
 1. invertible (matrix_change_of_basis X' X)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
invertible (matrix_change_of_basis X' X)

goal (1 subgoal):
 1. B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X
[PROOF STEP]
have "B = matrix' X' Y' f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B = matrix' X' Y' f
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
matrix' X' Y' f = B

goal (1 subgoal):
 1. B = matrix' X' Y' f
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
B = matrix' X' Y' f

goal (1 subgoal):
 1. B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B = matrix' X' Y' f

goal (1 subgoal):
 1. B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X
[PROOF STEP]
have "... =  matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix' X' Y' f = matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X
[PROOF STEP]
using matrix'_matrix_change_of_basis[OF X X' Y Y' linear_f]
[PROOF STATE]
proof (prove)
using this:
matrix' X' Y' f = matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X

goal (1 subgoal):
 1. matrix' X' Y' f = matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
matrix' X' Y' f = matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X

goal (1 subgoal):
 1. B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
B = matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X
[PROOF STEP]
show "B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X"
[PROOF STATE]
proof (prove)
using this:
B = matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X

goal (1 subgoal):
 1. B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X
[PROOF STEP]
unfolding inv
[PROOF STATE]
proof (prove)
using this:
B = matrix_inv (matrix_change_of_basis Y' Y) ** matrix' X Y f ** matrix_change_of_basis X' X

goal (1 subgoal):
 1. B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X
[PROOF STEP]
unfolding A
[PROOF STATE]
proof (prove)
using this:
B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X

goal (1 subgoal):
 1. B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
B = matrix_inv (matrix_change_of_basis Y' Y) ** A ** matrix_change_of_basis X' X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cnj_Gamma: "cnj (Gamma z) = Gamma (cnj z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (Gamma z) = Gamma (cnj z)
[PROOF STEP]
unfolding Gamma_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (inverse (rGamma z)) = inverse (rGamma (cnj z))
[PROOF STEP]
by (simp add: cnj_rGamma)


[STATEMENT]
lemma icd_path_shift0: assumes \<open>is_path \<pi>\<close> shows \<open>(i icd\<^bsup>\<pi>\<^esup>\<rightarrow> k) = (i-k icd\<^bsup>\<pi>\<guillemotleft>k\<^esup>\<rightarrow>0)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i icd\<^bsup>\<pi>\<^esup>\<rightarrow> k) = (i - k icd\<^bsup>\<pi> \<guillemotleft> k\<^esup>\<rightarrow> 0)
[PROOF STEP]
using icd_path_shift[OF _ assms]
[PROOF STATE]
proof (prove)
using this:
?l \<le> ?k \<Longrightarrow> (?i icd\<^bsup>\<pi>\<^esup>\<rightarrow> ?k) = (?i - ?l icd\<^bsup>\<pi> \<guillemotleft> ?l\<^esup>\<rightarrow> ?k - ?l)

goal (1 subgoal):
 1. (i icd\<^bsup>\<pi>\<^esup>\<rightarrow> k) = (i - k icd\<^bsup>\<pi> \<guillemotleft> k\<^esup>\<rightarrow> 0)
[PROOF STEP]
by (metis diff_self_eq_0 le_refl)


[STATEMENT]
lemma minus_1_power_ring_neq_zero [simp]: "(- 1 :: 'a :: ring_1) ^ n \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (1::'a)) ^ n \<noteq> (0::'a)
[PROOF STEP]
by (cases "even n") simp_all


[STATEMENT]
lemma atLeastLessThan_less_eq:
"({0..<m} \<le> {0..<n}) = ((m::nat) \<le> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({0..<m} \<subseteq> {0..<n}) = (m \<le> n)
[PROOF STEP]
unfolding ivl_subset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (m \<le> 0 \<or> 0 \<le> 0 \<and> m \<le> n) = (m \<le> n)
[PROOF STEP]
by arith


[STATEMENT]
lemma r01_to_r01_r01_snd_measurable:
 "r01_to_r01_r01_snd \<in> borel_measurable borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_to_r01_r01_snd \<in> borel_measurable real_borel
[PROOF STEP]
unfolding r01_to_r01_r01_snd_def'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>r. \<Sum>n. real (r01_binary_expansion' r (2 * n + 1)) * (1 / 2) ^ (n + 1)) \<in> borel_measurable real_borel
[PROOF STEP]
using r01_binary_expansion'_measurable
[PROOF STATE]
proof (prove)
using this:
(\<lambda>r. real (r01_binary_expansion' r ?n)) \<in> borel_measurable real_borel

goal (1 subgoal):
 1. (\<lambda>r. \<Sum>n. real (r01_binary_expansion' r (2 * n + 1)) * (1 / 2) ^ (n + 1)) \<in> borel_measurable real_borel
[PROOF STEP]
by auto


[STATEMENT]
lemma row_of_dagger [simp]:
  assumes "i < dim_col M"
  shows "row (M\<^sup>\<dagger>) i = vec (dim_row M) (\<lambda>j. cnj (M $$ (j,i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row M\<^sup>\<dagger> i = vec (dim_row M) (\<lambda>j. cnj (M $$ (j, i)))
[PROOF STEP]
using assms row_def dagger_def
[PROOF STATE]
proof (prove)
using this:
i < dim_col M
row ?A ?i = vec (dim_col ?A) (\<lambda>j. ?A $$ (?i, j))
?M\<^sup>\<dagger> \<equiv> mat (dim_col ?M) (dim_row ?M) (\<lambda>(i, j). cnj (?M $$ (j, i)))

goal (1 subgoal):
 1. row M\<^sup>\<dagger> i = vec (dim_row M) (\<lambda>j. cnj (M $$ (j, i)))
[PROOF STEP]
by simp