[STATEMENT]
lemma length_repeat: "length (repeat n a) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (repeat n a) = n
[PROOF STEP]
proof(induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (repeat 0 a) = 0
 2. \<And>n. length (repeat n a) = n \<Longrightarrow> length (repeat (Suc n) a) = Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. length (repeat 0 a) = 0
 2. \<And>n. length (repeat n a) = n \<Longrightarrow> length (repeat (Suc n) a) = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (repeat 0 a) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (repeat 0 a) = 0

goal (1 subgoal):
 1. \<And>n. length (repeat n a) = n \<Longrightarrow> length (repeat (Suc n) a) = Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. length (repeat n a) = n \<Longrightarrow> length (repeat (Suc n) a) = Suc n
[PROOF STEP]
case (Suc a)
[PROOF STATE]
proof (state)
this:
length (repeat a a) = a

goal (1 subgoal):
 1. \<And>n. length (repeat n a) = n \<Longrightarrow> length (repeat (Suc n) a) = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (repeat a a) = a
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length (repeat a a) = a

goal (1 subgoal):
 1. length (repeat (Suc a) a) = Suc a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (repeat (Suc a) a) = Suc a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pi_approx2':
  fixes n :: nat assumes n: "even n" and "n > 0" and "k \<le> 46*n - 1"
  shows   "\<bar>pi - pi_approx2 n\<bar> \<le> inverse (2^k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>pi - pi_approx2 n\<bar> \<le> inverse (2 ^ k)
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
k \<le> 46 * n - 1

goal (1 subgoal):
 1. \<bar>pi - pi_approx2 n\<bar> \<le> inverse (2 ^ k)
[PROOF STEP]
by (intro order.trans[OF pi_approx2[OF assms(1,2)]]) (simp_all add: field_simps)


[STATEMENT]
lemma binary_power[simp]: "binary_power = (^)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binary_power = (^)
[PROOF STEP]
proof (intro ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. binary_power x xa = x ^ xa
[PROOF STEP]
fix x n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. binary_power x xa = x ^ xa
[PROOF STEP]
show "binary_power x n = x ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binary_power x n = x ^ n
[PROOF STEP]
proof (induct x n rule: binary_power.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x n. (\<And>xa xb y. \<lbrakk>n \<noteq> 0; xa = Euclidean_Division.divmod_nat n 2; (xb, y) = xa\<rbrakk> \<Longrightarrow> binary_power (x * x) xb = (x * x) ^ xb) \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
case (1 x n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n \<noteq> 0; ?xa = Euclidean_Division.divmod_nat n 2; (?xb, ?y) = ?xa\<rbrakk> \<Longrightarrow> binary_power (x * x) ?xb = (x * x) ^ ?xb

goal (1 subgoal):
 1. \<And>x n. (\<And>xa xb y. \<lbrakk>n \<noteq> 0; xa = Euclidean_Division.divmod_nat n 2; (xb, y) = xa\<rbrakk> \<Longrightarrow> binary_power (x * x) xb = (x * x) ^ xb) \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binary_power x n = x ^ n
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
note IH = 1[OF False]
[PROOF STATE]
proof (state)
this:
\<lbrakk>?xa = Euclidean_Division.divmod_nat n 2; (?xb, ?y) = ?xa\<rbrakk> \<Longrightarrow> binary_power (x * x) ?xb = (x * x) ^ ?xb

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
obtain d r where n2: "Euclidean_Division.divmod_nat n 2 = (d,r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d r. Euclidean_Division.divmod_nat n 2 = (d, r) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
Euclidean_Division.divmod_nat n 2 = (d, r)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
from Euclidean_Division.divmod_nat_def[of n 2] n2
[PROOF STATE]
proof (chain)
picking this:
Euclidean_Division.divmod_nat n 2 = (n div 2, n mod 2)
Euclidean_Division.divmod_nat n 2 = (d, r)
[PROOF STEP]
have dr: "d = n div 2" "r = n mod 2"
[PROOF STATE]
proof (prove)
using this:
Euclidean_Division.divmod_nat n 2 = (n div 2, n mod 2)
Euclidean_Division.divmod_nat n 2 = (d, r)

goal (1 subgoal):
 1. d = n div 2 &&& r = n mod 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d = n div 2
r = n mod 2

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
hence r: "r = 0 \<or> r = 1"
[PROOF STATE]
proof (prove)
using this:
d = n div 2
r = n mod 2

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

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
let ?rec = "binary_power (x * x) d"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
have "binary_power x n = (if r = 0 then ?rec else ?rec * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binary_power x n = (if r = 0 then binary_power (x * x) d else binary_power (x * x) d * x)
[PROOF STEP]
unfolding binary_power.simps[of x n] n2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if n = 0 then 1::'a else let (d, r) = (d, r); rec = binary_power (x * x) d in if r = 0 then rec else rec * x) = (if r = 0 then binary_power (x * x) d else binary_power (x * x) d * x)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. (if n = 0 then 1::'a else let (d, r) = (d, r); rec = binary_power (x * x) d in if r = 0 then rec else rec * x) = (if r = 0 then binary_power (x * x) d else binary_power (x * x) d * x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
binary_power x n = (if r = 0 then binary_power (x * x) d else binary_power (x * x) d * x)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
binary_power x n = (if r = 0 then binary_power (x * x) d else binary_power (x * x) d * x)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
have "\<dots> = ?rec * x ^ r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if r = 0 then binary_power (x * x) d else binary_power (x * x) d * x) = binary_power (x * x) d * x ^ r
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
r = 0 \<or> r = 1

goal (1 subgoal):
 1. (if r = 0 then binary_power (x * x) d else binary_power (x * x) d * x) = binary_power (x * x) d * x ^ r
[PROOF STEP]
by (cases "r = 0", auto)
[PROOF STATE]
proof (state)
this:
(if r = 0 then binary_power (x * x) d else binary_power (x * x) d * x) = binary_power (x * x) d * x ^ r

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(if r = 0 then binary_power (x * x) d else binary_power (x * x) d * x) = binary_power (x * x) d * x ^ r

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
have "?rec = (x * x) ^ d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binary_power (x * x) d = (x * x) ^ d
[PROOF STEP]
by (rule IH[OF _ refl], simp add: n2)
[PROOF STATE]
proof (state)
this:
binary_power (x * x) d = (x * x) ^ d

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
binary_power (x * x) d = (x * x) ^ d

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
have "\<dots> = x ^ (d + d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * x) ^ d = x ^ (d + d)
[PROOF STEP]
unfolding power_add
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * x) ^ d = x ^ d * x ^ d
[PROOF STEP]
using power2_eq_square power_even_eq power_mult
[PROOF STATE]
proof (prove)
using this:
?a\<^sup>2 = ?a * ?a
?a ^ (2 * ?n) = (?a ^ ?n)\<^sup>2
?a ^ (?m * ?n) = (?a ^ ?m) ^ ?n

goal (1 subgoal):
 1. (x * x) ^ d = x ^ d * x ^ d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x * x) ^ d = x ^ (d + d)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x * x) ^ d = x ^ (d + d)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
have "\<dots> * x ^ r = x ^ (d + d + r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ (d + d) * x ^ r = x ^ (d + d + r)
[PROOF STEP]
by (simp add: power_add)
[PROOF STATE]
proof (state)
this:
x ^ (d + d) * x ^ r = x ^ (d + d + r)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x ^ (d + d) * x ^ r = x ^ (d + d + r)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
have "d + d + r = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d + d + r = n
[PROOF STEP]
unfolding dr
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n div 2 + n div 2 + n mod 2 = n
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
d + d + r = n

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
 2. n \<noteq> 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
binary_power x n = x ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
binary_power x n = x ^ n

goal (1 subgoal):
 1. binary_power x n = x ^ n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
binary_power x n = x ^ n

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> binary_power x n = x ^ n
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
binary_power x n = x ^ n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
binary_power x n = x ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma transpose_transpose[simp]:
  "transpose_mat (transpose_mat A) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose_mat (transpose_mat A) = A
[PROOF STEP]
by (intro eq_matI, auto)


[STATEMENT]
lemma expand_case_signs: "Q(case_signs vpos vneg F) = (
  (F = Pos --> Q (vpos)) &
  (F = Neg --> Q (vneg))
 )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q (case F of Pos \<Rightarrow> vpos | Neg \<Rightarrow> vneg) = ((F = Pos \<longrightarrow> Q vpos) \<and> (F = Neg \<longrightarrow> Q vneg))
[PROOF STEP]
by(induct F) simp_all


[STATEMENT]
theorem wls_freshAbs_simp[simp]:
assumes "wls s X"
shows "freshAbs ys y (Abs xs x X) = (ys = xs \<and> y = x \<or> fresh ys y X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. freshAbs ys y (Abs xs x X) = (ys = xs \<and> y = x \<or> fresh ys y X)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wls s X

goal (1 subgoal):
 1. freshAbs ys y (Abs xs x X) = (ys = xs \<and> y = x \<or> fresh ys y X)
[PROOF STEP]
by simp


[STATEMENT]
lemma emeasure_space_subprob_algebra[measurable]:
  "(\<lambda>a. emeasure a (space a)) \<in> borel_measurable (subprob_algebra N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a. emeasure a (space a)) \<in> borel_measurable (subprob_algebra N)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>a. emeasure a (space a)) \<in> borel_measurable (subprob_algebra N)
[PROOF STEP]
have "(\<lambda>a. emeasure a (space N)) \<in> borel_measurable (subprob_algebra N)" (is "?f \<in> ?M")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a. emeasure a (space N)) \<in> borel_measurable (subprob_algebra N)
[PROOF STEP]
by (rule measurable_emeasure_subprob_algebra) simp
[PROOF STATE]
proof (state)
this:
(\<lambda>a. emeasure a (space N)) \<in> borel_measurable (subprob_algebra N)

goal (1 subgoal):
 1. (\<lambda>a. emeasure a (space a)) \<in> borel_measurable (subprob_algebra N)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>a. emeasure a (space N)) \<in> borel_measurable (subprob_algebra N)

goal (1 subgoal):
 1. (\<lambda>a. emeasure a (space a)) \<in> borel_measurable (subprob_algebra N)
[PROOF STEP]
have "?f \<in> ?M \<longleftrightarrow> (\<lambda>a. emeasure a (space a)) \<in> ?M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>a. emeasure a (space N)) \<in> borel_measurable (subprob_algebra N)) = ((\<lambda>a. emeasure a (space a)) \<in> borel_measurable (subprob_algebra N))
[PROOF STEP]
by (rule measurable_cong) (auto simp: space_subprob_algebra dest: sets_eq_imp_space_eq)
[PROOF STATE]
proof (state)
this:
((\<lambda>a. emeasure a (space N)) \<in> borel_measurable (subprob_algebra N)) = ((\<lambda>a. emeasure a (space a)) \<in> borel_measurable (subprob_algebra N))

goal (1 subgoal):
 1. (\<lambda>a. emeasure a (space a)) \<in> borel_measurable (subprob_algebra N)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>a. emeasure a (space a)) \<in> borel_measurable (subprob_algebra N)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>a. emeasure a (space a)) \<in> borel_measurable (subprob_algebra N)

goal (1 subgoal):
 1. (\<lambda>a. emeasure a (space a)) \<in> borel_measurable (subprob_algebra N)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>a. emeasure a (space a)) \<in> borel_measurable (subprob_algebra N)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sets_eq_countable:
  assumes "countable A" "space M = A" "\<And>x. x \<in> A \<Longrightarrow> {x} \<in> sets M"
  shows   "sets M = Pow A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets M = Pow A
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> sets M \<Longrightarrow> x \<in> Pow A
 2. \<And>x. x \<in> Pow A \<Longrightarrow> x \<in> sets M
[PROOF STEP]
fix X
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> sets M \<Longrightarrow> x \<in> Pow A
 2. \<And>x. x \<in> Pow A \<Longrightarrow> x \<in> sets M
[PROOF STEP]
assume "X \<in> Pow A"
[PROOF STATE]
proof (state)
this:
X \<in> Pow A

goal (2 subgoals):
 1. \<And>x. x \<in> sets M \<Longrightarrow> x \<in> Pow A
 2. \<And>x. x \<in> Pow A \<Longrightarrow> x \<in> sets M
[PROOF STEP]
hence "(\<Union>x\<in>X. {x}) \<in> sets M"
[PROOF STATE]
proof (prove)
using this:
X \<in> Pow A

