[STATEMENT]
lemma contractible_space_prod_topology:
   "contractible_space(prod_topology X Y) \<longleftrightarrow>
    topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
[PROOF STEP]
proof (cases "topspace X = {} \<or> topspace Y = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. topspace X = {} \<or> topspace Y = {} \<Longrightarrow> contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
 2. \<not> (topspace X = {} \<or> topspace Y = {}) \<Longrightarrow> contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
topspace X = {} \<or> topspace Y = {}

goal (2 subgoals):
 1. topspace X = {} \<or> topspace Y = {} \<Longrightarrow> contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
 2. \<not> (topspace X = {} \<or> topspace Y = {}) \<Longrightarrow> contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace X = {} \<or> topspace Y = {}
[PROOF STEP]
have "topspace (prod_topology X Y) = {}"
[PROOF STATE]
proof (prove)
using this:
topspace X = {} \<or> topspace Y = {}

goal (1 subgoal):
 1. topspace (prod_topology X Y) = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
topspace (prod_topology X Y) = {}

goal (2 subgoals):
 1. topspace X = {} \<or> topspace Y = {} \<Longrightarrow> contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
 2. \<not> (topspace X = {} \<or> topspace Y = {}) \<Longrightarrow> contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace (prod_topology X Y) = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
topspace (prod_topology X Y) = {}

goal (1 subgoal):
 1. contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
[PROOF STEP]
by (auto simp: contractible_space_empty)
[PROOF STATE]
proof (state)
this:
contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)

goal (1 subgoal):
 1. \<not> (topspace X = {} \<or> topspace Y = {}) \<Longrightarrow> contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (topspace X = {} \<or> topspace Y = {}) \<Longrightarrow> contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (topspace X = {} \<or> topspace Y = {})

goal (1 subgoal):
 1. \<not> (topspace X = {} \<or> topspace Y = {}) \<Longrightarrow> contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
[PROOF STEP]
have "contractible_space(prod_topology X Y) \<longleftrightarrow> contractible_space X \<and> contractible_space Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contractible_space (prod_topology X Y) = (contractible_space X \<and> contractible_space Y)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. contractible_space (prod_topology X Y) \<Longrightarrow> contractible_space X
 2. contractible_space (prod_topology X Y) \<Longrightarrow> contractible_space Y
 3. \<lbrakk>contractible_space X; contractible_space Y\<rbrakk> \<Longrightarrow> contractible_space (prod_topology X Y)
[PROOF STEP]
assume XY: "contractible_space (prod_topology X Y)"
[PROOF STATE]
proof (state)
this:
contractible_space (prod_topology X Y)

goal (3 subgoals):
 1. contractible_space (prod_topology X Y) \<Longrightarrow> contractible_space X
 2. contractible_space (prod_topology X Y) \<Longrightarrow> contractible_space Y
 3. \<lbrakk>contractible_space X; contractible_space Y\<rbrakk> \<Longrightarrow> contractible_space (prod_topology X Y)
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> (topspace X = {} \<or> topspace Y = {})
contractible_space (prod_topology X Y)
[PROOF STEP]
have "retraction_map (prod_topology X Y) X fst"
[PROOF STATE]
proof (prove)
using this:
\<not> (topspace X = {} \<or> topspace Y = {})
contractible_space (prod_topology X Y)

goal (1 subgoal):
 1. retraction_map (prod_topology X Y) X fst
[PROOF STEP]
by (auto simp: contractible_space False retraction_map_fst)
[PROOF STATE]
proof (state)
this:
retraction_map (prod_topology X Y) X fst

goal (3 subgoals):
 1. contractible_space (prod_topology X Y) \<Longrightarrow> contractible_space X
 2. contractible_space (prod_topology X Y) \<Longrightarrow> contractible_space Y
 3. \<lbrakk>contractible_space X; contractible_space Y\<rbrakk> \<Longrightarrow> contractible_space (prod_topology X Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
retraction_map (prod_topology X Y) X fst
[PROOF STEP]
show "contractible_space X"
[PROOF STATE]
proof (prove)
using this:
retraction_map (prod_topology X Y) X fst

goal (1 subgoal):
 1. contractible_space X
[PROOF STEP]
by (rule contractible_space_retraction_map_image [OF _ XY])
[PROOF STATE]
proof (state)
this:
contractible_space X

goal (2 subgoals):
 1. contractible_space (prod_topology X Y) \<Longrightarrow> contractible_space Y
 2. \<lbrakk>contractible_space X; contractible_space Y\<rbrakk> \<Longrightarrow> contractible_space (prod_topology X Y)
[PROOF STEP]
have "retraction_map (prod_topology X Y) Y snd"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. retraction_map (prod_topology X Y) Y snd
[PROOF STEP]
using False XY
[PROOF STATE]
proof (prove)
using this:
\<not> (topspace X = {} \<or> topspace Y = {})
contractible_space (prod_topology X Y)

goal (1 subgoal):
 1. retraction_map (prod_topology X Y) Y snd
[PROOF STEP]
by (auto simp: contractible_space False retraction_map_snd)
[PROOF STATE]
proof (state)
this:
retraction_map (prod_topology X Y) Y snd

goal (2 subgoals):
 1. contractible_space (prod_topology X Y) \<Longrightarrow> contractible_space Y
 2. \<lbrakk>contractible_space X; contractible_space Y\<rbrakk> \<Longrightarrow> contractible_space (prod_topology X Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
retraction_map (prod_topology X Y) Y snd
[PROOF STEP]
show "contractible_space Y"
[PROOF STATE]
proof (prove)
using this:
retraction_map (prod_topology X Y) Y snd

goal (1 subgoal):
 1. contractible_space Y
[PROOF STEP]
by (rule contractible_space_retraction_map_image [OF _ XY])
[PROOF STATE]
proof (state)
this:
contractible_space Y

goal (1 subgoal):
 1. \<lbrakk>contractible_space X; contractible_space Y\<rbrakk> \<Longrightarrow> contractible_space (prod_topology X Y)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>contractible_space X; contractible_space Y\<rbrakk> \<Longrightarrow> contractible_space (prod_topology X Y)
[PROOF STEP]
assume "contractible_space X" and "contractible_space Y"
[PROOF STATE]
proof (state)
this:
contractible_space X
contractible_space Y

goal (1 subgoal):
 1. \<lbrakk>contractible_space X; contractible_space Y\<rbrakk> \<Longrightarrow> contractible_space (prod_topology X Y)
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> (topspace X = {} \<or> topspace Y = {})
contractible_space X
contractible_space Y
[PROOF STEP]
obtain a b
      where "a \<in> topspace X" and a: "homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)"
        and "b \<in> topspace Y" and b: "homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)"
[PROOF STATE]
proof (prove)
using this:
\<not> (topspace X = {} \<or> topspace Y = {})
contractible_space X
contractible_space Y

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a \<in> topspace X; homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a); b \<in> topspace Y; homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: contractible_space)
[PROOF STATE]
proof (state)
this:
a \<in> topspace X
homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)
b \<in> topspace Y
homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)

goal (1 subgoal):
 1. \<lbrakk>contractible_space X; contractible_space Y\<rbrakk> \<Longrightarrow> contractible_space (prod_topology X Y)
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> (topspace X = {} \<or> topspace Y = {})
a \<in> topspace X
homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)
b \<in> topspace Y
homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)
[PROOF STEP]
show "contractible_space (prod_topology X Y)"
[PROOF STATE]
proof (prove)
using this:
\<not> (topspace X = {} \<or> topspace Y = {})
a \<in> topspace X
homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)
b \<in> topspace Y
homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)

goal (1 subgoal):
 1. contractible_space (prod_topology X Y)
[PROOF STEP]
apply (simp add: contractible_space)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>topspace X \<noteq> {} \<and> topspace Y \<noteq> {}; a \<in> topspace X; homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a); b \<in> topspace Y; homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)\<rbrakk> \<Longrightarrow> \<exists>x\<in>topspace X. \<exists>y\<in>topspace Y. homotopic_with (\<lambda>x. True) (prod_topology X Y) (prod_topology X Y) id (\<lambda>xa. (x, y))
[PROOF STEP]
apply (rule_tac x=a in bexI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>topspace X \<noteq> {} \<and> topspace Y \<noteq> {}; a \<in> topspace X; homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a); b \<in> topspace Y; homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)\<rbrakk> \<Longrightarrow> \<exists>y\<in>topspace Y. homotopic_with (\<lambda>x. True) (prod_topology X Y) (prod_topology X Y) id (\<lambda>x. (a, y))
 2. \<lbrakk>topspace X \<noteq> {} \<and> topspace Y \<noteq> {}; a \<in> topspace X; homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a); b \<in> topspace Y; homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)\<rbrakk> \<Longrightarrow> a \<in> topspace X
[PROOF STEP]
apply (rule_tac x=b in bexI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>topspace X \<noteq> {} \<and> topspace Y \<noteq> {}; a \<in> topspace X; homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a); b \<in> topspace Y; homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)\<rbrakk> \<Longrightarrow> homotopic_with (\<lambda>x. True) (prod_topology X Y) (prod_topology X Y) id (\<lambda>x. (a, b))
 2. \<lbrakk>topspace X \<noteq> {} \<and> topspace Y \<noteq> {}; a \<in> topspace X; homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a); b \<in> topspace Y; homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)\<rbrakk> \<Longrightarrow> b \<in> topspace Y
 3. \<lbrakk>topspace X \<noteq> {} \<and> topspace Y \<noteq> {}; a \<in> topspace X; homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a); b \<in> topspace Y; homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)\<rbrakk> \<Longrightarrow> a \<in> topspace X
[PROOF STEP]
using homotopic_with_prod_topology [OF a b]
[PROOF STATE]
proof (prove)
using this:
(\<And>i j. \<lbrakk>True; True\<rbrakk> \<Longrightarrow> ?r (\<lambda>(x, y). (i x, j y))) \<Longrightarrow> homotopic_with ?r (prod_topology X Y) (prod_topology X Y) (\<lambda>z. (id (fst z), id (snd z))) (\<lambda>z. (a, b))

goal (3 subgoals):
 1. \<lbrakk>topspace X \<noteq> {} \<and> topspace Y \<noteq> {}; a \<in> topspace X; homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a); b \<in> topspace Y; homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)\<rbrakk> \<Longrightarrow> homotopic_with (\<lambda>x. True) (prod_topology X Y) (prod_topology X Y) id (\<lambda>x. (a, b))
 2. \<lbrakk>topspace X \<noteq> {} \<and> topspace Y \<noteq> {}; a \<in> topspace X; homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a); b \<in> topspace Y; homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)\<rbrakk> \<Longrightarrow> b \<in> topspace Y
 3. \<lbrakk>topspace X \<noteq> {} \<and> topspace Y \<noteq> {}; a \<in> topspace X; homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a); b \<in> topspace Y; homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)\<rbrakk> \<Longrightarrow> a \<in> topspace X
[PROOF STEP]
apply (metis (no_types, lifting) case_prod_Pair case_prod_beta' eq_id_iff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>topspace X \<noteq> {} \<and> topspace Y \<noteq> {}; a \<in> topspace X; homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a); b \<in> topspace Y; homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)\<rbrakk> \<Longrightarrow> b \<in> topspace Y
 2. \<lbrakk>topspace X \<noteq> {} \<and> topspace Y \<noteq> {}; a \<in> topspace X; homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a); b \<in> topspace Y; homotopic_with (\<lambda>x. True) Y Y id (\<lambda>x. b)\<rbrakk> \<Longrightarrow> a \<in> topspace X
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
contractible_space (prod_topology X Y)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
contractible_space (prod_topology X Y) = (contractible_space X \<and> contractible_space Y)

