[STATEMENT]
theorem bord_array: assumes "Suc k \<le> \<^bold>|w\<^bold>|" shows "(border_array w)!k = \<^bold>|max_border (take (Suc k) w)\<^bold>|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|
[PROOF STEP]
define m where "m = \<^bold>|w\<^bold>| - Suc k"
[PROOF STATE]
proof (state)
this:
m = \<^bold>|w\<^bold>| - Suc k

goal (1 subgoal):
 1. border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|
[PROOF STEP]
hence "m < \<^bold>|rev w\<^bold>|"
[PROOF STATE]
proof (prove)
using this:
m = \<^bold>|w\<^bold>| - Suc k

goal (1 subgoal):
 1. m < \<^bold>|rev w\<^bold>|
[PROOF STEP]
by (simp add: Suc_diff_Suc assms less_eq_Suc_le)
[PROOF STATE]
proof (state)
this:
m < \<^bold>|rev w\<^bold>|

goal (1 subgoal):
 1. border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|
[PROOF STEP]
have "rev w \<noteq> \<epsilon>" and "k < \<^bold>|rev w\<^bold>|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev w \<noteq> \<epsilon> &&& k < \<^bold>|rev w\<^bold>|
[PROOF STEP]
using \<open>Suc k \<le> \<^bold>|w\<^bold>|\<close>
[PROOF STATE]
proof (prove)
using this:
Suc k \<le> \<^bold>|w\<^bold>|

goal (1 subgoal):
 1. rev w \<noteq> \<epsilon> &&& k < \<^bold>|rev w\<^bold>|
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rev w \<noteq> \<epsilon>
k < \<^bold>|rev w\<^bold>|

goal (1 subgoal):
 1. border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|
[PROOF STEP]
hence "w = hd w#tl w"
[PROOF STATE]
proof (prove)
using this:
rev w \<noteq> \<epsilon>
k < \<^bold>|rev w\<^bold>|

goal (1 subgoal):
 1. w = hd w # tl w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
w = hd w # tl w

goal (1 subgoal):
 1. border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|
[PROOF STEP]
from arg_cong[OF border_array.simps(2)[of "hd w" "tl w", folded this], of rev, unfolded rev_rev_ident]
[PROOF STATE]
proof (chain)
picking this:
rev (border_array w) = KMP (rev w) [0] 0 (\<^bold>|w\<^bold>| - 1)
[PROOF STEP]
have "rev (border_array w) =  (KMP (rev w) [0] 0 (\<^bold>|w\<^bold>|-1))"
[PROOF STATE]
proof (prove)
using this:
rev (border_array w) = KMP (rev w) [0] 0 (\<^bold>|w\<^bold>| - 1)

goal (1 subgoal):
 1. rev (border_array w) = KMP (rev w) [0] 0 (\<^bold>|w\<^bold>| - 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rev (border_array w) = KMP (rev w) [0] 0 (\<^bold>|w\<^bold>| - 1)

goal (1 subgoal):
 1. border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|
[PROOF STEP]
hence "max_borderP (take (rev (border_array w)!m) (drop m (rev w))) (drop m (rev w))"
[PROOF STATE]
proof (prove)
using this:
rev (border_array w) = KMP (rev w) [0] 0 (\<^bold>|w\<^bold>| - 1)

goal (1 subgoal):
 1. max_borderP (take (rev (border_array w) ! m) (drop m (rev w))) (drop m (rev w))
[PROOF STEP]
using KMP_valid_max[rule_format, OF KMP_valid_base[OF \<open>rev w \<noteq> \<epsilon>\<close>] \<open>m < \<^bold>|rev w\<^bold>|\<close>]
[PROOF STATE]
proof (prove)
using this:
rev (border_array w) = KMP (rev w) [0] 0 (\<^bold>|w\<^bold>| - 1)
max_borderP (take (KMP (rev w) [0] 0 (\<^bold>|rev w\<^bold>| - 1) ! m) (drop m (rev w))) (drop m (rev w))

goal (1 subgoal):
 1. max_borderP (take (rev (border_array w) ! m) (drop m (rev w))) (drop m (rev w))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
max_borderP (take (rev (border_array w) ! m) (drop m (rev w))) (drop m (rev w))

goal (1 subgoal):
 1. border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|
[PROOF STEP]
hence  "max_border (drop m (rev w)) = take (rev (border_array w)!m) (drop m (rev w))"
[PROOF STATE]
proof (prove)
using this:
max_borderP (take (rev (border_array w) ! m) (drop m (rev w))) (drop m (rev w))

goal (1 subgoal):
 1. max_border (drop m (rev w)) = take (rev (border_array w) ! m) (drop m (rev w))
[PROOF STEP]
using max_borderP_max_border
[PROOF STATE]
proof (prove)
using this:
max_borderP (take (rev (border_array w) ! m) (drop m (rev w))) (drop m (rev w))
max_borderP ?u ?w \<Longrightarrow> max_border ?w = ?u

goal (1 subgoal):
 1. max_border (drop m (rev w)) = take (rev (border_array w) ! m) (drop m (rev w))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
max_border (drop m (rev w)) = take (rev (border_array w) ! m) (drop m (rev w))

goal (1 subgoal):
 1. border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|
[PROOF STEP]
hence  "\<^bold>|max_border (drop m (rev w))\<^bold>| =  rev (border_array w)!m"
[PROOF STATE]
proof (prove)
using this:
max_border (drop m (rev w)) = take (rev (border_array w) ! m) (drop m (rev w))

goal (1 subgoal):
 1. \<^bold>|max_border (drop m (rev w))\<^bold>| = rev (border_array w) ! m
[PROOF STEP]
by (metis \<open>m < \<^bold>|rev w\<^bold>|\<close> drop_all_iff leD max_border_nemp_neq nat_le_linear take_all take_len)
[PROOF STATE]
proof (state)
this:
\<^bold>|max_border (drop m (rev w))\<^bold>| = rev (border_array w) ! m

goal (1 subgoal):
 1. border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<^bold>|max_border (drop m (rev w))\<^bold>| = rev (border_array w) ! m

goal (1 subgoal):
 1. border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|
[PROOF STEP]
using m_def
[PROOF STATE]
proof (prove)
using this:
\<^bold>|max_border (drop m (rev w))\<^bold>| = rev (border_array w) ! m
m = \<^bold>|w\<^bold>| - Suc k

goal (1 subgoal):
 1. border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|
[PROOF STEP]
by (metis Suc_diff_Suc \<open>k < \<^bold>|rev w\<^bold>|\<close> \<open>m < \<^bold>|rev w\<^bold>|\<close> border_array_len diff_diff_cancel drop_rev length_rev less_imp_le_nat max_border_len_rev rev_nth)
[PROOF STATE]
proof (state)
this:
border_array w ! k = \<^bold>|max_border (take (Suc k) w)\<^bold>|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_roots_mult: "p \<noteq> 0 \<Longrightarrow> q \<noteq> 0 \<Longrightarrow> poly_roots (p * q) = poly_roots p + poly_roots q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> poly_roots (p * q) = poly_roots p + poly_roots q
[PROOF STEP]
by (intro multiset_eqI) (auto simp: count_poly_roots' order_mult)


[STATEMENT]
lemma positive_is_normal:
  fixes A :: "complex mat"
  assumes pos: "positive A"
  shows "A * adjoint A = adjoint A * A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * adjoint A = adjoint A * A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A * adjoint A = adjoint A * A
[PROOF STEP]
have hA: "hermitian A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitian A
[PROOF STEP]
using positive_is_hermitian pos
[PROOF STATE]
proof (prove)
using this:
positive ?A \<Longrightarrow> hermitian ?A
positive A

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

goal (1 subgoal):
 1. A * adjoint A = adjoint A * A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hermitian A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hermitian A

goal (1 subgoal):
 1. A * adjoint A = adjoint A * A
[PROOF STEP]
by (simp add: hA hermitian_is_normal)
[PROOF STATE]
proof (state)
this:
A * adjoint A = adjoint A * A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lm096:
  assumes "runiq f" "X \<subseteq> (f^-1)``Y"
  shows "f``X \<subseteq> Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f `` X \<subseteq> Y
[PROOF STEP]
using assms rightUniqueFunctionAfterInverse
[PROOF STATE]
proof (prove)
using this:
runiq f
X \<subseteq> f\<inverse> `` Y
runiq ?f \<Longrightarrow> ?f `` ?f\<inverse> `` ?Y \<subseteq> ?Y

goal (1 subgoal):
 1. f `` X \<subseteq> Y
[PROOF STEP]
by (metis Image_mono order_refl subset_trans)


[STATEMENT]
lemma bl_not_aux_bin: "map Not (bin_to_bl_aux n w cs) = bin_to_bl_aux n (NOT w) (map Not cs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map Not (bin_to_bl_aux n w cs) = bin_to_bl_aux n (NOT w) (map Not cs)
[PROOF STEP]
by (induct n arbitrary: w cs) auto


[STATEMENT]
lemma pmf_of_list_lottery:
  "pmf_of_list_wf xs \<Longrightarrow> set (map fst xs) \<subseteq> A \<Longrightarrow> pmf_of_list xs \<in> lotteries_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pmf_of_list_wf xs; set (map fst xs) \<subseteq> A\<rbrakk> \<Longrightarrow> pmf_of_list xs \<in> lotteries_on A
[PROOF STEP]
using set_pmf_of_list[of xs]
[PROOF STATE]
proof (prove)
using this:
pmf_of_list_wf xs \<Longrightarrow> set_pmf (pmf_of_list xs) \<subseteq> set (map fst xs)

goal (1 subgoal):
 1. \<lbrakk>pmf_of_list_wf xs; set (map fst xs) \<subseteq> A\<rbrakk> \<Longrightarrow> pmf_of_list xs \<in> lotteries_on A
[PROOF STEP]
by (auto simp: lotteries_on_def)


[STATEMENT]
lemma is_inverse\<^sub>L_D[dest]:
  assumes "is_inverse\<^sub>L X Y"
  shows "X o\<^sub>L Y = id_blinfun" "Y o\<^sub>L X = id_blinfun"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X o\<^sub>L Y = id_blinfun &&& Y o\<^sub>L X = id_blinfun
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_inverse\<^sub>L X Y

goal (1 subgoal):
 1. X o\<^sub>L Y = id_blinfun &&& Y o\<^sub>L X = id_blinfun
[PROOF STEP]
unfolding is_inverse\<^sub>L_def
[PROOF STATE]
proof (prove)
using this:
X o\<^sub>L Y = id_blinfun \<and> Y o\<^sub>L X = id_blinfun

goal (1 subgoal):
 1. X o\<^sub>L Y = id_blinfun &&& Y o\<^sub>L X = id_blinfun
[PROOF STEP]
by auto


[STATEMENT]
lemma int_binomial: "int (n choose k) = (int n) gchoose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (n choose k) = int n gchoose k
[PROOF STEP]
proof (cases "k \<le> n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k \<le> n \<Longrightarrow> int (n choose k) = int n gchoose k
 2. \<not> k \<le> n \<Longrightarrow> int (n choose k) = int n gchoose k
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
k \<le> n

goal (2 subgoals):
 1. k \<le> n \<Longrightarrow> int (n choose k) = int n gchoose k
 2. \<not> k \<le> n \<Longrightarrow> int (n choose k) = int n gchoose k
[PROOF STEP]
from refl
[PROOF STATE]
proof (chain)
picking this:
?t = ?t
[PROOF STEP]
have eq: "(\<Prod>i = 0..<k. int (n - i)) = (\<Prod>i = 0..<k. int n - int i)"
[PROOF STATE]
proof (prove)
using this:
?t = ?t

goal (1 subgoal):
 1. (\<Prod>i = 0..<k. int (n - i)) = (\<Prod>i = 0..<k. int n - int i)
[PROOF STEP]
proof (rule prod.cong)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<k} \<Longrightarrow> int (n - x) = int n - int x
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<k} \<Longrightarrow> int (n - x) = int n - int x
[PROOF STEP]
assume "i \<in> {0..<k}"
[PROOF STATE]
proof (state)
this:
i \<in> {0..<k}

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<k} \<Longrightarrow> int (n - x) = int n - int x
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
k \<le> n
i \<in> {0..<k}
[PROOF STEP]
show "int (n - i) = int n - int i"
[PROOF STATE]
proof (prove)
using this:
k \<le> n
i \<in> {0..<k}

