[STATEMENT]
lemma tendsto_mcont:
  assumes mcont: "mcont Sup (\<le>) Sup (\<le>) (f :: 'a :: ccpo_topology \<Rightarrow> 'b :: ccpo_topology)"
  shows "f \<midarrow>l\<rightarrow> f l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>l\<rightarrow> f l
[PROOF STEP]
proof (intro tendsto_ccpoI conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>C. \<lbrakk>chain C; C \<noteq> {}\<rbrakk> \<Longrightarrow> chain (f ` C)
 2. \<And>C. \<lbrakk>chain C; C \<noteq> {}\<rbrakk> \<Longrightarrow> f (\<Squnion> C) = \<Squnion> (f ` C)
[PROOF STEP]
fix C :: "'a set"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>C. \<lbrakk>chain C; C \<noteq> {}\<rbrakk> \<Longrightarrow> chain (f ` C)
 2. \<And>C. \<lbrakk>chain C; C \<noteq> {}\<rbrakk> \<Longrightarrow> f (\<Squnion> C) = \<Squnion> (f ` C)
[PROOF STEP]
assume C: "chain C" "C \<noteq> {}"
[PROOF STATE]
proof (state)
this:
chain C
C \<noteq> {}

goal (2 subgoals):
 1. \<And>C. \<lbrakk>chain C; C \<noteq> {}\<rbrakk> \<Longrightarrow> chain (f ` C)
 2. \<And>C. \<lbrakk>chain C; C \<noteq> {}\<rbrakk> \<Longrightarrow> f (\<Squnion> C) = \<Squnion> (f ` C)
[PROOF STEP]
show "chain (f`C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chain (f ` C)
[PROOF STEP]
using mcont
[PROOF STATE]
proof (prove)
using this:
mcont Sup (\<le>) Sup (\<le>) f

goal (1 subgoal):
 1. chain (f ` C)
[PROOF STEP]
by (intro chain_imageI[where le_a="(\<le>)"] C) (simp add: mcont_def monotone_def)
[PROOF STATE]
proof (state)
this:
chain (f ` C)

goal (1 subgoal):
 1. \<And>C. \<lbrakk>chain C; C \<noteq> {}\<rbrakk> \<Longrightarrow> f (\<Squnion> C) = \<Squnion> (f ` C)
[PROOF STEP]
show "f (\<Squnion>C) = \<Squnion>(f ` C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (\<Squnion> C) = \<Squnion> (f ` C)
[PROOF STEP]
using mcont C
[PROOF STATE]
proof (prove)
using this:
mcont Sup (\<le>) Sup (\<le>) f
chain C
C \<noteq> {}

goal (1 subgoal):
 1. f (\<Squnion> C) = \<Squnion> (f ` C)
[PROOF STEP]
by (simp add: mcont_def cont_def)
[PROOF STATE]
proof (state)
this:
f (\<Squnion> C) = \<Squnion> (f ` C)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma simple_bochner_integral_diff:
  assumes f: "simple_bochner_integrable M f" and g: "simple_bochner_integrable M g"
  shows "simple_bochner_integral M (\<lambda>x. f x - g x) =
    simple_bochner_integral M f - simple_bochner_integral M g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simple_bochner_integral M (\<lambda>x. f x - g x) = simple_bochner_integral M f - simple_bochner_integral M g
[PROOF STEP]
unfolding diff_conv_add_uminus
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simple_bochner_integral M (\<lambda>x. f x + - g x) = simple_bochner_integral M f + - simple_bochner_integral M g
[PROOF STEP]
using f g
[PROOF STATE]
proof (prove)
using this:
simple_bochner_integrable M f
simple_bochner_integrable M g

goal (1 subgoal):
 1. simple_bochner_integral M (\<lambda>x. f x + - g x) = simple_bochner_integral M f + - simple_bochner_integral M g
[PROOF STEP]
by (subst simple_bochner_integral_add)
     (auto simp: simple_bochner_integral_minus simple_bochner_integrable_compose2[where p="\<lambda>x y. - y"])


[STATEMENT]
theorem (in group) subgroups_partial_order:
  "partial_order \<lparr>carrier = {H. subgroup H G}, eq = (=), le = (\<subseteq>)\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partial_order \<lparr>carrier = {H. subgroup H G}, eq = (=), le = (\<subseteq>)\<rparr>
[PROOF STEP]
by standard simp_all


[STATEMENT]
lemma summable_iff_shift [simp]: "summable (\<lambda>n. f (n + k)) \<longleftrightarrow> summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. f (n + k)) = summable f
[PROOF STEP]
by (metis diff_add_cancel summable_def sums_iff_shift [abs_def])


[STATEMENT]
lemma fds_nth_power_Suc_0 [simp]: "fds_nth (f ^ n) (Suc 0) = fds_nth f (Suc 0) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (f ^ n) (Suc 0) = fds_nth f (Suc 0) ^ n
[PROOF STEP]
by (induction n) simp_all


[STATEMENT]
lemma fpxs_const_diff [simp]: "fpxs_const (x - y) = fpxs_const x - fpxs_const y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fpxs_const (x - y) = fpxs_const x - fpxs_const y
[PROOF STEP]
unfolding minus_fpxs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fpxs_const (x - y) = fpxs_const x + - fpxs_const y
[PROOF STEP]
by transfer auto


[STATEMENT]
lemma finite_reach\<^sub>t:
  assumes "finite (reach \<Sigma> \<delta> q\<^sub>0)"
  assumes "finite \<Sigma>"
  shows "finite (reach\<^sub>t \<Sigma> \<delta> q\<^sub>0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (reach\<^sub>t \<Sigma> \<delta> q\<^sub>0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (reach\<^sub>t \<Sigma> \<delta> q\<^sub>0)
[PROOF STEP]
have "reach\<^sub>t \<Sigma> \<delta> q\<^sub>0 \<subseteq> reach \<Sigma> \<delta> q\<^sub>0 \<times> \<Sigma> \<times> reach \<Sigma> \<delta> q\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reach\<^sub>t \<Sigma> \<delta> q\<^sub>0 \<subseteq> reach \<Sigma> \<delta> q\<^sub>0 \<times> \<Sigma> \<times> reach \<Sigma> \<delta> q\<^sub>0
[PROOF STEP]
unfolding reach\<^sub>t_def reach_def run\<^sub>t.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(run \<delta> q\<^sub>0 w n, w n, run \<delta> q\<^sub>0 w (Suc n)) |w n. range w \<subseteq> \<Sigma>} \<subseteq> {run \<delta> q\<^sub>0 w n |w n. range w \<subseteq> \<Sigma>} \<times> \<Sigma> \<times> {run \<delta> q\<^sub>0 w n |w n. range w \<subseteq> \<Sigma>}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
reach\<^sub>t \<Sigma> \<delta> q\<^sub>0 \<subseteq> reach \<Sigma> \<delta> q\<^sub>0 \<times> \<Sigma> \<times> reach \<Sigma> \<delta> q\<^sub>0

goal (1 subgoal):
 1. finite (reach\<^sub>t \<Sigma> \<delta> q\<^sub>0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
reach\<^sub>t \<Sigma> \<delta> q\<^sub>0 \<subseteq> reach \<Sigma> \<delta> q\<^sub>0 \<times> \<Sigma> \<times> reach \<Sigma> \<delta> q\<^sub>0

goal (1 subgoal):
 1. finite (reach\<^sub>t \<Sigma> \<delta> q\<^sub>0)
[PROOF STEP]
using assms finite_subset
[PROOF STATE]
proof (prove)
using this:
reach\<^sub>t \<Sigma> \<delta> q\<^sub>0 \<subseteq> reach \<Sigma> \<delta> q\<^sub>0 \<times> \<Sigma> \<times> reach \<Sigma> \<delta> q\<^sub>0
finite (reach \<Sigma> \<delta> q\<^sub>0)
finite \<Sigma>
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite (reach\<^sub>t \<Sigma> \<delta> q\<^sub>0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (reach\<^sub>t \<Sigma> \<delta> q\<^sub>0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma formulaEntailsLiteralSubset:
  fixes formula :: Formula and formula' :: Formula and literal :: Literal
  assumes "formulaEntailsLiteral formula literal" and "\<forall> (c::Clause) . c el formula \<longrightarrow> c el formula'"
  shows "formulaEntailsLiteral formula' literal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. formulaEntailsLiteral formula' literal
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. formulaEntailsLiteral formula' literal
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. formulaEntailsLiteral formula' literal
[PROOF STEP]
fix valuation :: Valuation
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. formulaEntailsLiteral formula' literal
[PROOF STEP]
assume modelF': "model valuation formula'"
[PROOF STATE]
proof (state)
this:
model valuation formula'

goal (1 subgoal):
 1. formulaEntailsLiteral formula' literal
[PROOF STEP]
with \<open>\<forall> (c::Clause) . c el formula \<longrightarrow> c el formula'\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>c. c el formula \<longrightarrow> c el formula'
model valuation formula'
[PROOF STEP]
have "formulaTrue formula valuation"
[PROOF STATE]
proof (prove)
using this:
\<forall>c. c el formula \<longrightarrow> c el formula'
model valuation formula'

goal (1 subgoal):
 1. formulaTrue formula valuation
[PROOF STEP]
by (auto simp add: formulaTrueIffAllClausesAreTrue)
[PROOF STATE]
proof (state)
this:
formulaTrue formula valuation

goal (1 subgoal):
 1. formulaEntailsLiteral formula' literal
[PROOF STEP]
with modelF' \<open>formulaEntailsLiteral formula literal\<close>
[PROOF STATE]
proof (chain)
picking this:
model valuation formula'
formulaEntailsLiteral formula literal
formulaTrue formula valuation
[PROOF STEP]
have "literalTrue literal valuation"
[PROOF STATE]
proof (prove)
using this:
model valuation formula'
formulaEntailsLiteral formula literal
formulaTrue formula valuation

goal (1 subgoal):
 1. literalTrue literal valuation
[PROOF STEP]
by (simp add: formulaEntailsLiteral_def)
[PROOF STATE]
proof (state)
this:
literalTrue literal valuation

goal (1 subgoal):
 1. formulaEntailsLiteral formula' literal
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
model ?valuation2 formula' \<Longrightarrow> literalTrue literal ?valuation2

goal (1 subgoal):
 1. formulaEntailsLiteral formula' literal
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
model ?valuation2 formula' \<Longrightarrow> literalTrue literal ?valuation2

goal (1 subgoal):
 1. formulaEntailsLiteral formula' literal
[PROOF STEP]
by (simp add:formulaEntailsLiteral_def)
[PROOF STATE]
proof (state)
this:
formulaEntailsLiteral formula' literal

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_at_Inf_mono:
  fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
    'b::{linorder_topology,conditionally_complete_linorder}"
  assumes "mono f"
    and cont: "continuous (at_right (Inf S)) f"
    and S: "S \<noteq> {}" "bdd_below S"
  shows "f (Inf S) = (INF s\<in>S. f s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (Inf S) = Inf (f ` S)
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f (Inf S) \<le> Inf (f ` S)
 2. Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
have f: "(f \<longlongrightarrow> f (Inf S)) (at_right (Inf S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> f (Inf S)) (at_right (Inf S))
[PROOF STEP]
using cont
[PROOF STATE]
proof (prove)
using this:
continuous (at_right (Inf S)) f

goal (1 subgoal):
 1. (f \<longlongrightarrow> f (Inf S)) (at_right (Inf S))
[PROOF STEP]
unfolding continuous_within
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> f (Inf S)) (at_right (Inf S))

goal (1 subgoal):
 1. (f \<longlongrightarrow> f (Inf S)) (at_right (Inf S))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> f (Inf S)) (at_right (Inf S))

goal (2 subgoals):
 1. f (Inf S) \<le> Inf (f ` S)
 2. Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
show "(INF s\<in>S. f s) \<le> f (Inf S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> Inf (f ` S) \<le> f (Inf S)
 2. \<not> ?P \<Longrightarrow> Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
assume "Inf S \<in> S"
[PROOF STATE]
proof (state)
this:
Inf S \<in> S

goal (2 subgoals):
 1. ?P \<Longrightarrow> Inf (f ` S) \<le> f (Inf S)
 2. \<not> ?P \<Longrightarrow> Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Inf S \<in> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Inf S \<in> S

goal (1 subgoal):
 1. Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
by (rule cINF_lower[rotated]) (auto intro: bdd_below_image_mono S \<open>mono f\<close>)
[PROOF STATE]
proof (state)
this:
Inf (f ` S) \<le> f (Inf S)

goal (1 subgoal):
 1. Inf S \<notin> S \<Longrightarrow> Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Inf S \<notin> S \<Longrightarrow> Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
assume "Inf S \<notin> S"
[PROOF STATE]
proof (state)
this:
Inf S \<notin> S

goal (1 subgoal):
 1. Inf S \<notin> S \<Longrightarrow> Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
from \<open>S \<noteq> {}\<close>
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
[PROOF STEP]
obtain s where "s \<in> S"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

goal (1 subgoal):
 1. (\<And>s. s \<in> S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s \<in> S

goal (1 subgoal):
 1. Inf S \<notin> S \<Longrightarrow> Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
with \<open>Inf S \<notin> S\<close> S
[PROOF STATE]
proof (chain)
picking this:
Inf S \<notin> S
S \<noteq> {}
bdd_below S
s \<in> S
[PROOF STEP]
have "Inf S < s"
[PROOF STATE]
proof (prove)
using this:
Inf S \<notin> S
S \<noteq> {}
bdd_below S
s \<in> S

goal (1 subgoal):
 1. Inf S < s
[PROOF STEP]
unfolding less_le
[PROOF STATE]
proof (prove)
using this:
Inf S \<notin> S
S \<noteq> {}
bdd_below S
s \<in> S

goal (1 subgoal):
 1. Inf S \<le> s \<and> Inf S \<noteq> s
[PROOF STEP]
by (blast intro: cInf_lower)
[PROOF STATE]
proof (state)
this:
Inf S < s

goal (1 subgoal):
 1. Inf S \<notin> S \<Longrightarrow> Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> Inf (f ` S) \<le> f (Inf S) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> ?thesis"
[PROOF STATE]
proof (state)
this:
\<not> Inf (f ` S) \<le> f (Inf S)

goal (1 subgoal):
 1. \<not> Inf (f ` S) \<le> f (Inf S) \<Longrightarrow> False
[PROOF STEP]
with order_tendstoD(2)[OF f, of "INF s\<in>S. f s"]
[PROOF STATE]
proof (chain)
picking this:
f (Inf S) < Inf (f ` S) \<Longrightarrow> \<forall>\<^sub>F x in at_right (Inf S). f x < Inf (f ` S)
\<not> Inf (f ` S) \<le> f (Inf S)
[PROOF STEP]
obtain b where "Inf S < b"
        and *: "\<And>y. Inf S < y \<Longrightarrow> y < b \<Longrightarrow> f y < (INF s\<in>S. f s)"
[PROOF STATE]
proof (prove)
using this:
f (Inf S) < Inf (f ` S) \<Longrightarrow> \<forall>\<^sub>F x in at_right (Inf S). f x < Inf (f ` S)
\<not> Inf (f ` S) \<le> f (Inf S)

goal (1 subgoal):
 1. (\<And>b. \<lbrakk>Inf S < b; \<And>y. \<lbrakk>Inf S < y; y < b\<rbrakk> \<Longrightarrow> f y < Inf (f ` S)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: not_le eventually_at_right[OF \<open>Inf S < s\<close>])
[PROOF STATE]
proof (state)
this:
Inf S < b
\<lbrakk>Inf S < ?y; ?y < b\<rbrakk> \<Longrightarrow> f ?y < Inf (f ` S)

goal (1 subgoal):
 1. \<not> Inf (f ` S) \<le> f (Inf S) \<Longrightarrow> False
[PROOF STEP]
with \<open>S \<noteq> {}\<close>
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
Inf S < b
\<lbrakk>Inf S < ?y; ?y < b\<rbrakk> \<Longrightarrow> f ?y < Inf (f ` S)
[PROOF STEP]
obtain c where "c \<in> S" "c < b"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
Inf S < b
\<lbrakk>Inf S < ?y; ?y < b\<rbrakk> \<Longrightarrow> f ?y < Inf (f ` S)

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> S; c < b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using cInf_lessD[of S b]
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
Inf S < b
\<lbrakk>Inf S < ?y; ?y < b\<rbrakk> \<Longrightarrow> f ?y < Inf (f ` S)
\<lbrakk>S \<noteq> {}; Inf S < b\<rbrakk> \<Longrightarrow> \<exists>x\<in>S. x < b

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

goal (1 subgoal):
 1. \<not> Inf (f ` S) \<le> f (Inf S) \<Longrightarrow> False
[PROOF STEP]
with \<open>Inf S \<notin> S\<close> S
[PROOF STATE]
proof (chain)
picking this:
Inf S \<notin> S
S \<noteq> {}
bdd_below S
c \<in> S
c < b
[PROOF STEP]
have "Inf S < c"
[PROOF STATE]
proof (prove)
using this:
Inf S \<notin> S
S \<noteq> {}
bdd_below S
c \<in> S
c < b

goal (1 subgoal):
 1. Inf S < c
[PROOF STEP]
unfolding less_le
[PROOF STATE]
proof (prove)
using this:
Inf S \<notin> S
S \<noteq> {}
bdd_below S
c \<in> S
c \<le> b \<and> c \<noteq> b

goal (1 subgoal):
 1. Inf S \<le> c \<and> Inf S \<noteq> c
[PROOF STEP]
by (blast intro: cInf_lower)
[PROOF STATE]
proof (state)
this:
Inf S < c

goal (1 subgoal):
 1. \<not> Inf (f ` S) \<le> f (Inf S) \<Longrightarrow> False
[PROOF STEP]
from *[OF \<open>Inf S < c\<close> \<open>c < b\<close>] cINF_lower[OF bdd_below_image_mono[of f] \<open>c \<in> S\<close>]
[PROOF STATE]
proof (chain)
picking this:
f c < Inf (f ` S)
\<lbrakk>mono f; bdd_below S\<rbrakk> \<Longrightarrow> Inf (f ` S) \<le> f c
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
f c < Inf (f ` S)
\<lbrakk>mono f; bdd_below S\<rbrakk> \<Longrightarrow> Inf (f ` S) \<le> f c

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Inf (f ` S) \<le> f (Inf S)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Inf (f ` S) \<le> f (Inf S)

goal (1 subgoal):
 1. f (Inf S) \<le> Inf (f ` S)
[PROOF STEP]
qed (intro cINF_greatest \<open>mono f\<close>[THEN monoD] cInf_lower \<open>bdd_below S\<close> \<open>S \<noteq> {}\<close>)


[STATEMENT]
lemma qbs_morphism_fst'':
  assumes "f \<in> X \<rightarrow>\<^sub>Q Y"
  shows "(\<lambda>k. f (fst k)) \<in> X \<Otimes>\<^sub>Q Z \<rightarrow>\<^sub>Q Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. f (fst k)) \<in> X \<Otimes>\<^sub>Q Z \<rightarrow>\<^sub>Q Y
[PROOF STEP]
using qbs_morphism_comp[OF fst_qbs_morphism assms,of Z]
[PROOF STATE]
proof (prove)
using this:
f \<circ> fst \<in> X \<Otimes>\<^sub>Q Z \<rightarrow>\<^sub>Q Y

goal (1 subgoal):
 1. (\<lambda>k. f (fst k)) \<in> X \<Otimes>\<^sub>Q Z \<rightarrow>\<^sub>Q Y
[PROOF STEP]
by(simp add: comp_def)


[STATEMENT]
lemma multiset_induct'[case_names empty add]: "\<lbrakk>P {#}; \<And>M x. P M \<Longrightarrow> P ({#x#}+M)\<rbrakk> \<Longrightarrow> P M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P {#}; \<And>M x. P M \<Longrightarrow> P ({#x#} + M)\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
by (induct rule: multiset_induct) (auto simp add: union_commute)


[STATEMENT]
lemma subset_fSuc:
  assumes f: "\<And> u. f u \<subseteq> f (Suc u)"
  shows "u \<le> v \<Longrightarrow> f u \<subseteq> f v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<le> v \<Longrightarrow> f u \<subseteq> f v
[PROOF STEP]
apply (case_tac "u < v")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>u \<le> v; u < v\<rbrakk> \<Longrightarrow> f u \<subseteq> f v
 2. \<lbrakk>u \<le> v; \<not> u < v\<rbrakk> \<Longrightarrow> f u \<subseteq> f v
[PROOF STEP]
apply (rule subset_fSuc_strict[where f=f, OF f])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>u \<le> v; u < v\<rbrakk> \<Longrightarrow> u < v
 2. \<lbrakk>u \<le> v; \<not> u < v\<rbrakk> \<Longrightarrow> f u \<subseteq> f v
[PROOF STEP]
by auto


[STATEMENT]
lemma less_trans:
  assumes "x <\<^sub>a y" and "y <\<^sub>a z"
  shows "x <\<^sub>a z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x <\<^sub>a z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x <\<^sub>a y
y <\<^sub>a z

goal (1 subgoal):
 1. x <\<^sub>a z
[PROOF STEP]
by (auto simp: less_le_not_le intro: order_trans)


[STATEMENT]
lemma tendsto_power_int [tendsto_intros]:
  fixes a :: "'a::real_normed_div_algebra"
  assumes f: "(f \<longlongrightarrow> a) F"
    and a: "a \<noteq> 0"
  shows "((\<lambda>x. power_int (f x) n) \<longlongrightarrow> power_int a n) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x powi n) \<longlongrightarrow> a powi n) F
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> a) F
a \<noteq> (0::'a)

goal (1 subgoal):
 1. ((\<lambda>x. f x powi n) \<longlongrightarrow> a powi n) F
[PROOF STEP]
by (cases n rule: int_cases4) (auto intro!: tendsto_intros simp: power_int_minus)


[STATEMENT]
lemma isomorphic_cards:
  assumes "G\<^sub>1 \<simeq> G\<^sub>2"
  shows
    "card (uverts G\<^sub>1) = card (uverts G\<^sub>2)" (is "?V")
    "card (uedges G\<^sub>1) = card (uedges G\<^sub>2)" (is "?E")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (uverts G\<^sub>1) = card (uverts G\<^sub>2) &&& card (uedges G\<^sub>1) = card (uedges G\<^sub>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card (uverts G\<^sub>1) = card (uverts G\<^sub>2)
 2. card (uedges G\<^sub>1) = card (uedges G\<^sub>2)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
G\<^sub>1 \<simeq> G\<^sub>2
[PROOF STEP]
obtain f where
    bij: "bij_betw f (uverts G\<^sub>1) (uverts G\<^sub>2)" and
    map: "G\<^sub>2 = map_ugraph f G\<^sub>1"
[PROOF STATE]
proof (prove)
using this:
G\<^sub>1 \<simeq> G\<^sub>2

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>bij_betw f (uverts G\<^sub>1) (uverts G\<^sub>2); G\<^sub>2 = map_ugraph f G\<^sub>1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding isomorphism_def
[PROOF STATE]
proof (prove)
using this:
uwellformed G\<^sub>1 \<and> uwellformed G\<^sub>2 \<and> (\<exists>f. bij_betw f (uverts G\<^sub>1) (uverts G\<^sub>2) \<and> G\<^sub>2 = map_ugraph f G\<^sub>1)

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>bij_betw f (uverts G\<^sub>1) (uverts G\<^sub>2); G\<^sub>2 = map_ugraph f G\<^sub>1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bij_betw f (uverts G\<^sub>1) (uverts G\<^sub>2)
G\<^sub>2 = map_ugraph f G\<^sub>1

goal (2 subgoals):
 1. card (uverts G\<^sub>1) = card (uverts G\<^sub>2)
 2. card (uedges G\<^sub>1) = card (uedges G\<^sub>2)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
G\<^sub>1 \<simeq> G\<^sub>2
[PROOF STEP]
have wellformed: "uwellformed G\<^sub>1" "uwellformed G\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
G\<^sub>1 \<simeq> G\<^sub>2

goal (1 subgoal):
 1. uwellformed G\<^sub>1 &&& uwellformed G\<^sub>2
[PROOF STEP]
by simp+
[PROOF STATE]
proof (state)
this:
uwellformed G\<^sub>1
uwellformed G\<^sub>2

goal (2 subgoals):
 1. card (uverts G\<^sub>1) = card (uverts G\<^sub>2)
 2. card (uedges G\<^sub>1) = card (uedges G\<^sub>2)
[PROOF STEP]
show ?V
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (uverts G\<^sub>1) = card (uverts G\<^sub>2)
[PROOF STEP]
by (rule bij_betw_same_card[OF bij])
[PROOF STATE]
proof (state)
this:
card (uverts G\<^sub>1) = card (uverts G\<^sub>2)

goal (1 subgoal):
 1. card (uedges G\<^sub>1) = card (uedges G\<^sub>2)
[PROOF STEP]
let ?g = "\<lambda>e. f ` e"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (uedges G\<^sub>1) = card (uedges G\<^sub>2)
[PROOF STEP]
have "bij_betw ?g (Pow (uverts G\<^sub>1)) (Pow (uverts G\<^sub>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((`) f) (Pow (uverts G\<^sub>1)) (Pow (uverts G\<^sub>2))
[PROOF STEP]
by (rule bij_lift[OF bij])
[PROOF STATE]
proof (state)
this:
bij_betw ((`) f) (Pow (uverts G\<^sub>1)) (Pow (uverts G\<^sub>2))

goal (1 subgoal):
 1. card (uedges G\<^sub>1) = card (uedges G\<^sub>2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bij_betw ((`) f) (Pow (uverts G\<^sub>1)) (Pow (uverts G\<^sub>2))

goal (1 subgoal):
 1. card (uedges G\<^sub>1) = card (uedges G\<^sub>2)
[PROOF STEP]
have "uedges G\<^sub>1 \<subseteq> Pow (uverts G\<^sub>1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uedges G\<^sub>1 \<subseteq> Pow (uverts G\<^sub>1)
[PROOF STEP]
using wellformed(1)
[PROOF STATE]
proof (prove)
using this:
uwellformed G\<^sub>1

goal (1 subgoal):
 1. uedges G\<^sub>1 \<subseteq> Pow (uverts G\<^sub>1)
[PROOF STEP]
unfolding uwellformed_def
[PROOF STATE]
proof (prove)
using this:
\<forall>e\<in>uedges G\<^sub>1. card e = 2 \<and> (\<forall>u\<in>e. u \<in> uverts G\<^sub>1)

goal (1 subgoal):
 1. uedges G\<^sub>1 \<subseteq> Pow (uverts G\<^sub>1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
uedges G\<^sub>1 \<subseteq> Pow (uverts G\<^sub>1)

goal (1 subgoal):
 1. card (uedges G\<^sub>1) = card (uedges G\<^sub>2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bij_betw ((`) f) (Pow (uverts G\<^sub>1)) (Pow (uverts G\<^sub>2))
uedges G\<^sub>1 \<subseteq> Pow (uverts G\<^sub>1)
[PROOF STEP]
have "card (?g ` uedges G\<^sub>1) = card (uedges G\<^sub>1)"
[PROOF STATE]
proof (prove)
using this:
bij_betw ((`) f) (Pow (uverts G\<^sub>1)) (Pow (uverts G\<^sub>2))
uedges G\<^sub>1 \<subseteq> Pow (uverts G\<^sub>1)

goal (1 subgoal):
 1. card ((`) f ` uedges G\<^sub>1) = card (uedges G\<^sub>1)
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj_on ((`) f) (Pow (uverts G\<^sub>1)) \<and> (`) f ` Pow (uverts G\<^sub>1) = Pow (uverts G\<^sub>2)
uedges G\<^sub>1 \<subseteq> Pow (uverts G\<^sub>1)

goal (1 subgoal):
 1. card ((`) f ` uedges G\<^sub>1) = card (uedges G\<^sub>1)
[PROOF STEP]
by (metis card_inj_subs)
[PROOF STATE]
proof (state)
this:
card ((`) f ` uedges G\<^sub>1) = card (uedges G\<^sub>1)

goal (1 subgoal):
 1. card (uedges G\<^sub>1) = card (uedges G\<^sub>2)
[PROOF STEP]
thus ?E
[PROOF STATE]
proof (prove)
using this:
card ((`) f ` uedges G\<^sub>1) = card (uedges G\<^sub>1)

goal (1 subgoal):
 1. card (uedges G\<^sub>1) = card (uedges G\<^sub>2)
[PROOF STEP]
by (metis map map_ugraph.simps snd_conv surjective_pairing)
[PROOF STATE]
proof (state)
this:
card (uedges G\<^sub>1) = card (uedges G\<^sub>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integrable_if_qbs_integrable:
  assumes "qbs_integrable (s::'a qbs_prob_space) f"
  shows "integrable (qbs_prob_measure s) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (qbs_prob_measure s) f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
qbs_integrable s f

goal (1 subgoal):
 1. integrable (qbs_prob_measure s) f
[PROOF STEP]
by(simp add: qbs_integrable_iff_integrable)


[STATEMENT]
lemma index_zip_replicate1[simp]: "index (zip (replicate d a) bs) (a, b) = index bs b"
  if "d = length bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. index (zip (replicate d a) bs) (a, b) = index bs b
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
d = length bs

goal (1 subgoal):
 1. index (zip (replicate d a) bs) (a, b) = index bs b
[PROOF STEP]
by (induction bs arbitrary: d) auto


[STATEMENT]
lemma ra_1: "(x \<cdot> y ; 1) ; z = x ; z \<cdot> y ; 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<cdot> y ; 1) ; z = x ; z \<cdot> y ; 1
[PROOF STEP]
proof (rule order.antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (x \<cdot> y ; 1) ; z \<le> x ; z \<cdot> y ; 1
 2. x ; z \<cdot> y ; 1 \<le> (x \<cdot> y ; 1) ; z
[PROOF STEP]
show "x ; z \<cdot> y ; 1 \<le> (x \<cdot> y ; 1) ; z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ; z \<cdot> y ; 1 \<le> (x \<cdot> y ; 1) ; z
[PROOF STEP]
by (metis modular_2_var comp_assoc order_trans eq_refl inf_mono inf_top_left mult_isor mult_subdistl)
[PROOF STATE]
proof (state)
this:
x ; z \<cdot> y ; 1 \<le> (x \<cdot> y ; 1) ; z

goal (1 subgoal):
 1. (x \<cdot> y ; 1) ; z \<le> x ; z \<cdot> y ; 1
[PROOF STEP]
show "(x \<cdot> y ; 1) ; z \<le> x ; z \<cdot> y ; 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<cdot> y ; 1) ; z \<le> x ; z \<cdot> y ; 1
[PROOF STEP]
by (metis inf.commute inf_greatest inf_top_left mult.assoc mult_subdistl mult_subdistr order_trans)
[PROOF STATE]
proof (state)
this:
(x \<cdot> y ; 1) ; z \<le> x ; z \<cdot> y ; 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<psi>_minus_\<theta>_bigo: "(\<lambda>x. \<psi> x - \<theta> x) \<in> O(\<lambda>x. ln x * sqrt x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<psi> x - \<theta> x) \<in> O(\<lambda>x. ln x * sqrt x)
[PROOF STEP]
proof (intro bigoI[of _ "2"] eventually_mono[OF eventually_ge_at_top[of 2]])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. 2 \<le> x \<Longrightarrow> norm (\<psi> x - \<theta> x) \<le> 2 * norm (ln x * sqrt x)
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. 2 \<le> x \<Longrightarrow> norm (\<psi> x - \<theta> x) \<le> 2 * norm (ln x * sqrt x)
[PROOF STEP]
assume "x \<ge> 2"
[PROOF STATE]
proof (state)
this:
2 \<le> x

goal (1 subgoal):
 1. \<And>x. 2 \<le> x \<Longrightarrow> norm (\<psi> x - \<theta> x) \<le> 2 * norm (ln x * sqrt x)
[PROOF STEP]
thus "norm (\<psi> x - \<theta> x) \<le> 2 * norm (ln x * sqrt x)"
[PROOF STATE]
proof (prove)
using this:
2 \<le> x

goal (1 subgoal):
 1. norm (\<psi> x - \<theta> x) \<le> 2 * norm (ln x * sqrt x)
[PROOF STEP]
using \<psi>_minus_\<theta>_bound[of x] \<theta>_le_\<psi>[of x]
[PROOF STATE]
proof (prove)
using this:
2 \<le> x
2 \<le> x \<Longrightarrow> \<psi> x - \<theta> x \<le> 2 * ln x * sqrt x
\<theta> x \<le> \<psi> x

goal (1 subgoal):
 1. norm (\<psi> x - \<theta> x) \<le> 2 * norm (ln x * sqrt x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (\<psi> x - \<theta> x) \<le> 2 * norm (ln x * sqrt x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_mpoly_map_vars:
  fixes f :: "nat \<Rightarrow> nat" and p :: "'a :: zero mpoly"
  assumes "bij f"
  shows   "MPoly_Type.coeff (mpoly_map_vars f p) mon =
             MPoly_Type.coeff p (permutep f mon)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeff (mpoly_map_vars f p) mon = MPoly_Type.coeff p (permutep f mon)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bij f

goal (1 subgoal):
 1. MPoly_Type.coeff (mpoly_map_vars f p) mon = MPoly_Type.coeff p (permutep f mon)
[PROOF STEP]
by transfer' (simp add: lookup_permutep bij_permutep)


[STATEMENT]
lemma size_eq_card_implies_surj_on:
  assumes "finite A" "finite B"
  assumes "size N = card B"
  assumes "f \<in> functions_of A B N"
  shows   "f ` A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
from \<open>f \<in> functions_of A B N\<close>
[PROOF STATE]
proof (chain)
picking this:
f \<in> Twelvefold_Way_Entry10.functions_of A B N
[PROOF STEP]
have "f \<in> A \<rightarrow>\<^sub>E B" and
    "N = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))"
[PROOF STATE]
proof (prove)
using this:
f \<in> Twelvefold_Way_Entry10.functions_of A B N

goal (1 subgoal):
 1. f \<in> A \<rightarrow>\<^sub>E B &&& N = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))
[PROOF STEP]
unfolding functions_of_def
[PROOF STATE]
proof (prove)
using this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N}

goal (1 subgoal):
 1. f \<in> A \<rightarrow>\<^sub>E B &&& N = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f \<in> A \<rightarrow>\<^sub>E B
N = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))

goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
from this \<open>size N = card B\<close>
[PROOF STATE]
proof (chain)
picking this:
f \<in> A \<rightarrow>\<^sub>E B
N = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))
size N = card B
[PROOF STEP]
have "card ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}) = card B"
[PROOF STATE]
proof (prove)
using this:
f \<in> A \<rightarrow>\<^sub>E B
N = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))
size N = card B

goal (1 subgoal):
 1. card ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}) = card B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}) = card B

goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
from this \<open>finite B\<close> \<open>f \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (chain)
picking this:
card ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}) = card B
finite B
f \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
show "f ` A = B"
[PROOF STATE]
proof (prove)
using this:
card ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}) = card B
finite B
f \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
using card_eq_implies_surjective_on
[PROOF STATE]
proof (prove)
using this:
card ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}) = card B
finite B
f \<in> A \<rightarrow>\<^sub>E B
\<lbrakk>finite ?B; ?f \<in> ?A \<rightarrow>\<^sub>E ?B; card ((\<lambda>b. {x \<in> ?A. ?f x = b}) ` ?B - {{}}) = card ?B\<rbrakk> \<Longrightarrow> ?f ` ?A = ?B

goal (1 subgoal):
 1. f ` A = B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f ` A = B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subset_val_process':
  assumes "finite A"
  and "support_set p \<subseteq> A"
shows "val_process Mkt p n w = (sum (\<lambda>x. ((prices Mkt) x n w) * (p x (Suc n) w)) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
have "portfolio p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. portfolio p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
support_set p \<subseteq> A

goal (1 subgoal):
 1. portfolio p
[PROOF STEP]
unfolding portfolio_def
[PROOF STATE]
proof (prove)
using this:
finite A
support_set p \<subseteq> A

goal (1 subgoal):
 1. finite (support_set p)
[PROOF STEP]
using finite_subset
[PROOF STATE]
proof (prove)
using this:
finite A
support_set p \<subseteq> A
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

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

goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
have "\<exists>C. (support_set p) \<inter> C = {} \<and> (support_set p) \<union> C = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>C. support_set p \<inter> C = {} \<and> support_set p \<union> C = A
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
support_set p \<subseteq> A

goal (1 subgoal):
 1. \<exists>C. support_set p \<inter> C = {} \<and> support_set p \<union> C = A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>C. support_set p \<inter> C = {} \<and> support_set p \<union> C = A

goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>C. support_set p \<inter> C = {} \<and> support_set p \<union> C = A
[PROOF STEP]
obtain C where "(support_set p) \<inter> C = {}" and "(support_set p) \<union> C = A"
[PROOF STATE]
proof (prove)
using this:
\<exists>C. support_set p \<inter> C = {} \<and> support_set p \<union> C = A

goal (1 subgoal):
 1. (\<And>C. \<lbrakk>support_set p \<inter> C = {}; support_set p \<union> C = A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
support_set p \<inter> C = {}
support_set p \<union> C = A

goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
note Cprops = this
[PROOF STATE]
proof (state)
this:
support_set p \<inter> C = {}
support_set p \<union> C = A

goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
have "finite C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite C
[PROOF STEP]
using assms \<open>(support_set p) \<union> C = A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
support_set p \<subseteq> A
support_set p \<union> C = A

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

goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
have "\<forall>x\<in> C. p x (Suc n) w = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>C. p x (Suc n) w = 0
[PROOF STEP]
using Cprops(1) support_set_def
[PROOF STATE]
proof (prove)
using this:
support_set p \<inter> C = {}
support_set ?p = {x. \<exists>n w. ?p x n w \<noteq> 0}

goal (1 subgoal):
 1. \<forall>x\<in>C. p x (Suc n) w = 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>C. p x (Suc n) w = 0

goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
hence "(\<Sum>x\<in> C. ((prices Mkt) x n w) * (p x (Suc n) w)) = 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>C. p x (Suc n) w = 0

goal (1 subgoal):
 1. (\<Sum>x\<in>C. prices Mkt x n w * p x (Suc n) w) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>C. prices Mkt x n w * p x (Suc n) w) = 0

goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
hence "val_process Mkt p n w = (\<Sum>x\<in> (support_set p). ((prices Mkt) x n w) * (p x (Suc n) w))
    + (\<Sum>x\<in> C. ((prices Mkt) x n w) * (p x (Suc n) w))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>C. prices Mkt x n w * p x (Suc n) w) = 0

goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>support_set p. prices Mkt x n w * p x (Suc n) w) + (\<Sum>x\<in>C. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
unfolding val_process_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>C. prices Mkt x n w * p x (Suc n) w) = 0

goal (1 subgoal):
 1. (if \<not> portfolio p then \<lambda>n w. 0 else (\<lambda>n w. \<Sum>x\<in>support_set p. prices Mkt x n w * p x (Suc n) w)) n w = (\<Sum>x\<in>support_set p. prices Mkt x n w * p x (Suc n) w) + (\<Sum>x\<in>C. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
using \<open>portfolio p\<close>
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>C. prices Mkt x n w * p x (Suc n) w) = 0
portfolio p

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

goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
val_process Mkt p n w = (\<Sum>x\<in>support_set p. prices Mkt x n w * p x (Suc n) w) + (\<Sum>x\<in>C. prices Mkt x n w * p x (Suc n) w)

goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
have "... = (\<Sum> x\<in> A. ((prices Mkt) x n w) * (p x (Suc n) w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>support_set p. prices Mkt x n w * p x (Suc n) w) + (\<Sum>x\<in>C. prices Mkt x n w * p x (Suc n) w) = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
using \<open>portfolio p\<close> \<open>finite C\<close> Cprops portfolio_def sum_union_disjoint'
[PROOF STATE]
proof (prove)
using this:
portfolio p
finite C
support_set p \<inter> C = {}
support_set p \<union> C = A
portfolio ?p = finite (support_set ?p)
\<lbrakk>finite ?A; finite ?B; ?A \<inter> ?B = {}; ?A \<union> ?B = ?C\<rbrakk> \<Longrightarrow> sum ?g ?C = sum ?g ?A + sum ?g ?B

