[STATEMENT]
lemma discriminant_pos_ex:
  fixes a b c :: real
  assumes "a \<noteq> 0"
    and "discrim a b c > 0"
  shows "\<exists>x y. x \<noteq> y \<and> a * x\<^sup>2 + b * x + c = 0 \<and> a * y\<^sup>2 + b * y + c = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y. x \<noteq> y \<and> a * x\<^sup>2 + b * x + c = 0 \<and> a * y\<^sup>2 + b * y + c = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x y. x \<noteq> y \<and> a * x\<^sup>2 + b * x + c = 0 \<and> a * y\<^sup>2 + b * y + c = 0
[PROOF STEP]
let ?x = "(-b + sqrt (discrim a b c)) / (2 * a)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x y. x \<noteq> y \<and> a * x\<^sup>2 + b * x + c = 0 \<and> a * y\<^sup>2 + b * y + c = 0
[PROOF STEP]
let ?y = "(-b - sqrt (discrim a b c)) / (2 * a)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x y. x \<noteq> y \<and> a * x\<^sup>2 + b * x + c = 0 \<and> a * y\<^sup>2 + b * y + c = 0
[PROOF STEP]
from \<open>discrim a b c > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < discrim a b c
[PROOF STEP]
have "sqrt (discrim a b c) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < discrim a b c

goal (1 subgoal):
 1. sqrt (discrim a b c) \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sqrt (discrim a b c) \<noteq> 0

goal (1 subgoal):
 1. \<exists>x y. x \<noteq> y \<and> a * x\<^sup>2 + b * x + c = 0 \<and> a * y\<^sup>2 + b * y + c = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sqrt (discrim a b c) \<noteq> 0
[PROOF STEP]
have "sqrt (discrim a b c) \<noteq> - sqrt (discrim a b c)"
[PROOF STATE]
proof (prove)
using this:
sqrt (discrim a b c) \<noteq> 0

goal (1 subgoal):
 1. sqrt (discrim a b c) \<noteq> - sqrt (discrim a b c)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
sqrt (discrim a b c) \<noteq> - sqrt (discrim a b c)

goal (1 subgoal):
 1. \<exists>x y. x \<noteq> y \<and> a * x\<^sup>2 + b * x + c = 0 \<and> a * y\<^sup>2 + b * y + c = 0
[PROOF STEP]
with \<open>a \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> 0
sqrt (discrim a b c) \<noteq> - sqrt (discrim a b c)
[PROOF STEP]
have "?x \<noteq> ?y"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0
sqrt (discrim a b c) \<noteq> - sqrt (discrim a b c)

goal (1 subgoal):
 1. (- b + sqrt (discrim a b c)) / (2 * a) \<noteq> (- b - sqrt (discrim a b c)) / (2 * a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- b + sqrt (discrim a b c)) / (2 * a) \<noteq> (- b - sqrt (discrim a b c)) / (2 * a)

goal (1 subgoal):
 1. \<exists>x y. x \<noteq> y \<and> a * x\<^sup>2 + b * x + c = 0 \<and> a * y\<^sup>2 + b * y + c = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(- b + sqrt (discrim a b c)) / (2 * a) \<noteq> (- b - sqrt (discrim a b c)) / (2 * a)

goal (1 subgoal):
 1. \<exists>x y. x \<noteq> y \<and> a * x\<^sup>2 + b * x + c = 0 \<and> a * y\<^sup>2 + b * y + c = 0
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> 0
0 < discrim a b c
[PROOF STEP]
have "a * ?x\<^sup>2 + b * ?x + c = 0" and "a * ?y\<^sup>2 + b * ?y + c = 0"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0
0 < discrim a b c

goal (1 subgoal):
 1. a * ((- b + sqrt (discrim a b c)) / (2 * a))\<^sup>2 + b * ((- b + sqrt (discrim a b c)) / (2 * a)) + c = 0 &&& a * ((- b - sqrt (discrim a b c)) / (2 * a))\<^sup>2 + b * ((- b - sqrt (discrim a b c)) / (2 * a)) + c = 0
[PROOF STEP]
using discriminant_nonneg [of a b c ?x]
      and discriminant_nonneg [of a b c ?y]
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0
0 < discrim a b c
\<lbrakk>a \<noteq> 0; 0 \<le> discrim a b c\<rbrakk> \<Longrightarrow> (a * ((- b + sqrt (discrim a b c)) / (2 * a))\<^sup>2 + b * ((- b + sqrt (discrim a b c)) / (2 * a)) + c = 0) = ((- b + sqrt (discrim a b c)) / (2 * a) = (- b + sqrt (discrim a b c)) / (2 * a) \<or> (- b + sqrt (discrim a b c)) / (2 * a) = (- b - sqrt (discrim a b c)) / (2 * a))
\<lbrakk>a \<noteq> 0; 0 \<le> discrim a b c\<rbrakk> \<Longrightarrow> (a * ((- b - sqrt (discrim a b c)) / (2 * a))\<^sup>2 + b * ((- b - sqrt (discrim a b c)) / (2 * a)) + c = 0) = ((- b - sqrt (discrim a b c)) / (2 * a) = (- b + sqrt (discrim a b c)) / (2 * a) \<or> (- b - sqrt (discrim a b c)) / (2 * a) = (- b - sqrt (discrim a b c)) / (2 * a))

goal (1 subgoal):
 1. a * ((- b + sqrt (discrim a b c)) / (2 * a))\<^sup>2 + b * ((- b + sqrt (discrim a b c)) / (2 * a)) + c = 0 &&& a * ((- b - sqrt (discrim a b c)) / (2 * a))\<^sup>2 + b * ((- b - sqrt (discrim a b c)) / (2 * a)) + c = 0
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
a * ((- b + sqrt (discrim a b c)) / (2 * a))\<^sup>2 + b * ((- b + sqrt (discrim a b c)) / (2 * a)) + c = 0
a * ((- b - sqrt (discrim a b c)) / (2 * a))\<^sup>2 + b * ((- b - sqrt (discrim a b c)) / (2 * a)) + c = 0

goal (1 subgoal):
 1. \<exists>x y. x \<noteq> y \<and> a * x\<^sup>2 + b * x + c = 0 \<and> a * y\<^sup>2 + b * y + c = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(- b + sqrt (discrim a b c)) / (2 * a) \<noteq> (- b - sqrt (discrim a b c)) / (2 * a)
a * ((- b + sqrt (discrim a b c)) / (2 * a))\<^sup>2 + b * ((- b + sqrt (discrim a b c)) / (2 * a)) + c = 0
a * ((- b - sqrt (discrim a b c)) / (2 * a))\<^sup>2 + b * ((- b - sqrt (discrim a b c)) / (2 * a)) + c = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(- b + sqrt (discrim a b c)) / (2 * a) \<noteq> (- b - sqrt (discrim a b c)) / (2 * a)
a * ((- b + sqrt (discrim a b c)) / (2 * a))\<^sup>2 + b * ((- b + sqrt (discrim a b c)) / (2 * a)) + c = 0
a * ((- b - sqrt (discrim a b c)) / (2 * a))\<^sup>2 + b * ((- b - sqrt (discrim a b c)) / (2 * a)) + c = 0