goal (1 subgoal):
 1. \<not> (topspace X = {} \<or> topspace Y = {}) \<Longrightarrow> contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> (topspace X = {} \<or> topspace Y = {})
contractible_space (prod_topology X Y) = (contractible_space X \<and> contractible_space Y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (topspace X = {} \<or> topspace Y = {})
contractible_space (prod_topology X Y) = (contractible_space X \<and> contractible_space Y)

goal (1 subgoal):
 1. contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
contractible_space (prod_topology X Y) = (topspace X = {} \<or> topspace Y = {} \<or> contractible_space X \<and> contractible_space Y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lborel_measurable_sub_dim: "(\<lambda>f. restrict f {..<n}) \<in> measurable (lborel_f (Suc n)) (lborel_f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f. restrict f {..<n}) \<in> lborel_f (Suc n) \<rightarrow>\<^sub>M lborel_f n
[PROOF STEP]
using lborel_f_measurable_restrict[of "n" "Suc n"]
[PROOF STATE]
proof (prove)
using this:
n \<le> Suc n \<Longrightarrow> (\<lambda>f. restrict f {..<n}) \<in> lborel_f (Suc n) \<rightarrow>\<^sub>M lborel_f n

goal (1 subgoal):
 1. (\<lambda>f. restrict f {..<n}) \<in> lborel_f (Suc n) \<rightarrow>\<^sub>M lborel_f n
[PROOF STEP]
by linarith


[STATEMENT]
lemma disjuncts_nb:
  assumes "bound0 p"
  shows "\<forall>q \<in> set (disjuncts p). bound0 q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>q\<in>set (disjuncts p). bound0 q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>q\<in>set (disjuncts p). bound0 q
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
bound0 p
[PROOF STEP]
have "list_all bound0 (disjuncts p)"
[PROOF STATE]
proof (prove)
using this:
bound0 p

goal (1 subgoal):
 1. list_all bound0 (disjuncts p)
[PROOF STEP]
by (induct p rule: disjuncts.induct) auto
[PROOF STATE]
proof (state)
this:
list_all bound0 (disjuncts p)

goal (1 subgoal):
 1. \<forall>q\<in>set (disjuncts p). bound0 q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
list_all bound0 (disjuncts p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
list_all bound0 (disjuncts p)

goal (1 subgoal):
 1. \<forall>q\<in>set (disjuncts p). bound0 q
[PROOF STEP]
by (simp only: list_all_iff)
[PROOF STATE]
proof (state)
this:
\<forall>q\<in>set (disjuncts p). bound0 q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem compet_BIT4: assumes "init \<noteq> []" "distinct init"
shows "T_on_rand BIT init qs \<le> 7/4 * T_opt init qs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T_opt init qs)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T_opt init qs)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T_opt init qs)
[PROOF STEP]
fix acts :: "answer list"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T_opt init qs)
[PROOF STEP]
assume len: "length acts = length qs"
[PROOF STATE]
proof (state)
this:
length acts = length qs

goal (1 subgoal):
 1. T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T_opt init qs)
[PROOF STEP]
interpret BIT_Off acts qs init
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. BIT_Off acts qs init
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. distinct init
 2. length acts = length qs
[PROOF STEP]
qed (auto simp: assms(2) len)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T_opt init qs)
[PROOF STEP]
from BIT_absch_le[OF assms(1)] assms(1)
[PROOF STATE]
proof (chain)
picking this:
T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T init qs acts) - 3 / 4 * real (length qs)
init \<noteq> []
[PROOF STEP]
have "(T_on_rand BIT init qs + 3 / 4 * length qs)/ (7/4) \<le> real(T init qs acts)"
[PROOF STATE]
proof (prove)
using this:
T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T init qs acts) - 3 / 4 * real (length qs)
init \<noteq> []

goal (1 subgoal):
 1. (T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs + 3 / 4 * real (length qs)) / (7 / 4) \<le> real (T init qs acts)
[PROOF STEP]
by(simp add: field_simps length_greater_0_conv[symmetric]
        del: length_greater_0_conv)
[PROOF STATE]
proof (state)
this:
(T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs + 3 / 4 * real (length qs)) / (7 / 4) \<le> real (T init qs acts)

goal (1 subgoal):
 1. T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T_opt init qs)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
length ?acts2 = length qs \<Longrightarrow> (T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs + 3 / 4 * real (length qs)) / (7 / 4) \<le> real (T init qs ?acts2)

goal (1 subgoal):
 1. T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T_opt init qs)
[PROOF STEP]
hence "(T_on_rand BIT init qs + 3 / 4 * length qs)/ (7/4) \<le> T_opt init qs"
[PROOF STATE]
proof (prove)
using this:
length ?acts2 = length qs \<Longrightarrow> (T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs + 3 / 4 * real (length qs)) / (7 / 4) \<le> real (T init qs ?acts2)

goal (1 subgoal):
 1. (T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs + 3 / 4 * real (length qs)) / (7 / 4) \<le> real (T_opt init qs)
[PROOF STEP]
apply(simp add: T_opt_def Inf_nat_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>acts. length acts = length qs \<Longrightarrow> T_on_rand' BIT (BIT_init init \<bind> (\<lambda>is. return_pmf (init, is))) qs * 4 + 3 * real (length qs) \<le> real (T init qs acts) * 7) \<Longrightarrow> T_on_rand' BIT (BIT_init init \<bind> (\<lambda>is. return_pmf (init, is))) qs * 4 + 3 * real (length qs) \<le> real (LEAST n. \<exists>as. n = T init qs as \<and> length as = length qs) * 7
[PROOF STEP]
apply(rule LeastI2_wellorder)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>acts. length acts = length qs \<Longrightarrow> T_on_rand' BIT (BIT_init init \<bind> (\<lambda>is. return_pmf (init, is))) qs * 4 + 3 * real (length qs) \<le> real (T init qs acts) * 7) \<Longrightarrow> \<exists>as. ?a4 = T init qs as \<and> length as = length qs
 2. \<And>a. \<lbrakk>\<And>acts. length acts = length qs \<Longrightarrow> T_on_rand' BIT (BIT_init init \<bind> (\<lambda>is. return_pmf (init, is))) qs * 4 + 3 * real (length qs) \<le> real (T init qs acts) * 7; \<exists>as. a = T init qs as \<and> length as = length qs; \<forall>b. (\<exists>as. b = T init qs as \<and> length as = length qs) \<longrightarrow> a \<le> b\<rbrakk> \<Longrightarrow> T_on_rand' BIT (BIT_init init \<bind> (\<lambda>is. return_pmf (init, is))) qs * 4 + 3 * real (length qs) \<le> real a * 7
[PROOF STEP]
using length_replicate[of "length qs" undefined]
[PROOF STATE]
proof (prove)
using this:
length (replicate (length qs) undefined) = length qs

goal (2 subgoals):
 1. (\<And>acts. length acts = length qs \<Longrightarrow> T_on_rand' BIT (BIT_init init \<bind> (\<lambda>is. return_pmf (init, is))) qs * 4 + 3 * real (length qs) \<le> real (T init qs acts) * 7) \<Longrightarrow> \<exists>as. ?a4 = T init qs as \<and> length as = length qs
 2. \<And>a. \<lbrakk>\<And>acts. length acts = length qs \<Longrightarrow> T_on_rand' BIT (BIT_init init \<bind> (\<lambda>is. return_pmf (init, is))) qs * 4 + 3 * real (length qs) \<le> real (T init qs acts) * 7; \<exists>as. a = T init qs as \<and> length as = length qs; \<forall>b. (\<exists>as. b = T init qs as \<and> length as = length qs) \<longrightarrow> a \<le> b\<rbrakk> \<Longrightarrow> T_on_rand' BIT (BIT_init init \<bind> (\<lambda>is. return_pmf (init, is))) qs * 4 + 3 * real (length qs) \<le> real a * 7
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>\<And>acts. length acts = length qs \<Longrightarrow> T_on_rand' BIT (BIT_init init \<bind> (\<lambda>is. return_pmf (init, is))) qs * 4 + 3 * real (length qs) \<le> real (T init qs acts) * 7; \<exists>as. a = T init qs as \<and> length as = length qs; \<forall>b. (\<exists>as. b = T init qs as \<and> length as = length qs) \<longrightarrow> a \<le> b\<rbrakk> \<Longrightarrow> T_on_rand' BIT (BIT_init init \<bind> (\<lambda>is. return_pmf (init, is))) qs * 4 + 3 * real (length qs) \<le> real a * 7
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs + 3 / 4 * real (length qs)) / (7 / 4) \<le> real (T_opt init qs)

goal (1 subgoal):
 1. T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T_opt init qs)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs + 3 / 4 * real (length qs)) / (7 / 4) \<le> real (T_opt init qs)

goal (1 subgoal):
 1. T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T_opt init qs)
[PROOF STEP]
by(simp add: field_simps
    length_greater_0_conv[symmetric] del: length_greater_0_conv)
[PROOF STATE]
proof (state)
this:
T_on_rand' BIT (fst BIT init \<bind> (\<lambda>is. return_pmf (init, is))) qs \<le> 7 / 4 * real (T_opt init qs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_sum_upto_eqI:
  assumes "a \<le> b" "\<And>k. k \<in> {nat \<lfloor>a\<rfloor><..nat\<lfloor>b\<rfloor>} \<Longrightarrow> \<not>prime k"
  shows   "prime_sum_upto f a = prime_sum_upto f b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_sum_upto f a = prime_sum_upto f b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_sum_upto f a = prime_sum_upto f b
[PROOF STEP]
have *: "k \<le> nat \<lfloor>a\<rfloor>" if "k \<le> nat \<lfloor>b\<rfloor>" "prime k" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> nat \<lfloor>a\<rfloor>
[PROOF STEP]
using that assms(2)[of k]
[PROOF STATE]
proof (prove)
using this:
k \<le> nat \<lfloor>b\<rfloor>
prime k
k \<in> {nat \<lfloor>a\<rfloor><..nat \<lfloor>b\<rfloor>} \<Longrightarrow> \<not> prime k

goal (1 subgoal):
 1. k \<le> nat \<lfloor>a\<rfloor>
[PROOF STEP]
by (cases "k \<le> nat \<lfloor>a\<rfloor>") auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?k \<le> nat \<lfloor>b\<rfloor>; prime ?k\<rbrakk> \<Longrightarrow> ?k \<le> nat \<lfloor>a\<rfloor>

goal (1 subgoal):
 1. prime_sum_upto f a = prime_sum_upto f b
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
[PROOF STEP]
have "nat \<lfloor>a\<rfloor> \<le> nat \<lfloor>b\<rfloor>"
[PROOF STATE]
proof (prove)
using this:
a \<le> b

goal (1 subgoal):
 1. nat \<lfloor>a\<rfloor> \<le> nat \<lfloor>b\<rfloor>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
nat \<lfloor>a\<rfloor> \<le> nat \<lfloor>b\<rfloor>

goal (1 subgoal):
 1. prime_sum_upto f a = prime_sum_upto f b
