[STATEMENT]
lemma fps_power_Suc_nth:
  fixes f :: "'a :: comm_ring_1 fps"
  assumes k: "k > 0"
  shows "(f ^ Suc m) $ k =
           of_nat (Suc m) * (f $ k * (f $ 0) ^ m) +
           (\<Sum>v\<in>{v\<in>natpermute k (m+1). k \<notin> set v}. \<Prod>j = 0..m. f $ v ! j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
define A B
    where "A = {v\<in>natpermute k (m+1). k \<in> set v}"
      and  "B = {v\<in>natpermute k (m+1). k \<notin> set v}"
[PROOF STATE]
proof (state)
this:
A = {v \<in> natpermute k (m + 1). k \<in> set v}
B = {v \<in> natpermute k (m + 1). k \<notin> set v}

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
have [simp]: "finite A" "finite B" "A \<inter> B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A &&& finite B &&& A \<inter> B = {}
[PROOF STEP]
by (auto simp: A_def B_def natpermute_finite)
[PROOF STATE]
proof (state)
this:
finite A
finite B
A \<inter> B = {}

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
from natpermute_max_card[of k m] k
[PROOF STATE]
proof (chain)
picking this:
k \<noteq> 0 \<Longrightarrow> card {xs \<in> natpermute k (m + 1). k \<in> set xs} = m + 1
0 < k
[PROOF STEP]
have card_A: "card A = m + 1"
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0 \<Longrightarrow> card {xs \<in> natpermute k (m + 1). k \<in> set xs} = m + 1
0 < k

goal (1 subgoal):
 1. card A = m + 1
[PROOF STEP]
by (simp add: A_def)
[PROOF STATE]
proof (state)
this:
card A = m + 1

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
card A = m + 1

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
assume v: "v \<in> A"
[PROOF STATE]
proof (state)
this:
v \<in> A

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
v \<in> A
[PROOF STEP]
have [simp]: "length v = Suc m"
[PROOF STATE]
proof (prove)
using this:
v \<in> A

goal (1 subgoal):
 1. length v = Suc m
[PROOF STEP]
by (simp add: A_def natpermute_def)
[PROOF STATE]
proof (state)
this:
length v = Suc m

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
v \<in> A
[PROOF STEP]
have "\<exists>j. j \<le> m \<and> v ! j = k"
[PROOF STATE]
proof (prove)
using this:
v \<in> A

goal (1 subgoal):
 1. \<exists>j\<le>m. v ! j = k
[PROOF STEP]
by (auto simp: set_conv_nth A_def natpermute_def less_Suc_eq_le)
[PROOF STATE]
proof (state)
this:
\<exists>j\<le>m. v ! j = k

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>j\<le>m. v ! j = k
[PROOF STEP]
obtain j where j: "j \<le> m" "v ! j = k"
[PROOF STATE]
proof (prove)
using this:
\<exists>j\<le>m. v ! j = k

goal (1 subgoal):
 1. (\<And>j. \<lbrakk>j \<le> m; v ! j = k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
j \<le> m
v ! j = k

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
v \<in> A
[PROOF STEP]
have "k = sum_list v"
[PROOF STATE]
proof (prove)
using this:
v \<in> A

goal (1 subgoal):
 1. k = sum_list v
[PROOF STEP]
by (simp add: A_def natpermute_def)
[PROOF STATE]
proof (state)
this:
k = sum_list v

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k = sum_list v

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
have "\<dots> = (\<Sum>i=0..m. v ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list v = sum ((!) v) {0..m}
[PROOF STEP]
by (simp add: sum_list_sum_nth atLeastLessThanSuc_atLeastAtMost del: sum.op_ivl_Suc)
[PROOF STATE]
proof (state)
this:
sum_list v = sum ((!) v) {0..m}

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list v = sum ((!) v) {0..m}

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
from j
[PROOF STATE]
proof (chain)
picking this:
j \<le> m
v ! j = k
[PROOF STEP]
have "{0..m} = insert j ({0..m}-{j})"
[PROOF STATE]
proof (prove)
using this:
j \<le> m
v ! j = k

goal (1 subgoal):
 1. {0..m} = insert j ({0..m} - {j})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..m} = insert j ({0..m} - {j})

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{0..m} = insert j ({0..m} - {j})

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
from j
[PROOF STATE]
proof (chain)
picking this:
j \<le> m
v ! j = k
[PROOF STEP]
have "(\<Sum>i\<in>\<dots>. v ! i) = k + (\<Sum>i\<in>{0..m}-{j}. v ! i)"
[PROOF STATE]
proof (prove)
using this:
j \<le> m
v ! j = k

goal (1 subgoal):
 1. sum ((!) v) (insert j ({0..m} - {j})) = k + sum ((!) v) ({0..m} - {j})
[PROOF STEP]
by (subst sum.insert) simp_all
[PROOF STATE]
proof (state)
this:
sum ((!) v) (insert j ({0..m} - {j})) = k + sum ((!) v) ({0..m} - {j})

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
k = k + sum ((!) v) ({0..m} - {j})
[PROOF STEP]
have "(\<Sum>i\<in>{0..m}-{j}. v ! i) = 0"
[PROOF STATE]
proof (prove)
using this:
k = k + sum ((!) v) ({0..m} - {j})

goal (1 subgoal):
 1. sum ((!) v) ({0..m} - {j}) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum ((!) v) ({0..m} - {j}) = 0

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
hence zero: "v ! i = 0" if "i \<in> {0..m}-{j}" for i
[PROOF STATE]
proof (prove)
using this:
sum ((!) v) ({0..m} - {j}) = 0

goal (1 subgoal):
 1. v ! i = 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
sum ((!) v) ({0..m} - {j}) = 0
i \<in> {0..m} - {j}

goal (1 subgoal):
 1. v ! i = 0
[PROOF STEP]
by (subst (asm) sum_eq_0_iff) auto
[PROOF STATE]
proof (state)
this:
?i \<in> {0..m} - {j} \<Longrightarrow> v ! ?i = 0

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
from j
[PROOF STATE]
proof (chain)
picking this:
j \<le> m
v ! j = k
[PROOF STEP]
have "{0..m} = insert j ({0..m} - {j})"
[PROOF STATE]
proof (prove)
using this:
j \<le> m
v ! j = k

goal (1 subgoal):
 1. {0..m} = insert j ({0..m} - {j})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..m} = insert j ({0..m} - {j})

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{0..m} = insert j ({0..m} - {j})

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
from j
[PROOF STATE]
proof (chain)
picking this:
j \<le> m
v ! j = k
[PROOF STEP]
have "(\<Prod>i\<in>\<dots>. f $ (v ! i)) = f $ k * (\<Prod>i\<in>{0..m} - {j}. f $ (v ! i))"
[PROOF STATE]
proof (prove)
using this:
j \<le> m
v ! j = k

goal (1 subgoal):
 1. (\<Prod>i\<in>insert j ({0..m} - {j}). f $ v ! i) = f $ k * (\<Prod>i\<in>{0..m} - {j}. f $ v ! i)
[PROOF STEP]
by (subst prod.insert) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>insert j ({0..m} - {j}). f $ v ! i) = f $ k * (\<Prod>i\<in>{0..m} - {j}. f $ v ! i)

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>insert j ({0..m} - {j}). f $ v ! i) = f $ k * (\<Prod>i\<in>{0..m} - {j}. f $ v ! i)

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
have "(\<Prod>i\<in>{0..m} - {j}. f $ (v ! i)) = (\<Prod>i\<in>{0..m} - {j}. f $ 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i\<in>{0..m} - {j}. f $ v ! i) = (\<Prod>i\<in>{0..m} - {j}. f $ 0)
[PROOF STEP]
by (intro prod.cong) (simp_all add: zero)
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>{0..m} - {j}. f $ v ! i) = (\<Prod>i\<in>{0..m} - {j}. f $ 0)

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>{0..m} - {j}. f $ v ! i) = (\<Prod>i\<in>{0..m} - {j}. f $ 0)

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
from j
[PROOF STATE]
proof (chain)
picking this:
j \<le> m
v ! j = k
[PROOF STEP]
have "\<dots> = (f $ 0) ^ m"
[PROOF STATE]
proof (prove)
using this:
j \<le> m
v ! j = k

goal (1 subgoal):
 1. (\<Prod>i\<in>{0..m} - {j}. f $ 0) = (f $ 0) ^ m
[PROOF STEP]
by (subst prod_constant) simp_all
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>{0..m} - {j}. f $ 0) = (f $ 0) ^ m

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>i = 0..m. f $ v ! i) = f $ k * (f $ 0) ^ m
[PROOF STEP]
have "(\<Prod>j = 0..m. f $ (v ! j)) = f $ k * (f $ 0) ^ m"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>i = 0..m. f $ v ! i) = f $ k * (f $ 0) ^ m

goal (1 subgoal):
 1. (\<Prod>j = 0..m. f $ v ! j) = f $ k * (f $ 0) ^ m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Prod>j = 0..m. f $ v ! j) = f $ k * (f $ 0) ^ m

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?v2 \<in> A \<Longrightarrow> (\<Prod>j = 0..m. f $ ?v2 ! j) = f $ k * (f $ 0) ^ m

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
note A = this
[PROOF STATE]
proof (state)
this:
?v2 \<in> A \<Longrightarrow> (\<Prod>j = 0..m. f $ ?v2 ! j) = f $ k * (f $ 0) ^ m

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
have "(f ^ Suc m) $ k = (\<Sum>v\<in>natpermute k (m + 1). \<Prod>j = 0..m. f $ v ! j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ^ Suc m $ k = (\<Sum>v\<in>natpermute k (m + 1). \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
by (rule fps_power_nth_Suc)
[PROOF STATE]
proof (state)
this:
f ^ Suc m $ k = (\<Sum>v\<in>natpermute k (m + 1). \<Prod>j = 0..m. f $ v ! j)

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f ^ Suc m $ k = (\<Sum>v\<in>natpermute k (m + 1). \<Prod>j = 0..m. f $ v ! j)

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
have "natpermute k (m+1) = A \<union> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. natpermute k (m + 1) = A \<union> B
[PROOF STEP]
unfolding A_def B_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. natpermute k (m + 1) = {v \<in> natpermute k (m + 1). k \<in> set v} \<union> {v \<in> natpermute k (m + 1). k \<notin> set v}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
natpermute k (m + 1) = A \<union> B

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
natpermute k (m + 1) = A \<union> B

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
have "(\<Sum>v\<in>\<dots>. \<Prod>j = 0..m. f $ (v ! j)) =
               (\<Sum>v\<in>A. \<Prod>j = 0..m. f $ (v ! j)) + (\<Sum>v\<in>B. \<Prod>j = 0..m. f $ (v ! j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>A \<union> B. \<Prod>j = 0..m. f $ v ! j) = (\<Sum>v\<in>A. \<Prod>j = 0..m. f $ v ! j) + (\<Sum>v\<in>B. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
by (intro sum.union_disjoint) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>A \<union> B. \<Prod>j = 0..m. f $ v ! j) = (\<Sum>v\<in>A. \<Prod>j = 0..m. f $ v ! j) + (\<Sum>v\<in>B. \<Prod>j = 0..m. f $ v ! j)

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>A \<union> B. \<Prod>j = 0..m. f $ v ! j) = (\<Sum>v\<in>A. \<Prod>j = 0..m. f $ v ! j) + (\<Sum>v\<in>B. \<Prod>j = 0..m. f $ v ! j)

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
have "(\<Sum>v\<in>A. \<Prod>j = 0..m. f $ (v ! j)) = of_nat (Suc m) * (f $ k * (f $ 0) ^ m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>A. \<Prod>j = 0..m. f $ v ! j) = of_nat (Suc m) * (f $ k * (f $ 0) ^ m)
[PROOF STEP]
by (simp add: A card_A)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>A. \<Prod>j = 0..m. f $ v ! j) = of_nat (Suc m) * (f $ k * (f $ 0) ^ m)

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v\<in>B. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v\<in>B. \<Prod>j = 0..m. f $ v ! j)

goal (1 subgoal):
 1. f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)