goal (1 subgoal):
 1. \<exists>x y. x \<noteq> y \<and> a * x\<^sup>2 + b * x + c = 0 \<and> a * y\<^sup>2 + b * y + c = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>x y. x \<noteq> y \<and> a * x\<^sup>2 + b * x + c = 0 \<and> a * y\<^sup>2 + b * y + c = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in PolynRg) polyn_n_m1:"\<lbrakk>pol_coeff S c; n < m; m \<le> (fst c)\<rbrakk> \<Longrightarrow>
      polyn_expr R X m c = polyn_expr R X n c \<plusminus>
                        (fSum R (\<lambda>j. ((snd c) j) \<cdot>\<^sub>r (X^\<^bsup>R j\<^esup>)) (Suc n) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; n < m; m \<le> fst c\<rbrakk> \<Longrightarrow> polyn_expr R X m c = polyn_expr R X n c \<plusminus> \<Sigma>\<^sub>f R (\<lambda>j. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc n m
[PROOF STEP]
apply (subst polyn_expr_short[of c n], assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>pol_coeff S c; n < m; m \<le> fst c\<rbrakk> \<Longrightarrow> n \<le> fst c
 2. \<lbrakk>pol_coeff S c; n < m; m \<le> fst c\<rbrakk> \<Longrightarrow> polyn_expr R X m c = polyn_expr R X n (n, snd c) \<plusminus> \<Sigma>\<^sub>f R (\<lambda>j. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc n m
[PROOF STEP]
apply (frule_tac x = n and y = m and z = "fst c" in less_le_trans, assumption,
        simp add:less_imp_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; n < m; m \<le> fst c\<rbrakk> \<Longrightarrow> polyn_expr R X m c = polyn_expr R X n (n, snd c) \<plusminus> \<Sigma>\<^sub>f R (\<lambda>j. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc n m
[PROOF STEP]
apply (subst polyn_expr_short[of c m], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; n < m; m \<le> fst c\<rbrakk> \<Longrightarrow> polyn_expr R X m (m, snd c) = polyn_expr R X n (n, snd c) \<plusminus> \<Sigma>\<^sub>f R (\<lambda>j. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc n m
[PROOF STEP]
apply (simp add:polyn_n_m)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma c_snd_snd_lt [termination_simp]: "c_snd (c_snd (Suc (Suc x))) < Suc (Suc x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_snd (c_snd (Suc (Suc x))) < Suc (Suc x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_snd (c_snd (Suc (Suc x))) < Suc (Suc x)
[PROOF STEP]
let ?y = "Suc (Suc x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_snd (c_snd (Suc (Suc x))) < Suc (Suc x)
[PROOF STEP]
have "?y > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < Suc (Suc x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < Suc (Suc x)

goal (1 subgoal):
 1. c_snd (c_snd (Suc (Suc x))) < Suc (Suc x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < Suc (Suc x)
[PROOF STEP]
have "c_snd ?y < ?y"
[PROOF STATE]
proof (prove)
using this:
1 < Suc (Suc x)

goal (1 subgoal):
 1. c_snd (Suc (Suc x)) < Suc (Suc x)
[PROOF STEP]
by (rule c_snd_less_arg)
[PROOF STATE]
proof (state)
this:
c_snd (Suc (Suc x)) < Suc (Suc x)

goal (1 subgoal):
 1. c_snd (c_snd (Suc (Suc x))) < Suc (Suc x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
c_snd (Suc (Suc x)) < Suc (Suc x)

goal (1 subgoal):
 1. c_snd (c_snd (Suc (Suc x))) < Suc (Suc x)
[PROOF STEP]
have "c_snd (c_snd ?y) \<le> c_snd ?y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_snd (c_snd (Suc (Suc x))) \<le> c_snd (Suc (Suc x))
[PROOF STEP]
by (rule c_snd_le_arg)
[PROOF STATE]
proof (state)
this:
c_snd (c_snd (Suc (Suc x))) \<le> c_snd (Suc (Suc x))

goal (1 subgoal):
 1. c_snd (c_snd (Suc (Suc x))) < Suc (Suc x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
c_snd (Suc (Suc x)) < Suc (Suc x)
c_snd (c_snd (Suc (Suc x))) \<le> c_snd (Suc (Suc x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c_snd (Suc (Suc x)) < Suc (Suc x)
c_snd (c_snd (Suc (Suc x))) \<le> c_snd (Suc (Suc x))

goal (1 subgoal):
 1. c_snd (c_snd (Suc (Suc x))) < Suc (Suc x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_snd (c_snd (Suc (Suc x))) < Suc (Suc x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in domain) degree_zero_imp_not_is_root:
  assumes "p \<in> carrier (poly_ring R)" and "degree p = 0" shows "\<not> is_root p x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> is_root p x
[PROOF STEP]
proof (cases "p = []", simp add: is_root_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> [] \<Longrightarrow> \<not> is_root p x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> []

goal (1 subgoal):
 1. p \<noteq> [] \<Longrightarrow> \<not> is_root p x
[PROOF STEP]
with \<open>degree p = 0\<close>
[PROOF STATE]
proof (chain)
picking this:
degree p = 0
p \<noteq> []
[PROOF STEP]
have "length p = Suc 0"
[PROOF STATE]
proof (prove)
using this:
degree p = 0
p \<noteq> []

goal (1 subgoal):
 1. length p = Suc 0
[PROOF STEP]
using le_SucE
[PROOF STATE]
proof (prove)
using this:
degree p = 0
p \<noteq> []
\<lbrakk>?m \<le> Suc ?n; ?m \<le> ?n \<Longrightarrow> ?R; ?m = Suc ?n \<Longrightarrow> ?R\<rbrakk> \<Longrightarrow> ?R

goal (1 subgoal):
 1. length p = Suc 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
length p = Suc 0

goal (1 subgoal):
 1. p \<noteq> [] \<Longrightarrow> \<not> is_root p x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length p = Suc 0
[PROOF STEP]
obtain a where "p = [ a ]" and "a \<in> carrier R" and "a \<noteq> \<zero>"
[PROOF STATE]
proof (prove)
using this:
length p = Suc 0

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>p = [a]; a \<in> carrier R; a \<noteq> \<zero>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length p = Suc 0
p \<in> carrier (poly_ring R)
degree p = 0

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>p = [a]; a \<in> carrier R; a \<noteq> \<zero>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding sym[OF univ_poly_carrier] polynomial_def
[PROOF STATE]
proof (prove)
using this:
length p = Suc 0
p = [] \<or> set p \<subseteq> carrier R \<and> lead_coeff p \<noteq> \<zero>
degree p = 0

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>p = [a]; a \<in> carrier R; a \<noteq> \<zero>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis False length_0_conv length_Suc_conv list.sel(1) list.set_sel(1) subset_code(1))
[PROOF STATE]
proof (state)
this:
p = [a]
a \<in> carrier R
a \<noteq> \<zero>

goal (1 subgoal):
 1. p \<noteq> [] \<Longrightarrow> \<not> is_root p x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p = [a]
a \<in> carrier R
a \<noteq> \<zero>

goal (1 subgoal):
 1. \<not> is_root p x
[PROOF STEP]
unfolding is_root_def
[PROOF STATE]
proof (prove)
using this:
p = [a]
a \<in> carrier R
a \<noteq> \<zero>

goal (1 subgoal):
 1. \<not> (x \<in> carrier R \<and> local.eval p x = \<zero> \<and> p \<noteq> [])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> is_root p x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_imageI'':
  assumes "finite (A \<times> B)"
  shows "finite {f x y | x y. x \<in> A \<and> y \<in> B \<and> R x y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {f x y |x y. x \<in> A \<and> y \<in> B \<and> R x y}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (A \<times> B)

goal (1 subgoal):
 1. finite {f x y |x y. x \<in> A \<and> y \<in> B \<and> R x y}
[PROOF STEP]
by - finite


[STATEMENT]
lemma l2wi_intersect: "wordinterval_to_set (l2wi_intersect l) = (\<Inter> (i,j) \<in> set l. {i .. j})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (l2wi_intersect l) = (\<Inter>(i, j)\<in>set l. {i..j})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wordinterval_to_set (l2wi_intersect l) = (\<Inter>(i, j)\<in>set l. {i..j})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wordinterval_to_set (l2wi_intersect l) = (\<Inter>(i, j)\<in>set l. {i..j})
[PROOF STEP]
fix U \<comment> \<open>@{const wordinterval_UNIV} generalized\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wordinterval_to_set (l2wi_intersect l) = (\<Inter>(i, j)\<in>set l. {i..j})
[PROOF STEP]
have "wordinterval_to_set (foldl (\<lambda>acc (s, e). wordinterval_intersection (WordInterval s e) acc) U l) = (wordinterval_to_set U) \<inter> (\<Inter>(i, j)\<in>set l. {i..j})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (foldl (\<lambda>acc (s, e). wordinterval_intersection (WordInterval s e) acc) U l) = wordinterval_to_set U \<inter> (\<Inter>(i, j)\<in>set l. {i..j})
[PROOF STEP]
apply(induction l arbitrary: U)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>U. wordinterval_to_set (foldl (\<lambda>acc (s, e). wordinterval_intersection (WordInterval s e) acc) U []) = wordinterval_to_set U \<inter> (\<Inter>(x, y)\<in>set []. {x..y})
 2. \<And>a l U. (\<And>U. wordinterval_to_set (foldl (\<lambda>acc (s, e). wordinterval_intersection (WordInterval s e) acc) U l) = wordinterval_to_set U \<inter> (\<Inter>(x, y)\<in>set l. {x..y})) \<Longrightarrow> wordinterval_to_set (foldl (\<lambda>acc (s, e). wordinterval_intersection (WordInterval s e) acc) U (a # l)) = wordinterval_to_set U \<inter> (\<Inter>(x, y)\<in>set (a # l). {x..y})
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l U. (\<And>U. wordinterval_to_set (foldl (\<lambda>acc (s, e). wordinterval_intersection (WordInterval s e) acc) U l) = wordinterval_to_set U \<inter> (\<Inter>(x, y)\<in>set l. {x..y})) \<Longrightarrow> wordinterval_to_set (foldl (\<lambda>acc (s, e). wordinterval_intersection (WordInterval s e) acc) U (a # l)) = wordinterval_to_set U \<inter> (\<Inter>(x, y)\<in>set (a # l). {x..y})
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
wordinterval_to_set (foldl (\<lambda>acc (s, e). wordinterval_intersection (WordInterval s e) acc) U l) = wordinterval_to_set U \<inter> (\<Inter>(i, j)\<in>set l. {i..j})

goal (1 subgoal):
 1. wordinterval_to_set (l2wi_intersect l) = (\<Inter>(i, j)\<in>set l. {i..j})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
wordinterval_to_set (foldl (\<lambda>acc (s, e). wordinterval_intersection (WordInterval s e) acc) ?U2 l) = wordinterval_to_set ?U2 \<inter> (\<Inter>(i, j)\<in>set l. {i..j})

goal (1 subgoal):
 1. wordinterval_to_set (l2wi_intersect l) = (\<Inter>(i, j)\<in>set l. {i..j})
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
wordinterval_to_set (foldl (\<lambda>acc (s, e). wordinterval_intersection (WordInterval s e) acc) ?U2 l) = wordinterval_to_set ?U2 \<inter> (\<Inter>(i, j)\<in>set l. {i..j})

goal (1 subgoal):
 1. wordinterval_to_set (l2wi_intersect l) = (\<Inter>(i, j)\<in>set l. {i..j})
[PROOF STEP]
unfolding l2wi_intersect_def
[PROOF STATE]
proof (prove)
using this:
wordinterval_to_set (foldl (\<lambda>acc (s, e). wordinterval_intersection (WordInterval s e) acc) ?U2 l) = wordinterval_to_set ?U2 \<inter> (\<Inter>(i, j)\<in>set l. {i..j})

goal (1 subgoal):
 1. wordinterval_to_set (foldl (\<lambda>acc (s, e). wordinterval_intersection (WordInterval s e) acc) wordinterval_UNIV l) = (\<Inter>(i, j)\<in>set l. {i..j})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
wordinterval_to_set (l2wi_intersect l) = (\<Inter>(i, j)\<in>set l. {i..j})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma point_reachable_converse:
  assumes "is_vector v"
      and "v \<noteq> 0"
      and "point r"
      and "v \<le> x\<^sup>T\<^sup>+;r"
    shows "r \<le> x\<^sup>+;v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<le> x\<^sup>+ ; v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r \<le> x\<^sup>+ ; v
[PROOF STEP]
have "v\<^sup>T;v \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v\<^sup>T ; v \<noteq> 0
[PROOF STEP]
by (metis assms(2) inf.idem inf_bot_right mult_1_right schroeder_1)
[PROOF STATE]
proof (state)
this:
v\<^sup>T ; v \<noteq> 0

goal (1 subgoal):
 1. r \<le> x\<^sup>+ ; v
[PROOF STEP]
hence "1;v\<^sup>T;v = 1"
[PROOF STATE]
proof (prove)
using this:
v\<^sup>T ; v \<noteq> 0

goal (1 subgoal):
 1. 1 ; v\<^sup>T ; v = 1
[PROOF STEP]
using assms(1) is_vector_def mult_assoc tarski
[PROOF STATE]
proof (prove)
using this:
v\<^sup>T ; v \<noteq> 0
is_vector v
is_vector ?x \<equiv> ?x = ?x ; 1
?a ; ?b ; ?c = ?a ; (?b ; ?c)
(?x \<noteq> 0) = (1 ; ?x ; 1 = 1)

goal (1 subgoal):
 1. 1 ; v\<^sup>T ; v = 1
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
1 ; v\<^sup>T ; v = 1

goal (1 subgoal):
 1. r \<le> x\<^sup>+ ; v
[PROOF STEP]
hence 1: "r = r;v\<^sup>T;v"
[PROOF STATE]
proof (prove)
using this:
1 ; v\<^sup>T ; v = 1

goal (1 subgoal):
 1. r = r ; v\<^sup>T ; v
[PROOF STEP]
by (metis assms(3) is_vector_def mult_assoc point_def)
[PROOF STATE]
proof (state)
this:
r = r ; v\<^sup>T ; v

goal (1 subgoal):
 1. r \<le> x\<^sup>+ ; v
[PROOF STEP]
have "v;r\<^sup>T \<le> x\<^sup>T\<^sup>+"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v ; r\<^sup>T \<le> x\<^sup>T\<^sup>+
[PROOF STEP]
using assms(3,4) point_def ss423bij
[PROOF STATE]
proof (prove)
using this:
point r
v \<le> x\<^sup>T\<^sup>+ ; r
point ?x \<equiv> is_vector ?x \<and> bijective ?x
bijective ?x \<Longrightarrow> (?y ; ?x\<^sup>T \<le> ?z) = (?y \<le> ?z ; ?x)

goal (1 subgoal):
 1. v ; r\<^sup>T \<le> x\<^sup>T\<^sup>+
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
v ; r\<^sup>T \<le> x\<^sup>T\<^sup>+

goal (1 subgoal):
 1. r \<le> x\<^sup>+ ; v
[PROOF STEP]
hence "r;v\<^sup>T \<le> x\<^sup>+"
[PROOF STATE]
proof (prove)
using this:
v ; r\<^sup>T \<le> x\<^sup>T\<^sup>+

goal (1 subgoal):
 1. r ; v\<^sup>T \<le> x\<^sup>+
[PROOF STEP]
by (metis conv_contrav conv_invol conv_iso star_conv star_slide_var)
[PROOF STATE]
proof (state)
this:
r ; v\<^sup>T \<le> x\<^sup>+

goal (1 subgoal):
 1. r \<le> x\<^sup>+ ; v
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
r ; v\<^sup>T \<le> x\<^sup>+

goal (1 subgoal):
 1. r \<le> x\<^sup>+ ; v
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
r ; v\<^sup>T \<le> x\<^sup>+
r = r ; v\<^sup>T ; v

goal (1 subgoal):
 1. r \<le> x\<^sup>+ ; v
[PROOF STEP]
by (metis mult_isor)
[PROOF STATE]
proof (state)
this:
r \<le> x\<^sup>+ ; v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Fract_le_one_iff: "0 < b \<Longrightarrow> Fract a b \<le> 1 \<longleftrightarrow> a \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < b \<Longrightarrow> (Fract a b \<le> 1) = (a \<le> b)
[PROOF STEP]
by (auto simp add: One_fract_def mult_le_cancel_right)


[STATEMENT]
lemma out_arcs_del_arc_iff:
  "out_arcs (del_arc a) u = (if tail G a = u then out_arcs G u - {a} else out_arcs G u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. out_arcs (del_arc a) u = (if tail G a = u then out_arcs G u - {a} else out_arcs G u)
[PROOF STEP]
by auto


[STATEMENT]
lemma optimize_no_cond_correct:
  assumes "optimize_no_cond A b c = Sat x"
  shows "x \<in> max_lp A b c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> max_lp A b c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> max_lp A b c
[PROOF STEP]
obtain X where X: "create_optimal_solutions A b c = Sat X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. create_optimal_solutions A b c = Inr X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis Inr_Inl_False assms old.sum.exhaust old.sum.simps(5) optimize_no_cond.simps)
[PROOF STATE]
proof (state)
this:
create_optimal_solutions A b c = Inr X

goal (1 subgoal):
 1. x \<in> max_lp A b c
[PROOF STEP]
have "x = (fst (split_n_m_x (dim_vec c) (dim_vec b) X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = fst (split_n_m_x (dim_vec c) (dim_vec b) X)
[PROOF STEP]
using X assms
[PROOF STATE]
proof (prove)
using this:
create_optimal_solutions A b c = Inr X
optimize_no_cond A b c = Inr x

goal (1 subgoal):
 1. x = fst (split_n_m_x (dim_vec c) (dim_vec b) X)
[PROOF STEP]
by (metis old.sum.inject(2) old.sum.simps(6) optimize_no_cond.simps)
[PROOF STATE]
proof (state)
this:
x = fst (split_n_m_x (dim_vec c) (dim_vec b) X)

goal (1 subgoal):
 1. x \<in> max_lp A b c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = fst (split_n_m_x (dim_vec c) (dim_vec b) X)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = fst (split_n_m_x (dim_vec c) (dim_vec b) X)

goal (1 subgoal):
 1. x \<in> max_lp A b c
[PROOF STEP]
using create_opt_solutions_correct[of X x]
[PROOF STATE]
proof (prove)
using this:
x = fst (split_n_m_x (dim_vec c) (dim_vec b) X)
\<lbrakk>create_optimal_solutions A b c = Inr X; (x, ?y) = split_n_m_x (dim_vec c) (dim_vec b) X\<rbrakk> \<Longrightarrow> x \<in> max_lp A b c

goal (1 subgoal):
 1. x \<in> max_lp A b c
[PROOF STEP]
by (metis X fst_conv old.prod.exhaust)
[PROOF STATE]
proof (state)
this:
x \<in> max_lp A b c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma return_time_eqI:
  assumes "closed P"
    and t_pos: "t > 0"
    and ex: "t \<in> existence_ivl0 x"
    and ret: "flow0 x t \<in> P"
    and least: "\<And>s. 0 < s \<Longrightarrow> s < t \<Longrightarrow> flow0 x s \<notin> P"
  shows "return_time P x = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. return_time P x = t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. return_time P x = t
[PROOF STEP]
from least t_pos
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < ?s; ?s < t\<rbrakk> \<Longrightarrow> flow0 x ?s \<notin> P
0 < t
[PROOF STEP]
have "\<forall>\<^sub>F t in at_right 0. flow0 x t \<notin> P"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?s; ?s < t\<rbrakk> \<Longrightarrow> flow0 x ?s \<notin> P
0 < t

goal (1 subgoal):
 1. \<forall>\<^sub>F t in at_right 0. flow0 x t \<notin> P
[PROOF STEP]
by (auto simp: eventually_at_right[OF zero_less_one])
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F t in at_right 0. flow0 x t \<notin> P

goal (1 subgoal):
 1. return_time P x = t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F t in at_right 0. flow0 x t \<notin> P
[PROOF STEP]
have "returns_to P x"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F t in at_right 0. flow0 x t \<notin> P

goal (1 subgoal):
 1. returns_to P x
[PROOF STEP]
by (auto intro!: returns_toI[of t] assms)
[PROOF STATE]
proof (state)
this:
returns_to P x

goal (1 subgoal):
 1. return_time P x = t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
returns_to P x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
returns_to P x

goal (1 subgoal):
 1. return_time P x = t
[PROOF STEP]
using least
[PROOF STATE]
proof (prove)
using this:
returns_to P x
\<lbrakk>0 < ?s; ?s < t\<rbrakk> \<Longrightarrow> flow0 x ?s \<notin> P

goal (1 subgoal):
 1. return_time P x = t
[PROOF STEP]
by (auto simp: return_time_def t_pos ex ret
        intro!: some1_equality[OF return_time_ex1[OF \<open>returns_to _ _\<close> \<open>closed _\<close>]])
[PROOF STATE]
proof (state)
this:
return_time P x = t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_0': "(\<And>i. i < I ==> s (c i) = 0) ==> sum I s = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i < I \<Longrightarrow> s (c i) = 0) \<Longrightarrow> Counter.sum I s = 0
[PROOF STEP]
by (induct I) auto


[STATEMENT]
lemma all_edges_between_disjoint1:
  assumes "disjoint R"
  shows "disjoint ((\<lambda>X. all_edges_between X Y) ` R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint ((\<lambda>X. all_edges_between X Y) ` R)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
disjoint R

goal (1 subgoal):
 1. disjoint ((\<lambda>X. all_edges_between X Y) ` R)
[PROOF STEP]
by (auto simp: all_edges_between_def disjoint_def)


[STATEMENT]
lemma has_vector_derivative_mult_right[derivative_intros]:
  fixes a :: "'a::real_normed_algebra"
  shows "(f has_vector_derivative x) F \<Longrightarrow> ((\<lambda>x. a * f x) has_vector_derivative (a * x)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_vector_derivative x) F \<Longrightarrow> ((\<lambda>x. a * f x) has_vector_derivative a * x) F
[PROOF STEP]
by (rule bounded_linear.has_vector_derivative[OF bounded_linear_mult_right])


[STATEMENT]
lemma lookup_empty [simp]: "lookup empty k = None"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup DAList.empty k = None
[PROOF STEP]
by (simp add: empty_def lookup_def Alist_inverse)


[STATEMENT]
lemma filter_join_False:
  assumes "finite A"
  shows "filter_join False A m = Finite_Set.fold Mapping.delete m A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_join False A m = Finite_Set.fold Mapping.delete m A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filter_join False A m = Finite_Set.fold Mapping.delete m A
[PROOF STEP]
interpret comp_fun_idem "Mapping.delete"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_idem Mapping.delete
[PROOF STEP]
by (unfold_locales; transfer) (fastforce simp add: comp_def)+
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filter_join False A m = Finite_Set.fold Mapping.delete m A
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. filter_join False A m = Finite_Set.fold Mapping.delete m A
[PROOF STEP]
by (induction A arbitrary: m rule: finite.induct)
       (auto simp add: filter_join_False_empty filter_join_False_insert fold_fun_left_comm)
[PROOF STATE]
proof (state)
this:
filter_join False A m = Finite_Set.fold Mapping.delete m A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le2_per2__le:
  assumes "Per A B C" and
    "Per A' B' C'" and
    "A B Le A' B'" and
    "B C Le B' C'"
  shows "A C Le A' C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A C Le A' C'
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> A C Le A' C'
 2. \<not> ?P \<Longrightarrow> A C Le A' C'
[PROOF STEP]
assume "Cong B C B' C'"
[PROOF STATE]
proof (state)
this:
Cong B C B' C'

goal (2 subgoals):
 1. ?P \<Longrightarrow> A C Le A' C'
 2. \<not> ?P \<Longrightarrow> A C Le A' C'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Cong B C B' C'

goal (1 subgoal):
 1. A C Le A' C'
[PROOF STEP]
by (meson Per_cases Tarski_neutral_dimensionless.cong_le_per2__le Tarski_neutral_dimensionless_axioms assms(1) assms(2) assms(3) le_comm not_cong_2143)
[PROOF STATE]
proof (state)
this:
A C Le A' C'

goal (1 subgoal):
 1. \<not> Cong B C B' C' \<Longrightarrow> A C Le A' C'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> Cong B C B' C' \<Longrightarrow> A C Le A' C'
[PROOF STEP]
assume "\<not> Cong B C B' C'"
[PROOF STATE]
proof (state)
this:
\<not> Cong B C B' C'

goal (1 subgoal):
 1. \<not> Cong B C B' C' \<Longrightarrow> A C Le A' C'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> Cong B C B' C'
[PROOF STEP]
have "B C Lt B' C'"
[PROOF STATE]
proof (prove)
using this:
\<not> Cong B C B' C'

goal (1 subgoal):
 1. B C Lt B' C'
[PROOF STEP]
by (simp add: Lt_def assms(4))
[PROOF STATE]
proof (state)
this:
B C Lt B' C'

goal (1 subgoal):
 1. \<not> Cong B C B' C' \<Longrightarrow> A C Le A' C'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
B C Lt B' C'

goal (1 subgoal):
 1. A C Le A' C'
[PROOF STEP]
using assms(1) assms(2) assms(3) le_lt_per2__lt lt__le
[PROOF STATE]
proof (prove)
using this:
B C Lt B' C'
Per A B C
Per A' B' C'
A B Le A' B'
\<lbrakk>Per ?A ?B ?C; Per ?A' ?B' ?C'; ?A ?B Le ?A' ?B'; ?B ?C Lt ?B' ?C'\<rbrakk> \<Longrightarrow> ?A ?C Lt ?A' ?C'
?A ?B Lt ?C ?D \<Longrightarrow> ?A ?B Le ?C ?D

goal (1 subgoal):
 1. A C Le A' C'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A C Le A' C'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sep_conj_true [simp]:
  "(sep_true ** sep_true) = sep_true"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>s. True) \<and>* (\<lambda>s. True)) = (\<lambda>s. True)
[PROOF STEP]
unfolding sep_conj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>h. \<exists>x y. x ## y \<and> h = x + y \<and> True \<and> True) = (\<lambda>s. True)
[PROOF STEP]
by (auto intro!: ext intro: disjoint_subheaps_exist)


[STATEMENT]
lemma least_image[simp]:
    fixes f :: "'a :: wellorder \<Rightarrow> 'b :: wellorder"
    assumes "A \<noteq> {}" "\<And> k l. k \<in> A \<Longrightarrow> l \<in> A \<Longrightarrow> k \<le> l \<Longrightarrow> f k \<le> f l"
    shows "least (f ` A) = f (least A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least (f ` A) = f (least A)
[PROOF STEP]
proof (rule leastI2_order)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A \<noteq> {}
 2. \<And>k. \<lbrakk>k \<in> A; \<And>l. l \<in> A \<Longrightarrow> k \<le> l\<rbrakk> \<Longrightarrow> least (f ` A) = f k
[PROOF STEP]
show "A \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> {}
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}

goal (1 subgoal):
 1. A \<noteq> {}
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k \<in> A; \<And>l. l \<in> A \<Longrightarrow> k \<le> l\<rbrakk> \<Longrightarrow> least (f ` A) = f k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k \<in> A; \<And>l. l \<in> A \<Longrightarrow> k \<le> l\<rbrakk> \<Longrightarrow> least (f ` A) = f k
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k \<in> A; \<And>l. l \<in> A \<Longrightarrow> k \<le> l\<rbrakk> \<Longrightarrow> least (f ` A) = f k
[PROOF STEP]
assume 1: "k \<in> A" "\<And> i. i \<in> A \<Longrightarrow> k \<le> i"
[PROOF STATE]
proof (state)
this:
k \<in> A
?i \<in> A \<Longrightarrow> k \<le> ?i

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k \<in> A; \<And>l. l \<in> A \<Longrightarrow> k \<le> l\<rbrakk> \<Longrightarrow> least (f ` A) = f k
[PROOF STEP]
show "least (f ` A) = f k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least (f ` A) = f k
[PROOF STEP]
proof (rule leastI2_order)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f ` A \<noteq> {}
 2. \<And>ka. \<lbrakk>ka \<in> f ` A; \<And>l. l \<in> f ` A \<Longrightarrow> ka \<le> l\<rbrakk> \<Longrightarrow> ka = f k
[PROOF STEP]
show "f ` A \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` A \<noteq> {}
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}

goal (1 subgoal):
 1. f ` A \<noteq> {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f ` A \<noteq> {}

goal (1 subgoal):
 1. \<And>ka. \<lbrakk>ka \<in> f ` A; \<And>l. l \<in> f ` A \<Longrightarrow> ka \<le> l\<rbrakk> \<Longrightarrow> ka = f k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ka. \<lbrakk>ka \<in> f ` A; \<And>l. l \<in> f ` A \<Longrightarrow> ka \<le> l\<rbrakk> \<Longrightarrow> ka = f k
[PROOF STEP]
fix l
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ka. \<lbrakk>ka \<in> f ` A; \<And>l. l \<in> f ` A \<Longrightarrow> ka \<le> l\<rbrakk> \<Longrightarrow> ka = f k
[PROOF STEP]
assume 2: "l \<in> f ` A" "\<And> i. i \<in> f ` A \<Longrightarrow> l \<le> i"
[PROOF STATE]
proof (state)
this:
l \<in> f ` A
?i \<in> f ` A \<Longrightarrow> l \<le> ?i

goal (1 subgoal):
 1. \<And>ka. \<lbrakk>ka \<in> f ` A; \<And>l. l \<in> f ` A \<Longrightarrow> ka \<le> l\<rbrakk> \<Longrightarrow> ka = f k
[PROOF STEP]
show "l = f k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l = f k
[PROOF STEP]
using assms(2) 1 2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?k \<in> A; ?l \<in> A; ?k \<le> ?l\<rbrakk> \<Longrightarrow> f ?k \<le> f ?l
k \<in> A
?i \<in> A \<Longrightarrow> k \<le> ?i
l \<in> f ` A
?i \<in> f ` A \<Longrightarrow> l \<le> ?i

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
least (f ` A) = f k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group_hom) FactGroup_subset:
  assumes "g \<in> carrier G" "g' \<in> carrier G" "h g = h g'"
  shows "kernel G H h #> g \<subseteq> kernel G H h #> g'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel G H h #> g \<subseteq> kernel G H h #> g'
[PROOF STEP]
unfolding kernel_def r_coset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>h\<in>{x \<in> carrier G. h x = \<one>\<^bsub>H\<^esub>}. {h \<otimes> g}) \<subseteq> (\<Union>h\<in>{x \<in> carrier G. h x = \<one>\<^bsub>H\<^esub>}. {h \<otimes> g'})
[PROOF STEP]
proof clarsimp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ha. \<lbrakk>ha \<in> carrier G; h ha = \<one>\<^bsub>H\<^esub>\<rbrakk> \<Longrightarrow> \<exists>x. x \<in> carrier G \<and> h x = \<one>\<^bsub>H\<^esub> \<and> ha \<otimes> g = x \<otimes> g'
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ha. \<lbrakk>ha \<in> carrier G; h ha = \<one>\<^bsub>H\<^esub>\<rbrakk> \<Longrightarrow> \<exists>x. x \<in> carrier G \<and> h x = \<one>\<^bsub>H\<^esub> \<and> ha \<otimes> g = x \<otimes> g'
[PROOF STEP]
assume "y \<in> carrier G" "h y = \<one>\<^bsub>H\<^esub>"
[PROOF STATE]
proof (state)
this:
y \<in> carrier G
h y = \<one>\<^bsub>H\<^esub>

goal (1 subgoal):
 1. \<And>ha. \<lbrakk>ha \<in> carrier G; h ha = \<one>\<^bsub>H\<^esub>\<rbrakk> \<Longrightarrow> \<exists>x. x \<in> carrier G \<and> h x = \<one>\<^bsub>H\<^esub> \<and> ha \<otimes> g = x \<otimes> g'
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
g \<in> carrier G
g' \<in> carrier G
h g = h g'
y \<in> carrier G
h y = \<one>\<^bsub>H\<^esub>
[PROOF STEP]
show "\<exists>x. x \<in> carrier G \<and> h x = \<one>\<^bsub>H\<^esub> \<and> y \<otimes> g = x \<otimes> g'"
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G
g' \<in> carrier G
h g = h g'
y \<in> carrier G
h y = \<one>\<^bsub>H\<^esub>

goal (1 subgoal):
 1. \<exists>x. x \<in> carrier G \<and> h x = \<one>\<^bsub>H\<^esub> \<and> y \<otimes> g = x \<otimes> g'
[PROOF STEP]
by (rule_tac x="y \<otimes> g \<otimes> inv g'" in exI) (auto simp: G.m_assoc)
[PROOF STATE]
proof (state)
this:
\<exists>x. x \<in> carrier G \<and> h x = \<one>\<^bsub>H\<^esub> \<and> y \<otimes> g = x \<otimes> g'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in vectorspace) full_dim_span:
assumes "S \<subseteq> carrier V"
and "finite S"
and "vectorspace.dim K (span_vs S) = card S"
shows "lin_indpt S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_indpt S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lin_indpt S
[PROOF STEP]
have "vectorspace K (span_vs S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace K (vs (local.module.span S))
[PROOF STEP]
using field.field_axioms vectorspace_def submodule_is_module[OF span_is_submodule[OF assms(1)]]
[PROOF STATE]
proof (prove)
using this:
field K
vectorspace ?K ?V \<equiv> module ?K ?V \<and> field ?K
module K (vs (local.module.span S))

goal (1 subgoal):
 1. vectorspace K (vs (local.module.span S))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
vectorspace K (vs (local.module.span S))

goal (1 subgoal):
 1. lin_indpt S
[PROOF STEP]
have "S \<subseteq> carrier (span_vs S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> carrier (vs (local.module.span S))
[PROOF STEP]
by (simp add: assms(1) in_own_span)
[PROOF STATE]
proof (state)
this:
S \<subseteq> carrier (vs (local.module.span S))

goal (1 subgoal):
 1. lin_indpt S
[PROOF STEP]
have "LinearCombinations.module.span K (vs (span S)) S = carrier (vs (span S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LinearCombinations.module.span K (vs (local.module.span S)) S = carrier (vs (local.module.span S))
[PROOF STEP]
using module.span_li_not_depend[OF _ span_is_submodule[OF assms(1)]]
[PROOF STATE]
proof (prove)
using this:
?S \<subseteq> local.module.span S \<Longrightarrow> LinearCombinations.module.span K (vs (local.module.span S)) ?S = local.module.span ?S
?S \<subseteq> local.module.span S \<Longrightarrow> LinearCombinations.module.lin_dep K (vs (local.module.span S)) ?S = lin_dep ?S

goal (1 subgoal):
 1. LinearCombinations.module.span K (vs (local.module.span S)) S = carrier (vs (local.module.span S))
[PROOF STEP]
by (simp add: assms(1) in_own_span)
[PROOF STATE]
proof (state)
this:
LinearCombinations.module.span K (vs (local.module.span S)) S = carrier (vs (local.module.span S))

goal (1 subgoal):
 1. lin_indpt S
[PROOF STEP]
have "vectorspace.basis K (vs (span S)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.basis K (vs (local.module.span S)) S
[PROOF STEP]
using vectorspace.dim_gen_is_basis[OF \<open>vectorspace K (span_vs S)\<close> \<open>finite S\<close> \<open>S \<subseteq> carrier (span_vs S)\<close>
     \<open>LinearCombinations.module.span K (vs (span S)) S = carrier (vs (span S))\<close>]  \<open>vectorspace.dim K (span_vs S) = card S\<close>
[PROOF STATE]
proof (prove)
using this:
card S \<le> vectorspace.dim K (vs (local.module.span S)) \<Longrightarrow> vectorspace.basis K (vs (local.module.span S)) S
vectorspace.dim K (vs (local.module.span S)) = card S

goal (1 subgoal):
 1. vectorspace.basis K (vs (local.module.span S)) S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vectorspace.basis K (vs (local.module.span S)) S

goal (1 subgoal):
 1. lin_indpt S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vectorspace.basis K (vs (local.module.span S)) S
[PROOF STEP]
have "LinearCombinations.module.lin_indpt K (vs (span S)) S"
[PROOF STATE]
proof (prove)
using this:
vectorspace.basis K (vs (local.module.span S)) S

goal (1 subgoal):
 1. \<not> LinearCombinations.module.lin_dep K (vs (local.module.span S)) S
[PROOF STEP]
using vectorspace.basis_def[OF \<open>vectorspace K (span_vs S)\<close>]
[PROOF STATE]
proof (prove)
using this:
vectorspace.basis K (vs (local.module.span S)) S
vectorspace.basis K (vs (local.module.span S)) ?A = (\<not> LinearCombinations.module.lin_dep K (vs (local.module.span S)) ?A \<and> LinearCombinations.module.span K (vs (local.module.span S)) ?A = carrier (vs (local.module.span S)) \<and> ?A \<subseteq> carrier (vs (local.module.span S)))

goal (1 subgoal):
 1. \<not> LinearCombinations.module.lin_dep K (vs (local.module.span S)) S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> LinearCombinations.module.lin_dep K (vs (local.module.span S)) S

goal (1 subgoal):
 1. lin_indpt S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> LinearCombinations.module.lin_dep K (vs (local.module.span S)) S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> LinearCombinations.module.lin_dep K (vs (local.module.span S)) S

goal (1 subgoal):
 1. lin_indpt S
[PROOF STEP]
using module.span_li_not_depend[OF _ span_is_submodule[OF assms(1)]]
[PROOF STATE]
proof (prove)
using this:
\<not> LinearCombinations.module.lin_dep K (vs (local.module.span S)) S
?S \<subseteq> local.module.span S \<Longrightarrow> LinearCombinations.module.span K (vs (local.module.span S)) ?S = local.module.span ?S
?S \<subseteq> local.module.span S \<Longrightarrow> LinearCombinations.module.lin_dep K (vs (local.module.span S)) ?S = lin_dep ?S

goal (1 subgoal):
 1. lin_indpt S
[PROOF STEP]
by (simp add: assms(1) in_own_span)
[PROOF STATE]
proof (state)
this:
lin_indpt S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inv_fun_scale [simp]:
  "inv (f :: nat \<Rightarrow> 'a::ring) \<Longrightarrow> inv (fun_scale r f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abstract_Linear_Poly.inv f \<Longrightarrow> Abstract_Linear_Poly.inv (fun_scale r f)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Abstract_Linear_Poly.inv f \<Longrightarrow> Abstract_Linear_Poly.inv (fun_scale r f)
[PROOF STEP]
have *: "{v. r * (f v) \<noteq> 0} \<subseteq> {v. f v \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {v. r * f v \<noteq> (0::'a)} \<subseteq> {v. f v \<noteq> (0::'a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{v. r * f v \<noteq> (0::'a)} \<subseteq> {v. f v \<noteq> (0::'a)}

goal (1 subgoal):
 1. Abstract_Linear_Poly.inv f \<Longrightarrow> Abstract_Linear_Poly.inv (fun_scale r f)
[PROOF STEP]
assume "inv f"
[PROOF STATE]
proof (state)
this:
Abstract_Linear_Poly.inv f

goal (1 subgoal):
 1. Abstract_Linear_Poly.inv f \<Longrightarrow> Abstract_Linear_Poly.inv (fun_scale r f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Abstract_Linear_Poly.inv f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Abstract_Linear_Poly.inv f

goal (1 subgoal):
 1. Abstract_Linear_Poly.inv (fun_scale r f)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
Abstract_Linear_Poly.inv f
{v. r * f v \<noteq> (0::'a)} \<subseteq> {v. f v \<noteq> (0::'a)}

goal (1 subgoal):
 1. Abstract_Linear_Poly.inv (fun_scale r f)
[PROOF STEP]
by (auto simp add: finite_subset)
[PROOF STATE]
proof (state)
this:
Abstract_Linear_Poly.inv (fun_scale r f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma resolvent_is_resolvent_upon :
  assumes "resolvent P1 P2 C"
  shows "\<exists>A. C = resolvent_upon P1 P2 A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>A. C = resolvent_upon P1 P2 A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
resolvent P1 P2 C

goal (1 subgoal):
 1. \<exists>A. C = resolvent_upon P1 P2 A
[PROOF STEP]
unfolding resolvent_def
[PROOF STATE]
proof (prove)
using this:
\<exists>A. Pos A \<in> P1 \<and> Neg A \<in> P2 \<and> C = P1 - {Pos A} \<union> (P2 - {Neg A})

goal (1 subgoal):
 1. \<exists>A. C = resolvent_upon P1 P2 A
[PROOF STEP]
by auto


[STATEMENT]
lemma listrel_iff_zip [code_unfold]: "(xs,ys) \<in> listrel r \<longleftrightarrow>
  length xs = length ys \<and> (\<forall>(x,y) \<in> set(zip xs ys). (x,y) \<in> r)" (is "?L \<longleftrightarrow> ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((xs, ys) \<in> listrel r) = (length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (xs, ys) \<in> listrel r \<Longrightarrow> length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r)
 2. length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r) \<Longrightarrow> (xs, ys) \<in> listrel r
[PROOF STEP]
assume ?L
[PROOF STATE]
proof (state)
this:
(xs, ys) \<in> listrel r

goal (2 subgoals):
 1. (xs, ys) \<in> listrel r \<Longrightarrow> length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r)
 2. length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r) \<Longrightarrow> (xs, ys) \<in> listrel r
[PROOF STEP]
thus ?R
[PROOF STATE]
proof (prove)
using this:
(xs, ys) \<in> listrel r

goal (1 subgoal):
 1. length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r)
[PROOF STEP]
by induct (auto intro: listrel_eq_len)
[PROOF STATE]
proof (state)
this:
length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r)

goal (1 subgoal):
 1. length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r) \<Longrightarrow> (xs, ys) \<in> listrel r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r) \<Longrightarrow> (xs, ys) \<in> listrel r
[PROOF STEP]
assume ?R
[PROOF STATE]
proof (state)
this:
length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r)

goal (1 subgoal):
 1. length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r) \<Longrightarrow> (xs, ys) \<in> listrel r
[PROOF STEP]
thus ?L
[PROOF STATE]
proof (prove)
using this:
length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r)

goal (1 subgoal):
 1. (xs, ys) \<in> listrel r
[PROOF STEP]
apply (clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = length ys; \<forall>(x, y)\<in>set (zip xs ys). (x, y) \<in> r\<rbrakk> \<Longrightarrow> (xs, ys) \<in> listrel r
[PROOF STEP]
by (induct rule: list_induct2) (auto intro: listrel.intros)
[PROOF STATE]
proof (state)
this:
(xs, ys) \<in> listrel r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_eq_polar: "exp z = exp (Re z) * cis (Im z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp z = complex_of_real (exp (Re z)) * cis (Im z)
[PROOF STEP]
unfolding cis_conv_exp exp_of_real [symmetric] mult_exp_exp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp z = exp (complex_of_real (Re z) + \<i> * complex_of_real (Im z))
[PROOF STEP]
by (cases z) (simp add: Complex_eq)


[STATEMENT]
lemma "\<forall>(x::'a::linordered_field) y. \<exists>z. \<forall>w. \<bar>x - y\<bar> = \<bar>z - w\<bar> \<longrightarrow> z < x \<and> w \<noteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. \<exists>z. \<forall>w. \<bar>x - y\<bar> = \<bar>z - w\<bar> \<longrightarrow> z < x \<and> w \<noteq> y
[PROOF STEP]
by ferrack


[STATEMENT]
lemma flatf_gfp_transfer:
    \<comment> \<open>Transfer rule for greatest fixed points\<close>
    fixes B::"(_ \<Rightarrow> 'a::order_top) \<Rightarrow> _"
    assumes TR_TOP[simp]: "\<And>x. tr x top"
    assumes MONO: "flatf_mono_ge B"
    assumes MONO': "flatf_mono_ge B'"
    assumes R0: "P x x'"
    assumes RS: "\<And>f f' x x'.
       \<lbrakk>\<And>x x'. P x x' \<Longrightarrow> tr (f x) (f' x'); P x x'; flatf_gfp B = f\<rbrakk>
       \<Longrightarrow> tr (B f x) (B' f' x')"
    shows "tr (flatf_gfp B x) (flatf_gfp B' x')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tr (flatf_gfp B x) (flatf_gfp B' x')
[PROOF STEP]
apply (rule flatf_fixp_transfer[where
        tr="\<lambda>x y. tr y x" and fp'="flatf_gfp B" and P="\<lambda>x y. P y x"])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>x'. tr x' top
 2. monotone flatf_ge flatf_ge B'
 3. flatf_gfp B = ?B' (flatf_gfp B)
 4. P x x'
 5. \<And>f f' x x'. \<lbrakk>\<And>x x'. P x' x \<Longrightarrow> tr (f' x') (f x); P x' x; flatf_gfp B = f'\<rbrakk> \<Longrightarrow> tr (?B' f' x') (B' f x)
[PROOF STEP]
apply (fact|assumption|rule flatf_ord.fixp_unfold[OF MONO] RS)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma integrable_distr_eq:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  assumes [measurable]: "g \<in> measurable M N" "f \<in> borel_measurable N"
  shows "integrable (distr M N g) f \<longleftrightarrow> integrable M (\<lambda>x. f (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (distr M N g) f = integrable M (\<lambda>x. f (g x))
[PROOF STEP]
unfolding integrable_iff_bounded
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> borel_measurable (distr M N g) \<and> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>distr M N g < \<infinity>) = ((\<lambda>x. f (g x)) \<in> borel_measurable M \<and> \<integral>\<^sup>+ x. ennreal (norm (f (g x))) \<partial>M < \<infinity>)
[PROOF STEP]
by (simp_all add: nn_integral_distr)


[STATEMENT]
lemma R39_d [simp]: "pmf (sds R39) d = 1/2 - pmf (sds R39) c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (sds R39) d = 1 / 2 - pmf (sds R39) c
[PROOF STEP]
using lottery_conditions[OF R39.wf]
[PROOF STATE]
proof (prove)
using this:
0 \<le> pmf (sds R39) a
0 \<le> pmf (sds R39) b
0 \<le> pmf (sds R39) c
0 \<le> pmf (sds R39) d
pmf (sds R39) a + pmf (sds R39) b + pmf (sds R39) c + pmf (sds R39) d = 1

goal (1 subgoal):
 1. pmf (sds R39) d = 1 / 2 - pmf (sds R39) c
[PROOF STEP]
by simp


[STATEMENT]
lemma ex_1[simp]: "(\<exists>x::num1. P x) \<longleftrightarrow> P 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. P x) = P 1
[PROOF STEP]
by auto (metis (full_types) num1_eq_iff)


[STATEMENT]
theorem Crypt_Nonce_neq_Nonce:
  shows "Crypt K (Nonce M) \<noteq> Nonce N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Crypt K (Nonce M) \<noteq> Nonce N
[PROOF STEP]
by (descending) (auto dest: msgrel_imp_eq_freediscrim)


[STATEMENT]
lemma (in disc_equity_market) trading_strategy_init:
  assumes "trading_strategy p"
and "support_adapt Mkt p"
  shows "\<exists>c. \<forall>w \<in> space M. val_process Mkt p 0 w = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>c. \<forall>w\<in>space M. val_process Mkt p 0 w = c
[PROOF STEP]
using assms adapted_init ats_val_process_adapted
[PROOF STATE]
proof (prove)
using this:
trading_strategy p
support_adapt Mkt p
borel_adapt_stoch_proc F ?x \<Longrightarrow> \<exists>c. \<forall>w\<in>space M. ?x 0 w = c
\<lbrakk>trading_strategy ?p; support_adapt Mkt ?p\<rbrakk> \<Longrightarrow> borel_adapt_stoch_proc F (val_process Mkt ?p)

goal (1 subgoal):
 1. \<exists>c. \<forall>w\<in>space M. val_process Mkt p 0 w = c
[PROOF STEP]
by simp


[STATEMENT]
theorem p60: "\<forall>x. F(x,f(x)) \<longleftrightarrow> (\<exists>y. (\<forall>z. F(z,y) \<longrightarrow> F(z,f(x))) \<and> F(x,y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. F (x, f x) = (\<exists>y. (\<forall>z. F (z, y) \<longrightarrow> F (z, f x)) \<and> F (x, y))
[PROOF STEP]
by auto2


[STATEMENT]
lemma matrix_to_iarray_rank[code_unfold]:
  shows "rank A = rank_iarray (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = rank_iarray (matrix_to_iarray A)
[PROOF STEP]
unfolding rank_eq_card_iarrays_code rank_iarray_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat i)} = card {i. i < IArray.length (Gauss_Jordan_iarrays (matrix_to_iarray A)) \<and> \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! i)}
[PROOF STEP]
apply (rule bij_betw_same_card[of "to_nat"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw mod_type_class.to_nat {i. \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat i)} {i. i < IArray.length (Gauss_Jordan_iarrays (matrix_to_iarray A)) \<and> \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! i)}
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on mod_type_class.to_nat {i. \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat i)} \<and> mod_type_class.to_nat ` {i. \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat i)} = {i. i < IArray.length (Gauss_Jordan_iarrays (matrix_to_iarray A)) \<and> \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! i)}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. inj_on mod_type_class.to_nat {i. \<not> is_zero_iarray (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A)) ! mod_type_class.to_nat i)}
 2. \<And>xa. \<not> is_zero_iarray (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A)) ! mod_type_class.to_nat xa) \<Longrightarrow> mod_type_class.to_nat xa < length (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A)))
 3. \<And>x. \<lbrakk>x < length (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A))); \<not> is_zero_iarray (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A)) ! x)\<rbrakk> \<Longrightarrow> x \<in> mod_type_class.to_nat ` {i. \<not> is_zero_iarray (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A)) ! mod_type_class.to_nat i)}
[PROOF STEP]
unfolding IArray.length_def[symmetric] IArray.sub_def[symmetric]
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. inj_on mod_type_class.to_nat {i. \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat i)}
 2. \<And>xa. \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat xa) \<Longrightarrow> mod_type_class.to_nat xa < IArray.length (Gauss_Jordan_iarrays (matrix_to_iarray A))
 3. \<And>x. \<lbrakk>x < IArray.length (Gauss_Jordan_iarrays (matrix_to_iarray A)); \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! x)\<rbrakk> \<Longrightarrow> x \<in> mod_type_class.to_nat ` {i. \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat i)}
[PROOF STEP]
apply (metis inj_onI to_nat_eq)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat xa) \<Longrightarrow> mod_type_class.to_nat xa < IArray.length (Gauss_Jordan_iarrays (matrix_to_iarray A))
 2. \<And>x. \<lbrakk>x < IArray.length (Gauss_Jordan_iarrays (matrix_to_iarray A)); \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! x)\<rbrakk> \<Longrightarrow> x \<in> mod_type_class.to_nat ` {i. \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat i)}
[PROOF STEP]
unfolding  matrix_to_iarray_Gauss_Jordan[symmetric] length_eq_card_rows
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. \<not> is_zero_iarray (matrix_to_iarray (Gauss_Jordan A) !! mod_type_class.to_nat xa) \<Longrightarrow> mod_type_class.to_nat xa < CARD('c)
 2. \<And>x. \<lbrakk>x < CARD('c); \<not> is_zero_iarray (matrix_to_iarray (Gauss_Jordan A) !! x)\<rbrakk> \<Longrightarrow> x \<in> mod_type_class.to_nat ` {i. \<not> is_zero_iarray (matrix_to_iarray (Gauss_Jordan A) !! mod_type_class.to_nat i)}
[PROOF STEP]
using bij_to_nat[where ?'a='c]
[PROOF STATE]
proof (prove)
using this:
bij_betw mod_type_class.to_nat UNIV {0..<CARD('c)}

goal (2 subgoals):
 1. \<And>xa. \<not> is_zero_iarray (matrix_to_iarray (Gauss_Jordan A) !! mod_type_class.to_nat xa) \<Longrightarrow> mod_type_class.to_nat xa < CARD('c)
 2. \<And>x. \<lbrakk>x < CARD('c); \<not> is_zero_iarray (matrix_to_iarray (Gauss_Jordan A) !! x)\<rbrakk> \<Longrightarrow> x \<in> mod_type_class.to_nat ` {i. \<not> is_zero_iarray (matrix_to_iarray (Gauss_Jordan A) !! mod_type_class.to_nat i)}
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj mod_type_class.to_nat \<and> range mod_type_class.to_nat = {0..<CARD('c)}

goal (2 subgoals):
 1. \<And>xa. \<not> is_zero_iarray (matrix_to_iarray (Gauss_Jordan A) !! mod_type_class.to_nat xa) \<Longrightarrow> mod_type_class.to_nat xa < CARD('c)
 2. \<And>x. \<lbrakk>x < CARD('c); \<not> is_zero_iarray (matrix_to_iarray (Gauss_Jordan A) !! x)\<rbrakk> \<Longrightarrow> x \<in> mod_type_class.to_nat ` {i. \<not> is_zero_iarray (matrix_to_iarray (Gauss_Jordan A) !! mod_type_class.to_nat i)}
[PROOF STEP]
by auto


[STATEMENT]
theorem "\<forall>(x::nat). \<exists>(y::nat). (0::nat) \<le> 5 --> y = 5 + x "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. \<exists>y. 0 \<le> 5 \<longrightarrow> y = 5 + x
[PROOF STEP]
by presburger


[STATEMENT]
lemma "kauff_mat ([cup]*(basic [cap])) = [[-(A^2) - (B^2)]]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kauff_mat ([cup] * basic [cap]) = [[rat_poly_inv (A\<^sup>2) - B\<^sup>2]]
[PROOF STEP]
apply(simp add:mat_multI_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matT_vec_multI 0 rat_poly_plus rat_poly_times (map2 (#) [0] (map2 (#) [A] (map2 (#) [rat_poly_inv B] (map2 (#) [0] (replicate (rat_poly.row_length [[0], [A], [rat_poly_inv B], [0]]) []))))) [0, rat_poly_inv A, B, 0] = [rat_poly_inv (A\<^sup>2) - B\<^sup>2]
[PROOF STEP]
apply(simp add:matT_vec_multI_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((\<lambda>w. scalar_prod w [0, rat_poly_inv A, B, 0]) \<circ> (\<lambda>(x, y). x # y)) (zip [0] (map2 (#) [A] (map2 (#) [rat_poly_inv B] (map2 (#) [0] (replicate (rat_poly.row_length [[0], [A], [rat_poly_inv B], [0]]) []))))) = [rat_poly_inv (A\<^sup>2) - B\<^sup>2]
[PROOF STEP]
apply(auto simp add:replicate_def rat_poly.row_length_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scalar_prod [0, A, rat_poly_inv B, 0] [0, rat_poly_inv A, B, 0] = rat_poly_inv (A\<^sup>2) - B\<^sup>2
[PROOF STEP]
apply(auto simp add:scalar_prod)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_inv (rat_poly_times A A) - rat_poly_times B B = rat_poly_inv (A\<^sup>2) - B\<^sup>2
[PROOF STEP]
by (simp add: power2_eq_square)


[STATEMENT]
lemma lim_stream_Suc[measurable]:
  assumes p: "is_policy p"
  shows "(\<lambda>a. lim_stream (Suc_policy p a) (K a)) \<in> M \<rightarrow>\<^sub>M prob_algebra (stream_space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a. lim_stream (Suc_policy p a) (K a)) \<in> M \<rightarrow>\<^sub>M prob_algebra (stream_space M)
[PROOF STEP]
unfolding lim_stream_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a. distr (lim_sequence (Suc_policy p a) (K a)) (stream_space M) to_stream) \<in> M \<rightarrow>\<^sub>M prob_algebra (stream_space M)
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
is_policy p

goal (1 subgoal):
 1. (\<lambda>a. distr (lim_sequence (Suc_policy p a) (K a)) (stream_space M) to_stream) \<in> M \<rightarrow>\<^sub>M prob_algebra (stream_space M)
[PROOF STEP]
by (auto intro: measurable_distr_prob_space2[OF lim_sequence_Suc_K])


[STATEMENT]
lemma spmf_scale_spmf: "spmf (scale_spmf r p) x = max 0 (min (inverse (weight_spmf p)) r) * spmf p x" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. spmf (scale_spmf r p) x = max 0 (min (inverse (weight_spmf p)) r) * spmf p x
[PROOF STEP]
unfolding scale_spmf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. spmf (embed_spmf (\<lambda>x. min (inverse (weight_spmf p)) (max 0 r) * spmf p x)) x = max 0 (min (inverse (weight_spmf p)) r) * spmf p x
[PROOF STEP]
apply(subst spmf_embed_spmf[OF scale_spmf_le_1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max 0 (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) = max 0 (min (inverse (weight_spmf p)) r) * spmf p x
[PROOF STEP]
apply(simp add: max_def min_def weight_spmf_le_0 field_simps weight_spmf_nonneg not_le order.strict_iff_order)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<le> 0 \<and> r \<noteq> 0 \<longrightarrow> weight_spmf p \<noteq> 0 \<longrightarrow> 1 \<le> r * weight_spmf p \<longrightarrow> spmf p x = 0
[PROOF STEP]
apply(metis antisym_conv order_trans weight_spmf_nonneg zero_le_mult_iff zero_le_one)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma normalize1_dsjnt_subset_split1:
  fixes t1
  defines "X \<equiv> {v \<in> dverts (normalize1 t1). v \<notin> dverts t1}"
  assumes "wf_dlverts t1"
  shows "{x. x\<in>dverts t1 \<and> set x \<inter> \<Union>(set ` X) = {}} \<subseteq> {v \<in> dverts (normalize1 t1). v \<in> dverts t1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> dverts t1. set x \<inter> \<Union> (set ` X) = {}} \<subseteq> {v \<in> dverts (normalize1 t1). v \<in> dverts t1}
[PROOF STEP]
using assms normalize1_dsjnt_in_dverts
[PROOF STATE]
proof (prove)
using this:
X \<equiv> {v \<in> dverts (normalize1 t1). v \<notin> dverts t1}
wf_dlverts t1
\<lbrakk>wf_dlverts ?t1.0; ?v \<in> dverts ?t1.0; set ?v \<inter> \<Union> (set ` {v \<in> dverts (normalize1 ?t1.0). v \<notin> dverts ?t1.0}) = {}\<rbrakk> \<Longrightarrow> ?v \<in> dverts (normalize1 ?t1.0)

goal (1 subgoal):
 1. {x \<in> dverts t1. set x \<inter> \<Union> (set ` X) = {}} \<subseteq> {v \<in> dverts (normalize1 t1). v \<in> dverts t1}
[PROOF STEP]
by blast


[STATEMENT]
lemma (in Ring) bilinear_r_add:"\<lbrakk>R module M1; R module M2; R module N;
      m \<in> carrier M1; m21 \<in> carrier M2; m22 \<in> carrier M2;
      bilinear_map f R M1 M2 N\<rbrakk> \<Longrightarrow>
      f (m, m21 \<plusminus>\<^bsub>M2\<^esub> m22) = f (m, m21) \<plusminus>\<^bsub>N\<^esub> (f (m, m22))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module M1; R module M2; R module N; m \<in> carrier M1; m21 \<in> carrier M2; m22 \<in> carrier M2; bilinear_map f R M1 M2 N\<rbrakk> \<Longrightarrow> f (m, m21 \<plusminus>\<^bsub>M2\<^esub> m22) = f (m, m21) \<plusminus>\<^bsub>N\<^esub> f (m, m22)
[PROOF STEP]
apply (simp add:bilinear_map_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_integral_open_interval:
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
  shows "(f has_integral y) (box a b) \<longleftrightarrow> (f has_integral y) (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_integral y) (box a b) = (f has_integral y) (cbox a b)
[PROOF STEP]
unfolding interior_cbox [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_integral y) (interior (cbox a b)) = (f has_integral y) (cbox a b)
[PROOF STEP]
by (metis frontier_cbox has_integral_interior negligible_frontier_interval)


[STATEMENT]
lemma ennreal_eq_0_iff: "ennreal x = 0 \<longleftrightarrow> x \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ennreal x = 0) = (x \<le> 0)
[PROOF STEP]
by (cases "0 \<le> x") (auto simp: ennreal_neg)


[STATEMENT]
lemma ord_congruence_set_SA_function:
  assumes "n \<ge> 0"
  assumes "c \<in> carrier (SA (m+l))"
  shows "is_semialgebraic (m+l) {x \<in> carrier (Q\<^sub>p\<^bsup>m+l\<^esup>). c x \<in> nonzero Q\<^sub>p \<and> ord (c x) mod n = a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialgebraic (m + l) {x \<in> carrier (Q\<^sub>p\<^bsup>m + l\<^esup>). c x \<in> nonzero Q\<^sub>p \<and> ord (c x) mod n = a}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_semialgebraic (m + l) {x \<in> carrier (Q\<^sub>p\<^bsup>m + l\<^esup>). c x \<in> nonzero Q\<^sub>p \<and> ord (c x) mod n = a}
[PROOF STEP]
have 0: "{x \<in> carrier (Q\<^sub>p\<^bsup>m+l\<^esup>). c x \<in> nonzero Q\<^sub>p \<and> ord (c x) mod n = a} = c  \<inverse>\<^bsub>m+l\<^esub> (ord_congruence_set n a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> carrier (Q\<^sub>p\<^bsup>m + l\<^esup>). c x \<in> nonzero Q\<^sub>p \<and> ord (c x) mod n = a} = c \<inverse>\<^bsub>m + l\<^esub> ord_congruence_set n a
[PROOF STEP]
unfolding ord_congruence_set_def evimage_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> carrier (Q\<^sub>p\<^bsup>m + l\<^esup>). c x \<in> nonzero Q\<^sub>p \<and> ord (c x) mod n = a} = c -` {x \<in> nonzero Q\<^sub>p. ord x mod n = a} \<inter> carrier (Q\<^sub>p\<^bsup>m + l\<^esup>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> n
c \<in> carrier (SA (m + l))

goal (1 subgoal):
 1. {x \<in> carrier (Q\<^sub>p\<^bsup>m + l\<^esup>). c x \<in> nonzero Q\<^sub>p \<and> ord (c x) mod n = a} = c -` {x \<in> nonzero Q\<^sub>p. ord x mod n = a} \<inter> carrier (Q\<^sub>p\<^bsup>m + l\<^esup>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{x \<in> carrier (Q\<^sub>p\<^bsup>m + l\<^esup>). c x \<in> nonzero Q\<^sub>p \<and> ord (c x) mod n = a} = c \<inverse>\<^bsub>m + l\<^esub> ord_congruence_set n a

goal (1 subgoal):
 1. is_semialgebraic (m + l) {x \<in> carrier (Q\<^sub>p\<^bsup>m + l\<^esup>). c x \<in> nonzero Q\<^sub>p \<and> ord (c x) mod n = a}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialgebraic (m + l) {x \<in> carrier (Q\<^sub>p\<^bsup>m + l\<^esup>). c x \<in> nonzero Q\<^sub>p \<and> ord (c x) mod n = a}
[PROOF STEP]
unfolding 0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialgebraic (m + l) (c \<inverse>\<^bsub>m + l\<^esub> ord_congruence_set n a)
[PROOF STEP]
apply(rule evimage_is_semialg)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c \<in> carrier (SA (m + l))
 2. is_univ_semialgebraic (ord_congruence_set n a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> n
c \<in> carrier (SA (m + l))

goal (2 subgoals):
 1. c \<in> carrier (SA (m + l))
 2. is_univ_semialgebraic (ord_congruence_set n a)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_univ_semialgebraic (ord_congruence_set n a)
[PROOF STEP]
using assms  ord_congruence_set_univ_semialg_fixed[of n a]
[PROOF STATE]
proof (prove)
using this:
0 \<le> n
c \<in> carrier (SA (m + l))
0 \<le> n \<Longrightarrow> is_univ_semialgebraic (ord_congruence_set n a)

goal (1 subgoal):
 1. is_univ_semialgebraic (ord_congruence_set n a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_semialgebraic (m + l) {x \<in> carrier (Q\<^sub>p\<^bsup>m + l\<^esup>). c x \<in> nonzero Q\<^sub>p \<and> ord (c x) mod n = a}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coord_ring_to_UP_SA_mult:
  assumes "f \<in> carrier (Q\<^sub>p[\<X>\<^bsub>Suc n\<^esub>])"
  assumes "g \<in> carrier (Q\<^sub>p[\<X>\<^bsub>Suc n\<^esub>])"
  shows "coord_ring_to_UP_SA n (f \<otimes>\<^bsub>Q\<^sub>p[\<X>\<^bsub>Suc n\<^esub>]\<^esub>g) = coord_ring_to_UP_SA n f  \<otimes>\<^bsub>UP (SA n)\<^esub> coord_ring_to_UP_SA n g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coord_ring_to_UP_SA n (f \<otimes>\<^bsub>Q\<^sub>p [\<X>\<^bsub>Suc n\<^esub>]\<^esub> g) = coord_ring_to_UP_SA n f \<otimes>\<^bsub>UP (SA n)\<^esub> coord_ring_to_UP_SA n g
[PROOF STEP]
using assms coord_ring_to_UP_SA_is_hom ring_hom_mult
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (Q\<^sub>p [\<X>\<^bsub>Suc n\<^esub>])
g \<in> carrier (Q\<^sub>p [\<X>\<^bsub>Suc n\<^esub>])
coord_ring_to_UP_SA ?n \<in> ring_hom (Q\<^sub>p [\<X>\<^bsub>Suc ?n\<^esub>]) (UP (SA ?n))
\<lbrakk>?h \<in> ring_hom ?R ?S; ?x \<in> carrier ?R; ?y \<in> carrier ?R\<rbrakk> \<Longrightarrow> ?h (?x \<otimes>\<^bsub>?R\<^esub> ?y) = ?h ?x \<otimes>\<^bsub>?S\<^esub> ?h ?y

goal (1 subgoal):
 1. coord_ring_to_UP_SA n (f \<otimes>\<^bsub>Q\<^sub>p [\<X>\<^bsub>Suc n\<^esub>]\<^esub> g) = coord_ring_to_UP_SA n f \<otimes>\<^bsub>UP (SA n)\<^esub> coord_ring_to_UP_SA n g
[PROOF STEP]
by (metis (no_types, opaque_lifting))


[STATEMENT]
theorem wls_fresh_vsubst:
assumes "wls s X"
shows "fresh zs z (X #[y1 // y]_ys) =
       (((zs = ys \<and> z = y) \<or> fresh zs z X) \<and> (fresh ys y X \<or> (zs \<noteq> ys \<or> z \<noteq> y1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fresh zs z (X #[y1 // y]_ys) = ((zs = ys \<and> z = y \<or> fresh zs z X) \<and> (fresh ys y X \<or> zs \<noteq> ys \<or> z \<noteq> y1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wls s X

goal (1 subgoal):
 1. fresh zs z (X #[y1 // y]_ys) = ((zs = ys \<and> z = y \<or> fresh zs z X) \<and> (fresh ys y X \<or> zs \<noteq> ys \<or> z \<noteq> y1))
[PROOF STEP]
by(simp add: fresh_vsubst)


[STATEMENT]
lemma "min (i::int) j <= max i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min i j \<le> max i j
[PROOF STEP]
by linarith


[STATEMENT]
lemma step_4_pop_small_size_ok: "\<lbrakk>
  invar (States dir big small);
  0 < size small;
  Small.pop small = (x, smallP);
  4 \<le> remaining_steps (States dir big smallP);
  size_ok (States dir big small)
\<rbrakk> \<Longrightarrow> size_ok ((step^^4) (States dir big smallP))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar (States dir big small); 0 < size small; Small.pop small = (x, smallP); 4 \<le> remaining_steps (States dir big smallP); size_ok (States dir big small)\<rbrakk> \<Longrightarrow> size_ok ((step ^^ 4) (States dir big smallP))
[PROOF STEP]
by (smt (verit) size_ok'.elims(3) size_ok'.simps step_4_pop_small_size_ok_1 step_4_pop_small_size_ok_2 step_4_pop_small_size_ok_3 step_4_pop_small_size_ok_4)


[STATEMENT]
lemma pp_dist_sum:
  fixes f :: "'b::finite \<Rightarrow> 'a"
  shows "(\<Squnion>\<^sub>k --f k) = --(\<Squnion>\<^sub>k f k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comm_monoid_add.sum (\<squnion>) bot (\<lambda>k. - - f k) {k. True} = - - comm_monoid_add.sum (\<squnion>) bot f {k. True}
[PROOF STEP]
proof (induct rule: one_sup_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. - - f i = - - f i
 2. \<And>j I. \<lbrakk>j \<notin> I; comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - comm_monoid_add.sum (\<squnion>) bot f I\<rbrakk> \<Longrightarrow> - - f j \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)
[PROOF STEP]
case one
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>i. - - f i = - - f i
 2. \<And>j I. \<lbrakk>j \<notin> I; comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - comm_monoid_add.sum (\<squnion>) bot f I\<rbrakk> \<Longrightarrow> - - f j \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - - f i_ = - - f i_
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- - f i_ = - - f i_

goal (1 subgoal):
 1. \<And>j I. \<lbrakk>j \<notin> I; comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - comm_monoid_add.sum (\<squnion>) bot f I\<rbrakk> \<Longrightarrow> - - f j \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j I. \<lbrakk>j \<notin> I; comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - comm_monoid_add.sum (\<squnion>) bot f I\<rbrakk> \<Longrightarrow> - - f j \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)
[PROOF STEP]
case (sup j I)
[PROOF STATE]
proof (state)
this:
j \<notin> I
comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - comm_monoid_add.sum (\<squnion>) bot f I

goal (1 subgoal):
 1. \<And>j I. \<lbrakk>j \<notin> I; comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - comm_monoid_add.sum (\<squnion>) bot f I\<rbrakk> \<Longrightarrow> - - f j \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
j \<notin> I
comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - comm_monoid_add.sum (\<squnion>) bot f I

goal (1 subgoal):
 1. - - f j \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- - f j \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. - - f i) I = - - (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Infinitesimal_hyperpow: "x \<in> Infinitesimal \<Longrightarrow> 0 < N \<Longrightarrow> x pow N \<in> Infinitesimal"
  for x :: hypreal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> Infinitesimal; 0 < N\<rbrakk> \<Longrightarrow> x pow N \<in> Infinitesimal
[PROOF STEP]
using hrabs_le_Infinitesimal lemma_Infinitesimal_hyperpow
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?e \<in> Infinitesimal; \<bar>?x\<bar> \<le> ?e\<rbrakk> \<Longrightarrow> ?x \<in> Infinitesimal
\<lbrakk>?x \<in> Infinitesimal; 0 < ?N\<rbrakk> \<Longrightarrow> \<bar>?x pow ?N\<bar> \<le> \<bar>?x\<bar>

goal (1 subgoal):
 1. \<lbrakk>x \<in> Infinitesimal; 0 < N\<rbrakk> \<Longrightarrow> x pow N \<in> Infinitesimal
[PROOF STEP]
by blast


[STATEMENT]
lemma continuous_logarithm_on_ball:
  fixes f :: "'a::real_normed_vector \<Rightarrow> complex"
  assumes "continuous_on (ball a r) f" and "\<And>z. z \<in> ball a r \<Longrightarrow> f z \<noteq> 0"
  obtains h where "continuous_on (ball a r) h" "\<And>z. z \<in> ball a r \<Longrightarrow> f z = exp(h z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>h. \<lbrakk>continuous_on (ball a r) h; \<And>z. z \<in> ball a r \<Longrightarrow> f z = exp (h z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms continuous_logarithm_on_contractible convex_imp_contractible
[PROOF STATE]
proof (prove)
using this:
continuous_on (ball a r) f
?z \<in> ball a r \<Longrightarrow> f ?z \<noteq> 0
\<lbrakk>continuous_on ?S ?f; contractible ?S; \<And>z. z \<in> ?S \<Longrightarrow> ?f z \<noteq> 0; \<And>g. \<lbrakk>continuous_on ?S g; \<And>x. x \<in> ?S \<Longrightarrow> ?f x = exp (g x)\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
convex ?S \<Longrightarrow> contractible ?S

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>continuous_on (ball a r) h; \<And>z. z \<in> ball a r \<Longrightarrow> f z = exp (h z)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma nat_of_natural_min [simp]:
  "nat_of_natural (min k l) = min (nat_of_natural k) (nat_of_natural l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_of_natural (min k l) = min (nat_of_natural k) (nat_of_natural l)
[PROOF STEP]
by transfer rule


[STATEMENT]
lemma add_positive_le_reduce2:
  assumes dA: "A \<in> carrier_mat n n" and dB: "B \<in> carrier_mat n n" and dC: "C \<in> carrier_mat n n"
    and pB: "positive B" and le: "B + A \<le>\<^sub>L C"
  shows "A \<le>\<^sub>L C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<le>\<^sub>L C
[PROOF STEP]
apply (subgoal_tac "B + A = A + B")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. B + A = A + B \<Longrightarrow> A \<le>\<^sub>L C
 2. B + A = A + B
[PROOF STEP]
using add_positive_le_reduce1[of A n B C] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A \<in> carrier_mat n n; B \<in> carrier_mat n n; C \<in> carrier_mat n n; positive B; A + B \<le>\<^sub>L C\<rbrakk> \<Longrightarrow> A \<le>\<^sub>L C
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n
positive B
B + A \<le>\<^sub>L C

goal (2 subgoals):
 1. B + A = A + B \<Longrightarrow> A \<le>\<^sub>L C
 2. B + A = A + B
[PROOF STEP]
by auto


[STATEMENT]
lemma Aleph_lt_succD [simp]: "\<aleph>\<alpha> < Aleph (succ \<alpha>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<aleph>\<alpha> < \<aleph>ZFC_in_HOL.succ \<alpha>
[PROOF STEP]
by (simp add: InfCard_is_Limit Limit_is_Ord OrdmemD mem_Aleph_succ)


[STATEMENT]
lemma wp_UN_eq:
     "[|single_valued act; I\<noteq>{}|]
      ==> wp act (\<Union>i\<in>I. A i) = (\<Union>i\<in>I. wp act (A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>single_valued act; I \<noteq> {}\<rbrakk> \<Longrightarrow> wp act (\<Union> (A ` I)) = (\<Union>i\<in>I. wp act (A i))
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>single_valued act; I \<noteq> {}\<rbrakk> \<Longrightarrow> wp act (\<Union> (A ` I)) \<subseteq> (\<Union>i\<in>I. wp act (A i))
 2. \<lbrakk>single_valued act; I \<noteq> {}\<rbrakk> \<Longrightarrow> (\<Union>i\<in>I. wp act (A i)) \<subseteq> wp act (\<Union> (A ` I))
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>single_valued act; I \<noteq> {}\<rbrakk> \<Longrightarrow> (\<Union>i\<in>I. wp act (A i)) \<subseteq> wp act (\<Union> (A ` I))
 2. \<lbrakk>single_valued act; I \<noteq> {}\<rbrakk> \<Longrightarrow> wp act (\<Union> (A ` I)) \<subseteq> (\<Union>i\<in>I. wp act (A i))
[PROOF STEP]
apply (rule wp_UN_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>single_valued act; I \<noteq> {}\<rbrakk> \<Longrightarrow> wp act (\<Union> (A ` I)) \<subseteq> (\<Union>i\<in>I. wp act (A i))
[PROOF STEP]
apply (simp add: wp_def Image_INT_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "repl (succ (succ (succ zero))) True = [True, True, True]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. repl (succ (succ (succ zero))) True = [True, True, True]
[PROOF STEP]
by simp


[STATEMENT]
lemma hmset_of_enat_1[simp]: "hmset_of_enat 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hmset_of_enat 1 = 1
[PROOF STEP]
by (simp add: one_enat_def del: One_nat_def)


[STATEMENT]
lemma push_precondI_nz:
  "\<lbrakk>excess f u \<noteq> 0; (u,v)\<in>cfE_of f; l u = l v + 1\<rbrakk> \<Longrightarrow> push_precond f l (u,v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>excess f u \<noteq> (0::'a); (u, v) \<in> cf.E; l u = l v + 1\<rbrakk> \<Longrightarrow> push_precond f l (u, v)
[PROOF STEP]
unfolding push_precond_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>excess f u \<noteq> (0::'a); (u, v) \<in> cf.E; l u = l v + 1\<rbrakk> \<Longrightarrow> case (u, v) of (u, v) \<Rightarrow> (0::'a) < excess f u \<and> (u, v) \<in> cf.E \<and> l u = l v + 1
[PROOF STEP]
by (auto simp: excess_nz_iff_gz)


[STATEMENT]
lemma Sup_sigma:
  assumes [simp]: "M \<noteq> {}" and M: "\<And>m. m \<in> M \<Longrightarrow> m \<subseteq> Pow \<Omega>"
  shows "(SUP m\<in>M. sigma \<Omega> m) = (sigma \<Omega> (\<Union>M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (sigma \<Omega> ` M) = sigma \<Omega> (\<Union> M)
[PROOF STEP]
proof (intro antisym SUP_least)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m. m \<in> M \<Longrightarrow> sigma \<Omega> m \<le> sigma \<Omega> (\<Union> M)
 2. sigma \<Omega> (\<Union> M) \<le> Sup (sigma \<Omega> ` M)
[PROOF STEP]
have *: "\<Union>M \<subseteq> Pow \<Omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> M \<subseteq> Pow \<Omega>
[PROOF STEP]
using M
[PROOF STATE]
proof (prove)
using this:
?m \<in> M \<Longrightarrow> ?m \<subseteq> Pow \<Omega>

goal (1 subgoal):
 1. \<Union> M \<subseteq> Pow \<Omega>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> M \<subseteq> Pow \<Omega>

goal (2 subgoals):
 1. \<And>m. m \<in> M \<Longrightarrow> sigma \<Omega> m \<le> sigma \<Omega> (\<Union> M)
 2. sigma \<Omega> (\<Union> M) \<le> Sup (sigma \<Omega> ` M)
[PROOF STEP]
show "sigma \<Omega> (\<Union>M) \<le> (SUP m\<in>M. sigma \<Omega> m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma \<Omega> (\<Union> M) \<le> Sup (sigma \<Omega> ` M)
[PROOF STEP]
proof (intro less_eq_measure.intros(3))
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. space (sigma \<Omega> (\<Union> M)) = space (Sup (sigma \<Omega> ` M))
 2. sets (sigma \<Omega> (\<Union> M)) = sets (Sup (sigma \<Omega> ` M))
 3. emeasure (sigma \<Omega> (\<Union> M)) \<le> emeasure (Sup (sigma \<Omega> ` M))
[PROOF STEP]
show "space (sigma \<Omega> (\<Union>M)) = space (SUP m\<in>M. sigma \<Omega> m)"
      "sets (sigma \<Omega> (\<Union>M)) = sets (SUP m\<in>M. sigma \<Omega> m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (sigma \<Omega> (\<Union> M)) = space (Sup (sigma \<Omega> ` M)) &&& sets (sigma \<Omega> (\<Union> M)) = sets (Sup (sigma \<Omega> ` M))
[PROOF STEP]
using sets_Sup_sigma[OF assms] sets_Sup_sigma[OF assms, THEN sets_eq_imp_space_eq]
[PROOF STATE]
proof (prove)
using this:
(\<And>m. m \<in> M \<Longrightarrow> m \<in> M) \<Longrightarrow> sets (Sup (sigma \<Omega> ` M)) = sets (sigma \<Omega> (\<Union> M))
(\<And>m. m \<in> M \<Longrightarrow> m \<in> M) \<Longrightarrow> space (Sup (sigma \<Omega> ` M)) = space (sigma \<Omega> (\<Union> M))

goal (1 subgoal):
 1. space (sigma \<Omega> (\<Union> M)) = space (Sup (sigma \<Omega> ` M)) &&& sets (sigma \<Omega> (\<Union> M)) = sets (Sup (sigma \<Omega> ` M))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
space (sigma \<Omega> (\<Union> M)) = space (Sup (sigma \<Omega> ` M))
sets (sigma \<Omega> (\<Union> M)) = sets (Sup (sigma \<Omega> ` M))

goal (1 subgoal):
 1. emeasure (sigma \<Omega> (\<Union> M)) \<le> emeasure (Sup (sigma \<Omega> ` M))
[PROOF STEP]
qed (simp add: emeasure_sigma le_fun_def)
[PROOF STATE]
proof (state)
this:
sigma \<Omega> (\<Union> M) \<le> Sup (sigma \<Omega> ` M)

goal (1 subgoal):
 1. \<And>m. m \<in> M \<Longrightarrow> sigma \<Omega> m \<le> sigma \<Omega> (\<Union> M)
[PROOF STEP]
fix m
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. m \<in> M \<Longrightarrow> sigma \<Omega> m \<le> sigma \<Omega> (\<Union> M)
[PROOF STEP]
assume "m \<in> M"
[PROOF STATE]
proof (state)
this:
m \<in> M

goal (1 subgoal):
 1. \<And>m. m \<in> M \<Longrightarrow> sigma \<Omega> m \<le> sigma \<Omega> (\<Union> M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m \<in> M
[PROOF STEP]
show "sigma \<Omega> m \<le> sigma \<Omega> (\<Union>M)"
[PROOF STATE]
proof (prove)
using this:
m \<in> M

goal (1 subgoal):
 1. sigma \<Omega> m \<le> sigma \<Omega> (\<Union> M)
[PROOF STEP]
by (subst sigma_le_iff) (auto simp add: M *)
[PROOF STATE]
proof (state)
this:
sigma \<Omega> m \<le> sigma \<Omega> (\<Union> M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sint_int_max_plus_1:
  "sint (2 ^ (LENGTH('a) - Suc 0) :: ('a::len) word) = - (2 ^ (LENGTH('a) - Suc 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sint (2 ^ (LENGTH('a) - Suc 0)) = - (2 ^ (LENGTH('a) - Suc 0))
[PROOF STEP]
apply (cases \<open>LENGTH('a)\<close>)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. LENGTH('a) = 0 \<Longrightarrow> sint (2 ^ (LENGTH('a) - Suc 0)) = - (2 ^ (LENGTH('a) - Suc 0))
 2. \<And>nat. LENGTH('a) = Suc nat \<Longrightarrow> sint (2 ^ (LENGTH('a) - Suc 0)) = - (2 ^ (LENGTH('a) - Suc 0))
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. LENGTH('a) = Suc nat \<Longrightarrow> sint (2 ^ nat) = - (2 ^ nat)
[PROOF STEP]
apply (subst word_of_int_2p [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. LENGTH('a) = Suc nat \<Longrightarrow> sint (word_of_int (2 ^ nat)) = - (2 ^ nat)
[PROOF STEP]
apply (subst int_word_sint)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. LENGTH('a) = Suc nat \<Longrightarrow> (2 ^ nat + 2 ^ (LENGTH('a) - 1)) mod 2 ^ LENGTH('a) - 2 ^ (LENGTH('a) - 1) = - (2 ^ nat)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in CRR_market_viable) asian_price:
  shows "fair_price Mkt
    (asian_price u d init r matur)
    (asian_option matur) matur"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fair_price Mkt (asian_price u d init r matur) (asian_option matur) matur
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fair_price Mkt (asian_price u d init r matur) (asian_option matur) matur
[PROOF STEP]
have "fair_price Mkt
    (\<Sum> w\<in> range (pseudo_proj_True matur). (prod (prob_component ((1 + r - d) / (u - d)) w) {0..<matur}) *
      (discounted_value r (\<lambda>m. (asian_option matur)) matur w))
    (asian_option matur) matur"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fair_price Mkt (\<Sum>w\<in>range (pseudo_proj_True matur). prod (prob_component ((1 + r - d) / (u - d)) w) {0..<matur} * discounted_value r (\<lambda>m. asian_option matur) matur w) (asian_option matur) matur
[PROOF STEP]
by (rule CRR_market_fair_price, rule asian_borel)
[PROOF STATE]
proof (state)
this:
fair_price Mkt (\<Sum>w\<in>range (pseudo_proj_True matur). prod (prob_component ((1 + r - d) / (u - d)) w) {0..<matur} * discounted_value r (\<lambda>m. asian_option matur) matur w) (asian_option matur) matur

goal (1 subgoal):
 1. fair_price Mkt (asian_price u d init r matur) (asian_option matur) matur
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
fair_price Mkt (\<Sum>w\<in>range (pseudo_proj_True matur). prod (prob_component ((1 + r - d) / (u - d)) w) {0..<matur} * discounted_value r (\<lambda>m. asian_option matur) matur w) (asian_option matur) matur

goal (1 subgoal):
 1. fair_price Mkt (asian_price u d init r matur) (asian_option matur) matur
[PROOF STEP]
using asian_effect_compute
[PROOF STATE]
proof (prove)
using this:
fair_price Mkt (\<Sum>w\<in>range (pseudo_proj_True matur). prod (prob_component ((1 + r - d) / (u - d)) w) {0..<matur} * discounted_value r (\<lambda>m. asian_option matur) matur w) (asian_option matur) matur
(\<Sum>w\<in>range (pseudo_proj_True ?matur). prod (prob_component ?pr w) {0..<?matur} * discounted_value r (\<lambda>m. asian_option ?matur) ?matur w) = (\<Sum>y\<in>gener_bool_list ?matur. lprob_comp ?pr y * det_discount r ?matur * (\<Sum>i = 1..?matur. lgeom_proc u d init (take i y)) / real ?matur)

goal (1 subgoal):
 1. fair_price Mkt (asian_price u d init r matur) (asian_option matur) matur
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fair_price Mkt (asian_price u d init r matur) (asian_option matur) matur

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma line_extension_mem_iff: "u \<in> line_extension K a E \<longleftrightarrow> (\<exists>k \<in> K. \<exists>v \<in> E. u = k \<otimes> a \<oplus> v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<in> line_extension K a E) = (\<exists>k\<in>K. \<exists>v\<in>E. u = k \<otimes> a \<oplus> v)
[PROOF STEP]
unfolding line_extension_def set_add_def'[of R "K #> a" E]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<in> (\<Union>h\<in>K #> a. \<Union>k\<in>E. {h \<oplus> k})) = (\<exists>k\<in>K. \<exists>v\<in>E. u = k \<otimes> a \<oplus> v)
[PROOF STEP]
unfolding r_coset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<in> (\<Union>h\<in>\<Union>h\<in>K. {h \<otimes> a}. \<Union>k\<in>E. {h \<oplus> k})) = (\<exists>k\<in>K. \<exists>v\<in>E. u = k \<otimes> a \<oplus> v)
[PROOF STEP]
by blast


[STATEMENT]
lemma set_relD1: "(s,s')\<in>\<langle>R\<rangle>set_rel \<Longrightarrow> x\<in>s \<Longrightarrow> \<exists>x'\<in>s'. (x,x')\<in>R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(s, s') \<in> \<langle>R\<rangle>set_rel; x \<in> s\<rbrakk> \<Longrightarrow> \<exists>x'\<in>s'. (x, x') \<in> R
[PROOF STEP]
unfolding set_rel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(s, s') \<in> {(A, B). (\<forall>x\<in>A. \<exists>y\<in>B. (x, y) \<in> R) \<and> (\<forall>y\<in>B. \<exists>x\<in>A. (x, y) \<in> R)}; x \<in> s\<rbrakk> \<Longrightarrow> \<exists>x'\<in>s'. (x, x') \<in> R
[PROOF STEP]
by blast


[STATEMENT]
lemma degree_sum_less:
  assumes "\<And>x. x \<in> A \<Longrightarrow> degree (f x) < n" "n > 0"
  shows   "degree (sum f A) < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (sum f A) < n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> degree (f ?x) < n
0 < n

goal (1 subgoal):
 1. degree (sum f A) < n
[PROOF STEP]
by (induction rule: infinite_finite_induct) (auto intro!: degree_add_less)


[STATEMENT]
lemma inverse_ereal_tendsto_at_right_0: "(inverse \<longlongrightarrow> \<infinity>) (at_right (0::ereal))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inverse \<longlongrightarrow> \<infinity>) (at_right 0)
[PROOF STEP]
unfolding tendsto_compose_filtermap[symmetric] at_right_ereal zero_ereal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((inverse \<circ> ereal) \<longlongrightarrow> \<infinity>) (at_right 0)
[PROOF STEP]
by (subst filterlim_cong[OF refl refl, where g="\<lambda>x. ereal (inverse x)"])
     (auto simp: eventually_at_filter tendsto_PInfty_eq_at_top filterlim_inverse_at_top_right)


[STATEMENT]
lemma homomth2Tr0: "\<lbrakk>Group F; Group G; f \<in> gHom F G; G \<triangleright> N\<rbrakk> \<Longrightarrow>
                           F \<triangleright> (iim F G f N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<triangleright> N\<rbrakk> \<Longrightarrow> F \<triangleright> iim F G f N
[PROOF STEP]
apply (frule Group.cond_nsg[of "F" "iim F G f N"],
       frule Group.nsg_sg[of "G" "N"], assumption+,
       simp add:ghomTr4[of "F" "G" "f" "N"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<triangleright> N\<rbrakk> \<Longrightarrow> \<forall>a\<in>carrier F. \<forall>h\<in>iim F G f N. a \<cdot>\<^bsub>F\<^esub> h \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> a \<in> iim F G f N
 2. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<triangleright> N; F \<triangleright> iim F G f N\<rbrakk> \<Longrightarrow> F \<triangleright> iim F G f N
[PROOF STEP]
apply ((rule ballI)+,
       simp add:iim_def, erule conjE,
       frule_tac a = a in Group.i_closed[of "F"], assumption+,
       frule_tac a = a and b = h in Group.mult_closed[of "F"], assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a h. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<triangleright> N; a \<in> carrier F; h \<in> carrier F; f h \<in> N; \<rho>\<^bsub>F\<^esub> a \<in> carrier F; a \<cdot>\<^bsub>F\<^esub> h \<in> carrier F\<rbrakk> \<Longrightarrow> a \<cdot>\<^bsub>F\<^esub> h \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> a \<in> carrier F \<and> f (a \<cdot>\<^bsub>F\<^esub> h \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> a) \<in> N
 2. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<triangleright> N; F \<triangleright> iim F G f N\<rbrakk> \<Longrightarrow> F \<triangleright> iim F G f N
[PROOF STEP]
apply (simp add:gHom ghom_inv_inv Group.mult_closed)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a h. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<triangleright> N; a \<in> carrier F; h \<in> carrier F; f h \<in> N; \<rho>\<^bsub>F\<^esub> a \<in> carrier F\<rbrakk> \<Longrightarrow> f a \<cdot>\<^bsub>G\<^esub> f h \<cdot>\<^bsub>G\<^esub> \<rho>\<^bsub>G\<^esub> f a \<in> N
 2. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<triangleright> N; F \<triangleright> iim F G f N\<rbrakk> \<Longrightarrow> F \<triangleright> iim F G f N
[PROOF STEP]
apply (frule_tac x = a in gHom_mem[of "F" "G" "f"], assumption+,
       simp add:Group.nsgPr1_1,
       assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma det_state_cover_finite :
  assumes "is_det_state_cover M V"
  and     "finite (nodes M)"
shows "finite V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite V
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite V
[PROOF STEP]
have "d_reachable M (initial M) \<subseteq> nodes M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d_reachable M (initial M) \<subseteq> nodes M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d_reachable M (initial M) \<subseteq> nodes M

goal (1 subgoal):
 1. finite V
[PROOF STEP]
show "finite V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite V
[PROOF STEP]
using det_state_cover_card[OF assms]
[PROOF STATE]
proof (prove)
using this:
card (d_reachable M (initial M)) = card V

goal (1 subgoal):
 1. finite V
[PROOF STEP]
by (metis \<open>d_reachable M (initial M) \<subseteq> nodes M\<close> assms(1) assms(2) finite_imageI infinite_super
        is_det_state_cover.simps)
[PROOF STATE]
proof (state)
this:
finite V

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inf_continuous_nn_integral[order_continuous_intros]:
  assumes f: "\<And>y. inf_continuous (f y)"
  assumes [measurable]: "\<And>x. (\<lambda>y. f y x) \<in> borel_measurable M"
  assumes bnd: "\<And>x. (\<integral>\<^sup>+ y. f y x \<partial>M) \<noteq> \<infinity>"
  shows "inf_continuous (\<lambda>x. (\<integral>\<^sup>+y. f y x \<partial>M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf_continuous (\<lambda>x. \<integral>\<^sup>+ y. f y x \<partial>M)
[PROOF STEP]
unfolding inf_continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>Ma. decseq Ma \<longrightarrow> \<integral>\<^sup>+ y. f y (Inf (range Ma)) \<partial>M = (INF i. \<integral>\<^sup>+ y. f y (Ma i) \<partial>M)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Ma. decseq Ma \<Longrightarrow> \<integral>\<^sup>+ y. f y (Inf (range Ma)) \<partial>M = (INF i. \<integral>\<^sup>+ y. f y (Ma i) \<partial>M)
[PROOF STEP]
fix C :: "nat \<Rightarrow> 'b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Ma. decseq Ma \<Longrightarrow> \<integral>\<^sup>+ y. f y (Inf (range Ma)) \<partial>M = (INF i. \<integral>\<^sup>+ y. f y (Ma i) \<partial>M)
[PROOF STEP]
assume C: "decseq C"
[PROOF STATE]
proof (state)
this:
decseq C

goal (1 subgoal):
 1. \<And>Ma. decseq Ma \<Longrightarrow> \<integral>\<^sup>+ y. f y (Inf (range Ma)) \<partial>M = (INF i. \<integral>\<^sup>+ y. f y (Ma i) \<partial>M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
decseq C
[PROOF STEP]
show "(\<integral>\<^sup>+ y. f y (Inf (C ` UNIV)) \<partial>M) = (INF i. \<integral>\<^sup>+ y. f y (C i) \<partial>M)"
[PROOF STATE]
proof (prove)
using this:
decseq C

goal (1 subgoal):
 1. \<integral>\<^sup>+ y. f y (Inf (range C)) \<partial>M = (INF i. \<integral>\<^sup>+ y. f y (C i) \<partial>M)
[PROOF STEP]
using inf_continuous_mono[OF f] bnd
[PROOF STATE]
proof (prove)
using this:
decseq C
mono (f ?y1)
\<integral>\<^sup>+ y. f y ?x \<partial>M \<noteq> \<infinity>

goal (1 subgoal):
 1. \<integral>\<^sup>+ y. f y (Inf (range C)) \<partial>M = (INF i. \<integral>\<^sup>+ y. f y (C i) \<partial>M)
[PROOF STEP]
by (auto simp add: inf_continuousD[OF f C] fun_eq_iff monotone_def le_fun_def less_top
             intro!: nn_integral_monotone_convergence_INF_decseq)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ y. f y (Inf (range C)) \<partial>M = (INF i. \<integral>\<^sup>+ y. f y (C i) \<partial>M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma AbGroup_inner_dirsum_el_decomp_eq :
  "\<lbrakk> \<forall>G \<in> set Gs. AbGroup G; add_independentS Gs; x \<in> (\<Oplus>G\<leftarrow>Gs. G);
        gs \<in> listset Gs; x = sum_list gs \<rbrakk> \<Longrightarrow> (\<Oplus>Gs\<leftarrow>x) = gs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>G\<in>set Gs. AbGroup G; add_independentS Gs; x \<in> (\<Oplus>G\<leftarrow>Gs. G); gs \<in> listset Gs; x = sum_list gs\<rbrakk> \<Longrightarrow> \<Oplus>Gs\<leftarrow> x = gs
[PROOF STEP]
using AbGroup_inner_dirsum_el_decomp_ex1[of Gs]
        inner_dirsum_el_decomp_def[of Gs]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>G\<in>set Gs. AbGroup G; add_independentS Gs\<rbrakk> \<Longrightarrow> \<forall>x\<in>\<Oplus>G\<leftarrow>Gs. G. \<exists>!gs. gs \<in> listset Gs \<and> x = sum_list gs
\<Oplus>Gs\<leftarrow> = (\<lambda>x. if x \<in> (\<Oplus>G\<leftarrow>Gs. G) then THE gs. gs \<in> listset Gs \<and> x = sum_list gs else [])

goal (1 subgoal):
 1. \<lbrakk>\<forall>G\<in>set Gs. AbGroup G; add_independentS Gs; x \<in> (\<Oplus>G\<leftarrow>Gs. G); gs \<in> listset Gs; x = sum_list gs\<rbrakk> \<Longrightarrow> \<Oplus>Gs\<leftarrow> x = gs
[PROOF STEP]
by    force


[STATEMENT]
lemma prob_Pn_X[simp]: "measure_pmf.prob (Pn p S0 n) {(s, a). s = x} = pmf (Xn p S0 n) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (Pn p S0 n) {(s, a). s = x} = pmf (Xn p S0 n) x
[PROOF STEP]
proof (induction n arbitrary: p S0)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>p S0. measure_pmf.prob (Pn p S0 0) {(s, a). s = x} = pmf (Xn p S0 0) x
 2. \<And>n p S0. (\<And>p S0. measure_pmf.prob (Pn p S0 n) {(s, a). s = x} = pmf (Xn p S0 n) x) \<Longrightarrow> measure_pmf.prob (Pn p S0 (Suc n)) {(s, a). s = x} = pmf (Xn p S0 (Suc n)) x
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>p S0. measure_pmf.prob (Pn p S0 0) {(s, a). s = x} = pmf (Xn p S0 0) x
 2. \<And>n p S0. (\<And>p S0. measure_pmf.prob (Pn p S0 n) {(s, a). s = x} = pmf (Xn p S0 n) x) \<Longrightarrow> measure_pmf.prob (Pn p S0 (Suc n)) {(s, a). s = x} = pmf (Xn p S0 (Suc n)) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (Pn p S0 0) {a. case a of (s, a) \<Rightarrow> s = x} = pmf (Xn p S0 0) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (Pn p S0 0) {a. case a of (s, a) \<Rightarrow> s = x} = pmf (Xn p S0 0) x

goal (1 subgoal):
 1. \<And>n p S0. (\<And>p S0. measure_pmf.prob (Pn p S0 n) {(s, a). s = x} = pmf (Xn p S0 n) x) \<Longrightarrow> measure_pmf.prob (Pn p S0 (Suc n)) {(s, a). s = x} = pmf (Xn p S0 (Suc n)) x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n p S0. (\<And>p S0. measure_pmf.prob (Pn p S0 n) {(s, a). s = x} = pmf (Xn p S0 n) x) \<Longrightarrow> measure_pmf.prob (Pn p S0 (Suc n)) {(s, a). s = x} = pmf (Xn p S0 (Suc n)) x
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (Pn ?p3 ?S0.3 n) {a. case a of (s, a) \<Rightarrow> s = x} = pmf (Xn ?p3 ?S0.3 n) x

goal (1 subgoal):
 1. \<And>n p S0. (\<And>p S0. measure_pmf.prob (Pn p S0 n) {(s, a). s = x} = pmf (Xn p S0 n) x) \<Longrightarrow> measure_pmf.prob (Pn p S0 (Suc n)) {(s, a). s = x} = pmf (Xn p S0 (Suc n)) x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (Pn p S0 (Suc n)) {a. case a of (s, a) \<Rightarrow> s = x} = pmf (Xn p S0 (Suc n)) x
[PROOF STEP]
unfolding Xn_Suc' Pn.simps(2) measure_pmf_bind
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_pmf (K\<^sub>0 (p []) S0) \<bind> (\<lambda>x. measure_pmf (Pn (\<pi>_Suc p x) (K x) n))) {a. case a of (s, a) \<Rightarrow> s = x} = pmf (K\<^sub>0 (p []) S0 \<bind> (\<lambda>sa. Xn (\<pi>_Suc p sa) (K sa) n)) x
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
measure_pmf.prob (Pn ?p3 ?S0.3 n) {a. case a of (s, a) \<Rightarrow> s = x} = pmf (Xn ?p3 ?S0.3 n) x

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_pmf (K\<^sub>0 (p []) S0) \<bind> (\<lambda>x. measure_pmf (Pn (\<pi>_Suc p x) (K x) n))) {a. case a of (s, a) \<Rightarrow> s = x} = pmf (K\<^sub>0 (p []) S0 \<bind> (\<lambda>sa. Xn (\<pi>_Suc p sa) (K sa) n)) x
[PROOF STEP]
by (simp add: measure_pmf.measure_bind[of _ _ "count_space UNIV"] K0_def
        measure_pmf_in_subprob_algebra pmf_bind)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (Pn p S0 (Suc n)) {a. case a of (s, a) \<Rightarrow> s = x} = pmf (Xn p S0 (Suc n)) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iso_imp_eqpoll_carrier: "G \<cong> H \<Longrightarrow> carrier G \<approx> carrier H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G \<cong> H \<Longrightarrow> carrier G \<approx> carrier H
[PROOF STEP]
by (auto simp: is_iso_def iso_def eqpoll_def)