[STATEMENT]
lemma nn_integral_count_space_prod_eq:
  "nn_integral (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = nn_integral (count_space UNIV) f"
    (is "nn_integral ?P f = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
assume cntbl: "countable {x. f x \<noteq> 0}"
[PROOF STATE]
proof (state)
this:
countable {x. f x \<noteq> 0}

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
have [simp]: "\<And>x. card ({x} \<inter> {x. f x \<noteq> 0}) = (indicator {x. f x \<noteq> 0} x::ennreal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. of_nat (card ({x} \<inter> {x. f x \<noteq> 0})) = indicator {x. f x \<noteq> 0} x
[PROOF STEP]
by (auto split: split_indicator)
[PROOF STATE]
proof (state)
this:
of_nat (card ({?x} \<inter> {x. f x \<noteq> 0})) = indicator {x. f x \<noteq> 0} ?x

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
have [measurable]: "\<And>y. (\<lambda>x. indicator {y} x) \<in> borel_measurable ?P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. indicator {y} \<in> borel_measurable (count_space UNIV \<Otimes>\<^sub>M count_space UNIV)
[PROOF STEP]
by (rule measurable_discrete_difference[of "\<lambda>x. 0" _ borel "{y}" "\<lambda>x. indicator {y} x" for y])
       (auto intro: sets_Pair)
[PROOF STATE]
proof (state)
this:
indicator {?y} \<in> borel_measurable (count_space UNIV \<Otimes>\<^sub>M count_space UNIV)

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
have "(\<integral>\<^sup>+x. f x \<partial>?P) = (\<integral>\<^sup>+x. \<integral>\<^sup>+x'. f x * indicator {x} x' \<partial>count_space {x. f x \<noteq> 0} \<partial>?P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = \<integral>\<^sup>+ x. \<integral>\<^sup>+ x'. f x * indicator {x} x' \<partial>count_space {x. f x \<noteq> 0} \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV
[PROOF STEP]
by (auto simp add: nn_integral_cmult nn_integral_indicator' intro!: nn_integral_cong split: split_indicator)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = \<integral>\<^sup>+ x. \<integral>\<^sup>+ x'. f x * indicator {x} x' \<partial>count_space {x. f x \<noteq> 0} \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = \<integral>\<^sup>+ x. \<integral>\<^sup>+ x'. f x * indicator {x} x' \<partial>count_space {x. f x \<noteq> 0} \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+x. \<integral>\<^sup>+x'. f x' * indicator {x'} x \<partial>count_space {x. f x \<noteq> 0} \<partial>?P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. \<integral>\<^sup>+ x'. f x * indicator {x} x' \<partial>count_space {x. f x \<noteq> 0} \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV = \<integral>\<^sup>+ x. \<integral>\<^sup>+ x'. f x' * indicator {x'} x \<partial>count_space {x. f x \<noteq> 0} \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV
[PROOF STEP]
by (auto intro!: nn_integral_cong split: split_indicator)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. \<integral>\<^sup>+ x'. f x * indicator {x} x' \<partial>count_space {x. f x \<noteq> 0} \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV = \<integral>\<^sup>+ x. \<integral>\<^sup>+ x'. f x' * indicator {x'} x \<partial>count_space {x. f x \<noteq> 0} \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. \<integral>\<^sup>+ x'. f x * indicator {x} x' \<partial>count_space {x. f x \<noteq> 0} \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV = \<integral>\<^sup>+ x. \<integral>\<^sup>+ x'. f x' * indicator {x'} x \<partial>count_space {x. f x \<noteq> 0} \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+x'. \<integral>\<^sup>+x. f x' * indicator {x'} x \<partial>?P \<partial>count_space {x. f x \<noteq> 0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. \<integral>\<^sup>+ x'. f x' * indicator {x'} x \<partial>count_space {x. f x \<noteq> 0} \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV = \<integral>\<^sup>+ x'. \<integral>\<^sup>+ x. f x' * indicator {x'} x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV \<partial>count_space {x. f x \<noteq> 0}
[PROOF STEP]
by (intro nn_integral_count_space_nn_integral cntbl) auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. \<integral>\<^sup>+ x'. f x' * indicator {x'} x \<partial>count_space {x. f x \<noteq> 0} \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV = \<integral>\<^sup>+ x'. \<integral>\<^sup>+ x. f x' * indicator {x'} x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV \<partial>count_space {x. f x \<noteq> 0}

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. \<integral>\<^sup>+ x'. f x' * indicator {x'} x \<partial>count_space {x. f x \<noteq> 0} \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV = \<integral>\<^sup>+ x'. \<integral>\<^sup>+ x. f x' * indicator {x'} x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV \<partial>count_space {x. f x \<noteq> 0}

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+x'. f x' \<partial>count_space {x. f x \<noteq> 0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x'. \<integral>\<^sup>+ x. f x' * indicator {x'} x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV \<partial>count_space {x. f x \<noteq> 0} = integral\<^sup>N (count_space {x. f x \<noteq> 0}) f
[PROOF STEP]
by (intro nn_integral_cong) (auto simp: nn_integral_cmult sets_Pair)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x'. \<integral>\<^sup>+ x. f x' * indicator {x'} x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV \<partial>count_space {x. f x \<noteq> 0} = integral\<^sup>N (count_space {x. f x \<noteq> 0}) f

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space {x. f x \<noteq> 0}) f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space {x. f x \<noteq> 0}) f

goal (1 subgoal):
 1. integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
by (auto simp add: nn_integral_count_space_indicator intro!: nn_integral_cong split: split_indicator)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
assume "f x \<noteq> 0"
[PROOF STATE]
proof (state)
this:
f x \<noteq> 0

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f x \<noteq> 0
[PROOF STEP]
have "(\<exists>r\<ge>0. 0 < r \<and> f x = ennreal r) \<or> f x = \<infinity>"
[PROOF STATE]
proof (prove)
using this:
f x \<noteq> 0

goal (1 subgoal):
 1. (\<exists>r\<ge>0. 0 < r \<and> f x = ennreal r) \<or> f x = \<infinity>
[PROOF STEP]
by (cases "f x" rule: ennreal_cases) (auto simp: less_le)
[PROOF STATE]
proof (state)
this:
(\<exists>r\<ge>0. 0 < r \<and> f x = ennreal r) \<or> f x = \<infinity>

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<exists>r\<ge>0. 0 < r \<and> f x = ennreal r) \<or> f x = \<infinity>
[PROOF STEP]
have "\<exists>n. ennreal (1 / real (Suc n)) \<le> f x"
[PROOF STATE]
proof (prove)
using this:
(\<exists>r\<ge>0. 0 < r \<and> f x = ennreal r) \<or> f x = \<infinity>

goal (1 subgoal):
 1. \<exists>n. ennreal (1 / real (Suc n)) \<le> f x
[PROOF STEP]
by (auto elim!: nat_approx_posE intro!: less_imp_le)
[PROOF STATE]
proof (state)
this:
\<exists>n. ennreal (1 / real (Suc n)) \<le> f x

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
f ?x2 \<noteq> 0 \<Longrightarrow> \<exists>n. ennreal (1 / real (Suc n)) \<le> f ?x2

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
note * = this
[PROOF STATE]
proof (state)
this:
f ?x2 \<noteq> 0 \<Longrightarrow> \<exists>n. ennreal (1 / real (Suc n)) \<le> f ?x2

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
assume cntbl: "uncountable {x. f x \<noteq> 0}"
[PROOF STATE]
proof (state)
this:
uncountable {x. f x \<noteq> 0}

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
uncountable {x. f x \<noteq> 0}

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
have "{x. f x \<noteq> 0} = (\<Union>n. {x. 1/Suc n \<le> f x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. f x \<noteq> 0} = (\<Union>n. {x. ennreal (1 / real (Suc n)) \<le> f x})
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
f ?x2 \<noteq> 0 \<Longrightarrow> \<exists>n. ennreal (1 / real (Suc n)) \<le> f ?x2

goal (1 subgoal):
 1. {x. f x \<noteq> 0} = (\<Union>n. {x. ennreal (1 / real (Suc n)) \<le> f x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x. f x \<noteq> 0} = (\<Union>n. {x. ennreal (1 / real (Suc n)) \<le> f x})

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
uncountable (\<Union>n. {x. ennreal (1 / real (Suc n)) \<le> f x})
[PROOF STEP]
obtain n where "infinite {x. 1/Suc n \<le> f x}"
[PROOF STATE]
proof (prove)
using this:
uncountable (\<Union>n. {x. ennreal (1 / real (Suc n)) \<le> f x})

goal (1 subgoal):
 1. (\<And>n. infinite {x. ennreal (1 / real (Suc n)) \<le> f x} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson countableI_type countable_UN uncountable_infinite)
[PROOF STATE]
proof (state)
this:
infinite {x. ennreal (1 / real (Suc n)) \<le> f x}

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite {x. ennreal (1 / real (Suc n)) \<le> f x}
[PROOF STEP]
obtain C where C: "C \<subseteq> {x. 1/Suc n \<le> f x}" and "countable C" "infinite C"
[PROOF STATE]
proof (prove)
using this:
infinite {x. ennreal (1 / real (Suc n)) \<le> f x}

goal (1 subgoal):
 1. (\<And>C. \<lbrakk>C \<subseteq> {x. ennreal (1 / real (Suc n)) \<le> f x}; countable C; infinite C\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis infinite_countable_subset')
[PROOF STATE]
proof (state)
this:
C \<subseteq> {x. ennreal (1 / real (Suc n)) \<le> f x}
countable C
infinite C

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
have [measurable]: "C \<in> sets ?P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<in> sets (count_space UNIV \<Otimes>\<^sub>M count_space UNIV)
[PROOF STEP]
using sets.countable[OF _ \<open>countable C\<close>, of ?P]
[PROOF STATE]
proof (prove)
using this:
(\<And>a. a \<in> C \<Longrightarrow> {a} \<in> sets (count_space UNIV \<Otimes>\<^sub>M count_space UNIV)) \<Longrightarrow> C \<in> sets (count_space UNIV \<Otimes>\<^sub>M count_space UNIV)

goal (1 subgoal):
 1. C \<in> sets (count_space UNIV \<Otimes>\<^sub>M count_space UNIV)
[PROOF STEP]
by (auto simp: sets_Pair)
[PROOF STATE]
proof (state)
this:
C \<in> sets (count_space UNIV \<Otimes>\<^sub>M count_space UNIV)

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
have "(\<integral>\<^sup>+x. ennreal (1/Suc n) * indicator C x \<partial>?P) \<le> nn_integral ?P f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV \<le> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f
[PROOF STEP]
using C
[PROOF STATE]
proof (prove)
using this:
C \<subseteq> {x. ennreal (1 / real (Suc n)) \<le> f x}

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV \<le> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f
[PROOF STEP]
by (intro nn_integral_mono) (auto split: split_indicator simp: zero_ereal_def[symmetric])
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV \<le> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV \<le> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
have "(\<integral>\<^sup>+x. ennreal (1/Suc n) * indicator C x \<partial>?P) = \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV = \<infinity>
[PROOF STEP]
using \<open>infinite C\<close>
[PROOF STATE]
proof (prove)
using this:
infinite C

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV = \<infinity>
[PROOF STEP]
by (simp add: nn_integral_cmult emeasure_count_space_prod_eq ennreal_mult_top)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV = \<infinity>

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV = \<infinity>

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
have "(\<integral>\<^sup>+x. ennreal (1/Suc n) * indicator C x \<partial>count_space UNIV) \<le> nn_integral (count_space UNIV) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<le> integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
using C
[PROOF STATE]
proof (prove)
using this:
C \<subseteq> {x. ennreal (1 / real (Suc n)) \<le> f x}

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<le> integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
by (intro nn_integral_mono) (auto split: split_indicator simp: zero_ereal_def[symmetric])
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<le> integral\<^sup>N (count_space UNIV) f

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<le> integral\<^sup>N (count_space UNIV) f

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
have "(\<integral>\<^sup>+x. ennreal (1/Suc n) * indicator C x \<partial>count_space UNIV) = \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV = \<infinity>
[PROOF STEP]
using \<open>infinite C\<close>
[PROOF STATE]
proof (prove)
using this:
infinite C

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV = \<infinity>
[PROOF STEP]
by (simp add: nn_integral_cmult ennreal_mult_top)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV = \<infinity>

goal (1 subgoal):
 1. uncountable {x. f x \<noteq> 0} \<Longrightarrow> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV \<le> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV = \<infinity>
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<le> integral\<^sup>N (count_space UNIV) f
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV = \<infinity>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV \<le> integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<Otimes>\<^sub>M count_space UNIV = \<infinity>
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV \<le> integral\<^sup>N (count_space UNIV) f
\<integral>\<^sup>+ x. ennreal (1 / real (Suc n)) * indicator C x \<partial>count_space UNIV = \<infinity>

goal (1 subgoal):
 1. integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f
[PROOF STEP]
by (simp add: top_unique)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = integral\<^sup>N (count_space UNIV) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma omega_n_star:
  "x\<^sup>\<omega> \<squnion> n(x\<^sup>\<star>) * top \<le> x\<^sup>\<star> * n(x\<^sup>\<omega>) * top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<omega> \<squnion> n (x\<^sup>\<star>) * top \<le> x\<^sup>\<star> * n (x\<^sup>\<omega>) * top
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x\<^sup>\<omega> \<squnion> n (x\<^sup>\<star>) * top \<le> x\<^sup>\<star> * n (x\<^sup>\<omega>) * top
[PROOF STEP]
have 1: "n(x\<^sup>\<star>) * top \<le> n(x\<^sup>\<omega>) * top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n (x\<^sup>\<star>) * top \<le> n (x\<^sup>\<omega>) * top
[PROOF STEP]
by (simp add: mult_left_isotone n_star_below_n_omega)
[PROOF STATE]
proof (state)
this:
n (x\<^sup>\<star>) * top \<le> n (x\<^sup>\<omega>) * top

goal (1 subgoal):
 1. x\<^sup>\<omega> \<squnion> n (x\<^sup>\<star>) * top \<le> x\<^sup>\<star> * n (x\<^sup>\<omega>) * top
[PROOF STEP]
have "... \<le> x\<^sup>\<star> * n(x\<^sup>\<omega>) * top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n (x\<^sup>\<omega>) * top \<le> x\<^sup>\<star> * n (x\<^sup>\<omega>) * top
[PROOF STEP]
by (simp add: star_n_omega_top)
[PROOF STATE]
proof (state)
this:
n (x\<^sup>\<omega>) * top \<le> x\<^sup>\<star> * n (x\<^sup>\<omega>) * top

goal (1 subgoal):
 1. x\<^sup>\<omega> \<squnion> n (x\<^sup>\<star>) * top \<le> x\<^sup>\<star> * n (x\<^sup>\<omega>) * top
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n (x\<^sup>\<omega>) * top \<le> x\<^sup>\<star> * n (x\<^sup>\<omega>) * top

goal (1 subgoal):
 1. x\<^sup>\<omega> \<squnion> n (x\<^sup>\<star>) * top \<le> x\<^sup>\<star> * n (x\<^sup>\<omega>) * top
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
n (x\<^sup>\<omega>) * top \<le> x\<^sup>\<star> * n (x\<^sup>\<omega>) * top
n (x\<^sup>\<star>) * top \<le> n (x\<^sup>\<omega>) * top

goal (1 subgoal):
 1. x\<^sup>\<omega> \<squnion> n (x\<^sup>\<star>) * top \<le> x\<^sup>\<star> * n (x\<^sup>\<omega>) * top
[PROOF STEP]
by (metis le_sup_iff n_split_omega order_trans star_n_omega_top)
[PROOF STATE]
proof (state)
this:
x\<^sup>\<omega> \<squnion> n (x\<^sup>\<star>) * top \<le> x\<^sup>\<star> * n (x\<^sup>\<omega>) * top

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Pareto_strict_iff:
  "x \<prec>[Pareto(R)] y \<longleftrightarrow> (\<forall>i\<in>dom. x \<preceq>[R i] y) \<and> (\<exists>i\<in>dom. x \<prec>[R i] y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<prec>[Pareto R] y = ((\<forall>i\<in>dom. R i x y) \<and> (\<exists>i\<in>dom. x \<prec>[R i] y))
[PROOF STEP]
by (auto simp: strongly_preferred_def Pareto_iff nonempty_dom)


[STATEMENT]
lemma permutes_less [simp]:
  assumes p: "p permutes {0..<(n :: nat)}"
  shows
    "i < n \<Longrightarrow> p i < n"
    "i < n \<Longrightarrow> inv p i < n"
    "p (inv p i) = i"
    "inv p (p i) = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((i < n \<Longrightarrow> p i < n) &&& (i < n \<Longrightarrow> inv p i < n)) &&& p (inv p i) = i &&& inv p (p i) = i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p permutes {0..<n}

goal (1 subgoal):
 1. ((i < n \<Longrightarrow> p i < n) &&& (i < n \<Longrightarrow> inv p i < n)) &&& p (inv p i) = i &&& inv p (p i) = i
[PROOF STEP]
by (simp_all add: permutes_inverses permutes_nat_less permutes_nat_inv_less)


[STATEMENT]
lemma prop2p:
  "IS_LEFT_UNIQUE R = left_unique (rel2p R)"
  "IS_RIGHT_UNIQUE R = right_unique (rel2p R)"
  "right_unique (rel2p (R\<inverse>)) = left_unique (rel2p R)"
  "IS_LEFT_TOTAL R = left_total (rel2p R)"
  "IS_RIGHT_TOTAL R = right_total (rel2p R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (IS_LEFT_UNIQUE R = left_unique (rel2p R) &&& single_valued R = right_unique (rel2p R)) &&& right_unique (rel2p (R\<inverse>)) = left_unique (rel2p R) &&& IS_LEFT_TOTAL R = left_total (rel2p R) &&& IS_RIGHT_TOTAL R = right_total (rel2p R)
[PROOF STEP]
by (auto
    simp: IS_LEFT_UNIQUE_def left_unique_def single_valued_def
    simp: right_unique_def
    simp: IS_LEFT_TOTAL_def left_total_def
    simp: IS_RIGHT_TOTAL_def right_total_def
    simp: rel2p_def
    )


[STATEMENT]
lemma log_base_root: "n > 0 \<Longrightarrow> b > 0 \<Longrightarrow> log (root n b) x = n * (log b x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 < b\<rbrakk> \<Longrightarrow> log (root n b) x = real n * log b x
[PROOF STEP]
by (simp add: log_def ln_root)


[STATEMENT]
lemma mat_le_iff: "(X \<le> Y) \<longleftrightarrow> (\<forall>x\<ge>0. (X::real^_^_) *v x \<le> Y *v x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X \<le> Y) = (\<forall>x\<ge>0. X *v x \<le> Y *v x)
[PROOF STEP]
by (metis diff_ge_0_iff_ge matrix_vector_mult_diff_rdistrib nonneg_mat_iff)


[STATEMENT]
lemma algebra_intersection:
  assumes "algebra \<Omega> A"
          "algebra \<Omega> B"
  shows "algebra \<Omega> (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebra \<Omega> (A \<inter> B)
[PROOF STEP]
apply (subst algebra_iff_Un)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B \<subseteq> Pow \<Omega> \<and> {} \<in> A \<inter> B \<and> (\<forall>a\<in>A \<inter> B. \<Omega> - a \<in> A \<inter> B) \<and> (\<forall>a\<in>A \<inter> B. \<forall>b\<in>A \<inter> B. a \<union> b \<in> A \<inter> B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
algebra \<Omega> A
algebra \<Omega> B

goal (1 subgoal):
 1. A \<inter> B \<subseteq> Pow \<Omega> \<and> {} \<in> A \<inter> B \<and> (\<forall>a\<in>A \<inter> B. \<Omega> - a \<in> A \<inter> B) \<and> (\<forall>a\<in>A \<inter> B. \<forall>b\<in>A \<inter> B. a \<union> b \<in> A \<inter> B)
[PROOF STEP]
by (auto simp add: algebra_iff_Un)


[STATEMENT]
lemma coeff_finite_fourier_poly:
  assumes "n < length ws"
  defines "k \<equiv> length ws"
  shows "coeff (finite_fourier_poly ws) n =
         (1/k) * (\<Sum>m < k. ws ! m * unity_root k (-n*m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (finite_fourier_poly ws) n = 1 / of_nat k * (\<Sum>m<k. ws ! m * unity_root k (- int n * int m))
[PROOF STEP]
using assms degree_finite_fourier_poly
[PROOF STATE]
proof (prove)
using this:
n < length ws
k \<equiv> length ws
degree (finite_fourier_poly ?ws) \<le> length ?ws - 1

goal (1 subgoal):
 1. coeff (finite_fourier_poly ws) n = 1 / of_nat k * (\<Sum>m<k. ws ! m * unity_root k (- int n * int m))
[PROOF STEP]
by (auto simp: Let_def nth_default_def finite_fourier_poly_def)


[STATEMENT]
lemma eval_mod_exp [simp]:
  "mod_exp b' 0 m' = 1 mod m'"
  "mod_exp b' 1 m' = b' mod m'"
  "mod_exp b' (Suc 0) m' = b' mod m'"
  "mod_exp b' e' 0 = b' ^ e'"
  "mod_exp b' e' 1 = 0"
  "mod_exp b' e' (Suc 0) = 0"
  "mod_exp 0 1 m' = 0"
  "mod_exp 0 (Suc 0) m' = 0"
  "mod_exp 0 (numeral e) m' = 0"
  "mod_exp 1 e' m' = 1 mod m'"
  "mod_exp (Suc 0) e' m' = 1 mod m'"
  "mod_exp (numeral b) (numeral e) (numeral m) =
     mod_exp_aux (numeral m) 1 (numeral b) (numeral e) mod numeral m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((mod_exp b' 0 m' = 1 mod m' &&& mod_exp b' 1 m' = b' mod m' &&& mod_exp b' (Suc 0) m' = b' mod m') &&& mod_exp b' e' 0 = b' ^ e' &&& mod_exp b' e' 1 = 0 &&& mod_exp b' e' (Suc 0) = 0) &&& (mod_exp 0 1 m' = 0 &&& mod_exp 0 (Suc 0) m' = 0 &&& mod_exp 0 (numeral e) m' = 0) &&& mod_exp 1 e' m' = 1 mod m' &&& mod_exp (Suc 0) e' m' = 1 mod m' &&& mod_exp (numeral b) (numeral e) (numeral m) = mod_exp_aux (numeral m) (1::'a) (numeral b) (numeral e) mod numeral m
[PROOF STEP]
by (simp_all add: mod_exp_def mod_exp_aux_correct)


[STATEMENT]
lemma extended_distance_middle:
  assumes "a \<in> extended_distance_set"
          "b \<in> extended_distance_set"
  shows "extended_distance a (middle a b) = extended_distance a b / 2"
        "extended_distance b (middle a b) = extended_distance a b / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extended_distance a (middle a b) = extended_distance a b / 2 &&& extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. extended_distance a (middle a b) = extended_distance a b / 2
 2. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
have "0 = extended_distance a b - max (extended_distance a b) (extended_distance b b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = extended_distance a b - max (extended_distance a b) (extended_distance b b)
[PROOF STEP]
using extended_distance_pos[OF assms] assms(2) extended_distance_set_def
[PROOF STATE]
proof (prove)
using this:
0 \<le> extended_distance a b
b \<in> extended_distance_set
extended_distance_set = {z. extended_distance z z = 0}

goal (1 subgoal):
 1. 0 = extended_distance a b - max (extended_distance a b) (extended_distance b b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 = extended_distance a b - max (extended_distance a b) (extended_distance b b)

goal (2 subgoals):
 1. extended_distance a (middle a b) = extended_distance a b / 2
 2. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 = extended_distance a b - max (extended_distance a b) (extended_distance b b)

goal (2 subgoals):
 1. extended_distance a (middle a b) = extended_distance a b / 2
 2. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
have "... \<le> (SUP w\<in>wo.underS (middle a b) \<inter> extended_distance_set.
          extended_distance a w - max (extended_distance a w) (extended_distance b w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extended_distance a b - max (extended_distance a b) (extended_distance b b) \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))
[PROOF STEP]
apply (rule cSUP_upper)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. b \<in> underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set
 2. bdd_above ((\<lambda>w. extended_distance a w - max (extended_distance a w) (extended_distance b w)) ` (underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set))
[PROOF STEP]
apply (simp add: assms(2) Bonk_Schramm_extension_unfolded_wo_props'(2))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above ((\<lambda>w. extended_distance a w - max (extended_distance a w) (extended_distance b w)) ` (underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set))
[PROOF STEP]
by (rule bdd_aboveI2[of _ _ 0], auto)
[PROOF STATE]
proof (state)
this:
extended_distance a b - max (extended_distance a b) (extended_distance b b) \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))

goal (2 subgoals):
 1. extended_distance a (middle a b) = extended_distance a b / 2
 2. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 = extended_distance a b - max (extended_distance a b) (extended_distance b b)
extended_distance a b - max (extended_distance a b) (extended_distance b b) \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))
[PROOF STEP]
have "0 \<le> (SUP w\<in>wo.underS (middle a b) \<inter> extended_distance_set.
          extended_distance a w - max (extended_distance a w) (extended_distance b w))"
[PROOF STATE]
proof (prove)
using this:
0 = extended_distance a b - max (extended_distance a b) (extended_distance b b)
extended_distance a b - max (extended_distance a b) (extended_distance b b) \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))

goal (1 subgoal):
 1. 0 \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))

goal (2 subgoals):
 1. extended_distance a (middle a b) = extended_distance a b / 2
 2. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))

