[STATEMENT]
lemma SUP_ereal_add:
  fixes f g :: "nat \<Rightarrow> ereal"
  assumes inc: "incseq f" "incseq g"
    and pos: "\<And>i. f i \<noteq> -\<infinity>" "\<And>i. g i \<noteq> -\<infinity>"
  shows "(SUP i. f i + g i) = Sup (f ` UNIV) + Sup (g ` UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i. f i + g i) = Sup (range f) + Sup (range g)
[PROOF STEP]
apply (subst SUP_ereal_add_left[symmetric, OF UNIV_not_empty])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Sup (range g) \<noteq> - \<infinity>
 2. (SUP i. f i + g i) = (SUP i. f i + Sup (range g))
[PROOF STEP]
apply (metis SUP_upper UNIV_I assms(4) ereal_infty_less_eq(2))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i. f i + g i) = (SUP i. f i + Sup (range g))
[PROOF STEP]
apply (subst (2) add.commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i. f i + g i) = (SUP i. Sup (range g) + f i)
[PROOF STEP]
apply (subst SUP_ereal_add_left[symmetric, OF UNIV_not_empty assms(3)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i. f i + g i) = (SUP i ia. g ia + f i)
[PROOF STEP]
apply (subst (2) add.commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i. f i + g i) = (SUP i ia. f i + g ia)
[PROOF STEP]
apply (rule SUP_combine[symmetric] add_mono inc[THEN monoD] | assumption)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma arctan_less_pi4: "\<bar>x\<bar> < 1 \<Longrightarrow> \<bar>arctan x\<bar> < pi/4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x\<bar> < 1 \<Longrightarrow> \<bar>arctan x\<bar> < pi / 4
[PROOF STEP]
by (metis abs_less_iff arctan_less_pi4_pos arctan_minus)


[STATEMENT]
lemma leq_all_in_sol:
  fixes f :: "'a \<Rightarrow> ('b :: preorder)"
  assumes "x \<in> arg_max_set f S"
  shows "\<forall>y \<in> S. f y \<ge> f x \<longrightarrow> y \<in> arg_max_set f S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y\<in>S. f x \<le> f y \<longrightarrow> y \<in> arg_max_set f S
[PROOF STEP]
using assms le_less_trans
[PROOF STATE]
proof (prove)
using this:
x \<in> arg_max_set f S
\<lbrakk>?x \<le> ?y; ?y < ?z\<rbrakk> \<Longrightarrow> ?x < ?z

goal (1 subgoal):
 1. \<forall>y\<in>S. f x \<le> f y \<longrightarrow> y \<in> arg_max_set f S
[PROOF STEP]
by (auto simp: arg_max_set_def is_arg_max_def)


[STATEMENT]
lemma seq_top [simp]: "\<top> ; c = \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<top> ; c = \<top>
variables:
c :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<top> ; c = \<top>
variables:
c :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
have "\<top> ; c = (\<Sqinter>a\<in>{}. a ; c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<top> ; c = (\<Sqinter>a::'a\<in>{}. a ; c)
variables:
c :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (metis Inf_empty Inf_seq_distrib)
[PROOF STATE]
proof (state)
this:
\<top> ; (c::'a::refinement_lattice) = (\<Sqinter>a::'a::refinement_lattice\<in>{}. a ; c)

goal (1 subgoal):
 1. \<top> ; c = \<top>
variables:
c :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<top> ; (c::'a::refinement_lattice) = (\<Sqinter>a::'a::refinement_lattice\<in>{}. a ; c)

goal (1 subgoal):
 1. \<top> ; c = \<top>
variables:
c :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<top> ; (c::'a::refinement_lattice) = \<top>

goal:
No subgoals!
variables:
c :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
qed


[STATEMENT]
lemma machin': "pi/4 = (12::real) * arctan (1/18) + 8 * arctan (1/57) - 5 * arctan (1/239)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi / 4 = 12 * arctan (1 / 18) + 8 * arctan (1 / 57) - 5 * arctan (1 / 239)
[PROOF STEP]
by machin


[STATEMENT]
lemma in_listrel1_converse:
  "(x,y) \<in> listrel1 (r\<inverse>) \<longleftrightarrow> (x,y) \<in> (listrel1 r)\<inverse>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x, y) \<in> listrel1 (r\<inverse>)) = ((x, y) \<in> (listrel1 r)\<inverse>)
[PROOF STEP]
unfolding listrel1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x, y) \<in> {(xs, ys). \<exists>us z z' vs. xs = us @ z # vs \<and> (z, z') \<in> r\<inverse> \<and> ys = us @ z' # vs}) = ((x, y) \<in> {(xs, ys). \<exists>us z z' vs. xs = us @ z # vs \<and> (z, z') \<in> r \<and> ys = us @ z' # vs}\<inverse>)
[PROOF STEP]
by blast


[STATEMENT]
lemma Borsukian_alt:
  fixes S :: "'a::real_normed_vector set"
  shows
   "Borsukian S \<longleftrightarrow>
        (\<forall>f g. continuous_on S f \<and> f ` S \<subseteq> -{0} \<and>
               continuous_on S g \<and> g ` S \<subseteq> -{0}
               \<longrightarrow> homotopic_with_canon (\<lambda>h. True) S (- {0::complex}) f g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Borsukian S = (\<forall>f g. continuous_on S f \<and> f ` S \<subseteq> - {0} \<and> continuous_on S g \<and> g ` S \<subseteq> - {0} \<longrightarrow> homotopic_with_canon (\<lambda>h. True) S (- {0}) f g)
[PROOF STEP]
unfolding Borsukian_def homotopic_triviality
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>f. continuous_on S f \<and> f ` S \<subseteq> - {0} \<longrightarrow> (\<exists>a. homotopic_with_canon (\<lambda>h. True) S (- {0}) f (\<lambda>x. a))) = ((S = {} \<or> path_connected (- {0})) \<and> (\<forall>f. continuous_on S f \<and> f ` S \<subseteq> - {0} \<longrightarrow> (\<exists>c. homotopic_with_canon (\<lambda>h. True) S (- {0}) f (\<lambda>h. c))))
[PROOF STEP]
by (simp add: path_connected_punctured_universe)


[STATEMENT]
lemma continuous_cot:
  "continuous F f \<Longrightarrow> sin (f (Lim F (\<lambda>x. x))) \<noteq> 0 \<Longrightarrow> continuous F (\<lambda>x. cot (f x))"
  for f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous F f; sin (f (Lim F (\<lambda>x. x))) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. cot (f x))
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F; sin (f (Lim F (\<lambda>x. x))) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> ((\<lambda>x. cot (f x)) \<longlongrightarrow> cot (f (Lim F (\<lambda>x. x)))) F
[PROOF STEP]
by (rule tendsto_cot)