[PROOF STEP]
hence "(\<Sum>p | prime p \<and> p \<le> nat \<lfloor>a\<rfloor>. f p) = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>b\<rfloor>. f p)"
[PROOF STATE]
proof (prove)
using this:
nat \<lfloor>a\<rfloor> \<le> nat \<lfloor>b\<rfloor>

goal (1 subgoal):
 1. (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>a\<rfloor>. f p) = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>b\<rfloor>. f p)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
nat \<lfloor>a\<rfloor> \<le> nat \<lfloor>b\<rfloor>
a \<le> b
?k \<in> {nat \<lfloor>a\<rfloor><..nat \<lfloor>b\<rfloor>} \<Longrightarrow> \<not> prime ?k

goal (1 subgoal):
 1. (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>a\<rfloor>. f p) = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>b\<rfloor>. f p)
[PROOF STEP]
by (intro sum.mono_neutral_left) (auto dest: *)
[PROOF STATE]
proof (state)
this:
(\<Sum>p | prime p \<and> p \<le> nat \<lfloor>a\<rfloor>. f p) = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>b\<rfloor>. f p)

goal (1 subgoal):
 1. prime_sum_upto f a = prime_sum_upto f b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>p | prime p \<and> p \<le> nat \<lfloor>a\<rfloor>. f p) = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>b\<rfloor>. f p)

goal (1 subgoal):
 1. prime_sum_upto f a = prime_sum_upto f b
[PROOF STEP]
by (simp add: prime_sum_upto_altdef2)
[PROOF STATE]
proof (state)
this:
prime_sum_upto f a = prime_sum_upto f b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma collinear_open_segment [simp]: "collinear (open_segment a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear (open_segment a b)
[PROOF STEP]
unfolding open_segment_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear (closed_segment a b - {a, b})
[PROOF STEP]
by (metis convex_hull_subset_affine_hull segment_convex_hull dual_order.trans
      convex_hull_subset_affine_hull Diff_subset collinear_affine_hull)


[STATEMENT]
lemma inv_set_fv: "finite M \<Longrightarrow> \<Union>(set (map fv (inv set M))) = fv\<^sub>s\<^sub>e\<^sub>t M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite M \<Longrightarrow> \<Union> (set (map fv (inv set M))) = fv\<^sub>s\<^sub>e\<^sub>t M
[PROOF STEP]
using fv_map_fv_set[of "inv set M"] inv_set_fset
[PROOF STATE]
proof (prove)
using this:
\<Union> (set (map fv (inv set M))) = fv\<^sub>s\<^sub>e\<^sub>t (set (inv set M))
finite ?M \<Longrightarrow> set (inv set ?M) = ?M

goal (1 subgoal):
 1. finite M \<Longrightarrow> \<Union> (set (map fv (inv set M))) = fv\<^sub>s\<^sub>e\<^sub>t M
[PROOF STEP]
by auto


[STATEMENT]
lemma vec_of_basis_enum_tensor_state:
  fixes \<psi> :: \<open>'a::enum ell2\<close> and \<phi> :: \<open>'b::enum ell2\<close>
  shows \<open>vec_of_basis_enum (\<psi> \<otimes>\<^sub>s \<phi>) = tensor_state_jnf (vec_of_basis_enum \<psi>) (vec_of_basis_enum \<phi>)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum (\<psi> \<otimes>\<^sub>s \<phi>) = tensor_state_jnf (vec_of_basis_enum \<psi>) (vec_of_basis_enum \<phi>)