goal (1 subgoal):
 1. (\<Sum>x\<in>support_set p. prices Mkt x n w * p x (Suc n) w) + (\<Sum>x\<in>C. prices Mkt x n w * p x (Suc n) w) = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
by (metis (no_types, lifting))
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>support_set p. prices Mkt x n w * p x (Suc n) w) + (\<Sum>x\<in>C. prices Mkt x n w * p x (Suc n) w) = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)

goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
show "val_process Mkt p n w = (\<Sum> x\<in> A. ((prices Mkt) x n w) * (p x (Suc n) w))"
[PROOF STATE]
proof (prove)
using this:
val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)

goal (1 subgoal):
 1. val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
val_process Mkt p n w = (\<Sum>x\<in>A. prices Mkt x n w * p x (Suc n) w)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_iff_shift [simp]: "summable (\<lambda>n. f (n + k)) \<longleftrightarrow> summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. f (n + k)) = summable f
[PROOF STEP]
by (metis diff_add_cancel summable_def sums_iff_shift [abs_def])


[STATEMENT]
lemma (in ring) sum_space_dim:
  assumes "subfield K R" "finite_dimension K E" "finite_dimension K F"
  shows "finite_dimension K (E <+>\<^bsub>R\<^esub> F)"
    and "((dim over K) (E <+>\<^bsub>R\<^esub> F)) = ((dim over K) E) + ((dim over K) F) - ((dim over K) (E \<inter> F))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_dimension K (E <+> F) &&& (local.dim over K) (E <+> F) = (local.dim over K) E + (local.dim over K) F - (local.dim over K) (E \<inter> F)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite_dimension K (E <+> F)
 2. (local.dim over K) (E <+> F) = (local.dim over K) E + (local.dim over K) F - (local.dim over K) (E \<inter> F)