goal (1 subgoal):
 1. (\<Union>x\<in>X. {x}) \<in> sets M
[PROOF STEP]
by (intro sets.countable_UN' countable_subset[OF _ assms(1)]) (auto intro!: assms(3))
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>X. {x}) \<in> sets M

goal (2 subgoals):
 1. \<And>x. x \<in> sets M \<Longrightarrow> x \<in> Pow A
 2. \<And>x. x \<in> Pow A \<Longrightarrow> x \<in> sets M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>X. {x}) \<in> sets M

goal (2 subgoals):
 1. \<And>x. x \<in> sets M \<Longrightarrow> x \<in> Pow A
 2. \<And>x. x \<in> Pow A \<Longrightarrow> x \<in> sets M
[PROOF STEP]
have "(\<Union>x\<in>X. {x}) = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>X. {x}) = X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>X. {x}) = X

goal (2 subgoals):
 1. \<And>x. x \<in> sets M \<Longrightarrow> x \<in> Pow A
 2. \<And>x. x \<in> Pow A \<Longrightarrow> x \<in> sets M
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
X \<in> sets M
[PROOF STEP]
show "X \<in> sets M"
[PROOF STATE]
proof (prove)
using this:
X \<in> sets M

goal (1 subgoal):
 1. X \<in> sets M
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
X \<in> sets M

goal (1 subgoal):
 1. \<And>x. x \<in> sets M \<Longrightarrow> x \<in> Pow A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> sets M \<Longrightarrow> x \<in> Pow A
[PROOF STEP]
fix X
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> sets M \<Longrightarrow> x \<in> Pow A
[PROOF STEP]
assume "X \<in> sets M"
[PROOF STATE]
proof (state)
this:
X \<in> sets M

goal (1 subgoal):
 1. \<And>x. x \<in> sets M \<Longrightarrow> x \<in> Pow A
[PROOF STEP]
from sets.sets_into_space[OF this] and assms
[PROOF STATE]
proof (chain)
picking this:
X \<subseteq> space M
countable A
space M = A
?x \<in> A \<Longrightarrow> {?x} \<in> sets M
[PROOF STEP]
show "X \<in> Pow A"
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> space M
countable A
space M = A
?x \<in> A \<Longrightarrow> {?x} \<in> sets M

goal (1 subgoal):
 1. X \<in> Pow A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
X \<in> Pow A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in is_cf_adjunction) cf_adj_AdjNT_cf_adjunction_counit:
  \<comment>\<open>See Chapter IV-1 in \cite{mac_lane_categories_2010}.\<close>
  assumes "x \<in>\<^sub>\<circ> \<DD>\<lparr>Obj\<rparr>" and "g : a \<mapsto>\<^bsub>\<CC>\<^esub> \<GG>\<lparr>ObjMap\<rparr>\<lparr>x\<rparr>"
  shows
    "\<epsilon>\<^sub>C \<Phi>\<lparr>NTMap\<rparr>\<lparr>x\<rparr> \<circ>\<^sub>A\<^bsub>\<DD>\<^esub> \<FF>\<lparr>ArrMap\<rparr>\<lparr>g\<rparr> =
      (\<Phi>\<lparr>AdjNT\<rparr>\<lparr>NTMap\<rparr>\<lparr>a, x\<rparr>\<^sub>\<bullet>)\<inverse>\<^sub>C\<^bsub>cat_Set \<alpha>\<^esub>\<lparr>ArrVal\<rparr>\<lparr>g\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<epsilon>\<^sub>C \<Phi>\<lparr>NTMap\<rparr>\<lparr>x\<rparr> \<circ>\<^sub>A\<^bsub>\<DD>\<^esub> \<FF>\<lparr>ArrMap\<rparr>\<lparr>g\<rparr> = (\<Phi>\<lparr>AdjNT\<rparr>\<lparr>NTMap\<rparr> \<lparr>a, x\<rparr>\<^sub>\<bullet>)\<inverse>\<^sub>C\<^bsub>cat_Set \<alpha>\<^esub>\<lparr>ArrVal\<rparr>\<lparr>g\<rparr>
[PROOF STEP]
using
    is_cf_adjunction.cf_adj_AdjNT_cf_adjunction_unit
      [
        OF is_cf_adjunction_op,
        unfolded cat_op_simps cf_adjunction_unit_NTMap_op,
        OF assms
      ]
    assms
[PROOF STATE]
proof (prove)
using this:
\<FF>\<lparr>ArrMap\<rparr>\<lparr>g\<rparr> \<circ>\<^sub>A\<^bsub>op_cat \<DD>\<^esub> \<epsilon>\<^sub>C \<Phi>\<lparr>NTMap\<rparr>\<lparr>x\<rparr> = (op_cf_adj \<Phi>\<lparr>AdjNT\<rparr>\<lparr>NTMap\<rparr> \<lparr>x, a\<rparr>\<^sub>\<bullet>)\<lparr>ArrVal\<rparr>\<lparr>g\<rparr>
x \<in>\<^sub>\<circ> \<DD>\<lparr>Obj\<rparr>
g : a \<mapsto>\<^bsub>\<CC>\<^esub> \<GG>\<lparr>ObjMap\<rparr>\<lparr>x\<rparr>

goal (1 subgoal):
 1. \<epsilon>\<^sub>C \<Phi>\<lparr>NTMap\<rparr>\<lparr>x\<rparr> \<circ>\<^sub>A\<^bsub>\<DD>\<^esub> \<FF>\<lparr>ArrMap\<rparr>\<lparr>g\<rparr> = (\<Phi>\<lparr>AdjNT\<rparr>\<lparr>NTMap\<rparr> \<lparr>a, x\<rparr>\<^sub>\<bullet>)\<inverse>\<^sub>C\<^bsub>cat_Set \<alpha>\<^esub>\<lparr>ArrVal\<rparr>\<lparr>g\<rparr>
[PROOF STEP]
by (*slow*)
    (
      cs_prems
        cs_simp: cat_cs_simps cat_op_simps
        cs_intro:
          cat_cs_intros
          adj_cs_intros
          cat_op_intros
          cat_prod_cs_intros
    )