[PROOF STEP]
apply (rule eq_vecI, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < CARD('a) * CARD('b) \<Longrightarrow> vec_of_basis_enum (\<psi> \<otimes>\<^sub>s \<phi>) $ i = tensor_state_jnf (vec_of_basis_enum \<psi>) (vec_of_basis_enum \<phi>) $ i
[PROOF STEP]
apply (subst vec_of_basis_enum_tensor_state_index, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < CARD('a) * CARD('b) \<Longrightarrow> (case tensor_unpack CARD('a) CARD('b) i of (i1, i2) \<Rightarrow> vec_of_basis_enum \<psi> $ i1 * vec_of_basis_enum \<phi> $ i2) = tensor_state_jnf (vec_of_basis_enum \<psi>) (vec_of_basis_enum \<phi>) $ i
[PROOF STEP]
by (simp add: tensor_state_jnf_def case_prod_beta Let_def)


[STATEMENT]
lemma (in state_space)
  shows "\<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace>
          TRY
            WHILE True
            INV \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
            DO IF \<acute>M = a THEN RAISE \<acute>Abr :== ''Break''
               ELSE \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1
               FI
            OD
          CATCH
            IF \<acute>Abr = ''Break'' THEN SKIP ELSE Throw FI
          END
          \<lbrace>\<acute>S = a * b\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> TRY WHILE True INV \<lbrace>\<acute>S = \<acute>M * b\<rbrace> DO IF \<acute>M = a THEN RAISE \<acute>Abr :== ''Break'' ELSE \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 FI OD CATCH IF \<acute>Abr = ''Break'' THEN SKIP ELSE THROW FI END \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
apply vcg
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>M S. \<lbrakk>M = 0; S = 0\<rbrakk> \<Longrightarrow> S = M * b
 2. \<And>M S. \<lbrakk>S = M * b; True\<rbrakk> \<Longrightarrow> (M = a \<longrightarrow> S = a * b) \<and> (M \<noteq> a \<longrightarrow> S + b = (M + 1) * b)
 3. \<And>M S. \<lbrakk>S = M * b; \<not> True\<rbrakk> \<Longrightarrow> S = a * b
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma the_cat_parallel_2_Dom_vdomain[cat_parallel_cs_simps]:
  "\<D>\<^sub>\<circ> (\<up>\<up>\<^sub>C \<aa> \<bb> \<gg> \<ff>\<lparr>Dom\<rparr>) = set {\<aa>, \<bb>, \<gg>, \<ff>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (\<up>\<up>\<^sub>C \<aa> \<bb> \<gg> \<ff>\<lparr>Dom\<rparr>) = ZFC_in_HOL.set {\<aa>, \<bb>, \<gg>, \<ff>}
[PROOF STEP]
unfolding the_cat_parallel_2_def the_cat_parallel_Dom_vdomain
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ZFC_in_HOL.set {\<aa>, \<bb>} \<union>\<^sub>\<circ> ZFC_in_HOL.set {\<gg>, \<ff>} = ZFC_in_HOL.set {\<aa>, \<bb>, \<gg>, \<ff>}
[PROOF STEP]
by auto


[STATEMENT]
lemma poly2_by_map: "poly2 p x = poly (map_poly (\<lambda>c. poly c x) p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly2 p x = poly (map_poly (\<lambda>c. poly c x) p)
[PROOF STEP]
apply (rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. poly2 p x xa = poly (map_poly (\<lambda>c. poly c x) p) xa
[PROOF STEP]
unfolding poly2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. poly (poly p [:xa:]) x = poly (map_poly (\<lambda>c. poly c x) p) xa
[PROOF STEP]
by (induct p; simp)


[STATEMENT]
lemma partition_map_extend:
  \<open>isPartition_map R h xs lo' hi' p \<Longrightarrow>
  hi < length xs \<Longrightarrow>
  lo \<le> lo' \<Longrightarrow> lo' \<le> hi \<Longrightarrow> hi' \<le> hi \<Longrightarrow>
  lo' \<le> p \<Longrightarrow> p \<le> hi' \<Longrightarrow>
  (\<And> i. lo\<le>i \<Longrightarrow> i <lo' \<Longrightarrow> R (h (xs!i)) (h (xs!p))) \<Longrightarrow>
  (\<And> j. hi'<j \<Longrightarrow> j\<le>hi \<Longrightarrow> R (h (xs!p)) (h (xs!j))) \<Longrightarrow>
  isPartition_map R h xs lo hi p\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>isPartition_map R h xs lo' hi' p; hi < length xs; lo \<le> lo'; lo' \<le> hi; hi' \<le> hi; lo' \<le> p; p \<le> hi'; \<And>i. \<lbrakk>lo \<le> i; i < lo'\<rbrakk> \<Longrightarrow> R (h (xs ! i)) (h (xs ! p)); \<And>j. \<lbrakk>hi' < j; j \<le> hi\<rbrakk> \<Longrightarrow> R (h (xs ! p)) (h (xs ! j))\<rbrakk> \<Longrightarrow> isPartition_map R h xs lo hi p
[PROOF STEP]
by (auto simp add: partition_wrt_extend)


[STATEMENT]
lemma card_le_image_div:
  fixes A:: "'a set" and B:: "'b set" and f:: "'a \<Rightarrow> 'b set" and r:: real
  assumes "finite B" and "pairwise (\<lambda> s t. disjnt (f s) (f t)) A" and "\<forall> d \<in> A. (card (f d)) \<ge> r"
  and "\<forall> d \<in> A. f d \<subseteq> B" and "r > 0"
  shows "card A \<le> card B / r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card A) \<le> real (card B) / r
[PROOF STEP]
proof (cases "finite A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
assume hA: "finite A"
[PROOF STATE]
proof (state)
this:
finite A

goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
have hpair_disj: "pairwise disjnt (f ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint (f ` A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite B
pairwise (\<lambda>s t. disjnt (f s) (f t)) A
\<forall>d\<in>A. r \<le> real (card (f d))
\<forall>d\<in>A. f d \<subseteq> B
0 < r

goal (1 subgoal):
 1. disjoint (f ` A)
[PROOF STEP]
by (metis pairwiseD pairwise_imageI)
[PROOF STATE]
proof (state)
this:
disjoint (f ` A)

goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
have "r * card A = (\<Sum> d \<in> A. r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r * real (card A) = (\<Sum>d\<in>A. r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r * real (card A) = (\<Sum>d\<in>A. r)

goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
r * real (card A) = (\<Sum>d\<in>A. r)

goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
have "... \<le> (\<Sum> d \<in> A. card (f d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d\<in>A. r) \<le> real (\<Sum>d\<in>A. card (f d))
[PROOF STEP]
using assms sum_mono
[PROOF STATE]
proof (prove)
using this:
finite B
pairwise (\<lambda>s t. disjnt (f s) (f t)) A
\<forall>d\<in>A. r \<le> real (card (f d))
\<forall>d\<in>A. f d \<subseteq> B
0 < r
(\<And>i. i \<in> ?K \<Longrightarrow> ?f i \<le> ?g i) \<Longrightarrow> sum ?f ?K \<le> sum ?g ?K

goal (1 subgoal):
 1. (\<Sum>d\<in>A. r) \<le> real (\<Sum>d\<in>A. card (f d))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>d\<in>A. r) \<le> real (\<Sum>d\<in>A. card (f d))

goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d\<in>A. r) \<le> real (\<Sum>d\<in>A. card (f d))

goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
have "... = sum card (f ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (\<Sum>d\<in>A. card (f d)) = real (sum card (f ` A))
[PROOF STEP]
using assms hA
[PROOF STATE]
proof (prove)
using this:
finite B
pairwise (\<lambda>s t. disjnt (f s) (f t)) A
\<forall>d\<in>A. r \<le> real (card (f d))
\<forall>d\<in>A. f d \<subseteq> B
0 < r
finite A

goal (1 subgoal):
 1. real (\<Sum>d\<in>A. card (f d)) = real (sum card (f ` A))
[PROOF STEP]
by (simp add: sum_card_image)
[PROOF STATE]
proof (state)
this:
real (\<Sum>d\<in>A. card (f d)) = real (sum card (f ` A))

goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (\<Sum>d\<in>A. card (f d)) = real (sum card (f ` A))

goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
have "... = card (\<Union> d \<in> A. f d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (sum card (f ` A)) = real (card (\<Union> (f ` A)))
[PROOF STEP]
using assms hA hpair_disj
[PROOF STATE]
proof (prove)
using this:
finite B
pairwise (\<lambda>s t. disjnt (f s) (f t)) A
\<forall>d\<in>A. r \<le> real (card (f d))
\<forall>d\<in>A. f d \<subseteq> B
0 < r
finite A
disjoint (f ` A)

goal (1 subgoal):
 1. real (sum card (f ` A)) = real (card (\<Union> (f ` A)))
[PROOF STEP]
by (metis Sup_upper card_Union_disjoint finite_UN_I rev_finite_subset)
[PROOF STATE]
proof (state)
this:
real (sum card (f ` A)) = real (card (\<Union> (f ` A)))

goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (sum card (f ` A)) = real (card (\<Union> (f ` A)))

goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
have "... \<le> card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (\<Union> (f ` A))) \<le> real (card B)
[PROOF STEP]
using assms card_mono
[PROOF STATE]
proof (prove)
using this:
finite B
pairwise (\<lambda>s t. disjnt (f s) (f t)) A
\<forall>d\<in>A. r \<le> real (card (f d))
\<forall>d\<in>A. f d \<subseteq> B
0 < r
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> card ?A \<le> card ?B

goal (1 subgoal):
 1. real (card (\<Union> (f ` A))) \<le> real (card B)
[PROOF STEP]
by (metis UN_subset_iff of_nat_le_iff)
[PROOF STATE]
proof (state)
this:
real (card (\<Union> (f ` A))) \<le> real (card B)

goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
r * real (card A) \<le> real (card B)
[PROOF STEP]
have "r * card A \<le> card B"
[PROOF STATE]
proof (prove)
using this:
r * real (card A) \<le> real (card B)

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

goal (2 subgoals):
 1. finite A \<Longrightarrow> real (card A) \<le> real (card B) / r
 2. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
r * real (card A) \<le> real (card B)

goal (1 subgoal):
 1. real (card A) \<le> real (card B) / r
[PROOF STEP]
using divide_le_eq assms
[PROOF STATE]
proof (prove)
using this:
r * real (card A) \<le> real (card B)
(?b / ?c \<le> ?a) = (if (0::?'a) < ?c then ?b \<le> ?a * ?c else if ?c < (0::?'a) then ?a * ?c \<le> ?b else (0::?'a) \<le> ?a)
finite B
pairwise (\<lambda>s t. disjnt (f s) (f t)) A
\<forall>d\<in>A. r \<le> real (card (f d))
\<forall>d\<in>A. f d \<subseteq> B
0 < r

goal (1 subgoal):
 1. real (card A) \<le> real (card B) / r
[PROOF STEP]
by (simp add: mult_imp_le_div_pos mult_of_nat_commute)
[PROOF STATE]
proof (state)
this:
real (card A) \<le> real (card B) / r

goal (1 subgoal):
 1. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
assume "\<not> finite A"
[PROOF STATE]
proof (state)
this:
infinite A

goal (1 subgoal):
 1. infinite A \<Longrightarrow> real (card A) \<le> real (card B) / r
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite A

goal (1 subgoal):
 1. real (card A) \<le> real (card B) / r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
infinite A
finite B
pairwise (\<lambda>s t. disjnt (f s) (f t)) A
\<forall>d\<in>A. r \<le> real (card (f d))
\<forall>d\<in>A. f d \<subseteq> B
0 < r

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma csqrt_of_real_nonneg [simp]: "Im x = 0 \<Longrightarrow> Re x \<ge> 0 \<Longrightarrow> csqrt x = sqrt (Re x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Im x = 0; 0 \<le> Re x\<rbrakk> \<Longrightarrow> csqrt x = complex_of_real (sqrt (Re x))
[PROOF STEP]
by (simp add: complex_eq_iff norm_complex_def)


[STATEMENT]
lemma SD_preorder:
   "p \<succeq>[SD(le)] q \<longleftrightarrow> p \<in> lotteries_on carrier \<and> q \<in> lotteries_on carrier \<and>
      (\<forall>x\<in>carrier. measure_pmf.prob p (preferred_alts le x) \<ge>
                     measure_pmf.prob q (preferred_alts le x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SD le q p = (p \<in> lotteries_on carrier \<and> q \<in> lotteries_on carrier \<and> (\<forall>x\<in>carrier. measure_pmf.prob q (preferred_alts le x) \<le> measure_pmf.prob p (preferred_alts le x)))
[PROOF STEP]
by (simp add: SD_def preferred_alts_def carrier_eq)


[STATEMENT]
lemma (in vector_space_pair_on)
  linear_sum':
    "\<forall>x. x \<in> S1 \<longrightarrow> f x \<in> S2 \<Longrightarrow>
    \<forall>x. x \<in> S \<longrightarrow> g x \<in> S1 \<Longrightarrow>
    linear_on S1 S2 scale1 scale2 f \<Longrightarrow>
    f (sum g S) = (\<Sum>a\<in>S. f (g a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. x \<in> S1 \<longrightarrow> f x \<in> S2; \<forall>x. x \<in> S \<longrightarrow> g x \<in> S1; linear_on S1 S2 scale1 scale2 f\<rbrakk> \<Longrightarrow> f (sum g S) = (\<Sum>a\<in>S. f (g a))
[PROOF STEP]
using linear_sum[of f "\<lambda>x. if x \<in> S then g x else 0" S]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>x. x \<in> S1 \<longrightarrow> f x \<in> S2; \<forall>x. (if x \<in> S then g x else (0::'b)) \<in> S1; linear_on S1 S2 scale1 scale2 f\<rbrakk> \<Longrightarrow> f (\<Sum>x\<in>S. if x \<in> S then g x else (0::'b)) = (\<Sum>a\<in>S. f (if a \<in> S then g a else (0::'b)))

goal (1 subgoal):
 1. \<lbrakk>\<forall>x. x \<in> S1 \<longrightarrow> f x \<in> S2; \<forall>x. x \<in> S \<longrightarrow> g x \<in> S1; linear_on S1 S2 scale1 scale2 f\<rbrakk> \<Longrightarrow> f (sum g S) = (\<Sum>a\<in>S. f (g a))
[PROOF STEP]
by (auto simp: if_distrib if_distribR m1.mem_zero cong: if_cong)


[STATEMENT]
lemma sumlist_as_fold:
  assumes "set xs \<subseteq> carrier G"
  shows "sumlist xs = fold (\<oplus>) xs \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumlist xs = fold (\<oplus>) xs \<zero>
[PROOF STEP]
by (fold sumlist_rev[OF assms], simp add: sumlist_def foldr_conv_fold)


[STATEMENT]
lemma sup_id_top: "1 \<le> y \<Longrightarrow> y \<cdot> \<top> = \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) \<le> y \<Longrightarrow> y \<cdot> \<top> = \<top>
[PROOF STEP]
using order.eq_iff local.mult_isol_var top_ref
[PROOF STATE]
proof (prove)
using this:
(?a = ?b) = (?a \<le> ?b \<and> ?b \<le> ?a)
\<lbrakk>?u \<le> ?x; ?v \<le> ?y\<rbrakk> \<Longrightarrow> ?u \<cdot> ?v \<le> ?x \<cdot> ?y
?x \<le> \<top>

goal (1 subgoal):
 1. (1::'a) \<le> y \<Longrightarrow> y \<cdot> \<top> = \<top>
[PROOF STEP]
by fastforce


[STATEMENT]
lemma sort_les_trans: "sort_les cs x y \<Longrightarrow> sort_les cs y z \<Longrightarrow> sort_les cs x z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sort_les cs x y; sort_les cs y z\<rbrakk> \<Longrightarrow> sort_les cs x z
[PROOF STEP]
using sort_les_def sort_leq_trans
[PROOF STATE]
proof (prove)
using this:
sort_les ?cs ?s1.0 ?s2.0 = (sort_leq ?cs ?s1.0 ?s2.0 \<and> \<not> sort_leq ?cs ?s2.0 ?s1.0)
\<lbrakk>sort_leq cs ?x ?y; sort_leq cs ?y ?z\<rbrakk> \<Longrightarrow> sort_leq cs ?x ?z

goal (1 subgoal):
 1. \<lbrakk>sort_les cs x y; sort_les cs y z\<rbrakk> \<Longrightarrow> sort_les cs x z
[PROOF STEP]
by blast


[STATEMENT]
lemma pre_to_univ_poly_inv_hom_pvar_1:
  assumes "i < Suc n"
  assumes "i \<le> j"
  assumes "j < n"
  shows "pre_to_univ_poly_inv_hom (Suc n) i (pvar R j) =
            pvar R (j + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pre_to_univ_poly_inv_hom (Suc n) i (pvar R j) = pvar R (j + 1)
[PROOF STEP]
unfolding pre_to_univ_poly_inv_hom_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R.relabel_vars {..<Suc n - 1} {..<Suc n} (\<lambda>j. if j < i then j else j + 1) (pvar R j) = pvar R (j + 1)
[PROOF STEP]
using assms R.relabel_vars_is_morphism(2)[of "\<lambda>j. if j < i then j else j + 1" "{..<n}" "{..< Suc n}" j]
[PROOF STATE]
proof (prove)
using this:
i < Suc n
i \<le> j
j < n
\<lbrakk>(\<lambda>j. if j < i then j else j + 1) \<in> {..<n} \<rightarrow> {..<Suc n}; j \<in> {..<n}\<rbrakk> \<Longrightarrow> R.relabel_vars {..<n} {..<Suc n} (\<lambda>j. if j < i then j else j + 1) (pvar R j) = pvar R (if j < i then j else j + 1)

goal (1 subgoal):
 1. R.relabel_vars {..<Suc n - 1} {..<Suc n} (\<lambda>j. if j < i then j else j + 1) (pvar R j) = pvar R (j + 1)
[PROOF STEP]
by (smt Pi_I add.commute add_less_cancel_right diff_Suc_1 lessThan_iff less_Suc_eq not_le plus_1_eq_Suc)


[STATEMENT]
lemma set_ig_arcs_imp_verts:
  assumes "(u,v) \<in> set (ig_arcs G)" "IGraph_inv G" shows "u \<in> set (ig_verts G)" "v \<in> set (ig_verts G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<in> set (ig_verts G) &&& v \<in> set (ig_verts G)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u \<in> set (ig_verts G)
 2. v \<in> set (ig_verts G)
[PROOF STEP]
interpret pair_pseudo_graph "mk_graph G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pair_pseudo_graph (mk_graph G)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(u, v) \<in> set (ig_arcs G)
IGraph_inv G

goal (1 subgoal):
 1. pair_pseudo_graph (mk_graph G)
[PROOF STEP]
by (auto intro: IGraph_imp_ppg_mkg)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u \<in> set (ig_verts G)
 2. v \<in> set (ig_verts G)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
(u, v) \<in> set (ig_arcs G)
IGraph_inv G
[PROOF STEP]
have "(u,v) \<in> parcs (mk_graph G)"
[PROOF STATE]
proof (prove)
using this:
(u, v) \<in> set (ig_arcs G)
IGraph_inv G

goal (1 subgoal):
 1. (u, v) \<in> parcs (mk_graph G)
[PROOF STEP]
by (simp add: mkg_simps symcl_def)
[PROOF STATE]
proof (state)
this:
(u, v) \<in> parcs (mk_graph G)

goal (2 subgoals):
 1. u \<in> set (ig_verts G)
 2. v \<in> set (ig_verts G)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(u, v) \<in> parcs (mk_graph G)
[PROOF STEP]
have "u \<in> pverts (mk_graph G)" "v \<in> pverts (mk_graph G)"
[PROOF STATE]
proof (prove)
using this:
(u, v) \<in> parcs (mk_graph G)

goal (1 subgoal):
 1. u \<in> pverts (mk_graph G) &&& v \<in> pverts (mk_graph G)
[PROOF STEP]
by (auto dest: wellformed')
[PROOF STATE]
proof (state)
this:
u \<in> pverts (mk_graph G)
v \<in> pverts (mk_graph G)

goal (2 subgoals):
 1. u \<in> set (ig_verts G)
 2. v \<in> set (ig_verts G)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<in> pverts (mk_graph G)
v \<in> pverts (mk_graph G)
[PROOF STEP]
show "u \<in> set (ig_verts G)" "v \<in> set (ig_verts G)"
[PROOF STATE]
proof (prove)
using this:
u \<in> pverts (mk_graph G)
v \<in> pverts (mk_graph G)

goal (1 subgoal):
 1. u \<in> set (ig_verts G) &&& v \<in> set (ig_verts G)
[PROOF STEP]
by (auto simp: mkg_simps)
[PROOF STATE]
proof (state)
this:
u \<in> set (ig_verts G)
v \<in> set (ig_verts G)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma islimpt_eq_infinite_cball: "x islimpt S \<longleftrightarrow> (\<forall>e>0. infinite(S \<inter> cball x e))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x islimpt S = (\<forall>e>0. infinite (S \<inter> cball x e))
[PROOF STEP]
apply (simp add: islimpt_eq_infinite_ball, safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>e. \<lbrakk>\<forall>e>0. infinite (S \<inter> ball x e); 0 < e; finite (S \<inter> cball x e)\<rbrakk> \<Longrightarrow> False
 2. \<And>e. \<lbrakk>\<forall>e>0. infinite (S \<inter> cball x e); 0 < e; finite (S \<inter> ball x e)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (meson Int_mono ball_subset_cball finite_subset order_refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>e>0. infinite (S \<inter> cball x e); 0 < e; finite (S \<inter> ball x e)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (metis open_ball centre_in_ball finite_Int inf.absorb_iff2 inf_assoc open_contains_cball_eq)


[STATEMENT]
lemma out_null_anga:
  assumes "QCongAAcute a" and
    "a A B C" and
    "B Out A C"
  shows "QCongANullAcute a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. QCongANullAcute a
[PROOF STEP]
using IsNullAngaP_def assms(1) assms(2) assms(3) null_anga_null_angaP
[PROOF STATE]
proof (prove)
using this:
IsNullAngaP ?a \<equiv> QCongAACute ?a \<and> (\<exists>A B C. ?a A B C \<and> B Out A C)
QCongAACute a
a A B C
B Out A C
(QCongANullAcute ?a) = (IsNullAngaP ?a)

goal (1 subgoal):
 1. QCongANullAcute a
[PROOF STEP]
by auto


[STATEMENT]
lemma measure_return_pmf [simp]: "measure_pmf.prob (return_pmf x) A = indicator A x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (return_pmf x) A = indicat_real A x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.prob (return_pmf x) A = indicat_real A x
[PROOF STEP]
have "ennreal (measure_pmf.prob (return_pmf x) A) =
          emeasure (measure_pmf (return_pmf x)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (measure_pmf.prob (return_pmf x) A) = emeasure (measure_pmf (return_pmf x)) A
[PROOF STEP]
by (simp add: measure_pmf.emeasure_eq_measure)
[PROOF STATE]
proof (state)
this:
ennreal (measure_pmf.prob (return_pmf x) A) = emeasure (measure_pmf (return_pmf x)) A

goal (1 subgoal):
 1. measure_pmf.prob (return_pmf x) A = indicat_real A x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (measure_pmf.prob (return_pmf x) A) = emeasure (measure_pmf (return_pmf x)) A

goal (1 subgoal):
 1. measure_pmf.prob (return_pmf x) A = indicat_real A x
[PROOF STEP]
have "\<dots> = ennreal (indicator A x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (measure_pmf (return_pmf x)) A = ennreal (indicat_real A x)
[PROOF STEP]
by (simp add: ennreal_indicator)
[PROOF STATE]
proof (state)
this:
emeasure (measure_pmf (return_pmf x)) A = ennreal (indicat_real A x)

goal (1 subgoal):
 1. measure_pmf.prob (return_pmf x) A = indicat_real A x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (measure_pmf.prob (return_pmf x) A) = ennreal (indicat_real A x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (measure_pmf.prob (return_pmf x) A) = ennreal (indicat_real A x)

goal (1 subgoal):
 1. measure_pmf.prob (return_pmf x) A = indicat_real A x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (return_pmf x) A = indicat_real A x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_arctan [continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. arctan (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F f \<Longrightarrow> continuous F (\<lambda>x. arctan (f x))
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F \<Longrightarrow> ((\<lambda>x. arctan (f x)) \<longlongrightarrow> arctan (f (Lim F (\<lambda>x. x)))) F
[PROOF STEP]
by (rule tendsto_arctan)


[STATEMENT]
lemma max_zero_mult_nonneg_le: "0 \<le> h' \<Longrightarrow> h' \<le> h \<Longrightarrow> h' * k \<le> max 0 (h * k::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> h'; h' \<le> h\<rbrakk> \<Longrightarrow> h' * k \<le> max 0 (h * k)
[PROOF STEP]
by (metis dual_order.antisym le_cases le_max_iff_disj mult_eq_0_iff mult_right_mono
      zero_le_mult_iff)


[STATEMENT]
lemma diagonal_to_Smith_row_i_dvd_ii:
  fixes A::"'a::{bezout_ring}^'b::mod_type^'c::mod_type"
  shows "Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd A $ from_nat i $ from_nat i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Diagonal_to_Smith_row_i A i bezout $ from_nat i $ from_nat i dvd A $ from_nat i $ from_nat i
[PROOF STEP]
unfolding Diagonal_to_Smith_row_i_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diagonal_to_Smith_i [i + 1..<min (nrows A) (ncols A)] A i bezout $ from_nat i $ from_nat i dvd A $ from_nat i $ from_nat i
[PROOF STEP]
by (rule diagonal_to_Smith_i_dvd_ii[OF ib])


[STATEMENT]
lemma real_abs_infnorm: "\<bar>infnorm x\<bar> = infnorm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>infnorm x\<bar> = infnorm x
[PROOF STEP]
using infnorm_pos_le[of x]
[PROOF STATE]
proof (prove)
using this:
0 \<le> infnorm x

goal (1 subgoal):
 1. \<bar>infnorm x\<bar> = infnorm x
[PROOF STEP]
by arith


[STATEMENT]
lemma eval_list_conj_Uni : "evalUni (list_conj_Uni A) x = (\<forall>l\<in>set A. evalUni l x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. evalUni (list_conj_Uni A) x = (\<forall>l\<in>set A. evalUni l x)
[PROOF STEP]
apply(induction A)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. evalUni (list_conj_Uni []) x = (\<forall>l\<in>set []. evalUni l x)
 2. \<And>a A. evalUni (list_conj_Uni A) x = (\<forall>l\<in>set A. evalUni l x) \<Longrightarrow> evalUni (list_conj_Uni (a # A)) x = (\<forall>l\<in>set (a # A). evalUni l x)
[PROOF STEP]
by auto


[STATEMENT]
lemma transitive:
  fixes P :: pi
  and   Q :: pi
  and   R :: pi

  assumes "P \<sim> Q"
  and     "Q \<sim> R"

  shows "P \<sim> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<sim> R
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P \<sim> R
[PROOF STEP]
let ?X = "bisim O bisim"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P \<sim> R
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
P \<sim> Q
Q \<sim> R
[PROOF STEP]
have "(P, R) \<in> ?X"
[PROOF STATE]
proof (prove)
using this:
P \<sim> Q
Q \<sim> R

goal (1 subgoal):
 1. (P, R) \<in> bisim O bisim
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(P, R) \<in> bisim O bisim

goal (1 subgoal):
 1. P \<sim> R
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(P, R) \<in> bisim O bisim

goal (1 subgoal):
 1. P \<sim> R
[PROOF STEP]
proof(coinduct rule: bisimCoinduct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>R S. (R, S) \<in> bisim O bisim \<Longrightarrow> R \<leadsto>[(bisim O bisim \<union> bisim)] S
 2. \<And>R S. (R, S) \<in> bisim O bisim \<Longrightarrow> (S, R) \<in> bisim O bisim
[PROOF STEP]
case(cSim P R)
[PROOF STATE]
proof (state)
this:
(P, R) \<in> bisim O bisim

goal (2 subgoals):
 1. \<And>R S. (R, S) \<in> bisim O bisim \<Longrightarrow> R \<leadsto>[(bisim O bisim \<union> bisim)] S
 2. \<And>R S. (R, S) \<in> bisim O bisim \<Longrightarrow> (S, R) \<in> bisim O bisim
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
(P, R) \<in> bisim O bisim

goal (1 subgoal):
 1. P \<leadsto>[(bisim O bisim \<union> bisim)] R
[PROOF STEP]
by(fastforce intro: Strong_Late_Sim.transitive dest: bisimE simp add: eqvtTrans)
[PROOF STATE]
proof (state)
this:
P \<leadsto>[(bisim O bisim \<union> bisim)] R

goal (1 subgoal):
 1. \<And>R S. (R, S) \<in> bisim O bisim \<Longrightarrow> (S, R) \<in> bisim O bisim
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>R S. (R, S) \<in> bisim O bisim \<Longrightarrow> (S, R) \<in> bisim O bisim
[PROOF STEP]
case(cSym P R)
[PROOF STATE]
proof (state)
this:
(P, R) \<in> bisim O bisim

goal (1 subgoal):
 1. \<And>R S. (R, S) \<in> bisim O bisim \<Longrightarrow> (S, R) \<in> bisim O bisim
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
(P, R) \<in> bisim O bisim

goal (1 subgoal):
 1. (R, P) \<in> bisim O bisim
[PROOF STEP]
by(auto dest: symmetric)
[PROOF STATE]
proof (state)
this:
(R, P) \<in> bisim O bisim

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P \<sim> R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hmem_HF_iff [simp]: "x \<^bold>\<in> HF A \<longleftrightarrow> x \<in> A \<and> finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<^bold>\<in> HF A) = (x \<in> A \<and> finite A)
[PROOF STEP]
apply (cases "finite A", auto)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>finite A; x \<^bold>\<in> HF A\<rbrakk> \<Longrightarrow> x \<in> A
 2. \<lbrakk>finite A; x \<in> A\<rbrakk> \<Longrightarrow> x \<^bold>\<in> HF A
 3. \<lbrakk>infinite A; x \<^bold>\<in> HF A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (simp add: hmem_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite A; x \<in> A\<rbrakk> \<Longrightarrow> x \<^bold>\<in> HF A
 2. \<lbrakk>infinite A; x \<^bold>\<in> HF A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (simp add: hmem_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>infinite A; x \<^bold>\<in> HF A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (metis HF_def Rep_hf_inject Abs_hf_0 finite_imageD hempty_iff inj_onI set_encode_inf)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fps_divide_1: "(a :: 'a :: field fps) / 1 = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a / 1 = a
[PROOF STEP]
by simp


[STATEMENT]
lemma blinfun_of_matrix_works:
  fixes f::"'a::euclidean_space \<Rightarrow>\<^sub>L 'b::euclidean_space"
  shows "blinfun_of_matrix (\<lambda>i j. (f j) \<bullet> i) = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. blinfun_of_matrix (\<lambda>i j. blinfun_apply f j \<bullet> i) = f
[PROOF STEP]
proof (transfer, rule,  rule euclidean_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f x b. \<lbrakk>bounded_linear f; b \<in> Basis\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. (x \<bullet> j * (f j \<bullet> i)) *\<^sub>R i) \<bullet> b = f x \<bullet> b
[PROOF STEP]
fix f::"'a \<Rightarrow> 'b" and x::'a and b::'b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f x b. \<lbrakk>bounded_linear f; b \<in> Basis\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. (x \<bullet> j * (f j \<bullet> i)) *\<^sub>R i) \<bullet> b = f x \<bullet> b
[PROOF STEP]
assume "bounded_linear f" and b: "b \<in> Basis"
[PROOF STATE]
proof (state)
this:
bounded_linear f
b \<in> Basis

goal (1 subgoal):
 1. \<And>f x b. \<lbrakk>bounded_linear f; b \<in> Basis\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. (x \<bullet> j * (f j \<bullet> i)) *\<^sub>R i) \<bullet> b = f x \<bullet> b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bounded_linear f
b \<in> Basis
[PROOF STEP]
interpret bounded_linear f
[PROOF STATE]
proof (prove)
using this:
bounded_linear f
b \<in> Basis

goal (1 subgoal):
 1. bounded_linear f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f x b. \<lbrakk>bounded_linear f; b \<in> Basis\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. (x \<bullet> j * (f j \<bullet> i)) *\<^sub>R i) \<bullet> b = f x \<bullet> b
[PROOF STEP]
have "(\<Sum>j\<in>Basis. \<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j)) *\<^sub>R j) \<bullet> b
    = (\<Sum>j\<in>Basis. if j = b then (\<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j))) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. \<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j)) *\<^sub>R j) \<bullet> b = (\<Sum>j\<in>Basis. if j = b then \<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> j) else 0)
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
b \<in> Basis

goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. \<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j)) *\<^sub>R j) \<bullet> b = (\<Sum>j\<in>Basis. if j = b then \<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> j) else 0)
[PROOF STEP]
by (simp add: inner_sum_left inner_Basis if_distrib cong: if_cong) (simp add: sum.swap)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>Basis. \<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j)) *\<^sub>R j) \<bullet> b = (\<Sum>j\<in>Basis. if j = b then \<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> j) else 0)

goal (1 subgoal):
 1. \<And>f x b. \<lbrakk>bounded_linear f; b \<in> Basis\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. (x \<bullet> j * (f j \<bullet> i)) *\<^sub>R i) \<bullet> b = f x \<bullet> b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>Basis. \<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j)) *\<^sub>R j) \<bullet> b = (\<Sum>j\<in>Basis. if j = b then \<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> j) else 0)

goal (1 subgoal):
 1. \<And>f x b. \<lbrakk>bounded_linear f; b \<in> Basis\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. (x \<bullet> j * (f j \<bullet> i)) *\<^sub>R i) \<bullet> b = f x \<bullet> b
[PROOF STEP]
have "\<dots> = (\<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. if j = b then \<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> j) else 0) = (\<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> b))
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
b \<in> Basis

goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. if j = b then \<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> j) else 0) = (\<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> b))
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>Basis. if j = b then \<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> j) else 0) = (\<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> b))

