[STATEMENT]
lemma (in metric_space) totally_bounded_metric:
  "totally_bounded S \<longleftrightarrow> (\<forall>e>0. \<exists>k. finite k \<and> S \<subseteq> (\<Union>x\<in>k. {y. dist x y < e}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totally_bounded S = (\<forall>e>0. \<exists>k. finite k \<and> S \<subseteq> (\<Union>x\<in>k. {y. dist x y < e}))
[PROOF STEP]
unfolding totally_bounded_def eventually_uniformity_metric imp_ex
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>E x. 0 < x \<and> (\<forall>xa y. dist xa y < x \<longrightarrow> E (xa, y)) \<longrightarrow> (\<exists>X. finite X \<and> (\<forall>s\<in>S. \<exists>x\<in>X. E (x, s)))) = (\<forall>e>0. \<exists>k. finite k \<and> S \<subseteq> (\<Union>x\<in>k. {y. dist x y < e}))
[PROOF STEP]
apply (subst all_comm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>y x. 0 < y \<and> (\<forall>xa ya. dist xa ya < y \<longrightarrow> x (xa, ya)) \<longrightarrow> (\<exists>X. finite X \<and> (\<forall>s\<in>S. \<exists>xa\<in>X. x (xa, s)))) = (\<forall>e>0. \<exists>k. finite k \<and> S \<subseteq> (\<Union>x\<in>k. {y. dist x y < e}))
[PROOF STEP]
apply (intro arg_cong[where f=All] ext, safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y. \<lbrakk>\<forall>x. 0 < y \<and> (\<forall>xa ya. dist xa ya < y \<longrightarrow> x (xa, ya)) \<longrightarrow> (\<exists>X. finite X \<and> (\<forall>s\<in>S. \<exists>xa\<in>X. x (xa, s))); 0 < y\<rbrakk> \<Longrightarrow> \<exists>k. finite k \<and> S \<subseteq> (\<Union>x\<in>k. {ya. dist x ya < y})
 2. \<And>y x k. \<lbrakk>0 < y; \<forall>xa ya. dist xa ya < y \<longrightarrow> x (xa, ya); finite k; S \<subseteq> (\<Union>x\<in>k. {ya. dist x ya < y})\<rbrakk> \<Longrightarrow> \<exists>X. finite X \<and> (\<forall>s\<in>S. \<exists>xa\<in>X. x (xa, s))
[PROOF STEP]
subgoal for e
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. 0 < e \<and> (\<forall>xa y. dist xa y < e \<longrightarrow> x (xa, y)) \<longrightarrow> (\<exists>X. finite X \<and> (\<forall>s\<in>S. \<exists>xa\<in>X. x (xa, s))); 0 < e\<rbrakk> \<Longrightarrow> \<exists>k. finite k \<and> S \<subseteq> (\<Union>x\<in>k. {y. dist x y < e})
[PROOF STEP]
apply (erule allE[of _ "\<lambda>(x, y). dist x y < e"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < e; 0 < e \<and> (\<forall>x y. dist x y < e \<longrightarrow> (case (x, y) of (x, y) \<Rightarrow> dist x y < e)) \<longrightarrow> (\<exists>X. finite X \<and> (\<forall>s\<in>S. \<exists>x\<in>X. case (x, s) of (x, y) \<Rightarrow> dist x y < e))\<rbrakk> \<Longrightarrow> \<exists>k. finite k \<and> S \<subseteq> (\<Union>x\<in>k. {y. dist x y < e})
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y x k. \<lbrakk>0 < y; \<forall>xa ya. dist xa ya < y \<longrightarrow> x (xa, ya); finite k; S \<subseteq> (\<Union>x\<in>k. {ya. dist x ya < y})\<rbrakk> \<Longrightarrow> \<exists>X. finite X \<and> (\<forall>s\<in>S. \<exists>xa\<in>X. x (xa, s))
[PROOF STEP]
subgoal for e P k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < e; \<forall>x y. dist x y < e \<longrightarrow> P (x, y); finite k; S \<subseteq> (\<Union>x\<in>k. {y. dist x y < e})\<rbrakk> \<Longrightarrow> \<exists>X. finite X \<and> (\<forall>s\<in>S. \<exists>x\<in>X. P (x, s))
[PROOF STEP]
apply (intro exI[of _ k])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < e; \<forall>x y. dist x y < e \<longrightarrow> P (x, y); finite k; S \<subseteq> (\<Union>x\<in>k. {y. dist x y < e})\<rbrakk> \<Longrightarrow> finite k \<and> (\<forall>s\<in>S. \<exists>x\<in>k. P (x, s))
[PROOF STEP]
apply (force simp: subset_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma pathin_subtopology:
     "pathin (subtopology X S) g \<longleftrightarrow> pathin X g \<and> (\<forall>x \<in> {0..1}. g x \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pathin (subtopology X S) g = (pathin X g \<and> (\<forall>x\<in>{0..1}. g x \<in> S))
[PROOF STEP]
by (auto simp: pathin_def continuous_map_in_subtopology)


[STATEMENT]
lemma norm_Pair_le:
  shows "norm (x, y) \<le> norm x + norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (x, y) \<le> norm x + norm y
[PROOF STEP]
unfolding norm_Pair
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt ((norm x)\<^sup>2 + (norm y)\<^sup>2) \<le> norm x + norm y
[PROOF STEP]
by (metis norm_ge_zero sqrt_sum_squares_le_sum)


[STATEMENT]
lemma summable_minus_iff: "summable (\<lambda>n. - f n) \<longleftrightarrow> summable f"
  for f :: "nat \<Rightarrow> 'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. - f n) = summable f
[PROOF STEP]
by (auto dest: summable_minus)


[STATEMENT]
lemma compute_float_times[code]: "Float m1 e1 * Float m2 e2 = Float (m1 * m2) (e1 + e2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Float m1 e1 * Float m2 e2 = Float (m1 * m2) (e1 + e2)
[PROOF STEP]
by transfer (simp add: field_simps powr_add)


[STATEMENT]
lemma genPrefix_trans_O:
  assumes "(x, y) \<in> genPrefix r"
  shows "\<And>z. (y, z) \<in> genPrefix s \<Longrightarrow> (x, z) \<in> genPrefix (r O s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z. (y, z) \<in> genPrefix s \<Longrightarrow> (x, z) \<in> genPrefix (r O s)
[PROOF STEP]
apply (atomize (full))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>z. (y, z) \<in> genPrefix s \<longrightarrow> (x, z) \<in> genPrefix (r O s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> genPrefix r

goal (1 subgoal):
 1. \<forall>z. (y, z) \<in> genPrefix s \<longrightarrow> (x, z) \<in> genPrefix (r O s)
[PROOF STEP]
apply induct
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<forall>z. ([], z) \<in> genPrefix s \<longrightarrow> ([], z) \<in> genPrefix (r O s)
 2. \<And>xs ys x y. \<lbrakk>(xs, ys) \<in> genPrefix r; \<forall>z. (ys, z) \<in> genPrefix s \<longrightarrow> (xs, z) \<in> genPrefix (r O s); (x, y) \<in> r\<rbrakk> \<Longrightarrow> \<forall>z. (y # ys, z) \<in> genPrefix s \<longrightarrow> (x # xs, z) \<in> genPrefix (r O s)
 3. \<And>xs ys zs. \<lbrakk>(xs, ys) \<in> genPrefix r; \<forall>z. (ys, z) \<in> genPrefix s \<longrightarrow> (xs, z) \<in> genPrefix (r O s)\<rbrakk> \<Longrightarrow> \<forall>z. (ys @ zs, z) \<in> genPrefix s \<longrightarrow> (xs, z) \<in> genPrefix (r O s)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xs ys x y. \<lbrakk>(xs, ys) \<in> genPrefix r; \<forall>z. (ys, z) \<in> genPrefix s \<longrightarrow> (xs, z) \<in> genPrefix (r O s); (x, y) \<in> r\<rbrakk> \<Longrightarrow> \<forall>z. (y # ys, z) \<in> genPrefix s \<longrightarrow> (x # xs, z) \<in> genPrefix (r O s)
 2. \<And>xs ys zs. \<lbrakk>(xs, ys) \<in> genPrefix r; \<forall>z. (ys, z) \<in> genPrefix s \<longrightarrow> (xs, z) \<in> genPrefix (r O s)\<rbrakk> \<Longrightarrow> \<forall>z. (ys @ zs, z) \<in> genPrefix s \<longrightarrow> (xs, z) \<in> genPrefix (r O s)
[PROOF STEP]
apply (blast intro: genPrefix.prepend)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs ys zs. \<lbrakk>(xs, ys) \<in> genPrefix r; \<forall>z. (ys, z) \<in> genPrefix s \<longrightarrow> (xs, z) \<in> genPrefix (r O s)\<rbrakk> \<Longrightarrow> \<forall>z. (ys @ zs, z) \<in> genPrefix s \<longrightarrow> (xs, z) \<in> genPrefix (r O s)
[PROOF STEP]
apply (blast dest: append_genPrefix)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma no_roots_inbetween_imp_same_sign:
  assumes "a < b" "\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> (0::real)"
  shows "sgn (poly p a) = sgn (poly p b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn (poly p a) = sgn (poly p b)
[PROOF STEP]
using poly_different_sign_imp_root assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a < ?b; sgn (poly ?p ?a) \<noteq> sgn (poly ?p ?b)\<rbrakk> \<Longrightarrow> \<exists>x\<ge>?a. x \<le> ?b \<and> poly ?p x = 0
a < b
\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. sgn (poly p a) = sgn (poly p b)
[PROOF STEP]
by auto


[STATEMENT]
lemma mod_nat_int_pow_eq:
  fixes n :: nat and p a :: int
  shows "a \<ge> 0 \<Longrightarrow> p \<ge> 0 \<Longrightarrow> (nat a ^ n) mod (nat p) = nat ((a ^ n) mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> a; 0 \<le> p\<rbrakk> \<Longrightarrow> nat a ^ n mod nat p = nat (a ^ n mod p)
[PROOF STEP]
by (simp add: int_one_le_iff_zero_less nat_mod_distrib order_less_imp_le nat_power_eq[symmetric])


[STATEMENT]
lemma rank_eq_card_iarrays_code:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}"
  shows "rank A = (let A' = (Gauss_Jordan_iarrays (matrix_to_iarray A)) in card {i::'rows. \<not> is_zero_iarray (A' !! (to_nat i))})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = (let A' = Gauss_Jordan_iarrays (matrix_to_iarray A) in card {i. \<not> is_zero_iarray (A' !! mod_type_class.to_nat i)})
[PROOF STEP]
proof (unfold rank_eq_card_iarrays' Let_def, rule bij_betw_same_card[symmetric, of "\<lambda>i. row_iarray (to_nat i) (Gauss_Jordan_iarrays (matrix_to_iarray A))"],
    unfold bij_betw_def inj_on_def, auto, unfold IArray.sub_def[symmetric])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat x); \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat y); row_iarray (mod_type_class.to_nat x) (Gauss_Jordan_iarrays (matrix_to_iarray A)) = row_iarray (mod_type_class.to_nat y) (Gauss_Jordan_iarrays (matrix_to_iarray A))\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix x y::'rows
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat x); \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat y); row_iarray (mod_type_class.to_nat x) (Gauss_Jordan_iarrays (matrix_to_iarray A)) = row_iarray (mod_type_class.to_nat y) (Gauss_Jordan_iarrays (matrix_to_iarray A))\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume x: "\<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! to_nat x)"
    and y: "\<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! to_nat y)"
    and eq: "row_iarray (to_nat x) (Gauss_Jordan_iarrays (matrix_to_iarray A)) = row_iarray (to_nat y) (Gauss_Jordan_iarrays (matrix_to_iarray A))"
[PROOF STATE]
proof (state)
this:
\<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat x)
\<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat y)
row_iarray (mod_type_class.to_nat x) (Gauss_Jordan_iarrays (matrix_to_iarray A)) = row_iarray (mod_type_class.to_nat y) (Gauss_Jordan_iarrays (matrix_to_iarray A))

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat x); \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat y); row_iarray (mod_type_class.to_nat x) (Gauss_Jordan_iarrays (matrix_to_iarray A)) = row_iarray (mod_type_class.to_nat y) (Gauss_Jordan_iarrays (matrix_to_iarray A))\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have eq': "(Gauss_Jordan A) $ x = (Gauss_Jordan A) $ y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gauss_Jordan A $ x = Gauss_Jordan A $ y
[PROOF STEP]
by (metis eq matrix_to_iarray_Gauss_Jordan row_iarray_def vec_matrix vec_to_iarray_morph)
[PROOF STATE]
proof (state)
this:
Gauss_Jordan A $ x = Gauss_Jordan A $ y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat x); \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat y); row_iarray (mod_type_class.to_nat x) (Gauss_Jordan_iarrays (matrix_to_iarray A)) = row_iarray (mod_type_class.to_nat y) (Gauss_Jordan_iarrays (matrix_to_iarray A))\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence not_zero_x: "\<not> is_zero_row x (Gauss_Jordan A)" and not_zero_y: "\<not> is_zero_row y (Gauss_Jordan A)"
[PROOF STATE]
proof (prove)
using this:
Gauss_Jordan A $ x = Gauss_Jordan A $ y