goal (2 subgoals):
 1. extended_distance a (middle a b) = extended_distance a b / 2
 2. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
have "(SUP w\<in>wo.underS (middle a b) \<inter> extended_distance_set.
          extended_distance a w - max (extended_distance a w) (extended_distance b w)) \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w)) \<le> 0
[PROOF STEP]
apply (rule cSUP_least)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set \<noteq> {}
 2. \<And>x. x \<in> underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set \<Longrightarrow> extended_distance a x - max (extended_distance a x) (extended_distance b x) \<le> 0
[PROOF STEP]
using assms(1) Bonk_Schramm_extension_unfolded_wo_props'(1)
[PROOF STATE]
proof (prove)
using this:
a \<in> extended_distance_set
?a \<in> underS Bonk_Schramm_extension_unfolded_wo (middle ?a ?b)

goal (2 subgoals):
 1. underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set \<noteq> {}
 2. \<And>x. x \<in> underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set \<Longrightarrow> extended_distance a x - max (extended_distance a x) (extended_distance b x) \<le> 0
[PROOF STEP]
by (fastforce, auto)
[PROOF STATE]
proof (state)
this:
(SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w)) \<le> 0

goal (2 subgoals):
 1. extended_distance a (middle a b) = extended_distance a b / 2
 2. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w)) \<le> 0

