[STATEMENT]
lemma closed_segment_degen_complex:
  "\<lbrakk>Re lb = Re ub; Im lb \<le> Im ub \<rbrakk>
    \<Longrightarrow> x \<in> closed_segment lb ub \<longleftrightarrow> Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub "
  "\<lbrakk>Im lb = Im ub; Re lb \<le> Re ub \<rbrakk>
    \<Longrightarrow> x \<in> closed_segment lb ub \<longleftrightarrow> Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>Re lb = Re ub; Im lb \<le> Im ub\<rbrakk> \<Longrightarrow> (x \<in> closed_segment lb ub) = (Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub)) &&& (\<lbrakk>Im lb = Im ub; Re lb \<le> Re ub\<rbrakk> \<Longrightarrow> (x \<in> closed_segment lb ub) = (Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>Re lb = Re ub; Im lb \<le> Im ub\<rbrakk> \<Longrightarrow> (x \<in> closed_segment lb ub) = (Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub)
 2. \<lbrakk>Im lb = Im ub; Re lb \<le> Re ub\<rbrakk> \<Longrightarrow> (x \<in> closed_segment lb ub) = (Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub)
[PROOF STEP]
show "x \<in> closed_segment lb ub \<longleftrightarrow> Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub"
    when "Re lb = Re ub" "Im lb \<le> Im ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> closed_segment lb ub) = (Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub
 2. Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
show "Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub" when "x \<in> closed_segment lb ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub
[PROOF STEP]
using closed_segment_imp_Re_Im[OF that] \<open>Re lb = Re ub\<close> \<open>Im lb \<le> Im ub\<close>
[PROOF STATE]
proof (prove)
using this:
Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub
Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub
Re lb = Re ub
Im lb \<le> Im ub

goal (1 subgoal):
 1. Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x \<in> closed_segment lb ub \<Longrightarrow> Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub

goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
assume asm:"Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub"
[PROOF STATE]
proof (state)
this:
Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub

goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
define u where "u=(Im x - Im lb)/ (Im ub - Im lb)"
[PROOF STATE]
proof (state)
this:
u = (Im x - Im lb) / (Im ub - Im lb)

goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
have "x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub
[PROOF STEP]
unfolding u_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = (1 - (Im x - Im lb) / (Im ub - Im lb)) *\<^sub>R lb + ((Im x - Im lb) / (Im ub - Im lb)) *\<^sub>R ub
[PROOF STEP]
using asm \<open>Re lb = Re ub\<close> \<open>Im lb \<le> Im ub\<close>
[PROOF STATE]
proof (prove)
using this:
Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub
Re lb = Re ub
Im lb \<le> Im ub

goal (1 subgoal):
 1. x = (1 - (Im x - Im lb) / (Im ub - Im lb)) *\<^sub>R lb + ((Im x - Im lb) / (Im ub - Im lb)) *\<^sub>R ub
[PROOF STEP]
apply (intro complex_eqI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub; Re lb = Re ub; Im lb \<le> Im ub\<rbrakk> \<Longrightarrow> Re x = Re ((1 - (Im x - Im lb) / (Im ub - Im lb)) *\<^sub>R lb + ((Im x - Im lb) / (Im ub - Im lb)) *\<^sub>R ub)
 2. \<lbrakk>Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub; Re lb = Re ub; Im lb \<le> Im ub\<rbrakk> \<Longrightarrow> Im x = Im ((1 - (Im x - Im lb) / (Im ub - Im lb)) *\<^sub>R lb + ((Im x - Im lb) / (Im ub - Im lb)) *\<^sub>R ub)
[PROOF STEP]
apply (auto simp add:field_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Re lb = Re ub; Re x = Re ub; Im lb \<le> Im x; Im x \<le> Im ub\<rbrakk> \<Longrightarrow> Im x + (Im lb * Im x - Im lb * Im lb) / (Im ub - Im lb) = Im lb + (Im ub * Im x - Im lb * Im ub) / (Im ub - Im lb)
[PROOF STEP]
apply (cases "Im ub - Im lb =0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Re lb = Re ub; Re x = Re ub; Im lb \<le> Im x; Im x \<le> Im ub; Im ub - Im lb = 0\<rbrakk> \<Longrightarrow> Im x + (Im lb * Im x - Im lb * Im lb) / (Im ub - Im lb) = Im lb + (Im ub * Im x - Im lb * Im ub) / (Im ub - Im lb)
 2. \<lbrakk>Re lb = Re ub; Re x = Re ub; Im lb \<le> Im x; Im x \<le> Im ub; Im ub - Im lb \<noteq> 0\<rbrakk> \<Longrightarrow> Im x + (Im lb * Im x - Im lb * Im lb) / (Im ub - Im lb) = Im lb + (Im ub * Im x - Im lb * Im ub) / (Im ub - Im lb)
[PROOF STEP]
apply (auto simp add:field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub

goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub

goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
have "0\<le>u" "u\<le>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> u &&& u \<le> 1
[PROOF STEP]
unfolding u_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (Im x - Im lb) / (Im ub - Im lb) &&& (Im x - Im lb) / (Im ub - Im lb) \<le> 1
[PROOF STEP]
using \<open>Im lb \<le> Im ub\<close> asm
[PROOF STATE]
proof (prove)
using this:
Im lb \<le> Im ub
Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub

goal (1 subgoal):
 1. 0 \<le> (Im x - Im lb) / (Im ub - Im lb) &&& (Im x - Im lb) / (Im ub - Im lb) \<le> 1
[PROOF STEP]
by (cases "Im ub - Im lb =0",auto simp add:field_simps)+
[PROOF STATE]
proof (state)
this:
0 \<le> u
u \<le> 1

goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub
0 \<le> u
u \<le> 1
[PROOF STEP]
show "x \<in> closed_segment lb ub"
[PROOF STATE]
proof (prove)
using this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub
0 \<le> u
u \<le> 1

goal (1 subgoal):
 1. x \<in> closed_segment lb ub
[PROOF STEP]
unfolding closed_segment_def
[PROOF STATE]
proof (prove)
using this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub
0 \<le> u
u \<le> 1

goal (1 subgoal):
 1. x \<in> {(1 - u) *\<^sub>R lb + u *\<^sub>R ub |u. 0 \<le> u \<and> u \<le> 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> closed_segment lb ub

goal (1 subgoal):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re lb = Re ub; Im lb \<le> Im ub\<rbrakk> \<Longrightarrow> (x \<in> closed_segment lb ub) = (Re x = Re lb \<and> Im lb \<le> Im x \<and> Im x \<le> Im ub)

goal (3 subgoals):
 1. \<lbrakk>Re lb = Re ub; Im lb \<le> Im ub\<rbrakk> \<Longrightarrow> Re lb = Re ub
 2. \<lbrakk>Re lb = Re ub; Im lb \<le> Im ub\<rbrakk> \<Longrightarrow> Im lb \<le> Im ub
 3. \<lbrakk>Im lb = Im ub; Re lb \<le> Re ub\<rbrakk> \<Longrightarrow> (x \<in> closed_segment lb ub) = (Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub)
[PROOF STEP]
show "x \<in> closed_segment lb ub \<longleftrightarrow> Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub"
    when "Im lb = Im ub" "Re lb \<le> Re ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> closed_segment lb ub) = (Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub
 2. Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
show "Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub" when "x \<in> closed_segment lb ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub
[PROOF STEP]
using closed_segment_imp_Re_Im[OF that] \<open>Im lb = Im ub\<close> \<open>Re lb \<le> Re ub\<close>
[PROOF STATE]
proof (prove)
using this:
Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub
Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub
Im lb = Im ub
Re lb \<le> Re ub

goal (1 subgoal):
 1. Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x \<in> closed_segment lb ub \<Longrightarrow> Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub

goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
assume asm:"Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub"
[PROOF STATE]
proof (state)
this:
Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub

goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
define u where "u=(Re x - Re lb)/ (Re ub - Re lb)"
[PROOF STATE]
proof (state)
this:
u = (Re x - Re lb) / (Re ub - Re lb)

goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
have "x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub
[PROOF STEP]
unfolding u_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = (1 - (Re x - Re lb) / (Re ub - Re lb)) *\<^sub>R lb + ((Re x - Re lb) / (Re ub - Re lb)) *\<^sub>R ub
[PROOF STEP]
using asm \<open>Im lb = Im ub\<close> \<open>Re lb \<le> Re ub\<close>
[PROOF STATE]
proof (prove)
using this:
Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub
Im lb = Im ub
Re lb \<le> Re ub

goal (1 subgoal):
 1. x = (1 - (Re x - Re lb) / (Re ub - Re lb)) *\<^sub>R lb + ((Re x - Re lb) / (Re ub - Re lb)) *\<^sub>R ub
[PROOF STEP]
apply (intro complex_eqI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub; Im lb = Im ub; Re lb \<le> Re ub\<rbrakk> \<Longrightarrow> Re x = Re ((1 - (Re x - Re lb) / (Re ub - Re lb)) *\<^sub>R lb + ((Re x - Re lb) / (Re ub - Re lb)) *\<^sub>R ub)
 2. \<lbrakk>Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub; Im lb = Im ub; Re lb \<le> Re ub\<rbrakk> \<Longrightarrow> Im x = Im ((1 - (Re x - Re lb) / (Re ub - Re lb)) *\<^sub>R lb + ((Re x - Re lb) / (Re ub - Re lb)) *\<^sub>R ub)
[PROOF STEP]
apply (auto simp add:field_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Im lb = Im ub; Im x = Im ub; Re lb \<le> Re x; Re x \<le> Re ub\<rbrakk> \<Longrightarrow> Re x + (Re lb * Re x - Re lb * Re lb) / (Re ub - Re lb) = Re lb + (Re ub * Re x - Re lb * Re ub) / (Re ub - Re lb)
[PROOF STEP]
apply (cases "Re ub - Re lb =0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Im lb = Im ub; Im x = Im ub; Re lb \<le> Re x; Re x \<le> Re ub; Re ub - Re lb = 0\<rbrakk> \<Longrightarrow> Re x + (Re lb * Re x - Re lb * Re lb) / (Re ub - Re lb) = Re lb + (Re ub * Re x - Re lb * Re ub) / (Re ub - Re lb)
 2. \<lbrakk>Im lb = Im ub; Im x = Im ub; Re lb \<le> Re x; Re x \<le> Re ub; Re ub - Re lb \<noteq> 0\<rbrakk> \<Longrightarrow> Re x + (Re lb * Re x - Re lb * Re lb) / (Re ub - Re lb) = Re lb + (Re ub * Re x - Re lb * Re ub) / (Re ub - Re lb)
[PROOF STEP]
apply (auto simp add:field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub

goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub

goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
have "0\<le>u" "u\<le>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> u &&& u \<le> 1
[PROOF STEP]
unfolding u_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (Re x - Re lb) / (Re ub - Re lb) &&& (Re x - Re lb) / (Re ub - Re lb) \<le> 1
[PROOF STEP]
using \<open>Re lb \<le> Re ub\<close> asm
[PROOF STATE]
proof (prove)
using this:
Re lb \<le> Re ub
Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub

goal (1 subgoal):
 1. 0 \<le> (Re x - Re lb) / (Re ub - Re lb) &&& (Re x - Re lb) / (Re ub - Re lb) \<le> 1
[PROOF STEP]
by (cases "Re ub - Re lb =0",auto simp add:field_simps)+
[PROOF STATE]
proof (state)
this:
0 \<le> u
u \<le> 1

goal (2 subgoals):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
 2. Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub
0 \<le> u
u \<le> 1
[PROOF STEP]
show "x \<in> closed_segment lb ub"
[PROOF STATE]
proof (prove)
using this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub
0 \<le> u
u \<le> 1

goal (1 subgoal):
 1. x \<in> closed_segment lb ub
[PROOF STEP]
unfolding closed_segment_def
[PROOF STATE]
proof (prove)
using this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub
0 \<le> u
u \<le> 1

goal (1 subgoal):
 1. x \<in> {(1 - u) *\<^sub>R lb + u *\<^sub>R ub |u. 0 \<le> u \<and> u \<le> 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> closed_segment lb ub

goal (1 subgoal):
 1. x \<in> closed_segment lb ub \<Longrightarrow> x \<in> closed_segment lb ub
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Im lb = Im ub; Re lb \<le> Re ub\<rbrakk> \<Longrightarrow> (x \<in> closed_segment lb ub) = (Im x = Im lb \<and> Re lb \<le> Re x \<and> Re x \<le> Re ub)

goal (4 subgoals):
 1. \<lbrakk>Re lb = Re ub; Im lb \<le> Im ub\<rbrakk> \<Longrightarrow> Re lb = Re ub
 2. \<lbrakk>Re lb = Re ub; Im lb \<le> Im ub\<rbrakk> \<Longrightarrow> Im lb \<le> Im ub
 3. \<lbrakk>Im lb = Im ub; Re lb \<le> Re ub\<rbrakk> \<Longrightarrow> Im lb = Im ub
 4. \<lbrakk>Im lb = Im ub; Re lb \<le> Re ub\<rbrakk> \<Longrightarrow> Re lb \<le> Re ub
[PROOF STEP]
qed


[STATEMENT]
lemma count_pre_union_img:
  assumes "countable B"
  shows "Y -`B = (\<Union> i. (countable_preimages B Y) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
proof (cases "B = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. B = {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
 2. B \<noteq> {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
B \<noteq> {}

goal (2 subgoals):
 1. B = {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
 2. B \<noteq> {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
have "Y -`B \<subseteq> (\<Union> i. (countable_preimages B Y) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y -` B \<subseteq> \<Union> (range (countable_preimages B Y))
[PROOF STEP]
by (simp add: assms count_pre_surj subset_eq)
[PROOF STATE]
proof (state)
this:
Y -` B \<subseteq> \<Union> (range (countable_preimages B Y))

goal (2 subgoals):
 1. B = {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
 2. B \<noteq> {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Y -` B \<subseteq> \<Union> (range (countable_preimages B Y))

goal (2 subgoals):
 1. B = {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
 2. B \<noteq> {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
have "(\<Union> i. (countable_preimages B Y) i) \<subseteq> Y -`B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (range (countable_preimages B Y)) \<subseteq> Y -` B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Union> (range (countable_preimages B Y)) \<subseteq> Y -` B
[PROOF STEP]
have f1: "\<forall>b A f n. (b::'b) \<notin> countable_preimages A f n \<or> (f b::'a) = from_nat_into A n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b A f n. b \<notin> countable_preimages A f n \<or> f b = from_nat_into A n
[PROOF STEP]
by (meson count_pre_img)
[PROOF STATE]
proof (state)
this:
\<forall>b A f n. b \<notin> countable_preimages A f n \<or> f b = from_nat_into A n

goal (1 subgoal):
 1. \<Union> (range (countable_preimages B Y)) \<subseteq> Y -` B
[PROOF STEP]
have "range (from_nat_into B) = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range (from_nat_into B) = B
[PROOF STEP]
by (meson False assms range_from_nat_into)
[PROOF STATE]
proof (state)
this:
range (from_nat_into B) = B

goal (1 subgoal):
 1. \<Union> (range (countable_preimages B Y)) \<subseteq> Y -` B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
range (from_nat_into B) = B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
range (from_nat_into B) = B

goal (1 subgoal):
 1. \<Union> (range (countable_preimages B Y)) \<subseteq> Y -` B
[PROOF STEP]
using f1
[PROOF STATE]
proof (prove)
using this:
range (from_nat_into B) = B
\<forall>b A f n. b \<notin> countable_preimages A f n \<or> f b = from_nat_into A n

goal (1 subgoal):
 1. \<Union> (range (countable_preimages B Y)) \<subseteq> Y -` B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<Union> (range (countable_preimages B Y)) \<subseteq> Y -` B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Union> (range (countable_preimages B Y)) \<subseteq> Y -` B

goal (2 subgoals):
 1. B = {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
 2. B \<noteq> {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Y -` B \<subseteq> \<Union> (range (countable_preimages B Y))
\<Union> (range (countable_preimages B Y)) \<subseteq> Y -` B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Y -` B \<subseteq> \<Union> (range (countable_preimages B Y))
\<Union> (range (countable_preimages B Y)) \<subseteq> Y -` B

goal (1 subgoal):
 1. Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Y -` B = \<Union> (range (countable_preimages B Y))

goal (1 subgoal):
 1. B = {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B = {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
B = {}

goal (1 subgoal):
 1. B = {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
hence "\<forall> i. (countable_preimages B Y) i = {}"
[PROOF STATE]
proof (prove)
using this:
B = {}

goal (1 subgoal):
 1. \<forall>i. countable_preimages B Y i = {}
[PROOF STEP]
unfolding countable_preimages_def
[PROOF STATE]
proof (prove)
using this:
B = {}

goal (1 subgoal):
 1. \<forall>i. (if infinite B \<or> finite B \<and> i < card B then Y -` {from_nat_into B i} else {}) = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>i. countable_preimages B Y i = {}

goal (1 subgoal):
 1. B = {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
hence "(\<Union> i. (countable_preimages B Y) i) = {}"
[PROOF STATE]
proof (prove)
using this:
\<forall>i. countable_preimages B Y i = {}

goal (1 subgoal):
 1. \<Union> (range (countable_preimages B Y)) = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> (range (countable_preimages B Y)) = {}

goal (1 subgoal):
 1. B = {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<Union> (range (countable_preimages B Y)) = {}

goal (1 subgoal):
 1. B = {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
have "Y -`B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y -` B = {}
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
B = {}

goal (1 subgoal):
 1. Y -` B = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Y -` B = {}

goal (1 subgoal):
 1. B = {} \<Longrightarrow> Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<Union> (range (countable_preimages B Y)) = {}
Y -` B = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Union> (range (countable_preimages B Y)) = {}
Y -` B = {}

goal (1 subgoal):
 1. Y -` B = \<Union> (range (countable_preimages B Y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Y -` B = \<Union> (range (countable_preimages B Y))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Ring) zero_ideal:"ideal R {\<zero>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal R {\<zero>}
[PROOF STEP]
apply (cut_tac ring_is_ag)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aGroup R \<Longrightarrow> ideal R {\<zero>}
[PROOF STEP]
apply (rule ideal_condition1)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. aGroup R \<Longrightarrow> {\<zero>} \<subseteq> carrier R
 2. aGroup R \<Longrightarrow> {\<zero>} \<noteq> {}
 3. aGroup R \<Longrightarrow> \<forall>x\<in>{\<zero>}. \<forall>y\<in>{\<zero>}. x \<plusminus> y \<in> {\<zero>}
 4. aGroup R \<Longrightarrow> \<forall>r\<in>carrier R. \<forall>x\<in>{\<zero>}. r \<cdot>\<^sub>r x \<in> {\<zero>}
[PROOF STEP]
apply (simp add:ring_zero)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. aGroup R \<Longrightarrow> {\<zero>} \<noteq> {}
 2. aGroup R \<Longrightarrow> \<forall>x\<in>{\<zero>}. \<forall>y\<in>{\<zero>}. x \<plusminus> y \<in> {\<zero>}
 3. aGroup R \<Longrightarrow> \<forall>r\<in>carrier R. \<forall>x\<in>{\<zero>}. r \<cdot>\<^sub>r x \<in> {\<zero>}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. aGroup R \<Longrightarrow> \<forall>x\<in>{\<zero>}. \<forall>y\<in>{\<zero>}. x \<plusminus> y \<in> {\<zero>}
 2. aGroup R \<Longrightarrow> \<forall>r\<in>carrier R. \<forall>x\<in>{\<zero>}. r \<cdot>\<^sub>r x \<in> {\<zero>}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. aGroup R \<Longrightarrow> \<zero> \<plusminus> \<zero> = \<zero>
 2. aGroup R \<Longrightarrow> \<forall>r\<in>carrier R. \<forall>x\<in>{\<zero>}. r \<cdot>\<^sub>r x \<in> {\<zero>}
[PROOF STEP]
apply (cut_tac ring_zero, simp add:aGroup.ag_l_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aGroup R \<Longrightarrow> \<forall>r\<in>carrier R. \<forall>x\<in>{\<zero>}. r \<cdot>\<^sub>r x \<in> {\<zero>}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aGroup R \<Longrightarrow> \<forall>r\<in>carrier R. r \<cdot>\<^sub>r \<zero> = \<zero>
[PROOF STEP]
apply (rule ballI, simp add:ring_times_x_0)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma upper_asymptotic_density_finite:
  assumes "finite A"
  shows "upper_asymptotic_density A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_asymptotic_density A = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. upper_asymptotic_density A = 0
[PROOF STEP]
have "(\<lambda>n. card(A \<inter> {..<n})/n) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. real (card (A \<inter> {..<n})) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
proof (rule tendsto_sandwich[where ?f = "\<lambda>n. 0" and ?h = "\<lambda>(n::nat). card A / n"])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<forall>\<^sub>F n in sequentially. 0 \<le> real (card (A \<inter> {..<n})) / real n
 2. \<forall>\<^sub>F n in sequentially. real (card (A \<inter> {..<n})) / real n \<le> real (card A) / real n
 3. (\<lambda>n. 0) \<longlonglongrightarrow> 0
 4. (\<lambda>n. real (card A) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
have "card(A \<inter> {..<n})/n \<le> card A / n" if "n>0" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (A \<inter> {..<n})) / real n \<le> real (card A) / real n
[PROOF STEP]
using that \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n
finite A

goal (1 subgoal):
 1. real (card (A \<inter> {..<n})) / real n \<le> real (card A) / real n
[PROOF STEP]
by (simp add: card_mono divide_right_mono)
[PROOF STATE]
proof (state)
this:
0 < ?n \<Longrightarrow> real (card (A \<inter> {..<?n})) / real ?n \<le> real (card A) / real ?n

goal (4 subgoals):
 1. \<forall>\<^sub>F n in sequentially. 0 \<le> real (card (A \<inter> {..<n})) / real n
 2. \<forall>\<^sub>F n in sequentially. real (card (A \<inter> {..<n})) / real n \<le> real (card A) / real n
 3. (\<lambda>n. 0) \<longlonglongrightarrow> 0
 4. (\<lambda>n. real (card A) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < ?n \<Longrightarrow> real (card (A \<inter> {..<?n})) / real ?n \<le> real (card A) / real ?n
[PROOF STEP]
show "eventually (\<lambda>n. card(A \<inter> {..<n})/n \<le> card A / n) sequentially"
[PROOF STATE]
proof (prove)
using this:
0 < ?n \<Longrightarrow> real (card (A \<inter> {..<?n})) / real ?n \<le> real (card A) / real ?n

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. real (card (A \<inter> {..<n})) / real n \<le> real (card A) / real n
[PROOF STEP]
by (simp add: eventually_at_top_dense)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. real (card (A \<inter> {..<n})) / real n \<le> real (card A) / real n

goal (3 subgoals):
 1. \<forall>\<^sub>F n in sequentially. 0 \<le> real (card (A \<inter> {..<n})) / real n
 2. (\<lambda>n. 0) \<longlonglongrightarrow> 0
 3. (\<lambda>n. real (card A) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<lambda>n. real (card A)* (1 / real n)) \<longlonglongrightarrow> real(card A) * 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. real (card A) * (1 / real n)) \<longlonglongrightarrow> real (card A) * 0
[PROOF STEP]
by (intro tendsto_intros)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. real (card A) * (1 / real n)) \<longlonglongrightarrow> real (card A) * 0

goal (3 subgoals):
 1. \<forall>\<^sub>F n in sequentially. 0 \<le> real (card (A \<inter> {..<n})) / real n
 2. (\<lambda>n. 0) \<longlonglongrightarrow> 0
 3. (\<lambda>n. real (card A) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. real (card A) * (1 / real n)) \<longlonglongrightarrow> real (card A) * 0
[PROOF STEP]
show "(\<lambda>n. real (card A) / real n) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. real (card A) * (1 / real n)) \<longlonglongrightarrow> real (card A) * 0

goal (1 subgoal):
 1. (\<lambda>n. real (card A) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. real (card A) / real n) \<longlonglongrightarrow> 0

goal (2 subgoals):
 1. \<forall>\<^sub>F n in sequentially. 0 \<le> real (card (A \<inter> {..<n})) / real n
 2. (\<lambda>n. 0) \<longlonglongrightarrow> 0
[PROOF STEP]
qed (auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. real (card (A \<inter> {..<n})) / real n) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. upper_asymptotic_density A = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. real (card (A \<inter> {..<n})) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
show "upper_asymptotic_density A = 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. real (card (A \<inter> {..<n})) / real n) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. upper_asymptotic_density A = 0
[PROOF STEP]
using upper_asymptotic_density_lim
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. real (card (A \<inter> {..<n})) / real n) \<longlonglongrightarrow> 0
(\<lambda>n. real (card (?A \<inter> {..<n})) / real n) \<longlonglongrightarrow> ?l \<Longrightarrow> upper_asymptotic_density ?A = ?l

goal (1 subgoal):
 1. upper_asymptotic_density A = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
upper_asymptotic_density A = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ln_fun_in_smallo_fun:
  assumes "filterlim f at_top at_top"
  shows   "(\<lambda>x. ln (f x) powr p :: real) \<in> o(f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (f x) powr p) \<in> o(f)
[PROOF STEP]
proof (rule smalloI_tendsto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ((\<lambda>x. ln (f x) powr p / f x) \<longlongrightarrow> 0) at_top
 2. \<forall>\<^sub>F x in at_top. f x \<noteq> 0
[PROOF STEP]
have "((\<lambda>x. ln x powr p / x powr 1) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. ln x powr p / x powr 1) \<longlongrightarrow> 0) at_top
[PROOF STEP]
by (rule tendsto_ln_powr_over_powr') simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. ln x powr p / x powr 1) \<longlongrightarrow> 0) at_top

goal (2 subgoals):
 1. ((\<lambda>x. ln (f x) powr p / f x) \<longlongrightarrow> 0) at_top
 2. \<forall>\<^sub>F x in at_top. f x \<noteq> 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>x. ln x powr p / x powr 1) \<longlongrightarrow> 0) at_top

goal (2 subgoals):
 1. ((\<lambda>x. ln (f x) powr p / f x) \<longlongrightarrow> 0) at_top
 2. \<forall>\<^sub>F x in at_top. f x \<noteq> 0
[PROOF STEP]
have "eventually (\<lambda>x. ln x powr p / x powr 1 = ln x powr p / x) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. ln x powr p / x powr 1 = ln x powr p / x
[PROOF STEP]
using eventually_gt_at_top[of "0::real"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. ln x powr p / x powr 1 = ln x powr p / x
[PROOF STEP]
by eventually_elim simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. ln x powr p / x powr 1 = ln x powr p / x

goal (2 subgoals):
 1. ((\<lambda>x. ln (f x) powr p / f x) \<longlongrightarrow> 0) at_top
 2. \<forall>\<^sub>F x in at_top. f x \<noteq> 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. ln x powr p / x powr 1) \<longlongrightarrow> 0) at_top
\<forall>\<^sub>F x in at_top. ln x powr p / x powr 1 = ln x powr p / x
[PROOF STEP]
have "((\<lambda>x. ln x powr p / x) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. ln x powr p / x powr 1) \<longlongrightarrow> 0) at_top
\<forall>\<^sub>F x in at_top. ln x powr p / x powr 1 = ln x powr p / x

goal (1 subgoal):
 1. ((\<lambda>x. ln x powr p / x) \<longlongrightarrow> 0) at_top
[PROOF STEP]
by (subst (asm) tendsto_cong)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. ln x powr p / x) \<longlongrightarrow> 0) at_top

goal (2 subgoals):
 1. ((\<lambda>x. ln (f x) powr p / f x) \<longlongrightarrow> 0) at_top
 2. \<forall>\<^sub>F x in at_top. f x \<noteq> 0
[PROOF STEP]
from this assms
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. ln x powr p / x) \<longlongrightarrow> 0) at_top
filterlim f at_top at_top
[PROOF STEP]
show "((\<lambda>x. ln (f x) powr p / f x) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. ln x powr p / x) \<longlongrightarrow> 0) at_top
filterlim f at_top at_top

goal (1 subgoal):
 1. ((\<lambda>x. ln (f x) powr p / f x) \<longlongrightarrow> 0) at_top
[PROOF STEP]
by (rule filterlim_compose)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. ln (f x) powr p / f x) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x \<noteq> 0
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
filterlim f at_top at_top
[PROOF STEP]
have "eventually (\<lambda>x. f x \<ge> 1) at_top"
[PROOF STATE]
proof (prove)
using this:
filterlim f at_top at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 1 \<le> f x
[PROOF STEP]
by (simp add: filterlim_at_top)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 1 \<le> f x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x \<noteq> 0
[PROOF STEP]
thus "eventually (\<lambda>x. f x \<noteq> 0) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. 1 \<le> f x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x \<noteq> 0
[PROOF STEP]
by eventually_elim simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. f x \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rrsmult_distrib_right :
  assumes "\<And>x y. x \<in> R \<Longrightarrow> y \<in> R \<Longrightarrow> f (x+y) = f x + f y" "r \<in> R" "s \<in> R"
  shows   "(r + s) \<currency> f = r \<currency> f + s \<currency> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r + s) \<currency> f = r \<currency> f + s \<currency> f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. ((r + s) \<currency> f) x = (r \<currency> f + s \<currency> f) x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. ((r + s) \<currency> f) x = (r \<currency> f + s \<currency> f) x
[PROOF STEP]
show "((r + s) \<currency> f) x = (r \<currency> f + s \<currency> f) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((r + s) \<currency> f) x = (r \<currency> f + s \<currency> f) x
[PROOF STEP]
using     assms mult_closed
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x3 \<in> R; ?y3 \<in> R\<rbrakk> \<Longrightarrow> f (?x3 + ?y3) = f ?x3 + f ?y3
r \<in> R
s \<in> R
\<lbrakk>?r \<in> R; ?s \<in> R\<rbrakk> \<Longrightarrow> ?r * ?s \<in> R

goal (1 subgoal):
 1. ((r + s) \<currency> f) x = (r \<currency> f + s \<currency> f) x
[PROOF STEP]
unfolding rightreg_scalar_mult_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x3 \<in> R; ?y3 \<in> R\<rbrakk> \<Longrightarrow> f (?x3 + ?y3) = f ?x3 + f ?y3
r \<in> R
s \<in> R
\<lbrakk>?r \<in> R; ?s \<in> R\<rbrakk> \<Longrightarrow> ?r * ?s \<in> R

goal (1 subgoal):
 1. (if x \<in> R then f (x * (r + s)) else (0::'a)) = ((\<lambda>x. if x \<in> R then f (x * r) else (0::'a)) + (\<lambda>x. if x \<in> R then f (x * s) else (0::'a))) x
[PROOF STEP]
by        (cases "x \<in> R") (auto simp add: distrib_left)
[PROOF STATE]
proof (state)
this:
((r + s) \<currency> f) x = (r \<currency> f + s \<currency> f) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_diag_mult_left: assumes A: "A \<in> carrier_mat n nr"
  shows "mat_diag n f * A = Matrix.mat n nr (\<lambda> (i,j). f i * A $$ (i,j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_diag n f * A = mat n nr (\<lambda>(i, j). f i * A $$ (i, j))
[PROOF STEP]
proof (rule eq_matI, insert A, auto simp: mat_diag_def scalar_prod_def, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < n; j < nr; A \<in> carrier_mat n nr\<rbrakk> \<Longrightarrow> (\<Sum>ia = 0..<n. (if i = ia then f ia else (0::'a)) * A $$ (ia, j)) = f i * A $$ (i, j)
[PROOF STEP]
case (1 i j)
[PROOF STATE]
proof (state)
this:
i < n
j < nr
A \<in> carrier_mat n nr

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < n; j < nr; A \<in> carrier_mat n nr\<rbrakk> \<Longrightarrow> (\<Sum>ia = 0..<n. (if i = ia then f ia else (0::'a)) * A $$ (ia, j)) = f i * A $$ (i, j)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
i < n
j < nr
A \<in> carrier_mat n nr

goal (1 subgoal):
 1. (\<Sum>ia = 0..<n. (if i = ia then f ia else (0::'a)) * A $$ (ia, j)) = f i * A $$ (i, j)
[PROOF STEP]
by (subst sum.remove[of _ i], auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>ia = 0..<n. (if i = ia then f ia else (0::'a)) * A $$ (ia, j)) = f i * A $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ord_nonneg:
  assumes "x \<in>  \<O>\<^sub>p"
  assumes "x \<noteq> \<zero>"
  shows "ord x \<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> ord x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> ord x
[PROOF STEP]
obtain a where A: "x = \<iota> a \<and> a \<in> carrier Z\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. x = \<iota> a \<and> a \<in> carrier Z\<^sub>p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> \<O>\<^sub>p

goal (1 subgoal):
 1. (\<And>a. x = \<iota> a \<and> a \<in> carrier Z\<^sub>p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x = \<iota> a \<and> a \<in> carrier Z\<^sub>p

goal (1 subgoal):
 1. 0 \<le> ord x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = \<iota> a \<and> a \<in> carrier Z\<^sub>p
[PROOF STEP]
have "a \<in> nonzero Z\<^sub>p"
[PROOF STATE]
proof (prove)
using this:
x = \<iota> a \<and> a \<in> carrier Z\<^sub>p

goal (1 subgoal):
 1. a \<in> nonzero Z\<^sub>p
[PROOF STEP]
using assms(2)
      local.inc_def nonzero_fraction_imp_numer_not_zero not_nonzero_Zp
[PROOF STATE]
proof (prove)
using this:
x = \<iota> a \<and> a \<in> carrier Z\<^sub>p
x \<noteq> \<zero>
?a \<in> carrier Z\<^sub>p \<Longrightarrow> \<iota> ?a = fraction Z\<^sub>p ?a \<one>\<^bsub>Z\<^sub>p\<^esub>
\<lbrakk>?a \<in> carrier Z\<^sub>p; ?b \<in> nonzero Z\<^sub>p; fraction Z\<^sub>p ?a ?b \<noteq> \<zero>\<rbrakk> \<Longrightarrow> ?a \<noteq> \<zero>\<^bsub>Z\<^sub>p\<^esub>
\<lbrakk>?x \<in> carrier Z\<^sub>p; ?x \<notin> nonzero Z\<^sub>p\<rbrakk> \<Longrightarrow> ?x = \<zero>\<^bsub>Z\<^sub>p\<^esub>

goal (1 subgoal):
 1. a \<in> nonzero Z\<^sub>p
[PROOF STEP]
using Zp.nonzero_one_closed
[PROOF STATE]
proof (prove)
using this:
x = \<iota> a \<and> a \<in> carrier Z\<^sub>p
x \<noteq> \<zero>
?a \<in> carrier Z\<^sub>p \<Longrightarrow> \<iota> ?a = fraction Z\<^sub>p ?a \<one>\<^bsub>Z\<^sub>p\<^esub>
\<lbrakk>?a \<in> carrier Z\<^sub>p; ?b \<in> nonzero Z\<^sub>p; fraction Z\<^sub>p ?a ?b \<noteq> \<zero>\<rbrakk> \<Longrightarrow> ?a \<noteq> \<zero>\<^bsub>Z\<^sub>p\<^esub>
\<lbrakk>?x \<in> carrier Z\<^sub>p; ?x \<notin> nonzero Z\<^sub>p\<rbrakk> \<Longrightarrow> ?x = \<zero>\<^bsub>Z\<^sub>p\<^esub>
\<one>\<^bsub>Z\<^sub>p\<^esub> \<in> nonzero Z\<^sub>p

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

goal (1 subgoal):
 1. 0 \<le> ord x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> nonzero Z\<^sub>p
[PROOF STEP]
have "ord_Zp a \<ge>0"
[PROOF STATE]
proof (prove)
using this:
a \<in> nonzero Z\<^sub>p

goal (1 subgoal):
 1. 0 \<le> ord_Zp a
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
a \<in> nonzero Z\<^sub>p
x = \<iota> a \<and> a \<in> carrier Z\<^sub>p

goal (1 subgoal):
 1. 0 \<le> ord_Zp a
[PROOF STEP]
by (simp add: Zp.nonzero_memE(2) ord_pos)
[PROOF STATE]
proof (state)
this:
0 \<le> ord_Zp a

goal (1 subgoal):
 1. 0 \<le> ord x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> ord_Zp a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> ord_Zp a

goal (1 subgoal):
 1. 0 \<le> ord x
[PROOF STEP]
using A \<open>a \<in> nonzero Z\<^sub>p\<close> ord_of_inc
[PROOF STATE]
proof (prove)
using this:
0 \<le> ord_Zp a
x = \<iota> a \<and> a \<in> carrier Z\<^sub>p
a \<in> nonzero Z\<^sub>p
?x \<in> nonzero Z\<^sub>p \<Longrightarrow> ord_Zp ?x = ord (\<iota> ?x)

goal (1 subgoal):
 1. 0 \<le> ord x
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
0 \<le> ord x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma adds_minus:
  assumes "s adds t"
  shows "(t - s) + s = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t - s + s = t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. t - s + s = t
[PROOF STEP]
from assms adds_def[of s t]
[PROOF STATE]
proof (chain)
picking this:
s adds t
(s adds t) = (\<exists>k. t = s + k)
[PROOF STEP]
obtain u where u: "t = u + s"
[PROOF STATE]
proof (prove)
using this:
s adds t
(s adds t) = (\<exists>k. t = s + k)

goal (1 subgoal):
 1. (\<And>u. t = u + s \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: ac_simps)
[PROOF STATE]
proof (state)
this:
t = u + s

goal (1 subgoal):
 1. t - s + s = t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t = u + s
[PROOF STEP]
have "t - s = u"
[PROOF STATE]
proof (prove)
using this:
t = u + s

goal (1 subgoal):
 1. t - s = u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
t - s = u

goal (1 subgoal):
 1. t - s + s = t
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
t - s = u

goal (1 subgoal):
 1. t - s + s = t
[PROOF STEP]
using u
[PROOF STATE]
proof (prove)
using this:
t - s = u
t = u + s

goal (1 subgoal):
 1. t - s + s = t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
t - s + s = t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_rat [simp]: "Fract a b * Fract c d = Fract (a * c) (b * d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fract a b * Fract c d = Fract (a * c) (b * d)
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma reduced_homology_group_nsphere:
  "reduced_homology_group n (nsphere n) \<cong> integer_group"
  "p \<noteq> n \<Longrightarrow> trivial_group(reduced_homology_group p (nsphere n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reduced_homology_group (int n) (nsphere n) \<cong> integer_group &&& (p \<noteq> int n \<Longrightarrow> trivial_group (reduced_homology_group p (nsphere n)))
[PROOF STEP]
using reduced_homology_group_nsphere_aux
[PROOF STATE]
proof (prove)
using this:
if ?p = int ?n then reduced_homology_group (int ?n) (nsphere ?n) \<cong> integer_group else trivial_group (reduced_homology_group ?p (nsphere ?n))

goal (1 subgoal):
 1. reduced_homology_group (int n) (nsphere n) \<cong> integer_group &&& (p \<noteq> int n \<Longrightarrow> trivial_group (reduced_homology_group p (nsphere n)))
[PROOF STEP]
by auto


[STATEMENT]
lemma moebius_comp_inv_left [simp]:
  shows "moebius_comp (moebius_inv M) M = id_moebius"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_comp (moebius_inv M) M = id_moebius
[PROOF STEP]
by (metis left_minus plus_moebius_def uminus_moebius_def zero_moebius_def)


[STATEMENT]
lemma right_lang_Reverse_disjoint:
    "q1 \<noteq> q2 \<Longrightarrow> nfa.right_lang (Reverse_nfa M) q1 \<inter> nfa.right_lang (Reverse_nfa M) q2 = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q1 \<noteq> q2 \<Longrightarrow> nfa.right_lang (Reverse_nfa M) q1 \<inter> nfa.right_lang (Reverse_nfa M) q2 = {}
[PROOF STEP]
by (auto simp: left_lang_def right_lang_Reverse)


[STATEMENT]
lemma exp_times_self_ge: "x * exp x \<ge> -exp (-1::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - exp (- 1) \<le> x * exp x
[PROOF STEP]
using exp_times_self_gt[of x]
[PROOF STATE]
proof (prove)
using this:
x \<noteq> - 1 \<Longrightarrow> - exp (- 1) < x * exp x

goal (1 subgoal):
 1. - exp (- 1) \<le> x * exp x
[PROOF STEP]
by (cases "x = -1") auto


[STATEMENT]
lemma generaliseEx:
 assumes i: "PROP Pure.prop (\<And>s. PROP Pure.prop (Trueprop (P s)) \<Longrightarrow> PROP Pure.prop (Trueprop (Q s)))"
 shows "PROP Pure.prop (PROP Pure.prop (Trueprop (\<exists>s. P s)) \<Longrightarrow> PROP Pure.prop (Trueprop (\<exists>s. Q s)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>s. P s) \<Longrightarrow> (\<exists>s. Q s)
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
\<And>s. (P s) \<Longrightarrow> (Q s)

goal (1 subgoal):
 1. (\<exists>s. P s) \<Longrightarrow> (\<exists>s. Q s)
[PROOF STEP]
by (auto simp add: prop_def)


[STATEMENT]
lemma primepow_prime_power [simp]:
    "prime (p :: 'a :: factorial_semiring_multiplicative) \<Longrightarrow> primepow (p ^ n) \<longleftrightarrow> n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> primepow (p ^ n) = (0 < n)
[PROOF STEP]
by (subst primepow_power_iff) auto


[STATEMENT]
lemma qtable_empty_iff: "qtable n A P Q empty_table = (\<forall>x. wf_tuple n A x \<longrightarrow> P x \<longrightarrow> Q x \<longrightarrow> False)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qtable n A P Q empty_table = (\<forall>x. wf_tuple n A x \<longrightarrow> P x \<longrightarrow> Q x \<longrightarrow> False)
[PROOF STEP]
unfolding qtable_def table_def empty_table_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Ball {} (wf_tuple n A) \<and> (\<forall>x. (x \<in> {} \<and> P x \<longrightarrow> Q x) \<and> (wf_tuple n A x \<and> P x \<and> Q x \<longrightarrow> x \<in> {}))) = (\<forall>x. wf_tuple n A x \<longrightarrow> P x \<longrightarrow> Q x \<longrightarrow> False)
[PROOF STEP]
by auto


[STATEMENT]
lemma poly_mult_is_polynomial:
  assumes "subring K R" "set p1 \<subseteq> K" and "set p2 \<subseteq> K"
  shows "polynomial K (poly_mult p1 p2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polynomial K (poly_mult p1 p2)
[PROOF STEP]
using assms(2-3)
[PROOF STATE]
proof (prove)
using this:
set p1 \<subseteq> K
set p2 \<subseteq> K

goal (1 subgoal):
 1. polynomial K (poly_mult p1 p2)
[PROOF STEP]
proof (induction p1)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>set [] \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult [] p2)
 2. \<And>a p1. \<lbrakk>\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2); set (a # p1) \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult (a # p1) p2)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
set [] \<subseteq> K
set p2 \<subseteq> K

goal (2 subgoals):
 1. \<lbrakk>set [] \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult [] p2)
 2. \<And>a p1. \<lbrakk>\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2); set (a # p1) \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult (a # p1) p2)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
set [] \<subseteq> K
set p2 \<subseteq> K

goal (1 subgoal):
 1. polynomial K (poly_mult [] p2)
[PROOF STEP]
by (simp add: polynomial_def)
[PROOF STATE]
proof (state)
this:
polynomial K (poly_mult [] p2)

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2); set (a # p1) \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult (a # p1) p2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2); set (a # p1) \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult (a # p1) p2)
[PROOF STEP]
case (Cons a p1)
[PROOF STATE]
proof (state)
this:
\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2)
set (a # p1) \<subseteq> K
set p2 \<subseteq> K

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2); set (a # p1) \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult (a # p1) p2)
[PROOF STEP]
let ?a_p2 = "(map (\<lambda>b. a \<otimes> b) p2) @ (replicate (degree (a # p1)) \<zero>)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2); set (a # p1) \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult (a # p1) p2)
[PROOF STEP]
have "set (poly_mult p1 p2) \<subseteq> K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (poly_mult p1 p2) \<subseteq> K
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2)
set (a # p1) \<subseteq> K
set p2 \<subseteq> K

goal (1 subgoal):
 1. set (poly_mult p1 p2) \<subseteq> K
[PROOF STEP]
unfolding polynomial_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> poly_mult p1 p2 = [] \<or> set (poly_mult p1 p2) \<subseteq> K \<and> lead_coeff (poly_mult p1 p2) \<noteq> \<zero>
set (a # p1) \<subseteq> K
set p2 \<subseteq> K

goal (1 subgoal):
 1. set (poly_mult p1 p2) \<subseteq> K
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (poly_mult p1 p2) \<subseteq> K

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2); set (a # p1) \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult (a # p1) p2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (poly_mult p1 p2) \<subseteq> K

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2); set (a # p1) \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult (a # p1) p2)
[PROOF STEP]
have "set ?a_p2 \<subseteq> K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> K
[PROOF STEP]
using assms(3) Cons(2) subringE(1-2,6)[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
set p2 \<subseteq> K
set (a # p1) \<subseteq> K
K \<subseteq> carrier R
\<zero> \<in> K
\<lbrakk>?h1.0 \<in> K; ?h2.0 \<in> K\<rbrakk> \<Longrightarrow> ?h1.0 \<otimes> ?h2.0 \<in> K

goal (1 subgoal):
 1. set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> K
[PROOF STEP]
by(induct p2) (auto)
[PROOF STATE]
proof (state)
this:
set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> K

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2); set (a # p1) \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult (a # p1) p2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set (poly_mult p1 p2) \<subseteq> K
set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> K
[PROOF STEP]
have "polynomial K (poly_add ?a_p2 (poly_mult p1 p2))"
[PROOF STATE]
proof (prove)
using this:
set (poly_mult p1 p2) \<subseteq> K
set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> K

goal (1 subgoal):
 1. polynomial K (poly_add (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) (poly_mult p1 p2))
[PROOF STEP]
using poly_add_is_polynomial[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
set (poly_mult p1 p2) \<subseteq> K
set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> K
\<lbrakk>set ?p1.0 \<subseteq> K; set ?p2.0 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_add ?p1.0 ?p2.0)

goal (1 subgoal):
 1. polynomial K (poly_add (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) (poly_mult p1 p2))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
polynomial K (poly_add (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) (poly_mult p1 p2))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>\<lbrakk>set p1 \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult p1 p2); set (a # p1) \<subseteq> K; set p2 \<subseteq> K\<rbrakk> \<Longrightarrow> polynomial K (poly_mult (a # p1) p2)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
polynomial K (poly_add (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) (poly_mult p1 p2))

goal (1 subgoal):
 1. polynomial K (poly_mult (a # p1) p2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
polynomial K (poly_mult (a # p1) p2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Carmichael_0 [simp]: "Carmichael 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael 0 = 1
[PROOF STEP]
by (simp add: Carmichael_def)


[STATEMENT]
lemma row_mat_of_rows_list:
  assumes "list_all (\<lambda>r. length r = nc) rs"
  assumes "i < length rs"
  shows "row (mat_of_rows_list nc rs) i = vec_of_list (nth rs i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (mat_of_rows_list nc rs) i = vec_of_list (rs ! i)
[PROOF STEP]
by (smt assms(1) assms(2) dim_col_mat(1) dim_vec_of_list eq_vecI index_row(2) index_vec list_all_length mat_of_rows_list_def row_mat split_conv vec_of_list_index)


[STATEMENT]
lemma Smith_normal_form_min:
  "Smith_normal_form A = Smith_normal_form_upt_k A (min (nrows A) (ncols A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Smith_normal_form A = Smith_normal_form_upt_k A (min (nrows A) (ncols A))
[PROOF STEP]
unfolding Smith_normal_form_def Smith_normal_form_upt_k_def nrows_def ncols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>a b. mod_type_class.to_nat a = mod_type_class.to_nat b \<and> mod_type_class.to_nat a + 1 < CARD('c) \<and> mod_type_class.to_nat b + 1 < CARD('b) \<longrightarrow> A $ a $ b dvd A $ (a + (1::'c)) $ (b + (1::'b))) \<and> isDiagonal A) = ((\<forall>a b. mod_type_class.to_nat a = mod_type_class.to_nat b \<and> mod_type_class.to_nat a + 1 < min CARD('c) CARD('b) \<and> mod_type_class.to_nat b + 1 < min CARD('c) CARD('b) \<longrightarrow> A $ a $ b dvd A $ (a + (1::'c)) $ (b + (1::'b))) \<and> isDiagonal_upt_k A (min CARD('c) CARD('b)))
[PROOF STEP]
unfolding isDiagonal_upt_k_def isDiagonal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>a b. mod_type_class.to_nat a = mod_type_class.to_nat b \<and> mod_type_class.to_nat a + 1 < CARD('c) \<and> mod_type_class.to_nat b + 1 < CARD('b) \<longrightarrow> A $ a $ b dvd A $ (a + (1::'c)) $ (b + (1::'b))) \<and> (\<forall>a b. mod_type_class.to_nat a \<noteq> mod_type_class.to_nat b \<longrightarrow> A $ a $ b = (0::'a))) = ((\<forall>a b. mod_type_class.to_nat a = mod_type_class.to_nat b \<and> mod_type_class.to_nat a + 1 < min CARD('c) CARD('b) \<and> mod_type_class.to_nat b + 1 < min CARD('c) CARD('b) \<longrightarrow> A $ a $ b dvd A $ (a + (1::'c)) $ (b + (1::'b))) \<and> (\<forall>a b. mod_type_class.to_nat a \<noteq> mod_type_class.to_nat b \<and> (mod_type_class.to_nat a < min CARD('c) CARD('b) \<or> mod_type_class.to_nat b < min CARD('c) CARD('b)) \<longrightarrow> A $ a $ b = (0::'a)))
[PROOF STEP]
by (auto, smt Suc_le_eq le_trans less_le min.boundedI not_less_eq_eq suc_not_zero
      to_nat_less_card to_nat_plus_one_less_card')


[STATEMENT]
lemma wf_interp_for_formula_FEXISTS:
 "\<lbrakk>wf_formula (length I) (FEXISTS \<phi>)\<rbrakk>\<Longrightarrow>
  wf_interp_for_formula (w, I) (FEXISTS \<phi>) \<longleftrightarrow> (\<forall>P. finite P \<longrightarrow> wf_interp_for_formula (w, Inr P # I) \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_formula (length I) (FEXISTS \<phi>) \<Longrightarrow> wf_interp_for_formula (w, I) (FEXISTS \<phi>) = (\<forall>P. finite P \<longrightarrow> wf_interp_for_formula (w, Inr P # I) \<phi>)
[PROOF STEP]
by (auto simp: nth_Cons' split: if_split_asm)


[STATEMENT]
lemma rel_star_contr: "X^* ; Y = (\<Union>i. (rel_d.power X i) ; Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X\<^sup>* ; Y = (\<Union>i. rel_d.power X i ; Y)
[PROOF STEP]
by (simp add: rel_star_def relcomp_UNION_distrib2)


[STATEMENT]
lemma hyperb_ineq [mono_intros]:
  "Gromov_product_at (e::'a) x z \<ge> min (Gromov_product_at e x y) (Gromov_product_at e y z) - deltaG(TYPE('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (Gromov_product_at e x y) (Gromov_product_at e y z) - deltaG TYPE('a) \<le> Gromov_product_at e x z
[PROOF STEP]
using hyperb_quad_ineq[of e y x z]
[PROOF STATE]
proof (prove)
using this:
dist e y + dist x z \<le> max (dist e x + dist y z) (dist e z + dist y x) + 2 * deltaG TYPE('a)

goal (1 subgoal):
 1. min (Gromov_product_at e x y) (Gromov_product_at e y z) - deltaG TYPE('a) \<le> Gromov_product_at e x z
[PROOF STEP]
unfolding Gromov_product_at_def min_def max_def
[PROOF STATE]
proof (prove)
using this:
dist e y + dist x z \<le> (if dist e x + dist y z \<le> dist e z + dist y x then dist e z + dist y x else dist e x + dist y z) + 2 * deltaG TYPE('a)

goal (1 subgoal):
 1. (if (dist e x + dist e y - dist x y) / 2 \<le> (dist e y + dist e z - dist y z) / 2 then (dist e x + dist e y - dist x y) / 2 else (dist e y + dist e z - dist y z) / 2) - deltaG TYPE('a) \<le> (dist e x + dist e z - dist x z) / 2
[PROOF STEP]
by (auto simp add: divide_simps algebra_simps metric_space_class.dist_commute)


[STATEMENT]
lemma up_injective:
  "\<up>x = \<up>y \<Longrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<up>x = \<up>y \<Longrightarrow> x = y
[PROOF STEP]
using order.antisym
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<le> ?b; ?b \<le> ?a\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. \<up>x = \<up>y \<Longrightarrow> x = y
[PROOF STEP]
by auto


[STATEMENT]
lemma val_ring_cfs_imp_nonneg_gauss_norm:
  assumes "g \<in> carrier (UP Q\<^sub>p)"
  assumes "\<And>n. g n \<in> \<O>\<^sub>p"
  shows "gauss_norm g \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> gauss_norm g
[PROOF STEP]
by(rule gauss_norm_geqI, rule assms, rule val_ring_memE, rule assms)


[STATEMENT]
lemma nn_integral_count_compose_inj:
  assumes "inj_on g A"
  shows "(\<integral>\<^sup>+x \<in> A. f (g x) \<partial>count_space UNIV) = (\<integral>\<^sup>+y \<in> g`A. f y \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f
[PROOF STEP]
have "(\<integral>\<^sup>+x \<in> A. f (g x) \<partial>count_space UNIV) = (\<integral>\<^sup>+x. f (g x) \<partial>count_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = \<integral>\<^sup>+ x. f (g x) \<partial>count_space A
[PROOF STEP]
by (auto simp add: nn_integral_count_space_indicator[symmetric])
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = \<integral>\<^sup>+ x. f (g x) \<partial>count_space A

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = \<integral>\<^sup>+ x. f (g x) \<partial>count_space A

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f
[PROOF STEP]
have "... = (\<integral>\<^sup>+y. f y \<partial>count_space (g`A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f (g x) \<partial>count_space A = integral\<^sup>N (count_space (g ` A)) f
[PROOF STEP]
by (simp add: assms nn_integral_bij_count_space inj_on_imp_bij_betw)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f (g x) \<partial>count_space A = integral\<^sup>N (count_space (g ` A)) f

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f (g x) \<partial>count_space A = integral\<^sup>N (count_space (g ` A)) f

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f
[PROOF STEP]
have "... = (\<integral>\<^sup>+y \<in> g`A. f y \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space (g ` A)) f = set_nn_integral (count_space UNIV) (g ` A) f
[PROOF STEP]
by (auto simp add: nn_integral_count_space_indicator[symmetric])
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space (g ` A)) f = set_nn_integral (count_space UNIV) (g ` A) f

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma higher_differentiable_on_Pair':
  "higher_differentiable_on S f k \<Longrightarrow> higher_differentiable_on T g k \<Longrightarrow>
   higher_differentiable_on (S \<times> T) (\<lambda>x. (f (fst x), g (snd x))) k"
  if S: "open S" and T: "open T"
  for f::"_::euclidean_space\<Rightarrow>_" and g::"_::euclidean_space\<Rightarrow>_"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>higher_differentiable_on S f k; higher_differentiable_on T g k\<rbrakk> \<Longrightarrow> higher_differentiable_on (S \<times> T) (\<lambda>x. (f (fst x), g (snd x))) k
[PROOF STEP]
by (auto intro!: higher_differentiable_on_Pair open_Times S T
      higher_differentiable_on_fst
      higher_differentiable_on_snd
      higher_differentiable_on_compose'[where f=f and T=S]
      higher_differentiable_on_compose'[where f=g and T=T])


[STATEMENT]
lemma reduce_system_matrix_subsets_helper_aux:
  fixes p:: "real poly"
  fixes qs :: "real poly list"
  fixes subsets :: "nat list list"
  fixes signs :: "rat list list"
  fixes S:: "nat list"
  assumes inv: "length subsets \<ge> length signs"
  assumes well_def_h: "\<forall>x. List.member S x \<longrightarrow> x < length subsets"
  assumes nonzero: "p \<noteq> 0"
  shows "alt_matrix_A signs (take_indices subsets S) = take_rows_from_matrix (alt_matrix_A signs subsets) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. alt_matrix_A signs (take_indices subsets S) = take_rows_from_matrix (alt_matrix_A signs subsets) S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. alt_matrix_A signs (take_indices subsets S) = take_rows_from_matrix (alt_matrix_A signs subsets) S
[PROOF STEP]
have h0a: "dim_row (take_rows_from_matrix (alt_matrix_A signs subsets) S) = length (take_indices subsets S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (take_rows_from_matrix (alt_matrix_A signs subsets) S) = length (take_indices subsets S)
[PROOF STEP]
unfolding take_rows_from_matrix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (take_indices (rows (alt_matrix_A signs subsets)) S)) = length (take_indices subsets S)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (take_indices (rows (alt_matrix_A signs subsets)) S) = length (take_indices subsets S)
[PROOF STEP]
unfolding take_indices_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map ((!) (rows (alt_matrix_A signs subsets))) S) = length (map ((!) subsets) S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row (take_rows_from_matrix (alt_matrix_A signs subsets) S) = length (take_indices subsets S)

goal (1 subgoal):
 1. alt_matrix_A signs (take_indices subsets S) = take_rows_from_matrix (alt_matrix_A signs subsets) S
[PROOF STEP]
have h0: "\<forall>i < length (take_indices subsets S). (row (alt_matrix_A signs (take_indices subsets S) ) i =
row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length (take_indices subsets S). row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
proof clarsimp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < length (take_indices subsets S) \<Longrightarrow> row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < length (take_indices subsets S) \<Longrightarrow> row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
assume asm: "i < length (take_indices subsets S)"
[PROOF STATE]
proof (state)
this:
i < length (take_indices subsets S)

goal (1 subgoal):
 1. \<And>i. i < length (take_indices subsets S) \<Longrightarrow> row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
have i_lt: "i < length (map ((!) (rows (alt_matrix_A signs subsets))) S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length (map ((!) (rows (alt_matrix_A signs subsets))) S)
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
i < length (take_indices subsets S)

goal (1 subgoal):
 1. i < length (map ((!) (rows (alt_matrix_A signs subsets))) S)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length (take_indices subsets S) \<Longrightarrow> i < length S
[PROOF STEP]
unfolding take_indices_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length (map ((!) subsets) S) \<Longrightarrow> i < length S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length (map ((!) (rows (alt_matrix_A signs subsets))) S)

goal (1 subgoal):
 1. \<And>i. i < length (take_indices subsets S) \<Longrightarrow> row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
have h0: "row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i =
    row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i = row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i
[PROOF STEP]
unfolding take_rows_from_matrix_def take_indices_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i = row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i = row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i

goal (1 subgoal):
 1. \<And>i. i < length (take_indices subsets S) \<Longrightarrow> row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
have dim: "(map ((!) (rows (alt_matrix_A signs subsets))) S) ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
have "dim_col (alt_matrix_A signs subsets) = length (signs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (alt_matrix_A signs subsets) = length signs
[PROOF STEP]
by (simp add: alt_matrix_A_def)
[PROOF STATE]
proof (state)
this:
dim_col (alt_matrix_A signs subsets) = length signs

goal (1 subgoal):
 1. map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim_col (alt_matrix_A signs subsets) = length signs
[PROOF STEP]
have lenh: "dim_col (alt_matrix_A signs subsets) \<le> length (subsets)"
[PROOF STATE]
proof (prove)
using this:
dim_col (alt_matrix_A signs subsets) = length signs

goal (1 subgoal):
 1. dim_col (alt_matrix_A signs subsets) \<le> length subsets
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_col (alt_matrix_A signs subsets) = length signs
length signs \<le> length subsets
\<forall>x. List.member S x \<longrightarrow> x < length subsets
p \<noteq> 0

goal (1 subgoal):
 1. dim_col (alt_matrix_A signs subsets) \<le> length subsets
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_col (alt_matrix_A signs subsets) \<le> length subsets

goal (1 subgoal):
 1. map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
have well_d: "S ! i < length (subsets)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S ! i < length subsets
[PROOF STEP]
using well_def_h
[PROOF STATE]
proof (prove)
using this:
\<forall>x. List.member S x \<longrightarrow> x < length subsets

goal (1 subgoal):
 1. S ! i < length subsets
[PROOF STEP]
using i_lt in_set_member
[PROOF STATE]
proof (prove)
using this:
\<forall>x. List.member S x \<longrightarrow> x < length subsets
i < length (map ((!) (rows (alt_matrix_A signs subsets))) S)
(?x \<in> set ?xs) = List.member ?xs ?x

goal (1 subgoal):
 1. S ! i < length subsets
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
S ! i < length subsets

goal (1 subgoal):
 1. map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
have
        map_eq: "(map ((!) (rows (alt_matrix_A signs subsets))) S) ! i  = nth (rows (alt_matrix_A signs subsets))  (S ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((!) (rows (alt_matrix_A signs subsets))) S ! i = rows (alt_matrix_A signs subsets) ! (S ! i)
[PROOF STEP]
using i_lt
[PROOF STATE]
proof (prove)
using this:
i < length (map ((!) (rows (alt_matrix_A signs subsets))) S)

goal (1 subgoal):
 1. map ((!) (rows (alt_matrix_A signs subsets))) S ! i = rows (alt_matrix_A signs subsets) ! (S ! i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map ((!) (rows (alt_matrix_A signs subsets))) S ! i = rows (alt_matrix_A signs subsets) ! (S ! i)

goal (1 subgoal):
 1. map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
have "nth (rows (alt_matrix_A signs subsets))  (S ! i) \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rows (alt_matrix_A signs subsets) ! (S ! i) \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
using col_dim
[PROOF STATE]
proof (prove)
using this:
col ?A ?i \<in> carrier_vec (dim_row ?A)

goal (1 subgoal):
 1. rows (alt_matrix_A signs subsets) ! (S ! i) \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
unfolding rows_def
[PROOF STATE]
proof (prove)
using this:
col ?A ?i \<in> carrier_vec (dim_row ?A)

goal (1 subgoal):
 1. map (row (alt_matrix_A signs subsets)) [0..<dim_row (alt_matrix_A signs subsets)] ! (S ! i) \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
using nth_map well_d
[PROOF STATE]
proof (prove)
using this:
col ?A ?i \<in> carrier_vec (dim_row ?A)
?n < length ?xs \<Longrightarrow> map ?f ?xs ! ?n = ?f (?xs ! ?n)
S ! i < length subsets

goal (1 subgoal):
 1. map (row (alt_matrix_A signs subsets)) [0..<dim_row (alt_matrix_A signs subsets)] ! (S ! i) \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
using lenh
[PROOF STATE]
proof (prove)
using this:
col ?A ?i \<in> carrier_vec (dim_row ?A)
?n < length ?xs \<Longrightarrow> map ?f ?xs ! ?n = ?f (?xs ! ?n)
S ! i < length subsets
dim_col (alt_matrix_A signs subsets) \<le> length subsets

goal (1 subgoal):
 1. map (row (alt_matrix_A signs subsets)) [0..<dim_row (alt_matrix_A signs subsets)] ! (S ! i) \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
by (simp add: alt_matrix_A_def)
[PROOF STATE]
proof (state)
this:
rows (alt_matrix_A signs subsets) ! (S ! i) \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))

goal (1 subgoal):
 1. map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rows (alt_matrix_A signs subsets) ! (S ! i) \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rows (alt_matrix_A signs subsets) ! (S ! i) \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))

goal (1 subgoal):
 1. map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
using map_eq
[PROOF STATE]
proof (prove)
using this:
rows (alt_matrix_A signs subsets) ! (S ! i) \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
map ((!) (rows (alt_matrix_A signs subsets))) S ! i = rows (alt_matrix_A signs subsets) ! (S ! i)

goal (1 subgoal):
 1. map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
[PROOF STEP]
unfolding alt_matrix_A_def
[PROOF STATE]
proof (prove)
using this:
rows (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j))) ! (S ! i) \<in> carrier_vec (dim_col (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j))))
map ((!) (rows (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j))))) S ! i = rows (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j))) ! (S ! i)

goal (1 subgoal):
 1. map ((!) (rows (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j))))) S ! i \<in> carrier_vec (dim_col (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))

goal (1 subgoal):
 1. \<And>i. i < length (take_indices subsets S) \<Longrightarrow> row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
have h1: " row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i
      = (row  (alt_matrix_A signs subsets) (S ! i)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i = row (alt_matrix_A signs subsets) (S ! i)
[PROOF STEP]
using dim i_lt mat_of_rows_row[where i = "i", where n = "(dim_col (alt_matrix_A signs subsets))",
          where vs = "(map ((!) (rows (alt_matrix_A signs subsets))) S)"]
[PROOF STATE]
proof (prove)
using this:
map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
i < length (map ((!) (rows (alt_matrix_A signs subsets))) S)
\<lbrakk>i < length (map ((!) (rows (alt_matrix_A signs subsets))) S); map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))\<rbrakk> \<Longrightarrow> row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i = map ((!) (rows (alt_matrix_A signs subsets))) S ! i

goal (1 subgoal):
 1. row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i = row (alt_matrix_A signs subsets) (S ! i)
[PROOF STEP]
using alt_matrix_char in_set_member nth_mem well_def_h
[PROOF STATE]
proof (prove)
using this:
map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))
i < length (map ((!) (rows (alt_matrix_A signs subsets))) S)
\<lbrakk>i < length (map ((!) (rows (alt_matrix_A signs subsets))) S); map ((!) (rows (alt_matrix_A signs subsets))) S ! i \<in> carrier_vec (dim_col (alt_matrix_A signs subsets))\<rbrakk> \<Longrightarrow> row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i = map ((!) (rows (alt_matrix_A signs subsets))) S ! i
alt_matrix_A ?signs ?subsets = M_mat ?signs ?subsets
(?x \<in> set ?xs) = List.member ?xs ?x
?n < length ?xs \<Longrightarrow> ?xs ! ?n \<in> set ?xs
\<forall>x. List.member S x \<longrightarrow> x < length subsets

goal (1 subgoal):
 1. row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i = row (alt_matrix_A signs subsets) (S ! i)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i = row (alt_matrix_A signs subsets) (S ! i)

goal (1 subgoal):
 1. \<And>i. i < length (take_indices subsets S) \<Longrightarrow> row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
have "row (alt_matrix_A signs (take_indices subsets S) ) i = (row  (alt_matrix_A signs subsets) (S ! i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (alt_matrix_A signs (take_indices subsets S)) i = row (alt_matrix_A signs subsets) (S ! i)
[PROOF STEP]
using subsets_are_rows
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length ?subsets. row (alt_matrix_A ?signs ?subsets) i = vec (length ?signs) (\<lambda>j. z (?subsets ! i) (?signs ! j))

goal (1 subgoal):
 1. row (alt_matrix_A signs (take_indices subsets S)) i = row (alt_matrix_A signs subsets) (S ! i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>subsets signs. \<forall>i<length subsets. row (alt_matrix_A signs subsets) i = vec (length signs) (\<lambda>j. z (subsets ! i) (signs ! j))) \<Longrightarrow> row (alt_matrix_A signs (take_indices subsets S)) i = row (alt_matrix_A signs subsets) (S ! i)
[PROOF STEP]
have f1: "i < length S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length S
[PROOF STEP]
by (metis (no_types) asm length_map take_indices_def)
[PROOF STATE]
proof (state)
this:
i < length S

goal (1 subgoal):
 1. (\<And>subsets signs. \<forall>i<length subsets. row (alt_matrix_A signs subsets) i = vec (length signs) (\<lambda>j. z (subsets ! i) (signs ! j))) \<Longrightarrow> row (alt_matrix_A signs (take_indices subsets S)) i = row (alt_matrix_A signs subsets) (S ! i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length S
[PROOF STEP]
have "List.member S (S ! i)"
[PROOF STATE]
proof (prove)
using this:
i < length S

goal (1 subgoal):
 1. List.member S (S ! i)
[PROOF STEP]
by (meson in_set_member nth_mem)
[PROOF STATE]
proof (state)
this:
List.member S (S ! i)

goal (1 subgoal):
 1. (\<And>subsets signs. \<forall>i<length subsets. row (alt_matrix_A signs subsets) i = vec (length signs) (\<lambda>j. z (subsets ! i) (signs ! j))) \<Longrightarrow> row (alt_matrix_A signs (take_indices subsets S)) i = row (alt_matrix_A signs subsets) (S ! i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
List.member S (S ! i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
List.member S (S ! i)

goal (1 subgoal):
 1. row (alt_matrix_A signs (take_indices subsets S)) i = row (alt_matrix_A signs subsets) (S ! i)
[PROOF STEP]
using f1
[PROOF STATE]
proof (prove)
using this:
List.member S (S ! i)
i < length S

goal (1 subgoal):
 1. row (alt_matrix_A signs (take_indices subsets S)) i = row (alt_matrix_A signs subsets) (S ! i)
[PROOF STEP]
by (simp add: \<open>\<And>subsets signs. \<forall>i<length subsets. row (alt_matrix_A signs subsets) i = vec (length signs) (\<lambda>j. z (subsets ! i) (signs ! j))\<close> take_indices_def well_def_h)
[PROOF STATE]
proof (state)
this:
row (alt_matrix_A signs (take_indices subsets S)) i = row (alt_matrix_A signs subsets) (S ! i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
row (alt_matrix_A signs (take_indices subsets S)) i = row (alt_matrix_A signs subsets) (S ! i)

goal (1 subgoal):
 1. \<And>i. i < length (take_indices subsets S) \<Longrightarrow> row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
row (alt_matrix_A signs (take_indices subsets S)) i = row (alt_matrix_A signs subsets) (S ! i)
[PROOF STEP]
show "(row (alt_matrix_A signs (take_indices subsets S) ) i =
      row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i)"
[PROOF STATE]
proof (prove)
using this:
row (alt_matrix_A signs (take_indices subsets S)) i = row (alt_matrix_A signs subsets) (S ! i)

goal (1 subgoal):
 1. row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
using h0 h1
[PROOF STATE]
proof (prove)
using this:
row (alt_matrix_A signs (take_indices subsets S)) i = row (alt_matrix_A signs subsets) (S ! i)
row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i = row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i
row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i = row (alt_matrix_A signs subsets) (S ! i)

goal (1 subgoal):
 1. row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
unfolding take_indices_def
[PROOF STATE]
proof (prove)
using this:
row (alt_matrix_A signs (map ((!) subsets) S)) i = row (alt_matrix_A signs subsets) (S ! i)
row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i = row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i
row (mat_of_rows (dim_col (alt_matrix_A signs subsets)) (map ((!) (rows (alt_matrix_A signs subsets))) S)) i = row (alt_matrix_A signs subsets) (S ! i)

goal (1 subgoal):
 1. row (alt_matrix_A signs (map ((!) subsets) S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i<length (take_indices subsets S). row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i

goal (1 subgoal):
 1. alt_matrix_A signs (take_indices subsets S) = take_rows_from_matrix (alt_matrix_A signs subsets) S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<length (take_indices subsets S). row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length (take_indices subsets S). row (alt_matrix_A signs (take_indices subsets S)) i = row (take_rows_from_matrix (alt_matrix_A signs subsets) S) i

goal (1 subgoal):
 1. alt_matrix_A signs (take_indices subsets S) = take_rows_from_matrix (alt_matrix_A signs subsets) S
[PROOF STEP]
unfolding alt_matrix_A_def take_rows_from_matrix_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length (take_indices subsets S). row (mat (length (take_indices subsets S)) (length signs) (\<lambda>(i, j). z (take_indices subsets S ! i) (signs ! j))) i = row (mat_of_rows (dim_col (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j)))) (take_indices (rows (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j)))) S)) i

goal (1 subgoal):
 1. mat (length (take_indices subsets S)) (length signs) (\<lambda>(i, j). z (take_indices subsets S ! i) (signs ! j)) = mat_of_rows (dim_col (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j)))) (take_indices (rows (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j)))) S)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length (take_indices subsets S). vec (length signs) (\<lambda>j. z (take_indices subsets S ! i) (signs ! j)) = row (mat_of_rows (length signs) (take_indices (rows (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j)))) S)) i \<Longrightarrow> mat (length (take_indices subsets S)) (length signs) (\<lambda>(i, j). z (take_indices subsets S ! i) (signs ! j)) = mat_of_rows (length signs) (take_indices (rows (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j)))) S)
[PROOF STEP]
using eq_rowI
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>i. i < dim_row ?B \<Longrightarrow> row ?A i = row ?B i; dim_row ?A = dim_row ?B; dim_col ?A = dim_col ?B\<rbrakk> \<Longrightarrow> ?A = ?B

goal (1 subgoal):
 1. \<forall>i<length (take_indices subsets S). vec (length signs) (\<lambda>j. z (take_indices subsets S ! i) (signs ! j)) = row (mat_of_rows (length signs) (take_indices (rows (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j)))) S)) i \<Longrightarrow> mat (length (take_indices subsets S)) (length signs) (\<lambda>(i, j). z (take_indices subsets S ! i) (signs ! j)) = mat_of_rows (length signs) (take_indices (rows (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j)))) S)
[PROOF STEP]
by (metis alt_matrix_A_def dim_col_mat(1) dim_row_mat(1) h0 length_map mat_of_rows_def take_indices_def take_rows_from_matrix_def)
[PROOF STATE]
proof (state)
this:
alt_matrix_A signs (take_indices subsets S) = take_rows_from_matrix (alt_matrix_A signs subsets) S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_0_imp_prod_zero:
  fixes f g :: "real \<Rightarrow> real"
  assumes "eventually (\<lambda>x. f x = 0) at_top"
  shows   "eventually (\<lambda>x. f x * g x = 0) at_top" "eventually (\<lambda>x. g x * f x = 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x * g x = 0 &&& \<forall>\<^sub>F x in at_top. g x * f x = 0
[PROOF STEP]
by (use assms in eventually_elim; simp)+


[STATEMENT]
lemma differentiable_on_add [simp, derivative_intros]:
   "\<lbrakk>f differentiable_on S; g differentiable_on S\<rbrakk> \<Longrightarrow> (\<lambda>z. f z + g z) differentiable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable_on S; g differentiable_on S\<rbrakk> \<Longrightarrow> (\<lambda>z. f z + g z) differentiable_on S
[PROOF STEP]
by (simp add: differentiable_on_def)


[STATEMENT]
lemma trunc_zero:
  assumes "f \<in> carrier P"
  assumes "degree f = 0"
  shows "trunc f = \<zero>\<^bsub>P\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cring_Poly.truncate R f = \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
unfolding truncate_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<ominus>\<^bsub>UP R\<^esub> leading_term R f = \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
using assms ltrm_deg_0[of f]
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier P
deg R f = 0
\<lbrakk>f \<in> carrier P; deg R f = 0\<rbrakk> \<Longrightarrow> monom P (f (deg R f)) (deg R f) = f

goal (1 subgoal):
 1. f \<ominus>\<^bsub>UP R\<^esub> leading_term R f = \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
by (metis P.r_neg P_def a_minus_def leading_term_def)


[STATEMENT]
lemma strict_order_greek_less:
  assumes "strict_order r"
  shows "strict_order (greek_less r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_order (greek_less r)
[PROOF STEP]
by (simp add: greek_less_def strict_order_lfp[OF mono_nest strict_order_nest[OF assms]])


[STATEMENT]
lemma countable_card_of_nat: "countable A \<longleftrightarrow> |A| \<le>o |UNIV::nat set|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable A = (|A| \<le>o |UNIV|)
[PROOF STEP]
unfolding countable_def card_of_ordLeq[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>f. inj_on f A) = (\<exists>f. inj_on f A \<and> f ` A \<subseteq> UNIV)
[PROOF STEP]
by auto


[STATEMENT]
lemma interior_complement: "interior (- S) = - closure S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior (- S) = - closure S
[PROOF STEP]
by (simp add: closure_interior)


[STATEMENT]
lemma rank_mul_le_left:
  fixes A :: "real^'n^'m" and B :: "real^'p^'n"
  shows "rank(A ** B) \<le> rank A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (A ** B) \<le> rank A
[PROOF STEP]
by (metis matrix_transpose_mul rank_mul_le_right rank_transpose)


[STATEMENT]
lemma closed_le_abs [simp]:
  "closed {x. (C::real) \<le> abs x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x. C \<le> \<bar>x\<bar>}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed {x. C \<le> \<bar>x\<bar>}
[PROOF STEP]
have *: "{x. C \<le> \<bar>x\<bar>} = abs-`{C..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. C \<le> \<bar>x\<bar>} = abs -` {C..}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x. C \<le> \<bar>x\<bar>} = abs -` {C..}

goal (1 subgoal):
 1. closed {x. C \<le> \<bar>x\<bar>}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x. C \<le> \<bar>x\<bar>}
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (abs -` {C..})
[PROOF STEP]
by (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
closed {x. C \<le> \<bar>x\<bar>}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_exp: "summable (\<lambda>n. inverse (fact n) * x^n)"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. inverse (fact n) * x ^ n)
[PROOF STEP]
using summable_exp_generic [where x=x]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. x ^ n /\<^sub>R fact n)

goal (1 subgoal):
 1. summable (\<lambda>n. inverse (fact n) * x ^ n)
[PROOF STEP]
by (simp add: scaleR_conv_of_real nonzero_of_real_inverse)


[STATEMENT]
lemma residue_primroot_modulus_mult_coprime_imp_Carmichael_coprime:
  assumes "coprime m n" and "residue_primroot (m * n) g"
  shows   "coprime (Carmichael m) (Carmichael n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime (Carmichael m) (Carmichael n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coprime (Carmichael m) (Carmichael n)
[PROOF STEP]
from residue_primroot_modulus_mult_coprimeD[OF assms]
[PROOF STATE]
proof (chain)
picking this:
residue_primroot m g
residue_primroot n g
[PROOF STEP]
have *: "residue_primroot m g" "residue_primroot n g"
[PROOF STATE]
proof (prove)
using this:
residue_primroot m g
residue_primroot n g

goal (1 subgoal):
 1. residue_primroot m g &&& residue_primroot n g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
residue_primroot m g
residue_primroot n g

goal (1 subgoal):
 1. coprime (Carmichael m) (Carmichael n)
[PROOF STEP]
hence [simp]: "Carmichael m = totient m" "Carmichael n = totient n"
[PROOF STATE]
proof (prove)
using this:
residue_primroot m g
residue_primroot n g

goal (1 subgoal):
 1. Carmichael m = totient m &&& Carmichael n = totient n
[PROOF STEP]
by (simp_all add: residue_primroot_Carmichael)
[PROOF STATE]
proof (state)
this:
Carmichael m = totient m
Carmichael n = totient n

goal (1 subgoal):
 1. coprime (Carmichael m) (Carmichael n)
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
residue_primroot m g
residue_primroot n g
[PROOF STEP]
have mn: "m > 0" "n > 0"
[PROOF STATE]
proof (prove)
using this:
residue_primroot m g
residue_primroot n g

goal (1 subgoal):
 1. 0 < m &&& 0 < n
[PROOF STEP]
by (auto simp: residue_primroot_def)
[PROOF STATE]
proof (state)
this:
0 < m
0 < n

goal (1 subgoal):
 1. coprime (Carmichael m) (Carmichael n)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
coprime m n
residue_primroot (m * n) g
[PROOF STEP]
have "Carmichael (m * n) = totient (m * n) \<and> n > 0"
[PROOF STATE]
proof (prove)
using this:
coprime m n
residue_primroot (m * n) g

goal (1 subgoal):
 1. Carmichael (m * n) = totient (m * n) \<and> 0 < n
[PROOF STEP]
using residue_primroot_iff_Carmichael[of "m * n"]
[PROOF STATE]
proof (prove)
using this:
coprime m n
residue_primroot (m * n) g
(\<exists>g. residue_primroot (m * n) g) = (Carmichael (m * n) = totient (m * n) \<and> 0 < m * n)

goal (1 subgoal):
 1. Carmichael (m * n) = totient (m * n) \<and> 0 < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Carmichael (m * n) = totient (m * n) \<and> 0 < n

goal (1 subgoal):
 1. coprime (Carmichael m) (Carmichael n)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
coprime m n
residue_primroot (m * n) g
Carmichael (m * n) = totient (m * n) \<and> 0 < n
[PROOF STEP]
have "lcm (totient m) (totient n) = totient m * totient n"
[PROOF STATE]
proof (prove)
using this:
coprime m n
residue_primroot (m * n) g
Carmichael (m * n) = totient (m * n) \<and> 0 < n

goal (1 subgoal):
 1. lcm (totient m) (totient n) = totient m * totient n
[PROOF STEP]
by (simp add: Carmichael_mult_coprime totient_mult_coprime)
[PROOF STATE]
proof (state)
this:
lcm (totient m) (totient n) = totient m * totient n

goal (1 subgoal):
 1. coprime (Carmichael m) (Carmichael n)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
lcm (totient m) (totient n) = totient m * totient n

goal (1 subgoal):
 1. coprime (Carmichael m) (Carmichael n)
[PROOF STEP]
unfolding coprime_iff_gcd_eq_1
[PROOF STATE]
proof (prove)
using this:
lcm (totient m) (totient n) = totient m * totient n

goal (1 subgoal):
 1. gcd (Carmichael m) (Carmichael n) = 1
[PROOF STEP]
using mn
[PROOF STATE]
proof (prove)
using this:
lcm (totient m) (totient n) = totient m * totient n
0 < m
0 < n

goal (1 subgoal):
 1. gcd (Carmichael m) (Carmichael n) = 1
[PROOF STEP]
by (simp add: lcm_nat_def dvd_div_eq_mult)
[PROOF STATE]
proof (state)
this:
coprime (Carmichael m) (Carmichael n)

goal:
No subgoals!
[PROOF STEP]
qed