[STATEMENT]
theorem "\<forall>(x::nat). \<exists>(y::nat). y = 5 + x | x div 6 + 1= 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. \<exists>y. y = 5 + x \<or> x div 6 + 1 = 2
[PROOF STEP]
by presburger


[STATEMENT]
lemma parts_UN_subset2: "parts(\<Union>x\<in>A. H x) \<subseteq> (\<Union>x\<in>A. parts(H x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. parts (\<Union> (H ` A)) \<subseteq> (\<Union>x\<in>A. parts (H x))
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> parts (\<Union> (H ` A)) \<Longrightarrow> x \<in> (\<Union>x\<in>A. parts (H x))
[PROOF STEP]
apply (erule parts.induct, blast+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mult_n_ncols:
assumes
"\<forall>a. fmul 0 a = 0"
"\<forall>a. fmul a 0 = 0"
"fadd 0 0 = 0"
shows "ncols (mult_matrix_n n fmul fadd A B) \<le> ncols B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ncols (mult_matrix_n n fmul fadd A B) \<le> ncols B
[PROOF STEP]
apply (subst ncols_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>j i. ncols B \<le> i \<longrightarrow> Rep_matrix (mult_matrix_n n fmul fadd A B) j i = (0::'b)
[PROOF STEP]
apply (simp add: mult_matrix_n_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>j i. ncols B \<le> i \<longrightarrow> Rep_matrix (Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n)) j i = (0::'b)
[PROOF STEP]
apply (subst RepAbs_matrix)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<exists>m. \<forall>j i. m \<le> j \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n = (0::'b)
 2. \<And>i j. \<exists>na. \<forall>j i. na \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n = (0::'b)
 3. \<forall>j i. ncols B \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n = (0::'b)
[PROOF STEP]
apply (rule_tac x="nrows A" in exI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<forall>j i. nrows A \<le> j \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n = (0::'b)
 2. \<And>i j. \<exists>na. \<forall>j i. na \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n = (0::'b)
 3. \<forall>j i. ncols B \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n = (0::'b)
[PROOF STEP]
apply (simp add: nrows assms foldseq_zero)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i j. \<exists>na. \<forall>j i. na \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n = (0::'b)
 2. \<forall>j i. ncols B \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n = (0::'b)
[PROOF STEP]
apply (rule_tac x="ncols B" in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i j. \<forall>j i. ncols B \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n = (0::'b)
 2. \<forall>j i. ncols B \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n = (0::'b)
[PROOF STEP]
apply (simp add: ncols assms foldseq_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>j i. ncols B \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) n = (0::'b)
[PROOF STEP]
apply (simp add: ncols assms foldseq_zero)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma top_sort:
  fixes rp
  assumes "acyclicP r"
  shows "finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
proof (induction "card s" arbitrary:s)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s. 0 = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
 2. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = card s

goal (2 subgoals):
 1. \<And>s. 0 = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
 2. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 = card s
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 = card s

goal (1 subgoal):
 1. finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
n = card ?s \<Longrightarrow> finite ?s \<longrightarrow> (\<exists>l. set l = ?s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
Suc n = card s

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
hence "s \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
n = card ?s \<Longrightarrow> finite ?s \<longrightarrow> (\<exists>l. set l = ?s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
Suc n = card s

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

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
s \<noteq> {}

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
have "acyclicP (r\<^sup>+\<^sup>+)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. acyclicP r\<^sup>+\<^sup>+
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
acyclicP r

goal (1 subgoal):
 1. acyclicP r\<^sup>+\<^sup>+
[PROOF STEP]
by (simp add:acyclic_def trancl_def trancl_idemp)
[PROOF STATE]
proof (state)
this:
acyclicP r\<^sup>+\<^sup>+

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
hence "acyclic ({(x,y). r\<^sup>+\<^sup>+ x y} \<inter> s \<times> s)"
[PROOF STATE]
proof (prove)
using this:
acyclicP r\<^sup>+\<^sup>+

goal (1 subgoal):
 1. acyclic (Restr {(x, y). r\<^sup>+\<^sup>+ x y} s)
[PROOF STEP]
by (meson acyclic_subset inf_le1)
[PROOF STATE]
proof (state)
this:
acyclic (Restr {(x, y). r\<^sup>+\<^sup>+ x y} s)

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
hence "wf ({(x,y). r\<^sup>+\<^sup>+ x y} \<inter> s \<times> s)"
[PROOF STATE]
proof (prove)
using this:
acyclic (Restr {(x, y). r\<^sup>+\<^sup>+ x y} s)

goal (1 subgoal):
 1. wf (Restr {(x, y). r\<^sup>+\<^sup>+ x y} s)
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
acyclic (Restr {(x, y). r\<^sup>+\<^sup>+ x y} s)
n = card ?s \<Longrightarrow> finite ?s \<longrightarrow> (\<exists>l. set l = ?s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
Suc n = card s

goal (1 subgoal):
 1. wf (Restr {(x, y). r\<^sup>+\<^sup>+ x y} s)
[PROOF STEP]
by (metis card.infinite finite_Int finite_SigmaI nat.distinct(1)
        wf_iff_acyclic_if_finite)
[PROOF STATE]
proof (state)
this:
wf (Restr {(x, y). r\<^sup>+\<^sup>+ x y} s)

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
s \<noteq> {}
wf (Restr {(x, y). r\<^sup>+\<^sup>+ x y} s)
[PROOF STEP]
obtain z where
    "z \<in> s \<and> (\<forall>y. (y, z) \<in>  ({(x,y). r\<^sup>+\<^sup>+ x y} \<inter> s \<times> s) \<longrightarrow> y \<notin> s)"
[PROOF STATE]
proof (prove)
using this:
s \<noteq> {}
wf (Restr {(x, y). r\<^sup>+\<^sup>+ x y} s)

goal (1 subgoal):
 1. (\<And>z. z \<in> s \<and> (\<forall>y. (y, z) \<in> Restr {(x, y). r\<^sup>+\<^sup>+ x y} s \<longrightarrow> y \<notin> s) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis ex_in_conv wf_eq_minimal)
[PROOF STATE]
proof (state)
this:
z \<in> s \<and> (\<forall>y. (y, z) \<in> Restr {(x, y). r\<^sup>+\<^sup>+ x y} s \<longrightarrow> y \<notin> s)

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
hence z_def: "z \<in> s \<and> (\<forall>y. r\<^sup>+\<^sup>+ y z \<longrightarrow> y \<notin> s)"
[PROOF STATE]
proof (prove)
using this:
z \<in> s \<and> (\<forall>y. (y, z) \<in> Restr {(x, y). r\<^sup>+\<^sup>+ x y} s \<longrightarrow> y \<notin> s)

goal (1 subgoal):
 1. z \<in> s \<and> (\<forall>y. r\<^sup>+\<^sup>+ y z \<longrightarrow> y \<notin> s)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
z \<in> s \<and> (\<forall>y. r\<^sup>+\<^sup>+ y z \<longrightarrow> y \<notin> s)

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
hence "card (s - {z}) = n"
[PROOF STATE]
proof (prove)
using this:
z \<in> s \<and> (\<forall>y. r\<^sup>+\<^sup>+ y z \<longrightarrow> y \<notin> s)

goal (1 subgoal):
 1. card (s - {z}) = n
[PROOF STEP]
by (metis One_nat_def Suc.hyps(2) card_Diff_singleton_if card.infinite
        diff_Suc_Suc diff_zero nat.simps(3))
[PROOF STATE]
proof (state)
this:
card (s - {z}) = n

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (s - {z}) = n
[PROOF STEP]
obtain l where l_def:
    "set l = s - {z} \<and> sorted_wrt (to_ord r) l \<and> distinct l"
[PROOF STATE]
proof (prove)
using this:
card (s - {z}) = n

goal (1 subgoal):
 1. (\<And>l. set l = s - {z} \<and> sorted_wrt (to_ord r) l \<and> distinct l \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis Zero_not_Suc card.infinite finite_Diff Suc)
[PROOF STATE]
proof (state)
this:
set l = s - {z} \<and> sorted_wrt (to_ord r) l \<and> distinct l

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
hence "set (z#l) = s"
[PROOF STATE]
proof (prove)
using this:
set l = s - {z} \<and> sorted_wrt (to_ord r) l \<and> distinct l

goal (1 subgoal):
 1. set (z # l) = s
[PROOF STEP]
using z_def
[PROOF STATE]
proof (prove)
using this:
set l = s - {z} \<and> sorted_wrt (to_ord r) l \<and> distinct l
z \<in> s \<and> (\<forall>y. r\<^sup>+\<^sup>+ y z \<longrightarrow> y \<notin> s)

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

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (z # l) = s

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
have "\<forall>y \<in> set l. \<not>(r\<^sup>*\<^sup>* y z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y\<in>set l. \<not> r\<^sup>*\<^sup>* y z
[PROOF STEP]
using z_def l_def rtranclpD
[PROOF STATE]
proof (prove)
using this:
z \<in> s \<and> (\<forall>y. r\<^sup>+\<^sup>+ y z \<longrightarrow> y \<notin> s)
set l = s - {z} \<and> sorted_wrt (to_ord r) l \<and> distinct l
?R\<^sup>*\<^sup>* ?a ?b \<Longrightarrow> ?a = ?b \<or> ?a \<noteq> ?b \<and> ?R\<^sup>+\<^sup>+ ?a ?b

goal (1 subgoal):
 1. \<forall>y\<in>set l. \<not> r\<^sup>*\<^sup>* y z
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<forall>y\<in>set l. \<not> r\<^sup>*\<^sup>* y z

goal (1 subgoal):
 1. \<And>x s. \<lbrakk>\<And>s. x = card s \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l); Suc x = card s\<rbrakk> \<Longrightarrow> finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set (z # l) = s
\<forall>y\<in>set l. \<not> r\<^sup>*\<^sup>* y z
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
set (z # l) = s
\<forall>y\<in>set l. \<not> r\<^sup>*\<^sup>* y z

goal (1 subgoal):
 1. finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)
[PROOF STEP]
by (metis distinct.simps(2) insert_absorb l_def list.simps(15)
        sorted_wrt.simps(2) to_ord.elims(3))
[PROOF STATE]
proof (state)
this:
finite s \<longrightarrow> (\<exists>l. set l = s \<and> sorted_wrt (to_ord r) l \<and> distinct l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma simplex_furthest_lt:
  fixes S :: "'a::real_inner set"
  assumes "finite S"
  shows "\<forall>x \<in> convex hull S.  x \<notin> S \<longrightarrow> (\<exists>y \<in> convex hull S. norm (x - a) < norm(y - a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>convex hull S. x \<notin> S \<longrightarrow> (\<exists>y\<in>convex hull S. norm (x - a) < norm (y - a))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. \<forall>x\<in>convex hull S. x \<notin> S \<longrightarrow> (\<exists>y\<in>convex hull S. norm (x - a) < norm (y - a))
[PROOF STEP]
proof induct
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>x\<in>convex hull {}. x \<notin> {} \<longrightarrow> (\<exists>y\<in>convex hull {}. norm (x - a) < norm (y - a))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>x\<in>convex hull F. x \<notin> F \<longrightarrow> (\<exists>y\<in>convex hull F. norm (x - a) < norm (y - a))\<rbrakk> \<Longrightarrow> \<forall>xa\<in>convex hull insert x F. xa \<notin> insert x F \<longrightarrow> (\<exists>y\<in>convex hull insert x F. norm (xa - a) < norm (y - a))
[PROOF STEP]
fix x S
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>x\<in>convex hull {}. x \<notin> {} \<longrightarrow> (\<exists>y\<in>convex hull {}. norm (x - a) < norm (y - a))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>x\<in>convex hull F. x \<notin> F \<longrightarrow> (\<exists>y\<in>convex hull F. norm (x - a) < norm (y - a))\<rbrakk> \<Longrightarrow> \<forall>xa\<in>convex hull insert x F. xa \<notin> insert x F \<longrightarrow> (\<exists>y\<in>convex hull insert x F. norm (xa - a) < norm (y - a))
[PROOF STEP]
assume as: "finite S" "x\<notin>S" "\<forall>x\<in>convex hull S. x \<notin> S \<longrightarrow> (\<exists>y\<in>convex hull S. norm (x - a) < norm (y - a))"
[PROOF STATE]
proof (state)
this:
finite S
x \<notin> S
\<forall>x\<in>convex hull S. x \<notin> S \<longrightarrow> (\<exists>y\<in>convex hull S. norm (x - a) < norm (y - a))

goal (2 subgoals):
 1. \<forall>x\<in>convex hull {}. x \<notin> {} \<longrightarrow> (\<exists>y\<in>convex hull {}. norm (x - a) < norm (y - a))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>x\<in>convex hull F. x \<notin> F \<longrightarrow> (\<exists>y\<in>convex hull F. norm (x - a) < norm (y - a))\<rbrakk> \<Longrightarrow> \<forall>xa\<in>convex hull insert x F. xa \<notin> insert x F \<longrightarrow> (\<exists>y\<in>convex hull insert x F. norm (xa - a) < norm (y - a))
[PROOF STEP]
show "\<forall>xa\<in>convex hull insert x S. xa \<notin> insert x S \<longrightarrow>
    (\<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xa\<in>convex hull insert x S. xa \<notin> insert x S \<longrightarrow> (\<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a))
[PROOF STEP]
proof (intro impI ballI, cases "S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<in> convex hull insert x S; xa \<notin> insert x S; S = {}\<rbrakk> \<Longrightarrow> \<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a)
 2. \<And>xa. \<lbrakk>xa \<in> convex hull insert x S; xa \<notin> insert x S; S \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<in> convex hull insert x S; xa \<notin> insert x S; S = {}\<rbrakk> \<Longrightarrow> \<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a)
 2. \<And>xa. \<lbrakk>xa \<in> convex hull insert x S; xa \<notin> insert x S; S \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a)
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<in> convex hull insert x S; xa \<notin> insert x S; S = {}\<rbrakk> \<Longrightarrow> \<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a)
 2. \<And>xa. \<lbrakk>xa \<in> convex hull insert x S; xa \<notin> insert x S; S \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a)
[PROOF STEP]
assume y: "y \<in> convex hull insert x S" "y \<notin> insert x S"
[PROOF STATE]
proof (state)
this:
y \<in> convex hull insert x S
y \<notin> insert x S

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<in> convex hull insert x S; xa \<notin> insert x S; S = {}\<rbrakk> \<Longrightarrow> \<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a)
 2. \<And>xa. \<lbrakk>xa \<in> convex hull insert x S; xa \<notin> insert x S; S \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a)
[PROOF STEP]
obtain u v b where obt: "u\<ge>0" "v\<ge>0" "u + v = 1" "b \<in> convex hull S" "y = u *\<^sub>R x + v *\<^sub>R b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u v b. \<lbrakk>0 \<le> u; 0 \<le> v; u + v = 1; b \<in> convex hull S; y = u *\<^sub>R x + v *\<^sub>R b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using y(1)[unfolded convex_hull_insert[OF False]]
[PROOF STATE]
proof (prove)
using this:
y \<in> {xa. \<exists>u\<ge>0. \<exists>v\<ge>0. \<exists>b. u + v = 1 \<and> b \<in> convex hull S \<and> xa = u *\<^sub>R x + v *\<^sub>R b}

goal (1 subgoal):
 1. (\<And>u v b. \<lbrakk>0 \<le> u; 0 \<le> v; u + v = 1; b \<in> convex hull S; y = u *\<^sub>R x + v *\<^sub>R b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> u
0 \<le> v
u + v = 1
b \<in> convex hull S
y = u *\<^sub>R x + v *\<^sub>R b

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<in> convex hull insert x S; xa \<notin> insert x S; S = {}\<rbrakk> \<Longrightarrow> \<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a)
 2. \<And>xa. \<lbrakk>xa \<in> convex hull insert x S; xa \<notin> insert x S; S \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a)
[PROOF STEP]
show "\<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
proof (cases "y \<in> convex hull S")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y \<in> convex hull S \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
 2. y \<notin> convex hull S \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y \<in> convex hull S

goal (2 subgoals):
 1. y \<in> convex hull S \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
 2. y \<notin> convex hull S \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> convex hull S
[PROOF STEP]
obtain z where "z \<in> convex hull S" "norm (y - a) < norm (z - a)"
[PROOF STATE]
proof (prove)
using this:
y \<in> convex hull S

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> convex hull S; norm (y - a) < norm (z - a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using as(3)[THEN bspec[where x=y]] and y(2)
[PROOF STATE]
proof (prove)
using this:
y \<in> convex hull S
y \<in> convex hull S \<Longrightarrow> y \<notin> S \<longrightarrow> (\<exists>ya\<in>convex hull S. norm (y - a) < norm (ya - a))
y \<notin> insert x S

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> convex hull S; norm (y - a) < norm (z - a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<in> convex hull S
norm (y - a) < norm (z - a)

goal (2 subgoals):
 1. y \<in> convex hull S \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
 2. y \<notin> convex hull S \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> convex hull S
norm (y - a) < norm (z - a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<in> convex hull S
norm (y - a) < norm (z - a)

goal (1 subgoal):
 1. \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
by (meson hull_mono subsetD subset_insertI)
[PROOF STATE]
proof (state)
this:
\<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)

goal (1 subgoal):
 1. y \<notin> convex hull S \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<notin> convex hull S \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
y \<notin> convex hull S

goal (1 subgoal):
 1. y \<notin> convex hull S \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
proof (cases "u = 0 \<or> v = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u = 0 \<or> v = 0 \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
 2. \<not> (u = 0 \<or> v = 0) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
u = 0 \<or> v = 0

goal (2 subgoals):
 1. u = 0 \<or> v = 0 \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
 2. \<not> (u = 0 \<or> v = 0) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
y \<notin> convex hull S
u = 0 \<or> v = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y \<notin> convex hull S
u = 0 \<or> v = 0

goal (1 subgoal):
 1. \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
using obt y
[PROOF STATE]
proof (prove)
using this:
y \<notin> convex hull S
u = 0 \<or> v = 0
0 \<le> u
0 \<le> v
u + v = 1
b \<in> convex hull S
y = u *\<^sub>R x + v *\<^sub>R b
y \<in> convex hull insert x S
y \<notin> insert x S

goal (1 subgoal):
 1. \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)

goal (1 subgoal):
 1. \<not> (u = 0 \<or> v = 0) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (u = 0 \<or> v = 0) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (u = 0 \<or> v = 0)

goal (1 subgoal):
 1. \<not> (u = 0 \<or> v = 0) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (u = 0 \<or> v = 0)
[PROOF STEP]
obtain w where w: "w>0" "w<u" "w<v"
[PROOF STATE]
proof (prove)
using this:
\<not> (u = 0 \<or> v = 0)

goal (1 subgoal):
 1. (\<And>w. \<lbrakk>0 < w; w < u; w < v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using field_lbound_gt_zero[of u v] and obt(1,2)
[PROOF STATE]
proof (prove)
using this:
\<not> (u = 0 \<or> v = 0)
\<lbrakk>0 < u; 0 < v\<rbrakk> \<Longrightarrow> \<exists>e>0. e < u \<and> e < v
0 \<le> u
0 \<le> v

goal (1 subgoal):
 1. (\<And>w. \<lbrakk>0 < w; w < u; w < v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < w
w < u
w < v

goal (1 subgoal):
 1. \<not> (u = 0 \<or> v = 0) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
have "x \<noteq> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> b
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = b \<Longrightarrow> False
[PROOF STEP]
assume "x = b"
[PROOF STATE]
proof (state)
this:
x = b

goal (1 subgoal):
 1. x = b \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = b
[PROOF STEP]
have "y = b"
[PROOF STATE]
proof (prove)
using this:
x = b

goal (1 subgoal):
 1. y = b
[PROOF STEP]
unfolding obt(5)
[PROOF STATE]
proof (prove)
using this:
x = b

goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R b = b
[PROOF STEP]
using obt(3)
[PROOF STATE]
proof (prove)
using this:
x = b
u + v = 1

goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R b = b
[PROOF STEP]
by (auto simp: scaleR_left_distrib[symmetric])
[PROOF STATE]
proof (state)
this:
y = b

goal (1 subgoal):
 1. x = b \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y = b
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
y = b

goal (1 subgoal):
 1. False
[PROOF STEP]
using obt(4) and False
[PROOF STATE]
proof (prove)
using this:
y = b
b \<in> convex hull S
\<not> (u = 0 \<or> v = 0)

goal (1 subgoal):
 1. False
[PROOF STEP]
using \<open>x = b\<close> y(2)
[PROOF STATE]
proof (prove)
using this:
y = b
b \<in> convex hull S
\<not> (u = 0 \<or> v = 0)
x = b
y \<notin> insert x S

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<noteq> b

goal (1 subgoal):
 1. \<not> (u = 0 \<or> v = 0) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> b
[PROOF STEP]
have *: "w *\<^sub>R (x - b) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> b

goal (1 subgoal):
 1. w *\<^sub>R (x - b) \<noteq> (0::'a)
[PROOF STEP]
using w(1)
[PROOF STATE]
proof (prove)
using this:
x \<noteq> b
0 < w

goal (1 subgoal):
 1. w *\<^sub>R (x - b) \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w *\<^sub>R (x - b) \<noteq> (0::'a)

goal (1 subgoal):
 1. \<not> (u = 0 \<or> v = 0) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
using dist_increases_online[OF *, of a y]
[PROOF STATE]
proof (prove)
using this:
dist a y < dist a (y + w *\<^sub>R (x - b)) \<or> dist a y < dist a (y - w *\<^sub>R (x - b))

goal (1 subgoal):
 1. \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
proof (elim disjE)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dist a y < dist a (y + w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
 2. dist a y < dist a (y - w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
assume "dist a y < dist a (y + w *\<^sub>R (x - b))"
[PROOF STATE]
proof (state)
this:
dist a y < dist a (y + w *\<^sub>R (x - b))

goal (2 subgoals):
 1. dist a y < dist a (y + w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
 2. dist a y < dist a (y - w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dist a y < dist a (y + w *\<^sub>R (x - b))
[PROOF STEP]
have "norm (y - a) < norm ((u + w) *\<^sub>R x + (v - w) *\<^sub>R b - a)"
[PROOF STATE]
proof (prove)
using this:
dist a y < dist a (y + w *\<^sub>R (x - b))

goal (1 subgoal):
 1. norm (y - a) < norm ((u + w) *\<^sub>R x + (v - w) *\<^sub>R b - a)
[PROOF STEP]
unfolding dist_commute[of a]
[PROOF STATE]
proof (prove)
using this:
dist y a < dist (y + w *\<^sub>R (x - b)) a

goal (1 subgoal):
 1. norm (y - a) < norm ((u + w) *\<^sub>R x + (v - w) *\<^sub>R b - a)
[PROOF STEP]
unfolding dist_norm obt(5)
[PROOF STATE]
proof (prove)
using this:
norm (u *\<^sub>R x + v *\<^sub>R b - a) < norm (u *\<^sub>R x + v *\<^sub>R b + w *\<^sub>R (x - b) - a)

goal (1 subgoal):
 1. norm (u *\<^sub>R x + v *\<^sub>R b - a) < norm ((u + w) *\<^sub>R x + (v - w) *\<^sub>R b - a)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
norm (y - a) < norm ((u + w) *\<^sub>R x + (v - w) *\<^sub>R b - a)

goal (2 subgoals):
 1. dist a y < dist a (y + w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
 2. dist a y < dist a (y - w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
norm (y - a) < norm ((u + w) *\<^sub>R x + (v - w) *\<^sub>R b - a)

goal (2 subgoals):
 1. dist a y < dist a (y + w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
 2. dist a y < dist a (y - w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
have "(u + w) *\<^sub>R x + (v - w) *\<^sub>R b \<in> convex hull insert x S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u + w) *\<^sub>R x + (v - w) *\<^sub>R b \<in> convex hull insert x S
[PROOF STEP]
unfolding convex_hull_insert[OF \<open>S\<noteq>{}\<close>]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u + w) *\<^sub>R x + (v - w) *\<^sub>R b \<in> {xa. \<exists>u\<ge>0. \<exists>v\<ge>0. \<exists>b. u + v = 1 \<and> b \<in> convex hull S \<and> xa = u *\<^sub>R x + v *\<^sub>R b}
[PROOF STEP]
proof (intro CollectI conjI exI)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. 0 \<le> ?u1
 2. 0 \<le> ?v3
 3. ?u1 + ?v3 = 1
 4. ?b5 \<in> convex hull S
 5. (u + w) *\<^sub>R x + (v - w) *\<^sub>R b = ?u1 *\<^sub>R x + ?v3 *\<^sub>R ?b5
[PROOF STEP]
show "u + w \<ge> 0" "v - w \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> u + w &&& 0 \<le> v - w
[PROOF STEP]
using obt(1) w
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
0 < w
w < u
w < v

goal (1 subgoal):
 1. 0 \<le> u + w &&& 0 \<le> v - w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> u + w
0 \<le> v - w

goal (3 subgoals):
 1. u + w + (v - w) = 1
 2. ?b5 \<in> convex hull S
 3. (u + w) *\<^sub>R x + (v - w) *\<^sub>R b = (u + w) *\<^sub>R x + (v - w) *\<^sub>R ?b5
[PROOF STEP]
qed (use obt in auto)
[PROOF STATE]
proof (state)
this:
(u + w) *\<^sub>R x + (v - w) *\<^sub>R b \<in> convex hull insert x S

goal (2 subgoals):
 1. dist a y < dist a (y + w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
 2. dist a y < dist a (y - w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
norm (y - a) < norm ((u + w) *\<^sub>R x + (v - w) *\<^sub>R b - a)
(u + w) *\<^sub>R x + (v - w) *\<^sub>R b \<in> convex hull insert x S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (y - a) < norm ((u + w) *\<^sub>R x + (v - w) *\<^sub>R b - a)
(u + w) *\<^sub>R x + (v - w) *\<^sub>R b \<in> convex hull insert x S

goal (1 subgoal):
 1. \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)

goal (1 subgoal):
 1. dist a y < dist a (y - w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist a y < dist a (y - w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
assume "dist a y < dist a (y - w *\<^sub>R (x - b))"
[PROOF STATE]
proof (state)
this:
dist a y < dist a (y - w *\<^sub>R (x - b))

goal (1 subgoal):
 1. dist a y < dist a (y - w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dist a y < dist a (y - w *\<^sub>R (x - b))
[PROOF STEP]
have "norm (y - a) < norm ((u - w) *\<^sub>R x + (v + w) *\<^sub>R b - a)"
[PROOF STATE]
proof (prove)
using this:
dist a y < dist a (y - w *\<^sub>R (x - b))

goal (1 subgoal):
 1. norm (y - a) < norm ((u - w) *\<^sub>R x + (v + w) *\<^sub>R b - a)
[PROOF STEP]
unfolding dist_commute[of a]
[PROOF STATE]
proof (prove)
using this:
dist y a < dist (y - w *\<^sub>R (x - b)) a

goal (1 subgoal):
 1. norm (y - a) < norm ((u - w) *\<^sub>R x + (v + w) *\<^sub>R b - a)
[PROOF STEP]
unfolding dist_norm obt(5)
[PROOF STATE]
proof (prove)
using this:
norm (u *\<^sub>R x + v *\<^sub>R b - a) < norm (u *\<^sub>R x + v *\<^sub>R b - w *\<^sub>R (x - b) - a)

goal (1 subgoal):
 1. norm (u *\<^sub>R x + v *\<^sub>R b - a) < norm ((u - w) *\<^sub>R x + (v + w) *\<^sub>R b - a)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
norm (y - a) < norm ((u - w) *\<^sub>R x + (v + w) *\<^sub>R b - a)

goal (1 subgoal):
 1. dist a y < dist a (y - w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
norm (y - a) < norm ((u - w) *\<^sub>R x + (v + w) *\<^sub>R b - a)

goal (1 subgoal):
 1. dist a y < dist a (y - w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
have "(u - w) *\<^sub>R x + (v + w) *\<^sub>R b \<in> convex hull insert x S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u - w) *\<^sub>R x + (v + w) *\<^sub>R b \<in> convex hull insert x S
[PROOF STEP]
unfolding convex_hull_insert[OF \<open>S\<noteq>{}\<close>]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u - w) *\<^sub>R x + (v + w) *\<^sub>R b \<in> {xa. \<exists>u\<ge>0. \<exists>v\<ge>0. \<exists>b. u + v = 1 \<and> b \<in> convex hull S \<and> xa = u *\<^sub>R x + v *\<^sub>R b}
[PROOF STEP]
proof (intro CollectI conjI exI)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. 0 \<le> ?u1
 2. 0 \<le> ?v3
 3. ?u1 + ?v3 = 1
 4. ?b5 \<in> convex hull S
 5. (u - w) *\<^sub>R x + (v + w) *\<^sub>R b = ?u1 *\<^sub>R x + ?v3 *\<^sub>R ?b5
[PROOF STEP]
show "u - w \<ge> 0" "v + w \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> u - w &&& 0 \<le> v + w
[PROOF STEP]
using obt(1) w
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
0 < w
w < u
w < v

goal (1 subgoal):
 1. 0 \<le> u - w &&& 0 \<le> v + w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> u - w
0 \<le> v + w

goal (3 subgoals):
 1. u - w + (v + w) = 1
 2. ?b5 \<in> convex hull S
 3. (u - w) *\<^sub>R x + (v + w) *\<^sub>R b = (u - w) *\<^sub>R x + (v + w) *\<^sub>R ?b5
[PROOF STEP]
qed (use obt in auto)
[PROOF STATE]
proof (state)
this:
(u - w) *\<^sub>R x + (v + w) *\<^sub>R b \<in> convex hull insert x S

goal (1 subgoal):
 1. dist a y < dist a (y - w *\<^sub>R (x - b)) \<Longrightarrow> \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
norm (y - a) < norm ((u - w) *\<^sub>R x + (v + w) *\<^sub>R b - a)
(u - w) *\<^sub>R x + (v + w) *\<^sub>R b \<in> convex hull insert x S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (y - a) < norm ((u - w) *\<^sub>R x + (v + w) *\<^sub>R b - a)
(u - w) *\<^sub>R x + (v + w) *\<^sub>R b \<in> convex hull insert x S

goal (1 subgoal):
 1. \<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)

goal (1 subgoal):
 1. \<And>xa. \<lbrakk>xa \<in> convex hull insert x S; xa \<notin> insert x S; S = {}\<rbrakk> \<Longrightarrow> \<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
\<forall>xa\<in>convex hull insert x S. xa \<notin> insert x S \<longrightarrow> (\<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a))

goal (1 subgoal):
 1. \<forall>x\<in>convex hull {}. x \<notin> {} \<longrightarrow> (\<exists>y\<in>convex hull {}. norm (x - a) < norm (y - a))
[PROOF STEP]
qed (auto simp: assms)


[STATEMENT]
lemma derangementsE:
  assumes "d : derangements S"
  obtains "d permutes S" "\<forall>x\<in>S. d x \<noteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>d permutes S; \<forall>x\<in>S. d x \<noteq> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
d \<in> derangements S

goal (1 subgoal):
 1. (\<lbrakk>d permutes S; \<forall>x\<in>S. d x \<noteq> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding derangements_def
[PROOF STATE]
proof (prove)
using this:
d \<in> {p. p permutes S \<and> (\<forall>x\<in>S. p x \<noteq> x)}

goal (1 subgoal):
 1. (\<lbrakk>d permutes S; \<forall>x\<in>S. d x \<noteq> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma ttft_4: assumes dx: "dim_vec x = 4"
  and be: "x $ 0 = True \<and> x $ 1 = True \<and> x $ 2 = False \<and> x $ 3 = True"
  shows "ceros_of_boolean_input x = {2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ceros_of_boolean_input x = {2}
[PROOF STEP]
using dx be
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = True \<and> x $ 1 = True \<and> x $ 2 = False \<and> x $ 3 = True

goal (1 subgoal):
 1. ceros_of_boolean_input x = {2}
[PROOF STEP]
unfolding ceros_of_boolean_input_def
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = True \<and> x $ 1 = True \<and> x $ 2 = False \<and> x $ 3 = True

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {2}
[PROOF STEP]
using less_4_cases
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = True \<and> x $ 1 = True \<and> x $ 2 = False \<and> x $ 3 = True
?n < 4 \<Longrightarrow> ?n = 0 \<or> ?n = 1 \<or> ?n = 2 \<or> ?n = 3

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {2}
[PROOF STEP]
by auto


[STATEMENT]
lemma card_fset_mono:
  shows "xs |\<subseteq>| ys \<Longrightarrow> card_fset xs \<le> card_fset ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs |\<subseteq>| ys \<Longrightarrow> card_fset xs \<le> card_fset ys
[PROOF STEP]
unfolding card_fset psubset_fset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs |\<subseteq>| ys \<Longrightarrow> card (fset xs) \<le> card (fset ys)
[PROOF STEP]
by (simp add: card_mono subset_fset)


[STATEMENT]
lemma homeomorphic_map_frontier_of:
  assumes hom: "homeomorphic_map X Y f" and S: "S \<subseteq> topspace X"
  shows "Y frontier_of (f ` S) = f ` (X frontier_of S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y frontier_of f ` S = f ` (X frontier_of S)
[PROOF STEP]
unfolding frontier_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y closure_of f ` S - Y interior_of f ` S = f ` (X closure_of S - X interior_of S)
[PROOF STEP]
proof (intro equalityI subsetI DiffI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> Y closure_of f ` S - Y interior_of f ` S \<Longrightarrow> x \<in> f ` (X closure_of S - X interior_of S)
 2. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<in> Y closure_of f ` S
 3. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> Y closure_of f ` S - Y interior_of f ` S \<Longrightarrow> x \<in> f ` (X closure_of S - X interior_of S)
 2. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<in> Y closure_of f ` S
 3. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
assume "y \<in> Y closure_of f ` S - Y interior_of f ` S"
[PROOF STATE]
proof (state)
this:
y \<in> Y closure_of f ` S - Y interior_of f ` S

goal (3 subgoals):
 1. \<And>x. x \<in> Y closure_of f ` S - Y interior_of f ` S \<Longrightarrow> x \<in> f ` (X closure_of S - X interior_of S)
 2. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<in> Y closure_of f ` S
 3. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> Y closure_of f ` S - Y interior_of f ` S
[PROOF STEP]
show "y \<in> f ` (X closure_of S - X interior_of S)"
[PROOF STATE]
proof (prove)
using this:
y \<in> Y closure_of f ` S - Y interior_of f ` S

goal (1 subgoal):
 1. y \<in> f ` (X closure_of S - X interior_of S)
[PROOF STEP]
using S hom homeomorphic_map_closure_of homeomorphic_map_interior_of
[PROOF STATE]
proof (prove)
using this:
y \<in> Y closure_of f ` S - Y interior_of f ` S
S \<subseteq> topspace X
homeomorphic_map X Y f
\<lbrakk>homeomorphic_map ?X ?Y ?f; ?S \<subseteq> topspace ?X\<rbrakk> \<Longrightarrow> ?Y closure_of ?f ` ?S = ?f ` (?X closure_of ?S)
\<lbrakk>homeomorphic_map ?X ?Y ?f; ?S \<subseteq> topspace ?X\<rbrakk> \<Longrightarrow> ?Y interior_of ?f ` ?S = ?f ` (?X interior_of ?S)

goal (1 subgoal):
 1. y \<in> f ` (X closure_of S - X interior_of S)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
y \<in> f ` (X closure_of S - X interior_of S)

goal (2 subgoals):
 1. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<in> Y closure_of f ` S
 2. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<in> Y closure_of f ` S
 2. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<in> Y closure_of f ` S
 2. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
assume "y \<in> f ` (X closure_of S - X interior_of S)"
[PROOF STATE]
proof (state)
this:
y \<in> f ` (X closure_of S - X interior_of S)

goal (2 subgoals):
 1. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<in> Y closure_of f ` S
 2. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> f ` (X closure_of S - X interior_of S)
[PROOF STEP]
show "y \<in> Y closure_of f ` S"
[PROOF STATE]
proof (prove)
using this:
y \<in> f ` (X closure_of S - X interior_of S)

goal (1 subgoal):
 1. y \<in> Y closure_of f ` S
[PROOF STEP]
using S hom homeomorphic_map_closure_of
[PROOF STATE]
proof (prove)
using this:
y \<in> f ` (X closure_of S - X interior_of S)
S \<subseteq> topspace X
homeomorphic_map X Y f
\<lbrakk>homeomorphic_map ?X ?Y ?f; ?S \<subseteq> topspace ?X\<rbrakk> \<Longrightarrow> ?Y closure_of ?f ` ?S = ?f ` (?X closure_of ?S)

goal (1 subgoal):
 1. y \<in> Y closure_of f ` S
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
y \<in> Y closure_of f ` S

goal (1 subgoal):
 1. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
assume "x \<in> f ` (X closure_of S - X interior_of S)"
[PROOF STATE]
proof (state)
this:
x \<in> f ` (X closure_of S - X interior_of S)

goal (1 subgoal):
 1. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> f ` (X closure_of S - X interior_of S)
[PROOF STEP]
obtain y where y: "x = f y" "y \<in> X closure_of S" "y \<notin> X interior_of S"
[PROOF STATE]
proof (prove)
using this:
x \<in> f ` (X closure_of S - X interior_of S)

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>x = f y; y \<in> X closure_of S; y \<notin> X interior_of S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x = f y
y \<in> X closure_of S
y \<notin> X interior_of S

goal (1 subgoal):
 1. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = f y
y \<in> X closure_of S
y \<notin> X interior_of S
[PROOF STEP]
have "y \<in> topspace X"
[PROOF STATE]
proof (prove)
using this:
x = f y
y \<in> X closure_of S
y \<notin> X interior_of S

goal (1 subgoal):
 1. y \<in> topspace X
[PROOF STEP]
by (simp add: in_closure_of)
[PROOF STATE]
proof (state)
this:
y \<in> topspace X

goal (1 subgoal):
 1. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> topspace X
[PROOF STEP]
have "f y \<notin> f ` (X interior_of S)"
[PROOF STATE]
proof (prove)
using this:
y \<in> topspace X

goal (1 subgoal):
 1. f y \<notin> f ` (X interior_of S)
[PROOF STEP]
by (meson hom homeomorphic_map_def inj_on_image_mem_iff interior_of_subset_topspace y(3))
[PROOF STATE]
proof (state)
this:
f y \<notin> f ` (X interior_of S)

goal (1 subgoal):
 1. \<And>x. x \<in> f ` (X closure_of S - X interior_of S) \<Longrightarrow> x \<notin> Y interior_of f ` S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f y \<notin> f ` (X interior_of S)
[PROOF STEP]
show "x \<notin> Y interior_of f ` S"
[PROOF STATE]
proof (prove)
using this:
f y \<notin> f ` (X interior_of S)

goal (1 subgoal):
 1. x \<notin> Y interior_of f ` S
[PROOF STEP]
using S hom homeomorphic_map_interior_of y(1)
[PROOF STATE]
proof (prove)
using this:
f y \<notin> f ` (X interior_of S)
S \<subseteq> topspace X
homeomorphic_map X Y f
\<lbrakk>homeomorphic_map ?X ?Y ?f; ?S \<subseteq> topspace ?X\<rbrakk> \<Longrightarrow> ?Y interior_of ?f ` ?S = ?f ` (?X interior_of ?S)
x = f y

goal (1 subgoal):
 1. x \<notin> Y interior_of f ` S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<notin> Y interior_of f ` S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma notin_rtrancl:
  "(a, b) \<in> r\<^sup>* \<Longrightarrow> a \<noteq> b \<Longrightarrow> (\<And>y. (a, y) \<notin> r) \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(a, b) \<in> r\<^sup>*; a \<noteq> b; \<And>y. (a, y) \<notin> r\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (auto elim: converse_rtranclE)


[STATEMENT]
lemma cone_carrier: "A \<subseteq> carrier_vec n \<Longrightarrow> cone A \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> carrier_vec n \<Longrightarrow> cone A \<subseteq> carrier_vec n
[PROOF STEP]
using finite_cone_carrier
[PROOF STATE]
proof (prove)
using this:
?A \<subseteq> carrier_vec n \<Longrightarrow> finite_cone ?A \<subseteq> carrier_vec n

goal (1 subgoal):
 1. A \<subseteq> carrier_vec n \<Longrightarrow> cone A \<subseteq> carrier_vec n
[PROOF STEP]
unfolding cone_def
[PROOF STATE]
proof (prove)
using this:
?A \<subseteq> carrier_vec n \<Longrightarrow> finite_cone ?A \<subseteq> carrier_vec n

goal (1 subgoal):
 1. A \<subseteq> carrier_vec n \<Longrightarrow> {x. \<exists>Ws. finite Ws \<and> Ws \<subseteq> A \<and> x \<in> finite_cone Ws} \<subseteq> carrier_vec n
[PROOF STEP]
by blast


[STATEMENT]
lemma T_A_A'_leq: "n \<le> length paid_A' \<Longrightarrow> T_A n \<le> T_A' n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> length paid_A' \<Longrightarrow> T_A n \<le> T_A' n
[PROOF STEP]
unfolding T_A'_def T_A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> length paid_A' \<Longrightarrow> sum t_A {..<n} \<le> sum t_A' {..<n}
[PROOF STEP]
apply(rule sum_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>n \<le> length paid_A'; i \<in> {..<n}\<rbrakk> \<Longrightarrow> t_A i \<le> t_A' i
[PROOF STEP]
by (simp add: t_A_A'_leq)


[STATEMENT]
lemma poly_roots_power: "p \<noteq> 0 \<Longrightarrow> poly_roots (p ^ n) = repeat_mset n (poly_roots p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> poly_roots (p ^ n) = repeat_mset n (poly_roots p)
[PROOF STEP]
by (induction n) (auto simp: poly_roots_mult)


[STATEMENT]
lemma length_diff_Suc_exists:
  assumes "length xs - length ys = Suc m"
    and "set ys \<subseteq> set xs"
    and "distinct ys" and "distinct xs"
  shows "\<exists>e. e \<in> set xs \<and> e \<notin> set ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>e. e \<in> set xs \<and> e \<notin> set ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs - length ys = Suc m
set ys \<subseteq> set xs
distinct ys
distinct xs

goal (1 subgoal):
 1. \<exists>e. e \<in> set xs \<and> e \<notin> set ys
[PROOF STEP]
proof(induction xs arbitrary: ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ys. \<lbrakk>length [] - length ys = Suc m; set ys \<subseteq> set []; distinct ys; distinct []\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set [] \<and> e \<notin> set ys
 2. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs)\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
length [] - length ys = Suc m
set ys \<subseteq> set []
distinct ys
distinct []

goal (2 subgoals):
 1. \<And>ys. \<lbrakk>length [] - length ys = Suc m; set ys \<subseteq> set []; distinct ys; distinct []\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set [] \<and> e \<notin> set ys
 2. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs)\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length [] - length ys = Suc m
set ys \<subseteq> set []
distinct ys
distinct []
[PROOF STEP]
show "\<exists>e. e \<in> set [] \<and> e \<notin> set ys"
[PROOF STATE]
proof (prove)
using this:
length [] - length ys = Suc m
set ys \<subseteq> set []
distinct ys
distinct []

goal (1 subgoal):
 1. \<exists>e. e \<in> set [] \<and> e \<notin> set ys
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>e. e \<in> set [] \<and> e \<notin> set ys

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs)\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs)\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>length xs - length ?ys = Suc m; set ?ys \<subseteq> set xs; distinct ?ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ?ys
length (a # xs) - length ys = Suc m
set ys \<subseteq> set (a # xs)
distinct ys
distinct (a # xs)

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs)\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>length xs - length ?ys = Suc m; set ?ys \<subseteq> set xs; distinct ?ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ?ys
length (a # xs) - length ys = Suc m
set ys \<subseteq> set (a # xs)
distinct ys
distinct (a # xs)
[PROOF STEP]
show "\<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length xs - length ?ys = Suc m; set ?ys \<subseteq> set xs; distinct ?ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ?ys
length (a # xs) - length ys = Suc m
set ys \<subseteq> set (a # xs)
distinct ys
distinct (a # xs)

goal (1 subgoal):
 1. \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
proof(cases "a \<in> set ys")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<in> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
 2. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<notin> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a \<in> set ys

goal (2 subgoals):
 1. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<in> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
 2. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<notin> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
have IH: "\<exists>e. e \<in> set xs \<and> e \<notin> set (remove1 a ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>e. e \<in> set xs \<and> e \<notin> set (remove1 a ys)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>e. e \<in> set xs \<and> e \<notin> set (remove1 a ys)
[PROOF STEP]
have "length xs - length (remove1 a ys) = Suc m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs - length (remove1 a ys) = Suc m
[PROOF STEP]
by (metis Cons.prems(1) One_nat_def Suc_pred True diff_Suc_Suc length_Cons
            length_pos_if_in_set length_remove1)
[PROOF STATE]
proof (state)
this:
length xs - length (remove1 a ys) = Suc m

goal (1 subgoal):
 1. \<exists>e. e \<in> set xs \<and> e \<notin> set (remove1 a ys)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length xs - length (remove1 a ys) = Suc m

goal (1 subgoal):
 1. \<exists>e. e \<in> set xs \<and> e \<notin> set (remove1 a ys)
[PROOF STEP]
have "set (remove1 a ys) \<subseteq> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (remove1 a ys) \<subseteq> set xs
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
length (a # xs) - length ys = Suc m
set ys \<subseteq> set (a # xs)
distinct ys
distinct (a # xs)

goal (1 subgoal):
 1. set (remove1 a ys) \<subseteq> set xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (remove1 a ys) \<subseteq> set xs

goal (1 subgoal):
 1. \<exists>e. e \<in> set xs \<and> e \<notin> set (remove1 a ys)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length xs - length (remove1 a ys) = Suc m
set (remove1 a ys) \<subseteq> set xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length xs - length (remove1 a ys) = Suc m
set (remove1 a ys) \<subseteq> set xs

goal (1 subgoal):
 1. \<exists>e. e \<in> set xs \<and> e \<notin> set (remove1 a ys)
[PROOF STEP]
by (meson Cons.IH Cons.prems distinct.simps(2) distinct_remove1)
[PROOF STATE]
proof (state)
this:
\<exists>e. e \<in> set xs \<and> e \<notin> set (remove1 a ys)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>e. e \<in> set xs \<and> e \<notin> set (remove1 a ys)

goal (2 subgoals):
 1. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<in> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
 2. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<notin> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>e. e \<in> set xs \<and> e \<notin> set (remove1 a ys)

goal (2 subgoals):
 1. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<in> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
 2. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<notin> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
have "set ys - {a} \<subseteq> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set ys - {a} \<subseteq> set xs
[PROOF STEP]
using Cons.prems(2)
[PROOF STATE]
proof (prove)
using this:
set ys \<subseteq> set (a # xs)

goal (1 subgoal):
 1. set ys - {a} \<subseteq> set xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set ys - {a} \<subseteq> set xs

goal (2 subgoals):
 1. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<in> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
 2. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<notin> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<exists>e. e \<in> set xs \<and> e \<notin> set (remove1 a ys)
set ys - {a} \<subseteq> set xs
[PROOF STEP]
show "\<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys"
[PROOF STATE]
proof (prove)
using this:
\<exists>e. e \<in> set xs \<and> e \<notin> set (remove1 a ys)
set ys - {a} \<subseteq> set xs

goal (1 subgoal):
 1. \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
by (metis Cons.prems(4) distinct.simps(2) in_set_remove1 set_subset_Cons subsetCE)
[PROOF STATE]
proof (state)
this:
\<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys

goal (1 subgoal):
 1. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<notin> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<notin> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<notin> set ys

goal (1 subgoal):
 1. \<lbrakk>\<And>ys. \<lbrakk>length xs - length ys = Suc m; set ys \<subseteq> set xs; distinct ys; distinct xs\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set xs \<and> e \<notin> set ys; length (a # xs) - length ys = Suc m; set ys \<subseteq> set (a # xs); distinct ys; distinct (a # xs); a \<notin> set ys\<rbrakk> \<Longrightarrow> \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<notin> set ys
[PROOF STEP]
show "\<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys"
[PROOF STATE]
proof (prove)
using this:
a \<notin> set ys

goal (1 subgoal):
 1. \<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>e. e \<in> set (a # xs) \<and> e \<notin> set ys

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Ball_eqvt [eqvt]:
  shows "p \<bullet> (\<forall>x \<in> S. P x) = (\<forall>x \<in> (p \<bullet> S). (p \<bullet> P) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<bullet> (\<forall>x\<in>S. P x) = (\<forall>x\<in>p \<bullet> S. (p \<bullet> P) x)
[PROOF STEP]
unfolding Ball_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<bullet> (\<forall>x. x \<in> S \<longrightarrow> P x) = (\<forall>x. x \<in> p \<bullet> S \<longrightarrow> (p \<bullet> P) x)
[PROOF STEP]
by simp


[STATEMENT]
lemma eexp_le_eexp_iff_le:
  "eexp x \<le> eexp y \<longleftrightarrow> x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (eexp x \<le> eexp y) = (x \<le> y)
[PROOF STEP]
using eexp_strict_mono2 not_le
[PROOF STATE]
proof (prove)
using this:
?x < ?y \<Longrightarrow> eexp ?x < eexp ?y
(\<not> ?x \<le> ?y) = (?y < ?x)

goal (1 subgoal):
 1. (eexp x \<le> eexp y) = (x \<le> y)
[PROOF STEP]
by (auto intro: mono_intros)


[STATEMENT]
lemma Nset_pre_sub:"(0::nat) < k \<Longrightarrow> {j. j \<le> (k - Suc 0)} \<subseteq> {j. j \<le> k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> {j. j \<le> k - Suc 0} \<subseteq> {j. j \<le> k}
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 < k; x \<in> {j. j \<le> k - Suc 0}\<rbrakk> \<Longrightarrow> x \<in> {j. j \<le> k}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eventually_at_right_less: "\<forall>\<^sub>F y in at_right (x::'a::{linorder_topology, no_top}). x < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually ((<) x) (at_right x)
[PROOF STEP]
using gt_ex[of x] eventually_at_right[of x]
[PROOF STATE]
proof (prove)
using this:
\<exists>y. x < y
x < ?y \<Longrightarrow> eventually ?P (at_right x) = (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> ?P y)

goal (1 subgoal):
 1. eventually ((<) x) (at_right x)
[PROOF STEP]
by auto


[STATEMENT]
lemma arg_mult:
  assumes "z1 * z2 \<noteq> 0"
  shows "Arg(z1 * z2) = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (z1 * z2) = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Arg (z1 * z2) = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>
[PROOF STEP]
obtain k::int where "Arg(z1 * z2) = Arg z1 + Arg z2 + 2*k*pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. Arg (z1 * z2) = Arg z1 + Arg z2 + real_of_int (2 * k) * pi \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using arg_mult_2kpi[of z1 z2]
[PROOF STATE]
proof (prove)
using this:
z1 * z2 \<noteq> 0 \<Longrightarrow> \<exists>x. Arg (z1 * z2) = Arg z1 + Arg z2 + 2 * real_of_int x * pi

goal (1 subgoal):
 1. (\<And>k. Arg (z1 * z2) = Arg z1 + Arg z2 + real_of_int (2 * k) * pi \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z1 * z2 \<noteq> 0 \<Longrightarrow> \<exists>x. Arg (z1 * z2) = Arg z1 + Arg z2 + 2 * real_of_int x * pi
z1 * z2 \<noteq> 0

goal (1 subgoal):
 1. (\<And>k. Arg (z1 * z2) = Arg z1 + Arg z2 + real_of_int (2 * k) * pi \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Arg (z1 * z2) = Arg z1 + Arg z2 + real_of_int (2 * k) * pi

goal (1 subgoal):
 1. Arg (z1 * z2) = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>
[PROOF STEP]
hence "\<downharpoonright>Arg(z1 * z2)\<downharpoonleft> = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>"
[PROOF STATE]
proof (prove)
using this:
Arg (z1 * z2) = Arg z1 + Arg z2 + real_of_int (2 * k) * pi

goal (1 subgoal):
 1. \<downharpoonright>Arg (z1 * z2)\<downharpoonleft> = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>
[PROOF STEP]
using canon_ang_eq
[PROOF STATE]
proof (prove)
using this:
Arg (z1 * z2) = Arg z1 + Arg z2 + real_of_int (2 * k) * pi
\<exists>x. ?\<alpha>\<^sub>1 - ?\<alpha>\<^sub>2 = 2 * real_of_int x * pi \<Longrightarrow> \<downharpoonright>?\<alpha>\<^sub>1\<downharpoonleft> = \<downharpoonright>?\<alpha>\<^sub>2\<downharpoonleft>

goal (1 subgoal):
 1. \<downharpoonright>Arg (z1 * z2)\<downharpoonleft> = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>
[PROOF STEP]
by(simp add:field_simps)
[PROOF STATE]
proof (state)
this:
\<downharpoonright>Arg (z1 * z2)\<downharpoonleft> = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>

goal (1 subgoal):
 1. Arg (z1 * z2) = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<downharpoonright>Arg (z1 * z2)\<downharpoonleft> = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>

goal (1 subgoal):
 1. Arg (z1 * z2) = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>
[PROOF STEP]
using canon_ang_arg[of "z1*z2"]
[PROOF STATE]
proof (prove)
using this:
\<downharpoonright>Arg (z1 * z2)\<downharpoonleft> = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>
\<downharpoonright>Arg (z1 * z2)\<downharpoonleft> = Arg (z1 * z2)

goal (1 subgoal):
 1. Arg (z1 * z2) = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Arg (z1 * z2) = \<downharpoonright>Arg z1 + Arg z2\<downharpoonleft>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gronwall_more_general_segment:
  fixes a b c::real
  assumes "\<And>t. t \<in> closed_segment a b \<Longrightarrow> g t \<le> C + K * integral (closed_segment c t) g"
    and cont: "continuous_on (closed_segment a b) g"
    and "\<And>t. t \<in> closed_segment a b \<Longrightarrow> 0 \<le> g t"
    and "0 < C"
    and "0 < K"
    and t: "t \<in> closed_segment a b"
    and c: "c \<in> closed_segment a b"
  shows "g t \<le> C * exp (K * abs (t - c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
from t c
[PROOF STATE]
proof (chain)
picking this:
t \<in> closed_segment a b
c \<in> closed_segment a b
[PROOF STEP]
have "t \<in> closed_segment c a \<or> t \<in> closed_segment c b"
[PROOF STATE]
proof (prove)
using this:
t \<in> closed_segment a b
c \<in> closed_segment a b

goal (1 subgoal):
 1. t \<in> closed_segment c a \<or> t \<in> closed_segment c b
[PROOF STEP]
by (auto simp: closed_segment_eq_real_ivl split_ifs)
[PROOF STATE]
proof (state)
this:
t \<in> closed_segment c a \<or> t \<in> closed_segment c b

goal (1 subgoal):
 1. g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<in> closed_segment c a \<or> t \<in> closed_segment c b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
t \<in> closed_segment c a \<or> t \<in> closed_segment c b

goal (1 subgoal):
 1. g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t \<in> closed_segment c a \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
 2. t \<in> closed_segment c b \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
assume "t \<in> closed_segment c a"
[PROOF STATE]
proof (state)
this:
t \<in> closed_segment c a

goal (2 subgoals):
 1. t \<in> closed_segment c a \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
 2. t \<in> closed_segment c b \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
t \<in> closed_segment c a

goal (2 subgoals):
 1. t \<in> closed_segment c a \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
 2. t \<in> closed_segment c b \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
have subs: "closed_segment c a \<subseteq> closed_segment a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment c a \<subseteq> closed_segment a b
[PROOF STEP]
using t c
[PROOF STATE]
proof (prove)
using this:
t \<in> closed_segment a b
c \<in> closed_segment a b

goal (1 subgoal):
 1. closed_segment c a \<subseteq> closed_segment a b
[PROOF STEP]
by (auto simp: closed_segment_eq_real_ivl split_ifs)
[PROOF STATE]
proof (state)
this:
closed_segment c a \<subseteq> closed_segment a b

goal (2 subgoals):
 1. t \<in> closed_segment c a \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
 2. t \<in> closed_segment c b \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
t \<in> closed_segment c a
closed_segment c a \<subseteq> closed_segment a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
t \<in> closed_segment c a
closed_segment c a \<subseteq> closed_segment a b

goal (1 subgoal):
 1. g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
by (intro gronwall_general_segment[where b=a])
        (auto intro!: assms intro: continuous_on_subset)
[PROOF STATE]
proof (state)
this:
g t \<le> C * exp (K * \<bar>t - c\<bar>)

goal (1 subgoal):
 1. t \<in> closed_segment c b \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. t \<in> closed_segment c b \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
assume "t \<in> closed_segment c b"
[PROOF STATE]
proof (state)
this:
t \<in> closed_segment c b

goal (1 subgoal):
 1. t \<in> closed_segment c b \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
t \<in> closed_segment c b

goal (1 subgoal):
 1. t \<in> closed_segment c b \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
have subs: "closed_segment c b \<subseteq> closed_segment a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment c b \<subseteq> closed_segment a b
[PROOF STEP]
using t c
[PROOF STATE]
proof (prove)
using this:
t \<in> closed_segment a b
c \<in> closed_segment a b

goal (1 subgoal):
 1. closed_segment c b \<subseteq> closed_segment a b
[PROOF STEP]
by (auto simp: closed_segment_eq_real_ivl)
[PROOF STATE]
proof (state)
this:
closed_segment c b \<subseteq> closed_segment a b

goal (1 subgoal):
 1. t \<in> closed_segment c b \<Longrightarrow> g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
t \<in> closed_segment c b
closed_segment c b \<subseteq> closed_segment a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
t \<in> closed_segment c b
closed_segment c b \<subseteq> closed_segment a b

goal (1 subgoal):
 1. g t \<le> C * exp (K * \<bar>t - c\<bar>)
[PROOF STEP]
by (intro gronwall_general_segment[where b=b])
        (auto intro!: assms intro: continuous_on_subset)
[PROOF STATE]
proof (state)
this:
g t \<le> C * exp (K * \<bar>t - c\<bar>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
g t \<le> C * exp (K * \<bar>t - c\<bar>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Group) sg_condition:"\<lbrakk>H \<subseteq> carrier G; H \<noteq> {};
       \<forall>a. \<forall>b. a \<in> H \<and> b \<in> H \<longrightarrow>  a \<cdot> (\<rho> b) \<in> H\<rbrakk> \<Longrightarrow> G \<guillemotright> H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<subseteq> carrier G; H \<noteq> {}; \<forall>a b. a \<in> H \<and> b \<in> H \<longrightarrow> a \<cdot> \<rho> b \<in> H\<rbrakk> \<Longrightarrow> G \<guillemotright> H
[PROOF STEP]
by (simp add:sg_def)


[STATEMENT]
lemma quot_of_fract_quot_to_fract: "quot_of_fract (quot_to_fract x) = normalize_quot x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quot_of_fract (quot_to_fract x) = normalize_quot x
[PROOF STEP]
proof (cases "snd x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. snd x = (0::'a) \<Longrightarrow> quot_of_fract (quot_to_fract x) = normalize_quot x
 2. snd x \<noteq> (0::'a) \<Longrightarrow> quot_of_fract (quot_to_fract x) = normalize_quot x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
snd x = (0::'a)

goal (2 subgoals):
 1. snd x = (0::'a) \<Longrightarrow> quot_of_fract (quot_to_fract x) = normalize_quot x
 2. snd x \<noteq> (0::'a) \<Longrightarrow> quot_of_fract (quot_to_fract x) = normalize_quot x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
snd x = (0::'a)

goal (1 subgoal):
 1. quot_of_fract (quot_to_fract x) = normalize_quot x
[PROOF STEP]
unfolding quot_to_fract_def
[PROOF STATE]
proof (prove)
using this:
snd x = (0::'a)

goal (1 subgoal):
 1. quot_of_fract (case x of (x, xa) \<Rightarrow> Fract x xa) = normalize_quot x
[PROOF STEP]
by transfer (simp add: case_prod_unfold normalize_quot_def)
[PROOF STATE]
proof (state)
this:
quot_of_fract (quot_to_fract x) = normalize_quot x

goal (1 subgoal):
 1. snd x \<noteq> (0::'a) \<Longrightarrow> quot_of_fract (quot_to_fract x) = normalize_quot x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. snd x \<noteq> (0::'a) \<Longrightarrow> quot_of_fract (quot_to_fract x) = normalize_quot x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
snd x \<noteq> (0::'a)

goal (1 subgoal):
 1. snd x \<noteq> (0::'a) \<Longrightarrow> quot_of_fract (quot_to_fract x) = normalize_quot x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
snd x \<noteq> (0::'a)

goal (1 subgoal):
 1. quot_of_fract (quot_to_fract x) = normalize_quot x
[PROOF STEP]
unfolding quot_to_fract_def
[PROOF STATE]
proof (prove)
using this:
snd x \<noteq> (0::'a)

goal (1 subgoal):
 1. quot_of_fract (case x of (x, xa) \<Rightarrow> Fract x xa) = normalize_quot x
[PROOF STEP]
by transfer (simp add: case_prod_unfold)
[PROOF STATE]
proof (state)
this:
quot_of_fract (quot_to_fract x) = normalize_quot x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma comp_vblcase: "f o vblcase a b = vblcase (f a) (f o b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> vblcase a b = vblcase (f a) (f \<circ> b)
[PROOF STEP]
apply(rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (f \<circ> vblcase a b) x = (case x of zeroX \<Rightarrow> f a | nextX x \<Rightarrow> (f \<circ> b) x)
[PROOF STEP]
apply(rule_tac x = x in vbl_casesE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x = zeroX \<Longrightarrow> (f \<circ> vblcase a b) x = (case x of zeroX \<Rightarrow> f a | nextX x \<Rightarrow> (f \<circ> b) x)
 2. \<And>x y. x = nextX y \<Longrightarrow> (f \<circ> vblcase a b) x = (case x of zeroX \<Rightarrow> f a | nextX x \<Rightarrow> (f \<circ> b) x)
[PROOF STEP]
apply(simp_all add: vblcase_zeroX vblcase_nextX)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma unitary_gen_comp:
  assumes "unitary_gen M1" and "unitary_gen M2"
  shows "unitary_gen (M1 *\<^sub>m\<^sub>m M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. unitary_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
obtain k1 k2 where *: "k1 * k2 \<noteq> 0" "mat_adj M1 *\<^sub>m\<^sub>m M1 = k1 *\<^sub>s\<^sub>m eye" "mat_adj M2 *\<^sub>m\<^sub>m M2 = k2 *\<^sub>s\<^sub>m eye"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k1 k2. \<lbrakk>k1 * k2 \<noteq> 0; mat_adj M1 *\<^sub>m\<^sub>m M1 = k1 *\<^sub>s\<^sub>m eye; mat_adj M2 *\<^sub>m\<^sub>m M2 = k2 *\<^sub>s\<^sub>m eye\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
unitary_gen M1
unitary_gen M2

goal (1 subgoal):
 1. (\<And>k1 k2. \<lbrakk>k1 * k2 \<noteq> 0; mat_adj M1 *\<^sub>m\<^sub>m M1 = k1 *\<^sub>s\<^sub>m eye; mat_adj M2 *\<^sub>m\<^sub>m M2 = k2 *\<^sub>s\<^sub>m eye\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding unitary_gen_def
[PROOF STATE]
proof (prove)
using this:
\<exists>k. k \<noteq> 0 \<and> mat_adj M1 *\<^sub>m\<^sub>m M1 = k *\<^sub>s\<^sub>m eye
\<exists>k. k \<noteq> 0 \<and> mat_adj M2 *\<^sub>m\<^sub>m M2 = k *\<^sub>s\<^sub>m eye

goal (1 subgoal):
 1. (\<And>k1 k2. \<lbrakk>k1 * k2 \<noteq> 0; mat_adj M1 *\<^sub>m\<^sub>m M1 = k1 *\<^sub>s\<^sub>m eye; mat_adj M2 *\<^sub>m\<^sub>m M2 = k2 *\<^sub>s\<^sub>m eye\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k1 * k2 \<noteq> 0
mat_adj M1 *\<^sub>m\<^sub>m M1 = k1 *\<^sub>s\<^sub>m eye
mat_adj M2 *\<^sub>m\<^sub>m M2 = k2 *\<^sub>s\<^sub>m eye

goal (1 subgoal):
 1. unitary_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
have "mat_adj M2 *\<^sub>m\<^sub>m mat_adj M1 *\<^sub>m\<^sub>m (M1 *\<^sub>m\<^sub>m M2) = mat_adj M2 *\<^sub>m\<^sub>m (mat_adj M1 *\<^sub>m\<^sub>m M1) *\<^sub>m\<^sub>m M2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_adj M2 *\<^sub>m\<^sub>m mat_adj M1 *\<^sub>m\<^sub>m (M1 *\<^sub>m\<^sub>m M2) = mat_adj M2 *\<^sub>m\<^sub>m (mat_adj M1 *\<^sub>m\<^sub>m M1) *\<^sub>m\<^sub>m M2
[PROOF STEP]
by (auto simp add: mult_mm_assoc)
[PROOF STATE]
proof (state)
this:
mat_adj M2 *\<^sub>m\<^sub>m mat_adj M1 *\<^sub>m\<^sub>m (M1 *\<^sub>m\<^sub>m M2) = mat_adj M2 *\<^sub>m\<^sub>m (mat_adj M1 *\<^sub>m\<^sub>m M1) *\<^sub>m\<^sub>m M2

goal (1 subgoal):
 1. unitary_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_adj M2 *\<^sub>m\<^sub>m mat_adj M1 *\<^sub>m\<^sub>m (M1 *\<^sub>m\<^sub>m M2) = mat_adj M2 *\<^sub>m\<^sub>m (mat_adj M1 *\<^sub>m\<^sub>m M1) *\<^sub>m\<^sub>m M2

goal (1 subgoal):
 1. unitary_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
have "... = mat_adj M2 *\<^sub>m\<^sub>m ((k1 *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>m M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_adj M2 *\<^sub>m\<^sub>m (mat_adj M1 *\<^sub>m\<^sub>m M1) *\<^sub>m\<^sub>m M2 = mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m eye *\<^sub>m\<^sub>m M2)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
k1 * k2 \<noteq> 0
mat_adj M1 *\<^sub>m\<^sub>m M1 = k1 *\<^sub>s\<^sub>m eye
mat_adj M2 *\<^sub>m\<^sub>m M2 = k2 *\<^sub>s\<^sub>m eye

goal (1 subgoal):
 1. mat_adj M2 *\<^sub>m\<^sub>m (mat_adj M1 *\<^sub>m\<^sub>m M1) *\<^sub>m\<^sub>m M2 = mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m eye *\<^sub>m\<^sub>m M2)
[PROOF STEP]
by (auto simp add: mult_mm_assoc)
[PROOF STATE]
proof (state)
this:
mat_adj M2 *\<^sub>m\<^sub>m (mat_adj M1 *\<^sub>m\<^sub>m M1) *\<^sub>m\<^sub>m M2 = mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m eye *\<^sub>m\<^sub>m M2)

goal (1 subgoal):
 1. unitary_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_adj M2 *\<^sub>m\<^sub>m (mat_adj M1 *\<^sub>m\<^sub>m M1) *\<^sub>m\<^sub>m M2 = mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m eye *\<^sub>m\<^sub>m M2)

goal (1 subgoal):
 1. unitary_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
have "... = mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m eye *\<^sub>m\<^sub>m M2) = mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m M2)
[PROOF STEP]
using mult_sm_eye_mm[of k1 M2]
[PROOF STATE]
proof (prove)
using this:
k1 *\<^sub>s\<^sub>m eye *\<^sub>m\<^sub>m M2 = k1 *\<^sub>s\<^sub>m M2

goal (1 subgoal):
 1. mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m eye *\<^sub>m\<^sub>m M2) = mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m M2)
[PROOF STEP]
by (simp del: eye_def)
[PROOF STATE]
proof (state)
this:
mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m eye *\<^sub>m\<^sub>m M2) = mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m M2)

goal (1 subgoal):
 1. unitary_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m eye *\<^sub>m\<^sub>m M2) = mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m M2)

goal (1 subgoal):
 1. unitary_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
have "... = k1 *\<^sub>s\<^sub>m (k2 *\<^sub>s\<^sub>m eye)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m M2) = k1 *\<^sub>s\<^sub>m (k2 *\<^sub>s\<^sub>m eye)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
k1 * k2 \<noteq> 0
mat_adj M1 *\<^sub>m\<^sub>m M1 = k1 *\<^sub>s\<^sub>m eye
mat_adj M2 *\<^sub>m\<^sub>m M2 = k2 *\<^sub>s\<^sub>m eye

goal (1 subgoal):
 1. mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m M2) = k1 *\<^sub>s\<^sub>m (k2 *\<^sub>s\<^sub>m eye)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_adj M2 *\<^sub>m\<^sub>m (k1 *\<^sub>s\<^sub>m M2) = k1 *\<^sub>s\<^sub>m (k2 *\<^sub>s\<^sub>m eye)

goal (1 subgoal):
 1. unitary_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mat_adj M2 *\<^sub>m\<^sub>m mat_adj M1 *\<^sub>m\<^sub>m (M1 *\<^sub>m\<^sub>m M2) = k1 *\<^sub>s\<^sub>m (k2 *\<^sub>s\<^sub>m eye)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat_adj M2 *\<^sub>m\<^sub>m mat_adj M1 *\<^sub>m\<^sub>m (M1 *\<^sub>m\<^sub>m M2) = k1 *\<^sub>s\<^sub>m (k2 *\<^sub>s\<^sub>m eye)

goal (1 subgoal):
 1. unitary_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
mat_adj M2 *\<^sub>m\<^sub>m mat_adj M1 *\<^sub>m\<^sub>m (M1 *\<^sub>m\<^sub>m M2) = k1 *\<^sub>s\<^sub>m (k2 *\<^sub>s\<^sub>m eye)
k1 * k2 \<noteq> 0
mat_adj M1 *\<^sub>m\<^sub>m M1 = k1 *\<^sub>s\<^sub>m eye
mat_adj M2 *\<^sub>m\<^sub>m M2 = k2 *\<^sub>s\<^sub>m eye

goal (1 subgoal):
 1. unitary_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
unfolding unitary_gen_def
[PROOF STATE]
proof (prove)
using this:
mat_adj M2 *\<^sub>m\<^sub>m mat_adj M1 *\<^sub>m\<^sub>m (M1 *\<^sub>m\<^sub>m M2) = k1 *\<^sub>s\<^sub>m (k2 *\<^sub>s\<^sub>m eye)
k1 * k2 \<noteq> 0
mat_adj M1 *\<^sub>m\<^sub>m M1 = k1 *\<^sub>s\<^sub>m eye
mat_adj M2 *\<^sub>m\<^sub>m M2 = k2 *\<^sub>s\<^sub>m eye

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> mat_adj (M1 *\<^sub>m\<^sub>m M2) *\<^sub>m\<^sub>m (M1 *\<^sub>m\<^sub>m M2) = k *\<^sub>s\<^sub>m eye
[PROOF STEP]
by (rule_tac x="k1*k2" in exI, simp del: eye_def)
[PROOF STATE]
proof (state)
this:
unitary_gen (M1 *\<^sub>m\<^sub>m M2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inorder_rot2:
  "B \<noteq> Leaf \<Longrightarrow> inorder(rot2 A a B b C) = inorder A @ a # inorder B @ b # inorder C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<noteq> \<langle>\<rangle> \<Longrightarrow> Tree2.inorder (rot2 A a B b C) = Tree2.inorder A @ a # Tree2.inorder B @ b # Tree2.inorder C
[PROOF STEP]
by (cases "(A,a,B,b,C)" rule: rot2.cases) (auto)


[STATEMENT]
lemma fps_exp_eq_fps_const_iff [simp]:
  "fps_exp (c :: 'a :: field_char_0) = fps_const c' \<longleftrightarrow> c = 0 \<and> c' = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_exp c = fps_const c') = (c = (0::'a) \<and> c' = (1::'a))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fps_exp c = fps_const c' \<Longrightarrow> c = (0::'a) \<and> c' = (1::'a)
 2. c = (0::'a) \<and> c' = (1::'a) \<Longrightarrow> fps_exp c = fps_const c'
[PROOF STEP]
assume "c = 0 \<and> c' = 1"
[PROOF STATE]
proof (state)
this:
c = (0::'a) \<and> c' = (1::'a)

goal (2 subgoals):
 1. fps_exp c = fps_const c' \<Longrightarrow> c = (0::'a) \<and> c' = (1::'a)
 2. c = (0::'a) \<and> c' = (1::'a) \<Longrightarrow> fps_exp c = fps_const c'
[PROOF STEP]
thus "fps_exp c = fps_const c'"
[PROOF STATE]
proof (prove)
using this:
c = (0::'a) \<and> c' = (1::'a)

goal (1 subgoal):
 1. fps_exp c = fps_const c'
[PROOF STEP]
by (simp add: fps_eq_iff)
[PROOF STATE]
proof (state)
this:
fps_exp c = fps_const c'

goal (1 subgoal):
 1. fps_exp c = fps_const c' \<Longrightarrow> c = (0::'a) \<and> c' = (1::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_exp c = fps_const c' \<Longrightarrow> c = (0::'a) \<and> c' = (1::'a)
[PROOF STEP]
assume "fps_exp c = fps_const c'"
[PROOF STATE]
proof (state)
this:
fps_exp c = fps_const c'

goal (1 subgoal):
 1. fps_exp c = fps_const c' \<Longrightarrow> c = (0::'a) \<and> c' = (1::'a)
[PROOF STEP]
from arg_cong[of _ _ "\<lambda>F. F $ 1", OF this] arg_cong[of _ _ "\<lambda>F. F $ 0", OF this]
[PROOF STATE]
proof (chain)
picking this:
fps_exp c $ 1 = fps_const c' $ 1
fps_exp c $ 0 = fps_const c' $ 0
[PROOF STEP]
show "c = 0 \<and> c' = 1"
[PROOF STATE]
proof (prove)
using this:
fps_exp c $ 1 = fps_const c' $ 1
fps_exp c $ 0 = fps_const c' $ 0

goal (1 subgoal):
 1. c = (0::'a) \<and> c' = (1::'a)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
c = (0::'a) \<and> c' = (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma parts_UN_subset2: "parts(\<Union>x\<in>A. H x) \<subseteq> (\<Union>x\<in>A. parts(H x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. parts (\<Union> (H ` A)) \<subseteq> (\<Union>x\<in>A. parts (H x))
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> parts (\<Union> (H ` A)) \<Longrightarrow> x \<in> (\<Union>x\<in>A. parts (H x))
[PROOF STEP]
apply (erule parts.induct, blast+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma neighbourhood_base_of_topology_base:
   "openin X = arbitrary union_of (\<lambda>W. W \<in> \<B>)
        \<Longrightarrow> neighbourhood_base_of P X \<longleftrightarrow>
             (\<forall>W x. W \<in> \<B> \<and> x \<in> W  \<longrightarrow> (\<exists>U V. openin X U \<and> P V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin X = arbitrary union_of (\<lambda>W. W \<in> \<B>) \<Longrightarrow> neighbourhood_base_of P X = (\<forall>W x. W \<in> \<B> \<and> x \<in> W \<longrightarrow> (\<exists>U V. openin X U \<and> P V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W))
[PROOF STEP]
apply (auto simp: openin_topology_base_unique neighbourhood_base_of)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>W x. \<lbrakk>\<forall>V. V \<in> \<B> \<longrightarrow> openin X V; \<forall>U x. openin X U \<and> x \<in> U \<longrightarrow> (\<exists>V. V \<in> \<B> \<and> x \<in> V \<and> V \<subseteq> U); \<forall>W x. W \<in> \<B> \<and> x \<in> W \<longrightarrow> (\<exists>U. openin X U \<and> (\<exists>V. P V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)); openin X W; x \<in> W\<rbrakk> \<Longrightarrow> \<exists>U. openin X U \<and> (\<exists>V. P V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)
[PROOF STEP]
by (meson subset_trans)


[STATEMENT]
lemma even_mult_exp_div_word_iff:
  \<open>even (a * 2 ^ m div 2 ^ n) \<longleftrightarrow> \<not> (
    m \<le> n \<and>
    n < LENGTH('a) \<and> odd (a div 2 ^ (n - m)))\<close> for a :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (a * 2 ^ m div 2 ^ n) = (\<not> (m \<le> n \<and> n < LENGTH('a) \<and> odd (a div 2 ^ (n - m))))
[PROOF STEP]
by transfer
    (auto simp flip: drop_bit_eq_div simp add: even_drop_bit_iff_not_bit bit_take_bit_iff,
      simp_all flip: push_bit_eq_mult add: bit_push_bit_iff_int)


[STATEMENT]
lemma fin_directed_tree_r: "r \<in> verts G \<Longrightarrow> finite_directed_tree (dir_tree_r r) r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<in> verts G \<Longrightarrow> finite_directed_tree (dir_tree_r r) r
[PROOF STEP]
unfolding finite_directed_tree_def fin_digraph_def fin_digraph_axioms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<in> verts G \<Longrightarrow> directed_tree (dir_tree_r r) r \<and> wf_digraph (dir_tree_r r) \<and> finite (verts (dir_tree_r r)) \<and> finite (arcs (dir_tree_r r))
[PROOF STEP]
using directed_tree.axioms(1)  directed_tree_r fin_arcs_dir_tree_r_eq  verts_dir_tree_r_eq
[PROOF STATE]
proof (prove)
using this:
directed_tree ?T ?root \<Longrightarrow> wf_digraph ?T
?r \<in> verts G \<Longrightarrow> directed_tree (dir_tree_r ?r) ?r
?r \<in> verts G \<Longrightarrow> finite (arcs (dir_tree_r ?r))
?r \<in> verts G \<Longrightarrow> verts (dir_tree_r ?r) = verts G

goal (1 subgoal):
 1. r \<in> verts G \<Longrightarrow> directed_tree (dir_tree_r r) r \<and> wf_digraph (dir_tree_r r) \<and> finite (verts (dir_tree_r r)) \<and> finite (arcs (dir_tree_r r))
[PROOF STEP]
by force


[STATEMENT]
lemma ordertype_UU_\<omega>2: "ordertype UU pair_less = \<omega>\<up>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordertype UU pair_less = \<omega> \<up> ord_of_nat 2
[PROOF STEP]
by (metis eq_iff ordertype_UNIV_\<omega>2 ordertype_UU_ge_\<omega>2 ordertype_mono small top_greatest trans_pair_less wf_pair_less)


[STATEMENT]
lemma enat_less_imp_le:
  assumes k: "!!k. n < enat k \<Longrightarrow> m < enat k"
  shows "m \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n
[PROOF STEP]
proof(cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>nat. n = enat nat \<Longrightarrow> m \<le> n
 2. n = \<infinity> \<Longrightarrow> m \<le> n
[PROOF STEP]
case (enat n')
[PROOF STATE]
proof (state)
this:
n = enat n'

goal (2 subgoals):
 1. \<And>nat. n = enat nat \<Longrightarrow> m \<le> n
 2. n = \<infinity> \<Longrightarrow> m \<le> n
[PROOF STEP]
with k[of "Suc n'"]
[PROOF STATE]
proof (chain)
picking this:
n < enat (Suc n') \<Longrightarrow> m < enat (Suc n')
n = enat n'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n < enat (Suc n') \<Longrightarrow> m < enat (Suc n')
n = enat n'

goal (1 subgoal):
 1. m \<le> n
[PROOF STEP]
by(cases m) simp_all
[PROOF STATE]
proof (state)
this:
m \<le> n

goal (1 subgoal):
 1. n = \<infinity> \<Longrightarrow> m \<le> n
[PROOF STEP]
qed simp


[STATEMENT]
lemma rel_frontier_of_polyhedron:
  fixes S :: "'a :: euclidean_space set"
  assumes "polyhedron S"
    shows "rel_frontier S = \<Union> {F. F facet_of S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_frontier S = \<Union> {F. F facet_of S}
[PROOF STEP]
by (simp add: assms rel_frontier_def polyhedron_imp_closed rel_boundary_of_polyhedron)