[STATEMENT]
lemma cindex_path_reversepath:
  "cindex_path (reversepath g) z = - cindex_path g z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_path (reversepath g) z = - cindex_path g z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_path (reversepath g) z = - cindex_path g z
[PROOF STEP]
define f where "f=(\<lambda>t. Im (g t - z) / Re (g t - z))"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>t. Im (g t - z) / Re (g t - z))

goal (1 subgoal):
 1. cindex_path (reversepath g) z = - cindex_path g z
[PROOF STEP]
define f' where "f'=(\<lambda>t. Im (reversepath g t - z) / Re (reversepath g t - z))"
[PROOF STATE]
proof (state)
this:
f' = (\<lambda>t. Im (reversepath g t - z) / Re (reversepath g t - z))

goal (1 subgoal):
 1. cindex_path (reversepath g) z = - cindex_path g z
[PROOF STEP]
have "f o (\<lambda>t. 1 - t) = f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> (-) 1 = f'
[PROOF STEP]
unfolding f_def f'_def comp_def reversepath_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. Im (g (1 - x) - z) / Re (g (1 - x) - z)) = (\<lambda>t. Im (g (1 - t) - z) / Re (g (1 - t) - z))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f \<circ> (-) 1 = f'

goal (1 subgoal):
 1. cindex_path (reversepath g) z = - cindex_path g z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f \<circ> (-) 1 = f'
[PROOF STEP]
have "cindex 0 1 f' = - cindex 0 1 f"
[PROOF STATE]
proof (prove)
using this:
f \<circ> (-) 1 = f'

goal (1 subgoal):
 1. cindex 0 1 f' = - cindex 0 1 f
[PROOF STEP]
using cindex_linear_comp[of "-1" 0 1 f 1,simplified]
[PROOF STATE]
proof (prove)
using this:
f \<circ> (-) 1 = f'
cindex 0 1 (f \<circ> (-) 1) = - cindex 0 1 f

goal (1 subgoal):
 1. cindex 0 1 f' = - cindex 0 1 f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cindex 0 1 f' = - cindex 0 1 f

goal (1 subgoal):
 1. cindex_path (reversepath g) z = - cindex_path g z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cindex 0 1 f' = - cindex 0 1 f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cindex 0 1 f' = - cindex 0 1 f

goal (1 subgoal):
 1. cindex_path (reversepath g) z = - cindex_path g z
[PROOF STEP]
unfolding cindex_path_def
[PROOF STATE]
proof (prove)
using this:
cindex 0 1 f' = - cindex 0 1 f

goal (1 subgoal):
 1. cindex 0 1 (\<lambda>t. Im (reversepath g t - z) / Re (reversepath g t - z)) = - cindex 0 1 (\<lambda>t. Im (g t - z) / Re (g t - z))
[PROOF STEP]
apply (fold f_def f'_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex 0 1 f' = - cindex 0 1 f \<Longrightarrow> cindex 0 1 f' = - cindex 0 1 f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cindex_path (reversepath g) z = - cindex_path g z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lambert_W_times_exp_self:
  assumes "x \<ge> -exp (-1)"
  shows   "Lambert_W x * exp (Lambert_W x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lambert_W x * exp (Lambert_W x) = x
[PROOF STEP]
using theI'[OF Lambert_W_ex1[OF assms]] assms
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> (THE xa. - 1 \<le> xa \<and> xa * exp xa = x) \<and> (THE xa. - 1 \<le> xa \<and> xa * exp xa = x) * exp (THE xa. - 1 \<le> xa \<and> xa * exp xa = x) = x
- exp (- 1) \<le> x

goal (1 subgoal):
 1. Lambert_W x * exp (Lambert_W x) = x
[PROOF STEP]
by (auto simp: Lambert_W_def)


[STATEMENT]
lemma not_cong_1243:
  assumes "\<not> Cong A B C D"
  shows "\<not> Cong A B D C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> Cong A B D C
[PROOF STEP]
using assms cong_right_commutativity
[PROOF STATE]
proof (prove)
using this:
\<not> Cong A B C D
Cong ?A ?B ?C ?D \<Longrightarrow> Cong ?A ?B ?D ?C

goal (1 subgoal):
 1. \<not> Cong A B D C
[PROOF STEP]
by blast


[STATEMENT]
lemma bigtheta_sym: "f \<in> \<Theta>[F](g) \<longleftrightarrow> g \<in> \<Theta>[F](f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> \<Theta>[F](g)) = (g \<in> \<Theta>[F](f))
[PROOF STEP]
unfolding bigtheta_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> O[F](g) \<inter> \<Omega>[F](g)) = (g \<in> O[F](f) \<inter> \<Omega>[F](f))
[PROOF STEP]
by (auto simp: bigomega_iff_bigo)


[STATEMENT]
lemma  dep_var_set_self_empty:
  fixes PROB vs
  assumes "dep_var_set PROB vs vs"
  shows "(vs = {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vs = {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dep_var_set PROB vs vs

goal (1 subgoal):
 1. vs = {}
[PROOF STEP]
unfolding dep_var_set_def
[PROOF STATE]
proof (prove)
using this:
disjnt vs vs \<and> (\<exists>v1 v2. v1 \<in> vs \<and> v2 \<in> vs \<and> dep PROB v1 v2)