goal (1 subgoal):
 1. \<And>f x b. \<lbrakk>bounded_linear f; b \<in> Basis\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. (x \<bullet> j * (f j \<bullet> i)) *\<^sub>R i) \<bullet> b = f x \<bullet> b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>Basis. if j = b then \<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> j) else 0) = (\<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> b))

goal (1 subgoal):
 1. \<And>f x b. \<lbrakk>bounded_linear f; b \<in> Basis\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. (x \<bullet> j * (f j \<bullet> i)) *\<^sub>R i) \<bullet> b = f x \<bullet> b
[PROOF STEP]
have "\<dots> = f x \<bullet> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> b)) = f x \<bullet> b
[PROOF STEP]
by (metis (mono_tags, lifting) Linear_Algebra.linear_componentwise linear_axioms)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>Basis. x \<bullet> i * (f i \<bullet> b)) = f x \<bullet> b

goal (1 subgoal):
 1. \<And>f x b. \<lbrakk>bounded_linear f; b \<in> Basis\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. (x \<bullet> j * (f j \<bullet> i)) *\<^sub>R i) \<bullet> b = f x \<bullet> b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>j\<in>Basis. \<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j)) *\<^sub>R j) \<bullet> b = f x \<bullet> b
[PROOF STEP]
show "(\<Sum>j\<in>Basis. \<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j)) *\<^sub>R j) \<bullet> b = f x \<bullet> b"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j\<in>Basis. \<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j)) *\<^sub>R j) \<bullet> b = f x \<bullet> b

