[STATEMENT]
lemma Aleph_Limit:
  assumes "Limit \<gamma>"
  shows "Aleph \<gamma> = \<Squnion> (Aleph ` elts \<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<aleph>\<gamma> = \<Squnion> (Aleph ` elts \<gamma>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<aleph>\<gamma> = \<Squnion> (Aleph ` elts \<gamma>)
[PROOF STEP]
have [simp]: "\<gamma> \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<gamma> \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Limit \<gamma>

goal (1 subgoal):
 1. \<gamma> \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<gamma> \<noteq> 0

goal (1 subgoal):
 1. \<aleph>\<gamma> = \<Squnion> (Aleph ` elts \<gamma>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<aleph>\<gamma> = \<Squnion> (Aleph ` elts \<gamma>)
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<aleph>\<gamma> \<le> \<Squnion> (Aleph ` elts \<gamma>)
 2. \<Squnion> (Aleph ` elts \<gamma>) \<le> \<aleph>\<gamma>
[PROOF STEP]
show "Aleph \<gamma> \<le> \<Squnion> (Aleph ` elts \<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<aleph>\<gamma> \<le> \<Squnion> (Aleph ` elts \<gamma>)
[PROOF STEP]
apply (simp add: Aleph [of \<gamma>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<omega> \<le> \<Squnion> (Aleph ` elts \<gamma>) \<and> (\<Squnion>y\<in>elts \<gamma>. csucc (\<aleph>y)) \<le> \<Squnion> (Aleph ` elts \<gamma>)
[PROOF STEP]
by (metis (mono_tags, lifting) Aleph_0 Aleph_succ Limit_def ZFC_in_HOL.SUP_le_iff
           ZFC_in_HOL.Sup_upper assms imageI replacement small_elts)
[PROOF STATE]
proof (state)
this:
\<aleph>\<gamma> \<le> \<Squnion> (Aleph ` elts \<gamma>)

goal (1 subgoal):
 1. \<Squnion> (Aleph ` elts \<gamma>) \<le> \<aleph>\<gamma>
[PROOF STEP]
show "\<Squnion> (Aleph ` elts \<gamma>) \<le> Aleph \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> (Aleph ` elts \<gamma>) \<le> \<aleph>\<gamma>
[PROOF STEP]
apply (simp add: cSup_le_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>elts \<gamma>. \<aleph>x \<le> \<aleph>\<gamma>
[PROOF STEP]
by (meson InfCard_Aleph InfCard_def csucc_Aleph_le_Aleph le_csucc order_trans)
[PROOF STATE]
proof (state)
this:
\<Squnion> (Aleph ` elts \<gamma>) \<le> \<aleph>\<gamma>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<aleph>\<gamma> = \<Squnion> (Aleph ` elts \<gamma>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma omega_continuous_imp_mono_refl:
  assumes cont: "omega_continuous f"
    and x: "x \<in> A" and y: "y \<in> A"
    and xy: "x \<sqsubseteq> y" and xx: "x \<sqsubseteq> x" and yy: "y \<sqsubseteq> y"
  shows "f x \<sqsubseteq> f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x \<sqsubseteq> f y
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f x \<sqsubseteq> f y
[PROOF STEP]
define c :: "nat \<Rightarrow> 'a" where "c \<equiv> \<lambda>i. if i = 0 then x else y"
[PROOF STATE]
proof (state)
this:
c \<equiv> \<lambda>i. if i = 0 then x else y

goal (1 subgoal):
 1. f x \<sqsubseteq> f y
[PROOF STEP]
from x y xx xy yy
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
y \<in> A
x \<sqsubseteq> x
x \<sqsubseteq> y
y \<sqsubseteq> y
[PROOF STEP]
have c: "range c \<subseteq> A" "monotone (\<le>) (\<sqsubseteq>) c"
[PROOF STATE]
proof (prove)
using this:
x \<in> A
y \<in> A
x \<sqsubseteq> x
x \<sqsubseteq> y
y \<sqsubseteq> y

goal (1 subgoal):
 1. range c \<subseteq> A &&& monotone (\<le>) (\<sqsubseteq>) c
[PROOF STEP]
by (auto simp: c_def intro!: monotoneI)
[PROOF STATE]
proof (state)
this:
range c \<subseteq> A
monotone (\<le>) (\<sqsubseteq>) c

goal (1 subgoal):
 1. f x \<sqsubseteq> f y
[PROOF STEP]
have "extreme_bound A (\<sqsubseteq>) (range c) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extreme_bound A (\<sqsubseteq>) (range c) y
[PROOF STEP]
using xy yy x y
[PROOF STATE]
proof (prove)
using this:
x \<sqsubseteq> y
y \<sqsubseteq> y
x \<in> A
y \<in> A

goal (1 subgoal):
 1. extreme_bound A (\<sqsubseteq>) (range c) y
[PROOF STEP]
by (auto simp: c_def)
[PROOF STATE]
proof (state)
this:
extreme_bound A (\<sqsubseteq>) (range c) y

goal (1 subgoal):
 1. f x \<sqsubseteq> f y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
extreme_bound A (\<sqsubseteq>) (range c) y
[PROOF STEP]
have fboy: "extreme_bound A (\<sqsubseteq>) (f ` range c) (f y)"
[PROOF STATE]
proof (prove)
using this:
extreme_bound A (\<sqsubseteq>) (range c) y

goal (1 subgoal):
 1. extreme_bound A (\<sqsubseteq>) (f ` range c) (f y)
[PROOF STEP]
using c cont y
[PROOF STATE]
proof (prove)
using this:
extreme_bound A (\<sqsubseteq>) (range c) y
range c \<subseteq> A
monotone (\<le>) (\<sqsubseteq>) c
local.omega_continuous f
y \<in> A

goal (1 subgoal):
 1. extreme_bound A (\<sqsubseteq>) (f ` range c) (f y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
extreme_bound A (\<sqsubseteq>) (f ` range c) (f y)

goal (1 subgoal):
 1. f x \<sqsubseteq> f y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
extreme_bound A (\<sqsubseteq>) (f ` range c) (f y)
[PROOF STEP]
show "f x \<sqsubseteq> f y"
[PROOF STATE]
proof (prove)
using this:
extreme_bound A (\<sqsubseteq>) (f ` range c) (f y)

goal (1 subgoal):
 1. f x \<sqsubseteq> f y
[PROOF STEP]
by (auto simp: c_def)
[PROOF STATE]
proof (state)
this:
f x \<sqsubseteq> f y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem c_fst_is_pr [prec]: "c_fst \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_fst \<in> PrimRec1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_fst \<in> PrimRec1
[PROOF STEP]
have S1: "(\<lambda> u. c_fst u) = (\<lambda> u. (u - sf (c_sum u)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_fst = (\<lambda>u. u - sf (c_sum u))
[PROOF STEP]
by (simp add: c_fst_def ext)
[PROOF STATE]
proof (state)
this:
c_fst = (\<lambda>u. u - sf (c_sum u))

goal (1 subgoal):
 1. c_fst \<in> PrimRec1
[PROOF STEP]
from c_sum_is_pr
[PROOF STATE]
proof (chain)
picking this:
c_sum \<in> PrimRec1
[PROOF STEP]
have "(\<lambda> u. (u - sf (c_sum u))) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
using this:
c_sum \<in> PrimRec1

goal (1 subgoal):
 1. (\<lambda>u. u - sf (c_sum u)) \<in> PrimRec1
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
(\<lambda>u. u - sf (c_sum u)) \<in> PrimRec1

goal (1 subgoal):
 1. c_fst \<in> PrimRec1
[PROOF STEP]
with S1
[PROOF STATE]
proof (chain)
picking this:
c_fst = (\<lambda>u. u - sf (c_sum u))
(\<lambda>u. u - sf (c_sum u)) \<in> PrimRec1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c_fst = (\<lambda>u. u - sf (c_sum u))
(\<lambda>u. u - sf (c_sum u)) \<in> PrimRec1

goal (1 subgoal):
 1. c_fst \<in> PrimRec1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_fst \<in> PrimRec1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bst_wrt_mono: "(\<And>x y. P x y \<Longrightarrow> Q x y) \<Longrightarrow> bst_wrt P t \<Longrightarrow> bst_wrt Q t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. P x y \<Longrightarrow> Q x y; bst_wrt P t\<rbrakk> \<Longrightarrow> bst_wrt Q t
[PROOF STEP]
by (induction t) (auto)


[STATEMENT]
lemma (in equivalence) closure_inclusion:
  assumes "A \<subseteq> B"
  shows "closure_of A \<subseteq> closure_of B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure_of A \<subseteq> closure_of B
[PROOF STEP]
unfolding eq_closure_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y \<in> carrier S. y .\<in> A} \<subseteq> {y \<in> carrier S. y .\<in> B}
[PROOF STEP]
using assms elem_subsetD
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B
\<lbrakk>?A \<subseteq> ?B; ?a .\<in> ?A\<rbrakk> \<Longrightarrow> ?a .\<in> ?B

goal (1 subgoal):
 1. {y \<in> carrier S. y .\<in> A} \<subseteq> {y \<in> carrier S. y .\<in> B}
[PROOF STEP]
by auto


[STATEMENT]
lemma gexp_max_input_Nor:
  "max_input (Nor g1 g2) = max (max_input g1) (max_input g2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GExp.max_input (Nor g1 g2) = max (GExp.max_input g1) (GExp.max_input g2)
[PROOF STEP]
apply (simp add: AExp.max_input_def max_input_def Let_def max_absorb2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enumerate_gexp_inputs g1 \<noteq> {} \<longrightarrow> enumerate_gexp_inputs g2 \<noteq> {} \<longrightarrow> Some (Max (enumerate_gexp_inputs g1 \<union> enumerate_gexp_inputs g2)) = max (Some (Max (enumerate_gexp_inputs g1))) (Some (Max (enumerate_gexp_inputs g2)))
[PROOF STEP]
by (metis List.finite_set Max.union enumerate_gexp_inputs_list less_eq_option_Some_None max_def sup_Some sup_max)


[STATEMENT]
lemma Inf_eq_PInfty:
  fixes S :: "ereal set"
  shows "Inf S = \<infinity> \<longleftrightarrow> S = {} \<or> S = {\<infinity>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Inf S = \<infinity>) = (S = {} \<or> S = {\<infinity>})
[PROOF STEP]
using Sup_eq_MInfty[of "uminus`S"]
[PROOF STATE]
proof (prove)
using this:
(Sup (uminus ` S) = - \<infinity>) = (uminus ` S = {} \<or> uminus ` S = {- \<infinity>})

goal (1 subgoal):
 1. (Inf S = \<infinity>) = (S = {} \<or> S = {\<infinity>})
[PROOF STEP]
unfolding ereal_Sup_uminus_image_eq ereal_image_uminus_shift
[PROOF STATE]
proof (prove)
using this:
(- Inf S = - \<infinity>) = (S = uminus ` {} \<or> S = uminus ` {- \<infinity>})

goal (1 subgoal):
 1. (Inf S = \<infinity>) = (S = {} \<or> S = {\<infinity>})
[PROOF STEP]
by simp


[STATEMENT]
lemma LIM_at_top_divide:
  fixes f g :: "'a \<Rightarrow> real"
  assumes f: "(f \<longlongrightarrow> a) F" "0 < a"
    and g: "(g \<longlongrightarrow> 0) F" "eventually (\<lambda>x. 0 < g x) F"
  shows "LIM x F. f x / g x :> at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x F. f x / g x :> at_top
[PROOF STEP]
unfolding divide_inverse
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x F. f x * inverse (g x) :> at_top
[PROOF STEP]
by (rule filterlim_tendsto_pos_mult_at_top[OF f]) (rule filterlim_inverse_at_top[OF g])


[STATEMENT]
lemma continuous_within_cot [continuous_intros]:
  fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
  shows "continuous (at x within s) f \<Longrightarrow> sin (f x) \<noteq> 0 \<Longrightarrow> continuous (at x within s) (\<lambda>x. cot (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous (at x within s) f; sin (f x) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> continuous (at x within s) (\<lambda>x. cot (f x))
[PROOF STEP]
unfolding continuous_within
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f x) (at x within s); sin (f x) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> ((\<lambda>x. cot (f x)) \<longlongrightarrow> cot (f x)) (at x within s)
[PROOF STEP]
by (rule tendsto_cot)


[STATEMENT]
lemma countable_infinite_vcard: "countable (elts x) \<and> infinite (elts x) \<longleftrightarrow> vcard x = \<aleph>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (countable (elts x) \<and> infinite (elts x)) = (vcard x = \<aleph>0)
[PROOF STEP]
by (metis Aleph_0 countable_iff_le_Aleph0 dual_order.refl finite_iff_less_Aleph0 less_V_def)


[STATEMENT]
lemma nn_integral_spmf_of_set: "nn_integral (measure_spmf (spmf_of_set A)) f = sum f A / card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_spmf (spmf_of_set A)) f = sum f A / of_nat (card A)
[PROOF STEP]
by(cases "finite A")(auto simp add: spmf_of_set_def nn_integral_pmf_of_set card_gt_0_iff simp del: spmf_of_pmf_pmf_of_set)


[STATEMENT]
lemma Log_one [simp]: "\<lbrakk> 0 < a; a \<noteq> 1 \<rbrakk> \<Longrightarrow> Log a 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; a \<noteq> 1\<rbrakk> \<Longrightarrow> Log a 1 = 0
[PROOF STEP]
by (metis Log_powreal_cancel powreal_zero_eq_one)


[STATEMENT]
lemma eventually_at_right_to_top:
  "eventually P (at_right (0::real)) \<longleftrightarrow> eventually (\<lambda>x. P (inverse x)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (at_right 0) = (\<forall>\<^sub>F x in at_top. P (inverse x))
[PROOF STEP]
unfolding at_right_to_top eventually_filtermap
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<^sub>F x in at_top. P (inverse x)) = (\<forall>\<^sub>F x in at_top. P (inverse x))
[PROOF STEP]
..


[STATEMENT]
lemma clop_alt: "(clop f) = (\<forall>x y. x \<le> f y \<longleftrightarrow> f x \<le> f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. clop f = (\<forall>x y. (x \<le> f y) = (f x \<le> f y))
[PROOF STEP]
unfolding clop_def mono_def le_fun_def comp_def id_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>x. x \<le> f x) \<and> (\<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y) \<and> (\<forall>x. f (f x) \<le> f x)) = (\<forall>x y. (x \<le> f y) = (f x \<le> f y))
[PROOF STEP]
by (meson dual_order.refl order_trans)


[STATEMENT]
lemma isomTr2:"\<lbrakk>Group F; Group G; Group H; F \<cong> G; G \<cong> H \<rbrakk> \<Longrightarrow> F \<cong> H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; Group H; F \<cong> G; G \<cong> H\<rbrakk> \<Longrightarrow> F \<cong> H
[PROOF STEP]
apply (simp add:isomorphic_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; Group H; \<exists>f. gbij\<^bsub>F,G\<^esub> f; \<exists>f. gbij\<^bsub>G,H\<^esub> f\<rbrakk> \<Longrightarrow> \<exists>f. gbij\<^bsub>F,H\<^esub> f
[PROOF STEP]
apply (erule exE)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f fa. \<lbrakk>Group F; Group G; Group H; gbij\<^bsub>F,G\<^esub> f; gbij\<^bsub>G,H\<^esub> fa\<rbrakk> \<Longrightarrow> \<exists>f. gbij\<^bsub>F,H\<^esub> f
[PROOF STEP]
apply (simp add:gbijec_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f fa. \<lbrakk>Group F; Group G; Group H; gsurj\<^bsub>F,G\<^esub> f \<and> ginj\<^bsub>F,G\<^esub> f; gsurj\<^bsub>G,H\<^esub> fa \<and> ginj\<^bsub>G,H\<^esub> fa\<rbrakk> \<Longrightarrow> \<exists>f. gsurj\<^bsub>F,H\<^esub> f \<and> ginj\<^bsub>F,H\<^esub> f
[PROOF STEP]
apply (erule conjE)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f fa. \<lbrakk>Group F; Group G; Group H; gsurj\<^bsub>F,G\<^esub> f; ginj\<^bsub>F,G\<^esub> f; gsurj\<^bsub>G,H\<^esub> fa; ginj\<^bsub>G,H\<^esub> fa\<rbrakk> \<Longrightarrow> \<exists>f. gsurj\<^bsub>F,H\<^esub> f \<and> ginj\<^bsub>F,H\<^esub> f
[PROOF STEP]
apply (frule gHom_comp_gsurjec [of "F" "G" "H" _ _], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f fa. \<lbrakk>Group F; Group G; Group H; gsurj\<^bsub>F,G\<^esub> f; ginj\<^bsub>F,G\<^esub> f; gsurj\<^bsub>G,H\<^esub> fa; ginj\<^bsub>G,H\<^esub> fa; gsurj\<^bsub>F,H\<^esub> (fa \<circ>\<^bsub>F\<^esub> f)\<rbrakk> \<Longrightarrow> \<exists>f. gsurj\<^bsub>F,H\<^esub> f \<and> ginj\<^bsub>F,H\<^esub> f
[PROOF STEP]
apply (frule gHom_comp_ginjec [of "F" "G" "H" _ _], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f fa. \<lbrakk>Group F; Group G; Group H; gsurj\<^bsub>F,G\<^esub> f; ginj\<^bsub>F,G\<^esub> f; gsurj\<^bsub>G,H\<^esub> fa; ginj\<^bsub>G,H\<^esub> fa; gsurj\<^bsub>F,H\<^esub> (fa \<circ>\<^bsub>F\<^esub> f); ginj\<^bsub>F,H\<^esub> (fa \<circ>\<^bsub>F\<^esub> f)\<rbrakk> \<Longrightarrow> \<exists>f. gsurj\<^bsub>F,H\<^esub> f \<and> ginj\<^bsub>F,H\<^esub> f
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma le_transpose_matrix: "(A <= B) = (transpose_matrix A <= transpose_matrix B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<le> B) = (transpose_matrix A \<le> transpose_matrix B)
[PROOF STEP]
by (simp add: le_matrix_def, auto)


[STATEMENT]
lemma norm_diff_temp_dyn: "0 < a \<Longrightarrow> \<parallel>f a L s\<^sub>1 - f a L s\<^sub>2\<parallel> = \<bar>a\<bar> * \<bar>s\<^sub>1$1 - s\<^sub>2$1\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a \<Longrightarrow> \<parallel>f a L s\<^sub>1 - f a L s\<^sub>2\<parallel> = \<bar>a\<bar> * \<bar>s\<^sub>1 $ 1 - s\<^sub>2 $ 1\<bar>
[PROOF STEP]
proof(simp add: norm_vec_def L2_set_def, unfold UNIV_4, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < a \<Longrightarrow> \<bar>a * (s\<^sub>2 $ 1 - L) - a * (s\<^sub>1 $ 1 - L)\<bar> = a * \<bar>s\<^sub>1 $ 1 - s\<^sub>2 $ 1\<bar>
[PROOF STEP]
assume a1: "0 < a"
[PROOF STATE]
proof (state)
this:
0 < a

goal (1 subgoal):
 1. 0 < a \<Longrightarrow> \<bar>a * (s\<^sub>2 $ 1 - L) - a * (s\<^sub>1 $ 1 - L)\<bar> = a * \<bar>s\<^sub>1 $ 1 - s\<^sub>2 $ 1\<bar>
[PROOF STEP]
have f2: "\<And>r ra. \<bar>(r::real) + - ra\<bar> = \<bar>ra + - r\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r ra. \<bar>r + - ra\<bar> = \<bar>ra + - r\<bar>
[PROOF STEP]
by (metis abs_minus_commute minus_real_def)
[PROOF STATE]
proof (state)
this:
\<bar>?r + - ?ra\<bar> = \<bar>?ra + - ?r\<bar>

goal (1 subgoal):
 1. 0 < a \<Longrightarrow> \<bar>a * (s\<^sub>2 $ 1 - L) - a * (s\<^sub>1 $ 1 - L)\<bar> = a * \<bar>s\<^sub>1 $ 1 - s\<^sub>2 $ 1\<bar>
[PROOF STEP]
have "\<And>r ra rb. (r::real) * ra + - (r * rb) = r * (ra + - rb)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r ra rb. r * ra + - (r * rb) = r * (ra + - rb)
[PROOF STEP]
by (metis minus_real_def right_diff_distrib)
[PROOF STATE]
proof (state)
this:
?r * ?ra + - (?r * ?rb) = ?r * (?ra + - ?rb)

goal (1 subgoal):
 1. 0 < a \<Longrightarrow> \<bar>a * (s\<^sub>2 $ 1 - L) - a * (s\<^sub>1 $ 1 - L)\<bar> = a * \<bar>s\<^sub>1 $ 1 - s\<^sub>2 $ 1\<bar>
[PROOF STEP]
hence "\<bar>a * (s\<^sub>1$1 + - L) + - (a * (s\<^sub>2$1 + - L))\<bar> = a * \<bar>s\<^sub>1$1 + - s\<^sub>2$1\<bar>"
[PROOF STATE]
proof (prove)
using this:
?r * ?ra + - (?r * ?rb) = ?r * (?ra + - ?rb)

goal (1 subgoal):
 1. \<bar>a * (s\<^sub>1 $ 1 + - L) + - (a * (s\<^sub>2 $ 1 + - L))\<bar> = a * \<bar>s\<^sub>1 $ 1 + - s\<^sub>2 $ 1\<bar>
[PROOF STEP]
using a1
[PROOF STATE]
proof (prove)
using this:
?r * ?ra + - (?r * ?rb) = ?r * (?ra + - ?rb)
0 < a

goal (1 subgoal):
 1. \<bar>a * (s\<^sub>1 $ 1 + - L) + - (a * (s\<^sub>2 $ 1 + - L))\<bar> = a * \<bar>s\<^sub>1 $ 1 + - s\<^sub>2 $ 1\<bar>
[PROOF STEP]
by (simp add: abs_mult)
[PROOF STATE]
proof (state)
this:
\<bar>a * (s\<^sub>1 $ 1 + - L) + - (a * (s\<^sub>2 $ 1 + - L))\<bar> = a * \<bar>s\<^sub>1 $ 1 + - s\<^sub>2 $ 1\<bar>

goal (1 subgoal):
 1. 0 < a \<Longrightarrow> \<bar>a * (s\<^sub>2 $ 1 - L) - a * (s\<^sub>1 $ 1 - L)\<bar> = a * \<bar>s\<^sub>1 $ 1 - s\<^sub>2 $ 1\<bar>
[PROOF STEP]
thus "\<bar>a * (s\<^sub>2$1 - L) - a * (s\<^sub>1$1 - L)\<bar> = a * \<bar>s\<^sub>1$1 - s\<^sub>2$1\<bar>"
[PROOF STATE]
proof (prove)
using this:
\<bar>a * (s\<^sub>1 $ 1 + - L) + - (a * (s\<^sub>2 $ 1 + - L))\<bar> = a * \<bar>s\<^sub>1 $ 1 + - s\<^sub>2 $ 1\<bar>

goal (1 subgoal):
 1. \<bar>a * (s\<^sub>2 $ 1 - L) - a * (s\<^sub>1 $ 1 - L)\<bar> = a * \<bar>s\<^sub>1 $ 1 - s\<^sub>2 $ 1\<bar>
[PROOF STEP]
using f2 minus_real_def
[PROOF STATE]
proof (prove)
using this:
\<bar>a * (s\<^sub>1 $ 1 + - L) + - (a * (s\<^sub>2 $ 1 + - L))\<bar> = a * \<bar>s\<^sub>1 $ 1 + - s\<^sub>2 $ 1\<bar>
\<bar>?r + - ?ra\<bar> = \<bar>?ra + - ?r\<bar>
?x - ?y = ?x + - ?y

goal (1 subgoal):
 1. \<bar>a * (s\<^sub>2 $ 1 - L) - a * (s\<^sub>1 $ 1 - L)\<bar> = a * \<bar>s\<^sub>1 $ 1 - s\<^sub>2 $ 1\<bar>
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<bar>a * (s\<^sub>2 $ 1 - L) - a * (s\<^sub>1 $ 1 - L)\<bar> = a * \<bar>s\<^sub>1 $ 1 - s\<^sub>2 $ 1\<bar>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_power:
  assumes "x = of_int \<lfloor>x\<rfloor>"
  shows "\<lfloor>x ^ n\<rfloor> = \<lfloor>x\<rfloor> ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>x ^ n\<rfloor> = \<lfloor>x\<rfloor> ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lfloor>x ^ n\<rfloor> = \<lfloor>x\<rfloor> ^ n
[PROOF STEP]
have "x ^ n = of_int (\<lfloor>x\<rfloor> ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ n = of_int (\<lfloor>x\<rfloor> ^ n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x = of_int \<lfloor>x\<rfloor>

goal (1 subgoal):
 1. x ^ n = of_int (\<lfloor>x\<rfloor> ^ n)
[PROOF STEP]
by (induct n arbitrary: x) simp_all
[PROOF STATE]
proof (state)
this:
x ^ n = of_int (\<lfloor>x\<rfloor> ^ n)

goal (1 subgoal):
 1. \<lfloor>x ^ n\<rfloor> = \<lfloor>x\<rfloor> ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x ^ n = of_int (\<lfloor>x\<rfloor> ^ n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x ^ n = of_int (\<lfloor>x\<rfloor> ^ n)

goal (1 subgoal):
 1. \<lfloor>x ^ n\<rfloor> = \<lfloor>x\<rfloor> ^ n
[PROOF STEP]
by (metis floor_of_int)
[PROOF STATE]
proof (state)
this:
\<lfloor>x ^ n\<rfloor> = \<lfloor>x\<rfloor> ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dual_blocks_inter_index:
  assumes "j1 < length \<B>s*" "j2 < length \<B>s*"
  shows "(\<B>s* ! j1) |\<inter>| (\<B>s* ! j2) = points_index \<B> {\<V>s ! j1, \<V>s ! j2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<B>s* ! j1 |\<inter>| \<B>s* ! j2 = \<B> index {\<V>s ! j1, \<V>s ! j2}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<B>s* ! j1 |\<inter>| \<B>s* ! j2 = \<B> index {\<V>s ! j1, \<V>s ! j2}
[PROOF STEP]
have assms2: "j1 < \<v>" "j2 < \<v>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j1 < \<v> &&& j2 < \<v>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j1 < length \<B>s*
j2 < length \<B>s*

goal (1 subgoal):
 1. j1 < \<v> &&& j2 < \<v>
[PROOF STEP]
by (simp_all add: dual_blocks_len points_list_length)
[PROOF STATE]
proof (state)
this:
j1 < \<v>
j2 < \<v>

goal (1 subgoal):
 1. \<B>s* ! j1 |\<inter>| \<B>s* ! j2 = \<B> index {\<V>s ! j1, \<V>s ! j2}
[PROOF STEP]
have "(\<B>s* ! j1) |\<inter>| (\<B>s* ! j2) = mat_inter_num (ordered_dual_sys.N) j1 j2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<B>s* ! j1 |\<inter>| \<B>s* ! j2 = mat_inter_num ordered_dual_sys.N j1 j2
[PROOF STEP]
by (simp add: assms(1) assms(2) ordered_dual_sys.mat_inter_num_conv)
[PROOF STATE]
proof (state)
this:
\<B>s* ! j1 |\<inter>| \<B>s* ! j2 = mat_inter_num ordered_dual_sys.N j1 j2

goal (1 subgoal):
 1. \<B>s* ! j1 |\<inter>| \<B>s* ! j2 = \<B> index {\<V>s ! j1, \<V>s ! j2}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<B>s* ! j1 |\<inter>| \<B>s* ! j2 = mat_inter_num ordered_dual_sys.N j1 j2

goal (1 subgoal):
 1. \<B>s* ! j1 |\<inter>| \<B>s* ! j2 = \<B> index {\<V>s ! j1, \<V>s ! j2}
[PROOF STEP]
have "... = mat_point_index N {j1, j2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_inter_num ordered_dual_sys.N j1 j2 = mat_point_index N {j1, j2}
[PROOF STEP]
using dual_incidence_mat_eq_trans_rev trans_mat_point_index_inter_sym(2)
[PROOF STATE]
proof (prove)
using this:
ordered_dual_sys.N\<^sup>T = N
\<lbrakk>?j1.0 < dim_col ?M; ?j2.0 < dim_col ?M\<rbrakk> \<Longrightarrow> mat_inter_num ?M ?j1.0 ?j2.0 = mat_point_index ?M\<^sup>T {?j1.0, ?j2.0}

goal (1 subgoal):
 1. mat_inter_num ordered_dual_sys.N j1 j2 = mat_point_index N {j1, j2}
[PROOF STEP]
by (metis assms inc_mat_dim_col)
[PROOF STATE]
proof (state)
this:
mat_inter_num ordered_dual_sys.N j1 j2 = mat_point_index N {j1, j2}

goal (1 subgoal):
 1. \<B>s* ! j1 |\<inter>| \<B>s* ! j2 = \<B> index {\<V>s ! j1, \<V>s ! j2}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<B>s* ! j1 |\<inter>| \<B>s* ! j2 = mat_point_index N {j1, j2}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<B>s* ! j1 |\<inter>| \<B>s* ! j2 = mat_point_index N {j1, j2}

goal (1 subgoal):
 1. \<B>s* ! j1 |\<inter>| \<B>s* ! j2 = \<B> index {\<V>s ! j1, \<V>s ! j2}
[PROOF STEP]
using assms2 incidence_mat_two_index
[PROOF STATE]
proof (prove)
using this:
\<B>s* ! j1 |\<inter>| \<B>s* ! j2 = mat_point_index N {j1, j2}
j1 < \<v>
j2 < \<v>
\<lbrakk>?i1.0 < \<v>; ?i2.0 < \<v>\<rbrakk> \<Longrightarrow> mat_point_index N {?i1.0, ?i2.0} = \<B> index {\<V>s ! ?i1.0, \<V>s ! ?i2.0}

goal (1 subgoal):
 1. \<B>s* ! j1 |\<inter>| \<B>s* ! j2 = \<B> index {\<V>s ! j1, \<V>s ! j2}
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<B>s* ! j1 |\<inter>| \<B>s* ! j2 = \<B> index {\<V>s ! j1, \<V>s ! j2}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fls_right_inverse_delta:
  fixes   b :: "'a::{comm_monoid_add,mult_zero,uminus}"
  assumes "b \<noteq> 0"
  shows   "fls_right_inverse (Abs_fls (\<lambda>n. if n=a then b else 0)) x =
            Abs_fls (\<lambda>n. if n=-a then x else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_right_inverse (Abs_fls (\<lambda>n. if n = a then b else (0::'a))) x = Abs_fls (\<lambda>n. if n = - a then x else (0::'a))
[PROOF STEP]
proof (intro fls_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. fls_right_inverse (Abs_fls (\<lambda>n. if n = a then b else (0::'a))) x $$ xa = Abs_fls (\<lambda>n. if n = - a then x else (0::'a)) $$ xa
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. fls_right_inverse (Abs_fls (\<lambda>n. if n = a then b else (0::'a))) x $$ xa = Abs_fls (\<lambda>n. if n = - a then x else (0::'a)) $$ xa
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> (0::'a)
[PROOF STEP]
show
    "fls_right_inverse (Abs_fls (\<lambda>n. if n=a then b else 0)) x $$ n
      = Abs_fls (\<lambda>n. if n = - a then x else 0) $$ n"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)

goal (1 subgoal):
 1. fls_right_inverse (Abs_fls (\<lambda>n. if n = a then b else (0::'a))) x $$ n = Abs_fls (\<lambda>n. if n = - a then x else (0::'a)) $$ n
[PROOF STEP]
using fls_base_factor_to_fps_delta[of a b]
          fls_lr_inverse_const(2)[of b]
          fls_shift_const
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)
fls_base_factor_to_fps (Abs_fls (\<lambda>n. if n = a then b else (0::'a))) = fps_const b
fls_right_inverse (fls_const b) ?y = fls_const ?y
fls_shift ?m (fls_const ?c) = Abs_fls (\<lambda>n. if n = - ?m then ?c else (0::?'a))

goal (1 subgoal):
 1. fls_right_inverse (Abs_fls (\<lambda>n. if n = a then b else (0::'a))) x $$ n = Abs_fls (\<lambda>n. if n = - a then x else (0::'a)) $$ n
[PROOF STEP]
by    simp
[PROOF STATE]
proof (state)
this:
fls_right_inverse (Abs_fls (\<lambda>n. if n = a then b else (0::'a))) x $$ n = Abs_fls (\<lambda>n. if n = - a then x else (0::'a)) $$ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in infinite_coin_toss_space) reindex_pseudo_proj:
  shows "(\<Sum>w\<in>range (pseudo_proj_True n). f (c ## w)) =
      (\<Sum>y\<in>{y. \<exists>w \<in> range (pseudo_proj_True n). y = c ## w}.f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>w\<in>range (pseudo_proj_True n). f (c ## w)) = (\<Sum>y | \<exists>w\<in>range (pseudo_proj_True n). y = c ## w. f y)
[PROOF STEP]
proof (rule sum.reindex_cong[symmetric],auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on ((##) c) (range (pseudo_proj_True n))
[PROOF STEP]
define ccons where "ccons = (\<lambda>w. c## w)"
[PROOF STATE]
proof (state)
this:
ccons = (##) c

goal (1 subgoal):
 1. inj_on ((##) c) (range (pseudo_proj_True n))
[PROOF STEP]
show "inj_on ccons (range (pseudo_proj_True n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ccons (range (pseudo_proj_True n))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> range (pseudo_proj_True n); y \<in> range (pseudo_proj_True n); ccons x = ccons y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> range (pseudo_proj_True n); y \<in> range (pseudo_proj_True n); ccons x = ccons y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "x\<in> range (pseudo_proj_True n)" and "y\<in> range (pseudo_proj_True n)" and "ccons x = ccons y"
[PROOF STATE]
proof (state)
this:
x \<in> range (pseudo_proj_True n)
y \<in> range (pseudo_proj_True n)
ccons x = ccons y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> range (pseudo_proj_True n); y \<in> range (pseudo_proj_True n); ccons x = ccons y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence "c##x = c##y"
[PROOF STATE]
proof (prove)
using this:
x \<in> range (pseudo_proj_True n)
y \<in> range (pseudo_proj_True n)
ccons x = ccons y

goal (1 subgoal):
 1. c ## x = c ## y
[PROOF STEP]
unfolding ccons_def
[PROOF STATE]
proof (prove)
using this:
x \<in> range (pseudo_proj_True n)
y \<in> range (pseudo_proj_True n)
c ## x = c ## y

goal (1 subgoal):
 1. c ## x = c ## y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c ## x = c ## y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> range (pseudo_proj_True n); y \<in> range (pseudo_proj_True n); ccons x = ccons y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
thus "x = y"
[PROOF STATE]
proof (prove)
using this:
c ## x = c ## y

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on ccons (range (pseudo_proj_True n))

goal:
No subgoals!
[PROOF STEP]
qed


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

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


[STATEMENT]
lemma mult_right_one: "a * 1 = (a::'a::semiring_1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * (1::'a) = a
[PROOF STEP]
by simp


[STATEMENT]
lemma powrat_inverse_of_nat_le_self [simp]:
  assumes "1 \<le> a" shows "a pow\<^sub>\<rat> inverse (rat_of_nat n) \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a pow\<^sub>\<rat> inverse (rat_of_nat n) \<le> a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a pow\<^sub>\<rat> inverse (rat_of_nat n) \<le> a
[PROOF STEP]
have "inverse (rat_of_nat n) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (rat_of_nat n) \<le> 1
[PROOF STEP]
by (auto simp add: inverse_le_1_iff)
[PROOF STATE]
proof (state)
this:
inverse (rat_of_nat n) \<le> 1

goal (1 subgoal):
 1. a pow\<^sub>\<rat> inverse (rat_of_nat n) \<le> a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inverse (rat_of_nat n) \<le> 1

goal (1 subgoal):
 1. a pow\<^sub>\<rat> inverse (rat_of_nat n) \<le> a
[PROOF STEP]
have "a pow\<^sub>\<rat> 1 \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a pow\<^sub>\<rat> 1 \<le> a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<rat> 1 \<le> a

goal (1 subgoal):
 1. a pow\<^sub>\<rat> inverse (rat_of_nat n) \<le> a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inverse (rat_of_nat n) \<le> 1
a pow\<^sub>\<rat> 1 \<le> a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inverse (rat_of_nat n) \<le> 1
a pow\<^sub>\<rat> 1 \<le> a

goal (1 subgoal):
 1. a pow\<^sub>\<rat> inverse (rat_of_nat n) \<le> a
[PROOF STEP]
using assms powrat_le_mono
[PROOF STATE]
proof (prove)
using this:
inverse (rat_of_nat n) \<le> 1
a pow\<^sub>\<rat> 1 \<le> a
1 \<le> a
\<lbrakk>?r \<le> ?s; 1 \<le> ?x\<rbrakk> \<Longrightarrow> ?x pow\<^sub>\<rat> ?r \<le> ?x pow\<^sub>\<rat> ?s

goal (1 subgoal):
 1. a pow\<^sub>\<rat> inverse (rat_of_nat n) \<le> a
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<rat> inverse (rat_of_nat n) \<le> a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Smith_prod_zero_imp_last_zero:
  fixes A::"'a::{semidom,comm_ring_1} mat"
  assumes  A: "A \<in> carrier_mat m n"
    and SNF: "Smith_normal_form_mat A"
    and prod_0: "(\<Prod>j=0..<Suc i. A $$ (j,j)) = 0"
  and i: "i<min m n"
  shows "A $$(i,i) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (i, i) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A $$ (i, i) = (0::'a)
[PROOF STEP]
obtain j where Ajj: "A$$(j,j) = 0" and j: "j<Suc i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>j. \<lbrakk>A $$ (j, j) = (0::'a); j < Suc i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using prod_0 prod_zero_iff
[PROOF STATE]
proof (prove)
using this:
(\<Prod>j = 0..<Suc i. A $$ (j, j)) = (0::'a)
finite ?A \<Longrightarrow> (prod ?f ?A = (0::?'a)) = (\<exists>a\<in>?A. ?f a = (0::?'a))

goal (1 subgoal):
 1. (\<And>j. \<lbrakk>A $$ (j, j) = (0::'a); j < Suc i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A $$ (j, j) = (0::'a)
j < Suc i

goal (1 subgoal):
 1. A $$ (i, i) = (0::'a)
[PROOF STEP]
show "A $$(i,i) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (i, i) = (0::'a)
[PROOF STEP]
by (rule Smith_zero_imp_zero[OF A SNF Ajj i], insert j, auto)
[PROOF STATE]
proof (state)
this:
A $$ (i, i) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_braun_indices: "card (braun_indices t) = size t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (braun_indices t) = size t
[PROOF STEP]
proof (induction t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card (braun_indices \<langle>\<rangle>) = size \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>card (braun_indices t1) = size t1; card (braun_indices t2) = size t2\<rbrakk> \<Longrightarrow> card (braun_indices \<langle>t1, x2, t2\<rangle>) = size \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
case Leaf
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. card (braun_indices \<langle>\<rangle>) = size \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>card (braun_indices t1) = size t1; card (braun_indices t2) = size t2\<rbrakk> \<Longrightarrow> card (braun_indices \<langle>t1, x2, t2\<rangle>) = size \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (braun_indices \<langle>\<rangle>) = size \<langle>\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (braun_indices \<langle>\<rangle>) = size \<langle>\<rangle>

goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>card (braun_indices t1) = size t1; card (braun_indices t2) = size t2\<rbrakk> \<Longrightarrow> card (braun_indices \<langle>t1, x2, t2\<rangle>) = size \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>card (braun_indices t1) = size t1; card (braun_indices t2) = size t2\<rbrakk> \<Longrightarrow> card (braun_indices \<langle>t1, x2, t2\<rangle>) = size \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
case Node
[PROOF STATE]
proof (state)
this:
card (braun_indices t1_) = size t1_
card (braun_indices t2_) = size t2_

goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>card (braun_indices t1) = size t1; card (braun_indices t2) = size t2\<rbrakk> \<Longrightarrow> card (braun_indices \<langle>t1, x2, t2\<rangle>) = size \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
card (braun_indices t1_) = size t1_
card (braun_indices t2_) = size t2_

goal (1 subgoal):
 1. card (braun_indices \<langle>t1_, x2_, t2_\<rangle>) = size \<langle>t1_, x2_, t2_\<rangle>
[PROOF STEP]
by(auto simp: UNION_singleton_eq_range finite_braun_indices card_Un_disjoint
                  card_insert_if disj_evens_odds card_image inj_on_def braun_indices1)
[PROOF STATE]
proof (state)
this:
card (braun_indices \<langle>t1_, x2_, t2_\<rangle>) = size \<langle>t1_, x2_, t2_\<rangle>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powr_mono':
  assumes "(x::real) > 0" "x \<le> 1" "a \<le> b"
  shows   "x powr b \<le> x powr a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x powr b \<le> x powr a
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x powr b \<le> x powr a
[PROOF STEP]
have "inverse x powr a \<le> inverse x powr b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse x powr a \<le> inverse x powr b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x
x \<le> 1
a \<le> b

goal (1 subgoal):
 1. inverse x powr a \<le> inverse x powr b
[PROOF STEP]
by (intro powr_mono) (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
inverse x powr a \<le> inverse x powr b

goal (1 subgoal):
 1. x powr b \<le> x powr a
[PROOF STEP]
hence "inverse (x powr a) \<le> inverse (x powr b)"
[PROOF STATE]
proof (prove)
using this:
inverse x powr a \<le> inverse x powr b

goal (1 subgoal):
 1. inverse (x powr a) \<le> inverse (x powr b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
inverse x powr a \<le> inverse x powr b
0 < x
x \<le> 1
a \<le> b

goal (1 subgoal):
 1. inverse (x powr a) \<le> inverse (x powr b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse (x powr a) \<le> inverse (x powr b)

goal (1 subgoal):
 1. x powr b \<le> x powr a
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < x
x \<le> 1
a \<le> b
inverse (x powr a) \<le> inverse (x powr b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < x
x \<le> 1
a \<le> b
inverse (x powr a) \<le> inverse (x powr b)

goal (1 subgoal):
 1. x powr b \<le> x powr a
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
x powr b \<le> x powr a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in vectorspace) li_smaller_than_gen:
  fixes A B
  assumes h1: "finite A" and h2: "finite B" and h3: "A\<subseteq>carrier V" and h4: "B\<subseteq>carrier V"
    and h5: "lin_indpt A" and h6: "gen_set B"
  shows "card A \<le> card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A \<le> card B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card A \<le> card B
[PROOF STEP]
from h3 h6
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> carrier V
gen_set B
[PROOF STEP]
have 1: "A\<subseteq>span B"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier V
gen_set B

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

goal (1 subgoal):
 1. card A \<le> card B
[PROOF STEP]
from h1 h2 h4 h5 1
[PROOF STATE]
proof (chain)
picking this:
finite A
finite B
B \<subseteq> carrier V
lin_indpt A
A \<subseteq> span B
[PROOF STEP]
obtain C where
    2: "finite C \<and> C\<subseteq>carrier V \<and> C\<subseteq>span B \<and> C\<inter>A={} \<and> int (card C) \<le> int (card B) - int (card A) \<and> (span (A \<union> C) = span B)"
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
B \<subseteq> carrier V
lin_indpt A
A \<subseteq> span B

goal (1 subgoal):
 1. (\<And>C. finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> span (A \<union> C) = span B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis replacement)
[PROOF STATE]
proof (state)
this:
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> span (A \<union> C) = span B

goal (1 subgoal):
 1. card A \<le> card B
[PROOF STEP]
from 2
[PROOF STATE]
proof (chain)
picking this:
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> span (A \<union> C) = span B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite C \<and> C \<subseteq> carrier V \<and> C \<subseteq> span B \<and> C \<inter> A = {} \<and> int (card C) \<le> int (card B) - int (card A) \<and> span (A \<union> C) = span B

goal (1 subgoal):
 1. card A \<le> card B
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
card A \<le> card B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bounded_subset_box_symmetric:
  fixes S :: "('a::euclidean_space) set"
  assumes "bounded S"
  obtains a where "S \<subseteq> box (-a) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. S \<subseteq> box (- a) a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>a. S \<subseteq> box (- a) a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain b where "b>0" and b: "\<forall>x\<in>S. norm x \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. \<lbrakk>0 < b; \<forall>x\<in>S. norm x \<le> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms[unfolded bounded_pos]
[PROOF STATE]
proof (prove)
using this:
\<exists>b>0. \<forall>x\<in>S. norm x \<le> b

goal (1 subgoal):
 1. (\<And>b. \<lbrakk>0 < b; \<forall>x\<in>S. norm x \<le> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < b
\<forall>x\<in>S. norm x \<le> b

goal (1 subgoal):
 1. (\<And>a. S \<subseteq> box (- a) a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define a :: 'a where "a = (\<Sum>i\<in>Basis. (b + 1) *\<^sub>R i)"
[PROOF STATE]
proof (state)
this:
a = sum ((*\<^sub>R) (b + 1)) Basis

goal (1 subgoal):
 1. (\<And>a. S \<subseteq> box (- a) a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "(-a)\<bullet>i < x\<bullet>i" and "x\<bullet>i < a\<bullet>i" if "x \<in> S" and i: "i \<in> Basis" for x i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - a \<bullet> i < x \<bullet> i &&& x \<bullet> i < a \<bullet> i
[PROOF STEP]
using b Basis_le_norm[OF i, of x] that
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. norm x \<le> b
\<bar>x \<bullet> i\<bar> \<le> norm x
x \<in> S
i \<in> Basis

goal (1 subgoal):
 1. - a \<bullet> i < x \<bullet> i &&& x \<bullet> i < a \<bullet> i
[PROOF STEP]
by (auto simp: a_def)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> S; ?i \<in> Basis\<rbrakk> \<Longrightarrow> - a \<bullet> ?i < ?x \<bullet> ?i
\<lbrakk>?x \<in> S; ?i \<in> Basis\<rbrakk> \<Longrightarrow> ?x \<bullet> ?i < a \<bullet> ?i

goal (1 subgoal):
 1. (\<And>a. S \<subseteq> box (- a) a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> S; ?i \<in> Basis\<rbrakk> \<Longrightarrow> - a \<bullet> ?i < ?x \<bullet> ?i
\<lbrakk>?x \<in> S; ?i \<in> Basis\<rbrakk> \<Longrightarrow> ?x \<bullet> ?i < a \<bullet> ?i
[PROOF STEP]
have "S \<subseteq> box (-a) a"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> S; ?i \<in> Basis\<rbrakk> \<Longrightarrow> - a \<bullet> ?i < ?x \<bullet> ?i
\<lbrakk>?x \<in> S; ?i \<in> Basis\<rbrakk> \<Longrightarrow> ?x \<bullet> ?i < a \<bullet> ?i

goal (1 subgoal):
 1. S \<subseteq> box (- a) a
[PROOF STEP]
by (auto simp: simp add: box_def)
[PROOF STATE]
proof (state)
this:
S \<subseteq> box (- a) a

goal (1 subgoal):
 1. (\<And>a. S \<subseteq> box (- a) a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> box (- a) a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> box (- a) a

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma column_rank_def:
  fixes A :: "real^'n^'m"
  shows "rank A = dim(columns A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = dim (columns A)
[PROOF STEP]
unfolding row_rank_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim (rows A) = dim (columns A)
[PROOF STEP]
by (metis columns_transpose dim_rows_le_dim_columns le_antisym rows_transpose)


[STATEMENT]
lemma integral_sum'[simp]: "(\<And>i. i \<in> I =simp=> integrable M (f i)) \<Longrightarrow>
  integral\<^sup>L M (\<lambda>x. \<Sum>i\<in>I. f i x) = (\<Sum>i\<in>I. integral\<^sup>L M (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I =simp=> integrable M (f i)) \<Longrightarrow> LINT x|M. (\<Sum>i\<in>I. f i x) = (\<Sum>i\<in>I. integral\<^sup>L M (f i))
[PROOF STEP]
unfolding simp_implies_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> integrable M (f i)) \<Longrightarrow> LINT x|M. (\<Sum>i\<in>I. f i x) = (\<Sum>i\<in>I. integral\<^sup>L M (f i))
[PROOF STEP]
by (rule integral_sum)


[STATEMENT]
lemma (in prob_space) indep_vars_cong:
  "I = J \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> X i = Y i) \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> M' i = N' i) \<Longrightarrow> indep_vars M' X I \<longleftrightarrow> indep_vars N' Y J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I = J; \<And>i. i \<in> I \<Longrightarrow> X i = Y i; \<And>i. i \<in> I \<Longrightarrow> M' i = N' i\<rbrakk> \<Longrightarrow> indep_vars M' X I = indep_vars N' Y J
[PROOF STEP]
unfolding indep_vars_def2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I = J; \<And>i. i \<in> I \<Longrightarrow> X i = Y i; \<And>i. i \<in> I \<Longrightarrow> M' i = N' i\<rbrakk> \<Longrightarrow> ((\<forall>i\<in>I. random_variable (M' i) (X i)) \<and> indep_sets (\<lambda>i. {X i -` A \<inter> space M |A. A \<in> sets (M' i)}) I) = ((\<forall>i\<in>J. random_variable (N' i) (Y i)) \<and> indep_sets (\<lambda>i. {Y i -` A \<inter> space M |A. A \<in> sets (N' i)}) J)
[PROOF STEP]
by (intro conj_cong indep_sets_cong) auto


[STATEMENT]
lemma covar_self_eq:
  fixes f :: "'a \<Rightarrow> real"
  shows "covariance f f = variance f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. covariance f f = expectation (\<lambda>x. (f x - expectation f)\<^sup>2)
[PROOF STEP]
by (simp add:covariance_def power2_eq_square)


[STATEMENT]
lemma upd_set_fold:
  assumes "finite A"
  shows "upd_set m f A = Finite_Set.fold (\<lambda>a. Mapping.update a (f a)) m A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upd_set m f A = Finite_Set.fold (\<lambda>a. Mapping.update a (f a)) m A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. upd_set m f A = Finite_Set.fold (\<lambda>a. Mapping.update a (f a)) m A
[PROOF STEP]
interpret comp_fun_idem "\<lambda>a. Mapping.update a (f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_idem (\<lambda>a. Mapping.update a (f a))
[PROOF STEP]
by unfold_locales (transfer; auto simp: fun_eq_iff)+
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. upd_set m f A = Finite_Set.fold (\<lambda>a. Mapping.update a (f a)) m A
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. upd_set m f A = Finite_Set.fold (\<lambda>a. Mapping.update a (f a)) m A
[PROOF STEP]
by (induct A arbitrary: m rule: finite.induct) auto
[PROOF STATE]
proof (state)
this:
upd_set m f A = Finite_Set.fold (\<lambda>a. Mapping.update a (f a)) m A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_prod_mset_zero_iff:
  fixes x :: "'a :: idom"
  shows "poly (prod_mset F) x = 0 \<longleftrightarrow> (\<exists>f \<in># F. poly f x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly (\<Prod>\<^sub># F) x = (0::'a)) = (\<exists>f\<in>#F. poly f x = (0::'a))
[PROOF STEP]
by (induct F, auto simp: poly_mult_zero_iff)


[STATEMENT]
lemma arcosh_eq_iff:
  fixes x y::real
  assumes "x \<ge> 1" "y \<ge> 1"
  shows "arcosh x = arcosh y \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (arcosh x = arcosh y) = (x = y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> x
1 \<le> y

goal (1 subgoal):
 1. (arcosh x = arcosh y) = (x = y)
[PROOF STEP]
using cosh_arcosh
[PROOF STATE]
proof (prove)
using this:
1 \<le> x
1 \<le> y
1 \<le> ?x \<Longrightarrow> cosh (arcosh ?x) = ?x

goal (1 subgoal):
 1. (arcosh x = arcosh y) = (x = y)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma ex_moebius_01inf:
  assumes "z1 \<noteq> z2" and "z1 \<noteq> z3" and "z2 \<noteq> z3"
  shows "\<exists> M. ((moebius_pt M z1 = 0\<^sub>h) \<and> (moebius_pt M z2 = 1\<^sub>h) \<and> (moebius_pt M z3 = \<infinity>\<^sub>h))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>M. moebius_pt M z1 = 0\<^sub>h \<and> moebius_pt M z2 = 1\<^sub>h \<and> moebius_pt M z3 = \<infinity>\<^sub>h
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z1 \<noteq> z2
z1 \<noteq> z3
z2 \<noteq> z3

goal (1 subgoal):
 1. \<exists>M. moebius_pt M z1 = 0\<^sub>h \<and> moebius_pt M z2 = 1\<^sub>h \<and> moebius_pt M z3 = \<infinity>\<^sub>h
[PROOF STEP]
using is_moebius_cross_ratio[OF \<open>z1 \<noteq> z2\<close> \<open>z2 \<noteq> z3\<close> \<open>z1 \<noteq> z3\<close>]
[PROOF STATE]
proof (prove)
using this:
z1 \<noteq> z2
z1 \<noteq> z3
z2 \<noteq> z3
is_moebius (\<lambda>z. cross_ratio z z1 z2 z3)

goal (1 subgoal):
 1. \<exists>M. moebius_pt M z1 = 0\<^sub>h \<and> moebius_pt M z2 = 1\<^sub>h \<and> moebius_pt M z3 = \<infinity>\<^sub>h
[PROOF STEP]
using cross_ratio_0[OF \<open>z1 \<noteq> z2\<close> \<open>z1 \<noteq> z3\<close>] cross_ratio_1[OF \<open>z1 \<noteq> z2\<close> \<open>z2 \<noteq> z3\<close>] cross_ratio_inf[OF \<open>z1 \<noteq> z3\<close> \<open>z2 \<noteq> z3\<close>]
[PROOF STATE]
proof (prove)
using this:
z1 \<noteq> z2
z1 \<noteq> z3
z2 \<noteq> z3
is_moebius (\<lambda>z. cross_ratio z z1 z2 z3)
cross_ratio z1 z1 z2 z3 = 0\<^sub>h
cross_ratio z2 z1 z2 z3 = 1\<^sub>h
cross_ratio z3 z1 z2 z3 = \<infinity>\<^sub>h

goal (1 subgoal):
 1. \<exists>M. moebius_pt M z1 = 0\<^sub>h \<and> moebius_pt M z2 = 1\<^sub>h \<and> moebius_pt M z3 = \<infinity>\<^sub>h
[PROOF STEP]
by (metis is_moebius_def)


[STATEMENT]
theorem invertible_inverse_invertible [intro, simp]:
  "\<lbrakk> invertible u; u \<in> M \<rbrakk> \<Longrightarrow> invertible (inverse u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invertible u; u \<in> M\<rbrakk> \<Longrightarrow> invertible (inverse u)
[PROOF STEP]
using invertible_left_inverse invertible_right_inverse
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>invertible ?u; ?u \<in> M\<rbrakk> \<Longrightarrow> inverse ?u \<cdot> ?u = \<one>
\<lbrakk>invertible ?u; ?u \<in> M\<rbrakk> \<Longrightarrow> ?u \<cdot> inverse ?u = \<one>

goal (1 subgoal):
 1. \<lbrakk>invertible u; u \<in> M\<rbrakk> \<Longrightarrow> invertible (inverse u)
[PROOF STEP]
by blast


[STATEMENT]
lemma d_lt_logq:
  assumes "of_nat d < \<lceil>(log 2 q)::real\<rceil>"
  shows "d< log 2 q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real d < log 2 (real_of_int q)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
int d < \<lceil>log 2 (real_of_int q)\<rceil>

goal (1 subgoal):
 1. real d < log 2 (real_of_int q)
[PROOF STEP]
by linarith


[STATEMENT]
lemma uniformly_continuous_on_cmul_right [continuous_intros]:
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_algebra"
  shows "uniformly_continuous_on s f \<Longrightarrow> uniformly_continuous_on s (\<lambda>x. f x * c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniformly_continuous_on s f \<Longrightarrow> uniformly_continuous_on s (\<lambda>x. f x * c)
[PROOF STEP]
using bounded_linear.uniformly_continuous_on[OF bounded_linear_mult_left]
[PROOF STATE]
proof (prove)
using this:
uniformly_continuous_on ?s ?g \<Longrightarrow> uniformly_continuous_on ?s (\<lambda>x. ?g x * ?y1)

goal (1 subgoal):
 1. uniformly_continuous_on s f \<Longrightarrow> uniformly_continuous_on s (\<lambda>x. f x * c)
[PROOF STEP]
.


[STATEMENT]
lemma binomial_n_0 [simp]: "n choose 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose 0 = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n choose 0 = 1
[PROOF STEP]
have "{K \<in> Pow {0..<n}. card K = 0} = {{}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {K \<in> Pow {0..<n}. card K = 0} = {{}}
[PROOF STEP]
by (auto dest: finite_subset)
[PROOF STATE]
proof (state)
this:
{K \<in> Pow {0..<n}. card K = 0} = {{}}

goal (1 subgoal):
 1. n choose 0 = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{K \<in> Pow {0..<n}. card K = 0} = {{}}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{K \<in> Pow {0..<n}. card K = 0} = {{}}

goal (1 subgoal):
 1. n choose 0 = 1
[PROOF STEP]
by (simp add: binomial_def)
[PROOF STATE]
proof (state)
this:
n choose 0 = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_Fract [simp]: "\<lfloor>Fract a b\<rfloor> = a div b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>Fract a b\<rfloor> = a div b
[PROOF STEP]
by (simp add: Fract_of_int_quotient floor_divide_of_int_eq)


[STATEMENT]
lemma cardFinestpart:
  "card (finestpart X) = card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (finestpart X) = card X
[PROOF STEP]
using finestpart_def
[PROOF STATE]
proof (prove)
using this:
finestpart ?X = (\<lambda>x. {x}) ` ?X

goal (1 subgoal):
 1. card (finestpart X) = card X
[PROOF STEP]
by (metis (lifting) card_image inj_on_inverseI the_elem_eq)


[STATEMENT]
lemma jointfun_mem:"\<lbrakk>\<forall>j \<le> (n::nat). f j \<in> A; \<forall>j \<le> m. g j \<in> B;
             l \<le> (Suc (n + m))\<rbrakk> \<Longrightarrow> (jointfun n f m g) l \<in> (A \<union> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>j\<le>n. f j \<in> A; \<forall>j\<le>m. g j \<in> B; l \<le> Suc (n + m)\<rbrakk> \<Longrightarrow> jointfun n f m g l \<in> A \<union> B
[PROOF STEP]
apply (rule funcset_mem[of "jointfun n f m g" "{j. j \<le> Suc (n + m)}" "A \<union> B"
       l])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>j\<le>n. f j \<in> A; \<forall>j\<le>m. g j \<in> B; l \<le> Suc (n + m)\<rbrakk> \<Longrightarrow> jointfun n f m g \<in> {j. j \<le> Suc (n + m)} \<rightarrow> A \<union> B
 2. \<lbrakk>\<forall>j\<le>n. f j \<in> A; \<forall>j\<le>m. g j \<in> B; l \<le> Suc (n + m)\<rbrakk> \<Longrightarrow> l \<in> {j. j \<le> Suc (n + m)}
[PROOF STEP]
apply (rule jointfun_hom0)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>\<forall>j\<le>n. f j \<in> A; \<forall>j\<le>m. g j \<in> B; l \<le> Suc (n + m)\<rbrakk> \<Longrightarrow> f \<in> {j. j \<le> n} \<rightarrow> A
 2. \<lbrakk>\<forall>j\<le>n. f j \<in> A; \<forall>j\<le>m. g j \<in> B; l \<le> Suc (n + m)\<rbrakk> \<Longrightarrow> g \<in> {k. k \<le> m} \<rightarrow> B
 3. \<lbrakk>\<forall>j\<le>n. f j \<in> A; \<forall>j\<le>m. g j \<in> B; l \<le> Suc (n + m)\<rbrakk> \<Longrightarrow> l \<in> {j. j \<le> Suc (n + m)}
[PROOF STEP]
apply simp+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lnth_lzip:
  "\<lbrakk> enat n < llength xs; enat n < llength ys \<rbrakk>
  \<Longrightarrow> lnth (lzip xs ys) n = (lnth xs n, lnth ys n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>enat n < llength xs; enat n < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) n = (lnth xs n, lnth ys n)
[PROOF STEP]
proof(induct n arbitrary: xs ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs ys. \<lbrakk>enat 0 < llength xs; enat 0 < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) 0 = (lnth xs 0, lnth ys 0)
 2. \<And>n xs ys. \<lbrakk>\<And>xs ys. \<lbrakk>enat n < llength xs; enat n < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) n = (lnth xs n, lnth ys n); enat (Suc n) < llength xs; enat (Suc n) < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) (Suc n) = (lnth xs (Suc n), lnth ys (Suc n))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
enat 0 < llength xs
enat 0 < llength ys

goal (2 subgoals):
 1. \<And>xs ys. \<lbrakk>enat 0 < llength xs; enat 0 < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) 0 = (lnth xs 0, lnth ys 0)
 2. \<And>n xs ys. \<lbrakk>\<And>xs ys. \<lbrakk>enat n < llength xs; enat n < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) n = (lnth xs n, lnth ys n); enat (Suc n) < llength xs; enat (Suc n) < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) (Suc n) = (lnth xs (Suc n), lnth ys (Suc n))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
enat 0 < llength xs
enat 0 < llength ys

goal (1 subgoal):
 1. lnth (lzip xs ys) 0 = (lnth xs 0, lnth ys 0)
[PROOF STEP]
by(simp add: zero_enat_def[symmetric] lnth_0_conv_lhd)
[PROOF STATE]
proof (state)
this:
lnth (lzip xs ys) 0 = (lnth xs 0, lnth ys 0)

goal (1 subgoal):
 1. \<And>n xs ys. \<lbrakk>\<And>xs ys. \<lbrakk>enat n < llength xs; enat n < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) n = (lnth xs n, lnth ys n); enat (Suc n) < llength xs; enat (Suc n) < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) (Suc n) = (lnth xs (Suc n), lnth ys (Suc n))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n xs ys. \<lbrakk>\<And>xs ys. \<lbrakk>enat n < llength xs; enat n < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) n = (lnth xs n, lnth ys n); enat (Suc n) < llength xs; enat (Suc n) < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) (Suc n) = (lnth xs (Suc n), lnth ys (Suc n))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>enat n < llength ?xs; enat n < llength ?ys\<rbrakk> \<Longrightarrow> lnth (lzip ?xs ?ys) n = (lnth ?xs n, lnth ?ys n)
enat (Suc n) < llength xs
enat (Suc n) < llength ys

goal (1 subgoal):
 1. \<And>n xs ys. \<lbrakk>\<And>xs ys. \<lbrakk>enat n < llength xs; enat n < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) n = (lnth xs n, lnth ys n); enat (Suc n) < llength xs; enat (Suc n) < llength ys\<rbrakk> \<Longrightarrow> lnth (lzip xs ys) (Suc n) = (lnth xs (Suc n), lnth ys (Suc n))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>enat n < llength ?xs; enat n < llength ?ys\<rbrakk> \<Longrightarrow> lnth (lzip ?xs ?ys) n = (lnth ?xs n, lnth ?ys n)
