[STATEMENT]
lemma sigma_finite_subalgebra_is_sigma_finite:
  assumes "sigma_finite_subalgebra M F"
  shows "sigma_finite_measure M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_finite_measure M
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union> A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)
[PROOF STEP]
have subalg: "subalgebra M F"
   and sigma_fin_subalg: "sigma_finite_measure (restr_to_subalg M F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subalgebra M F &&& sigma_finite_measure (restr_to_subalg M F)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sigma_finite_subalgebra M F

goal (1 subgoal):
 1. subalgebra M F &&& sigma_finite_measure (restr_to_subalg M F)
[PROOF STEP]
unfolding sigma_finite_subalgebra_def
[PROOF STATE]
proof (prove)
using this:
subalgebra M F \<and> sigma_finite_measure (restr_to_subalg M F)

goal (1 subgoal):
 1. subalgebra M F &&& sigma_finite_measure (restr_to_subalg M F)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
subalgebra M F
sigma_finite_measure (restr_to_subalg M F)

goal (1 subgoal):
 1. \<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union> A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)
[PROOF STEP]
obtain A where Ap: "countable A \<and> A \<subseteq> sets (restr_to_subalg M F) \<and> \<Union>A = space (restr_to_subalg M F) \<and> (\<forall>a\<in>A. emeasure (restr_to_subalg M F) a \<noteq> \<infinity>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A. countable A \<and> A \<subseteq> sets (restr_to_subalg M F) \<and> \<Union> A = space (restr_to_subalg M F) \<and> (\<forall>a\<in>A. emeasure (restr_to_subalg M F) a \<noteq> \<infinity>) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using sigma_finite_measure.sigma_finite_countable[OF sigma_fin_subalg]
[PROOF STATE]
proof (prove)
using this:
\<exists>A. countable A \<and> A \<subseteq> sets (restr_to_subalg M F) \<and> \<Union> A = space (restr_to_subalg M F) \<and> (\<forall>a\<in>A. emeasure (restr_to_subalg M F) a \<noteq> \<infinity>)

goal (1 subgoal):
 1. (\<And>A. countable A \<and> A \<subseteq> sets (restr_to_subalg M F) \<and> \<Union> A = space (restr_to_subalg M F) \<and> (\<forall>a\<in>A. emeasure (restr_to_subalg M F) a \<noteq> \<infinity>) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
countable A \<and> A \<subseteq> sets (restr_to_subalg M F) \<and> \<Union> A = space (restr_to_subalg M F) \<and> (\<forall>a\<in>A. emeasure (restr_to_subalg M F) a \<noteq> \<infinity>)

goal (1 subgoal):
 1. \<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union> A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)
[PROOF STEP]
have "A \<subseteq> sets F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> sets F
[PROOF STEP]
using Ap sets_restr_to_subalg[OF subalg]
[PROOF STATE]
proof (prove)
using this:
countable A \<and> A \<subseteq> sets (restr_to_subalg M F) \<and> \<Union> A = space (restr_to_subalg M F) \<and> (\<forall>a\<in>A. emeasure (restr_to_subalg M F) a \<noteq> \<infinity>)
sets (restr_to_subalg M F) = sets F

goal (1 subgoal):
 1. A \<subseteq> sets F
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
A \<subseteq> sets F

goal (1 subgoal):
 1. \<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union> A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> sets F
[PROOF STEP]
have "A \<subseteq> sets M"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> sets F

goal (1 subgoal):
 1. A \<subseteq> sets M
[PROOF STEP]
using subalg subalgebra_def
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> sets F
subalgebra M F
subalgebra ?M ?F = (space ?F = space ?M \<and> sets ?F \<subseteq> sets ?M)

goal (1 subgoal):
 1. A \<subseteq> sets M
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
A \<subseteq> sets M

goal (1 subgoal):
 1. \<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union> A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A \<subseteq> sets M

goal (1 subgoal):
 1. \<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union> A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)
[PROOF STEP]
have "\<Union>A = space M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> A = space M
[PROOF STEP]
using Ap space_restr_to_subalg
[PROOF STATE]
proof (prove)
using this:
countable A \<and> A \<subseteq> sets (restr_to_subalg M F) \<and> \<Union> A = space (restr_to_subalg M F) \<and> (\<forall>a\<in>A. emeasure (restr_to_subalg M F) a \<noteq> \<infinity>)
space (restr_to_subalg ?M ?F) = space ?M