[STATEMENT]
lemma evaluate_net_Conv_all1:
assumes "valid_net' m"
and "input_sizes m = map dim_vec input"
and "i<nr"
shows "evaluate_net (Conv (all1_matrix nr (output_size' m)) m) input $ i
 = Groups_List.sum_list (list_of_vec (evaluate_net m input))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. evaluate_net (Conv (all1_matrix nr (output_size' m)) m) input $ i = sum_list (list_of_vec (evaluate_net m input))
[PROOF STEP]
unfolding evaluate_net.simps output_size_correct[OF assms(1) assms(2)[symmetric]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (all1_matrix nr (dim_vec (evaluate_net m input)) *\<^sub>v evaluate_net m input) $ i = sum_list (list_of_vec (evaluate_net m input))
[PROOF STEP]
using mult_all1_matrix[OF \<open>i<nr\<close>, of "evaluate_net m input", unfolded dim_vec_of_list]
  assms(3) all1_matrix_dim(1)
[PROOF STATE]
proof (prove)
using this:
(all1_matrix nr (dim_vec (evaluate_net m input)) *\<^sub>v evaluate_net m input) $ i = sum_list (list_of_vec (evaluate_net m input))
i < nr
dim_row (all1_matrix ?nr ?nc) = ?nr

goal (1 subgoal):
 1. (all1_matrix nr (dim_vec (evaluate_net m input)) *\<^sub>v evaluate_net m input) $ i = sum_list (list_of_vec (evaluate_net m input))
[PROOF STEP]
by metis


[STATEMENT]
lemma "3 ^ 15 = (14348907::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 ^ 15 = 14348907
[PROOF STEP]
by simp


[STATEMENT]
lemma (in weak_lower_semilattice) weak_meet_assoc_lemma:
  assumes L: "x \<in> carrier L"  "y \<in> carrier L"  "z \<in> carrier L"
  shows "x \<sqinter> (y \<sqinter> z) .= \<Sqinter>{x, y, z}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter> (y \<sqinter> z) .= \<Sqinter>{x, y, z}
[PROOF STEP]
proof (rule finite_inf_insertI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>i. is_glb L i {x, y, z} \<Longrightarrow> x \<sqinter> (y \<sqinter> z) .= i
 2. finite {y, z}
 3. x \<in> carrier L
 4. {y, z} \<subseteq> carrier L
[PROOF STEP]
txt \<open>The textbook argument in Jacobson I, p 457\<close>
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>i. is_glb L i {x, y, z} \<Longrightarrow> x \<sqinter> (y \<sqinter> z) .= i
 2. finite {y, z}
 3. x \<in> carrier L
 4. {y, z} \<subseteq> carrier L
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>i. is_glb L i {x, y, z} \<Longrightarrow> x \<sqinter> (y \<sqinter> z) .= i
 2. finite {y, z}
 3. x \<in> carrier L
 4. {y, z} \<subseteq> carrier L
[PROOF STEP]
assume inf: "greatest L i (Lower L {x, y, z})"
[PROOF STATE]
proof (state)
this:
is_glb L i {x, y, z}

goal (4 subgoals):
 1. \<And>i. is_glb L i {x, y, z} \<Longrightarrow> x \<sqinter> (y \<sqinter> z) .= i
 2. finite {y, z}
 3. x \<in> carrier L
 4. {y, z} \<subseteq> carrier L
[PROOF STEP]
show "x \<sqinter> (y \<sqinter> z) .= i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter> (y \<sqinter> z) .= i
[PROOF STEP]
proof (rule weak_le_antisym)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. x \<sqinter> (y \<sqinter> z) \<sqsubseteq> i
 2. i \<sqsubseteq> x \<sqinter> (y \<sqinter> z)
 3. x \<sqinter> (y \<sqinter> z) \<in> carrier L
 4. i \<in> carrier L
[PROOF STEP]
from inf L
[PROOF STATE]
proof (chain)
picking this:
is_glb L i {x, y, z}
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L
[PROOF STEP]
show "i \<sqsubseteq> x \<sqinter> (y \<sqinter> z)"
[PROOF STATE]
proof (prove)
using this:
is_glb L i {x, y, z}
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L

goal (1 subgoal):
 1. i \<sqsubseteq> x \<sqinter> (y \<sqinter> z)
[PROOF STEP]
by (fastforce intro!: meet_le elim: greatest_Lower_below)
[PROOF STATE]
proof (state)
this:
i \<sqsubseteq> x \<sqinter> (y \<sqinter> z)

goal (3 subgoals):
 1. x \<sqinter> (y \<sqinter> z) \<sqsubseteq> i
 2. x \<sqinter> (y \<sqinter> z) \<in> carrier L
 3. i \<in> carrier L
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. x \<sqinter> (y \<sqinter> z) \<sqsubseteq> i
 2. x \<sqinter> (y \<sqinter> z) \<in> carrier L
 3. i \<in> carrier L
[PROOF STEP]
from inf L
[PROOF STATE]
proof (chain)
picking this:
is_glb L i {x, y, z}
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L
[PROOF STEP]
show "x \<sqinter> (y \<sqinter> z) \<sqsubseteq> i"
[PROOF STATE]
proof (prove)
using this:
is_glb L i {x, y, z}
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L

goal (1 subgoal):
 1. x \<sqinter> (y \<sqinter> z) \<sqsubseteq> i
[PROOF STEP]
by (erule_tac greatest_le)
      (blast intro!: Lower_memI intro: le_trans meet_left meet_right meet_closed)
[PROOF STATE]
proof (state)
this:
x \<sqinter> (y \<sqinter> z) \<sqsubseteq> i

goal (2 subgoals):
 1. x \<sqinter> (y \<sqinter> z) \<in> carrier L
 2. i \<in> carrier L
[PROOF STEP]
qed (simp_all add: L greatest_closed [OF inf])
[PROOF STATE]
proof (state)
this:
x \<sqinter> (y \<sqinter> z) .= i

goal (3 subgoals):
 1. finite {y, z}
 2. x \<in> carrier L
 3. {y, z} \<subseteq> carrier L
[PROOF STEP]
qed (simp_all add: L)


[STATEMENT]
theorem complete_mono_imp_ex_extreme_qfp:
  assumes comp: "UNIV-complete A (\<sqsubseteq>)" and f: "f ` A \<subseteq> A"
    and mono: "monotone_on A (\<sqsubseteq>) (\<sqsubseteq>) f"
  shows "\<exists>s. extreme {p \<in> A. f p \<sim> p} (\<sqsubseteq>) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>s. extreme {p \<in> A. f p \<sim> p} (\<sqsubseteq>) s
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>s. extreme {p \<in> A. f p \<sim> p} (\<sqsubseteq>) s
[PROOF STEP]
interpret dual: fixed_point_proof A "(\<sqsupseteq>)" rewrites "dual.sym = (\<sim>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fixed_point_proof A f &&& sympartp (\<lambda>x y. y \<sqsubseteq> x) = (\<sim>)
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
f ` A \<subseteq> A

goal (1 subgoal):
 1. fixed_point_proof A f &&& sympartp (\<lambda>x y. y \<sqsubseteq> x) = (\<sim>)
[PROOF STEP]
by unfold_locales (auto intro!:ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>s. extreme {p \<in> A. f p \<sim> p} (\<sqsubseteq>) s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>s. extreme {p \<in> A. f p \<sim> p} (\<sqsubseteq>) s
[PROOF STEP]
apply (rule dual.ex_extreme_qfp[OF complete_dual[OF comp] _ _ monotone_on_dual[OF mono]])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. dual.C \<in> UNIV
 2. \<forall>p\<in>A. \<forall>x\<in>A. f p \<sim> p \<longrightarrow> f p \<sqsubseteq> x \<longrightarrow> p \<sqsubseteq> x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>A. \<forall>x\<in>A. f p \<sim> p \<longrightarrow> f p \<sqsubseteq> x \<longrightarrow> p \<sqsubseteq> x
[PROOF STEP]
using f sym_order_trans
[PROOF STATE]
proof (prove)
using this:
f ` A \<subseteq> A
\<lbrakk>?x \<sim> ?y; ?y \<sqsubseteq> ?z; ?x \<in> A; ?y \<in> A; ?z \<in> A\<rbrakk> \<Longrightarrow> ?x \<sqsubseteq> ?z

goal (1 subgoal):
 1. \<forall>p\<in>A. \<forall>x\<in>A. f p \<sim> p \<longrightarrow> f p \<sqsubseteq> x \<longrightarrow> p \<sqsubseteq> x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>s. extreme {p \<in> A. f p \<sim> p} (\<sqsubseteq>) s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bezout_ring_iff_fin_gen_principal_ideal:
    "(\<And>I::'a::comm_ring_1 set. finitely_generated_ideal I \<Longrightarrow> principal_ideal I)
    \<equiv> OFCLASS('a, bezout_ring_class)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>I. finitely_generated_ideal I \<Longrightarrow> principal_ideal I) \<equiv> OFCLASS('a, bezout_ring_class)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>I. finitely_generated_ideal I \<Longrightarrow> principal_ideal I) \<Longrightarrow> OFCLASS('a, bezout_ring_class)
 2. \<And>I. \<lbrakk>OFCLASS('a, bezout_ring_class); finitely_generated_ideal I\<rbrakk> \<Longrightarrow> principal_ideal I
[PROOF STEP]
show "(\<And>I::'a::comm_ring_1 set. finitely_generated_ideal I \<Longrightarrow> principal_ideal I)
    \<Longrightarrow> OFCLASS('a, bezout_ring_class)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>I. finitely_generated_ideal I \<Longrightarrow> principal_ideal I) \<Longrightarrow> OFCLASS('a, bezout_ring_class)
[PROOF STEP]
using all_fin_gen_ideals_are_principal_imp_bezout [where ?'a='a]
[PROOF STATE]
proof (prove)
using this:
\<forall>I. finitely_generated_ideal I \<longrightarrow> principal_ideal I \<Longrightarrow> OFCLASS('a, bezout_ring_class)

goal (1 subgoal):
 1. (\<And>I. finitely_generated_ideal I \<Longrightarrow> principal_ideal I) \<Longrightarrow> OFCLASS('a, bezout_ring_class)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<And>I. finitely_generated_ideal I \<Longrightarrow> principal_ideal I) \<Longrightarrow> OFCLASS('a, bezout_ring_class)

goal (1 subgoal):
 1. \<And>I. \<lbrakk>OFCLASS('a, bezout_ring_class); finitely_generated_ideal I\<rbrakk> \<Longrightarrow> principal_ideal I
[PROOF STEP]
show "\<And>I::'a::comm_ring_1 set. OFCLASS('a, bezout_ring_class)
    \<Longrightarrow> finitely_generated_ideal I \<Longrightarrow> principal_ideal I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>I. \<lbrakk>OFCLASS('a, bezout_ring_class); finitely_generated_ideal I\<rbrakk> \<Longrightarrow> principal_ideal I
[PROOF STEP]
using bezout_imp_all_fin_gen_ideals_are_principal_unsatisfactory[where ?'b='a]
[PROOF STATE]
proof (prove)
using this:
class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus \<Longrightarrow> \<forall>I. finitely_generated_ideal I \<longrightarrow> principal_ideal I

goal (1 subgoal):
 1. \<And>I. \<lbrakk>OFCLASS('a, bezout_ring_class); finitely_generated_ideal I\<rbrakk> \<Longrightarrow> principal_ideal I
[PROOF STEP]
using OFCLASS_bezout_ring_imp_class_bezout_ring[where ?'a='a]
[PROOF STATE]
proof (prove)
using this:
class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus \<Longrightarrow> \<forall>I. finitely_generated_ideal I \<longrightarrow> principal_ideal I
OFCLASS('a, bezout_ring_class) \<Longrightarrow> class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus

goal (1 subgoal):
 1. \<And>I. \<lbrakk>OFCLASS('a, bezout_ring_class); finitely_generated_ideal I\<rbrakk> \<Longrightarrow> principal_ideal I
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>OFCLASS('a, bezout_ring_class); finitely_generated_ideal ?I\<rbrakk> \<Longrightarrow> principal_ideal ?I

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rtrancl_on_conv_ntrancl_onp: "(a,b) \<in> rtrancl_on F r \<longleftrightarrow> (\<exists>n. ntrancl_onp F r n a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((a, b) \<in> rtrancl_on F r) = (\<exists>n. ntrancl_onp F r n a b)
[PROOF STEP]
by (metis ntrancl_onpD_rtrancl_on rtrancl_onE_ntrancl_onp)


[STATEMENT]
lemma convex_hull_union_cones_two:
  fixes S T :: "'m::euclidean_space set"
  assumes "convex S"
    and "cone S"
    and "S \<noteq> {}"
  assumes "convex T"
    and "cone T"
    and "T \<noteq> {}"
  shows "convex hull (S \<union> T) = S + T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull (S \<union> T) = S + T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex hull (S \<union> T) = S + T
[PROOF STEP]
define I :: "nat set" where "I = {1, 2}"
[PROOF STATE]
proof (state)
this:
I = {1, 2}

goal (1 subgoal):
 1. convex hull (S \<union> T) = S + T
[PROOF STEP]
define A where "A i = (if i = (1::nat) then S else T)" for i
[PROOF STATE]
proof (state)
this:
A ?i = (if ?i = 1 then S else T)

goal (1 subgoal):
 1. convex hull (S \<union> T) = S + T
[PROOF STEP]
have "\<Union>(A ` I) = S \<union> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (A ` I) = S \<union> T
[PROOF STEP]
using A_def I_def
[PROOF STATE]
proof (prove)
using this:
A ?i = (if ?i = 1 then S else T)
I = {1, 2}

goal (1 subgoal):
 1. \<Union> (A ` I) = S \<union> T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> (A ` I) = S \<union> T

goal (1 subgoal):
 1. convex hull (S \<union> T) = S + T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<Union> (A ` I) = S \<union> T
[PROOF STEP]
have "convex hull (\<Union>(A ` I)) = convex hull (S \<union> T)"
[PROOF STATE]
proof (prove)
using this:
\<Union> (A ` I) = S \<union> T

goal (1 subgoal):
 1. convex hull \<Union> (A ` I) = convex hull (S \<union> T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
convex hull \<Union> (A ` I) = convex hull (S \<union> T)

goal (1 subgoal):
 1. convex hull (S \<union> T) = S + T
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
convex hull \<Union> (A ` I) = convex hull (S \<union> T)

goal (1 subgoal):
 1. convex hull (S \<union> T) = S + T
[PROOF STEP]
have "convex hull \<Union>(A ` I) = sum A I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull \<Union> (A ` I) = sum A I
[PROOF STEP]
using A_def I_def
[PROOF STATE]
proof (prove)
using this:
A ?i = (if ?i = 1 then S else T)
I = {1, 2}

goal (1 subgoal):
 1. convex hull \<Union> (A ` I) = sum A I
[PROOF STEP]
by (metis assms convex_hull_finite_union_cones empty_iff finite.emptyI finite.insertI insertI1)
[PROOF STATE]
proof (state)
this:
convex hull \<Union> (A ` I) = sum A I

goal (1 subgoal):
 1. convex hull (S \<union> T) = S + T
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
convex hull \<Union> (A ` I) = sum A I

goal (1 subgoal):
 1. convex hull (S \<union> T) = S + T
[PROOF STEP]
have "sum A I = S + T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum A I = S + T
[PROOF STEP]
using A_def I_def
[PROOF STATE]
proof (prove)
using this:
A ?i = (if ?i = 1 then S else T)
I = {1, 2}

goal (1 subgoal):
 1. sum A I = S + T
[PROOF STEP]
by (force simp add: set_plus_def)
[PROOF STATE]
proof (state)
this:
sum A I = S + T

goal (1 subgoal):
 1. convex hull (S \<union> T) = S + T
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
convex hull \<Union> (A ` I) = convex hull (S \<union> T)
convex hull \<Union> (A ` I) = sum A I
sum A I = S + T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
convex hull \<Union> (A ` I) = convex hull (S \<union> T)
convex hull \<Union> (A ` I) = sum A I
sum A I = S + T

goal (1 subgoal):
 1. convex hull (S \<union> T) = S + T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
convex hull (S \<union> T) = S + T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_list_minus:
  assumes "strict_prefix s t"
  shows "length(t - s) = length(t) - length(s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (t - s) = length t - length s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
strict_prefix s t

goal (1 subgoal):
 1. length (t - s) = length t - length s
[PROOF STEP]
by (simp add: minus_list_def prefix_order.dual_order.strict_implies_order)


[STATEMENT]
lemma swap_cols_rows_block_dims[simp]:
  "dim_row (swap_cols_rows_block i j A) = dim_row A"
  "dim_col (swap_cols_rows_block i j A) = dim_col A"
  "A \<in> carrier_mat n n \<Longrightarrow> swap_cols_rows_block i j A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (swap_cols_rows_block i j A) = dim_row A &&& dim_col (swap_cols_rows_block i j A) = dim_col A &&& (A \<in> carrier_mat n n \<Longrightarrow> swap_cols_rows_block i j A \<in> carrier_mat n n)
[PROOF STEP]
using swap_cols_rows_block_dims_main
[PROOF STATE]
proof (prove)
using this:
dim_row (swap_cols_rows_block ?i ?j ?A) = dim_row ?A \<and> dim_col (swap_cols_rows_block ?i ?j ?A) = dim_col ?A

goal (1 subgoal):
 1. dim_row (swap_cols_rows_block i j A) = dim_row A &&& dim_col (swap_cols_rows_block i j A) = dim_col A &&& (A \<in> carrier_mat n n \<Longrightarrow> swap_cols_rows_block i j A \<in> carrier_mat n n)
[PROOF STEP]
unfolding carrier_mat_def
[PROOF STATE]
proof (prove)
using this:
dim_row (swap_cols_rows_block ?i ?j ?A) = dim_row ?A \<and> dim_col (swap_cols_rows_block ?i ?j ?A) = dim_col ?A

goal (1 subgoal):
 1. dim_row (swap_cols_rows_block i j A) = dim_row A &&& dim_col (swap_cols_rows_block i j A) = dim_col A &&& (A \<in> {m. dim_row m = n \<and> dim_col m = n} \<Longrightarrow> swap_cols_rows_block i j A \<in> {m. dim_row m = n \<and> dim_col m = n})
[PROOF STEP]
by auto


[STATEMENT]
lemma add_order_equality:
  "\<lbrakk> n>0; a+^n = 0; (\<And>m. m>0 \<Longrightarrow> a+^m = 0 \<Longrightarrow> n\<le>m) \<rbrakk> \<Longrightarrow>
    add_order a = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; a +^ n = (0::'a); \<And>m. \<lbrakk>0 < m; a +^ m = (0::'a)\<rbrakk> \<Longrightarrow> n \<le> m\<rbrakk> \<Longrightarrow> add_order a = n
[PROOF STEP]
using Least_equality[of "\<lambda>n. n>0 \<and> a+^n = 0"] add_order_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?x \<and> a +^ ?x = (0::'a); \<And>y. 0 < y \<and> a +^ y = (0::'a) \<Longrightarrow> ?x \<le> y\<rbrakk> \<Longrightarrow> (LEAST n. 0 < n \<and> a +^ n = (0::'a)) = ?x
add_order ?a \<equiv> if \<exists>n>0. ?a +^ n = (0::'a) then LEAST n. 0 < n \<and> ?a +^ n = (0::'a) else 0

goal (1 subgoal):
 1. \<lbrakk>0 < n; a +^ n = (0::'a); \<And>m. \<lbrakk>0 < m; a +^ m = (0::'a)\<rbrakk> \<Longrightarrow> n \<le> m\<rbrakk> \<Longrightarrow> add_order a = n
[PROOF STEP]
by auto


[STATEMENT]
lemma (in order) order_finite_set_exists_foundation:
  fixes   t :: 'a
  assumes "finite M"
    and   "t \<in> M"
  shows   "\<exists>s\<in>M. s \<le> t \<and> (\<forall>u\<in>M. \<not> u < s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>s\<in>M. s \<le> t \<and> (\<forall>u\<in>M. \<not> u < s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite M
t \<in> M

goal (1 subgoal):
 1. \<exists>s\<in>M. s \<le> t \<and> (\<forall>u\<in>M. \<not> u < s)
[PROOF STEP]
by (simp add: dual_order.strict_iff_order finite_has_minimal2)


[STATEMENT]
lemma relInvImage_Gr: "\<lbrakk>R \<subseteq> B \<times> B\<rbrakk> \<Longrightarrow> relInvImage A R f = Gr A f O R O (Gr A f)\<inverse>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R \<subseteq> B \<times> B \<Longrightarrow> relInvImage A R f = Gr A f O R O (Gr A f)\<inverse>
[PROOF STEP]
unfolding Gr_def relcomp_def image_def relInvImage_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R \<subseteq> B \<times> B \<Longrightarrow> {(a1, a2) |a1 a2. a1 \<in> A \<and> a2 \<in> A \<and> (f a1, f a2) \<in> R} = {(x, y). ((\<lambda>x xa. (x, xa) \<in> {(a, f a) |a. a \<in> A}) OO (\<lambda>x xa. (x, xa) \<in> {(x, y). ((\<lambda>x xa. (x, xa) \<in> R) OO (\<lambda>x xa. (x, xa) \<in> {(a, f a) |a. a \<in> A}\<inverse>)) x y})) x y}
[PROOF STEP]
by auto


[STATEMENT]
lemma mat_inv_cnj:
  shows "mat_cnj (mat_inv M) = mat_inv (mat_cnj M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_cnj (mat_inv M) = mat_inv (mat_cnj M)
[PROOF STEP]
unfolding mat_cnj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_map cnj (mat_inv M) = mat_inv (mat_map cnj M)
[PROOF STEP]
by (cases M) auto


[STATEMENT]
lemma swap_rows_mat_eq_permute:
  "k < n \<Longrightarrow> l < n \<Longrightarrow> swaprows_mat n k l = mat n n (\<lambda>(i, j). 1\<^sub>m n $$ (transpose k l i, j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k < n; l < n\<rbrakk> \<Longrightarrow> swaprows_mat n k l = mat n n (\<lambda>(i, j). 1\<^sub>m n $$ (Transposition.transpose k l i, j))
[PROOF STEP]
by (rule eq_matI) (auto simp add: transpose_def)


[STATEMENT]
lemma sum_set_linear:
  fixes f :: "'a::comm_monoid_add set \<Rightarrow> 'b::comm_monoid_add set"
  assumes "\<And>A B. f(A) + f(B) = f(A + B)" "f {0} = {0}"
  shows "f (sum S I) = sum (f \<circ> S) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (sum S I) = sum (f \<circ> S) I
[PROOF STEP]
using sum_set_cond_linear[of "\<lambda>x. True" f I S] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>A B. \<lbrakk>True; True\<rbrakk> \<Longrightarrow> True; True; \<And>A B. \<lbrakk>True; True\<rbrakk> \<Longrightarrow> f (A + B) = f A + f B; f {0::'a} = {0::'b}; \<And>i. i \<in> I \<Longrightarrow> True\<rbrakk> \<Longrightarrow> f (sum S I) = sum (f \<circ> S) I
f ?A + f ?B = f (?A + ?B)
f {0::'a} = {0::'b}

goal (1 subgoal):
 1. f (sum S I) = sum (f \<circ> S) I
[PROOF STEP]
by auto


[STATEMENT]
lemma ordertype_UNIV_\<omega>2: "ordertype UNIV pair_less = \<omega>\<up>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordertype UNIV pair_less = \<omega> \<up> ord_of_nat 2
[PROOF STEP]
using ordertype_Times [of concl: UNIV UNIV less_than less_than]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>small UNIV; small UNIV; wf less_than; trans less_than; total less_than; wf less_than; trans less_than; total less_than\<rbrakk> \<Longrightarrow> ordertype (UNIV \<times> UNIV) (less_than <*lex*> less_than) = ordertype UNIV less_than * ordertype UNIV less_than

goal (1 subgoal):
 1. ordertype UNIV pair_less = \<omega> \<up> ord_of_nat 2
[PROOF STEP]
by (simp add: total_less_than pair_less_def ordertype_nat_\<omega> numeral_2_eq_2)


[STATEMENT]
lemma llist_all2_right: "llist_all2 (\<lambda>_. P) xs ys \<longleftrightarrow> llength xs = llength ys \<and> (\<forall>x\<in>lset ys. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llist_all2 (\<lambda>_. P) xs ys = (llength xs = llength ys \<and> (\<forall>x\<in>lset ys. P x))
[PROOF STEP]
by(fastforce simp add: llist_all2_conv_all_lnth lset_conv_lnth)


[STATEMENT]
lemma filterlim_at_to_0:
  "filterlim f F (at a) \<longleftrightarrow> filterlim (\<lambda>x. f (x + a)) F (at 0)"
  for a :: "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim f F (at a) = (LIM x at (0::'a). f (x + a) :> F)
[PROOF STEP]
unfolding filterlim_def filtermap_filtermap at_to_0[of a]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (filtermap (\<lambda>x. f (x + a)) (at (0::'a)) \<le> F) = (filtermap (\<lambda>x. f (x + a)) (at (0::'a)) \<le> F)
[PROOF STEP]
..


[STATEMENT]
lemma cinner_canonical_basis:
  assumes \<open>i < length (canonical_basis :: 'a::onb_enum list)\<close>
  assumes \<open>j < length (canonical_basis :: 'a::onb_enum list)\<close>
  shows \<open>cinner (canonical_basis!i :: 'a) (canonical_basis!j) = (if i=j then 1 else 0)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. canonical_basis ! i \<bullet>\<^sub>C canonical_basis ! j = (if i = j then 1 else 0)
[PROOF STEP]
by (metis assms(1) assms(2) distinct_canonical_basis is_normal is_ortho_set_def is_orthonormal nth_eq_iff_index_eq nth_mem of_real_1 power2_norm_eq_cinner power_one)


[STATEMENT]
lemma bound_main_lemma_charles:
  fixes PROB :: "'a problem"
  assumes "finite PROB"
  shows "problem_plan_bound_charles PROB \<le> 2 ^ (card (prob_dom PROB)) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. problem_plan_bound_charles PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. problem_plan_bound_charles PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
have 1: "\<forall>x\<in>MPLS_charles PROB. x \<le> 2 ^ (card (prob_dom PROB)) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>MPLS_charles PROB. x \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
using assms in_MPLS_charles_leq_2_pow_n
[PROOF STATE]
proof (prove)
using this:
finite PROB
\<lbrakk>finite ?PROB; ?x \<in> MPLS_charles ?PROB\<rbrakk> \<Longrightarrow> ?x \<le> 2 ^ card (prob_dom ?PROB) - 1

goal (1 subgoal):
 1. \<forall>x\<in>MPLS_charles PROB. x \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>MPLS_charles PROB. x \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. problem_plan_bound_charles PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>MPLS_charles PROB. x \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
have "MPLS_charles PROB \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>MPLS_charles PROB. x \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. MPLS_charles PROB \<noteq> {}
[PROOF STEP]
using assms bound_main_lemma_charles_3
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>MPLS_charles PROB. x \<le> 2 ^ card (prob_dom PROB) - 1
finite PROB
finite ?PROB \<Longrightarrow> MPLS_charles ?PROB \<noteq> {}

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

goal (1 subgoal):
 1. problem_plan_bound_charles PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
MPLS_charles PROB \<noteq> {}
[PROOF STEP]
have "Sup (MPLS_charles PROB) \<le> 2 ^ (card (prob_dom PROB)) - 1"
[PROOF STATE]
proof (prove)
using this:
MPLS_charles PROB \<noteq> {}

goal (1 subgoal):
 1. Sup (MPLS_charles PROB) \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
using 1 bound_main_lemma_2
[PROOF STATE]
proof (prove)
using this:
MPLS_charles PROB \<noteq> {}
\<forall>x\<in>MPLS_charles PROB. x \<le> 2 ^ card (prob_dom PROB) - 1
?s \<noteq> {} \<and> (\<forall>x. x \<in> ?s \<longrightarrow> x \<le> ?k) \<Longrightarrow> Sup ?s \<le> ?k

goal (1 subgoal):
 1. Sup (MPLS_charles PROB) \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
by meson
[PROOF STATE]
proof (state)
this:
Sup (MPLS_charles PROB) \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. problem_plan_bound_charles PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sup (MPLS_charles PROB) \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sup (MPLS_charles PROB) \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. problem_plan_bound_charles PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
using problem_plan_bound_charles_def
[PROOF STATE]
proof (prove)
using this:
Sup (MPLS_charles PROB) \<le> 2 ^ card (prob_dom PROB) - 1
problem_plan_bound_charles ?PROB \<equiv> Sup (MPLS_charles ?PROB)

goal (1 subgoal):
 1. problem_plan_bound_charles PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
problem_plan_bound_charles PROB \<le> 2 ^ card (prob_dom PROB) - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_list_length_card_dom_map_of_concat:
  assumes "ht_hash l"
  assumes "ht_distinct l"
  shows "sum_list (map length l) = card (dom (map_of (concat l)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map length l) = card (dom (map_of (concat l)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ht_hash l
ht_distinct l

goal (1 subgoal):
 1. sum_list (map length l) = card (dom (map_of (concat l)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>ht_hash l; ht_distinct l\<rbrakk> \<Longrightarrow> sum_list (map length l) = card (dom (map_of (concat l)))
[PROOF STEP]
from ht_hash_dom_map_of_disj_drop[OF assms(1)]
[PROOF STATE]
proof (chain)
picking this:
?i < length l \<Longrightarrow> dom (map_of (l ! ?i)) \<inter> dom (map_of (concat (drop (Suc ?i) l))) = {}
[PROOF STEP]
have "\<forall>i. i < length l
    \<longrightarrow> dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l)))
        = {}"
[PROOF STATE]
proof (prove)
using this:
?i < length l \<Longrightarrow> dom (map_of (l ! ?i)) \<inter> dom (map_of (concat (drop (Suc ?i) l))) = {}

goal (1 subgoal):
 1. \<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}

goal (1 subgoal):
 1. \<lbrakk>ht_hash l; ht_distinct l\<rbrakk> \<Longrightarrow> sum_list (map length l) = card (dom (map_of (concat l)))
[PROOF STEP]
with assms(2)
[PROOF STATE]
proof (chain)
picking this:
ht_distinct l
\<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ht_distinct l
\<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}

goal (1 subgoal):
 1. sum_list (map length l) = card (dom (map_of (concat l)))
[PROOF STEP]
proof (induct l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>ht_distinct []; \<forall>i<length []. dom (map_of ([] ! i)) \<inter> dom (map_of (concat (drop (Suc i) []))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length []) = card (dom (map_of (concat [])))
 2. \<And>a l. \<lbrakk>\<lbrakk>ht_distinct l; \<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length l) = card (dom (map_of (concat l))); ht_distinct (a # l); \<forall>i<length (a # l). dom (map_of ((a # l) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (a # l)))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length (a # l)) = card (dom (map_of (concat (a # l))))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
ht_distinct []
\<forall>i<length []. dom (map_of ([] ! i)) \<inter> dom (map_of (concat (drop (Suc i) []))) = {}

goal (2 subgoals):
 1. \<lbrakk>ht_distinct []; \<forall>i<length []. dom (map_of ([] ! i)) \<inter> dom (map_of (concat (drop (Suc i) []))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length []) = card (dom (map_of (concat [])))
 2. \<And>a l. \<lbrakk>\<lbrakk>ht_distinct l; \<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length l) = card (dom (map_of (concat l))); ht_distinct (a # l); \<forall>i<length (a # l). dom (map_of ((a # l) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (a # l)))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length (a # l)) = card (dom (map_of (concat (a # l))))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
ht_distinct []
\<forall>i<length []. dom (map_of ([] ! i)) \<inter> dom (map_of (concat (drop (Suc i) []))) = {}

goal (1 subgoal):
 1. sum_list (map length []) = card (dom (map_of (concat [])))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (map length []) = card (dom (map_of (concat [])))

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>ht_distinct l; \<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length l) = card (dom (map_of (concat l))); ht_distinct (a # l); \<forall>i<length (a # l). dom (map_of ((a # l) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (a # l)))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length (a # l)) = card (dom (map_of (concat (a # l))))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>ht_distinct l; \<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length l) = card (dom (map_of (concat l))); ht_distinct (a # l); \<forall>i<length (a # l). dom (map_of ((a # l) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (a # l)))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length (a # l)) = card (dom (map_of (concat (a # l))))
[PROOF STEP]
case (Cons l ls)
[PROOF STATE]
proof (state)
this:
\<lbrakk>ht_distinct ls; \<forall>i<length ls. dom (map_of (ls ! i)) \<inter> dom (map_of (concat (drop (Suc i) ls))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length ls) = card (dom (map_of (concat ls)))
ht_distinct (l # ls)
\<forall>i<length (l # ls). dom (map_of ((l # ls) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (l # ls)))) = {}

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>ht_distinct l; \<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length l) = card (dom (map_of (concat l))); ht_distinct (a # l); \<forall>i<length (a # l). dom (map_of ((a # l) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (a # l)))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length (a # l)) = card (dom (map_of (concat (a # l))))
[PROOF STEP]
from Cons(2)
[PROOF STATE]
proof (chain)
picking this:
ht_distinct (l # ls)
[PROOF STEP]
have a: "ht_distinct ls"
[PROOF STATE]
proof (prove)
using this:
ht_distinct (l # ls)

goal (1 subgoal):
 1. ht_distinct ls
[PROOF STEP]
by (auto simp add: ht_distinct_def)
[PROOF STATE]
proof (state)
this:
ht_distinct ls

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>ht_distinct l; \<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length l) = card (dom (map_of (concat l))); ht_distinct (a # l); \<forall>i<length (a # l). dom (map_of ((a # l) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (a # l)))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length (a # l)) = card (dom (map_of (concat (a # l))))
[PROOF STEP]
from Cons(3)
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<length (l # ls). dom (map_of ((l # ls) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (l # ls)))) = {}
[PROOF STEP]
have b: "\<forall>i < length ls. dom (map_of (ls ! i))
      \<inter> dom (map_of (concat (drop (Suc i) ls))) = {}"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length (l # ls). dom (map_of ((l # ls) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (l # ls)))) = {}

goal (1 subgoal):
 1. \<forall>i<length ls. dom (map_of (ls ! i)) \<inter> dom (map_of (concat (drop (Suc i) ls))) = {}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<Suc (length ls). dom (map_of ((l # ls) ! i)) \<inter> dom (map_of (concat (drop i ls))) = {} \<Longrightarrow> \<forall>i<length ls. dom (map_of (ls ! i)) \<inter> dom (map_of (concat (drop (Suc i) ls))) = {}
[PROOF STEP]
apply (rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<forall>i<Suc (length ls). dom (map_of ((l # ls) ! i)) \<inter> dom (map_of (concat (drop i ls))) = {} \<Longrightarrow> i < length ls \<longrightarrow> dom (map_of (ls ! i)) \<inter> dom (map_of (concat (drop (Suc i) ls))) = {}
[PROOF STEP]
apply (rule_tac x="Suc i" and P="(\<lambda>i. i<Suc (length ls) \<longrightarrow>
             dom (map_of ((l # ls) ! i)) \<inter> dom (map_of (concat (drop i ls))) =
             {})" in allE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. \<forall>i<Suc (length ls). dom (map_of ((l # ls) ! i)) \<inter> dom (map_of (concat (drop i ls))) = {} \<Longrightarrow> \<forall>x<Suc (length ls). dom (map_of ((l # ls) ! x)) \<inter> dom (map_of (concat (drop x ls))) = {}
 2. \<And>i. \<lbrakk>\<forall>i<Suc (length ls). dom (map_of ((l # ls) ! i)) \<inter> dom (map_of (concat (drop i ls))) = {}; Suc i < Suc (length ls) \<longrightarrow> dom (map_of ((l # ls) ! Suc i)) \<inter> dom (map_of (concat (drop (Suc i) ls))) = {}\<rbrakk> \<Longrightarrow> i < length ls \<longrightarrow> dom (map_of (ls ! i)) \<inter> dom (map_of (concat (drop (Suc i) ls))) = {}
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
\<forall>i<length ls. dom (map_of (ls ! i)) \<inter> dom (map_of (concat (drop (Suc i) ls))) = {}

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>ht_distinct l; \<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length l) = card (dom (map_of (concat l))); ht_distinct (a # l); \<forall>i<length (a # l). dom (map_of ((a # l) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (a # l)))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length (a # l)) = card (dom (map_of (concat (a # l))))
[PROOF STEP]
from Cons(2)
[PROOF STATE]
proof (chain)
picking this:
ht_distinct (l # ls)
[PROOF STEP]
have "distinct (map fst l)"
[PROOF STATE]
proof (prove)
using this:
ht_distinct (l # ls)

goal (1 subgoal):
 1. distinct (map fst l)
[PROOF STEP]
by (auto simp add: ht_distinct_def)
[PROOF STATE]
proof (state)
this:
distinct (map fst l)

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>ht_distinct l; \<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length l) = card (dom (map_of (concat l))); ht_distinct (a # l); \<forall>i<length (a # l). dom (map_of ((a # l) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (a # l)))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length (a # l)) = card (dom (map_of (concat (a # l))))
[PROOF STEP]
note l = length_card_dom_map_of[OF this]
[PROOF STATE]
proof (state)
this:
length l = card (dom (map_of l))

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>ht_distinct l; \<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length l) = card (dom (map_of (concat l))); ht_distinct (a # l); \<forall>i<length (a # l). dom (map_of ((a # l) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (a # l)))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length (a # l)) = card (dom (map_of (concat (a # l))))
[PROOF STEP]
from Cons(3)
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<length (l # ls). dom (map_of ((l # ls) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (l # ls)))) = {}
[PROOF STEP]
have c: "dom (map_of l) \<inter> dom (map_of (concat ls)) = {}"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length (l # ls). dom (map_of ((l # ls) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (l # ls)))) = {}

goal (1 subgoal):
 1. dom (map_of l) \<inter> dom (map_of (concat ls)) = {}
[PROOF STEP]
apply (rule_tac x="0" and P="(\<lambda>i. i<Suc (length ls) \<longrightarrow>
             dom (map_of ((l # ls) ! i))
               \<inter> dom (map_of (concat (drop i ls)))
             = {})" in allE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>i<length (l # ls). dom (map_of ((l # ls) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (l # ls)))) = {} \<Longrightarrow> \<forall>x<Suc (length ls). dom (map_of ((l # ls) ! x)) \<inter> dom (map_of (concat (drop x ls))) = {}
 2. \<lbrakk>\<forall>i<length (l # ls). dom (map_of ((l # ls) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (l # ls)))) = {}; 0 < Suc (length ls) \<longrightarrow> dom (map_of ((l # ls) ! 0)) \<inter> dom (map_of (concat (drop 0 ls))) = {}\<rbrakk> \<Longrightarrow> dom (map_of l) \<inter> dom (map_of (concat ls)) = {}
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
dom (map_of l) \<inter> dom (map_of (concat ls)) = {}

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>ht_distinct l; \<forall>i<length l. dom (map_of (l ! i)) \<inter> dom (map_of (concat (drop (Suc i) l))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length l) = card (dom (map_of (concat l))); ht_distinct (a # l); \<forall>i<length (a # l). dom (map_of ((a # l) ! i)) \<inter> dom (map_of (concat (drop (Suc i) (a # l)))) = {}\<rbrakk> \<Longrightarrow> sum_list (map length (a # l)) = card (dom (map_of (concat (a # l))))
[PROOF STEP]
from Cons(1)[OF a b] l c
[PROOF STATE]
proof (chain)
picking this:
sum_list (map length ls) = card (dom (map_of (concat ls)))
length l = card (dom (map_of l))
dom (map_of l) \<inter> dom (map_of (concat ls)) = {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sum_list (map length ls) = card (dom (map_of (concat ls)))
length l = card (dom (map_of l))
dom (map_of l) \<inter> dom (map_of (concat ls)) = {}

goal (1 subgoal):
 1. sum_list (map length (l # ls)) = card (dom (map_of (concat (l # ls))))
[PROOF STEP]
by (simp add: card_Un_disjoint)
[PROOF STATE]
proof (state)
this:
sum_list (map length (l # ls)) = card (dom (map_of (concat (l # ls))))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum_list (map length l) = card (dom (map_of (concat l)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_imp_iff: "eventually (\<lambda>x. P x \<longrightarrow> Q x) F \<longleftrightarrow> (eventually P F \<longrightarrow> eventually Q F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<^sub>F x in F. P x \<longrightarrow> Q x) = (eventually P F \<longrightarrow> eventually Q F)
[PROOF STEP]
using frequently_imp_iff[of P Q F]
[PROOF STATE]
proof (prove)
using this:
(\<exists>\<^sub>F x in F. P x \<longrightarrow> Q x) = (eventually P F \<longrightarrow> frequently Q F)

goal (1 subgoal):
 1. (\<forall>\<^sub>F x in F. P x \<longrightarrow> Q x) = (eventually P F \<longrightarrow> eventually Q F)
[PROOF STEP]
by (simp add: frequently_eq_eventually)


[STATEMENT]
lemma split_list_first_prop_iff:
  "(\<exists>x \<in> set xs. P x) \<longleftrightarrow>
   (\<exists>ys x zs. xs = ys@x#zs \<and> P x \<and> (\<forall>y \<in> set ys. \<not> P y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x\<in>set xs. P x) = (\<exists>ys x zs. xs = ys @ x # zs \<and> P x \<and> (\<forall>y\<in>set ys. \<not> P y))
[PROOF STEP]
by (rule, erule split_list_first_prop) auto


[STATEMENT]
lemma poincare_distance_eq_0_iff:
  assumes "u \<in> unit_disc" and "v \<in> unit_disc"
  shows "poincare_distance u v = 0 \<longleftrightarrow> u = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poincare_distance u v = 0) = (u = v)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc

goal (1 subgoal):
 1. (poincare_distance u v = 0) = (u = v)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> unit_disc; v \<in> unit_disc; poincare_distance u v = 0\<rbrakk> \<Longrightarrow> u = v
[PROOF STEP]
using poincare_distance_formula'_ge_1[OF assms]
[PROOF STATE]
proof (prove)
using this:
1 \<le> poincare_distance_formula' (to_complex u) (to_complex v)

goal (1 subgoal):
 1. \<lbrakk>u \<in> unit_disc; v \<in> unit_disc; poincare_distance u v = 0\<rbrakk> \<Longrightarrow> u = v
[PROOF STEP]
using unit_disc_cmod_square_lt_1[OF assms(1)] unit_disc_cmod_square_lt_1[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
1 \<le> poincare_distance_formula' (to_complex u) (to_complex v)
(cmod (to_complex u))\<^sup>2 < 1
(cmod (to_complex v))\<^sup>2 < 1

goal (1 subgoal):
 1. \<lbrakk>u \<in> unit_disc; v \<in> unit_disc; poincare_distance u v = 0\<rbrakk> \<Longrightarrow> u = v
[PROOF STEP]
unfolding poincare_distance_formula[OF assms(1) assms(2)]
[PROOF STATE]
proof (prove)
using this:
1 \<le> poincare_distance_formula' (to_complex u) (to_complex v)
(cmod (to_complex u))\<^sup>2 < 1
(cmod (to_complex v))\<^sup>2 < 1

goal (1 subgoal):
 1. \<lbrakk>u \<in> unit_disc; v \<in> unit_disc; poincare_distance_formula (to_complex u) (to_complex v) = 0\<rbrakk> \<Longrightarrow> u = v
[PROOF STEP]
unfolding poincare_distance_formula_def
[PROOF STATE]
proof (prove)
using this:
1 \<le> poincare_distance_formula' (to_complex u) (to_complex v)
(cmod (to_complex u))\<^sup>2 < 1
(cmod (to_complex v))\<^sup>2 < 1

goal (1 subgoal):
 1. \<lbrakk>u \<in> unit_disc; v \<in> unit_disc; arcosh (poincare_distance_formula' (to_complex u) (to_complex v)) = 0\<rbrakk> \<Longrightarrow> u = v
[PROOF STEP]
unfolding poincare_distance_formula'_def
[PROOF STATE]
proof (prove)
using this:
1 \<le> 1 + 2 * ((cmod (to_complex u - to_complex v))\<^sup>2 / ((1 - (cmod (to_complex u))\<^sup>2) * (1 - (cmod (to_complex v))\<^sup>2)))
(cmod (to_complex u))\<^sup>2 < 1
(cmod (to_complex v))\<^sup>2 < 1

goal (1 subgoal):
 1. \<lbrakk>u \<in> unit_disc; v \<in> unit_disc; arcosh (1 + 2 * ((cmod (to_complex u - to_complex v))\<^sup>2 / ((1 - (cmod (to_complex u))\<^sup>2) * (1 - (cmod (to_complex v))\<^sup>2)))) = 0\<rbrakk> \<Longrightarrow> u = v
[PROOF STEP]
apply (subst (asm) arcosh_eq_0_iff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>1 \<le> 1 + 2 * ((cmod (to_complex u - to_complex v))\<^sup>2 / ((1 - (cmod (to_complex u))\<^sup>2) * (1 - (cmod (to_complex v))\<^sup>2))); (cmod (to_complex u))\<^sup>2 < 1; (cmod (to_complex v))\<^sup>2 < 1; u \<in> unit_disc; v \<in> unit_disc\<rbrakk> \<Longrightarrow> 1 \<le> 1 + 2 * ((cmod (to_complex u - to_complex v))\<^sup>2 / ((1 - (cmod (to_complex u))\<^sup>2) * (1 - (cmod (to_complex v))\<^sup>2)))
 2. \<lbrakk>u \<in> unit_disc; v \<in> unit_disc; 1 + 2 * ((cmod (to_complex u - to_complex v))\<^sup>2 / ((1 - (cmod (to_complex u))\<^sup>2) * (1 - (cmod (to_complex v))\<^sup>2))) = 1; 1 \<le> 1 + 2 * ((cmod (to_complex u - to_complex v))\<^sup>2 / ((1 - (cmod (to_complex u))\<^sup>2) * (1 - (cmod (to_complex v))\<^sup>2))); (cmod (to_complex u))\<^sup>2 < 1; (cmod (to_complex v))\<^sup>2 < 1\<rbrakk> \<Longrightarrow> u = v
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> unit_disc; v \<in> unit_disc; 1 + 2 * ((cmod (to_complex u - to_complex v))\<^sup>2 / ((1 - (cmod (to_complex u))\<^sup>2) * (1 - (cmod (to_complex v))\<^sup>2))) = 1; 1 \<le> 1 + 2 * ((cmod (to_complex u - to_complex v))\<^sup>2 / ((1 - (cmod (to_complex u))\<^sup>2) * (1 - (cmod (to_complex v))\<^sup>2))); (cmod (to_complex u))\<^sup>2 < 1; (cmod (to_complex v))\<^sup>2 < 1\<rbrakk> \<Longrightarrow> u = v
[PROOF STEP]
apply (simp add: unit_disc_to_complex_inj)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma state_qbit_norm_sq:
  assumes "v\<in> state_qbit n"
  shows "(cpx_vec_length v)\<^sup>2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>v\<parallel>\<^sup>2 = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<parallel>v\<parallel>\<^sup>2 = 1
[PROOF STEP]
have "cpx_vec_length v = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>v\<parallel> = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<in> state_qbit n

goal (1 subgoal):
 1. \<parallel>v\<parallel> = 1
[PROOF STEP]
unfolding state_qbit_def
[PROOF STATE]
proof (prove)
using this:
v \<in> {v |v. dim_vec v = 2 ^ n \<and> \<parallel>v\<parallel> = 1}

goal (1 subgoal):
 1. \<parallel>v\<parallel> = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<parallel>v\<parallel> = 1

goal (1 subgoal):
 1. \<parallel>v\<parallel>\<^sup>2 = 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<parallel>v\<parallel> = 1

goal (1 subgoal):
 1. \<parallel>v\<parallel>\<^sup>2 = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<parallel>v\<parallel>\<^sup>2 = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_compl_induct'[case_names 0 Suc]: "\<lbrakk>P 0; !! n . \<lbrakk>!! nn . nn \<le> n \<Longrightarrow> P nn\<rbrakk> \<Longrightarrow> P (Suc n)\<rbrakk> \<Longrightarrow> P n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P 0; \<And>n. (\<And>nn. nn \<le> n \<Longrightarrow> P nn) \<Longrightarrow> P (Suc n)\<rbrakk> \<Longrightarrow> P n
[PROOF STEP]
apply(induct_tac n rule: nat_less_induct)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>P 0; \<And>n. (\<And>nn. nn \<le> n \<Longrightarrow> P nn) \<Longrightarrow> P (Suc n); \<forall>m<n. P m\<rbrakk> \<Longrightarrow> P n
[PROOF STEP]
apply(case_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>P 0; \<And>n. (\<And>nn. nn \<le> n \<Longrightarrow> P nn) \<Longrightarrow> P (Suc n); \<forall>m<n. P m; n = 0\<rbrakk> \<Longrightarrow> P n
 2. \<And>n nat. \<lbrakk>P 0; \<And>n. (\<And>nn. nn \<le> n \<Longrightarrow> P nn) \<Longrightarrow> P (Suc n); \<forall>m<n. P m; n = Suc nat\<rbrakk> \<Longrightarrow> P n
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma prob_neg_binomial_pmf_lessThan:
  assumes p: "p \<in> {0<..1}"
  shows "measure_pmf.prob (neg_binomial_pmf n p) {..<k} =
         measure_pmf.prob (binomial_pmf (n + k - 1) (1 - p)) {..<k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (neg_binomial_pmf n p) {..<k} = measure_pmf.prob (binomial_pmf (n + k - 1) (1 - p)) {..<k}
[PROOF STEP]
proof (cases "k = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = 0 \<Longrightarrow> measure_pmf.prob (neg_binomial_pmf n p) {..<k} = measure_pmf.prob (binomial_pmf (n + k - 1) (1 - p)) {..<k}
 2. k \<noteq> 0 \<Longrightarrow> measure_pmf.prob (neg_binomial_pmf n p) {..<k} = measure_pmf.prob (binomial_pmf (n + k - 1) (1 - p)) {..<k}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
k \<noteq> 0

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> measure_pmf.prob (neg_binomial_pmf n p) {..<k} = measure_pmf.prob (binomial_pmf (n + k - 1) (1 - p)) {..<k}
 2. k \<noteq> 0 \<Longrightarrow> measure_pmf.prob (neg_binomial_pmf n p) {..<k} = measure_pmf.prob (binomial_pmf (n + k - 1) (1 - p)) {..<k}
[PROOF STEP]
hence "{..<k} = {..k-1}"
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0

goal (1 subgoal):
 1. {..<k} = {..k - 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..<k} = {..k - 1}

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> measure_pmf.prob (neg_binomial_pmf n p) {..<k} = measure_pmf.prob (binomial_pmf (n + k - 1) (1 - p)) {..<k}
 2. k \<noteq> 0 \<Longrightarrow> measure_pmf.prob (neg_binomial_pmf n p) {..<k} = measure_pmf.prob (binomial_pmf (n + k - 1) (1 - p)) {..<k}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{..<k} = {..k - 1}

goal (1 subgoal):
 1. measure_pmf.prob (neg_binomial_pmf n p) {..<k} = measure_pmf.prob (binomial_pmf (n + k - 1) (1 - p)) {..<k}
[PROOF STEP]
using prob_neg_binomial_pmf_atMost[OF p, of n "k - 1"] False
[PROOF STATE]
proof (prove)
using this:
{..<k} = {..k - 1}
measure_pmf.prob (neg_binomial_pmf n p) {..k - 1} = measure_pmf.prob (binomial_pmf (n + (k - 1)) (1 - p)) {..k - 1}
k \<noteq> 0

goal (1 subgoal):
 1. measure_pmf.prob (neg_binomial_pmf n p) {..<k} = measure_pmf.prob (binomial_pmf (n + k - 1) (1 - p)) {..<k}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (neg_binomial_pmf n p) {..<k} = measure_pmf.prob (binomial_pmf (n + k - 1) (1 - p)) {..<k}

goal (1 subgoal):
 1. k = 0 \<Longrightarrow> measure_pmf.prob (neg_binomial_pmf n p) {..<k} = measure_pmf.prob (binomial_pmf (n + k - 1) (1 - p)) {..<k}
[PROOF STEP]
qed auto


[STATEMENT]
lemma mult_mm_cancel_l:
  assumes "mat_det M \<noteq> 0"  "M *\<^sub>m\<^sub>m A = M *\<^sub>m\<^sub>m B"
  shows "A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mat_det M \<noteq> 0
M *\<^sub>m\<^sub>m A = M *\<^sub>m\<^sub>m B

goal (1 subgoal):
 1. A = B
[PROOF STEP]
by (metis mult_mm_inv_l)


[STATEMENT]
lemma product_sigma_finite_interval: "product_sigma_finite (\<lambda>b. interval_measure (\<lambda>x. x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. product_sigma_finite (\<lambda>b. interval_measure (\<lambda>x. x))
[PROOF STEP]
unfolding product_sigma_finite_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. sigma_finite_measure (interval_measure (\<lambda>x. x))
[PROOF STEP]
using  sigma_finite_interval_measure
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> ?F x \<le> ?F y; \<And>a. continuous (at_right a) ?F\<rbrakk> \<Longrightarrow> sigma_finite_measure (interval_measure ?F)

goal (1 subgoal):
 1. \<forall>i. sigma_finite_measure (interval_measure (\<lambda>x. x))
[PROOF STEP]
by auto


[STATEMENT]
lemma prime_multiplicity_other:
  assumes "prime p" "prime q" "p \<noteq> q"
  shows   "multiplicity p q = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p q = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
prime q
p \<noteq> q

goal (1 subgoal):
 1. multiplicity p q = 0
[PROOF STEP]
by (subst prime_elem_multiplicity_eq_zero_iff) (auto dest: primes_dvd_imp_eq)


[STATEMENT]
lemma quat_eqI [intro?]: "\<lbrakk>Re x = Re y; Im1 x = Im1 y; Im2 x = Im2 y; Im3 x = Im3 y\<rbrakk> \<Longrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>quat.Re x = quat.Re y; Im1 x = Im1 y; Im2 x = Im2 y; Im3 x = Im3 y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
by (rule quat.expand) simp


[STATEMENT]
lemma Suffixes_union [simp]: "Suffixes (A \<union> B) = Suffixes A \<union> Suffixes B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suffixes (A \<union> B) = Suffixes A \<union> Suffixes B
[PROOF STEP]
by (auto simp: Suffixes_def)


[STATEMENT]
lemma quadratic_poly_eval:
  fixes a b c::"real"
  fixes x::"real"
  shows "poly [:c, b, a:] x = a*x^2 + b*x + c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly [:c, b, a:] x = a * x\<^sup>2 + b * x + c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly [:c, b, a:] x = a * x\<^sup>2 + b * x + c
[PROOF STEP]
have "x * (b + x * a) = a * x\<^sup>2 + b * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (b + x * a) = a * x\<^sup>2 + b * x
[PROOF STEP]
by (metis add.commute distrib_right mult.assoc mult.commute power2_eq_square)
[PROOF STATE]
proof (state)
this:
x * (b + x * a) = a * x\<^sup>2 + b * x

goal (1 subgoal):
 1. poly [:c, b, a:] x = a * x\<^sup>2 + b * x + c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x * (b + x * a) = a * x\<^sup>2 + b * x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * (b + x * a) = a * x\<^sup>2 + b * x

goal (1 subgoal):
 1. poly [:c, b, a:] x = a * x\<^sup>2 + b * x + c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly [:c, b, a:] x = a * x\<^sup>2 + b * x + c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_n_lists: "length (List.n_lists n xs) = length xs ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (List.n_lists n xs) = length xs ^ n
[PROOF STEP]
by (induct n) (auto simp add: comp_def length_concat sum_list_triv)


[STATEMENT]
theorem IK_nf_real_card:
  shows "card ((\<lambda> f. f RRR) ` {f . IK_nf f}) = 7"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>f. f RRR) ` {f. IK_nf f}) = 7
[PROOF STEP]
by (simp add: IK_nf_set) ((subst card_insert_disjoint; auto dest!: RRR_test simp: nf_RRR I_K id_def[symmetric] o_assoc)[1])+


[STATEMENT]
lemma card_gt0: "card (verts G) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < card (verts G)
[PROOF STEP]
using verts_nempty
[PROOF STATE]
proof (prove)
using this:
verts G \<noteq> {}

goal (1 subgoal):
 1. 0 < card (verts G)
[PROOF STEP]
by auto


[STATEMENT]
lemma exp_upper_taylor_even:
  fixes x::real
  assumes n: "even n"
      and pos: "(\<Sum>m<n. ((-x) ^ m) / (fact m)) > 0"  (is "?sum > 0")
    shows "exp x \<le> inverse ?sum"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp x \<le> inverse (\<Sum>m<n. (- x) ^ m / fact m)
[PROOF STEP]
using exp_lower_taylor_even [OF n, of "-x"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>m<n. (- x) ^ m / fact m) \<le> exp (- x)

goal (1 subgoal):
 1. exp x \<le> inverse (\<Sum>m<n. (- x) ^ m / fact m)
[PROOF STEP]
by (metis exp_minus inverse_inverse_eq le_imp_inverse_le pos)


[STATEMENT]
theorem finite_reachable: "finite(reachable c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (reachable c)
[PROOF STEP]
apply(induction c)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. finite (reachable SKIP)
 2. \<And>x1 x2. finite (reachable (x1 ::= x2))
 3. \<And>c1 c2. \<lbrakk>finite (reachable c1); finite (reachable c2)\<rbrakk> \<Longrightarrow> finite (reachable (c1;; c2))
 4. \<And>x1 c1 c2. \<lbrakk>finite (reachable c1); finite (reachable c2)\<rbrakk> \<Longrightarrow> finite (reachable (IF x1 THEN c1 ELSE c2))
 5. \<And>x1 c. finite (reachable c) \<Longrightarrow> finite (reachable (WHILE x1 DO c))
[PROOF STEP]
apply(auto simp: reachable_SKIP reachable_Assign
  finite_subset[OF reachable_Seq] finite_subset[OF reachable_If]
  finite_subset[OF reachable_While])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma matrix_inv_unique:
  assumes "A ** B = mat 1" and "B ** A = mat 1"
  shows "A\<^sup>-\<^sup>1 = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A\<^sup>-\<^sup>1 = B
[PROOF STEP]
by (metis assms invertibleD(2) invertibleI matrix_mul_assoc matrix_mul_lid)


[STATEMENT]
lemma InfCard_le_cmult_eq:
  assumes "InfCard \<kappa>" "\<mu> \<le> \<kappa>" "\<mu> \<noteq> 0"
  shows "\<kappa> \<otimes> \<mu> = \<kappa>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<kappa> \<otimes> \<mu> = \<kappa>
[PROOF STEP]
proof (rule order_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<kappa> \<otimes> \<mu> \<le> \<kappa>
 2. \<kappa> \<le> \<kappa> \<otimes> \<mu>
[PROOF STEP]
have "\<kappa> \<otimes> \<mu> \<le> \<kappa> \<otimes> \<kappa>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<kappa> \<otimes> \<mu> \<le> \<kappa> \<otimes> \<kappa>
[PROOF STEP]
by (simp add: assms(2) cmult_le_mono)
[PROOF STATE]
proof (state)
this:
\<kappa> \<otimes> \<mu> \<le> \<kappa> \<otimes> \<kappa>

goal (2 subgoals):
 1. \<kappa> \<otimes> \<mu> \<le> \<kappa>
 2. \<kappa> \<le> \<kappa> \<otimes> \<mu>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<kappa> \<otimes> \<mu> \<le> \<kappa> \<otimes> \<kappa>

goal (2 subgoals):
 1. \<kappa> \<otimes> \<mu> \<le> \<kappa>
 2. \<kappa> \<le> \<kappa> \<otimes> \<mu>
[PROOF STEP]
have "\<dots> \<le> \<kappa>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<kappa> \<otimes> \<kappa> \<le> \<kappa>
[PROOF STEP]
by (simp add: InfCard_csquare_eq assms(1))
[PROOF STATE]
proof (state)
this:
\<kappa> \<otimes> \<kappa> \<le> \<kappa>

goal (2 subgoals):
 1. \<kappa> \<otimes> \<mu> \<le> \<kappa>
 2. \<kappa> \<le> \<kappa> \<otimes> \<mu>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<kappa> \<otimes> \<mu> \<le> \<kappa>
[PROOF STEP]
show "\<kappa> \<otimes> \<mu> \<le> \<kappa>"
[PROOF STATE]
proof (prove)
using this:
\<kappa> \<otimes> \<mu> \<le> \<kappa>

goal (1 subgoal):
 1. \<kappa> \<otimes> \<mu> \<le> \<kappa>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<kappa> \<otimes> \<mu> \<le> \<kappa>

goal (1 subgoal):
 1. \<kappa> \<le> \<kappa> \<otimes> \<mu>
[PROOF STEP]
show "\<kappa> \<le> \<kappa> \<otimes> \<mu>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<kappa> \<le> \<kappa> \<otimes> \<mu>
[PROOF STEP]
using InfCard_def assms(1) assms(3) cmult_le_self
[PROOF STATE]
proof (prove)
using this:
InfCard ?\<kappa> \<equiv> Card ?\<kappa> \<and> \<omega> \<le> ?\<kappa>
InfCard \<kappa>
\<mu> \<noteq> 0
\<lbrakk>Card ?\<kappa>; ?\<alpha> \<noteq> 0\<rbrakk> \<Longrightarrow> ?\<kappa> \<le> ?\<kappa> \<otimes> ?\<alpha>

goal (1 subgoal):
 1. \<kappa> \<le> \<kappa> \<otimes> \<mu>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<kappa> \<le> \<kappa> \<otimes> \<mu>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem lehmers_theorem':
  fixes p :: nat
  assumes "list_all prime ps" "a \<equiv> a" "n \<equiv> n"
  assumes "list_all (\<lambda>p. mod_exp_nat a ((n - 1) div p) n \<noteq> 1) ps" "mod_exp_nat a (n - 1) n = 1"
  assumes "check_prime_factors_subset (n - 1) ps" "2 \<le> n"
  shows "prime n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime n
[PROOF STEP]
using assms check_prime_factors_subset_correct[OF assms(6,1)]
[PROOF STATE]
proof (prove)
using this:
list_all prime ps
a \<equiv> a
n \<equiv> n
list_all (\<lambda>p. mod_exp_nat a ((n - 1) div p) n \<noteq> 1) ps
mod_exp_nat a (n - 1) n = 1
check_prime_factors_subset (n - 1) ps
2 \<le> n
prime_factors (n - 1) \<subseteq> set ps

goal (1 subgoal):
 1. prime n
[PROOF STEP]
by (intro lehmers_theorem[where a = a]) (auto simp: cong_def mod_exp_nat_def list.pred_set)


[STATEMENT]
lemma foldr_True_set: "foldr (\<lambda>x. (\<and>) (f x)) l True = (\<forall>x \<in> set l. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>x. (\<and>) (f x)) l True = (\<forall>x\<in>set l. f x)
[PROOF STEP]
by (induction l) simp_all


[STATEMENT]
lemma gcard_image: "inj_on f X \<Longrightarrow> gcard (f ` X) = gcard X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f X \<Longrightarrow> gcard (f ` X) = gcard X
[PROOF STEP]
by (simp add: gcardinal_cong)


[STATEMENT]
lemma mult_minus_distrib_mat[algebra_simps]: fixes A :: "'a :: ring mat"
  assumes m: "A \<in> carrier_mat nr n" "B \<in> carrier_mat n nc" "C \<in> carrier_mat n nc"
  shows "A * (B - C) = A * B - A * C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * (B - C) = A * B - A * C
[PROOF STEP]
unfolding minus_add_uminus_mat[OF m(2,3)]
    mult_add_distrib_mat[OF m(1) m(2) uminus_carrier_mat[OF m(3)]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B + A * - C = A * B - A * C
[PROOF STEP]
by (subst uminus_mult_right_mat, insert m, auto)


[STATEMENT]
lemma sgn_scaleR: "sgn (scaleR r x) = scaleR (sgn r) (sgn x)"
  for x :: "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn (r *\<^sub>R x) = sgn r *\<^sub>R sgn x
[PROOF STEP]
by (simp add: sgn_div_norm ac_simps)


[STATEMENT]
lemma reachable_mono: "\<lbrakk>R\<subseteq>R'; X\<subseteq>X'\<rbrakk> \<Longrightarrow> R\<^sup>*``X \<subseteq> R'\<^sup>*``X'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R \<subseteq> R'; X \<subseteq> X'\<rbrakk> \<Longrightarrow> R\<^sup>* `` X \<subseteq> R'\<^sup>* `` X'
[PROOF STEP]
by (metis Image_mono rtrancl_mono)


[STATEMENT]
lemma Erdos_Rado_sunflower_card_core:
  assumes "finite E"
    and "\<forall> A \<in> F. A \<subseteq> E \<and> s \<le> card A \<and> card A \<le> k"
    and "card F > (card E choose s) * (r - 1)^k * fact k"
    and "s \<noteq> 0"
    and "r \<noteq> 0"
  shows "\<exists> S. S \<subseteq> F \<and> sunflower S \<and> card S = r \<and> card (\<Inter> S) \<ge> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> s \<le> card (\<Inter> S)
[PROOF STEP]
by (rule sunflower_card_core_lift[OF assms(1) _ assms(2) _ assms(4-5),
        of "(r - 1)^k * fact k"],
      rule Erdos_Rado_sunflower, insert assms(3), auto simp: ac_simps)


[STATEMENT]
lemma approximation_preproc_int[approximation_preproc]:
  "real_of_int 0 = real_of_float 0"
  "real_of_int 1 = real_of_float 1"
  "real_of_int (i + j) = real_of_int i + real_of_int j"
  "real_of_int (- i) = - real_of_int i"
  "real_of_int (i - j) = real_of_int i - real_of_int j"
  "real_of_int (i * j) = real_of_int i * real_of_int j"
  "real_of_int (i div j) = real_of_int (floor (real_of_int i / real_of_int j))"
  "real_of_int (min i j) = min (real_of_int i) (real_of_int j)"
  "real_of_int (max i j) = max (real_of_int i) (real_of_int j)"
  "real_of_int (abs i) = abs (real_of_int i)"
  "real_of_int (i ^ n) = (real_of_int i) ^ n"
  "real_of_int (numeral a) = real_of_float (numeral a)"
  "i mod j = i - i div j * j"
  "i = j \<longleftrightarrow> real_of_int i = real_of_int j"
  "i \<le> j \<longleftrightarrow> real_of_int i \<le> real_of_int j"
  "i < j \<longleftrightarrow> real_of_int i < real_of_int j"
  "i \<in> {j .. k} \<longleftrightarrow> real_of_int i \<in> {real_of_int j .. real_of_int k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((real_of_int 0 = real_of_float 0 &&& real_of_int 1 = real_of_float 1) &&& real_of_int (i + j) = real_of_int i + real_of_int j &&& real_of_int (- i) = - real_of_int i) &&& (real_of_int (i - j) = real_of_int i - real_of_int j &&& real_of_int (i * j) = real_of_int i * real_of_int j) &&& real_of_int (i div j) = real_of_int \<lfloor>real_of_int i / real_of_int j\<rfloor> &&& real_of_int (min i j) = min (real_of_int i) (real_of_int j)) &&& ((real_of_int (max i j) = max (real_of_int i) (real_of_int j) &&& real_of_int \<bar>i\<bar> = \<bar>real_of_int i\<bar>) &&& real_of_int (i ^ n) = real_of_int i ^ n &&& real_of_int (numeral a) = real_of_float (numeral a)) &&& (i mod j = i - i div j * j &&& (i = j) = (real_of_int i = real_of_int j)) &&& (i \<le> j) = (real_of_int i \<le> real_of_int j) &&& (i < j) = (real_of_int i < real_of_int j) &&& (i \<in> {j..k}) = (real_of_int i \<in> {real_of_int j..real_of_int k})
[PROOF STEP]
by (simp_all add: floor_divide_of_int_eq minus_div_mult_eq_mod [symmetric])


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


[STATEMENT]
lemma "(-4::int) * 2 = -8"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 4 * 2 = - 8
[PROOF STEP]
by normalization


[STATEMENT]
lemma ldeep_T_app: "ldeep_T f cf (xs@ys) = ldeep_T f cf xs * ldeep_T f cf ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ldeep_T f cf (xs @ ys) = ldeep_T f cf xs * ldeep_T f cf ys
[PROOF STEP]
using ldeep_T_def foldl_append ldeep_T'_eq_foldl
[PROOF STATE]
proof (prove)
using this:
ldeep_T ?sf ?cf ?xs = foldl (\<lambda>a b. a * ?cf b * ?sf b) 1 ?xs
foldl ?f ?a (?xs @ ?ys) = foldl ?f (foldl ?f ?a ?xs) ?ys
?acc * ldeep_T' ?f ?cf ?xs = foldl (\<lambda>a b. a * ?cf b * ?f b) ?acc ?xs

goal (1 subgoal):
 1. ldeep_T f cf (xs @ ys) = ldeep_T f cf xs * ldeep_T f cf ys
[PROOF STEP]
by (metis (mono_tags, lifting) monoid.left_neutral mult.monoid_axioms)


[STATEMENT]
lemma length_even_filter: "length [f i .  i <- (filter even [0..<l])] = l-l div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map f (filter even [0..<l])) = l - l div 2
[PROOF STEP]
by(induction l) auto


[STATEMENT]
lemma set_list_four: shows "{0..<4} = set [0,1,2,3::nat]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<4} = set [0, 1, 2, 3]
[PROOF STEP]
by auto


[STATEMENT]
lemma pow_int_mult: "pow_int (x * y) a = pow_int x a * pow_int y a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pow_int (x * y) a = pow_int x a * pow_int y a
[PROOF STEP]
unfolding pow_int_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if a < 0 then (1::'a) / (x * y) ^ nat (- a) else (x * y) ^ nat a) = (if a < 0 then (1::'a) / x ^ nat (- a) else x ^ nat a) * (if a < 0 then (1::'a) / y ^ nat (- a) else y ^ nat a)
[PROOF STEP]
by (cases "a < 0", auto simp: power_mult_distrib)


[STATEMENT]
theorem sort_quicksort:
  "sort = quicksort"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sort = quicksort
[PROOF STEP]
by (rule ext, rule properties_for_sort) (fact quicksort_permutes sorted_quicksort)+


[STATEMENT]
lemma bounded_dist_le_SUP_dist:
  "bounded (range f) \<Longrightarrow> bounded (range g) \<Longrightarrow> dist (f x) (g x) \<le> (SUP x. dist (f x) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bounded (range f); bounded (range g)\<rbrakk> \<Longrightarrow> dist (f x) (g x) \<le> (\<Squnion>x. dist (f x) (g x))
[PROOF STEP]
by (auto intro!: cSUP_upper bounded_imp_bdd_above bounded_dist_comp)


[STATEMENT]
lemma Nonce_supply3: "\<exists>N N' N''. Nonce N \<notin> used evs & Nonce N' \<notin> used evs' &
                    Nonce N'' \<notin> used evs'' & N \<noteq> N' & N' \<noteq> N'' & N \<noteq> N''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N N' N''. Nonce N \<notin> used evs \<and> Nonce N' \<notin> used evs' \<and> Nonce N'' \<notin> used evs'' \<and> N \<noteq> N' \<and> N' \<noteq> N'' \<and> N \<noteq> N''
[PROOF STEP]
apply (cut_tac evs = evs in finite.emptyI [THEN Nonce_supply_ax])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. N \<notin> {} \<and> Nonce N \<notin> used evs \<Longrightarrow> \<exists>N N' N''. Nonce N \<notin> used evs \<and> Nonce N' \<notin> used evs' \<and> Nonce N'' \<notin> used evs'' \<and> N \<noteq> N' \<and> N' \<noteq> N'' \<and> N \<noteq> N''
[PROOF STEP]
apply (erule exE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>N. N \<notin> {} \<and> Nonce N \<notin> used evs \<Longrightarrow> \<exists>N N' N''. Nonce N \<notin> used evs \<and> Nonce N' \<notin> used evs' \<and> Nonce N'' \<notin> used evs'' \<and> N \<noteq> N' \<and> N' \<noteq> N'' \<and> N \<noteq> N''
[PROOF STEP]
apply (cut_tac evs = evs' and a1 = N in finite.emptyI [THEN finite.insertI, THEN Nonce_supply_ax])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>N. \<lbrakk>N \<notin> {} \<and> Nonce N \<notin> used evs; \<exists>Na. Na \<notin> {N} \<and> Nonce Na \<notin> used evs'\<rbrakk> \<Longrightarrow> \<exists>N N' N''. Nonce N \<notin> used evs \<and> Nonce N' \<notin> used evs' \<and> Nonce N'' \<notin> used evs'' \<and> N \<noteq> N' \<and> N' \<noteq> N'' \<and> N \<noteq> N''
[PROOF STEP]
apply (erule exE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>N Na. \<lbrakk>N \<notin> {} \<and> Nonce N \<notin> used evs; Na \<notin> {N} \<and> Nonce Na \<notin> used evs'\<rbrakk> \<Longrightarrow> \<exists>N N' N''. Nonce N \<notin> used evs \<and> Nonce N' \<notin> used evs' \<and> Nonce N'' \<notin> used evs'' \<and> N \<noteq> N' \<and> N' \<noteq> N'' \<and> N \<noteq> N''
[PROOF STEP]
apply (cut_tac evs = evs'' and a1 = Na and a2 = N in finite.emptyI [THEN finite.insertI, THEN finite.insertI, THEN Nonce_supply_ax])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>N Na. \<lbrakk>N \<notin> {} \<and> Nonce N \<notin> used evs; Na \<notin> {N} \<and> Nonce Na \<notin> used evs'; \<exists>Nb. Nb \<notin> {Na, N} \<and> Nonce Nb \<notin> used evs''\<rbrakk> \<Longrightarrow> \<exists>N N' N''. Nonce N \<notin> used evs \<and> Nonce N' \<notin> used evs' \<and> Nonce N'' \<notin> used evs'' \<and> N \<noteq> N' \<and> N' \<noteq> N'' \<and> N \<noteq> N''
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in prob_space) erlang_distributed_le:
  assumes D: "distributed M lborel X (erlang_density k l)"
  assumes [simp, arith]: "0 < l" "0 \<le> a"
  shows "\<P>(x in M. X x \<le> a) = erlang_CDF k l a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {x \<in> space M. X x \<le> a} = erlang_CDF k l a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prob {x \<in> space M. X x \<le> a} = erlang_CDF k l a
[PROOF STEP]
have "emeasure M {x \<in> space M. X x \<le> a } = emeasure (distr M lborel X) {.. a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M {x \<in> space M. X x \<le> a} = emeasure (distr M lborel X) {..a}
[PROOF STEP]
using distributed_measurable[OF D]
[PROOF STATE]
proof (prove)
using this:
random_variable lborel X

goal (1 subgoal):
 1. emeasure M {x \<in> space M. X x \<le> a} = emeasure (distr M lborel X) {..a}
[PROOF STEP]
by (subst emeasure_distr) (auto intro!: arg_cong2[where f=emeasure])
[PROOF STATE]
proof (state)
this:
emeasure M {x \<in> space M. X x \<le> a} = emeasure (distr M lborel X) {..a}

goal (1 subgoal):
 1. prob {x \<in> space M. X x \<le> a} = erlang_CDF k l a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M {x \<in> space M. X x \<le> a} = emeasure (distr M lborel X) {..a}

goal (1 subgoal):
 1. prob {x \<in> space M. X x \<le> a} = erlang_CDF k l a
[PROOF STEP]
have "\<dots> = emeasure (density lborel (erlang_density k l)) {.. a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (distr M lborel X) {..a} = emeasure (density lborel (\<lambda>x. ennreal (erlang_density k l x))) {..a}
[PROOF STEP]
unfolding distributed_distr_eq_density[OF D]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (density lborel (\<lambda>x. ennreal (erlang_density k l x))) {..a} = emeasure (density lborel (\<lambda>x. ennreal (erlang_density k l x))) {..a}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
emeasure (distr M lborel X) {..a} = emeasure (density lborel (\<lambda>x. ennreal (erlang_density k l x))) {..a}

goal (1 subgoal):
 1. prob {x \<in> space M. X x \<le> a} = erlang_CDF k l a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure (distr M lborel X) {..a} = emeasure (density lborel (\<lambda>x. ennreal (erlang_density k l x))) {..a}

goal (1 subgoal):
 1. prob {x \<in> space M. X x \<le> a} = erlang_CDF k l a
[PROOF STEP]
have "\<dots> = erlang_CDF k l a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (density lborel (\<lambda>x. ennreal (erlang_density k l x))) {..a} = ennreal (erlang_CDF k l a)
[PROOF STEP]
by (auto intro!: emeasure_erlang_density)
[PROOF STATE]
proof (state)
this:
emeasure (density lborel (\<lambda>x. ennreal (erlang_density k l x))) {..a} = ennreal (erlang_CDF k l a)

goal (1 subgoal):
 1. prob {x \<in> space M. X x \<le> a} = erlang_CDF k l a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure M {x \<in> space M. X x \<le> a} = ennreal (erlang_CDF k l a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure M {x \<in> space M. X x \<le> a} = ennreal (erlang_CDF k l a)

goal (1 subgoal):
 1. prob {x \<in> space M. X x \<le> a} = erlang_CDF k l a
[PROOF STEP]
by (auto simp: emeasure_eq_measure measure_nonneg)
[PROOF STATE]
proof (state)
this:
prob {x \<in> space M. X x \<le> a} = erlang_CDF k l a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_Inv_tri_ineq:
  "dist_perm xs ys \<Longrightarrow> dist_perm ys zs \<Longrightarrow>
  card (Inv xs zs) \<le> card(Inv xs ys) + card (Inv ys zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dist_perm xs ys; dist_perm ys zs\<rbrakk> \<Longrightarrow> card (Inv xs zs) \<le> card (Inv xs ys) + card (Inv ys zs)
[PROOF STEP]
using card_mono[OF _ Inv_tri_ineq[of xs ys zs]]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (Inv xs ys \<union> Inv ys zs); dist_perm xs ys; dist_perm ys zs\<rbrakk> \<Longrightarrow> card (Inv xs zs) \<le> card (Inv xs ys \<union> Inv ys zs)

goal (1 subgoal):
 1. \<lbrakk>dist_perm xs ys; dist_perm ys zs\<rbrakk> \<Longrightarrow> card (Inv xs zs) \<le> card (Inv xs ys) + card (Inv ys zs)
[PROOF STEP]
by auto (metis card_Un_Int finite_Invs trans_le_add1)


[STATEMENT]
lemma floor_minus_divide_eq_div_numeral [simp]:
  "\<lfloor>- (numeral a / numeral b)::real\<rfloor> = - numeral a div numeral b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>- (numeral a / numeral b)\<rfloor> = - numeral a div numeral b
[PROOF STEP]
by (metis divide_minus_left floor_divide_of_int_eq of_int_neg_numeral of_int_numeral)


[STATEMENT]
lemma face_of_subset_rel_boundary:
  fixes S :: "'a::real_normed_vector set"
  assumes "T face_of S" "T \<noteq> S"
    shows "T \<subseteq> (S - rel_interior S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T \<subseteq> S - rel_interior S
[PROOF STEP]
by (meson DiffI assms disjoint_iff_not_equal face_of_disjoint_rel_interior face_of_imp_subset rev_subsetD subsetI)


[STATEMENT]
lemma bernoulli_Not: "map_pmf Not (bernoulli_pmf r) = bernoulli_pmf (1 - r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf Not (bernoulli_pmf r) = bernoulli_pmf (1 - r)
[PROOF STEP]
apply(rule pmf_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. pmf (map_pmf Not (bernoulli_pmf r)) i = pmf (bernoulli_pmf (1 - r)) i
[PROOF STEP]
apply(rewrite in "pmf _ \<hole> = _" not_not[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. pmf (map_pmf Not (bernoulli_pmf r)) (\<not> \<not> i) = pmf (bernoulli_pmf (1 - r)) i
[PROOF STEP]
apply(subst pmf_map_inj')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. inj Not
 2. \<And>i. pmf (bernoulli_pmf r) (\<not> i) = pmf (bernoulli_pmf (1 - r)) i
[PROOF STEP]
apply(simp_all add: inj_on_def bernoulli_pmf.rep_eq min_def max_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma triangle_num_less: "m < n \<Longrightarrow> triangle_num m < triangle_num n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < n \<Longrightarrow> triangle_num m < triangle_num n
[PROOF STEP]
using strict_monoD[OF strict_mono_triangle_num]
[PROOF STATE]
proof (prove)
using this:
?x < ?y \<Longrightarrow> triangle_num ?x < triangle_num ?y

goal (1 subgoal):
 1. m < n \<Longrightarrow> triangle_num m < triangle_num n
[PROOF STEP]
.


[STATEMENT]
lemma cofinite_interior_finite:
  fixes X :: "'a cofinite set"
  assumes "finite X"
  assumes "infinite (UNIV::'a cofinite set)"
  shows "interior X = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior X = {}
[PROOF STEP]
using assms cofinite_closure_infinite[where X="-X"]
[PROOF STATE]
proof (prove)
using this:
finite X
infinite UNIV
infinite (- X) \<Longrightarrow> closure (- X) = UNIV

goal (1 subgoal):
 1. interior X = {}
[PROOF STEP]
by (simp add: interior_closure)


[STATEMENT]
lemma nodes_of_graph_from_list: "nodes (graph_from_list l) = fst`set l \<union> snd`set l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nodes (graph_from_list l) = fst ` set l \<union> snd ` set l
[PROOF STEP]
apply (induction l)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. nodes (graph_from_list []) = fst ` set [] \<union> snd ` set []
 2. \<And>a l. nodes (graph_from_list l) = fst ` set l \<union> snd ` set l \<Longrightarrow> nodes (graph_from_list (a # l)) = fst ` set (a # l) \<union> snd ` set (a # l)
[PROOF STEP]
unfolding graph_from_list_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. nodes (foldr ins_edge [] graph_empty) = fst ` set [] \<union> snd ` set []
 2. \<And>a l. nodes (foldr ins_edge l graph_empty) = fst ` set l \<union> snd ` set l \<Longrightarrow> nodes (foldr ins_edge (a # l) graph_empty) = fst ` set (a # l) \<union> snd ` set (a # l)
[PROOF STEP]
by auto


[STATEMENT]
lemma arccos_0 [simp]: "arccos 0 = pi/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arccos 0 = pi / 2
[PROOF STEP]
by (metis arccos_cos cos_gt_zero cos_pi cos_pi_half pi_gt_zero
      pi_half_ge_zero not_le not_zero_less_neg_numeral numeral_One)


[STATEMENT]
lemma rtos_rs_1:"\<lbrakk> 0 < r; 0 < s; rtos r s i < r * s;
       \<not> Suc (rtos r s i) < r * s\<rbrakk> \<Longrightarrow> rtos r s i = r * s - Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; rtos r s i < r * s; \<not> Suc (rtos r s i) < r * s\<rbrakk> \<Longrightarrow> rtos r s i = r * s - Suc 0
[PROOF STEP]
apply (frule pos_mult_pos [of "r" "s"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; rtos r s i < r * s; \<not> Suc (rtos r s i) < r * s; 0 < r * s\<rbrakk> \<Longrightarrow> rtos r s i = r * s - Suc 0
[PROOF STEP]
apply (frule less_le_diff [of "rtos r s i" "r * s"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; rtos r s i < r * s; \<not> Suc (rtos r s i) < r * s; 0 < r * s; rtos r s i \<le> r * s - Suc 0\<rbrakk> \<Longrightarrow> rtos r s i = r * s - Suc 0
[PROOF STEP]
apply (simp add:nat_not_le_less[THEN sym, of "Suc (rtos r s i)" "r * s"])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "x > (0 :: real) \<Longrightarrow> x < 1 \<Longrightarrow>
         ((\<lambda>n. abs (x powr n / (n * (1 + x powr (2 * n)))) powr (1 / n)) \<longlongrightarrow> x) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; x < 1\<rbrakk> \<Longrightarrow> ((\<lambda>n. \<bar>x powr n / (n * (1 + x powr (2 * n)))\<bar> powr (1 / n)) \<longlongrightarrow> x) at_top
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma replicate_count:
 "count (mset (replicate n x)) x = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (mset (replicate n x)) x = n
[PROOF STEP]
by (induction n, simp_all)


[STATEMENT]
lemma Inf_inf: "\<forall>X. f(\<Sqinter> X) = \<Sqinter>{f x | x. x \<in> X} \<Longrightarrow> f (x \<sqinter> y) = f x \<sqinter> f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>X. f (\<Sqinter> X) = \<Sqinter> {f x |x. x \<in> X} \<Longrightarrow> f (x \<sqinter> y) = f x \<sqinter> f y
[PROOF STEP]
apply (erule_tac x="{x, y}" in allE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (\<Sqinter> {x, y}) = \<Sqinter> {f xa |xa. xa \<in> {x, y}} \<Longrightarrow> f (x \<sqinter> y) = f x \<sqinter> f y
[PROOF STEP]
by (force intro: Inf_eqI)


[STATEMENT]
lemma floor_less_iff: "\<lfloor>x\<rfloor> < z \<longleftrightarrow> x < of_int z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> < z) = (x < of_int z)
[PROOF STEP]
by (simp add: not_le [symmetric] le_floor_iff)


[STATEMENT]
lemma basis_image_linear:
  fixes f::"'b::{field}^'n => 'b^'n"
  assumes invertible_lf: "invertible_lf ((*s)) ((*s)) f"
  and basis_X: "is_basis (set_of_vector X)"
  shows "is_basis (f` (set_of_vector X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_basis (f ` set_of_vector X)
[PROOF STEP]
proof (rule iffD1[OF independent_is_basis], rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vec.independent (f ` set_of_vector X)
 2. card (f ` set_of_vector X) = CARD('n)
[PROOF STEP]
have "card (f ` set_of_vector X) = card (set_of_vector X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (f ` set_of_vector X) = card (set_of_vector X)
[PROOF STEP]
by (rule card_image[of f "set_of_vector X"], metis invertible_imp_bijective[OF invertible_lf] bij_def inj_eq inj_on_def)
[PROOF STATE]
proof (state)
this:
card (f ` set_of_vector X) = card (set_of_vector X)

goal (2 subgoals):
 1. vec.independent (f ` set_of_vector X)
 2. card (f ` set_of_vector X) = CARD('n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (f ` set_of_vector X) = card (set_of_vector X)

goal (2 subgoals):
 1. vec.independent (f ` set_of_vector X)
 2. card (f ` set_of_vector X) = CARD('n)
[PROOF STEP]
have "... = card (UNIV::'n set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set_of_vector X) = CARD('n)
[PROOF STEP]
using basis_X
[PROOF STATE]
proof (prove)
using this:
is_basis (set_of_vector X)

goal (1 subgoal):
 1. card (set_of_vector X) = CARD('n)
[PROOF STEP]
unfolding independent_is_basis[symmetric]
[PROOF STATE]
proof (prove)
using this:
vec.independent (set_of_vector X) \<and> card (set_of_vector X) = CARD('n)

goal (1 subgoal):
 1. card (set_of_vector X) = CARD('n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (set_of_vector X) = CARD('n)

goal (2 subgoals):
 1. vec.independent (f ` set_of_vector X)
 2. card (f ` set_of_vector X) = CARD('n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (f ` set_of_vector X) = CARD('n)
[PROOF STEP]
show "card (f ` set_of_vector X) = card (UNIV::'n set)"
[PROOF STATE]
proof (prove)
using this:
card (f ` set_of_vector X) = CARD('n)

goal (1 subgoal):
 1. card (f ` set_of_vector X) = CARD('n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (f ` set_of_vector X) = CARD('n)

goal (1 subgoal):
 1. vec.independent (f ` set_of_vector X)
[PROOF STEP]
interpret Vector_Spaces.linear "(*s)" "(*s)" f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear (*s) (*s) f
[PROOF STEP]
using invertible_lf
[PROOF STATE]
proof (prove)
using this:
invertible_lf (*s) (*s) f

goal (1 subgoal):
 1. linear (*s) (*s) f
[PROOF STEP]
unfolding invertible_lf_def
[PROOF STATE]
proof (prove)
using this:
linear (*s) (*s) f \<and> invertible_lf_axioms f

goal (1 subgoal):
 1. linear (*s) (*s) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec.independent (f ` set_of_vector X)
[PROOF STEP]
show "vec.independent (f ` set_of_vector X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent (f ` set_of_vector X)
[PROOF STEP]
proof (rule independent_injective_image)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vec.independent (set_of_vector X)
 2. inj_on f (vec.span (set_of_vector X))
[PROOF STEP]
show "vec.independent (set_of_vector X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent (set_of_vector X)
[PROOF STEP]
using basis_X
[PROOF STATE]
proof (prove)
using this:
is_basis (set_of_vector X)

goal (1 subgoal):
 1. vec.independent (set_of_vector X)
[PROOF STEP]
unfolding is_basis_def
[PROOF STATE]
proof (prove)
using this:
vec.independent (set_of_vector X) \<and> vec.span (set_of_vector X) = UNIV

goal (1 subgoal):
 1. vec.independent (set_of_vector X)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vec.independent (set_of_vector X)

goal (1 subgoal):
 1. inj_on f (vec.span (set_of_vector X))
[PROOF STEP]
show "inj_on f (vec.span (set_of_vector X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (vec.span (set_of_vector X))
[PROOF STEP]
by (metis bij_def injD inj_onI invertible_imp_bijective invertible_lf)
[PROOF STATE]
proof (state)
this:
inj_on f (vec.span (set_of_vector X))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
vec.independent (f ` set_of_vector X)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  matrix_left_invertible_gen:
  fixes f :: "'a::field^'m \<Rightarrow> 'a::field^'n"
  assumes "Vector_Spaces.linear (*s) (*s) f"
  shows "((\<exists>B. B ** matrix f = mat 1) \<longleftrightarrow> (\<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> g \<circ> f = id))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>B. B ** matrix f = mat (1::'a)) = (\<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> g \<circ> f = id)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>B. B ** matrix f = mat (1::'a) \<Longrightarrow> \<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> g \<circ> f = id
 2. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; g \<circ> f = id\<rbrakk> \<Longrightarrow> \<exists>B. B ** matrix f = mat (1::'a)
[PROOF STEP]
fix B
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>B. B ** matrix f = mat (1::'a) \<Longrightarrow> \<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> g \<circ> f = id
 2. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; g \<circ> f = id\<rbrakk> \<Longrightarrow> \<exists>B. B ** matrix f = mat (1::'a)
[PROOF STEP]
assume 1: "B ** matrix f = mat 1"
[PROOF STATE]
proof (state)
this:
B ** matrix f = mat (1::'a)

goal (2 subgoals):
 1. \<And>B. B ** matrix f = mat (1::'a) \<Longrightarrow> \<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> g \<circ> f = id
 2. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; g \<circ> f = id\<rbrakk> \<Longrightarrow> \<exists>B. B ** matrix f = mat (1::'a)
[PROOF STEP]
show "\<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> g \<circ> f = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> g \<circ> f = id
[PROOF STEP]
proof (intro exI conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Vector_Spaces.linear (*s) (*s) ?g
 2. ?g \<circ> f = id
[PROOF STEP]
show "Vector_Spaces.linear (*s) (*s) (\<lambda>y. B *v y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Vector_Spaces.linear (*s) (*s) ((*v) B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Vector_Spaces.linear (*s) (*s) ((*v) B)

goal (1 subgoal):
 1. (*v) B \<circ> f = id
[PROOF STEP]
show "((*v) B) \<circ> f = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*v) B \<circ> f = id
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. B *v f x) = id
[PROOF STEP]
by (metis assms 1 eq_id_iff matrix_vector_mul(1) matrix_vector_mul_assoc matrix_vector_mul_lid)
[PROOF STATE]
proof (state)
this:
(*v) B \<circ> f = id

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> g \<circ> f = id

goal (1 subgoal):
 1. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; g \<circ> f = id\<rbrakk> \<Longrightarrow> \<exists>B. B ** matrix f = mat (1::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; g \<circ> f = id\<rbrakk> \<Longrightarrow> \<exists>B. B ** matrix f = mat (1::'a)
[PROOF STEP]
fix g
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; g \<circ> f = id\<rbrakk> \<Longrightarrow> \<exists>B. B ** matrix f = mat (1::'a)
[PROOF STEP]
assume "Vector_Spaces.linear (*s) (*s) g" "g \<circ> f = id"
[PROOF STATE]
proof (state)
this:
Vector_Spaces.linear (*s) (*s) g
g \<circ> f = id

goal (1 subgoal):
 1. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; g \<circ> f = id\<rbrakk> \<Longrightarrow> \<exists>B. B ** matrix f = mat (1::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Vector_Spaces.linear (*s) (*s) g
g \<circ> f = id
[PROOF STEP]
have "matrix g ** matrix f = mat 1"
[PROOF STATE]
proof (prove)
using this:
Vector_Spaces.linear (*s) (*s) g
g \<circ> f = id

goal (1 subgoal):
 1. matrix g ** matrix f = mat (1::'a)
[PROOF STEP]
by (metis assms matrix_compose_gen matrix_id_mat_1)
[PROOF STATE]
proof (state)
this:
matrix g ** matrix f = mat (1::'a)

goal (1 subgoal):
 1. \<And>g. \<lbrakk>Vector_Spaces.linear (*s) (*s) g; g \<circ> f = id\<rbrakk> \<Longrightarrow> \<exists>B. B ** matrix f = mat (1::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
matrix g ** matrix f = mat (1::'a)
[PROOF STEP]
show "\<exists>B. B ** matrix f = mat 1"
[PROOF STATE]
proof (prove)
using this:
matrix g ** matrix f = mat (1::'a)

goal (1 subgoal):
 1. \<exists>B. B ** matrix f = mat (1::'a)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>B. B ** matrix f = mat (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iIN_inter: "
  \<lbrakk> n \<le> n'; n' \<le> n + d; n + d \<le> n' + d' \<rbrakk> \<Longrightarrow>
  [n\<dots>,d] \<inter> [n'\<dots>,d'] = [n'\<dots>,n + d - n']"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<le> n'; n' \<le> n + d; n + d \<le> n' + d'\<rbrakk> \<Longrightarrow> [n\<dots>,d] \<inter> [n'\<dots>,d'] = [n'\<dots>,n + d - n']
[PROOF STEP]
by (fastforce simp: iIN_iff)


[STATEMENT]
lemma on_circline_unit_circle [simp]:
  shows "on_circline unit_circle (of_complex z) \<longleftrightarrow> cmod z = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. on_circline unit_circle (of_complex z) = (cmod z = 1)
[PROOF STEP]
by (transfer, transfer, simp add: vec_cnj_def mult.commute)


[STATEMENT]
lemma mset_pos_plus[simp]:
  "mset_pos (A + B) = (mset_pos A - mset_neg B) + (mset_pos B - mset_neg A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset_pos (A + B) = mset_pos A - mset_neg B + (mset_pos B - mset_neg A)
[PROOF STEP]
by (rule multiset_eqI) simp


[STATEMENT]
lemma nth_least_less_esize_less:
    "enat n < esize A \<and> enat (nth_least A n) < k \<longleftrightarrow> enat n < esize {i \<in> A. enat i < k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (enat n < esize A \<and> enat (nth_least A n) < k) = (enat n < esize {i \<in> A. enat i < k})
[PROOF STEP]
using nth_least_less_card_less
[PROOF STATE]
proof (prove)
using this:
(enat ?n < esize ?A \<and> nth_least ?A ?n < ?k) = (?n < card {i \<in> ?A. i < ?k})

goal (1 subgoal):
 1. (enat n < esize A \<and> enat (nth_least A n) < k) = (enat n < esize {i \<in> A. enat i < k})
[PROOF STEP]
by (cases k, simp+)


[STATEMENT]
lemma emeasure_pmf_of_set: "emeasure (measure_pmf pmf_of_set) A = card (S \<inter> A) / card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (measure_pmf local.pmf_of_set) A = ennreal (real (card (S \<inter> A)) / real (card S))
[PROOF STEP]
by (subst nn_integral_indicator[symmetric], simp)
     (simp add: S_finite S_not_empty card_gt_0_iff indicator_def sum.If_cases divide_ennreal
                ennreal_of_nat_eq_real_of_nat nn_integral_pmf_of_set)


[STATEMENT]
lemma limsup_root_limit':
  assumes "(\<lambda>n. root n (norm (f n))) \<longlonglongrightarrow> l"
  shows   "limsup (\<lambda>n. ereal (root n (norm (f n)))) = ereal l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (root n (norm (f n)))) = ereal l
[PROOF STEP]
by (intro limsup_root_limit tendsto_ereal assms)


[STATEMENT]
lemma listsp_inf_eq [simp]: "listsp (inf A B) = inf (listsp A) (listsp B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. listsp (A \<sqinter> B) = listsp A \<sqinter> listsp B
[PROOF STEP]
proof (rule mono_inf [where f=listsp, THEN order_antisym])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mono listsp
 2. listsp A \<sqinter> listsp B \<le> listsp (A \<sqinter> B)
[PROOF STEP]
show "mono listsp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono listsp
[PROOF STEP]
by (simp add: mono_def listsp_mono)
[PROOF STATE]
proof (state)
this:
mono listsp

goal (1 subgoal):
 1. listsp A \<sqinter> listsp B \<le> listsp (A \<sqinter> B)
[PROOF STEP]
show "inf (listsp A) (listsp B) \<le> listsp (inf A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. listsp A \<sqinter> listsp B \<le> listsp (A \<sqinter> B)
[PROOF STEP]
by (blast intro!: listsp_infI)
[PROOF STATE]
proof (state)
this:
listsp A \<sqinter> listsp B \<le> listsp (A \<sqinter> B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_final: "finite (final M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (nfa.final M)
[PROOF STEP]
using final finite_subset finite
[PROOF STATE]
proof (prove)
using this:
nfa.final M \<subseteq> nfa.states M
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
finite (nfa.states M)

goal (1 subgoal):
 1. finite (nfa.final M)
[PROOF STEP]
by blast