[STATEMENT]
lemma height_balR2:
  "\<lbrakk> hbt l;  hbt r;  height r \<noteq> height l + m + 1 \<rbrakk> \<Longrightarrow>
   height (balR l a r) = 1 + max (height l) (height r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>hbt l; hbt r; height r \<noteq> height l + m + 1\<rbrakk> \<Longrightarrow> height (balR l a r) = 1 + max (height l) (height r)
[PROOF STEP]
by (simp_all add: balR_def)


[STATEMENT]
lemma llist_all2_lappend1D:
  assumes "llist_all2 P (lappend xs xs') ys"
  shows "llist_all2 P xs (ltake (llength xs) ys)"
  and "lfinite xs \<Longrightarrow> llist_all2 P xs' (ldrop (llength xs) ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llist_all2 P xs (ltake (llength xs) ys) &&& (lfinite xs \<Longrightarrow> llist_all2 P xs' (ldrop (llength xs) ys))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. llist_all2 P xs (ltake (llength xs) ys)
 2. lfinite xs \<Longrightarrow> llist_all2 P xs' (ldrop (llength xs) ys)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
llist_all2 P (lappend xs xs') ys
[PROOF STEP]
have len: "llength xs + llength xs' = llength ys"
[PROOF STATE]
proof (prove)
using this:
llist_all2 P (lappend xs xs') ys

goal (1 subgoal):
 1. llength xs + llength xs' = llength ys
[PROOF STEP]
by(auto dest: llist_all2_llengthD)
[PROOF STATE]
proof (state)
this:
llength xs + llength xs' = llength ys

goal (2 subgoals):
 1. llist_all2 P xs (ltake (llength xs) ys)
 2. lfinite xs \<Longrightarrow> llist_all2 P xs' (ldrop (llength xs) ys)
[PROOF STEP]
hence len_xs: "llength xs \<le> llength ys" and len_xs': "llength xs' \<le> llength ys"
[PROOF STATE]
proof (prove)
using this:
llength xs + llength xs' = llength ys

goal (1 subgoal):
 1. llength xs \<le> llength ys &&& llength xs' \<le> llength ys
[PROOF STEP]
by (metis enat_le_plus_same llength_lappend)+
[PROOF STATE]
proof (state)
this:
llength xs \<le> llength ys
llength xs' \<le> llength ys

goal (2 subgoals):
 1. llist_all2 P xs (ltake (llength xs) ys)
 2. lfinite xs \<Longrightarrow> llist_all2 P xs' (ldrop (llength xs) ys)
[PROOF STEP]
show "llist_all2 P xs (ltake (llength xs) ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llist_all2 P xs (ltake (llength xs) ys)
[PROOF STEP]
proof(rule llist_all2_all_lnthI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. llength xs = llength (ltake (llength xs) ys)
 2. \<And>n. enat n < llength xs \<Longrightarrow> P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
show "llength xs = llength (ltake (llength xs) ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llength xs = llength (ltake (llength xs) ys)
[PROOF STEP]
using len_xs
[PROOF STATE]
proof (prove)
using this:
llength xs \<le> llength ys

goal (1 subgoal):
 1. llength xs = llength (ltake (llength xs) ys)
[PROOF STEP]
by(simp add: min_def)
[PROOF STATE]
proof (state)
this:
llength xs = llength (ltake (llength xs) ys)

goal (1 subgoal):
 1. \<And>n. enat n < llength xs \<Longrightarrow> P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. enat n < llength xs \<Longrightarrow> P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. enat n < llength xs \<Longrightarrow> P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
assume n: "enat n < llength xs"
[PROOF STATE]
proof (state)
this:
enat n < llength xs

goal (1 subgoal):
 1. \<And>n. enat n < llength xs \<Longrightarrow> P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
enat n < llength xs

goal (1 subgoal):
 1. \<And>n. enat n < llength xs \<Longrightarrow> P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
have "\<dots> \<le> llength (lappend xs xs')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llength xs \<le> llength (lappend xs xs')
[PROOF STEP]
by(simp add: enat_le_plus_same)
[PROOF STATE]
proof (state)
this:
llength xs \<le> llength (lappend xs xs')

goal (1 subgoal):
 1. \<And>n. enat n < llength xs \<Longrightarrow> P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
enat n < llength (lappend xs xs')
[PROOF STEP]
have "P (lnth (lappend xs xs') n) (lnth ys n)"
[PROOF STATE]
proof (prove)
using this:
enat n < llength (lappend xs xs')

goal (1 subgoal):
 1. P (lnth (lappend xs xs') n) (lnth ys n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
enat n < llength (lappend xs xs')
llist_all2 P (lappend xs xs') ys

goal (1 subgoal):
 1. P (lnth (lappend xs xs') n) (lnth ys n)
[PROOF STEP]
by -(rule llist_all2_lnthD)
[PROOF STATE]
proof (state)
this:
P (lnth (lappend xs xs') n) (lnth ys n)

goal (1 subgoal):
 1. \<And>n. enat n < llength xs \<Longrightarrow> P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P (lnth (lappend xs xs') n) (lnth ys n)

goal (1 subgoal):
 1. \<And>n. enat n < llength xs \<Longrightarrow> P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
enat n < llength xs
[PROOF STEP]
have "lnth ys n = lnth (ltake (llength xs) ys) n"
[PROOF STATE]
proof (prove)
using this:
enat n < llength xs

goal (1 subgoal):
 1. lnth ys n = lnth (ltake (llength xs) ys) n
[PROOF STEP]
by(rule lnth_ltake[symmetric])
[PROOF STATE]
proof (state)
this:
lnth ys n = lnth (ltake (llength xs) ys) n

goal (1 subgoal):
 1. \<And>n. enat n < llength xs \<Longrightarrow> P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lnth ys n = lnth (ltake (llength xs) ys) n

goal (1 subgoal):
 1. \<And>n. enat n < llength xs \<Longrightarrow> P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
enat n < llength xs
[PROOF STEP]
have "lnth (lappend xs xs') n = lnth xs n"
[PROOF STATE]
proof (prove)
using this:
enat n < llength xs

goal (1 subgoal):
 1. lnth (lappend xs xs') n = lnth xs n
[PROOF STEP]
by(simp add: lnth_lappend1)
[PROOF STATE]
proof (state)
this:
lnth (lappend xs xs') n = lnth xs n

goal (1 subgoal):
 1. \<And>n. enat n < llength xs \<Longrightarrow> P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
show "P (lnth xs n) (lnth (ltake (llength xs) ys) n)"
[PROOF STATE]
proof (prove)
using this:
P (lnth xs n) (lnth (ltake (llength xs) ys) n)

goal (1 subgoal):
 1. P (lnth xs n) (lnth (ltake (llength xs) ys) n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
P (lnth xs n) (lnth (ltake (llength xs) ys) n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
llist_all2 P xs (ltake (llength xs) ys)

goal (1 subgoal):
 1. lfinite xs \<Longrightarrow> llist_all2 P xs' (ldrop (llength xs) ys)
[PROOF STEP]
assume "lfinite xs"
[PROOF STATE]
proof (state)
this:
lfinite xs

goal (1 subgoal):
 1. lfinite xs \<Longrightarrow> llist_all2 P xs' (ldrop (llength xs) ys)
[PROOF STEP]
thus "llist_all2 P xs' (ldrop (llength xs) ys)"
[PROOF STATE]
proof (prove)
using this:
lfinite xs

goal (1 subgoal):
 1. llist_all2 P xs' (ldrop (llength xs) ys)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
lfinite xs
llist_all2 P (lappend xs xs') ys

goal (1 subgoal):
 1. llist_all2 P xs' (ldrop (llength xs) ys)
[PROOF STEP]
by(induct arbitrary: ys)(auto simp add: llist_all2_LCons1)
[PROOF STATE]
proof (state)
this:
llist_all2 P xs' (ldrop (llength xs) ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ack_le_mono1: "i \<le> j \<Longrightarrow> ack i k \<le> ack j k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> ack i k \<le> ack j k
[PROOF STEP]
using ack_less_mono1 le_eq_less_or_eq
[PROOF STATE]
proof (prove)
using this:
?i < ?j \<Longrightarrow> ack ?i ?k < ack ?j ?k
(?m \<le> ?n) = (?m < ?n \<or> ?m = ?n)

goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> ack i k \<le> ack j k
[PROOF STEP]
by auto


[STATEMENT]
lemma Max_is_Max_by_id:
  "\<lbrakk> finite S; S \<noteq> {} \<rbrakk> \<Longrightarrow> Max S = Max_by id S "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; S \<noteq> {}\<rbrakk> \<Longrightarrow> Max S = Max_by id S
[PROOF STEP]
apply(clarsimp simp add: Max_by_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; S \<noteq> {}\<rbrakk> \<Longrightarrow> Max S = (SOME x. x \<in> S \<and> x = Max S)
[PROOF STEP]
by (metis (mono_tags, lifting) Max_in someI_ex)


[STATEMENT]
lemma frag_cmul_eq_0_iff [simp]: "frag_cmul k c = 0 \<longleftrightarrow> k=0 \<or> c=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (frag_cmul k c = 0) = (k = 0 \<or> c = 0)
[PROOF STEP]
by auto (metis subsetI subset_antisym keys_cmul_iff keys_eq_empty)


[STATEMENT]
lemma power_is_relpow: "rel_dioid.power X n = X ^^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_dioid.power X n = X ^^ n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rel_dioid.power X 0 = X ^^ 0
 2. \<And>n. rel_dioid.power X n = X ^^ n \<Longrightarrow> rel_dioid.power X (Suc n) = X ^^ Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. rel_dioid.power X 0 = X ^^ 0
 2. \<And>n. rel_dioid.power X n = X ^^ n \<Longrightarrow> rel_dioid.power X (Suc n) = X ^^ Suc n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_dioid.power X 0 = X ^^ 0
[PROOF STEP]
by (metis rel_dioid.power_0 relpow.simps(1))
[PROOF STATE]
proof (state)
this:
rel_dioid.power X 0 = X ^^ 0

goal (1 subgoal):
 1. \<And>n. rel_dioid.power X n = X ^^ n \<Longrightarrow> rel_dioid.power X (Suc n) = X ^^ Suc n
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
rel_dioid.power X n_ = X ^^ n_

goal (1 subgoal):
 1. \<And>n. rel_dioid.power X n = X ^^ n \<Longrightarrow> rel_dioid.power X (Suc n) = X ^^ Suc n
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
rel_dioid.power X n_ = X ^^ n_

goal (1 subgoal):
 1. rel_dioid.power X (Suc n_) = X ^^ Suc n_
[PROOF STEP]
by (metis rel_dioid.power_Suc2 relpow.simps(2))
[PROOF STATE]
proof (state)
this:
rel_dioid.power X (Suc n_) = X ^^ Suc n_

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in aGroup) nsum_zeroGTr:"(\<forall>j \<le> n. f j = \<zero>) \<longrightarrow> nsum A f n = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<le>n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f n = \<zero>
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>j\<le>0. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f 0 = \<zero>
 2. \<And>n. (\<forall>j\<le>n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f n = \<zero> \<Longrightarrow> (\<forall>j\<le>Suc n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<zero>
[PROOF STEP]
apply (rule impI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (\<forall>j\<le>n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f n = \<zero> \<Longrightarrow> (\<forall>j\<le>Suc n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<zero>
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<forall>j\<le>n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f n = \<zero>; \<forall>j\<le>Suc n. f j = \<zero>\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<zero>
[PROOF STEP]
apply (cut_tac n = n in Nsetn_sub_mem1, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<Sigma>\<^sub>e A f n = \<zero>; \<forall>j\<le>Suc n. f j = \<zero>\<rbrakk> \<Longrightarrow> \<zero> \<plusminus> \<zero> = \<zero>
[PROOF STEP]
apply (cut_tac ex_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<Sigma>\<^sub>e A f n = \<zero>; \<forall>j\<le>Suc n. f j = \<zero>; \<zero> \<in> carrier A\<rbrakk> \<Longrightarrow> \<zero> \<plusminus> \<zero> = \<zero>
[PROOF STEP]
apply (simp add:l_zero[of \<zero>])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma double_nonneg_le:
  fixes a::real
  shows "a * 2 \<le> b \<Longrightarrow> a \<ge> 0 \<Longrightarrow> a \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a * 2 \<le> b; 0 \<le> a\<rbrakk> \<Longrightarrow> a \<le> b
[PROOF STEP]
by arith


[STATEMENT]
lemma mat_max_ge: "max\<^sub>m A B \<ge>\<^sub>m A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max\<^sub>m A B \<ge>\<^sub>m A
[PROOF STEP]
unfolding mat_max_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (dim_row A) (dim_col A) (\<lambda>ij. max (A $$ ij) (B $$ ij)) \<ge>\<^sub>m A
[PROOF STEP]
by (intro mat_geI[of _ "dim_row A" "dim_col A"], auto)


[STATEMENT]
lemma snd_mono: "x \<le> y \<Longrightarrow> snd x \<le> snd y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> snd x \<le> snd y
[PROOF STEP]
unfolding less_eq_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst x \<le> fst y \<and> snd x \<le> snd y \<Longrightarrow> snd x \<le> snd y
[PROOF STEP]
by simp


[STATEMENT]
lemma satisfiable_true: "satisfiable (Bc True)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. satisfiable (Bc True)
[PROOF STEP]
by (simp add: satisfiable_def)


[STATEMENT]
lemma EM_remainder_cnj:
  assumes "continuous_on {a..} f"
  shows   "EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
proof (cases "EM_remainder_converges n f a")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
 2. \<not> EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> EM_remainder_converges n f a

goal (2 subgoals):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
 2. \<not> EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
hence "\<not>EM_remainder_converges n (\<lambda>x. cnj (f x)) a"
[PROOF STATE]
proof (prove)
using this:
\<not> EM_remainder_converges n f a

goal (1 subgoal):
 1. \<not> EM_remainder_converges n (\<lambda>x. cnj (f x)) a
[PROOF STEP]
by (subst EM_remainder_converges_cnj_iff [OF assms])
[PROOF STATE]
proof (state)
this:
\<not> EM_remainder_converges n (\<lambda>x. cnj (f x)) a

goal (2 subgoals):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
 2. \<not> EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> EM_remainder_converges n f a
\<not> EM_remainder_converges n (\<lambda>x. cnj (f x)) a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> EM_remainder_converges n f a
\<not> EM_remainder_converges n (\<lambda>x. cnj (f x)) a

goal (1 subgoal):
 1. EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
by (simp add: EM_remainder_def)
[PROOF STATE]
proof (state)
this:
EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)

goal (1 subgoal):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
EM_remainder_converges n f a

goal (1 subgoal):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
EM_remainder_converges n f a
[PROOF STEP]
obtain L where L: "((\<lambda>x. EM_remainder' n f (real_of_int a) (real_of_int x)) \<longlongrightarrow> L) at_top"
[PROOF STATE]
proof (prove)
using this:
EM_remainder_converges n f a

goal (1 subgoal):
 1. (\<And>L. ((\<lambda>x. EM_remainder' n f (real_of_int a) (real_of_int x)) \<longlongrightarrow> L) at_top \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding EM_remainder_converges_def
[PROOF STATE]
proof (prove)
using this:
\<exists>L. ((\<lambda>x. EM_remainder' n f (real_of_int a) (real_of_int x)) \<longlongrightarrow> L) at_top

goal (1 subgoal):
 1. (\<And>L. ((\<lambda>x. EM_remainder' n f (real_of_int a) (real_of_int x)) \<longlongrightarrow> L) at_top \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>x. EM_remainder' n f (real_of_int a) (real_of_int x)) \<longlongrightarrow> L) at_top

goal (1 subgoal):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
note tendsto_cnj [OF this]
[PROOF STATE]
proof (state)
this:
((\<lambda>x. cnj (EM_remainder' n f (real_of_int a) (real_of_int x))) \<longlongrightarrow> cnj L) at_top

goal (1 subgoal):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. cnj (EM_remainder' n f (real_of_int a) (real_of_int x))) \<longlongrightarrow> cnj L) at_top

goal (1 subgoal):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
have "(\<lambda>x. cnj (EM_remainder' n f (real_of_int a) (real_of_int x))) =
               (\<lambda>x. EM_remainder' n (\<lambda>x. cnj (f x)) (real_of_int a) (real_of_int x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. cnj (EM_remainder' n f (real_of_int a) (real_of_int x))) = (\<lambda>x. EM_remainder' n (\<lambda>x. cnj (f x)) (real_of_int a) (real_of_int x))
[PROOF STEP]
by (subst EM_remainder'_bounded_linear [OF bounded_linear_cnj])
       (rule continuous_on_subset [OF assms(1)], auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. cnj (EM_remainder' n f (real_of_int a) (real_of_int x))) = (\<lambda>x. EM_remainder' n (\<lambda>x. cnj (f x)) (real_of_int a) (real_of_int x))

goal (1 subgoal):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. EM_remainder' n (\<lambda>x. cnj (f x)) (real_of_int a) (real_of_int x)) \<longlongrightarrow> cnj L) at_top
[PROOF STEP]
have L': "(\<dots> \<longlongrightarrow> cnj L) at_top"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. EM_remainder' n (\<lambda>x. cnj (f x)) (real_of_int a) (real_of_int x)) \<longlongrightarrow> cnj L) at_top

goal (1 subgoal):
 1. ((\<lambda>x. EM_remainder' n (\<lambda>x. cnj (f x)) (real_of_int a) (real_of_int x)) \<longlongrightarrow> cnj L) at_top
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. EM_remainder' n (\<lambda>x. cnj (f x)) (real_of_int a) (real_of_int x)) \<longlongrightarrow> cnj L) at_top

goal (1 subgoal):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>x. EM_remainder' n (\<lambda>x. cnj (f x)) (real_of_int a) (real_of_int x)) \<longlongrightarrow> cnj L) at_top

goal (1 subgoal):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
from assms and L
[PROOF STATE]
proof (chain)
picking this:
continuous_on {real_of_int a..} f
((\<lambda>x. EM_remainder' n f (real_of_int a) (real_of_int x)) \<longlongrightarrow> L) at_top
[PROOF STEP]
have "EM_remainder n f a = L"
[PROOF STATE]
proof (prove)
using this:
continuous_on {real_of_int a..} f
((\<lambda>x. EM_remainder' n f (real_of_int a) (real_of_int x)) \<longlongrightarrow> L) at_top

goal (1 subgoal):
 1. EM_remainder n f a = L
[PROOF STEP]
by (intro EM_remainder_eqI)
[PROOF STATE]
proof (state)
this:
EM_remainder n f a = L

goal (1 subgoal):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. EM_remainder' n (\<lambda>x. cnj (f x)) (real_of_int a) (real_of_int x)) \<longlongrightarrow> cnj L) at_top
EM_remainder n f a = L
[PROOF STEP]
show "EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. EM_remainder' n (\<lambda>x. cnj (f x)) (real_of_int a) (real_of_int x)) \<longlongrightarrow> cnj L) at_top
EM_remainder n f a = L

goal (1 subgoal):
 1. EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
using L'
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. EM_remainder' n (\<lambda>x. cnj (f x)) (real_of_int a) (real_of_int x)) \<longlongrightarrow> cnj L) at_top
EM_remainder n f a = L
((\<lambda>x. EM_remainder' n (\<lambda>x. cnj (f x)) (real_of_int a) (real_of_int x)) \<longlongrightarrow> cnj L) at_top

goal (1 subgoal):
 1. EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)
[PROOF STEP]
by (intro EM_remainder_eqI) simp_all
[PROOF STATE]
proof (state)
this:
EM_remainder n (\<lambda>x. cnj (f x)) a = cnj (EM_remainder n f a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Fin_neg_numeral[code_post]: "Fin (- numeral w) = - numeral w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fin (- numeral w) = - numeral w
[PROOF STEP]
by (simp only: Fin_numeral uminus_extended.simps[symmetric])


[STATEMENT]
lemma reciprocal_degree: "reciprocal_poly (degree P) P = reflect_poly P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reciprocal_poly (degree P) P = reflect_poly P
[PROOF STEP]
by (auto simp add: reciprocal_poly_def reflect_poly_def)


[STATEMENT]
lemma uniformly_continuous_on_setdist: "uniformly_continuous_on T (\<lambda>y. (setdist {y} S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniformly_continuous_on T (\<lambda>y. setdist {y} S)
[PROOF STEP]
by (force simp: uniformly_continuous_on_def dist_real_def intro: le_less_trans [OF setdist_Lipschitz])


[STATEMENT]
lemma Crypt_synth_analz:
     "[| Key K \<in> analz H;  Key (invKey K) \<in> analz H |]
       ==> (Crypt K X \<in> synth (analz H)) = (X \<in> synth (analz H))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Key K \<in> analz H; Key (invKey K) \<in> analz H\<rbrakk> \<Longrightarrow> (Crypt K X \<in> synth (analz H)) = (X \<in> synth (analz H))
[PROOF STEP]
by blast


[STATEMENT]
lemma order_gt_1_gen_not_1:
  assumes "order G > 1"
  shows "\<^bold>g \<noteq> \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>g \<noteq> \<one>
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
assume "\<not> \<^bold>g \<noteq> \<one>"
[PROOF STATE]
proof (state)
this:
\<not> \<^bold>g \<noteq> \<one>

goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
hence "\<^bold>g = \<one>"
[PROOF STATE]
proof (prove)
using this:
\<not> \<^bold>g \<noteq> \<one>

goal (1 subgoal):
 1. \<^bold>g = \<one>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<^bold>g = \<one>

goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
hence g_pow_eq_1: "\<^bold>g [^] n = \<one>" for n :: nat
[PROOF STATE]
proof (prove)
using this:
\<^bold>g = \<one>

goal (1 subgoal):
 1. \<^bold>g [^] n = \<one>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] ?n = \<one>

goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
hence "range (\<lambda>n :: nat. \<^bold>g [^] n) = {\<one>}"
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] ?n = \<one>

goal (1 subgoal):
 1. range (([^]) \<^bold>g) = {\<one>}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
range (([^]) \<^bold>g) = {\<one>}

goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
hence "carrier G \<subseteq> {\<one>}"
[PROOF STATE]
proof (prove)
using this:
range (([^]) \<^bold>g) = {\<one>}

goal (1 subgoal):
 1. carrier G \<subseteq> {\<one>}
[PROOF STEP]
using generator
[PROOF STATE]
proof (prove)
using this:
range (([^]) \<^bold>g) = {\<one>}
carrier G \<subseteq> range (([^]) \<^bold>g)

goal (1 subgoal):
 1. carrier G \<subseteq> {\<one>}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
carrier G \<subseteq> {\<one>}

goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
hence "order G < 1"
[PROOF STATE]
proof (prove)
using this:
carrier G \<subseteq> {\<one>}

goal (1 subgoal):
 1. order G < 1
[PROOF STEP]
by (metis One_nat_def assms g_pow_eq_1 inj_onD inj_on_generator lessThan_iff not_gr_zero zero_less_Suc)
[PROOF STATE]
proof (state)
this:
order G < 1

goal (1 subgoal):
 1. \<not> \<^bold>g \<noteq> \<one> \<Longrightarrow> False
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
1 < order G
order G < 1
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
1 < order G
order G < 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_sub_one[simp]:
  shows "0\<^sub>h -\<^sub>h 1\<^sub>h = of_complex (-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>h -\<^sub>h 1\<^sub>h = of_complex (- 1)
[PROOF STEP]
by (metis of_complex_one zero_sub_left)


[STATEMENT]
lemma llexord_antisym:
  "\<lbrakk> llexord r xs ys; llexord r ys xs;
    !!a b. \<lbrakk> r a b; r b a \<rbrakk> \<Longrightarrow> False \<rbrakk>
  \<Longrightarrow> xs = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>llexord r xs ys; llexord r ys xs; \<And>a b. \<lbrakk>r a b; r b a\<rbrakk> \<Longrightarrow> False\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
using antisympD[OF antisym_llexord, of r xs ys]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>antisymp r; \<And>x. \<not> r x x; llexord r xs ys; llexord r ys xs\<rbrakk> \<Longrightarrow> xs = ys

goal (1 subgoal):
 1. \<lbrakk>llexord r xs ys; llexord r ys xs; \<And>a b. \<lbrakk>r a b; r b a\<rbrakk> \<Longrightarrow> False\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
by(auto intro: antisympI)


[STATEMENT]
lemma remdups_ex2:
  "length (remdups xs) > 1 \<Longrightarrow> \<exists>a \<in> set xs. \<exists>b \<in> set xs. a \<noteq> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < length (remdups xs) \<Longrightarrow> \<exists>a\<in>set xs. \<exists>b\<in>set xs. a \<noteq> b
[PROOF STEP]
by (metis distinct_Ex1 distinct_remdups less_trans nth_mem set_remdups zero_less_one zero_neq_one)


[STATEMENT]
lemma heap_fixp_mono[partial_function_mono]:
  assumes [partial_function_mono]:
    "\<And>x d. mono_Heap (\<lambda>xa. B x xa d)"
    "\<And>Z xa. mono_Heap (\<lambda>a. B a Z xa)"
  shows "mono_Heap (\<lambda>x. heap.fixp_fun (\<lambda>D \<sigma>. B x D \<sigma>) \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone heap.le_fun Heap_ord (\<lambda>x. heap.fixp_fun (B x) \<sigma>)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. heap.le_fun x y \<Longrightarrow> Heap_ord (heap.fixp_fun (B x) \<sigma>) (heap.fixp_fun (B y) \<sigma>)
[PROOF STEP]
apply (rule ccpo.fixp_mono[OF heap.ccpo, THEN fun_ordD])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x y. heap.le_fun x y \<Longrightarrow> monotone heap.le_fun heap.le_fun (B x)
 2. \<And>x y. heap.le_fun x y \<Longrightarrow> monotone heap.le_fun heap.le_fun (B y)
 3. \<And>x y Z. heap.le_fun x y \<Longrightarrow> heap.le_fun (B x Z) (B y Z)
[PROOF STEP]
apply (rule mono_fun_fun_cnv, erule thin_rl, pf_mono)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y Z. heap.le_fun x y \<Longrightarrow> heap.le_fun (B x Z) (B y Z)
[PROOF STEP]
apply (rule fun_ordI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y Z xa. heap.le_fun x y \<Longrightarrow> Heap_ord (B x Z xa) (B y Z xa)
[PROOF STEP]
apply (erule monotoneD[of "fun_ord Heap_ord" Heap_ord, rotated])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y Z xa. monotone heap.le_fun Heap_ord (\<lambda>a. B a Z xa)
[PROOF STEP]
apply pf_mono
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma pos_le_divide_eq [field_simps]:
  assumes "0 < c"
  shows "a \<le> b / c \<longleftrightarrow> a * c \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<le> b / c) = (a * c \<le> b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(0::'a) < c

goal (1 subgoal):
 1. (a \<le> b / c) = (a * c \<le> b)
[PROOF STEP]
by (metis local.divide_eq_imp local.divide_inverse_commute
      local.dual_order.order_iff_strict local.dual_order.strict_iff_order
      local.mult_right_mono local.mult_strict_left_mono local.nonzero_divide_eq_eq
      local.order.strict_implies_order local.positive_imp_inverse_positive)


[STATEMENT]
lemma neg_in_model: "\<not> M n \<Longrightarrow> 0 < n \<Longrightarrow> n < n_vars \<Longrightarrow> - (int n) \<in> set (model_to_dimacs_model M [1..<n_vars])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> M n; 0 < n; n < n_vars\<rbrakk> \<Longrightarrow> - int n \<in> set (model_to_dimacs_model M [1..<n_vars])
[PROOF STEP]
by (induction n_vars) (auto simp add: less_Suc_eq model_to_dimacs_model_append)


[STATEMENT]
lemma cis_plus_2pi_neq_1: assumes x: "0 < x" "x < 2 * pi"
  shows "cis x \<noteq> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis x \<noteq> 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cis x \<noteq> 1
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
0 < x
x < 2 * pi
[PROOF STEP]
have "cos x \<noteq> 1"
[PROOF STATE]
proof (prove)
using this:
0 < x
x < 2 * pi

goal (1 subgoal):
 1. cos x \<noteq> 1
[PROOF STEP]
by (smt cos_2pi_minus cos_monotone_0_pi cos_zero)
[PROOF STATE]
proof (state)
this:
cos x \<noteq> 1

goal (1 subgoal):
 1. cis x \<noteq> 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
cos x \<noteq> 1

goal (1 subgoal):
 1. cis x \<noteq> 1
[PROOF STEP]
by (auto simp: complex_eq_iff)
[PROOF STATE]
proof (state)
this:
cis x \<noteq> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_factorization_unique:
  assumes "x \<noteq> 0" "y \<noteq> 0"
  shows   "prime_factorization x = prime_factorization y \<longleftrightarrow> normalize x = normalize y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (prime_factorization x = prime_factorization y) = (normalize x = normalize y)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. prime_factorization x = prime_factorization y \<Longrightarrow> normalize x = normalize y
 2. normalize x = normalize y \<Longrightarrow> prime_factorization x = prime_factorization y
[PROOF STEP]
assume "prime_factorization x = prime_factorization y"
[PROOF STATE]
proof (state)
this:
prime_factorization x = prime_factorization y

goal (2 subgoals):
 1. prime_factorization x = prime_factorization y \<Longrightarrow> normalize x = normalize y
 2. normalize x = normalize y \<Longrightarrow> prime_factorization x = prime_factorization y
[PROOF STEP]
hence "prod_mset (prime_factorization x) = prod_mset (prime_factorization y)"
[PROOF STATE]
proof (prove)
using this:
prime_factorization x = prime_factorization y

goal (1 subgoal):
 1. \<Prod>\<^sub># (prime_factorization x) = \<Prod>\<^sub># (prime_factorization y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Prod>\<^sub># (prime_factorization x) = \<Prod>\<^sub># (prime_factorization y)

goal (2 subgoals):
 1. prime_factorization x = prime_factorization y \<Longrightarrow> normalize x = normalize y
 2. normalize x = normalize y \<Longrightarrow> prime_factorization x = prime_factorization y
[PROOF STEP]
hence "normalize (prod_mset (prime_factorization x)) =
         normalize (prod_mset (prime_factorization y))"
[PROOF STATE]
proof (prove)
using this:
\<Prod>\<^sub># (prime_factorization x) = \<Prod>\<^sub># (prime_factorization y)

goal (1 subgoal):
 1. normalize (\<Prod>\<^sub># (prime_factorization x)) = normalize (\<Prod>\<^sub># (prime_factorization y))
[PROOF STEP]
by (simp only: )
[PROOF STATE]
proof (state)
this:
normalize (\<Prod>\<^sub># (prime_factorization x)) = normalize (\<Prod>\<^sub># (prime_factorization y))

goal (2 subgoals):
 1. prime_factorization x = prime_factorization y \<Longrightarrow> normalize x = normalize y
 2. normalize x = normalize y \<Longrightarrow> prime_factorization x = prime_factorization y
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> (0::'a)
y \<noteq> (0::'a)
normalize (\<Prod>\<^sub># (prime_factorization x)) = normalize (\<Prod>\<^sub># (prime_factorization y))
[PROOF STEP]
show "normalize x = normalize y"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)
y \<noteq> (0::'a)
normalize (\<Prod>\<^sub># (prime_factorization x)) = normalize (\<Prod>\<^sub># (prime_factorization y))

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

goal (1 subgoal):
 1. normalize x = normalize y \<Longrightarrow> prime_factorization x = prime_factorization y
[PROOF STEP]
qed (rule prime_factorization_cong)


[STATEMENT]
lemma int_pos_mult_monol:"\<lbrakk> 0 < (m::int); 0 \<le> n * m \<rbrakk> \<Longrightarrow> 0 \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; 0 \<le> n * m\<rbrakk> \<Longrightarrow> 0 \<le> n
[PROOF STEP]
apply (rule int_pos_mult_monor, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; 0 \<le> n * m\<rbrakk> \<Longrightarrow> 0 \<le> m * n
[PROOF STEP]
apply (simp add:mult.commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma keys_monom_of_set_finite [simp]: "finite X \<Longrightarrow> keys (monom_of_set X) = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite X \<Longrightarrow> keys (monom_of_set X) = X
[PROOF STEP]
by (simp add: keys_monom_of_set)


[STATEMENT]
lemma invh_baldL_Black:
  "\<lbrakk> invh l;  invh r;  bheight l + 1 = bheight r;  color r = Black \<rbrakk>
   \<Longrightarrow> invh (baldL l a r) \<and> bheight (baldL l a r) = bheight r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invh l; invh r; bheight l + 1 = bheight r; color r = Black\<rbrakk> \<Longrightarrow> invh (baldL l a r) \<and> bheight (baldL l a r) = bheight r
[PROOF STEP]
by (induct l a r rule: baldL.induct) (auto simp add: invh_baliR bheight_baliR)


[STATEMENT]
lemma skip_fun_im1:"\<lbrakk>i \<in> {j. j \<le> (Suc n)}; x \<in> {j. j \<le> n}\<rbrakk> \<Longrightarrow>
                      (skip i) x \<in> ({j. j \<le> (Suc n)} - {i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<in> {j. j \<le> Suc n}; x \<in> {j. j \<le> n}\<rbrakk> \<Longrightarrow> skip i x \<in> {j. j \<le> Suc n} - {i}
[PROOF STEP]
by (subst skip_fun_im[THEN sym], assumption,
    simp add:image_def, blast)


[STATEMENT]
lemma vimage_vintersection: "r `\<^sub>\<circ> (A \<inter>\<^sub>\<circ> B) \<subseteq>\<^sub>\<circ> r `\<^sub>\<circ> A \<inter>\<^sub>\<circ> r `\<^sub>\<circ> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r `\<^sub>\<circ> (A \<inter>\<^sub>\<circ> B) \<subseteq>\<^sub>\<circ> r `\<^sub>\<circ> A \<inter>\<^sub>\<circ> r `\<^sub>\<circ> B
[PROOF STEP]
by auto


[STATEMENT]
lemma list_every_elemnt_bound_sum_bound:"\<forall> x \<in> set xs. f x \<le> bound \<Longrightarrow>  foldr (\<lambda> a b. a+b) (map f xs) i \<le> length xs * bound + i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set xs. f x \<le> bound \<Longrightarrow> foldr (+) (map f xs) i \<le> length xs * bound + i
[PROOF STEP]
by(induction xs) auto


[STATEMENT]
lemma isomorphic_group_triviality:
  assumes "G \<cong> H" "group G" "group H"
  shows "trivial_group G \<longleftrightarrow> trivial_group H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trivial_group G = trivial_group H
[PROOF STEP]
by (meson assms group.iso_sym isomorphic_group_triviality1)


[STATEMENT]
lemma vpairsE[elim]:
  assumes "x \<in>\<^sub>\<circ> vpairs r"
  obtains a b where "x = \<langle>a, b\<rangle>" and "\<langle>a, b\<rangle> \<in>\<^sub>\<circ> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = \<langle>a, b\<rangle>; \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> vpairs r

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = \<langle>a, b\<rangle>; \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding vpairs_def
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> set {x. x \<in>\<^sub>\<circ> r \<and> (\<exists>a b. x = \<langle>a, b\<rangle>)}

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = \<langle>a, b\<rangle>; \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma additive_in_ivp_sols:
  assumes "s \<in> S" and "\<P> (\<lambda>\<tau>. \<tau> + t) T \<subseteq> T"
  shows "(\<lambda>\<tau>. \<phi> (\<tau> + t) s) \<in> Sols (\<lambda>t. f) (\<lambda>s. T) S 0 (\<phi> (0 + t) s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>\<tau>. \<phi> (\<tau> + t) s) \<in> Sols (\<lambda>t. f) (\<lambda>s. T) S 0 (\<phi> (0 + t) s)
[PROOF STEP]
apply(rule ivp_solsI[OF vderiv_on_composeI])
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1.  D (\<lambda>a. \<phi> a s) = ?f'1 on \<P> (\<lambda>ta. ta + t) T
 2.  D (\<lambda>ta. ta + t) = ?g'1 on T
 3. (\<lambda>\<tau>. f (\<phi> (\<tau> + t) s)) = (\<lambda>\<tau>. ?g'1 \<tau> *\<^sub>R ?f'1 (\<tau> + t))
 4. \<phi> (0 + t) s = \<phi> (0 + t) s
 5. (\<lambda>\<tau>. \<phi> (\<tau> + t) s) \<in> T \<rightarrow> S
 6. 0 \<in> T
[PROOF STEP]
apply(rule has_vderiv_on_subset[OF has_vderiv_on_domain])
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. s \<in> S
 2. \<P> (\<lambda>ta. ta + t) T \<subseteq> T
 3.  D (\<lambda>ta. ta + t) = ?g'1 on T
 4. (\<lambda>\<tau>. f (\<phi> (\<tau> + t) s)) = (\<lambda>\<tau>. ?g'1 \<tau> *\<^sub>R f (\<phi> (\<tau> + t) s))
 5. \<phi> (0 + t) s = \<phi> (0 + t) s
 6. (\<lambda>\<tau>. \<phi> (\<tau> + t) s) \<in> T \<rightarrow> S
 7. 0 \<in> T
[PROOF STEP]
using in_domain assms init_time
[PROOF STATE]
proof (prove)
using this:
?s \<in> S \<Longrightarrow> (\<lambda>t. \<phi> t ?s) \<in> T \<rightarrow> S
s \<in> S
\<P> (\<lambda>\<tau>. \<tau> + t) T \<subseteq> T
0 \<in> T

goal (7 subgoals):
 1. s \<in> S
 2. \<P> (\<lambda>ta. ta + t) T \<subseteq> T
 3.  D (\<lambda>ta. ta + t) = ?g'1 on T
 4. (\<lambda>\<tau>. f (\<phi> (\<tau> + t) s)) = (\<lambda>\<tau>. ?g'1 \<tau> *\<^sub>R f (\<phi> (\<tau> + t) s))
 5. \<phi> (0 + t) s = \<phi> (0 + t) s
 6. (\<lambda>\<tau>. \<phi> (\<tau> + t) s) \<in> T \<rightarrow> S
 7. 0 \<in> T
[PROOF STEP]
by (auto intro!: poly_derivatives)


[STATEMENT]
lemma rat_to_int_poly: assumes "rat_to_int_poly p = (d,q)"
  shows "p = smult (inverse (of_int d)) (map_poly of_int q)" "d > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = smult (inverse (rat_of_int d)) (of_int_poly q) &&& 0 < d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = smult (inverse (rat_of_int d)) (of_int_poly q)
 2. 0 < d
[PROOF STEP]
let ?f = "\<lambda> x. case quotient_of x of (pa, x) \<Rightarrow> pa * d div x"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = smult (inverse (rat_of_int d)) (of_int_poly q)
 2. 0 < d
[PROOF STEP]
define f where "f = ?f"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. case quotient_of x of (pa, x) \<Rightarrow> pa * d div x)

goal (2 subgoals):
 1. p = smult (inverse (rat_of_int d)) (of_int_poly q)
 2. 0 < d
[PROOF STEP]
from assms[unfolded rat_to_int_poly_def Let_def]
[PROOF STATE]
proof (chain)
picking this:
(fst (common_denom (coeffs p)), map_poly (\<lambda>x. case quotient_of x of (pa, x) \<Rightarrow> pa * fst (common_denom (coeffs p)) div x) p) = (d, q)
[PROOF STEP]
obtain xs where cd: "common_denom (coeffs p) = (d,xs)"
    and q: "q = map_poly f p"
[PROOF STATE]
proof (prove)
using this:
(fst (common_denom (coeffs p)), map_poly (\<lambda>x. case quotient_of x of (pa, x) \<Rightarrow> pa * fst (common_denom (coeffs p)) div x) p) = (d, q)

goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>common_denom (coeffs p) = (d, xs); q = map_poly f p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
using this:
(fst (common_denom (coeffs p)), map_poly (\<lambda>x. case quotient_of x of (pa, x) \<Rightarrow> pa * fst (common_denom (coeffs p)) div x) p) = (d, q)

goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>common_denom (coeffs p) = (d, xs); q = map_poly (\<lambda>x. case quotient_of x of (pa, x) \<Rightarrow> pa * d div x) p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "common_denom (coeffs p)", auto)
[PROOF STATE]
proof (state)
this:
common_denom (coeffs p) = (d, xs)
q = map_poly f p

goal (2 subgoals):
 1. p = smult (inverse (rat_of_int d)) (of_int_poly q)
 2. 0 < d
[PROOF STEP]
from common_denom[OF cd]
[PROOF STATE]
proof (chain)
picking this:
coeffs p = map (\<lambda>i. rat_of_int i / rat_of_int d) xs
0 < d
?x \<in> set (coeffs p) \<Longrightarrow> rat_of_int (case quotient_of ?x of (n, x) \<Rightarrow> n * d div x) / rat_of_int d = ?x
[PROOF STEP]
have d: "d > 0"  and
    id: "\<And> x. x \<in> set (coeffs p) \<Longrightarrow> rat_of_int (f x) / rat_of_int d = x"
[PROOF STATE]
proof (prove)
using this:
coeffs p = map (\<lambda>i. rat_of_int i / rat_of_int d) xs
0 < d
?x \<in> set (coeffs p) \<Longrightarrow> rat_of_int (case quotient_of ?x of (n, x) \<Rightarrow> n * d div x) / rat_of_int d = ?x

goal (1 subgoal):
 1. 0 < d &&& (\<And>x. x \<in> set (coeffs p) \<Longrightarrow> rat_of_int (f x) / rat_of_int d = x)
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
using this:
coeffs p = map (\<lambda>i. rat_of_int i / rat_of_int d) xs
0 < d
?x \<in> set (coeffs p) \<Longrightarrow> rat_of_int (case quotient_of ?x of (n, x) \<Rightarrow> n * d div x) / rat_of_int d = ?x

goal (1 subgoal):
 1. 0 < d &&& (\<And>x. x \<in> set (coeffs p) \<Longrightarrow> rat_of_int (case quotient_of x of (pa, x) \<Rightarrow> pa * d div x) / rat_of_int d = x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < d
?x \<in> set (coeffs p) \<Longrightarrow> rat_of_int (f ?x) / rat_of_int d = ?x

goal (2 subgoals):
 1. p = smult (inverse (rat_of_int d)) (of_int_poly q)
 2. 0 < d
[PROOF STEP]
have f0: "f 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 = 0
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case quotient_of 0 of (pa, x) \<Rightarrow> pa * d div x) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f 0 = 0

goal (2 subgoals):
 1. p = smult (inverse (rat_of_int d)) (of_int_poly q)
 2. 0 < d
[PROOF STEP]
have id: "rat_of_int (f (coeff p n)) / rat_of_int d = coeff p n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int (f (coeff p n)) / rat_of_int d = coeff p n
[PROOF STEP]
using id[of "coeff p n"] f0 range_coeff
[PROOF STATE]
proof (prove)
using this:
coeff p n \<in> set (coeffs p) \<Longrightarrow> rat_of_int (f (coeff p n)) / rat_of_int d = coeff p n
f 0 = 0
range (coeff ?p) = insert (0::?'a) (set (coeffs ?p))

goal (1 subgoal):
 1. rat_of_int (f (coeff p n)) / rat_of_int d = coeff p n
[PROOF STEP]
by (cases "coeff p n = 0", auto)
[PROOF STATE]
proof (state)
this:
rat_of_int (f (coeff p ?n)) / rat_of_int d = coeff p ?n

goal (2 subgoals):
 1. p = smult (inverse (rat_of_int d)) (of_int_poly q)
 2. 0 < d
[PROOF STEP]
show "d > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < d
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
0 < d

goal (1 subgoal):
 1. p = smult (inverse (rat_of_int d)) (of_int_poly q)
[PROOF STEP]
show "p = smult (inverse (of_int d)) (map_poly of_int q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = smult (inverse (rat_of_int d)) (of_int_poly q)
[PROOF STEP]
unfolding q smult_as_map_poly
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = map_poly ((*) (inverse (rat_of_int d))) (of_int_poly (map_poly f p))
[PROOF STEP]
using id f0
[PROOF STATE]
proof (prove)
using this:
rat_of_int (f (coeff p ?n)) / rat_of_int d = coeff p ?n
f 0 = 0

goal (1 subgoal):
 1. p = map_poly ((*) (inverse (rat_of_int d))) (of_int_poly (map_poly f p))
[PROOF STEP]
by (intro poly_eqI, auto simp: field_simps coeff_map_poly)
[PROOF STATE]
proof (state)
this:
p = smult (inverse (rat_of_int d)) (of_int_poly q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma supp_mono: "finite (B::'a::fs set) \<Longrightarrow> A \<subseteq> B \<Longrightarrow> supp A \<subseteq> supp B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite B; A \<subseteq> B\<rbrakk> \<Longrightarrow> supp A \<subseteq> supp B
[PROOF STEP]
by (metis infinite_super subset_Un_eq supp_of_finite_union)


[STATEMENT]
lemma sliden_hom:"i < j \<Longrightarrow> (sliden i) \<in> nset i j \<rightarrow>  {k. k \<le> (j - i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < j \<Longrightarrow> sliden i \<in> nset i j \<rightarrow> {k. k \<le> j - i}
[PROOF STEP]
by (simp add:Pi_def, rule allI, rule impI, simp add:sliden_def,
       simp add:nset_def, erule conjE, simp add:diff_le_mono)


[STATEMENT]
lemma ennreal_suminf_divide[simp]: "(\<Sum>i. f i / r) = (\<Sum>i. f i::ennreal) / r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. f i / r) = (\<Sum>i. f i) / r
[PROOF STEP]
by (simp add: divide_ennreal_def)


[STATEMENT]
lemma Legendre_mod[simp]: "p dvd n \<Longrightarrow> Legendre (a mod n) p = Legendre a p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p dvd n \<Longrightarrow> Legendre (a mod n) p = Legendre a p
[PROOF STEP]
by (simp add: mod_mod_cancel Legendre_def cong_def)


[STATEMENT]
lemma Crypt_synth_analz:
     "[| Key K \<in> analz H;  Key (invKey K) \<in> analz H |]
       ==> (Crypt K X \<in> synth (analz H)) = (X \<in> synth (analz H))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Key K \<in> analz H; Key (invKey K) \<in> analz H\<rbrakk> \<Longrightarrow> (Crypt K X \<in> synth (analz H)) = (X \<in> synth (analz H))
[PROOF STEP]
by blast


[STATEMENT]
lemma gamma_inf: "\<gamma>(a1 \<sqinter> a2) = \<gamma> a1 \<inter> \<gamma> a2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<gamma> (a1 \<sqinter> a2) = \<gamma> a1 \<inter> \<gamma> a2
[PROOF STEP]
by(rule equalityI[OF _ inter_gamma_subset_gamma_inf])
  (metis inf_le1 inf_le2 le_inf_iff mono_gamma)


[STATEMENT]
lemma bilinear_bounded_pos:
  fixes h :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::real_normed_vector"
  assumes bh: "bilinear h"
  shows "\<exists>B > 0. \<forall>x y. norm (h x y) \<le> B * norm x * norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B>0. \<forall>x y. norm (h x y) \<le> B * norm x * norm y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>B>0. \<forall>x y. norm (h x y) \<le> B * norm x * norm y
[PROOF STEP]
have "\<exists>B > 0. \<forall>x y. norm (h x y) \<le> norm x * norm y * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B>0. \<forall>x y. norm (h x y) \<le> norm x * norm y * B
[PROOF STEP]
using bh [unfolded bilinear_conv_bounded_bilinear]
[PROOF STATE]
proof (prove)
using this:
bounded_bilinear h

goal (1 subgoal):
 1. \<exists>B>0. \<forall>x y. norm (h x y) \<le> norm x * norm y * B
[PROOF STEP]
by (rule bounded_bilinear.pos_bounded)
[PROOF STATE]
proof (state)
this:
\<exists>B>0. \<forall>x y. norm (h x y) \<le> norm x * norm y * B

goal (1 subgoal):
 1. \<exists>B>0. \<forall>x y. norm (h x y) \<le> B * norm x * norm y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>B>0. \<forall>x y. norm (h x y) \<le> norm x * norm y * B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>B>0. \<forall>x y. norm (h x y) \<le> norm x * norm y * B

goal (1 subgoal):
 1. \<exists>B>0. \<forall>x y. norm (h x y) \<le> B * norm x * norm y
[PROOF STEP]
by (simp only: ac_simps)
[PROOF STATE]
proof (state)
this:
\<exists>B>0. \<forall>x y. norm (h x y) \<le> B * norm x * norm y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_cross_ratio:
  assumes "u \<noteq> v" and "u \<noteq> w" and "v \<noteq> w"
  shows "\<exists> z. cross_ratio z u v w = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. cross_ratio z u v w = c
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>z. cross_ratio z u v w = c
[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 assms is_moebius_cross_ratio[of u v w]
[PROOF STATE]
proof (prove)
using this:
u \<noteq> v
u \<noteq> w
v \<noteq> w
\<lbrakk>u \<noteq> v; v \<noteq> w; u \<noteq> w\<rbrakk> \<Longrightarrow> 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:
u \<noteq> v
u \<noteq> w
v \<noteq> w
\<lbrakk>u \<noteq> v; v \<noteq> w; u \<noteq> w\<rbrakk> \<Longrightarrow> \<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. \<exists>z. cross_ratio z u v w = c
[PROOF STEP]
hence *: "\<forall> z. cross_ratio z u v w = 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. \<forall>z. cross_ratio z u v w = moebius_pt M z
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<forall>z. cross_ratio z u v w = moebius_pt M z

goal (1 subgoal):
 1. \<exists>z. cross_ratio z u v w = c
[PROOF STEP]
let ?z = "moebius_pt (-M) c"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>z. cross_ratio z u v w = c
[PROOF STEP]
have "cross_ratio ?z u v w = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cross_ratio (moebius_pt (- M) c) u v w = c
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
\<forall>z. cross_ratio z u v w = moebius_pt M z

goal (1 subgoal):
 1. cross_ratio (moebius_pt (- M) c) u v w = c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cross_ratio (moebius_pt (- M) c) u v w = c

goal (1 subgoal):
 1. \<exists>z. cross_ratio z u v w = c
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
cross_ratio (moebius_pt (- M) c) u v w = c

goal (1 subgoal):
 1. \<exists>z. cross_ratio z u v w = c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>z. cross_ratio z u v w = c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma parallel_converter2_map1_out:
  "parallel_converter2 (map_converter f g h k conv1) conv2 =
   map_converter (map_sum f id) (map_sum g id) (map_sum h id) (map_sum k id) (parallel_converter2 conv1 conv2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. parallel_converter2 (map_converter f g h k conv1) conv2 = map_converter (map_sum f id) (map_sum g id) (map_sum h id) (map_sum k id) (parallel_converter2 conv1 conv2)
[PROOF STEP]
by(simp add: map_converter_parallel_converter2)


[STATEMENT]
lemma div_to_mult_word_lt:
  "\<lbrakk> (x :: 'a :: len word) \<le> y div z \<rbrakk> \<Longrightarrow> x * z \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y div z \<Longrightarrow> x * z \<le> y
[PROOF STEP]
apply (cases "z = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<le> y div z; z = 0\<rbrakk> \<Longrightarrow> x * z \<le> y
 2. \<lbrakk>x \<le> y div z; z \<noteq> 0\<rbrakk> \<Longrightarrow> x * z \<le> y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y div z; z \<noteq> 0\<rbrakk> \<Longrightarrow> x * z \<le> y
[PROOF STEP]
apply (simp add: word_neq_0_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y div z; 0 < z\<rbrakk> \<Longrightarrow> x * z \<le> y
[PROOF STEP]
apply (rule order_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<le> y div z; 0 < z\<rbrakk> \<Longrightarrow> x * z \<le> ?y1
 2. \<lbrakk>x \<le> y div z; 0 < z\<rbrakk> \<Longrightarrow> ?y1 \<le> y
[PROOF STEP]
apply (erule(1) word_mult_le_mono1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < z \<Longrightarrow> unat (y div z) * unat z < 2 ^ LENGTH('a)
 2. \<lbrakk>x \<le> y div z; 0 < z\<rbrakk> \<Longrightarrow> y div z * z \<le> y
[PROOF STEP]
apply (simp add: unat_div)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < z \<Longrightarrow> unat y div unat z * unat z < 2 ^ LENGTH('a)
 2. \<lbrakk>x \<le> y div z; 0 < z\<rbrakk> \<Longrightarrow> y div z * z \<le> y
[PROOF STEP]
apply (rule order_le_less_trans [OF div_mult_le])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < z \<Longrightarrow> unat y < 2 ^ LENGTH('a)
 2. \<lbrakk>x \<le> y div z; 0 < z\<rbrakk> \<Longrightarrow> y div z * z \<le> y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y div z; 0 < z\<rbrakk> \<Longrightarrow> y div z * z \<le> y
[PROOF STEP]
apply (rule word_div_mult_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma type_to_set2:
  shows "class.nontriv TYPE('c)" (is ?a) and "n=CARD('c)" (is ?b)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.nontriv TYPE('c) &&& n = CARD('c)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. class.nontriv TYPE('c)
 2. n = CARD('c)
[PROOF STEP]
from local_typedef2
[PROOF STATE]
proof (chain)
picking this:
\<exists>Rep Abs. type_definition Rep Abs {0..<int n}
[PROOF STEP]
obtain Rep::"('c \<Rightarrow> int)" and Abs
    where t: "type_definition Rep Abs {0..<n :: int}"
[PROOF STATE]
proof (prove)
using this:
\<exists>Rep Abs. type_definition Rep Abs {0..<int n}

goal (1 subgoal):
 1. (\<And>Rep Abs. type_definition Rep Abs {0..<int n} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
type_definition Rep Abs {0..<int n}

goal (2 subgoals):
 1. class.nontriv TYPE('c)
 2. n = CARD('c)
[PROOF STEP]
have "card (UNIV :: 'c set) = card {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('c) = card {0..<n}
[PROOF STEP]
using t type_definition.card
[PROOF STATE]
proof (prove)
using this:
type_definition Rep Abs {0..<int n}
type_definition ?Rep ?Abs ?A \<Longrightarrow> CARD(?'b) = card ?A

goal (1 subgoal):
 1. CARD('c) = card {0..<n}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
CARD('c) = card {0..<n}

goal (2 subgoals):
 1. class.nontriv TYPE('c)
 2. n = CARD('c)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
CARD('c) = card {0..<n}

goal (2 subgoals):
 1. class.nontriv TYPE('c)
 2. n = CARD('c)
[PROOF STEP]
have "... = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {0..<n} = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {0..<n} = n

goal (2 subgoals):
 1. class.nontriv TYPE('c)
 2. n = CARD('c)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
CARD('c) = n
[PROOF STEP]
show ?b
[PROOF STATE]
proof (prove)
using this:
CARD('c) = n

goal (1 subgoal):
 1. n = CARD('c)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
n = CARD('c)

goal (1 subgoal):
 1. class.nontriv TYPE('c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = CARD('c)
[PROOF STEP]
show ?a
[PROOF STATE]
proof (prove)
using this:
n = CARD('c)

goal (1 subgoal):
 1. class.nontriv TYPE('c)
[PROOF STEP]
unfolding class.nontriv_def
[PROOF STATE]
proof (prove)
using this:
n = CARD('c)

goal (1 subgoal):
 1. 1 < CARD('c)
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
n = CARD('c)
1 < n

goal (1 subgoal):
 1. 1 < CARD('c)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
class.nontriv TYPE('c)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gval_Le [simp]:
  "gval (Le a1 a2) s = \<not>? (value_gt (aval a1 s) (aval a2 s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gval (Le a1 a2) s = \<not>? value_gt (aval a1 s) (aval a2 s)
[PROOF STEP]
by (simp add: Le_def value_gt_def gNot_def maybe_or_idempotent)


[STATEMENT]
lemma set_zero_plus2: "0 \<in> A \<Longrightarrow> B \<subseteq> A + B"
  for A B :: "'a::comm_monoid_add set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<in> A \<Longrightarrow> B \<subseteq> A + B
[PROOF STEP]
using set_plus_intro
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> ?C; ?b \<in> ?D\<rbrakk> \<Longrightarrow> ?a + ?b \<in> ?C + ?D

goal (1 subgoal):
 1. (0::'a) \<in> A \<Longrightarrow> B \<subseteq> A + B
[PROOF STEP]
by fastforce


[STATEMENT]
lemma antisym_Elem: "Elem a b \<Longrightarrow> Not (Elem b a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Elem a b \<Longrightarrow> \<not> Elem b a
[PROOF STEP]
apply (insert notsym_Elem[of a b])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Elem a b; \<not> (Elem a b \<and> Elem b a)\<rbrakk> \<Longrightarrow> \<not> Elem b a
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma UINF_atLeast_Suc:
  "(\<Sqinter> i \<in> {Suc m..} \<bullet> P(i)) = (\<Sqinter> i \<in> {m..} \<bullet> P(Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sqinter> i \<in> {Suc m..} \<bullet> P i) = (\<Sqinter> i \<in> {m..} \<bullet> P (Suc i))
[PROOF STEP]
by (rel_simp, metis (full_types) Suc_le_D not_less_eq_eq)


[STATEMENT]
lemma nonempty_some:"A \<noteq> {} \<Longrightarrow> (SOME x. x \<in> A) \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> (SOME x. x \<in> A) \<in> A
[PROOF STEP]
apply (frule nonempty_ex[of "A"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; \<exists>x. x \<in> A\<rbrakk> \<Longrightarrow> (SOME x. x \<in> A) \<in> A
[PROOF STEP]
apply (rule someI2_ex)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<noteq> {}; \<exists>x. x \<in> A\<rbrakk> \<Longrightarrow> \<exists>a. a \<in> A
 2. \<And>x. \<lbrakk>A \<noteq> {}; \<exists>x. x \<in> A; x \<in> A\<rbrakk> \<Longrightarrow> x \<in> A
[PROOF STEP]
apply simp+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_difference[simp]:
  "\<lbrakk> distinct xs; distinct ys; sorted xs; sorted ys \<rbrakk>
     \<Longrightarrow> set (difference xs ys) = set xs - set ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; distinct ys; sorted xs; sorted ys\<rbrakk> \<Longrightarrow> set (difference xs ys) = set xs - set ys
[PROOF STEP]
by (induct xs ys rule: difference.induct) (auto)


[STATEMENT]
lemma closed_segment_subset_domainI: "t0 \<in> T \<Longrightarrow> t \<in> T \<Longrightarrow> s \<in> closed_segment t0 t \<Longrightarrow> s \<in> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t0 \<in> T; t \<in> T; s \<in> {t0--t}\<rbrakk> \<Longrightarrow> s \<in> T
[PROOF STEP]
using closed_segment_subset_domain
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?t0.0 \<in> T; ?t \<in> T\<rbrakk> \<Longrightarrow> {?t0.0--?t} \<subseteq> T

goal (1 subgoal):
 1. \<lbrakk>t0 \<in> T; t \<in> T; s \<in> {t0--t}\<rbrakk> \<Longrightarrow> s \<in> T
[PROOF STEP]
by force


[STATEMENT]
lemma powr_one: "0 \<le> x \<Longrightarrow> x powr 1 = x"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> x powr 1 = x
[PROOF STEP]
using powr_realpow [of x 1]
[PROOF STATE]
proof (prove)
using this:
0 < x \<Longrightarrow> x powr real 1 = x ^ 1

goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> x powr 1 = x
[PROOF STEP]
by simp


[STATEMENT]
lemma notin_cross_events_neq:
  "\<lbrakk>Q \<in> \<P>; R \<in> \<P>; Q \<noteq> R; a \<in> Q; b \<in> R; a \<notin> R\<inter>Q\<rbrakk> \<Longrightarrow> a \<noteq> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Q \<in> \<P>; R \<in> \<P>; Q \<noteq> R; a \<in> Q; b \<in> R; a \<notin> R \<inter> Q\<rbrakk> \<Longrightarrow> a \<noteq> b
[PROOF STEP]
by blast


[STATEMENT]
lemma singular_relcycle_add:
   "\<lbrakk>singular_relcycle p X S a; singular_relcycle p X S b\<rbrakk>
        \<Longrightarrow> singular_relcycle p X S (a+b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>singular_relcycle p X S a; singular_relcycle p X S b\<rbrakk> \<Longrightarrow> singular_relcycle p X S (a + b)
[PROOF STEP]
by (simp add: singular_relcycle_def chain_boundary_add mod_subset_def singular_chain_add)


[STATEMENT]
lemma partitions_iff_Abs_multiset:
  "p partitions n \<longleftrightarrow> finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p partitions n) = (finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p partitions n \<Longrightarrow> finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)
 2. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
assume "p partitions n"
[PROOF STATE]
proof (state)
this:
p partitions n

goal (2 subgoals):
 1. p partitions n \<Longrightarrow> finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)
 2. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
p partitions n
[PROOF STEP]
have bounds: "(\<forall>i. p i \<noteq> 0 \<longrightarrow> 1 \<le> i \<and> i \<le> n)"
    and sum: "(\<Sum>i\<le>n. p i * i) = n"
[PROOF STATE]
proof (prove)
using this:
p partitions n

goal (1 subgoal):
 1. \<forall>i. p i \<noteq> 0 \<longrightarrow> 1 \<le> i \<and> i \<le> n &&& (\<Sum>i\<le>n. p i * i) = n
[PROOF STEP]
unfolding partitions_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>i. p i \<noteq> 0 \<longrightarrow> 1 \<le> i \<and> i \<le> n) \<and> (\<Sum>i\<le>n. p i * i) = n

goal (1 subgoal):
 1. \<forall>i. p i \<noteq> 0 \<longrightarrow> 1 \<le> i \<and> i \<le> n &&& (\<Sum>i\<le>n. p i * i) = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i. p i \<noteq> 0 \<longrightarrow> 1 \<le> i \<and> i \<le> n
(\<Sum>i\<le>n. p i * i) = n

goal (2 subgoals):
 1. p partitions n \<Longrightarrow> finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)
 2. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
from \<open>p partitions n\<close>
[PROOF STATE]
proof (chain)
picking this:
p partitions n
[PROOF STEP]
have "finite {x. 0 < p x}"
[PROOF STATE]
proof (prove)
using this:
p partitions n

goal (1 subgoal):
 1. finite {x. 0 < p x}
[PROOF STEP]
by (rule partitions_imp_finite_elements)
[PROOF STATE]
proof (state)
this:
finite {x. 0 < p x}

goal (2 subgoals):
 1. p partitions n \<Longrightarrow> finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)
 2. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {x. 0 < p x}

goal (2 subgoals):
 1. p partitions n \<Longrightarrow> finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)
 2. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
from \<open>finite {x. 0 < p x}\<close> bounds
[PROOF STATE]
proof (chain)
picking this:
finite {x. 0 < p x}
\<forall>i. p i \<noteq> 0 \<longrightarrow> 1 \<le> i \<and> i \<le> n
[PROOF STEP]
have "\<not> 0 \<in># Abs_multiset p"
[PROOF STATE]
proof (prove)
using this:
finite {x. 0 < p x}
\<forall>i. p i \<noteq> 0 \<longrightarrow> 1 \<le> i \<and> i \<le> n

goal (1 subgoal):
 1. 0 \<notin># Abs_multiset p
[PROOF STEP]
using count_eq_zero_iff
[PROOF STATE]
proof (prove)
using this:
finite {x. 0 < p x}
\<forall>i. p i \<noteq> 0 \<longrightarrow> 1 \<le> i \<and> i \<le> n
(count ?M ?x = 0) = (?x \<notin># ?M)

goal (1 subgoal):
 1. 0 \<notin># Abs_multiset p
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 \<notin># Abs_multiset p

goal (2 subgoals):
 1. p partitions n \<Longrightarrow> finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)
 2. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 \<notin># Abs_multiset p

goal (2 subgoals):
 1. p partitions n \<Longrightarrow> finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)
 2. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
from \<open>finite {x. 0 < p x}\<close> this sum
[PROOF STATE]
proof (chain)
picking this:
finite {x. 0 < p x}
0 \<notin># Abs_multiset p
(\<Sum>i\<le>n. p i * i) = n
[PROOF STEP]
have "sum_mset (Abs_multiset p) = n"
[PROOF STATE]
proof (prove)
using this:
finite {x. 0 < p x}
0 \<notin># Abs_multiset p
(\<Sum>i\<le>n. p i * i) = n

goal (1 subgoal):
 1. \<Sum>\<^sub># (Abs_multiset p) = n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>finite {x. 0 < p x}; 0 \<notin># Abs_multiset p; (\<Sum>i\<le>n. p i * i) = n\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (Abs_multiset p) = n
[PROOF STEP]
have "(\<Sum>i\<in>{x. 0 < p x}. p i * i) = (\<Sum>i\<le>n. p i * i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{x. 0 < p x}. p i * i) = (\<Sum>i\<le>n. p i * i)
[PROOF STEP]
using bounds
[PROOF STATE]
proof (prove)
using this:
\<forall>i. p i \<noteq> 0 \<longrightarrow> 1 \<le> i \<and> i \<le> n

goal (1 subgoal):
 1. (\<Sum>i\<in>{x. 0 < p x}. p i * i) = (\<Sum>i\<le>n. p i * i)
[PROOF STEP]
by (auto intro: sum.mono_neutral_cong_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{x. 0 < p x}. p i * i) = (\<Sum>i\<le>n. p i * i)

goal (1 subgoal):
 1. \<lbrakk>finite {x. 0 < p x}; 0 \<notin># Abs_multiset p; (\<Sum>i\<le>n. p i * i) = n\<rbrakk> \<Longrightarrow> \<Sum>\<^sub># (Abs_multiset p) = n
[PROOF STEP]
from \<open>finite {x. 0 < p x}\<close> this sum
[PROOF STATE]
proof (chain)
picking this:
finite {x. 0 < p x}
(\<Sum>i\<in>{x. 0 < p x}. p i * i) = (\<Sum>i\<le>n. p i * i)
(\<Sum>i\<le>n. p i * i) = n
[PROOF STEP]
show "sum_mset (Abs_multiset p) = n"
[PROOF STATE]
proof (prove)
using this:
finite {x. 0 < p x}
(\<Sum>i\<in>{x. 0 < p x}. p i * i) = (\<Sum>i\<le>n. p i * i)
(\<Sum>i\<le>n. p i * i) = n

goal (1 subgoal):
 1. \<Sum>\<^sub># (Abs_multiset p) = n
[PROOF STEP]
by (simp add: sum_mset_sum_count set_mset_Abs_multiset)
[PROOF STATE]
proof (state)
this:
\<Sum>\<^sub># (Abs_multiset p) = n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Sum>\<^sub># (Abs_multiset p) = n

goal (2 subgoals):
 1. p partitions n \<Longrightarrow> finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)
 2. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {x. 0 < p x}
0 \<notin># Abs_multiset p
\<Sum>\<^sub># (Abs_multiset p) = n
[PROOF STEP]
show "finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)"
[PROOF STATE]
proof (prove)
using this:
finite {x. 0 < p x}
0 \<notin># Abs_multiset p
\<Sum>\<^sub># (Abs_multiset p) = n

goal (1 subgoal):
 1. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)
[PROOF STEP]
unfolding number_partition_def
[PROOF STATE]
proof (prove)
using this:
finite {x. 0 < p x}
0 \<notin># Abs_multiset p
\<Sum>\<^sub># (Abs_multiset p) = n

goal (1 subgoal):
 1. finite {x. 0 < p x} \<and> \<Sum>\<^sub># (Abs_multiset p) = n \<and> 0 \<notin># Abs_multiset p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)

goal (1 subgoal):
 1. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
assume "finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)"
[PROOF STATE]
proof (state)
this:
finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)

goal (1 subgoal):
 1. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)
[PROOF STEP]
have "finite {x. 0 < p x}" "0 \<notin># Abs_multiset p" "sum_mset (Abs_multiset p) = n"
[PROOF STATE]
proof (prove)
using this:
finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p)

goal (1 subgoal):
 1. finite {x. 0 < p x} &&& 0 \<notin># Abs_multiset p &&& \<Sum>\<^sub># (Abs_multiset p) = n
[PROOF STEP]
unfolding number_partition_def
[PROOF STATE]
proof (prove)
using this:
finite {x. 0 < p x} \<and> \<Sum>\<^sub># (Abs_multiset p) = n \<and> 0 \<notin># Abs_multiset p

goal (1 subgoal):
 1. finite {x. 0 < p x} &&& 0 \<notin># Abs_multiset p &&& \<Sum>\<^sub># (Abs_multiset p) = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {x. 0 < p x}
0 \<notin># Abs_multiset p
\<Sum>\<^sub># (Abs_multiset p) = n

goal (1 subgoal):
 1. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
from \<open>finite {x. 0 < p x}\<close>
[PROOF STATE]
proof (chain)
picking this:
finite {x. 0 < p x}
[PROOF STEP]
have "(\<Sum>i\<in>{x. 0 < p x}. p i * i) = n"
[PROOF STATE]
proof (prove)
using this:
finite {x. 0 < p x}

goal (1 subgoal):
 1. (\<Sum>i\<in>{x. 0 < p x}. p i * i) = n
[PROOF STEP]
using \<open> sum_mset (Abs_multiset p) = n\<close>
[PROOF STATE]
proof (prove)
using this:
finite {x. 0 < p x}
\<Sum>\<^sub># (Abs_multiset p) = n

goal (1 subgoal):
 1. (\<Sum>i\<in>{x. 0 < p x}. p i * i) = n
[PROOF STEP]
by (simp add: sum_mset_sum_count set_mset_Abs_multiset)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{x. 0 < p x}. p i * i) = n

goal (1 subgoal):
 1. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
have bounds: "\<And>i. p i \<noteq> 0 \<Longrightarrow> 1 \<le> i \<and> i \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. p i \<noteq> 0 \<Longrightarrow> 1 \<le> i \<and> i \<le> n
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. p i \<noteq> 0 \<Longrightarrow> 1 \<le> i
 2. \<And>i. p i \<noteq> 0 \<Longrightarrow> i \<le> n
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. p i \<noteq> 0 \<Longrightarrow> 1 \<le> i
 2. \<And>i. p i \<noteq> 0 \<Longrightarrow> i \<le> n
[PROOF STEP]
assume "p i \<noteq> 0"
[PROOF STATE]
proof (state)
this:
p i \<noteq> 0

goal (2 subgoals):
 1. \<And>i. p i \<noteq> 0 \<Longrightarrow> 1 \<le> i
 2. \<And>i. p i \<noteq> 0 \<Longrightarrow> i \<le> n
[PROOF STEP]
from \<open>\<not> 0 \<in># Abs_multiset p\<close> \<open>finite {x. 0 < p x}\<close>
[PROOF STATE]
proof (chain)
picking this:
0 \<notin># Abs_multiset p
finite {x. 0 < p x}
[PROOF STEP]
have "p 0 = 0"
[PROOF STATE]
proof (prove)
using this:
0 \<notin># Abs_multiset p
finite {x. 0 < p x}

goal (1 subgoal):
 1. p 0 = 0
[PROOF STEP]
using count_inI
[PROOF STATE]
proof (prove)
using this:
0 \<notin># Abs_multiset p
finite {x. 0 < p x}
(count ?M ?x = 0 \<Longrightarrow> False) \<Longrightarrow> ?x \<in># ?M

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

goal (2 subgoals):
 1. \<And>i. p i \<noteq> 0 \<Longrightarrow> 1 \<le> i
 2. \<And>i. p i \<noteq> 0 \<Longrightarrow> i \<le> n
[PROOF STEP]
from this \<open>p i \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
p 0 = 0
p i \<noteq> 0
[PROOF STEP]
show "1 \<le> i"
[PROOF STATE]
proof (prove)
using this:
p 0 = 0
p i \<noteq> 0

goal (1 subgoal):
 1. 1 \<le> i
[PROOF STEP]
by (metis One_nat_def leI less_Suc0)
[PROOF STATE]
proof (state)
this:
1 \<le> i

goal (1 subgoal):
 1. \<And>i. p i \<noteq> 0 \<Longrightarrow> i \<le> n
[PROOF STEP]
show "i \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> n
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> i \<le> n \<Longrightarrow> False
[PROOF STEP]
assume "\<not> i \<le> n"
[PROOF STATE]
proof (state)
this:
\<not> i \<le> n

goal (1 subgoal):
 1. \<not> i \<le> n \<Longrightarrow> False
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<not> i \<le> n
[PROOF STEP]
have "i > n"
[PROOF STATE]
proof (prove)
using this:
\<not> i \<le> n

goal (1 subgoal):
 1. n < i
[PROOF STEP]
using le_less_linear
[PROOF STATE]
proof (prove)
using this:
\<not> i \<le> n
?x \<le> ?y \<or> ?y < ?x

goal (1 subgoal):
 1. n < i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
n < i

goal (1 subgoal):
 1. \<not> i \<le> n \<Longrightarrow> False
[PROOF STEP]
from this \<open>p i \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
n < i
p i \<noteq> 0
[PROOF STEP]
have "p i * i > n"
[PROOF STATE]
proof (prove)
using this:
n < i
p i \<noteq> 0

goal (1 subgoal):
 1. n < p i * i
[PROOF STEP]
by (auto simp add: less_le_trans)
[PROOF STATE]
proof (state)
this:
n < p i * i

goal (1 subgoal):
 1. \<not> i \<le> n \<Longrightarrow> False
[PROOF STEP]
from \<open>p i \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
p i \<noteq> 0
[PROOF STEP]
have "(\<Sum>i\<in>{x. 0 < p x}. p i * i) = p i * i + (\<Sum>i\<in>{x. 0 < p x} - {i}. p i * i)"
[PROOF STATE]
proof (prove)
using this:
p i \<noteq> 0

goal (1 subgoal):
 1. (\<Sum>i\<in>{x. 0 < p x}. p i * i) = p i * i + (\<Sum>i\<in>{x. 0 < p x} - {i}. p i * i)
[PROOF STEP]
using \<open>finite {x. 0 < p x}\<close>
[PROOF STATE]
proof (prove)
using this:
p i \<noteq> 0
finite {x. 0 < p x}

goal (1 subgoal):
 1. (\<Sum>i\<in>{x. 0 < p x}. p i * i) = p i * i + (\<Sum>i\<in>{x. 0 < p x} - {i}. p i * i)
[PROOF STEP]
by (subst sum.insert_remove[symmetric]) (auto simp add: insert_absorb)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{x. 0 < p x}. p i * i) = p i * i + (\<Sum>i\<in>{x. 0 < p x} - {i}. p i * i)

goal (1 subgoal):
 1. \<not> i \<le> n \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{x. 0 < p x}. p i * i) = p i * i + (\<Sum>i\<in>{x. 0 < p x} - {i}. p i * i)

goal (1 subgoal):
 1. \<not> i \<le> n \<Longrightarrow> False
[PROOF STEP]
from \<open>p i * i > n\<close>
[PROOF STATE]
proof (chain)
picking this:
n < p i * i
[PROOF STEP]
have "\<dots> > n"
[PROOF STATE]
proof (prove)
using this:
n < p i * i

goal (1 subgoal):
 1. n < p i * i + (\<Sum>i\<in>{x. 0 < p x} - {i}. p i * i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n < p i * i + (\<Sum>i\<in>{x. 0 < p x} - {i}. p i * i)

goal (1 subgoal):
 1. \<not> i \<le> n \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
n < (\<Sum>i\<in>{x. 0 < p x}. p i * i)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
n < (\<Sum>i\<in>{x. 0 < p x}. p i * i)

goal (1 subgoal):
 1. False
[PROOF STEP]
using \<open>(\<Sum>i\<in>{x. 0 < p x}. p i * i) = n\<close>
[PROOF STATE]
proof (prove)
using this:
n < (\<Sum>i\<in>{x. 0 < p x}. p i * i)
(\<Sum>i\<in>{x. 0 < p x}. p i * i) = n

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
i \<le> n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p ?i \<noteq> 0 \<Longrightarrow> 1 \<le> ?i \<and> ?i \<le> n

goal (1 subgoal):
 1. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p ?i \<noteq> 0 \<Longrightarrow> 1 \<le> ?i \<and> ?i \<le> n

goal (1 subgoal):
 1. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
have "(\<Sum>i\<le>n. p i * i) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. p i * i) = n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. p i * i) = n
[PROOF STEP]
have "(\<Sum>i\<le>n. p i * i) = (\<Sum>i\<in>{x. 0 < p x}. p i * i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. p i * i) = (\<Sum>i\<in>{x. 0 < p x}. p i * i)
[PROOF STEP]
using bounds
[PROOF STATE]
proof (prove)
using this:
p ?i \<noteq> 0 \<Longrightarrow> 1 \<le> ?i \<and> ?i \<le> n

goal (1 subgoal):
 1. (\<Sum>i\<le>n. p i * i) = (\<Sum>i\<in>{x. 0 < p x}. p i * i)
[PROOF STEP]
by (auto intro: sum.mono_neutral_cong_right)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. p i * i) = (\<Sum>i\<in>{x. 0 < p x}. p i * i)

goal (1 subgoal):
 1. (\<Sum>i\<le>n. p i * i) = n
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<le>n. p i * i) = (\<Sum>i\<in>{x. 0 < p x}. p i * i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>n. p i * i) = (\<Sum>i\<in>{x. 0 < p x}. p i * i)

goal (1 subgoal):
 1. (\<Sum>i\<le>n. p i * i) = n
[PROOF STEP]
using \<open>(\<Sum>i\<in>{x. 0 < p x}. p i * i) = n\<close>
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>n. p i * i) = (\<Sum>i\<in>{x. 0 < p x}. p i * i)
(\<Sum>i\<in>{x. 0 < p x}. p i * i) = n

goal (1 subgoal):
 1. (\<Sum>i\<le>n. p i * i) = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. p i * i) = n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. p i * i) = n

goal (1 subgoal):
 1. finite {x. 0 < p x} \<and> number_partition n (Abs_multiset p) \<Longrightarrow> p partitions n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p ?i \<noteq> 0 \<Longrightarrow> 1 \<le> ?i \<and> ?i \<le> n
(\<Sum>i\<le>n. p i * i) = n
[PROOF STEP]
show "p partitions n"
[PROOF STATE]
proof (prove)
using this:
p ?i \<noteq> 0 \<Longrightarrow> 1 \<le> ?i \<and> ?i \<le> n
(\<Sum>i\<le>n. p i * i) = n

goal (1 subgoal):
 1. p partitions n
[PROOF STEP]
by (auto intro: partitionsI)
[PROOF STATE]
proof (state)
this:
p partitions n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fold_fun_chain:
  "g x = (g ^^ 1) x" "(g ^^ m) ((g ^^ n) x) = (g ^^ (m+n)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g x = (g ^^ 1) x &&& (g ^^ m) ((g ^^ n) x) = (g ^^ (m + n)) x
[PROOF STEP]
by (simp_all add: funpow_add)