[STATEMENT]
lemma antilinear_imp_scaleC:
  fixes D :: "complex \<Rightarrow> 'a::complex_vector"
  assumes "antilinear D"
  obtains d where "D = (\<lambda>x. cnj x *\<^sub>C d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d. D = (\<lambda>x. cnj x *\<^sub>C d) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>d. D = (\<lambda>x. cnj x *\<^sub>C d) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
interpret clinear "D o cnj"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. clinear (D \<circ> cnj)
[PROOF STEP]
apply standard
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b1 b2. (D \<circ> cnj) (b1 + b2) = (D \<circ> cnj) b1 + (D \<circ> cnj) b2
 2. \<And>r b. (D \<circ> cnj) (r *\<^sub>C b) = r *\<^sub>C (D \<circ> cnj) b
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b1 b2. D (cnj b1 + cnj b2) = D (cnj b1) + D (cnj b2)
 2. \<And>r b. D (cnj r * cnj b) = r *\<^sub>C D (cnj b)
[PROOF STEP]
apply (simp add: additive.add assms antilinear.axioms(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r b. D (cnj r * cnj b) = r *\<^sub>C D (cnj b)
[PROOF STEP]
using assms antilinear.scaleC
[PROOF STATE]
proof (prove)
using this:
antilinear D
antilinear ?f \<Longrightarrow> ?f (?r *\<^sub>C ?x) = cnj ?r *\<^sub>C ?f ?x

goal (1 subgoal):
 1. \<And>r b. D (cnj r * cnj b) = r *\<^sub>C D (cnj b)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>d. D = (\<lambda>x. cnj x *\<^sub>C d) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain d where "D o cnj = (\<lambda>x. x *\<^sub>C d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d. D \<circ> cnj = (\<lambda>x. x *\<^sub>C d) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using clinear_axioms complex_vector.linear_imp_scale
[PROOF STATE]
proof (prove)
using this:
clinear (D \<circ> cnj)
\<lbrakk>clinear ?D; \<And>d. ?D = (\<lambda>x. x *\<^sub>C d) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>d. D \<circ> cnj = (\<lambda>x. x *\<^sub>C d) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
D \<circ> cnj = (\<lambda>x. x *\<^sub>C d)

goal (1 subgoal):
 1. (\<And>d. D = (\<lambda>x. cnj x *\<^sub>C d) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
D \<circ> cnj = (\<lambda>x. x *\<^sub>C d)
[PROOF STEP]
have \<open>D = (\<lambda>x. cnj x *\<^sub>C d)\<close>
[PROOF STATE]
proof (prove)
using this:
D \<circ> cnj = (\<lambda>x. x *\<^sub>C d)

goal (1 subgoal):
 1. D = (\<lambda>x. cnj x *\<^sub>C d)
[PROOF STEP]
by (metis comp_apply complex_cnj_cnj)
[PROOF STATE]
proof (state)
this:
D = (\<lambda>x. cnj x *\<^sub>C d)

goal (1 subgoal):
 1. (\<And>d. D = (\<lambda>x. cnj x *\<^sub>C d) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
D = (\<lambda>x. cnj x *\<^sub>C d)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
D = (\<lambda>x. cnj x *\<^sub>C d)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_pmf_inf:
  fixes p q :: "'a pmf"
  assumes 1: "rel_pmf R p q"
  assumes 2: "rel_pmf R q p"
  and refl: "reflp R" and trans: "transp R"
  shows "rel_pmf (inf R R\<inverse>\<inverse>) p q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_pmf (inf R R\<inverse>\<inverse>) p q
[PROOF STEP]
proof (subst rel_pmf_iff_equivp, safe)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. equivp (inf R R\<inverse>\<inverse>)
 2. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
show "equivp (inf R R\<inverse>\<inverse>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equivp (inf R R\<inverse>\<inverse>)
[PROOF STEP]
using trans refl
[PROOF STATE]
proof (prove)
using this:
transp R
reflp R

goal (1 subgoal):
 1. equivp (inf R R\<inverse>\<inverse>)
[PROOF STEP]
by (auto simp: equivp_reflp_symp_transp intro: sympI transpI reflpI dest: transpD reflpD)
[PROOF STATE]
proof (state)
this:
equivp (inf R R\<inverse>\<inverse>)

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
fix C
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
assume "C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y}"
[PROOF STATE]
proof (state)
this:
C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y}

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y}
[PROOF STEP]
obtain x where C: "C = {y. R x y \<and> R y x}"
[PROOF STATE]
proof (prove)
using this:
C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y}

goal (1 subgoal):
 1. (\<And>x. C = {y. R x y \<and> R y x} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: quotientE)
[PROOF STATE]
proof (state)
this:
C = {y. R x y \<and> R y x}

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
let ?R = "\<lambda>x y. R x y \<and> R y x"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
let ?\<mu>R = "\<lambda>y. measure q {x. ?R x y}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
have "measure p {y. ?R x y} = measure p ({y. R x y} - {y. R x y \<and> \<not> R y x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob p {y. R x y \<and> R y x} = measure_pmf.prob p ({y. R x y} - {y. R x y \<and> \<not> R y x})
[PROOF STEP]
by(auto intro!: arg_cong[where f="measure p"])
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p {y. R x y \<and> R y x} = measure_pmf.prob p ({y. R x y} - {y. R x y \<and> \<not> R y x})

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p {y. R x y \<and> R y x} = measure_pmf.prob p ({y. R x y} - {y. R x y \<and> \<not> R y x})

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
have "\<dots> = measure p {y. R x y} - measure p {y. R x y \<and> \<not> R y x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob p ({y. R x y} - {y. R x y \<and> \<not> R y x}) = measure_pmf.prob p {y. R x y} - measure_pmf.prob p {y. R x y \<and> \<not> R y x}
[PROOF STEP]
by (rule measure_pmf.finite_measure_Diff) auto
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p ({y. R x y} - {y. R x y \<and> \<not> R y x}) = measure_pmf.prob p {y. R x y} - measure_pmf.prob p {y. R x y \<and> \<not> R y x}

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p ({y. R x y} - {y. R x y \<and> \<not> R y x}) = measure_pmf.prob p {y. R x y} - measure_pmf.prob p {y. R x y \<and> \<not> R y x}

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
have "measure p {y. R x y \<and> \<not> R y x} = measure q {y. R x y \<and> \<not> R y x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob p {y. R x y \<and> \<not> R y x} = measure_pmf.prob q {y. R x y \<and> \<not> R y x}
[PROOF STEP]
using 1 2 refl trans
[PROOF STATE]
proof (prove)
using this:
rel_pmf R p q
rel_pmf R q p
reflp R
transp R

goal (1 subgoal):
 1. measure_pmf.prob p {y. R x y \<and> \<not> R y x} = measure_pmf.prob q {y. R x y \<and> \<not> R y x}
[PROOF STEP]
by(auto intro!: Orderings.antisym measure_Ioi)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p {y. R x y \<and> \<not> R y x} = measure_pmf.prob q {y. R x y \<and> \<not> R y x}

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p {y. R x y \<and> \<not> R y x} = measure_pmf.prob q {y. R x y \<and> \<not> R y x}

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
have "measure p {y. R x y} = measure q {y. R x y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob p {y. R x y} = measure_pmf.prob q {y. R x y}
[PROOF STEP]
using 1 2 refl trans
[PROOF STATE]
proof (prove)
using this:
rel_pmf R p q
rel_pmf R q p
reflp R
transp R

goal (1 subgoal):
 1. measure_pmf.prob p {y. R x y} = measure_pmf.prob q {y. R x y}
[PROOF STEP]
by(auto intro!: Orderings.antisym measure_Ici)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p {y. R x y} = measure_pmf.prob q {y. R x y}

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p {y. R x y} = measure_pmf.prob q {y. R x y}

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
have "measure q {y. R x y} - measure q {y. R x y \<and> \<not> R y x} =
    measure q ({y. R x y} - {y. R x y \<and> \<not> R y x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob q {y. R x y} - measure_pmf.prob q {y. R x y \<and> \<not> R y x} = measure_pmf.prob q ({y. R x y} - {y. R x y \<and> \<not> R y x})
[PROOF STEP]
by(rule measure_pmf.finite_measure_Diff[symmetric]) auto
[PROOF STATE]
proof (state)
this:
measure_pmf.prob q {y. R x y} - measure_pmf.prob q {y. R x y \<and> \<not> R y x} = measure_pmf.prob q ({y. R x y} - {y. R x y \<and> \<not> R y x})

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.prob q {y. R x y} - measure_pmf.prob q {y. R x y \<and> \<not> R y x} = measure_pmf.prob q ({y. R x y} - {y. R x y \<and> \<not> R y x})

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
have "\<dots> = ?\<mu>R x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob q ({y. R x y} - {y. R x y \<and> \<not> R y x}) = measure_pmf.prob q {xa. R xa x \<and> R x xa}
[PROOF STEP]
by(auto intro!: arg_cong[where f="measure q"])
[PROOF STATE]
proof (state)
this:
measure_pmf.prob q ({y. R x y} - {y. R x y \<and> \<not> R y x}) = measure_pmf.prob q {xa. R xa x \<and> R x xa}

goal (1 subgoal):
 1. \<And>C. C \<in> UNIV // {(x, y). inf R R\<inverse>\<inverse> x y} \<Longrightarrow> measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
measure_pmf.prob p {y. R x y \<and> R y x} = measure_pmf.prob q {xa. R xa x \<and> R x xa}
[PROOF STEP]
show "measure p C = measure q C"
[PROOF STATE]
proof (prove)
using this:
measure_pmf.prob p {y. R x y \<and> R y x} = measure_pmf.prob q {xa. R xa x \<and> R x xa}

goal (1 subgoal):
 1. measure_pmf.prob p C = measure_pmf.prob q C
[PROOF STEP]
by (simp add: C conj_commute)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p C = measure_pmf.prob q C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma T_BIT_ub: "\<forall>i<n. qs!i \<in> set init \<Longrightarrow> T_BIT n \<le> n * size init"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<n. qs ! i \<in> set init \<Longrightarrow> T_BIT n \<le> real (n * length init)
[PROOF STEP]
proof(induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>i<0. qs ! i \<in> set init \<Longrightarrow> T_BIT 0 \<le> real (0 * length init)
 2. \<And>n. \<lbrakk>\<forall>i<n. qs ! i \<in> set init \<Longrightarrow> T_BIT n \<le> real (n * length init); \<forall>i<Suc n. qs ! i \<in> set init\<rbrakk> \<Longrightarrow> T_BIT (Suc n) \<le> real (Suc n * length init)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
\<forall>i<0. qs ! i \<in> set init

goal (2 subgoals):
 1. \<forall>i<0. qs ! i \<in> set init \<Longrightarrow> T_BIT 0 \<le> real (0 * length init)
 2. \<And>n. \<lbrakk>\<forall>i<n. qs ! i \<in> set init \<Longrightarrow> T_BIT n \<le> real (n * length init); \<forall>i<Suc n. qs ! i \<in> set init\<rbrakk> \<Longrightarrow> T_BIT (Suc n) \<le> real (Suc n * length init)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_BIT 0 \<le> real (0 * length init)
[PROOF STEP]
by(simp add: T_BIT_def)
[PROOF STATE]
proof (state)
this:
T_BIT 0 \<le> real (0 * length init)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>i<n. qs ! i \<in> set init \<Longrightarrow> T_BIT n \<le> real (n * length init); \<forall>i<Suc n. qs ! i \<in> set init\<rbrakk> \<Longrightarrow> T_BIT (Suc n) \<le> real (Suc n * length init)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>i<n. qs ! i \<in> set init \<Longrightarrow> T_BIT n \<le> real (n * length init); \<forall>i<Suc n. qs ! i \<in> set init\<rbrakk> \<Longrightarrow> T_BIT (Suc n) \<le> real (Suc n * length init)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<forall>i<n. qs ! i \<in> set init \<Longrightarrow> T_BIT n \<le> real (n * length init)
\<forall>i<Suc n. qs ! i \<in> set init

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>i<n. qs ! i \<in> set init \<Longrightarrow> T_BIT n \<le> real (n * length init); \<forall>i<Suc n. qs ! i \<in> set init\<rbrakk> \<Longrightarrow> T_BIT (Suc n) \<le> real (Suc n * length init)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>i<n. qs ! i \<in> set init \<Longrightarrow> T_BIT n \<le> real (n * length init)
\<forall>i<Suc n. qs ! i \<in> set init

goal (1 subgoal):
 1. T_BIT (Suc n) \<le> real (Suc n * length init)
[PROOF STEP]
using t_BIT_ub[where n="n"]
[PROOF STATE]
proof (prove)
using this:
\<forall>i<n. qs ! i \<in> set init \<Longrightarrow> T_BIT n \<le> real (n * length init)
\<forall>i<Suc n. qs ! i \<in> set init
qs ! n \<in> set init \<Longrightarrow> t_BIT n \<le> real (length init)

goal (1 subgoal):
 1. T_BIT (Suc n) \<le> real (Suc n * length init)
[PROOF STEP]
by (simp add: T_BIT_def)
[PROOF STATE]
proof (state)
this:
T_BIT (Suc n) \<le> real (Suc n * length init)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Partition_diag:
  "Partition (Suc m) (Suc m) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Partition (Suc m) (Suc m) = 1
[PROOF STEP]
by (induct m) auto


[STATEMENT]
lemma less_floor_iff: "z < \<lfloor>x\<rfloor> \<longleftrightarrow> of_int z + 1 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z < \<lfloor>x\<rfloor>) = (of_int z + (1::'a) \<le> x)
[PROOF STEP]
using le_floor_iff [of "z + 1" x]
[PROOF STATE]
proof (prove)
using this:
(z + 1 \<le> \<lfloor>x\<rfloor>) = (of_int (z + 1) \<le> x)

goal (1 subgoal):
 1. (z < \<lfloor>x\<rfloor>) = (of_int z + (1::'a) \<le> x)
[PROOF STEP]
by auto


[STATEMENT]
lemma Cauchy_fst: "Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. fst (X n :: 'a::metric_space \<times> 'b::metric_space))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. fst (X n))
[PROOF STEP]
unfolding Cauchy_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < e \<Longrightarrow> \<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (fst (X m)) (fst (X n)) < e
[PROOF STEP]
by (fast elim: le_less_trans [OF dist_fst_le])


[STATEMENT]
lemma Suc_stack_discover:
    assumes n: "n < (length (stack s)) - 1"
    shows "\<delta> s (stack s ! n) > \<delta> s (stack s ! Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<delta> s (stack s ! Suc n) < \<delta> s (stack s ! n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<delta> s (stack s ! Suc n) < \<delta> s (stack s ! n)
[PROOF STEP]
from prev_stack_discover assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?n < length (stack s); ?v \<in> set (drop (Suc ?n) (stack s))\<rbrakk> \<Longrightarrow> \<delta> s ?v < \<delta> s (stack s ! ?n)
n < length (stack s) - 1
[PROOF STEP]
have
      "\<And> v. v \<in> set (drop (Suc n) (stack s)) \<Longrightarrow> \<delta> s (stack s ! n) > \<delta> s v"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?n < length (stack s); ?v \<in> set (drop (Suc ?n) (stack s))\<rbrakk> \<Longrightarrow> \<delta> s ?v < \<delta> s (stack s ! ?n)
n < length (stack s) - 1

goal (1 subgoal):
 1. \<And>v. v \<in> set (drop (Suc n) (stack s)) \<Longrightarrow> \<delta> s v < \<delta> s (stack s ! n)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
?v5 \<in> set (drop (Suc n) (stack s)) \<Longrightarrow> \<delta> s ?v5 < \<delta> s (stack s ! n)

goal (1 subgoal):
 1. \<delta> s (stack s ! Suc n) < \<delta> s (stack s ! n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?v5 \<in> set (drop (Suc n) (stack s)) \<Longrightarrow> \<delta> s ?v5 < \<delta> s (stack s ! n)

goal (1 subgoal):
 1. \<delta> s (stack s ! Suc n) < \<delta> s (stack s ! n)
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
n < length (stack s) - 1
[PROOF STEP]
have "stack s ! Suc n \<in> set (drop (Suc n) (stack s))"
[PROOF STATE]
proof (prove)
using this:
n < length (stack s) - 1

goal (1 subgoal):
 1. stack s ! Suc n \<in> set (drop (Suc n) (stack s))
[PROOF STEP]
using in_set_conv_nth
[PROOF STATE]
proof (prove)
using this:
n < length (stack s) - 1
(?x \<in> set ?xs) = (\<exists>i<length ?xs. ?xs ! i = ?x)

goal (1 subgoal):
 1. stack s ! Suc n \<in> set (drop (Suc n) (stack s))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
stack s ! Suc n \<in> set (drop (Suc n) (stack s))

goal (1 subgoal):
 1. \<delta> s (stack s ! Suc n) < \<delta> s (stack s ! n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?v5 \<in> set (drop (Suc n) (stack s)) \<Longrightarrow> \<delta> s ?v5 < \<delta> s (stack s ! n)
stack s ! Suc n \<in> set (drop (Suc n) (stack s))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?v5 \<in> set (drop (Suc n) (stack s)) \<Longrightarrow> \<delta> s ?v5 < \<delta> s (stack s ! n)
stack s ! Suc n \<in> set (drop (Suc n) (stack s))

goal (1 subgoal):
 1. \<delta> s (stack s ! Suc n) < \<delta> s (stack s ! n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<delta> s (stack s ! Suc n) < \<delta> s (stack s ! n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma left_move_to_right: "a \<le> - c + b \<Longrightarrow> c + a \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> - c + b \<Longrightarrow> c + a \<le> b
[PROOF STEP]
apply (drule_tac u = "c" in add_order_preserving_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c + a \<le> c + (- c + b) \<Longrightarrow> c + a \<le> b
[PROOF STEP]
by (simp add: add.assoc [THEN sym])


[STATEMENT]
theorem comp_impl_tot_rec: "computable A \<Longrightarrow> total_recursive (chf A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
assume A: "computable A"
[PROOF STATE]
proof (state)
this:
computable A

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
computable A
[PROOF STEP]
have A1: "A \<in> ce_sets"
[PROOF STATE]
proof (prove)
using this:
computable A

goal (1 subgoal):
 1. A \<in> ce_sets
[PROOF STEP]
by (unfold computable_def, simp)
[PROOF STATE]
proof (state)
this:
A \<in> ce_sets

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
computable A
[PROOF STEP]
have A2: "-A \<in> ce_sets"
[PROOF STATE]
proof (prove)
using this:
computable A

goal (1 subgoal):
 1. - A \<in> ce_sets
[PROOF STEP]
by (unfold computable_def, simp)
[PROOF STATE]
proof (state)
this:
- A \<in> ce_sets

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
define p where "p x = c_pair x 0" for x
[PROOF STATE]
proof (state)
this:
p ?x = c_pair ?x 0

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
define q where "q x = c_pair x 1" for x
[PROOF STATE]
proof (state)
this:
q ?x = c_pair ?x 1

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
from p_def
[PROOF STATE]
proof (chain)
picking this:
p ?x = c_pair ?x 0
[PROOF STEP]
have p_is_pr: "p \<in> PrimRec1"
[PROOF STATE]
proof (prove)
using this:
p ?x = c_pair ?x 0

goal (1 subgoal):
 1. p \<in> PrimRec1
[PROOF STEP]
unfolding p_def
[PROOF STATE]
proof (prove)
using this:
c_pair ?x 0 = c_pair ?x 0

goal (1 subgoal):
 1. (\<lambda>x. c_pair x 0) \<in> PrimRec1
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
p \<in> PrimRec1

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
from q_def
[PROOF STATE]
proof (chain)
picking this:
q ?x = c_pair ?x 1
[PROOF STEP]
have q_is_pr: "q \<in> PrimRec1"
[PROOF STATE]
proof (prove)
using this:
q ?x = c_pair ?x 1

goal (1 subgoal):
 1. q \<in> PrimRec1
[PROOF STEP]
unfolding q_def
[PROOF STATE]
proof (prove)
using this:
c_pair ?x 1 = c_pair ?x 1

goal (1 subgoal):
 1. (\<lambda>x. c_pair x 1) \<in> PrimRec1
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
q \<in> PrimRec1

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
define U0 where "U0 = {p x | x. x \<in> A}"
[PROOF STATE]
proof (state)
this:
U0 = {p x |x. x \<in> A}

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
define U1 where "U1 = {q x | x. x \<in> - A}"
[PROOF STATE]
proof (state)
this:
U1 = {q x |x. x \<in> - A}

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
from A1 p_is_pr
[PROOF STATE]
proof (chain)
picking this:
A \<in> ce_sets
p \<in> PrimRec1
[PROOF STEP]
have U0_ce: "U0 \<in> ce_sets"
[PROOF STATE]
proof (prove)
using this:
A \<in> ce_sets
p \<in> PrimRec1

goal (1 subgoal):
 1. U0 \<in> ce_sets
[PROOF STEP]
by(unfold U0_def, rule ce_set_lm_7)
[PROOF STATE]
proof (state)
this:
U0 \<in> ce_sets

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
from A2 q_is_pr
[PROOF STATE]
proof (chain)
picking this:
- A \<in> ce_sets
q \<in> PrimRec1
[PROOF STEP]
have U1_ce: "U1 \<in> ce_sets"
[PROOF STATE]
proof (prove)
using this:
- A \<in> ce_sets
q \<in> PrimRec1

goal (1 subgoal):
 1. U1 \<in> ce_sets
[PROOF STEP]
by(unfold U1_def, rule ce_set_lm_7)
[PROOF STATE]
proof (state)
this:
U1 \<in> ce_sets

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
define U where "U = U0 \<union> U1"
[PROOF STATE]
proof (state)
this:
U = U0 \<union> U1

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
from U0_ce U1_ce
[PROOF STATE]
proof (chain)
picking this:
U0 \<in> ce_sets
U1 \<in> ce_sets
[PROOF STEP]
have U_ce: "U \<in> ce_sets"
[PROOF STATE]
proof (prove)
using this:
U0 \<in> ce_sets
U1 \<in> ce_sets

goal (1 subgoal):
 1. U \<in> ce_sets
[PROOF STEP]
by (unfold U_def, rule ce_union)
[PROOF STATE]
proof (state)
this:
U \<in> ce_sets

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
define V where "V = c_graph (chf A)"
[PROOF STATE]
proof (state)
this:
V = c_graph (chf A)

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
have V_1: "V = { c_pair x (chf A x) | x. x \<in> UNIV}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V = {c_pair x (chf A x) |x. x \<in> UNIV}
[PROOF STEP]
by (simp add: V_def c_graph_def)
[PROOF STATE]
proof (state)
this:
V = {c_pair x (chf A x) |x. x \<in> UNIV}

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
from U0_def p_def
[PROOF STATE]
proof (chain)
picking this:
U0 = {p x |x. x \<in> A}
p ?x = c_pair ?x 0
[PROOF STEP]
have U0_1: "U0 = { c_pair x y | x y. x \<in> A \<and> y=0}"
[PROOF STATE]
proof (prove)
using this:
U0 = {p x |x. x \<in> A}
p ?x = c_pair ?x 0

goal (1 subgoal):
 1. U0 = {c_pair x y |x y. x \<in> A \<and> y = 0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U0 = {c_pair x y |x y. x \<in> A \<and> y = 0}

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
from U1_def q_def
[PROOF STATE]
proof (chain)
picking this:
U1 = {q x |x. x \<in> - A}
q ?x = c_pair ?x 1
[PROOF STEP]
have U1_1: "U1 = { c_pair x y | x y. x \<notin> A \<and> y=1}"
[PROOF STATE]
proof (prove)
using this:
U1 = {q x |x. x \<in> - A}
q ?x = c_pair ?x 1

goal (1 subgoal):
 1. U1 = {c_pair x y |x y. x \<notin> A \<and> y = 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U1 = {c_pair x y |x y. x \<notin> A \<and> y = 1}

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
from U0_1 U1_1 U_def
[PROOF STATE]
proof (chain)
picking this:
U0 = {c_pair x y |x y. x \<in> A \<and> y = 0}
U1 = {c_pair x y |x y. x \<notin> A \<and> y = 1}
U = U0 \<union> U1
[PROOF STEP]
have U_1: "U = { c_pair x y | x y. (x \<in> A \<and> y=0) \<or> (x \<notin> A \<and> y=1)}"
[PROOF STATE]
proof (prove)
using this:
U0 = {c_pair x y |x y. x \<in> A \<and> y = 0}
U1 = {c_pair x y |x y. x \<notin> A \<and> y = 1}
U = U0 \<union> U1

goal (1 subgoal):
 1. U = {c_pair x y |x y. x \<in> A \<and> y = 0 \<or> x \<notin> A \<and> y = 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U = {c_pair x y |x y. x \<in> A \<and> y = 0 \<or> x \<notin> A \<and> y = 1}

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
from V_1
[PROOF STATE]
proof (chain)
picking this:
V = {c_pair x (chf A x) |x. x \<in> UNIV}
[PROOF STEP]
have V_2: "V = { c_pair x y | x y. y = chf A x}"
[PROOF STATE]
proof (prove)
using this:
V = {c_pair x (chf A x) |x. x \<in> UNIV}

goal (1 subgoal):
 1. V = {c_pair x y |x y. y = chf A x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V = {c_pair x y |x y. y = chf A x}

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
have L1: "\<And> x y. ((x \<in> A \<and> y=0) \<or> (x \<notin> A \<and> y=1)) = (y = chf A x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. (x \<in> A \<and> y = 0 \<or> x \<notin> A \<and> y = 1) = (y = chf A x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. (x \<in> A \<and> y = 0 \<or> x \<notin> A \<and> y = 1) = (y = chf A x)
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. (x \<in> A \<and> y = 0 \<or> x \<notin> A \<and> y = 1) = (y = chf A x)
[PROOF STEP]
show "((x \<in> A \<and> y=0) \<or> (x \<notin> A \<and> y=1)) = (y = chf A x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> A \<and> y = 0 \<or> x \<notin> A \<and> y = 1) = (y = chf A x)
[PROOF STEP]
by(unfold chf_def, auto)
[PROOF STATE]
proof (state)
this:
(x \<in> A \<and> y = 0 \<or> x \<notin> A \<and> y = 1) = (y = chf A x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(?x \<in> A \<and> ?y = 0 \<or> ?x \<notin> A \<and> ?y = 1) = (?y = chf A ?x)

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
from V_2 U_1 L1
[PROOF STATE]
proof (chain)
picking this:
V = {c_pair x y |x y. y = chf A x}
U = {c_pair x y |x y. x \<in> A \<and> y = 0 \<or> x \<notin> A \<and> y = 1}
(?x \<in> A \<and> ?y = 0 \<or> ?x \<notin> A \<and> ?y = 1) = (?y = chf A ?x)
[PROOF STEP]
have "U=V"
[PROOF STATE]
proof (prove)
using this:
V = {c_pair x y |x y. y = chf A x}
U = {c_pair x y |x y. x \<in> A \<and> y = 0 \<or> x \<notin> A \<and> y = 1}
(?x \<in> A \<and> ?y = 0 \<or> ?x \<notin> A \<and> ?y = 1) = (?y = chf A ?x)

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

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
with U_ce
[PROOF STATE]
proof (chain)
picking this:
U \<in> ce_sets
U = V
[PROOF STEP]
have V_ce: "V \<in> ce_sets"
[PROOF STATE]
proof (prove)
using this:
U \<in> ce_sets
U = V

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

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
with V_def
[PROOF STATE]
proof (chain)
picking this:
V = c_graph (chf A)
V \<in> ce_sets
[PROOF STEP]
have "c_graph (chf A) \<in> ce_sets"
[PROOF STATE]
proof (prove)
using this:
V = c_graph (chf A)
V \<in> ce_sets

goal (1 subgoal):
 1. c_graph (chf A) \<in> ce_sets
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c_graph (chf A) \<in> ce_sets

goal (1 subgoal):
 1. computable A \<Longrightarrow> total_recursive (chf A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c_graph (chf A) \<in> ce_sets
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c_graph (chf A) \<in> ce_sets

goal (1 subgoal):
 1. total_recursive (chf A)
[PROOF STEP]
by (unfold total_recursive_def1)
[PROOF STATE]
proof (state)
this:
total_recursive (chf A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map2_snoc_snoc: "
  length xs = length ys \<Longrightarrow>
  map2 f (xs @ [x]) (ys @ [y]) =
  map2 f xs ys @
  [f x y]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys \<Longrightarrow> List2.map2 f (xs @ [x]) (ys @ [y]) = List2.map2 f xs ys @ [f x y]
[PROOF STEP]
by (simp add: map2_append_append)


[STATEMENT]
lemma simple_rotation_bij_corollary: "r \<in> simple_rotations \<Longrightarrow> r x \<noteq> r y \<longleftrightarrow> x \<noteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<in> simple_rotations \<Longrightarrow> (r x \<noteq> r y) = (x \<noteq> y)
[PROOF STEP]
using bij_def simple_rotations_bij inj_eq
[PROOF STATE]
proof (prove)
using this:
bij ?f = (inj ?f \<and> surj ?f)
?r \<in> simple_rotations \<Longrightarrow> bij ?r
inj ?f \<Longrightarrow> (?f ?x = ?f ?y) = (?x = ?y)

goal (1 subgoal):
 1. r \<in> simple_rotations \<Longrightarrow> (r x \<noteq> r y) = (x \<noteq> y)
[PROOF STEP]
by metis


[STATEMENT]
lemma funof_eq: "[|single_valued r; (x,y) \<in> r|] ==> funof r x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>single_valued r; (x, y) \<in> r\<rbrakk> \<Longrightarrow> funof r x = y
[PROOF STEP]
by (simp add: funof_def single_valued_def, blast)


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


[STATEMENT]
lemma msg_nonempty1:
  assumes h1:"msg (Suc 0) a"
         and h2:"a t = aa # l"
  shows "l = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l = []
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l = []
[PROOF STEP]
from h1
[PROOF STATE]
proof (chain)
picking this:
msg (Suc 0) a
[PROOF STEP]
have "length (a t) \<le> Suc 0"
[PROOF STATE]
proof (prove)
using this:
msg (Suc 0) a

goal (1 subgoal):
 1. length (a t) \<le> Suc 0
[PROOF STEP]
by (simp add: msg_def)
[PROOF STATE]
proof (state)
this:
length (a t) \<le> Suc 0

goal (1 subgoal):
 1. l = []
[PROOF STEP]
from h2 and this
[PROOF STATE]
proof (chain)
picking this:
a t = aa # l
length (a t) \<le> Suc 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a t = aa # l
length (a t) \<le> Suc 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma remove_comp_val_process:
  assumes "portfolio pf1"
shows "\<forall>n w. val_process Mkt (qty_rem_comp pf1 y) n w = ((val_process Mkt pf1) n w) - (prices Mkt y n w)* (pf1 y (Suc n) w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
proof (intro allI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
fix n w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
have pf:"portfolio (qty_rem_comp pf1 y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. portfolio (qty_rem_comp pf1 y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
portfolio pf1

goal (1 subgoal):
 1. portfolio (qty_rem_comp pf1 y)
[PROOF STEP]
by (simp add:remove_comp_portfolio)
[PROOF STATE]
proof (state)
this:
portfolio (qty_rem_comp pf1 y)

goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
have fin:"finite (support_set pf1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (support_set pf1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
portfolio pf1

goal (1 subgoal):
 1. finite (support_set pf1)
[PROOF STEP]
unfolding portfolio_def
[PROOF STATE]
proof (prove)
using this:
finite (support_set pf1)

goal (1 subgoal):
 1. finite (support_set pf1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (support_set pf1)

goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
hence fin2: "finite (support_set pf1 - {y})"
[PROOF STATE]
proof (prove)
using this:
finite (support_set pf1)

goal (1 subgoal):
 1. finite (support_set pf1 - {y})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (support_set pf1 - {y})

goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
have "((val_process Mkt pf1) n w)  =
    (\<Sum> x\<in> (support_set pf1). ((prices Mkt) x n w) * (pf1 x (Suc n) w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val_process Mkt pf1 n w = (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w)
[PROOF STEP]
unfolding val_process_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if \<not> portfolio pf1 then \<lambda>n w. 0 else (\<lambda>n w. \<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w)) n w = (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
portfolio pf1

goal (1 subgoal):
 1. (if \<not> portfolio pf1 then \<lambda>n w. 0 else (\<lambda>n w. \<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w)) n w = (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
val_process Mkt pf1 n w = (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w)

goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
val_process Mkt pf1 n w = (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w)

goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
have "... = (\<Sum> x\<in> (support_set pf1 - {y}).
    (((prices Mkt) x n w) * (pf1 x (Suc n) w))) + (prices Mkt y n w)* (pf1 y (Suc n) w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
proof (cases "y\<in> support_set pf1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y \<in> support_set pf1 \<Longrightarrow> (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
 2. y \<notin> support_set pf1 \<Longrightarrow> (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y \<in> support_set pf1

goal (2 subgoals):
 1. y \<in> support_set pf1 \<Longrightarrow> (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
 2. y \<notin> support_set pf1 \<Longrightarrow> (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
y \<in> support_set pf1

goal (1 subgoal):
 1. (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
by (simp add: fin sum_diff1)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w

goal (1 subgoal):
 1. y \<notin> support_set pf1 \<Longrightarrow> (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<notin> support_set pf1 \<Longrightarrow> (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
y \<notin> support_set pf1

goal (1 subgoal):
 1. y \<notin> support_set pf1 \<Longrightarrow> (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
hence "pf1 y (Suc n) w = 0"
[PROOF STATE]
proof (prove)
using this:
y \<notin> support_set pf1

goal (1 subgoal):
 1. pf1 y (Suc n) w = 0
[PROOF STEP]
unfolding support_set_def
[PROOF STATE]
proof (prove)
using this:
y \<notin> {x. \<exists>n w. pf1 x n w \<noteq> 0}

goal (1 subgoal):
 1. pf1 y (Suc n) w = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pf1 y (Suc n) w = 0

goal (1 subgoal):
 1. y \<notin> support_set pf1 \<Longrightarrow> (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
pf1 y (Suc n) w = 0

goal (1 subgoal):
 1. (\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
by (simp add: fin sum_diff1)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w

goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>support_set pf1. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w

goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
have "... = (\<Sum> x\<in> (support_set pf1 - {y}).
    ((prices Mkt) x n w) * ((qty_rem_comp pf1 y) x (Suc n) w)) + (prices Mkt y n w)* (pf1 y (Suc n) w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
have "(\<Sum> x\<in> (support_set pf1 - {y}). (((prices Mkt) x n w) * (pf1 x (Suc n) w))) =
      (\<Sum> x\<in> (support_set pf1 - {y}). ((prices Mkt) x n w) * ((qty_rem_comp pf1 y) x (Suc n) w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w)
[PROOF STEP]
proof (rule sum.cong,simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> support_set pf1 - {y} \<Longrightarrow> prices Mkt x n w * pf1 x (Suc n) w = prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> support_set pf1 - {y} \<Longrightarrow> prices Mkt x n w * pf1 x (Suc n) w = prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w
[PROOF STEP]
assume "x\<in> support_set pf1 - {y}"
[PROOF STATE]
proof (state)
this:
x \<in> support_set pf1 - {y}

goal (1 subgoal):
 1. \<And>x. x \<in> support_set pf1 - {y} \<Longrightarrow> prices Mkt x n w * pf1 x (Suc n) w = prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w
[PROOF STEP]
show "prices Mkt x n w * pf1 x (Suc n) w = prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prices Mkt x n w * pf1 x (Suc n) w = prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w
[PROOF STEP]
using remove_comp_values
[PROOF STATE]
proof (prove)
using this:
?x \<noteq> ?y \<Longrightarrow> \<forall>n w. ?pf1.0 ?x n w = qty_rem_comp ?pf1.0 ?y ?x n w

goal (1 subgoal):
 1. prices Mkt x n w * pf1 x (Suc n) w = prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w
[PROOF STEP]
by (metis DiffD2 \<open>x \<in> support_set pf1 - {y}\<close> singletonI)
[PROOF STATE]
proof (state)
this:
prices Mkt x n w * pf1 x (Suc n) w = prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w)

goal (1 subgoal):
 1. (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w)

goal (1 subgoal):
 1. (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w

goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * pf1 x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w = (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w

goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
have "... = (val_process Mkt (qty_rem_comp pf1 y) n w) + (prices Mkt y n w)* (pf1 y (Suc n) w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w = val_process Mkt (qty_rem_comp pf1 y) n w + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
using subset_val_process'[of "support_set pf1 - {y}" "qty_rem_comp pf1 y"] fin2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (support_set pf1 - {y}); support_set (qty_rem_comp pf1 y) \<subseteq> support_set pf1 - {y}\<rbrakk> \<Longrightarrow> val_process ?Mkt (qty_rem_comp pf1 y) ?n ?w = (\<Sum>x\<in>support_set pf1 - {y}. prices ?Mkt x ?n ?w * qty_rem_comp pf1 y x (Suc ?n) ?w)
finite (support_set pf1 - {y})

goal (1 subgoal):
 1. (\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w = val_process Mkt (qty_rem_comp pf1 y) n w + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
by (simp add: remove_comp_support_set)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>support_set pf1 - {y}. prices Mkt x n w * qty_rem_comp pf1 y x (Suc n) w) + prices Mkt y n w * pf1 y (Suc n) w = val_process Mkt (qty_rem_comp pf1 y) n w + prices Mkt y n w * pf1 y (Suc n) w

goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
val_process Mkt pf1 n w = val_process Mkt (qty_rem_comp pf1 y) n w + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
have "(val_process Mkt pf1) n w =
    (val_process Mkt (qty_rem_comp pf1 y) n w) + (prices Mkt y n w)* (pf1 y (Suc n) w)"
[PROOF STATE]
proof (prove)
using this:
val_process Mkt pf1 n w = val_process Mkt (qty_rem_comp pf1 y) n w + prices Mkt y n w * pf1 y (Suc n) w

goal (1 subgoal):
 1. val_process Mkt pf1 n w = val_process Mkt (qty_rem_comp pf1 y) n w + prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
val_process Mkt pf1 n w = val_process Mkt (qty_rem_comp pf1 y) n w + prices Mkt y n w * pf1 y (Suc n) w

goal (1 subgoal):
 1. \<And>n w. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
thus  "val_process Mkt (qty_rem_comp pf1 y) n w = ((val_process Mkt pf1) n w) - (prices Mkt y n w)* (pf1 y (Suc n) w)"
[PROOF STATE]
proof (prove)
using this:
val_process Mkt pf1 n w = val_process Mkt (qty_rem_comp pf1 y) n w + prices Mkt y n w * pf1 y (Suc n) w

goal (1 subgoal):
 1. val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
val_process Mkt (qty_rem_comp pf1 y) n w = val_process Mkt pf1 n w - prices Mkt y n w * pf1 y (Suc n) w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma disjointify_is_disjoint:
  assumes "finite As"
  assumes "A \<in> disjointify As"
  assumes "B \<in> disjointify As"
  assumes "A \<noteq>  B"
  shows "A \<inter> B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
using assms rec_disjointify_is_disjoint[of A _ _ B]
[PROOF STATE]
proof (prove)
using this:
finite As
A \<in> disjointify As
B \<in> disjointify As
A \<noteq> B
\<lbrakk>A \<in> rec_disjointify ?m ?f; B \<in> rec_disjointify ?m ?f; A \<noteq> B\<rbrakk> \<Longrightarrow> A \<inter> B = {}

goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
unfolding disjointify_def
[PROOF STATE]
proof (prove)
using this:
finite As
A \<in> rec_disjointify (card As) (Generated_Boolean_Algebra.enumerate As)
B \<in> rec_disjointify (card As) (Generated_Boolean_Algebra.enumerate As)
A \<noteq> B
\<lbrakk>A \<in> rec_disjointify ?m ?f; B \<in> rec_disjointify ?m ?f; A \<noteq> B\<rbrakk> \<Longrightarrow> A \<inter> B = {}

goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
by simp


[STATEMENT]
lemma mult_zero_left [simp]:
  assumes "z \<noteq> \<infinity>\<^sub>h"
  shows "0\<^sub>h *\<^sub>h z = 0\<^sub>h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>h *\<^sub>h z = 0\<^sub>h
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z \<noteq> \<infinity>\<^sub>h

goal (1 subgoal):
 1. 0\<^sub>h *\<^sub>h z = 0\<^sub>h
[PROOF STEP]
proof (transfer, transfer)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>z za. \<lbrakk>z \<noteq> vec_zero; \<not> z \<approx>\<^sub>v \<infinity>\<^sub>v; \<not> za \<approx> \<infinity>\<^sub>h\<^sub>c\<rbrakk> \<Longrightarrow> 0\<^sub>v *\<^sub>v z \<approx>\<^sub>v 0\<^sub>v
[PROOF STEP]
fix z :: complex_vec
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>z za. \<lbrakk>z \<noteq> vec_zero; \<not> z \<approx>\<^sub>v \<infinity>\<^sub>v; \<not> za \<approx> \<infinity>\<^sub>h\<^sub>c\<rbrakk> \<Longrightarrow> 0\<^sub>v *\<^sub>v z \<approx>\<^sub>v 0\<^sub>v
[PROOF STEP]
obtain z1 z2 where *: "z = (z1, z2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z1 z2. z = (z1, z2) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases z, auto)
[PROOF STATE]
proof (state)
this:
z = (z1, z2)

goal (1 subgoal):
 1. \<And>z za. \<lbrakk>z \<noteq> vec_zero; \<not> z \<approx>\<^sub>v \<infinity>\<^sub>v; \<not> za \<approx> \<infinity>\<^sub>h\<^sub>c\<rbrakk> \<Longrightarrow> 0\<^sub>v *\<^sub>v z \<approx>\<^sub>v 0\<^sub>v
[PROOF STEP]
assume "z \<noteq> vec_zero" "\<not> (z \<approx>\<^sub>v \<infinity>\<^sub>v)"
[PROOF STATE]
proof (state)
this:
z \<noteq> vec_zero
\<not> z \<approx>\<^sub>v \<infinity>\<^sub>v

goal (1 subgoal):
 1. \<And>z za. \<lbrakk>z \<noteq> vec_zero; \<not> z \<approx>\<^sub>v \<infinity>\<^sub>v; \<not> za \<approx> \<infinity>\<^sub>h\<^sub>c\<rbrakk> \<Longrightarrow> 0\<^sub>v *\<^sub>v z \<approx>\<^sub>v 0\<^sub>v
[PROOF STEP]
hence "z2 \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
z \<noteq> vec_zero
\<not> z \<approx>\<^sub>v \<infinity>\<^sub>v

goal (1 subgoal):
 1. z2 \<noteq> 0
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
z \<noteq> vec_zero
\<not> z \<approx>\<^sub>v \<infinity>\<^sub>v
z = (z1, z2)

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

goal (1 subgoal):
 1. \<And>z za. \<lbrakk>z \<noteq> vec_zero; \<not> z \<approx>\<^sub>v \<infinity>\<^sub>v; \<not> za \<approx> \<infinity>\<^sub>h\<^sub>c\<rbrakk> \<Longrightarrow> 0\<^sub>v *\<^sub>v z \<approx>\<^sub>v 0\<^sub>v
[PROOF STEP]
thus "0\<^sub>v *\<^sub>v z \<approx>\<^sub>v 0\<^sub>v"
[PROOF STATE]
proof (prove)
using this:
z2 \<noteq> 0

goal (1 subgoal):
 1. 0\<^sub>v *\<^sub>v z \<approx>\<^sub>v 0\<^sub>v
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
z2 \<noteq> 0
z = (z1, z2)

goal (1 subgoal):
 1. 0\<^sub>v *\<^sub>v z \<approx>\<^sub>v 0\<^sub>v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0\<^sub>v *\<^sub>v z \<approx>\<^sub>v 0\<^sub>v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_bintree_children_length_desc:
  assumes "is_bintree_list l ts"
  shows "map (length \<circ> children) ts = rev [0..<l]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (length \<circ> children) ts = rev [0..<l]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_bintree_list l ts

goal (1 subgoal):
 1. map (length \<circ> children) ts = rev [0..<l]
[PROOF STEP]
by (induct ts) simp_all


[STATEMENT]
lemma is_mgu_insert_decomp [simp]:
  assumes "length ss = length ts"
  shows "is_mgu \<sigma> (insert (Fun f ss, Fun f ts) E) \<longleftrightarrow>
    is_mgu \<sigma> (E \<union> set (zip ss ts))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_mgu \<sigma> (insert (Fun f ss, Fun f ts) E) = is_mgu \<sigma> (E \<union> set (zip ss ts))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length ss = length ts

goal (1 subgoal):
 1. is_mgu \<sigma> (insert (Fun f ss, Fun f ts) E) = is_mgu \<sigma> (E \<union> set (zip ss ts))
[PROOF STEP]
by (auto simp: is_mgu_def unifiers_insert)


[STATEMENT]
lemma trancl_list_all_step_induct [consumes 2, case_names base step]:
  assumes "length ss = length ts" "\<forall> i < length ts. (ss ! i, ts ! i) \<in> \<R>\<^sup>+"
    and base: "\<And>xs ys. length xs = length ys \<Longrightarrow> \<forall> i < length ys. (xs ! i, ys ! i) \<in> \<R> \<Longrightarrow> P xs ys"
    and steps: "\<And>xs ys zs. length xs = length ys \<Longrightarrow> length ys = length zs \<Longrightarrow>
       \<forall> i < length zs. (xs ! i, ys ! i) \<in> \<R>\<^sup>+ \<Longrightarrow> \<forall> i < length zs. (ys ! i, zs ! i) \<in> \<R> \<or> ys ! i = zs ! i \<Longrightarrow>
       P xs ys \<Longrightarrow> P xs zs"
  shows "P ss ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P ss ts
[PROOF STEP]
using assms(1, 2)
[PROOF STATE]
proof (prove)
using this:
length ss = length ts
\<forall>i<length ts. (ss ! i, ts ! i) \<in> \<R>\<^sup>+

goal (1 subgoal):
 1. P ss ts
[PROOF STEP]
proof (induct rule: trancl_list_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs ys. \<lbrakk>length xs = length ys; \<forall>i<length ys. (xs ! i, ys ! i) \<in> \<R>\<rbrakk> \<Longrightarrow> P xs ys
 2. \<And>xs ys i z. \<lbrakk>length xs = length ys; \<forall>i<length ys. (xs ! i, ys ! i) \<in> \<R>\<^sup>+; P xs ys; i < length ys; (ys ! i, z) \<in> \<R>\<rbrakk> \<Longrightarrow> P xs (ys[i := z])
[PROOF STEP]
case (step xs ys i z)
[PROOF STATE]
proof (state)
this:
length xs = length ys
\<forall>i<length ys. (xs ! i, ys ! i) \<in> \<R>\<^sup>+
P xs ys
i < length ys
(ys ! i, z) \<in> \<R>

goal (2 subgoals):
 1. \<And>xs ys. \<lbrakk>length xs = length ys; \<forall>i<length ys. (xs ! i, ys ! i) \<in> \<R>\<rbrakk> \<Longrightarrow> P xs ys
 2. \<And>xs ys i z. \<lbrakk>length xs = length ys; \<forall>i<length ys. (xs ! i, ys ! i) \<in> \<R>\<^sup>+; P xs ys; i < length ys; (ys ! i, z) \<in> \<R>\<rbrakk> \<Longrightarrow> P xs (ys[i := z])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length xs = length ys
\<forall>i<length ys. (xs ! i, ys ! i) \<in> \<R>\<^sup>+
P xs ys
i < length ys
(ys ! i, z) \<in> \<R>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
\<forall>i<length ys. (xs ! i, ys ! i) \<in> \<R>\<^sup>+
P xs ys
i < length ys
(ys ! i, z) \<in> \<R>

goal (1 subgoal):
 1. P xs (ys[i := z])
[PROOF STEP]
by (intro steps[of xs ys "ys[i := z]"])
       (auto simp: nth_list_update)
[PROOF STATE]
proof (state)
this:
P xs (ys[i := z])

goal (1 subgoal):
 1. \<And>xs ys. \<lbrakk>length xs = length ys; \<forall>i<length ys. (xs ! i, ys ! i) \<in> \<R>\<rbrakk> \<Longrightarrow> P xs ys
[PROOF STEP]
qed (auto simp: base)


[STATEMENT]
lemma zero_setE:
  assumes  "a \<in> zero_set R n p"
  shows  "a \<in> carrier (R\<^bsup>n\<^esup>)"
         "eval_at_point R a p =\<zero>\<^bsub>R\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> carrier (R\<^bsup>n\<^esup>) &&& eval_at_point R a p = \<zero>
[PROOF STEP]
using assms zero_set_def
[PROOF STATE]
proof (prove)
using this:
a \<in> V n p
V\<^bsub>?R\<^esub> ?n ?p = {a \<in> carrier (?R\<^bsup>?n\<^esup>). eval_at_point ?R a ?p = \<zero>\<^bsub>?R\<^esub>}

goal (1 subgoal):
 1. a \<in> carrier (R\<^bsup>n\<^esup>) &&& eval_at_point R a p = \<zero>
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_at_point R a p = \<zero>
[PROOF STEP]
by (metis (mono_tags, lifting) assms mem_Collect_eq zero_set_def)


[STATEMENT]
lemma real_le_lemma:
  assumes l: "u1 + v2 \<le> u2 + v1"
    and "x1 + v1 = u1 + y1"
    and "x2 + v2 = u2 + y2"
  shows "x1 + y2 \<le> x2 + (y1::preal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x1 + y2 \<le> x2 + y1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x1 + y2 \<le> x2 + y1
[PROOF STEP]
have "(x1+v1) + (u2+y2) = (u1+y1) + (x2+v2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x1 + v1 + (u2 + y2) = u1 + y1 + (x2 + v2)
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
x1 + v1 + (u2 + y2) = u1 + y1 + (x2 + v2)

goal (1 subgoal):
 1. x1 + y2 \<le> x2 + y1
[PROOF STEP]
hence "(x1+y2) + (u2+v1) = (x2+y1) + (u1+v2)"
[PROOF STATE]
proof (prove)
using this:
x1 + v1 + (u2 + y2) = u1 + y1 + (x2 + v2)

goal (1 subgoal):
 1. x1 + y2 + (u2 + v1) = x2 + y1 + (u1 + v2)
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
x1 + y2 + (u2 + v1) = x2 + y1 + (u1 + v2)

goal (1 subgoal):
 1. x1 + y2 \<le> x2 + y1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x1 + y2 + (u2 + v1) = x2 + y1 + (u1 + v2)

goal (1 subgoal):
 1. x1 + y2 \<le> x2 + y1
[PROOF STEP]
have "\<dots> \<le> (x2+y1) + (u2+v1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x2 + y1 + (u1 + v2) \<le> x2 + y1 + (u2 + v1)
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
x2 + y1 + (u1 + v2) \<le> x2 + y1 + (u2 + v1)

goal (1 subgoal):
 1. x1 + y2 \<le> x2 + y1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x1 + y2 + (u2 + v1) \<le> x2 + y1 + (u2 + v1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x1 + y2 + (u2 + v1) \<le> x2 + y1 + (u2 + v1)

goal (1 subgoal):
 1. x1 + y2 \<le> x2 + y1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x1 + y2 \<le> x2 + y1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prj1_in_hom':
    assumes "cospan f g"
    shows "\<guillemotleft>\<p>\<^sub>1[f, g] : dom \<p>\<^sub>0[f, g] \<rightarrow> dom f\<guillemotright>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<guillemotleft>\<p>\<^sub>1[f, g] : local.dom \<p>\<^sub>0[f, g] \<rightarrow> local.dom f\<guillemotright>
[PROOF STEP]
using assms pullback_commutes
[PROOF STATE]
proof (prove)
using this:
cospan f g
cospan ?f ?g \<Longrightarrow> commutative_square ?f ?g \<p>\<^sub>1[?f, ?g] \<p>\<^sub>0[?f, ?g]

goal (1 subgoal):
 1. \<guillemotleft>\<p>\<^sub>1[f, g] : local.dom \<p>\<^sub>0[f, g] \<rightarrow> local.dom f\<guillemotright>
[PROOF STEP]
by (metis category.commutative_squareE category_axioms in_homI)


[STATEMENT]
lemma rGamma_Weierstrass_complex: "rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma (z :: complex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
proof (cases "z \<in> \<int>\<^sub>\<le>\<^sub>0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
 2. z \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
z \<in> \<int>\<^sub>\<le>\<^sub>0

goal (2 subgoals):
 1. z \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
 2. z \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
obtain n where "z = - of_nat n"
[PROOF STATE]
proof (prove)
using this:
z \<in> \<int>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. (\<And>n. z = - of_nat n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim nonpos_Ints_cases')
[PROOF STATE]
proof (state)
this:
z = - of_nat n

goal (2 subgoals):
 1. z \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
 2. z \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
z = - of_nat n

goal (2 subgoals):
 1. z \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
 2. z \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
z \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
have "rGamma_series_Weierstrass \<dots> \<longlonglongrightarrow> rGamma z"
[PROOF STATE]
proof (prove)
using this:
z \<in> \<int>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. rGamma_series_Weierstrass (- of_nat n) \<longlonglongrightarrow> rGamma z
[PROOF STEP]
by (simp add: tendsto_cong[OF rGamma_series_Weierstrass_nonpos_Ints] rGamma_nonpos_Int)
[PROOF STATE]
proof (state)
this:
rGamma_series_Weierstrass (- of_nat n) \<longlonglongrightarrow> rGamma z

goal (2 subgoals):
 1. z \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
 2. z \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z

goal (1 subgoal):
 1. rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z

goal (1 subgoal):
 1. z \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
z \<notin> \<int>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. z \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
have "rGamma_series_Weierstrass z = (\<lambda>n. inverse (Gamma_series_Weierstrass z n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma_series_Weierstrass z = (\<lambda>n. inverse (Gamma_series_Weierstrass z n))
[PROOF STEP]
by (simp add: rGamma_series_Weierstrass_def[abs_def] Gamma_series_Weierstrass_def
                  exp_minus divide_inverse prod_inversef[symmetric] mult_ac)
[PROOF STATE]
proof (state)
this:
rGamma_series_Weierstrass z = (\<lambda>n. inverse (Gamma_series_Weierstrass z n))

goal (1 subgoal):
 1. z \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rGamma_series_Weierstrass z = (\<lambda>n. inverse (Gamma_series_Weierstrass z n))

goal (1 subgoal):
 1. z \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
z \<notin> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
have "\<dots> \<longlonglongrightarrow> inverse (Gamma z)"
[PROOF STATE]
proof (prove)
using this:
z \<notin> \<int>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. (\<lambda>n. inverse (Gamma_series_Weierstrass z n)) \<longlonglongrightarrow> inverse (Gamma z)
[PROOF STEP]
by (intro tendsto_intros Gamma_Weierstrass_complex) (simp add: Gamma_eq_zero_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. inverse (Gamma_series_Weierstrass z n)) \<longlonglongrightarrow> inverse (Gamma z)

goal (1 subgoal):
 1. z \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rGamma_series_Weierstrass z \<longlonglongrightarrow> inverse (Gamma z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rGamma_series_Weierstrass z \<longlonglongrightarrow> inverse (Gamma z)

goal (1 subgoal):
 1. rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z
[PROOF STEP]
by (simp add: Gamma_def)
[PROOF STATE]
proof (state)
this:
rGamma_series_Weierstrass z \<longlonglongrightarrow> rGamma z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) IDirProd_one_left:
  assumes "A \<subseteq> carrier G"
  shows "IDirProd G {\<one>} A = generate G A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IDirProd G {\<one>} A = generate G A
[PROOF STEP]
using IDirProd_one_right[of A] assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier G \<Longrightarrow> IDirProd G A {\<one>} = generate G A
A \<subseteq> carrier G

goal (1 subgoal):
 1. IDirProd G {\<one>} A = generate G A
[PROOF STEP]
unfolding IDirProd_def
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier G \<Longrightarrow> generate G (A \<union> {\<one>}) = generate G A
A \<subseteq> carrier G

goal (1 subgoal):
 1. generate G ({\<one>} \<union> A) = generate G A
[PROOF STEP]
by force


[STATEMENT]
lemma fls_residue_nonzero_ex_anitderivative_iff:
  fixes f :: "'a::{division_ring,ring_char_0} fls"
  shows "fls_residue f = 0 \<longleftrightarrow> (\<exists>F. fls_deriv F = f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fls_residue f = (0::'a)) = (\<exists>F. fls_deriv F = f)
[PROOF STEP]
using fls_residue_nonzero_ex_antiderivative fls_ex_antiderivative_residue_nonzero
[PROOF STATE]
proof (prove)
using this:
fls_residue ?f = (0::?'a) \<Longrightarrow> \<exists>F. fls_deriv F = ?f
\<exists>F. fls_deriv F = ?f \<Longrightarrow> fls_residue ?f = (0::?'a)

goal (1 subgoal):
 1. (fls_residue f = (0::'a)) = (\<exists>F. fls_deriv F = f)
[PROOF STEP]
by    fast


[STATEMENT]
lemma enum_works:
  fixes N :: "nat set"
  assumes "infinite N"
  shows "N = range (enum N) \<and> strict_mono (enum N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N = range (enum N) \<and> strict_mono (enum N)
[PROOF STEP]
by (metis assms bij_betw_imp_surj_on bij_enumerate enumerate_mono strict_monoI)


[STATEMENT]
lemma iter: "\<forall>a. (iter g (g a) n) = (g (iter g a n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a. iter g (g a) n = g (iter g a n)
[PROOF STEP]
apply(induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>a. iter g (g a) 0 = g (iter g a 0)
 2. \<And>n. \<forall>a. iter g (g a) n = g (iter g a n) \<Longrightarrow> \<forall>a. iter g (g a) (Suc n) = g (iter g a (Suc n))
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<forall>a. iter g (g a) n = g (iter g a n) \<Longrightarrow> \<forall>a. iter g (g a) (Suc n) = g (iter g a (Suc n))
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "rec_nat zero suc (Suc x) = suc x (rec_nat zero suc x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_nat zero suc (Suc x) = suc x (rec_nat zero suc x)
[PROOF STEP]
refute [maxsize = 2, expect = none]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_nat zero suc (Suc x) = suc x (rec_nat zero suc x)
[PROOF STEP]
by simp


[STATEMENT]
lemma north_far_north_distinct: "north \<noteq> far_north"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. north \<noteq> far_north
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. north = far_north \<Longrightarrow> False
[PROOF STEP]
assume "north = far_north"
[PROOF STATE]
proof (state)
this:
north = far_north

goal (1 subgoal):
 1. north = far_north \<Longrightarrow> False
[PROOF STEP]
with compass_non_zero
    and proj2_abs_abs_mult [of "vector [0,1,1]" "vector [0,1,0]"]
[PROOF STATE]
proof (chain)
picking this:
vector [1, 0, 1] \<noteq> 0
vector [- 1, 0, 1] \<noteq> 0
vector [0, 1, 1] \<noteq> 0
vector [0, - 1, 1] \<noteq> 0
vector [0, 1, 0] \<noteq> 0
vector [1, 0, 0] \<noteq> 0
\<lbrakk>proj2_abs (vector [0, 1, 1]) = proj2_abs (vector [0, 1, 0]); vector [0, 1, 0] \<noteq> 0\<rbrakk> \<Longrightarrow> \<exists>c. vector [0, 1, 1] = c *\<^sub>R vector [0, 1, 0]
north = far_north
[PROOF STEP]
obtain k where "(vector [0,1,1] :: real^3) = k *\<^sub>R vector [0,1,0]"
[PROOF STATE]
proof (prove)
using this:
vector [1, 0, 1] \<noteq> 0
vector [- 1, 0, 1] \<noteq> 0
vector [0, 1, 1] \<noteq> 0
vector [0, - 1, 1] \<noteq> 0
vector [0, 1, 0] \<noteq> 0
vector [1, 0, 0] \<noteq> 0
\<lbrakk>proj2_abs (vector [0, 1, 1]) = proj2_abs (vector [0, 1, 0]); vector [0, 1, 0] \<noteq> 0\<rbrakk> \<Longrightarrow> \<exists>c. vector [0, 1, 1] = c *\<^sub>R vector [0, 1, 0]
north = far_north

goal (1 subgoal):
 1. (\<And>k. vector [0, 1, 1] = k *\<^sub>R vector [0, 1, 0] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (unfold north_def far_north_def) auto
[PROOF STATE]
proof (state)
this:
vector [0, 1, 1] = k *\<^sub>R vector [0, 1, 0]

goal (1 subgoal):
 1. north = far_north \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
vector [0, 1, 1] = k *\<^sub>R vector [0, 1, 0]

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding vector_def
[PROOF STATE]
proof (prove)
using this:
vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [0, 1, 1] (\<lambda>n x. 0) 1) = k *\<^sub>R vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [0, 1, 0] (\<lambda>n x. 0) 1)

goal (1 subgoal):
 1. False
[PROOF STEP]
by (auto simp add: vec_eq_iff forall_3)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Ring) nsumMulElmL:
  "\<And> n. \<lbrakk> \<forall> i. f i \<in> carrier R; x \<in> carrier R \<rbrakk>
        \<Longrightarrow> x \<cdot>\<^sub>r (nsum R f n) = nsum R (\<lambda> i. x \<cdot>\<^sub>r (f i)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>i. f i \<in> carrier R; x \<in> carrier R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R f n = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) n
[PROOF STEP]
apply (cut_tac ring_is_ag)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>i. f i \<in> carrier R; x \<in> carrier R; aGroup R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R f n = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) n
[PROOF STEP]
apply (induct_tac "n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<forall>i. f i \<in> carrier R; x \<in> carrier R; aGroup R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R f 0 = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) 0
 2. \<And>n na. \<lbrakk>\<forall>i. f i \<in> carrier R; x \<in> carrier R; aGroup R; x \<cdot>\<^sub>r \<Sigma>\<^sub>e R f na = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R f Suc na = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) Suc na
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>\<forall>i. f i \<in> carrier R; x \<in> carrier R; aGroup R; x \<cdot>\<^sub>r \<Sigma>\<^sub>e R f na = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R f Suc na = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) Suc na
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>\<forall>i. f i \<in> carrier R; x \<in> carrier R; aGroup R; x \<cdot>\<^sub>r \<Sigma>\<^sub>e R f na = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r (\<Sigma>\<^sub>e R f na \<plusminus> f (Suc na)) = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) na \<plusminus> x \<cdot>\<^sub>r f (Suc na)
[PROOF STEP]
apply (subst ring_distrib1, assumption+)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>na. \<lbrakk>\<forall>i. f i \<in> carrier R; x \<in> carrier R; aGroup R; x \<cdot>\<^sub>r \<Sigma>\<^sub>e R f na = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) na\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R f na \<in> carrier R
 2. \<And>na. \<lbrakk>\<forall>i. f i \<in> carrier R; x \<in> carrier R; aGroup R; x \<cdot>\<^sub>r \<Sigma>\<^sub>e R f na = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) na\<rbrakk> \<Longrightarrow> f (Suc na) \<in> carrier R
 3. \<And>na. \<lbrakk>\<forall>i. f i \<in> carrier R; x \<in> carrier R; aGroup R; x \<cdot>\<^sub>r \<Sigma>\<^sub>e R f na = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) na\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r \<Sigma>\<^sub>e R f na \<plusminus> x \<cdot>\<^sub>r f (Suc na) = \<Sigma>\<^sub>e R (\<lambda>i. x \<cdot>\<^sub>r f i) na \<plusminus> x \<cdot>\<^sub>r f (Suc na)
[PROOF STEP]
apply (simp add:aGroup.nsum_mem)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nonEmptySet:
shows "A \<noteq> [] \<longrightarrow> (\<exists> a. a \<in> set A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> [] \<longrightarrow> (\<exists>a. a \<in> set A)
[PROOF STEP]
by (auto simp add:neq_Nil_conv)


[STATEMENT]
lemma "~~((P-->Q) | (Q-->P))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> \<not> ((P \<longrightarrow> Q) \<or> (Q \<longrightarrow> P))
[PROOF STEP]
by iprover


[STATEMENT]
lemma (in is_functor) op_cf_cf_obj_comma_proj:
  assumes "b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>"
  shows "op_cf (\<FF> \<^sub>C\<^sub>F\<Sqinter>\<^sub>O b) = b \<^sub>O\<Sqinter>\<^sub>C\<^sub>F (op_cf \<FF>) \<circ>\<^sub>C\<^sub>F op_cf_obj_comma \<FF> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_cf (\<FF> \<^sub>C\<^sub>F\<Sqinter>\<^sub>O b) = b \<^sub>O\<Sqinter>\<^sub>C\<^sub>F (op_cf \<FF>) \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M op_cf_obj_comma \<FF> b
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. op_cf (\<FF> \<^sub>C\<^sub>F\<Sqinter>\<^sub>O b) = b \<^sub>O\<Sqinter>\<^sub>C\<^sub>F (op_cf \<FF>) \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M op_cf_obj_comma \<FF> b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>
[PROOF STEP]
have cf_const: "cf_const (cat_1 0 0) \<BB> b : cat_1 0 0 \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
[PROOF STATE]
proof (prove)
using this:
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. dghm_const (cat_1 []\<^sub>\<circ> []\<^sub>\<circ>) \<BB> b (\<BB>\<lparr>CId\<rparr>\<lparr>b\<rparr>) : cat_1 []\<^sub>\<circ> []\<^sub>\<circ> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (cs_concl cs_simp: cat_cs_simps cs_intro: V_cs_intros cat_cs_intros)
[PROOF STATE]
proof (state)
this:
dghm_const (cat_1 []\<^sub>\<circ> []\<^sub>\<circ>) \<BB> b (\<BB>\<lparr>CId\<rparr>\<lparr>b\<rparr>) : cat_1 []\<^sub>\<circ> []\<^sub>\<circ> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>

goal (1 subgoal):
 1. op_cf (\<FF> \<^sub>C\<^sub>F\<Sqinter>\<^sub>O b) = b \<^sub>O\<Sqinter>\<^sub>C\<^sub>F (op_cf \<FF>) \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M op_cf_obj_comma \<FF> b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_cf (\<FF> \<^sub>C\<^sub>F\<Sqinter>\<^sub>O b) = b \<^sub>O\<Sqinter>\<^sub>C\<^sub>F (op_cf \<FF>) \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M op_cf_obj_comma \<FF> b
[PROOF STEP]
by
      (
        rule op_cf_comma_proj_left
          [
            OF is_functor_axioms cf_const,
            unfolded cat_op_simps,
            folded
              cf_cf_obj_comma_proj_def
              op_cf_obj_comma_def
              is_functor.cf_obj_cf_comma_proj_def[
                OF is_functor_op, unfolded cat_op_simps
                ]
          ]
      )
[PROOF STATE]
proof (state)
this:
op_cf (\<FF> \<^sub>C\<^sub>F\<Sqinter>\<^sub>O b) = b \<^sub>O\<Sqinter>\<^sub>C\<^sub>F (op_cf \<FF>) \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M op_cf_obj_comma \<FF> b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem thm_2_3_7_indets_Dube:
  fixes fs
  defines "X \<equiv> \<Union>(indets ` set fs)"
  shows "1 \<in> ideal (set fs) \<longleftrightarrow>
          1 \<in> set (punit.Macaulay_list (deg_shifts X (Dube (Suc (card X)) (maxdeg (set fs))) fs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 \<in> ideal (set fs)) = (1 \<in> set (punit.Macaulay_list (deg_shifts X (Dube (Suc (card X)) (maxdeg (set fs))) fs)))
[PROOF STEP]
unfolding X_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 \<in> ideal (set fs)) = (1 \<in> set (punit.Macaulay_list (deg_shifts (\<Union> (indets ` set fs)) (Dube (Suc (card (\<Union> (indets ` set fs)))) (maxdeg (set fs))) fs)))
[PROOF STEP]
using Dube_is_GB_cofactor_bound_indets
[PROOF STATE]
proof (prove)
using this:
finite ?F \<Longrightarrow> is_GB_cofactor_bound ?F (Dube (Suc (card (\<Union> (indets ` ?F)))) (maxdeg ?F))

goal (1 subgoal):
 1. (1 \<in> ideal (set fs)) = (1 \<in> set (punit.Macaulay_list (deg_shifts (\<Union> (indets ` set fs)) (Dube (Suc (card (\<Union> (indets ` set fs)))) (maxdeg (set fs))) fs)))
[PROOF STEP]
by (rule thm_2_3_7_indets) (fact finite_set)


[STATEMENT]
lemma fps_mult_nth_conv_inside_subdegrees:
  fixes f g :: "('a :: {mult_zero,comm_monoid_add}) fps"
  shows "(f * g) $ n = (\<Sum>i=subdegree f..n - subdegree g. f $ i * g $ (n - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
proof (cases "subdegree f \<le> n - subdegree g")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
 2. \<not> subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
subdegree f \<le> n - subdegree g

goal (2 subgoals):
 1. subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
 2. \<not> subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
hence "{subdegree f..n} = {subdegree f..n - subdegree g} \<union> {n - subdegree g<..n}"
[PROOF STATE]
proof (prove)
using this:
subdegree f \<le> n - subdegree g

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

goal (2 subgoals):
 1. subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
 2. \<not> subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{subdegree f..n} = {subdegree f..n - subdegree g} \<union> {n - subdegree g<..n}

goal (2 subgoals):
 1. subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
 2. \<not> subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
have "{subdegree f..n - subdegree g} \<inter> {n - subdegree g<..n} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {subdegree f..n - subdegree g} \<inter> {n - subdegree g<..n} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{subdegree f..n - subdegree g} \<inter> {n - subdegree g<..n} = {}

goal (2 subgoals):
 1. subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
 2. \<not> subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{subdegree f..n - subdegree g} \<inter> {n - subdegree g<..n} = {}

goal (2 subgoals):
 1. subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
 2. \<not> subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
have "\<forall>i\<in>{n - subdegree g<..n}. f $ i * g $ (n - i) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{n - subdegree g<..n}. f $ i * g $ (n - i) = (0::'a)
[PROOF STEP]
using nth_less_subdegree_zero[of _ g]
[PROOF STATE]
proof (prove)
using this:
?n < subdegree g \<Longrightarrow> g $ ?n = (0::'a)

goal (1 subgoal):
 1. \<forall>i\<in>{n - subdegree g<..n}. f $ i * g $ (n - i) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{n - subdegree g<..n}. f $ i * g $ (n - i) = (0::'a)

goal (2 subgoals):
 1. subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
 2. \<not> subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{subdegree f..n} = {subdegree f..n - subdegree g} \<union> {n - subdegree g<..n}
{subdegree f..n - subdegree g} \<inter> {n - subdegree g<..n} = {}
\<forall>i\<in>{n - subdegree g<..n}. f $ i * g $ (n - i) = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{subdegree f..n} = {subdegree f..n - subdegree g} \<union> {n - subdegree g<..n}
{subdegree f..n - subdegree g} \<inter> {n - subdegree g<..n} = {}
\<forall>i\<in>{n - subdegree g<..n}. f $ i * g $ (n - i) = (0::'a)

goal (1 subgoal):
 1. (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
using fps_mult_nth_conv_upto_subdegree_left[of f g n]
[PROOF STATE]
proof (prove)
using this:
{subdegree f..n} = {subdegree f..n - subdegree g} \<union> {n - subdegree g<..n}
{subdegree f..n - subdegree g} \<inter> {n - subdegree g<..n} = {}
\<forall>i\<in>{n - subdegree g<..n}. f $ i * g $ (n - i) = (0::'a)
(f * g) $ n = (\<Sum>i = subdegree f..n. f $ i * g $ (n - i))

goal (1 subgoal):
 1. (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
by    (simp add: sum.union_disjoint)
[PROOF STATE]
proof (state)
this:
(f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))

goal (1 subgoal):
 1. \<not> subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> subdegree f \<le> n - subdegree g

goal (1 subgoal):
 1. \<not> subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
hence 1: "subdegree f > n - subdegree g"
[PROOF STATE]
proof (prove)
using this:
\<not> subdegree f \<le> n - subdegree g

goal (1 subgoal):
 1. n - subdegree g < subdegree f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n - subdegree g < subdegree f

goal (1 subgoal):
 1. \<not> subdegree f \<le> n - subdegree g \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
proof (cases "f*g = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f * g = 0 \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
 2. f * g \<noteq> 0 \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f * g \<noteq> 0

goal (2 subgoals):
 1. f * g = 0 \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
 2. f * g \<noteq> 0 \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
n - subdegree g < subdegree f
f * g \<noteq> 0
[PROOF STEP]
have "n < subdegree (f*g)"
[PROOF STATE]
proof (prove)
using this:
n - subdegree g < subdegree f
f * g \<noteq> 0

goal (1 subgoal):
 1. n < subdegree (f * g)
[PROOF STEP]
using fps_mult_subdegree_ge[of f g]
[PROOF STATE]
proof (prove)
using this:
n - subdegree g < subdegree f
f * g \<noteq> 0
f * g \<noteq> 0 \<Longrightarrow> subdegree f + subdegree g \<le> subdegree (f * g)

goal (1 subgoal):
 1. n < subdegree (f * g)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n < subdegree (f * g)

goal (2 subgoals):
 1. f * g = 0 \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
 2. f * g \<noteq> 0 \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
n - subdegree g < subdegree f
n < subdegree (f * g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n - subdegree g < subdegree f
n < subdegree (f * g)

goal (1 subgoal):
 1. (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))

goal (1 subgoal):
 1. f * g = 0 \<Longrightarrow> (f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))
[PROOF STEP]
qed (simp add: 1)
[PROOF STATE]
proof (state)
this:
(f * g) $ n = (\<Sum>i = subdegree f..n - subdegree g. f $ i * g $ (n - i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem or_intro2: "\<not> (P \<or> Q) \<Longrightarrow> \<not> Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (P \<or> Q) \<Longrightarrow> \<not> Q
[PROOF STEP]
by simp


[STATEMENT]
lemma qbs_ennintegral_eq_qbs_integral:
  assumes "qbs_prob_space_qbs s = X"
          "qbs_integrable s f"
      and "\<And>x. x \<in> qbs_space X \<Longrightarrow> 0 \<le> f x"
    shows "qbs_prob_ennintegral s (\<lambda>x. ennreal (f x)) = ennreal (qbs_prob_integral s f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q x. ennreal (f x) \<partial>s = ennreal (qbs_prob_integral s f)
[PROOF STEP]
using nn_integral_eq_integral[OF integrable_if_qbs_integrable[OF assms(2)]] assms qbs_prob_ennintegral_def2[OF assms(1) qbs_morphism_comp[OF qbs_integrable_morphism[OF assms(1,2)],of ennreal "\<real>\<^sub>Q\<^sub>\<ge>\<^sub>0",simplified comp_def]] measurable_ennreal
[PROOF STATE]
proof (prove)
using this:
AE x in qbs_prob_measure s. 0 \<le> f x \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (f x) \<partial>qbs_prob_measure s = ennreal (qbs_prob_measure_prob_space.expectation s f)
qbs_prob_space_qbs s = X
qbs_integrable s f
?x \<in> qbs_space X \<Longrightarrow> 0 \<le> f ?x
ennreal \<in> \<real>\<^sub>Q \<rightarrow>\<^sub>Q \<real>\<^sub>Q\<^sub>\<ge>\<^sub>0 \<Longrightarrow> \<integral>\<^sup>+\<^sub>Q x. ennreal (f x) \<partial>s = \<integral>\<^sup>+ x. ennreal (f x) \<partial>qbs_prob_measure s
ennreal \<in> borel_measurable real_borel

goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q x. ennreal (f x) \<partial>s = ennreal (qbs_prob_integral s f)
[PROOF STEP]
by (metis AE_I2 qbs_prob_integral_def2 qbs_prob_measure_space real.standard_borel_r_full_faithful)


[STATEMENT]
lemma test_insert2:
"insert2 (1::nat) (2::nat) [(2,3),(1,5)] = [(2,3),(1,2)]"
"insert2 (1::nat) (2::nat) [(2,3),(4,5)] = [(2,3),(4,5),(1,2)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert2 1 2 [(2, 3), (1, 5)] = [(2, 3), (1, 2)] &&& insert2 1 2 [(2, 3), (4, 5)] = [(2, 3), (4, 5), (1, 2)]
[PROOF STEP]
unfolding insert2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if 1 \<in>\<in> map fst [(2, 3), (1, 5)] then map (\<lambda>(a', b'). if a' = 1 then (a', 2) else (a', b')) [(2, 3), (1, 5)] else [(2, 3), (1, 5)] ## (1, 2)) = [(2, 3), (1, 2)] &&& (if 1 \<in>\<in> map fst [(2, 3), (4, 5)] then map (\<lambda>(a', b'). if a' = 1 then (a', 2) else (a', b')) [(2, 3), (4, 5)] else [(2, 3), (4, 5)] ## (1, 2)) = [(2, 3), (4, 5), (1, 2)]
[PROOF STEP]
by simp_all


[STATEMENT]
lemma Infinitesimal_less_SReal2: "y \<in> Infinitesimal \<Longrightarrow> \<forall>r \<in> Reals. 0 < r \<longrightarrow> y < r"
  for y :: hypreal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> Infinitesimal \<Longrightarrow> \<forall>r\<in>\<real>. 0 < r \<longrightarrow> y < r
[PROOF STEP]
by (blast intro: Infinitesimal_less_SReal)


[STATEMENT]
lemma lower_asymptotic_density_subset:
  assumes "A \<subseteq> B"
  shows "lower_asymptotic_density A \<le> lower_asymptotic_density B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lower_asymptotic_density A \<le> lower_asymptotic_density B
[PROOF STEP]
using upper_asymptotic_density_subset[of "UNIV-B" "UNIV-A"] assms
[PROOF STATE]
proof (prove)
using this:
UNIV - B \<subseteq> UNIV - A \<Longrightarrow> upper_asymptotic_density (UNIV - B) \<le> upper_asymptotic_density (UNIV - A)
A \<subseteq> B

goal (1 subgoal):
 1. lower_asymptotic_density A \<le> lower_asymptotic_density B
[PROOF STEP]
unfolding lower_upper_asymptotic_density_complement
[PROOF STATE]
proof (prove)
using this:
UNIV - B \<subseteq> UNIV - A \<Longrightarrow> upper_asymptotic_density (UNIV - B) \<le> upper_asymptotic_density (UNIV - A)
A \<subseteq> B

goal (1 subgoal):
 1. 1 - upper_asymptotic_density (UNIV - A) \<le> 1 - upper_asymptotic_density (UNIV - B)
[PROOF STEP]
by auto


[STATEMENT]
lemma Bernstein_nonneg: "\<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> 0 \<le> Bernstein n k x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> 0 \<le> Bernstein n k x
[PROOF STEP]
by (simp add: Bernstein_def)


[STATEMENT]
theorem dfs_eq_reachable: "set (dfs g xs []) = reachable g xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (dfs g xs []) = reachable g xs
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set (dfs g xs []) \<subseteq> reachable g xs
 2. reachable g xs \<subseteq> set (dfs g xs [])
[PROOF STEP]
have "set (dfs g xs []) \<subseteq> reachable g xs \<union> set []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (dfs g xs []) \<subseteq> reachable g xs \<union> set []
[PROOF STEP]
by (rule dfs_subset_reachable_visit_nodes[of g xs "[]"])
[PROOF STATE]
proof (state)
this:
set (dfs g xs []) \<subseteq> reachable g xs \<union> set []

goal (2 subgoals):
 1. set (dfs g xs []) \<subseteq> reachable g xs
 2. reachable g xs \<subseteq> set (dfs g xs [])
[PROOF STEP]
thus "set (dfs g xs []) \<subseteq> reachable g xs"
[PROOF STATE]
proof (prove)
using this:
set (dfs g xs []) \<subseteq> reachable g xs \<union> set []

goal (1 subgoal):
 1. set (dfs g xs []) \<subseteq> reachable g xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (dfs g xs []) \<subseteq> reachable g xs

goal (1 subgoal):
 1. reachable g xs \<subseteq> set (dfs g xs [])
[PROOF STEP]
qed(rule reachable_closed_dfs)


[STATEMENT]
lemma not_AE_zero_int_E:
  fixes f::"'a \<Rightarrow> real"
  assumes "AE x in M. f x \<ge> 0" "(\<integral>x. f x \<partial>M) > 0"
      and [measurable]: "f \<in> borel_measurable M"
  shows "\<exists>A e. A \<in> sets M \<and> e>0 \<and> emeasure M A > 0 \<and> (\<forall>x \<in> A. f x \<ge> e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>A e. A \<in> sets M \<and> 0 < e \<and> 0 < emeasure M A \<and> (\<forall>x\<in>A. e \<le> f x)
[PROOF STEP]
proof (rule not_AE_zero_E, auto simp add: assms)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. f x = 0 \<Longrightarrow> False
[PROOF STEP]
assume *: "AE x in M. f x = 0"
[PROOF STATE]
proof (state)
this:
AE x in M. f x = 0

goal (1 subgoal):
 1. AE x in M. f x = 0 \<Longrightarrow> False
[PROOF STEP]
have "(\<integral>x. f x \<partial>M) = (\<integral>x. 0 \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L M f = LINT x|M. 0
[PROOF STEP]
by (rule integral_cong_AE, auto simp add: *)
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M f = LINT x|M. 0

goal (1 subgoal):
 1. AE x in M. f x = 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>L M f = LINT x|M. 0
[PROOF STEP]
have "(\<integral>x. f x \<partial>M) = 0"
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L M f = LINT x|M. 0

goal (1 subgoal):
 1. integral\<^sup>L M f = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M f = 0

goal (1 subgoal):
 1. AE x in M. f x = 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>L M f = 0
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L M f = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L M f = 0
0 < integral\<^sup>L M f

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_complex_of_real [simp]: "summable (\<lambda>n. complex_of_real (f n)) \<longleftrightarrow> summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. complex_of_real (f n)) = summable f
[PROOF STEP]
unfolding summable_complex_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (summable (\<lambda>x. Re (complex_of_real (f x))) \<and> summable (\<lambda>x. Im (complex_of_real (f x)))) = summable f
[PROOF STEP]
by simp