goal (1 subgoal):
 1. int (n - i) = int n - int i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int (n - i) = int n - int i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<k. int (n - i)) = (\<Prod>i = 0..<k. int n - int i)

goal (2 subgoals):
 1. k \<le> n \<Longrightarrow> int (n choose k) = int n gchoose k
 2. \<not> k \<le> n \<Longrightarrow> int (n choose k) = int n gchoose k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (n choose k) = int n gchoose k
[PROOF STEP]
by (simp add: gbinomial_binomial[symmetric] gbinomial_prod_rev zdiv_int eq)
[PROOF STATE]
proof (state)
this:
int (n choose k) = int n gchoose k

goal (1 subgoal):
 1. \<not> k \<le> n \<Longrightarrow> int (n choose k) = int n gchoose k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> k \<le> n \<Longrightarrow> int (n choose k) = int n gchoose k
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> k \<le> n

goal (1 subgoal):
 1. \<not> k \<le> n \<Longrightarrow> int (n choose k) = int n gchoose k
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> k \<le> n

goal (1 subgoal):
 1. int (n choose k) = int n gchoose k
[PROOF STEP]
by (simp add: gbinomial_eq_0_int)
[PROOF STATE]
proof (state)
this:
int (n choose k) = int n gchoose k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cost_swapSyms_le:
assumes "consistent t" "a \<in> alphabet t" "b \<in> alphabet t" "freq t a \<le> freq t b"
        "depth t a \<le> depth t b"
shows "cost (swapSyms t a b) \<le> cost t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cost (swapSyms t a b) \<le> cost t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cost (swapSyms t a b) \<le> cost t
[PROOF STEP]
let ?aabb = "freq t a * depth t a + freq t b * depth t b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cost (swapSyms t a b) \<le> cost t
[PROOF STEP]
let ?abba = "freq t a * depth t b + freq t b * depth t a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cost (swapSyms t a b) \<le> cost t
[PROOF STEP]
have "?abba \<le> ?aabb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. freq t a * depth t b + freq t b * depth t a \<le> freq t a * depth t a + freq t b * depth t b
[PROOF STEP]
using assms(4-5)
[PROOF STATE]
proof (prove)
using this:
freq t a \<le> freq t b
depth t a \<le> depth t b

goal (1 subgoal):
 1. freq t a * depth t b + freq t b * depth t a \<le> freq t a * depth t a + freq t b * depth t b
[PROOF STEP]
by (rule le_le_imp_sum_mult_le_sum_mult)
[PROOF STATE]
proof (state)
this:
freq t a * depth t b + freq t b * depth t a \<le> freq t a * depth t a + freq t b * depth t b

goal (1 subgoal):
 1. cost (swapSyms t a b) \<le> cost t
[PROOF STEP]
have "cost (swapSyms t a b) + ?aabb = cost t + ?abba"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cost (swapSyms t a b) + (freq t a * depth t a + freq t b * depth t b) = cost t + (freq t a * depth t b + freq t b * depth t a)
[PROOF STEP]
using assms(1-3)
[PROOF STATE]
proof (prove)
using this:
consistent t
a \<in> alphabet t
b \<in> alphabet t

goal (1 subgoal):
 1. cost (swapSyms t a b) + (freq t a * depth t a + freq t b * depth t b) = cost t + (freq t a * depth t b + freq t b * depth t a)
[PROOF STEP]
by (simp add: cost_swapSyms add.assoc[THEN sym])
[PROOF STATE]
proof (state)
this:
cost (swapSyms t a b) + (freq t a * depth t a + freq t b * depth t b) = cost t + (freq t a * depth t b + freq t b * depth t a)

goal (1 subgoal):
 1. cost (swapSyms t a b) \<le> cost t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cost (swapSyms t a b) + (freq t a * depth t a + freq t b * depth t b) = cost t + (freq t a * depth t b + freq t b * depth t a)

goal (1 subgoal):
 1. cost (swapSyms t a b) \<le> cost t
[PROOF STEP]
have "\<dots> \<le> cost t + ?aabb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cost t + (freq t a * depth t b + freq t b * depth t a) \<le> cost t + (freq t a * depth t a + freq t b * depth t b)
[PROOF STEP]
using \<open>?abba \<le> ?aabb\<close>
[PROOF STATE]
proof (prove)
using this:
freq t a * depth t b + freq t b * depth t a \<le> freq t a * depth t a + freq t b * depth t b

