[STATEMENT]
lemma replace_basis :
  assumes closed: "set vs \<subseteq> V" and indep_vs: "lin_independent vs"
  shows   "\<lbrakk> length us \<le> length vs; set us \<subseteq> Span vs; lin_independent us \<rbrakk>
                \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs
                  \<and> basis_for (Span vs) (take (length vs) (us @ pvs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs))
[PROOF STEP]
proof (induct us)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>length [] \<le> length vs; set [] \<subseteq> RSpan vs; R_lin_independent []\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ([] @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ([] @ pvs)) \<and> R_lin_independent (take (length vs) ([] @ pvs))
 2. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
length [] \<le> length vs
set [] \<subseteq> RSpan vs
R_lin_independent []

goal (2 subgoals):
 1. \<lbrakk>length [] \<le> length vs; set [] \<subseteq> RSpan vs; R_lin_independent []\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ([] @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ([] @ pvs)) \<and> R_lin_independent (take (length vs) ([] @ pvs))
 2. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
from closed indep_vs
[PROOF STATE]
proof (chain)
picking this:
set vs \<subseteq> V
R_lin_independent vs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> V
R_lin_independent vs

goal (1 subgoal):
 1. \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ([] @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ([] @ pvs)) \<and> R_lin_independent (take (length vs) ([] @ pvs))
[PROOF STEP]
using Span_contains_spanset[of vs]
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> V
R_lin_independent vs
set vs \<subseteq> V \<Longrightarrow> set vs \<subseteq> RSpan vs

goal (1 subgoal):
 1. \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ([] @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ([] @ pvs)) \<and> R_lin_independent (take (length vs) ([] @ pvs))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ([] @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ([] @ pvs)) \<and> R_lin_independent (take (length vs) ([] @ pvs))

goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
case (Cons u us)
[PROOF STATE]
proof (state)
this:
\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs))
length (u # us) \<le> length vs
set (u # us) \<subseteq> RSpan vs
R_lin_independent (u # us)

goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs))
length (u # us) \<le> length vs
set (u # us) \<subseteq> RSpan vs
R_lin_independent (u # us)
[PROOF STEP]
obtain ppvs
    where ppvs: "length ppvs = length vs" "set ppvs = set vs"
                "basis_for (Span vs) (take (length vs) (us @ ppvs))"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs))
length (u # us) \<le> length vs
set (u # us) \<subseteq> RSpan vs
R_lin_independent (u # us)

goal (1 subgoal):
 1. (\<And>ppvs. \<lbrakk>length ppvs = length vs; set ppvs = set vs; set (take (length vs) (us @ ppvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ ppvs)) \<and> R_lin_independent (take (length vs) (us @ ppvs))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using lin_independent_ConsD1[of u us]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs))
length (u # us) \<le> length vs
set (u # us) \<subseteq> RSpan vs
R_lin_independent (u # us)
R_lin_independent (u # us) \<Longrightarrow> R_lin_independent us

goal (1 subgoal):
 1. (\<And>ppvs. \<lbrakk>length ppvs = length vs; set ppvs = set vs; set (take (length vs) (us @ ppvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ ppvs)) \<and> R_lin_independent (take (length vs) (us @ ppvs))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by    auto
[PROOF STATE]
proof (state)
this:
length ppvs = length vs
set ppvs = set vs
set (take (length vs) (us @ ppvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ ppvs)) \<and> R_lin_independent (take (length vs) (us @ ppvs))

goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
define fppvs bppvs
    where "fppvs = take (length vs - length us) ppvs"
      and "bppvs = drop (length vs - length us) ppvs"
[PROOF STATE]
proof (state)
this:
fppvs = take (length vs - length us) ppvs
bppvs = drop (length vs - length us) ppvs

goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
with ppvs(1) Cons(2)
[PROOF STATE]
proof (chain)
picking this:
length ppvs = length vs
length (u # us) \<le> length vs
fppvs = take (length vs - length us) ppvs
bppvs = drop (length vs - length us) ppvs
[PROOF STEP]
have ppvs_decomp: "ppvs = fppvs @ bppvs"
    and  len_fppvs  : "length fppvs = length vs - length us"
[PROOF STATE]
proof (prove)
using this:
length ppvs = length vs
length (u # us) \<le> length vs
fppvs = take (length vs - length us) ppvs
bppvs = drop (length vs - length us) ppvs

goal (1 subgoal):
 1. ppvs = fppvs @ bppvs &&& length fppvs = length vs - length us
[PROOF STEP]
by    auto
[PROOF STATE]
proof (state)
this:
ppvs = fppvs @ bppvs
length fppvs = length vs - length us

goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
from closed Cons(3)
[PROOF STATE]
proof (chain)
picking this:
set vs \<subseteq> V
set (u # us) \<subseteq> RSpan vs
[PROOF STEP]
have uus_V:  "u \<in> V" "set us \<subseteq> V"
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> V
set (u # us) \<subseteq> RSpan vs

goal (1 subgoal):
 1. u \<in> V &&& set us \<subseteq> V
[PROOF STEP]
using Span_closed
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> V
set (u # us) \<subseteq> RSpan vs
set ?ms \<subseteq> V \<Longrightarrow> RSpan ?ms \<subseteq> V

goal (1 subgoal):
 1. u \<in> V &&& set us \<subseteq> V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u \<in> V
set us \<subseteq> V

goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
from closed ppvs(2)
[PROOF STATE]
proof (chain)
picking this:
set vs \<subseteq> V
set ppvs = set vs
[PROOF STEP]
have "set ppvs \<subseteq> V"
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> V
set ppvs = set vs

goal (1 subgoal):
 1. set ppvs \<subseteq> V
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
set ppvs \<subseteq> V

goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
with fppvs_def
[PROOF STATE]
proof (chain)
picking this:
fppvs = take (length vs - length us) ppvs
set ppvs \<subseteq> V
[PROOF STEP]
have fppvs_V: "set fppvs \<subseteq> V"
[PROOF STATE]
proof (prove)
using this:
fppvs = take (length vs - length us) ppvs
set ppvs \<subseteq> V

goal (1 subgoal):
 1. set fppvs \<subseteq> V
[PROOF STEP]
using set_take_subset[of _ ppvs]
[PROOF STATE]
proof (prove)
using this:
fppvs = take (length vs - length us) ppvs
set ppvs \<subseteq> V
set (take ?n ppvs) \<subseteq> set ppvs

goal (1 subgoal):
 1. set fppvs \<subseteq> V
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
set fppvs \<subseteq> V

goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
from fppvs_def Cons(2)
[PROOF STATE]
proof (chain)
picking this:
fppvs = take (length vs - length us) ppvs
length (u # us) \<le> length vs
[PROOF STEP]
have prev_basis_decomp: "take (length vs) (us @ ppvs) = us @ fppvs"
[PROOF STATE]
proof (prove)
using this:
fppvs = take (length vs - length us) ppvs
length (u # us) \<le> length vs

goal (1 subgoal):
 1. take (length vs) (us @ ppvs) = us @ fppvs
[PROOF STEP]
by   auto
[PROOF STATE]
proof (state)
this:
take (length vs) (us @ ppvs) = us @ fppvs

goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
with Cons(3,4) ppvs(3) fppvs_V uus_V
[PROOF STATE]
proof (chain)
picking this:
set (u # us) \<subseteq> RSpan vs
R_lin_independent (u # us)
set (take (length vs) (us @ ppvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ ppvs)) \<and> R_lin_independent (take (length vs) (us @ ppvs))
set fppvs \<subseteq> V
u \<in> V
set us \<subseteq> V
take (length vs) (us @ ppvs) = us @ fppvs
[PROOF STEP]
obtain xs y ys
    where xs_y_ys: "fppvs = xs @ y # ys" "basis_for (Span vs) (u # us @ xs @ ys)"
[PROOF STATE]
proof (prove)
using this:
set (u # us) \<subseteq> RSpan vs
R_lin_independent (u # us)
set (take (length vs) (us @ ppvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ ppvs)) \<and> R_lin_independent (take (length vs) (us @ ppvs))
set fppvs \<subseteq> V
u \<in> V
set us \<subseteq> V
take (length vs) (us @ ppvs) = us @ fppvs

goal (1 subgoal):
 1. (\<And>xs y ys. \<lbrakk>fppvs = xs @ y # ys; set (u # us @ xs @ ys) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (u # us @ xs @ ys) \<and> R_lin_independent (u # us @ xs @ ys)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using lin_independent_imp_hd_independent_from_Span
          replace_basis_one_step[of fppvs us u]
[PROOF STATE]
proof (prove)
using this:
set (u # us) \<subseteq> RSpan vs
R_lin_independent (u # us)
set (take (length vs) (us @ ppvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ ppvs)) \<and> R_lin_independent (take (length vs) (us @ ppvs))
set fppvs \<subseteq> V
u \<in> V
set us \<subseteq> V
take (length vs) (us @ ppvs) = us @ fppvs
\<lbrakk>?m \<in> V; set ?ms \<subseteq> V; R_lin_independent (?m # ?ms)\<rbrakk> \<Longrightarrow> ?m \<notin> RSpan ?ms
\<lbrakk>set fppvs \<subseteq> V; set us \<subseteq> V; R_lin_independent (us @ fppvs); u \<in> RSpan (us @ fppvs) - RSpan us\<rbrakk> \<Longrightarrow> \<exists>xs y ys. fppvs = xs @ y # ys \<and> set (u # us @ xs @ ys) \<subseteq> RSpan (us @ fppvs) \<and> RSpan (us @ fppvs) = RSpan (u # us @ xs @ ys) \<and> R_lin_independent (u # us @ xs @ ys)

goal (1 subgoal):
 1. (\<And>xs y ys. \<lbrakk>fppvs = xs @ y # ys; set (u # us @ xs @ ys) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (u # us @ xs @ ys) \<and> R_lin_independent (u # us @ xs @ ys)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by    auto
[PROOF STATE]
proof (state)
this:
fppvs = xs @ y # ys
set (u # us @ xs @ ys) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (u # us @ xs @ ys) \<and> R_lin_independent (u # us @ xs @ ys)

goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
define pvs where "pvs = xs @ ys @ y # bppvs"
[PROOF STATE]
proof (state)
this:
pvs = xs @ ys @ y # bppvs

goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
with xs_y_ys len_fppvs ppvs_decomp ppvs(1,2)
[PROOF STATE]
proof (chain)
picking this:
fppvs = xs @ y # ys
set (u # us @ xs @ ys) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (u # us @ xs @ ys) \<and> R_lin_independent (u # us @ xs @ ys)
length fppvs = length vs - length us
ppvs = fppvs @ bppvs
length ppvs = length vs
set ppvs = set vs
pvs = xs @ ys @ y # bppvs
[PROOF STEP]
have "length pvs = length vs" "set pvs = set vs"
         "basis_for (Span vs) (take (length vs) ((u # us) @ pvs))"
[PROOF STATE]
proof (prove)
using this:
fppvs = xs @ y # ys
set (u # us @ xs @ ys) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (u # us @ xs @ ys) \<and> R_lin_independent (u # us @ xs @ ys)
length fppvs = length vs - length us
ppvs = fppvs @ bppvs
length ppvs = length vs
set ppvs = set vs
pvs = xs @ ys @ y # bppvs

goal (1 subgoal):
 1. length pvs = length vs &&& set pvs = set vs &&& set (take (length vs) ((u # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((u # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((u # us) @ pvs))
[PROOF STEP]
using take_append[of "length vs" "u # us @ xs @ ys"]
[PROOF STATE]
proof (prove)
using this:
fppvs = xs @ y # ys
set (u # us @ xs @ ys) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (u # us @ xs @ ys) \<and> R_lin_independent (u # us @ xs @ ys)
length fppvs = length vs - length us
ppvs = fppvs @ bppvs
length ppvs = length vs
set ppvs = set vs
pvs = xs @ ys @ y # bppvs
take (length vs) ((u # us @ xs @ ys) @ ?ys) = take (length vs) (u # us @ xs @ ys) @ take (length vs - length (u # us @ xs @ ys)) ?ys

goal (1 subgoal):
 1. length pvs = length vs &&& set pvs = set vs &&& set (take (length vs) ((u # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((u # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((u # us) @ pvs))
[PROOF STEP]
by    auto
[PROOF STATE]
proof (state)
this:
length pvs = length vs
set pvs = set vs
set (take (length vs) ((u # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((u # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((u # us) @ pvs))

goal (1 subgoal):
 1. \<And>a us. \<lbrakk>\<lbrakk>length us \<le> length vs; set us \<subseteq> RSpan vs; R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) (us @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) (us @ pvs)) \<and> R_lin_independent (take (length vs) (us @ pvs)); length (a # us) \<le> length vs; set (a # us) \<subseteq> RSpan vs; R_lin_independent (a # us)\<rbrakk> \<Longrightarrow> \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((a # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((a # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((a # us) @ pvs))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
length pvs = length vs
set pvs = set vs
set (take (length vs) ((u # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((u # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((u # us) @ pvs))

goal (1 subgoal):
 1. \<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((u # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((u # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((u # us) @ pvs))
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
\<exists>pvs. length pvs = length vs \<and> set pvs = set vs \<and> set (take (length vs) ((u # us) @ pvs)) \<subseteq> RSpan vs \<and> RSpan vs = RSpan (take (length vs) ((u # us) @ pvs)) \<and> R_lin_independent (take (length vs) ((u # us) @ pvs))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma CauchyD: "Cauchy X \<Longrightarrow> 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e"
  for X :: "nat \<Rightarrow> 'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Cauchy X; 0 < e\<rbrakk> \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e
[PROOF STEP]
by (simp add: Cauchy_iff)


[STATEMENT]
lemma S_order2_add: "s\<in>S \<Longrightarrow> s + s = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<in> (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g}) \<Longrightarrow> s + s = 0
[PROOF STEP]
using fundfoldpairs_induced_autormorph_bij zero_permutation.abs_eq
[PROOF STATE]
proof (prove)
using this:
(?f, ?g) \<in> fundfoldpairs \<Longrightarrow> bij (induced_automorph ?f ?g)
0 = Abs_permutation id

goal (1 subgoal):
 1. s \<in> (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g}) \<Longrightarrow> s + s = 0
[PROOF STEP]
by    (fastforce simp add:
          plus_permutation_abs_eq fundfoldpairs_induced_autormorph_order2
        )


[STATEMENT]
lemma Ico_subset_finite: "i \<subseteq> {a ..< b::nat} \<Longrightarrow> finite i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<subseteq> {a..<b} \<Longrightarrow> finite i
[PROOF STEP]
by (auto dest: finite_subset)


[STATEMENT]
lemma accum3_lemma [simp]:
  shows "rec_eval (rec_accum3 f) [x, y1, y2, y3] = (\<Prod> z \<le> x. (rec_eval f)  [z, y1, y2, y3])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_eval (rec_accum3 f) [x, y1, y2, y3] = (\<Prod>z\<le>x. rec_eval f [z, y1, y2, y3])
[PROOF STEP]
by (induct x) (simp_all add: rec_accum3_def)


[STATEMENT]
lemma nonzero_times_divide_eq:
  "a \<in> carrier R \<Longrightarrow> b \<in> carrier R \<Longrightarrow> c \<in> carrier R \<Longrightarrow> d \<in> carrier R \<Longrightarrow>
    b \<noteq> \<zero> \<Longrightarrow> d \<noteq> \<zero> \<Longrightarrow> (a \<oslash> b) \<otimes> (c \<oslash> d) = (a \<otimes> c) \<oslash> (b \<otimes> d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; c \<in> carrier R; d \<in> carrier R; b \<noteq> \<zero>; d \<noteq> \<zero>\<rbrakk> \<Longrightarrow> a \<oslash> b \<otimes> (c \<oslash> d) = a \<otimes> c \<oslash> (b \<otimes> d)
[PROOF STEP]
by (simp add: m_div_def nonzero_inverse_mult_distrib m_ac integral_iff)


[STATEMENT]
lemma takeWhile_sing_pow: "takeWhile (\<lambda> x. x = a) w = w \<longleftrightarrow> w = [a]\<^sup>@\<^bold>|w\<^bold>|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (takeWhile (\<lambda>x. x = a) w = w) = (w = [a] \<^sup>@ \<^bold>|w\<^bold>|)
[PROOF STEP]
by(induct w,  auto)


[STATEMENT]
lemma val_of_inv:
  assumes "a \<in> carrier Q\<^sub>p"
  assumes "a \<noteq> \<zero>"
  shows "val (inv\<^bsub>Q\<^sub>p\<^esub> a) = - (val a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val (inv a) = - val a
[PROOF STEP]
using ord_of_inv
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> carrier Q\<^sub>p; ?a \<noteq> \<zero>\<rbrakk> \<Longrightarrow> ord (inv ?a) = - ord ?a

goal (1 subgoal):
 1. val (inv a) = - val a
[PROOF STEP]
unfolding uminus_eint_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> carrier Q\<^sub>p; ?a \<noteq> \<zero>\<rbrakk> \<Longrightarrow> ord (inv ?a) = - ord ?a

goal (1 subgoal):
 1. val (inv a) = (case val a of eint m \<Rightarrow> eint (- m) | \<infinity> \<Rightarrow> \<infinity>)
[PROOF STEP]
by (simp add: assms(1) assms(2) inv_in_frac(2) val_def)


[STATEMENT]
lemma val_relation_setI:
  assumes "as!0 \<in> carrier Q\<^sub>p"
  assumes "as!1 \<in> carrier Q\<^sub>p"
  assumes "length as = 2"
  assumes "val (as!1) \<le> val(as!0)"
  shows "as \<in> val_relation_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. as \<in> val_relation_set
[PROOF STEP]
unfolding val_relation_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. as \<in> {as \<in> carrier (Q\<^sub>p\<^bsup>2\<^esup>). val (as ! 1) \<le> val (as ! 0)}
[PROOF STEP]
using assms Qp_2I[of "as!0" "as!1"]
[PROOF STATE]
proof (prove)
using this:
as ! 0 \<in> carrier Q\<^sub>p
as ! 1 \<in> carrier Q\<^sub>p
length as = 2
val (as ! 1) \<le> val (as ! 0)
\<lbrakk>as ! 0 \<in> carrier Q\<^sub>p; as ! 1 \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> [as ! 0, as ! 1] \<in> carrier (Q\<^sub>p\<^bsup>2\<^esup>)

goal (1 subgoal):
 1. as \<in> {as \<in> carrier (Q\<^sub>p\<^bsup>2\<^esup>). val (as ! 1) \<le> val (as ! 0)}
[PROOF STEP]
by (metis (no_types, lifting) mem_Collect_eq pair_id)


[STATEMENT]
lemma mapCollect_cong[fundef_cong]:
  "(\<And> k v. m1 k = Some v \<Longrightarrow> f1 k v = f2 k v) \<Longrightarrow> m1 = m2 \<Longrightarrow> mapCollect f1 m1 = mapCollect f2 m2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>k v. m1 k = Some v \<Longrightarrow> f1 k v = f2 k v; m1 = m2\<rbrakk> \<Longrightarrow> mapCollect f1 m1 = mapCollect f2 m2
[PROOF STEP]
unfolding mapCollect_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>k v. m1 k = Some v \<Longrightarrow> f1 k v = f2 k v; m1 = m2\<rbrakk> \<Longrightarrow> {f1 k v |k v. m1 k = Some v} = {f2 k v |k v. m2 k = Some v}
[PROOF STEP]
by force


[STATEMENT]
lemma set_eq_iff_mset_remdups_eq:
  \<open>set x = set y \<longleftrightarrow> mset (remdups x) = mset (remdups y)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (set x = set y) = (mset (remdups x) = mset (remdups y))
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. set x = set y \<Longrightarrow> mset (remdups x) = mset (remdups y)
 2. mset (remdups x) = mset (remdups y) \<Longrightarrow> set x = set y
[PROOF STEP]
apply (simp add: set_eq_iff_mset_eq_distinct[THEN iffD1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (remdups x) = mset (remdups y) \<Longrightarrow> set x = set y
[PROOF STEP]
apply (drule distinct_remdups [THEN distinct_remdups
      [THEN set_eq_iff_mset_eq_distinct [THEN iffD2]]])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (remdups x) = set (remdups y) \<Longrightarrow> set x = set y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma asymptotics5: "eventually (\<lambda>x. ln (b*x - hb*x*ln x powr -(1+e)) powr (-e/2) < 1) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. ln (b * x - hb * x * ln x powr - (1 + e)) powr (- e / 2) < 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. ln (b * x - hb * x * ln x powr - (1 + e)) powr (- e / 2) < 1
[PROOF STEP]
from bep
[PROOF STATE]
proof (chain)
picking this:
0 < b
b < 1
0 < e
0 < hb
[PROOF STEP]
have "((\<lambda>x. b - hb * ln x powr -(1+e)) \<longlongrightarrow> b - 0) at_top"
[PROOF STATE]
proof (prove)
using this:
0 < b
b < 1
0 < e
0 < hb

goal (1 subgoal):
 1. ((\<lambda>x. b - hb * ln x powr - (1 + e)) \<longlongrightarrow> b - 0) at_top
[PROOF STEP]
by (intro tendsto_intros tendsto_mult_right_zero tendsto_neg_powr ln_at_top) simp_all
[PROOF STATE]
proof (state)
this:
((\<lambda>x. b - hb * ln x powr - (1 + e)) \<longlongrightarrow> b - 0) at_top

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

goal (1 subgoal):
 1. LIM x at_top. (b - hb * ln x powr - (1 + e)) * x :> at_top
[PROOF STEP]
by (rule filterlim_tendsto_pos_mult_at_top[OF _ _ filterlim_ident], insert bep) simp_all
[PROOF STATE]
proof (state)
this:
LIM x at_top. (b - hb * ln x powr - (1 + e)) * x :> at_top

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

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. ln (b * x - hb * x * ln x powr - (1 + e)) powr (- e / 2) < 1
[PROOF STEP]
have "(\<lambda>x. (b - hb * ln x powr -(1+e)) * x) = (\<lambda>x. b*x - hb*x*ln x powr -(1+e))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (b - hb * ln x powr - (1 + e)) * x) = (\<lambda>x. b * x - hb * x * ln x powr - (1 + e))
[PROOF STEP]
by (intro ext) (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (b - hb * ln x powr - (1 + e)) * x) = (\<lambda>x. b * x - hb * x * ln x powr - (1 + e))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. ln (b * x - hb * x * ln x powr - (1 + e)) powr (- e / 2) < 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
LIM x at_top. b * x - hb * x * ln x powr - (1 + e) :> at_top
[PROOF STEP]
have "filterlim ... at_top at_top"
[PROOF STATE]
proof (prove)
using this:
LIM x at_top. b * x - hb * x * ln x powr - (1 + e) :> at_top

goal (1 subgoal):
 1. LIM x at_top. b * x - hb * x * ln x powr - (1 + e) :> at_top
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
LIM x at_top. b * x - hb * x * ln x powr - (1 + e) :> at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. ln (b * x - hb * x * ln x powr - (1 + e)) powr (- e / 2) < 1
[PROOF STEP]
with bep
[PROOF STATE]
proof (chain)
picking this:
0 < b
b < 1
0 < e
0 < hb
LIM x at_top. b * x - hb * x * ln x powr - (1 + e) :> at_top
[PROOF STEP]
have "((\<lambda>x. ln (b*x - hb*x*ln x powr -(1+e)) powr -(e/2)) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
using this:
0 < b
b < 1
0 < e
0 < hb
LIM x at_top. b * x - hb * x * ln x powr - (1 + e) :> at_top

goal (1 subgoal):
 1. ((\<lambda>x. ln (b * x - hb * x * ln x powr - (1 + e)) powr - (e / 2)) \<longlongrightarrow> 0) at_top
[PROOF STEP]
by (intro tendsto_neg_powr filterlim_compose[OF ln_at_top]) simp_all
[PROOF STATE]
proof (state)
this:
((\<lambda>x. ln (b * x - hb * x * ln x powr - (1 + e)) powr - (e / 2)) \<longlongrightarrow> 0) at_top

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

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>ln (b * x - hb * x * ln x powr - (1 + e)) powr (- e / 2)\<bar> < 1
[PROOF STEP]
by (subst (asm) tendsto_iff) (simp add: dist_real_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. \<bar>ln (b * x - hb * x * ln x powr - (1 + e)) powr (- e / 2)\<bar> < 1

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. ln (b * x - hb * x * ln x powr - (1 + e)) powr (- e / 2) < 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. \<bar>ln (b * x - hb * x * ln x powr - (1 + e)) powr (- e / 2)\<bar> < 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in monoid_add) sum_list_sum_nth:
  "sum_list xs = (\<Sum> i = 0 ..< length xs. xs ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list xs = sum ((!) xs) {0..<length xs}
[PROOF STEP]
using interv_sum_list_conv_sum_set_nat [of "(!) xs" 0 "length xs"]
[PROOF STATE]
proof (prove)
using this:
sum_list (map ((!) xs) [0..<length xs]) = sum ((!) xs) (set [0..<length xs])

goal (1 subgoal):
 1. sum_list xs = sum ((!) xs) {0..<length xs}
[PROOF STEP]
by (simp add: map_nth)


[STATEMENT]
lemma embed_measure_eq_distr':
  assumes "inj_on f (space M)"
  shows "embed_measure M f = distr M (embed_measure M f) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. embed_measure M f = distr M (embed_measure M f) f
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. embed_measure M f = distr M (embed_measure M f) f
[PROOF STEP]
have "distr M (embed_measure M f) f =
            measure_of (f ` space M) {f ` A |A. A \<in> sets M}
                       (\<lambda>A. emeasure M (f -` A \<inter> space M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr M (embed_measure M f) f = measure_of (f ` space M) {f ` A |A. A \<in> sets M} (\<lambda>A. emeasure M (f -` A \<inter> space M))
[PROOF STEP]
unfolding distr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_of (space (embed_measure M f)) (sets (embed_measure M f)) (\<lambda>A. emeasure M (f -` A \<inter> space M)) = measure_of (f ` space M) {f ` A |A. A \<in> sets M} (\<lambda>A. emeasure M (f -` A \<inter> space M))
[PROOF STEP]
by (simp add: space_embed_measure sets_embed_measure'[OF assms])
[PROOF STATE]
proof (state)
this:
distr M (embed_measure M f) f = measure_of (f ` space M) {f ` A |A. A \<in> sets M} (\<lambda>A. emeasure M (f -` A \<inter> space M))

goal (1 subgoal):
 1. embed_measure M f = distr M (embed_measure M f) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distr M (embed_measure M f) f = measure_of (f ` space M) {f ` A |A. A \<in> sets M} (\<lambda>A. emeasure M (f -` A \<inter> space M))

goal (1 subgoal):
 1. embed_measure M f = distr M (embed_measure M f) f
[PROOF STEP]
have "... = embed_measure M f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_of (f ` space M) {f ` A |A. A \<in> sets M} (\<lambda>A. emeasure M (f -` A \<inter> space M)) = embed_measure M f
[PROOF STEP]
unfolding embed_measure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_of (f ` space M) {f ` A |A. A \<in> sets M} (\<lambda>A. emeasure M (f -` A \<inter> space M)) = measure_of (f ` space M) {f ` A |A. A \<in> sets M} (\<lambda>A. emeasure M (f -` A \<inter> space M))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
measure_of (f ` space M) {f ` A |A. A \<in> sets M} (\<lambda>A. emeasure M (f -` A \<inter> space M)) = embed_measure M f

goal (1 subgoal):
 1. embed_measure M f = distr M (embed_measure M f) f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
distr M (embed_measure M f) f = embed_measure M f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
distr M (embed_measure M f) f = embed_measure M f

goal (1 subgoal):
 1. embed_measure M f = distr M (embed_measure M f) f
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
embed_measure M f = distr M (embed_measure M f) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma L_infinity_I':
  assumes [measurable]: "f \<in> borel_measurable M"
      and "AE x in M. ennreal \<bar>f x\<bar> \<le> C"
  shows "eNorm (\<LL> \<infinity> M) f \<le> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eNorm (\<LL> \<infinity> M) f \<le> C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eNorm (\<LL> \<infinity> M) f \<le> C
[PROOF STEP]
have "esssup M (\<lambda>x. \<bar>f x\<bar>) \<le> enn2ereal C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. esssup M (\<lambda>x. ereal \<bar>f x\<bar>) \<le> enn2ereal C
[PROOF STEP]
apply (rule esssup_I, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. ereal \<bar>f x\<bar> \<le> enn2ereal C
[PROOF STEP]
using assms(2) less_eq_ennreal.rep_eq
[PROOF STATE]
proof (prove)
using this:
AE x in M. ennreal \<bar>f x\<bar> \<le> C
(?x \<le> ?xa) = (enn2ereal ?x \<le> enn2ereal ?xa)

goal (1 subgoal):
 1. AE x in M. ereal \<bar>f x\<bar> \<le> enn2ereal C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
esssup M (\<lambda>x. ereal \<bar>f x\<bar>) \<le> enn2ereal C

goal (1 subgoal):
 1. eNorm (\<LL> \<infinity> M) f \<le> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
esssup M (\<lambda>x. ereal \<bar>f x\<bar>) \<le> enn2ereal C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
esssup M (\<lambda>x. ereal \<bar>f x\<bar>) \<le> enn2ereal C

goal (1 subgoal):
 1. eNorm (\<LL> \<infinity> M) f \<le> C
[PROOF STEP]
unfolding L_infinity
[PROOF STATE]
proof (prove)
using this:
esssup M (\<lambda>x. ereal \<bar>f x\<bar>) \<le> enn2ereal C

goal (1 subgoal):
 1. (if f \<in> borel_measurable M then e2ennreal (esssup M (\<lambda>x. ereal \<bar>f x\<bar>)) else \<infinity>) \<le> C
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
esssup M (\<lambda>x. ereal \<bar>f x\<bar>) \<le> enn2ereal C
f \<in> borel_measurable M
AE x in M. ennreal \<bar>f x\<bar> \<le> C

goal (1 subgoal):
 1. (if f \<in> borel_measurable M then e2ennreal (esssup M (\<lambda>x. ereal \<bar>f x\<bar>)) else \<infinity>) \<le> C
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>esssup M (\<lambda>x. ereal \<bar>f x\<bar>) \<le> enn2ereal C; AE x in M. ennreal \<bar>f x\<bar> \<le> C\<rbrakk> \<Longrightarrow> e2ennreal (esssup M (\<lambda>x. ereal \<bar>f x\<bar>)) \<le> C
[PROOF STEP]
using e2ennreal_mono
[PROOF STATE]
proof (prove)
using this:
?x \<le> ?y \<Longrightarrow> e2ennreal ?x \<le> e2ennreal ?y

goal (1 subgoal):
 1. \<lbrakk>esssup M (\<lambda>x. ereal \<bar>f x\<bar>) \<le> enn2ereal C; AE x in M. ennreal \<bar>f x\<bar> \<le> C\<rbrakk> \<Longrightarrow> e2ennreal (esssup M (\<lambda>x. ereal \<bar>f x\<bar>)) \<le> C
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
eNorm (\<LL> \<infinity> M) f \<le> C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma a_choose_equivalence: "Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x)) = Suc (n + k) choose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x)) = Suc (n + k) choose k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x)) = Suc (n + k) choose k
[PROOF STEP]
have "m \<ge> k \<Longrightarrow> (\<Sum>x\<leftarrow>[0..< Suc k]. m - x choose (k - x)) = Suc m choose k" for m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> m \<Longrightarrow> (\<Sum>x\<leftarrow>[0..<Suc k]. m - x choose (k - x)) = Suc m choose k
[PROOF STEP]
using sum_choose_diagonal leq_sum_to_sum_list
[PROOF STATE]
proof (prove)
using this:
?m \<le> ?n \<Longrightarrow> (\<Sum>k\<le>?m. ?n - k choose (?m - k)) = Suc ?n choose ?m
sum ?f {..?n} = sum_list (map ?f [0..<Suc ?n])

goal (1 subgoal):
 1. k \<le> m \<Longrightarrow> (\<Sum>x\<leftarrow>[0..<Suc k]. m - x choose (k - x)) = Suc m choose k
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
k \<le> ?m \<Longrightarrow> (\<Sum>x\<leftarrow>[0..<Suc k]. ?m - x choose (k - x)) = Suc ?m choose k

goal (1 subgoal):
 1. Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x)) = Suc (n + k) choose k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<le> ?m \<Longrightarrow> (\<Sum>x\<leftarrow>[0..<Suc k]. ?m - x choose (k - x)) = Suc ?m choose k
[PROOF STEP]
have 1: "Suc (\<Sum>x\<leftarrow>[0..<k]. (n + k) - x choose (k - x)) = Suc (n + k) choose k"
[PROOF STATE]
proof (prove)
using this:
k \<le> ?m \<Longrightarrow> (\<Sum>x\<leftarrow>[0..<Suc k]. ?m - x choose (k - x)) = Suc ?m choose k

goal (1 subgoal):
 1. Suc (\<Sum>x\<leftarrow>[0..<k]. n + k - x choose (k - x)) = Suc (n + k) choose k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc (\<Sum>x\<leftarrow>[0..<k]. n + k - x choose (k - x)) = Suc (n + k) choose k

goal (1 subgoal):
 1. Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x)) = Suc (n + k) choose k
[PROOF STEP]
have "Suc (\<Sum>x\<leftarrow>[0..<k]. (n + k) - x choose (k - x)) = Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (\<Sum>x\<leftarrow>[0..<k]. n + k - x choose (k - x)) = Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x))
[PROOF STEP]
by (metis (no_types, opaque_lifting) Nat.diff_add_assoc2 add.commute binomial_n_0 diff_is_0_eq' nle_le)
[PROOF STATE]
proof (state)
this:
Suc (\<Sum>x\<leftarrow>[0..<k]. n + k - x choose (k - x)) = Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x))

goal (1 subgoal):
 1. Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x)) = Suc (n + k) choose k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Suc (\<Sum>x\<leftarrow>[0..<k]. n + k - x choose (k - x)) = Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Suc (\<Sum>x\<leftarrow>[0..<k]. n + k - x choose (k - x)) = Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x))

goal (1 subgoal):
 1. Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x)) = Suc (n + k) choose k
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
Suc (\<Sum>x\<leftarrow>[0..<k]. n + k - x choose (k - x)) = Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x))
Suc (\<Sum>x\<leftarrow>[0..<k]. n + k - x choose (k - x)) = Suc (n + k) choose k

goal (1 subgoal):
 1. Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x)) = Suc (n + k) choose k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc (\<Sum>x\<leftarrow>[0..<k]. n + (k - x) choose (k - x)) = Suc (n + k) choose k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIMSEQ_const_mult:
    assumes "f \<longlonglongrightarrow> a"
    shows "(\<lambda>x. c * f x) \<longlonglongrightarrow> c * a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c * f x) \<longlonglongrightarrow> c * a
[PROOF STEP]
by (rule tendsto_mult[OF tendsto_const[where k = c] assms])


[STATEMENT]
lemma cols_take_cols_subset:
  shows "set (cols (take_cols A inds)) \<subseteq> set (cols A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (cols (take_cols A inds)) \<subseteq> set (cols A)
[PROOF STEP]
unfolding take_cols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (cols (mat_of_cols (dim_row A) (map ((!) (cols A)) (filter (\<lambda>y. y < dim_col A) inds)))) \<subseteq> set (cols A)
[PROOF STEP]
apply (subst cols_mat_of_cols)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. set (map ((!) (cols A)) (filter (\<lambda>y. y < dim_col A) inds)) \<subseteq> carrier_vec (dim_row A)
 2. set (map ((!) (cols A)) (filter (\<lambda>y. y < dim_col A) inds)) \<subseteq> set (cols A)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>xa \<in> set inds; xa < dim_col A\<rbrakk> \<Longrightarrow> col A xa \<in> set (cols A)
[PROOF STEP]
using in_set_conv_nth
[PROOF STATE]
proof (prove)
using this:
(?x \<in> set ?xs) = (\<exists>i<length ?xs. ?xs ! i = ?x)

goal (1 subgoal):
 1. \<And>xa. \<lbrakk>xa \<in> set inds; xa < dim_col A\<rbrakk> \<Longrightarrow> col A xa \<in> set (cols A)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma set_sel'_reasonable_fin:
  "\<lbrakk>finite y; sel_reasonable f\<rbrakk> \<Longrightarrow> set_sel' f x y \<le> 1 \<and> set_sel' f x y > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite y; sel_reasonable f\<rbrakk> \<Longrightarrow> set_sel' f x y \<le> 1 \<and> 0 < set_sel' f x y
[PROOF STEP]
unfolding set_sel'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite y; sel_reasonable f\<rbrakk> \<Longrightarrow> prod (set_sel_aux' f x) y \<le> 1 \<and> 0 < prod (set_sel_aux' f x) y
[PROOF STEP]
apply(induction y rule: finite_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sel_reasonable f \<Longrightarrow> prod (set_sel_aux' f x) {} \<le> 1 \<and> 0 < prod (set_sel_aux' f x) {}
 2. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; sel_reasonable f \<Longrightarrow> prod (set_sel_aux' f x) F \<le> 1 \<and> 0 < prod (set_sel_aux' f x) F; sel_reasonable f\<rbrakk> \<Longrightarrow> prod (set_sel_aux' f x) (insert xa F) \<le> 1 \<and> 0 < prod (set_sel_aux' f x) (insert xa F)
[PROOF STEP]
using set_sel_aux'_reasonable_fin
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?x; sel_reasonable ?f\<rbrakk> \<Longrightarrow> set_sel_aux' ?f ?x ?y \<le> 1 \<and> 0 < set_sel_aux' ?f ?x ?y

goal (2 subgoals):
 1. sel_reasonable f \<Longrightarrow> prod (set_sel_aux' f x) {} \<le> 1 \<and> 0 < prod (set_sel_aux' f x) {}
 2. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; sel_reasonable f \<Longrightarrow> prod (set_sel_aux' f x) F \<le> 1 \<and> 0 < prod (set_sel_aux' f x) F; sel_reasonable f\<rbrakk> \<Longrightarrow> prod (set_sel_aux' f x) (insert xa F) \<le> 1 \<and> 0 < prod (set_sel_aux' f x) (insert xa F)
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; sel_reasonable f \<Longrightarrow> prod (set_sel_aux' f x) F \<le> 1 \<and> 0 < prod (set_sel_aux' f x) F; sel_reasonable f\<rbrakk> \<Longrightarrow> prod (set_sel_aux' f x) (insert xa F) \<le> 1 \<and> 0 < prod (set_sel_aux' f x) (insert xa F)
[PROOF STEP]
by (smt (verit) prod_le_1 prod_pos set_sel_aux'_reasonable)


[STATEMENT]
lemma diag_block_mat_dim_row_cong:
  assumes "length Ul = length Bl"
  and "\<forall>i < length Bl. dim_row (Bl!i) = dim_row (Ul!i)"
  shows "dim_row (diag_block_mat Ul) = dim_row (diag_block_mat Bl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (diag_block_mat Ul) = dim_row (diag_block_mat Bl)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim_row (diag_block_mat Ul) = dim_row (diag_block_mat Bl)
[PROOF STEP]
have "dim_row (diag_block_mat Ul) = sum_list (map dim_row Ul)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (diag_block_mat Ul) = sum_list (map dim_row Ul)
[PROOF STEP]
by (simp add: dim_diag_block_mat(1))
[PROOF STATE]
proof (state)
this:
dim_row (diag_block_mat Ul) = sum_list (map dim_row Ul)

goal (1 subgoal):
 1. dim_row (diag_block_mat Ul) = dim_row (diag_block_mat Bl)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dim_row (diag_block_mat Ul) = sum_list (map dim_row Ul)

goal (1 subgoal):
 1. dim_row (diag_block_mat Ul) = dim_row (diag_block_mat Bl)
[PROOF STEP]
have "... = sum_list (map dim_row Bl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map dim_row Ul) = sum_list (map dim_row Bl)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length Ul = length Bl
\<forall>i<length Bl. dim_row (Bl ! i) = dim_row (Ul ! i)

goal (1 subgoal):
 1. sum_list (map dim_row Ul) = sum_list (map dim_row Bl)
[PROOF STEP]
by (metis nth_map_conv)
[PROOF STATE]
proof (state)
this:
sum_list (map dim_row Ul) = sum_list (map dim_row Bl)

goal (1 subgoal):
 1. dim_row (diag_block_mat Ul) = dim_row (diag_block_mat Bl)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map dim_row Ul) = sum_list (map dim_row Bl)

goal (1 subgoal):
 1. dim_row (diag_block_mat Ul) = dim_row (diag_block_mat Bl)
[PROOF STEP]
have "... = dim_row (diag_block_mat Bl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map dim_row Bl) = dim_row (diag_block_mat Bl)
[PROOF STEP]
by (simp add: dim_diag_block_mat(1))
[PROOF STATE]
proof (state)
this:
sum_list (map dim_row Bl) = dim_row (diag_block_mat Bl)

goal (1 subgoal):
 1. dim_row (diag_block_mat Ul) = dim_row (diag_block_mat Bl)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dim_row (diag_block_mat Ul) = dim_row (diag_block_mat Bl)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dim_row (diag_block_mat Ul) = dim_row (diag_block_mat Bl)

goal (1 subgoal):
 1. dim_row (diag_block_mat Ul) = dim_row (diag_block_mat Bl)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dim_row (diag_block_mat Ul) = dim_row (diag_block_mat Bl)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma times_1_both:"\<lbrakk>(0::int) < z; z * z' = 1\<rbrakk> \<Longrightarrow> z = 1 \<and> z' = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < z; z * z' = 1\<rbrakk> \<Longrightarrow> z = 1 \<and> z' = 1
[PROOF STEP]
apply (subgoal_tac "0 < z'")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < z; z * z' = 1; 0 < z'\<rbrakk> \<Longrightarrow> z = 1 \<and> z' = 1
 2. \<lbrakk>0 < z; z * z' = 1\<rbrakk> \<Longrightarrow> 0 < z'
[PROOF STEP]
apply (frule zgt_0_zge_1[of "z'"],
        subgoal_tac "z' = 1", simp,
        subgoal_tac "1 < z' \<or> 1 = z'", thin_tac "1 \<le> z'", thin_tac "0 < z'")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>0 < z; z * z' = 1; 1 < z' \<or> 1 = z'\<rbrakk> \<Longrightarrow> z' = 1
 2. \<lbrakk>0 < z; z * z' = 1; 0 < z'; 1 \<le> z'\<rbrakk> \<Longrightarrow> 1 < z' \<or> 1 = z'
 3. \<lbrakk>0 < z; z * z' = 1\<rbrakk> \<Longrightarrow> 0 < z'
[PROOF STEP]
apply (rule contrapos_pp, simp+,
        frule int_mult_mono[of "1" "z'" "z"], assumption+, simp, arith)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < z; z * z' = 1\<rbrakk> \<Longrightarrow> 0 < z'
[PROOF STEP]
apply (rule contrapos_pp, simp+, simp add:zle[THEN sym],
       frule zless_imp_zle[of "0" "z"], frule int_mult_le[of "z'" "0" "z"],
       assumption+, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma less_prod_simp [simp, code]:
  "(x1, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 \<le> x2 \<and> y1 < y2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x1, y1) < (x2, y2)) = (x1 < x2 \<or> x1 \<le> x2 \<and> y1 < y2)
[PROOF STEP]
by (simp add: less_prod_def)


[STATEMENT]
lemma nodes_graph: "\<lbrakk>finite V; finite E\<rbrakk> \<Longrightarrow> nodes (graph V E) = V\<union>fst`E\<union>snd`E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite V; finite E\<rbrakk> \<Longrightarrow> nodes (graph V E) = V \<union> fst ` E \<union> snd ` E
[PROOF STEP]
unfolding edges_def nodes_def graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite V; finite E\<rbrakk> \<Longrightarrow> nodes_internal (graph_internal V E) = V \<union> fst ` E \<union> snd ` E
[PROOF STEP]
by transfer auto


[STATEMENT]
lemma prefix_eq_prefix_take_ex: "prefix xs ys = (\<exists>n. ys \<down> n = xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefix xs ys = (\<exists>n. ys \<down> n = xs)
[PROOF STEP]
apply (unfold prefix_def, safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>zs. ys = xs @ zs \<Longrightarrow> \<exists>n. (xs @ zs) \<down> n = xs
 2. \<And>n. xs = ys \<down> n \<Longrightarrow> \<exists>zs. ys = ys \<down> n @ zs
[PROOF STEP]
apply (rule_tac x="length xs" in exI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. xs = ys \<down> n \<Longrightarrow> \<exists>zs. ys = ys \<down> n @ zs
[PROOF STEP]
apply (rule_tac x="ys \<up> n" in exI, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma downsets_upsets_dual: "(X \<in> downsets) = (\<partial> ` X \<in> upsets)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X \<in> downsets) = (\<partial> ` X \<in> upsets)
[PROOF STEP]
unfolding downsets_def upsets_def Fix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X \<in> {x. \<Down> x = x}) = (\<partial> ` X \<in> {x. \<Up> x = x})
[PROOF STEP]
by (smt comp_eq_dest downset_set_upset_set_dual image_inv_f_f inj_dual mem_Collect_eq)


[STATEMENT]
lemma prod_mset_multiplicity:
  "prod_mset M = prod (\<lambda>x. x ^ count M x) (set_mset M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_mset M = (\<Prod>x\<in>set_mset M. x ^ count M x)
[PROOF STEP]
by (simp add: fold_mset_def prod.eq_fold prod_mset.eq_fold funpow_times_power comp_def)


[STATEMENT]
lemma bijective_imp_sv:
  "bijective R \<Longrightarrow> single_valued R"
  "bijective R \<Longrightarrow> single_valued (R\<inverse>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bijective R \<Longrightarrow> single_valued R) &&& (bijective R \<Longrightarrow> single_valued (R\<inverse>))
[PROOF STEP]
by (simp_all add: bijective_alt)


[STATEMENT]
lemma fps_to_fls_nth [simp]:
  "(fps_to_fls f) $$ n = (if n < 0 then 0 else f$(nat n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_to_fls f $$ n = (if n < 0 then 0::'a else f $ nat n)
[PROOF STEP]
using     nth_Abs_fls_lower_bound[of 0 "(\<lambda>k::int. if k<0 then 0 else f $ (nat k))"]
[PROOF STATE]
proof (prove)
using this:
\<forall>n<0. (if n < 0 then 0::'a else f $ nat n) = (0::'a) \<Longrightarrow> Abs_fls (\<lambda>k. if k < 0 then 0::'a else f $ nat k) $$ ?n = (if ?n < 0 then 0::'a else f $ nat ?n)

goal (1 subgoal):
 1. fps_to_fls f $$ n = (if n < 0 then 0::'a else f $ nat n)
[PROOF STEP]
unfolding fps_to_fls_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n<0. (if n < 0 then 0::'a else f $ nat n) = (0::'a) \<Longrightarrow> Abs_fls (\<lambda>k. if k < 0 then 0::'a else f $ nat k) $$ ?n = (if ?n < 0 then 0::'a else f $ nat ?n)

goal (1 subgoal):
 1. Abs_fls (\<lambda>k. if k < 0 then 0::'a else f $ nat k) $$ n = (if n < 0 then 0::'a else f $ nat n)
[PROOF STEP]
by        simp


[STATEMENT]
lemma kernel_Proj[simp]: \<open>kernel (Proj S) = - S\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel (Proj S) = - S
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S. closed_csubspace S \<Longrightarrow> projection S -` {0::'a} = orthogonal_complement S
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>S x. \<lbrakk>closed_csubspace S; projection S x = (0::'a)\<rbrakk> \<Longrightarrow> x \<in> orthogonal_complement S
 2. \<And>S x. \<lbrakk>closed_csubspace S; x \<in> orthogonal_complement S\<rbrakk> \<Longrightarrow> projection S x = (0::'a)
[PROOF STEP]
apply (metis diff_0_right is_projection_on_iff_orthog projection_is_projection_on')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S x. \<lbrakk>closed_csubspace S; x \<in> orthogonal_complement S\<rbrakk> \<Longrightarrow> projection S x = (0::'a)
[PROOF STEP]
by (simp add: complex_vector.subspace_0 projection_eqI)


[STATEMENT]
theorem n_subsets:
  assumes "finite A"
  shows "card {B. B \<subseteq> A \<and> card B = k} = card A choose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
obtain f where bij: "bij_betw f {0..<card A} A"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (\<And>f. bij_betw f {0..<card A} A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (blast dest: ex_bij_betw_nat_finite)
[PROOF STATE]
proof (state)
this:
bij_betw f {0..<card A} A

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bij_betw f {0..<card A} A
[PROOF STEP]
have [simp]: "card (f ` C) = card C" if "C \<subseteq> {0..<card A}" for C
[PROOF STATE]
proof (prove)
using this:
bij_betw f {0..<card A} A

goal (1 subgoal):
 1. card (f ` C) = card C
[PROOF STEP]
by (meson bij_betw_imp_inj_on bij_betw_subset card_image that)
[PROOF STATE]
proof (state)
this:
?C \<subseteq> {0..<card A} \<Longrightarrow> card (f ` ?C) = card ?C

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
from bij
[PROOF STATE]
proof (chain)
picking this:
bij_betw f {0..<card A} A
[PROOF STEP]
have "bij_betw (image f) (Pow {0..<card A}) (Pow A)"
[PROOF STATE]
proof (prove)
using this:
bij_betw f {0..<card A} A

goal (1 subgoal):
 1. bij_betw ((`) f) (Pow {0..<card A}) (Pow A)
[PROOF STEP]
by (rule bij_betw_Pow)
[PROOF STATE]
proof (state)
this:
bij_betw ((`) f) (Pow {0..<card A}) (Pow A)

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bij_betw ((`) f) (Pow {0..<card A}) (Pow A)
[PROOF STEP]
have "inj_on (image f) (Pow {0..<card A})"
[PROOF STATE]
proof (prove)
using this:
bij_betw ((`) f) (Pow {0..<card A}) (Pow A)

goal (1 subgoal):
 1. inj_on ((`) f) (Pow {0..<card A})
[PROOF STEP]
by (rule bij_betw_imp_inj_on)
[PROOF STATE]
proof (state)
this:
inj_on ((`) f) (Pow {0..<card A})

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on ((`) f) (Pow {0..<card A})

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
have "{K. K \<subseteq> {0..<card A} \<and> card K = k} \<subseteq> Pow {0..<card A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {K. K \<subseteq> {0..<card A} \<and> card K = k} \<subseteq> Pow {0..<card A}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{K. K \<subseteq> {0..<card A} \<and> card K = k} \<subseteq> Pow {0..<card A}

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj_on ((`) f) (Pow {0..<card A})
{K. K \<subseteq> {0..<card A} \<and> card K = k} \<subseteq> Pow {0..<card A}
[PROOF STEP]
have "inj_on (image f) {K. K \<subseteq> {0..<card A} \<and> card K = k}"
[PROOF STATE]
proof (prove)
using this:
inj_on ((`) f) (Pow {0..<card A})
{K. K \<subseteq> {0..<card A} \<and> card K = k} \<subseteq> Pow {0..<card A}

goal (1 subgoal):
 1. inj_on ((`) f) {K. K \<subseteq> {0..<card A} \<and> card K = k}
[PROOF STEP]
by (rule inj_on_subset)
[PROOF STATE]
proof (state)
this:
inj_on ((`) f) {K. K \<subseteq> {0..<card A} \<and> card K = k}

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj_on ((`) f) {K. K \<subseteq> {0..<card A} \<and> card K = k}
[PROOF STEP]
have "card {K. K \<subseteq> {0..<card A} \<and> card K = k} =
      card (image f ` {K. K \<subseteq> {0..<card A} \<and> card K = k})" (is "_ = card ?C")
[PROOF STATE]
proof (prove)
using this:
inj_on ((`) f) {K. K \<subseteq> {0..<card A} \<and> card K = k}

goal (1 subgoal):
 1. card {K. K \<subseteq> {0..<card A} \<and> card K = k} = card ((`) f ` {K. K \<subseteq> {0..<card A} \<and> card K = k})
[PROOF STEP]
by (simp add: card_image)
[PROOF STATE]
proof (state)
this:
card {K. K \<subseteq> {0..<card A} \<and> card K = k} = card ((`) f ` {K. K \<subseteq> {0..<card A} \<and> card K = k})

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {K. K \<subseteq> {0..<card A} \<and> card K = k} = card ((`) f ` {K. K \<subseteq> {0..<card A} \<and> card K = k})

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
have "?C = {K. K \<subseteq> f ` {0..<card A} \<and> card K = k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (`) f ` {K. K \<subseteq> {0..<card A} \<and> card K = k} = {K. K \<subseteq> f ` {0..<card A} \<and> card K = k}
[PROOF STEP]
by (auto elim!: subset_imageE)
[PROOF STATE]
proof (state)
this:
(`) f ` {K. K \<subseteq> {0..<card A} \<and> card K = k} = {K. K \<subseteq> f ` {0..<card A} \<and> card K = k}

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(`) f ` {K. K \<subseteq> {0..<card A} \<and> card K = k} = {K. K \<subseteq> f ` {0..<card A} \<and> card K = k}

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
have "f ` {0..<card A} = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` {0..<card A} = A
[PROOF STEP]
by (meson bij bij_betw_def)
[PROOF STATE]
proof (state)
this:
f ` {0..<card A} = A

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {K. K \<subseteq> {0..<card A} \<and> card K = k} = card {K. K \<subseteq> A \<and> card K = k}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {K. K \<subseteq> {0..<card A} \<and> card K = k} = card {K. K \<subseteq> A \<and> card K = k}

goal (1 subgoal):
 1. card {B. B \<subseteq> A \<and> card B = k} = card A choose k
[PROOF STEP]
by (simp add: binomial_def)
[PROOF STATE]
proof (state)
this:
card {B. B \<subseteq> A \<and> card B = k} = card A choose k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Module) mHom_eq:"\<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R M N;
                            \<forall>m\<in>carrier M. f m = g m\<rbrakk> \<Longrightarrow> f = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R M N; \<forall>m\<in>carrier M. f m = g m\<rbrakk> \<Longrightarrow> f = g
[PROOF STEP]
apply (simp add:mHom_def aHom_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> carrier M \<rightarrow> carrier N \<and> f \<in> extensional (carrier M) \<and> (\<forall>a\<in>carrier M. \<forall>b\<in>carrier M. f (a \<plusminus> b) = g a \<plusminus>\<^bsub>N\<^esub> g b) \<and> (\<forall>a\<in>carrier R. \<forall>m\<in>carrier M. f (a \<cdot>\<^sub>s m) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> g m); g \<in> carrier M \<rightarrow> carrier N \<and> g \<in> extensional (carrier M) \<and> (\<forall>a\<in>carrier M. \<forall>b\<in>carrier M. g (a \<plusminus> b) = g a \<plusminus>\<^bsub>N\<^esub> g b) \<and> (\<forall>a\<in>carrier R. \<forall>m\<in>carrier M. g (a \<cdot>\<^sub>s m) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> g m); \<forall>m\<in>carrier M. f m = g m\<rbrakk> \<Longrightarrow> f = g
[PROOF STEP]
apply (erule conjE)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; \<forall>m\<in>carrier M. f m = g m; f \<in> carrier M \<rightarrow> carrier N; g \<in> carrier M \<rightarrow> carrier N; f \<in> extensional (carrier M); g \<in> extensional (carrier M); \<forall>a\<in>carrier M. \<forall>b\<in>carrier M. f (a \<plusminus> b) = g a \<plusminus>\<^bsub>N\<^esub> g b; \<forall>a\<in>carrier R. \<forall>m\<in>carrier M. f (a \<cdot>\<^sub>s m) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> g m; \<forall>a\<in>carrier M. \<forall>b\<in>carrier M. g (a \<plusminus> b) = g a \<plusminus>\<^bsub>N\<^esub> g b; \<forall>a\<in>carrier R. \<forall>m\<in>carrier M. g (a \<cdot>\<^sub>s m) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> g m\<rbrakk> \<Longrightarrow> f = g
[PROOF STEP]
apply (rule funcset_eq, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "app (fs @ gs) x = app gs (app fs x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. app (fs @ gs) x = app gs (app fs x)
[PROOF STEP]
quickcheck[random, expect = no_counterexample]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. app (fs @ gs) x = app gs (app fs x)
[PROOF STEP]
quickcheck[exhaustive, size = 2, expect = no_counterexample]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. app (fs @ gs) x = app gs (app fs x)
[PROOF STEP]
by (induct fs arbitrary: x) simp_all


[STATEMENT]
lemma inext_atLeastAtMost: "\<lbrakk> m \<le> t; t < n \<rbrakk> \<Longrightarrow> inext t {m..n} = Suc t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<le> t; t < n\<rbrakk> \<Longrightarrow> inext t {m..n} = Suc t
[PROOF STEP]
by (simp add: atLeastAtMost_def cut_le_Int_conv[symmetric] inext_atLeast inext_cut_le_conv)


[STATEMENT]
lemma binary_eval: "eval (BINARY R P\<^sub>1 P\<^sub>2) a = R (peval P\<^sub>1 a) (peval P\<^sub>2 a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (BINARY R P\<^sub>1 P\<^sub>2) a = R (peval P\<^sub>1 a) (peval P\<^sub>2 a)
[PROOF STEP]
unfolding BINARY_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (NARY (\<lambda>l. R (l ! 0) (l ! 1)) [P\<^sub>1, P\<^sub>2]) a = R (peval P\<^sub>1 a) (peval P\<^sub>2 a)
[PROOF STEP]
by simp


[STATEMENT]
lemma t_heap_of_B_bound:
  "t_heap_of_B xs \<le> 6 * length xs + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t_heap_of_B xs \<le> 6 * length xs + 1
[PROOF STEP]
by (simp add: t_heap_of_B_def order_trans[OF t_heapify_bound])


[STATEMENT]
theorem c_out_asi'':
  assumes "sel_reasonable sf"
      and "\<forall>x. cf x > 0"
      and "c = c_list f cf h r"
      and "f = (ldeep_s sf xs)"
      and "h = create_h_list (\<lambda>xs x. (list_sel_aux' sf xs x) * cf x) xs"
    shows "asi'' (\<lambda>l. (ldeep_T f cf l - 1) / c l) r (c_list f cf h r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. asi'' (\<lambda>l. (ldeep_T f cf l - 1) / c l) r (c_list f cf h r)
[PROOF STEP]
unfolding asi''_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A U V B. distinct (A @ U @ V @ B) \<and> U \<noteq> [] \<and> V \<noteq> [] \<and> U \<noteq> [r] \<and> V \<noteq> [r] \<longrightarrow> (c_list f cf h r (rev (A @ U @ V @ B)) \<le> c_list f cf h r (rev (A @ V @ U @ B))) = ((ldeep_T f cf (rev U) - 1) / c (rev U) \<le> (ldeep_T f cf (rev V) - 1) / c (rev V))
[PROOF STEP]
using c_out_asi''_aux[OF assms] assms(3)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>distinct (?A @ ?U @ ?V @ ?B); ?U \<noteq> []; ?V \<noteq> []; ?rank = (\<lambda>l. (ldeep_T f cf l - 1) / c l); ?U \<noteq> [r]; ?V \<noteq> [r]\<rbrakk> \<Longrightarrow> (c (rev (?A @ ?U @ ?V @ ?B)) \<le> c (rev (?A @ ?V @ ?U @ ?B))) = (?rank (rev ?U) \<le> ?rank (rev ?V))
c = c_list f cf h r

goal (1 subgoal):
 1. \<forall>A U V B. distinct (A @ U @ V @ B) \<and> U \<noteq> [] \<and> V \<noteq> [] \<and> U \<noteq> [r] \<and> V \<noteq> [r] \<longrightarrow> (c_list f cf h r (rev (A @ U @ V @ B)) \<le> c_list f cf h r (rev (A @ V @ U @ B))) = ((ldeep_T f cf (rev U) - 1) / c (rev U) \<le> (ldeep_T f cf (rev V) - 1) / c (rev V))
[PROOF STEP]
by blast


[STATEMENT]
lemma card_of_Times_cong[simp]:
assumes "|A| =o |B|" and "|C| =o |D|"
shows "|A \<times> C| =o |B \<times> D|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A \<times> C| =o |B \<times> D|
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
|A| =o |B|
|C| =o |D|

goal (1 subgoal):
 1. |A \<times> C| =o |B \<times> D|
[PROOF STEP]
by (auto simp add: ordIso_iff_ordLeq)


[STATEMENT]
lemma nonempty_card_pos:"\<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> 0 < card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> 0 < card A
[PROOF STEP]
apply (frule nonempty_ex [of "A"], erule exE,
       frule_tac a = x and A = A in singleton_sub)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>finite A; A \<noteq> {}; x \<in> A; {x} \<subseteq> A\<rbrakk> \<Longrightarrow> 0 < card A
[PROOF STEP]
apply (frule_tac B = A and A = "{x}" in card_mono, assumption+,
       simp add:card1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma phull_syzygy_module: "phull (pmdl.syzygy_module B) = pmdl.syzygy_module B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. phull (pmdl.syzygy_module B) = pmdl.syzygy_module B
[PROOF STEP]
unfolding phull.span_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. phull.subspace (pmdl.syzygy_module B)
[PROOF STEP]
apply (rule phull.subspaceI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 0 \<in> pmdl.syzygy_module B
 2. \<And>x y. \<lbrakk>x \<in> pmdl.syzygy_module B; y \<in> pmdl.syzygy_module B\<rbrakk> \<Longrightarrow> x + y \<in> pmdl.syzygy_module B
 3. \<And>c x. x \<in> pmdl.syzygy_module B \<Longrightarrow> c \<cdot> x \<in> pmdl.syzygy_module B
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<in> pmdl.syzygy_module B
[PROOF STEP]
by (fact pmdl.zero_in_syzygy_module)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> pmdl.syzygy_module B; y \<in> pmdl.syzygy_module B\<rbrakk> \<Longrightarrow> x + y \<in> pmdl.syzygy_module B
 2. \<And>c x. x \<in> pmdl.syzygy_module B \<Longrightarrow> c \<cdot> x \<in> pmdl.syzygy_module B
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x_ \<in> pmdl.syzygy_module B; y_ \<in> pmdl.syzygy_module B\<rbrakk> \<Longrightarrow> x_ + y_ \<in> pmdl.syzygy_module B
[PROOF STEP]
by (fact pmdl.syzygy_module_closed_plus)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c x. x \<in> pmdl.syzygy_module B \<Longrightarrow> c \<cdot> x \<in> pmdl.syzygy_module B
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x_ \<in> pmdl.syzygy_module B \<Longrightarrow> c_ \<cdot> x_ \<in> pmdl.syzygy_module B
[PROOF STEP]
by (fact syzygy_module_closed_map_scale)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bin_mask_conv_pow2:
  "mask n = 2 ^ n - (1 :: int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mask n = 2 ^ n - 1
[PROOF STEP]
by (fact mask_eq_exp_minus_1)


[STATEMENT]
lemma contour_integral_primitive:
  assumes "\<And>x. x \<in> S \<Longrightarrow> (f has_field_derivative f' x) (at x within S)"
      and "valid_path g" "path_image g \<subseteq> S"
    shows "(f' has_contour_integral (f(pathfinish g) - f(pathstart g))) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f' has_contour_integral f (pathfinish g) - f (pathstart g)) g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> (f has_field_derivative f' ?x) (at ?x within S)
valid_path g
path_image g \<subseteq> S

goal (1 subgoal):
 1. (f' has_contour_integral f (pathfinish g) - f (pathstart g)) g
[PROOF STEP]
apply (simp add: valid_path_def path_image_def pathfinish_def pathstart_def has_contour_integral_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> (f has_field_derivative f' x) (at x within S); g piecewise_C1_differentiable_on {0..1}; g ` {0..1} \<subseteq> S\<rbrakk> \<Longrightarrow> ((\<lambda>x. f' (g x) * vector_derivative g (at x within {0..1})) has_integral f (g 1) - f (g 0)) {0..1}
[PROOF STEP]
apply (auto intro!: piecewise_C1_imp_differentiable contour_integral_primitive_lemma [of 0 1 S])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma euclid:
  "PRE (\<lambda>s::nat store. s ''x'' = x \<and> s ''y'' = y)
   (WHILE (\<lambda>s. s ''y'' \<noteq> 0) INV (\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y)
    DO
     (''z'' ::= (\<lambda>s. s ''y''));
     (''y'' ::= (\<lambda>s. s ''x'' mod s ''y''));
     (''x'' ::= (\<lambda>s. s ''z''))
    OD)
   POST (\<lambda>s. s ''x'' = gcd x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rdom \<lceil>\<lambda>s. s ''x'' = x \<and> s ''y'' = y\<rceil> \<subseteq> wp (WHILE (\<lambda>s. s ''y'' \<noteq> zero_class.zero) INV (\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y) DO (''z'' ::= (\<lambda>s. s ''y'')) ; (''y'' ::= (\<lambda>s. s ''x'' mod s ''y'')) ; (''x'' ::= (\<lambda>s. s ''z'')) OD) \<lceil>\<lambda>s. s ''x'' = gcd x y\<rceil>
[PROOF STEP]
by (rule ppath_aka.fbox_whilei, simp_all, auto simp: p2pp_def rel_ad_def gcd_non_0_nat)


[STATEMENT]
lemma face_of_imp_compact:
    fixes S :: "'a::euclidean_space set"
    shows "\<lbrakk>convex S; compact S; T face_of S\<rbrakk> \<Longrightarrow> compact T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>convex S; compact S; T face_of S\<rbrakk> \<Longrightarrow> compact T
[PROOF STEP]
by (meson bounded_subset compact_eq_bounded_closed face_of_imp_closed face_of_imp_subset)


[STATEMENT]
lemma power2_norm_eq_cinner':
  shows "(norm x)\<^sup>2 = Re (cinner x x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm x)\<^sup>2 = Re (cinner x x)
[PROOF STEP]
by (metis Re_complex_of_real of_real_power power2_norm_eq_cinner)


[STATEMENT]
lemma hyperplane_eq_empty:
     "{x. a \<bullet> x = b} = {} \<longleftrightarrow> a = 0 \<and> b \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({x. a \<bullet> x = b} = {}) = (a = (0::'a) \<and> b \<noteq> 0)
[PROOF STEP]
using hyperplane_eq_Ex
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<noteq> (0::?'a); \<And>x. ?a \<bullet> x = ?b \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. ({x. a \<bullet> x = b} = {}) = (a = (0::'a) \<and> b \<noteq> 0)
[PROOF STEP]
by (metis (mono_tags, lifting) empty_Collect_eq inner_zero_left)


[STATEMENT]
lemma [simp]: "\<eta>1 \<approx>>\<bullet> \<eta>2 \<Longrightarrow> NTCatCod (\<eta>1 \<bullet>1 \<eta>2) = NTCatCod \<eta>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<eta>1 \<approx>>\<bullet> \<eta>2 \<Longrightarrow> NTCatCod (\<eta>1 \<bullet>1 \<eta>2) = NTCatCod \<eta>1
[PROOF STEP]
by (auto simp add: NatTransComp'_def NTCatCod_def)