[STATEMENT]
lemma smult_is_continuous:
  assumes "is_Zp_continuous f"
  assumes "a \<in> carrier Zp"
  shows "is_Zp_continuous (a \<odot>\<^bsub>Fun Zp\<^esub> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_Zp_continuous (a \<odot>\<^bsub>function_ring (carrier Zp) Zp\<^esub> f)
[PROOF STEP]
apply(rule is_Zp_continuousI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<odot>\<^bsub>function_ring (carrier Zp) Zp\<^esub> f \<in> carrier (function_ring (carrier Zp) Zp)
 2. \<And>s. is_Zp_cauchy s \<Longrightarrow> is_Zp_cauchy (a \<odot>\<^bsub>function_ring (carrier Zp) Zp\<^esub> f \<circ> s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_Zp_continuous f
a \<in> carrier Zp

goal (2 subgoals):
 1. a \<odot>\<^bsub>function_ring (carrier Zp) Zp\<^esub> f \<in> carrier (function_ring (carrier Zp) Zp)
 2. \<And>s. is_Zp_cauchy s \<Longrightarrow> is_Zp_cauchy (a \<odot>\<^bsub>function_ring (carrier Zp) Zp\<^esub> f \<circ> s)
[PROOF STEP]
apply (simp add: assms function_smult_closed is_Zp_continuous_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. is_Zp_cauchy s \<Longrightarrow> is_Zp_cauchy (a \<odot>\<^bsub>function_ring (carrier Zp) Zp\<^esub> f \<circ> s)
[PROOF STEP]
using ring_seq_smult_comp_assoc assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?s \<in> carrier Zp\<^bsup>\<omega>\<^esup>; ?f \<in> carrier (function_ring (carrier Zp) Zp); ?a \<in> carrier Zp\<rbrakk> \<Longrightarrow> ?a \<odot>\<^bsub>function_ring (carrier Zp) Zp\<^esub> ?f \<circ> ?s = ?a \<odot>\<^bsub>Zp\<^bsup>\<omega>\<^esup>\<^esub> (?f \<circ> ?s)
is_Zp_continuous f
a \<in> carrier Zp

goal (1 subgoal):
 1. \<And>s. is_Zp_cauchy s \<Longrightarrow> is_Zp_cauchy (a \<odot>\<^bsub>function_ring (carrier Zp) Zp\<^esub> f \<circ> s)
[PROOF STEP]
by (simp add: is_Zp_cauchy_imp_closed is_Zp_continuous_def smult_is_Zp_cauchy)


[STATEMENT]
lemma coplanar_perm_15:
  assumes "Coplanar A B C D"
  shows "Coplanar C B D A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar C B D A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Coplanar C B D A
[PROOF STEP]
obtain X where P1: "(Col A B X \<and> Col C D X) \<or> (Col A C X \<and> Col B D X) \<or> (Col A D X \<and> Col B C X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Coplanar_def assms
[PROOF STATE]
proof (prove)
using this:
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Coplanar A B C D

goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar C B D A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar C B D A
[PROOF STEP]
using Coplanar_def col_permutation_4
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Col ?A ?B ?C \<Longrightarrow> Col ?B ?A ?C

goal (1 subgoal):
 1. Coplanar C B D A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Coplanar C B D A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma separate_by_code[code] :
  "separate_by P xs = foldr (\<lambda>x (prevPass,prevFail) . if P x then (x#prevPass,prevFail) else (prevPass,x#prevFail)) xs ([],[])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. separate_by P xs = foldr (\<lambda>x (prevPass, prevFail). if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], [])
[PROOF STEP]
proof (induction xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. separate_by P [] = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) [] ([], [])
 2. \<And>a xs. separate_by P xs = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], []) \<Longrightarrow> separate_by P (a # xs) = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) (a # xs) ([], [])
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. separate_by P [] = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) [] ([], [])
 2. \<And>a xs. separate_by P xs = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], []) \<Longrightarrow> separate_by P (a # xs) = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) (a # xs) ([], [])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. separate_by P [] = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) [] ([], [])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
separate_by P [] = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) [] ([], [])

goal (1 subgoal):
 1. \<And>a xs. separate_by P xs = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], []) \<Longrightarrow> separate_by P (a # xs) = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) (a # xs) ([], [])
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. separate_by P xs = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], []) \<Longrightarrow> separate_by P (a # xs) = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) (a # xs) ([], [])
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
separate_by P xs = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], [])

goal (1 subgoal):
 1. \<And>a xs. separate_by P xs = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], []) \<Longrightarrow> separate_by P (a # xs) = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) (a # xs) ([], [])
[PROOF STEP]
let ?f = "(\<lambda>x (prevPass,prevFail) . if P x then (x#prevPass,prevFail) else (prevPass,x#prevFail))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. separate_by P xs = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], []) \<Longrightarrow> separate_by P (a # xs) = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) (a # xs) ([], [])
[PROOF STEP]
have "(filter P xs, filter (\<lambda> x . \<not> P x) xs) = foldr ?f xs ([],[])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (filter P xs, filter (\<lambda>x. \<not> P x) xs) = foldr (\<lambda>x (prevPass, prevFail). if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], [])
[PROOF STEP]
using Cons.IH
[PROOF STATE]
proof (prove)
using this:
separate_by P xs = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], [])

goal (1 subgoal):
 1. (filter P xs, filter (\<lambda>x. \<not> P x) xs) = foldr (\<lambda>x (prevPass, prevFail). if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], [])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(filter P xs, filter (\<lambda>x. \<not> P x) xs) = foldr (\<lambda>x (prevPass, prevFail). if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], [])

goal (1 subgoal):
 1. \<And>a xs. separate_by P xs = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], []) \<Longrightarrow> separate_by P (a # xs) = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) (a # xs) ([], [])
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(filter P xs, filter (\<lambda>x. \<not> P x) xs) = foldr (\<lambda>x (prevPass, prevFail). if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], [])