goal (1 subgoal):
 1. cost t + (freq t a * depth t b + freq t b * depth t a) \<le> cost t + (freq t a * depth t a + freq t b * depth t b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cost t + (freq t a * depth t b + freq t b * depth t a) \<le> cost t + (freq t a * depth t a + freq t b * depth t b)

goal (1 subgoal):
 1. cost (swapSyms t a b) \<le> cost t
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cost (swapSyms t a b) + (freq t a * depth t a + freq t b * depth t b) \<le> cost t + (freq t a * depth t a + freq t b * depth t b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cost (swapSyms t a b) + (freq t a * depth t a + freq t b * depth t b) \<le> cost t + (freq t a * depth t a + freq t b * depth t b)

goal (1 subgoal):
 1. cost (swapSyms t a b) \<le> cost t
[PROOF STEP]
using assms(4-5)
[PROOF STATE]
proof (prove)
using this:
cost (swapSyms t a b) + (freq t a * depth t a + freq t b * depth t b) \<le> cost t + (freq t a * depth t a + freq t b * depth t b)
freq t a \<le> freq t b
depth t a \<le> depth t b

goal (1 subgoal):
 1. cost (swapSyms t a b) \<le> cost t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cost (swapSyms t a b) \<le> cost t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Quo3:
  "n * (Quo n m) = m - m mod n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n * Quo n m = m - m mod n
[PROOF STEP]
using Quo2[of n m]
[PROOF STATE]
proof (prove)
using this:
n * Quo n m + m mod n = m

goal (1 subgoal):
 1. n * Quo n m = m - m mod n
[PROOF STEP]
by (auto)


[STATEMENT]
lemma sq_mtx_plus_ith[simp]:"(A + B) $$ i = A $$ i + B $$ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A + B) $$ i = A $$ i + B $$ i
[PROOF STEP]
unfolding sq_mtx_plus_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_mtx (\<chi>i j. A $$ i $ j + B $$ i $ j) $$ i = A $$ i + B $$ i
[PROOF STEP]
by (simp add: vec_eq_iff)


[STATEMENT]
lemma sum_np_eq:
assumes
  hC: "C \<subseteq> PR"
shows
  "(\<Sum>l\<in>{..<np}. f l) = (\<Sum>l\<in>C. f l) + (\<Sum>l\<in>({..<np}-C). f l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<np} = sum f C + sum f ({..<np} - C)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum f {..<np} = sum f C + sum f ({..<np} - C)
[PROOF STEP]
note finitC[where C=C]
[PROOF STATE]
proof (state)
this:
C \<subseteq> PR \<Longrightarrow> finite C

goal (1 subgoal):
 1. sum f {..<np} = sum f C + sum f ({..<np} - C)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
C \<subseteq> PR \<Longrightarrow> finite C

goal (1 subgoal):
 1. sum f {..<np} = sum f C + sum f ({..<np} - C)
[PROOF STEP]
note finitnpC[where C=C]
[PROOF STATE]
proof (state)
this:
finite (PR - C)

goal (1 subgoal):
 1. sum f {..<np} = sum f C + sum f ({..<np} - C)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite (PR - C)

goal (1 subgoal):
 1. sum f {..<np} = sum f C + sum f ({..<np} - C)
[PROOF STEP]
have "C \<inter> ({..<np}-C) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<inter> ({..<np} - C) = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C \<inter> ({..<np} - C) = {}

goal (1 subgoal):
 1. sum f {..<np} = sum f C + sum f ({..<np} - C)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
C \<inter> ({..<np} - C) = {}

goal (1 subgoal):
 1. sum f {..<np} = sum f C + sum f ({..<np} - C)
[PROOF STEP]
from hC
[PROOF STATE]
proof (chain)
picking this:
C \<subseteq> PR
[PROOF STEP]
have "C \<union> ({..<np}-C) = {..<np}"
[PROOF STATE]
proof (prove)
using this:
C \<subseteq> PR

goal (1 subgoal):
 1. C \<union> ({..<np} - C) = {..<np}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C \<union> ({..<np} - C) = {..<np}

goal (1 subgoal):
 1. sum f {..<np} = sum f C + sum f ({..<np} - C)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
C \<subseteq> PR \<Longrightarrow> finite C
finite (PR - C)
C \<inter> ({..<np} - C) = {}
C \<union> ({..<np} - C) = {..<np}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
C \<subseteq> PR \<Longrightarrow> finite C
finite (PR - C)
C \<inter> ({..<np} - C) = {}
C \<union> ({..<np} - C) = {..<np}

goal (1 subgoal):
 1. sum f {..<np} = sum f C + sum f ({..<np} - C)
[PROOF STEP]
using sum.union_disjoint[where A=C and B="{..<np} - C"]
[PROOF STATE]
proof (prove)
using this:
C \<subseteq> PR \<Longrightarrow> finite C
finite (PR - C)
C \<inter> ({..<np} - C) = {}
C \<union> ({..<np} - C) = {..<np}
\<lbrakk>finite C; finite ({..<np} - C); C \<inter> ({..<np} - C) = {}\<rbrakk> \<Longrightarrow> sum ?g (C \<union> ({..<np} - C)) = sum ?g C + sum ?g ({..<np} - C)

goal (1 subgoal):
 1. sum f {..<np} = sum f C + sum f ({..<np} - C)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum f {..<np} = sum f C + sum f ({..<np} - C)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma contractible_imp_holomorphic_log:
  assumes holf: "f holomorphic_on S"
      and S: "contractible S"
      and fnz: "\<And>z. z \<in> S \<Longrightarrow> f z \<noteq> 0"
  obtains g where "g holomorphic_on S" "\<And>z. z \<in> S \<Longrightarrow> f z = exp(g z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>g holomorphic_on S; \<And>z. z \<in> S \<Longrightarrow> f z = exp (g z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>g holomorphic_on S; \<And>z. z \<in> S \<Longrightarrow> f z = exp (g z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have contf: "continuous_on S f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on S f
[PROOF STEP]
by (simp add: holf holomorphic_on_imp_continuous_on)
[PROOF STATE]
proof (state)
this:
continuous_on S f

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>g holomorphic_on S; \<And>z. z \<in> S \<Longrightarrow> f z = exp (g z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain g where contg: "continuous_on S g" and feq: "\<And>x. x \<in> S \<Longrightarrow> f x = exp (g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>continuous_on S g; \<And>x. x \<in> S \<Longrightarrow> f x = exp (g x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis continuous_logarithm_on_contractible [OF contf S fnz])
[PROOF STATE]
proof (state)
this:
continuous_on S g
?x \<in> S \<Longrightarrow> f ?x = exp (g ?x)

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>g holomorphic_on S; \<And>z. z \<in> S \<Longrightarrow> f z = exp (g z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_on S g
?x \<in> S \<Longrightarrow> f ?x = exp (g ?x)
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
using this:
continuous_on S g
?x \<in> S \<Longrightarrow> f ?x = exp (g ?x)

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using fnz g_imp_holomorphic_log holf that
[PROOF STATE]
proof (prove)
using this:
continuous_on S g
?x \<in> S \<Longrightarrow> f ?x = exp (g ?x)
?z \<in> S \<Longrightarrow> f ?z \<noteq> 0
\<lbrakk>?f holomorphic_on ?S; continuous_on ?S ?g; \<And>x. x \<in> ?S \<Longrightarrow> ?f x = exp (?g x); \<And>z. z \<in> ?S \<Longrightarrow> ?f z \<noteq> 0; \<And>g. \<lbrakk>g holomorphic_on ?S; \<And>z. z \<in> ?S \<Longrightarrow> ?f z = exp (g z)\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
f holomorphic_on S
\<lbrakk>?g holomorphic_on S; \<And>z. z \<in> S \<Longrightarrow> f z = exp (?g z)\<rbrakk> \<Longrightarrow> thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ennreal_diff_le_mono_left: "a \<le> b \<Longrightarrow> a - c \<le> (b::ennreal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> a - c \<le> b
[PROOF STEP]
using ennreal_mono_minus[of 0 c a, THEN order_trans, of b]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> c; a - 0 \<le> b\<rbrakk> \<Longrightarrow> a - c \<le> b

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> a - c \<le> b
[PROOF STEP]
by simp


[STATEMENT]
lemma nat_to_ce_set_into_ce: "nat_to_ce_set n \<in> ce_sets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_ce_set n \<in> ce_sets
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nat_to_ce_set n \<in> ce_sets
[PROOF STEP]
have S1: "nat_to_ce_set n = fn_to_set (pr_conv_1_to_2 (nat_to_pr n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_ce_set n = fn_to_set (pr_conv_1_to_2 (nat_to_pr n))
[PROOF STEP]
by (simp add: nat_to_ce_set_def)
[PROOF STATE]
proof (state)
this:
nat_to_ce_set n = fn_to_set (pr_conv_1_to_2 (nat_to_pr n))

goal (1 subgoal):
 1. nat_to_ce_set n \<in> ce_sets
[PROOF STEP]
have "(nat_to_pr n) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_pr n \<in> PrimRec1
[PROOF STEP]
by (rule nat_to_pr_into_pr)
[PROOF STATE]
proof (state)
this:
nat_to_pr n \<in> PrimRec1

goal (1 subgoal):
 1. nat_to_ce_set n \<in> ce_sets
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat_to_pr n \<in> PrimRec1
[PROOF STEP]
have S2: "(pr_conv_1_to_2 (nat_to_pr n)) \<in> PrimRec2"
[PROOF STATE]
proof (prove)
using this:
nat_to_pr n \<in> PrimRec1

goal (1 subgoal):
 1. pr_conv_1_to_2 (nat_to_pr n) \<in> PrimRec2
[PROOF STEP]
by (rule pr_conv_1_to_2_lm)
[PROOF STATE]
proof (state)
this:
pr_conv_1_to_2 (nat_to_pr n) \<in> PrimRec2

goal (1 subgoal):
 1. nat_to_ce_set n \<in> ce_sets
[PROOF STEP]
from S2 S1
[PROOF STATE]
proof (chain)
picking this:
pr_conv_1_to_2 (nat_to_pr n) \<in> PrimRec2
nat_to_ce_set n = fn_to_set (pr_conv_1_to_2 (nat_to_pr n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pr_conv_1_to_2 (nat_to_pr n) \<in> PrimRec2
nat_to_ce_set n = fn_to_set (pr_conv_1_to_2 (nat_to_pr n))

goal (1 subgoal):
 1. nat_to_ce_set n \<in> ce_sets
[PROOF STEP]
by (simp add: ce_set_lm_1)
[PROOF STATE]
proof (state)
this:
nat_to_ce_set n \<in> ce_sets

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_gen_eigenspace_similar: assumes sim: "similar_mat A B"
  shows "dim_gen_eigenspace A = dim_gen_eigenspace B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.dim_gen_eigenspace A = local.dim_gen_eigenspace B
[PROOF STEP]
proof (intro ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
fix ev k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
define n where "n = dim_row A"
[PROOF STATE]
proof (state)
this:
n = dim_row A

goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
from sim[unfolded similar_mat_def]
[PROOF STATE]
proof (chain)
picking this:
\<exists>P. Ex (similar_mat_wit A B P)
[PROOF STEP]
obtain P Q where
    wit: "similar_mat_wit A B P Q"
[PROOF STATE]
proof (prove)
using this:
\<exists>P. Ex (similar_mat_wit A B P)

goal (1 subgoal):
 1. (\<And>P Q. similar_mat_wit A B P Q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
similar_mat_wit A B P Q

goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
let ?C = "carrier_mat n n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
from similar_mat_witD[OF refl wit, folded n_def]
[PROOF STATE]
proof (chain)
picking this:
P * Q = 1\<^sub>m n
Q * P = 1\<^sub>m n
A = P * B * Q
A \<in> carrier_mat n n
B \<in> carrier_mat n n
P \<in> carrier_mat n n
Q \<in> carrier_mat n n
[PROOF STEP]
have A: "A \<in> ?C" and B: "B \<in> ?C" and P: "P \<in> ?C" and Q: "Q \<in> ?C"
    and PQ: "P * Q = 1\<^sub>m n" and QP: "Q * P = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
using this:
P * Q = 1\<^sub>m n
Q * P = 1\<^sub>m n
A = P * B * Q
A \<in> carrier_mat n n
B \<in> carrier_mat n n
P \<in> carrier_mat n n
Q \<in> carrier_mat n n

goal (1 subgoal):
 1. (A \<in> carrier_mat n n &&& B \<in> carrier_mat n n &&& P \<in> carrier_mat n n) &&& Q \<in> carrier_mat n n &&& P * Q = 1\<^sub>m n &&& Q * P = 1\<^sub>m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
P \<in> carrier_mat n n
Q \<in> carrier_mat n n
P * Q = 1\<^sub>m n
Q * P = 1\<^sub>m n

goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
from similar_mat_wit_pow[OF similar_mat_wit_char_matrix[OF wit, of ev], of k]
[PROOF STATE]
proof (chain)
picking this:
similar_mat_wit (char_matrix A ev ^\<^sub>m k) (char_matrix B ev ^\<^sub>m k) P Q
[PROOF STEP]
have wit: "similar_mat_wit (char_matrix A ev ^\<^sub>m k) (char_matrix B ev ^\<^sub>m k) P Q"
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit (char_matrix A ev ^\<^sub>m k) (char_matrix B ev ^\<^sub>m k) P Q

goal (1 subgoal):
 1. similar_mat_wit (char_matrix A ev ^\<^sub>m k) (char_matrix B ev ^\<^sub>m k) P Q
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
similar_mat_wit (char_matrix A ev ^\<^sub>m k) (char_matrix B ev ^\<^sub>m k) P Q

goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
from A B
[PROOF STATE]
proof (chain)
picking this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
[PROOF STEP]
have cA: "char_matrix A ev ^\<^sub>m k \<in> carrier_mat n n"
    and cB: "char_matrix B ev ^\<^sub>m k \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (1 subgoal):
 1. char_matrix A ev ^\<^sub>m k \<in> carrier_mat n n &&& char_matrix B ev ^\<^sub>m k \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
char_matrix A ev ^\<^sub>m k \<in> carrier_mat n n
char_matrix B ev ^\<^sub>m k \<in> carrier_mat n n

goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
hence dim: "dim_col (char_matrix A ev ^\<^sub>m k) = n" "dim_col (char_matrix B ev ^\<^sub>m k) = n"
[PROOF STATE]
proof (prove)
using this:
char_matrix A ev ^\<^sub>m k \<in> carrier_mat n n
char_matrix B ev ^\<^sub>m k \<in> carrier_mat n n

goal (1 subgoal):
 1. dim_col (char_matrix A ev ^\<^sub>m k) = n &&& dim_col (char_matrix B ev ^\<^sub>m k) = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_col (char_matrix A ev ^\<^sub>m k) = n
dim_col (char_matrix B ev ^\<^sub>m k) = n

goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
have "dim_gen_eigenspace A ev k = kernel_dim (char_matrix A ev ^\<^sub>m k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.dim_gen_eigenspace A ev k = kernel_dim (char_matrix A ev ^\<^sub>m k)
[PROOF STEP]
unfolding dim_gen_eigenspace_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel_dim (char_matrix A ev ^\<^sub>m k) = kernel_dim (char_matrix A ev ^\<^sub>m k)
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. kernel_dim (char_matrix A ev ^\<^sub>m k) = kernel_dim (char_matrix A ev ^\<^sub>m k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.dim_gen_eigenspace A ev k = kernel_dim (char_matrix A ev ^\<^sub>m k)

goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.dim_gen_eigenspace A ev k = kernel_dim (char_matrix A ev ^\<^sub>m k)

goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
have "\<dots> = kernel_dim (char_matrix B ev ^\<^sub>m k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel_dim (char_matrix A ev ^\<^sub>m k) = kernel_dim (char_matrix B ev ^\<^sub>m k)
[PROOF STEP]
unfolding kernel_dim_def dim
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (char_matrix A ev ^\<^sub>m k)\<rparr>) = vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (char_matrix B ev ^\<^sub>m k)\<rparr>)
[PROOF STEP]
by (rule similar_mat_wit_kernel_dim[OF cA wit])
[PROOF STATE]
proof (state)
this:
kernel_dim (char_matrix A ev ^\<^sub>m k) = kernel_dim (char_matrix B ev ^\<^sub>m k)

goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
kernel_dim (char_matrix A ev ^\<^sub>m k) = kernel_dim (char_matrix B ev ^\<^sub>m k)

goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
have "\<dots> = dim_gen_eigenspace B ev k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel_dim (char_matrix B ev ^\<^sub>m k) = local.dim_gen_eigenspace B ev k
[PROOF STEP]
unfolding dim_gen_eigenspace_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel_dim (char_matrix B ev ^\<^sub>m k) = kernel_dim (char_matrix B ev ^\<^sub>m k)
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat n n

goal (1 subgoal):
 1. kernel_dim (char_matrix B ev ^\<^sub>m k) = kernel_dim (char_matrix B ev ^\<^sub>m k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
kernel_dim (char_matrix B ev ^\<^sub>m k) = local.dim_gen_eigenspace B ev k

goal (1 subgoal):
 1. \<And>x xa. local.dim_gen_eigenspace A x xa = local.dim_gen_eigenspace B x xa
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.dim_gen_eigenspace A ev k = local.dim_gen_eigenspace B ev k
[PROOF STEP]
show "dim_gen_eigenspace A ev k = dim_gen_eigenspace B ev k"
[PROOF STATE]
proof (prove)
using this:
local.dim_gen_eigenspace A ev k = local.dim_gen_eigenspace B ev k

goal (1 subgoal):
 1. local.dim_gen_eigenspace A ev k = local.dim_gen_eigenspace B ev k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
local.dim_gen_eigenspace A ev k = local.dim_gen_eigenspace B ev k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cong_add_lcancel_0:
  "[a + x = a] (mod n) \<longleftrightarrow> [x = 0] (mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a + x = a] (mod n) = [x = 0::'a] (mod n)
[PROOF STEP]
using cong_add_lcancel [of a x 0 n]
[PROOF STATE]
proof (prove)
using this:
[a + x = a + (0::'a)] (mod n) = [x = 0::'a] (mod n)

goal (1 subgoal):
 1. [a + x = a] (mod n) = [x = 0::'a] (mod n)
[PROOF STEP]
by simp


[STATEMENT]
lemma repeat_stabilize_induct: "(P m) \<Longrightarrow> (\<And>m. P m \<Longrightarrow> P (f m)) \<Longrightarrow> P (repeat_stabilize n f m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P m; \<And>m. P m \<Longrightarrow> P (f m)\<rbrakk> \<Longrightarrow> P (repeat_stabilize n f m)
[PROOF STEP]
apply(simp add: repeat_stabilize_funpow)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P m; \<And>m. P m \<Longrightarrow> P (f m)\<rbrakk> \<Longrightarrow> P ((f ^^ n) m)
[PROOF STEP]
apply(induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>P m; \<And>m. P m \<Longrightarrow> P (f m)\<rbrakk> \<Longrightarrow> P ((f ^^ 0) m)
 2. \<And>n. \<lbrakk>\<lbrakk>P m; \<And>m. P m \<Longrightarrow> P (f m)\<rbrakk> \<Longrightarrow> P ((f ^^ n) m); P m; \<And>m. P m \<Longrightarrow> P (f m)\<rbrakk> \<Longrightarrow> P ((f ^^ Suc n) m)
[PROOF STEP]
by(simp)+


[STATEMENT]
lemma floor_exists1: "\<exists>!z. of_int z \<le> x \<and> x < of_int (z + 1)"
  for x :: "'a::archimedean_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!z. of_int z \<le> x \<and> x < of_int (z + 1)
[PROOF STEP]
proof (rule ex_ex1I)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>z. of_int z \<le> x \<and> x < of_int (z + 1)
 2. \<And>z y. \<lbrakk>of_int z \<le> x \<and> x < of_int (z + 1); of_int y \<le> x \<and> x < of_int (y + 1)\<rbrakk> \<Longrightarrow> z = y
[PROOF STEP]
show "\<exists>z. of_int z \<le> x \<and> x < of_int (z + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. of_int z \<le> x \<and> x < of_int (z + 1)
[PROOF STEP]
by (rule floor_exists)
[PROOF STATE]
proof (state)
this:
\<exists>z. of_int z \<le> x \<and> x < of_int (z + 1)

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

goal (1 subgoal):
 1. \<And>z y. \<lbrakk>of_int z \<le> x \<and> x < of_int (z + 1); of_int y \<le> x \<and> x < of_int (y + 1)\<rbrakk> \<Longrightarrow> z = y
[PROOF STEP]
with le_less_trans [of "of_int y" "x" "of_int (z + 1)"]
       le_less_trans [of "of_int z" "x" "of_int (y + 1)"]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>of_int y \<le> x; x < of_int (z + 1)\<rbrakk> \<Longrightarrow> of_int y < of_int (z + 1)
\<lbrakk>of_int z \<le> x; x < of_int (y + 1)\<rbrakk> \<Longrightarrow> of_int z < of_int (y + 1)
of_int y \<le> x \<and> x < of_int (y + 1)
of_int z \<le> x \<and> x < of_int (z + 1)
[PROOF STEP]
show "y = z"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>of_int y \<le> x; x < of_int (z + 1)\<rbrakk> \<Longrightarrow> of_int y < of_int (z + 1)
\<lbrakk>of_int z \<le> x; x < of_int (y + 1)\<rbrakk> \<Longrightarrow> of_int z < of_int (y + 1)
of_int y \<le> x \<and> x < of_int (y + 1)
of_int z \<le> x \<and> x < of_int (z + 1)

goal (1 subgoal):
 1. y = z
[PROOF STEP]
by (simp del: of_int_add)
[PROOF STATE]
proof (state)
this:
y = z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_bij_enumerate:
  fixes S :: "'a::wellorder set"
  assumes S: "finite S"
  shows "bij_betw (enumerate S) {..<card S} S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) {..<card S} S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) {..<card S} S
[PROOF STEP]
have "\<And>n m. \<lbrakk>n \<noteq> m; n < card S; m < card S\<rbrakk> \<Longrightarrow> enumerate S n \<noteq> enumerate S m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<noteq> m; n < card S; m < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S n \<noteq> wellorder_class.enumerate S m
[PROOF STEP]
using finite_enumerate_mono[OF _ \<open>finite S\<close>]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?m < ?n; ?n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S ?m < wellorder_class.enumerate S ?n

goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<noteq> m; n < card S; m < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S n \<noteq> wellorder_class.enumerate S m
[PROOF STEP]
by (auto simp: neq_iff)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?n \<noteq> ?m; ?n < card S; ?m < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S ?n \<noteq> wellorder_class.enumerate S ?m

goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) {..<card S} S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?n \<noteq> ?m; ?n < card S; ?m < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S ?n \<noteq> wellorder_class.enumerate S ?m
[PROOF STEP]
have "inj_on (enumerate S) {..<card S}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?n \<noteq> ?m; ?n < card S; ?m < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S ?n \<noteq> wellorder_class.enumerate S ?m

goal (1 subgoal):
 1. inj_on (wellorder_class.enumerate S) {..<card S}
[PROOF STEP]
by (auto simp: inj_on_def)
[PROOF STATE]
proof (state)
this:
inj_on (wellorder_class.enumerate S) {..<card S}

goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) {..<card S} S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on (wellorder_class.enumerate S) {..<card S}

goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) {..<card S} S
[PROOF STEP]
have "\<forall>s \<in> S. \<exists>i<card S. enumerate S i = s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>s\<in>S. \<exists>i<card S. wellorder_class.enumerate S i = s
[PROOF STEP]
using finite_enumerate_Ex[OF S]
[PROOF STATE]
proof (prove)
using this:
?s \<in> S \<Longrightarrow> \<exists>n<card S. wellorder_class.enumerate S n = ?s

goal (1 subgoal):
 1. \<forall>s\<in>S. \<exists>i<card S. wellorder_class.enumerate S i = s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>s\<in>S. \<exists>i<card S. wellorder_class.enumerate S i = s

goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) {..<card S} S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>s\<in>S. \<exists>i<card S. wellorder_class.enumerate S i = s

goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) {..<card S} S
[PROOF STEP]
note \<open>finite S\<close>
[PROOF STATE]
proof (state)
this:
finite S

goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) {..<card S} S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj_on (wellorder_class.enumerate S) {..<card S}
\<forall>s\<in>S. \<exists>i<card S. wellorder_class.enumerate S i = s
finite S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on (wellorder_class.enumerate S) {..<card S}
\<forall>s\<in>S. \<exists>i<card S. wellorder_class.enumerate S i = s
finite S

goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) {..<card S} S
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj_on (wellorder_class.enumerate S) {..<card S}
\<forall>s\<in>S. \<exists>i<card S. wellorder_class.enumerate S i = s
finite S

goal (1 subgoal):
 1. inj_on (wellorder_class.enumerate S) {..<card S} \<and> wellorder_class.enumerate S ` {..<card S} = S
[PROOF STEP]
by (auto intro: finite_enumerate_in_set)
[PROOF STATE]
proof (state)
this:
bij_betw (wellorder_class.enumerate S) {..<card S} S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bilinear_lsub: "bilinear h \<Longrightarrow> h (x - y) z = h x z - h y z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bilinear h \<Longrightarrow> h (x - y) z = h x z - h y z
[PROOF STEP]
using bilinear_ladd [of h x "- y"]
[PROOF STATE]
proof (prove)
using this:
bilinear h \<Longrightarrow> h (x + - y) ?z = h x ?z + h (- y) ?z

goal (1 subgoal):
 1. bilinear h \<Longrightarrow> h (x - y) z = h x z - h y z
[PROOF STEP]
by (simp add: bilinear_lneg)


[STATEMENT]
lemma real_transfer_operator_diff [intro, simp]:
  assumes [measurable]: "integrable M f" "integrable M g"
  shows "AE x in M. real_transfer_operator (\<lambda>x. f x - g x) x = real_transfer_operator f x - real_transfer_operator g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. f x - g x) x = real_transfer_operator f x - real_transfer_operator g x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. f x - g x) x = real_transfer_operator f x - real_transfer_operator g x
[PROOF STEP]
have "AE x in M. real_transfer_operator (\<lambda>x. f x + (- g x)) x = real_transfer_operator f x + real_transfer_operator (\<lambda>x. -g x) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. f x + - g x) x = real_transfer_operator f x + real_transfer_operator (\<lambda>x. - g x) x
[PROOF STEP]
using real_transfer_operator_add[where ?f = f and ?g = "\<lambda>x. - g x"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable M f; integrable M (\<lambda>x. - g x)\<rbrakk> \<Longrightarrow> AE x in M. real_transfer_operator (\<lambda>x. f x + - g x) x = real_transfer_operator f x + real_transfer_operator (\<lambda>x. - g x) x
integrable M f
integrable M g

goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. f x + - g x) x = real_transfer_operator f x + real_transfer_operator (\<lambda>x. - g x) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. real_transfer_operator (\<lambda>x. f x + - g x) x = real_transfer_operator f x + real_transfer_operator (\<lambda>x. - g x) x

goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. f x - g x) x = real_transfer_operator f x - real_transfer_operator g x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
AE x in M. real_transfer_operator (\<lambda>x. f x + - g x) x = real_transfer_operator f x + real_transfer_operator (\<lambda>x. - g x) x

goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. f x - g x) x = real_transfer_operator f x - real_transfer_operator g x
[PROOF STEP]
have "AE x in M. real_transfer_operator (\<lambda>x. -g x) x = - real_transfer_operator g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. - g x) x = - real_transfer_operator g x
[PROOF STEP]
using real_transfer_operator_cmult[where ?f = g and ?c = "-1"] assms(2)
[PROOF STATE]
proof (prove)
using this:
integrable M g \<Longrightarrow> AE x in M. real_transfer_operator (\<lambda>x. - 1 * g x) x = - 1 * real_transfer_operator g x
integrable M g

goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. - g x) x = - real_transfer_operator g x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. real_transfer_operator (\<lambda>x. - g x) x = - real_transfer_operator g x

goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. f x - g x) x = real_transfer_operator f x - real_transfer_operator g x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
AE x in M. real_transfer_operator (\<lambda>x. f x + - g x) x = real_transfer_operator f x + real_transfer_operator (\<lambda>x. - g x) x
AE x in M. real_transfer_operator (\<lambda>x. - g x) x = - real_transfer_operator g x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
AE x in M. real_transfer_operator (\<lambda>x. f x + - g x) x = real_transfer_operator f x + real_transfer_operator (\<lambda>x. - g x) x
AE x in M. real_transfer_operator (\<lambda>x. - g x) x = - real_transfer_operator g x

goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. f x - g x) x = real_transfer_operator f x - real_transfer_operator g x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. real_transfer_operator (\<lambda>x. f x - g x) x = real_transfer_operator f x - real_transfer_operator g x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ereal_eq_0[simp]:
  "ereal r = 0 \<longleftrightarrow> r = 0"
  "0 = ereal r \<longleftrightarrow> r = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ereal r = 0) = (r = 0) &&& (0 = ereal r) = (r = 0)
[PROOF STEP]
unfolding zero_ereal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ereal r = ereal 0) = (r = 0) &&& (ereal 0 = ereal r) = (r = 0)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma cos_abs[simp]: "cos (abs x :: real) = cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos \<bar>x\<bar> = cos x
[PROOF STEP]
proof (cases "x < 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x < 0 \<Longrightarrow> cos \<bar>x\<bar> = cos x
 2. \<not> x < 0 \<Longrightarrow> cos \<bar>x\<bar> = cos x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x < 0

goal (2 subgoals):
 1. x < 0 \<Longrightarrow> cos \<bar>x\<bar> = cos x
 2. \<not> x < 0 \<Longrightarrow> cos \<bar>x\<bar> = cos x
[PROOF STEP]
hence abs: "abs x = - x"
[PROOF STATE]
proof (prove)
using this:
x < 0

goal (1 subgoal):
 1. \<bar>x\<bar> = - x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> = - x

goal (2 subgoals):
 1. x < 0 \<Longrightarrow> cos \<bar>x\<bar> = cos x
 2. \<not> x < 0 \<Longrightarrow> cos \<bar>x\<bar> = cos x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos \<bar>x\<bar> = cos x
[PROOF STEP]
unfolding abs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (- x) = cos x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cos \<bar>x\<bar> = cos x

goal (1 subgoal):
 1. \<not> x < 0 \<Longrightarrow> cos \<bar>x\<bar> = cos x
[PROOF STEP]
qed simp


[STATEMENT]
lemma poly_N_xi: "poly (N i) (x j) = pprod j 0 i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (N i) (x j) = pprod j 0 i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly (N i) (x j) = pprod j 0 i
[PROOF STEP]
have "poly (N i) (x j) = (\<Prod>l\<leftarrow>[0..<i]. xd j l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (N i) (x j) = prod_list (map (xd j) [0..<i])
[PROOF STEP]
unfolding N_def Xij_def poly_prod_list X_def[abs_def] map_map o_def xd_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>xa\<leftarrow>[0..<i]. poly [:- x xa, 1::'a:] (x j)) = (\<Prod>l\<leftarrow>[0..<i]. x j - x l)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly (N i) (x j) = prod_list (map (xd j) [0..<i])

goal (1 subgoal):
 1. poly (N i) (x j) = pprod j 0 i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly (N i) (x j) = prod_list (map (xd j) [0..<i])

goal (1 subgoal):
 1. poly (N i) (x j) = pprod j 0 i
[PROOF STEP]
have "\<dots> = pprod j 0 i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map (xd j) [0..<i]) = pprod j 0 i
[PROOF STEP]
unfolding pprod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map (xd j) [0..<i]) = prod_list (map (xd j) [0..<i])
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
prod_list (map (xd j) [0..<i]) = pprod j 0 i

goal (1 subgoal):
 1. poly (N i) (x j) = pprod j 0 i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly (N i) (x j) = pprod j 0 i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly (N i) (x j) = pprod j 0 i

goal (1 subgoal):
 1. poly (N i) (x j) = pprod j 0 i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poly (N i) (x j) = pprod j 0 i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dropWhile_neq_rev: "\<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow>
  dropWhile (\<lambda>y. y \<noteq> x) (rev xs) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>y. y \<noteq> x) (rev xs) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) xs)
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>distinct []; x \<in> set []\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>y. y \<noteq> x) (rev []) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) [])
 2. \<And>a xs. \<lbrakk>\<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>y. y \<noteq> x) (rev xs) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) xs); distinct (a # xs); x \<in> set (a # xs)\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>y. y \<noteq> x) (rev (a # xs)) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) (a # xs))
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>y. y \<noteq> x) (rev xs) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) xs)
distinct (a # xs)
x \<in> set (a # xs)

goal (2 subgoals):
 1. \<lbrakk>distinct []; x \<in> set []\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>y. y \<noteq> x) (rev []) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) [])
 2. \<And>a xs. \<lbrakk>\<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>y. y \<noteq> x) (rev xs) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) xs); distinct (a # xs); x \<in> set (a # xs)\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>y. y \<noteq> x) (rev (a # xs)) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) (a # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>y. y \<noteq> x) (rev xs) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) xs)
distinct (a # xs)
x \<in> set (a # xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>y. y \<noteq> x) (rev xs) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) xs)
distinct (a # xs)
x \<in> set (a # xs)

goal (1 subgoal):
 1. dropWhile (\<lambda>y. y \<noteq> x) (rev (a # xs)) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) (a # xs))
[PROOF STEP]
by(auto, subst dropWhile_append2, auto)
[PROOF STATE]
proof (state)
this:
dropWhile (\<lambda>y. y \<noteq> x) (rev (a # xs)) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) (a # xs))

goal (1 subgoal):
 1. \<lbrakk>distinct []; x \<in> set []\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>y. y \<noteq> x) (rev []) = x # rev (takeWhile (\<lambda>y. y \<noteq> x) [])
[PROOF STEP]
qed simp


[STATEMENT]
lemma map_mat_map_vec:
  assumes "i < dim_row P"
  shows "row (map_mat f P) i = map_vec f (row P i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (map_mat f P) i = map_vec f (row P i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row P

goal (1 subgoal):
 1. row (map_mat f P) i = map_vec f (row P i)
[PROOF STEP]
by auto


[STATEMENT]
lemma omap_alt_None: "omap f l = None \<longleftrightarrow> (\<exists>x\<in>set l. f x = None)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (omap f l = None) = (\<exists>x\<in>set l. f x = None)
[PROOF STEP]
apply (induction l)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (omap f [] = None) = (\<exists>x\<in>set []. f x = None)
 2. \<And>a l. (omap f l = None) = (\<exists>x\<in>set l. f x = None) \<Longrightarrow> (omap f (a # l) = None) = (\<exists>x\<in>set (a # l). f x = None)
[PROOF STEP]
apply (auto split: Option.bind_splits)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bounded_linear_axis: "bounded_linear (axis i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear (axis i)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>b1 b2. axis i (b1 + b2) = axis i b1 + axis i b2
 2. \<And>r b. axis i (r *\<^sub>R b) = r *\<^sub>R axis i b
 3. \<exists>K. \<forall>x. norm (axis i x) \<le> norm x * K
[PROOF STEP]
show "axis i (x + y) = axis i x + axis i y" "axis i (r *\<^sub>R x) = r *\<^sub>R axis i x" for x y :: "'a" and r
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. axis i (x + y) = axis i x + axis i y &&& axis i (r *\<^sub>R x) = r *\<^sub>R axis i x
[PROOF STEP]
by (auto simp: vec_eq_iff axis_def)
[PROOF STATE]
proof (state)
this:
axis i (?x + ?y) = axis i ?x + axis i ?y
axis i (?r *\<^sub>R ?x) = ?r *\<^sub>R axis i ?x

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (axis i x) \<le> norm x * K
[PROOF STEP]
show "\<exists>K. \<forall>x::'a. norm (axis i x) \<le> norm x * K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (axis i x) \<le> norm x * K
[PROOF STEP]
by (auto simp add: norm_axis intro!: exI[of _ 1])
[PROOF STATE]
proof (state)
this:
\<exists>K. \<forall>x. norm (axis i x) \<le> norm x * K

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma spanning_subset_independent:
  assumes BA: "B \<subseteq> A"
    and iA: "independent A"
    and AsB: "A \<subseteq> span B"
  shows "A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = B
[PROOF STEP]
proof (intro antisym[OF _ BA] subsetI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<in> B
[PROOF STEP]
have iB: "independent B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. independent B
[PROOF STEP]
using independent_mono [OF iA BA]
[PROOF STATE]
proof (prove)
using this:
independent B

goal (1 subgoal):
 1. independent B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
independent B

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<in> B
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<in> B
[PROOF STEP]
assume "v \<in> A"
[PROOF STATE]
proof (state)
this:
v \<in> A

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<in> B
[PROOF STEP]
with AsB
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> span B
v \<in> A
[PROOF STEP]
have "v \<in> span B"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> span B
v \<in> A

goal (1 subgoal):
 1. v \<in> span B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> span B

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<in> B
[PROOF STEP]
let ?RB = "representation B v" and ?RA = "representation A v"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<in> B
[PROOF STEP]
have "?RB v = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. representation B v v = (1::'a)
[PROOF STEP]
unfolding representation_extend[OF iA \<open>v \<in> span B\<close> BA, symmetric] representation_basis[OF iA \<open>v \<in> A\<close>]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if v = v then 1::'a else (0::'a)) = (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
representation B v v = (1::'a)

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<in> B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
representation B v v = (1::'a)
[PROOF STEP]
show "v \<in> B"
[PROOF STATE]
proof (prove)
using this:
representation B v v = (1::'a)

goal (1 subgoal):
 1. v \<in> B
[PROOF STEP]
using representation_ne_zero[of B v v]
[PROOF STATE]
proof (prove)
using this:
representation B v v = (1::'a)
representation B v v \<noteq> (0::'a) \<Longrightarrow> v \<in> B

goal (1 subgoal):
 1. v \<in> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_superdiagonal:
  "closed {(x,y) | x y. x \<ge> (y::('a::{linorder_topology}))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {(x, y) |x y. y \<le> x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed {(x, y) |x y. y \<le> x}
[PROOF STEP]
have "{(x,y) | x y. x \<ge> (y::'a)} = UNIV - {(x,y) | x y. x < y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, y) |x y. y \<le> x} = UNIV - {(x, y) |x y. x < y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{(x, y) |x y. y \<le> x} = UNIV - {(x, y) |x y. x < y}

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

goal (1 subgoal):
 1. closed {(x, y) |x y. y \<le> x}
[PROOF STEP]
using open_subdiagonal closed_Diff
[PROOF STATE]
proof (prove)
using this:
{(x, y) |x y. y \<le> x} = UNIV - {(x, y) |x y. x < y}
open {(x, y) |x y. x < y}
\<lbrakk>closed ?S; open ?T\<rbrakk> \<Longrightarrow> closed (?S - ?T)

goal (1 subgoal):
 1. closed {(x, y) |x y. y \<le> x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
closed {(x, y) |x y. y \<le> x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma enumerator_length2: "ls \<in> set (enumerator m n) \<Longrightarrow> 2 < m \<Longrightarrow> length ls = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ls \<in> set (enumerator m n); 2 < m\<rbrakk> \<Longrightarrow> |ls| = m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>ls \<in> set (enumerator m n); 2 < m\<rbrakk> \<Longrightarrow> |ls| = m
[PROOF STEP]
assume ls:"ls \<in> set (enumerator m n)" and m: "2 < m"
[PROOF STATE]
proof (state)
this:
ls \<in> set (enumerator m n)
2 < m

goal (1 subgoal):
 1. \<lbrakk>ls \<in> set (enumerator m n); 2 < m\<rbrakk> \<Longrightarrow> |ls| = m
[PROOF STEP]
define k where "k = m - 3"
[PROOF STATE]
proof (state)
this:
k = m - 3

goal (1 subgoal):
 1. \<lbrakk>ls \<in> set (enumerator m n); 2 < m\<rbrakk> \<Longrightarrow> |ls| = m
[PROOF STEP]
with m
[PROOF STATE]
proof (chain)
picking this:
2 < m
k = m - 3
[PROOF STEP]
have k: "m = k + 3"
[PROOF STATE]
proof (prove)
using this:
2 < m
k = m - 3

goal (1 subgoal):
 1. m = k + 3
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
m = k + 3

goal (1 subgoal):
 1. \<lbrakk>ls \<in> set (enumerator m n); 2 < m\<rbrakk> \<Longrightarrow> |ls| = m
[PROOF STEP]
with ls
[PROOF STATE]
proof (chain)
picking this:
ls \<in> set (enumerator m n)
m = k + 3
[PROOF STEP]
have "ls \<in> set (enumerator (k+3) n)"
[PROOF STATE]
proof (prove)
using this:
ls \<in> set (enumerator m n)
m = k + 3

goal (1 subgoal):
 1. ls \<in> set (enumerator (k + 3) n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ls \<in> set (enumerator (k + 3) n)

goal (1 subgoal):
 1. \<lbrakk>ls \<in> set (enumerator m n); 2 < m\<rbrakk> \<Longrightarrow> |ls| = m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ls \<in> set (enumerator (k + 3) n)
[PROOF STEP]
have "length ls = k + 3"
[PROOF STATE]
proof (prove)
using this:
ls \<in> set (enumerator (k + 3) n)

goal (1 subgoal):
 1. |ls| = k + 3
[PROOF STEP]
apply (auto simp: enumerator_def enumBase_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>is. \<lbrakk>is \<in> set ((enumAppend (n - 2) ^^ k) (map (\<lambda>i. [i]) [0..<n - 2] @ [[n - 2]])); ls = 0 # is @ [n - Suc 0]\<rbrakk> \<Longrightarrow> |is| = Suc k
[PROOF STEP]
apply (erule enumAppend_length2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>is l. \<lbrakk>ls = 0 # is @ [n - Suc 0]; l \<in> set (map (\<lambda>i. [i]) [0..<n - 2] @ [[n - 2]])\<rbrakk> \<Longrightarrow> |l| = ?k5 is
 2. \<And>is. ls = 0 # is @ [n - Suc 0] \<Longrightarrow> Suc k = ?k5 is + k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
|ls| = k + 3

goal (1 subgoal):
 1. \<lbrakk>ls \<in> set (enumerator m n); 2 < m\<rbrakk> \<Longrightarrow> |ls| = m
[PROOF STEP]
with k
[PROOF STATE]
proof (chain)
picking this:
m = k + 3
|ls| = k + 3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m = k + 3
|ls| = k + 3

goal (1 subgoal):
 1. |ls| = m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
|ls| = m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tfff_4: assumes dx: "dim_vec x = 4"
  and be: "x $ 0 = True \<and> x $ 1 = False \<and> x $ 2 = False \<and> x $ 3 = False"
  shows "ceros_of_boolean_input x = {1,2,3}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ceros_of_boolean_input x = {1, 2, 3}
[PROOF STEP]
using dx be
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = True \<and> x $ 1 = False \<and> x $ 2 = False \<and> x $ 3 = False

goal (1 subgoal):
 1. ceros_of_boolean_input x = {1, 2, 3}
[PROOF STEP]
unfolding ceros_of_boolean_input_def
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = True \<and> x $ 1 = False \<and> x $ 2 = False \<and> x $ 3 = False

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {1, 2, 3}
[PROOF STEP]
using less_4_cases
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = True \<and> x $ 1 = False \<and> x $ 2 = False \<and> x $ 3 = False
?n < 4 \<Longrightarrow> ?n = 0 \<or> ?n = 1 \<or> ?n = 2 \<or> ?n = 3

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {1, 2, 3}
[PROOF STEP]
by auto


[STATEMENT]
lemma JoinI [intro?]:
  "(\<And>a. a \<in> A \<Longrightarrow> a \<sqsubseteq> sup) \<Longrightarrow>
    (\<And>b. \<forall>a \<in> A. a \<sqsubseteq> b \<Longrightarrow> sup \<sqsubseteq> b) \<Longrightarrow>
    \<Squnion>A = sup"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>a. a \<in> A \<Longrightarrow> a \<sqsubseteq> sup; \<And>b. \<forall>a\<in>A. a \<sqsubseteq> b \<Longrightarrow> sup \<sqsubseteq> b\<rbrakk> \<Longrightarrow> \<Squnion>A = sup
[PROOF STEP]
by (rule Join_equality, rule is_SupI) blast+


[STATEMENT]
lemma all_edges_mono:
  "vs \<subseteq> ws \<Longrightarrow> all_edges vs \<subseteq> all_edges ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vs \<subseteq> ws \<Longrightarrow> all_edges vs \<subseteq> all_edges ws
[PROOF STEP]
unfolding all_edges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vs \<subseteq> ws \<Longrightarrow> {e. e \<subseteq> vs \<and> card e = 2} \<subseteq> {e. e \<subseteq> ws \<and> card e = 2}
[PROOF STEP]
by auto


[STATEMENT]
theorem (in prob_space) strong_law_of_large_numbers_iid:
  fixes X :: "nat \<Rightarrow> 'a \<Rightarrow> real"
  assumes indep: "indep_vars (\<lambda>_. borel) X UNIV"
  assumes distr: "\<And>i. distr M borel (X i) = distr M borel (X 0)"
  assumes L1:    "integrable M (X 0)"
  shows "AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / n) \<longlonglongrightarrow> expectation (X 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
text \<open>
    We adopt a more explicit view of \<^term>\<open>M\<close> as a countably infinite product of i.i.d.
    random variables, indexed by the natural numbers:
  \<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
define M' :: "(nat \<Rightarrow> real) measure" where "M' = Pi\<^sub>M UNIV (\<lambda>i. distr M borel (X i))"
[PROOF STATE]
proof (state)
this:
M' = Pi\<^sub>M UNIV (\<lambda>i. distr M borel (X i))

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
have [measurable]: "random_variable borel (X i)" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_variable borel (X i)
[PROOF STEP]
using indep
[PROOF STATE]
proof (prove)
using this:
indep_vars (\<lambda>_. borel) X UNIV

goal (1 subgoal):
 1. random_variable borel (X i)
[PROOF STEP]
by (auto simp: indep_vars_def)
[PROOF STATE]
proof (state)
this:
random_variable borel (X ?i12)

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
have M'_eq: "M' = distr M (Pi\<^sub>M UNIV (\<lambda>i. borel)) (\<lambda>x. \<lambda>i\<in>UNIV. X i x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M' = distr M (Pi\<^sub>M UNIV (\<lambda>i. borel)) (\<lambda>x. \<lambda>i\<in>UNIV. X i x)
[PROOF STEP]
using indep
[PROOF STATE]
proof (prove)
using this:
indep_vars (\<lambda>_. borel) X UNIV

goal (1 subgoal):
 1. M' = distr M (Pi\<^sub>M UNIV (\<lambda>i. borel)) (\<lambda>x. \<lambda>i\<in>UNIV. X i x)
[PROOF STEP]
unfolding M'_def
[PROOF STATE]
proof (prove)
using this:
indep_vars (\<lambda>_. borel) X UNIV

goal (1 subgoal):
 1. Pi\<^sub>M UNIV (\<lambda>i. distr M borel (X i)) = distr M (Pi\<^sub>M UNIV (\<lambda>i. borel)) (\<lambda>x. \<lambda>i\<in>UNIV. X i x)
[PROOF STEP]
by (subst (asm) indep_vars_iff_distr_eq_PiM) auto
[PROOF STATE]
proof (state)
this:
M' = distr M (Pi\<^sub>M UNIV (\<lambda>i. borel)) (\<lambda>x. \<lambda>i\<in>UNIV. X i x)

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
have space_M': "space M' = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space M' = UNIV
[PROOF STEP]
by (simp add: M'_def space_PiM)
[PROOF STATE]
proof (state)
this:
space M' = UNIV

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
have sets_M' [measurable_cong]: "sets M' = sets (Pi\<^sub>M UNIV (\<lambda>i. borel))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets M' = sets (Pi\<^sub>M UNIV (\<lambda>i. borel))
[PROOF STEP]
by (simp add: M'_eq)
[PROOF STATE]
proof (state)
this:
sets M' = sets (Pi\<^sub>M UNIV (\<lambda>i. borel))

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
interpret M': prob_space M'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space M'
[PROOF STEP]
unfolding M'_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space (distr M (Pi\<^sub>M UNIV (\<lambda>i. borel)) (\<lambda>x. \<lambda>i\<in>UNIV. X i x))
[PROOF STEP]
by (intro prob_space_distr) auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
text \<open>We introduce a shift operator that forgets the first variable in the sequence.\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
define T :: "(nat \<Rightarrow> real) \<Rightarrow> (nat \<Rightarrow> real)" where
    "T = (\<lambda>f. f \<circ> Suc)"
[PROOF STATE]
proof (state)
this:
T = (\<lambda>f. f \<circ> Suc)

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
have funpow_T: "(T ^^ i) = (\<lambda>f. f \<circ> (\<lambda>n. n + i))" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T ^^ i = (\<lambda>f. f \<circ> (\<lambda>n. n + i))
[PROOF STEP]
by (induction i) (auto simp: T_def)
[PROOF STATE]
proof (state)
this:
T ^^ ?i12 = (\<lambda>f. f \<circ> (\<lambda>n. n + ?i12))

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
interpret T: shift_operator_ergodic "distr M borel (X 0)" T M'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. shift_operator_ergodic (distr M borel (X 0)) &&& (T \<equiv> \<lambda>f. f \<circ> Suc) &&& M' \<equiv> Pi\<^sub>M UNIV (\<lambda>_. distr M borel (X 0))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. shift_operator_ergodic (distr M borel (X 0))
 2. T \<equiv> \<lambda>f. f \<circ> Suc
 3. M' \<equiv> Pi\<^sub>M UNIV (\<lambda>_. distr M borel (X 0))
[PROOF STEP]
interpret X0: prob_space "distr M borel (X 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space (distr M borel (X 0))
[PROOF STEP]
by (rule prob_space_distr) auto
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. shift_operator_ergodic (distr M borel (X 0))
 2. T \<equiv> \<lambda>f. f \<circ> Suc
 3. M' \<equiv> Pi\<^sub>M UNIV (\<lambda>_. distr M borel (X 0))
[PROOF STEP]
show "shift_operator_ergodic (distr M borel (X 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. shift_operator_ergodic (distr M borel (X 0))
[PROOF STEP]
by unfold_locales
[PROOF STATE]
proof (state)
this:
shift_operator_ergodic (distr M borel (X 0))

goal (2 subgoals):
 1. T \<equiv> \<lambda>f. f \<circ> Suc
 2. M' \<equiv> Pi\<^sub>M UNIV (\<lambda>_. distr M borel (X 0))
[PROOF STEP]
show "M' \<equiv> Pi\<^sub>M UNIV (\<lambda>_. distr M borel (X 0)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M' \<equiv> Pi\<^sub>M UNIV (\<lambda>_. distr M borel (X 0))
[PROOF STEP]
unfolding M'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pi\<^sub>M UNIV (\<lambda>i. distr M borel (X i)) \<equiv> Pi\<^sub>M UNIV (\<lambda>_. distr M borel (X 0))
[PROOF STEP]
by (subst distr)
[PROOF STATE]
proof (state)
this:
M' \<equiv> Pi\<^sub>M UNIV (\<lambda>_. distr M borel (X 0))

goal (1 subgoal):
 1. T \<equiv> \<lambda>f. f \<circ> Suc
[PROOF STEP]
qed (simp_all add: T_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
have [intro]: "integrable M' (\<lambda>f. f 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M' (\<lambda>f. f 0)
[PROOF STEP]
unfolding M'_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (distr M (Pi\<^sub>M UNIV (\<lambda>i. borel)) (\<lambda>x. \<lambda>i\<in>UNIV. X i x)) (\<lambda>f. f 0)
[PROOF STEP]
by (subst integrable_distr_eq) (use L1 in auto)
[PROOF STATE]
proof (state)
this:
integrable M' (\<lambda>f. f 0)

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
have "AE f in M'. (\<lambda>n. T.birkhoff_sum (\<lambda>f. f 0) n f / real n)
            \<longlonglongrightarrow> real_cond_exp M' T.Invariants (\<lambda>f. f 0) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE f in M'. (\<lambda>n. T.birkhoff_sum (\<lambda>f. f 0) n f / real n) \<longlonglongrightarrow> real_cond_exp M' T.Invariants (\<lambda>f. f 0) f
[PROOF STEP]
by (rule T.birkhoff_theorem_AE_nonergodic) auto
[PROOF STATE]
proof (state)
this:
AE f in M'. (\<lambda>n. T.birkhoff_sum (\<lambda>f. f 0) n f / real n) \<longlonglongrightarrow> real_cond_exp M' T.Invariants (\<lambda>f. f 0) f

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
AE f in M'. (\<lambda>n. T.birkhoff_sum (\<lambda>f. f 0) n f / real n) \<longlonglongrightarrow> real_cond_exp M' T.Invariants (\<lambda>f. f 0) f

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
have "AE x in M'. real_cond_exp M' T.Invariants (\<lambda>f. f 0) x =
                    M'.expectation (\<lambda>f. f 0) / M'.prob (space M')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M'. real_cond_exp M' T.Invariants (\<lambda>f. f 0) x = M'.expectation (\<lambda>f. f 0) / M'.prob (space M')
[PROOF STEP]
by (intro T.Invariants_cond_exp_is_integral_fmpt) auto
[PROOF STATE]
proof (state)
this:
AE x in M'. real_cond_exp M' T.Invariants (\<lambda>f. f 0) x = M'.expectation (\<lambda>f. f 0) / M'.prob (space M')

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
AE f in M'. (\<lambda>n. T.birkhoff_sum (\<lambda>f. f 0) n f / real n) \<longlonglongrightarrow> real_cond_exp M' T.Invariants (\<lambda>f. f 0) f
AE x in M'. real_cond_exp M' T.Invariants (\<lambda>f. f 0) x = M'.expectation (\<lambda>f. f 0) / M'.prob (space M')
[PROOF STEP]
have "AE f in M'. (\<lambda>n. T.birkhoff_sum (\<lambda>f. f 0) n f / real n)
                     \<longlonglongrightarrow> M'.expectation (\<lambda>f. f 0)"
[PROOF STATE]
proof (prove)
using this:
AE f in M'. (\<lambda>n. T.birkhoff_sum (\<lambda>f. f 0) n f / real n) \<longlonglongrightarrow> real_cond_exp M' T.Invariants (\<lambda>f. f 0) f
AE x in M'. real_cond_exp M' T.Invariants (\<lambda>f. f 0) x = M'.expectation (\<lambda>f. f 0) / M'.prob (space M')

goal (1 subgoal):
 1. AE f in M'. (\<lambda>n. T.birkhoff_sum (\<lambda>f. f 0) n f / real n) \<longlonglongrightarrow> M'.expectation (\<lambda>f. f 0)
[PROOF STEP]
by eventually_elim (simp_all add: M'.prob_space)
[PROOF STATE]
proof (state)
this:
AE f in M'. (\<lambda>n. T.birkhoff_sum (\<lambda>f. f 0) n f / real n) \<longlonglongrightarrow> M'.expectation (\<lambda>f. f 0)

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
AE f in M'. (\<lambda>n. T.birkhoff_sum (\<lambda>f. f 0) n f / real n) \<longlonglongrightarrow> M'.expectation (\<lambda>f. f 0)

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
have "M'.expectation (\<lambda>f. f 0) = expectation (X 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M'.expectation (\<lambda>f. f 0) = expectation (X 0)
[PROOF STEP]
unfolding M'_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT f|distr M (Pi\<^sub>M UNIV (\<lambda>i. borel)) (\<lambda>x. \<lambda>i\<in>UNIV. X i x). f 0 = expectation (X 0)
[PROOF STEP]
by (subst integral_distr) simp_all
[PROOF STATE]
proof (state)
this:
M'.expectation (\<lambda>f. f 0) = expectation (X 0)

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M'.expectation (\<lambda>f. f 0) = expectation (X 0)

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
have "T.birkhoff_sum (\<lambda>f. f 0) = (\<lambda>n f. sum f {..<n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T.birkhoff_sum (\<lambda>f. f 0) = (\<lambda>n f. sum f {..<n})
[PROOF STEP]
by (intro ext) (simp_all add:T.birkhoff_sum_def funpow_T)
[PROOF STATE]
proof (state)
this:
T.birkhoff_sum (\<lambda>f. f 0) = (\<lambda>n f. sum f {..<n})

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
AE f in M'. (\<lambda>n. sum f {..<n} / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
AE f in M'. (\<lambda>n. sum f {..<n} / real n) \<longlonglongrightarrow> expectation (X 0)

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
unfolding M'_eq
[PROOF STATE]
proof (prove)
using this:
AE f in distr M (Pi\<^sub>M UNIV (\<lambda>i. borel)) (\<lambda>x. \<lambda>i\<in>UNIV. X i x). (\<lambda>n. sum f {..<n} / real n) \<longlonglongrightarrow> expectation (X 0)

goal (1 subgoal):
 1. AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)
[PROOF STEP]
by (subst (asm) AE_distr_iff) simp_all
[PROOF STATE]
proof (state)
this:
AE x in M. (\<lambda>n. (\<Sum>i<n. X i x) / real n) \<longlonglongrightarrow> expectation (X 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cong_solve_dvd_nat:
  fixes a :: nat
  assumes "gcd a n dvd d"
  shows "\<exists>x. [a * x = d] (mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. [a * x = d] (mod n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. [a * x = d] (mod n)
[PROOF STEP]
from cong_solve_nat [of a]
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. [a * x = gcd a ?n] (mod ?n)
[PROOF STEP]
obtain x where "[a * x = gcd a n](mod n)"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. [a * x = gcd a ?n] (mod ?n)

goal (1 subgoal):
 1. (\<And>x. [a * x = gcd a n] (mod n) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[a * x = gcd a n] (mod n)

goal (1 subgoal):
 1. \<exists>x. [a * x = d] (mod n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[a * x = gcd a n] (mod n)
[PROOF STEP]
have "[(d div gcd a n) * (a * x) = (d div gcd a n) * gcd a n] (mod n)"
[PROOF STATE]
proof (prove)
using this:
[a * x = gcd a n] (mod n)

goal (1 subgoal):
 1. [d div gcd a n * (a * x) = d div gcd a n * gcd a n] (mod n)
[PROOF STEP]
using cong_scalar_left
[PROOF STATE]
proof (prove)
using this:
[a * x = gcd a n] (mod n)
[?b = ?c] (mod ?a) \<Longrightarrow> [?d * ?b = ?d * ?c] (mod ?a)

goal (1 subgoal):
 1. [d div gcd a n * (a * x) = d div gcd a n * gcd a n] (mod n)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[d div gcd a n * (a * x) = d div gcd a n * gcd a n] (mod n)

goal (1 subgoal):
 1. \<exists>x. [a * x = d] (mod n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[d div gcd a n * (a * x) = d div gcd a n * gcd a n] (mod n)

goal (1 subgoal):
 1. \<exists>x. [a * x = d] (mod n)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
gcd a n dvd d
[PROOF STEP]
have "(d div gcd a n) * gcd a n = d"
[PROOF STATE]
proof (prove)
using this:
gcd a n dvd d

goal (1 subgoal):
 1. d div gcd a n * gcd a n = d
[PROOF STEP]
by (rule dvd_div_mult_self)
[PROOF STATE]
proof (state)
this:
d div gcd a n * gcd a n = d

goal (1 subgoal):
 1. \<exists>x. [a * x = d] (mod n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
d div gcd a n * gcd a n = d

goal (1 subgoal):
 1. \<exists>x. [a * x = d] (mod n)
[PROOF STEP]
have "(d div gcd a n) * (a * x) = a * (d div gcd a n * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d div gcd a n * (a * x) = a * (d div gcd a n * x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d div gcd a n * (a * x) = a * (d div gcd a n * x)

goal (1 subgoal):
 1. \<exists>x. [a * x = d] (mod n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[a * (d div gcd a n * x) = d] (mod n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[a * (d div gcd a n * x) = d] (mod n)

goal (1 subgoal):
 1. \<exists>x. [a * x = d] (mod n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x. [a * x = d] (mod n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nonzero_pow_res:
  assumes "x \<in> nonzero Q\<^sub>p"
  shows "pow_res (n::nat) x \<subseteq> nonzero Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pow_res n x \<subseteq> nonzero Q\<^sub>p
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> pow_res n x \<Longrightarrow> xa \<in> nonzero Q\<^sub>p
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> pow_res n x \<Longrightarrow> xa \<in> nonzero Q\<^sub>p
[PROOF STEP]
assume "a \<in> pow_res n x"
[PROOF STATE]
proof (state)
this:
a \<in> pow_res n x

goal (1 subgoal):
 1. \<And>xa. xa \<in> pow_res n x \<Longrightarrow> xa \<in> nonzero Q\<^sub>p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> pow_res n x
[PROOF STEP]
obtain y where y_def: "y \<in> nonzero Q\<^sub>p \<and> (a = x \<otimes> (y[^]n))"
[PROOF STATE]
proof (prove)
using this:
a \<in> pow_res n x

goal (1 subgoal):
 1. (\<And>y. y \<in> nonzero Q\<^sub>p \<and> a = x \<otimes> y [^] n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using pow_res_def
[PROOF STATE]
proof (prove)
using this:
a \<in> pow_res n x
pow_res ?n ?x = {a \<in> carrier Q\<^sub>p. \<exists>y\<in>nonzero Q\<^sub>p. a = ?x \<otimes> y [^] ?n}

goal (1 subgoal):
 1. (\<And>y. y \<in> nonzero Q\<^sub>p \<and> a = x \<otimes> y [^] n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y \<in> nonzero Q\<^sub>p \<and> a = x \<otimes> y [^] n

goal (1 subgoal):
 1. \<And>xa. xa \<in> pow_res n x \<Longrightarrow> xa \<in> nonzero Q\<^sub>p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> nonzero Q\<^sub>p \<and> a = x \<otimes> y [^] n
[PROOF STEP]
show "a \<in> nonzero Q\<^sub>p"
[PROOF STATE]
proof (prove)
using this:
y \<in> nonzero Q\<^sub>p \<and> a = x \<otimes> y [^] n

goal (1 subgoal):
 1. a \<in> nonzero Q\<^sub>p
[PROOF STEP]
using assms Qp.Units_m_closed Qp_nat_pow_nonzero Units_eq_nonzero
[PROOF STATE]
proof (prove)
using this:
y \<in> nonzero Q\<^sub>p \<and> a = x \<otimes> y [^] n
x \<in> nonzero Q\<^sub>p
\<lbrakk>?x \<in> Units Q\<^sub>p; ?y \<in> Units Q\<^sub>p\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y \<in> Units Q\<^sub>p
?x \<in> nonzero Q\<^sub>p \<Longrightarrow> ?x [^] ?n \<in> nonzero Q\<^sub>p
Units Q\<^sub>p = nonzero Q\<^sub>p

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma monic_monom_smult:
  assumes "a \<in> carrier R"
  shows "a \<odot>\<^bsub>P\<^esub> monom P \<one> n = monom P a n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<odot>\<^bsub>P\<^esub> monom P \<one> n = monom P a n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R

goal (1 subgoal):
 1. a \<odot>\<^bsub>P\<^esub> monom P \<one> n = monom P a n
[PROOF STEP]
by (metis R.one_closed R.r_one monom_mult_smult)


[STATEMENT]
lemma lists_of_len_fin2: "finite P \<Longrightarrow> finite (lists P \<inter> { l. n = length l })"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite P \<Longrightarrow> finite (lists P \<inter> {l. n = length l})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite P \<Longrightarrow> finite (lists P \<inter> {l. n = length l})
[PROOF STEP]
assume A: "finite P"
[PROOF STATE]
proof (state)
this:
finite P

goal (1 subgoal):
 1. finite P \<Longrightarrow> finite (lists P \<inter> {l. n = length l})
[PROOF STEP]
have S: "{ l. n = length l } = { l. length l = n }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {l. n = length l} = {l. length l = n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{l. n = length l} = {l. length l = n}

goal (1 subgoal):
 1. finite P \<Longrightarrow> finite (lists P \<inter> {l. n = length l})
[PROOF STEP]
have "finite (lists P \<inter> { l. n = length l })
      \<longleftrightarrow> finite (lists P \<inter> { l. length l = n })"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (lists P \<inter> {l. n = length l}) = finite (lists P \<inter> {l. length l = n})
[PROOF STEP]
by (subst S) simp
[PROOF STATE]
proof (state)
this:
finite (lists P \<inter> {l. n = length l}) = finite (lists P \<inter> {l. length l = n})

goal (1 subgoal):
 1. finite P \<Longrightarrow> finite (lists P \<inter> {l. n = length l})
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (lists P \<inter> {l. n = length l}) = finite (lists P \<inter> {l. length l = n})

goal (1 subgoal):
 1. finite (lists P \<inter> {l. n = length l})
[PROOF STEP]
using lists_of_len_fin1[OF A]
[PROOF STATE]
proof (prove)
using this:
finite (lists P \<inter> {l. n = length l}) = finite (lists P \<inter> {l. length l = n})
finite (lists P \<inter> {l. length l = ?n})

goal (1 subgoal):
 1. finite (lists P \<inter> {l. n = length l})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (lists P \<inter> {l. n = length l})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma min_union_empty[simp]:
  "A \<union>\<^sub>m {} = min_set A"
  "{} \<union>\<^sub>m A = min_set A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<union>\<^sub>m {} = min_set A &&& {} \<union>\<^sub>m A = min_set A
[PROOF STEP]
by (simp_all add: min_union_def)


[STATEMENT]
lemma onorm_scaleR_left:
  assumes f: "bounded_linear r"
  shows "onorm (\<lambda>x. r x *\<^sub>R f) = onorm r * norm f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. r x *\<^sub>R f) = onorm r * norm f
[PROOF STEP]
proof (cases "f = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f = (0::'b) \<Longrightarrow> onorm (\<lambda>x. r x *\<^sub>R f) = onorm r * norm f
 2. f \<noteq> (0::'b) \<Longrightarrow> onorm (\<lambda>x. r x *\<^sub>R f) = onorm r * norm f
[PROOF STEP]
assume "f \<noteq> 0"
[PROOF STATE]
proof (state)
this:
f \<noteq> (0::'b)

goal (2 subgoals):
 1. f = (0::'b) \<Longrightarrow> onorm (\<lambda>x. r x *\<^sub>R f) = onorm r * norm f
 2. f \<noteq> (0::'b) \<Longrightarrow> onorm (\<lambda>x. r x *\<^sub>R f) = onorm r * norm f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. r x *\<^sub>R f) = onorm r * norm f
[PROOF STEP]
proof (rule order_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. onorm (\<lambda>x. r x *\<^sub>R f) \<le> onorm r * norm f
 2. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>R f)
[PROOF STEP]
show "onorm (\<lambda>x. r x *\<^sub>R f) \<le> onorm r * norm f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. r x *\<^sub>R f) \<le> onorm r * norm f
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
bounded_linear r

goal (1 subgoal):
 1. onorm (\<lambda>x. r x *\<^sub>R f) \<le> onorm r * norm f
[PROOF STEP]
by (rule onorm_scaleR_left_lemma)
[PROOF STATE]
proof (state)
this:
onorm (\<lambda>x. r x *\<^sub>R f) \<le> onorm r * norm f

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>R f)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>R f)
[PROOF STEP]
have bl1: "bounded_linear (\<lambda>x. r x *\<^sub>R f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear (\<lambda>x. r x *\<^sub>R f)
[PROOF STEP]
by (metis bounded_linear_scaleR_const f)
[PROOF STATE]
proof (state)
this:
bounded_linear (\<lambda>x. r x *\<^sub>R f)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>R f)
[PROOF STEP]
have "bounded_linear (\<lambda>x. r x * norm f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear (\<lambda>x. r x * norm f)
[PROOF STEP]
by (metis bounded_linear_mult_const f)
[PROOF STATE]
proof (state)
this:
bounded_linear (\<lambda>x. r x * norm f)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>R f)
[PROOF STEP]
from onorm_scaleR_left_lemma[OF this, of "inverse (norm f)"]
[PROOF STATE]
proof (chain)
picking this:
onorm (\<lambda>x. (r x * norm f) *\<^sub>R inverse (norm f)) \<le> onorm (\<lambda>x. r x * norm f) * norm (inverse (norm f))
[PROOF STEP]
have "onorm r \<le> onorm (\<lambda>x. r x * norm f) * inverse (norm f)"
[PROOF STATE]
proof (prove)
using this:
onorm (\<lambda>x. (r x * norm f) *\<^sub>R inverse (norm f)) \<le> onorm (\<lambda>x. r x * norm f) * norm (inverse (norm f))

goal (1 subgoal):
 1. onorm r \<le> onorm (\<lambda>x. r x * norm f) * inverse (norm f)
[PROOF STEP]
using \<open>f \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
onorm (\<lambda>x. (r x * norm f) *\<^sub>R inverse (norm f)) \<le> onorm (\<lambda>x. r x * norm f) * norm (inverse (norm f))
f \<noteq> (0::'b)

goal (1 subgoal):
 1. onorm r \<le> onorm (\<lambda>x. r x * norm f) * inverse (norm f)
[PROOF STEP]
by (simp add: inverse_eq_divide)
[PROOF STATE]
proof (state)
this:
onorm r \<le> onorm (\<lambda>x. r x * norm f) * inverse (norm f)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>R f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
onorm r \<le> onorm (\<lambda>x. r x * norm f) * inverse (norm f)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>R f)
[PROOF STEP]
have "onorm (\<lambda>x. r x * norm f) \<le> onorm (\<lambda>x. r x *\<^sub>R f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. r x * norm f) \<le> onorm (\<lambda>x. r x *\<^sub>R f)
[PROOF STEP]
by (rule onorm_bound)
        (auto simp: abs_mult bl1 onorm_pos_le intro!: order_trans[OF _ onorm])
[PROOF STATE]
proof (state)
this:
onorm (\<lambda>x. r x * norm f) \<le> onorm (\<lambda>x. r x *\<^sub>R f)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>R f)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> x * inverse (norm f) \<le> y * inverse (norm f)) \<Longrightarrow> onorm r \<le> onorm (\<lambda>x. r x *\<^sub>R f) * inverse (norm f)
[PROOF STEP]
show "onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>R f)"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> x * inverse (norm f) \<le> y * inverse (norm f)) \<Longrightarrow> onorm r \<le> onorm (\<lambda>x. r x *\<^sub>R f) * inverse (norm f)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>R f)
[PROOF STEP]
using \<open>f \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> x * inverse (norm f) \<le> y * inverse (norm f)) \<Longrightarrow> onorm r \<le> onorm (\<lambda>x. r x *\<^sub>R f) * inverse (norm f)
f \<noteq> (0::'b)

goal (1 subgoal):
 1. onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>R f)
[PROOF STEP]
by (simp add: inverse_eq_divide pos_le_divide_eq mult.commute)
[PROOF STATE]
proof (state)
this:
onorm r * norm f \<le> onorm (\<lambda>x. r x *\<^sub>R f)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
onorm (\<lambda>x. r x *\<^sub>R f) = onorm r * norm f

goal (1 subgoal):
 1. f = (0::'b) \<Longrightarrow> onorm (\<lambda>x. r x *\<^sub>R f) = onorm r * norm f
[PROOF STEP]
qed (simp add: onorm_zero)


[STATEMENT]
lemma dim_solution_set_not_zero_imp_infinite_solutions_no_homogeneous:
fixes A::"'a::{field, semiring_char_0}^'n::{mod_type}^'rows::{mod_type}"
assumes dim_not_0: "vec.dim (solution_set A 0) > 0"
and con: "consistent A b"
shows "infinite (solution_set A b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite (solution_set A b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite (solution_set A b)
[PROOF STEP]
have "solution_set A 0 \<noteq> {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. solution_set A 0 \<noteq> {0}
[PROOF STEP]
using vec.dim_zero_subspace_eq[of "solution_set A 0"] dim_not_0
[PROOF STATE]
proof (prove)
using this:
vec.subspace (solution_set A 0) \<Longrightarrow> (vec.dim (solution_set A 0) = 0) = (solution_set A 0 = {0})
0 < vec.dim (solution_set A 0)

goal (1 subgoal):
 1. solution_set A 0 \<noteq> {0}
[PROOF STEP]
by (metis less_numeral_extra(3) vec.dim_zero_eq')
[PROOF STATE]
proof (state)
this:
solution_set A 0 \<noteq> {0}

goal (1 subgoal):
 1. infinite (solution_set A b)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
solution_set A 0 \<noteq> {0}
[PROOF STEP]
obtain x where x: "x \<in> solution_set A 0" and x_not_0: "x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
solution_set A 0 \<noteq> {0}

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> solution_set A 0; x \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using vec.subspace_0[OF homogeneous_solution_set_subspace, of A]
[PROOF STATE]
proof (prove)
using this:
solution_set A 0 \<noteq> {0}
0 \<in> solution_set A 0

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> solution_set A 0; x \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> solution_set A 0
x \<noteq> 0

goal (1 subgoal):
 1. infinite (solution_set A b)
[PROOF STEP]
obtain y where y: "is_solution y A b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y. is_solution y A b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using con
[PROOF STATE]
proof (prove)
using this:
consistent A b

goal (1 subgoal):
 1. (\<And>y. is_solution y A b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding consistent_def
[PROOF STATE]
proof (prove)
using this:
\<exists>x. is_solution x A b

goal (1 subgoal):
 1. (\<And>y. is_solution y A b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_solution y A b

goal (1 subgoal):
 1. infinite (solution_set A b)
[PROOF STEP]
define f where "f = (\<lambda>n::nat. y + (of_nat n) *s x)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>n. y + of_nat n *s x)

goal (1 subgoal):
 1. infinite (solution_set A b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite (solution_set A b)
[PROOF STEP]
proof (unfold infinite_iff_countable_subset, rule exI[of _ f], rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj f
 2. range f \<subseteq> solution_set A b
[PROOF STEP]
show "inj f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj f
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. \<forall>y\<in>UNIV. f x = f y \<longrightarrow> x = y
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xa\<in>UNIV. \<forall>ya\<in>UNIV. y + of_nat xa *s x = y + of_nat ya *s x \<longrightarrow> xa = ya
[PROOF STEP]
using x_not_0
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0

goal (1 subgoal):
 1. \<forall>xa\<in>UNIV. \<forall>ya\<in>UNIV. y + of_nat xa *s x = y + of_nat ya *s x \<longrightarrow> xa = ya
[PROOF STEP]
by (auto simp: vec_eq_iff)
[PROOF STATE]
proof (state)
this:
inj f

goal (1 subgoal):
 1. range f \<subseteq> solution_set A b
[PROOF STEP]
show "range f \<subseteq> solution_set A b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range f \<subseteq> solution_set A b
[PROOF STEP]
unfolding solution_set_rel[OF y]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range f \<subseteq> {y} + solution_set A 0
[PROOF STEP]
using homogeneous_solution_set_subspace
[PROOF STATE]
proof (prove)
using this:
vec.subspace (solution_set ?A 0)

goal (1 subgoal):
 1. range f \<subseteq> {y} + solution_set A 0
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
vec.subspace (solution_set ?A 0)
x \<in> solution_set A 0

goal (1 subgoal):
 1. range f \<subseteq> {y} + solution_set A 0
[PROOF STEP]
unfolding vec.subspace_def image_def f_def
[PROOF STATE]
proof (prove)
using this:
0 \<in> solution_set ?A 0 \<and> (\<forall>x\<in>solution_set ?A 0. \<forall>y\<in>solution_set ?A 0. x + y \<in> solution_set ?A 0) \<and> (\<forall>c. \<forall>x\<in>solution_set ?A 0. c *s x \<in> solution_set ?A 0)
x \<in> solution_set A 0

goal (1 subgoal):
 1. {ya. \<exists>xa\<in>UNIV. ya = y + of_nat xa *s x} \<subseteq> {y} + solution_set A 0
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
range f \<subseteq> solution_set A b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
infinite (solution_set A b)

goal:
No subgoals!
[PROOF STEP]
qed