[STATEMENT]
lemma finsum_val_ultrametric:
  assumes "g \<in> A \<rightarrow> carrier Q\<^sub>p"
  assumes "finite A"
  assumes "A \<noteq> {}"
  shows " val (finsum Q\<^sub>p g A) \<ge> Min (val ` (g`A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
[PROOF STEP]
have "A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> val (finsum Q\<^sub>p g A) \<ge> Min (val ` (g`A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
[PROOF STEP]
apply(rule finite.induct[of A])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite A
 2. {} \<noteq> {} \<and> g \<in> {} \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` {}) \<le> val (finsum Q\<^sub>p g {})
 3. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)\<rbrakk> \<Longrightarrow> insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
apply (simp add: assms(2))
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {} \<noteq> {} \<and> g \<in> {} \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` {}) \<le> val (finsum Q\<^sub>p g {})
 2. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)\<rbrakk> \<Longrightarrow> insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)\<rbrakk> \<Longrightarrow> insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A); insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
fix A a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A); insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
assume A: "finite A" "A \<noteq> {}\<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> val (finsum Q\<^sub>p g A) \<ge> Min (val ` g ` A)"
                          " insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p "
[PROOF STATE]
proof (state)
this:
finite A
A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A); insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
show "val (finsum Q\<^sub>p g (insert a A)) \<ge> Min (val ` g ` insert a A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
apply(cases "a \<in> A")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<in> A \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
 2. a \<notin> A \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