goal (2 subgoals):
 1. extended_distance a (middle a b) = extended_distance a b / 2
 2. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
have "extended_distance a (middle a b) = (extended_distance a b)/2
    + (SUP w\<in>wo.underS (middle a b) \<inter> extended_distance_set.
          extended_distance a w - max (extended_distance a w) (extended_distance b w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extended_distance a (middle a b) = extended_distance a b / 2 + (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))
[PROOF STEP]
by (rule extended_distance_middle_formula, simp add: Bonk_Schramm_extension_unfolded_wo_props'(1))
[PROOF STATE]
proof (state)
this:
extended_distance a (middle a b) = extended_distance a b / 2 + (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))

goal (2 subgoals):
 1. extended_distance a (middle a b) = extended_distance a b / 2
 2. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))
(SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w)) \<le> 0
extended_distance a (middle a b) = extended_distance a b / 2 + (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))
[PROOF STEP]
show "extended_distance a (middle a b) = (extended_distance a b)/2"
[PROOF STATE]
proof (prove)
using this:
0 \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))
(SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w)) \<le> 0
extended_distance a (middle a b) = extended_distance a b / 2 + (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance a w - max (extended_distance a w) (extended_distance b w))

goal (1 subgoal):
 1. extended_distance a (middle a b) = extended_distance a b / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
