[STATEMENT]
lemma complex_quadratic_equation_two_roots:
  fixes \<xi> :: complex
  assumes "a \<noteq> 0" and "a*\<xi>\<^sup>2 + b * \<xi> + c = 0"
  shows "\<xi> = (-b + ccsqrt(b\<^sup>2 - 4*a*c)) / (2*a) \<or>
         \<xi> = (-b - ccsqrt(b\<^sup>2 - 4*a*c)) / (2*a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> 0
a * \<xi>\<^sup>2 + b * \<xi> + c = 0
[PROOF STEP]
have "\<xi>\<^sup>2 + (b/a) * \<xi> + (c/a) = 0"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0
a * \<xi>\<^sup>2 + b * \<xi> + c = 0

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

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
hence "\<xi> = (-(b/a) + ccsqrt((b/a)\<^sup>2 - 4*(c/a))) / 2 \<or> \<xi> = (-(b/a) - ccsqrt((b/a)\<^sup>2 - 4*(c/a))) / 2"
[PROOF STATE]
proof (prove)
using this:
\<xi>\<^sup>2 + b / a * \<xi> + c / a = 0

goal (1 subgoal):
 1. \<xi> = (- (b / a) + ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2 \<or> \<xi> = (- (b / a) - ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2
[PROOF STEP]
using complex_quadratic_equation_monic_only_two_roots[of \<xi> "b/a" "c/a"]
[PROOF STATE]
proof (prove)
using this:
\<xi>\<^sup>2 + b / a * \<xi> + c / a = 0
\<xi>\<^sup>2 + b / a * \<xi> + c / a = 0 \<Longrightarrow> \<xi> = (- (b / a) + ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2 \<or> \<xi> = (- (b / a) - ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2

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

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
hence "\<exists> k. \<xi> = (-(b/a) + (-1)^k * ccsqrt((b/a)\<^sup>2 - 4*(c/a))) / 2"
[PROOF STATE]
proof (prove)
using this:
\<xi> = (- (b / a) + ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2 \<or> \<xi> = (- (b / a) - ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2

goal (1 subgoal):
 1. \<exists>k. \<xi> = (- (b / a) + (- 1) ^ k * ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2
[PROOF STEP]
by safe (rule_tac x="2" in exI, simp, rule_tac x="1" in exI, simp)
[PROOF STATE]
proof (state)
this:
\<exists>k. \<xi> = (- (b / a) + (- 1) ^ k * ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>k. \<xi> = (- (b / a) + (- 1) ^ k * ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2
[PROOF STEP]
obtain k1 where "\<xi> = (-(b/a) + (-1)^k1 * ccsqrt((b/a)\<^sup>2 - 4*(c/a))) / 2"
[PROOF STATE]
proof (prove)
using this:
\<exists>k. \<xi> = (- (b / a) + (- 1) ^ k * ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2

goal (1 subgoal):
 1. (\<And>k1. \<xi> = (- (b / a) + (- 1) ^ k1 * ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<xi> = (- (b / a) + (- 1) ^ k1 * ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<xi> = (- (b / a) + (- 1) ^ k1 * ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
have "(b / a)\<^sup>2 - 4 * (c / a) = (b\<^sup>2 - 4 * a * c) * (1 / a\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b / a)\<^sup>2 - 4 * (c / a) = (b\<^sup>2 - 4 * a * c) * (1 / a\<^sup>2)
[PROOF STEP]
using \<open>a \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. (b / a)\<^sup>2 - 4 * (c / a) = (b\<^sup>2 - 4 * a * c) * (1 / a\<^sup>2)
[PROOF STEP]
by (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
(b / a)\<^sup>2 - 4 * (c / a) = (b\<^sup>2 - 4 * a * c) * (1 / a\<^sup>2)

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
hence "ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1/a\<^sup>2) \<or>
         ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = - ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1/a\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
(b / a)\<^sup>2 - 4 * (c / a) = (b\<^sup>2 - 4 * a * c) * (1 / a\<^sup>2)

goal (1 subgoal):
 1. ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2) \<or> ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = - ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)
[PROOF STEP]
using ccsqrt_mult[of "b\<^sup>2 - 4 * a * c" "1/a\<^sup>2"]
[PROOF STATE]
proof (prove)
using this:
(b / a)\<^sup>2 - 4 * (c / a) = (b\<^sup>2 - 4 * a * c) * (1 / a\<^sup>2)
ccsqrt ((b\<^sup>2 - 4 * a * c) * (1 / a\<^sup>2)) = ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2) \<or> ccsqrt ((b\<^sup>2 - 4 * a * c) * (1 / a\<^sup>2)) = - ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)

goal (1 subgoal):
 1. ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2) \<or> ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = - ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2) \<or> ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = - ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
hence "\<exists> k.  ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = (-1)^k * ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2) \<or> ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = - ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)

goal (1 subgoal):
 1. \<exists>k. ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = (- 1) ^ k * ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)
[PROOF STEP]
by safe (rule_tac x="2" in exI, simp, rule_tac x="1" in exI, simp)
[PROOF STATE]
proof (state)
this:
\<exists>k. ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = (- 1) ^ k * ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>k. ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = (- 1) ^ k * ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)
[PROOF STEP]
obtain k2 where "ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = (-1)^k2 * ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
\<exists>k. ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = (- 1) ^ k * ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)

goal (1 subgoal):
 1. (\<And>k2. ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = (- 1) ^ k2 * ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = (- 1) ^ k2 * ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = (- 1) ^ k2 * ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
have "ccsqrt (1 / a\<^sup>2) = 1/a \<or> ccsqrt (1 / a\<^sup>2) = -1/a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccsqrt (1 / a\<^sup>2) = 1 / a \<or> ccsqrt (1 / a\<^sup>2) = - 1 / a
[PROOF STEP]
using ccsqrt[of "1/a" "1 / a\<^sup>2"]
[PROOF STATE]
proof (prove)
using this:
1 / a * (1 / a) = 1 / a\<^sup>2 \<Longrightarrow> 1 / a = ccsqrt (1 / a\<^sup>2) \<or> 1 / a = - ccsqrt (1 / a\<^sup>2)

goal (1 subgoal):
 1. ccsqrt (1 / a\<^sup>2) = 1 / a \<or> ccsqrt (1 / a\<^sup>2) = - 1 / a
[PROOF STEP]
by (auto simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
ccsqrt (1 / a\<^sup>2) = 1 / a \<or> ccsqrt (1 / a\<^sup>2) = - 1 / a

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
hence "\<exists> k. ccsqrt (1 / a\<^sup>2) = (-1)^k * 1/a"
[PROOF STATE]
proof (prove)
using this:
ccsqrt (1 / a\<^sup>2) = 1 / a \<or> ccsqrt (1 / a\<^sup>2) = - 1 / a

goal (1 subgoal):
 1. \<exists>k. ccsqrt (1 / a\<^sup>2) = (- 1) ^ k * 1 / a
[PROOF STEP]
by safe (rule_tac x="2" in exI, simp, rule_tac x="1" in exI, simp)
[PROOF STATE]
proof (state)
this:
\<exists>k. ccsqrt (1 / a\<^sup>2) = (- 1) ^ k * 1 / a

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>k. ccsqrt (1 / a\<^sup>2) = (- 1) ^ k * 1 / a
[PROOF STEP]
obtain k3 where "ccsqrt (1 / a\<^sup>2) = (-1)^k3 * 1/a"
[PROOF STATE]
proof (prove)
using this:
\<exists>k. ccsqrt (1 / a\<^sup>2) = (- 1) ^ k * 1 / a

goal (1 subgoal):
 1. (\<And>k3. ccsqrt (1 / a\<^sup>2) = (- 1) ^ k3 * 1 / a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ccsqrt (1 / a\<^sup>2) = (- 1) ^ k3 * 1 / a

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<xi> = (- (b / a) + (- 1) ^ k1 * ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2
ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = (- 1) ^ k2 * ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)
ccsqrt (1 / a\<^sup>2) = (- 1) ^ k3 * 1 / a
[PROOF STEP]
have "\<xi> = (- (b / a) + ((-1) ^ k1 * (-1) ^ k2 * (-1) ^ k3) * ccsqrt (b\<^sup>2 - 4 * a * c) * 1/a) / 2"
[PROOF STATE]
proof (prove)
using this:
\<xi> = (- (b / a) + (- 1) ^ k1 * ccsqrt ((b / a)\<^sup>2 - 4 * (c / a))) / 2
ccsqrt ((b / a)\<^sup>2 - 4 * (c / a)) = (- 1) ^ k2 * ccsqrt (b\<^sup>2 - 4 * a * c) * ccsqrt (1 / a\<^sup>2)
ccsqrt (1 / a\<^sup>2) = (- 1) ^ k3 * 1 / a

goal (1 subgoal):
 1. \<xi> = (- (b / a) + (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 * ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<xi> = (- (b / a) + (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 * ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<xi> = (- (b / a) + (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 * ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
have "(-(1::complex)) ^ k1 * (-1) ^ k2 * (-1) ^ k3 = 1 \<or> (-(1::complex)) ^ k1 * (-1) ^ k2 * (-1) ^ k3 = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 = 1 \<or> (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 = - 1
[PROOF STEP]
using neg_one_even_power[of "k1 + k2 + k3"]
[PROOF STATE]
proof (prove)
using this:
even (k1 + k2 + k3) \<Longrightarrow> (- (1::?'a)) ^ (k1 + k2 + k3) = (1::?'a)

goal (1 subgoal):
 1. (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 = 1 \<or> (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 = - 1
[PROOF STEP]
using neg_one_odd_power[of "k1 + k2 + k3"]
[PROOF STATE]
proof (prove)
using this:
even (k1 + k2 + k3) \<Longrightarrow> (- (1::?'a)) ^ (k1 + k2 + k3) = (1::?'a)
odd (k1 + k2 + k3) \<Longrightarrow> (- (1::?'a)) ^ (k1 + k2 + k3) = - (1::?'a)

goal (1 subgoal):
 1. (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 = 1 \<or> (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 = - 1
[PROOF STEP]
by (smt power_add)
[PROOF STATE]
proof (state)
this:
(- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 = 1 \<or> (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 = - 1

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<xi> = (- (b / a) + (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 * ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2
(- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 = 1 \<or> (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 = - 1
[PROOF STEP]
have "\<xi> = (- (b / a) + ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2 \<or> \<xi> = (- (b / a) - ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2"
[PROOF STATE]
proof (prove)
using this:
\<xi> = (- (b / a) + (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 * ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2
(- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 = 1 \<or> (- 1) ^ k1 * (- 1) ^ k2 * (- 1) ^ k3 = - 1

goal (1 subgoal):
 1. \<xi> = (- (b / a) + ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2 \<or> \<xi> = (- (b / a) - ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<xi> = (- (b / a) + ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2 \<or> \<xi> = (- (b / a) - ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<xi> = (- (b / a) + ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2 \<or> \<xi> = (- (b / a) - ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
using \<open>a \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
\<xi> = (- (b / a) + ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2 \<or> \<xi> = (- (b / a) - ccsqrt (b\<^sup>2 - 4 * a * c) * 1 / a) / 2
a \<noteq> 0

goal (1 subgoal):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
\<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a) \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * a * c)) / (2 * a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_eq_UNIV[simp]: "card (S::'a::finite set) = card (UNIV::'a set) \<longleftrightarrow> S=UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card S = card UNIV) = (S = UNIV)
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. card S = card UNIV \<Longrightarrow> x \<in> S
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. card S = card UNIV \<Longrightarrow> x \<in> S
[PROOF STEP]
assume A: "card S = card (UNIV::'a set)"
[PROOF STATE]
proof (state)
this:
card S = card UNIV

goal (1 subgoal):
 1. \<And>x. card S = card UNIV \<Longrightarrow> x \<in> S
[PROOF STEP]
show "x\<in>S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> S
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<notin> S \<Longrightarrow> False
[PROOF STEP]
assume "x\<notin>S"
[PROOF STATE]
proof (state)
this:
x \<notin> S

goal (1 subgoal):
 1. x \<notin> S \<Longrightarrow> False
[PROOF STEP]
hence "S\<subset>UNIV"
[PROOF STATE]
proof (prove)
using this:
x \<notin> S

goal (1 subgoal):
 1. S \<subset> UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<subset> UNIV

goal (1 subgoal):
 1. x \<notin> S \<Longrightarrow> False
[PROOF STEP]
with psubset_card_mono[of UNIV S]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>finite UNIV; S \<subset> UNIV\<rbrakk> \<Longrightarrow> card S < card UNIV
S \<subset> UNIV
[PROOF STEP]
have "card S < card (UNIV::'a set)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite UNIV; S \<subset> UNIV\<rbrakk> \<Longrightarrow> card S < card UNIV
S \<subset> UNIV

goal (1 subgoal):
 1. card S < card UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card S < card UNIV

goal (1 subgoal):
 1. x \<notin> S \<Longrightarrow> False
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
card S = card UNIV
card S < card UNIV
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
card S = card UNIV
card S < card UNIV

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma HComplex_diff [simp]:
  "\<And>x1 y1 x2 y2. HComplex x1 y1 - HComplex x2 y2 = HComplex (x1 - x2) (y1 - y2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 y1 x2 y2. HComplex x1 y1 - HComplex x2 y2 = HComplex (x1 - x2) (y1 - y2)
[PROOF STEP]
by transfer (rule complex_diff)


[STATEMENT]
lemma Log_inverse:
  "\<lbrakk> a > 0; a \<noteq> 1; x > 0 \<rbrakk> \<Longrightarrow> Log a (inverse x) = - Log a x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; a \<noteq> 1; 0 < x\<rbrakk> \<Longrightarrow> Log a (inverse x) = - Log a x
[PROOF STEP]
by (metis Log_powreal_cancel powreal_Log_cancel powreal_minus)


[STATEMENT]
lemma odd_odd_even_nat':
  fixes a b :: nat
  assumes "odd a" "odd b"
  shows "even (((a * b)\<^sup>2 - 1) div 8) \<longleftrightarrow> even (((a\<^sup>2 - 1) div 8) + ((b\<^sup>2 - 1) div 8))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (((a * b)\<^sup>2 - 1) div 8) = even ((a\<^sup>2 - 1) div 8 + (b\<^sup>2 - 1) div 8)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. even (((a * b)\<^sup>2 - 1) div 8) = even ((a\<^sup>2 - 1) div 8 + (b\<^sup>2 - 1) div 8)
[PROOF STEP]
obtain x where [simp]: "a = 2*x + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. a = 2 * x + 1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>odd a\<close>
[PROOF STATE]
proof (prove)
using this:
odd a

goal (1 subgoal):
 1. (\<And>x. a = 2 * x + 1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: oddE)
[PROOF STATE]
proof (state)
this:
a = 2 * x + 1

goal (1 subgoal):
 1. even (((a * b)\<^sup>2 - 1) div 8) = even ((a\<^sup>2 - 1) div 8 + (b\<^sup>2 - 1) div 8)
[PROOF STEP]
obtain y where [simp]: "b = 2*y + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y. b = 2 * y + 1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>odd b\<close>
[PROOF STATE]
proof (prove)
using this:
odd b

goal (1 subgoal):
 1. (\<And>y. b = 2 * y + 1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: oddE)
[PROOF STATE]
proof (state)
this:
b = 2 * y + 1

goal (1 subgoal):
 1. even (((a * b)\<^sup>2 - 1) div 8) = even ((a\<^sup>2 - 1) div 8 + (b\<^sup>2 - 1) div 8)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (((a * b)\<^sup>2 - 1) div 8) = even ((a\<^sup>2 - 1) div 8 + (b\<^sup>2 - 1) div 8)
[PROOF STEP]
by (cases "even x"; cases "even y"; elim oddE evenE)
       (auto simp: power2_eq_square algebra_simps)
[PROOF STATE]
proof (state)
this:
even (((a * b)\<^sup>2 - 1) div 8) = even ((a\<^sup>2 - 1) div 8 + (b\<^sup>2 - 1) div 8)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma log4_log2: "log 4 x = log 2 x / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log 4 x = log 2 x / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. log 4 x = log 2 x / 2
[PROOF STEP]
have "log 4 x = log (2^2) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log 4 x = log (2\<^sup>2) x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
log 4 x = log (2\<^sup>2) x

goal (1 subgoal):
 1. log 4 x = log 2 x / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
log 4 x = log (2\<^sup>2) x

goal (1 subgoal):
 1. log 4 x = log 2 x / 2
[PROOF STEP]
have "\<dots> = log 2 x / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log (2\<^sup>2) x = log 2 x / 2
[PROOF STEP]
by(simp only: log_base_pow)
[PROOF STATE]
proof (state)
this:
log (2\<^sup>2) x = log 2 x / 2

goal (1 subgoal):
 1. log 4 x = log 2 x / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
log 4 x = log 2 x / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
log 4 x = log 2 x / 2

goal (1 subgoal):
 1. log 4 x = log 2 x / 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
log 4 x = log 2 x / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gcd_unique_int:
  "d \<ge> 0 \<and> d dvd a \<and> d dvd b \<and> (\<forall>e. e dvd a \<and> e dvd b \<longrightarrow> e dvd d) \<longleftrightarrow> d = gcd a b"
  for d a :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> d \<and> d dvd a \<and> d dvd b \<and> (\<forall>e. e dvd a \<and> e dvd b \<longrightarrow> e dvd d)) = (d = gcd a b)
[PROOF STEP]
using zdvd_antisym_nonneg
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?m; 0 \<le> ?n; ?m dvd ?n; ?n dvd ?m\<rbrakk> \<Longrightarrow> ?m = ?n

goal (1 subgoal):
 1. (0 \<le> d \<and> d dvd a \<and> d dvd b \<and> (\<forall>e. e dvd a \<and> e dvd b \<longrightarrow> e dvd d)) = (d = gcd a b)
[PROOF STEP]
by auto


[STATEMENT]
lemma real_powr_at_top_neg:
  assumes "(a::real) > 0" "a < 1"
  shows   "((\<lambda>x. a powr x) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((powr) a \<longlongrightarrow> 0) at_top
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((powr) a \<longlongrightarrow> 0) at_top
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < a
a < 1
[PROOF STEP]
have "LIM x at_top. ln (inverse a) * x :> at_top"
[PROOF STATE]
proof (prove)
using this:
0 < a
a < 1

goal (1 subgoal):
 1. filterlim ((*) (ln (inverse a))) at_top at_top
[PROOF STEP]
by (intro filterlim_tendsto_pos_mult_at_top[OF tendsto_const])
       (simp_all add: filterlim_ident field_simps)
[PROOF STATE]
proof (state)
this:
filterlim ((*) (ln (inverse a))) at_top at_top

goal (1 subgoal):
 1. ((powr) a \<longlongrightarrow> 0) at_top
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < a
a < 1
filterlim ((*) (ln (inverse a))) at_top at_top
[PROOF STEP]
have "LIM x at_top. ln a * x :> at_bot"
[PROOF STATE]
proof (prove)
using this:
0 < a
a < 1
filterlim ((*) (ln (inverse a))) at_top at_top

goal (1 subgoal):
 1. filterlim ((*) (ln a)) at_bot at_top
[PROOF STEP]
by (subst filterlim_uminus_at_bot) (simp add: ln_inverse)
[PROOF STATE]
proof (state)
this:
filterlim ((*) (ln a)) at_bot at_top

goal (1 subgoal):
 1. ((powr) a \<longlongrightarrow> 0) at_top
[PROOF STEP]
hence "((\<lambda>x. exp (x * ln a)) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
using this:
filterlim ((*) (ln a)) at_bot at_top

goal (1 subgoal):
 1. ((\<lambda>x. exp (x * ln a)) \<longlongrightarrow> 0) at_top
[PROOF STEP]
by (intro filterlim_compose[OF exp_at_bot]) (simp_all add: mult.commute)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp (x * ln a)) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. ((powr) a \<longlongrightarrow> 0) at_top
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < a
a < 1
((\<lambda>x. exp (x * ln a)) \<longlongrightarrow> 0) at_top
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < a
a < 1
((\<lambda>x. exp (x * ln a)) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. ((powr) a \<longlongrightarrow> 0) at_top
[PROOF STEP]
unfolding powr_def
[PROOF STATE]
proof (prove)
using this:
0 < a
a < 1
((\<lambda>x. exp (x * ln a)) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. ((\<lambda>x. if a = 0 then 0 else exp (x * ln a)) \<longlongrightarrow> 0) at_top
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((powr) a \<longlongrightarrow> 0) at_top

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exponential_distributedI:
  assumes X[measurable]: "X \<in> borel_measurable M" and [arith]: "0 < l"
    and X_distr: "\<And>a. 0 \<le> a \<Longrightarrow> emeasure M {x\<in>space M. X x \<le> a} = 1 - exp (- a * l)"
  shows "distributed M lborel X (exponential_density l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel X (\<lambda>x. ennreal (exponential_density l x))
[PROOF STEP]
proof (rule erlang_distributedI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. X \<in> borel_measurable M
 2. 0 < l
 3. \<And>a. 0 \<le> a \<Longrightarrow> emeasure M {x \<in> space M. X x \<le> a} = ennreal (erlang_CDF 0 l a)
[PROOF STEP]
fix a :: real
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. X \<in> borel_measurable M
 2. 0 < l
 3. \<And>a. 0 \<le> a \<Longrightarrow> emeasure M {x \<in> space M. X x \<le> a} = ennreal (erlang_CDF 0 l a)
[PROOF STEP]
assume "0 \<le> a"
[PROOF STATE]
proof (state)
this:
0 \<le> a

goal (3 subgoals):
 1. X \<in> borel_measurable M
 2. 0 < l
 3. \<And>a. 0 \<le> a \<Longrightarrow> emeasure M {x \<in> space M. X x \<le> a} = ennreal (erlang_CDF 0 l a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> a
[PROOF STEP]
show "emeasure M {x \<in> space M. X x \<le> a} = ennreal (erlang_CDF 0 l a)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> a

goal (1 subgoal):
 1. emeasure M {x \<in> space M. X x \<le> a} = ennreal (erlang_CDF 0 l a)
[PROOF STEP]
using X_distr[of a]
[PROOF STATE]
proof (prove)
using this:
0 \<le> a
0 \<le> a \<Longrightarrow> emeasure M {x \<in> space M. X x \<le> a} = 1 - ennreal (exp (- a * l))

goal (1 subgoal):
 1. emeasure M {x \<in> space M. X x \<le> a} = ennreal (erlang_CDF 0 l a)
[PROOF STEP]
by (simp add: erlang_CDF_def ennreal_minus ennreal_1[symmetric] del: ennreal_1)
[PROOF STATE]
proof (state)
this:
emeasure M {x \<in> space M. X x \<le> a} = ennreal (erlang_CDF 0 l a)

goal (2 subgoals):
 1. X \<in> borel_measurable M
 2. 0 < l
[PROOF STEP]
qed fact+


[STATEMENT]
lemma round_down_shift: "round_down p (x * 2 powr k) = 2 powr k * round_down (p + k) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round_down p (x * 2 powr real_of_int k) = 2 powr real_of_int k * round_down (p + k) x
[PROOF STEP]
unfolding round_down_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<lfloor>x * 2 powr real_of_int k * 2 powr real_of_int p\<rfloor> * 2 powr - real_of_int p = 2 powr real_of_int k * (real_of_int \<lfloor>x * 2 powr real_of_int (p + k)\<rfloor> * 2 powr - real_of_int (p + k))
[PROOF STEP]
by (simp add: powr_add powr_mult field_simps powr_diff)
    (simp flip: powr_add)


[STATEMENT]
lemma local_lipschitz_therm_dyn:
  assumes "0 < (a::real)"
  shows "local_lipschitz UNIV UNIV (\<lambda>t::real. f a L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local_lipschitz UNIV UNIV (\<lambda>t. f a L)
[PROOF STEP]
apply(unfold local_lipschitz_def lipschitz_on_def dist_norm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. \<forall>t\<in>UNIV. \<exists>u>0. \<exists>La. \<forall>t\<in>cball t u \<inter> UNIV. 0 \<le> La \<and> (\<forall>xa\<in>cball x u \<inter> UNIV. \<forall>y\<in>cball x u \<inter> UNIV. \<parallel>f a L xa - f a L y\<parallel> \<le> La \<cdot> \<parallel>xa - y\<parallel>)
[PROOF STEP]
apply(clarsimp, rule_tac x=1 in exI, clarsimp, rule_tac x=a in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t ta. dist t ta \<le> 1 \<Longrightarrow> 0 \<le> a \<and> (\<forall>xa\<in>cball x 1. \<forall>y\<in>cball x 1. \<parallel>f a L xa - f a L y\<parallel> \<le> a \<cdot> \<parallel>xa - y\<parallel>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. \<And>x t ta. dist t ta \<le> 1 \<Longrightarrow> 0 \<le> a \<and> (\<forall>xa\<in>cball x 1. \<forall>y\<in>cball x 1. \<parallel>f a L xa - f a L y\<parallel> \<le> a \<cdot> \<parallel>xa - y\<parallel>)
[PROOF STEP]
apply(simp_all add: norm_diff_therm_dyn)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t ta. \<lbrakk>dist t ta \<le> 1; 0 < a\<rbrakk> \<Longrightarrow> \<forall>xa\<in>cball x 1. \<forall>y\<in>cball x 1. \<bar>xa $ 1 - y $ 1\<bar> \<le> \<parallel>xa - y\<parallel>
[PROOF STEP]
apply(simp add: norm_vec_def L2_set_def, unfold UNIV_4, clarsimp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t ta xa y. \<lbrakk>dist t ta \<le> 1; 0 < a; dist x xa \<le> 1; dist x y \<le> 1\<rbrakk> \<Longrightarrow> \<bar>xa $ 1 - y $ 1\<bar> \<le> sqrt ((xa $ 1 - y $ 1)\<^sup>2 + ((xa $ 2 - y $ 2)\<^sup>2 + ((xa $ 3 - y $ 3)\<^sup>2 + (xa $ 4 - y $ 4)\<^sup>2)))
[PROOF STEP]
unfolding real_sqrt_abs[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t ta xa y. \<lbrakk>dist t ta \<le> 1; 0 < a; dist x xa \<le> 1; dist x y \<le> 1\<rbrakk> \<Longrightarrow> sqrt ((xa $ 1 - y $ 1)\<^sup>2) \<le> sqrt ((xa $ 1 - y $ 1)\<^sup>2 + ((xa $ 2 - y $ 2)\<^sup>2 + ((xa $ 3 - y $ 3)\<^sup>2 + (xa $ 4 - y $ 4)\<^sup>2)))
[PROOF STEP]
by (rule real_le_lsqrt) auto


[STATEMENT]
lemma mat_plus_left_mono: "A \<ge>\<^sub>m (B :: 'a :: ordered_ab_semigroup mat)
  \<Longrightarrow> A \<in> carrier_mat nr nc \<Longrightarrow> B \<in> carrier_mat nr nc \<Longrightarrow> C \<in> carrier_mat nr nc
  \<Longrightarrow> A + C \<ge>\<^sub>m B + C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<ge>\<^sub>m B; A \<in> carrier_mat nr nc; B \<in> carrier_mat nr nc; C \<in> carrier_mat nr nc\<rbrakk> \<Longrightarrow> A + C \<ge>\<^sub>m B + C
[PROOF STEP]
by (intro mat_geI[of _ nr nc], auto simp: plus_left_mono)


[STATEMENT]
lemma ceiling_zero [simp]: "\<lceil>0\<rceil> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>0::'a\<rceil> = 0
[PROOF STEP]
using ceiling_of_int [of 0]
[PROOF STATE]
proof (prove)
using this:
\<lceil>of_int 0\<rceil> = 0

goal (1 subgoal):
 1. \<lceil>0::'a\<rceil> = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma neg_of_aezfun_is_aezfun :
  fixes     f :: "'a\<Rightarrow>'b::group_add"
  shows     "f \<in> aezfun_set \<Longrightarrow> - f \<in> aezfun_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> aezfun_set \<Longrightarrow> - f \<in> aezfun_set
[PROOF STEP]
using     supp_neg_eq_supp[of f]
[PROOF STATE]
proof (prove)
using this:
supp (- f) = supp f

goal (1 subgoal):
 1. f \<in> aezfun_set \<Longrightarrow> - f \<in> aezfun_set
[PROOF STEP]
unfolding aezfun_set_def
[PROOF STATE]
proof (prove)
using this:
supp (- f) = supp f

goal (1 subgoal):
 1. f \<in> {f. finite (supp f)} \<Longrightarrow> - f \<in> {f. finite (supp f)}
[PROOF STEP]
by        simp


[STATEMENT]
lemma LIMSEQ_const_iff: "(\<lambda>n. k) \<longlonglongrightarrow> l \<longleftrightarrow> k = l"
  for k l :: "'a::t2_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. k) \<longlonglongrightarrow> l = (k = l)
[PROOF STEP]
using trivial_limit_sequentially
[PROOF STATE]
proof (prove)
using this:
sequentially \<noteq> bot

goal (1 subgoal):
 1. (\<lambda>n. k) \<longlonglongrightarrow> l = (k = l)
[PROOF STEP]
by (rule tendsto_const_iff)


[STATEMENT]
theorem card_partial_equiv:
  assumes "finite A"
  shows "card {R. partial_equiv A R} = Bell (card A + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
let ?expr = "do {
      k \<leftarrow> {0..card A};
      A' \<leftarrow> {A'. A' \<subseteq> A \<and> card A' = k};
      {R. equiv A' R}
    }"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
have "card {R. partial_equiv A R} = card (all_partial_equivs_on A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {R. partial_equiv A R} = card (all_partial_equivs_on A)
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. card {R. partial_equiv A R} = card (all_partial_equivs_on A)
[PROOF STEP]
by (simp add: all_partial_equivs_on)
[PROOF STATE]
proof (state)
this:
card {R. partial_equiv A R} = card (all_partial_equivs_on A)

goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {R. partial_equiv A R} = card (all_partial_equivs_on A)

goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
have "card (all_partial_equivs_on A) = card ?expr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_partial_equivs_on A) = card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})))
[PROOF STEP]
unfolding all_partial_equivs_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. Collect (equiv A')))) = card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
card (all_partial_equivs_on A) = card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})))

goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (all_partial_equivs_on A) = card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})))

goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
have "card ?expr = (\<Sum>k = 0..card A. (card A choose k) * Bell k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
let "?S \<bind> ?comp" = ?expr
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
assume k: "k \<in> {..card A}"
[PROOF STATE]
proof (state)
this:
k \<in> {..card A}

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
let ?expr = "?comp k"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
let "?S \<bind> ?comp" = ?expr
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
have "finite ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {A'. A' \<subseteq> A \<and> card A' = k}
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. finite {A'. A' \<subseteq> A \<and> card A' = k}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {A'. A' \<subseteq> A \<and> card A' = k}

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {A'. A' \<subseteq> A \<and> card A' = k}

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
finite {A'. A' \<subseteq> A \<and> card A' = k}

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
fix A'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
assume A': "A' \<in> {A'. A' \<subseteq> A \<and> card A' = k}"
[PROOF STATE]
proof (state)
this:
A' \<in> {A'. A' \<subseteq> A \<and> card A' = k}

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
A' \<in> {A'. A' \<subseteq> A \<and> card A' = k}
[PROOF STEP]
have "A' \<subseteq> A" and "card A' = k"
[PROOF STATE]
proof (prove)
using this:
A' \<in> {A'. A' \<subseteq> A \<and> card A' = k}

goal (1 subgoal):
 1. A' \<subseteq> A &&& card A' = k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A' \<subseteq> A
card A' = k

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
let ?expr = "?comp A'"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
have "finite A'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A'
[PROOF STEP]
using \<open>finite A\<close> \<open>A' \<subseteq> A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
A' \<subseteq> A

goal (1 subgoal):
 1. finite A'
[PROOF STEP]
by (simp add: finite_subset)
[PROOF STATE]
proof (state)
this:
finite A'

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
have "card ?expr = Bell k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {R. equiv A' R} = Bell k
[PROOF STEP]
using \<open>finite A\<close> \<open>finite A'\<close> \<open>A' \<subseteq> A\<close> \<open>card A' = k\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite A'
A' \<subseteq> A
card A' = k

goal (1 subgoal):
 1. card {R. equiv A' R} = Bell k
[PROOF STEP]
by (simp add: card_equiv_rel_eq_Bell)
[PROOF STATE]
proof (state)
this:
card {R. equiv A' R} = Bell k

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card {R. equiv A' R} = Bell k

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
have "finite ?expr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {R. equiv A' R}
[PROOF STEP]
using \<open>finite A'\<close>
[PROOF STATE]
proof (prove)
using this:
finite A'

goal (1 subgoal):
 1. finite {R. equiv A' R}
[PROOF STEP]
by (simp add: finite_equiv)
[PROOF STATE]
proof (state)
this:
finite {R. equiv A' R}

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card {R. equiv A' R} = Bell k
finite {R. equiv A' R}
[PROOF STEP]
have "finite ?expr \<and> card ?expr = Bell k"
[PROOF STATE]
proof (prove)
using this:
card {R. equiv A' R} = Bell k
finite {R. equiv A' R}

goal (1 subgoal):
 1. finite {R. equiv A' R} \<and> card {R. equiv A' R} = Bell k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite {R. equiv A' R} \<and> card {R. equiv A' R} = Bell k

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?A'2 \<in> {A'. A' \<subseteq> A \<and> card A' = k} \<Longrightarrow> finite {R. equiv ?A'2 R} \<and> card {R. equiv ?A'2 R} = Bell k

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
note inner = this
[PROOF STATE]
proof (state)
this:
?A'2 \<in> {A'. A' \<subseteq> A \<and> card A' = k} \<Longrightarrow> finite {R. equiv ?A'2 R} \<and> card {R. equiv ?A'2 R} = Bell k

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?A'2 \<in> {A'. A' \<subseteq> A \<and> card A' = k} \<Longrightarrow> finite {R. equiv ?A'2 R} \<and> card {R. equiv ?A'2 R} = Bell k

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
have "disjoint_family_on ?comp ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint_family_on (\<lambda>A'. {R. equiv A' R}) {A'. A' \<subseteq> A \<and> card A' = k}
[PROOF STEP]
by (injectivity_solver rule: injectivity(1))
[PROOF STATE]
proof (state)
this:
disjoint_family_on (\<lambda>A'. {R. equiv A' R}) {A'. A' \<subseteq> A \<and> card A' = k}

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
disjoint_family_on (\<lambda>A'. {R. equiv A' R}) {A'. A' \<subseteq> A \<and> card A' = k}

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
have "card ?S = card A choose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {A'. A' \<subseteq> A \<and> card A' = k} = card A choose k
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. card {A'. A' \<subseteq> A \<and> card A' = k} = card A choose k
[PROOF STEP]
by (simp add: n_subsets)
[PROOF STATE]
proof (state)
this:
card {A'. A' \<subseteq> A \<and> card A' = k} = card A choose k

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {A'. A' \<subseteq> A \<and> card A' = k}
?A'2 \<in> {A'. A' \<subseteq> A \<and> card A' = k} \<Longrightarrow> finite {R. equiv ?A'2 R} \<and> card {R. equiv ?A'2 R} = Bell k
disjoint_family_on (\<lambda>A'. {R. equiv A' R}) {A'. A' \<subseteq> A \<and> card A' = k}
card {A'. A' \<subseteq> A \<and> card A' = k} = card A choose k
[PROOF STEP]
have "card ?expr = (card A choose k) * Bell k" (is "_ = ?formula")
[PROOF STATE]
proof (prove)
using this:
finite {A'. A' \<subseteq> A \<and> card A' = k}
?A'2 \<in> {A'. A' \<subseteq> A \<and> card A' = k} \<Longrightarrow> finite {R. equiv ?A'2 R} \<and> card {R. equiv ?A'2 R} = Bell k
disjoint_family_on (\<lambda>A'. {R. equiv A' R}) {A'. A' \<subseteq> A \<and> card A' = k}
card {A'. A' \<subseteq> A \<and> card A' = k} = card A choose k

goal (1 subgoal):
 1. card ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) = (card A choose k) * Bell k
[PROOF STEP]
by (subst card_bind_constant) auto
[PROOF STATE]
proof (state)
this:
card ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) = (card A choose k) * Bell k

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) = (card A choose k) * Bell k

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
have "finite ?expr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))
[PROOF STEP]
using \<open>finite ?S\<close> inner
[PROOF STATE]
proof (prove)
using this:
finite {A'. A' \<subseteq> A \<and> card A' = k}
?A'2 \<in> {A'. A' \<subseteq> A \<and> card A' = k} \<Longrightarrow> finite {R. equiv ?A'2 R} \<and> card {R. equiv ?A'2 R} = Bell k

goal (1 subgoal):
 1. finite ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))
[PROOF STEP]
by (auto intro!: finite_bind)
[PROOF STATE]
proof (state)
this:
finite ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) = (card A choose k) * Bell k
finite ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))
[PROOF STEP]
have "finite ?expr \<and> card ?expr = ?formula"
[PROOF STATE]
proof (prove)
using this:
card ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) = (card A choose k) * Bell k
finite ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))

goal (1 subgoal):
 1. finite ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) \<and> card ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) = (card A choose k) * Bell k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) \<and> card ({A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) = (card A choose k) * Bell k

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?k2 \<in> {..card A} \<Longrightarrow> finite ({A'. A' \<subseteq> A \<and> card A' = ?k2} \<bind> (\<lambda>A'. {R. equiv A' R})) \<and> card ({A'. A' \<subseteq> A \<and> card A' = ?k2} \<bind> (\<lambda>A'. {R. equiv A' R})) = (card A choose ?k2) * Bell ?k2

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?k2 \<in> {..card A} \<Longrightarrow> finite ({A'. A' \<subseteq> A \<and> card A' = ?k2} \<bind> (\<lambda>A'. {R. equiv A' R})) \<and> card ({A'. A' \<subseteq> A \<and> card A' = ?k2} \<bind> (\<lambda>A'. {R. equiv A' R})) = (card A choose ?k2) * Bell ?k2

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
have "finite ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {0..card A}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {0..card A}

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {0..card A}

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
have "disjoint_family_on ?comp ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint_family_on (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) {0..card A}
[PROOF STEP]
by (injectivity_solver rule: injectivity(2))
[PROOF STATE]
proof (state)
this:
disjoint_family_on (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) {0..card A}

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?k2 \<in> {..card A} \<Longrightarrow> finite ({A'. A' \<subseteq> A \<and> card A' = ?k2} \<bind> (\<lambda>A'. {R. equiv A' R})) \<and> card ({A'. A' \<subseteq> A \<and> card A' = ?k2} \<bind> (\<lambda>A'. {R. equiv A' R})) = (card A choose ?k2) * Bell ?k2
finite {0..card A}
disjoint_family_on (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) {0..card A}
[PROOF STEP]
show "card ?expr = (\<Sum>k = 0..card A. (card A choose k) * Bell k)"
[PROOF STATE]
proof (prove)
using this:
?k2 \<in> {..card A} \<Longrightarrow> finite ({A'. A' \<subseteq> A \<and> card A' = ?k2} \<bind> (\<lambda>A'. {R. equiv A' R})) \<and> card ({A'. A' \<subseteq> A \<and> card A' = ?k2} \<bind> (\<lambda>A'. {R. equiv A' R})) = (card A choose ?k2) * Bell ?k2
finite {0..card A}
disjoint_family_on (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R})) {0..card A}

goal (1 subgoal):
 1. card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)
[PROOF STEP]
by (subst card_bind) auto
[PROOF STATE]
proof (state)
this:
card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)

goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ({0..card A} \<bind> (\<lambda>k. {A'. A' \<subseteq> A \<and> card A' = k} \<bind> (\<lambda>A'. {R. equiv A' R}))) = (\<Sum>k = 0..card A. (card A choose k) * Bell k)

goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
have "\<dots> = (\<Sum>k\<le>card A. (card A choose k) * Bell k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..card A. (card A choose k) * Bell k) = (\<Sum>k\<le>card A. (card A choose k) * Bell k)
[PROOF STEP]
by (auto intro: sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..card A. (card A choose k) * Bell k) = (\<Sum>k\<le>card A. (card A choose k) * Bell k)

goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..card A. (card A choose k) * Bell k) = (\<Sum>k\<le>card A. (card A choose k) * Bell k)

goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
have "\<dots> = Bell (card A + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>card A. (card A choose k) * Bell k) = Bell (card A + 1)
[PROOF STEP]
using Bell_recursive_eq
[PROOF STATE]
proof (prove)
using this:
Bell (?n + 1) = (\<Sum>k\<le>?n. (?n choose k) * Bell k)

goal (1 subgoal):
 1. (\<Sum>k\<le>card A. (card A choose k) * Bell k) = Bell (card A + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>card A. (card A choose k) * Bell k) = Bell (card A + 1)

goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {R. partial_equiv A R} = Bell (card A + 1)

goal (1 subgoal):
 1. card {R. partial_equiv A R} = Bell (card A + 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {R. partial_equiv A R} = Bell (card A + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma countable_UN[intro, simp]:
  fixes I :: "'i set" and A :: "'i => 'a set"
  assumes I: "countable I"
  assumes A: "\<And>i. i \<in> I \<Longrightarrow> countable (A i)"
  shows "countable (\<Union>i\<in>I. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable (\<Union> (A ` I))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. countable (\<Union> (A ` I))
[PROOF STEP]
have "(\<Union>i\<in>I. A i) = snd ` (SIGMA i : I. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (A ` I) = snd ` Sigma I A
[PROOF STEP]
by (auto simp: image_iff)
[PROOF STATE]
proof (state)
this:
\<Union> (A ` I) = snd ` Sigma I A

goal (1 subgoal):
 1. countable (\<Union> (A ` I))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<Union> (A ` I) = snd ` Sigma I A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Union> (A ` I) = snd ` Sigma I A

goal (1 subgoal):
 1. countable (\<Union> (A ` I))
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
countable (\<Union> (A ` I))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Youngs_inequality:
  fixes p::real
  assumes "p>1" "q>1" "1/p + 1/q = 1" "a\<ge>0" "b\<ge>0"
  shows "a * b \<le> a powr p / p + b powr q / q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * b \<le> a powr p / p + b powr q / q
[PROOF STEP]
proof (cases "a=0 \<or> b=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> a * b \<le> a powr p / p + b powr q / q
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> a * b \<le> a powr p / p + b powr q / q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (a = 0 \<or> b = 0)

goal (2 subgoals):
 1. a = 0 \<or> b = 0 \<Longrightarrow> a * b \<le> a powr p / p + b powr q / q
 2. \<not> (a = 0 \<or> b = 0) \<Longrightarrow> a * b \<le> a powr p / p + b powr q / q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (a = 0 \<or> b = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (a = 0 \<or> b = 0)

goal (1 subgoal):
 1. a * b \<le> a powr p / p + b powr q / q
[PROOF STEP]
using Youngs_inequality_0 [of "1/p" "1/q" "a powr p" "b powr q"] assms
[PROOF STATE]
proof (prove)
using this:
\<not> (a = 0 \<or> b = 0)
\<lbrakk>0 \<le> 1 / p; 0 \<le> 1 / q; 1 / p + 1 / q = 1; 0 < a powr p; 0 < b powr q\<rbrakk> \<Longrightarrow> (a powr p) powr (1 / p) * (b powr q) powr (1 / q) \<le> 1 / p * a powr p + 1 / q * b powr q
1 < p
1 < q
1 / p + 1 / q = 1
0 \<le> a
0 \<le> b

goal (1 subgoal):
 1. a * b \<le> a powr p / p + b powr q / q
[PROOF STEP]
by (simp add: powr_powr)
[PROOF STATE]
proof (state)
this:
a * b \<le> a powr p / p + b powr q / q

goal (1 subgoal):
 1. a = 0 \<or> b = 0 \<Longrightarrow> a * b \<le> a powr p / p + b powr q / q
[PROOF STEP]
qed (use assms in auto)


[STATEMENT]
lemma unitary_operator_keep_trace:
  fixes U A :: "complex mat"
  assumes dU: "U \<in> carrier_mat n n" and dA: "A \<in> carrier_mat n n" and u: "unitary U"
  shows "trace A = trace (adjoint U * A * U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace A = trace (adjoint U * A * U)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. trace A = trace (adjoint U * A * U)
[PROOF STEP]
have u': "U * adjoint U = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U * adjoint U = 1\<^sub>m n
[PROOF STEP]
using u
[PROOF STATE]
proof (prove)
using this:
unitary U

goal (1 subgoal):
 1. U * adjoint U = 1\<^sub>m n
[PROOF STEP]
unfolding unitary_def inverts_mat_def
[PROOF STATE]
proof (prove)
using this:
U \<in> carrier_mat (dim_row U) (dim_row U) \<and> U * adjoint U = 1\<^sub>m (dim_row U)

goal (1 subgoal):
 1. U * adjoint U = 1\<^sub>m n
[PROOF STEP]
using dU
[PROOF STATE]
proof (prove)
using this:
U \<in> carrier_mat (dim_row U) (dim_row U) \<and> U * adjoint U = 1\<^sub>m (dim_row U)
U \<in> carrier_mat n n

goal (1 subgoal):
 1. U * adjoint U = 1\<^sub>m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U * adjoint U = 1\<^sub>m n

goal (1 subgoal):
 1. trace A = trace (adjoint U * A * U)
[PROOF STEP]
have "trace (adjoint U * A * U) = trace (U * adjoint U * A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (adjoint U * A * U) = trace (U * adjoint U * A)
[PROOF STEP]
using dU dA
[PROOF STATE]
proof (prove)
using this:
U \<in> carrier_mat n n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (adjoint U * A * U) = trace (U * adjoint U * A)
[PROOF STEP]
by (mat_assoc n)
[PROOF STATE]
proof (state)
this:
trace (adjoint U * A * U) = trace (U * adjoint U * A)

goal (1 subgoal):
 1. trace A = trace (adjoint U * A * U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (adjoint U * A * U) = trace (U * adjoint U * A)

goal (1 subgoal):
 1. trace A = trace (adjoint U * A * U)
[PROOF STEP]
have "\<dots> = trace A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (U * adjoint U * A) = trace A
[PROOF STEP]
using u' dA
[PROOF STATE]
proof (prove)
using this:
U * adjoint U = 1\<^sub>m n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (U * adjoint U * A) = trace A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (U * adjoint U * A) = trace A

goal (1 subgoal):
 1. trace A = trace (adjoint U * A * U)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
trace (adjoint U * A * U) = trace A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
trace (adjoint U * A * U) = trace A

goal (1 subgoal):
 1. trace A = trace (adjoint U * A * U)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace A = trace (adjoint U * A * U)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_all_edges_loops:
  assumes "finite S"
  shows "card (all_edges_loops S) = (card S) choose 2 + card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_edges_loops S) = card S choose 2 + card S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (all_edges_loops S) = card S choose 2 + card S
[PROOF STEP]
have "card (all_edges_loops S) = card (all_edges S \<union> {{v} | v. v \<in> S})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_edges_loops S) = card (all_edges S \<union> {{v} |v. v \<in> S})
[PROOF STEP]
by (simp add: all_edges_loops_def)
[PROOF STATE]
proof (state)
this:
card (all_edges_loops S) = card (all_edges S \<union> {{v} |v. v \<in> S})

goal (1 subgoal):
 1. card (all_edges_loops S) = card S choose 2 + card S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (all_edges_loops S) = card (all_edges S \<union> {{v} |v. v \<in> S})

goal (1 subgoal):
 1. card (all_edges_loops S) = card S choose 2 + card S
[PROOF STEP]
have "... = card (all_edges S) + card {{v} | v. v \<in> S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_edges S \<union> {{v} |v. v \<in> S}) = card (all_edges S) + card {{v} |v. v \<in> S}
[PROOF STEP]
using loops_disjoint assms card_Un_disjoint[of "all_edges S" "{{v} | v. v \<in> S}"]
      all_edges_loops_ss finite_all_edges_loops finite_subset
[PROOF STATE]
proof (prove)
using this:
all_edges ?S \<inter> {{v} |v. v \<in> ?S} = {}
finite S
\<lbrakk>finite (all_edges S); finite {{v} |v. v \<in> S}; all_edges S \<inter> {{v} |v. v \<in> S} = {}\<rbrakk> \<Longrightarrow> card (all_edges S \<union> {{v} |v. v \<in> S}) = card (all_edges S) + card {{v} |v. v \<in> S}
all_edges ?S \<subseteq> all_edges_loops ?S
{{v} |v. v \<in> ?S} \<subseteq> all_edges_loops ?S
finite ?S \<Longrightarrow> finite (all_edges_loops ?S)
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. card (all_edges S \<union> {{v} |v. v \<in> S}) = card (all_edges S) + card {{v} |v. v \<in> S}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
card (all_edges S \<union> {{v} |v. v \<in> S}) = card (all_edges S) + card {{v} |v. v \<in> S}

goal (1 subgoal):
 1. card (all_edges_loops S) = card S choose 2 + card S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (all_edges S \<union> {{v} |v. v \<in> S}) = card (all_edges S) + card {{v} |v. v \<in> S}

goal (1 subgoal):
 1. card (all_edges_loops S) = card S choose 2 + card S
[PROOF STEP]
have "... = (card S) choose 2 + card {{v} | v. v \<in> S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_edges S) + card {{v} |v. v \<in> S} = card S choose 2 + card {{v} |v. v \<in> S}
[PROOF STEP]
by(simp add: card_all_edges assms)
[PROOF STATE]
proof (state)
this:
card (all_edges S) + card {{v} |v. v \<in> S} = card S choose 2 + card {{v} |v. v \<in> S}

goal (1 subgoal):
 1. card (all_edges_loops S) = card S choose 2 + card S
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (all_edges_loops S) = card S choose 2 + card {{v} |v. v \<in> S}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (all_edges_loops S) = card S choose 2 + card {{v} |v. v \<in> S}

goal (1 subgoal):
 1. card (all_edges_loops S) = card S choose 2 + card S
[PROOF STEP]
using assms card_singletons
[PROOF STATE]
proof (prove)
using this:
card (all_edges_loops S) = card S choose 2 + card {{v} |v. v \<in> S}
finite S
finite ?S \<Longrightarrow> card {{v} |v. v \<in> ?S} = card ?S

goal (1 subgoal):
 1. card (all_edges_loops S) = card S choose 2 + card S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (all_edges_loops S) = card S choose 2 + card S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unique_cross_ratio:
  assumes "u \<noteq> v" and "v \<noteq> w" and "u \<noteq> w"
  assumes "cross_ratio z u v w = cross_ratio z' u v w"
  shows "z = z'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z = z'
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z = z'
[PROOF STEP]
obtain M where "(\<lambda> z. cross_ratio z u v w) = moebius_pt M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>M. (\<lambda>z. cross_ratio z u v w) = moebius_pt M \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using is_moebius_cross_ratio[OF assms(1-3)]
[PROOF STATE]
proof (prove)
using this:
is_moebius (\<lambda>z. cross_ratio z u v w)

goal (1 subgoal):
 1. (\<And>M. (\<lambda>z. cross_ratio z u v w) = moebius_pt M \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding is_moebius_def
[PROOF STATE]
proof (prove)
using this:
\<exists>M. (\<lambda>z. cross_ratio z u v w) = moebius_pt M

goal (1 subgoal):
 1. (\<And>M. (\<lambda>z. cross_ratio z u v w) = moebius_pt M \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>z. cross_ratio z u v w) = moebius_pt M

goal (1 subgoal):
 1. z = z'
[PROOF STEP]
hence "moebius_pt M z = moebius_pt M z'"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>z. cross_ratio z u v w) = moebius_pt M

goal (1 subgoal):
 1. moebius_pt M z = moebius_pt M z'
[PROOF STEP]
using assms(4)
[PROOF STATE]
proof (prove)
using this:
(\<lambda>z. cross_ratio z u v w) = moebius_pt M
cross_ratio z u v w = cross_ratio z' u v w

goal (1 subgoal):
 1. moebius_pt M z = moebius_pt M z'
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
moebius_pt M z = moebius_pt M z'

goal (1 subgoal):
 1. z = z'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
moebius_pt M z = moebius_pt M z'

goal (1 subgoal):
 1. z = z'
[PROOF STEP]
using moebius_pt_eq_I
[PROOF STATE]
proof (prove)
using this:
moebius_pt M z = moebius_pt M z'
moebius_pt ?M ?z1.0 = moebius_pt ?M ?z2.0 \<Longrightarrow> ?z1.0 = ?z2.0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma absolutely_integrable_mult_Dirichlet_kernel:
  assumes "f absolutely_integrable_on {-pi..pi}"
  shows "(\<lambda>x. Dirichlet_kernel n x * f x) absolutely_integrable_on {-pi..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. Dirichlet_kernel n x * f x) absolutely_integrable_on {- pi..pi}
[PROOF STEP]
proof (rule absolutely_integrable_bounded_measurable_product_real)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. Dirichlet_kernel n \<in> borel_measurable (lebesgue_on {- pi..pi})
 2. {- pi..pi} \<in> sets lebesgue
 3. bounded (Dirichlet_kernel n ` {- pi..pi})
 4. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
show "Dirichlet_kernel n \<in> borel_measurable (lebesgue_on {-pi..pi})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Dirichlet_kernel n \<in> borel_measurable (lebesgue_on {- pi..pi})
[PROOF STEP]
by (simp add: Dirichlet_kernel_continuous continuous_imp_measurable_on_sets_lebesgue)
[PROOF STATE]
proof (state)
this:
Dirichlet_kernel n \<in> borel_measurable (lebesgue_on {- pi..pi})

goal (3 subgoals):
 1. {- pi..pi} \<in> sets lebesgue
 2. bounded (Dirichlet_kernel n ` {- pi..pi})
 3. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
have "compact (Dirichlet_kernel n ` {-pi..pi})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (Dirichlet_kernel n ` {- pi..pi})
[PROOF STEP]
by (auto simp: compact_continuous_image [OF Dirichlet_kernel_continuous])
[PROOF STATE]
proof (state)
this:
compact (Dirichlet_kernel n ` {- pi..pi})

goal (3 subgoals):
 1. {- pi..pi} \<in> sets lebesgue
 2. bounded (Dirichlet_kernel n ` {- pi..pi})
 3. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
compact (Dirichlet_kernel n ` {- pi..pi})
[PROOF STEP]
show "bounded (Dirichlet_kernel n ` {-pi..pi})"
[PROOF STATE]
proof (prove)
using this:
compact (Dirichlet_kernel n ` {- pi..pi})

goal (1 subgoal):
 1. bounded (Dirichlet_kernel n ` {- pi..pi})
[PROOF STEP]
using compact_imp_bounded
[PROOF STATE]
proof (prove)
using this:
compact (Dirichlet_kernel n ` {- pi..pi})
compact ?U \<Longrightarrow> bounded ?U

goal (1 subgoal):
 1. bounded (Dirichlet_kernel n ` {- pi..pi})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bounded (Dirichlet_kernel n ` {- pi..pi})

goal (2 subgoals):
 1. {- pi..pi} \<in> sets lebesgue
 2. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
qed (use assms in auto)


[STATEMENT]
lemma abs_ln_one_plus_x_minus_x_bound:
  fixes x :: real
  assumes "\<bar>x\<bar> \<le> 1 / 2"
  shows "\<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
proof (cases "0 \<le> x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> x \<Longrightarrow> \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
 2. \<not> 0 \<le> x \<Longrightarrow> \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 \<le> x

goal (2 subgoals):
 1. 0 \<le> x \<Longrightarrow> \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
 2. \<not> 0 \<le> x \<Longrightarrow> \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> x

goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
using abs_ln_one_plus_x_minus_x_bound_nonneg assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
\<lbrakk>0 \<le> ?x; ?x \<le> 1\<rbrakk> \<Longrightarrow> \<bar>ln (1 + ?x) - ?x\<bar> \<le> ?x\<^sup>2
\<bar>x\<bar> \<le> 1 / 2

goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2

goal (1 subgoal):
 1. \<not> 0 \<le> x \<Longrightarrow> \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 0 \<le> x \<Longrightarrow> \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 \<le> x

goal (1 subgoal):
 1. \<not> 0 \<le> x \<Longrightarrow> \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> 0 \<le> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> 0 \<le> x

goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
using abs_ln_one_plus_x_minus_x_bound_nonpos assms
[PROOF STATE]
proof (prove)
using this:
\<not> 0 \<le> x
\<lbrakk>- (1 / 2) \<le> ?x; ?x \<le> 0\<rbrakk> \<Longrightarrow> \<bar>ln (1 + ?x) - ?x\<bar> \<le> 2 * ?x\<^sup>2
\<bar>x\<bar> \<le> 1 / 2

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "count_true (vec (2::nat) (\<lambda>i. True)) = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_true (vec 2 (\<lambda>i. True)) = 2
[PROOF STEP]
unfolding count_true_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (vec 2 (\<lambda>i. True)). if vec 2 (\<lambda>i. True) $ i then 1 else 0) = 2
[PROOF STEP]
by simp


[STATEMENT]
lemma sin_tan_half: "sin (2*x) = 2 * tan x / (1 + (tan x)^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin ((2::'a) * x) = (2::'a) * tan x / ((1::'a) + (tan x)\<^sup>2)
[PROOF STEP]
unfolding sin_double tan_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2::'a) * sin x * cos x = (2::'a) * (sin x / cos x) / ((1::'a) + (sin x / cos x)\<^sup>2)
[PROOF STEP]
apply (cases "cos x=0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. cos x = (0::'a) \<Longrightarrow> (2::'a) * sin x * cos x = (2::'a) * (sin x / cos x) / ((1::'a) + (sin x / cos x)\<^sup>2)
 2. cos x \<noteq> (0::'a) \<Longrightarrow> (2::'a) * sin x * cos x = (2::'a) * (sin x / cos x) / ((1::'a) + (sin x / cos x)\<^sup>2)
[PROOF STEP]
by (auto simp add:field_simps power2_eq_square)


[STATEMENT]
lemma cos_periodic_nat[simp]:
  fixes n :: nat
  shows "cos (x + n * (2 * pi)) = cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x + real n * (2 * pi)) = cos x
[PROOF STEP]
proof (induct n arbitrary: x)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. cos (x + real 0 * (2 * pi)) = cos x
 2. \<And>n x. (\<And>x. cos (x + real n * (2 * pi)) = cos x) \<Longrightarrow> cos (x + real (Suc n) * (2 * pi)) = cos x
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>x. cos (x + real 0 * (2 * pi)) = cos x
 2. \<And>n x. (\<And>x. cos (x + real n * (2 * pi)) = cos x) \<Longrightarrow> cos (x + real (Suc n) * (2 * pi)) = cos x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x + real 0 * (2 * pi)) = cos x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cos (x + real 0 * (2 * pi)) = cos x

goal (1 subgoal):
 1. \<And>n x. (\<And>x. cos (x + real n * (2 * pi)) = cos x) \<Longrightarrow> cos (x + real (Suc n) * (2 * pi)) = cos x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n x. (\<And>x. cos (x + real n * (2 * pi)) = cos x) \<Longrightarrow> cos (x + real (Suc n) * (2 * pi)) = cos x
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
cos (?x + real n * (2 * pi)) = cos ?x

goal (1 subgoal):
 1. \<And>n x. (\<And>x. cos (x + real n * (2 * pi)) = cos x) \<Longrightarrow> cos (x + real (Suc n) * (2 * pi)) = cos x
[PROOF STEP]
have split_pi_off: "x + (Suc n) * (2 * pi) = (x + n * (2 * pi)) + 2 * pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + real (Suc n) * (2 * pi) = x + real n * (2 * pi) + 2 * pi
[PROOF STEP]
unfolding Suc_eq_plus1 of_nat_add of_int_1 distrib_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + (real n * (2 * pi) + real 1 * (2 * pi)) = x + real n * (2 * pi) + 2 * pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x + real (Suc n) * (2 * pi) = x + real n * (2 * pi) + 2 * pi

goal (1 subgoal):
 1. \<And>n x. (\<And>x. cos (x + real n * (2 * pi)) = cos x) \<Longrightarrow> cos (x + real (Suc n) * (2 * pi)) = cos x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x + real (Suc n) * (2 * pi)) = cos x
[PROOF STEP]
unfolding split_pi_off
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x + real n * (2 * pi) + 2 * pi) = cos x
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
cos (?x + real n * (2 * pi)) = cos ?x

goal (1 subgoal):
 1. cos (x + real n * (2 * pi) + 2 * pi) = cos x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos (x + real (Suc n) * (2 * pi)) = cos x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_add_Pythagorean:
  assumes "orthogonal a b"
    shows "norm(a + b) ^ 2 = norm a ^ 2 + norm b ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm (a + b))\<^sup>2 = (norm a)\<^sup>2 + (norm b)\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (norm (a + b))\<^sup>2 = (norm a)\<^sup>2 + (norm b)\<^sup>2
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
orthogonal a b
[PROOF STEP]
have "(a - (0 - b)) \<bullet> (a - (0 - b)) = a \<bullet> a - (0 - b \<bullet> b)"
[PROOF STATE]
proof (prove)
using this:
orthogonal a b

goal (1 subgoal):
 1. (a - ((0::'a) - b)) \<bullet> (a - ((0::'a) - b)) = a \<bullet> a - (0 - b \<bullet> b)
[PROOF STEP]
by (simp add: algebra_simps orthogonal_def inner_commute)
[PROOF STATE]
proof (state)
this:
(a - ((0::'a) - b)) \<bullet> (a - ((0::'a) - b)) = a \<bullet> a - (0 - b \<bullet> b)

goal (1 subgoal):
 1. (norm (a + b))\<^sup>2 = (norm a)\<^sup>2 + (norm b)\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(a - ((0::'a) - b)) \<bullet> (a - ((0::'a) - b)) = a \<bullet> a - (0 - b \<bullet> b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(a - ((0::'a) - b)) \<bullet> (a - ((0::'a) - b)) = a \<bullet> a - (0 - b \<bullet> b)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma outer_measure_of_mono: "A \<subseteq> B \<Longrightarrow> outer_measure_of M A \<le> outer_measure_of M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> outer_measure_of M A \<le> outer_measure_of M B
[PROOF STEP]
unfolding outer_measure_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> Inf (emeasure M ` {B \<in> sets M. A \<subseteq> B}) \<le> Inf (emeasure M ` {Ba \<in> sets M. B \<subseteq> Ba})
[PROOF STEP]
by (intro INF_superset_mono) auto


[STATEMENT]
lemma cmod_real_prod_squared:
  fixes x y:: real
  shows "(cmod (complex_of_real x * complex_of_real y))\<^sup>2 = x\<^sup>2 * y\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (complex_of_real x * complex_of_real y))\<^sup>2 = x\<^sup>2 * y\<^sup>2
[PROOF STEP]
by (simp add: norm_mult power_mult_distrib)


[STATEMENT]
lemma filterlim_at_top_linear_iff:
  fixes f::"'a::linordered_field \<Rightarrow> 'b"
  assumes "c\<noteq>0"
  shows "(LIM x at_top. f (x * c + b) :> F2) \<longleftrightarrow> (if c>0 then (LIM x at_top. f x :> F2)
            else (LIM x at_bot. f x :> F2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LIM x at_top. f (x * c + b) :> F2) = (if (0::'a) < c then filterlim f F2 at_top else filterlim f F2 at_bot)
[PROOF STEP]
unfolding filterlim_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (filtermap (\<lambda>x. f (x * c + b)) at_top \<le> F2) = (if (0::'a) < c then filtermap f at_top \<le> F2 else filtermap f at_bot \<le> F2)
[PROOF STEP]
apply (subst filtermap_filtermap[of f "\<lambda>x. x * c + b",symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (filtermap f (filtermap (\<lambda>x. x * c + b) at_top) \<le> F2) = (if (0::'a) < c then filtermap f at_top \<le> F2 else filtermap f at_bot \<le> F2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. (filtermap f (filtermap (\<lambda>x. x * c + b) at_top) \<le> F2) = (if (0::'a) < c then filtermap f at_top \<le> F2 else filtermap f at_bot \<le> F2)
[PROOF STEP]
by (auto simp add:filtermap_at_top_linear_eq)


[STATEMENT]
lemma lemma_tan_add1: "cos x \<noteq> 0 \<Longrightarrow> cos y \<noteq> 0 \<Longrightarrow> 1 - tan x * tan y = cos (x + y)/(cos x * cos y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cos x \<noteq> (0::'a); cos y \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> (1::'a) - tan x * tan y = cos (x + y) / (cos x * cos y)
[PROOF STEP]
by (simp add: tan_def cos_add field_simps)


[STATEMENT]
lemma less_two_pow_divD:
  "\<lbrakk> (x :: nat) < 2 ^ n div 2 ^ m \<rbrakk>
    \<Longrightarrow> n \<ge> m \<and> (x < 2 ^ (n - m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < 2 ^ n div 2 ^ m \<Longrightarrow> m \<le> n \<and> x < 2 ^ (n - m)
[PROOF STEP]
apply (rule context_conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x < 2 ^ n div 2 ^ m \<Longrightarrow> m \<le> n
 2. \<lbrakk>x < 2 ^ n div 2 ^ m; m \<le> n\<rbrakk> \<Longrightarrow> x < 2 ^ (n - m)
[PROOF STEP]
apply (rule ccontr)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x < 2 ^ n div 2 ^ m; \<not> m \<le> n\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>x < 2 ^ n div 2 ^ m; m \<le> n\<rbrakk> \<Longrightarrow> x < 2 ^ (n - m)
[PROOF STEP]
apply (simp add: power_strict_increasing)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < 2 ^ n div 2 ^ m; m \<le> n\<rbrakk> \<Longrightarrow> x < 2 ^ (n - m)
[PROOF STEP]
apply (simp add: power_sub)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Inf_le_iff_less:
  fixes x :: "'a :: {complete_linorder, dense_linorder}"
  shows "(INF i\<in>A. f i) \<le> x \<longleftrightarrow> (\<forall>y>x. \<exists>i\<in>A. f i \<le> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Inf (f ` A) \<le> x) = (\<forall>y>x. \<exists>i\<in>A. f i \<le> y)
[PROOF STEP]
unfolding INF_le_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>y>x. \<exists>i\<in>A. f i < y) = (\<forall>y>x. \<exists>i\<in>A. f i \<le> y)
[PROOF STEP]
by (blast intro: less_imp_le less_trans le_less_trans dest: dense)


[STATEMENT]
lemma card_of_Times_ordLess_infinite_Field[simp]:
assumes INF: "\<not>finite (Field r)" and r: "Card_order r" and
        LESS1: "|A| <o r" and LESS2: "|B| <o r"
shows "|A \<times> B| <o r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A \<times> B| <o r
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |A \<times> B| <o r
[PROOF STEP]
let ?C  = "Field r"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |A \<times> B| <o r
[PROOF STEP]
have 1: "r =o |?C| \<and> |?C| =o r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r =o |Field r| \<and> |Field r| =o r
[PROOF STEP]
using r card_of_Field_ordIso
  ordIso_symmetric
[PROOF STATE]
proof (prove)
using this:
Card_order r
Card_order ?r \<Longrightarrow> |Field ?r| =o ?r
?r =o ?r' \<Longrightarrow> ?r' =o ?r

goal (1 subgoal):
 1. r =o |Field r| \<and> |Field r| =o r
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
r =o |Field r| \<and> |Field r| =o r

goal (1 subgoal):
 1. |A \<times> B| <o r
[PROOF STEP]
hence "|A| <o |?C|"  "|B| <o |?C|"
[PROOF STATE]
proof (prove)
using this:
r =o |Field r| \<and> |Field r| =o r

goal (1 subgoal):
 1. |A| <o |Field r| &&& |B| <o |Field r|
[PROOF STEP]
using LESS1 LESS2 ordLess_ordIso_trans
[PROOF STATE]
proof (prove)
using this:
r =o |Field r| \<and> |Field r| =o r
|A| <o r
|B| <o r
\<lbrakk>?r <o ?r'; ?r' =o ?r''\<rbrakk> \<Longrightarrow> ?r <o ?r''

goal (1 subgoal):
 1. |A| <o |Field r| &&& |B| <o |Field r|
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
|A| <o |Field r|
|B| <o |Field r|

goal (1 subgoal):
 1. |A \<times> B| <o r
[PROOF STEP]
hence  "|A \<times> B| <o |?C|"
[PROOF STATE]
proof (prove)
using this:
|A| <o |Field r|
|B| <o |Field r|

goal (1 subgoal):
 1. |A \<times> B| <o |Field r|
[PROOF STEP]
using INF
  card_of_Times_ordLess_infinite
[PROOF STATE]
proof (prove)
using this:
|A| <o |Field r|
|B| <o |Field r|
infinite (Field r)
\<lbrakk>infinite ?C; |?A| <o |?C|; |?B| <o |?C|\<rbrakk> \<Longrightarrow> |?A \<times> ?B| <o |?C|

goal (1 subgoal):
 1. |A \<times> B| <o |Field r|
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
|A \<times> B| <o |Field r|

goal (1 subgoal):
 1. |A \<times> B| <o r
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
|A \<times> B| <o |Field r|

goal (1 subgoal):
 1. |A \<times> B| <o r
[PROOF STEP]
using 1 ordLess_ordIso_trans
[PROOF STATE]
proof (prove)
using this:
|A \<times> B| <o |Field r|
r =o |Field r| \<and> |Field r| =o r
\<lbrakk>?r <o ?r'; ?r' =o ?r''\<rbrakk> \<Longrightarrow> ?r <o ?r''

goal (1 subgoal):
 1. |A \<times> B| <o r
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
|A \<times> B| <o r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_strict_prefix_set:
  shows "finite {xa. strict_prefix xa (x::'a list)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xa. strict_prefix xa x}
[PROOF STEP]
apply (induct x rule:rev_induct, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xs. finite {xa. strict_prefix xa xs} \<Longrightarrow> finite {xa. strict_prefix xa (xs @ [x])}
[PROOF STEP]
apply (subgoal_tac "{xa. strict_prefix xa (xs @ [x])} = {xa. strict_prefix xa xs} \<union> {xs}")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x xs. \<lbrakk>finite {xa. strict_prefix xa xs}; {xa. strict_prefix xa (xs @ [x])} = {xa. strict_prefix xa xs} \<union> {xs}\<rbrakk> \<Longrightarrow> finite {xa. strict_prefix xa (xs @ [x])}
 2. \<And>x xs. finite {xa. strict_prefix xa xs} \<Longrightarrow> {xa. strict_prefix xa (xs @ [x])} = {xa. strict_prefix xa xs} \<union> {xs}
[PROOF STEP]
by (auto simp:strict_prefix_def)


[STATEMENT]
lemma norm_cblinfun_of_matrix:
  "norm (cblinfun_of_matrix a) \<le> (\<Sum>i\<in>CBasis. \<Sum>j\<in>CBasis. cmod (a i j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (cblinfun_of_matrix a) \<le> (\<Sum>i\<in>CBasis. \<Sum>j\<in>CBasis. cmod (a i j))
[PROOF STEP]
apply (rule norm_cblinfun_bound)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 \<le> (\<Sum>i\<in>CBasis. \<Sum>j\<in>CBasis. cmod (a i j))
 2. \<And>x. norm (cblinfun_apply (cblinfun_of_matrix a) x) \<le> (\<Sum>i\<in>CBasis. \<Sum>j\<in>CBasis. cmod (a i j)) * norm x
[PROOF STEP]
apply (simp add: sum_nonneg)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. norm (cblinfun_apply (cblinfun_of_matrix a) x) \<le> (\<Sum>i\<in>CBasis. \<Sum>j\<in>CBasis. cmod (a i j)) * norm x
[PROOF STEP]
apply (simp only: cblinfun_of_matrix_apply sum_distrib_right)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. norm (\<Sum>i\<in>CBasis. \<Sum>j\<in>CBasis. (j \<bullet>\<^sub>C x * a i j) *\<^sub>C i) \<le> (\<Sum>n\<in>CBasis. \<Sum>na\<in>CBasis. cmod (a n na) * norm x)
[PROOF STEP]
apply (rule order_trans[OF norm_sum sum_mono])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x n. n \<in> CBasis \<Longrightarrow> norm (\<Sum>j\<in>CBasis. (j \<bullet>\<^sub>C x * a n j) *\<^sub>C n) \<le> (\<Sum>na\<in>CBasis. cmod (a n na) * norm x)
[PROOF STEP]
apply (rule order_trans[OF norm_sum sum_mono])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x n na. \<lbrakk>n \<in> CBasis; na \<in> CBasis\<rbrakk> \<Longrightarrow> norm ((na \<bullet>\<^sub>C x * a n na) *\<^sub>C n) \<le> cmod (a n na) * norm x
[PROOF STEP]
apply (simp add: abs_mult mult_right_mono ac_simps Basis_le_norm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x n na. \<lbrakk>n \<in> CBasis; na \<in> CBasis\<rbrakk> \<Longrightarrow> cmod (na \<bullet>\<^sub>C x * a n na) \<le> norm x * cmod (a n na)
[PROOF STEP]
by (metis complex_inner_class.Cauchy_Schwarz_ineq2 complex_scaleC_def mult.left_neutral mult_right_mono norm_CBasis norm_ge_zero norm_scaleC)


[STATEMENT]
lemma decr_grading_p_monom_mult:
  assumes "hom_grading d"
  shows "decr_grading_p d n (monom_mult c t p) = monom_mult c (decr_grading d n t) (decr_grading_p d n p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. decr_grading_p d n (monom_mult c t p) = monom_mult c (decr_grading d n t) (decr_grading_p d n p)
[PROOF STEP]
proof (induct p rule: poly_mapping_plus_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. decr_grading_p d n (monom_mult c t 0) = monom_mult c (decr_grading d n t) (decr_grading_p d n 0)
 2. \<And>p ca ta. \<lbrakk>ca \<noteq> (0::'b); ta \<notin> keys p; decr_grading_p d n (monom_mult c t p) = monom_mult c (decr_grading d n t) (decr_grading_p d n p)\<rbrakk> \<Longrightarrow> decr_grading_p d n (monom_mult c t (monomial ca ta + p)) = monom_mult c (decr_grading d n t) (decr_grading_p d n (monomial ca ta + p))
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. decr_grading_p d n (monom_mult c t 0) = monom_mult c (decr_grading d n t) (decr_grading_p d n 0)
 2. \<And>p ca ta. \<lbrakk>ca \<noteq> (0::'b); ta \<notin> keys p; decr_grading_p d n (monom_mult c t p) = monom_mult c (decr_grading d n t) (decr_grading_p d n p)\<rbrakk> \<Longrightarrow> decr_grading_p d n (monom_mult c t (monomial ca ta + p)) = monom_mult c (decr_grading d n t) (decr_grading_p d n (monomial ca ta + p))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. decr_grading_p d n (monom_mult c t 0) = monom_mult c (decr_grading d n t) (decr_grading_p d n 0)
[PROOF STEP]
by (simp add: decr_grading_p_zero)
[PROOF STATE]
proof (state)
this:
decr_grading_p d n (monom_mult c t 0) = monom_mult c (decr_grading d n t) (decr_grading_p d n 0)

goal (1 subgoal):
 1. \<And>p ca ta. \<lbrakk>ca \<noteq> (0::'b); ta \<notin> keys p; decr_grading_p d n (monom_mult c t p) = monom_mult c (decr_grading d n t) (decr_grading_p d n p)\<rbrakk> \<Longrightarrow> decr_grading_p d n (monom_mult c t (monomial ca ta + p)) = monom_mult c (decr_grading d n t) (decr_grading_p d n (monomial ca ta + p))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p ca ta. \<lbrakk>ca \<noteq> (0::'b); ta \<notin> keys p; decr_grading_p d n (monom_mult c t p) = monom_mult c (decr_grading d n t) (decr_grading_p d n p)\<rbrakk> \<Longrightarrow> decr_grading_p d n (monom_mult c t (monomial ca ta + p)) = monom_mult c (decr_grading d n t) (decr_grading_p d n (monomial ca ta + p))
[PROOF STEP]
case (2 p a s)
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'b)
s \<notin> keys p
decr_grading_p d n (monom_mult c t p) = monom_mult c (decr_grading d n t) (decr_grading_p d n p)

goal (1 subgoal):
 1. \<And>p ca ta. \<lbrakk>ca \<noteq> (0::'b); ta \<notin> keys p; decr_grading_p d n (monom_mult c t p) = monom_mult c (decr_grading d n t) (decr_grading_p d n p)\<rbrakk> \<Longrightarrow> decr_grading_p d n (monom_mult c t (monomial ca ta + p)) = monom_mult c (decr_grading d n t) (decr_grading_p d n (monomial ca ta + p))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
hom_grading d
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
hom_grading d

goal (1 subgoal):
 1. decr_grading_p d n (monom_mult c t (monomial a s + p)) = monom_mult c (decr_grading d n t) (decr_grading_p d n (monomial a s + p))
[PROOF STEP]
by (simp add: monom_mult_dist_right decr_grading_p_plus 2(3) monom_mult_monomial
        decr_grading_p_monomial decr_grading_term_splus)
[PROOF STATE]
proof (state)
this:
decr_grading_p d n (monom_mult c t (monomial a s + p)) = monom_mult c (decr_grading d n t) (decr_grading_p d n (monomial a s + p))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma
  defines "f \<equiv> (\<lambda>x::real. ln (ln (x * exp (x * exp x) + 1)) - exp (exp (ln (ln x) + 1 / x)))"
  shows   "(f \<longlongrightarrow> 0) at_top" (is ?thesis1)
          "f \<sim> (\<lambda>x. -(ln x ^ 2) / (2*x))" (is ?thesis2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> 0) at_top &&& f \<sim>[at_top] (\<lambda>x. - (ln x)\<^sup>2 / (2 * x))
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. ln (ln (x * exp (x * exp x) + 1)) - exp (exp (ln (ln x) + 1 / x))) \<longlongrightarrow> 0) at_top &&& (\<lambda>x. ln (ln (x * exp (x * exp x) + 1)) - exp (exp (ln (ln x) + 1 / x))) \<sim>[at_top] (\<lambda>x. - (ln x)\<^sup>2 / (2 * x))
[PROOF STEP]
by real_asymp+


[STATEMENT]
lemma bt_map_append: "bt_map f (append t u) = append (bt_map f t) (bt_map f u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bt_map f (Binary_Tree.append t u) = Binary_Tree.append (bt_map f t) (bt_map f u)
[PROOF STEP]
apply (induct t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. bt_map f (Binary_Tree.append Lf u) = Binary_Tree.append (bt_map f Lf) (bt_map f u)
 2. \<And>x1 t1 t2. \<lbrakk>bt_map f (Binary_Tree.append t1 u) = Binary_Tree.append (bt_map f t1) (bt_map f u); bt_map f (Binary_Tree.append t2 u) = Binary_Tree.append (bt_map f t2) (bt_map f u)\<rbrakk> \<Longrightarrow> bt_map f (Binary_Tree.append (Br x1 t1 t2) u) = Binary_Tree.append (bt_map f (Br x1 t1 t2)) (bt_map f u)
[PROOF STEP]
apply (metis append.simps(1) bt_map.simps(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 t1 t2. \<lbrakk>bt_map f (Binary_Tree.append t1 u) = Binary_Tree.append (bt_map f t1) (bt_map f u); bt_map f (Binary_Tree.append t2 u) = Binary_Tree.append (bt_map f t2) (bt_map f u)\<rbrakk> \<Longrightarrow> bt_map f (Binary_Tree.append (Br x1 t1 t2) u) = Binary_Tree.append (bt_map f (Br x1 t1 t2)) (bt_map f u)
[PROOF STEP]
by (metis append.simps(2) bt_map.simps(2))


[STATEMENT]
lemma mon_iff_hom_one:
   "\<lbrakk>group G; group H\<rbrakk> \<Longrightarrow> f \<in> mon G H \<longleftrightarrow> f \<in> hom G H \<and> (\<forall>x. x \<in> carrier G \<and> f x = \<one>\<^bsub>H\<^esub> \<longrightarrow> x = \<one>\<^bsub>G\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group.group G; Group.group H\<rbrakk> \<Longrightarrow> (f \<in> mon G H) = (f \<in> hom G H \<and> (\<forall>x. x \<in> carrier G \<and> f x = \<one>\<^bsub>H\<^esub> \<longrightarrow> x = \<one>\<^bsub>G\<^esub>))
[PROOF STEP]
by (auto simp: mon_def inj_on_one_iff')


[STATEMENT]
lemma scalar_prod_inter_num_lift_01:
  assumes "j1 < \<b>" "j2 < \<b>"
  shows "((col (lift_01_mat N) j1) \<bullet> (col (lift_01_mat N) j2)) = (of_nat ((\<B>s ! j1) |\<inter>| (\<B>s ! j2)) :: ('b :: {ring_1}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (lift_01_mat N) j1 \<bullet> col (lift_01_mat N) j2 = of_nat (\<B>s ! j1 |\<inter>| \<B>s ! j2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. col (lift_01_mat N) j1 \<bullet> col (lift_01_mat N) j2 = of_nat (\<B>s ! j1 |\<inter>| \<B>s ! j2)
[PROOF STEP]
interpret z1: zero_one_matrix_ring_1 "(lift_01_mat N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zero_one_matrix_ring_1 (lift_01_mat N)
[PROOF STEP]
by (intro_locales) (simp add: lift_mat_is_0_1)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. col (lift_01_mat N) j1 \<bullet> col (lift_01_mat N) j2 = of_nat (\<B>s ! j1 |\<inter>| \<B>s ! j2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (lift_01_mat N) j1 \<bullet> col (lift_01_mat N) j2 = of_nat (\<B>s ! j1 |\<inter>| \<B>s ! j2)
[PROOF STEP]
using assms z1.scalar_prod_inc_vec_mat_inter_num preserve_mat_inter_num
    mat_inter_num_conv lift_01_mat_def blocks_list_length inc_mat_dim_col
[PROOF STATE]
proof (prove)
using this:
j1 < \<b>
j2 < \<b>
\<lbrakk>?j1.0 < dim_col (lift_01_mat N); ?j2.0 < dim_col (lift_01_mat N)\<rbrakk> \<Longrightarrow> col (lift_01_mat N) ?j1.0 \<bullet> col (lift_01_mat N) ?j2.0 = of_nat (mat_inter_num (lift_01_mat N) ?j1.0 ?j2.0)
\<lbrakk>inj_on_01_hom ?f; ?j1.0 < dim_col N; ?j2.0 < dim_col N\<rbrakk> \<Longrightarrow> mat_inter_num N ?j1.0 ?j2.0 = mat_inter_num (map_mat ?f N) ?j1.0 ?j2.0
\<lbrakk>?j1.0 < dim_col N; ?j2.0 < dim_col N\<rbrakk> \<Longrightarrow> \<B>s ! ?j1.0 |\<inter>| \<B>s ! ?j2.0 = mat_inter_num N ?j1.0 ?j2.0
lift_01_mat ?M \<equiv> map_mat of_zero_neq_one ?M
length \<B>s = \<b>
dim_col (inc_mat_of ?Vs ?Bs) = length ?Bs

goal (1 subgoal):
 1. col (lift_01_mat N) j1 \<bullet> col (lift_01_mat N) j2 = of_nat (\<B>s ! j1 |\<inter>| \<B>s ! j2)
[PROOF STEP]
by (metis  lift_01_mat_simp(2) of_inj_on_01_hom.inj_on_01_hom_axioms)
[PROOF STATE]
proof (state)
this:
col (lift_01_mat N) j1 \<bullet> col (lift_01_mat N) j2 = of_nat (\<B>s ! j1 |\<inter>| \<B>s ! j2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma jordan_matrix_Cons:  "jordan_matrix (Cons (n,a) n_as) = four_block_mat
  (jordan_block n a)                 (0\<^sub>m n (sum_list (map fst n_as)))
  (0\<^sub>m (sum_list (map fst n_as)) n)   (jordan_matrix n_as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jordan_matrix ((n, a) # n_as) = four_block_mat (jordan_block n a) (0\<^sub>m n (sum_list (map fst n_as))) (0\<^sub>m (sum_list (map fst n_as)) n) (jordan_matrix n_as)
[PROOF STEP]
unfolding jordan_matrix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat (map (\<lambda>(x, y). jordan_block x y) ((n, a) # n_as)) = four_block_mat (jordan_block n a) (0\<^sub>m n (sum_list (map fst n_as))) (0\<^sub>m (sum_list (map fst n_as)) n) (diag_block_mat (map (\<lambda>(x, y). jordan_block x y) n_as))
[PROOF STEP]
by (simp, simp add: jordan_matrix_def[symmetric])


[STATEMENT]
lemma affine_hull_2_alt:
  fixes a b :: "'a::real_vector"
  shows "affine hull {a,b} = range (\<lambda>u. a + u *\<^sub>R (b - a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull {a, b} = range (\<lambda>u. a + u *\<^sub>R (b - a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. affine hull {a, b} = range (\<lambda>u. a + u *\<^sub>R (b - a))
[PROOF STEP]
have 1: "u *\<^sub>R a + v *\<^sub>R b = a + v *\<^sub>R (b - a)" if "u + v = 1" for u v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u *\<^sub>R a + v *\<^sub>R b = a + v *\<^sub>R (b - a)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
u + v = 1

goal (1 subgoal):
 1. u *\<^sub>R a + v *\<^sub>R b = a + v *\<^sub>R (b - a)
[PROOF STEP]
by (simp add: algebra_simps flip: scaleR_add_left)
[PROOF STATE]
proof (state)
this:
?u + ?v = 1 \<Longrightarrow> ?u *\<^sub>R a + ?v *\<^sub>R b = a + ?v *\<^sub>R (b - a)

goal (1 subgoal):
 1. affine hull {a, b} = range (\<lambda>u. a + u *\<^sub>R (b - a))
[PROOF STEP]
have 2: "a + u *\<^sub>R (b - a) = (1 - u) *\<^sub>R a + u *\<^sub>R b" for u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + u *\<^sub>R (b - a) = (1 - u) *\<^sub>R a + u *\<^sub>R b
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
a + ?u *\<^sub>R (b - a) = (1 - ?u) *\<^sub>R a + ?u *\<^sub>R b

goal (1 subgoal):
 1. affine hull {a, b} = range (\<lambda>u. a + u *\<^sub>R (b - a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull {a, b} = range (\<lambda>u. a + u *\<^sub>R (b - a))
[PROOF STEP]
by (force simp add: affine_hull_2 dest: 1 intro!: 2)
[PROOF STATE]
proof (state)
this:
affine hull {a, b} = range (\<lambda>u. a + u *\<^sub>R (b - a))

goal:
No subgoals!
[PROOF STEP]
qed