goal (1 subgoal):
 1. vs = {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. disjnt vs vs \<and> (\<exists>v1 v2. v1 \<in> vs \<and> v2 \<in> vs \<and> dep PROB v1 v2) \<Longrightarrow> vs = {}
[PROOF STEP]
obtain v1 v2 where
    "v1 \<in> vs" "v2 \<in> vs" "disjnt vs vs" "dep PROB v1 v2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v1 v2. \<lbrakk>v1 \<in> vs; v2 \<in> vs; disjnt vs vs; dep PROB v1 v2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dep_var_set PROB vs vs

goal (1 subgoal):
 1. (\<And>v1 v2. \<lbrakk>v1 \<in> vs; v2 \<in> vs; disjnt vs vs; dep PROB v1 v2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding dep_var_set_def
[PROOF STATE]
proof (prove)
using this:
disjnt vs vs \<and> (\<exists>v1 v2. v1 \<in> vs \<and> v2 \<in> vs \<and> dep PROB v1 v2)

goal (1 subgoal):
 1. (\<And>v1 v2. \<lbrakk>v1 \<in> vs; v2 \<in> vs; disjnt vs vs; dep PROB v1 v2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
v1 \<in> vs
v2 \<in> vs
disjnt vs vs
dep PROB v1 v2

goal (1 subgoal):
 1. disjnt vs vs \<and> (\<exists>v1 v2. v1 \<in> vs \<and> v2 \<in> vs \<and> dep PROB v1 v2) \<Longrightarrow> vs = {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v1 \<in> vs
v2 \<in> vs
disjnt vs vs
dep PROB v1 v2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
v1 \<in> vs
v2 \<in> vs
disjnt vs vs
dep PROB v1 v2

goal (1 subgoal):
 1. vs = {}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
vs = {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem fst_sort_and_count_inversions [simp]:
  "fst (sort_and_count_inversions xs) = merge_sort xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (sort_and_count_inversions xs) = merge_sort xs
[PROOF STEP]
by (induction xs rule: length_induct)
     (subst sort_and_count_inversions.simps, subst merge_sort.simps,
      simp_all add: split_list_def case_prod_unfold Let_def)


[STATEMENT]
lemma less_vec_lesseq_vec: "v <\<^sub>v (w :: 'a :: preorder vec) \<Longrightarrow> v \<le> w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v <\<^sub>v w \<Longrightarrow> v \<le> w
[PROOF STEP]
unfolding less_vec_def less_eq_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec v = dim_vec w \<and> (\<forall>i<dim_vec w. v $ i < w $ i) \<Longrightarrow> dim_vec v = dim_vec w \<and> (\<forall>i<dim_vec w. v $ i \<le> w $ i)
[PROOF STEP]
by (auto simp: less_le_not_le)


[STATEMENT]
lemma space_2_pow_bound:  assumes "invar_vebt t n " shows "real (space' t) \<le> 12 * (2^n -1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (space' t) \<le> 12 * (2 ^ n - 1)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (space' t) \<le> 12 * (2 ^ n - 1)
[PROOF STEP]
have "space' t \<le> 6 * cnt t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (space' t) \<le> 6 * cnt t
[PROOF STEP]
using space_cnt[of t] assms
[PROOF STATE]
proof (prove)
using this:
real (space' t) \<le> 6 * cnt t
invar_vebt t n

goal (1 subgoal):
 1. real (space' t) \<le> 6 * cnt t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (space' t) \<le> 6 * cnt t

goal (1 subgoal):
 1. real (space' t) \<le> 12 * (2 ^ n - 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (space' t) \<le> 6 * cnt t

goal (1 subgoal):
 1. real (space' t) \<le> 12 * (2 ^ n - 1)
[PROOF STEP]
have "6 * cnt t \<le> 12 * (2^n -1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 6 * cnt t \<le> 12 * (2 ^ n - 1)
[PROOF STEP]
using cnt_bound'[of t n]  assms
[PROOF STATE]
proof (prove)
using this:
invar_vebt t n \<Longrightarrow> cnt t \<le> 2 * (2 ^ n - 1)
invar_vebt t n

goal (1 subgoal):
 1. 6 * cnt t \<le> 12 * (2 ^ n - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
6 * cnt t \<le> 12 * (2 ^ n - 1)

goal (1 subgoal):
 1. real (space' t) \<le> 12 * (2 ^ n - 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real (space' t) \<le> 6 * cnt t
6 * cnt t \<le> 12 * (2 ^ n - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (space' t) \<le> 6 * cnt t
6 * cnt t \<le> 12 * (2 ^ n - 1)

goal (1 subgoal):
 1. real (space' t) \<le> 12 * (2 ^ n - 1)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real (space' t) \<le> 12 * (2 ^ n - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_list_prod_map2 :
  "(\<Sum>(a,y)\<leftarrow>zip as (map f bs). g a y) = (\<Sum>(a,b)\<leftarrow>zip as bs. g a (f b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map2 g as (map f bs)) = sum_list (map2 (\<lambda>a b. g a (f b)) as bs)
[PROOF STEP]
by (induct as bs rule: list_induct2') auto


[STATEMENT]
lemma to_fun_ctrm:
  assumes "f \<in> carrier P"
  assumes  "b \<in> carrier R"
  shows "to_fun (ctrm f) b = (f 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (monom P (f 0) 0) b = f 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier P
b \<in> carrier R

goal (1 subgoal):
 1. to_fun (monom P (f 0) 0) b = f 0
[PROOF STEP]
by (metis ctrm_degree ctrm_is_poly lcf_monom(2) P_def cfs_closed to_fun_to_poly to_poly_inverse)


[STATEMENT]
lemma measure_scale_measure [simp]: "0 \<le> r \<Longrightarrow> measure (scale_measure r M) A = r * measure M A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> r \<Longrightarrow> Sigma_Algebra.measure (scale_measure (ennreal r) M) A = r * Sigma_Algebra.measure M A
[PROOF STEP]
using emeasure_scale_measure[of r M A]
    emeasure_eq_ennreal_measure[of M A]
    measure_eq_emeasure_eq_ennreal[of _ "scale_measure r M" A]
[PROOF STATE]
proof (prove)
using this:
emeasure (scale_measure (ennreal r) M) A = ennreal r * emeasure M A
emeasure M A \<noteq> top \<Longrightarrow> emeasure M A = ennreal (Sigma_Algebra.measure M A)
\<lbrakk>0 \<le> ?x; emeasure (scale_measure (ennreal r) M) A = ennreal ?x\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure (scale_measure (ennreal r) M) A = ?x

goal (1 subgoal):
 1. 0 \<le> r \<Longrightarrow> Sigma_Algebra.measure (scale_measure (ennreal r) M) A = r * Sigma_Algebra.measure M A
[PROOF STEP]
by (cases "emeasure (scale_measure r M) A = top")
     (auto simp del: emeasure_scale_measure
           simp: ennreal_top_eq_mult_iff ennreal_mult_eq_top_iff measure_zero_top ennreal_mult[symmetric])


[STATEMENT]
lemma unit_disc_fix_f_comp [simp]:
  assumes "unit_disc_fix_f f1" and "unit_disc_fix_f f2"
  shows "unit_disc_fix_f (f1 \<circ> f2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_disc_fix_f (f1 \<circ> f2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
unit_disc_fix_f f1
unit_disc_fix_f f2

goal (1 subgoal):
 1. unit_disc_fix_f (f1 \<circ> f2)
[PROOF STEP]
apply (subst (asm) unit_disc_fix_f_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>M. unit_disc_fix M \<and> (f1 = moebius_pt M \<or> f1 = moebius_pt M \<circ> conjugate); unit_disc_fix_f f2\<rbrakk> \<Longrightarrow> unit_disc_fix_f (f1 \<circ> f2)
[PROOF STEP]
apply (subst (asm) unit_disc_fix_f_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>M. unit_disc_fix M \<and> (f1 = moebius_pt M \<or> f1 = moebius_pt M \<circ> conjugate); \<exists>M. unit_disc_fix M \<and> (f2 = moebius_pt M \<or> f2 = moebius_pt M \<circ> conjugate)\<rbrakk> \<Longrightarrow> unit_disc_fix_f (f1 \<circ> f2)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> moebius_pt Ma)
 2. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> (moebius_pt Ma \<circ> conjugate))
 3. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt Ma)
 4. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
fix M M'
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> moebius_pt Ma)
 2. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> (moebius_pt Ma \<circ> conjugate))
 3. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt Ma)
 4. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
assume "unit_disc_fix M" "unit_disc_fix M'"
[PROOF STATE]
proof (state)
this:
unit_disc_fix M
unit_disc_fix M'

goal (4 subgoals):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> moebius_pt Ma)
 2. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> (moebius_pt Ma \<circ> conjugate))
 3. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt Ma)
 4. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
thus "unit_disc_fix_f (moebius_pt M \<circ> moebius_pt M')"
[PROOF STATE]
proof (prove)
using this:
unit_disc_fix M
unit_disc_fix M'

goal (1 subgoal):
 1. unit_disc_fix_f (moebius_pt M \<circ> moebius_pt M')
[PROOF STEP]
unfolding unit_disc_fix_f_def
[PROOF STATE]
proof (prove)
using this:
unit_disc_fix M
unit_disc_fix M'

goal (1 subgoal):
 1. \<exists>Ma. unit_disc_fix Ma \<and> (moebius_pt M \<circ> moebius_pt M' = moebius_pt Ma \<or> moebius_pt M \<circ> moebius_pt M' = moebius_pt Ma \<circ> conjugate)
[PROOF STEP]
by (rule_tac x="M + M'" in exI) auto
[PROOF STATE]
proof (state)
this:
unit_disc_fix_f (moebius_pt M \<circ> moebius_pt M')

goal (3 subgoals):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> (moebius_pt Ma \<circ> conjugate))
 2. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt Ma)
 3. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> (moebius_pt Ma \<circ> conjugate))
 2. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt Ma)
 3. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
fix M M'
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> (moebius_pt Ma \<circ> conjugate))
 2. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt Ma)
 3. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
assume "unit_disc_fix M" "unit_disc_fix M'"
[PROOF STATE]
proof (state)
this:
unit_disc_fix M
unit_disc_fix M'

goal (3 subgoals):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> (moebius_pt Ma \<circ> conjugate))
 2. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt Ma)
 3. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
thus "unit_disc_fix_f (moebius_pt M \<circ> (moebius_pt M' \<circ> conjugate))"
[PROOF STATE]
proof (prove)
using this:
unit_disc_fix M
unit_disc_fix M'

goal (1 subgoal):
 1. unit_disc_fix_f (moebius_pt M \<circ> (moebius_pt M' \<circ> conjugate))
[PROOF STEP]
unfolding unit_disc_fix_f_def
[PROOF STATE]
proof (prove)
using this:
unit_disc_fix M
unit_disc_fix M'

goal (1 subgoal):
 1. \<exists>Ma. unit_disc_fix Ma \<and> (moebius_pt M \<circ> (moebius_pt M' \<circ> conjugate) = moebius_pt Ma \<or> moebius_pt M \<circ> (moebius_pt M' \<circ> conjugate) = moebius_pt Ma \<circ> conjugate)
[PROOF STEP]
by (subst comp_assoc[symmetric])+
       (rule_tac x="M + M'" in exI, auto)
[PROOF STATE]
proof (state)
this:
unit_disc_fix_f (moebius_pt M \<circ> (moebius_pt M' \<circ> conjugate))

goal (2 subgoals):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt Ma)
 2. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt Ma)
 2. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
fix M M'
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt Ma)
 2. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
assume "unit_disc_fix M" "unit_disc_fix M'"
[PROOF STATE]
proof (state)
this:
unit_disc_fix M
unit_disc_fix M'

goal (2 subgoals):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt Ma)
 2. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
thus "unit_disc_fix_f ((moebius_pt M \<circ> conjugate) \<circ> moebius_pt M')"
[PROOF STATE]
proof (prove)
using this:
unit_disc_fix M
unit_disc_fix M'

goal (1 subgoal):
 1. unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt M')
[PROOF STEP]
unfolding unit_disc_fix_f_def
[PROOF STATE]
proof (prove)
using this:
unit_disc_fix M
unit_disc_fix M'

goal (1 subgoal):
 1. \<exists>Ma. unit_disc_fix Ma \<and> (moebius_pt M \<circ> conjugate \<circ> moebius_pt M' = moebius_pt Ma \<or> moebius_pt M \<circ> conjugate \<circ> moebius_pt M' = moebius_pt Ma \<circ> conjugate)
[PROOF STEP]
by (subst comp_assoc, subst conjugate_moebius, subst comp_assoc[symmetric])+
       (rule_tac x="M + conjugate_moebius M'" in exI, auto)
[PROOF STATE]
proof (state)
this:
unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> moebius_pt M')

goal (1 subgoal):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
fix M M'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
assume "unit_disc_fix M" "unit_disc_fix M'"
[PROOF STATE]
proof (state)
this:
unit_disc_fix M
unit_disc_fix M'

goal (1 subgoal):
 1. \<And>M Ma. \<lbrakk>unit_disc_fix M; unit_disc_fix Ma; f1 = moebius_pt M \<circ> conjugate; f2 = moebius_pt Ma \<circ> conjugate\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt Ma \<circ> conjugate))
[PROOF STEP]
thus "unit_disc_fix_f ((moebius_pt M \<circ> conjugate) \<circ> (moebius_pt M' \<circ> conjugate))"
[PROOF STATE]
proof (prove)
using this:
unit_disc_fix M
unit_disc_fix M'

goal (1 subgoal):
 1. unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt M' \<circ> conjugate))