[PROOF STEP]
by (simp add: B_def)
[PROOF STATE]
proof (state)
this:
f ^ Suc m $ k = of_nat (Suc m) * (f $ k * (f $ 0) ^ m) + (\<Sum>v | v \<in> natpermute k (m + 1) \<and> k \<notin> set v. \<Prod>j = 0..m. f $ v ! j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem EH\<^sub>N_bounds:
  fixes n::nat
  assumes "p \<in> {0<..<1}"
  shows
    "- harm n / ln q - 1 \<le> EH\<^sub>N n"
    "EH\<^sub>N n \<le> - harm n / ln q"
    "integrable (H\<^sub>N n) real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n &&& EH\<^sub>N n \<le> - harm n / ln q &&& integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
show "- harm n / ln q - 1 \<le> EH\<^sub>N n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
using assms EH\<^sub>N_bounds'
[PROOF STATE]
proof (prove)
using this:
p \<in> {0<..<1}
\<lbrakk>p \<in> {0<..<1}; 0 < ?n\<rbrakk> \<Longrightarrow> - harm ?n / ln q - 1 \<le> EH\<^sub>N ?n
\<lbrakk>p \<in> {0<..<1}; 0 < ?n\<rbrakk> \<Longrightarrow> EH\<^sub>N ?n \<le> - harm ?n / ln q
\<lbrakk>p \<in> {0<..<1}; 0 < ?n\<rbrakk> \<Longrightarrow> integrable (measure_pmf (H\<^sub>N ?n)) real

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
by (cases "n = 0") (auto simp add: EH\<^sub>N_def H\<^sub>N_def H_def SL_def harm_expand)
[PROOF STATE]
proof (state)
this:
- harm n / ln q - 1 \<le> EH\<^sub>N n

goal (2 subgoals):
 1. EH\<^sub>N n \<le> - harm n / ln q
 2. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
show "EH\<^sub>N n \<le> - harm n / ln q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
using assms EH\<^sub>N_bounds'
[PROOF STATE]
proof (prove)
using this:
p \<in> {0<..<1}
\<lbrakk>p \<in> {0<..<1}; 0 < ?n\<rbrakk> \<Longrightarrow> - harm ?n / ln q - 1 \<le> EH\<^sub>N ?n
\<lbrakk>p \<in> {0<..<1}; 0 < ?n\<rbrakk> \<Longrightarrow> EH\<^sub>N ?n \<le> - harm ?n / ln q
\<lbrakk>p \<in> {0<..<1}; 0 < ?n\<rbrakk> \<Longrightarrow> integrable (measure_pmf (H\<^sub>N ?n)) real

goal (1 subgoal):
 1. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
by (cases "n = 0") (auto simp add: EH\<^sub>N_def H\<^sub>N_def H_def SL_def harm_expand)
[PROOF STATE]
proof (state)
this:
EH\<^sub>N n \<le> - harm n / ln q

goal (1 subgoal):
 1. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
show "integrable (H\<^sub>N n) real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
using assms EH\<^sub>N_bounds'
[PROOF STATE]
proof (prove)
using this:
p \<in> {0<..<1}
\<lbrakk>p \<in> {0<..<1}; 0 < ?n\<rbrakk> \<Longrightarrow> - harm ?n / ln q - 1 \<le> EH\<^sub>N ?n
\<lbrakk>p \<in> {0<..<1}; 0 < ?n\<rbrakk> \<Longrightarrow> EH\<^sub>N ?n \<le> - harm ?n / ln q
\<lbrakk>p \<in> {0<..<1}; 0 < ?n\<rbrakk> \<Longrightarrow> integrable (measure_pmf (H\<^sub>N ?n)) real

goal (1 subgoal):
 1. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
by (cases "n = 0") (auto simp add: H\<^sub>N_def H_def SL_def intro!: integrable_measure_pmf_finite)
[PROOF STATE]
proof (state)
this:
integrable (measure_pmf (H\<^sub>N n)) real

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma totatives_code [code]: "totatives n = Set.filter (\<lambda>k. coprime k n) {0<..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totatives n = Set.filter (\<lambda>k. coprime k n) {0<..n}
[PROOF STEP]
by (simp add: totatives_def Set.filter_def)


[STATEMENT]
lemma order [simp]: "order G = totient n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order G = totient n
[PROOF STEP]
by (simp add: order_def G_def totient_def residue_mult_group_def)


[STATEMENT]
lemma [field_simps]:
  "c \<noteq> 0 \<Longrightarrow> a = b /\<^sub>R c \<longleftrightarrow> c *\<^sub>R a = b"
  "c \<noteq> 0 \<Longrightarrow> b /\<^sub>R c = a \<longleftrightarrow> b = c *\<^sub>R a"
  "c \<noteq> 0 \<Longrightarrow> a + b /\<^sub>R c = (c *\<^sub>R a + b) /\<^sub>R c"
  "c \<noteq> 0 \<Longrightarrow> a /\<^sub>R c + b = (a + c *\<^sub>R b) /\<^sub>R c"
  "c \<noteq> 0 \<Longrightarrow> a - b /\<^sub>R c = (c *\<^sub>R a - b) /\<^sub>R c"
  "c \<noteq> 0 \<Longrightarrow> a /\<^sub>R c - b = (a - c *\<^sub>R b) /\<^sub>R c"
  "c \<noteq> 0 \<Longrightarrow> - (a /\<^sub>R c) + b = (- a + c *\<^sub>R b) /\<^sub>R c"
  "c \<noteq> 0 \<Longrightarrow> - (a /\<^sub>R c) - b = (- a - c *\<^sub>R b) /\<^sub>R c"
  for a b :: "'a :: real_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((c \<noteq> 0 \<Longrightarrow> (a = b /\<^sub>R c) = (c *\<^sub>R a = b)) &&& (c \<noteq> 0 \<Longrightarrow> (b /\<^sub>R c = a) = (b = c *\<^sub>R a))) &&& (c \<noteq> 0 \<Longrightarrow> a + b /\<^sub>R c = (c *\<^sub>R a + b) /\<^sub>R c) &&& (c \<noteq> 0 \<Longrightarrow> a /\<^sub>R c + b = (a + c *\<^sub>R b) /\<^sub>R c)) &&& ((c \<noteq> 0 \<Longrightarrow> a - b /\<^sub>R c = (c *\<^sub>R a - b) /\<^sub>R c) &&& (c \<noteq> 0 \<Longrightarrow> a /\<^sub>R c - b = (a - c *\<^sub>R b) /\<^sub>R c)) &&& (c \<noteq> 0 \<Longrightarrow> - (a /\<^sub>R c) + b = (- a + c *\<^sub>R b) /\<^sub>R c) &&& (c \<noteq> 0 \<Longrightarrow> - (a /\<^sub>R c) - b = (- a - c *\<^sub>R b) /\<^sub>R c)
[PROOF STEP]
by (auto simp add: scaleR_add_right scaleR_add_left scaleR_diff_right scaleR_diff_left)


[STATEMENT]
lemma card_option [simp]: "CARD('a option) = Suc CARD('a::finite)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a option) = Suc CARD('a)
[PROOF STEP]
by(simp add: card_UNIV_option)


[STATEMENT]
lemma cblinfun_power_scaleC: \<open>cblinfun_power (c *\<^sub>C a) n = c^n *\<^sub>C cblinfun_power a n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cblinfun_power (c *\<^sub>C a) n = c ^ n *\<^sub>C cblinfun_power a n
[PROOF STEP]
apply (induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. cblinfun_power (c *\<^sub>C a) 0 = c ^ 0 *\<^sub>C cblinfun_power a 0
 2. \<And>n. cblinfun_power (c *\<^sub>C a) n = c ^ n *\<^sub>C cblinfun_power a n \<Longrightarrow> cblinfun_power (c *\<^sub>C a) (Suc n) = c ^ Suc n *\<^sub>C cblinfun_power a (Suc n)
[PROOF STEP]
by (auto simp: cblinfun_power_Suc)


[STATEMENT]
theorem distinct_nearest_neighbors:
  assumes "invar kdt"
  shows "distinct (nearest_neighbors n p kdt)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (nearest_neighbors n p kdt)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
invar kdt

goal (1 subgoal):
 1. distinct (nearest_neighbors n p kdt)
[PROOF STEP]
by (simp add: distinct_nns nearest_neighbors_def)


[STATEMENT]
lemma dist_fs_triangle_infinite3:
  shows "cmod(a - b) / (sqrt (1+(cmod a)\<^sup>2) * sqrt (1+(cmod b)\<^sup>2)) \<le> 1 / sqrt(1 + (cmod a)\<^sup>2) + 1 / sqrt(1 + (cmod b)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (a - b) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) \<le> 1 / sqrt (1 + (cmod a)\<^sup>2) + 1 / sqrt (1 + (cmod b)\<^sup>2)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod (a - b) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) \<le> 1 / sqrt (1 + (cmod a)\<^sup>2) + 1 / sqrt (1 + (cmod b)\<^sup>2)
[PROOF STEP]
let ?aa = "sqrt (1 + (cmod a)\<^sup>2)" and ?bb = "sqrt (1 + (cmod b)\<^sup>2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod (a - b) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) \<le> 1 / sqrt (1 + (cmod a)\<^sup>2) + 1 / sqrt (1 + (cmod b)\<^sup>2)
[PROOF STEP]
have "?aa > 0" "?bb > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < sqrt (1 + (cmod a)\<^sup>2) &&& 0 < sqrt (1 + (cmod b)\<^sup>2)
[PROOF STEP]
by (metis add_strict_increasing real_sqrt_gt_0_iff zero_le_power2 zero_less_one)+
[PROOF STATE]
proof (state)
this:
0 < sqrt (1 + (cmod a)\<^sup>2)
0 < sqrt (1 + (cmod b)\<^sup>2)

goal (1 subgoal):
 1. cmod (a - b) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) \<le> 1 / sqrt (1 + (cmod a)\<^sup>2) + 1 / sqrt (1 + (cmod b)\<^sup>2)
[PROOF STEP]
hence *: "?aa * ?bb \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 < sqrt (1 + (cmod a)\<^sup>2)
0 < sqrt (1 + (cmod b)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)

goal (1 subgoal):
 1. cmod (a - b) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) \<le> 1 / sqrt (1 + (cmod a)\<^sup>2) + 1 / sqrt (1 + (cmod b)\<^sup>2)
[PROOF STEP]
have **: "(?aa + ?bb) / (?aa * ?bb) = 1 / ?aa + 1 / ?bb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sqrt (1 + (cmod a)\<^sup>2) + sqrt (1 + (cmod b)\<^sup>2)) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) = 1 / sqrt (1 + (cmod a)\<^sup>2) + 1 / sqrt (1 + (cmod b)\<^sup>2)
[PROOF STEP]
using \<open>?aa > 0\<close> \<open>?bb > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < sqrt (1 + (cmod a)\<^sup>2)
0 < sqrt (1 + (cmod b)\<^sup>2)

goal (1 subgoal):
 1. (sqrt (1 + (cmod a)\<^sup>2) + sqrt (1 + (cmod b)\<^sup>2)) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) = 1 / sqrt (1 + (cmod a)\<^sup>2) + 1 / sqrt (1 + (cmod b)\<^sup>2)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(sqrt (1 + (cmod a)\<^sup>2) + sqrt (1 + (cmod b)\<^sup>2)) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) = 1 / sqrt (1 + (cmod a)\<^sup>2) + 1 / sqrt (1 + (cmod b)\<^sup>2)

goal (1 subgoal):
 1. cmod (a - b) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) \<le> 1 / sqrt (1 + (cmod a)\<^sup>2) + 1 / sqrt (1 + (cmod b)\<^sup>2)
[PROOF STEP]
show "cmod (a - b) / (?aa * ?bb) \<le> 1 / ?aa + 1 / ?bb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (a - b) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) \<le> 1 / sqrt (1 + (cmod a)\<^sup>2) + 1 / sqrt (1 + (cmod b)\<^sup>2)
[PROOF STEP]
using divide_right_mono[OF cmod_diff_le[of a b] *]
[PROOF STATE]
proof (prove)
using this:
cmod (a - b) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) \<le> (sqrt (1 + (cmod a)\<^sup>2) + sqrt (1 + (cmod b)\<^sup>2)) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2))

goal (1 subgoal):
 1. cmod (a - b) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) \<le> 1 / sqrt (1 + (cmod a)\<^sup>2) + 1 / sqrt (1 + (cmod b)\<^sup>2)