goal (1 subgoal):
 1. \<Union> A = space M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Union> A = space M

goal (1 subgoal):
 1. \<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union> A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<Union> A = space M

goal (1 subgoal):
 1. \<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union> A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)
[PROOF STEP]
have "\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a\<in>A. emeasure M a \<noteq> \<infinity>
[PROOF STEP]
by (metis subsetD emeasure_restr_to_subalg[OF subalg] \<open>A \<subseteq> sets F\<close> Ap)
[PROOF STATE]
proof (state)
this:
\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>

goal (1 subgoal):
 1. \<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union> A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> sets M
\<Union> A = space M
\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>
[PROOF STEP]
show "\<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union>A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> sets M
\<Union> A = space M
\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>

goal (1 subgoal):
 1. \<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union> A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)
[PROOF STEP]
using Ap
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> sets M
\<Union> A = space M
\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>
countable A \<and> A \<subseteq> sets (restr_to_subalg M F) \<and> \<Union> A = space (restr_to_subalg M F) \<and> (\<forall>a\<in>A. emeasure (restr_to_subalg M F) a \<noteq> \<infinity>)

goal (1 subgoal):
 1. \<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union> A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union> A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Ring) tail_of_expansion:"x \<in> carrier R \<Longrightarrow> (1\<^sub>r \<plusminus> x)^\<^bsup>R (Suc n)\<^esup> =
             (nsum R (\<lambda> i. (\<^bsub>(Suc n)\<^esub>C\<^bsub>(Suc i)\<^esub> \<times>\<^bsub>R\<^esub> x^\<^bsup>R (Suc i)\<^esup>)) n) \<plusminus> 1\<^sub>r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier R \<Longrightarrow> (1\<^sub>r \<plusminus> x)^\<^bsup>R Suc n\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  \<^bsub>Suc n\<^esub>C\<^bsub>Suc i\<^esub> \<times>\<^bsub>R\<^esub> x^\<^bsup>R Suc i\<^esup>) n \<plusminus> 1\<^sub>r