[PROOF STEP]
apply (subst comp_assoc[symmetric], subst comp_assoc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>unit_disc_fix M; unit_disc_fix M'; unit_disc_fix M; unit_disc_fix M'\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> (conjugate \<circ> moebius_pt M') \<circ> conjugate)
[PROOF STEP]
apply (subst conjugate_moebius, subst comp_assoc, subst comp_assoc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>unit_disc_fix M; unit_disc_fix M'; unit_disc_fix M; unit_disc_fix M'\<rbrakk> \<Longrightarrow> unit_disc_fix_f (moebius_pt M \<circ> (moebius_pt (conjugate_moebius M') \<circ> (conjugate \<circ> conjugate)))
[PROOF STEP]
apply (simp add: unit_disc_fix_f_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>unit_disc_fix M; unit_disc_fix M'\<rbrakk> \<Longrightarrow> \<exists>Ma. unit_disc_fix Ma \<and> (moebius_pt M \<circ> moebius_pt (conjugate_moebius M') = moebius_pt Ma \<or> moebius_pt M \<circ> moebius_pt (conjugate_moebius M') = moebius_pt Ma \<circ> conjugate)
[PROOF STEP]
apply (rule_tac x="M + conjugate_moebius M'" in exI, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
unit_disc_fix_f (moebius_pt M \<circ> conjugate \<circ> (moebius_pt M' \<circ> conjugate))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in comm_group) int_pow_distrib:
  assumes "x \<in> carrier G" "y \<in> carrier G"
  shows "(x \<otimes> y) [^] (i::int) = x [^] i \<otimes> y [^] i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<otimes> y) [^] i = x [^] i \<otimes> y [^] i
[PROOF STEP]
by (simp add: assms int_pow_mult_distrib m_comm)


[STATEMENT]
lemma fetch_bef_erase_a_o[simp]:
  "\<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk>
  \<Longrightarrow> (fetch (mopup_a n @ shift mopup_b (2 * n)) s Oc) = (WB, s + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> \<Longrightarrow> fetch (mopup_a n @ shift mopup_b (2 * n)) s Oc = (WB, s + 1)
[PROOF STEP]
apply(subgoal_tac "\<exists> q. s = 2*q + 1", auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>q. \<lbrakk>Suc (2 * q) \<le> 2 * n; s = Suc (2 * q)\<rbrakk> \<Longrightarrow> (mopup_a n @ shift mopup_b (2 * n)) ! Suc (4 * q) = (WB, Suc (Suc (2 * q)))
 2. \<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> \<Longrightarrow> \<exists>q. s = Suc (2 * q)
[PROOF STEP]
apply(subgoal_tac "length (mopup_a n) = 4*n")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>q. \<lbrakk>Suc (2 * q) \<le> 2 * n; s = Suc (2 * q); length (mopup_a n) = 4 * n\<rbrakk> \<Longrightarrow> (mopup_a n @ shift mopup_b (2 * n)) ! Suc (4 * q) = (WB, Suc (Suc (2 * q)))
 2. \<And>q. \<lbrakk>Suc (2 * q) \<le> 2 * n; s = Suc (2 * q)\<rbrakk> \<Longrightarrow> length (mopup_a n) = 4 * n
 3. \<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> \<Longrightarrow> \<exists>q. s = Suc (2 * q)
[PROOF STEP]
apply(auto simp: nth_append)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>q. \<lbrakk>Suc (2 * q) \<le> 2 * n; s = Suc (2 * q)\<rbrakk> \<Longrightarrow> mopup_a n ! Suc (4 * q) = (WB, Suc (Suc (2 * q)))
 2. \<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> \<Longrightarrow> \<exists>q. s = Suc (2 * q)
[PROOF STEP]
apply(subgoal_tac "mopup_a n ! (4 * q + 1) =
                      mopup_a (Suc q) ! ((4 * q) + 1)",
      simp add: nth_append)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>q. \<lbrakk>Suc (2 * q) \<le> 2 * n; s = Suc (2 * q)\<rbrakk> \<Longrightarrow> mopup_a n ! (4 * q + 1) = mopup_a (Suc q) ! (4 * q + 1)
 2. \<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> \<Longrightarrow> \<exists>q. s = Suc (2 * q)
[PROOF STEP]
apply(rule mopup_a_nth, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> \<Longrightarrow> \<exists>q. s = Suc (2 * q)
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma take_first: "\<lbrakk>0 < size s1; 0 < size s2; take (size s1) (list s2) = take (size s2) (list s1)\<rbrakk>
    \<Longrightarrow> first s1 = first s2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < size s1; 0 < size s2; take (size s1) (list s2) = take (size s2) (list s1)\<rbrakk> \<Longrightarrow> first s1 = first s2
[PROOF STEP]
by(induction s1 rule: first.induct; induction s2 rule: first.induct) auto


[STATEMENT]
lemma rotation_preserve_distance_formula [simp]:
  assumes "u \<in> unit_disc" "v \<in> unit_disc"
  shows "poincare_distance_formula (to_complex (moebius_pt (moebius_rotation \<phi>) u)) (to_complex (moebius_pt (moebius_rotation \<phi>) v)) =
         poincare_distance_formula (to_complex u) (to_complex v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_distance_formula (to_complex (moebius_pt (moebius_rotation \<phi>) u)) (to_complex (moebius_pt (moebius_rotation \<phi>) v)) = poincare_distance_formula (to_complex u) (to_complex v)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc

goal (1 subgoal):
 1. poincare_distance_formula (to_complex (moebius_pt (moebius_rotation \<phi>) u)) (to_complex (moebius_pt (moebius_rotation \<phi>) v)) = poincare_distance_formula (to_complex u) (to_complex v)
[PROOF STEP]
using inf_or_of_complex[of u] inf_or_of_complex[of v]
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
u = \<infinity>\<^sub>h \<or> (\<exists>x. u = of_complex x)
v = \<infinity>\<^sub>h \<or> (\<exists>x. v = of_complex x)

goal (1 subgoal):
 1. poincare_distance_formula (to_complex (moebius_pt (moebius_rotation \<phi>) u)) (to_complex (moebius_pt (moebius_rotation \<phi>) v)) = poincare_distance_formula (to_complex u) (to_complex v)
[PROOF STEP]
by (auto simp: norm_mult)


[STATEMENT]
lemma zero_lt_diff: "(0::int) < a - b \<Longrightarrow> b \<ge> 0 \<Longrightarrow> 0 < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a - b; 0 \<le> b\<rbrakk> \<Longrightarrow> 0 < a
[PROOF STEP]
by auto


[STATEMENT]
lemma mat_mod_vec_mod_row:  "i < dim_row A \<Longrightarrow> row (mat_mod A) i = vec_mod (row A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_row A \<Longrightarrow> row (local.mat_mod A) i = vec_mod (row A i)
[PROOF STEP]
unfolding mat_mod_def vec_mod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_row A \<Longrightarrow> row (map_mat (\<lambda>x. x mod m) A) i = map_vec (\<lambda>x. x mod m) (row A i)
[PROOF STEP]
by (simp)


[STATEMENT]
lemma primitive_part_gcd: "primitive_part (gcd f g)
  = unit_factor (gcd f g) * gcd (primitive_part f) (primitive_part g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primitive_part (gcd f g) = unit_factor (gcd f g) * gcd (primitive_part f) (primitive_part g)
[PROOF STEP]
unfolding gcd_primitive_part
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primitive_part (gcd f g) = unit_factor (gcd f g) * normalize (primitive_part (gcd f g))
[PROOF STEP]
by (metis (no_types, lifting)
  content_times_primitive_part gcd.normalize_idem mult_cancel_left2 mult_smult_left
  normalize_eq_0_iff normalize_mult_unit_factor primitive_part_eq_0_iff
  smult_content_normalize_primitive_part unit_factor_mult_normalize)


[STATEMENT]
lemma eval_Mn':
  assumes "recfn (length xs) (Mn n f)"
  shows "eval (Mn n f) xs =
   (if (\<exists>z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>))
    then Some (LEAST z. eval f (z # xs) \<down>= 0)
    else None)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (Mn n f) xs = (if \<exists>z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>) then Some (LEAST z. eval f (z # xs) \<down>= 0) else None)
[PROOF STEP]
using assms eval_def eval_wellf_Mn
[PROOF STATE]
proof (prove)
using this:
recfn (length xs) (Mn n f)
recfn (length ?xs) ?f \<Longrightarrow> eval ?f ?xs \<equiv> eval_wellf ?f ?xs
eval_wellf (Mn ?n ?f) ?xs = (if \<exists>z. eval_wellf ?f (z # ?xs) \<down>= 0 \<and> (\<forall>y<z. eval_wellf ?f (y # ?xs) \<down>) then Some (LEAST z. eval_wellf ?f (z # ?xs) \<down>= 0) else None)

goal (1 subgoal):
 1. eval (Mn n f) xs = (if \<exists>z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>) then Some (LEAST z. eval f (z # xs) \<down>= 0) else None)
[PROOF STEP]
by auto


[STATEMENT]
lemma real_eq_0_iff_le_ge_0:
  fixes x :: real
  shows "x = 0 \<equiv> x \<ge> 0 \<and> - x \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = 0 \<equiv> 0 \<le> x \<and> 0 \<le> - x
[PROOF STEP]
by arith


[STATEMENT]
lemma card_set_suffixes [simp]: "card (set (suffixes xs)) = Suc (length xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set (suffixes xs)) = Suc (length xs)
[PROOF STEP]
by (subst distinct_card) auto


[STATEMENT]
lemma card_basis_left_null_space_eq_dim:
fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
shows "card (basis_left_null_space A) = vec.dim (left_null_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
let ?f="\<lambda>n. row (from_nat (n + (rank A))) (P_Gauss_Jordan A)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
have "card (basis_left_null_space A) = card {row i (P_Gauss_Jordan A) | i. to_nat i \<ge> rank A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (basis_left_null_space A) = card {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i}
[PROOF STEP]
unfolding basis_left_null_space_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i} = card {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
card (basis_left_null_space A) = card {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i}

goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (basis_left_null_space A) = card {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i}

goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
have "... = card {..<(vec.dimension TYPE('a) TYPE('rows)) - rank A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i} = card {..<finite_dimensional_vector_space.dimension cart_basis - rank A}
[PROOF STEP]
proof (rule bij_betw_same_card[symmetric, of ?f], unfold bij_betw_def, rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on (\<lambda>n. row (mod_type_class.from_nat (n + rank A)) (P_Gauss_Jordan A)) {..<finite_dimensional_vector_space.dimension cart_basis - rank A}
 2. (\<lambda>n. row (mod_type_class.from_nat (n + rank A)) (P_Gauss_Jordan A)) ` {..<finite_dimensional_vector_space.dimension cart_basis - rank A} = {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i}
[PROOF STEP]
show "inj_on ?f {..<(vec.dimension TYPE('a) TYPE('rows)) - rank A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>n. row (mod_type_class.from_nat (n + rank A)) (P_Gauss_Jordan A)) {..<finite_dimensional_vector_space.dimension cart_basis - rank A}
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{..<finite_dimensional_vector_space.dimension cart_basis - rank A}. \<forall>y\<in>{..<finite_dimensional_vector_space.dimension cart_basis - rank A}. row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A) = row (mod_type_class.from_nat (y + rank A)) (P_Gauss_Jordan A) \<longrightarrow> x = y
[PROOF STEP]
proof (auto, rule ccontr, unfold dimension_vector)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x < CARD('rows) - rank A; y < CARD('rows) - rank A; row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A) = row (mod_type_class.from_nat (y + rank A)) (P_Gauss_Jordan A); x \<noteq> y\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x < CARD('rows) - rank A; y < CARD('rows) - rank A; row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A) = row (mod_type_class.from_nat (y + rank A)) (P_Gauss_Jordan A); x \<noteq> y\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume x: "x <CARD('rows) - rank A"
          and y: "y < CARD('rows) - rank A"
          and eq: "row (from_nat (x + rank A)) (P_Gauss_Jordan A) = row (from_nat (y + rank A)) (P_Gauss_Jordan A)"
          and x_not_y: "x \<noteq> y"
[PROOF STATE]
proof (state)
this:
x < CARD('rows) - rank A
y < CARD('rows) - rank A
row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A) = row (mod_type_class.from_nat (y + rank A)) (P_Gauss_Jordan A)
x \<noteq> y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x < CARD('rows) - rank A; y < CARD('rows) - rank A; row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A) = row (mod_type_class.from_nat (y + rank A)) (P_Gauss_Jordan A); x \<noteq> y\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "det (P_Gauss_Jordan A) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (P_Gauss_Jordan A) = (0::'a)
[PROOF STEP]
proof (rule det_identical_rows[OF _ eq])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mod_type_class.from_nat (x + rank A) \<noteq> mod_type_class.from_nat (y + rank A)
[PROOF STEP]
have "(x + rank A) \<noteq> (y + rank A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + rank A \<noteq> y + rank A
[PROOF STEP]
using x_not_y x y
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
x < CARD('rows) - rank A
y < CARD('rows) - rank A

goal (1 subgoal):
 1. x + rank A \<noteq> y + rank A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x + rank A \<noteq> y + rank A

goal (1 subgoal):
 1. mod_type_class.from_nat (x + rank A) \<noteq> mod_type_class.from_nat (y + rank A)
[PROOF STEP]
thus "(from_nat (x + rank A)::'rows) \<noteq> from_nat (y + rank A)"
[PROOF STATE]
proof (prove)
using this:
x + rank A \<noteq> y + rank A

goal (1 subgoal):
 1. mod_type_class.from_nat (x + rank A) \<noteq> mod_type_class.from_nat (y + rank A)
[PROOF STEP]
by (metis (mono_tags) from_nat_eq_imp_eq less_diff_conv x y)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat (x + rank A) \<noteq> mod_type_class.from_nat (y + rank A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (P_Gauss_Jordan A) = (0::'a)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x < CARD('rows) - rank A; y < CARD('rows) - rank A; row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A) = row (mod_type_class.from_nat (y + rank A)) (P_Gauss_Jordan A); x \<noteq> y\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
det (P_Gauss_Jordan A) = (0::'a)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x < CARD('rows) - rank A; y < CARD('rows) - rank A; row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A) = row (mod_type_class.from_nat (y + rank A)) (P_Gauss_Jordan A); x \<noteq> y\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "invertible (P_Gauss_Jordan A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (P_Gauss_Jordan A)
[PROOF STEP]
by (metis P_Gauss_Jordan_def invertible_fst_Gauss_Jordan_PA)
[PROOF STATE]
proof (state)
this:
invertible (P_Gauss_Jordan A)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x < CARD('rows) - rank A; y < CARD('rows) - rank A; row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A) = row (mod_type_class.from_nat (y + rank A)) (P_Gauss_Jordan A); x \<noteq> y\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
det (P_Gauss_Jordan A) = (0::'a)
invertible (P_Gauss_Jordan A)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
det (P_Gauss_Jordan A) = (0::'a)
invertible (P_Gauss_Jordan A)

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding invertible_det_nz
[PROOF STATE]
proof (prove)
using this:
det (P_Gauss_Jordan A) = (0::'a)
det (P_Gauss_Jordan A) \<noteq> (0::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>n. row (mod_type_class.from_nat (n + rank A)) (P_Gauss_Jordan A)) {..<finite_dimensional_vector_space.dimension cart_basis - rank A}

goal (1 subgoal):
 1. (\<lambda>n. row (mod_type_class.from_nat (n + rank A)) (P_Gauss_Jordan A)) ` {..<finite_dimensional_vector_space.dimension cart_basis - rank A} = {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i}
[PROOF STEP]
show "?f  ` {..<(vec.dimension TYPE('a) TYPE('rows)) - rank A} = {row i (P_Gauss_Jordan A) |i. rank A \<le> to_nat i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. row (mod_type_class.from_nat (n + rank A)) (P_Gauss_Jordan A)) ` {..<finite_dimensional_vector_space.dimension cart_basis - rank A} = {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i}
[PROOF STEP]
proof (unfold image_def dimension_vector, auto, metis le_add2 less_diff_conv to_nat_from_nat_id)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> \<exists>x\<in>{..<CARD('rows) - rank A}. row i (P_Gauss_Jordan A) = row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A)
[PROOF STEP]
fix i::'rows
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> \<exists>x\<in>{..<CARD('rows) - rank A}. row i (P_Gauss_Jordan A) = row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A)
[PROOF STEP]
assume rank_le_i: "rank A \<le> to_nat i"
[PROOF STATE]
proof (state)
this:
rank A \<le> mod_type_class.to_nat i

goal (1 subgoal):
 1. \<And>i. rank A \<le> mod_type_class.to_nat i \<Longrightarrow> \<exists>x\<in>{..<CARD('rows) - rank A}. row i (P_Gauss_Jordan A) = row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A)
[PROOF STEP]
show "\<exists>x\<in>{..<CARD('rows) - rank A}. row i (P_Gauss_Jordan A) = row (from_nat (x + rank A)) (P_Gauss_Jordan A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>{..<CARD('rows) - rank A}. row i (P_Gauss_Jordan A) = row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A)
[PROOF STEP]
proof (rule bexI[of _ "(to_nat i - rank A)"])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. row i (P_Gauss_Jordan A) = row (mod_type_class.from_nat (mod_type_class.to_nat i - rank A + rank A)) (P_Gauss_Jordan A)
 2. mod_type_class.to_nat i - rank A \<in> {..<CARD('rows) - rank A}
[PROOF STEP]
have "i = (from_nat (to_nat i - rank A + rank A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i = mod_type_class.from_nat (mod_type_class.to_nat i - rank A + rank A)
[PROOF STEP]
by (metis rank_le_i from_nat_to_nat_id le_add_diff_inverse2)
[PROOF STATE]
proof (state)
this:
i = mod_type_class.from_nat (mod_type_class.to_nat i - rank A + rank A)

goal (2 subgoals):
 1. row i (P_Gauss_Jordan A) = row (mod_type_class.from_nat (mod_type_class.to_nat i - rank A + rank A)) (P_Gauss_Jordan A)
 2. mod_type_class.to_nat i - rank A \<in> {..<CARD('rows) - rank A}
[PROOF STEP]
thus "row i (P_Gauss_Jordan A) = row (from_nat (to_nat i - rank A + rank A)) (P_Gauss_Jordan A)"
[PROOF STATE]
proof (prove)
using this:
i = mod_type_class.from_nat (mod_type_class.to_nat i - rank A + rank A)

goal (1 subgoal):
 1. row i (P_Gauss_Jordan A) = row (mod_type_class.from_nat (mod_type_class.to_nat i - rank A + rank A)) (P_Gauss_Jordan A)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
row i (P_Gauss_Jordan A) = row (mod_type_class.from_nat (mod_type_class.to_nat i - rank A + rank A)) (P_Gauss_Jordan A)

goal (1 subgoal):
 1. mod_type_class.to_nat i - rank A \<in> {..<CARD('rows) - rank A}
[PROOF STEP]
show "to_nat i - rank A \<in> {..<CARD('rows) - rank A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat i - rank A \<in> {..<CARD('rows) - rank A}
[PROOF STEP]
using rank_le_i
[PROOF STATE]
proof (prove)
using this:
rank A \<le> mod_type_class.to_nat i

goal (1 subgoal):
 1. mod_type_class.to_nat i - rank A \<in> {..<CARD('rows) - rank A}
[PROOF STEP]
by (metis diff_less_mono lessThan_def mem_Collect_eq to_nat_less_card)
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat i - rank A \<in> {..<CARD('rows) - rank A}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>{..<CARD('rows) - rank A}. row i (P_Gauss_Jordan A) = row (mod_type_class.from_nat (x + rank A)) (P_Gauss_Jordan A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. row (mod_type_class.from_nat (n + rank A)) (P_Gauss_Jordan A)) ` {..<finite_dimensional_vector_space.dimension cart_basis - rank A} = {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i} = card {..<finite_dimensional_vector_space.dimension cart_basis - rank A}

goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i} = card {..<finite_dimensional_vector_space.dimension cart_basis - rank A}

goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
have "... = (vec.dimension TYPE('a) TYPE('rows)) - rank A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {..<finite_dimensional_vector_space.dimension cart_basis - rank A} = finite_dimensional_vector_space.dimension cart_basis - rank A
[PROOF STEP]
unfolding card_lessThan
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis - rank A = finite_dimensional_vector_space.dimension cart_basis - rank A
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
card {..<finite_dimensional_vector_space.dimension cart_basis - rank A} = finite_dimensional_vector_space.dimension cart_basis - rank A

goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {..<finite_dimensional_vector_space.dimension cart_basis - rank A} = finite_dimensional_vector_space.dimension cart_basis - rank A

goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
have "... = vec.dim (null_space (transpose A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis - rank A = vec.dim (null_space (Finite_Cartesian_Product.transpose A))
[PROOF STEP]
unfolding dim_null_space rank_transpose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis - rank A = finite_dimensional_vector_space.dimension cart_basis - rank A
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
finite_dimensional_vector_space.dimension cart_basis - rank A = vec.dim (null_space (Finite_Cartesian_Product.transpose A))

goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
finite_dimensional_vector_space.dimension cart_basis - rank A = vec.dim (null_space (Finite_Cartesian_Product.transpose A))

goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
have "... = vec.dim (left_null_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (null_space (Finite_Cartesian_Product.transpose A)) = vec.dim (left_null_space A)
[PROOF STEP]
unfolding left_null_space_eq_null_space_transpose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (null_space (Finite_Cartesian_Product.transpose A)) = vec.dim (null_space (Finite_Cartesian_Product.transpose A))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
vec.dim (null_space (Finite_Cartesian_Product.transpose A)) = vec.dim (left_null_space A)

goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (basis_left_null_space A) = vec.dim (left_null_space A)

goal (1 subgoal):
 1. card (basis_left_null_space A) = vec.dim (left_null_space A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (basis_left_null_space A) = vec.dim (left_null_space A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma partial_order_on_acyclic:
  assumes "partial_order_on A r"
  shows "acyclic (r - Id)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. acyclic (r - Id)
[PROOF STEP]
by (metis acyclic_irrefl assms irrefl_diff_Id partial_order_on_def preorder_on_def trancl_id trans_diff_Id)


[STATEMENT]
lemma one_less_ceiling [simp]: "1 < \<lceil>x\<rceil> \<longleftrightarrow> 1 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 < \<lceil>x\<rceil>) = ((1::'a) < x)
[PROOF STEP]
by (simp add: less_ceiling_iff)


[STATEMENT]
lemma of_nat_inj:
  "\<lbrakk>x < 2 ^ LENGTH('a); y < 2 ^ LENGTH('a)\<rbrakk> \<Longrightarrow>
   (of_nat x = (of_nat y :: 'a :: len word)) = (x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < 2 ^ LENGTH('a); y < 2 ^ LENGTH('a)\<rbrakk> \<Longrightarrow> (word_of_nat x = word_of_nat y) = (x = y)
[PROOF STEP]
by (metis unat_of_nat_len)


[STATEMENT]
lemma float_up_correct: "real_of_float (float_up e f) - real_of_float f \<in> {0..2 powr -e}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_float (float_up e f) - real_of_float f \<in> {0..2 powr - real_of_int e}
[PROOF STEP]
by transfer (rule round_up_correct)


[STATEMENT]
lemma inv_prod_rel_eq[simp]: "(P \<times>\<^sub>r Q)\<inverse> = P\<inverse> \<times>\<^sub>r Q\<inverse>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<times>\<^sub>r Q)\<inverse> = P\<inverse> \<times>\<^sub>r Q\<inverse>
[PROOF STEP]
by (auto)


[STATEMENT]
lemma LIMSEQ_decseq_INF:
  fixes X :: "nat \<Rightarrow> 'a::{conditionally_complete_linorder, linorder_topology}"
  assumes u: "bdd_below (range X)"
    and X: "decseq X"
  shows "X \<longlonglongrightarrow> (INF i. X i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<longlonglongrightarrow> Inf (range X)
[PROOF STEP]
by (rule order_tendstoI)
     (auto simp: eventually_sequentially u cINF_less_iff
       intro: X[THEN decseqD] le_less_trans less_cINF_D[OF u])


[STATEMENT]
lemma listrel_rtrancl_trans:
  "\<lbrakk>(xs,ys) \<in> listrel(r\<^sup>*);  (ys,zs) \<in> listrel(r\<^sup>*)\<rbrakk> \<Longrightarrow> (xs,zs) \<in> listrel(r\<^sup>*)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(xs, ys) \<in> listrel (r\<^sup>*); (ys, zs) \<in> listrel (r\<^sup>*)\<rbrakk> \<Longrightarrow> (xs, zs) \<in> listrel (r\<^sup>*)
[PROOF STEP]
by (metis listrel_trans trans_def trans_rtrancl)


[STATEMENT]
lemma tensor_P_left_right_partial2:
  assumes "m1 \<in> carrier_mat K K" and "m2 \<in> carrier_mat K K" and "m3 \<in> carrier_mat N N" and "m4 \<in> carrier_mat K K"
  shows "tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)
[PROOF STEP]
have "tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 = tensor_P m3 (m1 * m2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 = tensor_P m3 (m1 * m2)
[PROOF STEP]
unfolding ps2_P.ptensor_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ps_P.tensor_mat (1\<^sub>m N) m1 * ps_P.tensor_mat m3 m2 = ps_P.tensor_mat m3 (m1 * m2)
[PROOF STEP]
apply (subst ps_P.tensor_mat_mult[symmetric])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. 1\<^sub>m N \<in> carrier_mat ps_P.d1 ps_P.d1
 2. m3 \<in> carrier_mat ps_P.d1 ps_P.d1
 3. m1 \<in> carrier_mat ps_P.d2 ps_P.d2
 4. m2 \<in> carrier_mat ps_P.d2 ps_P.d2
 5. ps_P.tensor_mat (1\<^sub>m N * m3) (m1 * m2) = ps_P.tensor_mat m3 (m1 * m2)
[PROOF STEP]
using assms ps_P_d1 ps_P_d2
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat K K
m2 \<in> carrier_mat K K
m3 \<in> carrier_mat N N
m4 \<in> carrier_mat K K
ps_P.d1 = N
ps_P.d2 = K

goal (5 subgoals):
 1. 1\<^sub>m N \<in> carrier_mat ps_P.d1 ps_P.d1
 2. m3 \<in> carrier_mat ps_P.d1 ps_P.d1
 3. m1 \<in> carrier_mat ps_P.d2 ps_P.d2
 4. m2 \<in> carrier_mat ps_P.d2 ps_P.d2
 5. ps_P.tensor_mat (1\<^sub>m N * m3) (m1 * m2) = ps_P.tensor_mat m3 (m1 * m2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 = tensor_P m3 (m1 * m2)

goal (1 subgoal):
 1. tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 = tensor_P m3 (m1 * m2)

goal (1 subgoal):
 1. tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)
[PROOF STEP]
have "tensor_P m3 (m1 * m2) * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_P m3 (m1 * m2) * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)
[PROOF STEP]
unfolding ps2_P.ptensor_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ps_P.tensor_mat m3 (m1 * m2) * ps_P.tensor_mat (1\<^sub>m N) m4 = ps_P.tensor_mat m3 (m1 * m2 * m4)
[PROOF STEP]
apply (subst ps_P.tensor_mat_mult[symmetric])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. m3 \<in> carrier_mat ps_P.d1 ps_P.d1
 2. 1\<^sub>m N \<in> carrier_mat ps_P.d1 ps_P.d1
 3. m1 * m2 \<in> carrier_mat ps_P.d2 ps_P.d2
 4. m4 \<in> carrier_mat ps_P.d2 ps_P.d2
 5. ps_P.tensor_mat (m3 * 1\<^sub>m N) (m1 * m2 * m4) = ps_P.tensor_mat m3 (m1 * m2 * m4)
[PROOF STEP]
using assms ps_P_d1 ps_P_d2
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat K K
m2 \<in> carrier_mat K K
m3 \<in> carrier_mat N N
m4 \<in> carrier_mat K K
ps_P.d1 = N
ps_P.d2 = K

goal (5 subgoals):
 1. m3 \<in> carrier_mat ps_P.d1 ps_P.d1
 2. 1\<^sub>m N \<in> carrier_mat ps_P.d1 ps_P.d1
 3. m1 * m2 \<in> carrier_mat ps_P.d2 ps_P.d2
 4. m4 \<in> carrier_mat ps_P.d2 ps_P.d2
 5. ps_P.tensor_mat (m3 * 1\<^sub>m N) (m1 * m2 * m4) = ps_P.tensor_mat m3 (m1 * m2 * m4)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
tensor_P m3 (m1 * m2) * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)

goal (1 subgoal):
 1. tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 = tensor_P m3 (m1 * m2)
tensor_P m3 (m1 * m2) * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 = tensor_P m3 (m1 * m2)
tensor_P m3 (m1 * m2) * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)

goal (1 subgoal):
 1. tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
tensor_P (1\<^sub>m N) m1 * tensor_P m3 m2 * tensor_P (1\<^sub>m N) m4 = tensor_P m3 (m1 * m2 * m4)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inverse_scaleR_times [simp]:
  fixes a :: "'a::real_algebra_1"
  shows "(1 / numeral v) *\<^sub>R (numeral w * a) = (numeral w / numeral v) *\<^sub>R a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / numeral v) *\<^sub>R (numeral w * a) = (numeral w / numeral v) *\<^sub>R a
[PROOF STEP]
by (metis divide_inverse_commute inverse_eq_divide of_real_numeral scaleR_conv_of_real scaleR_scaleR)


[STATEMENT]
lemma fun_meet_simp[simp]: "(f \<squnion> g) x = f x \<squnion> (g x::'a::Finite_Join_cpo)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<squnion> g) x = f x \<squnion> g x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f \<squnion> g) x = f x \<squnion> g x
[PROOF STEP]
have "f \<squnion> g = (\<lambda> x. f x \<squnion> g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<squnion> g = (\<lambda>x. f x \<squnion> g x)
[PROOF STEP]
by (rule is_joinI)(auto simp add: fun_below_iff)
[PROOF STATE]
proof (state)
this:
f \<squnion> g = (\<lambda>x. f x \<squnion> g x)

goal (1 subgoal):
 1. (f \<squnion> g) x = f x \<squnion> g x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<squnion> g = (\<lambda>x. f x \<squnion> g x)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma expands_to_imp_eventually_gt:
  assumes "basis_wf basis" "((\<lambda>x. f x - g x) expands_to F) basis" "trimmed_pos F"
  shows   "eventually (\<lambda>x. f x > g x) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. g x < f x
[PROOF STEP]
using expands_to_imp_eventually_pos[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. 0 < f x - g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. g x < f x
[PROOF STEP]
by simp


[STATEMENT]
lemma S_L_set_generation:
"VARS S L W u
  {True}
  S := {}; L := {}; W := U;
  WHILE W \<noteq> {}
  INV {W \<subseteq> U \<and> S = {v \<in> U - W. w(v) \<le> c / 2} \<and> L = {v \<in> U - W. w(v) > c / 2}} DO
    u := (SOME u. u \<in> W);
    IF 2 * w(u) \<le> c
    THEN S := S \<union> {u}
    ELSE L := L \<union> {u} FI;
    W := W - {u}
  OD
  {S = {v \<in> U. w(v) \<le> c / 2} \<and> L = {v \<in> U. w(v) > c / 2}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {True}
S := {}; L := {}; W := U; WHILE W \<noteq> {} INV {W \<subseteq> U \<and> S = {v \<in> U - W. w v \<le> real c / 2} \<and> L = {v \<in> U - W. real c / 2 < w v}}  VAR {0}
DO u := (SOME u. u \<in> W); IF 2 * w u \<le> real c THEN S := S \<union> {u}  ELSE L := L \<union> {u} FI; W := W - {u} OD
{S = {v \<in> U. w v \<le> real c / 2} \<and> L = {v \<in> U. real c / 2 < w v}}
[PROOF STEP]
by vcg (auto simp: some_in_eq)


[STATEMENT]
lemma vderiv_on_composeI:
  assumes "D f = f' on g ` T"
    and " D g = g' on T"
    and "h = (\<lambda>t. g' t *\<^sub>R f' (g t))"
  shows "D (\<lambda>t. f (g t)) = h on T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1.  D (\<lambda>t. f (g t)) = h on T
[PROOF STEP]
apply(subst ssubst[of h], simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1.  D (\<lambda>t. f (g t)) = h on T
 2. True
[PROOF STEP]
using assms has_vderiv_on_compose
[PROOF STATE]
proof (prove)
using this:
 D f = f' on g ` T
 D g = g' on T
h = (\<lambda>t. g' t *\<^sub>R f' (g t))
\<lbrakk> D ?f = ?f' on ?g ` ?T;  D ?g = ?g' on ?T\<rbrakk> \<Longrightarrow>  D (?f \<circ> ?g) = (\<lambda>x. ?g' x *\<^sub>R ?f' (?g x)) on ?T

goal (2 subgoals):
 1.  D (\<lambda>t. f (g t)) = h on T
 2. True
[PROOF STEP]
by auto


[STATEMENT]
lemma Mp_Mp_pow_is_Mp: "n \<noteq> 0 \<Longrightarrow> p > 1 \<Longrightarrow> poly_mod.Mp p (poly_mod.Mp (p^n) f)
  = poly_mod.Mp p f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<noteq> 0; 1 < p\<rbrakk> \<Longrightarrow> poly_mod.Mp p (poly_mod.Mp (p ^ n) f) = poly_mod.Mp p f
[PROOF STEP]
using  poly_mod_2.Mp_product_modulus poly_mod_2_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>poly_mod_2 ?m; ?m' = ?m * ?k; 0 < ?k\<rbrakk> \<Longrightarrow> poly_mod.Mp ?m (poly_mod.Mp ?m' ?f) = poly_mod.Mp ?m ?f
poly_mod_2 ?m \<equiv> 1 < ?m

goal (1 subgoal):
 1. \<lbrakk>n \<noteq> 0; 1 < p\<rbrakk> \<Longrightarrow> poly_mod.Mp p (poly_mod.Mp (p ^ n) f) = poly_mod.Mp p f
[PROOF STEP]
by(subst power_eq_if, auto)


[STATEMENT]
lemma nn_integral_floor_less_eq:
  assumes "\<And>x y. x \<le> y \<Longrightarrow> f y \<le> f x"
  shows "\<integral>\<^sup>+x\<in>{0::real..}. ennreal (f x)\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0::real..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f x)\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f (real (nat \<lfloor>x\<rfloor>)))\<partial>lborel
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<le> ?y \<Longrightarrow> f ?y \<le> f ?x

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f x)\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f (real (nat \<lfloor>x\<rfloor>)))\<partial>lborel
[PROOF STEP]
by (auto simp add: indicator_def intro!: nn_integral_mono ennreal_leI)


[STATEMENT]
lemma simple_function_eq_measurable:
  "simple_function M f \<longleftrightarrow> finite (f`space M) \<and> f \<in> measurable M (count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simple_function M f = (finite (f ` space M) \<and> f \<in> M \<rightarrow>\<^sub>M count_space UNIV)
[PROOF STEP]
using measurable_simple_function[of M f]
[PROOF STATE]
proof (prove)
using this:
simple_function M f \<Longrightarrow> f \<in> M \<rightarrow>\<^sub>M count_space UNIV

goal (1 subgoal):
 1. simple_function M f = (finite (f ` space M) \<and> f \<in> M \<rightarrow>\<^sub>M count_space UNIV)
[PROOF STEP]
by (fastforce simp: simple_function_def)


[STATEMENT]
lemma (in Corps) field_npowf_exp_zero:"\<lbrakk>a \<in> carrier K; a \<noteq> \<zero>\<rbrakk> \<Longrightarrow>
                                    npowf K a 0 = 1\<^sub>r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier K; a \<noteq> \<zero>\<rbrakk> \<Longrightarrow> a\<^bsub>K\<^esub>\<^bsup>0\<^esup> = 1\<^sub>r
[PROOF STEP]
by (cut_tac field_is_ring, simp add:npowf_def)


[STATEMENT]
lemma graph_map_comp[simp]: "graph (m1 \<circ>\<^sub>m m2) = graph m2 O graph m1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph (m1 \<circ>\<^sub>m m2) = graph m2 O graph m1
[PROOF STEP]
unfolding graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(a, b) |a b. (m1 \<circ>\<^sub>m m2) a = Some b} = {(a, b) |a b. m2 a = Some b} O {(a, b) |a b. m1 a = Some b}
[PROOF STEP]
by (auto simp: map_comp_Some_iff relcomp_unfold)


[STATEMENT]
lemma lhopital_right_at_top_at_bot:
  fixes f g :: "real \<Rightarrow> real"
  assumes f_0: "LIM x at_right a. f x :> at_top"
  assumes g_0: "LIM x at_right a. g x :> at_bot"
    and ev:
      "eventually (\<lambda>x. DERIV f x :> f' x) (at_right a)"
      "eventually (\<lambda>x. DERIV g x :> g' x) (at_right a)"
    and lim: "filterlim (\<lambda> x. (f' x / g' x)) at_bot (at_right a)"
  shows "filterlim (\<lambda> x. f x / g x) at_bot (at_right a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_right a. f x / g x :> at_bot
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LIM x at_right a. f x / g x :> at_bot
[PROOF STEP]
from ev(2)
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_right a. (g has_real_derivative g' x) (at x)
[PROOF STEP]
have ev': "eventually (\<lambda>x. DERIV (\<lambda>x. -g x) x :> -g' x) (at_right a)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_right a. (g has_real_derivative g' x) (at x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_right a. ((\<lambda>x. - g x) has_real_derivative - g' x) (at x)
[PROOF STEP]
by eventually_elim (auto intro: derivative_intros)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_right a. ((\<lambda>x. - g x) has_real_derivative - g' x) (at x)

goal (1 subgoal):
 1. LIM x at_right a. f x / g x :> at_bot
[PROOF STEP]
have "filterlim (\<lambda>x. f x / (-g x)) at_top (at_right a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_right a. f x / - g x :> at_top
[PROOF STEP]
by (rule lhopital_right_at_top_at_top[where f' = f' and g' = "\<lambda>x. -g' x"])
       (insert assms ev', auto simp: filterlim_uminus_at_bot)
[PROOF STATE]
proof (state)
this:
LIM x at_right a. f x / - g x :> at_top

goal (1 subgoal):
 1. LIM x at_right a. f x / g x :> at_bot
[PROOF STEP]
hence "filterlim (\<lambda>x. -(f x / g x)) at_top (at_right a)"
[PROOF STATE]
proof (prove)
using this:
LIM x at_right a. f x / - g x :> at_top

goal (1 subgoal):
 1. LIM x at_right a. - (f x / g x) :> at_top
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
LIM x at_right a. - (f x / g x) :> at_top

goal (1 subgoal):
 1. LIM x at_right a. f x / g x :> at_bot
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
LIM x at_right a. - (f x / g x) :> at_top

goal (1 subgoal):
 1. LIM x at_right a. f x / g x :> at_bot
[PROOF STEP]
by (simp add: filterlim_uminus_at_bot)
[PROOF STATE]
proof (state)
this:
LIM x at_right a. f x / g x :> at_bot

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_imp_sums_bounded:
   "summable f \<Longrightarrow> bounded (range (\<lambda>n. sum f {..<n}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f \<Longrightarrow> bounded (range (\<lambda>n. sum f {..<n}))
[PROOF STEP]
by (auto simp: summable_def sums_def dest: convergent_imp_bounded)


[STATEMENT]
lemma homology_exactness_reduced_2:
   "exact_seq([reduced_homology_group(p - 1) X,
                 reduced_homology_group(p - 1) (subtopology X S),
                 relative_homology_group p X S],
                [hom_induced (p - 1) (subtopology X S) {} X {} id, hom_boundary p X S])"
    (is "exact_seq ([?G1,?G2,?G3], [?h1,?h2])")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exact_seq ([reduced_homology_group (p - 1) X, reduced_homology_group (p - 1) (subtopology X S), relative_homology_group p X S], [hom_induced (p - 1) (subtopology X S) {} X {} id, hom_boundary p X S])
[PROOF STEP]
using homology_exactness_axiom_2 [of p X S]
[PROOF STATE]
proof (prove)
using this:
exact_seq ([homology_group (p - 1) X, homology_group (p - 1) (subtopology X S), relative_homology_group p X S], [hom_induced (p - 1) (subtopology X S) {} X {} id, hom_boundary p X S])

goal (1 subgoal):
 1. exact_seq ([reduced_homology_group (p - 1) X, reduced_homology_group (p - 1) (subtopology X S), relative_homology_group p X S], [hom_induced (p - 1) (subtopology X S) {} X {} id, hom_boundary p X S])
[PROOF STEP]
apply (simp add: group_hom_axioms_def group_hom_def hom_boundary_reduced_hom hom_induced_reduced_hom)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_boundary p X S \<in> hom (relative_homology_group p X S) (homology_group (p - 1) (subtopology X S)) \<and> hom_induced (p - 1) (subtopology X S) {} X {} id \<in> hom (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) \<and> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S) \<Longrightarrow> kernel (reduced_homology_group (p - 1) (subtopology X S)) (reduced_homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
apply (simp add: reduced_homology_group_def group_hom.subgroup_kernel group_hom_axioms_def group_hom_def hom_induced_hom)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_boundary p X S \<in> hom (relative_homology_group p X S) (homology_group (p - 1) (subtopology X S)) \<and> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S) \<Longrightarrow> hom_boundary p X S ` carrier (relative_homology_group p X S) \<inter> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) (discrete_topology {()})) (hom_induced (p - 1) (subtopology X S) {} (discrete_topology {()}) {} (\<lambda>x. ())) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
using hom_boundary_reduced_hom [of p X S]
[PROOF STATE]
proof (prove)
using this:
hom_boundary p X S \<in> hom (relative_homology_group p X S) (reduced_homology_group (p - 1) (subtopology X S))

goal (1 subgoal):
 1. hom_boundary p X S \<in> hom (relative_homology_group p X S) (homology_group (p - 1) (subtopology X S)) \<and> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S) \<Longrightarrow> hom_boundary p X S ` carrier (relative_homology_group p X S) \<inter> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) (discrete_topology {()})) (hom_induced (p - 1) (subtopology X S) {} (discrete_topology {()}) {} (\<lambda>x. ())) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
apply (auto simp: image_def set_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>hom_boundary p X S \<in> hom (relative_homology_group p X S) (reduced_homology_group (p - 1) (subtopology X S)); hom_boundary p X S \<in> hom (relative_homology_group p X S) (homology_group (p - 1) (subtopology X S)); \<forall>x. (x \<in> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id)) = (\<exists>xa\<in>carrier (relative_homology_group p X S). \<forall>xb. (xb \<in> x) = (xb \<in> hom_boundary p X S xa)); xa \<in> carrier (relative_homology_group p X S); \<forall>xb. (xb \<in> x) = (xb \<in> hom_boundary p X S xa)\<rbrakk> \<Longrightarrow> x \<in> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) (discrete_topology {()})) (hom_induced (p - 1) (subtopology X S) {} (discrete_topology {()}) {} (\<lambda>x. ()))
[PROOF STEP]
by (metis carrier_reduced_homology_group hom_in_carrier set_eq_iff)


[STATEMENT]
lemma binomial_pmf_altdef':
  fixes A :: "'a set"
  assumes "finite A" and "card A = n" and p: "p \<in> {0..1}"
  shows   "binomial_pmf n p =
             map_pmf (\<lambda>f. card {x\<in>A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
card A = n
p \<in> {0..1}
[PROOF STEP]
have "?lhs = binomial_pmf (card A) p"
[PROOF STATE]
proof (prove)
using this:
finite A
card A = n
p \<in> {0..1}

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

goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
binomial_pmf n p = binomial_pmf (card A) p

goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binomial_pmf (card A) p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. binomial_pmf (card A) p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
proof (induction rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. binomial_pmf (card {}) p = map_pmf (\<lambda>f. card {x \<in> {}. f x}) (Pi_pmf {} dflt (\<lambda>_. bernoulli_pmf p))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. binomial_pmf (card {}) p = map_pmf (\<lambda>f. card {x \<in> {}. f x}) (Pi_pmf {} dflt (\<lambda>_. bernoulli_pmf p))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
with p
[PROOF STATE]
proof (chain)
picking this:
p \<in> {0..1}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
p \<in> {0..1}

goal (1 subgoal):
 1. binomial_pmf (card {}) p = map_pmf (\<lambda>f. card {x \<in> {}. f x}) (Pi_pmf {} dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
by (simp add: binomial_pmf_0)
[PROOF STATE]
proof (state)
this:
binomial_pmf (card {}) p = map_pmf (\<lambda>f. card {x \<in> {}. f x}) (Pi_pmf {} dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
case (insert x A)
[PROOF STATE]
proof (state)
this:
finite A
x \<notin> A
binomial_pmf (card A) p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
from insert.hyps
[PROOF STATE]
proof (chain)
picking this:
finite A
x \<notin> A
[PROOF STEP]
have "card (insert x A) = Suc (card A)"
[PROOF STATE]
proof (prove)
using this:
finite A
x \<notin> A

goal (1 subgoal):
 1. card (insert x A) = Suc (card A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (insert x A) = Suc (card A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (insert x A) = Suc (card A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
have "binomial_pmf \<dots> p = do {
                                     b \<leftarrow> bernoulli_pmf p;
                                     f \<leftarrow> Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p);
                                     return_pmf ((if b then 1 else 0) + card {y \<in> A. f y})
                                   }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binomial_pmf (Suc (card A)) p = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y})))
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
p \<in> {0..1}

goal (1 subgoal):
 1. binomial_pmf (Suc (card A)) p = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y})))
[PROOF STEP]
by (simp add: binomial_pmf_Suc insert.IH bind_map_pmf)
[PROOF STATE]
proof (state)
this:
binomial_pmf (Suc (card A)) p = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y})))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
binomial_pmf (Suc (card A)) p = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y})))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
have "\<dots> = do {
                      b \<leftarrow> bernoulli_pmf p;
                      f \<leftarrow> Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p);
                      return_pmf (card {y \<in> insert x A. (f(x := b)) y})
                    }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y}))) = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf (card {y \<in> insert x A. (f(x := b)) y})))
[PROOF STEP]
proof (intro bind_pmf_cong refl, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa xaa. \<lbrakk>xa \<in> set_pmf (bernoulli_pmf p); xaa \<in> set_pmf (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> return_pmf ((if xa then 1 else 0) + card {y \<in> A. xaa y}) = return_pmf (card {y \<in> insert x A. (xaa(x := xa)) y})
[PROOF STEP]
case (1 b f)
[PROOF STATE]
proof (state)
this:
b \<in> set_pmf (bernoulli_pmf p)
f \<in> set_pmf (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. \<And>xa xaa. \<lbrakk>xa \<in> set_pmf (bernoulli_pmf p); xaa \<in> set_pmf (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> return_pmf ((if xa then 1 else 0) + card {y \<in> A. xaa y}) = return_pmf (card {y \<in> insert x A. (xaa(x := xa)) y})
[PROOF STEP]
have "(if b then 1 else 0) + card {y\<in>A. f y} = card ((if b then {x} else {}) \<union> {y\<in>A. f y})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if b then 1 else 0) + card {y \<in> A. f y} = card ((if b then {x} else {}) \<union> {y \<in> A. f y})
[PROOF STEP]
using insert.hyps
[PROOF STATE]
proof (prove)
using this:
finite A
x \<notin> A

goal (1 subgoal):
 1. (if b then 1 else 0) + card {y \<in> A. f y} = card ((if b then {x} else {}) \<union> {y \<in> A. f y})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if b then 1 else 0) + card {y \<in> A. f y} = card ((if b then {x} else {}) \<union> {y \<in> A. f y})

goal (1 subgoal):
 1. \<And>xa xaa. \<lbrakk>xa \<in> set_pmf (bernoulli_pmf p); xaa \<in> set_pmf (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> return_pmf ((if xa then 1 else 0) + card {y \<in> A. xaa y}) = return_pmf (card {y \<in> insert x A. (xaa(x := xa)) y})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(if b then 1 else 0) + card {y \<in> A. f y} = card ((if b then {x} else {}) \<union> {y \<in> A. f y})

goal (1 subgoal):
 1. \<And>xa xaa. \<lbrakk>xa \<in> set_pmf (bernoulli_pmf p); xaa \<in> set_pmf (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> return_pmf ((if xa then 1 else 0) + card {y \<in> A. xaa y}) = return_pmf (card {y \<in> insert x A. (xaa(x := xa)) y})
[PROOF STEP]
have "(if b then {x} else {}) \<union> {y\<in>A. f y} = {y\<in>insert x A. (f(x := b)) y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if b then {x} else {}) \<union> {y \<in> A. f y} = {y \<in> insert x A. (f(x := b)) y}
[PROOF STEP]
using insert.hyps
[PROOF STATE]
proof (prove)
using this:
finite A
x \<notin> A

goal (1 subgoal):
 1. (if b then {x} else {}) \<union> {y \<in> A. f y} = {y \<in> insert x A. (f(x := b)) y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if b then {x} else {}) \<union> {y \<in> A. f y} = {y \<in> insert x A. (f(x := b)) y}

goal (1 subgoal):
 1. \<And>xa xaa. \<lbrakk>xa \<in> set_pmf (bernoulli_pmf p); xaa \<in> set_pmf (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> return_pmf ((if xa then 1 else 0) + card {y \<in> A. xaa y}) = return_pmf (card {y \<in> insert x A. (xaa(x := xa)) y})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(if b then 1 else 0) + card {y \<in> A. f y} = card {y \<in> insert x A. (f(x := b)) y}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(if b then 1 else 0) + card {y \<in> A. f y} = card {y \<in> insert x A. (f(x := b)) y}

goal (1 subgoal):
 1. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y}) = return_pmf (card {y \<in> insert x A. (f(x := b)) y})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
return_pmf ((if b then 1 else 0) + card {y \<in> A. f y}) = return_pmf (card {y \<in> insert x A. (f(x := b)) y})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y}))) = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf (card {y \<in> insert x A. (f(x := b)) y})))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y}))) = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf (card {y \<in> insert x A. (f(x := b)) y})))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
have "\<dots> = map_pmf (\<lambda>f. card {y\<in>insert x A. f y})
                      (Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf (card {y \<in> insert x A. (f(x := b)) y}))) = map_pmf (\<lambda>f. card {y \<in> insert x A. f y}) (Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
using insert.hyps
[PROOF STATE]
proof (prove)
using this:
finite A
x \<notin> A

goal (1 subgoal):
 1. bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf (card {y \<in> insert x A. (f(x := b)) y}))) = map_pmf (\<lambda>f. card {y \<in> insert x A. f y}) (Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
by (subst Pi_pmf_insert) (simp_all add: pair_pmf_def map_bind_pmf)
[PROOF STATE]
proof (state)
this:
bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf (card {y \<in> insert x A. (f(x := b)) y}))) = map_pmf (\<lambda>f. card {y \<in> insert x A. f y}) (Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
binomial_pmf (card (insert x A)) p = map_pmf (\<lambda>f. card {y \<in> insert x A. f y}) (Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
binomial_pmf (card (insert x A)) p = map_pmf (\<lambda>f. card {y \<in> insert x A. f y}) (Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. binomial_pmf (card (insert x A)) p = map_pmf (\<lambda>f. card {xa \<in> insert x A. f xa}) (Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
binomial_pmf (card (insert x A)) p = map_pmf (\<lambda>f. card {xa \<in> insert x A. f xa}) (Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
binomial_pmf (card A) p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma llist_all2_lzipI:
  "\<lbrakk> llist_all2 P xs ys; llist_all2 P' xs' ys' \<rbrakk>
  \<Longrightarrow> llist_all2 (rel_prod P P') (lzip xs xs') (lzip ys ys')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>llist_all2 P xs ys; llist_all2 P' xs' ys'\<rbrakk> \<Longrightarrow> llist_all2 (rel_prod P P') (lzip xs xs') (lzip ys ys')
[PROOF STEP]
by(coinduction arbitrary: xs xs' ys ys')(auto 6 6 dest: llist_all2_lhdD llist_all2_lnullD intro: llist_all2_ltlI)


[STATEMENT]
lemma L2_set_empty [simp]: "L2_set f {} = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L2_set f {} = 0
[PROOF STEP]
unfolding L2_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>{}. (f i)\<^sup>2) = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma set_inter_mem:
assumes "x mem l1"
       and "x mem l2"
shows "set l1 \<inter> set l2 \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set l1 \<inter> set l2 \<noteq> {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x mem l1
x mem l2

goal (1 subgoal):
 1. set l1 \<inter> set l2 \<noteq> {}
[PROOF STEP]
by (metis IntI empty_iff mem_set_1)


[STATEMENT]
lemma countable_lfp:
  assumes step: "\<And>Y. countable Y \<Longrightarrow> countable (F Y)"
  and cont: "Order_Continuity.sup_continuous F"
  shows "countable (lfp F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable (lfp F)
[PROOF STEP]
by(subst sup_continuous_lfp[OF cont])(simp add: countable_funpow[OF step])


[STATEMENT]
lemma convex_affinity:
  assumes "convex S"
  shows "convex ((\<lambda>x. a + c *\<^sub>R x) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex ((\<lambda>x. a + c *\<^sub>R x) ` S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex ((\<lambda>x. a + c *\<^sub>R x) ` S)
[PROOF STEP]
have "(\<lambda>x. a + c *\<^sub>R x) ` S = (+) a ` (*\<^sub>R) c ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. a + c *\<^sub>R x) ` S = (+) a ` (*\<^sub>R) c ` S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. a + c *\<^sub>R x) ` S = (+) a ` (*\<^sub>R) c ` S

goal (1 subgoal):
 1. convex ((\<lambda>x. a + c *\<^sub>R x) ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. a + c *\<^sub>R x) ` S = (+) a ` (*\<^sub>R) c ` S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. a + c *\<^sub>R x) ` S = (+) a ` (*\<^sub>R) c ` S

goal (1 subgoal):
 1. convex ((\<lambda>x. a + c *\<^sub>R x) ` S)
[PROOF STEP]
using convex_translation[OF convex_scaling[OF assms], of a c]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. a + c *\<^sub>R x) ` S = (+) a ` (*\<^sub>R) c ` S
convex ((+) a ` (*\<^sub>R) c ` S)

goal (1 subgoal):
 1. convex ((\<lambda>x. a + c *\<^sub>R x) ` S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
convex ((\<lambda>x. a + c *\<^sub>R x) ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma i_shrink_eq_NoMsg_iAll_conv: "
  0 < k \<Longrightarrow> ((s \<div>\<^sub>i k) t = \<NoMsg>) = (\<box> t1 [t * k\<dots>,k - Suc 0]. s t1 = \<NoMsg>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> ((s \<div> k) t = NoMsg) = (\<box> t1 [t * k\<dots>,k - Suc 0]. s t1 = NoMsg)
[PROOF STEP]
apply (simp add: i_shrink_nth last_message_NoMsg_conv iAll_def Ball_def iIN_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> (\<forall>i<k. s (t * k + i) = NoMsg) = (\<forall>x. t * k \<le> x \<and> x \<le> t * k + k - Suc 0 \<longrightarrow> s x = NoMsg)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < k; \<forall>i<k. s (t * k + i) = NoMsg\<rbrakk> \<Longrightarrow> \<forall>x. t * k \<le> x \<and> x \<le> t * k + k - Suc 0 \<longrightarrow> s x = NoMsg
 2. \<lbrakk>0 < k; \<forall>x. t * k \<le> x \<and> x \<le> t * k + k - Suc 0 \<longrightarrow> s x = NoMsg\<rbrakk> \<Longrightarrow> \<forall>i<k. s (t * k + i) = NoMsg
[PROOF STEP]
apply (clarify, rename_tac i)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. \<lbrakk>0 < k; \<forall>i<k. s (t * k + i) = NoMsg; t * k \<le> i; i \<le> t * k + k - Suc 0\<rbrakk> \<Longrightarrow> s i = NoMsg
 2. \<lbrakk>0 < k; \<forall>x. t * k \<le> x \<and> x \<le> t * k + k - Suc 0 \<longrightarrow> s x = NoMsg\<rbrakk> \<Longrightarrow> \<forall>i<k. s (t * k + i) = NoMsg
[PROOF STEP]
apply (drule_tac x="i - t * k" in spec)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. \<lbrakk>0 < k; t * k \<le> i; i \<le> t * k + k - Suc 0; i - t * k < k \<longrightarrow> s (t * k + (i - t * k)) = NoMsg\<rbrakk> \<Longrightarrow> s i = NoMsg
 2. \<lbrakk>0 < k; \<forall>x. t * k \<le> x \<and> x \<le> t * k + k - Suc 0 \<longrightarrow> s x = NoMsg\<rbrakk> \<Longrightarrow> \<forall>i<k. s (t * k + i) = NoMsg
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; \<forall>x. t * k \<le> x \<and> x \<le> t * k + k - Suc 0 \<longrightarrow> s x = NoMsg\<rbrakk> \<Longrightarrow> \<forall>i<k. s (t * k + i) = NoMsg
[PROOF STEP]
apply (clarify, rename_tac i)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>0 < k; \<forall>x. t * k \<le> x \<and> x \<le> t * k + k - Suc 0 \<longrightarrow> s x = NoMsg; i < k\<rbrakk> \<Longrightarrow> s (t * k + i) = NoMsg
[PROOF STEP]
apply (drule_tac x="t * k + i" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>0 < k; i < k; t * k \<le> t * k + i \<and> t * k + i \<le> t * k + k - Suc 0 \<longrightarrow> s (t * k + i) = NoMsg\<rbrakk> \<Longrightarrow> s (t * k + i) = NoMsg
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma row_mat_of_col[simp]: "i < dim_vec v \<Longrightarrow> row (mat_of_col v) i = vec_of_scal (v $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_vec v \<Longrightarrow> row (mat_of_col v) i = vec_of_scal (v $ i)
[PROOF STEP]
unfolding mat_of_col_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_vec v \<Longrightarrow> row (mat_of_row v)\<^sup>T i = vec_of_scal (v $ i)
[PROOF STEP]
by auto


[STATEMENT]
lemma linear_term_inj[simplified,simp]: "inj (\<lambda> a. [:- a, 1::'a::idom:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (\<lambda>a. [:- a, 1::'a:])
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. \<forall>y\<in>UNIV. [:- x, 1::'a:] = [:- y, 1::'a:] \<longrightarrow> x = y
[PROOF STEP]
by simp


[STATEMENT]
lemma frac_less2: "0 < x \<Longrightarrow> x \<le> y \<Longrightarrow> 0 < w \<Longrightarrow> w < z  \<Longrightarrow> x / z < y / w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) < x; x \<le> y; (0::'a) < w; w < z\<rbrakk> \<Longrightarrow> x / z < y / w
[PROOF STEP]
by (metis local.antisym_conv2 local.divide_cancel_left local.dual_order.strict_implies_order
      local.frac_le local.frac_less)


[STATEMENT]
lemma unit_vec_Bounded_vec[simp,intro]: "unit_vec n i \<in> Bounded_vec (max 1 Bnd)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_vec n i \<in> Bounded_vec (max (1::'a) Bnd)
[PROOF STEP]
unfolding Bounded_vec_def unit_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n (\<lambda>j. if j = i then 1::'a else (0::'a)) \<in> {x. \<forall>i<dim_vec x. \<bar>x $ i\<bar> \<le> max (1::'a) Bnd}
[PROOF STEP]
by auto


[STATEMENT]
lemma degree_prod_eq: "(\<And>x. x \<in> A \<Longrightarrow> f x \<noteq> 0) \<Longrightarrow> degree (prod f A) = (\<Sum>x\<in>A. degree (f x))"
  for f :: "'a \<Rightarrow> 'b::{comm_semiring_1, semiring_no_zero_divisors} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> f x \<noteq> 0) \<Longrightarrow> degree (prod f A) = (\<Sum>x\<in>A. degree (f x))
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (auto simp: degree_mult_eq prod_zero_iff')


[STATEMENT]
lemma minus_one_less_multI:
  fixes e x::real
  shows "- 1 \<le> e \<Longrightarrow> 0 < x \<Longrightarrow> x < 1 \<Longrightarrow> - 1 < e * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> e; 0 < x; x < 1\<rbrakk> \<Longrightarrow> - 1 < e * x
[PROOF STEP]
by (metis abs_add_one_gt_zero abs_real_def le_less_trans less_not_sym mult_less_0_iff
    mult_less_cancel_left1 real_0_less_add_iff)


[STATEMENT]
lemma poly_map_is_struct_map:
  assumes "is_poly_tuple n fs"
  assumes "length fs = m"
  shows "poly_map n fs \<in> struct_maps (R\<^bsup>n\<^esup>) (R\<^bsup>m\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_map n fs \<in> struct_maps (R\<^bsup>n\<^esup>) (R\<^bsup>m\<^esup>)
[PROOF STEP]
apply(rule struct_maps_memI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> poly_map n fs x \<in> carrier (R\<^bsup>m\<^esup>)
 2. \<And>x. x \<notin> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> poly_map n fs x = undefined
[PROOF STEP]
unfolding poly_map_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> restrict (poly_tuple_eval fs) (carrier (R\<^bsup>n\<^esup>)) x \<in> carrier (R\<^bsup>m\<^esup>)
 2. \<And>x. x \<notin> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> restrict (poly_tuple_eval fs) (carrier (R\<^bsup>n\<^esup>)) x = undefined
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_poly_tuple n fs
length fs = m

goal (2 subgoals):
 1. \<And>x. x \<in> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> restrict (poly_tuple_eval fs) (carrier (R\<^bsup>n\<^esup>)) x \<in> carrier (R\<^bsup>m\<^esup>)
 2. \<And>x. x \<notin> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> restrict (poly_tuple_eval fs) (carrier (R\<^bsup>n\<^esup>)) x = undefined
[PROOF STEP]
apply (metis poly_tuple_eval_closed restrict_apply')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<notin> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> restrict (poly_tuple_eval fs) (carrier (R\<^bsup>n\<^esup>)) x = undefined
[PROOF STEP]
by (meson restrict_apply)


[STATEMENT]
lemma is_factorization_of_roots:
  fixes a :: "'a :: idom"
  assumes "is_factorization_of (a, fctrs) p" "p \<noteq> 0"
  shows   "set (map fst fctrs) = {x. poly p x = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map fst fctrs) = {x. poly p x = (0::'a)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_factorization_of (a, fctrs) p
p \<noteq> 0

goal (1 subgoal):
 1. set (map fst fctrs) = {x. poly p x = (0::'a)}
[PROOF STEP]
by (force simp: is_factorization_of_def interp_factorization_def o_def
        case_prod_unfold prod_list_zero_iff simp del: power_Suc)