[STATEMENT]
lemma variation_cases:
  "\<lbrakk>x>0;y>0\<rbrakk>\<Longrightarrow>variation x y = 0"
  "\<lbrakk>x>0;y<0\<rbrakk>\<Longrightarrow>variation x y = -1"
  "\<lbrakk>x<0;y>0\<rbrakk>\<Longrightarrow>variation x y = 1"
  "\<lbrakk>x<0;y<0\<rbrakk>\<Longrightarrow>variation x y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> variation x y = 0) &&& (\<lbrakk>0 < x; y < 0\<rbrakk> \<Longrightarrow> variation x y = - 1)) &&& (\<lbrakk>x < 0; 0 < y\<rbrakk> \<Longrightarrow> variation x y = 1) &&& (\<lbrakk>x < 0; y < 0\<rbrakk> \<Longrightarrow> variation x y = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> variation x y = 0
 2. \<lbrakk>0 < x; y < 0\<rbrakk> \<Longrightarrow> variation x y = - 1
 3. \<lbrakk>x < 0; 0 < y\<rbrakk> \<Longrightarrow> variation x y = 1
 4. \<lbrakk>x < 0; y < 0\<rbrakk> \<Longrightarrow> variation x y = 0
[PROOF STEP]
show "\<lbrakk>x>0;y>0\<rbrakk>\<Longrightarrow>variation x y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> variation x y = 0
[PROOF STEP]
unfolding variation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> (if 0 \<le> x * y then 0 else if x < y then 1 else - 1) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> variation x y = 0

goal (3 subgoals):
 1. \<lbrakk>0 < x; y < 0\<rbrakk> \<Longrightarrow> variation x y = - 1
 2. \<lbrakk>x < 0; 0 < y\<rbrakk> \<Longrightarrow> variation x y = 1
 3. \<lbrakk>x < 0; y < 0\<rbrakk> \<Longrightarrow> variation x y = 0