[PROOF STEP]
apply (cut_tac ring_is_ag)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; aGroup R\<rbrakk> \<Longrightarrow> (1\<^sub>r \<plusminus> x)^\<^bsup>R Suc n\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  \<^bsub>Suc n\<^esub>C\<^bsub>Suc i\<^esub> \<times>\<^bsub>R\<^esub> x^\<^bsup>R Suc i\<^esup>) n \<plusminus> 1\<^sub>r
[PROOF STEP]
apply (frule expansion_of_sum1[of "x" "Suc n"],
       simp del:nsum_suc binomial_Suc_Suc npow_suc,
       thin_tac "(1\<^sub>r \<plusminus> x)^\<^bsup>R (Suc n)\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i. \<^bsub>(Suc n)\<^esub>C\<^bsub>i\<^esub> \<times>\<^bsub>R\<^esub> x^\<^bsup>R i\<^esup>) (Suc n)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; aGroup R\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  \<^bsub>Suc n\<^esub>C\<^bsub>i\<^esub> \<times>\<^bsub>R\<^esub> x^\<^bsup>R i\<^esup>) Suc n = \<Sigma>\<^sub>e R (\<lambda>i.  \<^bsub>Suc n\<^esub>C\<^bsub>Suc i\<^esub> \<times>\<^bsub>R\<^esub> x^\<^bsup>R Suc i\<^esup>) n \<plusminus> 1\<^sub>r
[PROOF STEP]
apply (subst aGroup.nsumTail[of R n "\<lambda>i. \<^bsub>(Suc n)\<^esub>C\<^bsub>i\<^esub> \<times>\<^bsub>R\<^esub> x^\<^bsup>R i\<^esup>"], assumption,
       rule allI, rule impI, rule nsClose, rule npClose, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; aGroup R\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>i.  \<^bsub>Suc n\<^esub>C\<^bsub>Suc i\<^esub> \<times>\<^bsub>R\<^esub> x^\<^bsup>R Suc i\<^esup>) n \<plusminus>  \<^bsub>Suc n\<^esub>C\<^bsub>0\<^esub> \<times>\<^bsub>R\<^esub> x^\<^bsup>R 0\<^esup> = \<Sigma>\<^sub>e R (\<lambda>i.  \<^bsub>Suc n\<^esub>C\<^bsub>Suc i\<^esub> \<times>\<^bsub>R\<^esub> x^\<^bsup>R Suc i\<^esup>) n \<plusminus> 1\<^sub>r
[PROOF STEP]
apply (cut_tac ring_one,
       simp del:nsum_suc binomial_Suc_Suc npow_suc add:aGroup.ag_l_zero)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem fib_induct: "P 0 \<Longrightarrow> P 1 \<Longrightarrow> (\<And>n. P (n + 1) \<Longrightarrow> P n \<Longrightarrow> P (n + 2)) \<Longrightarrow> P n"
  for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P 0; P 1; \<And>n. \<lbrakk>P (n + 1); P n\<rbrakk> \<Longrightarrow> P (n + 2)\<rbrakk> \<Longrightarrow> P n
[PROOF STEP]
by (induct rule: fib.induct) simp_all


[STATEMENT]
lemma integrable_on_affinity:
  assumes "m \<noteq> 0" "f integrable_on (cbox a b)"
  shows   "(\<lambda>x. f (m *\<^sub>R x + c)) integrable_on ((\<lambda>x. (1 / m) *\<^sub>R x - ((1 / m) *\<^sub>R c)) ` cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f (m *\<^sub>R x + c)) integrable_on (\<lambda>x. (1 / m) *\<^sub>R x - (1 / m) *\<^sub>R c) ` cbox a b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. f (m *\<^sub>R x + c)) integrable_on (\<lambda>x. (1 / m) *\<^sub>R x - (1 / m) *\<^sub>R c) ` cbox a b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
m \<noteq> 0
f integrable_on cbox a b
[PROOF STEP]
obtain I where "(f has_integral I) (cbox a b)"
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 0
f integrable_on cbox a b

goal (1 subgoal):
 1. (\<And>I. (f has_integral I) (cbox a b) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: integrable_on_def)
[PROOF STATE]
proof (state)
this:
(f has_integral I) (cbox a b)

goal (1 subgoal):
 1. (\<lambda>x. f (m *\<^sub>R x + c)) integrable_on (\<lambda>x. (1 / m) *\<^sub>R x - (1 / m) *\<^sub>R c) ` cbox a b
[PROOF STEP]
from has_integral_affinity[OF this assms(1), of c]
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (1 / \<bar>m\<bar> ^ DIM('a)) *\<^sub>R I) ((\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (1 / \<bar>m\<bar> ^ DIM('a)) *\<^sub>R I) ((\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b)

goal (1 subgoal):
 1. (\<lambda>x. f (m *\<^sub>R x + c)) integrable_on (\<lambda>x. (1 / m) *\<^sub>R x - (1 / m) *\<^sub>R c) ` cbox a b
[PROOF STEP]
by (auto simp: integrable_on_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (m *\<^sub>R x + c)) integrable_on (\<lambda>x. (1 / m) *\<^sub>R x - (1 / m) *\<^sub>R c) ` cbox a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convex_supp_sum:
  assumes "convex S" and 1: "supp_sum u I = 1"
      and "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> u i \<and> (u i = 0 \<or> f i \<in> S)"
    shows "supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
have fin: "finite {i \<in> I. u i \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i \<in> I. u i \<noteq> 0}
[PROOF STEP]
using 1 sum.infinite
[PROOF STATE]
proof (prove)
using this:
supp_sum u I = 1
infinite ?A \<Longrightarrow> sum ?g ?A = (0::?'a)

goal (1 subgoal):
 1. finite {i \<in> I. u i \<noteq> 0}
[PROOF STEP]
by (force simp: supp_sum_def support_on_def)
[PROOF STATE]
proof (state)
this:
finite {i \<in> I. u i \<noteq> 0}

goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite {i \<in> I. u i \<noteq> 0}
[PROOF STEP]
have "supp_sum (\<lambda>i. u i *\<^sub>R f i) I = sum (\<lambda>i. u i *\<^sub>R f i) {i \<in> I. u i \<noteq> 0}"
[PROOF STATE]
proof (prove)
using this:
finite {i \<in> I. u i \<noteq> 0}

goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I = (\<Sum>i | i \<in> I \<and> u i \<noteq> 0. u i *\<^sub>R f i)
[PROOF STEP]
by (force intro: sum.mono_neutral_left simp: supp_sum_def support_on_def)
[PROOF STATE]
proof (state)
this:
supp_sum (\<lambda>i. u i *\<^sub>R f i) I = (\<Sum>i | i \<in> I \<and> u i \<noteq> 0. u i *\<^sub>R f i)

goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
supp_sum (\<lambda>i. u i *\<^sub>R f i) I = (\<Sum>i | i \<in> I \<and> u i \<noteq> 0. u i *\<^sub>R f i)

goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
have "... \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | i \<in> I \<and> u i \<noteq> 0. u i *\<^sub>R f i) \<in> S
[PROOF STEP]
using 1 assms
[PROOF STATE]
proof (prove)
using this:
supp_sum u I = 1
convex S
supp_sum u I = 1
?i \<in> I \<Longrightarrow> 0 \<le> u ?i \<and> (u ?i = 0 \<or> f ?i \<in> S)

goal (1 subgoal):
 1. (\<Sum>i | i \<in> I \<and> u i \<noteq> 0. u i *\<^sub>R f i) \<in> S
[PROOF STEP]
by (force simp: supp_sum_def support_on_def intro: convex_sum [OF fin \<open>convex S\<close>])
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i \<in> I \<and> u i \<noteq> 0. u i *\<^sub>R f i) \<in> S

goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S

goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma CARD_valid_states:
  assumes "finite (PROB :: 'a problem)"
  shows "(card (valid_states PROB :: 'a state set) = 2 ^ card (prob_dom PROB))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (valid_states PROB) = 2 ^ card (prob_dom PROB)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (valid_states PROB) = 2 ^ card (prob_dom PROB)
[PROOF STEP]
have 1: "finite (prob_dom PROB)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (prob_dom PROB)
[PROOF STEP]
using assms FINITE_prob_dom
[PROOF STATE]
proof (prove)
using this:
finite PROB
finite ?PROB \<Longrightarrow> finite (prob_dom ?PROB)

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

goal (1 subgoal):
 1. card (valid_states PROB) = 2 ^ card (prob_dom PROB)
[PROOF STEP]
have"(card (valid_states PROB :: 'a state set)) = card {s :: 'a state. fmdom' s = prob_dom PROB}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (valid_states PROB) = card {s. fmdom' s = prob_dom PROB}
[PROOF STEP]
unfolding valid_states_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {s. fmdom' s = prob_dom PROB} = card {s. fmdom' s = prob_dom PROB}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (valid_states PROB) = card {s. fmdom' s = prob_dom PROB}

goal (1 subgoal):
 1. card (valid_states PROB) = 2 ^ card (prob_dom PROB)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (valid_states PROB) = card {s. fmdom' s = prob_dom PROB}

goal (1 subgoal):
 1. card (valid_states PROB) = 2 ^ card (prob_dom PROB)
[PROOF STEP]
have "...  = 2 ^ (card (prob_dom PROB))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {s. fmdom' s = prob_dom PROB} = 2 ^ card (prob_dom PROB)
[PROOF STEP]
using 1 card_of_set_of_all_possible_states
[PROOF STATE]
proof (prove)
using this:
finite (prob_dom PROB)
finite ?X \<Longrightarrow> card {s. fmdom' s = ?X} = 2 ^ card ?X

goal (1 subgoal):
 1. card {s. fmdom' s = prob_dom PROB} = 2 ^ card (prob_dom PROB)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card {s. fmdom' s = prob_dom PROB} = 2 ^ card (prob_dom PROB)

goal (1 subgoal):
 1. card (valid_states PROB) = 2 ^ card (prob_dom PROB)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (valid_states PROB) = 2 ^ card (prob_dom PROB)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (valid_states PROB) = 2 ^ card (prob_dom PROB)

goal (1 subgoal):
 1. card (valid_states PROB) = 2 ^ card (prob_dom PROB)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (valid_states PROB) = 2 ^ card (prob_dom PROB)

goal:
No subgoals!
[PROOF STEP]
qed

\<comment> \<open>NOTE type of 'valid\_states PROB' has to be asserted to match 'FINITE\_states' in the proof.\<close>


[STATEMENT]
lemma prod_list_diag_prod: "prod_list (diag_mat A) = (\<Prod> i = 0 ..< dim_row A. A $$ (i,i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (diag_mat A) = (\<Prod>i = 0..<dim_row A. A $$ (i, i))
[PROOF STEP]
unfolding diag_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i\<leftarrow>[0..<dim_row A]. A $$ (i, i)) = (\<Prod>i = 0..<dim_row A. A $$ (i, i))
[PROOF STEP]
by (subst prod.distinct_set_conv_list[symmetric], auto)


[STATEMENT]
lemma sums_mult_iff:
  fixes f :: "nat \<Rightarrow> 'a::{real_normed_algebra,field}"
  assumes "c \<noteq> 0"
  shows "(\<lambda>n. c * f n) sums (c * d) \<longleftrightarrow> f sums d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. c * f n) sums (c * d) = f sums d
[PROOF STEP]
using sums_mult[of f d c] sums_mult[of "\<lambda>n. c * f n" "c * d" "inverse c"]
[PROOF STATE]
proof (prove)
using this:
f sums d \<Longrightarrow> (\<lambda>n. c * f n) sums (c * d)
(\<lambda>n. c * f n) sums (c * d) \<Longrightarrow> (\<lambda>n. inverse c * (c * f n)) sums (inverse c * (c * d))

goal (1 subgoal):
 1. (\<lambda>n. c * f n) sums (c * d) = f sums d
[PROOF STEP]
by (force simp: field_simps assms)


[STATEMENT]
lemma Ln_of_nat_over_of_nat:
  assumes "m > 0" "n > 0"
  shows   "Ln (of_nat m / of_nat n) = of_real (ln (of_nat m) - ln (of_nat n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (of_nat m / of_nat n) = complex_of_real (ln (real m) - ln (real n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Ln (of_nat m / of_nat n) = complex_of_real (ln (real m) - ln (real n))
[PROOF STEP]
have "of_nat m / of_nat n = (of_real (of_nat m / of_nat n) :: complex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat m / of_nat n = complex_of_real (real m / real n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_nat m / of_nat n = complex_of_real (real m / real n)

goal (1 subgoal):
 1. Ln (of_nat m / of_nat n) = complex_of_real (ln (real m) - ln (real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat m / of_nat n = complex_of_real (real m / real n)

goal (1 subgoal):
 1. Ln (of_nat m / of_nat n) = complex_of_real (ln (real m) - ln (real n))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < m
0 < n
[PROOF STEP]
have "Ln \<dots> = of_real (ln (of_nat m / of_nat n))"
[PROOF STATE]
proof (prove)
using this:
0 < m
0 < n

goal (1 subgoal):
 1. Ln (complex_of_real (real m / real n)) = complex_of_real (ln (real m / real n))
[PROOF STEP]
by (simp add: Ln_of_real[symmetric])
[PROOF STATE]
proof (state)
this:
Ln (complex_of_real (real m / real n)) = complex_of_real (ln (real m / real n))

goal (1 subgoal):
 1. Ln (of_nat m / of_nat n) = complex_of_real (ln (real m) - ln (real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Ln (complex_of_real (real m / real n)) = complex_of_real (ln (real m / real n))

goal (1 subgoal):
 1. Ln (of_nat m / of_nat n) = complex_of_real (ln (real m) - ln (real n))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < m
0 < n
[PROOF STEP]
have "\<dots> = of_real (ln (of_nat m) - ln (of_nat n))"
[PROOF STATE]
proof (prove)
using this:
0 < m
0 < n

goal (1 subgoal):
 1. complex_of_real (ln (real m / real n)) = complex_of_real (ln (real m) - ln (real n))
[PROOF STEP]
by (simp add: ln_div)
[PROOF STATE]
proof (state)
this:
complex_of_real (ln (real m / real n)) = complex_of_real (ln (real m) - ln (real n))

goal (1 subgoal):
 1. Ln (of_nat m / of_nat n) = complex_of_real (ln (real m) - ln (real n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Ln (of_nat m / of_nat n) = complex_of_real (ln (real m) - ln (real n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Ln (of_nat m / of_nat n) = complex_of_real (ln (real m) - ln (real n))

goal (1 subgoal):
 1. Ln (of_nat m / of_nat n) = complex_of_real (ln (real m) - ln (real n))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Ln (of_nat m / of_nat n) = complex_of_real (ln (real m) - ln (real n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_list_replicate0 : "sum_list (replicate n 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (replicate n (0::'a)) = (0::'a)
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma admits_SNF_JNF_alt_def:
  "(\<forall>A::'a::comm_ring_1 mat. admits_SNF_JNF A)
  = (\<forall>A n. (A::'a mat) \<in> carrier_mat n n \<and> isDiagonal_mat A
  \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat n n \<and> Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q
      \<and> Smith_normal_form_mat (P*A*Q)))" (is "?a = ?b")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>A. admits_SNF_JNF A) = (\<forall>A n. A \<in> carrier_mat n n \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat n n \<and> Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q)))
[PROOF STEP]
by (auto simp add: admits_SNF_JNF_def, metis carrier_matD(1) carrier_matD(2), blast)


[STATEMENT]
lemma exp_Lambert_W: "x \<ge> -exp (-1) \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> exp (Lambert_W x) = x / Lambert_W x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- exp (- 1) \<le> x; x \<noteq> 0\<rbrakk> \<Longrightarrow> exp (Lambert_W x) = x / Lambert_W x
[PROOF STEP]
using Lambert_W_times_exp_self[of x]
[PROOF STATE]
proof (prove)
using this:
- exp (- 1) \<le> x \<Longrightarrow> Lambert_W x * exp (Lambert_W x) = x

goal (1 subgoal):
 1. \<lbrakk>- exp (- 1) \<le> x; x \<noteq> 0\<rbrakk> \<Longrightarrow> exp (Lambert_W x) = x / Lambert_W x
[PROOF STEP]
by (auto simp add: divide_simps mult_ac)


[STATEMENT]
theorem i_take_induct: "
  \<lbrakk> P (f \<Down> 0); \<And>n. P (f \<Down> n) \<Longrightarrow> P ( f \<Down> Suc n) \<rbrakk> \<Longrightarrow> P ( f \<Down> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P (f \<Down> 0); \<And>n. P (f \<Down> n) \<Longrightarrow> P (f \<Down> Suc n)\<rbrakk> \<Longrightarrow> P (f \<Down> n)
[PROOF STEP]
by (rule nat.induct)


[STATEMENT]
lemma homeomorphic_convex_sets:
  assumes "convex S" "convex T" "S homeomorphic T"
  shows "aff_dim S = aff_dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S = aff_dim T
[PROOF STEP]
by (meson assms dual_order.antisym homeomorphic_convex_sets_le homeomorphic_sym)


[STATEMENT]
lemma (in CRR_market) delta_price_eq:
  assumes "Suc n \<le> T"
  shows "delta_price N cash_flow T n w = (rn_price N cash_flow T (Suc n) (spick w n True) - rn_price N cash_flow T (Suc n) (spick w n False))/
    ((geom_proc n w) * (u - d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. delta_price N cash_flow T n w = (rn_price N cash_flow T (Suc n) (spick w n True) - rn_price N cash_flow T (Suc n) (spick w n False)) / (geom_proc n w * (u - d))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. delta_price N cash_flow T n w = (rn_price N cash_flow T (Suc n) (spick w n True) - rn_price N cash_flow T (Suc n) (spick w n False)) / (geom_proc n w * (u - d))
[PROOF STEP]
have "(geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False)) = geom_proc n w * (u - d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)
[PROOF STEP]
by (simp add: geom_rand_walk_diff_induct)
[PROOF STATE]
proof (state)
this:
geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)

goal (1 subgoal):
 1. delta_price N cash_flow T n w = (rn_price N cash_flow T (Suc n) (spick w n True) - rn_price N cash_flow T (Suc n) (spick w n False)) / (geom_proc n w * (u - d))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)

goal (1 subgoal):
 1. delta_price N cash_flow T n w = (rn_price N cash_flow T (Suc n) (spick w n True) - rn_price N cash_flow T (Suc n) (spick w n False)) / (geom_proc n w * (u - d))
[PROOF STEP]
unfolding delta_price_def
[PROOF STATE]
proof (prove)
using this:
geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)

goal (1 subgoal):
 1. (if Suc n \<le> T then (rn_price N cash_flow T (Suc n) (pseudo_proj_True n w) - rn_price N cash_flow T (Suc n) (pseudo_proj_False n w)) / (geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False)) else 0) = (rn_price N cash_flow T (Suc n) (spick w n True) - rn_price N cash_flow T (Suc n) (spick w n False)) / (geom_proc n w * (u - d))
[PROOF STEP]
using assms spick_eq_pseudo_proj_True spick_eq_pseudo_proj_False
[PROOF STATE]
proof (prove)
using this:
geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False) = geom_proc n w * (u - d)
Suc n \<le> T
spick ?w ?n True = pseudo_proj_True ?n ?w
spick ?w ?n False = pseudo_proj_False ?n ?w

goal (1 subgoal):
 1. (if Suc n \<le> T then (rn_price N cash_flow T (Suc n) (pseudo_proj_True n w) - rn_price N cash_flow T (Suc n) (pseudo_proj_False n w)) / (geom_proc (Suc n) (spick w n True) - geom_proc (Suc n) (spick w n False)) else 0) = (rn_price N cash_flow T (Suc n) (spick w n True) - rn_price N cash_flow T (Suc n) (spick w n False)) / (geom_proc n w * (u - d))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
delta_price N cash_flow T n w = (rn_price N cash_flow T (Suc n) (spick w n True) - rn_price N cash_flow T (Suc n) (spick w n False)) / (geom_proc n w * (u - d))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "filterlim (\<lambda>x::real. (3 powr x - 2 powr x) / (x^2 - x)) (nhds (ln (2/3))) (at 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (3 powr x - 2 powr x) / (x\<^sup>2 - x)) \<midarrow>0\<rightarrow> ln (2 / 3)
[PROOF STEP]
by (real_asymp simp: ln_div)


[STATEMENT]
lemma qbs_morphism_pair_swap:
  assumes "f \<in> X \<Otimes>\<^sub>Q Y \<rightarrow>\<^sub>Q Z"
  shows "(\<lambda>(x,y). f (y,x)) \<in> Y \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). f (y, x)) \<in> Y \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q Z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>(x, y). f (y, x)) \<in> Y \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q Z
[PROOF STEP]
have "(\<lambda>(x,y). f (y,x)) = f \<circ> (\<lambda>(x,y). (y,x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). f (y, x)) = f \<circ> (\<lambda>(x, y). (y, x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). f (y, x)) = f \<circ> (\<lambda>(x, y). (y, x))

goal (1 subgoal):
 1. (\<lambda>(x, y). f (y, x)) \<in> Y \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q Z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). f (y, x)) = f \<circ> (\<lambda>(x, y). (y, x))

goal (1 subgoal):
 1. (\<lambda>(x, y). f (y, x)) \<in> Y \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q Z
[PROOF STEP]
using qbs_morphism_comp[of "(\<lambda>(x,y). (y,x))" "Y \<Otimes>\<^sub>Q X" _ f] qbs_morphism_pair_swap' assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). f (y, x)) = f \<circ> (\<lambda>(x, y). (y, x))
\<lbrakk>(\<lambda>(x, y). (y, x)) \<in> Y \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q ?Y; f \<in> ?Y \<rightarrow>\<^sub>Q ?Z\<rbrakk> \<Longrightarrow> f \<circ> (\<lambda>(x, y). (y, x)) \<in> Y \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q ?Z
(\<lambda>(x, y). (y, x)) \<in> ?X \<Otimes>\<^sub>Q ?Y \<rightarrow>\<^sub>Q ?Y \<Otimes>\<^sub>Q ?X
f \<in> X \<Otimes>\<^sub>Q Y \<rightarrow>\<^sub>Q Z

goal (1 subgoal):
 1. (\<lambda>(x, y). f (y, x)) \<in> Y \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q Z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). f (y, x)) \<in> Y \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q Z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ln_gt_zero_imp_gt_one: "0 < ln x \<Longrightarrow> 0 < x \<Longrightarrow> 1 < x"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < ln x; 0 < x\<rbrakk> \<Longrightarrow> 1 < x
[PROOF STEP]
using ln_less_cancel_iff [of 1 x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 1; 0 < x\<rbrakk> \<Longrightarrow> (ln 1 < ln x) = (1 < x)

goal (1 subgoal):
 1. \<lbrakk>0 < ln x; 0 < x\<rbrakk> \<Longrightarrow> 1 < x
[PROOF STEP]
by simp


[STATEMENT]
lemma val_of_divide:
  assumes "x \<in> carrier Zp"
  assumes "y \<in> nonzero Zp"
  assumes "val_Zp x \<ge> val_Zp y"
  shows "val_Zp (divide x y) = val_Zp x - val_Zp y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val_Zp (local.divide x y) = val_Zp x - val_Zp y
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. val_Zp (local.divide x y) = val_Zp x - val_Zp y
[PROOF STEP]
have 0: "y \<otimes> divide x y = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<otimes> local.divide x y = x
[PROOF STEP]
by (simp add: assms(1) assms(2) assms(3) divide_formula nonzero_closed nonzero_memE(2))
[PROOF STATE]
proof (state)
this:
y \<otimes> local.divide x y = x

goal (1 subgoal):
 1. val_Zp (local.divide x y) = val_Zp x - val_Zp y
[PROOF STEP]
hence "val_Zp y + val_Zp (divide x y) = val_Zp x"
[PROOF STATE]
proof (prove)
using this:
y \<otimes> local.divide x y = x

goal (1 subgoal):
 1. val_Zp y + val_Zp (local.divide x y) = val_Zp x
[PROOF STEP]
using assms(1) assms(2) divide_closed nonzero_closed not_nonzero_memI val_Zp_mult
[PROOF STATE]
proof (prove)
using this:
y \<otimes> local.divide x y = x
x \<in> carrier Zp
y \<in> nonzero Zp
\<lbrakk>?x \<in> carrier Zp; ?y \<in> carrier Zp; ?y \<noteq> \<zero>\<rbrakk> \<Longrightarrow> local.divide ?x ?y \<in> carrier Zp
?a \<in> nonzero Zp \<Longrightarrow> ?a \<in> carrier Zp
?a = \<zero> \<Longrightarrow> ?a \<notin> nonzero Zp
\<lbrakk>?x \<in> carrier Zp; ?y \<in> carrier Zp\<rbrakk> \<Longrightarrow> val_Zp (?x \<otimes> ?y) = val_Zp ?x + val_Zp ?y

goal (1 subgoal):
 1. val_Zp y + val_Zp (local.divide x y) = val_Zp x
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
val_Zp y + val_Zp (local.divide x y) = val_Zp x

goal (1 subgoal):
 1. val_Zp (local.divide x y) = val_Zp x - val_Zp y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
val_Zp y + val_Zp (local.divide x y) = val_Zp x

goal (1 subgoal):
 1. val_Zp (local.divide x y) = val_Zp x - val_Zp y
[PROOF STEP]
by (smt Zp_def add.commute add.left_neutral add.right_neutral add_diff_assoc_eint assms(1)
        assms(2) divide_nonzero eSuc_minus_eSuc iadd_Suc idiff_0_right mult_zero(1) mult_zero_l
        nonzero_closed ord_pos order_refl padic_integers.Zp_int_inc_closed padic_integers.mult_comm
        padic_integers.ord_of_nonzero(2) padic_integers_axioms val_Zp_eq_frac_0 val_Zp_mult val_Zp_p)
[PROOF STATE]
proof (state)
this:
val_Zp (local.divide x y) = val_Zp x - val_Zp y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "((\<lambda>x::real. (exp (x * exp (-x) / (exp (-x) + exp (-(2*x^2)/(x+1)))) - exp x) / x)
          \<longlongrightarrow> -exp 2) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (exp (x * exp (- x) / (exp (- x) + exp (- (2 * x\<^sup>2) / (x + 1)))) - exp x) / x) \<longlongrightarrow> - exp 2) at_top
[PROOF STEP]
by real_asymp