[PROOF STEP]
obtain n m k where n: "dimension n K E" and m: "dimension m K F" and k: "dimension k K (E \<inter> F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n m k. \<lbrakk>dimension n K E; dimension m K F; dimension k K (E \<inter> F)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(2-3) subalbegra_incl_imp_finite_dimension[OF assms(1-2)
          subalgebra_inter[OF assms(2-3)[THEN finite_dimension_imp_subalgebra[OF assms(1)]]]]
[PROOF STATE]
proof (prove)
using this:
finite_dimension K E
finite_dimension K F
E \<inter> F \<subseteq> E \<Longrightarrow> finite_dimension K (E \<inter> F)

goal (1 subgoal):
 1. (\<And>n m k. \<lbrakk>dimension n K E; dimension m K F; dimension k K (E \<inter> F)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson inf_le1 finite_dimension_def)
[PROOF STATE]
proof (state)
this:
dimension n K E
dimension m K F
dimension k K (E \<inter> F)

goal (2 subgoals):
 1. finite_dimension K (E <+> F)
 2. (local.dim over K) (E <+> F) = (local.dim over K) E + (local.dim over K) F - (local.dim over K) (E \<inter> F)
[PROOF STEP]
hence "dimension (n + m - k) K (E <+>\<^bsub>R\<^esub> F)"
[PROOF STATE]
proof (prove)
using this:
dimension n K E
dimension m K F
dimension k K (E \<inter> F)