apply (metis A(2) A(3) insert_absorb)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<notin> A \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
proof(cases "A = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>a \<notin> A; A = {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
 2. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
have g_closed: "g \<in> A \<rightarrow> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<in> A \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
using A(3)
[PROOF STATE]
proof (prove)
using this:
insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. g \<in> A \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g \<in> A \<rightarrow> carrier Q\<^sub>p

goal (2 subgoals):
 1. \<lbrakk>a \<notin> A; A = {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
 2. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
have g_closed': "g \<in> insert a A \<rightarrow> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<in> insert a A \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
using A(3)
[PROOF STATE]
proof (prove)
using this:
insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. g \<in> insert a A \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
g \<in> insert a A \<rightarrow> carrier Q\<^sub>p

goal (2 subgoals):
 1. \<lbrakk>a \<notin> A; A = {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
 2. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<in> insert a A \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
have ga: "g a \<in> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
using this:
g \<in> insert a A \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. g a \<in> carrier Q\<^sub>p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g a \<in> carrier Q\<^sub>p

goal (2 subgoals):
 1. \<lbrakk>a \<notin> A; A = {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
 2. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
assume a_notin: "a \<notin> A"
[PROOF STATE]
proof (state)
this:
a \<notin> A

goal (2 subgoals):
 1. \<lbrakk>a \<notin> A; A = {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
 2. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A = {}

goal (2 subgoals):
 1. \<lbrakk>a \<notin> A; A = {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
 2. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
have "g a \<in> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g a \<in> carrier Q\<^sub>p
[PROOF STEP]
using A(3)
[PROOF STATE]
proof (prove)
using this:
insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. g a \<in> carrier Q\<^sub>p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g a \<in> carrier Q\<^sub>p

goal (2 subgoals):
 1. \<lbrakk>a \<notin> A; A = {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
 2. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g a \<in> carrier Q\<^sub>p
[PROOF STEP]
have 0: "(finsum Q\<^sub>p g (insert a A)) = g a"
[PROOF STATE]
proof (prove)
using this:
g a \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. finsum Q\<^sub>p g (insert a A) = g a
[PROOF STEP]
using A True abelian_monoid.finsum_insert[of Q\<^sub>p A a g]  abelian_monoid.finsum_empty[of Q\<^sub>p g]
              Qp.abelian_monoid_axioms Qp.add.l_cancel_one Qp.zero_closed a_notin g_closed
[PROOF STATE]
proof (prove)
using this:
g a \<in> carrier Q\<^sub>p
finite A
A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p
A = {}
\<lbrakk>abelian_monoid Q\<^sub>p; finite A; a \<notin> A; g \<in> A \<rightarrow> carrier Q\<^sub>p; g a \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> finsum Q\<^sub>p g (insert a A) = g a \<oplus> finsum Q\<^sub>p g A
abelian_monoid Q\<^sub>p \<Longrightarrow> finsum Q\<^sub>p g {} = \<zero>
abelian_monoid Q\<^sub>p
\<lbrakk>?x \<in> carrier Q\<^sub>p; ?a \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> (?x \<oplus> ?a = ?x) = (?a = \<zero>)
\<zero> \<in> carrier Q\<^sub>p
a \<notin> A
g \<in> A \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. finsum Q\<^sub>p g (insert a A) = g a
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
finsum Q\<^sub>p g (insert a A) = g a

goal (2 subgoals):
 1. \<lbrakk>a \<notin> A; A = {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
 2. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
have 1: "Min (val ` g ` insert a A) = val (g a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min (val ` g ` insert a A) = val (g a)
[PROOF STEP]
by (metis A(1) True Min_in finite.insertI finite_imageI image_empty
            image_insert insert_not_empty singletonD)
[PROOF STATE]
proof (state)
this:
Min (val ` g ` insert a A) = val (g a)

goal (2 subgoals):
 1. \<lbrakk>a \<notin> A; A = {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
 2. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
using 0 1
[PROOF STATE]
proof (prove)
using this:
finsum Q\<^sub>p g (insert a A) = g a
Min (val ` g ` insert a A) = val (g a)

goal (1 subgoal):
 1. Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))

goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
assume a_notin: "a \<notin> A"
[PROOF STATE]
proof (state)
this:
a \<notin> A

goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
have g_closed: "g \<in> A \<rightarrow> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<in> A \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
using A(3)
[PROOF STATE]
proof (prove)
using this:
insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. g \<in> A \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g \<in> A \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
have g_closed': "g \<in> insert a A \<rightarrow> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<in> insert a A \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
using A(3)
[PROOF STATE]
proof (prove)
using this:
insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. g \<in> insert a A \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
g \<in> insert a A \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<in> insert a A \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
have ga: "g a \<in> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
using this:
g \<in> insert a A \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. g a \<in> carrier Q\<^sub>p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g a \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
have 0: "finsum Q\<^sub>p g (insert a A) = g a \<oplus> finsum Q\<^sub>p g A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum Q\<^sub>p g (insert a A) = g a \<oplus> finsum Q\<^sub>p g A
[PROOF STEP]
by (simp add: A(1) a_notin g_closed ga)
[PROOF STATE]
proof (state)
this:
finsum Q\<^sub>p g (insert a A) = g a \<oplus> finsum Q\<^sub>p g A

goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
have 1: "min (val (g a)) (Min (val ` g ` A)) = Min (insert (val (g a)) (val ` g ` A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (val (g a)) (Min (val ` g ` A)) = Min (insert (val (g a)) (val ` g ` A))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. min (val (g a)) (Min (val ` g ` A)) = Min (insert (val (g a)) (val ` g ` A))
[PROOF STEP]
have 10: "finite (val ` g ` A) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (val ` g ` A)
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. finite (val ` g ` A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (val ` g ` A)

goal (1 subgoal):
 1. min (val (g a)) (Min (val ` g ` A)) = Min (insert (val (g a)) (val ` g ` A))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (val ` g ` A)
[PROOF STEP]
have 11: "val ` g ` A \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
finite (val ` g ` A)

goal (1 subgoal):
 1. val ` g ` A \<noteq> {}
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
finite (val ` g ` A)
A \<noteq> {}

goal (1 subgoal):
 1. val ` g ` A \<noteq> {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
val ` g ` A \<noteq> {}

goal (1 subgoal):
 1. min (val (g a)) (Min (val ` g ` A)) = Min (insert (val (g a)) (val ` g ` A))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (val (g a)) (Min (val ` g ` A)) = Min (insert (val (g a)) (val ` g ` A))
[PROOF STEP]
using  10 11 Min_insert
[PROOF STATE]
proof (prove)
using this:
finite (val ` g ` A)
val ` g ` A \<noteq> {}
\<lbrakk>finite ?A; ?A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (insert ?x ?A) = min ?x (Min ?A)

goal (1 subgoal):
 1. min (val (g a)) (Min (val ` g ` A)) = Min (insert (val (g a)) (val ` g ` A))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
min (val (g a)) (Min (val ` g ` A)) = Min (insert (val (g a)) (val ` g ` A))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
min (val (g a)) (Min (val ` g ` A)) = Min (insert (val (g a)) (val ` g ` A))

goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
have 2: " val (g a \<oplus> finsum Q\<^sub>p g A) \<ge> min (val (g a)) (val (finsum Q\<^sub>p g A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (val (g a)) (val (finsum Q\<^sub>p g A)) \<le> val (g a \<oplus> finsum Q\<^sub>p g A)
[PROOF STEP]
using val_ultrametric[of "g a" "finsum Q\<^sub>p g A" ] abelian_monoid.finsum_closed[of Q\<^sub>p g A]
              g_closed ga  Qp.abelian_monoid_axioms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>g a \<in> carrier Q\<^sub>p; finsum Q\<^sub>p g A \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> min (val (g a)) (val (finsum Q\<^sub>p g A)) \<le> val (g a \<oplus> finsum Q\<^sub>p g A)
\<lbrakk>abelian_monoid Q\<^sub>p; g \<in> A \<rightarrow> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> finsum Q\<^sub>p g A \<in> carrier Q\<^sub>p
g \<in> A \<rightarrow> carrier Q\<^sub>p
g a \<in> carrier Q\<^sub>p
abelian_monoid Q\<^sub>p

goal (1 subgoal):
 1. min (val (g a)) (val (finsum Q\<^sub>p g A)) \<le> val (g a \<oplus> finsum Q\<^sub>p g A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
min (val (g a)) (val (finsum Q\<^sub>p g A)) \<le> val (g a \<oplus> finsum Q\<^sub>p g A)

goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
have 3: " val (finsum Q\<^sub>p g A) \<ge> Min (val ` g ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
[PROOF STEP]
using A False
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
insert a A \<noteq> {} \<and> g \<in> insert a A \<rightarrow> carrier Q\<^sub>p
A \<noteq> {}

goal (1 subgoal):
 1. Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)

goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
have 4: " val (finsum Q\<^sub>p g (insert a A)) \<ge>  min (val (g a)) (val (finsum Q\<^sub>p g A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (val (g a)) (val (finsum Q\<^sub>p g A)) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
using 2 "0"
[PROOF STATE]
proof (prove)
using this:
min (val (g a)) (val (finsum Q\<^sub>p g A)) \<le> val (g a \<oplus> finsum Q\<^sub>p g A)
finsum Q\<^sub>p g (insert a A) = g a \<oplus> finsum Q\<^sub>p g A

goal (1 subgoal):
 1. min (val (g a)) (val (finsum Q\<^sub>p g A)) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
min (val (g a)) (val (finsum Q\<^sub>p g A)) \<le> val (finsum Q\<^sub>p g (insert a A))

goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
have 5: " val (finsum Q\<^sub>p g A) \<ge> Min (val ` g ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
[PROOF STEP]
using False "3"
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}
Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)

goal (1 subgoal):
 1. Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)

goal (1 subgoal):
 1. \<lbrakk>a \<notin> A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
show " val (finsum Q\<^sub>p g (insert a A)) \<ge> Min (val ` g ` insert a A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
using 5 4 1
[PROOF STATE]
proof (prove)
using this:
Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
min (val (g a)) (val (finsum Q\<^sub>p g A)) \<le> val (finsum Q\<^sub>p g (insert a A))
min (val (g a)) (Min (val ` g ` A)) = Min (insert (val (g a)) (val ` g ` A))

goal (1 subgoal):
 1. Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))
[PROOF STEP]
by (smt image_insert min.cobounded1 min_def order_trans)
[PROOF STATE]
proof (state)
this:
Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Min (val ` g ` insert a A) \<le> val (finsum Q\<^sub>p g (insert a A))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)

goal (1 subgoal):
 1. Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)

goal (1 subgoal):
 1. Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {} \<and> g \<in> A \<rightarrow> carrier Q\<^sub>p \<longrightarrow> Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
g \<in> A \<rightarrow> carrier Q\<^sub>p
finite A
A \<noteq> {}

goal (1 subgoal):
 1. Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Min (val ` g ` A) \<le> val (finsum Q\<^sub>p g A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exists_diff:
  fixes P :: "'a set \<Rightarrow> bool"
  shows "(\<exists>S. P (- S)) \<longleftrightarrow> (\<exists>S. P S)"
    (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>S. P (- S)) = (\<exists>S. P S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>S. P (- S)) = (\<exists>S. P S)
[PROOF STEP]
have ?rhs if ?lhs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>S. P S
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<exists>S. P (- S)

goal (1 subgoal):
 1. \<exists>S. P S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>S. P (- S) \<Longrightarrow> \<exists>S. P S

goal (1 subgoal):
 1. (\<exists>S. P (- S)) = (\<exists>S. P S)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>S. P (- S) \<Longrightarrow> \<exists>S. P S

goal (1 subgoal):
 1. (\<exists>S. P (- S)) = (\<exists>S. P S)
[PROOF STEP]
have "P (- (- S))" if "P S" for S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (- (- S))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P (- (- S))
[PROOF STEP]
have "S = - (- S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = - (- S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
S = - (- S)

goal (1 subgoal):
 1. P (- (- S))
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
P S
S = - (- S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
P S
S = - (- S)

goal (1 subgoal):
 1. P (- (- S))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
P (- (- S))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P ?S \<Longrightarrow> P (- (- ?S))

goal (1 subgoal):
 1. (\<exists>S. P (- S)) = (\<exists>S. P S)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<exists>S. P (- S) \<Longrightarrow> \<exists>S. P S
P ?S \<Longrightarrow> P (- (- ?S))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>S. P (- S) \<Longrightarrow> \<exists>S. P S
P ?S \<Longrightarrow> P (- (- ?S))

goal (1 subgoal):
 1. (\<exists>S. P (- S)) = (\<exists>S. P S)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(\<exists>S. P (- S)) = (\<exists>S. P S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trees_of_size_0 [simp]: "trees_of_size 0 = {Leaf}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trees_of_size 0 = {Leaf}
[PROOF STEP]
by (simp add: trees_of_size_def)


[STATEMENT]
lemma is_inf_minimum: "is_inf x y (minimum x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_inf x y (minimum x y)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. minimum x y \<sqsubseteq> x
 2. minimum x y \<sqsubseteq> y
 3. \<And>z. \<lbrakk>z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> minimum x y
[PROOF STEP]
let ?min = "minimum x y"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. minimum x y \<sqsubseteq> x
 2. minimum x y \<sqsubseteq> y
 3. \<And>z. \<lbrakk>z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> minimum x y
[PROOF STEP]
from leq_linear
[PROOF STATE]
proof (chain)
picking this:
?x \<sqsubseteq> ?y \<or> ?y \<sqsubseteq> ?x
[PROOF STEP]
show "?min \<sqsubseteq> x"
[PROOF STATE]
proof (prove)
using this:
?x \<sqsubseteq> ?y \<or> ?y \<sqsubseteq> ?x

goal (1 subgoal):
 1. minimum x y \<sqsubseteq> x
[PROOF STEP]
by (auto simp add: minimum_def)
[PROOF STATE]
proof (state)
this:
minimum x y \<sqsubseteq> x

goal (2 subgoals):
 1. minimum x y \<sqsubseteq> y
 2. \<And>z. \<lbrakk>z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> minimum x y
[PROOF STEP]
from leq_linear
[PROOF STATE]
proof (chain)
picking this:
?x \<sqsubseteq> ?y \<or> ?y \<sqsubseteq> ?x
[PROOF STEP]
show "?min \<sqsubseteq> y"
[PROOF STATE]
proof (prove)
using this:
?x \<sqsubseteq> ?y \<or> ?y \<sqsubseteq> ?x

goal (1 subgoal):
 1. minimum x y \<sqsubseteq> y
[PROOF STEP]
by (auto simp add: minimum_def)
[PROOF STATE]
proof (state)
this:
minimum x y \<sqsubseteq> y

goal (1 subgoal):
 1. \<And>z. \<lbrakk>z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> minimum x y
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>z. \<lbrakk>z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> minimum x y
[PROOF STEP]
assume "z \<sqsubseteq> x" and "z \<sqsubseteq> y"
[PROOF STATE]
proof (state)
this:
z \<sqsubseteq> x
z \<sqsubseteq> y

goal (1 subgoal):
 1. \<And>z. \<lbrakk>z \<sqsubseteq> x; z \<sqsubseteq> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> minimum x y
[PROOF STEP]
with leq_linear
[PROOF STATE]
proof (chain)
picking this:
?x \<sqsubseteq> ?y \<or> ?y \<sqsubseteq> ?x
z \<sqsubseteq> x
z \<sqsubseteq> y
[PROOF STEP]
show "z \<sqsubseteq> ?min"
[PROOF STATE]
proof (prove)
using this:
?x \<sqsubseteq> ?y \<or> ?y \<sqsubseteq> ?x
z \<sqsubseteq> x
z \<sqsubseteq> y

goal (1 subgoal):
 1. z \<sqsubseteq> minimum x y
[PROOF STEP]
by (auto simp add: minimum_def)
[PROOF STATE]
proof (state)
this:
z \<sqsubseteq> minimum x y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  repeatAmountOfQuantifiers_eval :
  assumes  "\<And>xs F. eval F xs = eval (step F) xs"
  shows  "eval F xs = eval (repeatAmountOfQuantifiers step F) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval F xs = eval (repeatAmountOfQuantifiers step F) xs
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval F xs = eval (repeatAmountOfQuantifiers step F) xs
[PROOF STEP]
define F' where "F' = step F"
[PROOF STATE]
proof (state)
this:
F' = step F

goal (1 subgoal):
 1. eval F xs = eval (repeatAmountOfQuantifiers step F) xs
[PROOF STEP]
have h:  "eval F xs = eval F' xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval F xs = eval F' xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
eval ?F ?xs = eval (step ?F) ?xs

goal (1 subgoal):
 1. eval F xs = eval F' xs
[PROOF STEP]
unfolding F'_def
[PROOF STATE]
proof (prove)
using this:
eval ?F ?xs = eval (step ?F) ?xs

goal (1 subgoal):
 1. eval F xs = eval (step F) xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
eval F xs = eval F' xs

goal (1 subgoal):
 1. eval F xs = eval (repeatAmountOfQuantifiers step F) xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval F xs = eval (repeatAmountOfQuantifiers step F) xs
[PROOF STEP]
apply (simp add: F'_def[symmetric] h)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval F' xs = eval (repeatAmountOfQuantifiers_helper step (countQuantifiers F') F') xs
[PROOF STEP]
using repeatAmountOfQuantifiers_helper_eval[OF assms]
[PROOF STATE]
proof (prove)
using this:
eval ?F ?xs = eval (repeatAmountOfQuantifiers_helper step ?n ?F) ?xs

goal (1 subgoal):
 1. eval F' xs = eval (repeatAmountOfQuantifiers_helper step (countQuantifiers F') F') xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
eval F xs = eval (repeatAmountOfQuantifiers step F) xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma disjoint_family_imp_on:
  assumes "disjoint_family A"
  shows "disjoint_family_on A S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint_family_on A S
[PROOF STEP]
using assms disjoint_family_on_mono subset_UNIV
[PROOF STATE]
proof (prove)
using this:
disjoint_family A
\<lbrakk>?A \<subseteq> ?B; disjoint_family_on ?f ?B\<rbrakk> \<Longrightarrow> disjoint_family_on ?f ?A
?A \<subseteq> UNIV

goal (1 subgoal):
 1. disjoint_family_on A S
[PROOF STEP]
by blast


[STATEMENT]
lemma butlast_append_Cons[simp]: "butlast (xs @ y # ys) = xs @ butlast (y # ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butlast (xs @ y # ys) = xs @ butlast (y # ys)
[PROOF STEP]
using butlast_append[of xs "y # ys", simplified]
[PROOF STATE]
proof (prove)
using this:
butlast (xs @ y # ys) = xs @ (if ys = [] then [] else y # butlast ys)

goal (1 subgoal):
 1. butlast (xs @ y # ys) = xs @ butlast (y # ys)
[PROOF STEP]
by simp


[STATEMENT]
lemma coplanar_perm_12:
  assumes "Coplanar A B C D"
  shows "Coplanar C A B D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar C A B D
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Coplanar C A B D
[PROOF STEP]
obtain X where P1: "(Col A B X \<and> Col C D X) \<or> (Col A C X \<and> Col B D X) \<or> (Col A D X \<and> Col B C X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Coplanar_def assms
[PROOF STATE]
proof (prove)
using this:
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Coplanar A B C D

goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar C A B D
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar C A B D
[PROOF STEP]
using Coplanar_def col_permutation_4
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Col ?A ?B ?C \<Longrightarrow> Col ?B ?A ?C

goal (1 subgoal):
 1. Coplanar C A B D
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Coplanar C A B D

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma separation_normal:
  fixes S :: "'a::euclidean_space set"
  assumes "closed S" "closed T" "S \<inter> T = {}"
  obtains U V where "open U" "open V" "S \<subseteq> U" "T \<subseteq> V" "U \<inter> V = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>U V. \<lbrakk>open U; open V; S \<subseteq> U; T \<subseteq> V; U \<inter> V = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using separation_closures [of S T]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>S \<inter> closure T = {}; T \<inter> closure S = {}; \<And>U V. \<lbrakk>U \<inter> V = {}; open U; open V; S \<subseteq> U; T \<subseteq> V\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>U V. \<lbrakk>open U; open V; S \<subseteq> U; T \<subseteq> V; U \<inter> V = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis assms closure_closed disjnt_def inf_commute)


[STATEMENT]
lemma sgn_real_mono: "x \<le> y \<Longrightarrow> sgn x \<le> sgn (y :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> sgn x \<le> sgn y
[PROOF STEP]
unfolding sgn_real_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> (if x = 0 then 0 else if 0 < x then 1 else - 1) \<le> (if y = 0 then 0 else if 0 < y then 1 else - 1)
[PROOF STEP]
by (auto split: if_splits)


[STATEMENT]
lemma lex_simps [simp]:
  fixes xs ys :: "nat list"
  shows "[] \<sqsubset>lex ys \<longleftrightarrow> ys \<noteq> []"
  and   "xs \<sqsubset>lex [] \<longleftrightarrow> False"
  and   "(x # xs) \<sqsubset>lex (y # ys) \<longleftrightarrow> (x < y \<or> (x = y \<and> xs \<sqsubset>lex ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [] \<sqsubset>lex ys = (ys \<noteq> []) &&& xs \<sqsubset>lex [] = False &&& x # xs \<sqsubset>lex y # ys = (x < y \<or> x = y \<and> xs \<sqsubset>lex ys)
[PROOF STEP]
by (auto simp add: neq_Nil_conv elim: lex_list.cases intro: lex_list.intros)


[STATEMENT]
lemma null_space_orthogonal_complement_row_space:
  fixes A::"real^'cols^'rows::{finite,wellorder}"
  shows "null_space A = orthogonal_complement (row_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. null_space A = orthogonal_complement (row_space A)
[PROOF STEP]
proof (unfold null_space_def orthogonal_complement_def, auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x xa. \<lbrakk>A *v x = 0; xa \<in> row_space A\<rbrakk> \<Longrightarrow> orthogonal x xa
 2. \<And>x. \<forall>xa\<in>row_space A. orthogonal x xa \<Longrightarrow> A *v x = 0
[PROOF STEP]
fix x xa
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x xa. \<lbrakk>A *v x = 0; xa \<in> row_space A\<rbrakk> \<Longrightarrow> orthogonal x xa
 2. \<And>x. \<forall>xa\<in>row_space A. orthogonal x xa \<Longrightarrow> A *v x = 0
[PROOF STEP]
assume Ax: "A *v x = 0" and xa: "xa \<in> row_space A"
[PROOF STATE]
proof (state)
this:
A *v x = 0
xa \<in> row_space A

goal (2 subgoals):
 1. \<And>x xa. \<lbrakk>A *v x = 0; xa \<in> row_space A\<rbrakk> \<Longrightarrow> orthogonal x xa
 2. \<And>x. \<forall>xa\<in>row_space A. orthogonal x xa \<Longrightarrow> A *v x = 0
[PROOF STEP]
obtain y where y: "xa = transpose A *v y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y. xa = Finite_Cartesian_Product.transpose A *v y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using xa
[PROOF STATE]
proof (prove)
using this:
xa \<in> row_space A

goal (1 subgoal):
 1. (\<And>y. xa = Finite_Cartesian_Product.transpose A *v y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding row_space_eq
[PROOF STATE]
proof (prove)
using this:
xa \<in> {w. \<exists>y. Finite_Cartesian_Product.transpose A *v y = w}

goal (1 subgoal):
 1. (\<And>y. xa = Finite_Cartesian_Product.transpose A *v y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
xa = Finite_Cartesian_Product.transpose A *v y

goal (2 subgoals):
 1. \<And>x xa. \<lbrakk>A *v x = 0; xa \<in> row_space A\<rbrakk> \<Longrightarrow> orthogonal x xa
 2. \<And>x. \<forall>xa\<in>row_space A. orthogonal x xa \<Longrightarrow> A *v x = 0
[PROOF STEP]
have "y v* A = xa"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y v* A = xa
[PROOF STEP]
using transpose_vector y
[PROOF STATE]
proof (prove)
using this:
?x v* ?A = Finite_Cartesian_Product.transpose ?A *v ?x
xa = Finite_Cartesian_Product.transpose A *v y

goal (1 subgoal):
 1. y v* A = xa
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
y v* A = xa

goal (2 subgoals):
 1. \<And>x xa. \<lbrakk>A *v x = 0; xa \<in> row_space A\<rbrakk> \<Longrightarrow> orthogonal x xa
 2. \<And>x. \<forall>xa\<in>row_space A. orthogonal x xa \<Longrightarrow> A *v x = 0
[PROOF STEP]
thus "orthogonal x xa"
[PROOF STATE]
proof (prove)
using this:
y v* A = xa

goal (1 subgoal):
 1. orthogonal x xa
[PROOF STEP]
unfolding orthogonal_def
[PROOF STATE]
proof (prove)
using this:
y v* A = xa

goal (1 subgoal):
 1. x \<bullet> xa = 0
[PROOF STEP]
using Ax dot_lmul_matrix inner_commute inner_zero_right
[PROOF STATE]
proof (prove)
using this:
y v* A = xa
A *v x = 0
(?x v* ?A) \<bullet> ?y = ?x \<bullet> (?A *v ?y)
?x \<bullet> ?y = ?y \<bullet> ?x
?x \<bullet> (0::?'a) = 0

goal (1 subgoal):
 1. x \<bullet> xa = 0
[PROOF STEP]
by (metis Ax dot_lmul_matrix inner_commute inner_zero_right)
[PROOF STATE]
proof (state)
this:
orthogonal x xa

goal (1 subgoal):
 1. \<And>x. \<forall>xa\<in>row_space A. orthogonal x xa \<Longrightarrow> A *v x = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<forall>xa\<in>row_space A. orthogonal x xa \<Longrightarrow> A *v x = 0
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<forall>xa\<in>row_space A. orthogonal x xa \<Longrightarrow> A *v x = 0
[PROOF STEP]
assume xa: "\<forall>xa\<in>row_space A. orthogonal x xa"
[PROOF STATE]
proof (state)
this:
\<forall>xa\<in>row_space A. orthogonal x xa

goal (1 subgoal):
 1. \<And>x. \<forall>xa\<in>row_space A. orthogonal x xa \<Longrightarrow> A *v x = 0
[PROOF STEP]
show "A *v x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v x = 0
[PROOF STEP]
using xa
[PROOF STATE]
proof (prove)
using this:
\<forall>xa\<in>row_space A. orthogonal x xa

goal (1 subgoal):
 1. A *v x = 0
[PROOF STEP]
unfolding row_space_eq orthogonal_def
[PROOF STATE]
proof (prove)
using this:
\<forall>xa\<in>{w. \<exists>y. Finite_Cartesian_Product.transpose A *v y = w}. x \<bullet> xa = 0

goal (1 subgoal):
 1. A *v x = 0
[PROOF STEP]
by (auto, metis transpose_transpose dot_lmul_matrix inner_eq_zero_iff transpose_vector)
[PROOF STATE]
proof (state)
this:
A *v x = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in aGroup) ag_neq_diffnonzero:"\<lbrakk>a \<in> carrier A; b \<in> carrier A\<rbrakk> \<Longrightarrow>
         (a \<noteq> b) = (a \<plusminus> (-\<^sub>a b) \<noteq>  \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; b \<in> carrier A\<rbrakk> \<Longrightarrow> (a \<noteq> b) = (a \<plusminus> -\<^sub>a b \<noteq> \<zero>)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<in> carrier A; b \<in> carrier A; a \<noteq> b\<rbrakk> \<Longrightarrow> a \<plusminus> -\<^sub>a b \<noteq> \<zero>
 2. \<lbrakk>a \<in> carrier A; b \<in> carrier A; a \<plusminus> -\<^sub>a b \<noteq> \<zero>\<rbrakk> \<Longrightarrow> a \<noteq> b
[PROOF STEP]
apply (rule contrapos_pp, simp+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<in> carrier A; b \<in> carrier A; a \<noteq> b; a \<plusminus> -\<^sub>a b = \<zero>\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>a \<in> carrier A; b \<in> carrier A; a \<plusminus> -\<^sub>a b \<noteq> \<zero>\<rbrakk> \<Longrightarrow> a \<noteq> b
[PROOF STEP]
apply (simp add:ag_eq_diffzero[THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; b \<in> carrier A; a \<plusminus> -\<^sub>a b \<noteq> \<zero>\<rbrakk> \<Longrightarrow> a \<noteq> b
[PROOF STEP]
apply (rule contrapos_pp, simp+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b \<in> carrier A; b \<plusminus> -\<^sub>a b \<noteq> \<zero>; a = b\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (simp add:ag_r_inv1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma matrix_to_iarray_Gram_Schmidt_matrix[code_unfold]:
  fixes A::"real^'cols::{mod_type}^'rows::{mod_type}"
  shows "matrix_to_iarray (Gram_Schmidt_matrix A) = Gram_Schmidt_matrix_iarrays (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_matrix A) = Gram_Schmidt_matrix_iarrays (matrix_to_iarray A)
[PROOF STEP]
unfolding Gram_Schmidt_matrix_def Gram_Schmidt_matrix_iarrays_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A (ncols A - 1)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (ncols_iarray (matrix_to_iarray A) - 1)
[PROOF STEP]
unfolding matrix_to_iarray_ncols[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A (ncols A - 1)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (ncols A - 1)
[PROOF STEP]
by (rule matrix_to_iarray_Gram_Schmidt_upt_k, simp add: ncols_def)


[STATEMENT]
lemma negligible_powrI [negligible_intros]:
  assumes "0 \<le> k" "k < 1"
  shows "negligible (\<lambda>x. k powr x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. negligible (\<lambda>x. k powr real x)
[PROOF STEP]
proof(cases "k = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = 0 \<Longrightarrow> negligible (\<lambda>x. k powr real x)
 2. k \<noteq> 0 \<Longrightarrow> negligible (\<lambda>x. k powr real x)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
k = 0

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> negligible (\<lambda>x. k powr real x)
 2. k \<noteq> 0 \<Longrightarrow> negligible (\<lambda>x. k powr real x)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
k = 0

goal (1 subgoal):
 1. negligible (\<lambda>x. k powr real x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
negligible (\<lambda>x. k powr real x)

goal (1 subgoal):
 1. k \<noteq> 0 \<Longrightarrow> negligible (\<lambda>x. k powr real x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k \<noteq> 0 \<Longrightarrow> negligible (\<lambda>x. k powr real x)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
k \<noteq> 0

goal (1 subgoal):
 1. k \<noteq> 0 \<Longrightarrow> negligible (\<lambda>x. k powr real x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. negligible (\<lambda>x. k powr real x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> (\<lambda>x. k powr real x) \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
fix c :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> (\<lambda>x. k powr real x) \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
assume "0 < c"
[PROOF STATE]
proof (state)
this:
0 < c

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> (\<lambda>x. k powr real x) \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < c
[PROOF STEP]
have "(\<lambda>x. real x powr c) \<in> o(\<lambda>x. inverse k powr real x)"
[PROOF STATE]
proof (prove)
using this:
0 < c

goal (1 subgoal):
 1. (\<lambda>x. real x powr c) \<in> o(\<lambda>x. inverse k powr real x)
[PROOF STEP]
using assms False
[PROOF STATE]
proof (prove)
using this:
0 < c
0 \<le> k
k < 1
k \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>x. real x powr c) \<in> o(\<lambda>x. inverse k powr real x)
[PROOF STEP]
by(intro powr_fast_growth_tendsto)(simp_all add: one_less_inverse_iff filterlim_real_sequentially)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real x powr c) \<in> o(\<lambda>x. inverse k powr real x)

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> (\<lambda>x. k powr real x) \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. real x powr c) \<in> o(\<lambda>x. inverse k powr real x)
[PROOF STEP]
have "(\<lambda>x. inverse (k powr - real x)) \<in> o(\<lambda>x. inverse (real x powr c))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. real x powr c) \<in> o(\<lambda>x. inverse k powr real x)

goal (1 subgoal):
 1. (\<lambda>x. inverse (k powr - real x)) \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. real x powr c) \<in> o(\<lambda>x. inverse k powr real x)
0 \<le> k
k < 1

goal (1 subgoal):
 1. (\<lambda>x. inverse (k powr - real x)) \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
by(intro landau_o.small.inverse)(auto simp add: False eventually_sequentially powr_minus intro: exI[where x=1])
[PROOF STATE]
proof (state)
this:
(\<lambda>x. inverse (k powr - real x)) \<in> o(\<lambda>x. inverse (real x powr c))

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> (\<lambda>x. k powr real x) \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. inverse (k powr - real x)) \<in> o(\<lambda>x. inverse (real x powr c))

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> (\<lambda>x. k powr real x) \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
have "(\<lambda>x. inverse (k powr - real x)) = (\<lambda>x. k powr real x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. inverse (k powr - real x)) = (\<lambda>x. k powr real x)
[PROOF STEP]
by(simp add: powr_minus)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. inverse (k powr - real x)) = (\<lambda>x. k powr real x)

goal (1 subgoal):
 1. \<And>c. 0 < c \<Longrightarrow> (\<lambda>x. k powr real x) \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. k powr real x) \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
show "\<dots> \<in> o(\<lambda>x. inverse (x powr c))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. k powr real x) \<in> o(\<lambda>x. inverse (real x powr c))

goal (1 subgoal):
 1. (\<lambda>x. k powr real x) \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. k powr real x) \<in> o(\<lambda>x. inverse (real x powr c))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
negligible (\<lambda>x. k powr real x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_prime_factor_iff_primepow:
  fixes n :: "'a :: factorial_semiring_multiplicative"
  shows "card (prime_factors n) = Suc 0 \<longleftrightarrow> primepow (normalize n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card (prime_factors n) = Suc 0) = primepow (normalize n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
 2. primepow (normalize n) \<Longrightarrow> card (prime_factors n) = Suc 0
[PROOF STEP]
assume "primepow (normalize n)"
[PROOF STATE]
proof (state)
this:
primepow (normalize n)

goal (2 subgoals):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
 2. primepow (normalize n) \<Longrightarrow> card (prime_factors n) = Suc 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
primepow (normalize n)
[PROOF STEP]
obtain p k where pk: "prime p" "normalize n = p ^ k" "k > 0"
[PROOF STATE]
proof (prove)
using this:
primepow (normalize n)

goal (1 subgoal):
 1. (\<And>p k. \<lbrakk>prime p; normalize n = p ^ k; 0 < k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: primepow_def)
[PROOF STATE]
proof (state)
this:
prime p
normalize n = p ^ k
0 < k

goal (2 subgoals):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
 2. primepow (normalize n) \<Longrightarrow> card (prime_factors n) = Suc 0
[PROOF STEP]
hence "card (prime_factors (normalize n)) = Suc 0"
[PROOF STATE]
proof (prove)
using this:
prime p
normalize n = p ^ k
0 < k

goal (1 subgoal):
 1. card (prime_factors (normalize n)) = Suc 0
[PROOF STEP]
by (subst pk) (simp add: prime_factors_power prime_factorization_prime)
[PROOF STATE]
proof (state)
this:
card (prime_factors (normalize n)) = Suc 0

goal (2 subgoals):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
 2. primepow (normalize n) \<Longrightarrow> card (prime_factors n) = Suc 0
[PROOF STEP]
thus "card (prime_factors n) = Suc 0"
[PROOF STATE]
proof (prove)
using this:
card (prime_factors (normalize n)) = Suc 0

goal (1 subgoal):
 1. card (prime_factors n) = Suc 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (prime_factors n) = Suc 0

goal (1 subgoal):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
[PROOF STEP]
assume *: "card (prime_factors n) = Suc 0"
[PROOF STATE]
proof (state)
this:
card (prime_factors n) = Suc 0

goal (1 subgoal):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
card (prime_factors n) = Suc 0
[PROOF STEP]
have "(\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = normalize n"
[PROOF STATE]
proof (prove)
using this:
card (prime_factors n) = Suc 0

goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = normalize n
[PROOF STEP]
by (intro prod_prime_factors) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = normalize n

goal (1 subgoal):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = normalize n

goal (1 subgoal):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
card (prime_factors n) = Suc 0
[PROOF STEP]
have "card (prime_factors n) = 1"
[PROOF STATE]
proof (prove)
using this:
card (prime_factors n) = Suc 0

goal (1 subgoal):
 1. card (prime_factors n) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (prime_factors n) = 1

goal (1 subgoal):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (prime_factors n) = 1
[PROOF STEP]
obtain p where p: "prime_factors n = {p}"
[PROOF STATE]
proof (prove)
using this:
card (prime_factors n) = 1

goal (1 subgoal):
 1. (\<And>p. prime_factors n = {p} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim card_1_singletonE)
[PROOF STATE]
proof (state)
this:
prime_factors n = {p}

goal (1 subgoal):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>p\<in>{p}. p ^ multiplicity p n) = normalize n
[PROOF STEP]
have "normalize n = p ^ multiplicity p n"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>p\<in>{p}. p ^ multiplicity p n) = normalize n

goal (1 subgoal):
 1. normalize n = p ^ multiplicity p n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
normalize n = p ^ multiplicity p n

goal (1 subgoal):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
normalize n = p ^ multiplicity p n

goal (1 subgoal):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
[PROOF STEP]
from p
[PROOF STATE]
proof (chain)
picking this:
prime_factors n = {p}
[PROOF STEP]
have "prime p" "multiplicity p n > 0"
[PROOF STATE]
proof (prove)
using this:
prime_factors n = {p}

goal (1 subgoal):
 1. prime p &&& 0 < multiplicity p n
[PROOF STEP]
by (auto simp: prime_factors_multiplicity)
[PROOF STATE]
proof (state)
this:
prime p
0 < multiplicity p n

goal (1 subgoal):
 1. card (prime_factors n) = Suc 0 \<Longrightarrow> primepow (normalize n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
normalize n = p ^ multiplicity p n
prime p
0 < multiplicity p n
[PROOF STEP]
show "primepow (normalize n)"
[PROOF STATE]
proof (prove)
using this:
normalize n = p ^ multiplicity p n
prime p
0 < multiplicity p n

goal (1 subgoal):
 1. primepow (normalize n)
[PROOF STEP]
unfolding primepow_def
[PROOF STATE]
proof (prove)
using this:
normalize n = p ^ multiplicity p n
prime p
0 < multiplicity p n

goal (1 subgoal):
 1. \<exists>p k. prime p \<and> 0 < k \<and> normalize n = p ^ k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
primepow (normalize n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_map_autoref_size_aux:
  assumes "distinct (map fst x)"
  shows "card (dom (map_of x)) = length x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (dom (map_of x)) = length x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (dom (map_of x)) = length x
[PROOF STEP]
have "card (dom (map_of x)) = card (map_to_set (map_of x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (dom (map_of x)) = card (map_to_set (map_of x))
[PROOF STEP]
by (simp add: card_map_to_set)
[PROOF STATE]
proof (state)
this:
card (dom (map_of x)) = card (map_to_set (map_of x))

goal (1 subgoal):
 1. card (dom (map_of x)) = length x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (dom (map_of x)) = card (map_to_set (map_of x))

goal (1 subgoal):
 1. card (dom (map_of x)) = length x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
distinct (map fst x)
[PROOF STEP]
have "... = card (set x)"
[PROOF STATE]
proof (prove)
using this:
distinct (map fst x)

goal (1 subgoal):
 1. card (map_to_set (map_of x)) = card (set x)
[PROOF STEP]
by (simp add: map_to_set_map_of)
[PROOF STATE]
proof (state)
this:
card (map_to_set (map_of x)) = card (set x)

goal (1 subgoal):
 1. card (dom (map_of x)) = length x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (map_to_set (map_of x)) = card (set x)

goal (1 subgoal):
 1. card (dom (map_of x)) = length x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
distinct (map fst x)
[PROOF STEP]
have "... = length x"
[PROOF STATE]
proof (prove)
using this:
distinct (map fst x)

goal (1 subgoal):
 1. card (set x) = length x
[PROOF STEP]
by (force simp: distinct_card dest!: distinct_mapI)
[PROOF STATE]
proof (state)
this:
card (set x) = length x

goal (1 subgoal):
 1. card (dom (map_of x)) = length x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (dom (map_of x)) = length x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (dom (map_of x)) = length x

goal (1 subgoal):
 1. card (dom (map_of x)) = length x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (dom (map_of x)) = length x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sets_Sup_in_sets:
  assumes "M \<noteq> {}"
  assumes "\<And>m. m \<in> M \<Longrightarrow> space m = space N"
  assumes "\<And>m. m \<in> M \<Longrightarrow> sets m \<subseteq> sets N"
  shows "sets (Sup M) \<subseteq> sets N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (Sup M) \<subseteq> sets N
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sets (Sup M) \<subseteq> sets N
[PROOF STEP]
have *: "\<Union>(space ` M) = space N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (space ` M) = space N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M \<noteq> {}
?m \<in> M \<Longrightarrow> space ?m = space N
?m \<in> M \<Longrightarrow> sets ?m \<subseteq> sets N

goal (1 subgoal):
 1. \<Union> (space ` M) = space N
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> (space ` M) = space N

goal (1 subgoal):
 1. sets (Sup M) \<subseteq> sets N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (Sup M) \<subseteq> sets N
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (Sup M) \<subseteq> sets N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M \<noteq> {}
?m \<in> M \<Longrightarrow> space ?m = space N
?m \<in> M \<Longrightarrow> sets ?m \<subseteq> sets N

goal (1 subgoal):
 1. sets (Sup M) \<subseteq> sets N
[PROOF STEP]
by (subst sets_Sup_eq[of M "space N"]) (auto intro!: sets.sigma_sets_subset)
[PROOF STATE]
proof (state)
this:
sets (Sup M) \<subseteq> sets N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_induct_pair: "P 0 0 \<Longrightarrow> (\<And> m n. P m n \<Longrightarrow> P m (Suc n)) \<Longrightarrow> (\<And> m n. P m n \<Longrightarrow> P (Suc m) n) \<Longrightarrow> P m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P 0 0; \<And>m n. P m n \<Longrightarrow> P m (Suc n); \<And>m n. P m n \<Longrightarrow> P (Suc m) n\<rbrakk> \<Longrightarrow> P m n
[PROOF STEP]
by (induction m arbitrary: n) (metis nat_induct, simp)


[STATEMENT]
lemma prime_elem_imp_gcd_eq:
  fixes x::"'a:: ring_gcd"
  shows "prime_elem x \<Longrightarrow> gcd x y = normalize x \<or> gcd x y = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_elem x \<Longrightarrow> gcd x y = normalize x \<or> gcd x y = (1::'a)
[PROOF STEP]
using prime_elem_imp_coprime [of x y]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime_elem x; \<not> x dvd y\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime x y

goal (1 subgoal):
 1. prime_elem x \<Longrightarrow> gcd x y = normalize x \<or> gcd x y = (1::'a)
[PROOF STEP]
by (auto simp add: gcd_proj1_iff intro: coprime_imp_gcd_eq_1)


[STATEMENT]
lemma S_list_respects_labels:
  "\<lbrakk> label_wrt B \<phi>; ss\<in>lists S; v\<in>(\<Union>X) \<rbrakk> \<Longrightarrow> \<phi> (sum_list ss \<rightarrow> v) = \<phi> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>label_wrt B \<phi>; ss \<in> lists (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g}); v \<in> \<Union> X\<rbrakk> \<Longrightarrow> \<phi> (sum_list ss \<rightarrow> v) = \<phi> v
[PROOF STEP]
using S_endomorphism ChamberComplexEndomorphism.vertex_map[of X]
[PROOF STATE]
proof (prove)
using this:
?s \<in> (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g}) \<Longrightarrow> ChamberComplexEndomorphism X ((\<rightarrow>) ?s)
\<lbrakk>ChamberComplexEndomorphism X ?f; ?x \<in> \<Union> X\<rbrakk> \<Longrightarrow> ?f ?x \<in> \<Union> X

goal (1 subgoal):
 1. \<lbrakk>label_wrt B \<phi>; ss \<in> lists (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g}); v \<in> \<Union> X\<rbrakk> \<Longrightarrow> \<phi> (sum_list ss \<rightarrow> v) = \<phi> v
[PROOF STEP]
by    (induct ss arbitrary: v rule: rev_induct)
        (auto simp add:
          plus_permutation.rep_eq S_respects_labels zero_permutation.rep_eq
        )


[STATEMENT]
lemma set_eq_is_eq: "A {.=} B \<longleftrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A {.=} B) = (A = B)
[PROOF STEP]
by (auto simp add: set_eq_def elem_def eq_is_equal)


[STATEMENT]
lemma nn_integral_map_spmf [simp]: "nn_integral (measure_spmf (map_spmf f p)) g = nn_integral (measure_spmf p) (g \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_spmf (map_spmf f p)) g = integral\<^sup>N (measure_spmf p) (g \<circ> f)
[PROOF STEP]
by(auto 4 3 simp add: measure_spmf_def nn_integral_distr nn_integral_restrict_space intro: nn_integral_cong split: split_indicator)


[STATEMENT]
lemma rotater_map: "rotater n (map f xs) = map f (rotater n xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rotater n (map f xs) = map f (rotater n xs)
[PROOF STEP]
by (induct n) (auto simp: rotater_def rotater1_map)


[STATEMENT]
lemma r01_to_r01_r01_fst_measurable:
 "r01_to_r01_r01_fst \<in> borel_measurable borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_to_r01_r01_fst \<in> borel_measurable real_borel
[PROOF STEP]
unfolding r01_to_r01_r01_fst_def'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>r. \<Sum>n. real (r01_binary_expansion' r (2 * n)) * (1 / 2) ^ (n + 1)) \<in> borel_measurable real_borel
[PROOF STEP]
using r01_binary_expansion'_measurable
[PROOF STATE]
proof (prove)
using this:
(\<lambda>r. real (r01_binary_expansion' r ?n)) \<in> borel_measurable real_borel

goal (1 subgoal):
 1. (\<lambda>r. \<Sum>n. real (r01_binary_expansion' r (2 * n)) * (1 / 2) ^ (n + 1)) \<in> borel_measurable real_borel
[PROOF STEP]
by auto


[STATEMENT]
lemma lang_is_union_of_finals:
  shows "A = \<Union>(finals A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = \<Union> (finals A)
[PROOF STEP]
unfolding finals_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = \<Union> {\<approx>A `` {s} |s. s \<in> A}
[PROOF STEP]
unfolding Image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = \<Union> {{y. \<exists>x\<in>{s}. x \<approx>A y} |s. s \<in> A}
[PROOF STEP]
unfolding str_eq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = \<Union> {{y. \<exists>x\<in>{s}. (x, y) \<in> {(x, y). \<forall>z. (x @ z \<in> A) = (y @ z \<in> A)}} |s. s \<in> A}
[PROOF STEP]
by (auto) (metis append_Nil2)


[STATEMENT]
lemma dim_psubset:
  "span S \<subset> span T \<Longrightarrow> dim S < dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span S \<subset> span T \<Longrightarrow> dim S < dim T
[PROOF STEP]
by (metis (no_types, opaque_lifting) dim_span less_le not_le subspace_dim_equal subspace_span)


[STATEMENT]
lemma finite_order_radicals_has_max:
  "order_radicals (radicals e) \<noteq> {} \<Longrightarrow>
   finite (order_radicals (radicals e)) \<Longrightarrow>
   \<exists> r. (r \<in> radicals e) \<and> (\<forall> s \<in> (radicals e). (order r \<ge> order s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order_radicals (radicals e) \<noteq> {}; finite (order_radicals (radicals e))\<rbrakk> \<Longrightarrow> \<exists>r. r \<in> radicals e \<and> (\<forall>s\<in>radicals e. order s \<le> order r)
[PROOF STEP]
using finite_set_has_max [of "order_radicals (radicals e)"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (order_radicals (radicals e)); order_radicals (radicals e) \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>k\<in>order_radicals (radicals e). \<forall>p\<in>order_radicals (radicals e). p \<le> k

goal (1 subgoal):
 1. \<lbrakk>order_radicals (radicals e) \<noteq> {}; finite (order_radicals (radicals e))\<rbrakk> \<Longrightarrow> \<exists>r. r \<in> radicals e \<and> (\<forall>s\<in>radicals e. order s \<le> order r)
[PROOF STEP]
by auto


[STATEMENT]
lemma bigo_bounded2: "\<forall>x. lb x \<le> f x \<Longrightarrow> \<forall>x. f x \<le> lb x + g x \<Longrightarrow> f \<in> lb +o O(g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. lb x \<le> f x; \<forall>x. f x \<le> lb x + g x\<rbrakk> \<Longrightarrow> f \<in> lb +o O(g)
[PROOF STEP]
apply (rule set_minus_imp_plus)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. lb x \<le> f x; \<forall>x. f x \<le> lb x + g x\<rbrakk> \<Longrightarrow> f - lb \<in> O(g)
[PROOF STEP]
apply (rule bigo_bounded)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>x. lb x \<le> f x; \<forall>x. f x \<le> lb x + g x\<rbrakk> \<Longrightarrow> \<forall>x. (0::'b) \<le> (f - lb) x
 2. \<lbrakk>\<forall>x. lb x \<le> f x; \<forall>x. f x \<le> lb x + g x\<rbrakk> \<Longrightarrow> \<forall>x. (f - lb) x \<le> g x
[PROOF STEP]
apply (metis add_le_cancel_left diff_add_cancel diff_self minus_apply
              algebra_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. lb x \<le> f x; \<forall>x. f x \<le> lb x + g x\<rbrakk> \<Longrightarrow> \<forall>x. (f - lb) x \<le> g x
[PROOF STEP]
by (metis add_le_cancel_left diff_add_cancel func_plus le_fun_def
          algebra_simps)


[STATEMENT]
lemma nth_rotate1_Suc: "Suc n < length ls \<Longrightarrow> ls!(Suc n) = (rotate1 ls)!n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n < |ls| \<Longrightarrow> ls ! Suc n = rotate1 ls ! n
[PROOF STEP]
apply (cases ls)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Suc n < |ls|; ls = []\<rbrakk> \<Longrightarrow> ls ! Suc n = rotate1 ls ! n
 2. \<And>a list. \<lbrakk>Suc n < |ls|; ls = a # list\<rbrakk> \<Longrightarrow> ls ! Suc n = rotate1 ls ! n
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a list. \<lbrakk>n < |list|; ls = a # list\<rbrakk> \<Longrightarrow> list ! n = (list @ [a]) ! n
[PROOF STEP]
by (simp add: nth_append)


[STATEMENT]
lemma weighted_majority_eq_iff:
  assumes "is_pref_profile R1" "is_pref_profile R2"
  shows   "weighted_majority R1 = weighted_majority R2 \<longleftrightarrow>
             (\<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (weighted_majority R1 = weighted_majority R2) = (\<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y)
[PROOF STEP]
proof (intro iffI ext)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. weighted_majority R1 = weighted_majority R2 \<Longrightarrow> \<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y
 2. \<And>x xa. \<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y \<Longrightarrow> weighted_majority R1 x xa = weighted_majority R2 x xa
[PROOF STEP]
fix x y :: 'alt
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. weighted_majority R1 = weighted_majority R2 \<Longrightarrow> \<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y
 2. \<And>x xa. \<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y \<Longrightarrow> weighted_majority R1 x xa = weighted_majority R2 x xa
[PROOF STEP]
assume "\<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y"
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y

goal (2 subgoals):
 1. weighted_majority R1 = weighted_majority R2 \<Longrightarrow> \<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y
 2. \<And>x xa. \<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y \<Longrightarrow> weighted_majority R1 x xa = weighted_majority R2 x xa
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
is_pref_profile R1
is_pref_profile R2
\<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y
[PROOF STEP]
show "weighted_majority R1 x y = weighted_majority R2 x y"
[PROOF STATE]
proof (prove)
using this:
is_pref_profile R1
is_pref_profile R2
\<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y

goal (1 subgoal):
 1. weighted_majority R1 x y = weighted_majority R2 x y
[PROOF STEP]
by (cases "x \<in> alts"; cases "y \<in> alts")
       (auto simp: fun_eq_iff weighted_majority_nonagent1 weighted_majority_nonagent2)
[PROOF STATE]
proof (state)
this:
weighted_majority R1 x y = weighted_majority R2 x y

goal (1 subgoal):
 1. weighted_majority R1 = weighted_majority R2 \<Longrightarrow> \<forall>x\<in>alts. \<forall>y\<in>alts. weighted_majority R1 x y = weighted_majority R2 x y
[PROOF STEP]
qed auto


[STATEMENT]
lemma smooth_on_compose2:
  fixes g::"_\<Rightarrow>_::euclidean_space"
  assumes "k-smooth_on T f" "k-smooth_on S g" "open U" "open T" "g ` U \<subseteq> T" "U \<subseteq> S"
  shows "k-smooth_on U (f o g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k-smooth_on U (f \<circ> g)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k-smooth_on T f
k-smooth_on S g
open U
open T
g ` U \<subseteq> T
U \<subseteq> S

goal (1 subgoal):
 1. k-smooth_on U (f \<circ> g)
[PROOF STEP]
by (auto simp: smooth_on_def intro!: higher_differentiable_on_compose intro: higher_differentiable_on_subset)


[STATEMENT]
lemma p_prod_assoc: "(X \<cdot> Y) \<cdot> Z = X \<cdot> (Y \<cdot> Z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<cdot> Y \<cdot> Z = X \<cdot> (Y \<cdot> Z)
[PROOF STEP]
proof (rule set_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (x \<in> X \<cdot> Y \<cdot> Z) = (x \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
fix ps
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (x \<in> X \<cdot> Y \<cdot> Z) = (x \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
show "ps \<in> (X \<cdot> Y) \<cdot> Z \<longleftrightarrow> ps \<in> X \<cdot> (Y \<cdot> Z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
proof (cases ps)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ps = [] \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
 2. \<And>a list. ps = a # list \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
ps = []

goal (2 subgoals):
 1. ps = [] \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
 2. \<And>a list. ps = a # list \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ps = []

goal (1 subgoal):
 1. (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
by auto (metis nonempty_p_fusion p_prod_iff)+
[PROOF STATE]
proof (state)
this:
(ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))

goal (1 subgoal):
 1. \<And>a list. ps = a # list \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. ps = a # list \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
case Cons
[PROOF STATE]
proof (state)
this:
ps = a_ # list_

goal (1 subgoal):
 1. \<And>a list. ps = a # list \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ps = a_ # list_

goal (1 subgoal):
 1. (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
by (auto simp add: p_prod_iff) (metis (opaque_lifting, mono_tags) nonempty_p_fusion p_fusion_assoc p_fusion_hd p_fusion_last)+
[PROOF STATE]
proof (state)
this:
(ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma asymptotics2:
  shows "eventually (\<lambda>x.
             (1 + c * inverse b * ln x powr -(1+e)) powr p *
             (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le>
             1 - (ln x powr (-e/2))) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
let ?f = "\<lambda>x. (1 + c * inverse b * ln x powr -(1+e)) powr p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
let ?g = "\<lambda>x. 1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
define f where [abs_def]: "f x = 1 - ?f x" for x
[PROOF STATE]
proof (state)
this:
f \<equiv> \<lambda>x. 1 - (1 + c * inverse b * ln x powr - (1 + e)) powr p

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
from ev1[of c]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. (1 + c * inverse b * ln x powr - (1 + e)) powr p - 1) \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))
[PROOF STEP]
have "negl f"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. (1 + c * inverse b * ln x powr - (1 + e)) powr p - 1) \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))

goal (1 subgoal):
 1. f \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. (1 + c * inverse b * ln x powr - (1 + e)) powr p - 1) \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))

goal (1 subgoal):
 1. (\<lambda>x. 1 - (1 + c * inverse b * ln x powr - (1 + e)) powr p) \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))
[PROOF STEP]
by (subst landau_o.small.uminus_in_iff [symmetric]) simp
[PROOF STATE]
proof (state)
this:
f \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
from landau_o.smallD[OF this zero_less_one]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. norm (f x) \<le> 1 * norm (ln (b * x) powr - (e / 2 + 1))
[PROOF STEP]
have f: "eventually (\<lambda>x. f x \<le> ln (b*x) powr -(e/2+1)) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. norm (f x) \<le> 1 * norm (ln (b * x) powr - (e / 2 + 1))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x \<le> ln (b * x) powr - (e / 2 + 1)
[PROOF STEP]
by eventually_elim (simp add: f_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. f x \<le> ln (b * x) powr - (e / 2 + 1)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
from ev22
[PROOF STATE]
proof (chain)
picking this:
(\<And>g. \<lbrakk>g \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1)); \<forall>\<^sub>F x in at_top. 1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x; \<forall>\<^sub>F x in at_top. 0 < 1 - ln (b * x) powr (- e / 2) - g x\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
guess g
[PROOF STATE]
proof (prove)
using this:
(\<And>g. \<lbrakk>g \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1)); \<forall>\<^sub>F x in at_top. 1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x; \<forall>\<^sub>F x in at_top. 0 < 1 - ln (b * x) powr (- e / 2) - g x\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. thesis
goal instantiation:
PROP ?guess \<leadsto> thesis
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
g \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))
\<forall>\<^sub>F x in at_top. 1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x
\<forall>\<^sub>F x in at_top. 0 < 1 - ln (b * x) powr (- e / 2) - g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
note g = this
[PROOF STATE]
proof (state)
this:
g \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))
\<forall>\<^sub>F x in at_top. 1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x
\<forall>\<^sub>F x in at_top. 0 < 1 - ln (b * x) powr (- e / 2) - g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
define h where [abs_def]: "h x = -g x - f x + f x * ln (b*x) powr (-e/2) + f x * g x" for x
[PROOF STATE]
proof (state)
this:
h \<equiv> \<lambda>x. - g x - f x + f x * ln (b * x) powr (- e / 2) + f x * g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
have "((\<lambda>x. ln (b * x + hb * x / ln x powr (1 + e)) powr - (e / 2)) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. ln (b * x + hb * x / ln x powr (1 + e)) powr - (e / 2)) \<longlongrightarrow> 0) at_top
[PROOF STEP]
apply (insert bep, intro tendsto_neg_powr, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < b; b < 1; 0 < e; 0 < hb\<rbrakk> \<Longrightarrow> LIM x at_top. ln (b * x + hb * x / ln x powr (1 + e)) :> at_top
[PROOF STEP]
apply (rule filterlim_compose[OF ln_at_top])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < b; b < 1; 0 < e; 0 < hb\<rbrakk> \<Longrightarrow> LIM x at_top. b * x + hb * x / ln x powr (1 + e) :> at_top
[PROOF STEP]
apply (rule filterlim_at_top_smallomega_1, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < b; b < 1; 0 < e; 0 < hb\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in at_top. 0 < b * x + hb * x / ln x powr (1 + e)
[PROOF STEP]
using eventually_gt_at_top[of "max 1 (1/b)"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) (max 1 (1 / b))) at_top

goal (1 subgoal):
 1. \<lbrakk>0 < b; b < 1; 0 < e; 0 < hb\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in at_top. 0 < b * x + hb * x / ln x powr (1 + e)
[PROOF STEP]
apply (auto elim!: eventually_mono intro!: add_pos_nonneg simp: field_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 < b; b < 1; 0 < e; 0 < hb; 1 < x * b\<rbrakk> \<Longrightarrow> 0 \<le> x * hb / ln x powr (1 + e)
[PROOF STEP]
apply (smt (z3) divide_nonneg_nonneg mult_neg_pos mult_nonneg_nonneg powr_non_neg)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
((\<lambda>x. ln (b * x + hb * x / ln x powr (1 + e)) powr - (e / 2)) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
hence ev_g: "eventually (\<lambda>x. \<bar>1 - ?g x\<bar> < 1) at_top"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. ln (b * x + hb * x / ln x powr (1 + e)) powr - (e / 2)) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>1 - (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2))\<bar> < 1
[PROOF STEP]
by (intro smallo_imp_abs_less_real smalloI_tendsto) simp_all
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. \<bar>1 - (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2))\<bar> < 1

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
have A: "eventually (\<lambda>x. ?f x * ?g x \<le> 1 - ln (b*x) powr (-e/2) + h x) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x
[PROOF STEP]
using g(2,3) ev_g f
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. 1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x
\<forall>\<^sub>F x in at_top. 0 < 1 - ln (b * x) powr (- e / 2) - g x
\<forall>\<^sub>F x in at_top. \<bar>1 - (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2))\<bar> < 1
\<forall>\<^sub>F x in at_top. f x \<le> ln (b * x) powr - (e / 2 + 1)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x; 0 < 1 - ln (b * x) powr (- e / 2) - g x; \<bar>1 - (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2))\<bar> < 1; f x \<le> ln (b * x) powr - (e / 2 + 1)\<rbrakk> \<Longrightarrow> (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x
[PROOF STEP]
case (elim x)
[PROOF STATE]
proof (state)
this:
1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x
0 < 1 - ln (b * x) powr (- e / 2) - g x
\<bar>1 - (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2))\<bar> < 1
f x \<le> ln (b * x) powr - (e / 2 + 1)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x; 0 < 1 - ln (b * x) powr (- e / 2) - g x; \<bar>1 - (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2))\<bar> < 1; f x \<le> ln (b * x) powr - (e / 2 + 1)\<rbrakk> \<Longrightarrow> (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x
[PROOF STEP]
let ?t = "ln (b*x) powr (-e/2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x; 0 < 1 - ln (b * x) powr (- e / 2) - g x; \<bar>1 - (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2))\<bar> < 1; f x \<le> ln (b * x) powr - (e / 2 + 1)\<rbrakk> \<Longrightarrow> (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x
[PROOF STEP]
from elim
[PROOF STATE]
proof (chain)
picking this:
1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x
0 < 1 - ln (b * x) powr (- e / 2) - g x
\<bar>1 - (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2))\<bar> < 1
f x \<le> ln (b * x) powr - (e / 2 + 1)
[PROOF STEP]
have "?f x * ?g x \<le> (1 - f x) * (1 - ln (b*x) powr (-e/2) - g x)"
[PROOF STATE]
proof (prove)
using this:
1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x
0 < 1 - ln (b * x) powr (- e / 2) - g x
\<bar>1 - (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2))\<bar> < 1
f x \<le> ln (b * x) powr - (e / 2 + 1)

goal (1 subgoal):
 1. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> (1 - f x) * (1 - ln (b * x) powr (- e / 2) - g x)
[PROOF STEP]
by (intro mult_mono) (simp_all add: f_def)
[PROOF STATE]
proof (state)
this:
(1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> (1 - f x) * (1 - ln (b * x) powr (- e / 2) - g x)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x; 0 < 1 - ln (b * x) powr (- e / 2) - g x; \<bar>1 - (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2))\<bar> < 1; f x \<le> ln (b * x) powr - (e / 2 + 1)\<rbrakk> \<Longrightarrow> (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> (1 - f x) * (1 - ln (b * x) powr (- e / 2) - g x)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x; 0 < 1 - ln (b * x) powr (- e / 2) - g x; \<bar>1 - (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2))\<bar> < 1; f x \<le> ln (b * x) powr - (e / 2 + 1)\<rbrakk> \<Longrightarrow> (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x
[PROOF STEP]
have "... = 1 - ?t + h x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - f x) * (1 - ln (b * x) powr (- e / 2) - g x) = 1 - ln (b * x) powr (- e / 2) + h x
[PROOF STEP]
by (simp add: algebra_simps h_def)
[PROOF STATE]
proof (state)
this:
(1 - f x) * (1 - ln (b * x) powr (- e / 2) - g x) = 1 - ln (b * x) powr (- e / 2) + h x

goal (1 subgoal):
 1. \<And>x. \<lbrakk>1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2) \<le> 1 - ln (b * x) powr (- e / 2) - g x; 0 < 1 - ln (b * x) powr (- e / 2) - g x; \<bar>1 - (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2))\<bar> < 1; f x \<le> ln (b * x) powr - (e / 2 + 1)\<rbrakk> \<Longrightarrow> (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x
[PROOF STEP]
show "?f x * ?g x \<le> 1 - ln (b*x) powr (-e/2) + h x"
[PROOF STATE]
proof (prove)
using this:
(1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x

goal (1 subgoal):
 1. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
from bep \<open>negl f\<close> g(1)
[PROOF STATE]
proof (chain)
picking this:
0 < b
b < 1
0 < e
0 < hb
f \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))
g \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))
[PROOF STEP]
have "negl h"
[PROOF STATE]
proof (prove)
using this:
0 < b
b < 1
0 < e
0 < hb
f \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))
g \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))

goal (1 subgoal):
 1. h \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
using this:
0 < b
b < 1
0 < e
0 < hb
f \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))
g \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))

goal (1 subgoal):
 1. (\<lambda>x. - g x - f x + f x * ln (b * x) powr (- e / 2) + f x * g x) \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))
[PROOF STEP]
by (fastforce intro!: sum_in_smallo landau_o.small.mult simp: powr_diff
                  intro: landau_o.small_trans)+
[PROOF STATE]
proof (state)
this:
h \<in> o(\<lambda>x. ln (b * x) powr - (e / 2 + 1))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
from ev4[OF this] A
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. h x \<le> ln (b * x) powr (- e / 2) - ln x powr (- e / 2)
\<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. h x \<le> ln (b * x) powr (- e / 2) - ln x powr (- e / 2)
\<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln (b * x) powr (- e / 2) + h x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)
[PROOF STEP]
by eventually_elim simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. (1 + c * inverse b * ln x powr - (1 + e)) powr p * (1 - ln (b * x + hb * x / ln x powr (1 + e)) powr (- e / 2)) \<le> 1 - ln x powr (- e / 2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nn_integral_count_space_finite:
    "finite A \<Longrightarrow> (\<integral>\<^sup>+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>N (count_space A) f = sum f A
[PROOF STEP]
by (auto intro!: sum.mono_neutral_left simp: nn_integral_count_space less_le)


[STATEMENT]
lemma Utrans_P_is_tensor_P2:
  assumes "A \<in> carrier_mat K K"
  shows "Utrans_P vars2 A = Utrans (tensor_P (1\<^sub>m N) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Utrans_P vars2 A = Utrans (tensor_P (1\<^sub>m N) A)
[PROOF STEP]
unfolding Utrans_P_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Utrans (mat_extension dims vars2 A) = Utrans (tensor_P (1\<^sub>m N) A)
[PROOF STEP]
using mat_ext_vars2 assms
[PROOF STATE]
proof (prove)
using this:
?A \<in> carrier_mat K K \<Longrightarrow> mat_extension dims vars2 ?A = tensor_P (1\<^sub>m N) ?A
A \<in> carrier_mat K K

goal (1 subgoal):
 1. Utrans (mat_extension dims vars2 A) = Utrans (tensor_P (1\<^sub>m N) A)
[PROOF STEP]
by auto


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

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a \<in>\<^sub>\<circ> A; b \<in>\<^sub>\<circ> A; a \<subseteq>\<^sub>\<circ> b; x = [a, b]\<^sub>\<circ>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding ordinal_arrs_def
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> ZFC_in_HOL.set {[a, b]\<^sub>\<circ> |a b. a \<in>\<^sub>\<circ> A \<and> b \<in>\<^sub>\<circ> A \<and> a \<subseteq>\<^sub>\<circ> b}

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


[STATEMENT]
lemma hypreal_sqrt_mult_distrib:
    "\<And>x y. \<lbrakk>0 < x; 0 <y\<rbrakk> \<Longrightarrow>
      ( *f* sqrt)(x*y) = ( *f* sqrt)(x) * ( *f* sqrt)(y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> (*f* sqrt) (x * y) = (*f* sqrt) x * (*f* sqrt) y
[PROOF STEP]
by transfer (auto intro: real_sqrt_mult)


[STATEMENT]
lemma lcm_proj2_iff_nat [simp]: "lcm m n = n \<longleftrightarrow> m dvd n"
  for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lcm m n = n) = (m dvd n)
[PROOF STEP]
by (metis lcm_proj2_if_dvd_nat lcm_unique_nat)


[STATEMENT]
lemma p_coprime_right_nat: "prime p \<Longrightarrow> coprime a p = (\<not> p dvd a)" for p a :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> coprime a p = (\<not> p dvd a)
[PROOF STEP]
by (meson coprime_absorb_left coprime_commute not_prime_unit prime_imp_coprime_nat)


[STATEMENT]
lemma has_bochner_integral_imp_has_integral:
  "has_bochner_integral lebesgue (\<lambda>x. indicator S x *\<^sub>R f x) I \<Longrightarrow>
     (f has_integral (I :: 'b :: euclidean_space)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_bochner_integral lebesgue (\<lambda>x. indicat_real S x *\<^sub>R f x) I \<Longrightarrow> (f has_integral I) S
[PROOF STEP]
using has_integral_set_lebesgue[of S f]
[PROOF STATE]
proof (prove)
using this:
f absolutely_integrable_on S \<Longrightarrow> (f has_integral set_lebesgue_integral lebesgue S f) S

goal (1 subgoal):
 1. has_bochner_integral lebesgue (\<lambda>x. indicat_real S x *\<^sub>R f x) I \<Longrightarrow> (f has_integral I) S
[PROOF STEP]
by (simp add: has_bochner_integral_iff set_integrable_def set_lebesgue_integral_def)


[STATEMENT]
lemma less_multiset\<^sub>D\<^sub>M:
  "M < N \<longleftrightarrow> (\<exists>X Y. X \<noteq> {#} \<and> X \<subseteq># N \<and> M = N - X + Y \<and> (\<forall>k. k \<in># Y \<longrightarrow> (\<exists>a. a \<in># X \<and> k < a)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M < N) = (\<exists>X Y. X \<noteq> {#} \<and> X \<subseteq># N \<and> M = N - X + Y \<and> (\<forall>k. k \<in># Y \<longrightarrow> (\<exists>a. a \<in># X \<and> k < a)))
[PROOF STEP]
by (rule mult\<^sub>D\<^sub>M[folded multp_def less_multiset_def])


[STATEMENT]
lemma inf_ccSUP:
  "countable B \<Longrightarrow> inf a (SUP b\<in>B. f b) = (SUP b\<in>B. inf a (f b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable B \<Longrightarrow> inf a (Sup (f ` B)) = (SUP b\<in>B. inf a (f b))
[PROOF STEP]
by (simp only: inf_ccSup image_image countable_image)


[STATEMENT]
lemma distinct_genuine_roots [simp, intro]:
  "distinct xs \<Longrightarrow> distinct (genuine_roots p xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs \<Longrightarrow> distinct (genuine_roots p xs)
[PROOF STEP]
by (simp add: genuine_roots_def)


[STATEMENT]
lemma dim_psubset:
  "span S \<subset> span T \<Longrightarrow> dim S < dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span S \<subset> span T \<Longrightarrow> dim S < dim T
[PROOF STEP]
by (metis (no_types, opaque_lifting) dim_span less_le not_le subspace_dim_equal subspace_span)


[STATEMENT]
lemma Sup_supdistl_iso:
  fixes f :: "'a \<Rightarrow> 'b::complete_lattice"
  shows "Sup \<circ> (`) f \<le> f \<circ> Sup \<Longrightarrow> mono f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup \<circ> (`) f \<le> f \<circ> Sup \<Longrightarrow> mono f
[PROOF STEP]
unfolding mono_def le_fun_def comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. \<Squnion> (f ` x) \<le> f (\<Squnion> x) \<Longrightarrow> \<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y
[PROOF STEP]
by (metis complete_lattice_class.SUP_le_iff Sup_atMost atMost_iff)


[STATEMENT]
lemma subset_inext_in_imp_in: "\<lbrakk> inext n A \<in> B; A \<subseteq> B \<rbrakk> \<Longrightarrow> n \<in> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inext n A \<in> B; A \<subseteq> B\<rbrakk> \<Longrightarrow> n \<in> B
[PROOF STEP]
apply (case_tac "n \<in> A")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>inext n A \<in> B; A \<subseteq> B; n \<in> A\<rbrakk> \<Longrightarrow> n \<in> B
 2. \<lbrakk>inext n A \<in> B; A \<subseteq> B; n \<notin> A\<rbrakk> \<Longrightarrow> n \<in> B
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inext n A \<in> B; A \<subseteq> B; n \<notin> A\<rbrakk> \<Longrightarrow> n \<in> B
[PROOF STEP]
apply (simp add: not_in_inext_fix)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma hlog_one [simp]: "\<And>a. hlog a 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. hlog a 1 = 0
[PROOF STEP]
by transfer simp