enat (Suc n) < llength xs
enat (Suc n) < llength ys

goal (1 subgoal):
 1. lnth (lzip xs ys) (Suc n) = (lnth xs (Suc n), lnth ys (Suc n))
[PROOF STEP]
by(cases xs ys rule: llist.exhaust[case_product llist.exhaust])(auto simp add: eSuc_enat[symmetric])
[PROOF STATE]
proof (state)
this:
lnth (lzip xs ys) (Suc n) = (lnth xs (Suc n), lnth ys (Suc n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lim_Ln_over_n: "((\<lambda>n. Ln(of_nat n) / of_nat n) \<longlongrightarrow> 0) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. Ln (of_nat n) / of_nat n) \<longlonglongrightarrow> 0
[PROOF STEP]
using lim_Ln_over_power [of 1]
[PROOF STATE]
proof (prove)
using this:
0 < Re 1 \<Longrightarrow> (\<lambda>n. Ln (of_nat n) / of_nat n powr 1) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. Ln (of_nat n) / of_nat n) \<longlonglongrightarrow> 0
[PROOF STEP]
by simp


[STATEMENT]
lemma cols_id_unit_vecs:
  shows "cols (1\<^sub>m d) = unit_vecs d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cols (1\<^sub>m d) = unit_vecs d
[PROOF STEP]
unfolding unit_vecs_def list_eq_iff_nth_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (cols (1\<^sub>m d)) = length (map (unit_vec d) [0..<d]) \<and> (\<forall>i<length (cols (1\<^sub>m d)). cols (1\<^sub>m d) ! i = map (unit_vec d) [0..<d] ! i)
[PROOF STEP]
by auto


[STATEMENT]
lemma geodesic_segmentD:
  assumes "geodesic_segment_between G x y"
  shows "\<exists>g::(real \<Rightarrow> _). (g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t+dist x y} g \<and> G = g`{t..t+dist x y})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t + dist x y} g \<and> G = g ` {t..t + dist x y}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>g. g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t + dist x y} g \<and> G = g ` {t..t + dist x y}
[PROOF STEP]
obtain h where h: "h 0 = x" "h (dist x y) = y" "isometry_on {0..dist x y} h" "G = h`{0..dist x y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h 0 = x; h (dist x y) = y; isometry_on {0..dist x y} h; G = h ` {0..dist x y}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson \<open>geodesic_segment_between G x y\<close> geodesic_segment_between_def)
[PROOF STATE]
proof (state)
this:
h 0 = x
h (dist x y) = y
isometry_on {0..dist x y} h
G = h ` {0..dist x y}

goal (1 subgoal):
 1. \<exists>g. g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t + dist x y} g \<and> G = g ` {t..t + dist x y}
[PROOF STEP]
have * [simp]: "(\<lambda>x. x - t) ` {t..t + dist x y} = {0..dist x y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x - t) ` {t..t + dist x y} = {0..dist x y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x - t) ` {t..t + dist x y} = {0..dist x y}

goal (1 subgoal):
 1. \<exists>g. g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t + dist x y} g \<and> G = g ` {t..t + dist x y}
[PROOF STEP]
define g where "g = (\<lambda>s. h (s - t))"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>s. h (s - t))

goal (1 subgoal):
 1. \<exists>g. g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t + dist x y} g \<and> G = g ` {t..t + dist x y}