goal (1 subgoal):
 1. dimension (n + m - k) K (E <+> F)
[PROOF STEP]
using dimension_sum_space[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
dimension n K E
dimension m K F
dimension k K (E \<inter> F)
\<lbrakk>dimension ?n K ?E; dimension ?m K ?F; dimension ?k K (?E \<inter> ?F)\<rbrakk> \<Longrightarrow> dimension (?n + ?m - ?k) K (?E <+> ?F)

goal (1 subgoal):
 1. dimension (n + m - k) K (E <+> F)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dimension (n + m - k) K (E <+> F)

goal (2 subgoals):
 1. finite_dimension K (E <+> F)
 2. (local.dim over K) (E <+> F) = (local.dim over K) E + (local.dim over K) F - (local.dim over K) (E \<inter> F)
[PROOF STEP]
thus "finite_dimension K (E <+>\<^bsub>R\<^esub> F)"
   and "((dim over K) (E <+>\<^bsub>R\<^esub> F)) = ((dim over K) E) + ((dim over K) F) - ((dim over K) (E \<inter> F))"
[PROOF STATE]
proof (prove)
using this:
dimension (n + m - k) K (E <+> F)

goal (1 subgoal):
 1. finite_dimension K (E <+> F) &&& (local.dim over K) (E <+> F) = (local.dim over K) E + (local.dim over K) F - (local.dim over K) (E \<inter> F)
[PROOF STEP]
using finite_dimensionI dimI[OF assms(1)] n m k
[PROOF STATE]
proof (prove)
using this:
dimension (n + m - k) K (E <+> F)
dimension ?n ?K ?E \<Longrightarrow> finite_dimension ?K ?E
dimension ?n K ?E \<Longrightarrow> (local.dim over K) ?E = ?n
dimension n K E
dimension m K F
dimension k K (E \<inter> F)

goal (1 subgoal):
 1. finite_dimension K (E <+> F) &&& (local.dim over K) (E <+> F) = (local.dim over K) E + (local.dim over K) F - (local.dim over K) (E \<inter> F)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite_dimension K (E <+> F)
(local.dim over K) (E <+> F) = (local.dim over K) E + (local.dim over K) F - (local.dim over K) (E \<inter> F)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subset_singleton_iff_lepoll: "(\<exists>x. S \<subseteq> {x}) \<longleftrightarrow> S \<lesssim> {()}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. S \<subseteq> {x}) = (S \<lesssim> {()})
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. S \<subseteq> {x} \<Longrightarrow> S \<lesssim> {()}
 2. S \<lesssim> {()} \<Longrightarrow> \<exists>x. S \<subseteq> {x}
[PROOF STEP]
show "S \<lesssim> {()}" if "S \<subseteq> {x}" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<lesssim> {()}
[PROOF STEP]
using subset_imp_lepoll [OF that]
[PROOF STATE]
proof (prove)
using this:
S \<lesssim> {x}

goal (1 subgoal):
 1. S \<lesssim> {()}
[PROOF STEP]
by (simp add: singleton_eqpoll lepoll_trans2)
[PROOF STATE]
proof (state)
this:
S \<subseteq> {?x} \<Longrightarrow> S \<lesssim> {()}

goal (1 subgoal):
 1. S \<lesssim> {()} \<Longrightarrow> \<exists>x. S \<subseteq> {x}
[PROOF STEP]
show "\<exists>x. S \<subseteq> {x}" if "S \<lesssim> {()}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. S \<subseteq> {x}
[PROOF STEP]
by (metis (no_types, opaque_lifting) image_empty image_insert lepoll_iff that)
[PROOF STATE]
proof (state)
this:
S \<lesssim> {()} \<Longrightarrow> \<exists>x. S \<subseteq> {x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_ge_0_int: "prime p \<Longrightarrow> p \<ge> (0::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> 0 \<le> p
[PROOF STEP]
using prime_ge_2_int [of p]
[PROOF STATE]
proof (prove)
using this:
prime p \<Longrightarrow> 2 \<le> p

goal (1 subgoal):
 1. prime p \<Longrightarrow> 0 \<le> p
[PROOF STEP]
by simp


[STATEMENT]
lemma LeadsTo_le_imp_pfixGe:
     "\<forall>z. F \<in> {s. z \<le> f s} LeadsTo {s. z \<le> g s}
      ==> F \<in> {s. z pfixGe f s} LeadsTo {s. z pfixGe g s}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>z. F \<in> {s. z \<le> f s} \<longmapsto>w {s. z \<le> g s} \<Longrightarrow> F \<in> {s. z pfixGe f s} \<longmapsto>w {s. z pfixGe g s}
[PROOF STEP]
apply (rule single_LeadsTo_I)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. \<lbrakk>\<forall>z. F \<in> {s. z \<le> f s} \<longmapsto>w {s. z \<le> g s}; s \<in> {s. z pfixGe f s}\<rbrakk> \<Longrightarrow> F \<in> {s} \<longmapsto>w {s. z pfixGe g s}
[PROOF STEP]
apply (drule_tac x = "f s" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. \<lbrakk>s \<in> {s. z pfixGe f s}; F \<in> {sa. f s \<le> f sa} \<longmapsto>w {sa. f s \<le> g sa}\<rbrakk> \<Longrightarrow> F \<in> {s} \<longmapsto>w {s. z pfixGe g s}
[PROOF STEP]
apply (erule LeadsTo_weaken)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>s. s \<in> {s. z pfixGe f s} \<Longrightarrow> {s} \<subseteq> {sa. f s \<le> f sa}
 2. \<And>s. s \<in> {s. z pfixGe f s} \<Longrightarrow> {sa. f s \<le> g sa} \<subseteq> {s. z pfixGe g s}
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>s. s \<in> {s. z pfixGe f s} \<Longrightarrow> {sa. f s \<le> g sa} \<subseteq> {s. z pfixGe g s}
 2. \<And>s. s \<in> {s. z pfixGe f s} \<Longrightarrow> {s} \<subseteq> {sa. f s \<le> f sa}
[PROOF STEP]
apply (blast intro: trans_Ge [THEN trans_genPrefix, THEN transD]
                     prefix_imp_pfixGe, blast)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma totient_even:
  assumes "n > 2"
  shows   "even (totient n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (totient n)
[PROOF STEP]
proof (cases "\<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n

goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n
[PROOF STEP]
obtain p where p: "prime p" "p \<noteq> 2" "p dvd n"
[PROOF STATE]
proof (prove)
using this:
\<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; p \<noteq> 2; p dvd n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime p
p \<noteq> 2
p dvd n

goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
from \<open>p \<noteq> 2\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 2
[PROOF STEP]
have "p = 0 \<or> p = 1 \<or> p > 2"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 2

goal (1 subgoal):
 1. p = 0 \<or> p = 1 \<or> 2 < p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = 0 \<or> p = 1 \<or> 2 < p

goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
with p(1)
[PROOF STATE]
proof (chain)
picking this:
prime p
p = 0 \<or> p = 1 \<or> 2 < p
[PROOF STEP]
have "odd p"
[PROOF STATE]
proof (prove)
using this:
prime p
p = 0 \<or> p = 1 \<or> 2 < p

goal (1 subgoal):
 1. odd p
[PROOF STEP]
using prime_odd_nat[of p]
[PROOF STATE]
proof (prove)
using this:
prime p
p = 0 \<or> p = 1 \<or> 2 < p
\<lbrakk>prime p; 2 < p\<rbrakk> \<Longrightarrow> odd p

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

goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
define k where "k = multiplicity p n"
[PROOF STATE]
proof (state)
this:
k = multiplicity p n

goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
from p assms
[PROOF STATE]
proof (chain)
picking this:
prime p
p \<noteq> 2
p dvd n
2 < n
[PROOF STEP]
have k_pos: "k > 0"
[PROOF STATE]
proof (prove)
using this:
prime p
p \<noteq> 2
p dvd n
2 < n

goal (1 subgoal):
 1. 0 < k
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
using this:
prime p
p \<noteq> 2
p dvd n
2 < n

goal (1 subgoal):
 1. 0 < multiplicity p n
[PROOF STEP]
by (subst multiplicity_gt_zero_iff) auto
[PROOF STATE]
proof (state)
this:
0 < k

goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
have "p ^ k dvd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ k dvd n
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ multiplicity p n dvd n
[PROOF STEP]
by (simp add: multiplicity_dvd)
[PROOF STATE]
proof (state)
this:
p ^ k dvd n

goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p ^ k dvd n
[PROOF STEP]
obtain m where m: "n = p ^ k * m"
[PROOF STATE]
proof (prove)
using this:
p ^ k dvd n

goal (1 subgoal):
 1. (\<And>m. n = p ^ k * m \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim dvdE)
[PROOF STATE]
proof (state)
this:
n = p ^ k * m

goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
2 < n
n = p ^ k * m
[PROOF STEP]
have m_pos: "m > 0"
[PROOF STATE]
proof (prove)
using this:
2 < n
n = p ^ k * m

goal (1 subgoal):
 1. 0 < m
[PROOF STEP]
by (auto intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
0 < m

goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
from k_def m_pos p
[PROOF STATE]
proof (chain)
picking this:
k = multiplicity p n
0 < m
prime p
p \<noteq> 2
p dvd n
[PROOF STEP]
have "\<not> p dvd m"
[PROOF STATE]
proof (prove)
using this:
k = multiplicity p n
0 < m
prime p
p \<noteq> 2
p dvd n

goal (1 subgoal):
 1. \<not> p dvd m
[PROOF STEP]
by (subst (asm) m) (auto intro!: Nat.gr0I simp: prime_elem_multiplicity_mult_distrib
                          prime_elem_multiplicity_eq_zero_iff)
[PROOF STATE]
proof (state)
this:
\<not> p dvd m

goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
with \<open>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
prime p
\<not> p dvd m
[PROOF STEP]
have "coprime p m"
[PROOF STATE]
proof (prove)
using this:
prime p
\<not> p dvd m

goal (1 subgoal):
 1. coprime p m
[PROOF STEP]
by (rule prime_imp_coprime)
[PROOF STATE]
proof (state)
this:
coprime p m

goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
with \<open>k > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < k
coprime p m
[PROOF STEP]
have "coprime (p ^ k) m"
[PROOF STATE]
proof (prove)
using this:
0 < k
coprime p m

goal (1 subgoal):
 1. coprime (p ^ k) m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coprime (p ^ k) m

goal (2 subgoals):
 1. \<exists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
 2. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
coprime (p ^ k) m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coprime (p ^ k) m

goal (1 subgoal):
 1. even (totient n)
[PROOF STEP]
using p k_pos \<open>odd p\<close>
[PROOF STATE]
proof (prove)
using this:
coprime (p ^ k) m
prime p
p \<noteq> 2
p dvd n
0 < k
odd p

goal (1 subgoal):
 1. even (totient n)
[PROOF STEP]
by (auto simp add: m totient_mult_coprime totient_prime_power)
[PROOF STATE]
proof (state)
this:
even (totient n)

goal (1 subgoal):
 1. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n

goal (1 subgoal):
 1. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
2 < n
[PROOF STEP]
have "n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)"
[PROOF STATE]
proof (prove)
using this:
2 < n

goal (1 subgoal):
 1. n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)
[PROOF STEP]
by (intro Primes.prime_factorization_nat) auto
[PROOF STATE]
proof (state)
this:
n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)

goal (1 subgoal):
 1. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)

goal (1 subgoal):
 1. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
\<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n
[PROOF STEP]
have "\<dots> = (\<Prod>p\<in>prime_factors n. if p = 2 then 2 ^ multiplicity 2 n else 1)"
[PROOF STATE]
proof (prove)
using this:
\<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n

goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = (\<Prod>p\<in>prime_factors n. if p = 2 then 2 ^ multiplicity 2 n else 1)
[PROOF STEP]
by (intro prod.cong refl) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = (\<Prod>p\<in>prime_factors n. if p = 2 then 2 ^ multiplicity 2 n else 1)

goal (1 subgoal):
 1. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = (\<Prod>p\<in>prime_factors n. if p = 2 then 2 ^ multiplicity 2 n else 1)

goal (1 subgoal):
 1. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
have "\<dots> = 2 ^ multiplicity 2 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors n. if p = 2 then 2 ^ multiplicity 2 n else 1) = 2 ^ multiplicity 2 n
[PROOF STEP]
by (subst prod.delta[OF finite_set_mset]) (auto simp: prime_factors_multiplicity)
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. if p = 2 then 2 ^ multiplicity 2 n else 1) = 2 ^ multiplicity 2 n

goal (1 subgoal):
 1. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
n = 2 ^ multiplicity 2 n
[PROOF STEP]
have n: "n = 2 ^ multiplicity 2 n"
[PROOF STATE]
proof (prove)
using this:
n = 2 ^ multiplicity 2 n

goal (1 subgoal):
 1. n = 2 ^ multiplicity 2 n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
n = 2 ^ multiplicity 2 n

goal (1 subgoal):
 1. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
have "multiplicity 2 n = 0 \<or> multiplicity 2 n = 1 \<or> multiplicity 2 n > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity 2 n = 0 \<or> multiplicity 2 n = 1 \<or> 1 < multiplicity 2 n
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
multiplicity 2 n = 0 \<or> multiplicity 2 n = 1 \<or> 1 < multiplicity 2 n

goal (1 subgoal):
 1. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
with n assms
[PROOF STATE]
proof (chain)
picking this:
n = 2 ^ multiplicity 2 n
2 < n
multiplicity 2 n = 0 \<or> multiplicity 2 n = 1 \<or> 1 < multiplicity 2 n
[PROOF STEP]
have "multiplicity 2 n > 1"
[PROOF STATE]
proof (prove)
using this:
n = 2 ^ multiplicity 2 n
2 < n
multiplicity 2 n = 0 \<or> multiplicity 2 n = 1 \<or> 1 < multiplicity 2 n

goal (1 subgoal):
 1. 1 < multiplicity 2 n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 < multiplicity 2 n

goal (1 subgoal):
 1. \<nexists>p. prime p \<and> p \<noteq> 2 \<and> p dvd n \<Longrightarrow> even (totient n)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
1 < multiplicity 2 n

goal (1 subgoal):
 1. even (totient n)
[PROOF STEP]
by (subst n) (simp add: totient_prime_power)
[PROOF STATE]
proof (state)
this:
even (totient n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_natE:
  fixes a n b :: nat
  assumes "a mod n = b"
  shows "\<exists> l. a = n * l + b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>l. a = n * l + b
[PROOF STEP]
using assms mod_mult_div_eq[of a n]
[PROOF STATE]
proof (prove)
using this:
a mod n = b
a mod n + n * (a div n) = a

goal (1 subgoal):
 1. \<exists>l. a = n * l + b
[PROOF STEP]
by (metis add.commute)


[STATEMENT]
lemma apply_strategy_gives_path:
    assumes "\<Lambda>.reduction_strategy f" and "\<Lambda>.Ide a" and "n > 0"
    shows "Arr (apply_strategy f a n)"
    and "length (apply_strategy f a n) = n"
    and "Src (apply_strategy f a n) = a"
    and "Trg (apply_strategy f a n) = \<Lambda>.reduce f a n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Arr (apply_strategy f a n) &&& length (apply_strategy f a n) = n) &&& Src (apply_strategy f a n) = a &&& Trg (apply_strategy f a n) = \<Lambda>.reduce f a n
[PROOF STEP]
using assms apply_strategy_gives_path_ind
[PROOF STATE]
proof (prove)
using this:
\<Lambda>.reduction_strategy f
\<Lambda>.Ide a
0 < n
\<lbrakk>\<Lambda>.reduction_strategy ?f; \<Lambda>.Ide ?a; 0 < ?n\<rbrakk> \<Longrightarrow> Arr (apply_strategy ?f ?a ?n) \<and> length (apply_strategy ?f ?a ?n) = ?n \<and> Src (apply_strategy ?f ?a ?n) = ?a \<and> Trg (apply_strategy ?f ?a ?n) = \<Lambda>.reduce ?f ?a ?n

goal (1 subgoal):
 1. (Arr (apply_strategy f a n) &&& length (apply_strategy f a n) = n) &&& Src (apply_strategy f a n) = a &&& Trg (apply_strategy f a n) = \<Lambda>.reduce f a n
[PROOF STEP]
by auto


[STATEMENT]
lemma   times_aezdeltafun_aezdeltafun :
  fixes b1 b2 :: "'b::{comm_monoid_add,mult_zero}"
  shows "(b1 \<delta>\<delta> a1) * (b2 \<delta>\<delta> a2) = (b1 * b2) \<delta>\<delta> (a1 + a2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b1 \<delta>\<delta> a1 * (b2 \<delta>\<delta> a2) = (b1 * b2) \<delta>\<delta> (a1 + a2)
[PROOF STEP]
using deltafun_is_aezfun convolution_transfer[of "b1 \<delta> a1", THEN sym]
        convolution_delta_delta[of b1 a1 b2 a2]
[PROOF STATE]
proof (prove)
using this:
?b \<delta> ?a \<in> aezfun_set
\<lbrakk>b1 \<delta> a1 \<in> aezfun_set; ?g1 \<in> aezfun_set\<rbrakk> \<Longrightarrow> b1 \<delta>\<delta> a1 * Abs_aezfun ?g1 = Abs_aezfun (convolution (b1 \<delta> a1) ?g1)
convolution (b1 \<delta> a1) (b2 \<delta> a2) = (b1 * b2) \<delta> (a1 + a2)

goal (1 subgoal):
 1. b1 \<delta>\<delta> a1 * (b2 \<delta>\<delta> a2) = (b1 * b2) \<delta>\<delta> (a1 + a2)
[PROOF STEP]
by    fastforce


[STATEMENT]
lemma p_not_div_choose:
  assumes "k < K" and "k \<le> n"
      and eeq: "\<And>j. \<lbrakk>0<j; j<K\<rbrakk> \<Longrightarrow> multiplicity p (n - k + (K - j)) = multiplicity p (K - j)" "prime p"
    shows "multiplicity p (n choose k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (n choose k) = 0
[PROOF STEP]
apply (rule p_not_div_choose_lemma [of K p "n-k" k, simplified assms nat_minus_add_max max_absorb1])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i. Suc i < K \<Longrightarrow> multiplicity p (Suc i) = multiplicity p (Suc (n - k + i))
 2. True
 3. True
[PROOF STEP]
apply (metis add_Suc_right eeq diff_diff_cancel order_less_imp_le zero_less_Suc zero_less_diff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. True
 2. True
[PROOF STEP]
apply (rule TrueI)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma skolemize1: "\<forall>x. P x \<longrightarrow> (\<exists>y. Q x y) \<Longrightarrow> \<exists>f.\<forall>x. P x \<longrightarrow> Q x (f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. P x \<longrightarrow> (\<exists>y. Q x y) \<Longrightarrow> \<exists>f. \<forall>x. P x \<longrightarrow> Q x (f x)
[PROOF STEP]
apply(rule_tac x = "\<lambda>x. SOME y. Q x y" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. P x \<longrightarrow> (\<exists>y. Q x y) \<Longrightarrow> \<forall>x. P x \<longrightarrow> Q x (SOME y. Q x y)
[PROOF STEP]
apply(fast intro:someI2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nonzero_of_complex_inverse:
  "x \<noteq> 0 \<Longrightarrow> of_complex (inverse x) = inverse (of_complex x :: 'a::complex_div_algebra)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> of_complex (inverse x) = inverse (of_complex x)
[PROOF STEP]
by (simp add: of_complex_def nonzero_inverse_scaleC_distrib)


[STATEMENT]
lemma (in ordered_comm_monoid_add) sum_mono_complex_lex:
  "(\<And>i. i\<in>K \<Longrightarrow> f i \<le>\<^sub>\<complex> g i) \<Longrightarrow> (\<Sum>i\<in>K. f i) \<le>\<^sub>\<complex> (\<Sum>i\<in>K. g i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> K \<Longrightarrow> f i \<le>\<^sub>\<complex> g i) \<Longrightarrow> sum f K \<le>\<^sub>\<complex> sum g K
[PROOF STEP]
by (induct K rule: infinite_finite_induct) (use complex_lex.add_mono in auto)


[STATEMENT]
lemma imbal_ins_Unbal: "ins n d x t = Unbal t' \<Longrightarrow>
 real(imbal (node tw t' y s)) - imbal (node tw t y s) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ins n d x t = Unbal t' \<Longrightarrow> real (imbal (node tw t' y s)) - real (imbal (node tw t y s)) \<le> 1
[PROOF STEP]
apply(drule ins_size)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size t' = size t + 1 \<Longrightarrow> real (imbal (node tw t' y s)) - real (imbal (node tw t y s)) \<le> 1
[PROOF STEP]
apply(auto simp add: size1_size imbal.simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma list_all2_same: "list_all2 P xs xs \<longleftrightarrow> (\<forall>x\<in>set xs. P x x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 P xs xs = (\<forall>x\<in>set xs. P x x)
[PROOF STEP]
by(auto simp add: list_all2_conv_all_nth set_conv_nth)


[STATEMENT]
lemma Suc_mod: "n > 1 \<Longrightarrow> i \<noteq> Suc i mod n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < n \<Longrightarrow> i \<noteq> Suc i mod n
[PROOF STEP]
by (metis One_nat_def mod_Suc mod_if mod_mod_trivial n_not_Suc_n)


[STATEMENT]
lemma non_empty_ith:
  assumes "C \<subseteq> SEQ A" and "C \<noteq> {}"
  shows "ith (eq_upto C (lexmin C) i) i \<subseteq> A"
  and "ith (eq_upto C (lexmin C) i) i \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ith (eq_upto C (lexmin C) i) i \<subseteq> A &&& ith (eq_upto C (lexmin C) i) i \<noteq> {}
[PROOF STEP]
using eq_upto_lexmin_non_empty [OF assms, of i] and assms
[PROOF STATE]
proof (prove)
using this:
eq_upto C (lexmin C) i \<noteq> {}
C \<subseteq> SEQ A
C \<noteq> {}

goal (1 subgoal):
 1. ith (eq_upto C (lexmin C) i) i \<subseteq> A &&& ith (eq_upto C (lexmin C) i) i \<noteq> {}
[PROOF STEP]
by (auto simp: ith_def)