extended_distance a (middle a b) = extended_distance a b / 2

goal (1 subgoal):
 1. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
have "0 = extended_distance b a - max (extended_distance a a) (extended_distance b a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = extended_distance b a - max (extended_distance a a) (extended_distance b a)
[PROOF STEP]
using extended_distance_pos[OF assms] assms(1) extended_distance_set_def extended_distance_symmetric
[PROOF STATE]
proof (prove)
using this:
0 \<le> extended_distance a b
a \<in> extended_distance_set
extended_distance_set = {z. extended_distance z z = 0}
extended_distance ?x ?y = extended_distance ?y ?x

goal (1 subgoal):
 1. 0 = extended_distance b a - max (extended_distance a a) (extended_distance b a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 = extended_distance b a - max (extended_distance a a) (extended_distance b a)

goal (1 subgoal):
 1. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 = extended_distance b a - max (extended_distance a a) (extended_distance b a)

goal (1 subgoal):
 1. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
have "... \<le> (SUP w\<in>wo.underS (middle a b) \<inter> extended_distance_set.
          extended_distance b w - max (extended_distance a w) (extended_distance b w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extended_distance b a - max (extended_distance a a) (extended_distance b a) \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))
[PROOF STEP]
apply (rule cSUP_upper)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<in> underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set
 2. bdd_above ((\<lambda>w. extended_distance b w - max (extended_distance a w) (extended_distance b w)) ` (underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set))
[PROOF STEP]
apply (simp add: assms(1) Bonk_Schramm_extension_unfolded_wo_props'(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above ((\<lambda>w. extended_distance b w - max (extended_distance a w) (extended_distance b w)) ` (underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set))
[PROOF STEP]
by (rule bdd_aboveI2[of _ _ 0], auto)
[PROOF STATE]
proof (state)
this:
extended_distance b a - max (extended_distance a a) (extended_distance b a) \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))

goal (1 subgoal):
 1. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 = extended_distance b a - max (extended_distance a a) (extended_distance b a)
extended_distance b a - max (extended_distance a a) (extended_distance b a) \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))
[PROOF STEP]
have "0 \<le> (SUP w\<in>wo.underS (middle a b) \<inter> extended_distance_set.
          extended_distance b w - max (extended_distance a w) (extended_distance b w))"
[PROOF STATE]
proof (prove)
using this:
0 = extended_distance b a - max (extended_distance a a) (extended_distance b a)
extended_distance b a - max (extended_distance a a) (extended_distance b a) \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))

goal (1 subgoal):
 1. 0 \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))

goal (1 subgoal):
 1. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))

goal (1 subgoal):
 1. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
have "(SUP w\<in>wo.underS (middle a b) \<inter> extended_distance_set.
          extended_distance b w - max (extended_distance a w) (extended_distance b w)) \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w)) \<le> 0
[PROOF STEP]
apply (rule cSUP_least)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set \<noteq> {}
 2. \<And>x. x \<in> underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set \<Longrightarrow> extended_distance b x - max (extended_distance a x) (extended_distance b x) \<le> 0
[PROOF STEP]
using assms(1) Bonk_Schramm_extension_unfolded_wo_props'(1)
[PROOF STATE]
proof (prove)
using this:
a \<in> extended_distance_set
?a \<in> underS Bonk_Schramm_extension_unfolded_wo (middle ?a ?b)

goal (2 subgoals):
 1. underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set \<noteq> {}
 2. \<And>x. x \<in> underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set \<Longrightarrow> extended_distance b x - max (extended_distance a x) (extended_distance b x) \<le> 0
[PROOF STEP]
by (fastforce, auto)
[PROOF STATE]
proof (state)
this:
(SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w)) \<le> 0

goal (1 subgoal):
 1. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w)) \<le> 0

goal (1 subgoal):
 1. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
have "extended_distance b (middle a b) = (extended_distance a b)/2
    + (SUP w\<in>wo.underS (middle a b) \<inter> extended_distance_set.
          extended_distance b w - max (extended_distance a w) (extended_distance b w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extended_distance b (middle a b) = extended_distance a b / 2 + (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))
[PROOF STEP]
by (rule extended_distance_middle_formula, simp add: Bonk_Schramm_extension_unfolded_wo_props'(2))
[PROOF STATE]
proof (state)
this:
extended_distance b (middle a b) = extended_distance a b / 2 + (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))

goal (1 subgoal):
 1. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))
(SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w)) \<le> 0
extended_distance b (middle a b) = extended_distance a b / 2 + (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))
[PROOF STEP]
show "extended_distance b (middle a b) = (extended_distance a b)/2"
[PROOF STATE]
proof (prove)
using this:
0 \<le> (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))
(SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w)) \<le> 0
extended_distance b (middle a b) = extended_distance a b / 2 + (SUP w\<in>underS Bonk_Schramm_extension_unfolded_wo (middle a b) \<inter> extended_distance_set. extended_distance b w - max (extended_distance a w) (extended_distance b w))

goal (1 subgoal):
 1. extended_distance b (middle a b) = extended_distance a b / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
extended_distance b (middle a b) = extended_distance a b / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_list_length: "xs < ys \<Longrightarrow> length xs < length ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs < ys \<Longrightarrow> length xs < length ys
[PROOF STEP]
by (metis list_emb_length subseq_same_length le_neq_implies_less less_list_def less_eq_list_def)