[PROOF STEP]
have "g t = x" "g (t + dist x y) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g t = x &&& g (t + dist x y) = y
[PROOF STEP]
using h assms(1)
[PROOF STATE]
proof (prove)
using this:
h 0 = x
h (dist x y) = y
isometry_on {0..dist x y} h
G = h ` {0..dist x y}
geodesic_segment_between G x y

goal (1 subgoal):
 1. g t = x &&& g (t + dist x y) = y
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
using this:
h 0 = x
h (dist x y) = y
isometry_on {0..dist x y} h
G = h ` {0..dist x y}
geodesic_segment_between G x y

goal (1 subgoal):
 1. h (t - t) = x &&& h (t + dist x y - t) = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g t = x
g (t + dist x y) = y

goal (1 subgoal):
 1. \<exists>g. g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t + dist x y} g \<and> G = g ` {t..t + dist x y}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
g t = x
g (t + dist x y) = y

goal (1 subgoal):
 1. \<exists>g. g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t + dist x y} g \<and> G = g ` {t..t + dist x y}
[PROOF STEP]
have "isometry_on {t..t+dist x y} g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isometry_on {t..t + dist x y} g
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isometry_on {t..t + dist x y} (\<lambda>s. h (s - t))
[PROOF STEP]
apply (rule isometry_on_compose[of _ _ h])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. isometry_on {t..t + dist x y} (\<lambda>x. x - t)
 2. isometry_on ((\<lambda>x. x - t) ` {t..t + dist x y}) h
[PROOF STEP]
by (simp add: dist_real_def isometry_on_def, simp add: h(3))
[PROOF STATE]
proof (state)
this:
isometry_on {t..t + dist x y} g

goal (1 subgoal):
 1. \<exists>g. g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t + dist x y} g \<and> G = g ` {t..t + dist x y}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
isometry_on {t..t + dist x y} g

goal (1 subgoal):
 1. \<exists>g. g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t + dist x y} g \<and> G = g ` {t..t + dist x y}
[PROOF STEP]
have "g` {t..t + dist x y} = G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g ` {t..t + dist x y} = G
[PROOF STEP]
unfolding g_def h(4)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>s. h (s - t)) ` {t..t + dist x y} = h ` {0..dist x y}
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. x - t) ` {t..t + dist x y} = {0..dist x y}