goal (1 subgoal):
 1. \<not> is_zero_row x (Gauss_Jordan A) &&& \<not> is_zero_row y (Gauss_Jordan A)
[PROOF STEP]
by (metis  is_zero_iarray_eq_iff is_zero_row_def' matrix_to_iarray_Gauss_Jordan vec_eq_iff vec_matrix x zero_index)+
[PROOF STATE]
proof (state)
this:
\<not> is_zero_row x (Gauss_Jordan A)
\<not> is_zero_row y (Gauss_Jordan A)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat x); \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat y); row_iarray (mod_type_class.to_nat x) (Gauss_Jordan_iarrays (matrix_to_iarray A)) = row_iarray (mod_type_class.to_nat y) (Gauss_Jordan_iarrays (matrix_to_iarray A))\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence x_in: "row x (Gauss_Jordan A) \<in> {row i (Gauss_Jordan A) |i::'rows. row i (Gauss_Jordan A) \<noteq> 0}"
    and y_in: "row y (Gauss_Jordan A) \<in> {row i (Gauss_Jordan A) |i::'rows. row i (Gauss_Jordan A) \<noteq> 0}"
[PROOF STATE]
proof (prove)
using this:
\<not> is_zero_row x (Gauss_Jordan A)
\<not> is_zero_row y (Gauss_Jordan A)

goal (1 subgoal):
 1. row x (Gauss_Jordan A) \<in> {row i (Gauss_Jordan A) |i. row i (Gauss_Jordan A) \<noteq> 0} &&& row y (Gauss_Jordan A) \<in> {row i (Gauss_Jordan A) |i. row i (Gauss_Jordan A) \<noteq> 0}