[PROOF STEP]
show "\<lbrakk>x>0;y<0\<rbrakk>\<Longrightarrow>variation x y = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; y < 0\<rbrakk> \<Longrightarrow> variation x y = - 1
[PROOF STEP]
unfolding variation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; y < 0\<rbrakk> \<Longrightarrow> (if 0 \<le> x * y then 0 else if x < y then 1 else - 1) = - 1
[PROOF STEP]
using mult_pos_neg
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(0::?'a) < ?a; ?b < (0::?'a)\<rbrakk> \<Longrightarrow> ?a * ?b < (0::?'a)

goal (1 subgoal):
 1. \<lbrakk>0 < x; y < 0\<rbrakk> \<Longrightarrow> (if 0 \<le> x * y then 0 else if x < y then 1 else - 1) = - 1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < x; y < 0\<rbrakk> \<Longrightarrow> variation x y = - 1

goal (2 subgoals):
 1. \<lbrakk>x < 0; 0 < y\<rbrakk> \<Longrightarrow> variation x y = 1
 2. \<lbrakk>x < 0; y < 0\<rbrakk> \<Longrightarrow> variation x y = 0
[PROOF STEP]
show "\<lbrakk>x<0;y>0\<rbrakk>\<Longrightarrow>variation x y = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < 0; 0 < y\<rbrakk> \<Longrightarrow> variation x y = 1
[PROOF STEP]
unfolding variation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < 0; 0 < y\<rbrakk> \<Longrightarrow> (if 0 \<le> x * y then 0 else if x < y then 1 else - 1) = 1
[PROOF STEP]
using mult_neg_pos
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a < (0::?'a); (0::?'a) < ?b\<rbrakk> \<Longrightarrow> ?a * ?b < (0::?'a)

goal (1 subgoal):
 1. \<lbrakk>x < 0; 0 < y\<rbrakk> \<Longrightarrow> (if 0 \<le> x * y then 0 else if x < y then 1 else - 1) = 1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<lbrakk>x < 0; 0 < y\<rbrakk> \<Longrightarrow> variation x y = 1

goal (1 subgoal):
 1. \<lbrakk>x < 0; y < 0\<rbrakk> \<Longrightarrow> variation x y = 0
[PROOF STEP]
show "\<lbrakk>x<0;y<0\<rbrakk>\<Longrightarrow>variation x y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < 0; y < 0\<rbrakk> \<Longrightarrow> variation x y = 0
[PROOF STEP]
unfolding variation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < 0; y < 0\<rbrakk> \<Longrightarrow> (if 0 \<le> x * y then 0 else if x < y then 1 else - 1) = 0
[PROOF STEP]
using mult_neg_neg
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a < (0::?'a); ?b < (0::?'a)\<rbrakk> \<Longrightarrow> (0::?'a) < ?a * ?b

goal (1 subgoal):
 1. \<lbrakk>x < 0; y < 0\<rbrakk> \<Longrightarrow> (if 0 \<le> x * y then 0 else if x < y then 1 else - 1) = 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<lbrakk>x < 0; y < 0\<rbrakk> \<Longrightarrow> variation x y = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_set_nonzero_constant:
  assumes "a \<noteq> \<zero>"
  assumes "a \<in> carrier R"
  shows "zero_set R n (coord_const a) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V n (R.indexed_const a) = {}
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. V n (R.indexed_const a) \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
assume "V n (coord_const a) \<noteq> {}"
[PROOF STATE]
proof (state)
this:
V n (R.indexed_const a) \<noteq> {}

goal (1 subgoal):
 1. V n (R.indexed_const a) \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
V n (R.indexed_const a) \<noteq> {}
[PROOF STEP]
obtain x where "x \<in> V n (coord_const a)"
[PROOF STATE]
proof (prove)
using this:
V n (R.indexed_const a) \<noteq> {}

goal (1 subgoal):
 1. (\<And>x. x \<in> V n (R.indexed_const a) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> V n (R.indexed_const a)

goal (1 subgoal):
 1. V n (R.indexed_const a) \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> V n (R.indexed_const a)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
x \<in> V n (R.indexed_const a)

goal (1 subgoal):
 1. False
[PROOF STEP]
by (metis assms(1) assms(2) cring_coord_rings.eval_at_point_const cring_coord_rings.zero_setE(1) cring_coord_rings.zero_setE(2) cring_coord_rings_axioms)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in filtrated_prob_space) borel_adapt_stoch_proc_add:
  fixes X::"'b \<Rightarrow> 'a \<Rightarrow> ('c::{second_countable_topology, topological_monoid_add})"
  assumes "borel_adapt_stoch_proc F X"
  and "borel_adapt_stoch_proc F Y"
shows "borel_adapt_stoch_proc F (\<lambda>t w. X t w + Y t w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. borel_adapt_stoch_proc F (\<lambda>t w. X t w + Y t w)
[PROOF STEP]
unfolding adapt_stoch_proc_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t. (\<lambda>w. X t w + Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t. (\<lambda>w. X t w + Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t. (\<lambda>w. X t w + Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
have "X t \<in> borel_measurable (F t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X t \<in> borel_measurable (F t)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
borel_adapt_stoch_proc F X
borel_adapt_stoch_proc F Y

goal (1 subgoal):
 1. X t \<in> borel_measurable (F t)
[PROOF STEP]
unfolding adapt_stoch_proc_def
[PROOF STATE]
proof (prove)
using this:
\<forall>t. X t \<in> borel_measurable (F t)
\<forall>t. Y t \<in> borel_measurable (F t)

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

goal (1 subgoal):
 1. \<And>t. (\<lambda>w. X t w + Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
X t \<in> borel_measurable (F t)

goal (1 subgoal):
 1. \<And>t. (\<lambda>w. X t w + Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
have "Y t \<in> borel_measurable (F t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y t \<in> borel_measurable (F t)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
borel_adapt_stoch_proc F X
borel_adapt_stoch_proc F Y

goal (1 subgoal):
 1. Y t \<in> borel_measurable (F t)
[PROOF STEP]
unfolding adapt_stoch_proc_def
[PROOF STATE]
proof (prove)
using this:
\<forall>t. X t \<in> borel_measurable (F t)
\<forall>t. Y t \<in> borel_measurable (F t)

goal (1 subgoal):
 1. Y t \<in> borel_measurable (F t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Y t \<in> borel_measurable (F t)

goal (1 subgoal):
 1. \<And>t. (\<lambda>w. X t w + Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
X t \<in> borel_measurable (F t)
Y t \<in> borel_measurable (F t)
[PROOF STEP]
show "(\<lambda>w. X t w + Y t w) \<in> borel_measurable (F t)"
[PROOF STATE]
proof (prove)
using this:
X t \<in> borel_measurable (F t)
Y t \<in> borel_measurable (F t)

goal (1 subgoal):
 1. (\<lambda>w. X t w + Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>w. X t w + Y t w) \<in> borel_measurable (F t)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "rec_BitList nil bit0 bit1 (Bit0 xs) = bit0 xs (rec_BitList nil bit0 bit1 xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_BitList nil bit0 bit1 (Bit0 xs) = bit0 xs (rec_BitList nil bit0 bit1 xs)
[PROOF STEP]
nitpick [expect = none]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_BitList nil bit0 bit1 (Bit0 xs) = bit0 xs (rec_BitList nil bit0 bit1 xs)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma powsum_prod_suc: "x\<^bsub>0\<^esub>\<^bsup>m \<^esup>\<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m+n)\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup>
[PROOF STEP]
proof (induct m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x\<^bsub>0\<^esub>\<^bsup>0\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (0 + n)\<^esup>
 2. \<And>m. x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> \<Longrightarrow> x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. x\<^bsub>0\<^esub>\<^bsup>0\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (0 + n)\<^esup>
 2. \<And>m. x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> \<Longrightarrow> x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>0\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (0 + n)\<^esup>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>0\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (0 + n)\<^esup>

goal (1 subgoal):
 1. \<And>m. x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> \<Longrightarrow> x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup>

goal (1 subgoal):
 1. \<And>m. x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> \<Longrightarrow> x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
note hyp = this
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup>

goal (1 subgoal):
 1. \<And>m. x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> \<Longrightarrow> x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
have "x\<^bsub>0\<^esub>\<^bsup>Suc m \<^esup>\<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> =  x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> + x\<^bsup>Suc m \<^esup>\<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> + x\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup>
[PROOF STEP]
by (simp add: powsum2)
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> + x\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup>

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> + x\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup>

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
have "... = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc m \<^esup>\<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> + x\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup>
[PROOF STEP]
by (simp add:hyp)
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> + x\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup>

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> + x\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup>

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
have "... = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>Suc n\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>Suc n\<^esup>
[PROOF STEP]
by (subst powsum_shift, simp)
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>Suc n\<^esup>

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>Suc n\<^esup>

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
have "... = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + (x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc m + Suc n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + (x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc m + Suc n\<^esup>)
[PROOF STEP]
by (simp add:powsum2)
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + (x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc m + Suc n\<^esup>)

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + (x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc m + Suc n\<^esup>)

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
have "... = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + (x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc m + Suc n\<^esup>) = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup>
[PROOF STEP]
by (metis add_Suc_right add_Suc_shift add.assoc add.left_commute)
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + (x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc m + Suc n\<^esup>) = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup>

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + (x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc m + Suc n\<^esup>) = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup>

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
have "... = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup>
[PROOF STEP]
by (simp only: add_Suc_right[THEN sym] add_Suc_shift[THEN sym] powsum_split_var4)
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup>

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsub>Suc m\<^esub>\<^bsup>n\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup>

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
have "... = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
by (simp add: powsum2)
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc (m + n)\<^esup> + x\<^bsup>Suc (Suc (m + n))\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>

goal (1 subgoal):
 1. x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> \<cdot> x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc (Suc m + n)\<^esup>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_conv_radius_power: "fps_conv_radius (f ^ n) \<ge> fps_conv_radius f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_conv_radius f \<le> fps_conv_radius (f ^ n)
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fps_conv_radius f \<le> fps_conv_radius (f ^ 0)
 2. \<And>n. fps_conv_radius f \<le> fps_conv_radius (f ^ n) \<Longrightarrow> fps_conv_radius f \<le> fps_conv_radius (f ^ Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
fps_conv_radius f \<le> fps_conv_radius (f ^ n)

goal (2 subgoals):
 1. fps_conv_radius f \<le> fps_conv_radius (f ^ 0)
 2. \<And>n. fps_conv_radius f \<le> fps_conv_radius (f ^ n) \<Longrightarrow> fps_conv_radius f \<le> fps_conv_radius (f ^ Suc n)
[PROOF STEP]
hence "fps_conv_radius f \<le> min (fps_conv_radius f) (fps_conv_radius (f ^ n))"
[PROOF STATE]
proof (prove)
using this:
fps_conv_radius f \<le> fps_conv_radius (f ^ n)

goal (1 subgoal):
 1. fps_conv_radius f \<le> min (fps_conv_radius f) (fps_conv_radius (f ^ n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_conv_radius f \<le> min (fps_conv_radius f) (fps_conv_radius (f ^ n))

goal (2 subgoals):
 1. fps_conv_radius f \<le> fps_conv_radius (f ^ 0)
 2. \<And>n. fps_conv_radius f \<le> fps_conv_radius (f ^ n) \<Longrightarrow> fps_conv_radius f \<le> fps_conv_radius (f ^ Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fps_conv_radius f \<le> min (fps_conv_radius f) (fps_conv_radius (f ^ n))

goal (2 subgoals):
 1. fps_conv_radius f \<le> fps_conv_radius (f ^ 0)
 2. \<And>n. fps_conv_radius f \<le> fps_conv_radius (f ^ n) \<Longrightarrow> fps_conv_radius f \<le> fps_conv_radius (f ^ Suc n)
[PROOF STEP]
have "\<dots> \<le> fps_conv_radius (f * f ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (fps_conv_radius f) (fps_conv_radius (f ^ n)) \<le> fps_conv_radius (f * f ^ n)
[PROOF STEP]
by (rule fps_conv_radius_mult)
[PROOF STATE]
proof (state)
this:
min (fps_conv_radius f) (fps_conv_radius (f ^ n)) \<le> fps_conv_radius (f * f ^ n)

goal (2 subgoals):
 1. fps_conv_radius f \<le> fps_conv_radius (f ^ 0)
 2. \<And>n. fps_conv_radius f \<le> fps_conv_radius (f ^ n) \<Longrightarrow> fps_conv_radius f \<le> fps_conv_radius (f ^ Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fps_conv_radius f \<le> fps_conv_radius (f * f ^ n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
fps_conv_radius f \<le> fps_conv_radius (f * f ^ n)

goal (1 subgoal):
 1. fps_conv_radius f \<le> fps_conv_radius (f ^ Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_conv_radius f \<le> fps_conv_radius (f ^ Suc n)

goal (1 subgoal):
 1. fps_conv_radius f \<le> fps_conv_radius (f ^ 0)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma has_fps_expansion_inverse [fps_expansion_intros]:
  fixes F :: "'a :: {banach, real_normed_field} fps"
  assumes "f has_fps_expansion F"
  assumes "fps_nth F 0 \<noteq> 0"
  shows   "(\<lambda>x. inverse (f x)) has_fps_expansion inverse F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. inverse (f x)) has_fps_expansion inverse F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. inverse (f x)) has_fps_expansion inverse F
[PROOF STEP]
have radius: "fps_conv_radius (inverse F) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < fps_conv_radius (inverse F)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f has_fps_expansion F
fps_nth F 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. 0 < fps_conv_radius (inverse F)
[PROOF STEP]
unfolding has_fps_expansion_def
[PROOF STATE]
proof (prove)
using this:
0 < fps_conv_radius F \<and> (\<forall>\<^sub>F z in nhds (0::'a). eval_fps F z = f z)
fps_nth F 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. 0 < fps_conv_radius (inverse F)
[PROOF STEP]
by (intro fps_conv_radius_inverse_pos) auto
[PROOF STATE]
proof (state)
this:
0 < fps_conv_radius (inverse F)

goal (1 subgoal):
 1. (\<lambda>x. inverse (f x)) has_fps_expansion inverse F
[PROOF STEP]
let ?R = "min (fps_conv_radius F) (fps_conv_radius (inverse F))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. inverse (f x)) has_fps_expansion inverse F
[PROOF STEP]
from assms radius
[PROOF STATE]
proof (chain)
picking this:
f has_fps_expansion F
fps_nth F 0 \<noteq> (0::'a)
0 < fps_conv_radius (inverse F)
[PROOF STEP]
have "eventually (\<lambda>x. x \<in> eball 0 (fps_conv_radius F)) (nhds 0)"
         "eventually (\<lambda>x. x \<in> eball 0 (fps_conv_radius (inverse F))) (nhds 0)"
[PROOF STATE]
proof (prove)
using this:
f has_fps_expansion F
fps_nth F 0 \<noteq> (0::'a)
0 < fps_conv_radius (inverse F)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds (0::'b). x \<in> eball (0::'b) (fps_conv_radius F) &&& \<forall>\<^sub>F x in nhds (0::'c). x \<in> eball (0::'c) (fps_conv_radius (inverse F))
[PROOF STEP]
by (intro eventually_nhds_in_open; force simp: has_fps_expansion_def zero_ereal_def)+
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in nhds (0::?'b1). x \<in> eball (0::?'b1) (fps_conv_radius F)
\<forall>\<^sub>F x in nhds (0::?'c1). x \<in> eball (0::?'c1) (fps_conv_radius (inverse F))

goal (1 subgoal):
 1. (\<lambda>x. inverse (f x)) has_fps_expansion inverse F
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in nhds (0::?'b1). x \<in> eball (0::?'b1) (fps_conv_radius F)
\<forall>\<^sub>F x in nhds (0::?'c1). x \<in> eball (0::?'c1) (fps_conv_radius (inverse F))

goal (1 subgoal):
 1. (\<lambda>x. inverse (f x)) has_fps_expansion inverse F
[PROOF STEP]
have "eventually (\<lambda>z. eval_fps F z = f z) (nhds 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F z in nhds (0::'a). eval_fps F z = f z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f has_fps_expansion F
fps_nth F 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. \<forall>\<^sub>F z in nhds (0::'a). eval_fps F z = f z
[PROOF STEP]
by (auto simp: has_fps_expansion_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F z in nhds (0::'a). eval_fps F z = f z

goal (1 subgoal):
 1. (\<lambda>x. inverse (f x)) has_fps_expansion inverse F
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in nhds (0::?'b1). x \<in> eball (0::?'b1) (fps_conv_radius F)
\<forall>\<^sub>F x in nhds (0::?'c1). x \<in> eball (0::?'c1) (fps_conv_radius (inverse F))
\<forall>\<^sub>F z in nhds (0::'a). eval_fps F z = f z
[PROOF STEP]
have "eventually (\<lambda>z. eval_fps (inverse F) z = inverse (f z)) (nhds 0)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds (0::?'b1). x \<in> eball (0::?'b1) (fps_conv_radius F)
\<forall>\<^sub>F x in nhds (0::?'c1). x \<in> eball (0::?'c1) (fps_conv_radius (inverse F))
\<forall>\<^sub>F z in nhds (0::'a). eval_fps F z = f z

goal (1 subgoal):
 1. \<forall>\<^sub>F z in nhds (0::'a). eval_fps (inverse F) z = inverse (f z)
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>z. \<lbrakk>z \<in> eball (0::'a) (fps_conv_radius F); z \<in> eball (0::'a) (fps_conv_radius (inverse F)); eval_fps F z = f z\<rbrakk> \<Longrightarrow> eval_fps (inverse F) z = inverse (f z)
[PROOF STEP]
case (elim z)
[PROOF STATE]
proof (state)
this:
z \<in> eball (0::'a) (fps_conv_radius F)
z \<in> eball (0::'a) (fps_conv_radius (inverse F))
eval_fps F z = f z

goal (1 subgoal):
 1. \<And>z. \<lbrakk>z \<in> eball (0::'a) (fps_conv_radius F); z \<in> eball (0::'a) (fps_conv_radius (inverse F)); eval_fps F z = f z\<rbrakk> \<Longrightarrow> eval_fps (inverse F) z = inverse (f z)
[PROOF STEP]
hence "eval_fps (inverse F * F) z = eval_fps (inverse F) z * f z"
[PROOF STATE]
proof (prove)
using this:
z \<in> eball (0::'a) (fps_conv_radius F)
z \<in> eball (0::'a) (fps_conv_radius (inverse F))
eval_fps F z = f z

goal (1 subgoal):
 1. eval_fps (inverse F * F) z = eval_fps (inverse F) z * f z
[PROOF STEP]
by (subst eval_fps_mult) auto
[PROOF STATE]
proof (state)
this:
eval_fps (inverse F * F) z = eval_fps (inverse F) z * f z

goal (1 subgoal):
 1. \<And>z. \<lbrakk>z \<in> eball (0::'a) (fps_conv_radius F); z \<in> eball (0::'a) (fps_conv_radius (inverse F)); eval_fps F z = f z\<rbrakk> \<Longrightarrow> eval_fps (inverse F) z = inverse (f z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eval_fps (inverse F * F) z = eval_fps (inverse F) z * f z

goal (1 subgoal):
 1. \<And>z. \<lbrakk>z \<in> eball (0::'a) (fps_conv_radius F); z \<in> eball (0::'a) (fps_conv_radius (inverse F)); eval_fps F z = f z\<rbrakk> \<Longrightarrow> eval_fps (inverse F) z = inverse (f z)
[PROOF STEP]
have "eval_fps (inverse F * F) z = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fps (inverse F * F) z = (1::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f has_fps_expansion F
fps_nth F 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. eval_fps (inverse F * F) z = (1::'a)
[PROOF STEP]
by (simp add: inverse_mult_eq_1)
[PROOF STATE]
proof (state)
this:
eval_fps (inverse F * F) z = (1::'a)

goal (1 subgoal):
 1. \<And>z. \<lbrakk>z \<in> eball (0::'a) (fps_conv_radius F); z \<in> eball (0::'a) (fps_conv_radius (inverse F)); eval_fps F z = f z\<rbrakk> \<Longrightarrow> eval_fps (inverse F) z = inverse (f z)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1::'a) = eval_fps (inverse F) z * f z
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(1::'a) = eval_fps (inverse F) z * f z

goal (1 subgoal):
 1. eval_fps (inverse F) z = inverse (f z)
[PROOF STEP]
by (auto simp: field_split_simps)
[PROOF STATE]
proof (state)
this:
eval_fps (inverse F) z = inverse (f z)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F z in nhds (0::'a). eval_fps (inverse F) z = inverse (f z)

goal (1 subgoal):
 1. (\<lambda>x. inverse (f x)) has_fps_expansion inverse F
[PROOF STEP]
with radius
[PROOF STATE]
proof (chain)
picking this:
0 < fps_conv_radius (inverse F)
\<forall>\<^sub>F z in nhds (0::'a). eval_fps (inverse F) z = inverse (f z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < fps_conv_radius (inverse F)
\<forall>\<^sub>F z in nhds (0::'a). eval_fps (inverse F) z = inverse (f z)

goal (1 subgoal):
 1. (\<lambda>x. inverse (f x)) has_fps_expansion inverse F
[PROOF STEP]
by (auto simp: has_fps_expansion_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. inverse (f x)) has_fps_expansion inverse F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lcoset_rel_trans: "trans (lcoset_rel G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trans (lcoset_rel G)
[PROOF STEP]
proof (rule transI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>(x, y) \<in> lcoset_rel G; (y, z) \<in> lcoset_rel G\<rbrakk> \<Longrightarrow> (x, z) \<in> lcoset_rel G
[PROOF STEP]
fix x y z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>(x, y) \<in> lcoset_rel G; (y, z) \<in> lcoset_rel G\<rbrakk> \<Longrightarrow> (x, z) \<in> lcoset_rel G
[PROOF STEP]
assume xy: "(x,y) \<in> lcoset_rel G" and yz: "(y,z) \<in> lcoset_rel G"
[PROOF STATE]
proof (state)
this:
(x, y) \<in> lcoset_rel G
(y, z) \<in> lcoset_rel G

goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>(x, y) \<in> lcoset_rel G; (y, z) \<in> lcoset_rel G\<rbrakk> \<Longrightarrow> (x, z) \<in> lcoset_rel G
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
(x, y) \<in> lcoset_rel G
(y, z) \<in> lcoset_rel G
[PROOF STEP]
obtain g g' where "g\<in>G" "-x+y = g" "g'\<in>G" "-y+z = g'"
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> lcoset_rel G
(y, z) \<in> lcoset_rel G

goal (1 subgoal):
 1. (\<And>g g'. \<lbrakk>g \<in> G; - x + y = g; g' \<in> G; - y + z = g'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using lcoset_rel_def[of G]
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> lcoset_rel G
(y, z) \<in> lcoset_rel G
lcoset_rel G \<equiv> {(x, y). - x + y \<in> G}

goal (1 subgoal):
 1. (\<And>g g'. \<lbrakk>g \<in> G; - x + y = g; g' \<in> G; - y + z = g'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
g \<in> G
- x + y = g
g' \<in> G
- y + z = g'

goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>(x, y) \<in> lcoset_rel G; (y, z) \<in> lcoset_rel G\<rbrakk> \<Longrightarrow> (x, z) \<in> lcoset_rel G
[PROOF STEP]
thus "(x, z) \<in> lcoset_rel G"
[PROOF STATE]
proof (prove)
using this:
g \<in> G
- x + y = g
g' \<in> G
- y + z = g'

goal (1 subgoal):
 1. (x, z) \<in> lcoset_rel G
[PROOF STEP]
using add.assoc[of g "-y" z] add_closed lcoset_rel_def[of G]
[PROOF STATE]
proof (prove)
using this:
g \<in> G
- x + y = g
g' \<in> G
- y + z = g'
g + - y + z = g + (- y + z)
\<lbrakk>?g \<in> G; ?h \<in> G\<rbrakk> \<Longrightarrow> ?g + ?h \<in> G
lcoset_rel G \<equiv> {(x, y). - x + y \<in> G}

goal (1 subgoal):
 1. (x, z) \<in> lcoset_rel G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x, z) \<in> lcoset_rel G

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Carmichael_prime_power:
  assumes "prime p" "k > 0"
  shows   "Carmichael (p ^ k) =
             (if p = 2 \<and> k > 2 then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
[PROOF STEP]
proof (cases "p = 2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 2 \<Longrightarrow> Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
 2. p \<noteq> 2 \<Longrightarrow> Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = 2

goal (2 subgoals):
 1. p = 2 \<Longrightarrow> Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
 2. p \<noteq> 2 \<Longrightarrow> Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 2

goal (1 subgoal):
 1. Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
[PROOF STEP]
by (simp add: Carmichael_twopow)
[PROOF STATE]
proof (state)
this:
Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))

goal (1 subgoal):
 1. p \<noteq> 2 \<Longrightarrow> Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> 2 \<Longrightarrow> Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 2

goal (1 subgoal):
 1. p \<noteq> 2 \<Longrightarrow> Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
prime p
0 < k
p \<noteq> 2
[PROOF STEP]
have "odd p" "p > 2"
[PROOF STATE]
proof (prove)
using this:
prime p
0 < k
p \<noteq> 2

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

goal (1 subgoal):
 1. odd p &&& 2 < p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
odd p
2 < p

goal (1 subgoal):
 1. p \<noteq> 2 \<Longrightarrow> Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
odd p
2 < p

goal (1 subgoal):
 1. Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
[PROOF STEP]
using assms Carmichael_odd_prime_power[of p k]
[PROOF STATE]
proof (prove)
using this:
odd p
2 < p
prime p
0 < k
\<lbrakk>prime p; odd p; 0 < k\<rbrakk> \<Longrightarrow> Carmichael (p ^ k) = p ^ (k - 1) * (p - 1)

goal (1 subgoal):
 1. Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Carmichael (p ^ k) = (if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma up_close_equiv:
  assumes "up_closed A"
      and "up_closed B"
    shows "A \<sim> B \<longleftrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<sim> B) = (A = B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (A \<sim> B) = (A = B)
[PROOF STEP]
have "A \<sim> B \<longleftrightarrow> A \<ggreater> B \<and> B \<ggreater> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<sim> B) = (A \<ggreater> B \<and> B \<ggreater> A)
[PROOF STEP]
using local.equiv_def
[PROOF STATE]
proof (prove)
using this:
(?A \<sim> ?B) = (?A \<ggreater> ?B \<and> ?B \<ggreater> ?A)

goal (1 subgoal):
 1. (A \<sim> B) = (A \<ggreater> B \<and> B \<ggreater> A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A \<sim> B) = (A \<ggreater> B \<and> B \<ggreater> A)

goal (1 subgoal):
 1. (A \<sim> B) = (A = B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(A \<sim> B) = (A \<ggreater> B \<and> B \<ggreater> A)

goal (1 subgoal):
 1. (A \<sim> B) = (A = B)
[PROOF STEP]
have "... \<longleftrightarrow> A \<subseteq> B \<and> B \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<ggreater> B \<and> B \<ggreater> A) = (A \<subseteq> B \<and> B \<subseteq> A)
[PROOF STEP]
by (metis assms(1) assms(2) greater_set_def set_eq_subset succ_refl up_closed_bigger_subset)
[PROOF STATE]
proof (state)
this:
(A \<ggreater> B \<and> B \<ggreater> A) = (A \<subseteq> B \<and> B \<subseteq> A)

goal (1 subgoal):
 1. (A \<sim> B) = (A = B)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(A \<sim> B) = (A \<ggreater> B \<and> B \<ggreater> A)
(A \<ggreater> B \<and> B \<ggreater> A) = (A \<subseteq> B \<and> B \<subseteq> A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(A \<sim> B) = (A \<ggreater> B \<and> B \<ggreater> A)
(A \<ggreater> B \<and> B \<ggreater> A) = (A \<subseteq> B \<and> B \<subseteq> A)

goal (1 subgoal):
 1. (A \<sim> B) = (A = B)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(A \<sim> B) = (A = B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_times_self_gt:
  assumes "x \<noteq> -1"
  shows   "x * exp x > -exp (-1::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - exp (- 1) < x * exp x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - exp (- 1) < x * exp x
[PROOF STEP]
define f where "f = (\<lambda>x::real. x * exp x)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. x * exp x)

goal (1 subgoal):
 1. - exp (- 1) < x * exp x
[PROOF STEP]
define f' where "f' = (\<lambda>x::real. (x + 1) * exp x)"
[PROOF STATE]
proof (state)
this:
f' = (\<lambda>x. (x + 1) * exp x)

goal (1 subgoal):
 1. - exp (- 1) < x * exp x
[PROOF STEP]
have "(f has_field_derivative f' x) (at x)" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_real_derivative f' x) (at x)
[PROOF STEP]
by (auto simp: f_def f'_def intro!: derivative_eq_intros simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
(f has_real_derivative f' ?x) (at ?x)

goal (1 subgoal):
 1. - exp (- 1) < x * exp x
[PROOF STEP]
define l r where "l = min x (-1)" and "r = max x (-1)"
[PROOF STATE]
proof (state)
this:
l = min x (- 1)
r = max x (- 1)

goal (1 subgoal):
 1. - exp (- 1) < x * exp x
[PROOF STEP]
have "\<exists>z. z > l \<and> z < r \<and> f r - f l = (r - l) * f' z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z>l. z < r \<and> f r - f l = (r - l) * f' z
[PROOF STEP]
unfolding f_def f'_def l_def r_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z>min x (- 1). z < max x (- 1) \<and> max x (- 1) * exp (max x (- 1)) - min x (- 1) * exp (min x (- 1)) = (max x (- 1) - min x (- 1)) * ((z + 1) * exp z)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<noteq> - 1

goal (1 subgoal):
 1. \<exists>z>min x (- 1). z < max x (- 1) \<and> max x (- 1) * exp (max x (- 1)) - min x (- 1) * exp (min x (- 1)) = (max x (- 1) - min x (- 1)) * ((z + 1) * exp z)
[PROOF STEP]
by (intro MVT2) (auto intro!: derivative_eq_intros simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
\<exists>z>l. z < r \<and> f r - f l = (r - l) * f' z

goal (1 subgoal):
 1. - exp (- 1) < x * exp x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>z>l. z < r \<and> f r - f l = (r - l) * f' z
[PROOF STEP]
obtain z where z: "z \<in> {l<..<r}" "f r - f l = (r - l) * f' z"
[PROOF STATE]
proof (prove)
using this:
\<exists>z>l. z < r \<and> f r - f l = (r - l) * f' z

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> {l<..<r}; f r - f l = (r - l) * f' z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<in> {l<..<r}
f r - f l = (r - l) * f' z

goal (1 subgoal):
 1. - exp (- 1) < x * exp x
[PROOF STEP]
from z
[PROOF STATE]
proof (chain)
picking this:
z \<in> {l<..<r}
f r - f l = (r - l) * f' z
[PROOF STEP]
have "f x = f (-1) + (x + 1) * f' z"
[PROOF STATE]
proof (prove)
using this:
z \<in> {l<..<r}
f r - f l = (r - l) * f' z

goal (1 subgoal):
 1. f x = f (- 1) + (x + 1) * f' z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z \<in> {l<..<r}
f r - f l = (r - l) * f' z
x \<noteq> - 1

goal (1 subgoal):
 1. f x = f (- 1) + (x + 1) * f' z
[PROOF STEP]
by (cases "x \<ge> -1") (auto simp: l_def r_def max_def min_def algebra_simps)
[PROOF STATE]
proof (state)
this:
f x = f (- 1) + (x + 1) * f' z

goal (1 subgoal):
 1. - exp (- 1) < x * exp x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f x = f (- 1) + (x + 1) * f' z

goal (1 subgoal):
 1. - exp (- 1) < x * exp x
[PROOF STEP]
have "sgn ((x + 1) * f' z) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn ((x + 1) * f' z) = 1
[PROOF STEP]
using z assms
[PROOF STATE]
proof (prove)
using this:
z \<in> {l<..<r}
f r - f l = (r - l) * f' z
x \<noteq> - 1

goal (1 subgoal):
 1. sgn ((x + 1) * f' z) = 1
[PROOF STEP]
by (cases x "(-1) :: real" rule: linorder_cases; cases z "(-1) :: real" rule: linorder_cases)
       (auto simp: f'_def sgn_mult l_def r_def)
[PROOF STATE]
proof (state)
this:
sgn ((x + 1) * f' z) = 1

goal (1 subgoal):
 1. - exp (- 1) < x * exp x
[PROOF STEP]
hence "(x + 1) * f' z > 0"
[PROOF STATE]
proof (prove)
using this:
sgn ((x + 1) * f' z) = 1

goal (1 subgoal):
 1. 0 < (x + 1) * f' z
[PROOF STEP]
using sgn_greater
[PROOF STATE]
proof (prove)
using this:
sgn ((x + 1) * f' z) = 1
((0::?'a) < sgn ?a) = ((0::?'a) < ?a)

goal (1 subgoal):
 1. 0 < (x + 1) * f' z
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
0 < (x + 1) * f' z

goal (1 subgoal):
 1. - exp (- 1) < x * exp x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f x = f (- 1) + (x + 1) * f' z
0 < (x + 1) * f' z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f x = f (- 1) + (x + 1) * f' z
0 < (x + 1) * f' z

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_mult_not_eq_zero_leftI:
  fixes f :: "'b \<Rightarrow> 'a :: mult_zero"
  assumes "finite {a. f a \<noteq> 0}"
  shows "finite {a. g a * f a \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {a. g a * f a \<noteq> (0::'a)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {a. g a * f a \<noteq> (0::'a)}
[PROOF STEP]
have "{a. g a * f a \<noteq> 0} \<subseteq> {a. f a \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a. g a * f a \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{a. g a * f a \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}

goal (1 subgoal):
 1. finite {a. g a * f a \<noteq> (0::'a)}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{a. g a * f a \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{a. g a * f a \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}

goal (1 subgoal):
 1. finite {a. g a * f a \<noteq> (0::'a)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
{a. g a * f a \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}
finite {a. f a \<noteq> (0::'a)}

goal (1 subgoal):
 1. finite {a. g a * f a \<noteq> (0::'a)}
[PROOF STEP]
by (rule finite_subset)
[PROOF STATE]
proof (state)
this:
finite {a. g a * f a \<noteq> (0::'a)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma insert_nth_remove_nth:
  assumes "i < length xs"
  shows "insert_nth i (xs ! i) (remove_nth i xs) = xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert_nth i (xs ! i) (remove_nth i xs) = xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < length xs

goal (1 subgoal):
 1. insert_nth i (xs ! i) (remove_nth i xs) = xs
[PROOF STEP]
proof (induct xs arbitrary: i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < length [] \<Longrightarrow> insert_nth i ([] ! i) (remove_nth i []) = []
 2. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> insert_nth i (xs ! i) (remove_nth i xs) = xs; i < length (a # xs)\<rbrakk> \<Longrightarrow> insert_nth i ((a # xs) ! i) (remove_nth i (a # xs)) = a # xs
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
i < length []

goal (2 subgoals):
 1. \<And>i. i < length [] \<Longrightarrow> insert_nth i ([] ! i) (remove_nth i []) = []
 2. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> insert_nth i (xs ! i) (remove_nth i xs) = xs; i < length (a # xs)\<rbrakk> \<Longrightarrow> insert_nth i ((a # xs) ! i) (remove_nth i (a # xs)) = a # xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
i < length []

goal (1 subgoal):
 1. insert_nth i ([] ! i) (remove_nth i []) = []
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
insert_nth i ([] ! i) (remove_nth i []) = []

goal (1 subgoal):
 1. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> insert_nth i (xs ! i) (remove_nth i xs) = xs; i < length (a # xs)\<rbrakk> \<Longrightarrow> insert_nth i ((a # xs) ! i) (remove_nth i (a # xs)) = a # xs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> insert_nth i (xs ! i) (remove_nth i xs) = xs; i < length (a # xs)\<rbrakk> \<Longrightarrow> insert_nth i ((a # xs) ! i) (remove_nth i (a # xs)) = a # xs
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
?i < length xs \<Longrightarrow> insert_nth ?i (xs ! ?i) (remove_nth ?i xs) = xs
i < length (a # xs)

goal (1 subgoal):
 1. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> insert_nth i (xs ! i) (remove_nth i xs) = xs; i < length (a # xs)\<rbrakk> \<Longrightarrow> insert_nth i ((a # xs) ! i) (remove_nth i (a # xs)) = a # xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < length xs \<Longrightarrow> insert_nth ?i (xs ! ?i) (remove_nth ?i xs) = xs
i < length (a # xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?i < length xs \<Longrightarrow> insert_nth ?i (xs ! ?i) (remove_nth ?i xs) = xs
i < length (a # xs)

goal (1 subgoal):
 1. insert_nth i ((a # xs) ! i) (remove_nth i (a # xs)) = a # xs
[PROOF STEP]
by (cases i) auto
[PROOF STATE]
proof (state)
this:
insert_nth i ((a # xs) ! i) (remove_nth i (a # xs)) = a # xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma S_idx_uniq:
    "\<lbrakk>i<length S; j<length S\<rbrakk> \<Longrightarrow> S!i=S!j \<longleftrightarrow> i=j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length S; j < length S\<rbrakk> \<Longrightarrow> (S ! i = S ! j) = (i = j)
[PROOF STEP]
using S_distinct
[PROOF STATE]
proof (prove)
using this:
distinct S

goal (1 subgoal):
 1. \<lbrakk>i < length S; j < length S\<rbrakk> \<Longrightarrow> (S ! i = S ! j) = (i = j)
[PROOF STEP]
by (simp add: nth_eq_iff_index_eq)


[STATEMENT]
theorem mojmir_accept_iff_token_set_accept2:
  "accept \<longleftrightarrow> (\<exists>i < max_rank. finite fail \<and> finite (merge i) \<and> infinite (succeed i) \<and> (\<forall>j < i. finite (merge j) \<and> finite (succeed j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. accept\<^sub>M = (\<exists>i<max_rank. finite fail \<and> finite (local.merge i) \<and> infinite (succeed i) \<and> (\<forall>j<i. finite (local.merge j) \<and> finite (succeed j)))
[PROOF STEP]
using mojmir_accept_token_set_def1 mojmir_accept_token_set_def2 merge_finite'
[PROOF STATE]
proof (prove)
using this:
accept\<^sub>M \<Longrightarrow> \<exists>i<max_rank. finite fail \<and> finite (local.merge i) \<and> infinite (succeed i) \<and> (\<forall>j<i. finite (succeed j))
\<lbrakk>finite fail; finite (local.merge ?i); infinite (succeed ?i)\<rbrakk> \<Longrightarrow> accept\<^sub>M
\<lbrakk>?i < ?j; finite (local.merge ?j)\<rbrakk> \<Longrightarrow> finite (local.merge ?i)

goal (1 subgoal):
 1. accept\<^sub>M = (\<exists>i<max_rank. finite fail \<and> finite (local.merge i) \<and> infinite (succeed i) \<and> (\<forall>j<i. finite (local.merge j) \<and> finite (succeed j)))
[PROOF STEP]
by blast


[STATEMENT]
lemma merge_mset: "mset (merge xs ys) = mset xs + mset ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (merge xs ys) = mset xs + mset ys
[PROOF STEP]
by (induction xs ys rule: merge.induct) auto


[STATEMENT]
lemma filterlim_at_top_at_top_within_bounded_right:
  fixes a b::"'a::{dense_order,linorder_topology}"
  fixes f::"'a \<Rightarrow> real"
  assumes "a < b"
  shows "filterlim f at_top (at_top_within {..<b}) = (f \<longlongrightarrow> \<infinity>) (at_left b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim f at_top (at_top_within {..<b}) = ((\<lambda>x. ereal (f x)) \<longlongrightarrow> \<infinity>) (at_left b)
[PROOF STEP]
unfolding filterlim_at_top_dense
    at_top_within_at_top_bounded_right'[OF assms(1)]
    eventually_at_left[OF assms(1)]
    tendsto_PInfty
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>Z. \<exists>ba<b. \<forall>y>ba. y < b \<longrightarrow> Z < f y) = (\<forall>r. \<exists>ba<b. \<forall>y>ba. y < b \<longrightarrow> ereal r < ereal (f y))
[PROOF STEP]
by auto


[STATEMENT]
lemma cyclic_on_orbit:
  assumes "f permutes S" "finite S" shows "cyclic_on f (orbit f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cyclic_on f (orbit f x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f permutes S
finite S

goal (1 subgoal):
 1. cyclic_on f (orbit f x)
[PROOF STEP]
by (intro cyclic_on_orbit') (auto simp: permutation_permutes)


[STATEMENT]
lemma dim_vec_mult_vec_mat [simp]: "dim_vec (v \<^sub>v* A) = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (v \<^sub>v* A) = dim_col A
[PROOF STEP]
unfolding mult_vec_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec (dim_col A) (\<lambda>j. v \<bullet> col A j)) = dim_col A
[PROOF STEP]
by simp


[STATEMENT]
lemma popular_differences_card:  fixes A::"'a set" and c::real
  assumes "finite A" and "A \<subseteq> G" and "additive_energy A = 2 * c"
  shows "card (popular_diff_set c A) \<ge> c * card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
(* typo in the notes, square must not be there *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
proof(cases "card A \<noteq> 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
assume hA: "card A \<noteq> 0"
[PROOF STATE]
proof (state)
this:
card A \<noteq> 0

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
have hc: "c \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> c
[PROOF STEP]
using assms additive_energy_def of_nat_0_le_iff
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> G
additive_energy A = 2 * c
additive_energy ?A \<equiv> real (card (additive_quadruple_set ?A)) / real (card ?A ^ 3)
(0::?'a) \<le> of_nat ?n

goal (1 subgoal):
 1. 0 \<le> c
[PROOF STEP]
by (smt (verit, best) assms(3) divide_nonneg_nonneg of_nat_0_le_iff)
[PROOF STATE]
proof (state)
this:
0 \<le> c

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
have "(2 * c) * (card A)^3 = (\<Sum>d \<in> (differenceset A A). (f_diff d A)^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * c * real (card A ^ 3) = real (\<Sum>d\<in>differenceset A A. (f_diff d A)\<^sup>2)
[PROOF STEP]
using assms f_diff_card_quadruple_set_additive_energy
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> G
additive_energy A = 2 * c
\<lbrakk>?A \<subseteq> G; finite ?A\<rbrakk> \<Longrightarrow> real (\<Sum>d\<in>differenceset ?A ?A. (f_diff d ?A)\<^sup>2) = additive_energy ?A * real (card ?A ^ 3)

goal (1 subgoal):
 1. 2 * c * real (card A ^ 3) = real (\<Sum>d\<in>differenceset A A. (f_diff d A)\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * c * real (card A ^ 3) = real (\<Sum>d\<in>differenceset A A. (f_diff d A)\<^sup>2)

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * c * real (card A ^ 3) = real (\<Sum>d\<in>differenceset A A. (f_diff d A)\<^sup>2)

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
have "...= ((\<Sum>d \<in> (popular_diff_set c A). (f_diff d A)^2))
    +((\<Sum> d \<in> ((differenceset A A) - (popular_diff_set c A)). (f_diff d A)^2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (\<Sum>d\<in>differenceset A A. (f_diff d A)\<^sup>2) = real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2))
[PROOF STEP]
using popular_diff_set_def assms finite_minusset finite_sumset
[PROOF STATE]
proof (prove)
using this:
popular_diff_set ?\<theta> ?A \<equiv> {d \<in> differenceset ?A ?A. popular_diff d ?\<theta> ?A}
finite A
A \<subseteq> G
additive_energy A = 2 * c
finite ?A \<Longrightarrow> finite (minusset ?A)
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (sumset ?A ?B)

goal (1 subgoal):
 1. real (\<Sum>d\<in>differenceset A A. (f_diff d A)\<^sup>2) = real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2))
[PROOF STEP]
by (metis (no_types, lifting)
      add.commute mem_Collect_eq subsetI sum.subset_diff)
[PROOF STATE]
proof (state)
this:
real (\<Sum>d\<in>differenceset A A. (f_diff d A)\<^sup>2) = real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2))

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (\<Sum>d\<in>differenceset A A. (f_diff d A)\<^sup>2) = real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2))

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
have "... \<le> ((card (popular_diff_set c A)) * (card A)^2)
    + c * card A * ((\<Sum>d \<in> (differenceset A A - (popular_diff_set c A)) . (f_diff d A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
have "\<forall> d \<in> ((differenceset A A) - (popular_diff_set c A)) . (f_diff d A)^2 \<le>
      (c * (card A)) * (f_diff d A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>d\<in>differenceset A A - popular_diff_set c A. real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>d. d \<in> differenceset A A - popular_diff_set c A \<Longrightarrow> real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)
[PROOF STEP]
fix d
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>d. d \<in> differenceset A A - popular_diff_set c A \<Longrightarrow> real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)
[PROOF STEP]
assume hd1: "d \<in> differenceset A A - popular_diff_set c A"
[PROOF STATE]
proof (state)
this:
d \<in> differenceset A A - popular_diff_set c A

goal (1 subgoal):
 1. \<And>d. d \<in> differenceset A A - popular_diff_set c A \<Longrightarrow> real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)
[PROOF STEP]
have hnonneg: "f_diff d A \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> f_diff d A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> f_diff d A

goal (1 subgoal):
 1. \<And>d. d \<in> differenceset A A - popular_diff_set c A \<Longrightarrow> real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)
[PROOF STEP]
have "\<not> popular_diff d c A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> popular_diff d c A
[PROOF STEP]
using hd1 popular_diff_set_def
[PROOF STATE]
proof (prove)
using this:
d \<in> differenceset A A - popular_diff_set c A
popular_diff_set ?\<theta> ?A \<equiv> {d \<in> differenceset ?A ?A. popular_diff d ?\<theta> ?A}

goal (1 subgoal):
 1. \<not> popular_diff d c A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> popular_diff d c A

goal (1 subgoal):
 1. \<And>d. d \<in> differenceset A A - popular_diff_set c A \<Longrightarrow> real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<not> popular_diff d c A
[PROOF STEP]
have "f_diff d A \<le> c * card A"
[PROOF STATE]
proof (prove)
using this:
\<not> popular_diff d c A

goal (1 subgoal):
 1. real (f_diff d A) \<le> c * real (card A)
[PROOF STEP]
using popular_diff_def
[PROOF STATE]
proof (prove)
using this:
\<not> popular_diff d c A
popular_diff ?d ?\<theta> ?A \<equiv> ?\<theta> * of_real (real (card ?A)) \<le> real (f_diff ?d ?A)

goal (1 subgoal):
 1. real (f_diff d A) \<le> c * real (card A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (f_diff d A) \<le> c * real (card A)

goal (1 subgoal):
 1. \<And>d. d \<in> differenceset A A - popular_diff_set c A \<Longrightarrow> real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)
[PROOF STEP]
thus "real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)"
[PROOF STATE]
proof (prove)
using this:
real (f_diff d A) \<le> c * real (card A)

goal (1 subgoal):
 1. real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)
[PROOF STEP]
using power2_eq_square hnonneg mult_right_mono of_nat_0 of_nat_le_iff of_nat_mult
[PROOF STATE]
proof (prove)
using this:
real (f_diff d A) \<le> c * real (card A)
?a\<^sup>2 = ?a * ?a
0 \<le> f_diff d A
\<lbrakk>?a \<le> ?b; (0::?'a) \<le> ?c\<rbrakk> \<Longrightarrow> ?a * ?c \<le> ?b * ?c
of_nat 0 = (0::?'a)
(of_nat ?m \<le> of_nat ?n) = (?m \<le> ?n)
of_nat (?m * ?n) = of_nat ?m * of_nat ?n

goal (1 subgoal):
 1. real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>d\<in>differenceset A A - popular_diff_set c A. real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)

goal (1 subgoal):
 1. real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>d\<in>differenceset A A - popular_diff_set c A. real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)

goal (1 subgoal):
 1. real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
have "\<forall> d \<in> (differenceset A A) . f_diff d A \<le> (card A)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>d\<in>differenceset A A. f_diff d A \<le> (card A)\<^sup>2
[PROOF STEP]
using f_diff_def finite_minusset finite_sumset assms
[PROOF STATE]
proof (prove)
using this:
f_diff ?d ?A \<equiv> card {(a, b) |a b. a \<in> ?A \<and> b \<in> ?A \<and> a \<ominus> b = ?d}
finite ?A \<Longrightarrow> finite (minusset ?A)
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (sumset ?A ?B)
finite A
A \<subseteq> G
additive_energy A = 2 * c

goal (1 subgoal):
 1. \<forall>d\<in>differenceset A A. f_diff d A \<le> (card A)\<^sup>2
[PROOF STEP]
by (metis f_diff_le_card le_antisym nat_le_linear power2_nat_le_imp_le)
[PROOF STATE]
proof (state)
this:
\<forall>d\<in>differenceset A A. f_diff d A \<le> (card A)\<^sup>2

goal (1 subgoal):
 1. real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>d\<in>differenceset A A - popular_diff_set c A. real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)
\<forall>d\<in>differenceset A A. f_diff d A \<le> (card A)\<^sup>2
[PROOF STEP]
have "((\<Sum>d \<in> ((differenceset A A) - popular_diff_set c A) . (f_diff d A)^2)) \<le>
     ((\<Sum>d \<in> ((differenceset A A) - popular_diff_set c A). (c * card A) * (f_diff d A)))"
[PROOF STATE]
proof (prove)
using this:
\<forall>d\<in>differenceset A A - popular_diff_set c A. real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)
\<forall>d\<in>differenceset A A. f_diff d A \<le> (card A)\<^sup>2

goal (1 subgoal):
 1. real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>differenceset A A - popular_diff_set c A. c * real (card A) * real (f_diff d A))
[PROOF STEP]
using assms finite_minusset finite_sumset sum_distrib_left sum_mono
[PROOF STATE]
proof (prove)
using this:
\<forall>d\<in>differenceset A A - popular_diff_set c A. real ((f_diff d A)\<^sup>2) \<le> c * real (card A) * real (f_diff d A)
\<forall>d\<in>differenceset A A. f_diff d A \<le> (card A)\<^sup>2
finite A
A \<subseteq> G
additive_energy A = 2 * c
finite ?A \<Longrightarrow> finite (minusset ?A)
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (sumset ?A ?B)
?r * sum ?f ?A = (\<Sum>n\<in>?A. ?r * ?f n)
(\<And>i. i \<in> ?K \<Longrightarrow> ?f i \<le> ?g i) \<Longrightarrow> sum ?f ?K \<le> sum ?g ?K

goal (1 subgoal):
 1. real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>differenceset A A - popular_diff_set c A. c * real (card A) * real (f_diff d A))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>differenceset A A - popular_diff_set c A. c * real (card A) * real (f_diff d A))

goal (1 subgoal):
 1. real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>differenceset A A - popular_diff_set c A. c * real (card A) * real (f_diff d A))
[PROOF STEP]
have "((\<Sum>d \<in> ((differenceset A A) - popular_diff_set c A) . (f_diff d A)^2)) \<le>
     (c * card A) * ((\<Sum>d \<in> ((differenceset A A) - popular_diff_set c A) . (f_diff d A)))"
[PROOF STATE]
proof (prove)
using this:
real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>differenceset A A - popular_diff_set c A. c * real (card A) * real (f_diff d A))

goal (1 subgoal):
 1. real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
by (metis (no_types) of_nat_sum sum_distrib_left)
[PROOF STATE]
proof (state)
this:
real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)

goal (1 subgoal):
 1. real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)

goal (1 subgoal):
 1. real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
have "(\<Sum>d \<in> popular_diff_set c A. (f_diff d A)^2) \<le>
    (\<Sum>d \<in> popular_diff_set c A. (card A)^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>popular_diff_set c A. (card A)\<^sup>2)
[PROOF STEP]
using f_diff_le_card assms sum_mono assms popular_diff_set_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; ?A \<subseteq> G\<rbrakk> \<Longrightarrow> f_diff ?d ?A \<le> card ?A
finite A
A \<subseteq> G
additive_energy A = 2 * c
(\<And>i. i \<in> ?K \<Longrightarrow> ?f i \<le> ?g i) \<Longrightarrow> sum ?f ?K \<le> sum ?g ?K
finite A
A \<subseteq> G
additive_energy A = 2 * c
popular_diff_set ?\<theta> ?A \<equiv> {d \<in> differenceset ?A ?A. popular_diff d ?\<theta> ?A}

goal (1 subgoal):
 1. (\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>popular_diff_set c A. (card A)\<^sup>2)
[PROOF STEP]
by (metis (no_types, lifting) power2_nat_le_eq_le)
[PROOF STATE]
proof (state)
this:
(\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>popular_diff_set c A. (card A)\<^sup>2)

goal (1 subgoal):
 1. real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>popular_diff_set c A. (card A)\<^sup>2)

goal (1 subgoal):
 1. real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>popular_diff_set c A. (card A)\<^sup>2)
[PROOF STEP]
have ddd: "(\<Sum>d \<in> popular_diff_set c A . (f_diff d A)^2) \<le>
    (card (popular_diff_set c A)) * (card A)^2"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>popular_diff_set c A. (card A)\<^sup>2)

goal (1 subgoal):
 1. (\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> card (popular_diff_set c A) * (card A)\<^sup>2
[PROOF STEP]
using sum_distrib_right
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>popular_diff_set c A. (card A)\<^sup>2)
sum ?f ?A * ?r = (\<Sum>n\<in>?A. ?f n * ?r)

goal (1 subgoal):
 1. (\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> card (popular_diff_set c A) * (card A)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> card (popular_diff_set c A) * (card A)\<^sup>2

goal (1 subgoal):
 1. real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
(\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>popular_diff_set c A. (card A)\<^sup>2)
(\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> card (popular_diff_set c A) * (card A)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
(\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> (\<Sum>d\<in>popular_diff_set c A. (card A)\<^sup>2)
(\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) \<le> card (popular_diff_set c A) * (card A)\<^sup>2

goal (1 subgoal):
 1. real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real ((\<Sum>d\<in>popular_diff_set c A. (f_diff d A)\<^sup>2) + (\<Sum>d\<in>differenceset A A - popular_diff_set c A. (f_diff d A)\<^sup>2)) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A)

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
have "...  \<le> ((card (popular_diff_set c A)) * (card A)^2) + (c * card A) * (card A)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)
[PROOF STEP]
have "(\<Sum>d \<in> (differenceset A A - popular_diff_set c A) . (f_diff d A)) \<le>
      (\<Sum>d \<in> differenceset A A . (f_diff d A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> (\<Sum>d\<in>differenceset A A. f_diff d A)
[PROOF STEP]
using DiffD1 subsetI assms sum_mono2
      finite_minusset finite_sumset zero_le
[PROOF STATE]
proof (prove)
using this:
?c \<in> ?A - ?B \<Longrightarrow> ?c \<in> ?A
(\<And>x. x \<in> ?A \<Longrightarrow> x \<in> ?B) \<Longrightarrow> ?A \<subseteq> ?B
finite A
A \<subseteq> G
additive_energy A = 2 * c
\<lbrakk>finite ?B; ?A \<subseteq> ?B; \<And>b. b \<in> ?B - ?A \<Longrightarrow> (0::?'a) \<le> ?f b\<rbrakk> \<Longrightarrow> sum ?f ?A \<le> sum ?f ?B
finite ?A \<Longrightarrow> finite (minusset ?A)
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (sumset ?A ?B)
(0::?'a) \<le> ?x

goal (1 subgoal):
 1. (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> (\<Sum>d\<in>differenceset A A. f_diff d A)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> (\<Sum>d\<in>differenceset A A. f_diff d A)

goal (1 subgoal):
 1. real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> (\<Sum>d\<in>differenceset A A. f_diff d A)
[PROOF STEP]
have "(c * card A) * ((\<Sum>d \<in> (differenceset A A - popular_diff_set c A). (f_diff d A)))
      \<le> (c * card A) * (card A)^2"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> (\<Sum>d\<in>differenceset A A. f_diff d A)

goal (1 subgoal):
 1. c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> c * real (card A) * real ((card A)\<^sup>2)
[PROOF STEP]
using f_diff_card hc le0 mult_left_mono of_nat_0 of_nat_mono zero_le_mult_iff assms
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> (\<Sum>d\<in>differenceset A A. f_diff d A)
\<lbrakk>?A \<subseteq> G; finite ?A\<rbrakk> \<Longrightarrow> (\<Sum>d\<in>differenceset ?A ?A. f_diff d ?A) = (card ?A)\<^sup>2
0 \<le> c
0 \<le> ?n
\<lbrakk>?a \<le> ?b; (0::?'a) \<le> ?c\<rbrakk> \<Longrightarrow> ?c * ?a \<le> ?c * ?b
of_nat 0 = (0::?'a)
?i \<le> ?j \<Longrightarrow> of_nat ?i \<le> of_nat ?j
((0::?'a) \<le> ?a * ?b) = ((0::?'a) \<le> ?a \<and> (0::?'a) \<le> ?b \<or> ?a \<le> (0::?'a) \<and> ?b \<le> (0::?'a))
finite A
A \<subseteq> G
additive_energy A = 2 * c

goal (1 subgoal):
 1. c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> c * real (card A) * real ((card A)\<^sup>2)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> c * real (card A) * real ((card A)\<^sup>2)

goal (1 subgoal):
 1. real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> c * real (card A) * real ((card A)\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> c * real (card A) * real ((card A)\<^sup>2)

goal (1 subgoal):
 1. real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real (\<Sum>d\<in>differenceset A A - popular_diff_set c A. f_diff d A) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 * c * real (card A ^ 3) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)
[PROOF STEP]
have "(2 * c) * (card A)^3  \<le> ((card (popular_diff_set c A)) * (card A)^2) +
    (c * card A) * (card A)^2"
[PROOF STATE]
proof (prove)
using this:
2 * c * real (card A ^ 3) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)

goal (1 subgoal):
 1. 2 * c * real (card A ^ 3) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
2 * c * real (card A ^ 3) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 * c * real (card A ^ 3) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)
[PROOF STEP]
have "(card (popular_diff_set c A)) \<ge>
    ((2 * c) * (card A)^3 - (c * card A) * (card A)^2)/((card A)^2)"
[PROOF STATE]
proof (prove)
using this:
2 * c * real (card A ^ 3) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)

goal (1 subgoal):
 1. (2 * c * real (card A ^ 3) - c * real (card A) * real ((card A)\<^sup>2)) / real ((card A)\<^sup>2) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
using hA
[PROOF STATE]
proof (prove)
using this:
2 * c * real (card A ^ 3) \<le> real (card (popular_diff_set c A) * (card A)\<^sup>2) + c * real (card A) * real ((card A)\<^sup>2)
card A \<noteq> 0

goal (1 subgoal):
 1. (2 * c * real (card A ^ 3) - c * real (card A) * real ((card A)\<^sup>2)) / real ((card A)\<^sup>2) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(2 * c * real (card A ^ 3) - c * real (card A) * real ((card A)\<^sup>2)) / real ((card A)\<^sup>2) \<le> real (card (popular_diff_set c A))

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(2 * c * real (card A ^ 3) - c * real (card A) * real ((card A)\<^sup>2)) / real ((card A)\<^sup>2) \<le> real (card (popular_diff_set c A))

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
have "((2 * c)* (card A)^3 - (c * card A) * (card A)^2)/((card A)^2) = 2 * c * card A - c * card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 * c * real (card A ^ 3) - c * real (card A) * real ((card A)\<^sup>2)) / real ((card A)\<^sup>2) = 2 * c * real (card A) - c * real (card A)
[PROOF STEP]
using hA
[PROOF STATE]
proof (prove)
using this:
card A \<noteq> 0

goal (1 subgoal):
 1. (2 * c * real (card A ^ 3) - c * real (card A) * real ((card A)\<^sup>2)) / real ((card A)\<^sup>2) = 2 * c * real (card A) - c * real (card A)
[PROOF STEP]
by (simp add: power2_eq_square power3_eq_cube)
[PROOF STATE]
proof (state)
this:
(2 * c * real (card A ^ 3) - c * real (card A) * real ((card A)\<^sup>2)) / real ((card A)\<^sup>2) = 2 * c * real (card A) - c * real (card A)

goal (2 subgoals):
 1. card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
 2. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(2 * c * real (card A ^ 3) - c * real (card A) * real ((card A)\<^sup>2)) / real ((card A)\<^sup>2) \<le> real (card (popular_diff_set c A))
(2 * c * real (card A ^ 3) - c * real (card A) * real ((card A)\<^sup>2)) / real ((card A)\<^sup>2) = 2 * c * real (card A) - c * real (card A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(2 * c * real (card A ^ 3) - c * real (card A) * real ((card A)\<^sup>2)) / real ((card A)\<^sup>2) \<le> real (card (popular_diff_set c A))
(2 * c * real (card A ^ 3) - c * real (card A) * real ((card A)\<^sup>2)) / real ((card A)\<^sup>2) = 2 * c * real (card A) - c * real (card A)

goal (1 subgoal):
 1. c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
c * real (card A) \<le> real (card (popular_diff_set c A))

goal (1 subgoal):
 1. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
assume "\<not> card A \<noteq> 0"
[PROOF STATE]
proof (state)
this:
\<not> card A \<noteq> 0

goal (1 subgoal):
 1. \<not> card A \<noteq> 0 \<Longrightarrow> c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> card A \<noteq> 0

goal (1 subgoal):
 1. c * real (card A) \<le> real (card (popular_diff_set c A))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c * real (card A) \<le> real (card (popular_diff_set c A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma transp_eq_transp_on: "transp = transp_on UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transp = transp_on UNIV
[PROOF STEP]
unfolding transp_def transp_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>r. \<forall>x y z. r x y \<longrightarrow> r y z \<longrightarrow> r x z) = (\<lambda>r. \<forall>x\<in>UNIV. \<forall>y\<in>UNIV. \<forall>z\<in>UNIV. r x y \<longrightarrow> r y z \<longrightarrow> r x z)
[PROOF STEP]
by simp