[STATEMENT]
lemma absolutely_integrable_absolutely_integrable_lbound:
  fixes f :: "'m::euclidean_space \<Rightarrow> real"
  assumes f: "f integrable_on S" and g: "g absolutely_integrable_on S"
    and *: "\<And>x. x \<in> S \<Longrightarrow> g x \<le> f x"
  shows "f absolutely_integrable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f absolutely_integrable_on S
[PROOF STEP]
by (rule absolutely_integrable_component_lbound [OF g f]) (simp add: *)


[STATEMENT]
lemma Transset_Inf: "(\<And>i. i \<in> A \<Longrightarrow> Transset i) \<Longrightarrow> Transset (\<Sqinter> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> A \<Longrightarrow> Transset i) \<Longrightarrow> Transset (\<Sqinter> A)
[PROOF STEP]
by (force simp: Transset_def Inf_V_def)


[STATEMENT]
lemma iMin_Int_ge: "(A \<inter> B) \<noteq> {} \<Longrightarrow> max (iMin A) (iMin B) \<le> iMin (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B \<noteq> {} \<Longrightarrow> max (iMin A) (iMin B) \<le> iMin (A \<inter> B)
[PROOF STEP]
apply (rule conj_le_imp_max)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. A \<inter> B \<noteq> {} \<Longrightarrow> iMin A \<le> iMin (A \<inter> B)
 2. A \<inter> B \<noteq> {} \<Longrightarrow> iMin B \<le> iMin (A \<inter> B)