[STATEMENT]
lemma insertion_add_ind_basecase:
  "insertion (nth (list_update L var x)) ((\<Sum>i::nat \<le> 0. isolate_variable_sparse p var i * (Var var)^i))
  = (\<Sum>i = 0..<(0+1).  insertion (nth (list_update L var x)) (isolate_variable_sparse p var i * (Var var)^i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion ((!) (L[var := x])) (\<Sum>i\<le>0. isolate_variable_sparse p var i * Var var ^ i) = (\<Sum>i = 0..<0 + 1. insertion ((!) (L[var := x])) (isolate_variable_sparse p var i * Var var ^ i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. insertion ((!) (L[var := x])) (\<Sum>i\<le>0. isolate_variable_sparse p var i * Var var ^ i) = (\<Sum>i = 0..<0 + 1. insertion ((!) (L[var := x])) (isolate_variable_sparse p var i * Var var ^ i))
[PROOF STEP]
have h1: "((\<Sum>i::nat \<le> 0. isolate_variable_sparse p var i * (Var var)^i))
   = (isolate_variable_sparse p var 0 * (Var var)^0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>0. isolate_variable_sparse p var i * Var var ^ i) = isolate_variable_sparse p var 0 * Var var ^ 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>0. isolate_variable_sparse p var i * Var var ^ i) = isolate_variable_sparse p var 0 * Var var ^ 0

goal (1 subgoal):
 1. insertion ((!) (L[var := x])) (\<Sum>i\<le>0. isolate_variable_sparse p var i * Var var ^ i) = (\<Sum>i = 0..<0 + 1. insertion ((!) (L[var := x])) (isolate_variable_sparse p var i * Var var ^ i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion ((!) (L[var := x])) (\<Sum>i\<le>0. isolate_variable_sparse p var i * Var var ^ i) = (\<Sum>i = 0..<0 + 1. insertion ((!) (L[var := x])) (isolate_variable_sparse p var i * Var var ^ i))
[PROOF STEP]
using h1
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>0. isolate_variable_sparse p var i * Var var ^ i) = isolate_variable_sparse p var 0 * Var var ^ 0

goal (1 subgoal):
 1. insertion ((!) (L[var := x])) (\<Sum>i\<le>0. isolate_variable_sparse p var i * Var var ^ i) = (\<Sum>i = 0..<0 + 1. insertion ((!) (L[var := x])) (isolate_variable_sparse p var i * Var var ^ i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insertion ((!) (L[var := x])) (\<Sum>i\<le>0. isolate_variable_sparse p var i * Var var ^ i) = (\<Sum>i = 0..<0 + 1. insertion ((!) (L[var := x])) (isolate_variable_sparse p var i * Var var ^ i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma log2_mono:
  "x > 0 \<Longrightarrow> x \<le> y \<Longrightarrow> log 2 x \<le> log 2 y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; x \<le> y\<rbrakk> \<Longrightarrow> log 2 x \<le> log 2 y
[PROOF STEP]
by auto


[STATEMENT]
lemma similar_sq_mtx_trans: "A \<sim> B \<Longrightarrow> B \<sim> C \<Longrightarrow> A \<sim> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<sim> B; B \<sim> C\<rbrakk> \<Longrightarrow> A \<sim> C
[PROOF STEP]
unfolding similar_sq_mtx_matrix
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>similar_matrix (to_vec A) (to_vec B); similar_matrix (to_vec B) (to_vec C)\<rbrakk> \<Longrightarrow> similar_matrix (to_vec A) (to_vec C)
[PROOF STEP]
using similar_matrix_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>similar_matrix ?A ?B; similar_matrix ?B ?C\<rbrakk> \<Longrightarrow> similar_matrix ?A ?C

goal (1 subgoal):
 1. \<lbrakk>similar_matrix (to_vec A) (to_vec B); similar_matrix (to_vec B) (to_vec C)\<rbrakk> \<Longrightarrow> similar_matrix (to_vec A) (to_vec C)
[PROOF STEP]
by blast


[STATEMENT]
lemma segment_subset_existence_ivl:
  assumes "s \<in> existence_ivl t0 x0" "t \<in> existence_ivl t0 x0"
  shows "{s -- t} \<subseteq> existence_ivl t0 x0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {s--t} \<subseteq> existence_ivl t0 x0
[PROOF STEP]
using assms is_interval_existence_ivl
[PROOF STATE]
proof (prove)
using this:
s \<in> existence_ivl t0 x0
t \<in> existence_ivl t0 x0
is_interval (existence_ivl t0 ?x0.0)

goal (1 subgoal):
 1. {s--t} \<subseteq> existence_ivl t0 x0
[PROOF STEP]
unfolding is_interval_convex_1
[PROOF STATE]
proof (prove)
using this:
s \<in> existence_ivl t0 x0
t \<in> existence_ivl t0 x0
convex (existence_ivl t0 ?x0.0)

goal (1 subgoal):
 1. {s--t} \<subseteq> existence_ivl t0 x0
[PROOF STEP]
by (rule closed_segment_subset)


[STATEMENT]
lemma Bernstein_changes_01_def':
  "Bernstein_changes_01 p P = nat (changes [(inverse (real (p choose j)) *
     coeff (reciprocal_poly p P \<circ>\<^sub>p [:1, 1:]) (p-j)). j \<leftarrow> [0..<p + 1]])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bernstein_changes_01 p P = int (nat (changes (map (\<lambda>j. inverse (real (p choose j)) * coeff (reciprocal_poly p P \<circ>\<^sub>p [:1, 1:]) (p - j)) [0..<p + 1])))
[PROOF STEP]
by (simp add: Bernstein_changes_01_def Bernstein_coeffs_01_def)


[STATEMENT]
lemma darcs_children_count_not1:
  "\<lbrakk>(t1,e1) \<in> fset xs; (t2,e2) \<in> fset xs; (t1,e1) \<noteq> (t2,e2); e \<in> darcs t1; e \<in> darcs t2\<rbrakk>
    \<Longrightarrow> count (darcs_mset (Node r xs)) e \<noteq> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(t1, e1) \<in> fset xs; (t2, e2) \<in> fset xs; (t1, e1) \<noteq> (t2, e2); e \<in> darcs t1; e \<in> darcs t2\<rbrakk> \<Longrightarrow> count (darcs_mset (Node r xs)) e \<noteq> 1
[PROOF STEP]
using darcs_children_count_ge2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?t1.0, ?e1.0) \<in> fset ?xs; (?t2.0, ?e2.0) \<in> fset ?xs; (?t1.0, ?e1.0) \<noteq> (?t2.0, ?e2.0); ?e \<in> darcs ?t1.0; ?e \<in> darcs ?t2.0\<rbrakk> \<Longrightarrow> 2 \<le> count (darcs_mset (Node ?r ?xs)) ?e

goal (1 subgoal):
 1. \<lbrakk>(t1, e1) \<in> fset xs; (t2, e2) \<in> fset xs; (t1, e1) \<noteq> (t2, e2); e \<in> darcs t1; e \<in> darcs t2\<rbrakk> \<Longrightarrow> count (darcs_mset (Node r xs)) e \<noteq> 1
[PROOF STEP]
by fastforce


[STATEMENT]
lemma radical_idem [simp]: "\<surd>\<surd>F = \<surd>F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<surd>\<surd>F = \<surd>F
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<surd>\<surd>F \<subseteq> \<surd>F
 2. \<surd>F \<subseteq> \<surd>\<surd>F
[PROOF STEP]
show "\<surd>\<surd>F \<subseteq> \<surd>F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<surd>\<surd>F \<subseteq> \<surd>F
[PROOF STEP]
by (auto elim!: radicalE intro: radicalI simp flip: power_mult)
[PROOF STATE]
proof (state)
this:
\<surd>\<surd>F \<subseteq> \<surd>F

goal (1 subgoal):
 1. \<surd>F \<subseteq> \<surd>\<surd>F
[PROOF STEP]
qed (fact radical_superset)


[STATEMENT]
lemma pcompose_mult: "pcompose (p * q) r = pcompose p r * pcompose q r"
  for p q r :: "'a::comm_semiring_0 poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p * q) \<circ>\<^sub>p r = p \<circ>\<^sub>p r * q \<circ>\<^sub>p r
[PROOF STEP]
by (induct p arbitrary: q) (simp_all add: pcompose_add pcompose_smult pcompose_pCons algebra_simps)


[STATEMENT]
lemma subst_clause_finite:
  "finite (subst_clause \<Phi> m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (subst_clause \<Phi> m)
[PROOF STEP]
unfolding subst_clause_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Otimes>\<^sub>m {min_dnf (subst \<phi> m) |\<phi>. \<phi> \<in> fset \<Phi>})
[PROOF STEP]
by (auto intro: min_dnf_finite min_product_set_finite)


[STATEMENT]
lemma measurable_comp:
  "f \<in> measurable M N \<Longrightarrow> g \<in> measurable N L \<Longrightarrow> g \<circ> f \<in> measurable M L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> M \<rightarrow>\<^sub>M N; g \<in> N \<rightarrow>\<^sub>M L\<rbrakk> \<Longrightarrow> g \<circ> f \<in> M \<rightarrow>\<^sub>M L
[PROOF STEP]
using measurable_compose[of f M N g L]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f \<in> M \<rightarrow>\<^sub>M N; g \<in> N \<rightarrow>\<^sub>M L\<rbrakk> \<Longrightarrow> (\<lambda>x. g (f x)) \<in> M \<rightarrow>\<^sub>M L

goal (1 subgoal):
 1. \<lbrakk>f \<in> M \<rightarrow>\<^sub>M N; g \<in> N \<rightarrow>\<^sub>M L\<rbrakk> \<Longrightarrow> g \<circ> f \<in> M \<rightarrow>\<^sub>M L
[PROOF STEP]
by (simp add: comp_def)


[STATEMENT]
lemma (in metric_space) CauchyI':
  "(\<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n>m. dist (X m) (X n) < e) \<Longrightarrow> Cauchy X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n>m. dist (X m) (X n) < e) \<Longrightarrow> Cauchy X
[PROOF STEP]
unfolding Cauchy_altdef
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n>m. dist (X m) (X n) < e) \<Longrightarrow> \<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n>m. dist (X m) (X n) < e
[PROOF STEP]
by blast


[STATEMENT]
lemma vec_of_poly_as: "vec_of_poly_n p (Suc (degree p)) = vec_of_poly p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_poly_n p (Suc (degree p)) = vec_of_poly p
[PROOF STEP]
by (induct p, auto simp: vec_of_poly_def vec_of_poly_n_def)


[STATEMENT]
lemma scale_cancel_right [simp]: "scale a x = scale b x \<longleftrightarrow> a = b \<or> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a *s x = b *s x) = (a = b \<or> x = (0::'b))
[PROOF STEP]
by (auto intro: scale_right_imp_eq)


[STATEMENT]
lemma unitarily_equiv_square:
  assumes "A\<in> carrier_mat n n"
  and "unitarily_equiv A B U"
  shows "unitarily_equiv (A*A) (B*B) U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitarily_equiv (A * A) (B * B) U
[PROOF STEP]
proof (rule unitarily_equivI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. similar_mat_wit (A * A) (B * B) U (Complex_Matrix.adjoint U)
 2. Complex_Matrix.unitary U
[PROOF STEP]
show "unitary U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.unitary U
[PROOF STEP]
using assms unitarily_equivD(1)[of A]
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
unitarily_equiv A B U
unitarily_equiv A ?B ?U \<Longrightarrow> Complex_Matrix.unitary ?U

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

goal (1 subgoal):
 1. similar_mat_wit (A * A) (B * B) U (Complex_Matrix.adjoint U)
[PROOF STEP]
show "similar_mat_wit (A * A) (B * B) U (Complex_Matrix.adjoint U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat_wit (A * A) (B * B) U (Complex_Matrix.adjoint U)
[PROOF STEP]
by (smt (z3) \<open>Complex_Matrix.unitary U\<close> assms carrier_matD(1)
        carrier_matD(2) carrier_mat_triv index_mult_mat(2)
        index_mult_mat(3) similar_mat_witI unitarily_equiv_carrier(1)
        unitarily_equiv_carrier(2) unitarily_equiv_eq unitary_mult_square_eq
        unitary_simps(1) unitary_simps(2) mat_conj_def)
[PROOF STATE]
proof (state)
this:
similar_mat_wit (A * A) (B * B) U (Complex_Matrix.adjoint U)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in wajsberg_pseudo_hoop_algebra) sup1_eq_sup2: "(\<squnion>1) = (\<squnion>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<squnion>1) = (\<squnion>2)
[PROOF STEP]
apply (simp add: fun_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x xa. x \<squnion>1 xa = x \<squnion>2 xa
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. x \<squnion>1 xa = x \<squnion>2 xa
[PROOF STEP]
apply (cut_tac a = x and b = xa in lattice1.supremum_pair)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. supremum {x, xa} = {x \<squnion>1 xa} \<Longrightarrow> x \<squnion>1 xa = x \<squnion>2 xa
[PROOF STEP]
apply (cut_tac a = x and b = xa in lattice2.supremum_pair)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>supremum {x, xa} = {x \<squnion>1 xa}; supremum {x, xa} = {x \<squnion>2 xa}\<rbrakk> \<Longrightarrow> x \<squnion>1 xa = x \<squnion>2 xa
[PROOF STEP]
by blast


[STATEMENT]
lemma dropWhile_filter:
  "sorted (map fst xs) \<Longrightarrow> \<forall>t \<in> fst ` set xs. t \<le> nt \<Longrightarrow>
  dropWhile (\<lambda>(t, X). enat (nt - t) > c) xs = filter (\<lambda>(t, X). enat (nt - t) \<le> c) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted (map fst xs); \<forall>t\<in>fst ` set xs. t \<le> nt\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>(t, X). c < enat (nt - t)) xs = filter (\<lambda>(t, X). enat (nt - t) \<le> c) xs
[PROOF STEP]
by (induction xs) (auto 0 3 intro!: filter_id_conv[THEN iffD2, symmetric] elim: order.trans[rotated])


[STATEMENT]
lemma finite_bounded_log2:
  fixes a::complex
    assumes "a \<noteq> 0"
    shows "finite {z. norm z \<le> b \<and> exp(a*z) = w}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {z. cmod z \<le> b \<and> exp (a * z) = w}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {z. cmod z \<le> b \<and> exp (a * z) = w}
[PROOF STEP]
have *: "finite ((\<lambda>z. z / a) ` {z. cmod z \<le> b * cmod a \<and> exp z = w})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<lambda>z. z / a) ` {z. cmod z \<le> b * cmod a \<and> exp z = w})
[PROOF STEP]
by (rule finite_imageI [OF finite_bounded_log])
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>z. z / a) ` {z. cmod z \<le> b * cmod a \<and> exp z = w})