goal (1 subgoal):
 1. (\<lambda>s. h (s - t)) ` {t..t + dist x y} = h ` {0..dist x y}
[PROOF STEP]
by (metis image_image)
[PROOF STATE]
proof (state)
this:
g ` {t..t + dist x y} = G

goal (1 subgoal):
 1. \<exists>g. g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t + dist x y} g \<and> G = g ` {t..t + dist x y}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
g t = x
g (t + dist x y) = y
isometry_on {t..t + dist x y} g
g ` {t..t + dist x y} = G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g t = x
g (t + dist x y) = y
isometry_on {t..t + dist x y} g
g ` {t..t + dist x y} = G

goal (1 subgoal):
 1. \<exists>g. g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t + dist x y} g \<and> G = g ` {t..t + dist x y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>g. g t = x \<and> g (t + dist x y) = y \<and> isometry_on {t..t + dist x y} g \<and> G = g ` {t..t + dist x y}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma braun2_of_size_braun: "braun2_of x n = (s,t) \<Longrightarrow> size s = n \<and> size t = n+1 \<and> braun s \<and> braun t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. braun2_of x n = (s, t) \<Longrightarrow> size s = n \<and> size t = n + 1 \<and> braun s \<and> braun t
[PROOF STEP]
proof(induction x n arbitrary: s t rule: braun2_of.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x n s t. \<lbrakk>\<And>s t. \<lbrakk>n \<noteq> 0; braun2_of x ((n - 1) div 2) = (s, t)\<rbrakk> \<Longrightarrow> size s = (n - 1) div 2 \<and> size t = (n - 1) div 2 + 1 \<and> braun s \<and> braun t; braun2_of x n = (s, t)\<rbrakk> \<Longrightarrow> size s = n \<and> size t = n + 1 \<and> braun s \<and> braun t
[PROOF STEP]
case (1 x n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n \<noteq> 0; braun2_of x ((n - 1) div 2) = (?s, ?t)\<rbrakk> \<Longrightarrow> size ?s = (n - 1) div 2 \<and> size ?t = (n - 1) div 2 + 1 \<and> braun ?s \<and> braun ?t
braun2_of x n = (s, t)

goal (1 subgoal):
 1. \<And>x n s t. \<lbrakk>\<And>s t. \<lbrakk>n \<noteq> 0; braun2_of x ((n - 1) div 2) = (s, t)\<rbrakk> \<Longrightarrow> size s = (n - 1) div 2 \<and> size t = (n - 1) div 2 + 1 \<and> braun s \<and> braun t; braun2_of x n = (s, t)\<rbrakk> \<Longrightarrow> size s = n \<and> size t = n + 1 \<and> braun s \<and> braun t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>n \<noteq> 0; braun2_of x ((n - 1) div 2) = (?s, ?t)\<rbrakk> \<Longrightarrow> size ?s = (n - 1) div 2 \<and> size ?t = (n - 1) div 2 + 1 \<and> braun ?s \<and> braun ?t
braun2_of x n = (s, t)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n \<noteq> 0; braun2_of x ((n - 1) div 2) = (?s, ?t)\<rbrakk> \<Longrightarrow> size ?s = (n - 1) div 2 \<and> size ?t = (n - 1) div 2 + 1 \<and> braun ?s \<and> braun ?t
braun2_of x n = (s, t)

goal (1 subgoal):
 1. size s = n \<and> size t = n + 1 \<and> braun s \<and> braun t
[PROOF STEP]
by (auto simp: braun2_of.simps[of x n] split: prod.splits if_splits) presburger+
[PROOF STATE]
proof (state)
this:
size s = n \<and> size t = n + 1 \<and> braun s \<and> braun t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in domain) poly_mult_degree_le_1:
  assumes "x \<in> carrier (poly_ring R)"
  assumes "y \<in> carrier (poly_ring R)"
  shows "degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) \<le> degree x + degree y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) \<le> degree x + degree y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) \<le> degree x + degree y
[PROOF STEP]
have "degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) = (if x = [] \<or> y = [] then 0 else degree x + degree y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) = (if x = [] \<or> y = [] then 0 else degree x + degree y)
[PROOF STEP]
unfolding univ_poly_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (poly_mult x y) = (if x = [] \<or> y = [] then 0 else degree x + degree y)
[PROOF STEP]
by (metis univ_poly_carrier assms(1,2) carrier_is_subring poly_mult_degree_eq)
[PROOF STATE]
proof (state)
this:
degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) = (if x = [] \<or> y = [] then 0 else degree x + degree y)