goal (1 subgoal):
 1. (\<Sum>j\<in>Basis. \<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j)) *\<^sub>R j) \<bullet> b = f x \<bullet> b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>Basis. \<Sum>i\<in>Basis. (x \<bullet> i * (f i \<bullet> j)) *\<^sub>R j) \<bullet> b = f x \<bullet> b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cf_adjunction_AdjNT_of_unit_is_ntcf'[adj_cs_intros]:
  assumes "category \<alpha> \<CC>"
    and "category \<alpha> \
"
    and "\<FF> : \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \
"
    and "\<GG> : \
 \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
    and "\<eta> : cf_id \<CC> \<mapsto>\<^sub>C\<^sub>F \<GG> \<circ>\<^sub>C\<^sub>F \<FF> : \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
    and "\<SS> = Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\
(\<FF>-,-)"
    and "\<SS>' = Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(-,\<GG>-)"
    and "\<AA> = op_cat \<CC> \<times>\<^sub>C \
"
    and "\<BB> = cat_Set \<alpha>"
  shows "cf_adjunction_AdjNT_of_unit \<alpha> \<FF> \<GG> \<eta> : \<SS> \<mapsto>\<^sub>C\<^sub>F \<SS>' : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cf_adjunction_AdjNT_of_unit \<alpha> \<FF> \<GG> \<eta> : \<SS> \<mapsto>\<^sub>C\<^sub>F \<SS>' : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
using assms(1-5)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
category \<alpha> \

\<FF> : \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \

\<GG> : \
 \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
\<eta> : dghm_id \<CC> \<mapsto>\<^sub>C\<^sub>F \<GG> \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF> : \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>

goal (1 subgoal):
 1. cf_adjunction_AdjNT_of_unit \<alpha> \<FF> \<GG> \<eta> : \<SS> \<mapsto>\<^sub>C\<^sub>F \<SS>' : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
unfolding assms(6-9)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
category \<alpha> \

\<FF> : \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \

\<GG> : \
 \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
\<eta> : dghm_id \<CC> \<mapsto>\<^sub>C\<^sub>F \<GG> \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF> : \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>

goal (1 subgoal):
 1. cf_adjunction_AdjNT_of_unit \<alpha> \<FF> \<GG> \<eta> : Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\
(\<FF>-,-) \<mapsto>\<^sub>C\<^sub>F Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(-,\<GG>-) : op_cat \<CC> \<times>\<^sub>C \
 \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> cat_Set \<alpha>
[PROOF STEP]
by (rule cf_adjunction_AdjNT_of_unit_is_ntcf)


[STATEMENT]
lemma lprefix_llength_le: "xs \<sqsubseteq> ys \<Longrightarrow> llength xs \<le> llength ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<sqsubseteq> ys \<Longrightarrow> llength xs \<le> llength ys
[PROOF STEP]
using monotone_llength
[PROOF STATE]
proof (prove)
using this:
monotone (\<sqsubseteq>) (\<le>) llength

goal (1 subgoal):
 1. xs \<sqsubseteq> ys \<Longrightarrow> llength xs \<le> llength ys
[PROOF STEP]
by(rule monotoneD)


[STATEMENT]
lemma interval_lebesgue_integral_by_parts_01:
  assumes cont_f[intro]: "continuous_on {0..1} f"
  assumes cont_g[intro]: "continuous_on {0..1} g"
  assumes [intro]: "\<And>x. x \<in> {0..1} \<Longrightarrow> (F has_field_derivative f x) (at x within {0..1})"
  assumes [intro]: "\<And>x. x \<in> {0..1} \<Longrightarrow> (G has_field_derivative g x) (at x within {0..1})"
  shows "(LBINT x=0..1. F x * g x) = F 1 * G 1 - F 0 * G 0 - (LBINT x=0..1. f x * G x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LBINT x=0..1. F x * g x = F 1 * G 1 - F 0 * G 0 - (LBINT x=0..1. f x * G x)
[PROOF STEP]
using interval_lebesgue_integral_by_parts[of 0 1 f g F G] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> 1; continuous_on {0..1} f; continuous_on {0..1} g; \<And>x. x \<in> {0..1} \<Longrightarrow> (F has_real_derivative f x) (at x within {0..1}); \<And>x. x \<in> {0..1} \<Longrightarrow> (G has_real_derivative g x) (at x within {0..1})\<rbrakk> \<Longrightarrow> LBINT x=ereal 0..ereal 1. F x * g x = F 1 * G 1 - F 0 * G 0 - (LBINT x=ereal 0..ereal 1. f x * G x)
continuous_on {0..1} f
continuous_on {0..1} g
?x \<in> {0..1} \<Longrightarrow> (F has_real_derivative f ?x) (at ?x within {0..1})
?x \<in> {0..1} \<Longrightarrow> (G has_real_derivative g ?x) (at ?x within {0..1})

goal (1 subgoal):
 1. LBINT x=0..1. F x * g x = F 1 * G 1 - F 0 * G 0 - (LBINT x=0..1. f x * G x)
[PROOF STEP]
by (simp add: zero_ereal_def one_ereal_def)