goal (1 subgoal):
 1. finite {z. cmod z \<le> b \<and> exp (a * z) = w}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {z. cmod z \<le> b \<and> exp (a * z) = w}
[PROOF STEP]
by (rule finite_subset [OF _ *]) (force simp: assms norm_mult)
[PROOF STATE]
proof (state)
this:
finite {z. cmod z \<le> b \<and> exp (a * z) = w}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_ssub_zero_commutative: "(\<Sum>t=0..(q::nat). \<Sum>S0 p l (\<lambda>k. f k t)) = (\<Sum>S0 p l (\<lambda>k. \<Sum>t=0..q. f k t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t = 0..q. \<Sum>S0 p l (\<lambda>k. f k t) ) = \<Sum>S0 p l (\<lambda>k. sum (f k) {0..q})
[PROOF STEP]
by (rule sum_commutative sum_ssub_zero.simps) +


[STATEMENT]
lemma setdist_neq_0_sing_2:
  "\<lbrakk>setdist S {x} = a; a \<noteq> 0\<rbrakk> \<Longrightarrow> S \<noteq> {} \<and> x \<notin> closure S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>setdist S {x} = a; a \<noteq> 0\<rbrakk> \<Longrightarrow> S \<noteq> {} \<and> x \<notin> closure S
[PROOF STEP]
by (simp add: setdist_neq_0_sing_1 setdist_sym)


[STATEMENT]
lemma ordinal_times_left_cancel [simp]:
"0 < w \<Longrightarrow> (w * x = w * y) = (x = (y::ordinal))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < w \<Longrightarrow> (w * x = w * y) = (x = y)
[PROOF STEP]
by (rule normal.cancel_eq[OF normal_times])


[STATEMENT]
lemma linord_of_list_append:
  "(x, y) \<in> linord_of_list (xs @ ys) \<longleftrightarrow> (x, y) \<in> linord_of_list xs \<or> (x, y) \<in> linord_of_list ys \<or> (y \<in> set xs \<and> x \<in> set ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x, y) \<in> linord_of_list (xs @ ys)) = ((x, y) \<in> linord_of_list xs \<or> (x, y) \<in> linord_of_list ys \<or> y \<in> set xs \<and> x \<in> set ys)
[PROOF STEP]
unfolding linord_of_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x, y) \<in> {(x, y). linord_of_listP x y (xs @ ys)}) = ((x, y) \<in> {(x, y). linord_of_listP x y xs} \<or> (x, y) \<in> {(x, y). linord_of_listP x y ys} \<or> y \<in> set xs \<and> x \<in> set ys)
[PROOF STEP]
by (simp add: linord_of_listP_append)