goal (1 subgoal):
 1. degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) \<le> degree x + degree y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) = (if x = [] \<or> y = [] then 0 else degree x + degree y)

goal (1 subgoal):
 1. degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) \<le> degree x + degree y
[PROOF STEP]
by (metis nat_le_linear zero_le)
[PROOF STATE]
proof (state)
this:
degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) \<le> degree x + degree y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_append_col_access_in_mat:
  assumes "dim_row A = dim_vec b"
   and "i < dim_row A"
    and "j < dim_col A"
  shows "(row (mat_append_col A b) i) $ j = (row A i) $ j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (mat_append_col A b) i $ j = row A i $ j
[PROOF STEP]
using Matrix.row_transpose[of j A, OF assms(3)]
    Matrix.transpose_transpose[of "(mat_append_col A b)"] assms carrier_matD(1)
    carrier_matD(2) cols_length cols_transpose index_col index_row(1)[of i "mat_append_col A b" j] index_transpose_mat(2)
    mat_append_col.simps mat_append_col_dims
    mat_of_cols_carrier(3) mat_of_rows_row
    nth_append nth_rows row_carrier trans_less_add1 transpose_mat_of_cols
    mat_of_cols_index
[PROOF STATE]
proof (prove)
using this:
row A\<^sup>T j = col A j
(mat_append_col A b)\<^sup>T\<^sup>T = mat_append_col A b
dim_row A = dim_vec b
i < dim_row A
j < dim_col A
?A \<in> carrier_mat ?nr ?nc \<Longrightarrow> dim_row ?A = ?nr
?A \<in> carrier_mat ?nr ?nc \<Longrightarrow> dim_col ?A = ?nc
length (cols ?A) = dim_col ?A
cols ?A\<^sup>T = rows ?A
\<lbrakk>?i < dim_row ?A; ?j < dim_col ?A\<rbrakk> \<Longrightarrow> col ?A ?j $ ?i = ?A $$ (?i, ?j)
\<lbrakk>i < dim_row (mat_append_col A b); j < dim_col (mat_append_col A b)\<rbrakk> \<Longrightarrow> row (mat_append_col A b) i $ j = mat_append_col A b $$ (i, j)
dim_row ?A\<^sup>T = dim_col ?A
mat_append_col ?A ?b = mat_of_cols (dim_row ?A) (cols ?A @ [?b])
mat_append_col ?A ?b \<in> carrier_mat (dim_row ?A) (dim_col ?A + 1)
dim_col (mat_of_cols ?n ?vs) = length ?vs
\<lbrakk>?i < length ?vs; ?vs ! ?i \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> row (mat_of_rows ?n ?vs) ?i = ?vs ! ?i
(?xs @ ?ys) ! ?n = (if ?n < length ?xs then ?xs ! ?n else ?ys ! (?n - length ?xs))
?i < dim_row ?A \<Longrightarrow> rows ?A ! ?i = row ?A ?i
row ?A ?i \<in> carrier_vec (dim_col ?A)
?i < ?j \<Longrightarrow> ?i < ?j + ?m
(mat_of_cols ?n ?vs)\<^sup>T = mat_of_rows ?n ?vs
\<lbrakk>?i < ?n; ?j < length ?ws\<rbrakk> \<Longrightarrow> mat_of_cols ?n ?ws $$ (?i, ?j) = ?ws ! ?j $ ?i