[PROOF STEP]
by (subst (asm) **) (simp add: field_simps norm_minus_commute)
[PROOF STATE]
proof (state)
this:
cmod (a - b) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod b)\<^sup>2)) \<le> 1 / sqrt (1 + (cmod a)\<^sup>2) + 1 / sqrt (1 + (cmod b)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma and_nat_rec:
  \<open>m AND n = of_bool (odd m \<and> odd n) + 2 * ((m div 2) AND (n div 2))\<close> for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m AND n = of_bool (odd m \<and> odd n) + 2 * (m div 2 AND n div 2)
[PROOF STEP]
by (simp add: and_nat_def and_int_rec [of \<open>int m\<close> \<open>int n\<close>] zdiv_int nat_add_distrib nat_mult_distrib)


[STATEMENT]
lemma det3_eq_zeroI:
  assumes "p = q + x *\<^sub>R (t - q)"
  shows "det3 q t p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det3 q t p = 0
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det3 q t (q + x *\<^sub>R (t - q)) = 0
[PROOF STEP]
by (auto simp: det3_def' algebra_simps)


[STATEMENT]
lemma finite_neighbors: "finite (neighbors u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (neighbors u)
[PROOF STEP]
using finite_V and rev_finite_subset [of V "neighbors u"]
[PROOF STATE]
proof (prove)
using this:
finite V
\<lbrakk>finite V; neighbors u \<subseteq> V\<rbrakk> \<Longrightarrow> finite (neighbors u)

goal (1 subgoal):
 1. finite (neighbors u)
[PROOF STEP]
by auto


[STATEMENT]
lemma iT_Div_0_icard_if: "icard (I \<oslash> 0) = enat (if I = {} then 0 else Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. icard (I \<oslash> 0) = enat (if I = {} then 0 else Suc 0)
[PROOF STEP]
by (simp add: icard_finite iT_Div_0_finite iT_Div_0_card_if)


[STATEMENT]
lemma Mp_lift_modulus: assumes "f =m g"
  shows "poly_mod.eq_m (m * k) (smult k f) (smult k g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.Mp (m * k) (smult k f) = poly_mod.Mp (m * k) (smult k g)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f =m g

goal (1 subgoal):
 1. poly_mod.Mp (m * k) (smult k f) = poly_mod.Mp (m * k) (smult k g)
[PROOF STEP]
unfolding poly_eq_iff poly_mod.Mp_coeff coeff_smult
[PROOF STATE]
proof (prove)
using this:
\<forall>n. M (coeff f n) = M (coeff g n)

goal (1 subgoal):
 1. \<forall>n. poly_mod.M (m * k) (k * coeff f n) = poly_mod.M (m * k) (k * coeff g n)
[PROOF STEP]
unfolding poly_mod.M_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. coeff f n mod m = coeff g n mod m

goal (1 subgoal):
 1. \<forall>n. k * coeff f n mod (m * k) = k * coeff g n mod (m * k)
[PROOF STEP]
by simp


[STATEMENT]
lemma floor_minus_divide_eq_div_numeral [simp]:
  "\<lfloor>- (numeral a / numeral b)::real\<rfloor> = - numeral a div numeral b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>- (numeral a / numeral b)\<rfloor> = - numeral a div numeral b
[PROOF STEP]
by (metis divide_minus_left floor_divide_of_int_eq of_int_neg_numeral of_int_numeral)


[STATEMENT]
lemma leadsETo_UN_distrib:
     "F \<in> (UN i:I. A i) leadsTo[CC] B  =
      (\<forall>i\<in>I. F \<in> (A i) leadsTo[CC] B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<in> \<Union> (A ` I) leadsTo[CC] B) = (\<forall>i\<in>I. F \<in> A i leadsTo[CC] B)
[PROOF STEP]
by (blast intro: leadsETo_UN leadsETo_weaken_L)


[STATEMENT]
lemma (in finite_measure) measure_equiprobable_finite_unions:
  assumes s: "finite s" "\<And>x. x \<in> s \<Longrightarrow> {x} \<in> sets M"
  assumes "\<And> x y. \<lbrakk>x \<in> s; y \<in> s\<rbrakk> \<Longrightarrow> measure M {x} = measure M {y}"
  shows "measure M s = real (card s) * measure M {SOME x. x \<in> s}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
 2. \<not> ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
assume "s \<noteq> {}"
[PROOF STATE]
proof (state)
this:
s \<noteq> {}

goal (2 subgoals):
 1. ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
 2. \<not> ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s \<noteq> {}
[PROOF STEP]
have "\<exists> x. x \<in> s"
[PROOF STATE]
proof (prove)
using this:
s \<noteq> {}

goal (1 subgoal):
 1. \<exists>x. x \<in> s
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>x. x \<in> s

goal (2 subgoals):
 1. ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
 2. \<not> ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
from someI_ex[OF this] assms
[PROOF STATE]
proof (chain)
picking this:
(SOME x. x \<in> s) \<in> s
finite s
?x \<in> s \<Longrightarrow> {?x} \<in> sets M
\<lbrakk>?x \<in> s; ?y \<in> s\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M {?x} = Sigma_Algebra.measure M {?y}
[PROOF STEP]
have prob_some: "\<And> x. x \<in> s \<Longrightarrow> measure M {x} = measure M {SOME y. y \<in> s}"
[PROOF STATE]
proof (prove)
using this:
(SOME x. x \<in> s) \<in> s
finite s
?x \<in> s \<Longrightarrow> {?x} \<in> sets M
\<lbrakk>?x \<in> s; ?y \<in> s\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M {?x} = Sigma_Algebra.measure M {?y}

goal (1 subgoal):
 1. \<And>x. x \<in> s \<Longrightarrow> Sigma_Algebra.measure M {x} = Sigma_Algebra.measure M {SOME y. y \<in> s}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?x \<in> s \<Longrightarrow> Sigma_Algebra.measure M {?x} = Sigma_Algebra.measure M {SOME y. y \<in> s}

goal (2 subgoals):
 1. ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
 2. \<not> ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
have "measure M s = (\<Sum> x \<in> s. measure M {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M s = (\<Sum>x\<in>s. Sigma_Algebra.measure M {x})
[PROOF STEP]
using finite_measure_eq_sum_singleton[OF s]
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> s \<Longrightarrow> x \<in> s) \<Longrightarrow> Sigma_Algebra.measure M s = (\<Sum>x\<in>s. Sigma_Algebra.measure M {x})

goal (1 subgoal):
 1. Sigma_Algebra.measure M s = (\<Sum>x\<in>s. Sigma_Algebra.measure M {x})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M s = (\<Sum>x\<in>s. Sigma_Algebra.measure M {x})

goal (2 subgoals):
 1. ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
 2. \<not> ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M s = (\<Sum>x\<in>s. Sigma_Algebra.measure M {x})

goal (2 subgoals):
 1. ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
 2. \<not> ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
have "\<dots> = (\<Sum> x \<in> s. measure M {SOME y. y \<in> s})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>s. Sigma_Algebra.measure M {x}) = (\<Sum>x\<in>s. Sigma_Algebra.measure M {SOME y. y \<in> s})
[PROOF STEP]
using prob_some
[PROOF STATE]
proof (prove)
using this:
?x \<in> s \<Longrightarrow> Sigma_Algebra.measure M {?x} = Sigma_Algebra.measure M {SOME y. y \<in> s}

goal (1 subgoal):
 1. (\<Sum>x\<in>s. Sigma_Algebra.measure M {x}) = (\<Sum>x\<in>s. Sigma_Algebra.measure M {SOME y. y \<in> s})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>s. Sigma_Algebra.measure M {x}) = (\<Sum>x\<in>s. Sigma_Algebra.measure M {SOME y. y \<in> s})

goal (2 subgoals):
 1. ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
 2. \<not> ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>s. Sigma_Algebra.measure M {x}) = (\<Sum>x\<in>s. Sigma_Algebra.measure M {SOME y. y \<in> s})

goal (2 subgoals):
 1. ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
 2. \<not> ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
have "\<dots> = real (card s) * measure M {(SOME x. x \<in> s)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>s. Sigma_Algebra.measure M {SOME y. y \<in> s}) = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
using sum_constant assms
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>?A. ?y) = of_nat (card ?A) * ?y
finite s
?x \<in> s \<Longrightarrow> {?x} \<in> sets M
\<lbrakk>?x \<in> s; ?y \<in> s\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M {?x} = Sigma_Algebra.measure M {?y}

goal (1 subgoal):
 1. (\<Sum>x\<in>s. Sigma_Algebra.measure M {SOME y. y \<in> s}) = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>s. Sigma_Algebra.measure M {SOME y. y \<in> s}) = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}

goal (2 subgoals):
 1. ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
 2. \<not> ?P \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}

goal (1 subgoal):
 1. Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}

goal (1 subgoal):
 1. \<not> s \<noteq> {} \<Longrightarrow> Sigma_Algebra.measure M s = real (card s) * Sigma_Algebra.measure M {SOME x. x \<in> s}
[PROOF STEP]
qed simp


[STATEMENT]
lemma succ_le_iff: "Ord i \<Longrightarrow> Ord j \<Longrightarrow> succ i \<le> j \<longleftrightarrow> i < j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ord i; Ord j\<rbrakk> \<Longrightarrow> (ZFC_in_HOL.succ i \<le> j) = (i < j)
[PROOF STEP]
using Ord_mem_iff_lt dual_order.strict_implies_order less_eq_V_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Ord ?k; Ord ?l\<rbrakk> \<Longrightarrow> (?k \<in> elts ?l) = (?k < ?l)
?b < ?a \<Longrightarrow> ?b \<le> ?a
?x \<le> ?y \<equiv> elts ?x \<subseteq> elts ?y

goal (1 subgoal):
 1. \<lbrakk>Ord i; Ord j\<rbrakk> \<Longrightarrow> (ZFC_in_HOL.succ i \<le> j) = (i < j)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma orthogonal_matI[intro]:
  "(\<And>i j. i < dim_col A \<Longrightarrow> j < dim_col A \<Longrightarrow> (col A i \<bullet> col A j = 0) = (i \<noteq> j)) \<Longrightarrow>
   orthogonal_mat A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>i < dim_col A; j < dim_col A\<rbrakk> \<Longrightarrow> (col A i \<bullet> col A j = (0::'a)) = (i \<noteq> j)) \<Longrightarrow> orthogonal_mat A
[PROOF STEP]
unfolding orthogonal_mat_def diagonal_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>i < dim_col A; j < dim_col A\<rbrakk> \<Longrightarrow> (col A i \<bullet> col A j = (0::'a)) = (i \<noteq> j)) \<Longrightarrow> let B = transpose_mat A * A in (\<forall>i<dim_row B. \<forall>j<dim_col B. i \<noteq> j \<longrightarrow> B $$ (i, j) = (0::'a)) \<and> (\<forall>i<dim_col A. B $$ (i, i) \<noteq> (0::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma adjoint_scale:
  fixes A :: "'a::conjugatable_field mat"
  shows "adjoint (a \<cdot>\<^sub>m A) = (conjugate a) \<cdot>\<^sub>m adjoint A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint (a \<cdot>\<^sub>m A) = conjugate a \<cdot>\<^sub>m adjoint A
[PROOF STEP]
apply (rule eq_matI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (conjugate a \<cdot>\<^sub>m adjoint A); j < dim_col (conjugate a \<cdot>\<^sub>m adjoint A)\<rbrakk> \<Longrightarrow> adjoint (a \<cdot>\<^sub>m A) $$ (i, j) = (conjugate a \<cdot>\<^sub>m adjoint A) $$ (i, j)
 2. dim_row (adjoint (a \<cdot>\<^sub>m A)) = dim_row (conjugate a \<cdot>\<^sub>m adjoint A)
 3. dim_col (adjoint (a \<cdot>\<^sub>m A)) = dim_col (conjugate a \<cdot>\<^sub>m adjoint A)
[PROOF STEP]
using conjugatable_ring_class.conjugate_dist_mul
[PROOF STATE]
proof (prove)
using this:
conjugate (?a * ?b) = conjugate ?a * conjugate ?b

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (conjugate a \<cdot>\<^sub>m adjoint A); j < dim_col (conjugate a \<cdot>\<^sub>m adjoint A)\<rbrakk> \<Longrightarrow> adjoint (a \<cdot>\<^sub>m A) $$ (i, j) = (conjugate a \<cdot>\<^sub>m adjoint A) $$ (i, j)
 2. dim_row (adjoint (a \<cdot>\<^sub>m A)) = dim_row (conjugate a \<cdot>\<^sub>m adjoint A)
 3. dim_col (adjoint (a \<cdot>\<^sub>m A)) = dim_col (conjugate a \<cdot>\<^sub>m adjoint A)
[PROOF STEP]
by (auto simp add: adjoint_eval)


[STATEMENT]
lemma (in Order) g_Zorn_lemma1:"\<lbrakk>inductive_set D; Chain D C\<rbrakk> \<Longrightarrow> \<exists>m. maximal m \<and> m \<in> upper_bounds D C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inductive_set D; Chain D C\<rbrakk> \<Longrightarrow> \<exists>m. maximal m \<and> m \<in> upper_bounds D C
[PROOF STEP]
apply (frule Chain_mem_fTo [of "C"],
       frule Hausdorff_ac[of "C"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inductive_set D; Chain D C; C \<in> carrier fTo D; \<exists>M\<in>carrier fTo D. C \<subseteq> M \<and> maximal\<^bsub>fTo D\<^esub> M\<rbrakk> \<Longrightarrow> \<exists>m. maximal m \<and> m \<in> upper_bounds D C
[PROOF STEP]
apply (erule bexE, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>M. \<lbrakk>inductive_set D; Chain D C; C \<in> carrier fTo D; M \<in> carrier fTo D; C \<subseteq> M; maximal\<^bsub>fTo D\<^esub> M\<rbrakk> \<Longrightarrow> \<exists>m. maximal m \<and> m \<in> upper_bounds D C
[PROOF STEP]
apply (frule_tac X = M in mem_fTo_Chain)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>M. \<lbrakk>inductive_set D; Chain D C; C \<in> carrier fTo D; M \<in> carrier fTo D; C \<subseteq> M; maximal\<^bsub>fTo D\<^esub> M; Chain D M\<rbrakk> \<Longrightarrow> \<exists>m. maximal m \<and> m \<in> upper_bounds D C
[PROOF STEP]
apply (simp add:inductive_set_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>M. \<lbrakk>\<forall>C. Chain D C \<longrightarrow> (\<exists>b. ub C b); Chain D C; C \<in> carrier fTo D; M \<in> carrier fTo D; C \<subseteq> M; maximal\<^bsub>fTo D\<^esub> M; Chain D M\<rbrakk> \<Longrightarrow> \<exists>m. maximal m \<and> m \<in> upper_bounds D C
[PROOF STEP]
apply (frule_tac a = M in forall_spec, assumption,
        thin_tac "\<forall>C. Chain D C \<longrightarrow> (\<exists>b. ub C b)",
        erule exE, simp add:upper_bound_def, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>M b. \<lbrakk>Chain D C; C \<in> carrier fTo D; M \<in> carrier fTo D; C \<subseteq> M; maximal\<^bsub>fTo D\<^esub> M; Chain D M; b \<in> carrier D; \<forall>s\<in>M. s \<preceq> b\<rbrakk> \<Longrightarrow> \<exists>m. maximal m \<and> m \<in> upper_bounds D C
[PROOF STEP]
apply (frule_tac M = M and b = b in Zorn_lemmaTr[of "C"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>M b. \<lbrakk>Chain D C; C \<in> carrier fTo D; M \<in> carrier fTo D; C \<subseteq> M; maximal\<^bsub>fTo D\<^esub> M; Chain D M; b \<in> carrier D; \<forall>s\<in>M. s \<preceq> b; maximal b \<and> b \<in> upper_bounds D C\<rbrakk> \<Longrightarrow> \<exists>m. maximal m \<and> m \<in> upper_bounds D C
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma myle:
  fixes a b :: "'a::{ordered_ab_group_add}"
  shows "(a \<le> b) = (0 \<le> b - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<le> b) = ((0::'a) \<le> b - a)
[PROOF STEP]
by (metis add_0_left add_le_cancel_right diff_add_cancel)


[STATEMENT]
lemma \<pi>_nth_prime [simp]: "\<pi> (real (nth_prime n)) = real n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> (real (nth_prime n)) = real n + 1
[PROOF STEP]
by (simp add: \<pi>_def prime_sum_upto_def)


[STATEMENT]
lemma rbt_comp_bulkload: "rbt_comp_bulkload = ord.rbt_bulkload (lt_of_comp c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.rbt_comp_bulkload = ord.rbt_bulkload (lt_of_comp c)
[PROOF STEP]
unfolding rbt_comp_bulkload_def[abs_def] ord.rbt_bulkload_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>xs. foldr (\<lambda>(x, y). local.rbt_comp_insert x y) xs rbt.Empty) = (\<lambda>xs. foldr (\<lambda>(x, y). ord.rbt_insert (lt_of_comp c) x y) xs rbt.Empty)
[PROOF STEP]
unfolding rbt_comp_insert
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>xs. foldr (\<lambda>(x, y). ord.rbt_insert (lt_of_comp c) x y) xs rbt.Empty) = (\<lambda>xs. foldr (\<lambda>(x, y). ord.rbt_insert (lt_of_comp c) x y) xs rbt.Empty)
[PROOF STEP]
..


[STATEMENT]
lemma hmsetmset_times:
  "hmsetmset (m * n) = image_mset (case_prod (+)) (hmsetmset m \<times># hmsetmset n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hmsetmset (m * n) = {#x + y. (x, y) \<in># hmsetmset m \<times># hmsetmset n#}
[PROOF STEP]
unfolding times_hmultiset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hmsetmset (HMSet {#x + y. (x, y) \<in># hmsetmset m \<times># hmsetmset n#}) = {#x + y. (x, y) \<in># hmsetmset m \<times># hmsetmset n#}
[PROOF STEP]
by simp


[STATEMENT]
lemma sum2_nat: "(\<Sum>i<(2::nat). P i) = P 0 + P 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum P {..<2} = P 0 + P 1
[PROOF STEP]
by (simp add: eval_nat_numeral)


[STATEMENT]
lemma permutations_of_set_nonempty:
  "A \<noteq> {} \<Longrightarrow> permutations_of_set A =
                  (\<Union>x\<in>A. (\<lambda>xs. x # xs) ` permutations_of_set (A - {x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> permutations_of_set A = (\<Union>x\<in>A. (#) x ` permutations_of_set (A - {x}))
[PROOF STEP]
by (cases "finite A")
     (simp_all add: permutations_of_multiset_nonempty mset_set_empty_iff mset_set_Diff
                    permutations_of_set_altdef permutations_of_set_infinite)


[STATEMENT]
lemma domain_vs_domain_lsc_hull:
  fixes f :: "'a::euclidean_space \<Rightarrow> ereal"
  assumes "convex_on UNIV f"
  shows "rel_interior(domain (lsc_hull f)) = rel_interior(domain f)
         \<and> closure(domain (lsc_hull f)) = closure(domain f)
         \<and> aff_dim(domain (lsc_hull f)) = aff_dim(domain f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior (domain (lsc_hull f)) = rel_interior (domain f) \<and> closure (domain (lsc_hull f)) = closure (domain f) \<and> aff_dim (domain (lsc_hull f)) = aff_dim (domain f)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rel_interior (domain (lsc_hull f)) = rel_interior (domain f) \<and> closure (domain (lsc_hull f)) = closure (domain f) \<and> aff_dim (domain (lsc_hull f)) = aff_dim (domain f)
[PROOF STEP]
have "convex (domain f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (domain f)
[PROOF STEP]
by (metis assms convex_domain)
[PROOF STATE]
proof (state)
this:
convex (domain f)

goal (1 subgoal):
 1. rel_interior (domain (lsc_hull f)) = rel_interior (domain f) \<and> closure (domain (lsc_hull f)) = closure (domain f) \<and> aff_dim (domain (lsc_hull f)) = aff_dim (domain f)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
convex (domain f)

goal (1 subgoal):
 1. rel_interior (domain (lsc_hull f)) = rel_interior (domain f) \<and> closure (domain (lsc_hull f)) = closure (domain f) \<and> aff_dim (domain (lsc_hull f)) = aff_dim (domain f)
[PROOF STEP]
have "convex (domain (lsc_hull f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (domain (lsc_hull f))
[PROOF STEP]
by (metis assms convex_domain convex_lsc_hull)
[PROOF STATE]
proof (state)
this:
convex (domain (lsc_hull f))

goal (1 subgoal):
 1. rel_interior (domain (lsc_hull f)) = rel_interior (domain f) \<and> closure (domain (lsc_hull f)) = closure (domain f) \<and> aff_dim (domain (lsc_hull f)) = aff_dim (domain f)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
convex (domain (lsc_hull f))

goal (1 subgoal):
 1. rel_interior (domain (lsc_hull f)) = rel_interior (domain f) \<and> closure (domain (lsc_hull f)) = closure (domain f) \<and> aff_dim (domain (lsc_hull f)) = aff_dim (domain f)
[PROOF STEP]
have "rel_interior (domain f) \<le> domain (lsc_hull f)
                 \<and> domain (lsc_hull f) \<le> closure (domain f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior (domain f) \<subseteq> domain (lsc_hull f) \<and> domain (lsc_hull f) \<subseteq> closure (domain f)
[PROOF STEP]
by (metis domain_lsc_hull_between rel_interior_subset subset_trans)
[PROOF STATE]
proof (state)
this:
rel_interior (domain f) \<subseteq> domain (lsc_hull f) \<and> domain (lsc_hull f) \<subseteq> closure (domain f)

goal (1 subgoal):
 1. rel_interior (domain (lsc_hull f)) = rel_interior (domain f) \<and> closure (domain (lsc_hull f)) = closure (domain f) \<and> aff_dim (domain (lsc_hull f)) = aff_dim (domain f)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
convex (domain f)
convex (domain (lsc_hull f))
rel_interior (domain f) \<subseteq> domain (lsc_hull f) \<and> domain (lsc_hull f) \<subseteq> closure (domain f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
convex (domain f)
convex (domain (lsc_hull f))
rel_interior (domain f) \<subseteq> domain (lsc_hull f) \<and> domain (lsc_hull f) \<subseteq> closure (domain f)

goal (1 subgoal):
 1. rel_interior (domain (lsc_hull f)) = rel_interior (domain f) \<and> closure (domain (lsc_hull f)) = closure (domain f) \<and> aff_dim (domain (lsc_hull f)) = aff_dim (domain f)
[PROOF STEP]
by (metis closure_eq_between rel_interior_aff_dim rel_interior_eq_between)
[PROOF STATE]
proof (state)
this:
rel_interior (domain (lsc_hull f)) = rel_interior (domain f) \<and> closure (domain (lsc_hull f)) = closure (domain f) \<and> aff_dim (domain (lsc_hull f)) = aff_dim (domain f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma G_transpose_trancl:
  "(fixed_mat.G (transpose A))^+ = ((fixed_mat.G A)^+)^-1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fixed_mat.G (Finite_Cartesian_Product.transpose A))\<^sup>+ = ((fixed_mat.G A)\<^sup>+)\<inverse>
[PROOF STEP]
unfolding G_transpose trancl_converse
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((fixed_mat.G A)\<^sup>+)\<inverse> = ((fixed_mat.G A)\<^sup>+)\<inverse>
[PROOF STEP]
by auto


[STATEMENT]
lemma coeff_poly_to_mpoly: "MPoly_Type.coeff (poly_to_mpoly v p) (Poly_Mapping.single v k) = Polynomial.coeff p k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeff (poly_to_mpoly v p) (Poly_Mapping.single v k) = poly.coeff p k
[PROOF STEP]
unfolding poly_to_mpoly_def coeff_def MPoly_inverse[OF Set.UNIV_I] lookup_Abs_poly_mapping[OF poly_to_mpoly_finite]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly.coeff p (lookup (Poly_Mapping.single v k) v) when keys (Poly_Mapping.single v k) \<subseteq> {v}) = poly.coeff p k
[PROOF STEP]
using empty_subsetI keys_single lookup_single order_refl when_simps(1)
[PROOF STATE]
proof (prove)
using this:
{} \<subseteq> ?A
keys (Poly_Mapping.single ?k ?v) = (if ?v = (0::?'b) then {} else {?k})
lookup (Poly_Mapping.single ?k ?v) ?k' = (?v when ?k = ?k')
?x \<le> ?x
(?a when True) = ?a

goal (1 subgoal):
 1. (poly.coeff p (lookup (Poly_Mapping.single v k) v) when keys (Poly_Mapping.single v k) \<subseteq> {v}) = poly.coeff p k
[PROOF STEP]
by simp


[STATEMENT]
lemma card_iff_exists: "0 < card X \<longleftrightarrow> finite X \<and> (\<exists>x. x \<in> X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < card X) = (finite X \<and> (\<exists>x. x \<in> X))
[PROOF STEP]
by (auto simp: card_gt_0_iff)


[STATEMENT]
lemma dvd_elements_mult_matrix_left_right:
  assumes A: "(A::'a::comm_ring_1 mat) \<in> carrier_mat m n"
  and P: "P \<in> carrier_mat m m"
  and Q: "Q \<in> carrier_mat n n"
  and x: "(\<forall>i j. i<m \<and> j<n \<longrightarrow> x dvd A$$(i,j))"
shows "(\<forall>i j. i<m \<and> j<n \<longrightarrow> x dvd (P*A*Q)$$(i,j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i j. i < m \<and> j < n \<longrightarrow> x dvd (P * A * Q) $$ (i, j)
[PROOF STEP]
using dvd_elements_mult_matrix_left[OF A P x]
[PROOF STATE]
proof (prove)
using this:
\<forall>i j. i < m \<and> j < n \<longrightarrow> x dvd (P * A) $$ (i, j)

goal (1 subgoal):
 1. \<forall>i j. i < m \<and> j < n \<longrightarrow> x dvd (P * A * Q) $$ (i, j)
[PROOF STEP]
by (meson P A Q dvd_elements_mult_matrix_right mult_carrier_mat)


[STATEMENT]
lemma foldr_True_set: "foldr (\<lambda>x. (\<and>) (f x)) l True = (\<forall>x \<in> set l. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>x. (\<and>) (f x)) l True = (\<forall>x\<in>set l. f x)
[PROOF STEP]
by (induction l) simp_all


[STATEMENT]
lemma one_compl: "-(x ; 1) ; 1 = -(x ; 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (x ; 1) ; 1 = - (x ; 1)
[PROOF STEP]
by (metis order.antisym conv_one maddux_12 mult.assoc one_idem_mult maddux_20)


[STATEMENT]
lemma card_of_Un_infinite_simps[simp]:
"\<lbrakk>\<not>finite A; |B| \<le>o |A| \<rbrakk> \<Longrightarrow> |A \<union> B| =o |A|"
"\<lbrakk>\<not>finite A; |B| \<le>o |A| \<rbrakk> \<Longrightarrow> |B \<union> A| =o |A|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>infinite A; |B| \<le>o |A|\<rbrakk> \<Longrightarrow> |A \<union> B| =o |A|) &&& (\<lbrakk>infinite A; |B| \<le>o |A|\<rbrakk> \<Longrightarrow> |B \<union> A| =o |A|)
[PROOF STEP]
using card_of_Un_infinite
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>infinite ?A; |?B| \<le>o |?A|\<rbrakk> \<Longrightarrow> |?A \<union> ?B| =o |?A| \<and> |?B \<union> ?A| =o |?A|

goal (1 subgoal):
 1. (\<lbrakk>infinite A; |B| \<le>o |A|\<rbrakk> \<Longrightarrow> |A \<union> B| =o |A|) &&& (\<lbrakk>infinite A; |B| \<le>o |A|\<rbrakk> \<Longrightarrow> |B \<union> A| =o |A|)
[PROOF STEP]
by auto


[STATEMENT]
lemma integrable_combine:
  fixes f :: "real \<Rightarrow> 'a::banach"
  assumes "a \<le> c"
    and "c \<le> b"
    and "f integrable_on {a..c}"
    and "f integrable_on {c..b}"
  shows "f integrable_on {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f integrable_on {a..b}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<le> c
c \<le> b
f integrable_on {a..c}
f integrable_on {c..b}

goal (1 subgoal):
 1. f integrable_on {a..b}
[PROOF STEP]
unfolding integrable_on_def
[PROOF STATE]
proof (prove)
using this:
a \<le> c
c \<le> b
\<exists>y. (f has_integral y) {a..c}
\<exists>y. (f has_integral y) {c..b}

goal (1 subgoal):
 1. \<exists>y. (f has_integral y) {a..b}
[PROOF STEP]
by (auto intro!: has_integral_combine)


[STATEMENT]
lemma
  iT_Plus_iEx_conv: "(\<diamond> t I \<oplus> k. P t) = (\<diamond> t I. P (t + k))" and
  iT_Mult_iEx_conv: "(\<diamond> t I \<otimes> k. P t) = (\<diamond> t I. P (t * k))" and
  iT_Plus_neg_iEx_conv: "(\<diamond> t I \<oplus>- k. P t) = (\<diamond> t (I \<down>\<ge> k). P (t - k))" and
  iT_Minus_iEx_conv: "(\<diamond> t k \<ominus> I. P t) = (\<diamond> t (I \<down>\<le> k). P (k - t))" and
  iT_Div_iEx_conv: "(\<diamond> t I \<oslash> k. P t) = (\<diamond> t I. P (t div k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<diamond> t I \<oplus> k. P t) = (\<diamond> t I. P (t + k)) &&& (\<diamond> t I \<otimes> k. P t) = (\<diamond> t I. P (t * k))) &&& (\<diamond> t I \<oplus>- k. P t) = (\<diamond> t I \<down>\<ge> k. P (t - k)) &&& (\<diamond> t k \<ominus> I. P t) = (\<diamond> t I \<down>\<le> k. P (k - t)) &&& (\<diamond> t I \<oslash> k. P t) = (\<diamond> t I. P (t div k))
[PROOF STEP]
by (simp_all only: iEx_iAll_conv iT_arith_iAll_conv)


[STATEMENT]
lemma step_4_push_big_size_ok_3_aux: "\<lbrakk>
  4 \<le> remaining_steps (States dir big small);
  size_new small + remaining_steps (States dir big small) + 2 \<le> 3 * size_new big
\<rbrakk> \<Longrightarrow> size_new small + (remaining_steps (States dir big small) - 4) + 2 \<le> 3 * Suc (size_new big)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>4 \<le> remaining_steps (States dir big small); size_new small + remaining_steps (States dir big small) + 2 \<le> 3 * size_new big\<rbrakk> \<Longrightarrow> size_new small + (remaining_steps (States dir big small) - 4) + 2 \<le> 3 * Suc (size_new big)
[PROOF STEP]
using distrib_left dual_order.trans le_add_diff_inverse2
[PROOF STATE]
proof (prove)
using this:
?a * (?b + ?c) = ?a * ?b + ?a * ?c
\<lbrakk>?b \<le> ?a; ?c \<le> ?b\<rbrakk> \<Longrightarrow> ?c \<le> ?a
?b \<le> ?a \<Longrightarrow> ?a - ?b + ?b = ?a

goal (1 subgoal):
 1. \<lbrakk>4 \<le> remaining_steps (States dir big small); size_new small + remaining_steps (States dir big small) + 2 \<le> 3 * size_new big\<rbrakk> \<Longrightarrow> size_new small + (remaining_steps (States dir big small) - 4) + 2 \<le> 3 * Suc (size_new big)
[PROOF STEP]
by force


[STATEMENT]
lemma powr_ln_powr_upper_bound:
  "a > 1 \<Longrightarrow> a \<le> x \<Longrightarrow> x \<le> b \<Longrightarrow>
     max (a powr p) (b powr p) * max (ln a powr p') (ln b powr p') \<ge> x powr p * ln x powr p'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < a; a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> x powr p * ln x powr p' \<le> max (a powr p) (b powr p) * max (ln a powr p') (ln b powr p')
[PROOF STEP]
by (intro mult_mono powr_upper_bound) (auto intro: max.coboundedI1)


[STATEMENT]
lemma ccw_translate3_minus: "det3 0 a b \<noteq> 0 \<Longrightarrow> x < 1 \<Longrightarrow> ccw 0 a (b - x *\<^sub>R a) \<Longrightarrow> ccw 0 a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>det3 0 a b \<noteq> 0; x < 1; ccw 0 a (b - x *\<^sub>R a)\<rbrakk> \<Longrightarrow> ccw 0 a b
[PROOF STEP]
using ccw_translate3_aux[of a b x] ccw_scaleR1[of a "b - x *\<^sub>R a" "1-x" ]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>det3 0 a b \<noteq> 0; x < 1; ccw 0 (a - x *\<^sub>R a) (b - x *\<^sub>R a)\<rbrakk> \<Longrightarrow> ccw 0 a b
\<lbrakk>det3 0 a (b - x *\<^sub>R a) \<noteq> 0; 0 < 1 - x; ccw 0 a (b - x *\<^sub>R a)\<rbrakk> \<Longrightarrow> ccw 0 ((1 - x) *\<^sub>R a) (b - x *\<^sub>R a)

goal (1 subgoal):
 1. \<lbrakk>det3 0 a b \<noteq> 0; x < 1; ccw 0 a (b - x *\<^sub>R a)\<rbrakk> \<Longrightarrow> ccw 0 a b
[PROOF STEP]
by (auto simp add: algebra_simps)


[STATEMENT]
lemma independent_explicit:
  shows "independent B \<longleftrightarrow> finite B \<and> (\<forall>c. (\<Sum>v\<in>B. c v *s v) = 0 \<longrightarrow> (\<forall>v \<in> B. c v = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. independent B = (finite B \<and> (\<forall>c. (\<Sum>v\<in>B. c v *s v) = (0::'b) \<longrightarrow> (\<forall>v\<in>B. c v = (0::'a))))
[PROOF STEP]
using independent_bound_general
[PROOF STATE]
proof (prove)
using this:
independent ?S \<Longrightarrow> finite ?S \<and> card ?S \<le> dim ?S

goal (1 subgoal):
 1. independent B = (finite B \<and> (\<forall>c. (\<Sum>v\<in>B. c v *s v) = (0::'b) \<longrightarrow> (\<forall>v\<in>B. c v = (0::'a))))
[PROOF STEP]
by (fastforce simp: dependent_finite)


[STATEMENT]
lemma quat_norm_pow_2: "quat_of_real(norm q) ^ 2 = q * cnj q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (quat_of_real (norm q))\<^sup>2 = q * Quaternions.cnj q
[PROOF STEP]
by (simp add: quat_eq_iff norm_quat_def flip: of_real_power) (auto simp: power2_eq_square)


[STATEMENT]
lemma lm025:
  assumes "finite  (finestpart (snd pair))"
  shows "card (omega pair) = card (finestpart (snd pair))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (omega pair) = card (finestpart (snd pair))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (finestpart (snd pair))

goal (1 subgoal):
 1. card (omega pair) = card (finestpart (snd pair))
[PROOF STEP]
by force


[STATEMENT]
lemma ex_iter_fSucn: "(\<exists>m. iter (% x. flat (map subs x)) l m = []) = (if l = [] then True else (\<exists>n. (iter (% x. flat (map subs x)) ((% x. flat (map subs x)) l) n) = []))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>m. iter (\<lambda>x. flat (map subs x)) l m = []) = (if l = [] then True else \<exists>n. iter (\<lambda>x. flat (map subs x)) (flat (map subs l)) n = [])
[PROOF STEP]
using ex_iter[of "% x. x = []", of "(% x. flat (map subs x))" l ]
[PROOF STATE]
proof (prove)
using this:
(\<exists>n. iter (\<lambda>x. flat (map subs x)) l n = []) = (if l = [] then True else \<exists>n. iter (\<lambda>x. flat (map subs x)) (flat (map subs l)) n = [])

goal (1 subgoal):
 1. (\<exists>m. iter (\<lambda>x. flat (map subs x)) l m = []) = (if l = [] then True else \<exists>n. iter (\<lambda>x. flat (map subs x)) (flat (map subs l)) n = [])
[PROOF STEP]
apply(force)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in Idomain) idom_mult_cancel_l:"\<lbrakk>a \<in> carrier R;
      b \<in> carrier R; c \<in> carrier R; c \<noteq> \<zero>; c \<cdot>\<^sub>r a = c \<cdot>\<^sub>r b\<rbrakk> \<Longrightarrow> a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; c \<in> carrier R; c \<noteq> \<zero>; c \<cdot>\<^sub>r a = c \<cdot>\<^sub>r b\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
apply (simp add:ring_tOp_commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; c \<in> carrier R; c \<noteq> \<zero>; a \<cdot>\<^sub>r c = b \<cdot>\<^sub>r c\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
apply (simp add:idom_mult_cancel_r)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in CRR_market_viable) lbk_option_lgeom:
  shows "lbk_option T w = Max ((\<lambda>i. (lgeom_proc u d init (stake i w)))`{0 .. T}) - (lgeom_proc u d init (stake T w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lbk_option T w = (MAX i\<in>{0..T}. lgeom_proc u d init (stake i w)) - lgeom_proc u d init (stake T w)
[PROOF STEP]
using geom_lgeom stk_price geometric_process
[PROOF STATE]
proof (prove)
using this:
geom_rand_walk ?u ?d ?v ?n ?w = lgeom_proc ?u ?d ?v (stake ?n ?w)
prices Mkt stk = geom_proc
geom_proc = geom_rand_walk u d init

goal (1 subgoal):
 1. lbk_option T w = (MAX i\<in>{0..T}. lgeom_proc u d init (stake i w)) - lgeom_proc u d init (stake T w)
[PROOF STEP]
unfolding lbk_option_def
[PROOF STATE]
proof (prove)
using this:
geom_rand_walk ?u ?d ?v ?n ?w = lgeom_proc ?u ?d ?v (stake ?n ?w)
prices Mkt stk = geom_proc
geom_proc = geom_rand_walk u d init

goal (1 subgoal):
 1. (MAX i\<in>{0..T}. prices Mkt stk i w) - prices Mkt stk T w = (MAX i\<in>{0..T}. lgeom_proc u d init (stake i w)) - lgeom_proc u d init (stake T w)
[PROOF STEP]
by simp


[STATEMENT]
lemma ordinal_oLog_self: "oSuc 0 < b \<Longrightarrow> oLog b b = oSuc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. oSuc 0 < b \<Longrightarrow> oLog b b = oSuc 0
[PROOF STEP]
apply (subgoal_tac "oLog b (b ** oSuc 0) = oSuc 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>oSuc 0 < b; oLog b (b ** oSuc 0) = oSuc 0\<rbrakk> \<Longrightarrow> oLog b b = oSuc 0
 2. oSuc 0 < b \<Longrightarrow> oLog b (b ** oSuc 0) = oSuc 0
[PROOF STEP]
apply (simp only: ordinal_exp_1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. oSuc 0 < b \<Longrightarrow> oLog b (b ** oSuc 0) = oSuc 0
[PROOF STEP]
apply (simp only: ordinal_oLog_exp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in aGroup) nsum_zeroTr:
  "\<And> n. (\<forall> i. i \<le> n \<longrightarrow>  f i = \<zero>) \<longrightarrow> (nsum A f n = \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (\<forall>i\<le>n. f i = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f n = \<zero>
[PROOF STEP]
apply (induct_tac "n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. (\<forall>i\<le>0. f i = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f 0 = \<zero>
 2. \<And>n na. (\<forall>i\<le>na. f i = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f na = \<zero> \<Longrightarrow> (\<forall>i\<le>Suc na. f i = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f Suc na = \<zero>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. (\<forall>i\<le>na. f i = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f na = \<zero> \<Longrightarrow> (\<forall>i\<le>Suc na. f i = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f Suc na = \<zero>
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>(\<forall>i\<le>na. f i = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f na = \<zero>; \<forall>i\<le>Suc na. f i = \<zero>\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A f Suc na = \<zero>
[PROOF STEP]
apply (cut_tac n = na in Nsetn_sub_mem1, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>\<Sigma>\<^sub>e A f na = \<zero>; \<forall>i\<le>Suc na. f i = \<zero>\<rbrakk> \<Longrightarrow> \<zero> \<plusminus> \<zero> = \<zero>
[PROOF STEP]
apply (subst aGroup.ag_l_zero, rule aGroup_axioms)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>na. \<lbrakk>\<Sigma>\<^sub>e A f na = \<zero>; \<forall>i\<le>Suc na. f i = \<zero>\<rbrakk> \<Longrightarrow> \<zero> \<in> carrier A
 2. \<And>na. \<lbrakk>\<Sigma>\<^sub>e A f na = \<zero>; \<forall>i\<le>Suc na. f i = \<zero>\<rbrakk> \<Longrightarrow> \<zero> = \<zero>
[PROOF STEP]
apply (simp add:ag_inc_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>\<Sigma>\<^sub>e A f na = \<zero>; \<forall>i\<le>Suc na. f i = \<zero>\<rbrakk> \<Longrightarrow> \<zero> = \<zero>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma rank_invertible_subset_cols:
  fixes A:: "'a mat"
  fixes B:: "'a vec list"
  assumes inv: "invertible_mat A"
  assumes A_square: "A \<in> carrier_mat n n"
  assumes set_sub: "set (B) \<subseteq> set (cols A)"
  assumes dist_B: "distinct B"
  shows "rank (mat_of_cols n B) = length B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (mat_of_cols n B) = length B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank (mat_of_cols n B) = length B
[PROOF STEP]
let ?B_mat = "(mat_of_cols n B)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank (mat_of_cols n B) = length B
[PROOF STEP]
have h1: "lin_indpt (set(B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_indpt (set B)
[PROOF STEP]
using assms lin_indpt_subset_cols[of A]
[PROOF STATE]
proof (prove)
using this:
invertible_mat A
A \<in> carrier_mat n n
set B \<subseteq> set (cols A)
distinct B
\<lbrakk>A \<in> carrier_mat n n; invertible_mat A; ?B \<subseteq> set (cols A)\<rbrakk> \<Longrightarrow> lin_indpt ?B

goal (1 subgoal):
 1. lin_indpt (set B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lin_indpt (set B)

goal (1 subgoal):
 1. rank (mat_of_cols n B) = length B
[PROOF STEP]
have "set B \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set B \<subseteq> carrier_vec n
[PROOF STEP]
using set_sub A_square cols_dim[of A]
[PROOF STATE]
proof (prove)
using this:
set B \<subseteq> set (cols A)
A \<in> carrier_mat n n
set (cols A) \<subseteq> carrier_vec (dim_row A)

goal (1 subgoal):
 1. set B \<subseteq> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set B \<subseteq> carrier_vec n

goal (1 subgoal):
 1. rank (mat_of_cols n B) = length B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set B \<subseteq> carrier_vec n
[PROOF STEP]
have cols_B: "cols (mat_of_cols n B) = B"
[PROOF STATE]
proof (prove)
using this:
set B \<subseteq> carrier_vec n

goal (1 subgoal):
 1. cols (mat_of_cols n B) = B
[PROOF STEP]
using cols_mat_of_cols
[PROOF STATE]
proof (prove)
using this:
set B \<subseteq> carrier_vec n
set ?vs \<subseteq> carrier_vec ?n \<Longrightarrow> cols (mat_of_cols ?n ?vs) = ?vs

goal (1 subgoal):
 1. cols (mat_of_cols n B) = B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cols (mat_of_cols n B) = B

goal (1 subgoal):
 1. rank (mat_of_cols n B) = length B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cols (mat_of_cols n B) = B
[PROOF STEP]
have "maximal (set B) (\<lambda>T. T \<subseteq> set (B) \<and> lin_indpt T)"
[PROOF STATE]
proof (prove)
using this:
cols (mat_of_cols n B) = B

goal (1 subgoal):
 1. maximal (set B) (\<lambda>T. T \<subseteq> set B \<and> lin_indpt T)
[PROOF STEP]
using h1
[PROOF STATE]
proof (prove)
using this:
cols (mat_of_cols n B) = B
lin_indpt (set B)

goal (1 subgoal):
 1. maximal (set B) (\<lambda>T. T \<subseteq> set B \<and> lin_indpt T)
[PROOF STEP]
by (simp add: maximal_def subset_antisym)
[PROOF STATE]
proof (state)
this:
maximal (set B) (\<lambda>T. T \<subseteq> set B \<and> lin_indpt T)

goal (1 subgoal):
 1. rank (mat_of_cols n B) = length B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
maximal (set B) (\<lambda>T. T \<subseteq> set B \<and> lin_indpt T)
[PROOF STEP]
have h2: "maximal (set B) (\<lambda>T. T \<subseteq> set (cols (mat_of_cols n B)) \<and> lin_indpt T)"
[PROOF STATE]
proof (prove)
using this:
maximal (set B) (\<lambda>T. T \<subseteq> set B \<and> lin_indpt T)

goal (1 subgoal):
 1. maximal (set B) (\<lambda>T. T \<subseteq> set (cols (mat_of_cols n B)) \<and> lin_indpt T)
[PROOF STEP]
using cols_B
[PROOF STATE]
proof (prove)
using this:
maximal (set B) (\<lambda>T. T \<subseteq> set B \<and> lin_indpt T)
cols (mat_of_cols n B) = B

goal (1 subgoal):
 1. maximal (set B) (\<lambda>T. T \<subseteq> set (cols (mat_of_cols n B)) \<and> lin_indpt T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
maximal (set B) (\<lambda>T. T \<subseteq> set (cols (mat_of_cols n B)) \<and> lin_indpt T)

goal (1 subgoal):
 1. rank (mat_of_cols n B) = length B
[PROOF STEP]
have h3: "rank (mat_of_cols n B) = card (set B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (mat_of_cols n B) = card (set B)
[PROOF STEP]
using h1 h2 rank_card_indpt[of ?B_mat]
[PROOF STATE]
proof (prove)
using this:
lin_indpt (set B)
maximal (set B) (\<lambda>T. T \<subseteq> set (cols (mat_of_cols n B)) \<and> lin_indpt T)
\<lbrakk>mat_of_cols n B \<in> carrier_mat n ?nc; maximal ?S (\<lambda>T. T \<subseteq> set (cols (mat_of_cols n B)) \<and> lin_indpt T)\<rbrakk> \<Longrightarrow> rank (mat_of_cols n B) = card ?S

goal (1 subgoal):
 1. rank (mat_of_cols n B) = card (set B)
[PROOF STEP]
using mat_of_cols_carrier(1)
[PROOF STATE]
proof (prove)
using this:
lin_indpt (set B)
maximal (set B) (\<lambda>T. T \<subseteq> set (cols (mat_of_cols n B)) \<and> lin_indpt T)
\<lbrakk>mat_of_cols n B \<in> carrier_mat n ?nc; maximal ?S (\<lambda>T. T \<subseteq> set (cols (mat_of_cols n B)) \<and> lin_indpt T)\<rbrakk> \<Longrightarrow> rank (mat_of_cols n B) = card ?S
mat_of_cols ?n ?vs \<in> carrier_mat ?n (length ?vs)

goal (1 subgoal):
 1. rank (mat_of_cols n B) = card (set B)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
rank (mat_of_cols n B) = card (set B)

goal (1 subgoal):
 1. rank (mat_of_cols n B) = length B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rank (mat_of_cols n B) = card (set B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rank (mat_of_cols n B) = card (set B)

goal (1 subgoal):
 1. rank (mat_of_cols n B) = length B
[PROOF STEP]
using assms distinct_card
[PROOF STATE]
proof (prove)
using this:
rank (mat_of_cols n B) = card (set B)
invertible_mat A
A \<in> carrier_mat n n
set B \<subseteq> set (cols A)
distinct B
distinct ?xs \<Longrightarrow> card (set ?xs) = length ?xs

goal (1 subgoal):
 1. rank (mat_of_cols n B) = length B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rank (mat_of_cols n B) = length B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma artanh_real_at_left_1:
  "filterlim (artanh :: real \<Rightarrow> real) at_top (at_left 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim artanh at_top (at_left 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filterlim artanh at_top (at_left 1)
[PROOF STEP]
have *: "filterlim (\<lambda>x::real. (1 + x) / (1 - x)) at_top (at_left 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_left 1. (1 + x) / (1 - x) :> at_top
[PROOF STEP]
by (rule LIM_at_top_divide)
       (auto intro!: tendsto_eq_intros eventually_mono[OF eventually_at_left_real[of 0]])
[PROOF STATE]
proof (state)
this:
LIM x at_left 1. (1 + x) / (1 - x) :> at_top

goal (1 subgoal):
 1. filterlim artanh at_top (at_left 1)
[PROOF STEP]
have "filterlim (\<lambda>x::real. (1/2) * ln ((1 + x) / (1 - x))) at_top (at_left 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_left 1. 1 / 2 * ln ((1 + x) / (1 - x)) :> at_top
[PROOF STEP]
by (intro filterlim_tendsto_pos_mult_at_top[OF tendsto_const] *
                 filterlim_compose[OF ln_at_top]) auto
[PROOF STATE]
proof (state)
this:
LIM x at_left 1. 1 / 2 * ln ((1 + x) / (1 - x)) :> at_top

goal (1 subgoal):
 1. filterlim artanh at_top (at_left 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LIM x at_left 1. 1 / 2 * ln ((1 + x) / (1 - x)) :> at_top

goal (1 subgoal):
 1. filterlim artanh at_top (at_left 1)
[PROOF STEP]
have "(\<lambda>x::real. (1/2) * ln ((1 + x) / (1 - x))) = artanh"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. 1 / 2 * ln ((1 + x) / (1 - x))) = artanh
[PROOF STEP]
by (simp add: artanh_def [abs_def])
[PROOF STATE]
proof (state)
this:
(\<lambda>x. 1 / 2 * ln ((1 + x) / (1 - x))) = artanh

goal (1 subgoal):
 1. filterlim artanh at_top (at_left 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
filterlim artanh at_top (at_left 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
filterlim artanh at_top (at_left 1)

goal (1 subgoal):
 1. filterlim artanh at_top (at_left 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
filterlim artanh at_top (at_left 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_divide_smallo:
  assumes "((\<lambda>x. f1 x / g1 x) \<longlongrightarrow> a) F"
  assumes "f2 \<in> o[F](f1)" "g2 \<in> o[F](g1)"
  assumes "eventually (\<lambda>x. g1 x \<noteq> 0) F"
  shows   "((\<lambda>x. (f1 x + f2 x) / (g1 x + g2 x)) \<longlongrightarrow> a) F" (is "(?f \<longlongrightarrow> _) _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (f1 x + f2 x) / (g1 x + g2 x)) \<longlongrightarrow> a) F
[PROOF STEP]
proof (subst tendsto_cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in F. (f1 x + f2 x) / (g1 x + g2 x) = ?g x
 2. (?g \<longlongrightarrow> a) F
[PROOF STEP]
let ?f' = "\<lambda>x. (f1 x / g1 x) * (1 + f2 x / f1 x) / (1 + g2 x / g1 x)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in F. (f1 x + f2 x) / (g1 x + g2 x) = ?g x
 2. (?g \<longlongrightarrow> a) F
[PROOF STEP]
have "(?f' \<longlongrightarrow> a * (1 + 0) / (1 + 0)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)) \<longlongrightarrow> a * ((1::'b) + (0::'b)) / ((1::'b) + (0::'b))) F
[PROOF STEP]
by (rule tendsto_mult tendsto_divide tendsto_add assms tendsto_const
        smalloD_tendsto[OF assms(2)] smalloD_tendsto[OF assms(3)])+ simp_all
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)) \<longlongrightarrow> a * ((1::'b) + (0::'b)) / ((1::'b) + (0::'b))) F

goal (2 subgoals):
 1. \<forall>\<^sub>F x in F. (f1 x + f2 x) / (g1 x + g2 x) = ?g x
 2. (?g \<longlongrightarrow> a) F
[PROOF STEP]
thus "(?f' \<longlongrightarrow> a) F"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)) \<longlongrightarrow> a * ((1::'b) + (0::'b)) / ((1::'b) + (0::'b))) F

goal (1 subgoal):
 1. ((\<lambda>x. f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)) \<longlongrightarrow> a) F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)) \<longlongrightarrow> a) F

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
have "(1/2::real) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < 1 / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
from landau_o.smallD[OF assms(2) this] landau_o.smallD[OF assms(3) this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. norm (f2 x) \<le> 1 / 2 * norm (f1 x)
\<forall>\<^sub>F x in F. norm (g2 x) \<le> 1 / 2 * norm (g1 x)
[PROOF STEP]
have "eventually (\<lambda>x. norm (f2 x) \<le> norm (f1 x)/2) F"
         "eventually (\<lambda>x. norm (g2 x) \<le> norm (g1 x)/2) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. norm (f2 x) \<le> 1 / 2 * norm (f1 x)
\<forall>\<^sub>F x in F. norm (g2 x) \<le> 1 / 2 * norm (g1 x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. norm (f2 x) \<le> norm (f1 x) / 2 &&& \<forall>\<^sub>F x in F. norm (g2 x) \<le> norm (g1 x) / 2
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. norm (f2 x) \<le> norm (f1 x) / 2
\<forall>\<^sub>F x in F. norm (g2 x) \<le> norm (g1 x) / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
with assms(4)
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. g1 x \<noteq> (0::'b)
\<forall>\<^sub>F x in F. norm (f2 x) \<le> norm (f1 x) / 2
\<forall>\<^sub>F x in F. norm (g2 x) \<le> norm (g1 x) / 2
[PROOF STEP]
show "eventually (\<lambda>x. ?f x = ?f' x) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. g1 x \<noteq> (0::'b)
\<forall>\<^sub>F x in F. norm (f2 x) \<le> norm (f1 x) / 2
\<forall>\<^sub>F x in F. norm (g2 x) \<le> norm (g1 x) / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>g1 x \<noteq> (0::'b); norm (f2 x) \<le> norm (f1 x) / 2; norm (g2 x) \<le> norm (g1 x) / 2\<rbrakk> \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>g1 x \<noteq> (0::'b); norm (f2 x) \<le> norm (f1 x) / 2; norm (g2 x) \<le> norm (g1 x) / 2\<rbrakk> \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
assume A: "norm (f2 x) \<le> norm (f1 x)/2" and
                 B: "norm (g2 x) \<le> norm (g1 x)/2" and C: "g1 x \<noteq> 0"
[PROOF STATE]
proof (state)
this:
norm (f2 x) \<le> norm (f1 x) / 2
norm (g2 x) \<le> norm (g1 x) / 2
g1 x \<noteq> (0::'b)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>g1 x \<noteq> (0::'b); norm (f2 x) \<le> norm (f1 x) / 2; norm (g2 x) \<le> norm (g1 x) / 2\<rbrakk> \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
show "?f x = ?f' x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
proof (cases "f1 x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f1 x = (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
 2. f1 x \<noteq> (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
assume D: "f1 x \<noteq> 0"
[PROOF STATE]
proof (state)
this:
f1 x \<noteq> (0::'b)

goal (2 subgoals):
 1. f1 x = (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
 2. f1 x \<noteq> (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
from D
[PROOF STATE]
proof (chain)
picking this:
f1 x \<noteq> (0::'b)
[PROOF STEP]
have "f1 x + f2 x = f1 x * (1 + f2 x/f1 x)"
[PROOF STATE]
proof (prove)
using this:
f1 x \<noteq> (0::'b)

goal (1 subgoal):
 1. f1 x + f2 x = f1 x * ((1::'b) + f2 x / f1 x)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
f1 x + f2 x = f1 x * ((1::'b) + f2 x / f1 x)

goal (2 subgoals):
 1. f1 x = (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
 2. f1 x \<noteq> (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f1 x + f2 x = f1 x * ((1::'b) + f2 x / f1 x)

goal (2 subgoals):
 1. f1 x = (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
 2. f1 x \<noteq> (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
from C
[PROOF STATE]
proof (chain)
picking this:
g1 x \<noteq> (0::'b)
[PROOF STEP]
have "g1 x + g2 x = g1 x * (1 + g2 x/g1 x)"
[PROOF STATE]
proof (prove)
using this:
g1 x \<noteq> (0::'b)

goal (1 subgoal):
 1. g1 x + g2 x = g1 x * ((1::'b) + g2 x / g1 x)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
g1 x + g2 x = g1 x * ((1::'b) + g2 x / g1 x)

goal (2 subgoals):
 1. f1 x = (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
 2. f1 x \<noteq> (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f1 x + f2 x = f1 x * ((1::'b) + f2 x / f1 x)
g1 x + g2 x = g1 x * ((1::'b) + g2 x / g1 x)
[PROOF STEP]
have "?f x = (f1 x * (1 + f2 x/f1 x)) / (g1 x * (1 + g2 x/g1 x))"
[PROOF STATE]
proof (prove)
using this:
f1 x + f2 x = f1 x * ((1::'b) + f2 x / f1 x)
g1 x + g2 x = g1 x * ((1::'b) + g2 x / g1 x)

goal (1 subgoal):
 1. (f1 x + f2 x) / (g1 x + g2 x) = f1 x * ((1::'b) + f2 x / f1 x) / (g1 x * ((1::'b) + g2 x / g1 x))
[PROOF STEP]
by (simp only:)
[PROOF STATE]
proof (state)
this:
(f1 x + f2 x) / (g1 x + g2 x) = f1 x * ((1::'b) + f2 x / f1 x) / (g1 x * ((1::'b) + g2 x / g1 x))

goal (2 subgoals):
 1. f1 x = (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
 2. f1 x \<noteq> (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(f1 x + f2 x) / (g1 x + g2 x) = f1 x * ((1::'b) + f2 x / f1 x) / (g1 x * ((1::'b) + g2 x / g1 x))

goal (2 subgoals):
 1. f1 x = (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
 2. f1 x \<noteq> (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
have "... = ?f' x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f1 x * ((1::'b) + f2 x / f1 x) / (g1 x * ((1::'b) + g2 x / g1 x)) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f1 x * ((1::'b) + f2 x / f1 x) / (g1 x * ((1::'b) + g2 x / g1 x)) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)

goal (2 subgoals):
 1. f1 x = (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
 2. f1 x \<noteq> (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)

goal (1 subgoal):
 1. (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)

goal (1 subgoal):
 1. f1 x = (0::'b) \<Longrightarrow> (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)
[PROOF STEP]
qed (insert A, simp)
[PROOF STATE]
proof (state)
this:
(f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. (f1 x + f2 x) / (g1 x + g2 x) = f1 x / g1 x * ((1::'b) + f2 x / f1 x) / ((1::'b) + g2 x / g1 x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tranclp_imp_eq_image: "(\<forall>x y. R x y \<longrightarrow> f x = f y) \<Longrightarrow> R\<^sup>+\<^sup>+ x y \<Longrightarrow> f x = f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x y. R x y \<longrightarrow> f x = f y; R\<^sup>+\<^sup>+ x y\<rbrakk> \<Longrightarrow> f x = f y
[PROOF STEP]
by (erule tranclp.induct) auto


[STATEMENT]
theorem mset_merge_sort [simp]: "mset (merge_sort xs) = mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (merge_sort xs) = mset xs
[PROOF STEP]
by (induction xs rule: merge_sort.induct)
     (subst merge_sort.simps, auto simp flip: mset_append)


[STATEMENT]
lemma suffix_plus: "\<sigma> |\<^sub>s n |\<^sub>s m = \<sigma> |\<^sub>s (m + n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<sigma> |\<^sub>s n |\<^sub>s m = \<sigma> |\<^sub>s m + n
[PROOF STEP]
unfolding suffix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>j. \<sigma> (j + m + n)) = (\<lambda>j. \<sigma> (j + (m + n)))
[PROOF STEP]
by (simp add: add.assoc)


[STATEMENT]
lemma star_trans_eq [simp]: "x\<^sup>\<star> \<cdot> x\<^sup>\<star> = x\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<star> \<cdot> x\<^sup>\<star> = x\<^sup>\<star>
[PROOF STEP]
proof (rule order.antisym) \<comment> \<open>this splits an equation into two inequalities\<close>
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x\<^sup>\<star> \<cdot> x\<^sup>\<star> \<le> x\<^sup>\<star>
 2. x\<^sup>\<star> \<le> x\<^sup>\<star> \<cdot> x\<^sup>\<star>
[PROOF STEP]
have "x\<^sup>\<star> + x \<cdot> x\<^sup>\<star> \<le> x\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<star> + x \<cdot> x\<^sup>\<star> \<le> x\<^sup>\<star>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x\<^sup>\<star> + x \<cdot> x\<^sup>\<star> \<le> x\<^sup>\<star>

goal (2 subgoals):
 1. x\<^sup>\<star> \<cdot> x\<^sup>\<star> \<le> x\<^sup>\<star>
 2. x\<^sup>\<star> \<le> x\<^sup>\<star> \<cdot> x\<^sup>\<star>
[PROOF STEP]
thus "x\<^sup>\<star> \<cdot> x\<^sup>\<star> \<le> x\<^sup>\<star>"
[PROOF STATE]
proof (prove)
using this:
x\<^sup>\<star> + x \<cdot> x\<^sup>\<star> \<le> x\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> \<cdot> x\<^sup>\<star> \<le> x\<^sup>\<star>
[PROOF STEP]
by (simp add: star_inductl)
[PROOF STATE]
proof (state)
this:
x\<^sup>\<star> \<cdot> x\<^sup>\<star> \<le> x\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> \<le> x\<^sup>\<star> \<cdot> x\<^sup>\<star>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x\<^sup>\<star> \<le> x\<^sup>\<star> \<cdot> x\<^sup>\<star>
[PROOF STEP]
show "x\<^sup>\<star> \<le> x\<^sup>\<star> \<cdot> x\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<star> \<le> x\<^sup>\<star> \<cdot> x\<^sup>\<star>
[PROOF STEP]
using mult_isor star_ref
[PROOF STATE]
proof (prove)
using this:
?x \<le> ?y \<Longrightarrow> ?x \<cdot> ?z \<le> ?y \<cdot> ?z
(1::'a) \<le> ?x\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> \<le> x\<^sup>\<star> \<cdot> x\<^sup>\<star>
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x\<^sup>\<star> \<le> x\<^sup>\<star> \<cdot> x\<^sup>\<star>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complement_path_component_Union:
  fixes x :: "'a :: topological_space"
  shows "S - path_component_set S x =
         \<Union>({path_component_set S y| y. y \<in> S} - {path_component_set S x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - path_component_set S x = \<Union> ({path_component_set S y |y. y \<in> S} - {path_component_set S x})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S - path_component_set S x = \<Union> ({path_component_set S y |y. y \<in> S} - {path_component_set S x})
[PROOF STEP]
have *: "(\<And>x. x \<in> S - {a} \<Longrightarrow> disjnt a x) \<Longrightarrow> \<Union>S - a = \<Union>(S - {a})"
    for a::"'a set" and S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> S - {a} \<Longrightarrow> disjnt a x) \<Longrightarrow> \<Union> S - a = \<Union> (S - {a})
[PROOF STEP]
by (auto simp: disjnt_def)
[PROOF STATE]
proof (state)
this:
(\<And>x. x \<in> ?S - {?a} \<Longrightarrow> disjnt ?a x) \<Longrightarrow> \<Union> ?S - ?a = \<Union> (?S - {?a})

goal (1 subgoal):
 1. S - path_component_set S x = \<Union> ({path_component_set S y |y. y \<in> S} - {path_component_set S x})
[PROOF STEP]
have "\<And>y. y \<in> {path_component_set S x |x. x \<in> S} - {path_component_set S x}
            \<Longrightarrow> disjnt (path_component_set S x) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. y \<in> {path_component_set S x |x. x \<in> S} - {path_component_set S x} \<Longrightarrow> disjnt (path_component_set S x) y
[PROOF STEP]
using path_component_disjoint path_component_eq
[PROOF STATE]
proof (prove)
using this:
disjnt (path_component_set ?S ?a) (path_component_set ?S ?b) = (?a \<notin> path_component_set ?S ?b)
?y \<in> path_component_set ?S ?x \<Longrightarrow> path_component_set ?S ?y = path_component_set ?S ?x

goal (1 subgoal):
 1. \<And>y. y \<in> {path_component_set S x |x. x \<in> S} - {path_component_set S x} \<Longrightarrow> disjnt (path_component_set S x) y
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
?y \<in> {path_component_set S x |x. x \<in> S} - {path_component_set S x} \<Longrightarrow> disjnt (path_component_set S x) ?y

goal (1 subgoal):
 1. S - path_component_set S x = \<Union> ({path_component_set S y |y. y \<in> S} - {path_component_set S x})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?y \<in> {path_component_set S x |x. x \<in> S} - {path_component_set S x} \<Longrightarrow> disjnt (path_component_set S x) ?y
[PROOF STEP]
have "\<Union>{path_component_set S x |x. x \<in> S} - path_component_set S x =
             \<Union>({path_component_set S y |y. y \<in> S} - {path_component_set S x})"
[PROOF STATE]
proof (prove)
using this:
?y \<in> {path_component_set S x |x. x \<in> S} - {path_component_set S x} \<Longrightarrow> disjnt (path_component_set S x) ?y

goal (1 subgoal):
 1. \<Union> {path_component_set S x |x. x \<in> S} - path_component_set S x = \<Union> ({path_component_set S y |y. y \<in> S} - {path_component_set S x})
[PROOF STEP]
by (meson *)
[PROOF STATE]
proof (state)
this:
\<Union> {path_component_set S x |x. x \<in> S} - path_component_set S x = \<Union> ({path_component_set S y |y. y \<in> S} - {path_component_set S x})

goal (1 subgoal):
 1. S - path_component_set S x = \<Union> ({path_component_set S y |y. y \<in> S} - {path_component_set S x})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<Union> {path_component_set S x |x. x \<in> S} - path_component_set S x = \<Union> ({path_component_set S y |y. y \<in> S} - {path_component_set S x})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Union> {path_component_set S x |x. x \<in> S} - path_component_set S x = \<Union> ({path_component_set S y |y. y \<in> S} - {path_component_set S x})

goal (1 subgoal):
 1. S - path_component_set S x = \<Union> ({path_component_set S y |y. y \<in> S} - {path_component_set S x})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
S - path_component_set S x = \<Union> ({path_component_set S y |y. y \<in> S} - {path_component_set S x})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma top_weak_eq:  "\<lbrakk> t \<in> carrier L; \<And> x. x \<in> carrier L \<Longrightarrow> x \<sqsubseteq> t \<rbrakk> \<Longrightarrow> t .= \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t \<in> carrier L; \<And>x. x \<in> carrier L \<Longrightarrow> x \<sqsubseteq> t\<rbrakk> \<Longrightarrow> t .= \<top>
[PROOF STEP]
by (metis top_closed top_higher weak_le_antisym)


[STATEMENT]
lemma bezout_coefficients_0:
  "bezout_coefficients a 0 = (1 div unit_factor a, 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bezout_coefficients a (0::'a) = ((1::'a) div unit_factor a, 0::'a)
[PROOF STEP]
by (simp add: bezout_coefficients_def euclid_ext_aux.simps)


[STATEMENT]
lemma card_partitions_count_partitions:
  "card {p. p partitions n} = card {N. count N partitions n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {p. p partitions n} = card {N. count N partitions n}
[PROOF STEP]
using bij_betw_same_card partitions_bij_betw_count
[PROOF STATE]
proof (prove)
using this:
bij_betw ?f ?A ?B \<Longrightarrow> card ?A = card ?B
bij_betw count {N. count N partitions ?n} {p. p partitions ?n}

goal (1 subgoal):
 1. card {p. p partitions n} = card {N. count N partitions n}
[PROOF STEP]
by metis


[STATEMENT]
lemma vconverse_mono[simp]:
  assumes "vbrelation r" and "vbrelation s"
  shows "r\<inverse>\<^sub>\<circ> \<subseteq>\<^sub>\<circ> s\<inverse>\<^sub>\<circ> \<longleftrightarrow> r \<subseteq>\<^sub>\<circ> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r\<inverse>\<^sub>\<circ> \<subseteq>\<^sub>\<circ> s\<inverse>\<^sub>\<circ>) = (r \<subseteq>\<^sub>\<circ> s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
vbrelation r
vbrelation s

goal (1 subgoal):
 1. (r\<inverse>\<^sub>\<circ> \<subseteq>\<^sub>\<circ> s\<inverse>\<^sub>\<circ>) = (r \<subseteq>\<^sub>\<circ> s)
[PROOF STEP]
by (force intro: vconverse_vunion)+


[STATEMENT]
lemma linear_inj_on_left_inverse:
  assumes lf: "linear s1 s2 f"
  assumes fi: "inj_on f (vs1.span S)"
  shows "\<exists>g. range g \<subseteq> vs1.span S \<and> linear s2 s1 g \<and> (\<forall>x\<in>vs1.span S. g (f x) = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. range g \<subseteq> vs1.span S \<and> linear (*b) (*a) g \<and> (\<forall>x\<in>vs1.span S. g (f x) = x)
[PROOF STEP]
using linear_exists_left_inverse_on[OF lf vs1.subspace_span fi]
[PROOF STATE]
proof (prove)
using this:
\<exists>g. range g \<subseteq> vs1.span S \<and> linear (*b) (*a) g \<and> (\<forall>v\<in>vs1.span S. g (f v) = v)

goal (1 subgoal):
 1. \<exists>g. range g \<subseteq> vs1.span S \<and> linear (*b) (*a) g \<and> (\<forall>x\<in>vs1.span S. g (f x) = x)
[PROOF STEP]
by (auto simp: linear_iff_module_hom)


[STATEMENT]
lemma card_of_Un_ordLess_infinite[simp]:
assumes INF: "\<not>finite C" and
        LESS1: "|A| <o |C|" and LESS2: "|B| <o |C|"
shows "|A \<union> B| <o |C|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A \<union> B| <o |C|
[PROOF STEP]
using assms card_of_Plus_ordLess_infinite card_of_Un_Plus_ordLeq
      ordLeq_ordLess_trans
[PROOF STATE]
proof (prove)
using this:
infinite C
|A| <o |C|
|B| <o |C|
\<lbrakk>infinite ?C; |?A| <o |?C|; |?B| <o |?C|\<rbrakk> \<Longrightarrow> |?A <+> ?B| <o |?C|
|?A \<union> ?B| \<le>o |?A <+> ?B|
\<lbrakk>?r \<le>o ?r'; ?r' <o ?r''\<rbrakk> \<Longrightarrow> ?r <o ?r''

goal (1 subgoal):
 1. |A \<union> B| <o |C|
[PROOF STEP]
by blast


[STATEMENT]
lemma
  fixes a b :: real
  assumes "a > 1" "b > 1" "a \<noteq> b"
  shows   "((\<lambda>x. ((a powr x - x * ln a) / (b powr x - x * ln b)) powr (1/x^3)) \<longlongrightarrow> 1) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. ((a powr x - x * ln a) / (b powr x - x * ln b)) powr (1 / x ^ 3)) \<longlongrightarrow> 1) at_top
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < a
1 < b
a \<noteq> b

goal (1 subgoal):
 1. ((\<lambda>x. ((a powr x - x * ln a) / (b powr x - x * ln b)) powr (1 / x ^ 3)) \<longlongrightarrow> 1) at_top
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma iMODb_minus: "
  \<lbrakk> x \<in> [r, mod m, c]; k \<le> x - r \<rbrakk> \<Longrightarrow>
  (x - k \<in> [r, mod m, c]) = (k mod m = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> [ r, mod m, c ]; k \<le> x - r\<rbrakk> \<Longrightarrow> (x - k \<in> [ r, mod m, c ]) = (k mod m = 0)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> [ r, mod m, c ]; k \<le> x - r; x - k \<in> [ r, mod m, c ]\<rbrakk> \<Longrightarrow> k mod m = 0
 2. \<lbrakk>x \<in> [ r, mod m, c ]; k \<le> x - r; k mod m = 0\<rbrakk> \<Longrightarrow> x - k \<in> [ r, mod m, c ]
[PROOF STEP]
apply (simp add: iMODb_iMOD_iTILL_conv iMOD_minus)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> [ r, mod m, c ]; k \<le> x - r; k mod m = 0\<rbrakk> \<Longrightarrow> x - k \<in> [ r, mod m, c ]
[PROOF STEP]
apply (simp add: iMODb_iMOD_iTILL_conv iMOD_minus iTILL_minus)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "(-x < (0::real)) = (0 < x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- x < 0) = (0 < x)
[PROOF STEP]
by arith


[STATEMENT]
lemma inorder_ins: "sorted(inorder t) \<Longrightarrow>
  (ins n d x t = Same \<longrightarrow> ins_list x (inorder t) = inorder t) \<and>
  (ins n d x t = Bal t' \<longrightarrow> ins_list x (inorder t) = inorder t') \<and>
  (ins n d x t = Unbal t' \<longrightarrow> ins_list x (inorder t) = inorder t')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (inorder t) \<Longrightarrow> (ins n d x t = Same \<longrightarrow> ins_list x (inorder t) = inorder t) \<and> (ins n d x t = Bal t' \<longrightarrow> ins_list x (inorder t) = inorder t') \<and> (ins n d x t = Unbal t' \<longrightarrow> ins_list x (inorder t) = inorder t')
[PROOF STEP]
by(induction t arbitrary: d t')
  (auto simp: ins_list_simps bal.simps[of "Suc 0"] bal.simps[of 0]
        split!: if_splits prod.splits up.splits)