[PROOF STEP]
by (metis (lifting, mono_tags) is_zero_iarray_eq_iff matrix_to_iarray_Gauss_Jordan mem_Collect_eq vec_to_iarray_row' x y)+
[PROOF STATE]
proof (state)
this:
row x (Gauss_Jordan A) \<in> {row i (Gauss_Jordan A) |i. row i (Gauss_Jordan A) \<noteq> 0}
row y (Gauss_Jordan A) \<in> {row i (Gauss_Jordan A) |i. row i (Gauss_Jordan A) \<noteq> 0}

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>\<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat x); \<not> is_zero_iarray (Gauss_Jordan_iarrays (matrix_to_iarray A) !! mod_type_class.to_nat y); row_iarray (mod_type_class.to_nat x) (Gauss_Jordan_iarrays (matrix_to_iarray A)) = row_iarray (mod_type_class.to_nat y) (Gauss_Jordan_iarrays (matrix_to_iarray A))\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
using inj_index_independent_rows[OF _ x_in eq'] rref_Gauss_Jordan
[PROOF STATE]
proof (prove)
using this:
reduced_row_echelon_form (Gauss_Jordan A) \<Longrightarrow> x = y
reduced_row_echelon_form (Gauss_Jordan ?A)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma foldl_concat_prodl: "foldl (\<lambda>(l, r) x. (l @ g r x, f r x)) (l, r) xs =
    (l @ concat (map (\<lambda>(ys, x). g (foldl f r ys) x) (inits_self xs)), foldl f r xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (\<lambda>(l, r) x. (l @ g r x, f r x)) (l, r) xs = (l @ concat (map (\<lambda>(ys, x). g (foldl f r ys) x) (inits_self xs)), foldl f r xs)
[PROOF STEP]
by(induction xs arbitrary: l r) (simp_all add: split_def o_def)


[STATEMENT]
lemma oneodd:
  fixes b n :: nat
  assumes "b>2"
  shows "odd (\<alpha> b n) = True \<or> odd (\<alpha> b (n+1)) = True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd (\<alpha> b n) = True \<or> odd (\<alpha> b (n + 1)) = True
[PROOF STEP]
using assms odd_iff_mod_2_eq_one one_odd
[PROOF STATE]
proof (prove)
using this:
2 < b
odd ?a = (?a mod (2::?'a) = (1::?'a))
2 < ?b \<Longrightarrow> \<alpha> ?b ?n mod 2 = 1 \<or> \<alpha> ?b (?n + 1) mod 2 = 1

goal (1 subgoal):
 1. odd (\<alpha> b n) = True \<or> odd (\<alpha> b (n + 1)) = True
[PROOF STEP]
by auto


[STATEMENT]
lemma norm_ivl_integral_le:
  fixes f :: "real \<Rightarrow> real"
  assumes "f integrable_on (closed_segment a b)"
    and "g integrable_on (closed_segment a b)"
    and "\<And>x. x \<in> closed_segment a b \<Longrightarrow> f x \<le> g x"
    and "\<And>x. x \<in> closed_segment a b \<Longrightarrow> 0 \<le> f x"
  shows "abs (ivl_integral a b f) \<le> abs (ivl_integral a b g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>
[PROOF STEP]
proof (cases "a = b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = b \<Longrightarrow> \<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>
 2. a \<noteq> b \<Longrightarrow> \<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = b

goal (2 subgoals):
 1. a = b \<Longrightarrow> \<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>
 2. a \<noteq> b \<Longrightarrow> \<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = b

goal (1 subgoal):
 1. \<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> \<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> \<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> b

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> \<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>
[PROOF STEP]
have "0 \<le> integral {a..b} f" "0 \<le> integral {b..a} f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> integral {a..b} f &&& 0 \<le> integral {b..a} f
[PROOF STEP]
by (metis le_cases Henstock_Kurzweil_Integration.integral_nonneg assms(1) assms(4) closed_segment_eq_real_ivl integral_emptyI(1))+
[PROOF STATE]
proof (state)
this:
0 \<le> integral {a..b} f
0 \<le> integral {b..a} f

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> \<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> integral {a..b} f
0 \<le> integral {b..a} f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> integral {a..b} f
0 \<le> integral {b..a} f

goal (1 subgoal):
 1. \<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>
[PROOF STEP]
using integral_le[OF assms(1-3)]
[PROOF STATE]
proof (prove)
using this:
0 \<le> integral {a..b} f
0 \<le> integral {b..a} f
(\<And>x. x \<in> closed_segment a b \<Longrightarrow> x \<in> closed_segment a b) \<Longrightarrow> integral (closed_segment a b) f \<le> integral (closed_segment a b) g

goal (1 subgoal):
 1. \<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>
[PROOF STEP]
unfolding ivl_integral_def closed_segment_eq_real_ivl
[PROOF STATE]
proof (prove)
using this:
0 \<le> integral {a..b} f
0 \<le> integral {b..a} f
(\<And>x. x \<in> (if a \<le> b then {a..b} else {b..a}) \<Longrightarrow> x \<in> (if a \<le> b then {a..b} else {b..a})) \<Longrightarrow> integral (if a \<le> b then {a..b} else {b..a}) f \<le> integral (if a \<le> b then {a..b} else {b..a}) g

goal (1 subgoal):
 1. \<bar>integral {a..b} f - integral {b..a} f\<bar> \<le> \<bar>integral {a..b} g - integral {b..a} g\<bar>
[PROOF STEP]
by (simp split: if_split_asm)
[PROOF STATE]
proof (state)
this:
\<bar>ivl_integral a b f\<bar> \<le> \<bar>ivl_integral a b g\<bar>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_int_segment:
  fixes a :: "'a::floor_ceiling"
  shows "finite {x \<in> \<int>. a \<le> x \<and> x \<le> b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x \<in> \<int>. a \<le> x \<and> x \<le> b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {x \<in> \<int>. a \<le> x \<and> x \<le> b}
[PROOF STEP]
have "finite {ceiling a..floor b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {\<lceil>a\<rceil>..\<lfloor>b\<rfloor>}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {\<lceil>a\<rceil>..\<lfloor>b\<rfloor>}

goal (1 subgoal):
 1. finite {x \<in> \<int>. a \<le> x \<and> x \<le> b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {\<lceil>a\<rceil>..\<lfloor>b\<rfloor>}

goal (1 subgoal):
 1. finite {x \<in> \<int>. a \<le> x \<and> x \<le> b}
[PROOF STEP]
have "{x \<in> \<int>. a \<le> x \<and> x \<le> b} = of_int ` {ceiling a..floor b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> \<int>. a \<le> x \<and> x \<le> b} = of_int ` {\<lceil>a\<rceil>..\<lfloor>b\<rfloor>}
[PROOF STEP]
by (auto simp: le_floor_iff ceiling_le_iff elim!: Ints_cases)
[PROOF STATE]
proof (state)
this:
{x \<in> \<int>. a \<le> x \<and> x \<le> b} = of_int ` {\<lceil>a\<rceil>..\<lfloor>b\<rfloor>}

goal (1 subgoal):
 1. finite {x \<in> \<int>. a \<le> x \<and> x \<le> b}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {\<lceil>a\<rceil>..\<lfloor>b\<rfloor>}
{x \<in> \<int>. a \<le> x \<and> x \<le> b} = of_int ` {\<lceil>a\<rceil>..\<lfloor>b\<rfloor>}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {\<lceil>a\<rceil>..\<lfloor>b\<rfloor>}
{x \<in> \<int>. a \<le> x \<and> x \<le> b} = of_int ` {\<lceil>a\<rceil>..\<lfloor>b\<rfloor>}

goal (1 subgoal):
 1. finite {x \<in> \<int>. a \<le> x \<and> x \<le> b}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {x \<in> \<int>. a \<le> x \<and> x \<le> b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_of_int_diff_0:
  assumes "(\<lambda>n. f n - of_int(g n)) \<longlonglongrightarrow> (0::real)" "\<forall>\<^sub>F n in sequentially. f n > 0"
  shows "\<forall>\<^sub>F n in sequentially. 0 \<le> g n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. 0 \<le> g n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. 0 \<le> g n
[PROOF STEP]
have "\<forall>\<^sub>F n in sequentially. \<bar>f n - of_int(g n)\<bar> < 1 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. \<bar>f n - real_of_int (g n)\<bar> < 1 / 2
[PROOF STEP]
using assms(1)[unfolded tendsto_iff,rule_format,of "1/2"]
[PROOF STATE]
proof (prove)
using this:
0 < 1 / 2 \<Longrightarrow> \<forall>\<^sub>F x in sequentially. dist (f x - real_of_int (g x)) 0 < 1 / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. \<bar>f n - real_of_int (g n)\<bar> < 1 / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. \<bar>f n - real_of_int (g n)\<bar> < 1 / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. 0 \<le> g n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. \<bar>f n - real_of_int (g n)\<bar> < 1 / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. \<bar>f n - real_of_int (g n)\<bar> < 1 / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. 0 \<le> g n
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. \<bar>f n - real_of_int (g n)\<bar> < 1 / 2
\<forall>\<^sub>F n in sequentially. 0 < f n

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. 0 \<le> g n
[PROOF STEP]
by eventually_elim linarith
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. 0 \<le> g n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma binary_expression_less_than:
  assumes "\<And>n. a n \<in> {0,1 :: nat}"
  shows "(\<Sum>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k)) \<le> (\<Sum>n. (1 / 2) ^ Suc (n + k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k)) \<le> (\<Sum>n. (1 / 2) ^ Suc (n + k))
[PROOF STEP]
proof(rule suminf_le)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k) \<le> (1 / 2) ^ Suc (n + k)
 2. summable (\<lambda>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k))
 3. summable (\<lambda>n. (1 / 2) ^ Suc (n + k))
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k) \<le> (1 / 2) ^ Suc (n + k)
 2. summable (\<lambda>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k))
 3. summable (\<lambda>n. (1 / 2) ^ Suc (n + k))
[PROOF STEP]
show "real (a (n + k)) * (1 / 2) ^ Suc (n + k) \<le> (1 / 2) ^ Suc (n + k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (a (n + k)) * (1 / 2) ^ Suc (n + k) \<le> (1 / 2) ^ Suc (n + k)
[PROOF STEP]
using assms[of "n + k"]
[PROOF STATE]
proof (prove)
using this:
a (n + k) \<in> {0, 1}

goal (1 subgoal):
 1. real (a (n + k)) * (1 / 2) ^ Suc (n + k) \<le> (1 / 2) ^ Suc (n + k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (a (n + k)) * (1 / 2) ^ Suc (n + k) \<le> (1 / 2) ^ Suc (n + k)

goal (2 subgoals):
 1. summable (\<lambda>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k))
 2. summable (\<lambda>n. (1 / 2) ^ Suc (n + k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. summable (\<lambda>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k))
 2. summable (\<lambda>n. (1 / 2) ^ Suc (n + k))
[PROOF STEP]
show "summable (\<lambda>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k))
[PROOF STEP]
using summable_iff_shift[of "\<lambda>n. real (a n) * (1 / 2) ^ Suc n" k] binary_expression_summable[of a] assms
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k)) = summable (\<lambda>n. real (a n) * (1 / 2) ^ Suc n)
(\<And>n. a n \<in> {0, 1}) \<Longrightarrow> summable (\<lambda>n. real (a n) * (1 / 2) ^ Suc n)
a ?n \<in> {0, 1}

goal (1 subgoal):
 1. summable (\<lambda>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. real (a (n + k)) * (1 / 2) ^ Suc (n + k))

goal (1 subgoal):
 1. summable (\<lambda>n. (1 / 2) ^ Suc (n + k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable (\<lambda>n. (1 / 2) ^ Suc (n + k))
[PROOF STEP]
show "summable (\<lambda>n. ((1::real) / 2) ^ Suc (n + k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. (1 / 2) ^ Suc (n + k))
[PROOF STEP]
using power_half_summable summable_iff_shift[of "\<lambda>n. ((1::real) / 2) ^ Suc n" k]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. (1 / 2) ^ Suc n)
summable (\<lambda>n. (1 / 2) ^ Suc (n + k)) = summable (\<lambda>n. (1 / 2) ^ Suc n)

goal (1 subgoal):
 1. summable (\<lambda>n. (1 / 2) ^ Suc (n + k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. (1 / 2) ^ Suc (n + k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Urysohn_strong:
  assumes US: "closed S"
      and UT: "closed T"
      and "S \<inter> T = {}" "a \<noteq> b"
  obtains f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
    where "continuous_on UNIV f"
          "\<And>x. f x \<in> closed_segment a b"
          "\<And>x. f x = a \<longleftrightarrow> x \<in> S"
          "\<And>x. f x = b \<longleftrightarrow> x \<in> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>continuous_on UNIV f; \<And>x. f x \<in> closed_segment a b; \<And>x. (f x = a) = (x \<in> S); \<And>x. (f x = b) = (x \<in> T)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
closed S
closed T
S \<inter> T = {}
a \<noteq> b

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>continuous_on UNIV f; \<And>x. f x \<in> closed_segment a b; \<And>x. (f x = a) = (x \<in> S); \<And>x. (f x = b) = (x \<in> T)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto intro: Urysohn_local_strong [of UNIV S T])


[STATEMENT]
lemma (in group) ord_pow_gen:
  assumes "x \<in> carrier G"
  shows "ord (pow G x k) = (if k = 0 then 1 else ord x div gcd (ord x) k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord (x [^] k) = (if k = 0 then 1 else ord x div gcd (ord x) k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ord (x [^] k) = (if k = 0 then 1 else ord x div gcd (ord x) k)
[PROOF STEP]
have "ord (x [^] k) = ord x div gcd (ord x) k"
    if "0 < k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord (x [^] k) = ord x div gcd (ord x) k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ord (x [^] k) = ord x div gcd (ord x) k
[PROOF STEP]
have "(d dvd k * n) = (d div gcd (d) k dvd n)" for d n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (d dvd k * n) = (d div gcd d k dvd n)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. (d dvd k * n) = (d div gcd d k dvd n)
[PROOF STEP]
by (simp add: div_dvd_iff_mult gcd_mult_distrib_nat mult.commute)
[PROOF STATE]
proof (state)
this:
(?d dvd k * ?n) = (?d div gcd ?d k dvd ?n)

goal (1 subgoal):
 1. ord (x [^] k) = ord x div gcd (ord x) k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(?d dvd k * ?n) = (?d div gcd ?d k dvd ?n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(?d dvd k * ?n) = (?d div gcd ?d k dvd ?n)

goal (1 subgoal):
 1. ord (x [^] k) = ord x div gcd (ord x) k
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
(?d dvd k * ?n) = (?d div gcd ?d k dvd ?n)
0 < k

goal (1 subgoal):
 1. ord (x [^] k) = ord x div gcd (ord x) k
[PROOF STEP]
by (auto simp add: assms ord_unique nat_pow_pow pow_eq_id)
[PROOF STATE]
proof (state)
this:
ord (x [^] k) = ord x div gcd (ord x) k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < k \<Longrightarrow> ord (x [^] k) = ord x div gcd (ord x) k

goal (1 subgoal):
 1. ord (x [^] k) = (if k = 0 then 1 else ord x div gcd (ord x) k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < k \<Longrightarrow> ord (x [^] k) = ord x div gcd (ord x) k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < k \<Longrightarrow> ord (x [^] k) = ord x div gcd (ord x) k

goal (1 subgoal):
 1. ord (x [^] k) = (if k = 0 then 1 else ord x div gcd (ord x) k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ord (x [^] k) = (if k = 0 then 1 else ord x div gcd (ord x) k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_ge_minus_one [simp]: "- 1 \<le> sin x"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 \<le> sin x
[PROOF STEP]
using abs_sin_le_one [of x]
[PROOF STATE]
proof (prove)
using this:
\<bar>sin x\<bar> \<le> 1

goal (1 subgoal):
 1. - 1 \<le> sin x
[PROOF STEP]
by (simp add: abs_le_iff)


[STATEMENT]
lemma card_minus_insert_fset[simp]:
  assumes "a |\<in>| A" and "a |\<notin>| B"
  shows "card_fset (A - insert_fset a B) = card_fset (A - B) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_fset (A - insert_fset a B) = card_fset (A - B) - 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a |\<in>| A
a |\<notin>| B

goal (1 subgoal):
 1. card_fset (A - insert_fset a B) = card_fset (A - B) - 1
[PROOF STEP]
by (simp add: in_fset card_fset)


[STATEMENT]
lemma rank_1_proj_trace:
  assumes "\<parallel>v\<parallel> = 1"
  shows "Complex_Matrix.trace (rank_1_proj v) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
have "Complex_Matrix.trace (rank_1_proj v) = inner_prod v v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj v) = Complex_Matrix.inner_prod v v
[PROOF STEP]
using trace_outer_prod
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (outer_prod ?v ?w) = Complex_Matrix.inner_prod ?w ?v

goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj v) = Complex_Matrix.inner_prod v v
[PROOF STEP]
unfolding rank_1_proj_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (outer_prod ?v ?w) = Complex_Matrix.inner_prod ?w ?v

goal (1 subgoal):
 1. Complex_Matrix.trace (outer_prod v v) = Complex_Matrix.inner_prod v v
[PROOF STEP]
using carrier_vecI
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (outer_prod ?v ?w) = Complex_Matrix.inner_prod ?w ?v
dim_vec ?v = ?n \<Longrightarrow> ?v \<in> carrier_vec ?n

goal (1 subgoal):
 1. Complex_Matrix.trace (outer_prod v v) = Complex_Matrix.inner_prod v v
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (rank_1_proj v) = Complex_Matrix.inner_prod v v

goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (rank_1_proj v) = Complex_Matrix.inner_prod v v

goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
have "... = (vec_norm v)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod v v = (vec_norm v)\<^sup>2
[PROOF STEP]
unfolding vec_norm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod v v = (csqrt (Complex_Matrix.inner_prod v v))\<^sup>2
[PROOF STEP]
using power2_csqrt
[PROOF STATE]
proof (prove)
using this:
(csqrt ?z)\<^sup>2 = ?z

goal (1 subgoal):
 1. Complex_Matrix.inner_prod v v = (csqrt (Complex_Matrix.inner_prod v v))\<^sup>2
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod v v = (vec_norm v)\<^sup>2

goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod v v = (vec_norm v)\<^sup>2

goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
have "... = \<parallel>v\<parallel>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vec_norm v)\<^sup>2 = complex_of_real (\<parallel>v\<parallel>\<^sup>2)
[PROOF STEP]
using vec_norm_sq_cpx_vec_length_sq
[PROOF STATE]
proof (prove)
using this:
(vec_norm ?v)\<^sup>2 = complex_of_real (\<parallel>?v\<parallel>\<^sup>2)

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

goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(vec_norm v)\<^sup>2 = complex_of_real (\<parallel>v\<parallel>\<^sup>2)

goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
have "... = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (\<parallel>v\<parallel>\<^sup>2) = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<parallel>v\<parallel> = 1

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

goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.trace (rank_1_proj v) = 1

goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj v) = 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (rank_1_proj v) = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_slice_nth_nth: "
  \<lbrakk> m < length xs div k; n < k \<rbrakk> \<Longrightarrow>
  (list_slice xs k) ! m ! n = xs ! (m * k + n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m < length xs div k; n < k\<rbrakk> \<Longrightarrow> list_slice xs k ! m ! n = xs ! (m * k + n)
[PROOF STEP]
apply (frule list_slice_nth_length[of m xs k])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m < length xs div k; n < k; length (list_slice xs k ! m) = k\<rbrakk> \<Longrightarrow> list_slice xs k ! m ! n = xs ! (m * k + n)
[PROOF STEP]
apply (simp add: list_slice_nth)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma rtrancl_fun_conv:
  "((s, t) \<in> R\<^sup>*) = (\<exists> f n. f 0 = s \<and> f n = t \<and> (\<forall> i < n. (f i, f (Suc i)) \<in> R))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((s, t) \<in> R\<^sup>*) = (\<exists>f n. f 0 = s \<and> f n = t \<and> (\<forall>i<n. (f i, f (Suc i)) \<in> R))
[PROOF STEP]
unfolding rtrancl_is_UN_relpow
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((s, t) \<in> \<Union> (range ((^^) R))) = (\<exists>f n. f 0 = s \<and> f n = t \<and> (\<forall>i<n. (f i, f (Suc i)) \<in> R))
[PROOF STEP]
using relpow_fun_conv [where R = R]
[PROOF STATE]
proof (prove)
using this:
((?a, ?b) \<in> R ^^ ?n) = (\<exists>f. f 0 = ?a \<and> f ?n = ?b \<and> (\<forall>i<?n. (f i, f (Suc i)) \<in> R))

goal (1 subgoal):
 1. ((s, t) \<in> \<Union> (range ((^^) R))) = (\<exists>f n. f 0 = s \<and> f n = t \<and> (\<forall>i<n. (f i, f (Suc i)) \<in> R))
[PROOF STEP]
by auto


[STATEMENT]
lemma mat_base_case_R:
  shows "matrix_A_R [[1],[0],[-1]] [([], []),([0], []),([], [0])] = (mat_of_rows_list 3 [[1,1,1], [0,1,0], [1,0,-1]])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])] = mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]
[PROOF STEP]
unfolding matrix_A_R_def mtx_row_R_def z_R_def map_sgas_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows_list (length [[1], [0], [- 1]]) (map (\<lambda>index_list. map (\<lambda>sign_asg. prod_list (map ((!) (map (\<lambda>r. 1 - r\<^sup>2) sign_asg)) (fst index_list)) * prod_list (map ((!) sign_asg) (snd index_list))) [[1], [0], [- 1]]) [([], []), ([0], []), ([], [0])]) = mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows_list (Suc (Suc (Suc 0))) [[1, 1, 1], [0, 1, 0], [1, 0, - 1]] = mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]
[PROOF STEP]
by (simp add: numeral_3_eq_3)


[STATEMENT]
lemma interval_integral_endpoints_reverse: "(LBINT x=a..b. f x) = -(LBINT x=b..a. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integral lborel a b f = - interval_lebesgue_integral lborel b a f
[PROOF STEP]
by (cases a b rule: linorder_cases) (auto simp: interval_lebesgue_integral_def set_lebesgue_integral_def einterval_same)


[STATEMENT]
lemma inits_self_map: "inits_self (map f xs) = map (map_prod (map f) f) (inits_self xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inits_self (map f xs) = map (map_prod (map f) f) (inits_self xs)
[PROOF STEP]
by(induction xs) (simp_all add: apfst_def prod.map_comp o_def)


[STATEMENT]
lemma norm1_ge_0: "norm1 v \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> norm1 v
[PROOF STEP]
unfolding norm1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>UNIV. norm (v $h i))
[PROOF STEP]
by (rule sum_nonneg, auto)


[STATEMENT]
lemma open_real:
  fixes s :: "real set"
  shows "open s \<longleftrightarrow> (\<forall>x \<in> s. \<exists>e>0. \<forall>x'. \<bar>x' - x\<bar> < e --> x' \<in> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open s = (\<forall>x\<in>s. \<exists>e>0. \<forall>x'. \<bar>x' - x\<bar> < e \<longrightarrow> x' \<in> s)
[PROOF STEP]
unfolding open_dist dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>s. \<exists>e>0. \<forall>y. norm (y - x) < e \<longrightarrow> y \<in> s) = (\<forall>x\<in>s. \<exists>e>0. \<forall>x'. \<bar>x' - x\<bar> < e \<longrightarrow> x' \<in> s)
[PROOF STEP]
by simp


[STATEMENT]
lemma cis_2pi [simp]: "cis (2 * pi) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis (2 * pi) = 1
[PROOF STEP]
by (simp add: cis.ctr complex_eq_iff)


[STATEMENT]
lemma (in UP_cring) taylor_expansion_add:
  assumes "p \<in> carrier P"
  assumes "q \<in> carrier P"
  assumes "c \<in> carrier R"
  shows "taylor_expansion R c (p \<oplus>\<^bsub>UP R\<^esub> q) = (taylor_expansion R c p) \<oplus>\<^bsub>UP R\<^esub> (taylor_expansion R c q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. taylor_expansion R c (p \<oplus>\<^bsub>UP R\<^esub> q) = taylor_expansion R c p \<oplus>\<^bsub>UP R\<^esub> taylor_expansion R c q
[PROOF STEP]
unfolding taylor_expansion_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cring_Poly.compose R (p \<oplus>\<^bsub>UP R\<^esub> q) (X_poly_plus R c) = Cring_Poly.compose R p (X_poly_plus R c) \<oplus>\<^bsub>UP R\<^esub> Cring_Poly.compose R q (X_poly_plus R c)
[PROOF STEP]
using assms X_plus_closed[of c] P_def sub_add
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier P
q \<in> carrier P
c \<in> carrier R
c \<in> carrier R \<Longrightarrow> X_poly_plus R c \<in> carrier P
P \<equiv> UP R
\<lbrakk>?g \<in> carrier P; ?f \<in> carrier P; ?h \<in> carrier P\<rbrakk> \<Longrightarrow> Cring_Poly.compose R (?f \<oplus>\<^bsub>P\<^esub> ?h) ?g = Cring_Poly.compose R ?f ?g \<oplus>\<^bsub>P\<^esub> Cring_Poly.compose R ?h ?g

goal (1 subgoal):
 1. Cring_Poly.compose R (p \<oplus>\<^bsub>UP R\<^esub> q) (X_poly_plus R c) = Cring_Poly.compose R p (X_poly_plus R c) \<oplus>\<^bsub>UP R\<^esub> Cring_Poly.compose R q (X_poly_plus R c)
[PROOF STEP]
by blast


[STATEMENT]
lemma poly_pos_between_less_less:
  "(\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x > 0) \<longleftrightarrow>
   ((a \<ge> b \<or> (p \<noteq> 0 \<and> poly p ((a+b)/2) > 0 \<and>
       count_roots_between p a b = (if poly p b = 0 then 1 else 0))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. a < x \<and> x < b \<longrightarrow> 0 < poly p x) = (b \<le> a \<or> p \<noteq> 0 \<and> 0 < poly p ((a + b) / 2) \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0))
[PROOF STEP]
by (simp only: poly_pos_between_less_less Let_def
                 poly_no_roots_less_less, blast)


[STATEMENT]
lemma ListMem_iff: "(ListMem x xs) = (x \<in> set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ListMem x xs = (x \<in> set xs)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ListMem x xs \<Longrightarrow> x \<in> set xs
 2. x \<in> set xs \<Longrightarrow> ListMem x xs
[PROOF STEP]
show "ListMem x xs \<Longrightarrow> x \<in> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ListMem x xs \<Longrightarrow> x \<in> set xs
[PROOF STEP]
by (induct set: ListMem) auto
[PROOF STATE]
proof (state)
this:
ListMem x xs \<Longrightarrow> x \<in> set xs

goal (1 subgoal):
 1. x \<in> set xs \<Longrightarrow> ListMem x xs
[PROOF STEP]
show "x \<in> set xs \<Longrightarrow> ListMem x xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> set xs \<Longrightarrow> ListMem x xs
[PROOF STEP]
by (induct xs) (auto intro: ListMem.intros)
[PROOF STATE]
proof (state)
this:
x \<in> set xs \<Longrightarrow> ListMem x xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma i_cut_Diff_disj: "
  \<lbrakk> cut_op = (\<down><) \<or> cut_op = (\<down>\<le>) \<or>
    cut_op = (\<down>>) \<or> cut_op = (\<down>\<ge>) \<rbrakk>
  \<Longrightarrow> cut_op (A - B) t = cut_op A t - cut_op B t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cut_op = (\<down><) \<or> cut_op = (\<down>\<le>) \<or> cut_op = (\<down>>) \<or> cut_op = (\<down>\<ge>) \<Longrightarrow> cut_op (A - B) t = cut_op A t - cut_op B t
[PROOF STEP]
apply (drule i_cut_set_restriction_disj[where f="\<lambda>I. cut_op I t"], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_restriction (\<lambda>I. cut_op I t) \<Longrightarrow> cut_op (A - B) t = cut_op A t - cut_op B t
[PROOF STEP]
by (rule set_restriction_Diff)


[STATEMENT]
lemma vec_to_iarray_basis_row_space[code_unfold]:
fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
shows  "vec_to_iarray` (basis_row_space A) = basis_row_space_iarrays (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray ` basis_row_space A = basis_row_space_iarrays (matrix_to_iarray A)
[PROOF STEP]
proof (unfold basis_row_space_def basis_row_space_iarrays_eq, auto, unfold image_def, auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. row i (Gauss_Jordan A) \<noteq> 0 \<Longrightarrow> \<exists>x\<in>{0..<rank_iarray (matrix_to_iarray A)}. vec_to_iarray (row i (Gauss_Jordan A)) = row_iarray x (Gauss_Jordan_iarrays (matrix_to_iarray A))
 2. \<And>xa. xa < rank_iarray (matrix_to_iarray A) \<Longrightarrow> \<exists>x. (\<exists>i. x = row i (Gauss_Jordan A) \<and> row i (Gauss_Jordan A) \<noteq> 0) \<and> row_iarray xa (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray x
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. row i (Gauss_Jordan A) \<noteq> 0 \<Longrightarrow> \<exists>x\<in>{0..<rank_iarray (matrix_to_iarray A)}. vec_to_iarray (row i (Gauss_Jordan A)) = row_iarray x (Gauss_Jordan_iarrays (matrix_to_iarray A))
 2. \<And>xa. xa < rank_iarray (matrix_to_iarray A) \<Longrightarrow> \<exists>x. (\<exists>i. x = row i (Gauss_Jordan A) \<and> row i (Gauss_Jordan A) \<noteq> 0) \<and> row_iarray xa (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray x
[PROOF STEP]
assume i: "row i (Gauss_Jordan A) \<noteq> 0"
[PROOF STATE]
proof (state)
this:
row i (Gauss_Jordan A) \<noteq> 0

goal (2 subgoals):
 1. \<And>i. row i (Gauss_Jordan A) \<noteq> 0 \<Longrightarrow> \<exists>x\<in>{0..<rank_iarray (matrix_to_iarray A)}. vec_to_iarray (row i (Gauss_Jordan A)) = row_iarray x (Gauss_Jordan_iarrays (matrix_to_iarray A))
 2. \<And>xa. xa < rank_iarray (matrix_to_iarray A) \<Longrightarrow> \<exists>x. (\<exists>i. x = row i (Gauss_Jordan A) \<and> row i (Gauss_Jordan A) \<noteq> 0) \<and> row_iarray xa (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray x
[PROOF STEP]
show "\<exists>x\<in>{0..<rank_iarray (matrix_to_iarray A)}. vec_to_iarray (row i (Gauss_Jordan A)) = row_iarray x (Gauss_Jordan_iarrays (matrix_to_iarray A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>{0..<rank_iarray (matrix_to_iarray A)}. vec_to_iarray (row i (Gauss_Jordan A)) = row_iarray x (Gauss_Jordan_iarrays (matrix_to_iarray A))
[PROOF STEP]
proof (rule bexI[of _ "to_nat i"])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vec_to_iarray (row i (Gauss_Jordan A)) = row_iarray (mod_type_class.to_nat i) (Gauss_Jordan_iarrays (matrix_to_iarray A))
 2. mod_type_class.to_nat i \<in> {0..<rank_iarray (matrix_to_iarray A)}
[PROOF STEP]
show "vec_to_iarray (row i (Gauss_Jordan A)) = row_iarray (to_nat i) (Gauss_Jordan_iarrays (matrix_to_iarray A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray (row i (Gauss_Jordan A)) = row_iarray (mod_type_class.to_nat i) (Gauss_Jordan_iarrays (matrix_to_iarray A))
[PROOF STEP]
unfolding vec_to_iarray_row matrix_to_iarray_Gauss_Jordan
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_iarray (mod_type_class.to_nat i) (Gauss_Jordan_iarrays (matrix_to_iarray A)) = row_iarray (mod_type_class.to_nat i) (Gauss_Jordan_iarrays (matrix_to_iarray A))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
vec_to_iarray (row i (Gauss_Jordan A)) = row_iarray (mod_type_class.to_nat i) (Gauss_Jordan_iarrays (matrix_to_iarray A))

goal (1 subgoal):
 1. mod_type_class.to_nat i \<in> {0..<rank_iarray (matrix_to_iarray A)}
[PROOF STEP]
show "to_nat i \<in> {0..<rank_iarray (matrix_to_iarray A)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat i \<in> {0..<rank_iarray (matrix_to_iarray A)}
[PROOF STEP]
by (auto, unfold matrix_to_iarray_rank[symmetric],
      metis (full_types) i iarray_to_vec_vec_to_iarray not_less rank_less_row_i_imp_i_is_zero row_iarray_def vec_matrix vec_to_iarray_row)
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat i \<in> {0..<rank_iarray (matrix_to_iarray A)}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>{0..<rank_iarray (matrix_to_iarray A)}. vec_to_iarray (row i (Gauss_Jordan A)) = row_iarray x (Gauss_Jordan_iarrays (matrix_to_iarray A))

goal (1 subgoal):
 1. \<And>xa. xa < rank_iarray (matrix_to_iarray A) \<Longrightarrow> \<exists>x. (\<exists>i. x = row i (Gauss_Jordan A) \<and> row i (Gauss_Jordan A) \<noteq> 0) \<and> row_iarray xa (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa < rank_iarray (matrix_to_iarray A) \<Longrightarrow> \<exists>x. (\<exists>i. x = row i (Gauss_Jordan A) \<and> row i (Gauss_Jordan A) \<noteq> 0) \<and> row_iarray xa (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray x
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa < rank_iarray (matrix_to_iarray A) \<Longrightarrow> \<exists>x. (\<exists>i. x = row i (Gauss_Jordan A) \<and> row i (Gauss_Jordan A) \<noteq> 0) \<and> row_iarray xa (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray x
[PROOF STEP]
assume i: "i < rank_iarray (matrix_to_iarray A)"
[PROOF STATE]
proof (state)
this:
i < rank_iarray (matrix_to_iarray A)

goal (1 subgoal):
 1. \<And>xa. xa < rank_iarray (matrix_to_iarray A) \<Longrightarrow> \<exists>x. (\<exists>i. x = row i (Gauss_Jordan A) \<and> row i (Gauss_Jordan A) \<noteq> 0) \<and> row_iarray xa (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray x
[PROOF STEP]
hence i_less_rank: "i < rank A"
[PROOF STATE]
proof (prove)
using this:
i < rank_iarray (matrix_to_iarray A)

goal (1 subgoal):
 1. i < rank A
[PROOF STEP]
unfolding matrix_to_iarray_rank
[PROOF STATE]
proof (prove)
using this:
i < rank_iarray (matrix_to_iarray A)

goal (1 subgoal):
 1. i < rank_iarray (matrix_to_iarray A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
i < rank A

goal (1 subgoal):
 1. \<And>xa. xa < rank_iarray (matrix_to_iarray A) \<Longrightarrow> \<exists>x. (\<exists>i. x = row i (Gauss_Jordan A) \<and> row i (Gauss_Jordan A) \<noteq> 0) \<and> row_iarray xa (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray x
[PROOF STEP]
show "\<exists>x. (\<exists>i. x = row i (Gauss_Jordan A) \<and> row i (Gauss_Jordan A) \<noteq> 0) \<and> row_iarray i (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. (\<exists>i. x = row i (Gauss_Jordan A) \<and> row i (Gauss_Jordan A) \<noteq> 0) \<and> row_iarray i (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray x
[PROOF STEP]
proof (rule exI[of _ "row (from_nat i) (Gauss_Jordan A)"], rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>ia. row (mod_type_class.from_nat i) (Gauss_Jordan A) = row ia (Gauss_Jordan A) \<and> row ia (Gauss_Jordan A) \<noteq> 0
 2. row_iarray i (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray (row (mod_type_class.from_nat i) (Gauss_Jordan A))
[PROOF STEP]
have not_zero_i: "\<not> is_zero_row (from_nat i) (Gauss_Jordan A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> is_zero_row (mod_type_class.from_nat i) (Gauss_Jordan A)
[PROOF STEP]
proof (unfold is_zero_row_def, rule greatest_ge_nonzero_row')
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. reduced_row_echelon_form_upt_k (Gauss_Jordan A) (ncols (Gauss_Jordan A))
 2. mod_type_class.from_nat i \<le> (GREATEST m. \<not> is_zero_row_upt_k m (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
 3. \<not> (\<forall>a. is_zero_row_upt_k a (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
[PROOF STEP]
show "reduced_row_echelon_form_upt_k (Gauss_Jordan A) (ncols (Gauss_Jordan A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reduced_row_echelon_form_upt_k (Gauss_Jordan A) (ncols (Gauss_Jordan A))
[PROOF STEP]
by (metis rref_Gauss_Jordan rref_implies_rref_upt)
[PROOF STATE]
proof (state)
this:
reduced_row_echelon_form_upt_k (Gauss_Jordan A) (ncols (Gauss_Jordan A))

goal (2 subgoals):
 1. mod_type_class.from_nat i \<le> (GREATEST m. \<not> is_zero_row_upt_k m (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
 2. \<not> (\<forall>a. is_zero_row_upt_k a (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
[PROOF STEP]
have A_not_0: "A \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> 0
[PROOF STEP]
using i_less_rank
[PROOF STATE]
proof (prove)
using this:
i < rank A

goal (1 subgoal):
 1. A \<noteq> 0
[PROOF STEP]
by (metis less_nat_zero_code rank_0)
[PROOF STATE]
proof (state)
this:
A \<noteq> 0

goal (2 subgoals):
 1. mod_type_class.from_nat i \<le> (GREATEST m. \<not> is_zero_row_upt_k m (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
 2. \<not> (\<forall>a. is_zero_row_upt_k a (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
[PROOF STEP]
hence Gauss_not_0: "Gauss_Jordan A \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
A \<noteq> 0

goal (1 subgoal):
 1. Gauss_Jordan A \<noteq> 0
[PROOF STEP]
by (metis Gauss_Jordan_not_0)
[PROOF STATE]
proof (state)
this:
Gauss_Jordan A \<noteq> 0

goal (2 subgoals):
 1. mod_type_class.from_nat i \<le> (GREATEST m. \<not> is_zero_row_upt_k m (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
 2. \<not> (\<forall>a. is_zero_row_upt_k a (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
[PROOF STEP]
have "i \<le> to_nat (GREATEST a. \<not> is_zero_row a (Gauss_Jordan A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> mod_type_class.to_nat (GREATEST a. \<not> is_zero_row a (Gauss_Jordan A))
[PROOF STEP]
using i_less_rank
[PROOF STATE]
proof (prove)
using this:
i < rank A

goal (1 subgoal):
 1. i \<le> mod_type_class.to_nat (GREATEST a. \<not> is_zero_row a (Gauss_Jordan A))
[PROOF STEP]
unfolding rank_eq_suc_to_nat_greatest[OF A_not_0]
[PROOF STATE]
proof (prove)
using this:
i < mod_type_class.to_nat (GREATEST a. \<not> is_zero_row a (Gauss_Jordan A)) + 1

goal (1 subgoal):
 1. i \<le> mod_type_class.to_nat (GREATEST a. \<not> is_zero_row a (Gauss_Jordan A))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i \<le> mod_type_class.to_nat (GREATEST a. \<not> is_zero_row a (Gauss_Jordan A))

goal (2 subgoals):
 1. mod_type_class.from_nat i \<le> (GREATEST m. \<not> is_zero_row_upt_k m (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
 2. \<not> (\<forall>a. is_zero_row_upt_k a (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
[PROOF STEP]
thus "from_nat i \<le> (GREATEST m. \<not> is_zero_row_upt_k m (ncols (Gauss_Jordan A)) (Gauss_Jordan A))"
[PROOF STATE]
proof (prove)
using this:
i \<le> mod_type_class.to_nat (GREATEST a. \<not> is_zero_row a (Gauss_Jordan A))

goal (1 subgoal):
 1. mod_type_class.from_nat i \<le> (GREATEST m. \<not> is_zero_row_upt_k m (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
[PROOF STEP]
unfolding is_zero_row_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
i \<le> mod_type_class.to_nat (GREATEST a. \<not> is_zero_row a (Gauss_Jordan A))

goal (1 subgoal):
 1. mod_type_class.from_nat i \<le> (GREATEST m. \<not> is_zero_row m (Gauss_Jordan A))
[PROOF STEP]
by (metis leD not_le_imp_less to_nat_le)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i \<le> (GREATEST m. \<not> is_zero_row_upt_k m (ncols (Gauss_Jordan A)) (Gauss_Jordan A))

goal (1 subgoal):
 1. \<not> (\<forall>a. is_zero_row_upt_k a (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
[PROOF STEP]
show "\<not> (\<forall>a. is_zero_row_upt_k a (ncols (Gauss_Jordan A)) (Gauss_Jordan A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>a. is_zero_row_upt_k a (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
[PROOF STEP]
using Gauss_not_0
[PROOF STATE]
proof (prove)
using this:
Gauss_Jordan A \<noteq> 0

goal (1 subgoal):
 1. \<not> (\<forall>a. is_zero_row_upt_k a (ncols (Gauss_Jordan A)) (Gauss_Jordan A))
[PROOF STEP]
unfolding is_zero_row_def[symmetric] is_zero_row_def'
[PROOF STATE]
proof (prove)
using this:
Gauss_Jordan A \<noteq> 0

goal (1 subgoal):
 1. \<not> (\<forall>a j. Gauss_Jordan A $ a $ j = (0::'a))
[PROOF STEP]
by (metis vec_eq_iff zero_index)
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>a. is_zero_row_upt_k a (ncols (Gauss_Jordan A)) (Gauss_Jordan A))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> is_zero_row (mod_type_class.from_nat i) (Gauss_Jordan A)

goal (2 subgoals):
 1. \<exists>ia. row (mod_type_class.from_nat i) (Gauss_Jordan A) = row ia (Gauss_Jordan A) \<and> row ia (Gauss_Jordan A) \<noteq> 0
 2. row_iarray i (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray (row (mod_type_class.from_nat i) (Gauss_Jordan A))
[PROOF STEP]
have i_less_card: "i<CARD('rows)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < CARD('rows)
[PROOF STEP]
using i_less_rank rank_le_nrows[of A]
[PROOF STATE]
proof (prove)
using this:
i < rank A
rank A \<le> nrows A

goal (1 subgoal):
 1. i < CARD('rows)
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
using this:
i < rank A
rank A \<le> CARD('rows)

goal (1 subgoal):
 1. i < CARD('rows)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i < CARD('rows)

goal (2 subgoals):
 1. \<exists>ia. row (mod_type_class.from_nat i) (Gauss_Jordan A) = row ia (Gauss_Jordan A) \<and> row ia (Gauss_Jordan A) \<noteq> 0
 2. row_iarray i (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray (row (mod_type_class.from_nat i) (Gauss_Jordan A))
[PROOF STEP]
show "\<exists>ia. row (from_nat i) (Gauss_Jordan A) = row ia (Gauss_Jordan A) \<and> row ia (Gauss_Jordan A) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>ia. row (mod_type_class.from_nat i) (Gauss_Jordan A) = row ia (Gauss_Jordan A) \<and> row ia (Gauss_Jordan A) \<noteq> 0
[PROOF STEP]
apply (rule exI[of _ "from_nat i"], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (mod_type_class.from_nat i) (Gauss_Jordan A) \<noteq> 0
[PROOF STEP]
using not_zero_i
[PROOF STATE]
proof (prove)
using this:
\<not> is_zero_row (mod_type_class.from_nat i) (Gauss_Jordan A)

goal (1 subgoal):
 1. row (mod_type_class.from_nat i) (Gauss_Jordan A) \<noteq> 0
[PROOF STEP]
unfolding row_def is_zero_row_def' vec_nth_inverse
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>j. Gauss_Jordan A $ mod_type_class.from_nat i $ j = (0::'a))

goal (1 subgoal):
 1. Gauss_Jordan A $ mod_type_class.from_nat i \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>ia. row (mod_type_class.from_nat i) (Gauss_Jordan A) = row ia (Gauss_Jordan A) \<and> row ia (Gauss_Jordan A) \<noteq> 0

goal (1 subgoal):
 1. row_iarray i (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray (row (mod_type_class.from_nat i) (Gauss_Jordan A))
[PROOF STEP]
show "row_iarray i (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray (row (from_nat i) (Gauss_Jordan A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_iarray i (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray (row (mod_type_class.from_nat i) (Gauss_Jordan A))
[PROOF STEP]
unfolding matrix_to_iarray_Gauss_Jordan[symmetric] vec_to_iarray_row to_nat_from_nat_id[OF i_less_card]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_iarray i (matrix_to_iarray (Gauss_Jordan A)) = row_iarray i (matrix_to_iarray (Gauss_Jordan A))
[PROOF STEP]
by rule
[PROOF STATE]
proof (state)
this:
row_iarray i (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray (row (mod_type_class.from_nat i) (Gauss_Jordan A))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>x. (\<exists>i. x = row i (Gauss_Jordan A) \<and> row i (Gauss_Jordan A) \<noteq> 0) \<and> row_iarray i (Gauss_Jordan_iarrays (matrix_to_iarray A)) = vec_to_iarray x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma surj_on_mult:
  assumes coprime: "coprime x (q::nat)"
    and inj: "inj_on (\<lambda> b. x*b mod q) {..<q}"
  shows "(\<lambda> b. x*b mod q) ` {..< q} = {..< q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>b. x * b mod q) ` {..<q} = {..<q}
[PROOF STEP]
apply(rule endo_inj_surj)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite {..<q}
 2. (\<lambda>b. x * b mod q) ` {..<q} \<subseteq> {..<q}
 3. inj_on (\<lambda>b. x * b mod q) {..<q}
[PROOF STEP]
using coprime inj
[PROOF STATE]
proof (prove)
using this:
coprime x q
inj_on (\<lambda>b. x * b mod q) {..<q}

goal (3 subgoals):
 1. finite {..<q}
 2. (\<lambda>b. x * b mod q) ` {..<q} \<subseteq> {..<q}
 3. inj_on (\<lambda>b. x * b mod q) {..<q}
[PROOF STEP]
by auto


[STATEMENT]
lemma iso_in_carr:
  assumes "f \<in> iso G H"
  shows "\<And>x. x \<in> carrier G \<Longrightarrow> f x \<in> carrier H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> f x \<in> carrier H
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> Group.iso G H

goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> f x \<in> carrier H
[PROOF STEP]
unfolding iso_def bij_betw_def
[PROOF STATE]
proof (prove)
using this:
f \<in> {h \<in> hom G H. inj_on h (carrier G) \<and> h ` carrier G = carrier H}

goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> f x \<in> carrier H
[PROOF STEP]
by blast


[STATEMENT]
lemma inc_mat_col_def:  "j < length Bs \<Longrightarrow> i < length Vs \<Longrightarrow>
    (col (inc_mat_of Vs Bs) j) $ i = (if (Vs ! i \<in> Bs ! j) then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < length Bs; i < length Vs\<rbrakk> \<Longrightarrow> col (inc_mat_of Vs Bs) j $ i = (if Vs ! i \<in> Bs ! j then 1::'b else (0::'b))
[PROOF STEP]
by (simp add: inc_mat_of_def)


[STATEMENT]
theorem quot_exhaust: "\<exists>a. A = \<lfloor>a\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a. A = \<lfloor>a\<rfloor>
[PROOF STEP]
proof (cases A)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. \<lbrakk>A = Abs_quot y; y \<in> quot\<rbrakk> \<Longrightarrow> \<exists>a. A = \<lfloor>a\<rfloor>
[PROOF STEP]
fix R
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. \<lbrakk>A = Abs_quot y; y \<in> quot\<rbrakk> \<Longrightarrow> \<exists>a. A = \<lfloor>a\<rfloor>
[PROOF STEP]
assume R: "A = Abs_quot R"
[PROOF STATE]
proof (state)
this:
A = Abs_quot R

goal (1 subgoal):
 1. \<And>y. \<lbrakk>A = Abs_quot y; y \<in> quot\<rbrakk> \<Longrightarrow> \<exists>a. A = \<lfloor>a\<rfloor>
[PROOF STEP]
assume "R \<in> quot"
[PROOF STATE]
proof (state)
this:
R \<in> quot

goal (1 subgoal):
 1. \<And>y. \<lbrakk>A = Abs_quot y; y \<in> quot\<rbrakk> \<Longrightarrow> \<exists>a. A = \<lfloor>a\<rfloor>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
R \<in> quot
[PROOF STEP]
have "\<exists>a. R = {x. a \<sim> x}"
[PROOF STATE]
proof (prove)
using this:
R \<in> quot

goal (1 subgoal):
 1. \<exists>a. R = {x. a \<sim> x}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>a. R = {x. a \<sim> x}

goal (1 subgoal):
 1. \<And>y. \<lbrakk>A = Abs_quot y; y \<in> quot\<rbrakk> \<Longrightarrow> \<exists>a. A = \<lfloor>a\<rfloor>
[PROOF STEP]
with R
[PROOF STATE]
proof (chain)
picking this:
A = Abs_quot R
\<exists>a. R = {x. a \<sim> x}
[PROOF STEP]
have "\<exists>a. A = Abs_quot {x. a \<sim> x}"
[PROOF STATE]
proof (prove)
using this:
A = Abs_quot R
\<exists>a. R = {x. a \<sim> x}

goal (1 subgoal):
 1. \<exists>a. A = Abs_quot {x. a \<sim> x}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>a. A = Abs_quot {x. a \<sim> x}

goal (1 subgoal):
 1. \<And>y. \<lbrakk>A = Abs_quot y; y \<in> quot\<rbrakk> \<Longrightarrow> \<exists>a. A = \<lfloor>a\<rfloor>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>a. A = Abs_quot {x. a \<sim> x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>a. A = Abs_quot {x. a \<sim> x}

goal (1 subgoal):
 1. \<exists>a. A = \<lfloor>a\<rfloor>
[PROOF STEP]
unfolding class_def
[PROOF STATE]
proof (prove)
using this:
\<exists>a. A = Abs_quot {x. a \<sim> x}

goal (1 subgoal):
 1. \<exists>a. A = Abs_quot (Collect ((\<sim>) a))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<exists>a. A = \<lfloor>a\<rfloor>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma field_differentiable_caratheodory_within:
  "f field_differentiable (at z within s) \<longleftrightarrow>
         (\<exists>g. (\<forall>w. f(w) - f(z) = g(w) * (w - z)) \<and> continuous (at z within s) g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f field_differentiable at z within s) = (\<exists>g. (\<forall>w. f w - f z = g w * (w - z)) \<and> continuous (at z within s) g)
[PROOF STEP]
using DERIV_caratheodory_within [of f]
[PROOF STATE]
proof (prove)
using this:
(f has_field_derivative ?l) (at ?x within ?S) = (\<exists>g. (\<forall>z. f z - f ?x = g z * (z - ?x)) \<and> continuous (at ?x within ?S) g \<and> g ?x = ?l)

goal (1 subgoal):
 1. (f field_differentiable at z within s) = (\<exists>g. (\<forall>w. f w - f z = g w * (w - z)) \<and> continuous (at z within s) g)
[PROOF STEP]
by (simp add: field_differentiable_def has_field_derivative_def)


[STATEMENT]
lemma path_linear_image_eq:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
   assumes "linear f" "inj f"
     shows "path(f \<circ> g) = path g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path (f \<circ> g) = path g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. path (f \<circ> g) = path g
[PROOF STEP]
from linear_injective_left_inverse [OF assms]
[PROOF STATE]
proof (chain)
picking this:
\<exists>g. linear g \<and> g \<circ> f = id
[PROOF STEP]
obtain h where h: "linear h" "h \<circ> f = id"
[PROOF STATE]
proof (prove)
using this:
\<exists>g. linear g \<and> g \<circ> f = id

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>linear h; h \<circ> f = id\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
linear h
h \<circ> f = id

goal (1 subgoal):
 1. path (f \<circ> g) = path g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
linear h
h \<circ> f = id
[PROOF STEP]
have g: "g = h \<circ> (f \<circ> g)"
[PROOF STATE]
proof (prove)
using this:
linear h
h \<circ> f = id

goal (1 subgoal):
 1. g = h \<circ> (f \<circ> g)
[PROOF STEP]
by (metis comp_assoc id_comp)
[PROOF STATE]
proof (state)
this:
g = h \<circ> (f \<circ> g)

goal (1 subgoal):
 1. path (f \<circ> g) = path g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path (f \<circ> g) = path g
[PROOF STEP]
unfolding path_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..1} (f \<circ> g) = continuous_on {0..1} g
[PROOF STEP]
using h assms
[PROOF STATE]
proof (prove)
using this:
linear h
h \<circ> f = id
linear f
inj f

goal (1 subgoal):
 1. continuous_on {0..1} (f \<circ> g) = continuous_on {0..1} g
[PROOF STEP]
by (metis g continuous_on_compose linear_continuous_on linear_conv_bounded_linear)
[PROOF STATE]
proof (state)
this:
path (f \<circ> g) = path g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem injectivity:
  assumes is_osc: "OSC L E"
  assumes is_m: "matching V E M"
  assumes e1_in_M1: "e1 \<in> matching_i 1 V E M L"
      and e2_in_M1: "e2 \<in> matching_i 1 V E M L"
  assumes diff: "(e1 \<noteq> e2)"
  shows "endpoint_inV {v \<in> V. L v = 1} e1 \<noteq> endpoint_inV {v \<in> V. L v = 1} e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. endpoint_inV {v \<in> V. L v = 1} e1 \<noteq> endpoint_inV {v \<in> V. L v = 1} e2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. endpoint_inV {v \<in> V. L v = 1} e1 \<noteq> endpoint_inV {v \<in> V. L v = 1} e2
[PROOF STEP]
from e1_in_M1
[PROOF STATE]
proof (chain)
picking this:
e1 \<in> matching_i 1 V E M L
[PROOF STEP]
have "e1 \<in> M"
[PROOF STATE]
proof (prove)
using this:
e1 \<in> matching_i 1 V E M L

goal (1 subgoal):
 1. e1 \<in> M
[PROOF STEP]
by (auto simp add: matching_i_def)
[PROOF STATE]
proof (state)
this:
e1 \<in> M

goal (1 subgoal):
 1. endpoint_inV {v \<in> V. L v = 1} e1 \<noteq> endpoint_inV {v \<in> V. L v = 1} e2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
e1 \<in> M

goal (1 subgoal):
 1. endpoint_inV {v \<in> V. L v = 1} e1 \<noteq> endpoint_inV {v \<in> V. L v = 1} e2
[PROOF STEP]
from e2_in_M1
[PROOF STATE]
proof (chain)
picking this:
e2 \<in> matching_i 1 V E M L
[PROOF STEP]
have "e2 \<in> M"
[PROOF STATE]
proof (prove)
using this:
e2 \<in> matching_i 1 V E M L

goal (1 subgoal):
 1. e2 \<in> M
[PROOF STEP]
by (auto simp add: matching_i_def)
[PROOF STATE]
proof (state)
this:
e2 \<in> M

goal (1 subgoal):
 1. endpoint_inV {v \<in> V. L v = 1} e1 \<noteq> endpoint_inV {v \<in> V. L v = 1} e2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
e1 \<in> M
e2 \<in> M
[PROOF STEP]
have disjoint_edge_sets: "edge_as_set e1 \<inter> edge_as_set e2 = {}"
[PROOF STATE]
proof (prove)
using this:
e1 \<in> M
e2 \<in> M

goal (1 subgoal):
 1. edge_as_set e1 \<inter> edge_as_set e2 = {}
[PROOF STEP]
using diff is_m matching_disjointness
[PROOF STATE]
proof (prove)
using this:
e1 \<in> M
e2 \<in> M
e1 \<noteq> e2
matching V E M
\<lbrakk>matching ?V ?E ?M; ?e1.0 \<in> ?M; ?e2.0 \<in> ?M; ?e1.0 \<noteq> ?e2.0\<rbrakk> \<Longrightarrow> edge_as_set ?e1.0 \<inter> edge_as_set ?e2.0 = {}

goal (1 subgoal):
 1. edge_as_set e1 \<inter> edge_as_set e2 = {}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
edge_as_set e1 \<inter> edge_as_set e2 = {}

goal (1 subgoal):
 1. endpoint_inV {v \<in> V. L v = 1} e1 \<noteq> endpoint_inV {v \<in> V. L v = 1} e2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
edge_as_set e1 \<inter> edge_as_set e2 = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
edge_as_set e1 \<inter> edge_as_set e2 = {}

goal (1 subgoal):
 1. endpoint_inV {v \<in> V. L v = 1} e1 \<noteq> endpoint_inV {v \<in> V. L v = 1} e2
[PROOF STEP]
by (auto simp add: edge_as_set_def endpoint_inV_def)
[PROOF STATE]
proof (state)
this:
endpoint_inV {v \<in> V. L v = 1} e1 \<noteq> endpoint_inV {v \<in> V. L v = 1} e2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma product_simps[simp]:
      "alphabet\<^sub>3 (product A B) = alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B"
      "initial\<^sub>3 (product A B) = initial\<^sub>1 A \<times> initial\<^sub>2 B"
      "transition\<^sub>3 (product A B) a (p, q) = transition\<^sub>1 A a p \<times> transition\<^sub>2 B a q"
      "condition\<^sub>3 (product A B) = condition (condition\<^sub>1 A) (condition\<^sub>2 B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (alphabet\<^sub>3 (product A B) = alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B &&& initial\<^sub>3 (product A B) = initial\<^sub>1 A \<times> initial\<^sub>2 B) &&& transition\<^sub>3 (product A B) a (p, q) = transition\<^sub>1 A a p \<times> transition\<^sub>2 B a q &&& condition\<^sub>3 (product A B) = condition (condition\<^sub>1 A) (condition\<^sub>2 B)
[PROOF STEP]
unfolding product_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (alphabet\<^sub>3 (automaton\<^sub>3 (alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B) (initial\<^sub>1 A \<times> initial\<^sub>2 B) (\<lambda>a (p, q). transition\<^sub>1 A a p \<times> transition\<^sub>2 B a q) (condition (condition\<^sub>1 A) (condition\<^sub>2 B))) = alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B &&& initial\<^sub>3 (automaton\<^sub>3 (alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B) (initial\<^sub>1 A \<times> initial\<^sub>2 B) (\<lambda>a (p, q). transition\<^sub>1 A a p \<times> transition\<^sub>2 B a q) (condition (condition\<^sub>1 A) (condition\<^sub>2 B))) = initial\<^sub>1 A \<times> initial\<^sub>2 B) &&& transition\<^sub>3 (automaton\<^sub>3 (alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B) (initial\<^sub>1 A \<times> initial\<^sub>2 B) (\<lambda>a (p, q). transition\<^sub>1 A a p \<times> transition\<^sub>2 B a q) (condition (condition\<^sub>1 A) (condition\<^sub>2 B))) a (p, q) = transition\<^sub>1 A a p \<times> transition\<^sub>2 B a q &&& condition\<^sub>3 (automaton\<^sub>3 (alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B) (initial\<^sub>1 A \<times> initial\<^sub>2 B) (\<lambda>a (p, q). transition\<^sub>1 A a p \<times> transition\<^sub>2 B a q) (condition (condition\<^sub>1 A) (condition\<^sub>2 B))) = condition (condition\<^sub>1 A) (condition\<^sub>2 B)
[PROOF STEP]
by auto


[STATEMENT]
lemma csqrt_cmod_square:
  shows "csqrt ((cmod z)\<^sup>2) = cmod z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. csqrt (complex_of_real ((cmod z)\<^sup>2)) = complex_of_real (cmod z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. csqrt (complex_of_real ((cmod z)\<^sup>2)) = complex_of_real (cmod z)
[PROOF STEP]
have "csqrt ((cmod z)\<^sup>2) = sqrt (Re ((cmod z)\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. csqrt (complex_of_real ((cmod z)\<^sup>2)) = complex_of_real (sqrt (Re (complex_of_real ((cmod z)\<^sup>2))))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
csqrt (complex_of_real ((cmod z)\<^sup>2)) = complex_of_real (sqrt (Re (complex_of_real ((cmod z)\<^sup>2))))

goal (1 subgoal):
 1. csqrt (complex_of_real ((cmod z)\<^sup>2)) = complex_of_real (cmod z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
csqrt (complex_of_real ((cmod z)\<^sup>2)) = complex_of_real (sqrt (Re (complex_of_real ((cmod z)\<^sup>2))))

goal (1 subgoal):
 1. csqrt (complex_of_real ((cmod z)\<^sup>2)) = complex_of_real (cmod z)
[PROOF STEP]
have "... = cmod z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (sqrt (Re (complex_of_real ((cmod z)\<^sup>2)))) = complex_of_real (cmod z)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
complex_of_real (sqrt (Re (complex_of_real ((cmod z)\<^sup>2)))) = complex_of_real (cmod z)

goal (1 subgoal):
 1. csqrt (complex_of_real ((cmod z)\<^sup>2)) = complex_of_real (cmod z)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
csqrt (complex_of_real ((cmod z)\<^sup>2)) = complex_of_real (cmod z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
csqrt (complex_of_real ((cmod z)\<^sup>2)) = complex_of_real (cmod z)

goal (1 subgoal):
 1. csqrt (complex_of_real ((cmod z)\<^sup>2)) = complex_of_real (cmod z)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
csqrt (complex_of_real ((cmod z)\<^sup>2)) = complex_of_real (cmod z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sublist_equal_lengths:
  fixes l1 l2
  assumes "subseq l1 l2" "(length l1 = length l2)"
  shows "(l1 = l2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l1 = l2
[PROOF STEP]
using assms subseq_same_length
[PROOF STATE]
proof (prove)
using this:
subseq l1 l2
length l1 = length l2
\<lbrakk>subseq ?xs ?ys; length ?xs = length ?ys\<rbrakk> \<Longrightarrow> ?xs = ?ys

goal (1 subgoal):
 1. l1 = l2
[PROOF STEP]
by blast

\<comment> \<open>NOTE can be solved directly with 'subseq\_order.antisym'.\<close>


[STATEMENT]
lemma erf_real_altdef_nonneg:
  "x \<ge> 0 \<Longrightarrow> erf (x::real) = 2 / sqrt pi * integral {0..x} (\<lambda>t. exp (-(t^2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> erf x = 2 / sqrt pi * integral {0..x} (\<lambda>t. exp (- t\<^sup>2))
[PROOF STEP]
using integral_exp_minus_squared_real[of 0 x]
[PROOF STATE]
proof (prove)
using this:
0 \<le> x \<Longrightarrow> ((\<lambda>t. exp (- t\<^sup>2)) has_integral sqrt pi / 2 * (erf x - erf 0)) {0..x}

goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> erf x = 2 / sqrt pi * integral {0..x} (\<lambda>t. exp (- t\<^sup>2))
[PROOF STEP]
by (simp add: has_integral_iff field_simps)


[STATEMENT]
lemma bij_mono_map_set_to_nat:
  assumes "finite A"
  shows "bij_betw (bij_mono_map_set_to_nat A) A {..<card A}"
        "mono_on A (bij_mono_map_set_to_nat A)"
        "(bij_mono_map_set_to_nat A) ` A = {..<card A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (bij_mono_map_set_to_nat A) A {..<card A} &&& mono_on A (bij_mono_map_set_to_nat A) &&& bij_mono_map_set_to_nat A ` A = {..<card A}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. bij_betw (bij_mono_map_set_to_nat A) A {..<card A}
 2. mono_on A (bij_mono_map_set_to_nat A)
 3. bij_mono_map_set_to_nat A ` A = {..<card A}
[PROOF STEP]
let ?f = "bij_mono_map_set_to_nat A"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. bij_betw (bij_mono_map_set_to_nat A) A {..<card A}
 2. mono_on A (bij_mono_map_set_to_nat A)
 3. bij_mono_map_set_to_nat A ` A = {..<card A}
[PROOF STEP]
have "bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A}
[PROOF STEP]
using assms sorted_list_of_set_bij_betw  bij_betw_the_inv_into
[PROOF STATE]
proof (prove)
using this:
finite A
finite ?A \<Longrightarrow> bij_betw ((!) (sorted_list_of_set ?A)) {..<card ?A} ?A
bij_betw ?f ?A ?B \<Longrightarrow> bij_betw (the_inv_into ?A ?f) ?B ?A

goal (1 subgoal):
 1. bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A}

goal (3 subgoals):
 1. bij_betw (bij_mono_map_set_to_nat A) A {..<card A}
 2. mono_on A (bij_mono_map_set_to_nat A)
 3. bij_mono_map_set_to_nat A ` A = {..<card A}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A}

goal (3 subgoals):
 1. bij_betw (bij_mono_map_set_to_nat A) A {..<card A}
 2. mono_on A (bij_mono_map_set_to_nat A)
 3. bij_mono_map_set_to_nat A ` A = {..<card A}
[PROOF STEP]
have "bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A}
                     = bij_betw ?f A {..<card A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A} = bij_betw (bij_mono_map_set_to_nat A) A {..<card A}
[PROOF STEP]
unfolding bij_mono_map_set_to_nat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A} = bij_betw (\<lambda>x. if x \<in> A then the_inv_into {..<card A} ((!) (sorted_list_of_set A)) x else card A) A {..<card A}
[PROOF STEP]
by (rule bij_betw_cong) simp
[PROOF STATE]
proof (state)
this:
bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A} = bij_betw (bij_mono_map_set_to_nat A) A {..<card A}

goal (3 subgoals):
 1. bij_betw (bij_mono_map_set_to_nat A) A {..<card A}
 2. mono_on A (bij_mono_map_set_to_nat A)
 3. bij_mono_map_set_to_nat A ` A = {..<card A}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A}
bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A} = bij_betw (bij_mono_map_set_to_nat A) A {..<card A}
[PROOF STEP]
show *: "bij_betw (bij_mono_map_set_to_nat A) A {..<card A}"
[PROOF STATE]
proof (prove)
using this:
bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A}
bij_betw (the_inv_into {..<card A} ((!) (sorted_list_of_set A))) A {..<card A} = bij_betw (bij_mono_map_set_to_nat A) A {..<card A}

goal (1 subgoal):
 1. bij_betw (bij_mono_map_set_to_nat A) A {..<card A}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bij_betw (bij_mono_map_set_to_nat A) A {..<card A}

goal (2 subgoals):
 1. mono_on A (bij_mono_map_set_to_nat A)
 2. bij_mono_map_set_to_nat A ` A = {..<card A}
[PROOF STEP]
have "mono_on A (the_inv_into {..<card A} ((!) (sorted_list_of_set A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono_on A (the_inv_into {..<card A} ((!) (sorted_list_of_set A)))
[PROOF STEP]
using assms sorted_list_of_set_bij_betw
      sorted_list_of_set_mono_on
[PROOF STATE]
proof (prove)
using this:
finite A
finite ?A \<Longrightarrow> bij_betw ((!) (sorted_list_of_set ?A)) {..<card ?A} ?A
finite ?A \<Longrightarrow> mono_on {..<card ?A} ((!) (sorted_list_of_set ?A))

goal (1 subgoal):
 1. mono_on A (the_inv_into {..<card A} ((!) (sorted_list_of_set A)))
[PROOF STEP]
by (intro bij_betw_mono_on_the_inv_into) auto
[PROOF STATE]
proof (state)
this:
mono_on A (the_inv_into {..<card A} ((!) (sorted_list_of_set A)))

goal (2 subgoals):
 1. mono_on A (bij_mono_map_set_to_nat A)
 2. bij_mono_map_set_to_nat A ` A = {..<card A}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mono_on A (the_inv_into {..<card A} ((!) (sorted_list_of_set A)))
[PROOF STEP]
show "mono_on A (bij_mono_map_set_to_nat A)"
[PROOF STATE]
proof (prove)
using this:
mono_on A (the_inv_into {..<card A} ((!) (sorted_list_of_set A)))

goal (1 subgoal):
 1. mono_on A (bij_mono_map_set_to_nat A)
[PROOF STEP]
unfolding bij_mono_map_set_to_nat_def
[PROOF STATE]
proof (prove)
using this:
mono_on A (the_inv_into {..<card A} ((!) (sorted_list_of_set A)))

goal (1 subgoal):
 1. mono_on A (\<lambda>x. if x \<in> A then the_inv_into {..<card A} ((!) (sorted_list_of_set A)) x else card A)
[PROOF STEP]
using mono_onD
[PROOF STATE]
proof (prove)
using this:
mono_on A (the_inv_into {..<card A} ((!) (sorted_list_of_set A)))
\<lbrakk>mono_on ?A ?f; ?r \<in> ?A; ?s \<in> ?A; ?r \<le> ?s\<rbrakk> \<Longrightarrow> ?f ?r \<le> ?f ?s

goal (1 subgoal):
 1. mono_on A (\<lambda>x. if x \<in> A then the_inv_into {..<card A} ((!) (sorted_list_of_set A)) x else card A)
[PROOF STEP]
by (intro mono_onI) (auto)
[PROOF STATE]
proof (state)
this:
mono_on A (bij_mono_map_set_to_nat A)

goal (1 subgoal):
 1. bij_mono_map_set_to_nat A ` A = {..<card A}
[PROOF STEP]
show "?f ` A = {..<card A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_mono_map_set_to_nat A ` A = {..<card A}
[PROOF STEP]
using assms bij_betw_imp_surj_on *
[PROOF STATE]
proof (prove)
using this:
finite A
bij_betw ?f ?A ?B \<Longrightarrow> ?f ` ?A = ?B
bij_betw (bij_mono_map_set_to_nat A) A {..<card A}

goal (1 subgoal):
 1. bij_mono_map_set_to_nat A ` A = {..<card A}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bij_mono_map_set_to_nat A ` A = {..<card A}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vec_of_basis_enum_to_inverse:
  fixes \<psi> :: "'a::one_dim"
  shows "vec_of_basis_enum (inverse \<psi>) = vec_of_list [inverse (vec_index (vec_of_basis_enum \<psi>) 0)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum (inverse \<psi>) = vec_of_list [inverse (vec_of_basis_enum \<psi> $ 0)]
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_of_basis_enum (inverse \<psi>) = vec_of_list [inverse (vec_of_basis_enum \<psi> $ 0)]
[PROOF STEP]
have [simp]: \<open>crepresentation {1} x 1 = one_dim_iso x\<close> for x :: 'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. crepresentation {1::'a} x (1::'a) = one_dim_iso x
[PROOF STEP]
apply (subst one_dim_scaleC_1[where x=x, symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. crepresentation {1::'a} (one_dim_iso x *\<^sub>C (1::'a)) (1::'a) = one_dim_iso x
[PROOF STEP]
apply (subst complex_vector.representation_scale)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. cindependent {1::'a}
 2. (1::'a) \<in> cspan {1::'a}
 3. one_dim_iso x * crepresentation {1::'a} (1::'a) (1::'a) = one_dim_iso x
[PROOF STEP]
by (auto simp add: complex_vector.span_base complex_vector.representation_basis)
[PROOF STATE]
proof (state)
this:
crepresentation {1::'a} ?x (1::'a) = one_dim_iso ?x

goal (1 subgoal):
 1. vec_of_basis_enum (inverse \<psi>) = vec_of_list [inverse (vec_of_basis_enum \<psi> $ 0)]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum (inverse \<psi>) = vec_of_list [inverse (vec_of_basis_enum \<psi> $ 0)]
[PROOF STEP]
apply (rule eq_vecI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (vec_of_list [inverse (vec_of_basis_enum \<psi> $ 0)]) \<Longrightarrow> vec_of_basis_enum (inverse \<psi>) $ i = vec_of_list [inverse (vec_of_basis_enum \<psi> $ 0)] $ i
 2. dim_vec (vec_of_basis_enum (inverse \<psi>)) = dim_vec (vec_of_list [inverse (vec_of_basis_enum \<psi> $ 0)])
[PROOF STEP]
apply (auto simp: vec_of_basis_enum_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. one_dim_iso (inverse \<psi>) = inverse (one_dim_iso \<psi>)
[PROOF STEP]
by (metis complex_vector.scale_cancel_right one_dim_inverse one_dim_scaleC_1 zero_neq_one)
[PROOF STATE]
proof (state)
this:
vec_of_basis_enum (inverse \<psi>) = vec_of_list [inverse (vec_of_basis_enum \<psi> $ 0)]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Re_winding_number_half_right:
  assumes "\<forall>p\<in>path_image \<gamma>. Re p \<ge> Re z" and "valid_path \<gamma>" and  "z\<notin>path_image \<gamma>"
  shows "Re(winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z)))/(2*pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z))) / (2 * pi)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z))) / (2 * pi)
[PROOF STEP]
define g where "g=(\<lambda>t. \<gamma> t - z)"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>t. \<gamma> t - z)

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z))) / (2 * pi)
[PROOF STEP]
define st fi where "st\<equiv>pathstart g" and "fi\<equiv>pathfinish g"
[PROOF STATE]
proof (state)
this:
st \<equiv> pathstart g
fi \<equiv> pathfinish g

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z))) / (2 * pi)
[PROOF STEP]
have "valid_path g" "0\<notin>path_image g" and pos_img:"\<forall>p\<in>path_image g. Re p \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (valid_path g &&& 0 \<notin> path_image g) &&& \<forall>p\<in>path_image g. 0 \<le> Re p
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (valid_path (\<lambda>t. \<gamma> t - z) &&& 0 \<notin> path_image (\<lambda>t. \<gamma> t - z)) &&& \<forall>p\<in>path_image (\<lambda>t. \<gamma> t - z). 0 \<le> Re p
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_path (\<lambda>t. \<gamma> t - z)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
valid_path \<gamma>

goal (1 subgoal):
 1. valid_path (\<lambda>t. \<gamma> t - z)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 \<notin> path_image (\<lambda>t. \<gamma> t - z)
 2. \<forall>p\<in>path_image (\<lambda>t. \<gamma> t - z). 0 \<le> Re p
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<notin> path_image (\<lambda>t. \<gamma> t - z)
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
z \<notin> path_image \<gamma>

goal (1 subgoal):
 1. 0 \<notin> path_image (\<lambda>t. \<gamma> t - z)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>path_image (\<lambda>t. \<gamma> t - z). 0 \<le> Re p
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>path_image (\<lambda>t. \<gamma> t - z). 0 \<le> Re p
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>path_image \<gamma>. Re z \<le> Re p

goal (1 subgoal):
 1. \<forall>p\<in>path_image (\<lambda>t. \<gamma> t - z). 0 \<le> Re p
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
valid_path g
0 \<notin> path_image g
\<forall>p\<in>path_image g. 0 \<le> Re p

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z))) / (2 * pi)
[PROOF STEP]
have "(inverse has_contour_integral Ln fi - Ln st) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inverse has_contour_integral Ln fi - Ln st) g
[PROOF STEP]
unfolding fi_def st_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inverse has_contour_integral Ln (pathfinish g) - Ln (pathstart g)) g
[PROOF STEP]
proof (rule contour_integral_primitive[OF _ \<open>valid_path g\<close>,of " - \<real>\<^sub>\<le>\<^sub>0"])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> - \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> (Ln has_field_derivative inverse x) (at x within - \<real>\<^sub>\<le>\<^sub>0)
 2. path_image g \<subseteq> - \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
fix x::complex
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> - \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> (Ln has_field_derivative inverse x) (at x within - \<real>\<^sub>\<le>\<^sub>0)
 2. path_image g \<subseteq> - \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
assume "x \<in> - \<real>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (state)
this:
x \<in> - \<real>\<^sub>\<le>\<^sub>0

goal (2 subgoals):
 1. \<And>x. x \<in> - \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> (Ln has_field_derivative inverse x) (at x within - \<real>\<^sub>\<le>\<^sub>0)
 2. path_image g \<subseteq> - \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> - \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
have "(Ln has_field_derivative inverse x) (at x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> - \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. (Ln has_field_derivative inverse x) (at x)
[PROOF STEP]
using has_field_derivative_Ln
[PROOF STATE]
proof (prove)
using this:
x \<in> - \<real>\<^sub>\<le>\<^sub>0
?z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> (Ln has_field_derivative inverse ?z) (at ?z)

goal (1 subgoal):
 1. (Ln has_field_derivative inverse x) (at x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(Ln has_field_derivative inverse x) (at x)

goal (2 subgoals):
 1. \<And>x. x \<in> - \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> (Ln has_field_derivative inverse x) (at x within - \<real>\<^sub>\<le>\<^sub>0)
 2. path_image g \<subseteq> - \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(Ln has_field_derivative inverse x) (at x)
[PROOF STEP]
show "(Ln has_field_derivative inverse x) (at x within - \<real>\<^sub>\<le>\<^sub>0)"
[PROOF STATE]
proof (prove)
using this:
(Ln has_field_derivative inverse x) (at x)

goal (1 subgoal):
 1. (Ln has_field_derivative inverse x) (at x within - \<real>\<^sub>\<le>\<^sub>0)
[PROOF STEP]
using has_field_derivative_at_within
[PROOF STATE]
proof (prove)
using this:
(Ln has_field_derivative inverse x) (at x)
(?f has_field_derivative ?f') (at ?x) \<Longrightarrow> (?f has_field_derivative ?f') (at ?x within ?s)

goal (1 subgoal):
 1. (Ln has_field_derivative inverse x) (at x within - \<real>\<^sub>\<le>\<^sub>0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(Ln has_field_derivative inverse x) (at x within - \<real>\<^sub>\<le>\<^sub>0)

goal (1 subgoal):
 1. path_image g \<subseteq> - \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. path_image g \<subseteq> - \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
show "path_image g \<subseteq> - \<real>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image g \<subseteq> - \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
using pos_img \<open>0\<notin>path_image g\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>path_image g. 0 \<le> Re p
0 \<notin> path_image g

goal (1 subgoal):
 1. path_image g \<subseteq> - \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
by (metis ComplI antisym assms(3) complex_nonpos_Reals_iff complex_surj
          subsetI zero_complex.code)
[PROOF STATE]
proof (state)
this:
path_image g \<subseteq> - \<real>\<^sub>\<le>\<^sub>0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(inverse has_contour_integral Ln fi - Ln st) g

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z))) / (2 * pi)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(inverse has_contour_integral Ln fi - Ln st) g
[PROOF STEP]
have winding_eq:"2*pi*\<i>*winding_number g 0 = (Ln fi - Ln st)"
[PROOF STATE]
proof (prove)
using this:
(inverse has_contour_integral Ln fi - Ln st) g

goal (1 subgoal):
 1. complex_of_real (2 * pi) * \<i> * winding_number g 0 = Ln fi - Ln st
[PROOF STEP]
using has_contour_integral_winding_number[OF \<open>valid_path g\<close> \<open>0\<notin>path_image g\<close>
        ,simplified,folded inverse_eq_divide] has_contour_integral_unique
[PROOF STATE]
proof (prove)
using this:
(inverse has_contour_integral Ln fi - Ln st) g
(inverse has_contour_integral 2 * complex_of_real pi * \<i> * winding_number g 0) g
\<lbrakk>(?f has_contour_integral ?i) ?g; (?f has_contour_integral ?j) ?g\<rbrakk> \<Longrightarrow> ?i = ?j

goal (1 subgoal):
 1. complex_of_real (2 * pi) * \<i> * winding_number g 0 = Ln fi - Ln st
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
complex_of_real (2 * pi) * \<i> * winding_number g 0 = Ln fi - Ln st

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z))) / (2 * pi)
[PROOF STEP]
have "Re(winding_number g 0)
      = (Im (Ln fi) - Im (Ln st))/(2*pi)"
    (is "?L=?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (winding_number g 0) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re (winding_number g 0) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)
[PROOF STEP]
have "?L = Re((Ln fi - Ln st)/(2*pi*\<i>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (winding_number g 0) = Re ((Ln fi - Ln st) / (complex_of_real (2 * pi) * \<i>))
[PROOF STEP]
using winding_eq[symmetric]
[PROOF STATE]
proof (prove)
using this:
Ln fi - Ln st = complex_of_real (2 * pi) * \<i> * winding_number g 0

goal (1 subgoal):
 1. Re (winding_number g 0) = Re ((Ln fi - Ln st) / (complex_of_real (2 * pi) * \<i>))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re (winding_number g 0) = Re ((Ln fi - Ln st) / (complex_of_real (2 * pi) * \<i>))

goal (1 subgoal):
 1. Re (winding_number g 0) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Re (winding_number g 0) = Re ((Ln fi - Ln st) / (complex_of_real (2 * pi) * \<i>))

goal (1 subgoal):
 1. Re (winding_number g 0) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)
[PROOF STEP]
have "... = ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re ((Ln fi - Ln st) / (complex_of_real (2 * pi) * \<i>)) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)
[PROOF STEP]
by (metis Im_divide_of_real Im_i_times complex_i_not_zero minus_complex.simps(2)
          mult.commute mult_divide_mult_cancel_left_if times_divide_eq_right)
[PROOF STATE]
proof (state)
this:
Re ((Ln fi - Ln st) / (complex_of_real (2 * pi) * \<i>)) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)

goal (1 subgoal):
 1. Re (winding_number g 0) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Re (winding_number g 0) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Re (winding_number g 0) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)

goal (1 subgoal):
 1. Re (winding_number g 0) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Re (winding_number g 0) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Re (winding_number g 0) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z))) / (2 * pi)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Re (winding_number g 0) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Re (winding_number g 0) = (Im (Ln fi) - Im (Ln st)) / (2 * pi)

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z))) / (2 * pi)
[PROOF STEP]
unfolding g_def fi_def st_def
[PROOF STATE]
proof (prove)
using this:
Re (winding_number (\<lambda>t. \<gamma> t - z) 0) = (Im (Ln (pathfinish (\<lambda>t. \<gamma> t - z))) - Im (Ln (pathstart (\<lambda>t. \<gamma> t - z)))) / (2 * pi)

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z))) / (2 * pi)
[PROOF STEP]
using winding_number_offset
[PROOF STATE]
proof (prove)
using this:
Re (winding_number (\<lambda>t. \<gamma> t - z) 0) = (Im (Ln (pathfinish (\<lambda>t. \<gamma> t - z))) - Im (Ln (pathstart (\<lambda>t. \<gamma> t - z)))) / (2 * pi)
winding_number ?p ?z = winding_number (\<lambda>w. ?p w - ?z) 0

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z))) / (2 * pi)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Re (winding_number \<gamma> z) = (Im (Ln (pathfinish \<gamma> - z)) - Im (Ln (pathstart \<gamma> - z))) / (2 * pi)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma indets_power_subset: "indets (p ^ n) \<subseteq> indets (p::('x \<Rightarrow>\<^sub>0 nat) \<Rightarrow>\<^sub>0 'b::comm_semiring_1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indets (p ^ n) \<subseteq> indets p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. indets (p ^ n) \<subseteq> indets p
[PROOF STEP]
have "p ^ n = (\<Prod>i=0..<n. p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ n = (\<Prod>i = 0..<n. p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p ^ n = (\<Prod>i = 0..<n. p)

goal (1 subgoal):
 1. indets (p ^ n) \<subseteq> indets p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p ^ n = (\<Prod>i = 0..<n. p)

goal (1 subgoal):
 1. indets (p ^ n) \<subseteq> indets p
[PROOF STEP]
have "indets ... \<subseteq> (\<Union>i\<in>{0..<n}. indets p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indets (\<Prod>i = 0..<n. p) \<subseteq> (\<Union>i\<in>{0..<n}. indets p)
[PROOF STEP]
by (fact indets_prod_subset)
[PROOF STATE]
proof (state)
this:
indets (\<Prod>i = 0..<n. p) \<subseteq> (\<Union>i\<in>{0..<n}. indets p)

goal (1 subgoal):
 1. indets (p ^ n) \<subseteq> indets p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
indets (\<Prod>i = 0..<n. p) \<subseteq> (\<Union>i\<in>{0..<n}. indets p)

goal (1 subgoal):
 1. indets (p ^ n) \<subseteq> indets p
[PROOF STEP]
have "... \<subseteq> indets p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i\<in>{0..<n}. indets p) \<subseteq> indets p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Union>i\<in>{0..<n}. indets p) \<subseteq> indets p

goal (1 subgoal):
 1. indets (p ^ n) \<subseteq> indets p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
indets (p ^ n) \<subseteq> indets p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
indets (p ^ n) \<subseteq> indets p

goal (1 subgoal):
 1. indets (p ^ n) \<subseteq> indets p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
indets (p ^ n) \<subseteq> indets p

goal:
No subgoals!
[PROOF STEP]
qed