[STATEMENT]
lemma bigo_alt_def: "O(f) = {h. \<exists>c. 0 < c \<and> (\<forall>x. \<bar>h x\<bar> \<le> c * \<bar>f x\<bar>)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. O(f) = {h. \<exists>c>0::'b. \<forall>x. \<bar>h x\<bar> \<le> c * \<bar>f x\<bar>}
[PROOF STEP]
by (auto simp add: bigo_def bigo_pos_const)


[STATEMENT]
lemma sum_unique_nonzero:
  fixes i::"'sv::finite" and f::"'sv \<Rightarrow> real"
  assumes restZero:"\<And>j. j\<in>(UNIV::'sv set) \<Longrightarrow> j \<noteq> i \<Longrightarrow> f j = 0"
  shows "(\<Sum>j\<in>(UNIV::'sv set). f j) = f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f UNIV = f i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum f UNIV = f i
[PROOF STEP]
have "(\<Sum>j\<in>(UNIV::'sv set). f j) = (\<Sum>j\<in>{i}. f j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f UNIV = sum f {i}
[PROOF STEP]
using restZero
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?j5 \<in> UNIV; ?j5 \<noteq> i\<rbrakk> \<Longrightarrow> f ?j5 = 0

goal (1 subgoal):
 1. sum f UNIV = sum f {i}
[PROOF STEP]
by (intro sum.mono_neutral_cong_right) auto
[PROOF STATE]
proof (state)
this:
sum f UNIV = sum f {i}

goal (1 subgoal):
 1. sum f UNIV = f i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sum f UNIV = sum f {i}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum f UNIV = sum f {i}

goal (1 subgoal):
 1. sum f UNIV = f i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f UNIV = f i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uplus_power_def: "P\<^sup>+ = (\<Sqinter> i \<bullet> P \<^bold>^ (Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P\<^sup>+ = (\<Sqinter> i \<bullet> power.power II (;;) P (Suc i))