goal (1 subgoal):
 1. row (mat_append_col A b) i $ j = row A i $ j
[PROOF STEP]
by (smt cols_nth index_row(1))


[STATEMENT]
lemma reduce_invertible_mat_D0_BM:
  assumes A: "A \<in> carrier_mat m n"
  and a: "a < m"
  and b: "b < m"
  and ab: "a \<noteq> b"
  and Aa0: "A$$(a,0) \<noteq> 0"
  shows "reduce a b 0 A = (bezout_matrix_JNF A a b 0 euclid_ext2) * A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reduce a b 0 A = bezout_matrix_JNF A a b 0 euclid_ext2 * A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. reduce a b 0 A = bezout_matrix_JNF A a b 0 euclid_ext2 * A
[PROOF STEP]
obtain p q u v d where pquvd: "(p,q,u,v,d) = euclid_ext2 (A$$(a,0)) (A$$(b,0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p q u v d. (p, q, u, v, d) = euclid_ext2 (A $$ (a, 0)) (A $$ (b, 0)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (simp add: euclid_ext2_def)
[PROOF STATE]
proof (state)
this:
(p, q, u, v, d) = euclid_ext2 (A $$ (a, 0)) (A $$ (b, 0))

goal (1 subgoal):
 1. reduce a b 0 A = bezout_matrix_JNF A a b 0 euclid_ext2 * A
[PROOF STEP]
let ?BM = "bezout_matrix_JNF A a b 0 euclid_ext2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. reduce a b 0 A = bezout_matrix_JNF A a b 0 euclid_ext2 * A
[PROOF STEP]
let ?A = "Matrix.mat (dim_row A) (dim_col A)
          (\<lambda>(i,k). if i = a then  (p*A$$(a,k) + q*A$$(b,k))
                   else if i = b then  u * A$$(a,k) + v * A$$(b,k)
                   else A$$(i,k))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. reduce a b 0 A = bezout_matrix_JNF A a b 0 euclid_ext2 * A
[PROOF STEP]
have A'_BZ_A: "?A = ?BM * A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)) = bezout_matrix_JNF A a b 0 euclid_ext2 * A
[PROOF STEP]
by (rule bezout_matrix_JNF_mult_eq2[OF A _ _ ab pquvd], insert a b, auto)
[PROOF STATE]
proof (state)
this:
Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)) = bezout_matrix_JNF A a b 0 euclid_ext2 * A

goal (1 subgoal):
 1. reduce a b 0 A = bezout_matrix_JNF A a b 0 euclid_ext2 * A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)) = bezout_matrix_JNF A a b 0 euclid_ext2 * A

goal (1 subgoal):
 1. reduce a b 0 A = bezout_matrix_JNF A a b 0 euclid_ext2 * A
[PROOF STEP]
have "?A = reduce a b 0 A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)) = reduce a b 0 A
[PROOF STEP]
using pquvd Aa0
[PROOF STATE]
proof (prove)
using this:
(p, q, u, v, d) = euclid_ext2 (A $$ (a, 0)) (A $$ (b, 0))
A $$ (a, 0) \<noteq> 0

goal (1 subgoal):
 1. Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)) = reduce a b 0 A
[PROOF STEP]
unfolding reduce_D0 Let_def
[PROOF STATE]
proof (prove)
using this:
(p, q, u, v, d) = euclid_ext2 (A $$ (a, 0)) (A $$ (b, 0))
A $$ (a, 0) \<noteq> 0