[STATEMENT]
lemma csin_eq_minus1:
  fixes z::complex
  shows "sin z = -1 \<longleftrightarrow> (\<exists>n::int. z = complex_of_real(2 * n * pi) + 3/2*pi)"
        (is "_ = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))
[PROOF STEP]
have "sin z = -1 \<longleftrightarrow> sin (-z) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin z = - 1) = (sin (- z) = 1)
[PROOF STEP]
by (simp add: equation_minus_iff)
[PROOF STATE]
proof (state)
this:
(sin z = - 1) = (sin (- z) = 1)

goal (1 subgoal):
 1. (sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(sin z = - 1) = (sin (- z) = 1)

goal (1 subgoal):
 1. (sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<exists>n::int. -z = of_real(2 * n * pi) + of_real pi/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin (- z) = 1) = (\<exists>x. - z = complex_of_real (2 * real_of_int x * pi) + complex_of_real pi / 2)
[PROOF STEP]
by (simp only: csin_eq_1)
[PROOF STATE]
proof (state)
this:
(sin (- z) = 1) = (\<exists>x. - z = complex_of_real (2 * real_of_int x * pi) + complex_of_real pi / 2)

goal (1 subgoal):
 1. (sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(sin (- z) = 1) = (\<exists>x. - z = complex_of_real (2 * real_of_int x * pi) + complex_of_real pi / 2)

goal (1 subgoal):
 1. (sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<exists>n::int. z = - of_real(2 * n * pi) - of_real pi/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. - z = complex_of_real (2 * real_of_int x * pi) + complex_of_real pi / 2) = (\<exists>x. z = - complex_of_real (2 * real_of_int x * pi) - complex_of_real pi / 2)
[PROOF STEP]
by (rule iff_exI) (metis add.inverse_inverse add_uminus_conv_diff minus_add_distrib)
[PROOF STATE]
proof (state)
this:
(\<exists>x. - z = complex_of_real (2 * real_of_int x * pi) + complex_of_real pi / 2) = (\<exists>x. z = - complex_of_real (2 * real_of_int x * pi) - complex_of_real pi / 2)

goal (1 subgoal):
 1. (sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>x. - z = complex_of_real (2 * real_of_int x * pi) + complex_of_real pi / 2) = (\<exists>x. z = - complex_of_real (2 * real_of_int x * pi) - complex_of_real pi / 2)

goal (1 subgoal):
 1. (sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. z = - complex_of_real (2 * real_of_int x * pi) - complex_of_real pi / 2) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. z = - complex_of_real (2 * real_of_int x * pi) - complex_of_real pi / 2 \<Longrightarrow> \<exists>xa. - complex_of_real (2 * real_of_int x * pi) - complex_of_real pi / 2 = complex_of_real (2 * real_of_int xa * pi) + complex_of_real (3 / 2 * pi)
 2. \<And>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi) \<Longrightarrow> \<exists>xa. complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi) = - complex_of_real (2 * real_of_int xa * pi) - complex_of_real pi / 2
[PROOF STEP]
apply (rule_tac [2] x="-(x+1)" in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. z = - complex_of_real (2 * real_of_int x * pi) - complex_of_real pi / 2 \<Longrightarrow> \<exists>xa. - complex_of_real (2 * real_of_int x * pi) - complex_of_real pi / 2 = complex_of_real (2 * real_of_int xa * pi) + complex_of_real (3 / 2 * pi)
 2. \<And>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi) \<Longrightarrow> complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi) = - complex_of_real (2 * real_of_int (- (x + 1)) * pi) - complex_of_real pi / 2
[PROOF STEP]
apply (rule_tac x="-(x+1)" in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. z = - complex_of_real (2 * real_of_int x * pi) - complex_of_real pi / 2 \<Longrightarrow> - complex_of_real (2 * real_of_int x * pi) - complex_of_real pi / 2 = complex_of_real (2 * real_of_int (- (x + 1)) * pi) + complex_of_real (3 / 2 * pi)
 2. \<And>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi) \<Longrightarrow> complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi) = - complex_of_real (2 * real_of_int (- (x + 1)) * pi) - complex_of_real pi / 2
[PROOF STEP]
apply (simp_all add: algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<exists>x. z = - complex_of_real (2 * real_of_int x * pi) - complex_of_real pi / 2) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))

goal (1 subgoal):
 1. (sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))

goal (1 subgoal):
 1. (sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(sin z = - 1) = (\<exists>x. z = complex_of_real (2 * real_of_int x * pi) + complex_of_real (3 / 2 * pi))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lim_ceiling_over_n [tendsto_intros]:
  assumes "(\<lambda>n. u n/n) \<longlonglongrightarrow> l"
  shows "(\<lambda>n. ceiling(u n)/n) \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. real_of_int \<lceil>u n\<rceil> / real n) \<longlonglongrightarrow> l
[PROOF STEP]
proof (rule tendsto_sandwich[of "\<lambda>n. u n/n" _ _ "\<lambda>n. u n/n + 1/n"])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<forall>\<^sub>F n in sequentially. u n / real n \<le> real_of_int \<lceil>u n\<rceil> / real n
 2. \<forall>\<^sub>F n in sequentially. real_of_int \<lceil>u n\<rceil> / real n \<le> u n / real n + 1 / real n
 3. (\<lambda>n. u n / real n) \<longlonglongrightarrow> l
 4. (\<lambda>n. u n / real n + 1 / real n) \<longlonglongrightarrow> l
[PROOF STEP]
show "\<forall>\<^sub>F n in sequentially. u n / real n \<le> real_of_int \<lceil>u n\<rceil> / real n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. u n / real n \<le> real_of_int \<lceil>u n\<rceil> / real n
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. u n / real n \<le> real_of_int \<lceil>u n\<rceil> / real n
[PROOF STEP]
by (rule exI[of _ 1], auto simp add: divide_simps)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. u n / real n \<le> real_of_int \<lceil>u n\<rceil> / real n

goal (3 subgoals):
 1. \<forall>\<^sub>F n in sequentially. real_of_int \<lceil>u n\<rceil> / real n \<le> u n / real n + 1 / real n
 2. (\<lambda>n. u n / real n) \<longlonglongrightarrow> l
 3. (\<lambda>n. u n / real n + 1 / real n) \<longlonglongrightarrow> l
[PROOF STEP]
show "\<forall>\<^sub>F n in sequentially. real_of_int \<lceil>u n\<rceil> / real n \<le> u n / real n + 1 / real n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. real_of_int \<lceil>u n\<rceil> / real n \<le> u n / real n + 1 / real n
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. real_of_int \<lceil>u n\<rceil> / real n \<le> u n / real n + 1 / real n
[PROOF STEP]
by (rule exI[of _ 1], auto simp add: divide_simps)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. real_of_int \<lceil>u n\<rceil> / real n \<le> u n / real n + 1 / real n

goal (2 subgoals):
 1. (\<lambda>n. u n / real n) \<longlonglongrightarrow> l
 2. (\<lambda>n. u n / real n + 1 / real n) \<longlonglongrightarrow> l
[PROOF STEP]
have "(\<lambda>n. u n / real n + 1 / real n) \<longlonglongrightarrow> l + 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. u n / real n + 1 / real n) \<longlonglongrightarrow> l + 0
[PROOF STEP]
by (intro tendsto_intros assms)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. u n / real n + 1 / real n) \<longlonglongrightarrow> l + 0

goal (2 subgoals):
 1. (\<lambda>n. u n / real n) \<longlonglongrightarrow> l
 2. (\<lambda>n. u n / real n + 1 / real n) \<longlonglongrightarrow> l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. u n / real n + 1 / real n) \<longlonglongrightarrow> l + 0
[PROOF STEP]
show "(\<lambda>n. u n / real n + 1 / real n) \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. u n / real n + 1 / real n) \<longlonglongrightarrow> l + 0

goal (1 subgoal):
 1. (\<lambda>n. u n / real n + 1 / real n) \<longlonglongrightarrow> l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. u n / real n + 1 / real n) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>n. u n / real n) \<longlonglongrightarrow> l
[PROOF STEP]
qed (simp add: assms)


[STATEMENT]
lemma homeomorphism_on_compose:
  assumes "homeomorphism_on S f"
          "x \<in> S"
          "eventually (\<lambda>n. u n \<in> S) F"
  shows "(u \<longlongrightarrow> x) F \<longleftrightarrow> ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<longlongrightarrow> x) F = ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (u \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F
 2. ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F \<Longrightarrow> (u \<longlongrightarrow> x) F
[PROOF STEP]
assume "(u \<longlongrightarrow> x) F"
[PROOF STATE]
proof (state)
this:
(u \<longlongrightarrow> x) F

goal (2 subgoals):
 1. (u \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F
 2. ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F \<Longrightarrow> (u \<longlongrightarrow> x) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(u \<longlongrightarrow> x) F
[PROOF STEP]
show "((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F"
[PROOF STATE]
proof (prove)
using this:
(u \<longlongrightarrow> x) F

goal (1 subgoal):
 1. ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F
[PROOF STEP]
using continuous_on_tendsto_compose[OF homeomorphism_on_continuous[OF assms(1)] _ assms(2) assms(3)]
[PROOF STATE]
proof (prove)
using this:
(u \<longlongrightarrow> x) F
(u \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>x. f (u x)) \<longlongrightarrow> f x) F

goal (1 subgoal):
 1. ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F