[PROOF STEP]
apply (rule iMin_Int_ge1, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B \<noteq> {} \<Longrightarrow> iMin B \<le> iMin (A \<inter> B)
[PROOF STEP]
apply (rule iMin_Int_ge2, assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_vector_derivative_id_at [simp]: "vector_derivative (\<lambda>x. x) (at a) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative (\<lambda>x. x) (at a) = 1
[PROOF STEP]
by (simp add: vector_derivative_at)


[STATEMENT]
lemma iT_Minus_Min: "
  \<lbrakk> I \<noteq> {}; iMin I \<le> k \<rbrakk> \<Longrightarrow> iMin (k \<ominus> I) = k - (Max (I \<down>\<le> k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<noteq> {}; iMin I \<le> k\<rbrakk> \<Longrightarrow> iMin (k \<ominus> I) = k - Max (I \<down>\<le> k)
[PROOF STEP]
apply (insert nat_cut_le_finite[of I k])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<noteq> {}; iMin I \<le> k; finite (I \<down>\<le> k)\<rbrakk> \<Longrightarrow> iMin (k \<ominus> I) = k - Max (I \<down>\<le> k)
[PROOF STEP]
apply (frule cut_le_Min_not_empty[of _ k], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<noteq> {}; iMin I \<le> k; finite (I \<down>\<le> k); I \<down>\<le> k \<noteq> {}\<rbrakk> \<Longrightarrow> iMin (k \<ominus> I) = k - Max (I \<down>\<le> k)
[PROOF STEP]
apply (rule iMin_equality)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>I \<noteq> {}; iMin I \<le> k; finite (I \<down>\<le> k); I \<down>\<le> k \<noteq> {}\<rbrakk> \<Longrightarrow> k - Max (I \<down>\<le> k) \<in> k \<ominus> I
 2. \<And>x. \<lbrakk>I \<noteq> {}; iMin I \<le> k; finite (I \<down>\<le> k); I \<down>\<le> k \<noteq> {}; x \<in> k \<ominus> I\<rbrakk> \<Longrightarrow> k - Max (I \<down>\<le> k) \<le> x
[PROOF STEP]
apply (simp add: iT_Minus_mem_iff nat_cut_le_Max_le del: Max_le_iff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>I \<noteq> {}; iMin I \<le> k; finite (I \<down>\<le> k); I \<down>\<le> k \<noteq> {}\<rbrakk> \<Longrightarrow> Max (I \<down>\<le> k) \<in> I
 2. \<And>x. \<lbrakk>I \<noteq> {}; iMin I \<le> k; finite (I \<down>\<le> k); I \<down>\<le> k \<noteq> {}; x \<in> k \<ominus> I\<rbrakk> \<Longrightarrow> k - Max (I \<down>\<le> k) \<le> x
[PROOF STEP]
apply (simp add: subsetD[OF cut_le_subset, OF Max_in])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>I \<noteq> {}; iMin I \<le> k; finite (I \<down>\<le> k); I \<down>\<le> k \<noteq> {}; x \<in> k \<ominus> I\<rbrakk> \<Longrightarrow> k - Max (I \<down>\<le> k) \<le> x
[PROOF STEP]
apply (clarsimp simp add: iT_Minus_image_conv image_iff, rename_tac x')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x'. \<lbrakk>I \<noteq> {}; iMin I \<le> k; finite (I \<down>\<le> k); I \<down>\<le> k \<noteq> {}; x' \<in> I; x' \<le> k\<rbrakk> \<Longrightarrow> k - Max (I \<down>\<le> k) \<le> k - x'
[PROOF STEP]
apply (rule diff_le_mono2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x'. \<lbrakk>I \<noteq> {}; iMin I \<le> k; finite (I \<down>\<le> k); I \<down>\<le> k \<noteq> {}; x' \<in> I; x' \<le> k\<rbrakk> \<Longrightarrow> x' \<le> Max (I \<down>\<le> k)
[PROOF STEP]
apply (simp add: Max_ge_iff cut_le_mem_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma valid_step_1_1:
  assumes "valid_step (1,1) (i,j)" "i > 0" "j > 0"
  shows "(i,j) = (2,3) \<or> (i,j) = (3,2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i, j) = (2, 3) \<or> (i, j) = (3, 2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
valid_step (1, 1) (i, j)
0 < i
0 < j

goal (1 subgoal):
 1. (i, j) = (2, 3) \<or> (i, j) = (3, 2)
[PROOF STEP]
unfolding valid_step_def
[PROOF STATE]
proof (prove)
using this:
case (1, 1) of (ia, ja) \<Rightarrow> (i, j) \<in> {(ia + 1, ja + 2), (ia - 1, ja + 2), (ia + 1, ja - 2), (ia - 1, ja - 2), (ia + 2, ja + 1), (ia - 2, ja + 1), (ia + 2, ja - 1), (ia - 2, ja - 1)}
0 < i
0 < j

goal (1 subgoal):
 1. (i, j) = (2, 3) \<or> (i, j) = (3, 2)
[PROOF STEP]
by auto


[STATEMENT]
lemma mat_of_cblinfun_id:
  "mat_of_cblinfun (id_cblinfun :: ('a::{basis_enum,complex_normed_vector} \<Rightarrow>\<^sub>C\<^sub>L'a)) = 1\<^sub>m (length (canonical_basis :: 'a list))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun id_cblinfun = 1\<^sub>m (length canonical_basis)
[PROOF STEP]
apply (rule eq_matI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m (length canonical_basis)); j < dim_col (1\<^sub>m (length canonical_basis))\<rbrakk> \<Longrightarrow> mat_of_cblinfun id_cblinfun $$ (i, j) = 1\<^sub>m (length canonical_basis) $$ (i, j)
 2. dim_row (mat_of_cblinfun id_cblinfun) = dim_row (1\<^sub>m (length canonical_basis))
 3. dim_col (mat_of_cblinfun id_cblinfun) = dim_col (1\<^sub>m (length canonical_basis))
[PROOF STEP]
by (auto simp: mat_of_cblinfun_def complex_vector.representation_basis is_cindependent_set nth_eq_iff_index_eq)


[STATEMENT]
lemma not_false_eq_true: "(\<not> false) = true"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> false) = true
[PROOF STEP]
by (rule ext) blast


[STATEMENT]
lemma size_mset_sum_mset: "size (sum_mset X) = (\<Sum>x\<in>#X. size (x :: 'a multiset))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (\<Sum>\<^sub># X) = \<Sum>\<^sub># (image_mset size X)
[PROOF STEP]
by (induction X) auto


[STATEMENT]
lemma inter_mset_empty_distrib_left: "(A + B) \<inter># C = {#} \<longleftrightarrow> A \<inter># C = {#} \<and> B \<inter># C = {#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((A + B) \<inter># C = {#}) = (A \<inter># C = {#} \<and> B \<inter># C = {#})
[PROOF STEP]
by (meson disjunct_not_in union_iff)


[STATEMENT]
lemma filterlim_uminus_at_bot: "(LIM x F. f x :> at_bot) \<longleftrightarrow> (LIM x F. - (f x) :: real :> at_top)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim f at_bot F = (LIM x F. - f x :> at_top)
[PROOF STEP]
unfolding filterlim_uminus_at_top
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim f at_bot F = (LIM x F. - (- f x) :> at_bot)
[PROOF STEP]
by simp


[STATEMENT]
lemma skip_im1:"\<lbrakk>i \<le> (Suc n); P \<in> {j. j \<le> (Suc n)} \<rightarrow> Collect (prime_ideal R)\<rbrakk>
    \<Longrightarrow>
   compose {j. j \<le> n} P (skip i) ` {j. j \<le> n} = P ` ({j. j \<le> (Suc n)} - {i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<le> Suc n; P \<in> {j. j \<le> Suc n} \<rightarrow> Collect (prime_ideal R)\<rbrakk> \<Longrightarrow> compose {j. j \<le> n} P (skip i) ` {j. j \<le> n} = P ` ({j. j \<le> Suc n} - {i})
[PROOF STEP]
apply (cut_tac skip_fun[of i n])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<le> Suc n; P \<in> {j. j \<le> Suc n} \<rightarrow> Collect (prime_ideal R); skip i \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> Suc n}\<rbrakk> \<Longrightarrow> compose {j. j \<le> n} P (skip i) ` {j. j \<le> n} = P ` ({j. j \<le> Suc n} - {i})
[PROOF STEP]
apply (subst setim_cmpfn[of _ _ _ _ "{X. prime_ideal R X}"], assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>i \<le> Suc n; P \<in> {j. j \<le> Suc n} \<rightarrow> Collect (prime_ideal R); skip i \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> Suc n}\<rbrakk> \<Longrightarrow> {j. j \<le> n} \<subseteq> {j. j \<le> n}
 2. \<lbrakk>i \<le> Suc n; P \<in> {j. j \<le> Suc n} \<rightarrow> Collect (prime_ideal R); skip i \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> Suc n}\<rbrakk> \<Longrightarrow> P ` skip i ` {j. j \<le> n} = P ` ({j. j \<le> Suc n} - {i})
[PROOF STEP]
apply  simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<le> Suc n; P \<in> {j. j \<le> Suc n} \<rightarrow> Collect (prime_ideal R); skip i \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> Suc n}\<rbrakk> \<Longrightarrow> P ` skip i ` {j. j \<le> n} = P ` ({j. j \<le> Suc n} - {i})
[PROOF STEP]
apply (simp add:skip_fun_im)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ln_ge_iff: "\<And>x::real. 0 < x \<Longrightarrow> y \<le> ln x \<longleftrightarrow> exp y \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> (y \<le> ln x) = (exp y \<le> x)
[PROOF STEP]
using exp_le_cancel_iff exp_total
[PROOF STATE]
proof (prove)
using this:
(exp ?x \<le> exp ?y) = (?x \<le> ?y)
0 < ?y \<Longrightarrow> \<exists>x. exp x = ?y

goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> (y \<le> ln x) = (exp y \<le> x)
[PROOF STEP]
by force


[STATEMENT]
lemma ring_1_ow_UNIV_axioms:
  "ring_1_ow (UNIV::'a::ring_1 set) 1 (*) (+) 0 (-) uminus"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_1_ow UNIV (1::'a) (*) (+) (0::'a) (-) uminus
[PROOF STEP]
by (fold ring_1_ow) (rule ring_1_class.ring_1_axioms)


[STATEMENT]
lemma fps_conv_radius_mult: "fps_conv_radius (f * g) \<ge> min (fps_conv_radius f) (fps_conv_radius g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (fps_conv_radius f) (fps_conv_radius g) \<le> fps_conv_radius (f * g)
[PROOF STEP]
using conv_radius_mult_ge[of "fps_nth f" "fps_nth g"]
[PROOF STATE]
proof (prove)
using this:
min (conv_radius (fps_nth f)) (conv_radius (fps_nth g)) \<le> conv_radius (\<lambda>x. \<Sum>i\<le>x. fps_nth f i * fps_nth g (x - i))

goal (1 subgoal):
 1. min (fps_conv_radius f) (fps_conv_radius g) \<le> fps_conv_radius (f * g)
[PROOF STEP]
by (simp add: fps_mult_nth fps_conv_radius_def atLeast0AtMost)


[STATEMENT]
lemma mat_mult_left_right_inverse: assumes A: "(A :: 'a :: field mat) \<in> carrier_mat n n"
  and B: "B \<in> carrier_mat n n" and AB: "A * B = 1\<^sub>m n"
  shows "B * A = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
let ?R = "ring_mat TYPE('a) n undefined"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
from det_mult[OF A B, unfolded AB]
[PROOF STATE]
proof (chain)
picking this:
det (1\<^sub>m n) = det A * det B
[PROOF STEP]
have "det A \<noteq> 0" "det B \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
det (1\<^sub>m n) = det A * det B

goal (1 subgoal):
 1. det A \<noteq> (0::'a) &&& det B \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
det A \<noteq> (0::'a)
det B \<noteq> (0::'a)

goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
from det_non_zero_imp_unit[OF A this(1)] det_non_zero_imp_unit[OF B this(2)]
[PROOF STATE]
proof (chain)
picking this:
A \<in> Units (ring_mat TYPE('a) n ?b)
B \<in> Units (ring_mat TYPE('a) n ?b)
[PROOF STEP]
have U: "A \<in> Units ?R" "B \<in> Units ?R"
[PROOF STATE]
proof (prove)
using this:
A \<in> Units (ring_mat TYPE('a) n ?b)
B \<in> Units (ring_mat TYPE('a) n ?b)

goal (1 subgoal):
 1. A \<in> Units (ring_mat TYPE('a) n undefined) &&& B \<in> Units (ring_mat TYPE('a) n undefined)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
A \<in> Units (ring_mat TYPE('a) n undefined)
B \<in> Units (ring_mat TYPE('a) n undefined)

goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
interpret ring ?R
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring (ring_mat TYPE('a) n undefined)
[PROOF STEP]
by (rule ring_mat)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
from Units_inv_comm[unfolded ring_mat_simps, OF AB U]
[PROOF STATE]
proof (chain)
picking this:
B * A = 1\<^sub>m n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
B * A = 1\<^sub>m n

goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
B * A = 1\<^sub>m n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma order_trans: "\<lbrakk> order r A;  x \<sqsubseteq>\<^sub>r y;  y \<sqsubseteq>\<^sub>r z; x \<in> A; y \<in> A; z \<in> A \<rbrakk> \<Longrightarrow> x \<sqsubseteq>\<^sub>r z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order r A; x \<sqsubseteq>\<^bsub>r\<^esub> y; y \<sqsubseteq>\<^bsub>r\<^esub> z; x \<in> A; y \<in> A; z \<in> A\<rbrakk> \<Longrightarrow> x \<sqsubseteq>\<^bsub>r\<^esub> z
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order r A; x \<sqsubseteq>\<^bsub>r\<^esub> y; y \<sqsubseteq>\<^bsub>r\<^esub> z; x \<in> A; y \<in> A; z \<in> A\<rbrakk> \<Longrightarrow> x \<sqsubseteq>\<^bsub>r\<^esub> z
[PROOF STEP]
by (unfold order_def) blast


[STATEMENT]
lemma cblinfun_eq_gen_eqI:
  fixes A B :: "'a::cbanach \<Rightarrow>\<^sub>C\<^sub>L'b::complex_normed_vector"
  assumes "\<And>x. x \<in> G \<Longrightarrow> A *\<^sub>V x = B *\<^sub>V x" and \<open>ccspan G = \<top>\<close>
  shows "A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = B
[PROOF STEP]
apply (rule cblinfun_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. A *\<^sub>V i = B *\<^sub>V i
[PROOF STEP]
apply (rule cblinfun_eq_on[where G=G])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i x. x \<in> G \<Longrightarrow> A *\<^sub>V x = B *\<^sub>V x
 2. \<And>i. i \<in> closure (cspan G)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> G \<Longrightarrow> A *\<^sub>V ?x = B *\<^sub>V ?x
ccspan G = \<top>

goal (2 subgoals):
 1. \<And>i x. x \<in> G \<Longrightarrow> A *\<^sub>V x = B *\<^sub>V x
 2. \<And>i. i \<in> closure (cspan G)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<And>x. x \<in> G \<Longrightarrow> A *\<^sub>V x = B *\<^sub>V x; ccspan G = \<top>\<rbrakk> \<Longrightarrow> i \<in> closure (cspan G)
[PROOF STEP]
by (metis ccspan.rep_eq iso_tuple_UNIV_I top_ccsubspace.rep_eq)


[STATEMENT]
theorem turing_computable_total''_eq_turing_computable_total:
  "turing_computable_total'' f = turing_computable_total f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. turing_computable_total'' f = turing_computable_total f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. turing_computable_total'' f \<Longrightarrow> turing_computable_total f
 2. turing_computable_total f \<Longrightarrow> turing_computable_total'' f
[PROOF STEP]
show "turing_computable_total'' f \<Longrightarrow> turing_computable_total f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. turing_computable_total'' f \<Longrightarrow> turing_computable_total f
[PROOF STEP]
unfolding turing_computable_total_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. turing_computable_total'' f \<Longrightarrow> \<exists>tm. \<forall>ns. \<exists>n. f ns = Some n \<and> (\<exists>stp k l. steps0 (1, [], <ns>) tm stp = (0, Bk \<up> k, <n> @ Bk \<up> l))
[PROOF STEP]
unfolding turing_computable_total''_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>tm. fun_of_tm tm = f \<and> (\<forall>ns. \<exists>n. f ns = Some n) \<Longrightarrow> \<exists>tm. \<forall>ns. \<exists>n. f ns = Some n \<and> (\<exists>stp k l. steps0 (1, [], <ns>) tm stp = (0, Bk \<up> k, <n> @ Bk \<up> l))
[PROOF STEP]
by (meson fun_of_tm_eq_Some_n_imp_same_numeral_result)
[PROOF STATE]
proof (state)
this:
turing_computable_total'' f \<Longrightarrow> turing_computable_total f

goal (1 subgoal):
 1. turing_computable_total f \<Longrightarrow> turing_computable_total'' f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. turing_computable_total f \<Longrightarrow> turing_computable_total'' f
[PROOF STEP]
show "turing_computable_total f \<Longrightarrow> turing_computable_total'' f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. turing_computable_total f \<Longrightarrow> turing_computable_total'' f
[PROOF STEP]
unfolding turing_computable_total_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>tm. \<forall>ns. \<exists>n. f ns = Some n \<and> (\<exists>stp k l. steps0 (1, [], <ns>) tm stp = (0, Bk \<up> k, <n> @ Bk \<up> l)) \<Longrightarrow> turing_computable_total'' f
[PROOF STEP]
unfolding turing_computable_total''_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>tm. \<forall>ns. \<exists>n. f ns = Some n \<and> (\<exists>stp k l. steps0 (1, [], <ns>) tm stp = (0, Bk \<up> k, <n> @ Bk \<up> l)) \<Longrightarrow> \<exists>tm. fun_of_tm tm = f \<and> (\<forall>ns. \<exists>n. f ns = Some n)
[PROOF STEP]
by (metis numeral_result_n_imp_fun_of_tm_eq_n tape_of_list_def turing_computable_partial'I turing_computable_partial'_def)
[PROOF STATE]
proof (state)
this:
turing_computable_total f \<Longrightarrow> turing_computable_total'' f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hmset_of_enat_minus_enat[simp]: "hmset_of_enat (m - enat n) = hmset_of_enat m - of_nat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hmset_of_enat (m - enat n) = hmset_of_enat m - of_nat n
[PROOF STEP]
by (cases m) (auto simp: of_nat_minus_hmset)


[STATEMENT]
lemma contour_integral_subpath_combine:
  assumes "f contour_integrable_on g" "valid_path g" "u \<in> {0..1}" "v \<in> {0..1}" "w \<in> {0..1}"
    shows "contour_integral (subpath u v g) f + contour_integral (subpath v w g) f =
           contour_integral (subpath u w g) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
proof (cases "u\<noteq>v \<and> v\<noteq>w \<and> u\<noteq>w")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w \<Longrightarrow> contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
 2. \<not> (u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w) \<Longrightarrow> contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w

goal (2 subgoals):
 1. u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w \<Longrightarrow> contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
 2. \<not> (u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w) \<Longrightarrow> contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
have *: "subpath v u g = reversepath(subpath u v g) \<and>
             subpath w u g = reversepath(subpath u w g) \<and>
             subpath w v g = reversepath(subpath v w g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subpath v u g = reversepath (subpath u v g) \<and> subpath w u g = reversepath (subpath u w g) \<and> subpath w v g = reversepath (subpath v w g)
[PROOF STEP]
by (auto simp: reversepath_subpath)
[PROOF STATE]
proof (state)
this:
subpath v u g = reversepath (subpath u v g) \<and> subpath w u g = reversepath (subpath u w g) \<and> subpath w v g = reversepath (subpath v w g)

goal (2 subgoals):
 1. u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w \<Longrightarrow> contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
 2. \<not> (u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w) \<Longrightarrow> contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
have "u < v \<and> v < w \<or>
          u < w \<and> w < v \<or>
          v < u \<and> u < w \<or>
          v < w \<and> w < u \<or>
          w < u \<and> u < v \<or>
          w < v \<and> v < u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u < v \<and> v < w \<or> u < w \<and> w < v \<or> v < u \<and> u < w \<or> v < w \<and> w < u \<or> w < u \<and> u < v \<or> w < v \<and> v < u
[PROOF STEP]
using True assms
[PROOF STATE]
proof (prove)
using this:
u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w
f contour_integrable_on g
valid_path g
u \<in> {0..1}
v \<in> {0..1}
w \<in> {0..1}

goal (1 subgoal):
 1. u < v \<and> v < w \<or> u < w \<and> w < v \<or> v < u \<and> u < w \<or> v < w \<and> w < u \<or> w < u \<and> u < v \<or> w < v \<and> v < u
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
u < v \<and> v < w \<or> u < w \<and> w < v \<or> v < u \<and> u < w \<or> v < w \<and> w < u \<or> w < u \<and> u < v \<or> w < v \<and> v < u

goal (2 subgoals):
 1. u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w \<Longrightarrow> contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
 2. \<not> (u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w) \<Longrightarrow> contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
f contour_integrable_on g
valid_path g
u \<in> {0..1}
v \<in> {0..1}
w \<in> {0..1}
u < v \<and> v < w \<or> u < w \<and> w < v \<or> v < u \<and> u < w \<or> v < w \<and> w < u \<or> w < u \<and> u < v \<or> w < v \<and> v < u
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f contour_integrable_on g
valid_path g
u \<in> {0..1}
v \<in> {0..1}
w \<in> {0..1}
u < v \<and> v < w \<or> u < w \<and> w < v \<or> v < u \<and> u < w \<or> v < w \<and> w < u \<or> w < u \<and> u < v \<or> w < v \<and> v < u

goal (1 subgoal):
 1. contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
using contour_integral_subpath_combine_less [of f g u v w]
            contour_integral_subpath_combine_less [of f g u w v]
            contour_integral_subpath_combine_less [of f g v u w]
            contour_integral_subpath_combine_less [of f g v w u]
            contour_integral_subpath_combine_less [of f g w u v]
            contour_integral_subpath_combine_less [of f g w v u]
[PROOF STATE]
proof (prove)
using this:
f contour_integrable_on g
valid_path g
u \<in> {0..1}
v \<in> {0..1}
w \<in> {0..1}
u < v \<and> v < w \<or> u < w \<and> w < v \<or> v < u \<and> u < w \<or> v < w \<and> w < u \<or> w < u \<and> u < v \<or> w < v \<and> v < u
\<lbrakk>f contour_integrable_on g; valid_path g; u \<in> {0..1}; v \<in> {0..1}; w \<in> {0..1}; u < v; v < w\<rbrakk> \<Longrightarrow> contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
\<lbrakk>f contour_integrable_on g; valid_path g; u \<in> {0..1}; w \<in> {0..1}; v \<in> {0..1}; u < w; w < v\<rbrakk> \<Longrightarrow> contour_integral (subpath u w g) f + contour_integral (subpath w v g) f = contour_integral (subpath u v g) f
\<lbrakk>f contour_integrable_on g; valid_path g; v \<in> {0..1}; u \<in> {0..1}; w \<in> {0..1}; v < u; u < w\<rbrakk> \<Longrightarrow> contour_integral (subpath v u g) f + contour_integral (subpath u w g) f = contour_integral (subpath v w g) f
\<lbrakk>f contour_integrable_on g; valid_path g; v \<in> {0..1}; w \<in> {0..1}; u \<in> {0..1}; v < w; w < u\<rbrakk> \<Longrightarrow> contour_integral (subpath v w g) f + contour_integral (subpath w u g) f = contour_integral (subpath v u g) f
\<lbrakk>f contour_integrable_on g; valid_path g; w \<in> {0..1}; u \<in> {0..1}; v \<in> {0..1}; w < u; u < v\<rbrakk> \<Longrightarrow> contour_integral (subpath w u g) f + contour_integral (subpath u v g) f = contour_integral (subpath w v g) f
\<lbrakk>f contour_integrable_on g; valid_path g; w \<in> {0..1}; v \<in> {0..1}; u \<in> {0..1}; w < v; v < u\<rbrakk> \<Longrightarrow> contour_integral (subpath w v g) f + contour_integral (subpath v u g) f = contour_integral (subpath w u g) f

goal (1 subgoal):
 1. contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
by (elim disjE) (auto simp: * contour_integral_reversepath contour_integrable_subpath
                                    valid_path_subpath algebra_simps)
[PROOF STATE]
proof (state)
this:
contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f

goal (1 subgoal):
 1. \<not> (u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w) \<Longrightarrow> contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w) \<Longrightarrow> contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w)

goal (1 subgoal):
 1. \<not> (u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w) \<Longrightarrow> contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
f contour_integrable_on g
valid_path g
u \<in> {0..1}
v \<in> {0..1}
w \<in> {0..1}
\<not> (u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f contour_integrable_on g
valid_path g
u \<in> {0..1}
v \<in> {0..1}
w \<in> {0..1}
\<not> (u \<noteq> v \<and> v \<noteq> w \<and> u \<noteq> w)

goal (1 subgoal):
 1. contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
by (metis add.right_neutral contour_integral_reversepath contour_integral_subpath_refl diff_0 eq_diff_eq add_0 reversepath_subpath valid_path_subpath)
[PROOF STATE]
proof (state)
this:
contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_prime_factors_nat [simp]: "set (prime_factors_nat n) = prime_factors n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (prime_factors_nat n) = prime_factors n
[PROOF STEP]
unfolding prime_factors_nat_def multiset_prime_factorization_nat_correct
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (remdups_adj (sort (prime_factorization_nat n))) = set_mset (mset (prime_factorization_nat n))
[PROOF STEP]
by simp


[STATEMENT]
lemma mem_box_cart:
  fixes a :: "real^'n"
  shows "x \<in> box a b \<longleftrightarrow> (\<forall>i. a$i < x$i \<and> x$i < b$i)"
    and "x \<in> cbox a b \<longleftrightarrow> (\<forall>i. a$i \<le> x$i \<and> x$i \<le> b$i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> box a b) = (\<forall>i. a $ i < x $ i \<and> x $ i < b $ i) &&& (x \<in> cbox a b) = (\<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> b $ i)
[PROOF STEP]
using interval_cart[of a b]
[PROOF STATE]
proof (prove)
using this:
box a b = {x. \<forall>i. a $ i < x $ i \<and> x $ i < b $ i}
cbox a b = {x. \<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> b $ i}

goal (1 subgoal):
 1. (x \<in> box a b) = (\<forall>i. a $ i < x $ i \<and> x $ i < b $ i) &&& (x \<in> cbox a b) = (\<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> b $ i)
[PROOF STEP]
by (auto simp add: set_eq_iff less_vec_def less_eq_vec_def)


[STATEMENT]
lemma exp_scaleR_has_vector_derivative_left: "((\<lambda>t. exp (t *\<^sub>R A)) has_vector_derivative A * exp (t *\<^sub>R A)) (at t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. exp (t *\<^sub>R A)) has_vector_derivative A * exp (t *\<^sub>R A)) (at t)
[PROOF STEP]
using exp_scaleR_has_vector_derivative_right[of A t]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. exp (t *\<^sub>R A)) has_vector_derivative exp (t *\<^sub>R A) * A) (at t within ?T)

goal (1 subgoal):
 1. ((\<lambda>t. exp (t *\<^sub>R A)) has_vector_derivative A * exp (t *\<^sub>R A)) (at t)
[PROOF STEP]
by (simp add: exp_times_scaleR_commute)


[STATEMENT]
lemma ord_isom_restrictedS:
      "\<lbrakk>Order D; Order E; ord_isom D E f; D1 \<subseteq> carrier D\<rbrakk> \<Longrightarrow>
             ord_isom (SIod D D1) (SIod E (f ` D1)) (\<lambda>x\<in>D1. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Order D; Order E; ord_isom D E f; D1 \<subseteq> carrier D\<rbrakk> \<Longrightarrow> ord_isom (SIod D D1) (SIod E (f ` D1)) (restrict f D1)
[PROOF STEP]
apply (simp add:ord_isom_def[of D E f], erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Order D; Order E; D1 \<subseteq> carrier D; ord_inj D E f; surj_to f (carrier D) (carrier E)\<rbrakk> \<Longrightarrow> ord_isom (SIod D D1) (SIod E (f ` D1)) (restrict f D1)
[PROOF STEP]
apply (simp add:ord_inj_Srestrict_isom[of D E f D1])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Nsub0:
  assumes "SORT_CONSTRAINT('a::field_char_0)"
  assumes x: "isnormNum x"
    and y: "isnormNum y"
  shows "x -\<^sub>N y = 0\<^sub>N \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x -\<^sub>N y = 0\<^sub>N) = (x = y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x -\<^sub>N y = 0\<^sub>N) = (x = y)
[PROOF STEP]
from isnormNum_unique[where 'a = 'a, OF Nsub_normN[OF y], where y="0\<^sub>N"]
[PROOF STATE]
proof (chain)
picking this:
isnormNum 0\<^sub>N \<Longrightarrow> (INum (?x1 -\<^sub>N y) = INum 0\<^sub>N) = (?x1 -\<^sub>N y = 0\<^sub>N)
[PROOF STEP]
have "x -\<^sub>N y = 0\<^sub>N \<longleftrightarrow> INum (x -\<^sub>N y) = (INum 0\<^sub>N :: 'a)"
[PROOF STATE]
proof (prove)
using this:
isnormNum 0\<^sub>N \<Longrightarrow> (INum (?x1 -\<^sub>N y) = INum 0\<^sub>N) = (?x1 -\<^sub>N y = 0\<^sub>N)

goal (1 subgoal):
 1. (x -\<^sub>N y = 0\<^sub>N) = (INum (x -\<^sub>N y) = INum 0\<^sub>N)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x -\<^sub>N y = 0\<^sub>N) = (INum (x -\<^sub>N y) = INum 0\<^sub>N)

goal (1 subgoal):
 1. (x -\<^sub>N y = 0\<^sub>N) = (x = y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x -\<^sub>N y = 0\<^sub>N) = (INum (x -\<^sub>N y) = INum 0\<^sub>N)

goal (1 subgoal):
 1. (x -\<^sub>N y = 0\<^sub>N) = (x = y)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> INum x = (INum y :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INum (x -\<^sub>N y) = INum 0\<^sub>N) = (INum x = INum y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(INum (x -\<^sub>N y) = INum 0\<^sub>N) = (INum x = INum y)

goal (1 subgoal):
 1. (x -\<^sub>N y = 0\<^sub>N) = (x = y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(INum (x -\<^sub>N y) = INum 0\<^sub>N) = (INum x = INum y)

goal (1 subgoal):
 1. (x -\<^sub>N y = 0\<^sub>N) = (x = y)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INum x = INum y) = (x = y)
[PROOF STEP]
using x y
[PROOF STATE]
proof (prove)
using this:
isnormNum x
isnormNum y

goal (1 subgoal):
 1. (INum x = INum y) = (x = y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(INum x = INum y) = (x = y)

goal (1 subgoal):
 1. (x -\<^sub>N y = 0\<^sub>N) = (x = y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(x -\<^sub>N y = 0\<^sub>N) = (x = y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x -\<^sub>N y = 0\<^sub>N) = (x = y)

goal (1 subgoal):
 1. (x -\<^sub>N y = 0\<^sub>N) = (x = y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(x -\<^sub>N y = 0\<^sub>N) = (x = y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smult_eq_iff:
  fixes b :: "'a :: field"
  assumes "b \<noteq> 0"
  shows "smult a p = smult b q \<longleftrightarrow> smult (a / b) p = q"
    (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (smult a p = smult b q) = (smult (a / b) p = q)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. smult a p = smult b q \<Longrightarrow> smult (a / b) p = q
 2. smult (a / b) p = q \<Longrightarrow> smult a p = smult b q
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
smult a p = smult b q

goal (2 subgoals):
 1. smult a p = smult b q \<Longrightarrow> smult (a / b) p = q
 2. smult (a / b) p = q \<Longrightarrow> smult a p = smult b q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
smult a p = smult b q

goal (2 subgoals):
 1. smult a p = smult b q \<Longrightarrow> smult (a / b) p = q
 2. smult (a / b) p = q \<Longrightarrow> smult a p = smult b q
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> (0::'a)
[PROOF STEP]
have "smult (inverse b) \<dots> = q"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)

goal (1 subgoal):
 1. smult (inverse b) (smult b q) = q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
smult (inverse b) (smult b q) = q

goal (2 subgoals):
 1. smult a p = smult b q \<Longrightarrow> smult (a / b) p = q
 2. smult (a / b) p = q \<Longrightarrow> smult a p = smult b q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
smult (inverse b) (smult a p) = q
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
smult (inverse b) (smult a p) = q

goal (1 subgoal):
 1. smult (a / b) p = q
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
smult (a / b) p = q

goal (1 subgoal):
 1. smult (a / b) p = q \<Longrightarrow> smult a p = smult b q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. smult (a / b) p = q \<Longrightarrow> smult a p = smult b q
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
smult (a / b) p = q

goal (1 subgoal):
 1. smult (a / b) p = q \<Longrightarrow> smult a p = smult b q
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> (0::'a)
smult (a / b) p = q
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)
smult (a / b) p = q

goal (1 subgoal):
 1. smult a p = smult b q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
smult a p = smult b q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infinite_countable_subset':
  assumes X: "infinite X" shows "\<exists>C\<subseteq>X. countable C \<and> infinite C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>C\<subseteq>X. countable C \<and> infinite C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>C\<subseteq>X. countable C \<and> infinite C
[PROOF STEP]
obtain f :: "nat \<Rightarrow> 'a" where "inj f" "range f \<subseteq> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>inj f; range f \<subseteq> X\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using infinite_countable_subset [OF X]
[PROOF STATE]
proof (prove)
using this:
\<exists>f. inj f \<and> range f \<subseteq> X

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>inj f; range f \<subseteq> X\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
inj f
range f \<subseteq> X

goal (1 subgoal):
 1. \<exists>C\<subseteq>X. countable C \<and> infinite C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj f
range f \<subseteq> X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inj f
range f \<subseteq> X

goal (1 subgoal):
 1. \<exists>C\<subseteq>X. countable C \<and> infinite C
[PROOF STEP]
by (intro exI[of _ "range f"]) (auto simp: range_inj_infinite)
[PROOF STATE]
proof (state)
this:
\<exists>C\<subseteq>X. countable C \<and> infinite C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mersenne_mod_less:
  assumes "k \<le> 2 ^ m" "m \<ge> n"
  shows   "mersenne_mod k n < 2 ^ n + 2 ^ (m - n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
have "mersenne_mod k n = k mod 2 ^ n + k div 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mersenne_mod k n = k mod 2 ^ n + k div 2 ^ n
[PROOF STEP]
by (simp add: mersenne_mod_def)
[PROOF STATE]
proof (state)
this:
mersenne_mod k n = k mod 2 ^ n + k div 2 ^ n

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mersenne_mod k n = k mod 2 ^ n + k div 2 ^ n

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
have "k mod 2 ^ n < 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k mod 2 ^ n < 2 ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k mod 2 ^ n < 2 ^ n

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k mod 2 ^ n < 2 ^ n

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
k mod 2 ^ n < 2 ^ n

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
have "k div 2 ^ n * 2 ^ n + 0 \<le> k div 2 ^ n * 2 ^ n + k mod (2 ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k div 2 ^ n * 2 ^ n + 0 \<le> k div 2 ^ n * 2 ^ n + k mod 2 ^ n
[PROOF STEP]
by (intro add_mono) auto
[PROOF STATE]
proof (state)
this:
k div 2 ^ n * 2 ^ n + 0 \<le> k div 2 ^ n * 2 ^ n + k mod 2 ^ n

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k div 2 ^ n * 2 ^ n + 0 \<le> k div 2 ^ n * 2 ^ n + k mod 2 ^ n

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
have "\<dots> = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k div 2 ^ n * 2 ^ n + k mod 2 ^ n = k
[PROOF STEP]
by (subst mult.commute) auto
[PROOF STATE]
proof (state)
this:
k div 2 ^ n * 2 ^ n + k mod 2 ^ n = k

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k div 2 ^ n * 2 ^ n + k mod 2 ^ n = k

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
have "\<dots> \<le> 2 ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> 2 ^ m
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> 2 ^ m
n \<le> m

goal (1 subgoal):
 1. k \<le> 2 ^ m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k \<le> 2 ^ m

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k \<le> 2 ^ m

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
have "\<dots> = 2 ^ (m - n) * 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ m = 2 ^ (m - n) * 2 ^ n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> 2 ^ m
n \<le> m

goal (1 subgoal):
 1. 2 ^ m = 2 ^ (m - n) * 2 ^ n
[PROOF STEP]
by (simp flip: power_add)
[PROOF STATE]
proof (state)
this:
2 ^ m = 2 ^ (m - n) * 2 ^ n

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>k div 2 ^ n * 2 ^ n + 0 \<in> UNIV; k \<in> UNIV; 2 ^ m \<in> UNIV\<rbrakk> \<Longrightarrow> k div 2 ^ n * 2 ^ n + 0 \<le> 2 ^ (m - n) * 2 ^ n
[PROOF STEP]
have "k div 2 ^ n \<le> 2 ^ (m - n)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k div 2 ^ n * 2 ^ n + 0 \<in> UNIV; k \<in> UNIV; 2 ^ m \<in> UNIV\<rbrakk> \<Longrightarrow> k div 2 ^ n * 2 ^ n + 0 \<le> 2 ^ (m - n) * 2 ^ n

goal (1 subgoal):
 1. k div 2 ^ n \<le> 2 ^ (m - n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k div 2 ^ n \<le> 2 ^ (m - n)

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
k div 2 ^ n \<le> 2 ^ (m - n)

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>x y. x < y \<Longrightarrow> x + k div 2 ^ n < y + k div 2 ^ n; \<And>x y. x \<le> y \<Longrightarrow> 2 ^ n + x \<le> 2 ^ n + y\<rbrakk> \<Longrightarrow> mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x y. x < y \<Longrightarrow> x + k div 2 ^ n < y + k div 2 ^ n; \<And>x y. x \<le> y \<Longrightarrow> 2 ^ n + x \<le> 2 ^ n + y\<rbrakk> \<Longrightarrow> mersenne_mod k n < 2 ^ n + 2 ^ (m - n)

goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (m - n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mersenne_mod k n < 2 ^ n + 2 ^ (m - n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sublist_append_exists:
  fixes l1 l2
  shows "subseq (l1 @ l2) l3 \<Longrightarrow> \<exists>l3a l3b. (l3 = l3a @ l3b) \<and> subseq l1 l3a \<and> subseq l2 l3b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subseq (l1 @ l2) l3 \<Longrightarrow> \<exists>l3a l3b. l3 = l3a @ l3b \<and> subseq l1 l3a \<and> subseq l2 l3b
[PROOF STEP]
using list_emb_appendD
[PROOF STATE]
proof (prove)
using this:
list_emb ?P (?xs @ ?ys) ?zs \<Longrightarrow> \<exists>us vs. ?zs = us @ vs \<and> list_emb ?P ?xs us \<and> list_emb ?P ?ys vs

goal (1 subgoal):
 1. subseq (l1 @ l2) l3 \<Longrightarrow> \<exists>l3a l3b. l3 = l3a @ l3b \<and> subseq l1 l3a \<and> subseq l2 l3b
[PROOF STEP]
by fast

\<comment> \<open>NOTE can be solved directly with 'list\_emb\_append\_mono'.\<close>


[STATEMENT]
lemma row_nth_0_or_1_iff:
  assumes "j < dim_col M"
  assumes "i < dim_row M"
  shows "row M i $ j = 0 \<longleftrightarrow> row M i $ j \<noteq> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (row M i $ j = (0::'b)) = (row M i $ j \<noteq> (1::'b))
[PROOF STEP]
proof (intro iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. row M i $ j = (0::'b) \<Longrightarrow> row M i $ j \<noteq> (1::'b)
 2. row M i $ j \<noteq> (1::'b) \<Longrightarrow> row M i $ j = (0::'b)
[PROOF STEP]
have dv: "j < dim_vec (row M i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < dim_vec (row M i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j < dim_col M
i < dim_row M

goal (1 subgoal):
 1. j < dim_vec (row M i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j < dim_vec (row M i)

goal (2 subgoals):
 1. row M i $ j = (0::'b) \<Longrightarrow> row M i $ j \<noteq> (1::'b)
 2. row M i $ j \<noteq> (1::'b) \<Longrightarrow> row M i $ j = (0::'b)
[PROOF STEP]
have sv: "set\<^sub>v (row M i) \<subseteq> {0, 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set\<^sub>v (row M i) \<subseteq> {0::'b, 1::'b}
[PROOF STEP]
using row_elems_ss01 assms
[PROOF STATE]
proof (prove)
using this:
?i < dim_row M \<Longrightarrow> set\<^sub>v (row M ?i) \<subseteq> {0::'b, 1::'b}
j < dim_col M
i < dim_row M

goal (1 subgoal):
 1. set\<^sub>v (row M i) \<subseteq> {0::'b, 1::'b}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set\<^sub>v (row M i) \<subseteq> {0::'b, 1::'b}

goal (2 subgoals):
 1. row M i $ j = (0::'b) \<Longrightarrow> row M i $ j \<noteq> (1::'b)
 2. row M i $ j \<noteq> (1::'b) \<Longrightarrow> row M i $ j = (0::'b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set\<^sub>v (row M i) \<subseteq> {0::'b, 1::'b}
[PROOF STEP]
show "row M i $ j = 0 \<Longrightarrow> row M i $ j \<noteq> 1"
[PROOF STATE]
proof (prove)
using this:
set\<^sub>v (row M i) \<subseteq> {0::'b, 1::'b}

goal (1 subgoal):
 1. row M i $ j = (0::'b) \<Longrightarrow> row M i $ j \<noteq> (1::'b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
row M i $ j = (0::'b) \<Longrightarrow> row M i $ j \<noteq> (1::'b)

goal (1 subgoal):
 1. row M i $ j \<noteq> (1::'b) \<Longrightarrow> row M i $ j = (0::'b)
[PROOF STEP]
show "row M i $ j \<noteq> 1 \<Longrightarrow> row M i $ j = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row M i $ j \<noteq> (1::'b) \<Longrightarrow> row M i $ j = (0::'b)
[PROOF STEP]
using dv sv
[PROOF STATE]
proof (prove)
using this:
j < dim_vec (row M i)
set\<^sub>v (row M i) \<subseteq> {0::'b, 1::'b}

goal (1 subgoal):
 1. row M i $ j \<noteq> (1::'b) \<Longrightarrow> row M i $ j = (0::'b)
[PROOF STEP]
by (meson insertE singletonD subset_eq vec_setI)
[PROOF STATE]
proof (state)
this:
row M i $ j \<noteq> (1::'b) \<Longrightarrow> row M i $ j = (0::'b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_at_ball:
  "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f ` (ball x d) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont f x = (\<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. isCont f x \<Longrightarrow> \<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e
 2. \<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e \<Longrightarrow> isCont f x
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
isCont f x

goal (2 subgoals):
 1. isCont f x \<Longrightarrow> \<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e
 2. \<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e \<Longrightarrow> isCont f x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
isCont f x
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
isCont f x

goal (1 subgoal):
 1. \<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e
[PROOF STEP]
unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball
[PROOF STATE]
proof (prove)
using this:
\<forall>e>0. \<exists>d>0. \<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e

goal (1 subgoal):
 1. \<forall>e>0. \<exists>d>0. \<forall>xa. (\<exists>xb. dist x xb < d \<and> xa = f xb) \<longrightarrow> dist (f x) xa < e
[PROOF STEP]
by (metis dist_commute dist_pos_lt dist_self)
[PROOF STATE]
proof (state)
this:
\<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e

goal (1 subgoal):
 1. \<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e \<Longrightarrow> isCont f x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e \<Longrightarrow> isCont f x
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
\<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e

goal (1 subgoal):
 1. \<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e \<Longrightarrow> isCont f x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
\<forall>e>0. \<exists>d>0. f ` ball x d \<subseteq> ball (f x) e

goal (1 subgoal):
 1. isCont f x
[PROOF STEP]
unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball
[PROOF STATE]
proof (prove)
using this:
\<forall>e>0. \<exists>d>0. \<forall>xa. (\<exists>xb. dist x xb < d \<and> xa = f xb) \<longrightarrow> dist (f x) xa < e

goal (1 subgoal):
 1. \<forall>e>0. \<exists>d>0. \<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e
[PROOF STEP]
by (metis dist_commute)
[PROOF STATE]
proof (state)
this:
isCont f x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inner_prod_distrib_right:
  assumes "dim_vec a = dim_vec b"
  shows "\<langle>a|c \<cdot>\<^sub>v b\<rangle> = c * \<langle>a|b\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>a|c \<cdot>\<^sub>v b\<rangle> = c * \<langle>a|b\<rangle>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_vec a = dim_vec b

goal (1 subgoal):
 1. \<langle>a|c \<cdot>\<^sub>v b\<rangle> = c * \<langle>a|b\<rangle>
[PROOF STEP]
by (simp add: algebra_simps mult_hom.hom_sum)


[STATEMENT]
lemma on_closure_eqI:
  fixes f g :: \<open>'a::topological_space \<Rightarrow> 'b::t2_space\<close>
  assumes eq: \<open>\<And>x. x \<in> S \<Longrightarrow> f x = g x\<close>
  assumes xS: \<open>x \<in> closure S\<close>
  assumes cont: \<open>continuous_on UNIV f\<close> \<open>continuous_on UNIV g\<close>
  shows \<open>f x = g x\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
define X where \<open>X = {x. f x = g x}\<close>
[PROOF STATE]
proof (state)
this:
X = {x. f x = g x}

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
have \<open>closed X\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed X
[PROOF STEP]
using cont
[PROOF STATE]
proof (prove)
using this:
continuous_on UNIV f
continuous_on UNIV g

goal (1 subgoal):
 1. closed X
[PROOF STEP]
by (simp add: X_def closed_Collect_eq)
[PROOF STATE]
proof (state)
this:
closed X

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
closed X

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
have \<open>S \<subseteq> X\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> X
[PROOF STEP]
by (simp add: X_def eq subsetI)
[PROOF STATE]
proof (state)
this:
S \<subseteq> X

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
closed X
S \<subseteq> X
[PROOF STEP]
have \<open>closure S \<subseteq> X\<close>
[PROOF STATE]
proof (prove)
using this:
closed X
S \<subseteq> X

goal (1 subgoal):
 1. closure S \<subseteq> X
[PROOF STEP]
using closure_minimal
[PROOF STATE]
proof (prove)
using this:
closed X
S \<subseteq> X
\<lbrakk>?S \<subseteq> ?T; closed ?T\<rbrakk> \<Longrightarrow> closure ?S \<subseteq> ?T

goal (1 subgoal):
 1. closure S \<subseteq> X
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
closure S \<subseteq> X

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
with xS
[PROOF STATE]
proof (chain)
picking this:
x \<in> closure S
closure S \<subseteq> X
[PROOF STEP]
have \<open>x \<in> X\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> closure S
closure S \<subseteq> X

goal (1 subgoal):
 1. x \<in> X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> X

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
using X_def
[PROOF STATE]
proof (prove)
using this:
x \<in> X
X = {x. f x = g x}

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f x = g x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unlift_equiv: "x \<simeq> y \<Longrightarrow> unlift x \<leftrightarrow> unlift y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<simeq> y \<Longrightarrow> unlift x \<leftrightarrow> unlift y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<simeq> y \<Longrightarrow> unlift x \<leftrightarrow> unlift y
[PROOF STEP]
assume "x \<simeq> y"
[PROOF STATE]
proof (state)
this:
x \<simeq> y

goal (1 subgoal):
 1. x \<simeq> y \<Longrightarrow> unlift x \<leftrightarrow> unlift y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<simeq> y
[PROOF STEP]
have "unlift' (iorder y) x 0 \<leftrightarrow> unlift' (iorder y) y 0"
[PROOF STATE]
proof (prove)
using this:
x \<simeq> y

goal (1 subgoal):
 1. unlift' (iorder y) x 0 \<leftrightarrow> unlift' (iorder y) y 0
[PROOF STEP]
by (rule unlift'_equiv)
[PROOF STATE]
proof (state)
this:
unlift' (iorder y) x 0 \<leftrightarrow> unlift' (iorder y) y 0

goal (1 subgoal):
 1. x \<simeq> y \<Longrightarrow> unlift x \<leftrightarrow> unlift y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
unlift' (iorder y) x 0 \<leftrightarrow> unlift' (iorder y) y 0

goal (1 subgoal):
 1. x \<simeq> y \<Longrightarrow> unlift x \<leftrightarrow> unlift y
[PROOF STEP]
from \<open>x \<simeq> y\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<simeq> y
[PROOF STEP]
have "iorder x = iorder y"
[PROOF STATE]
proof (prove)
using this:
x \<simeq> y

goal (1 subgoal):
 1. iorder x = iorder y
[PROOF STEP]
by (rule iorder_equiv)
[PROOF STATE]
proof (state)
this:
iorder x = iorder y

goal (1 subgoal):
 1. x \<simeq> y \<Longrightarrow> unlift x \<leftrightarrow> unlift y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
unlift' (iorder y) x 0 \<leftrightarrow> unlift' (iorder y) y 0
iorder x = iorder y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
unlift' (iorder y) x 0 \<leftrightarrow> unlift' (iorder y) y 0
iorder x = iorder y

goal (1 subgoal):
 1. unlift x \<leftrightarrow> unlift y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
unlift x \<leftrightarrow> unlift y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma circline_set_unit_circle [simp]:
  shows "circline_set unit_circle = of_complex ` {z. cmod z = 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. circline_set unit_circle = of_complex ` {z. cmod z = 1}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. circline_set unit_circle = of_complex ` {z. cmod z = 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. circline_set unit_circle = of_complex ` {z. cmod z = 1}
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> circline_set unit_circle \<Longrightarrow> x \<in> of_complex ` {z. cmod z = 1}
 2. \<And>x xa. cmod xa = 1 \<Longrightarrow> of_complex xa \<in> circline_set unit_circle
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> circline_set unit_circle \<Longrightarrow> x \<in> of_complex ` {z. cmod z = 1}
 2. \<And>x xa. cmod xa = 1 \<Longrightarrow> of_complex xa \<in> circline_set unit_circle
[PROOF STEP]
assume "x \<in> circline_set unit_circle"
[PROOF STATE]
proof (state)
this:
x \<in> circline_set unit_circle

goal (2 subgoals):
 1. \<And>x. x \<in> circline_set unit_circle \<Longrightarrow> x \<in> of_complex ` {z. cmod z = 1}
 2. \<And>x xa. cmod xa = 1 \<Longrightarrow> of_complex xa \<in> circline_set unit_circle
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> circline_set unit_circle
[PROOF STEP]
obtain x' where "x = of_complex x'"
[PROOF STATE]
proof (prove)
using this:
x \<in> circline_set unit_circle

goal (1 subgoal):
 1. (\<And>x'. x = of_complex x' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using inf_or_of_complex[of x]
[PROOF STATE]
proof (prove)
using this:
x \<in> circline_set unit_circle
x = \<infinity>\<^sub>h \<or> (\<exists>xa. x = of_complex xa)

goal (1 subgoal):
 1. (\<And>x'. x = of_complex x' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = of_complex x'

goal (2 subgoals):
 1. \<And>x. x \<in> circline_set unit_circle \<Longrightarrow> x \<in> of_complex ` {z. cmod z = 1}
 2. \<And>x xa. cmod xa = 1 \<Longrightarrow> of_complex xa \<in> circline_set unit_circle
[PROOF STEP]
thus "x \<in> of_complex ` {z. cmod z = 1}"
[PROOF STATE]
proof (prove)
using this:
x = of_complex x'

goal (1 subgoal):
 1. x \<in> of_complex ` {z. cmod z = 1}
[PROOF STEP]
using \<open>x \<in> circline_set unit_circle\<close>
[PROOF STATE]
proof (prove)
using this:
x = of_complex x'
x \<in> circline_set unit_circle

goal (1 subgoal):
 1. x \<in> of_complex ` {z. cmod z = 1}
[PROOF STEP]
unfolding circline_set_def
[PROOF STATE]
proof (prove)
using this:
x = of_complex x'
x \<in> Collect (on_circline unit_circle)

goal (1 subgoal):
 1. x \<in> of_complex ` {z. cmod z = 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> of_complex ` {z. cmod z = 1}

goal (1 subgoal):
 1. \<And>x xa. cmod xa = 1 \<Longrightarrow> of_complex xa \<in> circline_set unit_circle
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. cmod xa = 1 \<Longrightarrow> of_complex xa \<in> circline_set unit_circle
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. cmod xa = 1 \<Longrightarrow> of_complex xa \<in> circline_set unit_circle
[PROOF STEP]
assume "cmod x = 1"
[PROOF STATE]
proof (state)
this:
cmod x = 1

goal (1 subgoal):
 1. \<And>x xa. cmod xa = 1 \<Longrightarrow> of_complex xa \<in> circline_set unit_circle
[PROOF STEP]
thus "of_complex x \<in> circline_set unit_circle"
[PROOF STATE]
proof (prove)
using this:
cmod x = 1

goal (1 subgoal):
 1. of_complex x \<in> circline_set unit_circle
[PROOF STEP]
unfolding circline_set_def
[PROOF STATE]
proof (prove)
using this:
cmod x = 1

goal (1 subgoal):
 1. of_complex x \<in> Collect (on_circline unit_circle)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_complex x \<in> circline_set unit_circle

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
circline_set unit_circle = of_complex ` {z. cmod z = 1}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uminus_less_lrv[simp]: fixes a b :: "'a :: lrv"
  shows "- a < - b \<longleftrightarrow> b < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- a < - b) = (b < a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (- a < - b) = (b < a)
[PROOF STEP]
have "(- a < - b) = (-1 *R a < -1 *R b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- a < - b) = (- 1 *R a < - 1 *R b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- a < - b) = (- 1 *R a < - 1 *R b)

goal (1 subgoal):
 1. (- a < - b) = (b < a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(- a < - b) = (- 1 *R a < - 1 *R b)

goal (1 subgoal):
 1. (- a < - b) = (b < a)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (b < a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1 *R a < - 1 *R b) = (b < a)
[PROOF STEP]
using scaleRat_less2[of _ _ "-1"] scaleRat_less2[of "-1 *R a" "-1 *R b" "-1"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a < ?b; - 1 < 0\<rbrakk> \<Longrightarrow> - 1 *R ?b < - 1 *R ?a
\<lbrakk>- 1 *R a < - 1 *R b; - 1 < 0\<rbrakk> \<Longrightarrow> - 1 *R - 1 *R b < - 1 *R - 1 *R a

goal (1 subgoal):
 1. (- 1 *R a < - 1 *R b) = (b < a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(- 1 *R a < - 1 *R b) = (b < a)

goal (1 subgoal):
 1. (- a < - b) = (b < a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(- a < - b) = (b < a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(- a < - b) = (b < a)

goal (1 subgoal):
 1. (- a < - b) = (b < a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(- a < - b) = (b < a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_height:
  "size_kdt kdt \<le> 2 ^ height kdt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KD_Tree.size_kdt kdt \<le> 2 ^ height kdt
[PROOF STEP]
proof(induction kdt)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. KD_Tree.size_kdt (Leaf x) \<le> 2 ^ height (Leaf x)
 2. \<And>x1a x2 kdt1 kdt2. \<lbrakk>KD_Tree.size_kdt kdt1 \<le> 2 ^ height kdt1; KD_Tree.size_kdt kdt2 \<le> 2 ^ height kdt2\<rbrakk> \<Longrightarrow> KD_Tree.size_kdt (Node x1a x2 kdt1 kdt2) \<le> 2 ^ height (Node x1a x2 kdt1 kdt2)
[PROOF STEP]
case (Node k v l r)
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt l \<le> 2 ^ height l
KD_Tree.size_kdt r \<le> 2 ^ height r

goal (2 subgoals):
 1. \<And>x. KD_Tree.size_kdt (Leaf x) \<le> 2 ^ height (Leaf x)
 2. \<And>x1a x2 kdt1 kdt2. \<lbrakk>KD_Tree.size_kdt kdt1 \<le> 2 ^ height kdt1; KD_Tree.size_kdt kdt2 \<le> 2 ^ height kdt2\<rbrakk> \<Longrightarrow> KD_Tree.size_kdt (Node x1a x2 kdt1 kdt2) \<le> 2 ^ height (Node x1a x2 kdt1 kdt2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
proof (cases "height l \<le> height r")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
 2. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
height l \<le> height r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
 2. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
have "size_kdt (Node k v l r) = size_kdt l + size_kdt r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KD_Tree.size_kdt (Node k v l r) = KD_Tree.size_kdt l + KD_Tree.size_kdt r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt (Node k v l r) = KD_Tree.size_kdt l + KD_Tree.size_kdt r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
 2. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt (Node k v l r) = KD_Tree.size_kdt l + KD_Tree.size_kdt r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
 2. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
have "\<dots> \<le> 2 ^ height l + 2 ^ height r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KD_Tree.size_kdt l + KD_Tree.size_kdt r \<le> 2 ^ height l + 2 ^ height r
[PROOF STEP]
using Node.IH
[PROOF STATE]
proof (prove)
using this:
KD_Tree.size_kdt l \<le> 2 ^ height l
KD_Tree.size_kdt r \<le> 2 ^ height r

goal (1 subgoal):
 1. KD_Tree.size_kdt l + KD_Tree.size_kdt r \<le> 2 ^ height l + 2 ^ height r
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt l + KD_Tree.size_kdt r \<le> 2 ^ height l + 2 ^ height r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
 2. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt l + KD_Tree.size_kdt r \<le> 2 ^ height l + 2 ^ height r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
 2. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
have "\<dots> \<le> 2 ^ height r + 2 ^ height r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ height l + 2 ^ height r \<le> 2 ^ height r + 2 ^ height r
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
height l \<le> height r

goal (1 subgoal):
 1. 2 ^ height l + 2 ^ height r \<le> 2 ^ height r + 2 ^ height r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ height l + 2 ^ height r \<le> 2 ^ height r + 2 ^ height r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
 2. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 ^ height l + 2 ^ height r \<le> 2 ^ height r + 2 ^ height r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
 2. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
have "\<dots> = 2 ^ height (Node k v l r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ height r + 2 ^ height r = 2 ^ height (Node k v l r)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
height l \<le> height r

goal (1 subgoal):
 1. 2 ^ height r + 2 ^ height r = 2 ^ height (Node k v l r)
[PROOF STEP]
by (auto simp: max_def mult_2)
[PROOF STATE]
proof (state)
this:
2 ^ height r + 2 ^ height r = 2 ^ height (Node k v l r)

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
 2. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)

goal (1 subgoal):
 1. KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> height l \<le> height r

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
have "size_kdt (Node k v l r) = size_kdt l + size_kdt r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KD_Tree.size_kdt (Node k v l r) = KD_Tree.size_kdt l + KD_Tree.size_kdt r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt (Node k v l r) = KD_Tree.size_kdt l + KD_Tree.size_kdt r

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt (Node k v l r) = KD_Tree.size_kdt l + KD_Tree.size_kdt r

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
have "\<dots> \<le> 2 ^ height l + 2 ^ height r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KD_Tree.size_kdt l + KD_Tree.size_kdt r \<le> 2 ^ height l + 2 ^ height r
[PROOF STEP]
using Node.IH
[PROOF STATE]
proof (prove)
using this:
KD_Tree.size_kdt l \<le> 2 ^ height l
KD_Tree.size_kdt r \<le> 2 ^ height r

goal (1 subgoal):
 1. KD_Tree.size_kdt l + KD_Tree.size_kdt r \<le> 2 ^ height l + 2 ^ height r
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt l + KD_Tree.size_kdt r \<le> 2 ^ height l + 2 ^ height r

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt l + KD_Tree.size_kdt r \<le> 2 ^ height l + 2 ^ height r

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
have "\<dots> \<le> 2 ^ height l + 2 ^ height l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ height l + 2 ^ height r \<le> 2 ^ height l + 2 ^ height l
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> height l \<le> height r

goal (1 subgoal):
 1. 2 ^ height l + 2 ^ height r \<le> 2 ^ height l + 2 ^ height l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ height l + 2 ^ height r \<le> 2 ^ height l + 2 ^ height l

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height l + 2 ^ height l
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height l + 2 ^ height l

goal (1 subgoal):
 1. KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height l + 2 ^ height l
\<not> height l \<le> height r

goal (1 subgoal):
 1. KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)
[PROOF STEP]
by (auto simp: max_def mult_2)
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt (Node k v l r) \<le> 2 ^ height (Node k v l r)

goal (1 subgoal):
 1. \<And>x. KD_Tree.size_kdt (Leaf x) \<le> 2 ^ height (Leaf x)
[PROOF STEP]
qed simp


[STATEMENT]
lemma (in ring) Idl_subset_ideal':
  assumes acarr: "a \<in> carrier R" and bcarr: "b \<in> carrier R"
  shows "Idl {a} \<subseteq> Idl {b} \<longleftrightarrow> a \<in> Idl {b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Idl {a} \<subseteq> Idl {b}) = (a \<in> Idl {b})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (Idl {a} \<subseteq> Idl {b}) = (a \<in> Idl {b})
[PROOF STEP]
have "Idl {a} \<subseteq> Idl {b} \<longleftrightarrow> {a} \<subseteq> Idl {b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Idl {a} \<subseteq> Idl {b}) = ({a} \<subseteq> Idl {b})
[PROOF STEP]
by (simp add: Idl_subset_ideal acarr bcarr genideal_ideal)
[PROOF STATE]
proof (state)
this:
(Idl {a} \<subseteq> Idl {b}) = ({a} \<subseteq> Idl {b})

goal (1 subgoal):
 1. (Idl {a} \<subseteq> Idl {b}) = (a \<in> Idl {b})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Idl {a} \<subseteq> Idl {b}) = ({a} \<subseteq> Idl {b})

goal (1 subgoal):
 1. (Idl {a} \<subseteq> Idl {b}) = (a \<in> Idl {b})
[PROOF STEP]
have "\<dots> \<longleftrightarrow> a \<in> Idl {b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a} \<subseteq> Idl {b}) = (a \<in> Idl {b})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
({a} \<subseteq> Idl {b}) = (a \<in> Idl {b})

goal (1 subgoal):
 1. (Idl {a} \<subseteq> Idl {b}) = (a \<in> Idl {b})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(Idl {a} \<subseteq> Idl {b}) = (a \<in> Idl {b})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(Idl {a} \<subseteq> Idl {b}) = (a \<in> Idl {b})

goal (1 subgoal):
 1. (Idl {a} \<subseteq> Idl {b}) = (a \<in> Idl {b})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(Idl {a} \<subseteq> Idl {b}) = (a \<in> Idl {b})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tl_rev: "tl (rev xs) = rev (butlast xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tl (rev xs) = rev (butlast xs)
[PROOF STEP]
using butlast_rev[of "rev xs", symmetric]
[PROOF STATE]
proof (prove)
using this:
rev (tl (rev xs)) = butlast (rev (rev xs))

goal (1 subgoal):
 1. tl (rev xs) = rev (butlast xs)
[PROOF STEP]
unfolding rev_swap rev_rev_ident
[PROOF STATE]
proof (prove)
using this:
tl (rev xs) = rev (butlast xs)

goal (1 subgoal):
 1. tl (rev xs) = rev (butlast xs)
[PROOF STEP]
.


[STATEMENT]
lemma (in group) weak_group_morphism_range:
  assumes "weak_group_morphism f H G" and "a \<in> carrier G" shows "f ` (H #> a) = { f a }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` (H #> a) = {f a}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ` (H #> a) = {f a}
[PROOF STEP]
interpret H: subgroup H G
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup H G
[PROOF STEP]
using weak_group_morphism.axioms(1)[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
H \<lhd> G

goal (1 subgoal):
 1. subgroup H G
[PROOF STEP]
unfolding normal_def
[PROOF STATE]
proof (prove)
using this:
subgroup H G \<and> Group.group G \<and> normal_axioms H G

goal (1 subgoal):
 1. subgroup H G
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ` (H #> a) = {f a}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` (H #> a) = {f a}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f ` (H #> a) \<subseteq> {f a}
 2. {f a} \<subseteq> f ` (H #> a)
[PROOF STEP]
show "{ f a } \<subseteq> f ` (H #> a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f a} \<subseteq> f ` (H #> a)
[PROOF STEP]
using H.one_closed assms(2)
[PROOF STATE]
proof (prove)
using this:
\<one> \<in> H
a \<in> carrier G

goal (1 subgoal):
 1. {f a} \<subseteq> f ` (H #> a)
[PROOF STEP]
unfolding r_coset_def
[PROOF STATE]
proof (prove)
using this:
\<one> \<in> H
a \<in> carrier G

goal (1 subgoal):
 1. {f a} \<subseteq> f ` (\<Union>h\<in>H. {h \<otimes> a})
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{f a} \<subseteq> f ` (H #> a)

goal (1 subgoal):
 1. f ` (H #> a) \<subseteq> {f a}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ` (H #> a) \<subseteq> {f a}
[PROOF STEP]
show "f ` (H #> a) \<subseteq> { f a }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` (H #> a) \<subseteq> {f a}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> f ` (H #> a) \<Longrightarrow> x \<in> {f a}
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> f ` (H #> a) \<Longrightarrow> x \<in> {f a}
[PROOF STEP]
assume "b \<in> f ` (H #> a)"
[PROOF STATE]
proof (state)
this:
b \<in> f ` (H #> a)

goal (1 subgoal):
 1. \<And>x. x \<in> f ` (H #> a) \<Longrightarrow> x \<in> {f a}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in> f ` (H #> a)
[PROOF STEP]
obtain h where "h \<in> H" "h \<in> carrier G" "b = f (h \<otimes> a)"
[PROOF STATE]
proof (prove)
using this:
b \<in> f ` (H #> a)

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h \<in> H; h \<in> carrier G; b = f (h \<otimes> a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding r_coset_def
[PROOF STATE]
proof (prove)
using this:
b \<in> f ` (\<Union>h\<in>H. {h \<otimes> a})

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h \<in> H; h \<in> carrier G; b = f (h \<otimes> a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using H.subset
[PROOF STATE]
proof (prove)
using this:
b \<in> f ` (\<Union>h\<in>H. {h \<otimes> a})
H \<subseteq> carrier G

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h \<in> H; h \<in> carrier G; b = f (h \<otimes> a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
h \<in> H
h \<in> carrier G
b = f (h \<otimes> a)

goal (1 subgoal):
 1. \<And>x. x \<in> f ` (H #> a) \<Longrightarrow> x \<in> {f a}
[PROOF STEP]
thus "b \<in> { f a }"
[PROOF STATE]
proof (prove)
using this:
h \<in> H
h \<in> carrier G
b = f (h \<otimes> a)

goal (1 subgoal):
 1. b \<in> {f a}
[PROOF STEP]
using weak_group_morphism.inj_mod_subgroup[OF assms(1)] assms(2)
[PROOF STATE]
proof (prove)
using this:
h \<in> H
h \<in> carrier G
b = f (h \<otimes> a)
\<lbrakk>?a \<in> carrier G; ?b \<in> carrier G\<rbrakk> \<Longrightarrow> (f ?a = f ?b) = (?a \<otimes> inv ?b \<in> H)
a \<in> carrier G

goal (1 subgoal):
 1. b \<in> {f a}
[PROOF STEP]
by (metis inv_solve_right m_closed singleton_iff)
[PROOF STATE]
proof (state)
this:
b \<in> {f a}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f ` (H #> a) \<subseteq> {f a}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f ` (H #> a) = {f a}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coprime_iff_prime_factors_disjoint:
  fixes x y :: "'a :: factorial_semiring"
  assumes "x \<noteq> 0" "y \<noteq> 0"
  shows "coprime x y \<longleftrightarrow> prime_factors x \<inter> prime_factors y = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime x y = (prime_factors x \<inter> prime_factors y = {})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. coprime x y \<Longrightarrow> prime_factors x \<inter> prime_factors y = {}
 2. prime_factors x \<inter> prime_factors y = {} \<Longrightarrow> coprime x y
[PROOF STEP]
assume "coprime x y"
[PROOF STATE]
proof (state)
this:
coprime x y

goal (2 subgoals):
 1. coprime x y \<Longrightarrow> prime_factors x \<inter> prime_factors y = {}
 2. prime_factors x \<inter> prime_factors y = {} \<Longrightarrow> coprime x y
[PROOF STEP]
have False if "p \<in> prime_factors x" "p \<in> prime_factors y" for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
from that assms
[PROOF STATE]
proof (chain)
picking this:
p \<in># prime_factorization x
p \<in># prime_factorization y
x \<noteq> (0::'a)
y \<noteq> (0::'a)
[PROOF STEP]
have "p dvd x" "p dvd y"
[PROOF STATE]
proof (prove)
using this:
p \<in># prime_factorization x
p \<in># prime_factorization y
x \<noteq> (0::'a)
y \<noteq> (0::'a)

goal (1 subgoal):
 1. p dvd x &&& p dvd y
[PROOF STEP]
by (auto simp: prime_factors_dvd)
[PROOF STATE]
proof (state)
this:
p dvd x
p dvd y

goal (1 subgoal):
 1. False
[PROOF STEP]
with \<open>coprime x y\<close>
[PROOF STATE]
proof (chain)
picking this:
coprime x y
p dvd x
p dvd y
[PROOF STEP]
have "p dvd 1"
[PROOF STATE]
proof (prove)
using this:
coprime x y
p dvd x
p dvd y

goal (1 subgoal):
 1. is_unit p
[PROOF STEP]
using coprime_common_divisor
[PROOF STATE]
proof (prove)
using this:
coprime x y
p dvd x
p dvd y
\<lbrakk>coprime ?a ?b; ?c dvd ?a; ?c dvd ?b\<rbrakk> \<Longrightarrow> is_unit ?c

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

goal (1 subgoal):
 1. False
[PROOF STEP]
with that assms
[PROOF STATE]
proof (chain)
picking this:
p \<in># prime_factorization x
p \<in># prime_factorization y
x \<noteq> (0::'a)
y \<noteq> (0::'a)
is_unit p
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
p \<in># prime_factorization x
p \<in># prime_factorization y
x \<noteq> (0::'a)
y \<noteq> (0::'a)
is_unit p

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?p \<in># prime_factorization x; ?p \<in># prime_factorization y\<rbrakk> \<Longrightarrow> False

goal (2 subgoals):
 1. coprime x y \<Longrightarrow> prime_factors x \<inter> prime_factors y = {}
 2. prime_factors x \<inter> prime_factors y = {} \<Longrightarrow> coprime x y
[PROOF STEP]
thus "prime_factors x \<inter> prime_factors y = {}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?p \<in># prime_factorization x; ?p \<in># prime_factorization y\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. prime_factors x \<inter> prime_factors y = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime_factors x \<inter> prime_factors y = {}

goal (1 subgoal):
 1. prime_factors x \<inter> prime_factors y = {} \<Longrightarrow> coprime x y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_factors x \<inter> prime_factors y = {} \<Longrightarrow> coprime x y
[PROOF STEP]
assume disjoint: "prime_factors x \<inter> prime_factors y = {}"
[PROOF STATE]
proof (state)
this:
prime_factors x \<inter> prime_factors y = {}

goal (1 subgoal):
 1. prime_factors x \<inter> prime_factors y = {} \<Longrightarrow> coprime x y
[PROOF STEP]
show "coprime x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime x y
[PROOF STEP]
proof (rule coprimeI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c. \<lbrakk>c dvd x; c dvd y\<rbrakk> \<Longrightarrow> is_unit c
[PROOF STEP]
fix d
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c. \<lbrakk>c dvd x; c dvd y\<rbrakk> \<Longrightarrow> is_unit c
[PROOF STEP]
assume d: "d dvd x" "d dvd y"
[PROOF STATE]
proof (state)
this:
d dvd x
d dvd y

goal (1 subgoal):
 1. \<And>c. \<lbrakk>c dvd x; c dvd y\<rbrakk> \<Longrightarrow> is_unit c
[PROOF STEP]
show "is_unit d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit d
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> is_unit d \<Longrightarrow> False
[PROOF STEP]
assume "\<not>is_unit d"
[PROOF STATE]
proof (state)
this:
\<not> is_unit d

goal (1 subgoal):
 1. \<not> is_unit d \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> is_unit d

goal (1 subgoal):
 1. \<not> is_unit d \<Longrightarrow> False
[PROOF STEP]
from this and d assms
[PROOF STATE]
proof (chain)
picking this:
\<not> is_unit d
d dvd x
d dvd y
x \<noteq> (0::'a)
y \<noteq> (0::'a)
[PROOF STEP]
have "d \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> is_unit d
d dvd x
d dvd y
x \<noteq> (0::'a)
y \<noteq> (0::'a)

goal (1 subgoal):
 1. d \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d \<noteq> (0::'a)

goal (1 subgoal):
 1. \<not> is_unit d \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> is_unit d
d \<noteq> (0::'a)
[PROOF STEP]
obtain p where p: "prime p" "p dvd d"
[PROOF STATE]
proof (prove)
using this:
\<not> is_unit d
d \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; p dvd d\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using prime_divisor_exists
[PROOF STATE]
proof (prove)
using this:
\<not> is_unit d
d \<noteq> (0::'a)
\<lbrakk>?a \<noteq> (0::?'a); \<not> is_unit ?a\<rbrakk> \<Longrightarrow> \<exists>b. b dvd ?a \<and> prime b

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

goal (1 subgoal):
 1. \<not> is_unit d \<Longrightarrow> False
[PROOF STEP]
with d and assms
[PROOF STATE]
proof (chain)
picking this:
d dvd x
d dvd y
x \<noteq> (0::'a)
y \<noteq> (0::'a)
prime p
p dvd d
[PROOF STEP]
have "p \<in> prime_factors x \<inter> prime_factors y"
[PROOF STATE]
proof (prove)
using this:
d dvd x
d dvd y
x \<noteq> (0::'a)
y \<noteq> (0::'a)
prime p
p dvd d

goal (1 subgoal):
 1. p \<in> prime_factors x \<inter> prime_factors y
[PROOF STEP]
by (auto simp: prime_factors_dvd)
[PROOF STATE]
proof (state)
this:
p \<in> prime_factors x \<inter> prime_factors y

goal (1 subgoal):
 1. \<not> is_unit d \<Longrightarrow> False
[PROOF STEP]
with disjoint
[PROOF STATE]
proof (chain)
picking this:
prime_factors x \<inter> prime_factors y = {}
p \<in> prime_factors x \<inter> prime_factors y
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
prime_factors x \<inter> prime_factors y = {}
p \<in> prime_factors x \<inter> prime_factors y

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
is_unit d

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
coprime x y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_le_of_rat_iff [simp]: "0 \<le> (of_rat r :: 'a::linordered_field) \<longleftrightarrow> 0 \<le> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) \<le> of_rat r) = (0 \<le> r)
[PROOF STEP]
using of_rat_less_eq [of 0 r, where 'a = 'a]
[PROOF STATE]
proof (prove)
using this:
(of_rat 0 \<le> of_rat r) = (0 \<le> r)

goal (1 subgoal):
 1. ((0::'a) \<le> of_rat r) = (0 \<le> r)
[PROOF STEP]
by simp


[STATEMENT]
lemma (in vector_space) dim_pos_finite_dimensional_vector_spaceE:
  assumes "dim (UNIV::'b set) > 0"
  obtains basis where "finite_dimensional_vector_space scale basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>basis. finite_dimensional_vector_space (*s) basis \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>basis. finite_dimensional_vector_space (*s) basis \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < local.dim UNIV
[PROOF STEP]
obtain b where b: "local.span b = local.span UNIV" "local.independent b"
[PROOF STATE]
proof (prove)
using this:
0 < local.dim UNIV

goal (1 subgoal):
 1. (\<And>b. \<lbrakk>local.span b = local.span UNIV; local.independent b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: dim_def split: if_splits)
[PROOF STATE]
proof (state)
this:
local.span b = local.span UNIV
local.independent b

goal (1 subgoal):
 1. (\<And>basis. finite_dimensional_vector_space (*s) basis \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
local.span b = local.span UNIV
local.independent b
[PROOF STEP]
have "dim UNIV = card b"
[PROOF STATE]
proof (prove)
using this:
local.span b = local.span UNIV
local.independent b

goal (1 subgoal):
 1. local.dim UNIV = card b
[PROOF STEP]
by (rule dim_eq_card)
[PROOF STATE]
proof (state)
this:
local.dim UNIV = card b

goal (1 subgoal):
 1. (\<And>basis. finite_dimensional_vector_space (*s) basis \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < local.dim UNIV
local.dim UNIV = card b
[PROOF STEP]
have "finite b"
[PROOF STATE]
proof (prove)
using this:
0 < local.dim UNIV
local.dim UNIV = card b

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

goal (1 subgoal):
 1. (\<And>basis. finite_dimensional_vector_space (*s) basis \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite b
[PROOF STEP]
have "finite_dimensional_vector_space scale b"
[PROOF STATE]
proof (prove)
using this:
finite b

goal (1 subgoal):
 1. finite_dimensional_vector_space (*s) b
[PROOF STEP]
by unfold_locales (auto simp: b)
[PROOF STATE]
proof (state)
this:
finite_dimensional_vector_space (*s) b

goal (1 subgoal):
 1. (\<And>basis. finite_dimensional_vector_space (*s) basis \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite_dimensional_vector_space (*s) b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite_dimensional_vector_space (*s) b

goal (1 subgoal):
 1. thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inverse_permutation_of_list_correct:
  fixes A :: "'a set"
  assumes "list_permutes xs A"
  shows "inverse_permutation_of_list xs = inv (permutation_of_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse_permutation_of_list xs = inv (permutation_of_list xs)
[PROOF STEP]
proof (rule ext, rule sym, subst permutes_inv_eq)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. permutation_of_list xs permutes ?S4 x
 2. \<And>x. permutation_of_list xs (inverse_permutation_of_list xs x) = x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
list_permutes xs A
[PROOF STEP]
show "permutation_of_list xs permutes A"
[PROOF STATE]
proof (prove)
using this:
list_permutes xs A

goal (1 subgoal):
 1. permutation_of_list xs permutes A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
permutation_of_list xs permutes A

goal (1 subgoal):
 1. \<And>x. permutation_of_list xs (inverse_permutation_of_list xs x) = x
[PROOF STEP]
show "permutation_of_list xs (inverse_permutation_of_list xs x) = x" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_of_list xs (inverse_permutation_of_list xs x) = x
[PROOF STEP]
proof (cases "x \<in> set (map snd xs)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> set (map snd xs) \<Longrightarrow> permutation_of_list xs (inverse_permutation_of_list xs x) = x
 2. x \<notin> set (map snd xs) \<Longrightarrow> permutation_of_list xs (inverse_permutation_of_list xs x) = x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x \<in> set (map snd xs)

goal (2 subgoals):
 1. x \<in> set (map snd xs) \<Longrightarrow> permutation_of_list xs (inverse_permutation_of_list xs x) = x
 2. x \<notin> set (map snd xs) \<Longrightarrow> permutation_of_list xs (inverse_permutation_of_list xs x) = x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> set (map snd xs)
[PROOF STEP]
obtain y where "(y, x) \<in> set xs"
[PROOF STATE]
proof (prove)
using this:
x \<in> set (map snd xs)

goal (1 subgoal):
 1. (\<And>y. (y, x) \<in> set xs \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(y, x) \<in> set xs

goal (2 subgoals):
 1. x \<in> set (map snd xs) \<Longrightarrow> permutation_of_list xs (inverse_permutation_of_list xs x) = x
 2. x \<notin> set (map snd xs) \<Longrightarrow> permutation_of_list xs (inverse_permutation_of_list xs x) = x
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
list_permutes xs A
(y, x) \<in> set xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
list_permutes xs A
(y, x) \<in> set xs

goal (1 subgoal):
 1. permutation_of_list xs (inverse_permutation_of_list xs x) = x
[PROOF STEP]
by (simp add: inverse_permutation_of_list_unique permutation_of_list_unique)
[PROOF STATE]
proof (state)
this:
permutation_of_list xs (inverse_permutation_of_list xs x) = x

goal (1 subgoal):
 1. x \<notin> set (map snd xs) \<Longrightarrow> permutation_of_list xs (inverse_permutation_of_list xs x) = x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<notin> set (map snd xs) \<Longrightarrow> permutation_of_list xs (inverse_permutation_of_list xs x) = x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<notin> set (map snd xs)

goal (1 subgoal):
 1. x \<notin> set (map snd xs) \<Longrightarrow> permutation_of_list xs (inverse_permutation_of_list xs x) = x
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
list_permutes xs A
x \<notin> set (map snd xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
list_permutes xs A
x \<notin> set (map snd xs)

goal (1 subgoal):
 1. permutation_of_list xs (inverse_permutation_of_list xs x) = x
[PROOF STEP]
by (auto simp: list_permutes_def inverse_permutation_of_list_id permutation_of_list_id)
[PROOF STATE]
proof (state)
this:
permutation_of_list xs (inverse_permutation_of_list xs x) = x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
permutation_of_list xs (inverse_permutation_of_list xs ?x) = ?x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma n_multiset_permutation_enum_correct2:
  "ys \<in> set (n_permutation_enum xs n) \<Longrightarrow> mset ys \<subseteq># mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ys \<in> set (n_permutation_enum xs n) \<Longrightarrow> mset ys \<subseteq># mset xs
[PROOF STEP]
proof(induct "n" arbitrary: xs ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs ys. ys \<in> set (n_permutation_enum xs 0) \<Longrightarrow> mset ys \<subseteq># mset xs
 2. \<And>n xs ys. \<lbrakk>\<And>xs ys. ys \<in> set (n_permutation_enum xs n) \<Longrightarrow> mset ys \<subseteq># mset xs; ys \<in> set (n_permutation_enum xs (Suc n))\<rbrakk> \<Longrightarrow> mset ys \<subseteq># mset xs
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
ys \<in> set (n_permutation_enum xs 0)

goal (2 subgoals):
 1. \<And>xs ys. ys \<in> set (n_permutation_enum xs 0) \<Longrightarrow> mset ys \<subseteq># mset xs
 2. \<And>n xs ys. \<lbrakk>\<And>xs ys. ys \<in> set (n_permutation_enum xs n) \<Longrightarrow> mset ys \<subseteq># mset xs; ys \<in> set (n_permutation_enum xs (Suc n))\<rbrakk> \<Longrightarrow> mset ys \<subseteq># mset xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ys \<in> set (n_permutation_enum xs 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
ys \<in> set (n_permutation_enum xs 0)

goal (1 subgoal):
 1. mset ys \<subseteq># mset xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mset ys \<subseteq># mset xs

goal (1 subgoal):
 1. \<And>n xs ys. \<lbrakk>\<And>xs ys. ys \<in> set (n_permutation_enum xs n) \<Longrightarrow> mset ys \<subseteq># mset xs; ys \<in> set (n_permutation_enum xs (Suc n))\<rbrakk> \<Longrightarrow> mset ys \<subseteq># mset xs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n xs ys. \<lbrakk>\<And>xs ys. ys \<in> set (n_permutation_enum xs n) \<Longrightarrow> mset ys \<subseteq># mset xs; ys \<in> set (n_permutation_enum xs (Suc n))\<rbrakk> \<Longrightarrow> mset ys \<subseteq># mset xs
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
?ys \<in> set (n_permutation_enum ?xs n) \<Longrightarrow> mset ?ys \<subseteq># mset ?xs
ys \<in> set (n_permutation_enum xs (Suc n))

goal (1 subgoal):
 1. \<And>n xs ys. \<lbrakk>\<And>xs ys. ys \<in> set (n_permutation_enum xs n) \<Longrightarrow> mset ys \<subseteq># mset xs; ys \<in> set (n_permutation_enum xs (Suc n))\<rbrakk> \<Longrightarrow> mset ys \<subseteq># mset xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?ys \<in> set (n_permutation_enum ?xs n) \<Longrightarrow> mset ?ys \<subseteq># mset ?xs
ys \<in> set (n_permutation_enum xs (Suc n))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?ys \<in> set (n_permutation_enum ?xs n) \<Longrightarrow> mset ?ys \<subseteq># mset ?xs
ys \<in> set (n_permutation_enum xs (Suc n))

goal (1 subgoal):
 1. mset ys \<subseteq># mset xs
[PROOF STEP]
using insert_subset_eq_iff mset_remove1
[PROOF STATE]
proof (prove)
using this:
?ys \<in> set (n_permutation_enum ?xs n) \<Longrightarrow> mset ?ys \<subseteq># mset ?xs
ys \<in> set (n_permutation_enum xs (Suc n))
(add_mset ?a ?A \<subseteq># ?B) = (?a \<in># ?B \<and> ?A \<subseteq># ?B - {#?a#})
mset (remove1 ?a ?xs) = mset ?xs - {#?a#}

goal (1 subgoal):
 1. mset ys \<subseteq># mset xs
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
mset ys \<subseteq># mset xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_permutations_inverse: "sum f {p. p permutes S} = sum (\<lambda>p. f(inv p)) {p. p permutes S}"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {p. p permutes S} = (\<Sum>p | p permutes S. f (inv p))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum f {p. p permutes S} = (\<Sum>p | p permutes S. f (inv p))
[PROOF STEP]
let ?S = "{p . p permutes S}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum f {p. p permutes S} = (\<Sum>p | p permutes S. f (inv p))
[PROOF STEP]
have *: "inj_on inv ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on inv {p. p permutes S}
[PROOF STEP]
proof (auto simp add: inj_on_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x permutes S; y permutes S; inv x = inv y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix q r
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x permutes S; y permutes S; inv x = inv y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume q: "q permutes S"
      and r: "r permutes S"
      and qr: "inv q = inv r"
[PROOF STATE]
proof (state)
this:
q permutes S
r permutes S
inv q = inv r

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x permutes S; y permutes S; inv x = inv y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q permutes S
r permutes S
inv q = inv r
[PROOF STEP]
have "inv (inv q) = inv (inv r)"
[PROOF STATE]
proof (prove)
using this:
q permutes S
r permutes S
inv q = inv r

goal (1 subgoal):
 1. inv (inv q) = inv (inv r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inv (inv q) = inv (inv r)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x permutes S; y permutes S; inv x = inv y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
with permutes_inv_inv[OF q] permutes_inv_inv[OF r]
[PROOF STATE]
proof (chain)
picking this:
inv (inv q) = q
inv (inv r) = r
inv (inv q) = inv (inv r)
[PROOF STEP]
show "q = r"
[PROOF STATE]
proof (prove)
using this:
inv (inv q) = q
inv (inv r) = r
inv (inv q) = inv (inv r)

goal (1 subgoal):
 1. q = r
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
q = r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on inv {p. p permutes S}

goal (1 subgoal):
 1. sum f {p. p permutes S} = (\<Sum>p | p permutes S. f (inv p))
[PROOF STEP]
have **: "inv ` ?S = ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv ` {p. p permutes S} = {p. p permutes S}
[PROOF STEP]
using image_inverse_permutations
[PROOF STATE]
proof (prove)
using this:
{inv p |p. p permutes ?S} = {p. p permutes ?S}

goal (1 subgoal):
 1. inv ` {p. p permutes S} = {p. p permutes S}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
inv ` {p. p permutes S} = {p. p permutes S}

goal (1 subgoal):
 1. sum f {p. p permutes S} = (\<Sum>p | p permutes S. f (inv p))
[PROOF STEP]
have ***: "?rhs = sum (f \<circ> inv) ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | p permutes S. f (inv p)) = sum (f \<circ> inv) {p. p permutes S}
[PROOF STEP]
by (simp add: o_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>p | p permutes S. f (inv p)) = sum (f \<circ> inv) {p. p permutes S}

goal (1 subgoal):
 1. sum f {p. p permutes S} = (\<Sum>p | p permutes S. f (inv p))
[PROOF STEP]
from sum.reindex[OF *, of f]
[PROOF STATE]
proof (chain)
picking this:
sum f (inv ` {p. p permutes S}) = sum (f \<circ> inv) {p. p permutes S}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum f (inv ` {p. p permutes S}) = sum (f \<circ> inv) {p. p permutes S}

goal (1 subgoal):
 1. sum f {p. p permutes S} = (\<Sum>p | p permutes S. f (inv p))
[PROOF STEP]
by (simp only: ** ***)
[PROOF STATE]
proof (state)
this:
sum f {p. p permutes S} = (\<Sum>p | p permutes S. f (inv p))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_roots_factorization:
  fixes p c A
  assumes [simp]: "c \<noteq> 0"
  defines "p \<equiv> Polynomial.smult c (prod_mset (image_mset (\<lambda>x. [:-x, 1:]) A))"
  shows   "poly_roots p = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots p = A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_roots p = A
[PROOF STEP]
have "poly_roots p = poly_roots (\<Prod>x\<in>#A. [:-x, 1:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots p = poly_roots (\<Prod>x\<in>#A. [:- x, 1::'a:])
[PROOF STEP]
by (auto simp: p_def)
[PROOF STATE]
proof (state)
this:
poly_roots p = poly_roots (\<Prod>x\<in>#A. [:- x, 1::'a:])

goal (1 subgoal):
 1. poly_roots p = A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_roots p = poly_roots (\<Prod>x\<in>#A. [:- x, 1::'a:])

goal (1 subgoal):
 1. poly_roots p = A
[PROOF STEP]
have "\<dots> = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (\<Prod>x\<in>#A. [:- x, 1::'a:]) = A
[PROOF STEP]
by (subst poly_roots_prod_mset) (auto simp: image_mset.compositionality o_def)
[PROOF STATE]
proof (state)
this:
poly_roots (\<Prod>x\<in>#A. [:- x, 1::'a:]) = A

goal (1 subgoal):
 1. poly_roots p = A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly_roots p = A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly_roots p = A

goal (1 subgoal):
 1. poly_roots p = A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poly_roots p = A

goal:
No subgoals!
[PROOF STEP]
qed