goal (1 subgoal):
 1. \<And>a xs. separate_by P xs = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], []) \<Longrightarrow> separate_by P (a # xs) = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) (a # xs) ([], [])
[PROOF STEP]
have "separate_by P (a#xs) = ?f a (filter P xs, filter (\<lambda> x . \<not> P x) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. separate_by P (a # xs) = (case (filter P xs, filter (\<lambda>x. \<not> P x) xs) of (prevPass, prevFail) \<Rightarrow> if P a then (a # prevPass, prevFail) else (prevPass, a # prevFail))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
separate_by P (a # xs) = (case (filter P xs, filter (\<lambda>x. \<not> P x) xs) of (prevPass, prevFail) \<Rightarrow> if P a then (a # prevPass, prevFail) else (prevPass, a # prevFail))

goal (1 subgoal):
 1. \<And>a xs. separate_by P xs = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], []) \<Longrightarrow> separate_by P (a # xs) = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) (a # xs) ([], [])
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(filter P xs, filter (\<lambda>x. \<not> P x) xs) = foldr (\<lambda>x (prevPass, prevFail). if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], [])
separate_by P (a # xs) = (case (filter P xs, filter (\<lambda>x. \<not> P x) xs) of (prevPass, prevFail) \<Rightarrow> if P a then (a # prevPass, prevFail) else (prevPass, a # prevFail))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(filter P xs, filter (\<lambda>x. \<not> P x) xs) = foldr (\<lambda>x (prevPass, prevFail). if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) xs ([], [])
separate_by P (a # xs) = (case (filter P xs, filter (\<lambda>x. \<not> P x) xs) of (prevPass, prevFail) \<Rightarrow> if P a then (a # prevPass, prevFail) else (prevPass, a # prevFail))

goal (1 subgoal):
 1. separate_by P (a # xs) = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) (a # xs) ([], [])
[PROOF STEP]
by (cases "P a"; auto)
[PROOF STATE]
proof (state)
this:
separate_by P (a # xs) = foldr (\<lambda>x a. case a of (prevPass, prevFail) \<Rightarrow> if P x then (x # prevPass, prevFail) else (prevPass, x # prevFail)) (a # xs) ([], [])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Nadd_commute:
  assumes "SORT_CONSTRAINT('a::field_char_0)"
  shows "x +\<^sub>N y = y +\<^sub>N x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x +\<^sub>N y = y +\<^sub>N x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x +\<^sub>N y = y +\<^sub>N x
[PROOF STEP]
have n: "isnormNum (x +\<^sub>N y)" "isnormNum (y +\<^sub>N x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isnormNum (x +\<^sub>N y) &&& isnormNum (y +\<^sub>N x)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
isnormNum (x +\<^sub>N y)
isnormNum (y +\<^sub>N x)

goal (1 subgoal):
 1. x +\<^sub>N y = y +\<^sub>N x
[PROOF STEP]
have "(INum (x +\<^sub>N y)::'a) = INum (y +\<^sub>N x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. INum (x +\<^sub>N y) = INum (y +\<^sub>N x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
INum (x +\<^sub>N y) = INum (y +\<^sub>N x)

goal (1 subgoal):
 1. x +\<^sub>N y = y +\<^sub>N x
[PROOF STEP]
with isnormNum_unique[OF n]
[PROOF STATE]
proof (chain)
picking this:
(INum (x +\<^sub>N y) = INum (y +\<^sub>N x)) = (x +\<^sub>N y = y +\<^sub>N x)
INum (x +\<^sub>N y) = INum (y +\<^sub>N x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(INum (x +\<^sub>N y) = INum (y +\<^sub>N x)) = (x +\<^sub>N y = y +\<^sub>N x)
INum (x +\<^sub>N y) = INum (y +\<^sub>N x)

goal (1 subgoal):
 1. x +\<^sub>N y = y +\<^sub>N x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x +\<^sub>N y = y +\<^sub>N x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_gt_imp_less_multiset: "(\<exists>y. y \<in># N \<and> (\<forall>x. x \<in># M \<longrightarrow> x < y)) \<Longrightarrow> M < N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y. y \<in># N \<and> (\<forall>x. x \<in># M \<longrightarrow> x < y) \<Longrightarrow> M < N
[PROOF STEP]
unfolding less_multiset\<^sub>H\<^sub>O
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y. y \<in># N \<and> (\<forall>x. x \<in># M \<longrightarrow> x < y) \<Longrightarrow> M \<noteq> N \<and> (\<forall>y. count N y < count M y \<longrightarrow> (\<exists>x>y. count M x < count N x))
[PROOF STEP]
by (metis count_eq_zero_iff count_greater_zero_iff less_le_not_le)


[STATEMENT]
lemma mult_less_multiset\<^sub>D\<^sub>M: "(M, N) \<in> mult {(x, y). x < y} \<longleftrightarrow> less_multiset\<^sub>D\<^sub>M M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((M, N) \<in> mult {(x, y). x < y}) = less_multiset\<^sub>D\<^sub>M M N
[PROOF STEP]
unfolding multp_def[of "(<)", symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multp (<) M N = less_multiset\<^sub>D\<^sub>M M N
[PROOF STEP]
using multp_eq_multp\<^sub>D\<^sub>M[of "(<)", simplified]
[PROOF STATE]
proof (prove)
using this:
multp (<) = multp\<^sub>D\<^sub>M (<)

goal (1 subgoal):
 1. multp (<) M N = less_multiset\<^sub>D\<^sub>M M N
[PROOF STEP]
by (simp add: multp\<^sub>D\<^sub>M_def less_multiset\<^sub>D\<^sub>M_def)


[STATEMENT]
lemma differentiable_on_comp2: "(f o g) differentiable_on S"
  if  "f differentiable_on T" "g differentiable_on S" "g ` S \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> g differentiable_on S
[PROOF STEP]
apply (rule differentiable_on_comp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. g differentiable_on S
 2. f differentiable_on g ` S
[PROOF STEP]
apply (rule that)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f differentiable_on g ` S
[PROOF STEP]
apply (rule differentiable_on_subset)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f differentiable_on ?t3
 2. g ` S \<subseteq> ?t3
[PROOF STEP]
apply (rule that)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g ` S \<subseteq> T
[PROOF STEP]
apply (rule that)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma vec_eq_iff: "(x = y) = (dim_vec x = dim_vec y \<and> (\<forall> i < dim_vec y. x $ i = y $ i))" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x = y) = (dim_vec x = dim_vec y \<and> (\<forall>i<dim_vec y. x $ i = y $ i))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = y \<Longrightarrow> dim_vec x = dim_vec y \<and> (\<forall>i<dim_vec y. x $ i = y $ i)
 2. dim_vec x = dim_vec y \<and> (\<forall>i<dim_vec y. x $ i = y $ i) \<Longrightarrow> x = y
[PROOF STEP]
assume ?r
[PROOF STATE]
proof (state)
this:
dim_vec x = dim_vec y \<and> (\<forall>i<dim_vec y. x $ i = y $ i)

goal (2 subgoals):
 1. x = y \<Longrightarrow> dim_vec x = dim_vec y \<and> (\<forall>i<dim_vec y. x $ i = y $ i)
 2. dim_vec x = dim_vec y \<and> (\<forall>i<dim_vec y. x $ i = y $ i) \<Longrightarrow> x = y
[PROOF STEP]
show ?l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
by (rule eq_vecI, insert \<open>?r\<close>, auto)
[PROOF STATE]
proof (state)
this:
x = y

goal (1 subgoal):
 1. x = y \<Longrightarrow> dim_vec x = dim_vec y \<and> (\<forall>i<dim_vec y. x $ i = y $ i)
[PROOF STEP]
qed simp


[STATEMENT]
lemma set_less_eq_aux''_antisym:
  "\<lbrakk> A \<sqsubseteq>''' B; B \<sqsubseteq>''' A;
     A \<in> infinite_complement_partition; B \<in> infinite_complement_partition \<rbrakk>
  \<Longrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<sqsubseteq>''' B; B \<sqsubseteq>''' A; A \<in> infinite_complement_partition; B \<in> infinite_complement_partition\<rbrakk> \<Longrightarrow> A = B
[PROOF STEP]
using set_less_eq_aux''_linear_order
[PROOF STATE]
proof (prove)
using this:
linear_order_on infinite_complement_partition {(A, B). A \<sqsubseteq>''' B}

goal (1 subgoal):
 1. \<lbrakk>A \<sqsubseteq>''' B; B \<sqsubseteq>''' A; A \<in> infinite_complement_partition; B \<in> infinite_complement_partition\<rbrakk> \<Longrightarrow> A = B
[PROOF STEP]
by(auto simp add: linear_order_on_def partial_order_on_def dest: antisymD del: equalityI)


[STATEMENT]
lemma det_cols_mul':
  assumes A: "A \<in> carrier_mat n m"
    and B: "B \<in> carrier_mat m n"
  shows "det (A*B) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i).
       (\<Prod>i = 0..<n. A $$ (i, f i)) * det (mat\<^sub>r n n (\<lambda>i. row B (f i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))
[PROOF STEP]
let ?F="{f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))
[PROOF STEP]
have t: "A * B = (B\<^sup>T*A\<^sup>T)\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B = (B\<^sup>T * A\<^sup>T)\<^sup>T
[PROOF STEP]
using transpose_mult[OF A B] transpose_transpose
[PROOF STATE]
proof (prove)
using this:
(A * B)\<^sup>T = B\<^sup>T * A\<^sup>T
?A\<^sup>T\<^sup>T = ?A

goal (1 subgoal):
 1. A * B = (B\<^sup>T * A\<^sup>T)\<^sup>T
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
A * B = (B\<^sup>T * A\<^sup>T)\<^sup>T

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))
[PROOF STEP]
have "det (B\<^sup>T*A\<^sup>T) = (\<Sum>f\<in>?F. (\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) * det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (B\<^sup>T * A\<^sup>T) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))))
[PROOF STEP]
by (rule det_cols_mul, auto simp add: A B)
[PROOF STATE]
proof (state)
this:
Determinant.det (B\<^sup>T * A\<^sup>T) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Determinant.det (B\<^sup>T * A\<^sup>T) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))
[PROOF STEP]
have "... = (\<Sum>f \<in>?F. (\<Prod>i = 0..<n. A $$ (i, f i)) * det (mat\<^sub>r n n (\<lambda>i. row B (f i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))
[PROOF STEP]
proof (rule sum.cong, rule refl)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} \<Longrightarrow> (\<Prod>i = 0..<n. A\<^sup>T $$ (x i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (x i))) = (\<Prod>i = 0..<n. A $$ (i, x i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (x i)))
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} \<Longrightarrow> (\<Prod>i = 0..<n. A\<^sup>T $$ (x i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (x i))) = (\<Prod>i = 0..<n. A $$ (i, x i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (x i)))
[PROOF STEP]
assume f: "f \<in> ?F"
[PROOF STATE]
proof (state)
this:
f \<in> {f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)}

goal (1 subgoal):
 1. \<And>x. x \<in> {f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} \<Longrightarrow> (\<Prod>i = 0..<n. A\<^sup>T $$ (x i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (x i))) = (\<Prod>i = 0..<n. A $$ (i, x i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (x i)))
[PROOF STEP]
have "(\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) = (\<Prod>i = 0..<n. A $$ (i, f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) = (\<Prod>i = 0..<n. A $$ (i, f i))
[PROOF STEP]
proof (rule prod.cong, rule refl)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<n} \<Longrightarrow> A\<^sup>T $$ (f x, x) = A $$ (x, f x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<n} \<Longrightarrow> A\<^sup>T $$ (f x, x) = A $$ (x, f x)
[PROOF STEP]
assume x: "x \<in> {0..<n}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..<n}

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<n} \<Longrightarrow> A\<^sup>T $$ (f x, x) = A $$ (x, f x)
[PROOF STEP]
show "A\<^sup>T $$ (f x, x) = A $$ (x, f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A\<^sup>T $$ (f x, x) = A $$ (x, f x)
[PROOF STEP]
by (rule index_transpose_mat(1), insert f A x, auto)
[PROOF STATE]
proof (state)
this:
A\<^sup>T $$ (f x, x) = A $$ (x, f x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) = (\<Prod>i = 0..<n. A $$ (i, f i))

goal (1 subgoal):
 1. \<And>x. x \<in> {f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} \<Longrightarrow> (\<Prod>i = 0..<n. A\<^sup>T $$ (x i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (x i))) = (\<Prod>i = 0..<n. A $$ (i, x i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (x i)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) = (\<Prod>i = 0..<n. A $$ (i, f i))

goal (1 subgoal):
 1. \<And>x. x \<in> {f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} \<Longrightarrow> (\<Prod>i = 0..<n. A\<^sup>T $$ (x i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (x i))) = (\<Prod>i = 0..<n. A $$ (i, x i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (x i)))
[PROOF STEP]
have "det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))) = det (mat\<^sub>r n n (\<lambda>i. row B (f i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))) = Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))) = Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i)))
[PROOF STEP]
have row_eq_colT: "row B (f i) $v j = col B\<^sup>T (f i) $v j" if i: "i < n" and j: "j < n" for i j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.row B (f i) $v j = col B\<^sup>T (f i) $v j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Matrix.row B (f i) $v j = col B\<^sup>T (f i) $v j
[PROOF STEP]
have fi_m: "f i < m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i < m
[PROOF STEP]
using f i
[PROOF STATE]
proof (prove)
using this:
f \<in> {f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)}
i < n

goal (1 subgoal):
 1. f i < m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f i < m

goal (1 subgoal):
 1. Matrix.row B (f i) $v j = col B\<^sup>T (f i) $v j
[PROOF STEP]
have "col B\<^sup>T (f i) $v j = B\<^sup>T $$(j, f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col B\<^sup>T (f i) $v j = B\<^sup>T $$ (j, f i)
[PROOF STEP]
by (rule index_col, insert B fi_m j, auto)
[PROOF STATE]
proof (state)
this:
col B\<^sup>T (f i) $v j = B\<^sup>T $$ (j, f i)

goal (1 subgoal):
 1. Matrix.row B (f i) $v j = col B\<^sup>T (f i) $v j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
col B\<^sup>T (f i) $v j = B\<^sup>T $$ (j, f i)

goal (1 subgoal):
 1. Matrix.row B (f i) $v j = col B\<^sup>T (f i) $v j
[PROOF STEP]
have "... = B $$ (f i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B\<^sup>T $$ (j, f i) = B $$ (f i, j)
[PROOF STEP]
using B fi_m j
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat m n
f i < m
j < n

goal (1 subgoal):
 1. B\<^sup>T $$ (j, f i) = B $$ (f i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B\<^sup>T $$ (j, f i) = B $$ (f i, j)

goal (1 subgoal):
 1. Matrix.row B (f i) $v j = col B\<^sup>T (f i) $v j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B\<^sup>T $$ (j, f i) = B $$ (f i, j)

goal (1 subgoal):
 1. Matrix.row B (f i) $v j = col B\<^sup>T (f i) $v j
[PROOF STEP]
have "... = row B (f i) $v j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B $$ (f i, j) = Matrix.row B (f i) $v j
[PROOF STEP]
by (rule index_row[symmetric], insert B fi_m j, auto)
[PROOF STATE]
proof (state)
this:
B $$ (f i, j) = Matrix.row B (f i) $v j

goal (1 subgoal):
 1. Matrix.row B (f i) $v j = col B\<^sup>T (f i) $v j
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
col B\<^sup>T (f i) $v j = Matrix.row B (f i) $v j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
col B\<^sup>T (f i) $v j = Matrix.row B (f i) $v j

goal (1 subgoal):
 1. Matrix.row B (f i) $v j = col B\<^sup>T (f i) $v j
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Matrix.row B (f i) $v j = col B\<^sup>T (f i) $v j

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i < n; ?j < n\<rbrakk> \<Longrightarrow> Matrix.row B (f ?i) $v ?j = col B\<^sup>T (f ?i) $v ?j

goal (1 subgoal):
 1. Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))) = Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))) = Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i)))
[PROOF STEP]
by (rule arg_cong[of _ _ det], rule eq_matI, insert row_eq_colT, auto)
[PROOF STATE]
proof (state)
this:
Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))) = Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))) = Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i)))

goal (1 subgoal):
 1. \<And>x. x \<in> {f. (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i)} \<Longrightarrow> (\<Prod>i = 0..<n. A\<^sup>T $$ (x i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (x i))) = (\<Prod>i = 0..<n. A $$ (i, x i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (x i)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) = (\<Prod>i = 0..<n. A $$ (i, f i))
Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))) = Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i)))
[PROOF STEP]
show "(\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) * det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))) =
         (\<Prod>i = 0..<n. A $$ (i, f i)) * det (mat\<^sub>r n n (\<lambda>i. row B (f i)))"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) = (\<Prod>i = 0..<n. A $$ (i, f i))
Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))) = Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i)))

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))) = (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i))) = (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A\<^sup>T $$ (f i, i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. col B\<^sup>T (f i)))) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Determinant.det (B\<^sup>T * A\<^sup>T) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Determinant.det (B\<^sup>T * A\<^sup>T) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))
[PROOF STEP]
by (metis (no_types, lifting) A B det_transpose transpose_mult mult_carrier_mat)
[PROOF STATE]
proof (state)
this:
Determinant.det (A * B) = (\<Sum>f | (\<forall>i\<in>{0..<n}. f i \<in> {0..<m}) \<and> (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i). (\<Prod>i = 0..<n. A $$ (i, f i)) * Determinant.det (mat\<^sub>r n n (\<lambda>i. Matrix.row B (f i))))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma emeasure_buffon_set'_long:
  shows "l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<ge> 0"
  and   "emeasure lborel Buffon_set' =
           ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d &&& emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d
 2. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
define \<phi>' where "\<phi>' = arcsin (d / l)"
[PROOF STATE]
proof (state)
this:
\<phi>' = arcsin (d / l)

goal (2 subgoals):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d
 2. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have \<phi>'_nonneg: "\<phi>' \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<phi>'
[PROOF STEP]
unfolding \<phi>'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> arcsin (d / l)
[PROOF STEP]
using d l l_ge_d arcsin_le_mono[of 0 "d/l"]
[PROOF STATE]
proof (prove)
using this:
0 < d
0 < l
d \<le> l
\<lbrakk>\<bar>0\<bar> \<le> 1; \<bar>d / l\<bar> \<le> 1\<rbrakk> \<Longrightarrow> (arcsin 0 \<le> arcsin (d / l)) = (0 \<le> d / l)

goal (1 subgoal):
 1. 0 \<le> arcsin (d / l)
[PROOF STEP]
by (simp add: \<phi>'_def)
[PROOF STATE]
proof (state)
this:
0 \<le> \<phi>'

goal (2 subgoals):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d
 2. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have \<phi>'_le: "\<phi>' \<le> pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi>' \<le> pi / 2
[PROOF STEP]
unfolding \<phi>'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arcsin (d / l) \<le> pi / 2
[PROOF STEP]
using arcsin_bounded[of "d/l"] d l l_ge_d
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- 1 \<le> d / l; d / l \<le> 1\<rbrakk> \<Longrightarrow> - (pi / 2) \<le> arcsin (d / l) \<and> arcsin (d / l) \<le> pi / 2
0 < d
0 < l
d \<le> l

goal (1 subgoal):
 1. arcsin (d / l) \<le> pi / 2
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
\<phi>' \<le> pi / 2

goal (2 subgoals):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d
 2. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have ge_phi': "sin \<phi> \<ge> d / l" if "\<phi> \<ge> \<phi>'" "\<phi> \<le> pi / 2" for \<phi>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d / l \<le> sin \<phi>
[PROOF STEP]
using arcsin_le_iff[of "d / l" "\<phi>"] d l_ge_d that \<phi>'_nonneg
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- 1 \<le> d / l; d / l \<le> 1; - pi / 2 \<le> \<phi>; \<phi> \<le> pi / 2\<rbrakk> \<Longrightarrow> (arcsin (d / l) \<le> \<phi>) = (d / l \<le> sin \<phi>)
0 < d
d \<le> l
\<phi>' \<le> \<phi>
\<phi> \<le> pi / 2
0 \<le> \<phi>'

goal (1 subgoal):
 1. d / l \<le> sin \<phi>
[PROOF STEP]
by (auto simp: \<phi>'_def field_simps)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<phi>' \<le> ?\<phi>1; ?\<phi>1 \<le> pi / 2\<rbrakk> \<Longrightarrow> d / l \<le> sin ?\<phi>1

goal (2 subgoals):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d
 2. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have le_phi': "sin \<phi> \<le> d / l" if "\<phi> \<le> \<phi>'" "\<phi> \<ge> 0" for \<phi>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin \<phi> \<le> d / l
[PROOF STEP]
using le_arcsin_iff[of "d / l" "\<phi>"] d l_ge_d that \<phi>'_le
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- 1 \<le> d / l; d / l \<le> 1; - pi / 2 \<le> \<phi>; \<phi> \<le> pi / 2\<rbrakk> \<Longrightarrow> (\<phi> \<le> arcsin (d / l)) = (sin \<phi> \<le> d / l)
0 < d
d \<le> l
\<phi> \<le> \<phi>'
0 \<le> \<phi>
\<phi>' \<le> pi / 2

goal (1 subgoal):
 1. sin \<phi> \<le> d / l
[PROOF STEP]
by (auto simp: \<phi>'_def field_simps)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?\<phi>1 \<le> \<phi>'; 0 \<le> ?\<phi>1\<rbrakk> \<Longrightarrow> sin ?\<phi>1 \<le> d / l

goal (2 subgoals):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d
 2. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "cos \<phi>' = sqrt (1 - (d / l)^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos \<phi>' = sqrt (1 - (d / l)\<^sup>2)
[PROOF STEP]
unfolding \<phi>'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (arcsin (d / l)) = sqrt (1 - (d / l)\<^sup>2)
[PROOF STEP]
by (rule cos_arcsin) (insert d l l_ge_d, auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
cos \<phi>' = sqrt (1 - (d / l)\<^sup>2)

goal (2 subgoals):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d
 2. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "l * (1 - cos \<phi>') + arccos (d / l) * d \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> l * (1 - cos \<phi>') + arccos (d / l) * d
[PROOF STEP]
using l d l_ge_d
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < d
d \<le> l

goal (1 subgoal):
 1. 0 \<le> l * (1 - cos \<phi>') + arccos (d / l) * d
[PROOF STEP]
by (intro add_nonneg_nonneg mult_nonneg_nonneg arccos_lbound) (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
0 \<le> l * (1 - cos \<phi>') + arccos (d / l) * d

goal (2 subgoals):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d
 2. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
thus "l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> l * (1 - cos \<phi>') + arccos (d / l) * d

goal (1 subgoal):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d
[PROOF STEP]
by (simp add: \<open>cos \<phi>' = sqrt (1 - (d / l)^2)\<close>)
[PROOF STATE]
proof (state)
this:
0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
let ?f = "(\<lambda>x. min (d / 2) (sin x * l / 2))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "emeasure lborel Buffon_set' = ennreal (integral {0..pi} ?f)" (is "_ = ennreal ?I")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
by (rule emeasure_buffon_set')
[PROOF STATE]
proof (state)
this:
emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "?I = integral {0..pi/2} ?f + integral {pi/2..pi} ?f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) + integral {pi / 2..pi} (\<lambda>x. min (d / 2) (sin x * l / 2))
[PROOF STEP]
by (rule Henstock_Kurzweil_Integration.integral_combine [symmetric]) (auto intro!: integrable_continuous_real continuous_intros)
[PROOF STATE]
proof (state)
this:
integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) + integral {pi / 2..pi} (\<lambda>x. min (d / 2) (sin x * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) + integral {pi / 2..pi} (\<lambda>x. min (d / 2) (sin x * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "integral {pi/2..pi} ?f = integral {-pi/2..0} (?f \<circ> (\<lambda>\<phi>. \<phi> + pi))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {pi / 2..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {- pi / 2..0} ((\<lambda>x. min (d / 2) (sin x * l / 2)) \<circ> (\<lambda>\<phi>. \<phi> + pi))
[PROOF STEP]
by (subst integral_shift) (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
integral {pi / 2..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {- pi / 2..0} ((\<lambda>x. min (d / 2) (sin x * l / 2)) \<circ> (\<lambda>\<phi>. \<phi> + pi))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {pi / 2..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {- pi / 2..0} ((\<lambda>x. min (d / 2) (sin x * l / 2)) \<circ> (\<lambda>\<phi>. \<phi> + pi))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "\<dots> = integral {-(pi/2)..-0} (\<lambda>x. min (d / 2) (sin (-x) * l / 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {- pi / 2..0} ((\<lambda>x. min (d / 2) (sin x * l / 2)) \<circ> (\<lambda>\<phi>. \<phi> + pi)) = integral {- (pi / 2)..- 0} (\<lambda>x. min (d / 2) (sin (- x) * l / 2))
[PROOF STEP]
by (simp add: o_def)
[PROOF STATE]
proof (state)
this:
integral {- pi / 2..0} ((\<lambda>x. min (d / 2) (sin x * l / 2)) \<circ> (\<lambda>\<phi>. \<phi> + pi)) = integral {- (pi / 2)..- 0} (\<lambda>x. min (d / 2) (sin (- x) * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {- pi / 2..0} ((\<lambda>x. min (d / 2) (sin x * l / 2)) \<circ> (\<lambda>\<phi>. \<phi> + pi)) = integral {- (pi / 2)..- 0} (\<lambda>x. min (d / 2) (sin (- x) * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "\<dots> = integral {0..pi/2} ?f" (is "_ = ?I")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {- (pi / 2)..- 0} (\<lambda>x. min (d / 2) (sin (- x) * l / 2)) = integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2))
[PROOF STEP]
by (subst Henstock_Kurzweil_Integration.integral_reflect_real) simp_all
[PROOF STATE]
proof (state)
this:
integral {- (pi / 2)..- 0} (\<lambda>x. min (d / 2) (sin (- x) * l / 2)) = integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {- (pi / 2)..- 0} (\<lambda>x. min (d / 2) (sin (- x) * l / 2)) = integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "\<dots> + \<dots> = 2 * \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) + integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) = 2 * integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) + integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) = 2 * integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) + integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) = 2 * integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "?I = integral {0..\<phi>'} ?f + integral {\<phi>'..pi/2} ?f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..\<phi>'} (\<lambda>x. min (d / 2) (sin x * l / 2)) + integral {\<phi>'..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2))
[PROOF STEP]
using l d l_ge_d \<phi>'_nonneg \<phi>'_le
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < d
d \<le> l
0 \<le> \<phi>'
\<phi>' \<le> pi / 2

goal (1 subgoal):
 1. integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..\<phi>'} (\<lambda>x. min (d / 2) (sin x * l / 2)) + integral {\<phi>'..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2))
[PROOF STEP]
by (intro Henstock_Kurzweil_Integration.integral_combine [symmetric]) (auto intro!: integrable_continuous_real continuous_intros)
[PROOF STATE]
proof (state)
this:
integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..\<phi>'} (\<lambda>x. min (d / 2) (sin x * l / 2)) + integral {\<phi>'..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {0..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..\<phi>'} (\<lambda>x. min (d / 2) (sin x * l / 2)) + integral {\<phi>'..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "integral {0..\<phi>'} ?f = integral {0..\<phi>'} (\<lambda>x. l / 2 * sin x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..\<phi>'} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..\<phi>'} (\<lambda>x. l / 2 * sin x)
[PROOF STEP]
using l
[PROOF STATE]
proof (prove)
using this:
0 < l

goal (1 subgoal):
 1. integral {0..\<phi>'} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..\<phi>'} (\<lambda>x. l / 2 * sin x)
[PROOF STEP]
by (intro integral_cong) (auto simp: min_def field_simps dest: le_phi')
[PROOF STATE]
proof (state)
this:
integral {0..\<phi>'} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..\<phi>'} (\<lambda>x. l / 2 * sin x)

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {0..\<phi>'} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..\<phi>'} (\<lambda>x. l / 2 * sin x)

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "((\<lambda>x. l / 2 * sin x) has_integral (- (l / 2 * cos \<phi>') - (- (l / 2 * cos 0)))) {0..\<phi>'}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. l / 2 * sin x) has_integral - (l / 2 * cos \<phi>') - - (l / 2 * cos 0)) {0..\<phi>'}
[PROOF STEP]
using \<phi>'_nonneg
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<phi>'

goal (1 subgoal):
 1. ((\<lambda>x. l / 2 * sin x) has_integral - (l / 2 * cos \<phi>') - - (l / 2 * cos 0)) {0..\<phi>'}
[PROOF STEP]
by (intro fundamental_theorem_of_calculus)
       (auto simp: has_real_derivative_iff_has_vector_derivative [symmetric] intro!: derivative_eq_intros)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. l / 2 * sin x) has_integral - (l / 2 * cos \<phi>') - - (l / 2 * cos 0)) {0..\<phi>'}

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
hence "integral {0..\<phi>'} (\<lambda>x. l / 2 * sin x) = (1 - cos \<phi>') * l / 2"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. l / 2 * sin x) has_integral - (l / 2 * cos \<phi>') - - (l / 2 * cos 0)) {0..\<phi>'}

goal (1 subgoal):
 1. integral {0..\<phi>'} (\<lambda>x. l / 2 * sin x) = (1 - cos \<phi>') * l / 2
[PROOF STEP]
by (simp add: has_integral_iff algebra_simps)
[PROOF STATE]
proof (state)
this:
integral {0..\<phi>'} (\<lambda>x. l / 2 * sin x) = (1 - cos \<phi>') * l / 2

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {0..\<phi>'} (\<lambda>x. l / 2 * sin x) = (1 - cos \<phi>') * l / 2

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "integral {\<phi>'..pi/2} ?f = integral {\<phi>'..pi/2} (\<lambda>_. d / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {\<phi>'..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {\<phi>'..pi / 2} (\<lambda>_. d / 2)
[PROOF STEP]
using l
[PROOF STATE]
proof (prove)
using this:
0 < l

goal (1 subgoal):
 1. integral {\<phi>'..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {\<phi>'..pi / 2} (\<lambda>_. d / 2)
[PROOF STEP]
by (intro integral_cong) (auto simp: min_def field_simps dest: ge_phi')
[PROOF STATE]
proof (state)
this:
integral {\<phi>'..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {\<phi>'..pi / 2} (\<lambda>_. d / 2)

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {\<phi>'..pi / 2} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {\<phi>'..pi / 2} (\<lambda>_. d / 2)

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "\<dots> = arccos (d / l) * d / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {\<phi>'..pi / 2} (\<lambda>_. d / 2) = arccos (d / l) * d / 2
[PROOF STEP]
using \<phi>'_le d l l_ge_d
[PROOF STATE]
proof (prove)
using this:
\<phi>' \<le> pi / 2
0 < d
0 < l
d \<le> l

goal (1 subgoal):
 1. integral {\<phi>'..pi / 2} (\<lambda>_. d / 2) = arccos (d / l) * d / 2
[PROOF STEP]
by (subst arccos_arcsin_eq) (auto simp: field_simps \<phi>'_def)
[PROOF STATE]
proof (state)
this:
integral {\<phi>'..pi / 2} (\<lambda>_. d / 2) = arccos (d / l) * d / 2

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {\<phi>'..pi / 2} (\<lambda>_. d / 2) = arccos (d / l) * d / 2

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
note \<open>cos \<phi>' = sqrt (1 - (d / l)^2)\<close>
[PROOF STATE]
proof (state)
this:
cos \<phi>' = sqrt (1 - (d / l)\<^sup>2)

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos \<phi>' = sqrt (1 - (d / l)\<^sup>2)

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
have "2 * ((1 - sqrt (1 - (d / l)\<^sup>2)) * l / 2 + arccos (d / l) * d / 2) =
               l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * ((1 - sqrt (1 - (d / l)\<^sup>2)) * l / 2 + arccos (d / l) * d / 2) = l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d
[PROOF STEP]
using d l
[PROOF STATE]
proof (prove)
using this:
0 < d
0 < l

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

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
show "emeasure lborel Buffon_set' =
                  ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)"
[PROOF STATE]
proof (prove)
using this:
emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure lborel Buffon_set' = ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma use_iso1:
  "\<lbrakk>isotone A A f; x \<in> carrier A; y \<in> carrier A; x \<sqsubseteq>\<^bsub>A\<^esub> y\<rbrakk> \<Longrightarrow>
   f x \<sqsubseteq>\<^bsub>A\<^esub> f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Mono\<^bsub>A\<^esub> f; x \<in> carrier A; y \<in> carrier A; x \<sqsubseteq>\<^bsub>A\<^esub> y\<rbrakk> \<Longrightarrow> f x \<sqsubseteq>\<^bsub>A\<^esub> f y
[PROOF STEP]
by (simp add: isotone_def)


[STATEMENT]
lemma rev_pair_relator_list: "rev (pair_relator_list s t) = pair_relator_list t s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev (pair_relator_list s t) = pair_relator_list t s
[PROOF STEP]
by (simp add:rev_alternating_list add_order_add_sym)


[STATEMENT]
lemma algebraic_power [intro]: "algebraic x \<Longrightarrow> algebraic (x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic x \<Longrightarrow> algebraic (x ^ n)
[PROOF STEP]
by (induction n) (auto intro: algebraic_times)


[STATEMENT]
lemma list_all_length:
  "list_all P xs \<longleftrightarrow> (\<forall>n < length xs. P (xs ! n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all P xs = (\<forall>n<length xs. P (xs ! n))
[PROOF STEP]
by (auto simp add: list_all_iff set_conv_nth)


[STATEMENT]
lemma bigo_useful_add: "f =o O(h) \<Longrightarrow> g =o O(h) \<Longrightarrow> f + g =o O(h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> O(h); g \<in> O(h)\<rbrakk> \<Longrightarrow> f + g \<in> O(h)
[PROOF STEP]
apply (subst bigo_plus_idemp [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> O(h); g \<in> O(h)\<rbrakk> \<Longrightarrow> f + g \<in> O(h) + O(h)
[PROOF STEP]
apply (rule set_plus_intro)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>f \<in> O(h); g \<in> O(h)\<rbrakk> \<Longrightarrow> f \<in> O(h)
 2. \<lbrakk>f \<in> O(h); g \<in> O(h)\<rbrakk> \<Longrightarrow> g \<in> O(h)
[PROOF STEP]
apply assumption+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma finite_atLeastZeroLessThan_integer: "finite {(0::integer)..<u}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {0..<u}
[PROOF STEP]
apply (cases "0 \<le> u")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 \<le> u \<Longrightarrow> finite {0..<u}
 2. \<not> 0 \<le> u \<Longrightarrow> finite {0..<u}
[PROOF STEP]
apply (subst image_atLeastZeroLessThan_integer, assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 \<le> u \<Longrightarrow> finite (of_nat ` {..<nat_of_integer u})
 2. \<not> 0 \<le> u \<Longrightarrow> finite {0..<u}
[PROOF STEP]
apply (rule finite_imageI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 \<le> u \<Longrightarrow> finite {..<nat_of_integer u}
 2. \<not> 0 \<le> u \<Longrightarrow> finite {0..<u}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma borel_measurable_iff_less:
  "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. f w < a} \<in> sets M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> borel_measurable M) = (\<forall>a. {w \<in> space M. f w < a} \<in> sets M)
[PROOF STEP]
using borel_measurable_iff_halfspace_less[where 'c=real]
[PROOF STATE]
proof (prove)
using this:
(?f \<in> borel_measurable ?M) = (\<forall>i\<in>Basis. \<forall>a. {w \<in> space ?M. ?f w \<bullet> i < a} \<in> sets ?M)

goal (1 subgoal):
 1. (f \<in> borel_measurable M) = (\<forall>a. {w \<in> space M. f w < a} \<in> sets M)
[PROOF STEP]
by simp


[STATEMENT]
lemma measure_Un_null_set: "A \<in> sets M \<Longrightarrow> B \<in> null_sets M \<Longrightarrow> measure M (A \<union> B) = measure M A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> sets M; B \<in> null_sets M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A
[PROOF STEP]
by (simp add: measure_def emeasure_Un_null_set)


[STATEMENT]
lemma Lim_at_zero:
  fixes a :: "'a::real_normed_vector"
    and l :: "'b::topological_space"
  shows "(f \<longlongrightarrow> l) (at a) \<longleftrightarrow> ((\<lambda>x. f(a + x)) \<longlongrightarrow> l) (at 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>a\<rightarrow> l = (\<lambda>x. f (a + x)) \<midarrow>0::'a\<rightarrow> l
[PROOF STEP]
using LIM_offset_zero LIM_offset_zero_cancel
[PROOF STATE]
proof (prove)
using this:
?f \<midarrow>?a\<rightarrow> ?L \<Longrightarrow> (\<lambda>h. ?f (?a + h)) \<midarrow>0::?'a\<rightarrow> ?L
(\<lambda>h. ?f (?a + h)) \<midarrow>0::?'a\<rightarrow> ?L \<Longrightarrow> ?f \<midarrow>?a\<rightarrow> ?L

goal (1 subgoal):
 1. f \<midarrow>a\<rightarrow> l = (\<lambda>x. f (a + x)) \<midarrow>0::'a\<rightarrow> l
[PROOF STEP]
..


[STATEMENT]
lemma (in VectorSpace) n_inj_comp_end :
  "\<lbrakk> VEnd S; VEnd T; \<not> inj_on (S \<circ> T) V \<rbrakk> \<Longrightarrow> \<not> inj_on S V \<or> \<not> inj_on T V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>VEnd S; VEnd T; \<not> inj_on (S \<circ> T) V\<rbrakk> \<Longrightarrow> \<not> inj_on S V \<or> \<not> inj_on T V
[PROOF STEP]
using inj_comp_end
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>VEnd ?S; inj_on ?S V; VEnd ?T; inj_on ?T V\<rbrakk> \<Longrightarrow> inj_on (?S \<circ> ?T) V

goal (1 subgoal):
 1. \<lbrakk>VEnd S; VEnd T; \<not> inj_on (S \<circ> T) V\<rbrakk> \<Longrightarrow> \<not> inj_on S V \<or> \<not> inj_on T V
[PROOF STEP]
by fast


[STATEMENT]
lemma integer_sword_bounded_eq:
  assumes "- (2 ^ (LENGTH('a::len) - 1)) \<le> i"
    and "i < 2 ^ (LENGTH('a) - 1)"
  shows "integer_of_sword ((sword_of_integer :: integer \<Rightarrow> 'a sword) i) = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integer_of_sword (sword_of_integer i) = i
[PROOF STEP]
unfolding integer_of_sword_def sword_of_integer_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integer_of_int (sint (word_of_int (int_of_integer i))) = i
[PROOF STEP]
using signed_take_bit_int_eq_self assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- (2 ^ ?n) \<le> ?k; ?k < 2 ^ ?n\<rbrakk> \<Longrightarrow> signed_take_bit ?n ?k = ?k
- (2 ^ (LENGTH('a) - 1)) \<le> i
i < 2 ^ (LENGTH('a) - 1)

goal (1 subgoal):
 1. integer_of_int (sint (word_of_int (int_of_integer i))) = i
[PROOF STEP]
by (smt (verit) diff_numeral_special(11) int_of_integer_numeral integer_less_eq_iff integer_of_int_eq_of_int len_signed minus_integer.rep_eq numeral_power_eq_of_int_cancel_iff of_int_integer_of of_int_power_less_of_int_cancel_iff one_integer.rep_eq sint_of_int_eq uminus_integer.rep_eq)


[STATEMENT]
lemma min_product_set_union[simp]:
  "finite X \<Longrightarrow> finite Y \<Longrightarrow> \<Otimes>\<^sub>m (X \<union> Y) = (\<Otimes>\<^sub>m X) \<otimes>\<^sub>m (\<Otimes>\<^sub>m Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite X; finite Y\<rbrakk> \<Longrightarrow> \<Otimes>\<^sub>m (X \<union> Y) = \<Otimes>\<^sub>m X \<otimes>\<^sub>m \<Otimes>\<^sub>m Y
[PROOF STEP]
by (induction X rule: finite_induct) simp_all