[STATEMENT]
lemma proots_card_pcompose_bij_eq:
  fixes p::"'a::idom poly"
  assumes bij:"bij_betw (\<lambda>x. poly q x) A B" and "p\<noteq>0"
      and q_deg: "degree q = 1"
  shows "card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
using \<open>p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
proof (induct p rule:poly_root_induct_alt)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> card (proots_within 0 B) = card (proots_within (0 \<circ>\<^sub>p q) A)
 2. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
 3. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 \<noteq> 0

goal (3 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> card (proots_within 0 B) = card (proots_within (0 \<circ>\<^sub>p q) A)
 2. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
 3. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<noteq> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 \<noteq> 0

goal (1 subgoal):
 1. card (proots_within 0 B) = card (proots_within (0 \<circ>\<^sub>p q) A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (proots_within 0 B) = card (proots_within (0 \<circ>\<^sub>p q) A)

goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
 2. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
 2. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
case (no_proots p)
[PROOF STATE]
proof (state)
this:
poly p ?a \<noteq> (0::'a)
p \<noteq> 0

goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
 2. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
have "proots_within p B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within p B = {}
[PROOF STEP]
using no_proots
[PROOF STATE]
proof (prove)
using this:
poly p ?a \<noteq> (0::'a)
p \<noteq> 0

goal (1 subgoal):
 1. proots_within p B = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_within p B = {}

goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
 2. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
proots_within p B = {}

goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
 2. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
have "proots_within (p \<circ>\<^sub>p q) A = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within (p \<circ>\<^sub>p q) A = {}
[PROOF STEP]
using no_proots
[PROOF STATE]
proof (prove)
using this:
poly p ?a \<noteq> (0::'a)
p \<noteq> 0

goal (1 subgoal):
 1. proots_within (p \<circ>\<^sub>p q) A = {}
[PROOF STEP]
by (simp add: poly_pcompose proots_within_def)
[PROOF STATE]
proof (state)
this:
proots_within (p \<circ>\<^sub>p q) A = {}

goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
 2. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
proots_within p B = {}
proots_within (p \<circ>\<^sub>p q) A = {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
proots_within p B = {}
proots_within (p \<circ>\<^sub>p q) A = {}

goal (1 subgoal):
 1. card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
case (root b p)
[PROOF STATE]
proof (state)
this:
p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
[:- b, 1::'a:] * p \<noteq> 0

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
[:- b, 1::'a:] * p \<noteq> 0
[PROOF STEP]
have [simp]:"p\<noteq>0"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)
[:- b, 1::'a:] * p \<noteq> 0

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

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
have ?case when "b\<notin>B \<or> poly p b=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
have "proots_within ([:- b, 1:] * p) B = proots_within p B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within ([:- b, 1::'a:] * p) B = proots_within p B
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
b \<notin> B \<or> poly p b = (0::'a)

goal (1 subgoal):
 1. proots_within ([:- b, 1::'a:] * p) B = proots_within p B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_within ([:- b, 1::'a:] * p) B = proots_within p B

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
proots_within ([:- b, 1::'a:] * p) B = proots_within p B

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
have "proots_within (([:- b, 1:] * p) \<circ>\<^sub>p q) A = proots_within (p \<circ>\<^sub>p q) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A = proots_within (p \<circ>\<^sub>p q) A
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
b \<notin> B \<or> poly p b = (0::'a)

goal (1 subgoal):
 1. proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A = proots_within (p \<circ>\<^sub>p q) A
[PROOF STEP]
unfolding pcompose_mult proots_within_times
[PROOF STATE]
proof (prove)
using this:
b \<notin> B \<or> poly p b = (0::'a)

goal (1 subgoal):
 1. proots_within ([:- b, 1::'a:] \<circ>\<^sub>p q) A \<union> proots_within (p \<circ>\<^sub>p q) A = proots_within (p \<circ>\<^sub>p q) A
[PROOF STEP]
apply (auto simp add: poly_pcompose)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>poly q x \<notin> B; x \<in> A; b = poly q x\<rbrakk> \<Longrightarrow> poly p (poly q x) = (0::'a)
[PROOF STEP]
using bij bij_betwE
[PROOF STATE]
proof (prove)
using this:
bij_betw (poly q) A B
bij_betw ?f ?A ?B \<Longrightarrow> \<forall>a\<in>?A. ?f a \<in> ?B

goal (1 subgoal):
 1. \<And>x. \<lbrakk>poly q x \<notin> B; x \<in> A; b = poly q x\<rbrakk> \<Longrightarrow> poly p (poly q x) = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A = proots_within (p \<circ>\<^sub>p q) A

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
proots_within ([:- b, 1::'a:] * p) B = proots_within p B
proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A = proots_within (p \<circ>\<^sub>p q) A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_within ([:- b, 1::'a:] * p) B = proots_within p B
proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A = proots_within (p \<circ>\<^sub>p q) A

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
using root.hyps[OF \<open>p\<noteq>0\<close>]
[PROOF STATE]
proof (prove)
using this:
proots_within ([:- b, 1::'a:] * p) B = proots_within p B
proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A = proots_within (p \<circ>\<^sub>p q) A
card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b \<notin> B \<or> poly p b = (0::'a) \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
b \<notin> B \<or> poly p b = (0::'a) \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
have ?case when "b\<in>B" "poly p b\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
define bb where "bb=[:- b, 1:]"
[PROOF STATE]
proof (state)
this:
bb = [:- b, 1::'a:]

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
have "card (proots_within (bb * p) B) = card {b} + card (proots_within p B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within (bb * p) B) = card {b} + card (proots_within p B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (proots_within (bb * p) B) = card {b} + card (proots_within p B)
[PROOF STEP]
have "proots_within bb B = {b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within bb B = {b}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
b \<in> B
poly p b \<noteq> (0::'a)

goal (1 subgoal):
 1. proots_within bb B = {b}
[PROOF STEP]
unfolding bb_def
[PROOF STATE]
proof (prove)
using this:
b \<in> B
poly p b \<noteq> (0::'a)

goal (1 subgoal):
 1. proots_within [:- b, 1::'a:] B = {b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_within bb B = {b}

goal (1 subgoal):
 1. card (proots_within (bb * p) B) = card {b} + card (proots_within p B)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
proots_within bb B = {b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_within bb B = {b}

goal (1 subgoal):
 1. card (proots_within (bb * p) B) = card {b} + card (proots_within p B)
[PROOF STEP]
unfolding proots_within_times
[PROOF STATE]
proof (prove)
using this:
proots_within bb B = {b}

goal (1 subgoal):
 1. card (proots_within bb B \<union> proots_within p B) = card {b} + card (proots_within p B)
[PROOF STEP]
apply (subst card_Un_disjoint)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. proots_within bb B = {b} \<Longrightarrow> finite (proots_within bb B)
 2. proots_within bb B = {b} \<Longrightarrow> finite (proots_within p B)
 3. proots_within bb B = {b} \<Longrightarrow> proots_within bb B \<inter> proots_within p B = {}
 4. proots_within bb B = {b} \<Longrightarrow> card (proots_within bb B) + card (proots_within p B) = card {b} + card (proots_within p B)
[PROOF STEP]
by (use that in auto)
[PROOF STATE]
proof (state)
this:
card (proots_within (bb * p) B) = card {b} + card (proots_within p B)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (proots_within (bb * p) B) = card {b} + card (proots_within p B)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (proots_within (bb * p) B) = card {b} + card (proots_within p B)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
have "... = 1 + card (proots_within (p \<circ>\<^sub>p q) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {b} + card (proots_within p B) = 1 + card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
using root.hyps
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A)

goal (1 subgoal):
 1. card {b} + card (proots_within p B) = 1 + card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {b} + card (proots_within p B) = 1 + card (proots_within (p \<circ>\<^sub>p q) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {b} + card (proots_within p B) = 1 + card (proots_within (p \<circ>\<^sub>p q) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
have "... = card (proots_within ((bb * p) \<circ>\<^sub>p q) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + card (proots_within (p \<circ>\<^sub>p q) A) = card (proots_within ((bb * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
unfolding proots_within_times pcompose_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + card (proots_within (p \<circ>\<^sub>p q) A) = card (proots_within (bb \<circ>\<^sub>p q) A \<union> proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
proof (subst card_Un_disjoint)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. finite (proots_within (bb \<circ>\<^sub>p q) A)
 2. finite (proots_within (p \<circ>\<^sub>p q) A)
 3. proots_within (bb \<circ>\<^sub>p q) A \<inter> proots_within (p \<circ>\<^sub>p q) A = {}
 4. 1 + card (proots_within (p \<circ>\<^sub>p q) A) = card (proots_within (bb \<circ>\<^sub>p q) A) + card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
obtain a where "b=poly q a" "a\<in>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>b = poly q a; a \<in> A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis \<open>b \<in> B\<close> bij bij_betwE bij_betw_the_inv_into f_the_inv_into_f_bij_betw)
[PROOF STATE]
proof (state)
this:
b = poly q a
a \<in> A

goal (4 subgoals):
 1. finite (proots_within (bb \<circ>\<^sub>p q) A)
 2. finite (proots_within (p \<circ>\<^sub>p q) A)
 3. proots_within (bb \<circ>\<^sub>p q) A \<inter> proots_within (p \<circ>\<^sub>p q) A = {}
 4. 1 + card (proots_within (p \<circ>\<^sub>p q) A) = card (proots_within (bb \<circ>\<^sub>p q) A) + card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
define bbq pq where "bbq=bb \<circ>\<^sub>p q" and "pq=p \<circ>\<^sub>p q"
[PROOF STATE]
proof (state)
this:
bbq = bb \<circ>\<^sub>p q
pq = p \<circ>\<^sub>p q

goal (4 subgoals):
 1. finite (proots_within (bb \<circ>\<^sub>p q) A)
 2. finite (proots_within (p \<circ>\<^sub>p q) A)
 3. proots_within (bb \<circ>\<^sub>p q) A \<inter> proots_within (p \<circ>\<^sub>p q) A = {}
 4. 1 + card (proots_within (p \<circ>\<^sub>p q) A) = card (proots_within (bb \<circ>\<^sub>p q) A) + card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
have bbq_0:"poly bbq a=0" and bbq_deg: "degree bbq\<le>1" and "bbq\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly bbq a = (0::'a) &&& degree bbq \<le> 1 &&& bbq \<noteq> 0
[PROOF STEP]
unfolding bbq_def bb_def poly_pcompose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly [:- b, 1::'a:] (poly q a) = (0::'a) &&& degree ([:- b, 1::'a:] \<circ>\<^sub>p q) \<le> 1 &&& [:- b, 1::'a:] \<circ>\<^sub>p q \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly [:- b, 1::'a:] (poly q a) = (0::'a)
[PROOF STEP]
using \<open>b=poly q a\<close>
[PROOF STATE]
proof (prove)
using this:
b = poly q a

goal (1 subgoal):
 1. poly [:- b, 1::'a:] (poly q a) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. degree ([:- b, 1::'a:] \<circ>\<^sub>p q) \<le> 1
 2. [:- b, 1::'a:] \<circ>\<^sub>p q \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree ([:- b, 1::'a:] \<circ>\<^sub>p q) \<le> 1
[PROOF STEP]
using q_deg
[PROOF STATE]
proof (prove)
using this:
degree q = 1

goal (1 subgoal):
 1. degree ([:- b, 1::'a:] \<circ>\<^sub>p q) \<le> 1
[PROOF STEP]
by (simp add: degree_add_le degree_pcompose)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:- b, 1::'a:] \<circ>\<^sub>p q \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:- b, 1::'a:] \<circ>\<^sub>p q \<noteq> 0
[PROOF STEP]
using pcompose_eq_0 q_deg
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?p \<circ>\<^sub>p ?q = 0; 0 < degree ?q\<rbrakk> \<Longrightarrow> ?p = 0
degree q = 1

goal (1 subgoal):
 1. [:- b, 1::'a:] \<circ>\<^sub>p q \<noteq> 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
poly bbq a = (0::'a)
degree bbq \<le> 1
bbq \<noteq> 0

goal (4 subgoals):
 1. finite (proots_within (bb \<circ>\<^sub>p q) A)
 2. finite (proots_within (p \<circ>\<^sub>p q) A)
 3. proots_within (bb \<circ>\<^sub>p q) A \<inter> proots_within (p \<circ>\<^sub>p q) A = {}
 4. 1 + card (proots_within (p \<circ>\<^sub>p q) A) = card (proots_within (bb \<circ>\<^sub>p q) A) + card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
show "finite (proots_within bbq A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (proots_within bbq A)
[PROOF STEP]
using \<open>bbq\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
bbq \<noteq> 0

goal (1 subgoal):
 1. finite (proots_within bbq A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (proots_within bbq A)

goal (3 subgoals):
 1. finite (proots_within (p \<circ>\<^sub>p q) A)
 2. proots_within (bb \<circ>\<^sub>p q) A \<inter> proots_within (p \<circ>\<^sub>p q) A = {}
 3. 1 + card (proots_within (p \<circ>\<^sub>p q) A) = card (proots_within (bb \<circ>\<^sub>p q) A) + card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
show "finite (proots_within pq A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (proots_within pq A)
[PROOF STEP]
unfolding pq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
by (metis \<open>p \<noteq> 0\<close> finite_proots pcompose_eq_0 q_deg zero_less_one)
[PROOF STATE]
proof (state)
this:
finite (proots_within pq A)

goal (2 subgoals):
 1. proots_within (bb \<circ>\<^sub>p q) A \<inter> proots_within (p \<circ>\<^sub>p q) A = {}
 2. 1 + card (proots_within (p \<circ>\<^sub>p q) A) = card (proots_within (bb \<circ>\<^sub>p q) A) + card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
have bbq_a:"proots_within bbq A = {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within bbq A = {a}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_within bbq A = {a}
[PROOF STEP]
have "a\<in>proots_within bbq A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> proots_within bbq A
[PROOF STEP]
unfolding bb_def proots_within_def poly_pcompose bbq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> {x \<in> A. poly [:- b, 1::'a:] (poly q x) = (0::'a)}
[PROOF STEP]
using \<open>b=poly q a\<close> \<open>a\<in>A\<close>
[PROOF STATE]
proof (prove)
using this:
b = poly q a
a \<in> A

goal (1 subgoal):
 1. a \<in> {x \<in> A. poly [:- b, 1::'a:] (poly q x) = (0::'a)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<in> proots_within bbq A

goal (1 subgoal):
 1. proots_within bbq A = {a}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a \<in> proots_within bbq A

goal (1 subgoal):
 1. proots_within bbq A = {a}
[PROOF STEP]
have "card (proots_within bbq A) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within bbq A) = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (proots_within bbq A) = 1
[PROOF STEP]
have "card (proots_within bbq A) \<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within bbq A) \<noteq> 0
[PROOF STEP]
using \<open>a\<in>proots_within bbq A\<close> \<open>finite (proots_within bbq A)\<close>
[PROOF STATE]
proof (prove)
using this:
a \<in> proots_within bbq A
finite (proots_within bbq A)

goal (1 subgoal):
 1. card (proots_within bbq A) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (proots_within bbq A) \<noteq> 0

goal (1 subgoal):
 1. card (proots_within bbq A) = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (proots_within bbq A) \<noteq> 0

goal (1 subgoal):
 1. card (proots_within bbq A) = 1
[PROOF STEP]
have "card (proots_within bbq A) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within bbq A) \<le> 1
[PROOF STEP]
by (meson \<open>bbq \<noteq> 0\<close> card_proots_within_leq le_trans proots_count_leq_degree bbq_deg)
[PROOF STATE]
proof (state)
this:
card (proots_within bbq A) \<le> 1

goal (1 subgoal):
 1. card (proots_within bbq A) = 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (proots_within bbq A) \<noteq> 0
card (proots_within bbq A) \<le> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (proots_within bbq A) \<noteq> 0
card (proots_within bbq A) \<le> 1

goal (1 subgoal):
 1. card (proots_within bbq A) = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (proots_within bbq A) = 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (proots_within bbq A) = 1

goal (1 subgoal):
 1. proots_within bbq A = {a}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a \<in> proots_within bbq A
card (proots_within bbq A) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<in> proots_within bbq A
card (proots_within bbq A) = 1

goal (1 subgoal):
 1. proots_within bbq A = {a}
[PROOF STEP]
by (metis card_1_singletonE singletonD)
[PROOF STATE]
proof (state)
this:
proots_within bbq A = {a}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
proots_within bbq A = {a}

goal (2 subgoals):
 1. proots_within (bb \<circ>\<^sub>p q) A \<inter> proots_within (p \<circ>\<^sub>p q) A = {}
 2. 1 + card (proots_within (p \<circ>\<^sub>p q) A) = card (proots_within (bb \<circ>\<^sub>p q) A) + card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
show "proots_within (bbq) A \<inter> proots_within (pq) A = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within bbq A \<inter> proots_within pq A = {}
[PROOF STEP]
using bbq_a \<open>b = poly q a\<close> that(2)
[PROOF STATE]
proof (prove)
using this:
proots_within bbq A = {a}
b = poly q a
poly p b \<noteq> (0::'a)

goal (1 subgoal):
 1. proots_within bbq A \<inter> proots_within pq A = {}
[PROOF STEP]
unfolding pq_def
[PROOF STATE]
proof (prove)
using this:
proots_within bbq A = {a}
b = poly q a
poly p b \<noteq> (0::'a)

goal (1 subgoal):
 1. proots_within bbq A \<inter> proots_within (p \<circ>\<^sub>p q) A = {}
[PROOF STEP]
by (simp add:poly_pcompose)
[PROOF STATE]
proof (state)
this:
proots_within bbq A \<inter> proots_within pq A = {}

goal (1 subgoal):
 1. 1 + card (proots_within (p \<circ>\<^sub>p q) A) = card (proots_within (bb \<circ>\<^sub>p q) A) + card (proots_within (p \<circ>\<^sub>p q) A)
[PROOF STEP]
show "1 + card (proots_within pq A) = card (proots_within bbq A) + card (proots_within pq A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + card (proots_within pq A) = card (proots_within bbq A) + card (proots_within pq A)
[PROOF STEP]
using bbq_a
[PROOF STATE]
proof (prove)
using this:
proots_within bbq A = {a}

goal (1 subgoal):
 1. 1 + card (proots_within pq A) = card (proots_within bbq A) + card (proots_within pq A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 + card (proots_within pq A) = card (proots_within bbq A) + card (proots_within pq A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
1 + card (proots_within (p \<circ>\<^sub>p q) A) = card (proots_within ((bb * p) \<circ>\<^sub>p q) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (proots_within (bb * p) B) = card (proots_within ((bb * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (proots_within (bb * p) B) = card (proots_within ((bb * p) \<circ>\<^sub>p q) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
unfolding bb_def
[PROOF STATE]
proof (prove)
using this:
card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>b \<in> B; poly p b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (p \<circ>\<^sub>p q) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (([:- a, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
b \<notin> B \<or> poly p b = (0::'a) \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
\<lbrakk>b \<in> B; poly p b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
b \<notin> B \<or> poly p b = (0::'a) \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
\<lbrakk>b \<in> B; poly p b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (([:- b, 1::'a:] * p) \<circ>\<^sub>p q) A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Limsup_eqI:
  "(\<And>P. eventually P F \<Longrightarrow> x \<le> Sup (f ` (Collect P))) \<Longrightarrow>
    (\<And>y. (\<And>P. eventually P F \<Longrightarrow> y \<le> Sup (f ` (Collect P))) \<Longrightarrow> y \<le> x) \<Longrightarrow> Limsup F f = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>P. eventually P F \<Longrightarrow> x \<le> Sup (f ` Collect P); \<And>y. (\<And>P. eventually P F \<Longrightarrow> y \<le> Sup (f ` Collect P)) \<Longrightarrow> y \<le> x\<rbrakk> \<Longrightarrow> Limsup F f = x
[PROOF STEP]
unfolding Limsup_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>P. eventually P F \<Longrightarrow> x \<le> Sup (f ` Collect P); \<And>y. (\<And>P. eventually P F \<Longrightarrow> y \<le> Sup (f ` Collect P)) \<Longrightarrow> y \<le> x\<rbrakk> \<Longrightarrow> (INF P\<in>{P. eventually P F}. Sup (f ` Collect P)) = x
[PROOF STEP]
by (auto intro!: INF_eqI)


[STATEMENT]
lemma rHom_0_0:"\<lbrakk> Ring A; Ring R; f \<in> rHom A R \<rbrakk>  \<Longrightarrow> f (\<zero>\<^bsub>A\<^esub>) = \<zero>\<^bsub>R\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; f \<in> rHom A R\<rbrakk> \<Longrightarrow> f \<zero>\<^bsub>A\<^esub> = \<zero>\<^bsub>R\<^esub>
[PROOF STEP]
apply (frule Ring.ring_is_ag [of "A"], frule Ring.ring_is_ag [of "R"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; f \<in> rHom A R; aGroup A; aGroup R\<rbrakk> \<Longrightarrow> f \<zero>\<^bsub>A\<^esub> = \<zero>\<^bsub>R\<^esub>
[PROOF STEP]
apply (simp add:rHom_def, (erule conjE)+, simp add:aHom_0_0)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma of_nat_Suc [simp]: "\<guillemotleft>Suc n\<guillemotright>\<^sub>\<nat> = \<one> \<oplus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<guillemotleft>Suc n\<guillemotright>\<^sub>\<nat> = \<one> \<oplus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
by (simp add: of_natural_def)


[STATEMENT]
lemma lebesgue_integral_count_space_finite: "finite A \<Longrightarrow> (\<integral>x. f x \<partial>count_space A) = (\<Sum>a\<in>A. f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> integral\<^sup>L (count_space A) f = sum f A
[PROOF STEP]
by (subst lebesgue_integral_count_space_finite_support)
     (auto intro!: sum.mono_neutral_cong_left)


[STATEMENT]
lemma countable_leq_natLeq: \<open>|X| \<le>o natLeq\<close> if \<open>countable X\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |X| \<le>o natLeq
[PROOF STEP]
using subset_range_from_nat_into[OF that]
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> range (from_nat_into X)

goal (1 subgoal):
 1. |X| \<le>o natLeq
[PROOF STEP]
by (meson card_of_nat ordIso_iff_ordLeq ordLeq_transitive surj_imp_ordLeq)


[STATEMENT]
lemma less_log_iff:
  assumes "1 < b" "x > 0"
  shows "y < log b x \<longleftrightarrow> b powr y < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y < log b x) = (b powr y < x)
[PROOF STEP]
by (metis assms dual_order.strict_trans less_irrefl powr_less_cancel_iff
    powr_log_cancel zero_less_one)


[STATEMENT]
lemma Sup_less_fun_eq:
  "((Sup_less P w) i) = (Sup_less (\<lambda> v . P v i)) w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup_less P w i = Sup_less (\<lambda>v. P v i) w
[PROOF STEP]
apply (simp add: Sup_less_def fun_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP f\<in>{y. \<exists>v<w. \<forall>x. y x = P v x}. f i) = Sup {y. \<exists>v<w. y = P v i}
[PROOF STEP]
apply (rule arg_cong [of _ _ Sup])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f. f i) ` {y. \<exists>v<w. \<forall>x. y x = P v x} = {y. \<exists>v<w. y = P v i}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma to_int_mod_ring_times: "to_int_mod_ring ((x :: 'a mod_ring) * y) = M (to_int_mod_ring x * to_int_mod_ring y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_int_mod_ring (x * y) = M (to_int_mod_ring x * to_int_mod_ring y)
[PROOF STEP]
unfolding M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_int_mod_ring (x * y) = to_int_mod_ring x * to_int_mod_ring y mod m
[PROOF STEP]
using m
[PROOF STATE]
proof (prove)
using this:
m = int CARD('a)

goal (1 subgoal):
 1. to_int_mod_ring (x * y) = to_int_mod_ring x * to_int_mod_ring y mod m
[PROOF STEP]
by (transfer, auto)


[STATEMENT]
lemma "(x::'a::field) \<noteq> 0 \<Longrightarrow> (1 - 1 / x) * x - x + 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> (0::'a) \<Longrightarrow> ((1::'a) - (1::'a) / x) * x - x + (1::'a) = (0::'a)
[PROOF STEP]
by field


[STATEMENT]
lemma minus_one_periodic [simp]:
  assumes "k > 0"
  shows   "\<chi> (k * n - 1) = \<chi> (n - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<chi> (k * n - 1) = \<chi> (n - 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<chi> (k * n - 1) = \<chi> (n - 1)
[PROOF STEP]
have "k * n - 1 = n - 1 + (k - 1) * n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * n - 1 = n - 1 + (k - 1) * n
[PROOF STEP]
using assms n
[PROOF STATE]
proof (prove)
using this:
0 < k
1 < n

goal (1 subgoal):
 1. k * n - 1 = n - 1 + (k - 1) * n
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
k * n - 1 = n - 1 + (k - 1) * n

goal (1 subgoal):
 1. \<chi> (k * n - 1) = \<chi> (n - 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k * n - 1 = n - 1 + (k - 1) * n

goal (1 subgoal):
 1. \<chi> (k * n - 1) = \<chi> (n - 1)
[PROOF STEP]
have "\<chi> \<dots> = \<chi> (n - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<chi> (n - 1 + (k - 1) * n) = \<chi> (n - 1)
[PROOF STEP]
by (rule periodic_mult)
[PROOF STATE]
proof (state)
this:
\<chi> (n - 1 + (k - 1) * n) = \<chi> (n - 1)

goal (1 subgoal):
 1. \<chi> (k * n - 1) = \<chi> (n - 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<chi> (k * n - 1) = \<chi> (n - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<chi> (k * n - 1) = \<chi> (n - 1)

goal (1 subgoal):
 1. \<chi> (k * n - 1) = \<chi> (n - 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<chi> (k * n - 1) = \<chi> (n - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_InfI [intro?]: "(\<And>x. x \<in> A \<Longrightarrow> inf \<sqsubseteq> x) \<Longrightarrow>
    (\<And>z. (\<forall>x \<in> A. z \<sqsubseteq> x) \<Longrightarrow> z \<sqsubseteq> inf) \<Longrightarrow> is_Inf A inf"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in> A \<Longrightarrow> inf \<sqsubseteq> x; \<And>z. \<forall>x\<in>A. z \<sqsubseteq> x \<Longrightarrow> z \<sqsubseteq> inf\<rbrakk> \<Longrightarrow> is_Inf A inf
[PROOF STEP]
by (unfold is_Inf_def) blast


[STATEMENT]
lemma min_set_Union_image:
  "finite X \<Longrightarrow> min_set (\<Union>x \<in> X. min_set (f x)) = min_set (\<Union>x \<in> X. f x)" for f :: "'b \<Rightarrow> 'a fset set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite X \<Longrightarrow> min_set (\<Union>x\<in>X. min_set (f x)) = min_set (\<Union> (f ` X))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite X \<Longrightarrow> min_set (\<Union>x\<in>X. min_set (f x)) = min_set (\<Union> (f ` X))
[PROOF STEP]
assume "finite X"
[PROOF STATE]
proof (state)
this:
finite X

goal (1 subgoal):
 1. finite X \<Longrightarrow> min_set (\<Union>x\<in>X. min_set (f x)) = min_set (\<Union> (f ` X))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite X
[PROOF STEP]
have *: "finite (f ` X)"
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. finite (f ` X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (f ` X)

goal (1 subgoal):
 1. finite X \<Longrightarrow> min_set (\<Union>x\<in>X. min_set (f x)) = min_set (\<Union> (f ` X))
[PROOF STEP]
with min_set_Union
[PROOF STATE]
proof (chain)
picking this:
finite ?X \<Longrightarrow> min_set (\<Union> (min_set ` ?X)) = min_set (\<Union> ?X)
finite (f ` X)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite ?X \<Longrightarrow> min_set (\<Union> (min_set ` ?X)) = min_set (\<Union> ?X)
finite (f ` X)

goal (1 subgoal):
 1. min_set (\<Union>x\<in>X. min_set (f x)) = min_set (\<Union> (f ` X))
[PROOF STEP]
unfolding image_image
[PROOF STATE]
proof (prove)
using this:
finite ?X \<Longrightarrow> min_set (\<Union> (min_set ` ?X)) = min_set (\<Union> ?X)
finite (f ` X)

goal (1 subgoal):
 1. min_set (\<Union>x\<in>X. min_set (f x)) = min_set (\<Union> (f ` X))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
min_set (\<Union>x\<in>X. min_set (f x)) = min_set (\<Union> (f ` X))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_nths_atLeastLessThan_0: "\<lbrakk> m \<le> n; sorted (nths xs {0..<n}) \<rbrakk> \<Longrightarrow> sorted (nths xs {0..<m})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<le> n; sorted (nths xs {0..<n})\<rbrakk> \<Longrightarrow> sorted (nths xs {0..<m})
[PROOF STEP]
by (metis atLeast0LessThan nths_upt_eq_take sorted_prefix take_prefix)


[STATEMENT]
lemma Mp_ident_iff': "Mp f = f \<longleftrightarrow> (set (coeffs f) \<subseteq> {0 ..< m})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Mp f = f) = (set (coeffs f) \<subseteq> {0..<m})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (Mp f = f) = (set (coeffs f) \<subseteq> {0..<m})
[PROOF STEP]
have 0: "0 \<in> {0 ..< m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<in> {0..<m}
[PROOF STEP]
using m1
[PROOF STATE]
proof (prove)
using this:
1 < m

goal (1 subgoal):
 1. 0 \<in> {0..<m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<in> {0..<m}

goal (1 subgoal):
 1. (Mp f = f) = (set (coeffs f) \<subseteq> {0..<m})
[PROOF STEP]
have ran: "(\<forall>n. coeff f n \<in> {0..<m}) \<longleftrightarrow> range (coeff f) \<subseteq> {0 ..< m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>n. coeff f n \<in> {0..<m}) = (range (coeff f) \<subseteq> {0..<m})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<forall>n. coeff f n \<in> {0..<m}) = (range (coeff f) \<subseteq> {0..<m})

goal (1 subgoal):
 1. (Mp f = f) = (set (coeffs f) \<subseteq> {0..<m})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Mp f = f) = (set (coeffs f) \<subseteq> {0..<m})
[PROOF STEP]
unfolding Mp_ident_iff ran
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (range (coeff f) \<subseteq> {0..<m}) = (set (coeffs f) \<subseteq> {0..<m})
[PROOF STEP]
using range_coeff[of f] 0
[PROOF STATE]
proof (prove)
using this:
range (coeff f) = insert 0 (set (coeffs f))
0 \<in> {0..<m}

goal (1 subgoal):
 1. (range (coeff f) \<subseteq> {0..<m}) = (set (coeffs f) \<subseteq> {0..<m})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(Mp f = f) = (set (coeffs f) \<subseteq> {0..<m})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lm079:
  "partitionValuedUniverse \<subseteq> Pow (UNIV \<times> (UNIV - {{}}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partitionValuedUniverse \<subseteq> Pow (UNIV \<times> (UNIV - {{}}))
[PROOF STEP]
using is_non_overlapping_def
[PROOF STATE]
proof (prove)
using this:
is_non_overlapping ?P = (\<forall>X\<in>?P. \<forall>Y\<in>?P. (X \<inter> Y \<noteq> {}) = (X = Y))

goal (1 subgoal):
 1. partitionValuedUniverse \<subseteq> Pow (UNIV \<times> (UNIV - {{}}))
[PROOF STEP]
by force


[STATEMENT]
lemma Lambert_W_gt_ln_minus_ln_ln:
  assumes "x > exp 1"
  shows   "Lambert_W x > ln x - ln (ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln x - ln (ln x) < Lambert_W x
[PROOF STEP]
proof (rule Lambert_W_gtI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (ln x - ln (ln x)) * exp (ln x - ln (ln x)) < x
[PROOF STEP]
have "x > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < x
[PROOF STEP]
by (rule less_trans[OF _ assms]) auto
[PROOF STATE]
proof (state)
this:
1 < x

goal (1 subgoal):
 1. (ln x - ln (ln x)) * exp (ln x - ln (ln x)) < x
[PROOF STEP]
have "ln x > ln (exp 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (exp 1) < ln x
[PROOF STEP]
by (subst ln_less_cancel_iff) (use \<open>x > 1\<close> assms in auto)
[PROOF STATE]
proof (state)
this:
ln (exp 1) < ln x

goal (1 subgoal):
 1. (ln x - ln (ln x)) * exp (ln x - ln (ln x)) < x
[PROOF STEP]
thus "(ln x - ln (ln x)) * exp (ln x - ln (ln x)) < x"
[PROOF STATE]
proof (prove)
using this:
ln (exp 1) < ln x

goal (1 subgoal):
 1. (ln x - ln (ln x)) * exp (ln x - ln (ln x)) < x
[PROOF STEP]
using assms \<open>x > 1\<close>
[PROOF STATE]
proof (prove)
using this:
ln (exp 1) < ln x
exp 1 < x
1 < x

goal (1 subgoal):
 1. (ln x - ln (ln x)) * exp (ln x - ln (ln x)) < x
[PROOF STEP]
by (simp add: exp_diff field_simps)
[PROOF STATE]
proof (state)
this:
(ln x - ln (ln x)) * exp (ln x - ln (ln x)) < x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zip_takeWhile_fst: "zip (takeWhile P xs) ys = takeWhile (P \<circ> fst) (zip xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip (takeWhile P xs) ys = takeWhile (P \<circ> fst) (zip xs ys)
[PROOF STEP]
proof (induct xs arbitrary: ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ys. zip (takeWhile P []) ys = takeWhile (P \<circ> fst) (zip [] ys)
 2. \<And>a xs ys. (\<And>ys. zip (takeWhile P xs) ys = takeWhile (P \<circ> fst) (zip xs ys)) \<Longrightarrow> zip (takeWhile P (a # xs)) ys = takeWhile (P \<circ> fst) (zip (a # xs) ys)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>ys. zip (takeWhile P []) ys = takeWhile (P \<circ> fst) (zip [] ys)
 2. \<And>a xs ys. (\<And>ys. zip (takeWhile P xs) ys = takeWhile (P \<circ> fst) (zip xs ys)) \<Longrightarrow> zip (takeWhile P (a # xs)) ys = takeWhile (P \<circ> fst) (zip (a # xs) ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip (takeWhile P []) ys = takeWhile (P \<circ> fst) (zip [] ys)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
zip (takeWhile P []) ys = takeWhile (P \<circ> fst) (zip [] ys)

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. zip (takeWhile P xs) ys = takeWhile (P \<circ> fst) (zip xs ys)) \<Longrightarrow> zip (takeWhile P (a # xs)) ys = takeWhile (P \<circ> fst) (zip (a # xs) ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. zip (takeWhile P xs) ys = takeWhile (P \<circ> fst) (zip xs ys)) \<Longrightarrow> zip (takeWhile P (a # xs)) ys = takeWhile (P \<circ> fst) (zip (a # xs) ys)
[PROOF STEP]
case Cons
[PROOF STATE]
proof (state)
this:
zip (takeWhile P xs_) ?ys = takeWhile (P \<circ> fst) (zip xs_ ?ys)

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. zip (takeWhile P xs) ys = takeWhile (P \<circ> fst) (zip xs ys)) \<Longrightarrow> zip (takeWhile P (a # xs)) ys = takeWhile (P \<circ> fst) (zip (a # xs) ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
zip (takeWhile P xs_) ?ys = takeWhile (P \<circ> fst) (zip xs_ ?ys)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
zip (takeWhile P xs_) ?ys = takeWhile (P \<circ> fst) (zip xs_ ?ys)

goal (1 subgoal):
 1. zip (takeWhile P (a_ # xs_)) ys = takeWhile (P \<circ> fst) (zip (a_ # xs_) ys)
[PROOF STEP]
by (cases ys) auto
[PROOF STATE]
proof (state)
this:
zip (takeWhile P (a_ # xs_)) ys = takeWhile (P \<circ> fst) (zip (a_ # xs_) ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Gromov_extension_id [simp]:
  "Gromov_extension (id::'a::Gromov_hyperbolic_space \<Rightarrow> 'a) = id"
  "Gromov_extension (\<lambda>x::'a. x) = (\<lambda>x. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gromov_extension id = id &&& Gromov_extension (\<lambda>x. x) = (\<lambda>x. x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Gromov_extension id = id
 2. Gromov_extension (\<lambda>x. x) = (\<lambda>x. x)
[PROOF STEP]
have "Gromov_extension id x = id x" for x::"'a Gromov_completion"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gromov_extension id x = id x
[PROOF STEP]
unfolding Gromov_extension_def comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x \<in> Gromov_boundary then lim (\<lambda>xa. to_Gromov_completion (id (rep_Gromov_completion x xa))) else to_Gromov_completion (id (from_Gromov_completion x))) = id x
[PROOF STEP]
using limI rep_Gromov_completion_limit
[PROOF STATE]
proof (prove)
using this:
?X \<longlonglongrightarrow> ?L \<Longrightarrow> lim ?X = ?L
(\<lambda>n. to_Gromov_completion (rep_Gromov_completion ?x n)) \<longlonglongrightarrow> ?x

goal (1 subgoal):
 1. (if x \<in> Gromov_boundary then lim (\<lambda>xa. to_Gromov_completion (id (rep_Gromov_completion x xa))) else to_Gromov_completion (id (from_Gromov_completion x))) = id x
[PROOF STEP]
by (auto simp add: to_from_Gromov_completion)
[PROOF STATE]
proof (state)
this:
Gromov_extension id ?x = id ?x

goal (2 subgoals):
 1. Gromov_extension id = id
 2. Gromov_extension (\<lambda>x. x) = (\<lambda>x. x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Gromov_extension id ?x = id ?x
[PROOF STEP]
show "Gromov_extension (id::'a \<Rightarrow> 'a) = id"
[PROOF STATE]
proof (prove)
using this:
Gromov_extension id ?x = id ?x

goal (1 subgoal):
 1. Gromov_extension id = id
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Gromov_extension id = id

goal (1 subgoal):
 1. Gromov_extension (\<lambda>x. x) = (\<lambda>x. x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Gromov_extension id = id
[PROOF STEP]
show "Gromov_extension (\<lambda>x::'a. x) = (\<lambda>x. x)"
[PROOF STATE]
proof (prove)
using this:
Gromov_extension id = id

goal (1 subgoal):
 1. Gromov_extension (\<lambda>x. x) = (\<lambda>x. x)
[PROOF STEP]
unfolding id_def
[PROOF STATE]
proof (prove)
using this:
Gromov_extension (\<lambda>x. x) = (\<lambda>x. x)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_of_set_of_all_possible_states:
  fixes X :: "'a set"
  assumes "finite X"
  shows "card {(s :: 'a state). fmdom' s = X} = 2 ^ (card X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {s. fmdom' s = X} = 2 ^ card X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. card {s. fmdom' s = X} = 2 ^ card X
[PROOF STEP]
proof (induction X)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card {s. fmdom' s = {}} = 2 ^ card {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. card {s. fmdom' s = {}} = 2 ^ card {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
have 1: "{s :: 'a state. fmdom' s = {}} = {fmempty}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {s. fmdom' s = {}} = {fmempty}
[PROOF STEP]
using empty_domain_fmap_set
[PROOF STATE]
proof (prove)
using this:
{s. fmdom' s = {}} = {fmempty}

goal (1 subgoal):
 1. {s. fmdom' s = {}} = {fmempty}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{s. fmdom' s = {}} = {fmempty}

goal (2 subgoals):
 1. card {s. fmdom' s = {}} = 2 ^ card {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{s. fmdom' s = {}} = {fmempty}
[PROOF STEP]
have "card {fmempty} = 1"
[PROOF STATE]
proof (prove)
using this:
{s. fmdom' s = {}} = {fmempty}

goal (1 subgoal):
 1. card {fmempty} = 1
[PROOF STEP]
using is_singleton_altdef
[PROOF STATE]
proof (prove)
using this:
{s. fmdom' s = {}} = {fmempty}
is_singleton ?A = (card ?A = 1)

goal (1 subgoal):
 1. card {fmempty} = 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card {fmempty} = 1

goal (2 subgoals):
 1. card {s. fmdom' s = {}} = 2 ^ card {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card {fmempty} = 1
[PROOF STEP]
have "2^(card {}) = 1"
[PROOF STATE]
proof (prove)
using this:
card {fmempty} = 1

goal (1 subgoal):
 1. (2::'b) ^ card {} = (1::'b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(2::?'b2) ^ card {} = (1::?'b2)

goal (2 subgoals):
 1. card {s. fmdom' s = {}} = 2 ^ card {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(2::?'b2) ^ card {} = (1::?'b2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(2::?'b2) ^ card {} = (1::?'b2)

goal (1 subgoal):
 1. card {s. fmdom' s = {}} = 2 ^ card {}
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
(2::?'b2) ^ card {} = (1::?'b2)
{s. fmdom' s = {}} = {fmempty}

goal (1 subgoal):
 1. card {s. fmdom' s = {}} = 2 ^ card {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {s. fmdom' s = {}} = 2 ^ card {}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
card {s. fmdom' s = F} = 2 ^ card F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
card {s. fmdom' s = F} = 2 ^ card F
[PROOF STEP]
show ?case
    \<comment> \<open>TODO refactor and simplify proof further.\<close>
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
card {s. fmdom' s = F} = 2 ^ card F

goal (1 subgoal):
 1. card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
proof (cases "x \<in> F")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<in> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
 2. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x \<in> F

goal (2 subgoals):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<in> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
 2. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> F

goal (1 subgoal):
 1. card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
using insert.hyps(2)
[PROOF STATE]
proof (prove)
using this:
x \<in> F
x \<notin> F

goal (1 subgoal):
 1. card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)

goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<notin> F

goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<notin> F
[PROOF STEP]
have "
        {s :: 'a state. fmdom' s = insert x F}
        = (\<lambda>s. fmupd x True s) ` {s. fmdom' s = F} \<union> (\<lambda>s. fmupd x False s) ` {s. fmdom' s = F}
      "
[PROOF STATE]
proof (prove)
using this:
x \<notin> F

goal (1 subgoal):
 1. {s. fmdom' s = insert x F} = fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}
[PROOF STEP]
using False construction_of_all_possible_states_lemma
[PROOF STATE]
proof (prove)
using this:
x \<notin> F
x \<notin> F
?v \<notin> ?X \<Longrightarrow> {s. fmdom' s = insert ?v ?X} = fmupd ?v True ` {s. fmdom' s = ?X} \<union> fmupd ?v False ` {s. fmdom' s = ?X}

goal (1 subgoal):
 1. {s. fmdom' s = insert x F} = fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
{s. fmdom' s = insert x F} = fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}

goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{s. fmdom' s = insert x F} = fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}
[PROOF STEP]
have 2: "
        card ({s :: 'a state. fmdom' s = insert x F})
        = card ((\<lambda>s. fmupd x True s) ` {s. fmdom' s = F} \<union> (\<lambda>s. fmupd x False s) ` {s. fmdom' s = F})
      "
[PROOF STATE]
proof (prove)
using this:
{s. fmdom' s = insert x F} = fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}

goal (1 subgoal):
 1. card {s. fmdom' s = insert x F} = card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F})
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
card {s. fmdom' s = insert x F} = card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F})

goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card {s. fmdom' s = insert x F} = card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F})
[PROOF STEP]
have 3: "2^(card (insert x F)) = 2 * 2^(card F)"
[PROOF STATE]
proof (prove)
using this:
card {s. fmdom' s = insert x F} = card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F})

goal (1 subgoal):
 1. (2::'b) ^ card (insert x F) = (2::'b) * (2::'b) ^ card F
[PROOF STEP]
using False insert.hyps(1)
[PROOF STATE]
proof (prove)
using this:
card {s. fmdom' s = insert x F} = card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F})
x \<notin> F
finite F

goal (1 subgoal):
 1. (2::'b) ^ card (insert x F) = (2::'b) * (2::'b) ^ card F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(2::?'b1) ^ card (insert x F) = (2::?'b1) * (2::?'b1) ^ card F

goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(2::?'b1) ^ card (insert x F) = (2::?'b1) * (2::?'b1) ^ card F
[PROOF STEP]
have
      "card ((\<lambda>s. fmupd x True s) ` {s. fmdom' s = F}) = 2^(card F)"
      "card ((\<lambda>s. fmupd x False s) ` {s. fmdom' s = F}) = 2^(card F)"
[PROOF STATE]
proof (prove)
using this:
(2::?'b1) ^ card (insert x F) = (2::?'b1) * (2::?'b1) ^ card F

goal (1 subgoal):
 1. card (fmupd x True ` {s. fmdom' s = F}) = 2 ^ card F &&& card (fmupd x False ` {s. fmdom' s = F}) = 2 ^ card F
[PROOF STEP]
using False card_update insert.IH insert.hyps(1)
[PROOF STATE]
proof (prove)
using this:
(2::?'b1) ^ card (insert x F) = (2::?'b1) * (2::?'b1) ^ card F
x \<notin> F
\<lbrakk>finite ?X; ?v \<notin> ?X\<rbrakk> \<Longrightarrow> card (fmupd ?v ?b ` {s. fmdom' s = ?X}) = card {s. fmdom' s = ?X}
card {s. fmdom' s = F} = 2 ^ card F
finite F

goal (1 subgoal):
 1. card (fmupd x True ` {s. fmdom' s = F}) = 2 ^ card F &&& card (fmupd x False ` {s. fmdom' s = F}) = 2 ^ card F
[PROOF STEP]
by metis+
[PROOF STATE]
proof (state)
this:
card (fmupd x True ` {s. fmdom' s = F}) = 2 ^ card F
card (fmupd x False ` {s. fmdom' s = F}) = 2 ^ card F

goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (fmupd x True ` {s. fmdom' s = F}) = 2 ^ card F
card (fmupd x False ` {s. fmdom' s = F}) = 2 ^ card F

goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
have "
          ((\<lambda>s. fmupd x True s) ` {s. fmdom' s = F})
          \<inter> ((\<lambda>s. fmupd x False s) ` {s. fmdom' s = F})
        = {}
      "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmupd x True ` {s. fmdom' s = F} \<inter> fmupd x False ` {s. fmdom' s = F} = {}
[PROOF STEP]
using False insert.hyps(1) updates_disjoint
[PROOF STATE]
proof (prove)
using this:
x \<notin> F
finite F
\<lbrakk>finite ?X; ?x \<notin> ?X\<rbrakk> \<Longrightarrow> fmupd ?x True ` {s. fmdom' s = ?X} \<inter> fmupd ?x False ` {s. fmdom' s = ?X} = {}

goal (1 subgoal):
 1. fmupd x True ` {s. fmdom' s = F} \<inter> fmupd x False ` {s. fmdom' s = F} = {}
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
fmupd x True ` {s. fmdom' s = F} \<inter> fmupd x False ` {s. fmdom' s = F} = {}

goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
fmupd x True ` {s. fmdom' s = F} \<inter> fmupd x False ` {s. fmdom' s = F} = {}

goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
have "card (
          ((\<lambda>s. fmupd x True s) ` {s. fmdom' s = F})
          \<union> ((\<lambda>s. fmupd x False s) ` {s. fmdom' s = F})
        )
        = card (((\<lambda>s. fmupd x True s) ` {s. fmdom' s = F}))
          + card ((\<lambda>s. fmupd x False s) ` {s. fmdom' s = F})
      "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = card (fmupd x True ` {s. fmdom' s = F}) + card (fmupd x False ` {s. fmdom' s = F})
[PROOF STEP]
using calculation card_Un_disjoint card.infinite
        power_eq_0_iff rel_simps(76)
[PROOF STATE]
proof (prove)
using this:
card (fmupd x True ` {s. fmdom' s = F}) = 2 ^ card F
card (fmupd x False ` {s. fmdom' s = F}) = 2 ^ card F
fmupd x True ` {s. fmdom' s = F} \<inter> fmupd x False ` {s. fmdom' s = F} = {}
\<lbrakk>finite ?A; finite ?B; ?A \<inter> ?B = {}\<rbrakk> \<Longrightarrow> card (?A \<union> ?B) = card ?A + card ?B
infinite ?A \<Longrightarrow> card ?A = 0
(?a ^ ?n = (0::?'a)) = (?a = (0::?'a) \<and> 0 < ?n)
(0::?'a) \<noteq> numeral ?n

goal (1 subgoal):
 1. card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = card (fmupd x True ` {s. fmdom' s = F}) + card (fmupd x False ` {s. fmdom' s = F})
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = card (fmupd x True ` {s. fmdom' s = F}) + card (fmupd x False ` {s. fmdom' s = F})

goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = card (fmupd x True ` {s. fmdom' s = F}) + card (fmupd x False ` {s. fmdom' s = F})
[PROOF STEP]
have "card (
          ((\<lambda>s. fmupd x True s) ` {s. fmdom' s = F})
          \<union> ((\<lambda>s. fmupd x False s) ` {s. fmdom' s = F})
        )
        = 2 * (2^(card F))"
[PROOF STATE]
proof (prove)
using this:
card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = card (fmupd x True ` {s. fmdom' s = F}) + card (fmupd x False ` {s. fmdom' s = F})

goal (1 subgoal):
 1. card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = 2 * 2 ^ card F
[PROOF STEP]
using calculation(1, 2)
[PROOF STATE]
proof (prove)
using this:
card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = card (fmupd x True ` {s. fmdom' s = F}) + card (fmupd x False ` {s. fmdom' s = F})
card (fmupd x True ` {s. fmdom' s = F}) = 2 ^ card F
card (fmupd x False ` {s. fmdom' s = F}) = 2 ^ card F

goal (1 subgoal):
 1. card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = 2 * 2 ^ card F
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = 2 * 2 ^ card F

goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = 2 * 2 ^ card F
[PROOF STEP]
have "card (
          ((\<lambda>s. fmupd x True s) ` {s. fmdom' s = F})
          \<union> ((\<lambda>s. fmupd x False s) ` {s. fmdom' s = F})
        )
        = 2^(card (insert x F))"
[PROOF STATE]
proof (prove)
using this:
card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = 2 * 2 ^ card F

goal (1 subgoal):
 1. card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = 2 ^ card (insert x F)
[PROOF STEP]
using insert.IH 3
[PROOF STATE]
proof (prove)
using this:
card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = 2 * 2 ^ card F
card {s. fmdom' s = F} = 2 ^ card F
(2::?'b1) ^ card (insert x F) = (2::?'b1) * (2::?'b1) ^ card F

goal (1 subgoal):
 1. card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = 2 ^ card (insert x F)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = 2 ^ card (insert x F)

goal (1 subgoal):
 1. \<lbrakk>finite F; x \<notin> F; card {s. fmdom' s = F} = 2 ^ card F; x \<notin> F\<rbrakk> \<Longrightarrow> card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = 2 ^ card (insert x F)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = 2 ^ card (insert x F)

goal (1 subgoal):
 1. card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
using "2"
[PROOF STATE]
proof (prove)
using this:
card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F}) = 2 ^ card (insert x F)
card {s. fmdom' s = insert x F} = card (fmupd x True ` {s. fmdom' s = F} \<union> fmupd x False ` {s. fmdom' s = F})

goal (1 subgoal):
 1. card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {s. fmdom' s = insert x F} = 2 ^ card (insert x F)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in prob_space) indep_events_def:
  "indep_events A I \<longleftrightarrow> (A`I \<subseteq> events) \<and>
    (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_events A I = (A ` I \<subseteq> events \<and> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))))
[PROOF STEP]
unfolding indep_events_def_alt indep_sets_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>i\<in>I. {A i} \<subseteq> events) \<and> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> (\<forall>A\<in>\<Pi> i\<in>J. {A i}. prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))))) = (A ` I \<subseteq> events \<and> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))))
[PROOF STEP]
apply (simp add: Ball_def Pi_iff image_subset_iff_funcset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>x. x \<in> I \<longrightarrow> A x \<in> events) \<and> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> (\<exists>Aa. \<forall>x. x \<in> J \<longrightarrow> Aa x = A x) \<longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j)))) = ((\<forall>x. x \<in> I \<longrightarrow> A x \<in> events) \<and> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))))
[PROOF STEP]
apply (intro conj_cong refl arg_cong[where f=All] ext imp_cong)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>J. \<lbrakk>\<forall>x. x \<in> I \<longrightarrow> A x \<in> events; J \<subseteq> I; J \<noteq> {}; finite J\<rbrakk> \<Longrightarrow> ((\<exists>Aa. \<forall>x. x \<in> J \<longrightarrow> Aa x = A x) \<longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))) = (prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j)))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma poly_prod_set_finite:
  assumes "finite as"
  assumes "finite bs"
  shows "finite (poly_prod_set n as bs)" "card (poly_prod_set n as bs) \<le> card as * card bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (poly_prod_set n as bs) &&& card (poly_prod_set n as bs) \<le> card as * card bs
[PROOF STEP]
using ring.prod_set_finite[of "R[\<X>\<^bsub>n\<^esub>]"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>ring (R [\<X>\<^bsub>n\<^esub>]); finite ?as; finite ?bs\<rbrakk> \<Longrightarrow> finite (MP.prod_set n ?as ?bs)
\<lbrakk>ring (R [\<X>\<^bsub>n\<^esub>]); finite ?as; finite ?bs\<rbrakk> \<Longrightarrow> card (MP.prod_set n ?as ?bs) \<le> card ?as * card ?bs

goal (1 subgoal):
 1. finite (poly_prod_set n as bs) &&& card (poly_prod_set n as bs) \<le> card as * card bs
[PROOF STEP]
apply (simp add: R.Pring_is_ring assms(1) assms(2) poly_prod_set_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<And>as bs. \<lbrakk>ring (R [\<X>\<^bsub>n\<^esub>]); finite as; finite bs\<rbrakk> \<Longrightarrow> finite (MP.prod_set n as bs); \<And>as bs. \<lbrakk>ring (R [\<X>\<^bsub>n\<^esub>]); finite as; finite bs\<rbrakk> \<Longrightarrow> card (MP.prod_set n as bs) \<le> card as * card bs\<rbrakk> \<Longrightarrow> finite (MP.prod_set n as bs)
 2. card (poly_prod_set n as bs) \<le> card as * card bs
[PROOF STEP]
using ring.prod_set_finite[of "R[\<X>\<^bsub>n\<^esub>]"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>ring (R [\<X>\<^bsub>n\<^esub>]); finite ?as; finite ?bs\<rbrakk> \<Longrightarrow> finite (MP.prod_set n ?as ?bs)
\<lbrakk>ring (R [\<X>\<^bsub>n\<^esub>]); finite ?as; finite ?bs\<rbrakk> \<Longrightarrow> card (MP.prod_set n ?as ?bs) \<le> card ?as * card ?bs

goal (2 subgoals):
 1. \<lbrakk>\<And>as bs. \<lbrakk>ring (R [\<X>\<^bsub>n\<^esub>]); finite as; finite bs\<rbrakk> \<Longrightarrow> finite (MP.prod_set n as bs); \<And>as bs. \<lbrakk>ring (R [\<X>\<^bsub>n\<^esub>]); finite as; finite bs\<rbrakk> \<Longrightarrow> card (MP.prod_set n as bs) \<le> card as * card bs\<rbrakk> \<Longrightarrow> finite (MP.prod_set n as bs)
 2. card (poly_prod_set n as bs) \<le> card as * card bs
[PROOF STEP]
apply (simp add: assms(1) assms(2) coord_cring_cring cring.axioms(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (poly_prod_set n as bs) \<le> card as * card bs
[PROOF STEP]
by (simp add: assms(1) assms(2) coord_cring_cring cring.axioms(1) poly_prod_set_def ring.prod_set_finite(2))


[STATEMENT]
lemma msubset_mset_set_iff:
  assumes "finite A"
  shows "set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1) \<longleftrightarrow> (M \<subseteq># mset_set A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)) = (M \<subseteq># mset_set A)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1) \<Longrightarrow> M \<subseteq># mset_set A
 2. M \<subseteq># mset_set A \<Longrightarrow> set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
assume "set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)"
[PROOF STATE]
proof (state)
this:
set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)

goal (2 subgoals):
 1. set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1) \<Longrightarrow> M \<subseteq># mset_set A
 2. M \<subseteq># mset_set A \<Longrightarrow> set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
from this assms
[PROOF STATE]
proof (chain)
picking this:
set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
finite A
[PROOF STEP]
show "M \<subseteq># mset_set A"
[PROOF STATE]
proof (prove)
using this:
set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
finite A

goal (1 subgoal):
 1. M \<subseteq># mset_set A
[PROOF STEP]
by (metis count_inI count_mset_set(1) le0 mset_subset_eqI subsetCE)
[PROOF STATE]
proof (state)
this:
M \<subseteq># mset_set A

goal (1 subgoal):
 1. M \<subseteq># mset_set A \<Longrightarrow> set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M \<subseteq># mset_set A \<Longrightarrow> set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
assume "M \<subseteq># mset_set A"
[PROOF STATE]
proof (state)
this:
M \<subseteq># mset_set A

goal (1 subgoal):
 1. M \<subseteq># mset_set A \<Longrightarrow> set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
from this assms
[PROOF STATE]
proof (chain)
picking this:
M \<subseteq># mset_set A
finite A
[PROOF STEP]
have "set_mset M \<subseteq> A"
[PROOF STATE]
proof (prove)
using this:
M \<subseteq># mset_set A
finite A

goal (1 subgoal):
 1. set_mset M \<subseteq> A
[PROOF STEP]
using mset_subset_eqD
[PROOF STATE]
proof (prove)
using this:
M \<subseteq># mset_set A
finite A
\<lbrakk>?A \<subseteq># ?B; ?x \<in># ?A\<rbrakk> \<Longrightarrow> ?x \<in># ?B

goal (1 subgoal):
 1. set_mset M \<subseteq> A
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
set_mset M \<subseteq> A

goal (1 subgoal):
 1. M \<subseteq># mset_set A \<Longrightarrow> set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set_mset M \<subseteq> A

goal (1 subgoal):
 1. M \<subseteq># mset_set A \<Longrightarrow> set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
set_mset M \<subseteq> A

goal (1 subgoal):
 1. M \<subseteq># mset_set A \<Longrightarrow> set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M \<subseteq># mset_set A \<Longrightarrow> set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
from \<open>M \<subseteq># mset_set A\<close>
[PROOF STATE]
proof (chain)
picking this:
M \<subseteq># mset_set A
[PROOF STEP]
have "count M x \<le> count (mset_set A) x"
[PROOF STATE]
proof (prove)
using this:
M \<subseteq># mset_set A

goal (1 subgoal):
 1. count M x \<le> count (mset_set A) x
[PROOF STEP]
by (simp add: mset_subset_eq_count)
[PROOF STATE]
proof (state)
this:
count M x \<le> count (mset_set A) x

goal (1 subgoal):
 1. M \<subseteq># mset_set A \<Longrightarrow> set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
from this \<open>finite A\<close>
[PROOF STATE]
proof (chain)
picking this:
count M x \<le> count (mset_set A) x
finite A
[PROOF STEP]
have "count M x \<le> 1"
[PROOF STATE]
proof (prove)
using this:
count M x \<le> count (mset_set A) x
finite A

goal (1 subgoal):
 1. count M x \<le> 1
[PROOF STEP]
by (meson count_mset_set_leq le_trans)
[PROOF STATE]
proof (state)
this:
count M x \<le> 1

goal (1 subgoal):
 1. M \<subseteq># mset_set A \<Longrightarrow> set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
count M ?x2 \<le> 1

goal (1 subgoal):
 1. M \<subseteq># mset_set A \<Longrightarrow> set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set_mset M \<subseteq> A
count M ?x2 \<le> 1
[PROOF STEP]
show "set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)"
[PROOF STATE]
proof (prove)
using this:
set_mset M \<subseteq> A
count M ?x2 \<le> 1

goal (1 subgoal):
 1. set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_mset M \<subseteq> A \<and> (\<forall>x. count M x \<le> 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rcis_inj_on: assumes r: "r \<noteq> 0" shows "inj_on (rcis r) {0 ..< 2 * pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (rcis r) {0..<2 * pi}
[PROOF STEP]
proof (rule inj_onI, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {0..<2 * pi}; y \<in> {0..<2 * pi}; rcis r x = rcis r y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
case (1 x y)
[PROOF STATE]
proof (state)
this:
x \<in> {0..<2 * pi}
y \<in> {0..<2 * pi}
rcis r x = rcis r y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {0..<2 * pi}; y \<in> {0..<2 * pi}; rcis r x = rcis r y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
from arg_cong[OF 1(3), of "\<lambda> x. x / r"]
[PROOF STATE]
proof (chain)
picking this:
rcis r x / complex_of_real r = rcis r y / complex_of_real r
[PROOF STEP]
have "cis x = cis y"
[PROOF STATE]
proof (prove)
using this:
rcis r x / complex_of_real r = rcis r y / complex_of_real r

goal (1 subgoal):
 1. cis x = cis y
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
rcis r x / complex_of_real r = rcis r y / complex_of_real r
r \<noteq> 0

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

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {0..<2 * pi}; y \<in> {0..<2 * pi}; rcis r x = rcis r y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
from arg_cong[OF this, of "\<lambda> x. inverse x"]
[PROOF STATE]
proof (chain)
picking this:
inverse (cis x) = inverse (cis y)
[PROOF STEP]
have "cis (-x) = cis (-y)"
[PROOF STATE]
proof (prove)
using this:
inverse (cis x) = inverse (cis y)

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

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {0..<2 * pi}; y \<in> {0..<2 * pi}; rcis r x = rcis r y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
from arg_cong[OF this, of uminus]
[PROOF STATE]
proof (chain)
picking this:
- cis (- x) = - cis (- y)
[PROOF STEP]
have *: "cis (-x + pi) = cis (-y + pi)"
[PROOF STATE]
proof (prove)
using this:
- cis (- x) = - cis (- y)

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

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {0..<2 * pi}; y \<in> {0..<2 * pi}; rcis r x = rcis r y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "- x + pi = - y + pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - x + pi = - y + pi
[PROOF STEP]
by (rule arg_eqD[OF arg_cong[OF *, of Arg]], insert 1(1-2), auto)
[PROOF STATE]
proof (state)
this:
- x + pi = - y + pi

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {0..<2 * pi}; y \<in> {0..<2 * pi}; rcis r x = rcis r y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
- x + pi = - y + pi

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lang_flatten_INTERSECT[simp]:
  assumes "finite X" "X \<noteq> {}" "\<forall>r\<in>X. wf n r"
  shows "w \<in> lang n (flatten INTERSECT X) = (\<forall>r \<in> X. w \<in> lang n r)" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w \<in> lang n (INTERSECT (sorted_list_of_set X))) = (\<forall>r\<in>X. w \<in> lang n r)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. w \<in> lang n (INTERSECT (sorted_list_of_set X)) \<Longrightarrow> \<forall>r\<in>X. w \<in> lang n r
 2. \<forall>r\<in>X. w \<in> lang n r \<Longrightarrow> w \<in> lang n (INTERSECT (sorted_list_of_set X))
[PROOF STEP]
assume ?L
[PROOF STATE]
proof (state)
this:
w \<in> lang n (INTERSECT (sorted_list_of_set X))

goal (2 subgoals):
 1. w \<in> lang n (INTERSECT (sorted_list_of_set X)) \<Longrightarrow> \<forall>r\<in>X. w \<in> lang n r
 2. \<forall>r\<in>X. w \<in> lang n r \<Longrightarrow> w \<in> lang n (INTERSECT (sorted_list_of_set X))
[PROOF STEP]
thus ?R
[PROOF STATE]
proof (prove)
using this:
w \<in> lang n (INTERSECT (sorted_list_of_set X))

goal (1 subgoal):
 1. \<forall>r\<in>X. w \<in> lang n r
[PROOF STEP]
using in_lang_INTERSECT[OF bspec[OF wf_lang_wf_word[OF iffD2[OF wf_flatten_INTERSECT]]],
    OF assms(1,3) \<open>?L\<close>, of "sorted_list_of_set X"] assms(1)
[PROOF STATE]
proof (prove)
using this:
w \<in> lang n (INTERSECT (sorted_list_of_set X))
(w \<in> lang n (INTERSECT (sorted_list_of_set X))) = (\<forall>r\<in>set (sorted_list_of_set X). w \<in> lang n r)
finite X

goal (1 subgoal):
 1. \<forall>r\<in>X. w \<in> lang n r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>r\<in>X. w \<in> lang n r

goal (1 subgoal):
 1. \<forall>r\<in>X. w \<in> lang n r \<Longrightarrow> w \<in> lang n (INTERSECT (sorted_list_of_set X))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>r\<in>X. w \<in> lang n r \<Longrightarrow> w \<in> lang n (INTERSECT (sorted_list_of_set X))
[PROOF STEP]
assume ?R
[PROOF STATE]
proof (state)
this:
\<forall>r\<in>X. w \<in> lang n r

goal (1 subgoal):
 1. \<forall>r\<in>X. w \<in> lang n r \<Longrightarrow> w \<in> lang n (INTERSECT (sorted_list_of_set X))
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite X
X \<noteq> {}
\<forall>r\<in>X. local.wf n r
\<forall>r\<in>X. w \<in> lang n r
[PROOF STEP]
show ?L
[PROOF STATE]
proof (prove)
using this:
finite X
X \<noteq> {}
\<forall>r\<in>X. local.wf n r
\<forall>r\<in>X. w \<in> lang n r

goal (1 subgoal):
 1. w \<in> lang n (INTERSECT (sorted_list_of_set X))
[PROOF STEP]
by (intro iffD2[OF in_lang_INTERSECT]) (auto dest: wf_lang_wf_word)
[PROOF STATE]
proof (state)
this:
w \<in> lang n (INTERSECT (sorted_list_of_set X))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_columns: "finite (columns A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (columns A)
[PROOF STEP]
using finite_Atleast_Atmost_nat[of "\<lambda>i. column i A"]
[PROOF STATE]
proof (prove)
using this:
finite {column x A |x. x \<in> UNIV}

goal (1 subgoal):
 1. finite (columns A)
[PROOF STEP]
unfolding columns_def
[PROOF STATE]
proof (prove)
using this:
finite {column x A |x. x \<in> UNIV}

goal (1 subgoal):
 1. finite {column i A |i. i \<in> UNIV}
[PROOF STEP]
.


[STATEMENT]
lemma strict_trans: "a \<prec>[le] b \<Longrightarrow> b \<prec>[le] c \<Longrightarrow> a \<prec>[le] c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<prec>[le] b; b \<prec>[le] c\<rbrakk> \<Longrightarrow> a \<prec>[le] c
[PROOF STEP]
unfolding strongly_preferred_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>le a b \<and> \<not> le b a; le b c \<and> \<not> le c b\<rbrakk> \<Longrightarrow> le a c \<and> \<not> le c a
[PROOF STEP]
by (blast intro: trans)


[STATEMENT]
lemma valuesum_choice:
  "finite (Mapping.keys M) \<Longrightarrow> x \<in> Mapping.keys M \<Longrightarrow> y \<in> Mapping.keys M \<Longrightarrow>
    the (Mapping.lookup M x) + valuesum (Mapping.delete x M) =
    the (Mapping.lookup M y) + valuesum (Mapping.delete y M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (Mapping.keys M); x \<in> Mapping.keys M; y \<in> Mapping.keys M\<rbrakk> \<Longrightarrow> the (Mapping.lookup M x) + valuesum (Mapping.delete x M) = the (Mapping.lookup M y) + valuesum (Mapping.delete y M)
[PROOF STEP]
unfolding valuesum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (Mapping.keys M); x \<in> Mapping.keys M; y \<in> Mapping.keys M\<rbrakk> \<Longrightarrow> the (Mapping.lookup M x) + (\<Sum>k\<in>Mapping.keys (Mapping.delete x M). the (Mapping.lookup (Mapping.delete x M) k)) = the (Mapping.lookup M y) + (\<Sum>k\<in>Mapping.keys (Mapping.delete y M). the (Mapping.lookup (Mapping.delete y M) k))
[PROOF STEP]
by transfer (simp add: sum_diff)


[STATEMENT]
lemma zero_le_floor [simp]: "0 \<le> \<lfloor>x\<rfloor> \<longleftrightarrow> 0 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> \<lfloor>x\<rfloor>) = ((0::'a) \<le> x)
[PROOF STEP]
by (simp add: le_floor_iff)


[STATEMENT]
lemma lhopital_right_at_top:
  "LIM x at_right x. (g::real \<Rightarrow> real) x :> at_top \<Longrightarrow>
    eventually (\<lambda>x. g' x \<noteq> 0) (at_right x) \<Longrightarrow>
    eventually (\<lambda>x. DERIV f x :> f' x) (at_right x) \<Longrightarrow>
    eventually (\<lambda>x. DERIV g x :> g' x) (at_right x) \<Longrightarrow>
    ((\<lambda> x. (f' x / g' x)) \<longlongrightarrow> y) (at_right x) \<Longrightarrow>
    ((\<lambda> x. f x / g x) \<longlongrightarrow> y) (at_right x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>filterlim g at_top (at_right x); \<forall>\<^sub>F x in at_right x. g' x \<noteq> 0; \<forall>\<^sub>F x in at_right x. (f has_real_derivative f' x) (at x); \<forall>\<^sub>F x in at_right x. (g has_real_derivative g' x) (at x); ((\<lambda>x. f' x / g' x) \<longlongrightarrow> y) (at_right x)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x / g x) \<longlongrightarrow> y) (at_right x)
[PROOF STEP]
unfolding eventually_at_right_to_0[of _ x] filterlim_at_right_to_0[of _ _ x] DERIV_shift
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>LIM xa at_right 0. g (xa + x) :> at_top; \<forall>\<^sub>F xa in at_right 0. g' (xa + x) \<noteq> 0; \<forall>\<^sub>F xa in at_right 0. ((\<lambda>xa. f (xa + x)) has_real_derivative f' (xa + x)) (at xa); \<forall>\<^sub>F xa in at_right 0. ((\<lambda>xa. g (xa + x)) has_real_derivative g' (xa + x)) (at xa); ((\<lambda>xa. f' (xa + x) / g' (xa + x)) \<longlongrightarrow> y) (at_right 0)\<rbrakk> \<Longrightarrow> ((\<lambda>xa. f (xa + x) / g (xa + x)) \<longlongrightarrow> y) (at_right 0)
[PROOF STEP]
by (rule lhopital_right_0_at_top)


[STATEMENT]
lemma mat_max_comm: "A \<in> carrier_mat nr nc \<Longrightarrow> B \<in> carrier_mat nr nc \<Longrightarrow> max\<^sub>m A B = max\<^sub>m B A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat nr nc; B \<in> carrier_mat nr nc\<rbrakk> \<Longrightarrow> max\<^sub>m A B = max\<^sub>m B A
[PROOF STEP]
unfolding mat_max_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat nr nc; B \<in> carrier_mat nr nc\<rbrakk> \<Longrightarrow> mat (dim_row A) (dim_col A) (\<lambda>ij. max (A $$ ij) (B $$ ij)) = mat (dim_row B) (dim_col B) (\<lambda>ij. max (B $$ ij) (A $$ ij))
[PROOF STEP]
by (intro eq_matI, auto simp: max_comm)


[STATEMENT]
lemma pSum_pre_expression:
  "(\<forall>n . t n \<in> Pre_expression) \<Longrightarrow> pSum t m \<in> Pre_expression"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. t n \<in> Pre_expression \<Longrightarrow> pSum t m \<in> Pre_expression
[PROOF STEP]
apply (induct m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>n. t n \<in> Pre_expression \<Longrightarrow> pSum t 0 \<in> Pre_expression
 2. \<And>m. \<lbrakk>\<forall>n. t n \<in> Pre_expression \<Longrightarrow> pSum t m \<in> Pre_expression; \<forall>n. t n \<in> Pre_expression\<rbrakk> \<Longrightarrow> pSum t (Suc m) \<in> Pre_expression
[PROOF STEP]
apply (simp add: zero_pre_expression)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>\<forall>n. t n \<in> Pre_expression \<Longrightarrow> pSum t m \<in> Pre_expression; \<forall>n. t n \<in> Pre_expression\<rbrakk> \<Longrightarrow> pSum t (Suc m) \<in> Pre_expression
[PROOF STEP]
by (simp add: disj_pre)


[STATEMENT]
lemma iT_Plus_neg_singleton: "{a} \<oplus>- k = (if k \<le> a then {a - k} else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a} \<oplus>- k = (if k \<le> a then {a - k} else {})
[PROOF STEP]
by (force simp add: set_eq_iff iT_Plus_neg_mem_iff singleton_iff)


[STATEMENT]
lemma segm_morph: "snd (Rep_segment x::('a::lip_order \<times> 'a::lip_order)) = fst (Rep_segment y)
    \<Longrightarrow> segm x \<union> segm y = segm (x \<cdot> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (Rep_segment x) = fst (Rep_segment y) \<Longrightarrow> segm x \<union> segm y = segm (x \<oplus> y)
[PROOF STEP]
apply (simp add: segm_def times_segment_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (Rep_segment x) = fst (Rep_segment y) \<Longrightarrow> {ya. fst (Rep_segment x) \<le> ya \<and> ya \<le> fst (Rep_segment y)} \<union> {ya. fst (Rep_segment y) \<le> ya \<and> ya \<le> snd (Rep_segment y)} = {ya. fst (Rep_segment (Abs_segment (fst (Rep_segment x), snd (Rep_segment y)))) \<le> ya \<and> ya \<le> snd (Rep_segment (Abs_segment (fst (Rep_segment x), snd (Rep_segment y))))}
[PROOF STEP]
apply (transfer, clarsimp simp add: Abs_segment_inverse lip, safe)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>a aa ba x. \<lbrakk>a \<le> aa; aa \<le> ba; a \<le> x; x \<le> aa\<rbrakk> \<Longrightarrow> x \<le> ba
 2. \<And>a aa ba x. \<lbrakk>a \<le> aa; aa \<le> ba; aa \<le> x; x \<le> ba\<rbrakk> \<Longrightarrow> a \<le> x
 3. \<And>a aa ba x. \<lbrakk>a \<le> aa; aa \<le> ba; a \<le> x; x \<le> ba; \<not> aa \<le> x\<rbrakk> \<Longrightarrow> x \<le> aa
[PROOF STEP]
apply force+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a aa ba x. \<lbrakk>a \<le> aa; aa \<le> ba; a \<le> x; x \<le> ba; \<not> aa \<le> x\<rbrakk> \<Longrightarrow> x \<le> aa
[PROOF STEP]
by (meson lip order_trans)


[STATEMENT]
lemma ratrel_iff [simp]: "ratrel x y \<longleftrightarrow> snd x \<noteq> 0 \<and> snd y \<noteq> 0 \<and> fst x * snd y = fst y * snd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ratrel x y = (snd x \<noteq> 0 \<and> snd y \<noteq> 0 \<and> fst x * snd y = fst y * snd x)
[PROOF STEP]
by (simp add: ratrel_def)


[STATEMENT]
lemma pos_lc_dom_quad:
  fixes a:: "real"
  fixes b:: "real"
  fixes c:: "real"
  assumes alt: "a > 0"
  shows "\<exists>(w::real). \<forall>(y::real). (y > w \<longrightarrow> a*y^2 + b*y + c > 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. 0 < a * y\<^sup>2 + b * y + c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. 0 < a * y\<^sup>2 + b * y + c
[PROOF STEP]
have "-a < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - a < 0
[PROOF STEP]
using alt
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. - a < 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- a < 0

goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. 0 < a * y\<^sup>2 + b * y + c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- a < 0
[PROOF STEP]
have "\<exists>(w::real). \<forall>(y::real). (y > w \<longrightarrow> -a*y^2 - b*y - c < 0)"
[PROOF STATE]
proof (prove)
using this:
- a < 0

goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. - a * y\<^sup>2 - b * y - c < 0
[PROOF STEP]
using neg_lc_dom_quad[where a = "-a", where b = "-b", where c = "-c"]
[PROOF STATE]
proof (prove)
using this:
- a < 0
- a < 0 \<Longrightarrow> \<exists>w. \<forall>y>w. - a * y\<^sup>2 + - b * y + - c < 0

goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. - a * y\<^sup>2 - b * y - c < 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>w. \<forall>y>w. - a * y\<^sup>2 - b * y - c < 0

goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. 0 < a * y\<^sup>2 + b * y + c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>w. \<forall>y>w. - a * y\<^sup>2 - b * y - c < 0
[PROOF STEP]
obtain w where w_prop: "\<forall>(y::real). (y > w \<longrightarrow> -a*y^2 - b*y - c < 0)"
[PROOF STATE]
proof (prove)
using this:
\<exists>w. \<forall>y>w. - a * y\<^sup>2 - b * y - c < 0

goal (1 subgoal):
 1. (\<And>w. \<forall>y>w. - a * y\<^sup>2 - b * y - c < 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>y>w. - a * y\<^sup>2 - b * y - c < 0

goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. 0 < a * y\<^sup>2 + b * y + c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>y>w. - a * y\<^sup>2 - b * y - c < 0
[PROOF STEP]
have "\<forall>(y::real). (y > w \<longrightarrow> a*y^2 + b*y + c > 0)"
[PROOF STATE]
proof (prove)
using this:
\<forall>y>w. - a * y\<^sup>2 - b * y - c < 0

goal (1 subgoal):
 1. \<forall>y>w. 0 < a * y\<^sup>2 + b * y + c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>y>w. 0 < a * y\<^sup>2 + b * y + c

goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. 0 < a * y\<^sup>2 + b * y + c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>y>w. 0 < a * y\<^sup>2 + b * y + c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>y>w. 0 < a * y\<^sup>2 + b * y + c

goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. 0 < a * y\<^sup>2 + b * y + c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>w. \<forall>y>w. 0 < a * y\<^sup>2 + b * y + c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Bag_Alist_Cons:
  "x \<notin> fst ` set xs \<Longrightarrow> distinct (map fst xs) \<Longrightarrow>
    Bag (Alist ((x, n) # xs)) = mset (replicate n x) + Bag (Alist xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<notin> fst ` set xs; distinct (map fst xs)\<rbrakk> \<Longrightarrow> Bag (Alist ((x, n) # xs)) = mset (replicate n x) + Bag (Alist xs)
[PROOF STEP]
by (induct xs) (auto simp: Bag_mset Alist_inverse)


[STATEMENT]
lemma hypnat_minus_zero [simp]: "\<And>z::hypnat. z - z = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z. z - z = 0
[PROOF STEP]
by transfer (rule diff_self_eq_0)


[STATEMENT]
lemma (in encoding) indRelSTEQ_trans:
  fixes SRel :: "('procS \<times> 'procS) set"
    and TRel :: "('procT \<times> 'procT) set"
  shows "trans (indRelSTEQ SRel TRel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trans (indRelSTEQ SRel TRel)
[PROOF STEP]
unfolding trans_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y z. x \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> y \<longrightarrow> y \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> z \<longrightarrow> x \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> z
[PROOF STEP]
proof clarify
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y z. x \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> y \<and> y \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> z \<Longrightarrow> x \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> z
[PROOF STEP]
fix P Q R
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y z. x \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> y \<and> y \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> z \<Longrightarrow> x \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> z
[PROOF STEP]
assume "P \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> Q" and "Q \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> R"
[PROOF STATE]
proof (state)
this:
P \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> Q
Q \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> R

goal (1 subgoal):
 1. \<And>x y z. x \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> y \<and> y \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> z \<Longrightarrow> x \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> z
[PROOF STEP]
thus "P \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> R"
[PROOF STATE]
proof (prove)
using this:
P \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> Q
Q \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> R

goal (1 subgoal):
 1. P \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> R
[PROOF STEP]
by (rule indRelSTEQ.trans)
[PROOF STATE]
proof (state)
this:
P \<sim>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma deg_smult_decr: assumes a_in_R: "a \<in> carrier R" and f_in_P: "f \<in> carrier P" shows "deg R (a \<odot>\<^bsub>P\<^esub> f) \<le> deg R f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg R (a \<odot>\<^bsub>P\<^esub> f) \<le> deg R f
[PROOF STEP]
using deg_smult_ring [OF a_in_R f_in_P]
[PROOF STATE]
proof (prove)
using this:
deg R (a \<odot>\<^bsub>P\<^esub> f) \<le> (if a = \<zero> then 0 else deg R f)

goal (1 subgoal):
 1. deg R (a \<odot>\<^bsub>P\<^esub> f) \<le> deg R f
[PROOF STEP]
by (cases "a = \<zero>", auto)


[STATEMENT]
lemma sum_fun_sup:
  fixes f :: "'a \<Rightarrow> 'b::join_semilattice_zero"
  assumes "finite (A ::'a set)"
  shows "\<Sum>{f a | a. a \<in> A} \<le> z \<longleftrightarrow> (\<forall>a \<in> A. f a \<le> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum> {f a |a. a \<in> A} \<le> z) = (\<forall>a\<in>A. f a \<le> z)
[PROOF STEP]
by (simp only: fset_to_im assms sum_fun_image_sup)


[STATEMENT]
lemma singleton_matrix_zero[simp]: "singleton_matrix j i 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. singleton_matrix j i (0::'a) = 0
[PROOF STEP]
by (simp add: singleton_matrix_def zero_matrix_def)


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