goal (1 subgoal):
 1. Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)) = (if A $$ (a, 0) = 0 then A else case euclid_ext2 (A $$ (a, 0)) (A $$ (b, 0)) of (p, q, u, v, d) \<Rightarrow> Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)))
[PROOF STEP]
by (metis (no_types, lifting) split_conv)
[PROOF STATE]
proof (state)
this:
Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)) = reduce a b 0 A

goal (1 subgoal):
 1. reduce a b 0 A = bezout_matrix_JNF A a b 0 euclid_ext2 * A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)) = bezout_matrix_JNF A a b 0 euclid_ext2 * A
Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)) = reduce a b 0 A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)) = bezout_matrix_JNF A a b 0 euclid_ext2 * A
Matrix.mat (dim_row A) (dim_col A) (\<lambda>(i, k). if i = a then p * A $$ (a, k) + q * A $$ (b, k) else if i = b then u * A $$ (a, k) + v * A $$ (b, k) else A $$ (i, k)) = reduce a b 0 A

goal (1 subgoal):
 1. reduce a b 0 A = bezout_matrix_JNF A a b 0 euclid_ext2 * A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
reduce a b 0 A = bezout_matrix_JNF A a b 0 euclid_ext2 * A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in CRR_market_viable) disc_lbk_option_lgeom:
  shows "(discounted_value r (\<lambda>m. (lbk_option T)) T w) =
    (det_discount r T) * (Max ((\<lambda>i. (lgeom_proc u d init (take i (stake T w))))`{0 .. T}) - (lgeom_proc u d init (stake T w)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. discounted_value r (\<lambda>m. lbk_option T) T w = det_discount r T * ((MAX i\<in>{0..T}. lgeom_proc u d init (take i (stake T w))) - lgeom_proc u d init (stake T w))
[PROOF STEP]
using det_discounted[of r "\<lambda>m. lbk_option T" T w] lbk_option_lgeom[of T w] lgeom_proc_take
[PROOF STATE]
proof (prove)
using this:
discounted_value r (\<lambda>m. lbk_option T) T w = det_discount r T * lbk_option T w
lbk_option T w = (MAX i\<in>{0..T}. lgeom_proc u d init (stake i w)) - lgeom_proc u d init (stake T w)
?i \<le> ?n \<Longrightarrow> lgeom_proc ?u ?d ?init (stake ?i ?w) = lgeom_proc ?u ?d ?init (take ?i (stake ?n ?w))

goal (1 subgoal):
 1. discounted_value r (\<lambda>m. lbk_option T) T w = det_discount r T * ((MAX i\<in>{0..T}. lgeom_proc u d init (take i (stake T w))) - lgeom_proc u d init (stake T w))
[PROOF STEP]
by (metis (no_types, lifting) atLeastAtMost_iff image_cong)


[STATEMENT]
lemma indicator_inter_min: "indicator (A \<inter> B) x = min (indicator A x) (indicator B x::'a::linordered_semidom)"
  and indicator_union_max: "indicator (A \<union> B) x = max (indicator A x) (indicator B x::'a::linordered_semidom)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indicator (A \<inter> B) x = min (indicator A x) (indicator B x) &&& indicator (A \<union> B) x = max (indicator A x) (indicator B x)
[PROOF STEP]
unfolding indicator_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_bool (x \<in> A \<inter> B) = min (of_bool (x \<in> A)) (of_bool (x \<in> B)) &&& of_bool (x \<in> A \<union> B) = max (of_bool (x \<in> A)) (of_bool (x \<in> B))
[PROOF STEP]
by (auto simp: min_def max_def)


[STATEMENT]
lemma arcsin_arctan: "-1 < x \<Longrightarrow> x < 1 \<Longrightarrow> arcsin x = arctan(x / sqrt(1 - x\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 < x; x < 1\<rbrakk> \<Longrightarrow> arcsin x = arctan (x / sqrt (1 - x\<^sup>2))
[PROOF STEP]
by (simp add: arccos_arctan arcsin_arccos_eq)


[STATEMENT]
lemma state_list_length_lemma_2:
  fixes as s
  shows "(length (state_list s as)) = (length as + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (state_list s as) = length as + 1
[PROOF STEP]
proof (induction as arbitrary: s)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s. length (state_list s []) = length [] + 1
 2. \<And>a as s. (\<And>s. length (state_list s as) = length as + 1) \<Longrightarrow> length (state_list s (a # as)) = length (a # as) + 1
[PROOF STEP]
qed auto

\<comment> \<open>NOTE using fun because of multiple defining equations.\<close>
\<comment> \<open>NOTE name shortened to 'state\_def'\<close>


[STATEMENT]
lemma R_list_length:
"length (R_list n R) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (R_list n R) = n
[PROOF STEP]
apply(induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (R_list 0 R) = 0
 2. \<And>n. length (R_list n R) = n \<Longrightarrow> length (R_list (Suc n) R) = Suc n
[PROOF STEP]
by auto


[STATEMENT]
lemma sum_common_left:
  fixes f::"'a \<Rightarrow> 'b::comm_ring_1"
  assumes "finite A"
  shows "sum (\<lambda>i. c * f i) A = c * sum f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>A. c * f i) = c * sum f A
[PROOF STEP]
by (simp add: mult_hom.hom_sum)


[STATEMENT]
lemma Ils''m_Ilsm: "$(I^{l}s'')^{m}_n = (1+i).^(1/m) * $(I^{l}s)^{m}_n"
  if "l \<noteq> 0" "m \<noteq> 0" for l m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $(I^{l}s'')^{m}_n = (1 + i) .^ (1 / real m) * $(I^{l}s)^{m}_n
[PROOF STEP]
unfolding acc_incr_def acc_due_incr_def sum_distrib_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 + i) .^ (real n - real k / real m) * real_of_int \<lceil>real (l * (k + 1)) / real m\<rceil> / (real l * real m)) = (\<Sum>na<n * m. (1 + i) .^ (1 / real m) * ((1 + i) .^ (real n - real (na + 1) / real m) * real_of_int \<lceil>real (l * (na + 1)) / real m\<rceil> / (real l * real m)))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
l \<noteq> 0
m \<noteq> 0

goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 + i) .^ (real n - real k / real m) * real_of_int \<lceil>real (l * (k + 1)) / real m\<rceil> / (real l * real m)) = (\<Sum>na<n * m. (1 + i) .^ (1 / real m) * ((1 + i) .^ (real n - real (na + 1) / real m) * real_of_int \<lceil>real (l * (na + 1)) / real m\<rceil> / (real l * real m)))
[PROOF STEP]
apply (intro sum.cong; simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x < n * m; 0 < l; 0 < m\<rbrakk> \<Longrightarrow> \<lceil>(real l + real l * real x) / real m\<rceil> = 0 \<or> (1 + i) .^ (real n - real x / real m) = (1 + i) .^ (1 / real m) * (1 + i) .^ (real n - (1 + real x) / real m)
[PROOF STEP]
by (smt (verit, ccfv_SIG) add_divide_distrib powr_add)


[STATEMENT]
lemma product_transitions_def :
  "transitions (product A B) = {((qA,qB),x,y,(qA',qB')) | qA qB x y qA' qB' . (qA,x,y,qA') \<in> transitions A \<and> (qB,x,y,qB') \<in> transitions B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FSM.transitions (Product_FSM.product A B) = {((qA, qB), x, y, qA', qB') |qA qB x y qA' qB'. (qA, x, y, qA') \<in> FSM.transitions A \<and> (qB, x, y, qB') \<in> FSM.transitions B}
[PROOF STEP]
by (transfer; simp)+


[STATEMENT]
lemma nat_power_diff: "n > 0 \<Longrightarrow> nat_power n (a - b) = nat_power n a / nat_power n b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> nat_power n (a - b) = nat_power n a / nat_power n b
[PROOF STEP]
using nat_power_add[of n "a - b" b]
[PROOF STATE]
proof (prove)
using this:
0 < n \<Longrightarrow> nat_power n (a - b + b) = nat_power n (a - b) * nat_power n b

goal (1 subgoal):
 1. 0 < n \<Longrightarrow> nat_power n (a - b) = nat_power n a / nat_power n b
[PROOF STEP]
by (simp add: divide_simps)


[STATEMENT]
lemma weaken_A_Int_B_eq_empty: "(\<forall>x. x \<in> A \<longrightarrow> x \<notin> B) \<Longrightarrow> A \<inter> B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. x \<in> A \<longrightarrow> x \<notin> B \<Longrightarrow> A \<inter> B = {}
[PROOF STEP]
apply fast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma prodinf_eq_lim:
  fixes f :: "nat \<Rightarrow> 'a :: {idom,topological_semigroup_mult,t2_space}"
  assumes "convergent_prod f" "\<And>i. f i \<noteq> 0"
  shows "prodinf f = lim (\<lambda>n. \<Prod>i\<le>n. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prodinf f = lim (\<lambda>n. prod f {..n})
[PROOF STEP]
using assms convergent_prod_offset_0 [OF assms]
[PROOF STATE]
proof (prove)
using this:
convergent_prod f
f ?i \<noteq> (0::'a)
\<exists>p. raw_has_prod f 0 p

goal (1 subgoal):
 1. prodinf f = lim (\<lambda>n. prod f {..n})
[PROOF STEP]
by (simp add: prod_defs lim_def) (metis (no_types) assms(1) convergent_prod_to_zero_iff)


[STATEMENT]
lemma full_col_rank_imp_independent_columns:
  fixes A::"'a::{field}^'n::{mod_type}^'m::{mod_type}"
  assumes "rank A = ncols A"
  shows "vec.independent (columns A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent (columns A)
[PROOF STEP]
by (metis assms full_rank_imp_is_basis2)


[STATEMENT]
lemma harm_mono: "m \<le> n \<Longrightarrow> harm m \<le> (harm n :: 'a :: {real_normed_field,linordered_field})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> harm m \<le> harm n
[PROOF STEP]
by(simp add: harm_def sum_mono2)


[STATEMENT]
lemma Qp_res_diff:
  assumes "x \<in> \<O>\<^sub>p"
  assumes "y \<in> \<O>\<^sub>p"
  shows "Qp_res (x \<ominus> y) n = Qp_res x n \<ominus>\<^bsub>Zp_res_ring n\<^esub> Qp_res y n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Qp_res (x \<ominus> y) n = Qp_res x n \<ominus>\<^bsub>residue_ring (p ^ n)\<^esub> Qp_res y n
[PROOF STEP]
unfolding Qp_res_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_Zp (x \<ominus> y) n = to_Zp x n \<ominus>\<^bsub>residue_ring (p ^ n)\<^esub> to_Zp y n
[PROOF STEP]
using assms residue_of_diff to_Zp_minus
[PROOF STATE]
proof (prove)
using this:
x \<in> \<O>\<^sub>p
y \<in> \<O>\<^sub>p
?b \<in> carrier Z\<^sub>p \<Longrightarrow> (?a \<ominus>\<^bsub>Z\<^sub>p\<^esub> ?b) ?k = ?a ?k \<ominus>\<^bsub>residue_ring (p ^ ?k)\<^esub> ?b ?k
\<lbrakk>?a \<in> \<O>\<^sub>p; ?b \<in> \<O>\<^sub>p\<rbrakk> \<Longrightarrow> to_Zp (?a \<ominus> ?b) = to_Zp ?a \<ominus>\<^bsub>Z\<^sub>p\<^esub> to_Zp ?b

goal (1 subgoal):
 1. to_Zp (x \<ominus> y) n = to_Zp x n \<ominus>\<^bsub>residue_ring (p ^ n)\<^esub> to_Zp y n
[PROOF STEP]
by (meson val_ring_res)


[STATEMENT]
theorem obj_sym: "Trueprop (t = s) \<equiv> Trueprop (s = t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t = s \<equiv> s = t
[PROOF STEP]
by (rule equal_intr_rule) auto


[STATEMENT]
lemma mono_rfloor: "mono rfloor" and mono_rceil: "mono rceil"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono rfloor &&& mono rceil
[PROOF STEP]
by (auto intro!: monoI simp: rfloor_def floor_mono rceil_def ceiling_mono)


[STATEMENT]
lemma finite_preImage[simp]: "\<lbrakk> finite A; inj f \<rbrakk> \<Longrightarrow> finite (preImage f A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; inj f\<rbrakk> \<Longrightarrow> finite (preImage f A)
[PROOF STEP]
apply(induct A rule: finite_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj f \<Longrightarrow> finite (preImage f {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; inj f \<Longrightarrow> finite (preImage f F); inj f\<rbrakk> \<Longrightarrow> finite (preImage f (insert x F))
[PROOF STEP]
apply(simp add: preImage_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; inj f \<Longrightarrow> finite (preImage f F); inj f\<rbrakk> \<Longrightarrow> finite (preImage f (insert x F))
[PROOF STEP]
apply(simp add: preImage_insert)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma square_norm_one:
  fixes x :: "'a::real_normed_div_algebra"
  assumes "x\<^sup>2 = 1"
  shows "norm x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm x = 1
[PROOF STEP]
by (metis assms norm_minus_cancel norm_one power2_eq_1_iff)


[STATEMENT]
lemma order_gt_0 [simp]: "order \<G> > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < order \<G>
[PROOF STEP]
by (simp add: prime_gt_0_nat prime_order)


[STATEMENT]
lemma (in aGroup) nsum_addTr:
  "(\<forall>j \<le> n. f j \<in> carrier A \<and> g j \<in> carrier A) \<longrightarrow>
   nsum A (\<lambda> i. (f i) \<plusminus> (g i)) n = (nsum A f n) \<plusminus> (nsum A g n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<le>n. f j \<in> carrier A \<and> g j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f i \<plusminus> g i) n = \<Sigma>\<^sub>e A f n \<plusminus> \<Sigma>\<^sub>e A g n
[PROOF STEP]
apply (induct_tac "n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>j\<le>0. f j \<in> carrier A \<and> g j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f i \<plusminus> g i) 0 = \<Sigma>\<^sub>e A f 0 \<plusminus> \<Sigma>\<^sub>e A g 0
 2. \<And>n. (\<forall>j\<le>n. f j \<in> carrier A \<and> g j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f i \<plusminus> g i) n = \<Sigma>\<^sub>e A f n \<plusminus> \<Sigma>\<^sub>e A g n \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f i \<plusminus> g i) Suc n = \<Sigma>\<^sub>e A f Suc n \<plusminus> \<Sigma>\<^sub>e A g Suc n
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (\<forall>j\<le>n. f j \<in> carrier A \<and> g j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f i \<plusminus> g i) n = \<Sigma>\<^sub>e A f n \<plusminus> \<Sigma>\<^sub>e A g n \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f i \<plusminus> g i) Suc n = \<Sigma>\<^sub>e A f Suc n \<plusminus> \<Sigma>\<^sub>e A g Suc n
[PROOF STEP]
apply (simp, rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<forall>j\<le>n. f j \<in> carrier A \<and> g j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f i \<plusminus> g i) n = \<Sigma>\<^sub>e A f n \<plusminus> \<Sigma>\<^sub>e A g n; \<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A f n \<plusminus> \<Sigma>\<^sub>e A g n \<plusminus> (f (Suc n) \<plusminus> g (Suc n)) = \<Sigma>\<^sub>e A f n \<plusminus> f (Suc n) \<plusminus> (\<Sigma>\<^sub>e A g n \<plusminus> g (Suc n))
[PROOF STEP]
apply (cut_tac n = n in Nsetn_sub_mem1, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<Sigma>\<^sub>e A (\<lambda>i. f i \<plusminus> g i) n = \<Sigma>\<^sub>e A f n \<plusminus> \<Sigma>\<^sub>e A g n; \<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A f n \<plusminus> \<Sigma>\<^sub>e A g n \<plusminus> (f (Suc n) \<plusminus> g (Suc n)) = \<Sigma>\<^sub>e A f n \<plusminus> f (Suc n) \<plusminus> (\<Sigma>\<^sub>e A g n \<plusminus> g (Suc n))
[PROOF STEP]
apply (thin_tac "\<Sigma>\<^sub>e A (\<lambda>i. f i \<plusminus> g i) n = \<Sigma>\<^sub>e A f n \<plusminus> \<Sigma>\<^sub>e A g n")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A \<Longrightarrow> \<Sigma>\<^sub>e A f n \<plusminus> \<Sigma>\<^sub>e A g n \<plusminus> (f (Suc n) \<plusminus> g (Suc n)) = \<Sigma>\<^sub>e A f n \<plusminus> f (Suc n) \<plusminus> (\<Sigma>\<^sub>e A g n \<plusminus> g (Suc n))
[PROOF STEP]
apply (rule aGroup.ag_add4_rel, rule aGroup_axioms)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>n. \<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A \<Longrightarrow> \<Sigma>\<^sub>e A f n \<in> carrier A
 2. \<And>n. \<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A \<Longrightarrow> \<Sigma>\<^sub>e A g n \<in> carrier A
 3. \<And>n. \<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A \<Longrightarrow> f (Suc n) \<in> carrier A
 4. \<And>n. \<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A \<Longrightarrow> g (Suc n) \<in> carrier A
[PROOF STEP]
apply (rule aGroup.nsum_mem, rule aGroup_axioms, rule allI, simp)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n. \<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A \<Longrightarrow> \<Sigma>\<^sub>e A g n \<in> carrier A
 2. \<And>n. \<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A \<Longrightarrow> f (Suc n) \<in> carrier A
 3. \<And>n. \<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A \<Longrightarrow> g (Suc n) \<in> carrier A
[PROOF STEP]
apply (rule aGroup.nsum_mem, rule aGroup_axioms, rule allI, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A \<Longrightarrow> f (Suc n) \<in> carrier A
 2. \<And>n. \<forall>j\<le>Suc n. f j \<in> carrier A \<and> g j \<in> carrier A \<Longrightarrow> g (Suc n) \<in> carrier A
[PROOF STEP]
apply simp+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma  det_3:
  "det (A::'a::comm_ring_1^3^3) =
    A$1$1 * A$2$2 * A$3$3 +
    A$1$2 * A$2$3 * A$3$1 +
    A$1$3 * A$2$1 * A$3$2 -
    A$1$1 * A$2$3 * A$3$2 -
    A$1$2 * A$2$1 * A$3$3 -
    A$1$3 * A$2$2 * A$3$1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = A $ 1 $ 1 * A $ 2 $ 2 * A $ 3 $ 3 + A $ 1 $ 2 * A $ 2 $ 3 * A $ 3 $ 1 + A $ 1 $ 3 * A $ 2 $ 1 * A $ 3 $ 2 - A $ 1 $ 1 * A $ 2 $ 3 * A $ 3 $ 2 - A $ 1 $ 2 * A $ 2 $ 1 * A $ 3 $ 3 - A $ 1 $ 3 * A $ 2 $ 2 * A $ 3 $ 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = A $ 1 $ 1 * A $ 2 $ 2 * A $ 3 $ 3 + A $ 1 $ 2 * A $ 2 $ 3 * A $ 3 $ 1 + A $ 1 $ 3 * A $ 2 $ 1 * A $ 3 $ 2 - A $ 1 $ 1 * A $ 2 $ 3 * A $ 3 $ 2 - A $ 1 $ 2 * A $ 2 $ 1 * A $ 3 $ 3 - A $ 1 $ 3 * A $ 2 $ 2 * A $ 3 $ 1
[PROOF STEP]
have f123: "finite {2::3, 3}" "1 \<notin> {2::3, 3}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {2, 3} &&& 1 \<notin> {2, 3}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {2, 3}
1 \<notin> {2, 3}

goal (1 subgoal):
 1. det A = A $ 1 $ 1 * A $ 2 $ 2 * A $ 3 $ 3 + A $ 1 $ 2 * A $ 2 $ 3 * A $ 3 $ 1 + A $ 1 $ 3 * A $ 2 $ 1 * A $ 3 $ 2 - A $ 1 $ 1 * A $ 2 $ 3 * A $ 3 $ 2 - A $ 1 $ 2 * A $ 2 $ 1 * A $ 3 $ 3 - A $ 1 $ 3 * A $ 2 $ 2 * A $ 3 $ 1
[PROOF STEP]
have f23: "finite {3::3}" "2 \<notin> {3::3}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {3} &&& 2 \<notin> {3}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {3}
2 \<notin> {3}

goal (1 subgoal):
 1. det A = A $ 1 $ 1 * A $ 2 $ 2 * A $ 3 $ 3 + A $ 1 $ 2 * A $ 2 $ 3 * A $ 3 $ 1 + A $ 1 $ 3 * A $ 2 $ 1 * A $ 3 $ 2 - A $ 1 $ 1 * A $ 2 $ 3 * A $ 3 $ 2 - A $ 1 $ 2 * A $ 2 $ 1 * A $ 3 $ 3 - A $ 1 $ 3 * A $ 2 $ 2 * A $ 3 $ 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = A $ 1 $ 1 * A $ 2 $ 2 * A $ 3 $ 3 + A $ 1 $ 2 * A $ 2 $ 3 * A $ 3 $ 1 + A $ 1 $ 3 * A $ 2 $ 1 * A $ 3 $ 2 - A $ 1 $ 1 * A $ 2 $ 3 * A $ 3 $ 2 - A $ 1 $ 2 * A $ 2 $ 1 * A $ 3 $ 3 - A $ 1 $ 3 * A $ 2 $ 2 * A $ 3 $ 1
[PROOF STEP]
unfolding det_def UNIV_3
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | p permutes {1, 2, 3}. of_int (sign p) * (\<Prod>i\<in>{1, 2, 3}. A $ i $ p i)) = A $ 1 $ 1 * A $ 2 $ 2 * A $ 3 $ 3 + A $ 1 $ 2 * A $ 2 $ 3 * A $ 3 $ 1 + A $ 1 $ 3 * A $ 2 $ 1 * A $ 3 $ 2 - A $ 1 $ 1 * A $ 2 $ 3 * A $ 3 $ 2 - A $ 1 $ 2 * A $ 2 $ 1 * A $ 3 $ 3 - A $ 1 $ 3 * A $ 2 $ 2 * A $ 3 $ 1
[PROOF STEP]
unfolding sum_over_permutations_insert[OF f123]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b\<in>{1, 2, 3}. \<Sum>q\<in>{p. p permutes {2, 3}}. of_int (sign (Transposition.transpose 1 b \<circ> q)) * (\<Prod>i\<in>{1, 2, 3}. A $ i $ (Transposition.transpose 1 b \<circ> q) i)) = A $ 1 $ 1 * A $ 2 $ 2 * A $ 3 $ 3 + A $ 1 $ 2 * A $ 2 $ 3 * A $ 3 $ 1 + A $ 1 $ 3 * A $ 2 $ 1 * A $ 3 $ 2 - A $ 1 $ 1 * A $ 2 $ 3 * A $ 3 $ 2 - A $ 1 $ 2 * A $ 2 $ 1 * A $ 3 $ 3 - A $ 1 $ 3 * A $ 2 $ 2 * A $ 3 $ 1
[PROOF STEP]
unfolding sum_over_permutations_insert[OF f23]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b\<in>{1, 2, 3}. \<Sum>ba\<in>{2, 3}. \<Sum>q\<in>{p. p permutes {3}}. of_int (sign (Transposition.transpose 1 b \<circ> (Transposition.transpose 2 ba \<circ> q))) * (\<Prod>i\<in>{1, 2, 3}. A $ i $ (Transposition.transpose 1 b \<circ> (Transposition.transpose 2 ba \<circ> q)) i)) = A $ 1 $ 1 * A $ 2 $ 2 * A $ 3 $ 3 + A $ 1 $ 2 * A $ 2 $ 3 * A $ 3 $ 1 + A $ 1 $ 3 * A $ 2 $ 1 * A $ 3 $ 2 - A $ 1 $ 1 * A $ 2 $ 3 * A $ 3 $ 2 - A $ 1 $ 2 * A $ 2 $ 1 * A $ 3 $ 3 - A $ 1 $ 3 * A $ 2 $ 2 * A $ 3 $ 1
[PROOF STEP]
unfolding permutes_sing
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b\<in>{1, 2, 3}. \<Sum>ba\<in>{2, 3}. \<Sum>q\<in>{p. p = id}. of_int (sign (Transposition.transpose 1 b \<circ> (Transposition.transpose 2 ba \<circ> q))) * (\<Prod>i\<in>{1, 2, 3}. A $ i $ (Transposition.transpose 1 b \<circ> (Transposition.transpose 2 ba \<circ> q)) i)) = A $ 1 $ 1 * A $ 2 $ 2 * A $ 3 $ 3 + A $ 1 $ 2 * A $ 2 $ 3 * A $ 3 $ 1 + A $ 1 $ 3 * A $ 2 $ 1 * A $ 3 $ 2 - A $ 1 $ 1 * A $ 2 $ 3 * A $ 3 $ 2 - A $ 1 $ 2 * A $ 2 $ 1 * A $ 3 $ 3 - A $ 1 $ 3 * A $ 2 $ 2 * A $ 3 $ 1
[PROOF STEP]
by (simp add: sign_swap_id permutation_swap_id sign_compose sign_id swap_id_eq)
[PROOF STATE]
proof (state)
this:
det A = A $ 1 $ 1 * A $ 2 $ 2 * A $ 3 $ 3 + A $ 1 $ 2 * A $ 2 $ 3 * A $ 3 $ 1 + A $ 1 $ 3 * A $ 2 $ 1 * A $ 3 $ 2 - A $ 1 $ 1 * A $ 2 $ 3 * A $ 3 $ 2 - A $ 1 $ 2 * A $ 2 $ 1 * A $ 3 $ 3 - A $ 1 $ 3 * A $ 2 $ 2 * A $ 3 $ 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rsum_diff_bound:
  assumes "p tagged_division_of (cbox a b)"
    and "\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e"
  shows "norm (sum (\<lambda>(x,k). content k *\<^sub>R f x) p - sum (\<lambda>(x,k). content k *\<^sub>R g x) p) \<le>
         e * content (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. content k *\<^sub>R g x)) \<le> e * content (cbox a b)
[PROOF STEP]
using order_trans[OF _ rsum_bound[OF assms]]
[PROOF STATE]
proof (prove)
using this:
?x \<le> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x - g x)) \<Longrightarrow> ?x \<le> e * content (cbox a b)

goal (1 subgoal):
 1. norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. content k *\<^sub>R g x)) \<le> e * content (cbox a b)
[PROOF STEP]
by (simp add: split_def scaleR_diff_right sum_subtractf eq_refl)


[STATEMENT]
lemma nth_root_nat_nth_power [simp]: "k > 0 \<Longrightarrow> nth_root_nat k (n ^ k) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> nth_root_nat k (n ^ k) = n
[PROOF STEP]
by (intro nth_root_nat_unique order.refl power_strict_mono) simp_all