goal (1 subgoal):
 1. ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F \<Longrightarrow> (u \<longlongrightarrow> x) F
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F \<Longrightarrow> (u \<longlongrightarrow> x) F
[PROOF STEP]
assume *: "((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F"
[PROOF STATE]
proof (state)
this:
((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F

goal (1 subgoal):
 1. ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F \<Longrightarrow> (u \<longlongrightarrow> x) F
[PROOF STEP]
have I: "inv_into S f (f y) = y" if "y \<in> S" for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv_into S f (f y) = y
[PROOF STEP]
using homeomorphism_on_bij[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
bij_betw f S (f ` S)

goal (1 subgoal):
 1. inv_into S f (f y) = y
[PROOF STEP]
by (meson bij_betw_inv_into_left that)
[PROOF STATE]
proof (state)
this:
?y \<in> S \<Longrightarrow> inv_into S f (f ?y) = ?y

goal (1 subgoal):
 1. ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F \<Longrightarrow> (u \<longlongrightarrow> x) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?y \<in> S \<Longrightarrow> inv_into S f (f ?y) = ?y
[PROOF STEP]
have A: "eventually (\<lambda>n. u n = inv_into S f (f (u n))) F"
[PROOF STATE]
proof (prove)
using this:
?y \<in> S \<Longrightarrow> inv_into S f (f ?y) = ?y

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. u n = inv_into S f (f (u n))
[PROOF STEP]
using assms eventually_mono
[PROOF STATE]
proof (prove)
using this:
?y \<in> S \<Longrightarrow> inv_into S f (f ?y) = ?y
homeomorphism_on S f
x \<in> S
\<forall>\<^sub>F n in F. u n \<in> S
\<lbrakk>eventually ?P ?F; \<And>x. ?P x \<Longrightarrow> ?Q x\<rbrakk> \<Longrightarrow> eventually ?Q ?F

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. u n = inv_into S f (f (u n))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in F. u n = inv_into S f (f (u n))

goal (1 subgoal):
 1. ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F \<Longrightarrow> (u \<longlongrightarrow> x) F
[PROOF STEP]
have "((\<lambda>n. (inv_into S f) (f (u n))) \<longlongrightarrow> (inv_into S f) (f x)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. inv_into S f (f (u n))) \<longlongrightarrow> inv_into S f (f x)) F
[PROOF STEP]
apply (rule continuous_on_tendsto_compose[OF homeomorphism_on_continuous[OF homeomorphism_on_inverse[OF assms(1)]] *])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f x \<in> f ` S
 2. \<forall>\<^sub>F n in F. f (u n) \<in> f ` S
[PROOF STEP]
using assms eventually_mono
[PROOF STATE]
proof (prove)
using this:
homeomorphism_on S f
x \<in> S
\<forall>\<^sub>F n in F. u n \<in> S
\<lbrakk>eventually ?P ?F; \<And>x. ?P x \<Longrightarrow> ?Q x\<rbrakk> \<Longrightarrow> eventually ?Q ?F

goal (2 subgoals):
 1. f x \<in> f ` S
 2. \<forall>\<^sub>F n in F. f (u n) \<in> f ` S
[PROOF STEP]
by (auto) fastforce
[PROOF STATE]
proof (state)
this:
((\<lambda>n. inv_into S f (f (u n))) \<longlongrightarrow> inv_into S f (f x)) F

goal (1 subgoal):
 1. ((\<lambda>n. f (u n)) \<longlongrightarrow> f x) F \<Longrightarrow> (u \<longlongrightarrow> x) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>n. inv_into S f (f (u n))) \<longlongrightarrow> inv_into S f (f x)) F
[PROOF STEP]
show "(u \<longlongrightarrow> x) F"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>n. inv_into S f (f (u n))) \<longlongrightarrow> inv_into S f (f x)) F

goal (1 subgoal):
 1. (u \<longlongrightarrow> x) F
[PROOF STEP]
unfolding tendsto_cong[OF A] I[OF \<open>x \<in> S\<close>]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>n. inv_into S f (f (u n))) \<longlongrightarrow> x) F

goal (1 subgoal):
 1. ((\<lambda>n. inv_into S f (f (u n))) \<longlongrightarrow> x) F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(u \<longlongrightarrow> x) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fls_regpart_prpart: "fls_regpart (fls_prpart_as_fls f) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_regpart (fls_prpart_as_fls f) = 0
[PROOF STEP]
using fls_prpart_as_fls_nth[of f]
[PROOF STATE]
proof (prove)
using this:
fls_prpart_as_fls f $$ ?n = (if ?n < 0 then f $$ ?n else (0::'a))

goal (1 subgoal):
 1. fls_regpart (fls_prpart_as_fls f) = 0
[PROOF STEP]
by (intro fps_ext) simp


[STATEMENT]
lemma card_of_lists_mono[simp]:
assumes "|A| \<le>o |B|"
shows "|lists A| \<le>o |lists B|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |lists A| \<le>o |lists B|
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |lists A| \<le>o |lists B|
[PROOF STEP]
obtain f where "inj_on f A \<and> f ` A \<le> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. inj_on f A \<and> f ` A \<subseteq> B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms card_of_ordLeq[of A B]
[PROOF STATE]
proof (prove)
using this:
|A| \<le>o |B|
(\<exists>f. inj_on f A \<and> f ` A \<subseteq> B) = (|A| \<le>o |B|)

goal (1 subgoal):
 1. (\<And>f. inj_on f A \<and> f ` A \<subseteq> B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj_on f A \<and> f ` A \<subseteq> B

goal (1 subgoal):
 1. |lists A| \<le>o |lists B|
[PROOF STEP]
hence "inj_on (map f) (lists A) \<and> (map f) ` (lists A) \<le> (lists B)"
[PROOF STATE]
proof (prove)
using this:
inj_on f A \<and> f ` A \<subseteq> B

goal (1 subgoal):
 1. inj_on (map f) (lists A) \<and> map f ` lists A \<subseteq> lists B
[PROOF STEP]
by (auto simp add: inj_on_map_lists map_lists_mono)
[PROOF STATE]
proof (state)
this:
inj_on (map f) (lists A) \<and> map f ` lists A \<subseteq> lists B

goal (1 subgoal):
 1. |lists A| \<le>o |lists B|
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on (map f) (lists A) \<and> map f ` lists A \<subseteq> lists B

goal (1 subgoal):
 1. |lists A| \<le>o |lists B|
[PROOF STEP]
using card_of_ordLeq[of "lists A"]
[PROOF STATE]
proof (prove)
using this:
inj_on (map f) (lists A) \<and> map f ` lists A \<subseteq> lists B
(\<exists>f. inj_on f (lists A) \<and> f ` lists A \<subseteq> ?B) = (|lists A| \<le>o |?B|)

goal (1 subgoal):
 1. |lists A| \<le>o |lists B|
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
|lists A| \<le>o |lists B|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma any_closest_point_dot:
  assumes "convex S" "closed S" "x \<in> S" "y \<in> S" "\<forall>z\<in>S. dist a x \<le> dist a z"
  shows "inner (a - x) (y - x) \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - x) \<bullet> (y - x) \<le> 0
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (a - x) \<bullet> (y - x) \<le> 0 \<Longrightarrow> False
[PROOF STEP]
assume "\<not> ?thesis"
[PROOF STATE]
proof (state)
this:
\<not> (a - x) \<bullet> (y - x) \<le> 0

goal (1 subgoal):
 1. \<not> (a - x) \<bullet> (y - x) \<le> 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (a - x) \<bullet> (y - x) \<le> 0
[PROOF STEP]
obtain u where u: "u>0" "u\<le>1" "dist (x + u *\<^sub>R (y - x)) a < dist x a"
[PROOF STATE]
proof (prove)
using this:
\<not> (a - x) \<bullet> (y - x) \<le> 0

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>0 < u; u \<le> 1; dist (x + u *\<^sub>R (y - x)) a < dist x a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using closer_point_lemma[of a x y]
[PROOF STATE]
proof (prove)
using this:
\<not> (a - x) \<bullet> (y - x) \<le> 0
0 < (a - x) \<bullet> (y - x) \<Longrightarrow> \<exists>u>0. u \<le> 1 \<and> dist (x + u *\<^sub>R (y - x)) a < dist x a

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>0 < u; u \<le> 1; dist (x + u *\<^sub>R (y - x)) a < dist x a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < u
u \<le> 1
dist (x + u *\<^sub>R (y - x)) a < dist x a

goal (1 subgoal):
 1. \<not> (a - x) \<bullet> (y - x) \<le> 0 \<Longrightarrow> False
[PROOF STEP]
let ?z = "(1 - u) *\<^sub>R x + u *\<^sub>R y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (a - x) \<bullet> (y - x) \<le> 0 \<Longrightarrow> False
[PROOF STEP]
have "?z \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - u) *\<^sub>R x + u *\<^sub>R y \<in> S
[PROOF STEP]
using convexD_alt[OF assms(1,3,4), of u]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> (1 - u) *\<^sub>R x + u *\<^sub>R y \<in> S

goal (1 subgoal):
 1. (1 - u) *\<^sub>R x + u *\<^sub>R y \<in> S
[PROOF STEP]
using u
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> (1 - u) *\<^sub>R x + u *\<^sub>R y \<in> S
0 < u
u \<le> 1
dist (x + u *\<^sub>R (y - x)) a < dist x a

goal (1 subgoal):
 1. (1 - u) *\<^sub>R x + u *\<^sub>R y \<in> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> S

goal (1 subgoal):
 1. \<not> (a - x) \<bullet> (y - x) \<le> 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> S
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> S

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(5)[THEN bspec[where x="?z"]] and u(3)
[PROOF STATE]
proof (prove)
using this:
(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> S
(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> S \<Longrightarrow> dist a x \<le> dist a ((1 - u) *\<^sub>R x + u *\<^sub>R y)
dist (x + u *\<^sub>R (y - x)) a < dist x a

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_matrix_n:
  assumes "ncols A \<le>  n" (is ?An) "nrows B \<le> n" (is ?Bn) "fadd 0 0 = 0" "fmul 0 0 = 0"
  shows c:"mult_matrix fmul fadd A B = mult_matrix_n n fmul fadd A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mult_matrix fmul fadd A B = mult_matrix_n n fmul fadd A B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mult_matrix fmul fadd A B = mult_matrix_n n fmul fadd A B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mult_matrix fmul fadd A B = mult_matrix_n n fmul fadd A B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ncols A \<le> n
nrows B \<le> n
fadd (0::'c) (0::'c) = (0::'c)
fmul (0::'a) (0::'b) = (0::'c)

goal (1 subgoal):
 1. mult_matrix fmul fadd A B = mult_matrix_n n fmul fadd A B
[PROOF STEP]
apply (simp add: mult_matrix_def mult_matrix_n_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ncols A \<le> n; nrows B \<le> n; fadd (0::'c) (0::'c) = (0::'c); fmul (0::'a) (0::'b) = (0::'c)\<rbrakk> \<Longrightarrow> Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B))) = Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n)
[PROOF STEP]
apply (rule comb[of "Abs_matrix" "Abs_matrix"], simp, (rule ext)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j i. \<lbrakk>ncols A \<le> n; nrows B \<le> n; fadd (0::'c) (0::'c) = (0::'c); fmul (0::'a) (0::'b) = (0::'c)\<rbrakk> \<Longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B)) = foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n
[PROOF STEP]
apply (rule foldseq_zerotail, simp_all add: nrows_le ncols_le assms)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
mult_matrix fmul fadd A B = mult_matrix_n n fmul fadd A B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) set_mult_carrier_idem:
  assumes "subgroup H G"
  shows "(carrier G) <#> H = carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier G <#> H = carrier G
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. carrier G <#> H \<subseteq> carrier G
 2. carrier G \<subseteq> carrier G <#> H
[PROOF STEP]
show "(carrier G)<#>H \<subseteq> carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier G <#> H \<subseteq> carrier G
[PROOF STEP]
unfolding set_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>h\<in>carrier G. \<Union>k\<in>H. {h \<otimes> k}) \<subseteq> carrier G
[PROOF STEP]
using subgroup.subset assms
[PROOF STATE]
proof (prove)
using this:
subgroup ?H ?G \<Longrightarrow> ?H \<subseteq> carrier ?G
subgroup H G

goal (1 subgoal):
 1. (\<Union>h\<in>carrier G. \<Union>k\<in>H. {h \<otimes> k}) \<subseteq> carrier G
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
carrier G <#> H \<subseteq> carrier G

goal (1 subgoal):
 1. carrier G \<subseteq> carrier G <#> H
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. carrier G \<subseteq> carrier G <#> H
[PROOF STEP]
have " (carrier G) #>  \<one> = carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier G #> \<one> = carrier G
[PROOF STEP]
unfolding set_mult_def r_coset_def group_axioms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>h\<in>carrier G. {h \<otimes> \<one>}) = carrier G
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
carrier G #> \<one> = carrier G

goal (1 subgoal):
 1. carrier G \<subseteq> carrier G <#> H
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
carrier G #> \<one> = carrier G

goal (1 subgoal):
 1. carrier G \<subseteq> carrier G <#> H
[PROOF STEP]
have "(carrier G) #>  \<one> \<subseteq> (carrier G) <#> H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier G #> \<one> \<subseteq> carrier G <#> H
[PROOF STEP]
unfolding set_mult_def r_coset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>h\<in>carrier G. {h \<otimes> \<one>}) \<subseteq> (\<Union>h\<in>carrier G. \<Union>k\<in>H. {h \<otimes> k})
[PROOF STEP]
using assms subgroup.one_closed[OF assms]
[PROOF STATE]
proof (prove)
using this:
subgroup H G
\<one> \<in> H

goal (1 subgoal):
 1. (\<Union>h\<in>carrier G. {h \<otimes> \<one>}) \<subseteq> (\<Union>h\<in>carrier G. \<Union>k\<in>H. {h \<otimes> k})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
carrier G #> \<one> \<subseteq> carrier G <#> H

goal (1 subgoal):
 1. carrier G \<subseteq> carrier G <#> H
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
carrier G #> \<one> = carrier G
carrier G #> \<one> \<subseteq> carrier G <#> H
[PROOF STEP]
show "carrier G \<subseteq> (carrier G) <#> H"
[PROOF STATE]
proof (prove)
using this:
carrier G #> \<one> = carrier G
carrier G #> \<one> \<subseteq> carrier G <#> H

goal (1 subgoal):
 1. carrier G \<subseteq> carrier G <#> H
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
carrier G \<subseteq> carrier G <#> H

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_keys: "m \<in> keys (mapping_of p) \<longleftrightarrow> coeff p m \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (m \<in> keys (mapping_of p)) = (coeff p m \<noteq> (0::'a))
[PROOF STEP]
by (simp add: coeff_def in_keys_iff)