[PROOF STEP]
by (simp add: uplus_def ustar_def seq_UINF_distl' UINF_atLeast_Suc upred_semiring.power_Suc)


[STATEMENT]
lemma row_addrow:
  "k \<noteq> i \<Longrightarrow> i < n \<Longrightarrow> row (addrow_mat n a k l) i = unit_vec n i"
  "k < n \<Longrightarrow> l < n \<Longrightarrow> row (addrow_mat n a k l) k = a \<cdot>\<^sub>v unit_vec n l + unit_vec n k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>k \<noteq> i; i < n\<rbrakk> \<Longrightarrow> row (addrow_mat n a k l) i = unit_vec n i) &&& (\<lbrakk>k < n; l < n\<rbrakk> \<Longrightarrow> row (addrow_mat n a k l) k = a \<cdot>\<^sub>v unit_vec n l + unit_vec n k)
[PROOF STEP]
by (rule eq_vecI, auto)


[STATEMENT]
lemma nn_integral_mono:
  "(\<And>x. x \<in> space M \<Longrightarrow> u x \<le> v x) \<Longrightarrow> integral\<^sup>N M u \<le> integral\<^sup>N M v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> space M \<Longrightarrow> u x \<le> v x) \<Longrightarrow> integral\<^sup>N M u \<le> integral\<^sup>N M v
[PROOF STEP]
by (auto intro: nn_integral_mono_AE)


[STATEMENT]
lemma CONJ_disjoint_eq_False_iff[simp]: "finite Qeq \<Longrightarrow> irrefl Qeq \<Longrightarrow> CONJ_disjoint (Q, Qeq) = Bool False \<longleftrightarrow> Q = Bool False \<and> Qeq = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite Qeq; irrefl Qeq\<rbrakk> \<Longrightarrow> (CONJ_disjoint (Q, Qeq) = Bool False) = (Q = Bool False \<and> Qeq = {})
[PROOF STEP]
by (auto simp: CONJ_disjoint_def)


[STATEMENT]
theorem member_bound_size_univ: "invar_vebt t n \<Longrightarrow> u =  2^n \<Longrightarrow>  T\<^sub>m\<^sub>e\<^sub>m\<^sub>b\<^sub>e\<^sub>r t x \<le> 30 + 15 * lb (lb u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar_vebt t n; u = 2 ^ n\<rbrakk> \<Longrightarrow> real (T\<^sub>m\<^sub>e\<^sub>m\<^sub>b\<^sub>e\<^sub>r t x) \<le> 30 + 15 * log 2 (log 2 u)
[PROOF STEP]
using member_bound_height[of t n x]  height_double_log_univ_size[of u n t] algebra_simps
[PROOF STATE]
proof (prove)
using this:
invar_vebt t n \<Longrightarrow> T\<^sub>m\<^sub>e\<^sub>m\<^sub>b\<^sub>e\<^sub>r t x \<le> (1 + height t) * 15
\<lbrakk>u = 2 ^ n; invar_vebt t n\<rbrakk> \<Longrightarrow> real (height t) \<le> 1 + log 2 (log 2 u)
?a + ?b + ?c = ?a + (?b + ?c)
?a + ?b = ?b + ?a
?b + (?a + ?c) = ?a + (?b + ?c)
?a * ?b * ?c = ?a * (?b * ?c)
?a * ?b = ?b * ?a
?b * (?a * ?c) = ?a * (?b * ?c)
?a - ?b - ?c = ?a - (?b + ?c)
?a + (?b - ?c) = ?a + ?b - ?c
(?a - ?b = ?c) = (?a = ?c + ?b)
(?a = ?c - ?b) = (?a + ?b = ?c)
?a - (?b - ?c) = ?a + ?c - ?b
?a - ?b + ?c = ?a + ?c - ?b
(?a - ?b < ?c) = (?a < ?c + ?b)
(?a < ?c - ?b) = (?a + ?b < ?c)
(?a - ?b \<le> ?c) = (?a \<le> ?c + ?b)
(?a \<le> ?c - ?b) = (?a + ?b \<le> ?c)
(?a + ?b) * ?c = ?a * ?c + ?b * ?c
?a * (?b + ?c) = ?a * ?b + ?a * ?c
?a * (?b - ?c) = ?a * ?b - ?a * ?c
(?b - ?c) * ?a = ?b * ?a - ?c * ?a
?a * (?b - ?c) = ?a * ?b - ?a * ?c
(?a - ?b) * ?c = ?a * ?c - ?b * ?c
(?a * ?b) ^ ?n = ?a ^ ?n * ?b ^ ?n
?a *\<^sub>R (?x + ?y) = ?a *\<^sub>R ?x + ?a *\<^sub>R ?y
(?a + ?b) *\<^sub>R ?x = ?a *\<^sub>R ?x + ?b *\<^sub>R ?x
(?a - ?b) *\<^sub>R ?x = ?a *\<^sub>R ?x - ?b *\<^sub>R ?x
?a *\<^sub>R (?x - ?y) = ?a *\<^sub>R ?x - ?a *\<^sub>R ?y

goal (1 subgoal):
 1. \<lbrakk>invar_vebt t n; u = 2 ^ n\<rbrakk> \<Longrightarrow> real (T\<^sub>m\<^sub>e\<^sub>m\<^sub>b\<^sub>e\<^sub>r t x) \<le> 30 + 15 * log 2 (log 2 u)
[PROOF STEP]
by simp


[STATEMENT]
lemma is_aligned_add_helper:
  "\<lbrakk> is_aligned p n; d < 2 ^ n \<rbrakk>
     \<Longrightarrow> (p + d AND mask n = d) \<and> (p + d AND (NOT (mask n)) = p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_aligned p n; d < 2 ^ n\<rbrakk> \<Longrightarrow> p + d AND mask n = d \<and> p + d AND NOT (mask n) = p
[PROOF STEP]
apply (subst (asm) is_aligned_mask)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p AND mask n = 0; d < 2 ^ n\<rbrakk> \<Longrightarrow> p + d AND mask n = d \<and> p + d AND NOT (mask n) = p
[PROOF STEP]
apply (drule less_mask_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p AND mask n = 0; d AND mask n = d\<rbrakk> \<Longrightarrow> p + d AND mask n = d \<and> p + d AND NOT (mask n) = p
[PROOF STEP]
apply (rule context_conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p AND mask n = 0; d AND mask n = d\<rbrakk> \<Longrightarrow> p + d AND mask n = d
 2. \<lbrakk>p AND mask n = 0; d AND mask n = d; p + d AND mask n = d\<rbrakk> \<Longrightarrow> p + d AND NOT (mask n) = p
[PROOF STEP]
apply (subst word_plus_and_or_coroll)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>p AND mask n = 0; d AND mask n = d\<rbrakk> \<Longrightarrow> p AND d = 0
 2. \<lbrakk>p AND mask n = 0; d AND mask n = d\<rbrakk> \<Longrightarrow> (p OR d) AND mask n = d
 3. \<lbrakk>p AND mask n = 0; d AND mask n = d; p + d AND mask n = d\<rbrakk> \<Longrightarrow> p + d AND NOT (mask n) = p
[PROOF STEP]
apply (simp_all flip: take_bit_eq_mask)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>take_bit n p = 0; take_bit n d = d\<rbrakk> \<Longrightarrow> p AND d = 0
 2. \<lbrakk>take_bit n p = 0; take_bit n d = d; take_bit n (p + d) = d\<rbrakk> \<Longrightarrow> p + d AND NOT (mask n) = p
[PROOF STEP]
apply (metis take_bit_eq_mask word_bw_lcs(1) word_log_esimps(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>take_bit n p = 0; take_bit n d = d; take_bit n (p + d) = d\<rbrakk> \<Longrightarrow> p + d AND NOT (mask n) = p
[PROOF STEP]
apply (metis add.commute add_left_imp_eq take_bit_eq_mask word_plus_and_or_coroll2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_zip_map1: "set (zip (map f xs) xs) = (\<lambda>x. (f x, x)) ` (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (zip (map f xs) xs) = (\<lambda>x. (f x, x)) ` set xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (zip (map f xs) xs) = (\<lambda>x. (f x, x)) ` set xs
[PROOF STEP]
have "set (zip (map f xs) (map id xs)) = (\<lambda>x. (f x, id x)) ` (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (zip (map f xs) (map id xs)) = (\<lambda>x. (f x, id x)) ` set xs
[PROOF STEP]
by (rule set_zip_map)
[PROOF STATE]
proof (state)
this:
set (zip (map f xs) (map id xs)) = (\<lambda>x. (f x, id x)) ` set xs

goal (1 subgoal):
 1. set (zip (map f xs) xs) = (\<lambda>x. (f x, x)) ` set xs
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
set (zip (map f xs) (map id xs)) = (\<lambda>x. (f x, id x)) ` set xs

goal (1 subgoal):
 1. set (zip (map f xs) xs) = (\<lambda>x. (f x, x)) ` set xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (zip (map f xs) xs) = (\<lambda>x. (f x, x)) ` set xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_field_derivative_nat_power [derivative_intros]:
  "n > 0 \<Longrightarrow> ((\<lambda>y. nat_power n y) has_field_derivative ln (real n) *\<^sub>R nat_power n x)
     (at (x :: 'a :: nat_power_normed_field) within A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> (nat_power n has_field_derivative ln (real n) *\<^sub>R nat_power n x) (at x within A)
[PROOF STEP]
by (rule has_field_derivative_at_within)
     (insert has_field_derivative_nat_power_aux[of n x],
      simp only: has_field_derivative_def has_derivative_def netlimit_at,
      simp add: nhds_def at_within_def bounded_linear_mult_right)


[STATEMENT]
lemma card_minus1 [rewrite]: "x \<in> S \<Longrightarrow> card (S - {x}) = card S - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> S \<Longrightarrow> card (S - {x}) = card S - 1
[PROOF STEP]
by (simp add: card_Diff_subset)


[STATEMENT]
lemma atLeastatMost_empty_iff[simp]: "{a\<le>\<^sub>a..\<le>\<^sub>ab} = {} \<longleftrightarrow> (\<not> a \<le>\<^sub>a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a\<le>\<^sub>a..\<le>\<^sub>ab} = {}) = (\<not> a \<le>\<^sub>a b)
[PROOF STEP]
by auto (blast intro: order_trans)


[STATEMENT]
lemma tick_count_strict_suc:\<open>tick_count_strict r c (Suc n) = tick_count r c n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tick_count_strict r c (Suc n) = tick_count r c n
[PROOF STEP]
unfolding tick_count_def tick_count_strict_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. i < Suc n \<and> hamlet (Rep_run r i c)} = card {i. i \<le> n \<and> hamlet (Rep_run r i c)}
[PROOF STEP]
using less_Suc_eq_le
[PROOF STATE]
proof (prove)
using this:
(?m < Suc ?n) = (?m \<le> ?n)

goal (1 subgoal):
 1. card {i. i < Suc n \<and> hamlet (Rep_run r i c)} = card {i. i \<le> n \<and> hamlet (Rep_run r i c)}
[PROOF STEP]
by auto


[STATEMENT]
lemma inf_eq_neg_sup: "inf a b = - sup (- a) (- b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf a b = - sup (- a) (- b)
[PROOF STEP]
proof (rule inf_unique)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x y. - sup (- x) (- y) \<le> x
 2. \<And>x y. - sup (- x) (- y) \<le> y
 3. \<And>x y z. \<lbrakk>x \<le> y; x \<le> z\<rbrakk> \<Longrightarrow> x \<le> - sup (- y) (- z)
[PROOF STEP]
fix a b c :: 'a
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x y. - sup (- x) (- y) \<le> x
 2. \<And>x y. - sup (- x) (- y) \<le> y
 3. \<And>x y z. \<lbrakk>x \<le> y; x \<le> z\<rbrakk> \<Longrightarrow> x \<le> - sup (- y) (- z)
[PROOF STEP]
show "- sup (- a) (- b) \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - sup (- a) (- b) \<le> a
[PROOF STEP]
by (rule add_le_imp_le_right [of _ "sup (uminus a) (uminus b)"])
      (simp, simp add: add_sup_distrib_left)
[PROOF STATE]
proof (state)
this:
- sup (- a) (- b) \<le> a

goal (2 subgoals):
 1. \<And>x y. - sup (- x) (- y) \<le> y
 2. \<And>x y z. \<lbrakk>x \<le> y; x \<le> z\<rbrakk> \<Longrightarrow> x \<le> - sup (- y) (- z)
[PROOF STEP]
show "- sup (-a) (-b) \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - sup (- a) (- b) \<le> b
[PROOF STEP]
by (rule add_le_imp_le_right [of _ "sup (uminus a) (uminus b)"])
      (simp, simp add: add_sup_distrib_left)
[PROOF STATE]
proof (state)
this:
- sup (- a) (- b) \<le> b

goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>x \<le> y; x \<le> z\<rbrakk> \<Longrightarrow> x \<le> - sup (- y) (- z)
[PROOF STEP]
assume "a \<le> b" "a \<le> c"
[PROOF STATE]
proof (state)
this:
a \<le> b
a \<le> c

goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>x \<le> y; x \<le> z\<rbrakk> \<Longrightarrow> x \<le> - sup (- y) (- z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
a \<le> c
[PROOF STEP]
show "a \<le> - sup (-b) (-c)"
[PROOF STATE]
proof (prove)
using this:
a \<le> b
a \<le> c

goal (1 subgoal):
 1. a \<le> - sup (- b) (- c)
[PROOF STEP]
by (subst neg_le_iff_le [symmetric]) (simp add: le_supI)
[PROOF STATE]
proof (state)
this:
a \<le> - sup (- b) (- c)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma represent_NatInterval[rule_format]: "Elem x (NatInterval n m) \<longrightarrow> (\<exists>u. n \<le> u \<and> u \<le> n+m \<and> nat2Nat u = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Elem x (NatInterval n m) \<longrightarrow> (\<exists>u\<ge>n. u \<le> n + m \<and> nat2Nat u = x)
[PROOF STEP]
apply (induct m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Elem x (NatInterval n 0) \<longrightarrow> (\<exists>u\<ge>n. u \<le> n + 0 \<and> nat2Nat u = x)
 2. \<And>m. Elem x (NatInterval n m) \<longrightarrow> (\<exists>u\<ge>n. u \<le> n + m \<and> nat2Nat u = x) \<Longrightarrow> Elem x (NatInterval n (Suc m)) \<longrightarrow> (\<exists>u\<ge>n. u \<le> n + Suc m \<and> nat2Nat u = x)
[PROOF STEP]
apply (auto simp add: Singleton union)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>\<not> Elem (SucNat (nat2Nat (n + m))) (NatInterval n m); x = SucNat (nat2Nat (n + m))\<rbrakk> \<Longrightarrow> \<exists>u\<ge>n. u \<le> Suc (n + m) \<and> nat2Nat u = SucNat (nat2Nat (n + m))
[PROOF STEP]
apply (rule_tac x="Suc (n+m)" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>\<not> Elem (SucNat (nat2Nat (n + m))) (NatInterval n m); x = SucNat (nat2Nat (n + m))\<rbrakk> \<Longrightarrow> n \<le> Suc (n + m) \<and> Suc (n + m) \<le> Suc (n + m) \<and> nat2Nat (Suc (n + m)) = SucNat (nat2Nat (n + m))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done