[STATEMENT]
lemma unique_calc_x_axis_intersection:
  assumes "is_poincare_line H" and "H \<noteq> x_axis"
  assumes "x \<in> unit_disc" and "x \<in> circline_set H \<inter> circline_set x_axis"
  shows  "x = calc_x_axis_intersection H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = calc_x_axis_intersection H
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = calc_x_axis_intersection H
[PROOF STEP]
have *: "intersects_x_axis H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. intersects_x_axis H
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H
H \<noteq> x_axis
x \<in> unit_disc
x \<in> circline_set H \<inter> circline_set x_axis

goal (1 subgoal):
 1. intersects_x_axis H
[PROOF STEP]
using intersects_x_axis_iff[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H
H \<noteq> x_axis
x \<in> unit_disc
x \<in> circline_set H \<inter> circline_set x_axis
(\<exists>x\<in>unit_disc. x \<in> circline_set H \<inter> circline_set x_axis) = intersects_x_axis H

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

goal (1 subgoal):
 1. x = calc_x_axis_intersection H
[PROOF STEP]
show "x = calc_x_axis_intersection H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = calc_x_axis_intersection H
[PROOF STEP]
using calc_x_axis_intersection[OF assms(1) *]
[PROOF STATE]
proof (prove)
using this:
calc_x_axis_intersection H \<in> circline_set H \<inter> circline_set x_axis

goal (1 subgoal):
 1. x = calc_x_axis_intersection H
[PROOF STEP]
using calc_x_axis_intersection_in_unit_disc[OF assms(1) *]
[PROOF STATE]
proof (prove)
using this:
calc_x_axis_intersection H \<in> circline_set H \<inter> circline_set x_axis
calc_x_axis_intersection H \<in> unit_disc

goal (1 subgoal):
 1. x = calc_x_axis_intersection H
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
calc_x_axis_intersection H \<in> circline_set H \<inter> circline_set x_axis
calc_x_axis_intersection H \<in> unit_disc
is_poincare_line H
H \<noteq> x_axis
x \<in> unit_disc
x \<in> circline_set H \<inter> circline_set x_axis

goal (1 subgoal):
 1. x = calc_x_axis_intersection H
[PROOF STEP]
using unique_is_poincare_line[of x "calc_x_axis_intersection H" H x_axis]
[PROOF STATE]
proof (prove)
using this:
calc_x_axis_intersection H \<in> circline_set H \<inter> circline_set x_axis
calc_x_axis_intersection H \<in> unit_disc
is_poincare_line H
H \<noteq> x_axis
x \<in> unit_disc
x \<in> circline_set H \<inter> circline_set x_axis
\<lbrakk>x \<in> unit_disc; calc_x_axis_intersection H \<in> unit_disc; x \<noteq> calc_x_axis_intersection H; is_poincare_line H; is_poincare_line x_axis; {x, calc_x_axis_intersection H} \<subseteq> circline_set H \<inter> circline_set x_axis\<rbrakk> \<Longrightarrow> H = x_axis

goal (1 subgoal):
 1. x = calc_x_axis_intersection H
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = calc_x_axis_intersection H

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma padic_one_in_padic_set:
  assumes "prime p"
  shows "padic_one p \<in> padic_set p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_one p \<in> padic_set p
[PROOF STEP]
apply(rule padic_set_memI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m. padic_one p m \<in> carrier (residue_ring (p ^ m))
 2. \<And>m n. m < n \<Longrightarrow> residue (p ^ m) (padic_one p n) = padic_one p m
[PROOF STEP]
by(auto simp : assms padic_one_def prime_gt_1_int residue_def residue_ring_def)


[STATEMENT]
lemma real_card_permutations_of_multiset_remove:
  assumes "x \<in># A"
  shows   "real (card (permutations_of_multiset (A - {#x#}))) =
             real (card (permutations_of_multiset A) * count A x) / real (size A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (permutations_of_multiset (A - {#x#}))) = real (card (permutations_of_multiset A) * count A x) / real (size A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in># A

goal (1 subgoal):
 1. real (card (permutations_of_multiset (A - {#x#}))) = real (card (permutations_of_multiset A) * count A x) / real (size A)
[PROOF STEP]
by (subst card_permutations_of_multiset_remove_aux[OF assms]) auto


[STATEMENT]
lemma CDERIV_pow [simp]: "DERIV (\<lambda>x. x ^ n) x :> complex_of_real (real n) * (x ^ (n - Suc 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x ^ n) has_field_derivative complex_of_real (real n) * x ^ (n - Suc 0)) (at x)
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((\<lambda>x. x ^ 0) has_field_derivative complex_of_real (real 0) * x ^ (0 - Suc 0)) (at x)
 2. \<And>n. ((\<lambda>x. x ^ n) has_field_derivative complex_of_real (real n) * x ^ (n - Suc 0)) (at x) \<Longrightarrow> ((\<lambda>x. x ^ Suc n) has_field_derivative complex_of_real (real (Suc n)) * x ^ (Suc n - Suc 0)) (at x)
[PROOF STEP]
apply (drule_tac [2] DERIV_ident [THEN DERIV_mult])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((\<lambda>x. x ^ 0) has_field_derivative complex_of_real (real 0) * x ^ (0 - Suc 0)) (at x)
 2. \<And>n. ((\<lambda>x. x * x ^ n) has_field_derivative 1 * x ^ n + complex_of_real (real n) * x ^ (n - Suc 0) * x) (at x) \<Longrightarrow> ((\<lambda>x. x ^ Suc n) has_field_derivative complex_of_real (real (Suc n)) * x ^ (Suc n - Suc 0)) (at x)
[PROOF STEP]
apply (auto simp add: distrib_right of_nat_Suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. ((\<lambda>x. x * x ^ n) has_field_derivative x ^ n + of_nat n * x ^ (n - Suc 0) * x) (at x) \<Longrightarrow> ((\<lambda>x. x * x ^ n) has_field_derivative x ^ n + of_nat n * x ^ n) (at x)
[PROOF STEP]
apply (case_tac "n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>((\<lambda>x. x * x ^ n) has_field_derivative x ^ n + of_nat n * x ^ (n - Suc 0) * x) (at x); n = 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. x * x ^ n) has_field_derivative x ^ n + of_nat n * x ^ n) (at x)
 2. \<And>n nat. \<lbrakk>((\<lambda>x. x * x ^ n) has_field_derivative x ^ n + of_nat n * x ^ (n - Suc 0) * x) (at x); n = Suc nat\<rbrakk> \<Longrightarrow> ((\<lambda>x. x * x ^ n) has_field_derivative x ^ n + of_nat n * x ^ n) (at x)
[PROOF STEP]
apply (auto simp add: ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma contour_integral_neg:
  shows "contour_integral g (\<lambda>x. -f x) = -contour_integral g f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral g (\<lambda>x. - f x) = - contour_integral g f
[PROOF STEP]
proof (cases "f contour_integrable_on g")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f contour_integrable_on g \<Longrightarrow> contour_integral g (\<lambda>x. - f x) = - contour_integral g f
 2. \<not> f contour_integrable_on g \<Longrightarrow> contour_integral g (\<lambda>x. - f x) = - contour_integral g f
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f contour_integrable_on g

goal (2 subgoals):
 1. f contour_integrable_on g \<Longrightarrow> contour_integral g (\<lambda>x. - f x) = - contour_integral g f
 2. \<not> f contour_integrable_on g \<Longrightarrow> contour_integral g (\<lambda>x. - f x) = - contour_integral g f
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f contour_integrable_on g

goal (1 subgoal):
 1. contour_integral g (\<lambda>x. - f x) = - contour_integral g f
[PROOF STEP]
by (simp add: contour_integral_neg)
[PROOF STATE]
proof (state)
this:
contour_integral g (\<lambda>x. - f x) = - contour_integral g f

goal (1 subgoal):
 1. \<not> f contour_integrable_on g \<Longrightarrow> contour_integral g (\<lambda>x. - f x) = - contour_integral g f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> f contour_integrable_on g \<Longrightarrow> contour_integral g (\<lambda>x. - f x) = - contour_integral g f
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> f contour_integrable_on g

goal (1 subgoal):
 1. \<not> f contour_integrable_on g \<Longrightarrow> contour_integral g (\<lambda>x. - f x) = - contour_integral g f
[PROOF STEP]
hence "\<not>(\<lambda>x. -f x) contour_integrable_on g"
[PROOF STATE]
proof (prove)
using this:
\<not> f contour_integrable_on g

goal (1 subgoal):
 1. \<not> (\<lambda>x. - f x) contour_integrable_on g
[PROOF STEP]
by (simp add: contour_integrable_neg_iff)
[PROOF STATE]
proof (state)
this:
\<not> (\<lambda>x. - f x) contour_integrable_on g

goal (1 subgoal):
 1. \<not> f contour_integrable_on g \<Longrightarrow> contour_integral g (\<lambda>x. - f x) = - contour_integral g f
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> f contour_integrable_on g
\<not> (\<lambda>x. - f x) contour_integrable_on g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> f contour_integrable_on g
\<not> (\<lambda>x. - f x) contour_integrable_on g

goal (1 subgoal):
 1. contour_integral g (\<lambda>x. - f x) = - contour_integral g f
[PROOF STEP]
by (simp add: not_integrable_contour_integral)
[PROOF STATE]
proof (state)
this:
contour_integral g (\<lambda>x. - f x) = - contour_integral g f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mono_Inf:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'b::complete_lattice"
  shows "mono f \<Longrightarrow> f (Inf S) \<le> Inf (f`S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> f (Inf S) \<le> Inf (f ` S)
[PROOF STEP]
apply (rule Inf_greatest)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>mono f; x \<in> f ` S\<rbrakk> \<Longrightarrow> f (Inf S) \<le> x
[PROOF STEP]
apply (erule imageE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>mono f; x = f xa; xa \<in> S\<rbrakk> \<Longrightarrow> f (Inf S) \<le> x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>mono f; x = f xa; xa \<in> S\<rbrakk> \<Longrightarrow> f (Inf S) \<le> f xa
[PROOF STEP]
apply (erule monoD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>x = f xa; xa \<in> S\<rbrakk> \<Longrightarrow> Inf S \<le> xa
[PROOF STEP]
apply (erule Inf_lower)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma seq_compact_eq_acc_point:
  fixes s :: "'a :: first_countable_topology set"
  shows "seq_compact s \<longleftrightarrow>
    (\<forall>t. infinite t \<and> countable t \<and> t \<subseteq> s --> (\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. seq_compact s = (\<forall>t. infinite t \<and> countable t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)))
[PROOF STEP]
using
    countable_acc_point_imp_seq_compact[of s]
    countably_compact_imp_acc_point[of s]
    seq_compact_imp_countably_compact[of s]
[PROOF STATE]
proof (prove)
using this:
\<forall>t. infinite t \<and> countable t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> seq_compact s
\<lbrakk>countably_compact s; countable ?t; infinite ?t; ?t \<subseteq> s\<rbrakk> \<Longrightarrow> \<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> ?t)
seq_compact s \<Longrightarrow> countably_compact s

goal (1 subgoal):
 1. seq_compact s = (\<forall>t. infinite t \<and> countable t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)))
[PROOF STEP]
by metis


[STATEMENT]
lemma convergent_prod_imp_ev_nonzero:
  fixes f :: "nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}"
  assumes "convergent_prod f"
  shows   "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
convergent_prod f

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)
[PROOF STEP]
by (auto simp: eventually_at_top_linorder convergent_prod_altdef)


[STATEMENT]
lemma Smith_2x2_eucl_works:
  assumes PBQ: "(P,S,Q) = Smith_2x2_eucl A"
  shows "S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
have ib: "is_bezout_ext euclid_ext2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_bezout_ext euclid_ext2
[PROOF STEP]
by (simp add: is_bezout_ext_euclid_ext2)
[PROOF STATE]
proof (state)
this:
is_bezout_ext euclid_ext2

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
obtain P1 D Q1 where P1DQ1: "(P1,D,Q1) = diagonalize_2x2 A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P1 D Q1. (P1, D, Q1) = diagonalize_2x2 A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis prod_cases3)
[PROOF STATE]
proof (state)
this:
(P1, D, Q1) = diagonalize_2x2 A

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
obtain P2 S' Q2 where P2SQ2:"(P2,S',Q2) = diagonal_to_Smith_PQ D euclid_ext2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P2 S' Q2. (P2, S', Q2) = diagonal_to_Smith_PQ D euclid_ext2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis prod_cases3)
[PROOF STATE]
proof (state)
this:
(P2, S', Q2) = diagonal_to_Smith_PQ D euclid_ext2

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
have P: "P = P2 ** P1" and S: "S = S'" and Q: "Q = Q1 ** Q2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P = P2 ** P1 &&& S = S' &&& Q = Q1 ** Q2
[PROOF STEP]
by (metis (mono_tags, lifting) PBQ Pair_inject Smith_2x2_eucl_def P1DQ1 P2SQ2 old.prod.case)+
[PROOF STATE]
proof (state)
this:
P = P2 ** P1
S = S'
Q = Q1 ** Q2

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
have 1: "D = P1 ** A ** Q1 \<and> invertible P1 \<and> invertible Q1 \<and> isDiagonal D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D = P1 ** A ** Q1 \<and> invertible P1 \<and> invertible Q1 \<and> isDiagonal D
[PROOF STEP]
by (rule diagonalize_2x2_works[OF P1DQ1])
[PROOF STATE]
proof (state)
this:
D = P1 ** A ** Q1 \<and> invertible P1 \<and> invertible Q1 \<and> isDiagonal D

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
have 2: "S' = P2 ** D ** Q2 \<and> invertible P2 \<and> invertible Q2 \<and> Smith_normal_form S'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S' = P2 ** D ** Q2 \<and> invertible P2 \<and> invertible Q2 \<and> Smith_normal_form S'
[PROOF STEP]
by (rule diagonal_to_Smith_PQ'[OF _ ib P2SQ2], insert 1, auto)
[PROOF STATE]
proof (state)
this:
S' = P2 ** D ** Q2 \<and> invertible P2 \<and> invertible Q2 \<and> Smith_normal_form S'

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
using 1 2 P S Q
[PROOF STATE]
proof (prove)
using this:
D = P1 ** A ** Q1 \<and> invertible P1 \<and> invertible Q1 \<and> isDiagonal D
S' = P2 ** D ** Q2 \<and> invertible P2 \<and> invertible Q2 \<and> Smith_normal_form S'
P = P2 ** P1
S = S'
Q = Q1 ** Q2

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
by (simp add: 2 invertible_mult matrix_mul_assoc)
[PROOF STATE]
proof (state)
this:
S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sums_SUP[simp, intro]: "f sums (SUP n. \<Sum>i<n. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f sums (SUP n. sum f {..<n})
[PROOF STEP]
unfolding sums_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> (SUP n. sum f {..<n})
[PROOF STEP]
by (intro LIMSEQ_SUP monoI sum_mono2 zero_le) auto


[STATEMENT]
lemma alternating_harmonic_series_sums':
  "(\<lambda>k. inverse (real_of_nat (2*k+1)) - inverse (real_of_nat (2*k+2))) sums ln 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. inverse (real (2 * k + 1)) - inverse (real (2 * k + 2))) sums ln 2
[PROOF STEP]
unfolding sums_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k<n. inverse (real (2 * k + 1)) - inverse (real (2 * k + 2))) \<longlonglongrightarrow> ln 2
[PROOF STEP]
proof (rule Lim_transform_eventually)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?f \<longlonglongrightarrow> ln 2
 2. \<forall>\<^sub>F x in sequentially. ?f x = (\<Sum>k<x. inverse (real (2 * k + 1)) - inverse (real (2 * k + 2)))
[PROOF STEP]
show "(\<lambda>n. \<Sum>k<2*n. (-1)^k / (real_of_nat (Suc k))) \<longlonglongrightarrow> ln 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k<2 * n. (- 1) ^ k / real (Suc k)) \<longlonglongrightarrow> ln 2
[PROOF STEP]
using alternating_harmonic_series_sums
[PROOF STATE]
proof (prove)
using this:
(\<lambda>k. (- 1) ^ k / real (Suc k)) sums ln 2

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k<2 * n. (- 1) ^ k / real (Suc k)) \<longlonglongrightarrow> ln 2
[PROOF STEP]
unfolding sums_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>k<n. (- 1) ^ k / real (Suc k)) \<longlonglongrightarrow> ln 2

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k<2 * n. (- 1) ^ k / real (Suc k)) \<longlonglongrightarrow> ln 2
[PROOF STEP]
by (rule filterlim_compose) (rule mult_nat_left_at_top, simp)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k<2 * n. (- 1) ^ k / real (Suc k)) \<longlonglongrightarrow> ln 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. (\<Sum>k<2 * x. (- 1) ^ k / real (Suc k)) = (\<Sum>k<x. inverse (real (2 * k + 1)) - inverse (real (2 * k + 2)))
[PROOF STEP]
show "eventually (\<lambda>n. (\<Sum>k<2*n. (-1)^k / (real_of_nat (Suc k))) =
            (\<Sum>k<n. inverse (real_of_nat (2*k+1)) - inverse (real_of_nat (2*k+2)))) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (\<Sum>k<2 * n. (- 1) ^ k / real (Suc k)) = (\<Sum>k<n. inverse (real (2 * k + 1)) - inverse (real (2 * k + 2)))
[PROOF STEP]
proof (intro always_eventually allI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (\<Sum>k<2 * x. (- 1) ^ k / real (Suc k)) = (\<Sum>k<x. inverse (real (2 * k + 1)) - inverse (real (2 * k + 2)))
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (\<Sum>k<2 * x. (- 1) ^ k / real (Suc k)) = (\<Sum>k<x. inverse (real (2 * k + 1)) - inverse (real (2 * k + 2)))
[PROOF STEP]
show "(\<Sum>k<2*n. (-1)^k / (real_of_nat (Suc k))) =
              (\<Sum>k<n. inverse (real_of_nat (2*k+1)) - inverse (real_of_nat (2*k+2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<2 * n. (- 1) ^ k / real (Suc k)) = (\<Sum>k<n. inverse (real (2 * k + 1)) - inverse (real (2 * k + 2)))
[PROOF STEP]
by (induction n) (simp_all add: inverse_eq_divide)
[PROOF STATE]
proof (state)
this:
(\<Sum>k<2 * n. (- 1) ^ k / real (Suc k)) = (\<Sum>k<n. inverse (real (2 * k + 1)) - inverse (real (2 * k + 2)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. (\<Sum>k<2 * n. (- 1) ^ k / real (Suc k)) = (\<Sum>k<n. inverse (real (2 * k + 1)) - inverse (real (2 * k + 2)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_power_less_diff:
  assumes lt: "(2::nat) ^ n * q < 2 ^ m"
  shows "q < 2 ^ (m - n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q < 2 ^ (m - n)
[PROOF STEP]
using lt
[PROOF STATE]
proof (prove)
using this:
2 ^ n * q < 2 ^ m

goal (1 subgoal):
 1. q < 2 ^ (m - n)
[PROOF STEP]
proof (induct n arbitrary: m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m. 2 ^ 0 * q < 2 ^ m \<Longrightarrow> q < 2 ^ (m - 0)
 2. \<And>n m. \<lbrakk>\<And>m. 2 ^ n * q < 2 ^ m \<Longrightarrow> q < 2 ^ (m - n); 2 ^ Suc n * q < 2 ^ m\<rbrakk> \<Longrightarrow> q < 2 ^ (m - Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
2 ^ 0 * q < 2 ^ m

goal (2 subgoals):
 1. \<And>m. 2 ^ 0 * q < 2 ^ m \<Longrightarrow> q < 2 ^ (m - 0)
 2. \<And>n m. \<lbrakk>\<And>m. 2 ^ n * q < 2 ^ m \<Longrightarrow> q < 2 ^ (m - n); 2 ^ Suc n * q < 2 ^ m\<rbrakk> \<Longrightarrow> q < 2 ^ (m - Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ 0 * q < 2 ^ m
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
2 ^ 0 * q < 2 ^ m

goal (1 subgoal):
 1. q < 2 ^ (m - 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
q < 2 ^ (m - 0)

goal (1 subgoal):
 1. \<And>n m. \<lbrakk>\<And>m. 2 ^ n * q < 2 ^ m \<Longrightarrow> q < 2 ^ (m - n); 2 ^ Suc n * q < 2 ^ m\<rbrakk> \<Longrightarrow> q < 2 ^ (m - Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. \<lbrakk>\<And>m. 2 ^ n * q < 2 ^ m \<Longrightarrow> q < 2 ^ (m - n); 2 ^ Suc n * q < 2 ^ m\<rbrakk> \<Longrightarrow> q < 2 ^ (m - Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
2 ^ n * q < 2 ^ ?m \<Longrightarrow> q < 2 ^ (?m - n)
2 ^ Suc n * q < 2 ^ m

goal (1 subgoal):
 1. \<And>n m. \<lbrakk>\<And>m. 2 ^ n * q < 2 ^ m \<Longrightarrow> q < 2 ^ (m - n); 2 ^ Suc n * q < 2 ^ m\<rbrakk> \<Longrightarrow> q < 2 ^ (m - Suc n)
[PROOF STEP]
have ih: "\<And>m. 2 ^ n * q < 2 ^ m \<Longrightarrow> q < 2 ^ (m - n)"
    and prem: "2 ^ Suc n * q < 2 ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>m. 2 ^ n * q < 2 ^ m \<Longrightarrow> q < 2 ^ (m - n)) &&& 2 ^ Suc n * q < 2 ^ m
[PROOF STEP]
by fact+
[PROOF STATE]
proof (state)
this:
2 ^ n * q < 2 ^ ?m \<Longrightarrow> q < 2 ^ (?m - n)
2 ^ Suc n * q < 2 ^ m

goal (1 subgoal):
 1. \<And>n m. \<lbrakk>\<And>m. 2 ^ n * q < 2 ^ m \<Longrightarrow> q < 2 ^ (m - n); 2 ^ Suc n * q < 2 ^ m\<rbrakk> \<Longrightarrow> q < 2 ^ (m - Suc n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q < 2 ^ (m - Suc n)
[PROOF STEP]
proof (cases m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = 0 \<Longrightarrow> q < 2 ^ (m - Suc n)
 2. \<And>nat. m = Suc nat \<Longrightarrow> q < 2 ^ (m - Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
m = 0

goal (2 subgoals):
 1. m = 0 \<Longrightarrow> q < 2 ^ (m - Suc n)
 2. \<And>nat. m = Suc nat \<Longrightarrow> q < 2 ^ (m - Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m = 0

goal (1 subgoal):
 1. q < 2 ^ (m - Suc n)
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
m = 0
2 ^ n * q < 2 ^ ?m \<Longrightarrow> q < 2 ^ (?m - n)
2 ^ Suc n * q < 2 ^ m

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

goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> q < 2 ^ (m - Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> q < 2 ^ (m - Suc n)
[PROOF STEP]
case (Suc m')
[PROOF STATE]
proof (state)
this:
m = Suc m'

goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> q < 2 ^ (m - Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m = Suc m'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m = Suc m'

goal (1 subgoal):
 1. q < 2 ^ (m - Suc n)
[PROOF STEP]
using prem
[PROOF STATE]
proof (prove)
using this:
m = Suc m'
2 ^ Suc n * q < 2 ^ m

goal (1 subgoal):
 1. q < 2 ^ (m - Suc n)
[PROOF STEP]
by (simp add: ac_simps ih)
[PROOF STATE]
proof (state)
this:
q < 2 ^ (m - Suc n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
q < 2 ^ (m - Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homogeneous_solution_set_subspace:
fixes A::"'a::{field}^'n^'rows"
shows "vec.subspace (solution_set A 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.subspace (solution_set A 0)
[PROOF STEP]
using subspace_null_space[of A]
[PROOF STATE]
proof (prove)
using this:
vec.subspace (null_space A)

goal (1 subgoal):
 1. vec.subspace (solution_set A 0)
[PROOF STEP]
unfolding null_space_eq_solution_set
[PROOF STATE]
proof (prove)
using this:
vec.subspace (solution_set A 0)

goal (1 subgoal):
 1. vec.subspace (solution_set A 0)
[PROOF STEP]
.


[STATEMENT]
lemma two_mod_two [simp]:
  shows "2 mod Suc (Suc 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 mod Suc (Suc 0) = 0
[PROOF STEP]
by (simp add: numeral_2_eq_2)


[STATEMENT]
lemma gbinomial_mult_fact: "fact k * (a gchoose k) = (\<Prod>i = 0..<k. a - of_nat i)"
  for a :: "'a::field_char_0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact k * (a gchoose k) = (\<Prod>i = 0..<k. a - of_nat i)
[PROOF STEP]
by (simp_all add: gbinomial_prod_rev field_simps)


[STATEMENT]
lemma char_poly_four_block_mat_lower_left_zero: fixes A :: "'a :: idom mat"
  assumes A: "A = four_block_mat B C (0\<^sub>m m n) D"
  and B: "B \<in> carrier_mat n n"
  and C: "C \<in> carrier_mat n m"
  and D: "D \<in> carrier_mat m m"
shows "char_poly A = char_poly B * char_poly D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_poly A = char_poly B * char_poly D
[PROOF STEP]
unfolding A char_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (char_poly_matrix (four_block_mat B C (0\<^sub>m m n) D)) = Determinant.det (char_poly_matrix B) * Determinant.det (char_poly_matrix D)
[PROOF STEP]
by (subst char_poly_matrix_four_block_mat[OF B C _ D], force,
     rule det_four_block_mat_lower_left_zero[of _ n _ m], insert B C D, auto)


[STATEMENT]
lemma fact_double:
  "fact (2 * n) = (2 ^ (2 * n) * pochhammer (1 / 2) n * fact n :: 'a::field_char_0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (2 * n) = (2::'a) ^ (2 * n) * pochhammer ((1::'a) / (2::'a)) n * fact n
[PROOF STEP]
using pochhammer_double[of "1/2::'a" n]
[PROOF STATE]
proof (prove)
using this:
pochhammer ((2::'a) * ((1::'a) / (2::'a))) (2 * n) = of_nat (2 ^ (2 * n)) * pochhammer ((1::'a) / (2::'a)) n * pochhammer ((1::'a) / (2::'a) + (1::'a) / (2::'a)) n

goal (1 subgoal):
 1. fact (2 * n) = (2::'a) ^ (2 * n) * pochhammer ((1::'a) / (2::'a)) n * fact n
[PROOF STEP]
by (simp add: pochhammer_fact)


[STATEMENT]
lemma polyhedron_imp_closed:
  fixes S :: "'a :: euclidean_space set"
  shows "polyhedron S \<Longrightarrow> closed S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polyhedron S \<Longrightarrow> closed S
[PROOF STEP]
by (metis closed_Inter closed_halfspace_le polyhedron_def)


[STATEMENT]
lemma Max_atMost: "Max {..(n::nat)} = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max {..n} = n
[PROOF STEP]
by (rule Max_equality[OF _ finite_atMost], simp_all)


[STATEMENT]
lemma vec_to_iarray_snd_solve_system: "vec_to_iarray (snd (solve_system A b)) = snd (solve_system_iarrays (matrix_to_iarray A) (vec_to_iarray b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray (snd (solve_system A b)) = snd (solve_system_iarrays (matrix_to_iarray A) (vec_to_iarray b))
[PROOF STEP]
unfolding solve_system_def solve_system_iarrays_def Let_def snd_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray (fst (Gauss_Jordan_PA A) *v b) = fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) *iv vec_to_iarray b
[PROOF STEP]
by (metis matrix_to_iarray_fst_Gauss_Jordan_PA vec_to_iarray_matrix_matrix_mult)


[STATEMENT]
lemma pell_square_solution_nat_iff:
  fixes x y :: nat
  shows "x ^ 2 = 1 + D * y ^ 2  \<longleftrightarrow>  x = 1 \<and> (D = 0 \<or> y = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x\<^sup>2 = 1 + D * y\<^sup>2) = (x = 1 \<and> (D = 0 \<or> y = 0))
[PROOF STEP]
using pell_square_solution_nat_aux[of x y]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < D; x\<^sup>2 = 1 + D * y\<^sup>2\<rbrakk> \<Longrightarrow> (x, y) = (1, 0)

goal (1 subgoal):
 1. (x\<^sup>2 = 1 + D * y\<^sup>2) = (x = 1 \<and> (D = 0 \<or> y = 0))
[PROOF STEP]
by (cases "D = 0") auto


[STATEMENT]
lemma "dist w x < e/4 \<Longrightarrow> dist x y < e/4 \<Longrightarrow> dist y z < e/2 \<Longrightarrow> dist w z < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dist w x < e / 4; dist x y < e / 4; dist y z < e / 2\<rbrakk> \<Longrightarrow> dist w z < e
[PROOF STEP]
by metric


[STATEMENT]
lemma "D x = x' on (\<lambda>\<tau>. \<tau> + t) ` T \<Longrightarrow> D (\<lambda>\<tau>. x (\<tau> + t)) = (\<lambda>\<tau>. x' (\<tau> + t)) on T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1.  D x = x' on (\<lambda>\<tau>. \<tau> + t) ` T \<Longrightarrow>  D (\<lambda>\<tau>. x (\<tau> + t)) = (\<lambda>\<tau>. x' (\<tau> + t)) on T
[PROOF STEP]
by (rule vderiv_on_composeI, auto intro: poly_derivatives)


[STATEMENT]
lemma kernel_dim_code[code]:
  "kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
define nr where "nr = dim_row A"
[PROOF STATE]
proof (state)
this:
nr = dim_row A

goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
define nc where "nc = dim_col A"
[PROOF STATE]
proof (state)
this:
nc = dim_col A

goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
let ?B = "gauss_jordan_single A"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
have A: "A \<in> carrier_mat nr nc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat nr nc
[PROOF STEP]
unfolding nr_def nc_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat (dim_row A) (dim_col A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
from gauss_jordan_single[OF A refl]
[PROOF STATE]
proof (chain)
picking this:
?x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v ?x = 0\<^sub>v nr) = (gauss_jordan_single A *\<^sub>v ?x = 0\<^sub>v nr)
gauss_jordan_single A \<in> carrier_mat nr nc
row_echelon_form (gauss_jordan_single A)
\<exists>P Q. gauss_jordan_single A = P * A \<and> P \<in> carrier_mat nr nr \<and> Q \<in> carrier_mat nr nr \<and> P * Q = 1\<^sub>m nr \<and> Q * P = 1\<^sub>m nr
[PROOF STEP]
obtain P Q where AB: "?B = P * A" and QP: "Q * P = 1\<^sub>m nr" and
    P: "P \<in> carrier_mat nr nr" and Q: "Q \<in> carrier_mat nr nr" and B: "?B \<in> carrier_mat nr nc"
    and row: "row_echelon_form ?B"
[PROOF STATE]
proof (prove)
using this:
?x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v ?x = 0\<^sub>v nr) = (gauss_jordan_single A *\<^sub>v ?x = 0\<^sub>v nr)
gauss_jordan_single A \<in> carrier_mat nr nc
row_echelon_form (gauss_jordan_single A)
\<exists>P Q. gauss_jordan_single A = P * A \<and> P \<in> carrier_mat nr nr \<and> Q \<in> carrier_mat nr nr \<and> P * Q = 1\<^sub>m nr \<and> Q * P = 1\<^sub>m nr

goal (1 subgoal):
 1. (\<And>P Q. \<lbrakk>gauss_jordan_single A = P * A; Q * P = 1\<^sub>m nr; P \<in> carrier_mat nr nr; Q \<in> carrier_mat nr nr; gauss_jordan_single A \<in> carrier_mat nr nc; row_echelon_form (gauss_jordan_single A)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gauss_jordan_single A = P * A
Q * P = 1\<^sub>m nr
P \<in> carrier_mat nr nr
Q \<in> carrier_mat nr nr
gauss_jordan_single A \<in> carrier_mat nr nc
row_echelon_form (gauss_jordan_single A)

goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
interpret K: kernel nr nc ?B
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix_Kernel.kernel nr nc (gauss_jordan_single A)
[PROOF STEP]
by (unfold_locales, rule B)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
from mat_kernel_mult_eq[OF A P Q QP, folded AB]
[PROOF STATE]
proof (chain)
picking this:
mat_kernel (gauss_jordan_single A) = mat_kernel A
[PROOF STEP]
have "kernel_dim A = K.dim"
[PROOF STATE]
proof (prove)
using this:
mat_kernel (gauss_jordan_single A) = mat_kernel A

goal (1 subgoal):
 1. kernel_dim A = K.dim
[PROOF STEP]
unfolding kernel_dim_def
[PROOF STATE]
proof (prove)
using this:
mat_kernel (gauss_jordan_single A) = mat_kernel A

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (dim_col A)\<lparr>carrier := mat_kernel A\<rparr>) = K.dim
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
mat_kernel (gauss_jordan_single A) = mat_kernel A
A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (dim_col A)\<lparr>carrier := mat_kernel A\<rparr>) = K.dim
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
kernel_dim A = K.dim

goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
kernel_dim A = K.dim

goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
have "\<dots> = nc - length (pivot_positions ?B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. K.dim = nc - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
using find_base_vectors[OF row B]
[PROOF STATE]
proof (prove)
using this:
set (find_base_vectors (gauss_jordan_single A)) \<subseteq> mat_kernel (gauss_jordan_single A)
0\<^sub>v nc \<notin> set (find_base_vectors (gauss_jordan_single A))
K.basis (set (find_base_vectors (gauss_jordan_single A)))
card (set (find_base_vectors (gauss_jordan_single A))) = nc - card {i. i < nr \<and> row (gauss_jordan_single A) i \<noteq> 0\<^sub>v nc}
length (pivot_positions (gauss_jordan_single A)) = card {i. i < nr \<and> row (gauss_jordan_single A) i \<noteq> 0\<^sub>v nc}
K.dim = nc - card {i. i < nr \<and> row (gauss_jordan_single A) i \<noteq> 0\<^sub>v nc}

goal (1 subgoal):
 1. K.dim = nc - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
K.dim = nc - length (pivot_positions (gauss_jordan_single A))

goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
K.dim = nc - length (pivot_positions (gauss_jordan_single A))

goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
have "\<dots> = dim_col A - length (pivot_positions ?B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nc - length (pivot_positions (gauss_jordan_single A)) = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
unfolding nc_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col A - length (pivot_positions (gauss_jordan_single A)) = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nc - length (pivot_positions (gauss_jordan_single A)) = dim_col A - length (pivot_positions (gauss_jordan_single A))

goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))

goal (1 subgoal):
 1. kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
kernel_dim A = dim_col A - length (pivot_positions (gauss_jordan_single A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "valid_prefix (PrefixMatch pfx len) \<equiv> pfx && (2 ^ (32 - len) - 1) = (0 :: 32 word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_prefix (PrefixMatch pfx len) \<equiv> pfx && 2 ^ (32 - len) - 1 = 0
[PROOF STEP]
by (simp add: valid_prefix_def pfxm_mask_def mask_eq_decr_exp and.commute)


[STATEMENT]
lemma col_space_eq_row_space_transpose:
  shows "col_space A = row_space A\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col_space A = row_space A\<^sup>T
[PROOF STEP]
unfolding col_space_def row_space_def Matrix.rows_transpose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (set (cols A)) = local.span (set (cols A))
[PROOF STEP]
..


[STATEMENT]
lemma minus_one_less_divideI: "b > 0 \<Longrightarrow> -b < a \<Longrightarrow> -1 < a / (b::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < b; - b < a\<rbrakk> \<Longrightarrow> - 1 < a / b
[PROOF STEP]
by (auto simp: field_simps)


[STATEMENT]
lemma eucl_of_list_inj: "length xs = DIM('a::executable_euclidean_space) \<Longrightarrow> length ys = DIM('a) \<Longrightarrow>
  (eucl_of_list xs::'a) = eucl_of_list (ys) \<Longrightarrow> xs = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = DIM('a); length ys = DIM('a); eucl_of_list xs = eucl_of_list ys\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
apply (auto intro!: nth_equalityI simp: euclidean_eq_iff[where 'a="'a"] eucl_of_list_inner)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>length xs = DIM('a); length ys = DIM('a); \<forall>b\<in>Basis. xs ! index Basis_list b = ys ! index Basis_list b; i < DIM('a)\<rbrakk> \<Longrightarrow> xs ! i = ys ! i
[PROOF STEP]
using nth_Basis_list_in_Basis[where 'a="'a"]
[PROOF STATE]
proof (prove)
using this:
?n < length Basis_list \<Longrightarrow> Basis_list ! ?n \<in> Basis

goal (1 subgoal):
 1. \<And>i. \<lbrakk>length xs = DIM('a); length ys = DIM('a); \<forall>b\<in>Basis. xs ! index Basis_list b = ys ! index Basis_list b; i < DIM('a)\<rbrakk> \<Longrightarrow> xs ! i = ys ! i
[PROOF STEP]
by fastforce


[STATEMENT]
lemma countable_imp_g_le_Aleph0: "countable X \<Longrightarrow> gcard X \<le> \<aleph>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable X \<Longrightarrow> gcard X \<le> \<aleph>0
[PROOF STEP]
by (meson countable countable_iff_g_le_Aleph0)


[STATEMENT]
lemma aux_ineq_with_card:
  fixes g:: "nat \<Rightarrow> nat" and A:: "nat set"
  assumes "finite A"
  shows "(\<Sum>k\<in>A. (-1)^(g k)) \<le> card A" and "(\<Sum>k\<in>A. (-1)^(g k)) \<ge> -card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>A. (- 1) ^ g k) \<le> int (card A) &&& - int (card A) \<le> (\<Sum>k\<in>A. (- 1) ^ g k)
[PROOF STEP]
apply (smt assms neg_one_even_power neg_one_odd_power card_eq_sum of_nat_1 of_nat_sum sum_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - int (card A) \<le> (\<Sum>k\<in>A. (- 1) ^ g k)
[PROOF STEP]
apply (smt assms neg_one_even_power neg_one_odd_power card_eq_sum of_nat_1 of_nat_sum sum_mono sum_negf)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
.


[STATEMENT]
lemma sum_dim_vec_equals_sum_dim_poly:
  shows "(\<Sum>a = 0..<dim_vec A. coeff (vec_to_lpoly  A) a * X a) =
         (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). coeff (vec_to_lpoly  A) a * X a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
consider (eq) "dim_vec A = dim_poly (vec_to_lpoly A)" |
           (le) "dim_vec A > dim_poly (vec_to_lpoly A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> thesis; dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
using vec_to_poly_dim_less[of "A"]
[PROOF STATE]
proof (prove)
using this:
dim_poly (vec_to_lpoly A) \<le> dim_vec A

goal (1 subgoal):
 1. \<lbrakk>dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> thesis; dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<lbrakk>dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> ?thesis; dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> ?thesis; dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> ?thesis; dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
proof (cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
 2. dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
case le
[PROOF STATE]
proof (state)
this:
dim_poly (vec_to_lpoly A) < dim_vec A

goal (2 subgoals):
 1. dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
 2. dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
define dp where dp: "dp = dim_poly (vec_to_lpoly A)"
[PROOF STATE]
proof (state)
this:
dp = dim_poly (vec_to_lpoly A)

goal (2 subgoals):
 1. dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
 2. dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
have "(\<Sum>a = 0..<dim_vec A. coeff (vec_to_lpoly A) a * X a) =
          (\<Sum>a = 0..<dp. coeff (vec_to_lpoly A) a * X a) +
          (\<Sum>a = dp..<dim_vec A. coeff (vec_to_lpoly A) a * X a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) + (\<Sum>a = dp..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
by (metis (no_types, lifting) dp vec_to_poly_dim_less sum.atLeastLessThan_concat zero_le)
[PROOF STATE]
proof (state)
this:
(\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) + (\<Sum>a = dp..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)

goal (2 subgoals):
 1. dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
 2. dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) + (\<Sum>a = dp..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)

goal (2 subgoals):
 1. dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
 2. dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
have "... = (\<Sum>a = 0..<dp. coeff (vec_to_lpoly A) a * X a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) + (\<Sum>a = dp..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
using all_greater_dim_poly_zero
[PROOF STATE]
proof (prove)
using this:
dim_poly ?p \<le> ?x \<Longrightarrow> Abstract_Linear_Poly.coeff ?p ?x = 0

goal (1 subgoal):
 1. (\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) + (\<Sum>a = dp..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
by (simp add: dp)
[PROOF STATE]
proof (state)
this:
(\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) + (\<Sum>a = dp..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)

goal (2 subgoals):
 1. dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
 2. dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) + (\<Sum>a = dp..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)

goal (2 subgoals):
 1. dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
 2. dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
have "... = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A).coeff (vec_to_lpoly A) a * X a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
using dp
[PROOF STATE]
proof (prove)
using this:
dp = dim_poly (vec_to_lpoly A)

goal (1 subgoal):
 1. (\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>a = 0..<dp. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)

goal (2 subgoals):
 1. dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
 2. dim_poly (vec_to_lpoly A) < dim_vec A \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)

goal (1 subgoal):
 1. (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)

goal (1 subgoal):
 1. dim_vec A = dim_poly (vec_to_lpoly A) \<Longrightarrow> (\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)
[PROOF STEP]
qed (auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>a = 0..<dim_vec A. Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a) = (\<Sum>a = 0..<dim_poly (vec_to_lpoly A). Abstract_Linear_Poly.coeff (vec_to_lpoly A) a * X a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lcm_eq_1_iff [simp]: "lcm a b = 1 \<longleftrightarrow> is_unit a \<and> is_unit b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lcm a b = (1::'a)) = (is_unit a \<and> is_unit b)
[PROOF STEP]
by (auto intro: associated_eqI)


[STATEMENT]
lemma example_perfect_6: shows "perfect_number 6"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. perfect_number 6
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. perfect_number 6
[PROOF STEP]
have a: "set(divisors_nat 6) = {1, 2, 3, 6}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (divisors_nat 6) = {1, 2, 3, 6}
[PROOF STEP]
by eval
[PROOF STATE]
proof (state)
this:
set (divisors_nat 6) = {1, 2, 3, 6}

goal (1 subgoal):
 1. perfect_number 6
[PROOF STEP]
have b: "divisor_set (6) = {1, 2, 3, 6}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_set 6 = {1, 2, 3, 6}
[PROOF STEP]
using a  def_equiv_divisor_set
[PROOF STATE]
proof (prove)
using this:
set (divisors_nat 6) = {1, 2, 3, 6}
divisor_set ?n = set (divisors_nat ?n)

goal (1 subgoal):
 1. divisor_set 6 = {1, 2, 3, 6}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
divisor_set 6 = {1, 2, 3, 6}

goal (1 subgoal):
 1. perfect_number 6
[PROOF STEP]
have  c: "properdiv_set (6) = {1, 2, 3}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. properdiv_set 6 = {1, 2, 3}
[PROOF STEP]
using b union_properdiv_set properdiv_set proper_divisor_def
[PROOF STATE]
proof (prove)
using this:
divisor_set 6 = {1, 2, 3, 6}
1 \<le> ?n \<Longrightarrow> divisor_set ?n = properdiv_set ?n \<union> {?n}
properdiv_set ?m = {n. n properdiv ?m}
?n properdiv ?m \<equiv> 1 \<le> ?n \<and> ?n < ?m \<and> ?n dvd ?m

goal (1 subgoal):
 1. properdiv_set 6 = {1, 2, 3}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
properdiv_set 6 = {1, 2, 3}

goal (1 subgoal):
 1. perfect_number 6
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. perfect_number 6
[PROOF STEP]
using aliquot_sum_def c
[PROOF STATE]
proof (prove)
using this:
aliquot_sum ?n \<equiv> \<Sum> (properdiv_set ?n)
properdiv_set 6 = {1, 2, 3}

goal (1 subgoal):
 1. perfect_number 6
[PROOF STEP]
by (simp add: numeral_3_eq_3 perfect_number_def)
[PROOF STATE]
proof (state)
this:
perfect_number 6

goal:
No subgoals!
[PROOF STEP]
qed


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

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


[STATEMENT]
lemma le_mult_floor:
  assumes "0 \<le> a" and "0 \<le> b"
  shows "\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
have "of_int \<lfloor>a\<rfloor> \<le> a" and "of_int \<lfloor>b\<rfloor> \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int \<lfloor>a\<rfloor> \<le> a &&& of_int \<lfloor>b\<rfloor> \<le> b
[PROOF STEP]
by (auto intro: of_int_floor_le)
[PROOF STATE]
proof (state)
this:
of_int \<lfloor>a\<rfloor> \<le> a
of_int \<lfloor>b\<rfloor> \<le> b

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
of_int \<lfloor>a\<rfloor> \<le> a
of_int \<lfloor>b\<rfloor> \<le> b
[PROOF STEP]
have "of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) \<le> a * b"
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>a\<rfloor> \<le> a
of_int \<lfloor>b\<rfloor> \<le> b

goal (1 subgoal):
 1. of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) \<le> a * b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>a\<rfloor> \<le> a
of_int \<lfloor>b\<rfloor> \<le> b
(0::'a) \<le> a
(0::'a) \<le> b

goal (1 subgoal):
 1. of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) \<le> a * b
[PROOF STEP]
by (auto intro!: mult_mono)
[PROOF STATE]
proof (state)
this:
of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) \<le> a * b

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) \<le> a * b

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
have "a * b < of_int (\<lfloor>a * b\<rfloor> + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * b < of_int (\<lfloor>a * b\<rfloor> + 1)
[PROOF STEP]
using floor_correct[of "a * b"]
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>a * b\<rfloor> \<le> a * b \<and> a * b < of_int (\<lfloor>a * b\<rfloor> + 1)

goal (1 subgoal):
 1. a * b < of_int (\<lfloor>a * b\<rfloor> + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a * b < of_int (\<lfloor>a * b\<rfloor> + 1)

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) < of_int (\<lfloor>a * b\<rfloor> + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) < of_int (\<lfloor>a * b\<rfloor> + 1)

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
unfolding of_int_less_iff
[PROOF STATE]
proof (prove)
using this:
\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> < \<lfloor>a * b\<rfloor> + 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_aff_dim_le:
  fixes S :: "'a::euclidean_space set"
  assumes "S homeomorphic T" "rel_interior S \<noteq> {}"
    shows "aff_dim (affine hull S) \<le> aff_dim (affine hull T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
obtain f g
    where S: "\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x" and T: "\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y"
      and contf: "continuous_on S f" and contg: "continuous_on T g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms [unfolded homeomorphic_minimal]
[PROOF STATE]
proof (prove)
using this:
\<exists>f g. (\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x) \<and> (\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y) \<and> continuous_on S f \<and> continuous_on T g
rel_interior S \<noteq> {}

goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g

goal (1 subgoal):
 1. aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
proof (rule invariance_of_dimension_affine_sets)
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. openin (top_of_set (affine hull S)) ?S
 2. affine (affine hull S)
 3. affine (affine hull T)
 4. continuous_on ?S ?f
 5. ?f ` ?S \<subseteq> affine hull T
 6. inj_on ?f ?S
 7. ?S \<noteq> {}
[PROOF STEP]
show "continuous_on (rel_interior S) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (rel_interior S) f
[PROOF STEP]
using contf continuous_on_subset rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
continuous_on S f
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f
rel_interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. continuous_on (rel_interior S) f
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on (rel_interior S) f

goal (6 subgoals):
 1. openin (top_of_set (affine hull S)) (rel_interior S)
 2. affine (affine hull S)
 3. affine (affine hull T)
 4. f ` rel_interior S \<subseteq> affine hull T
 5. inj_on f (rel_interior S)
 6. rel_interior S \<noteq> {}
[PROOF STEP]
show "f ` rel_interior S \<subseteq> affine hull T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` rel_interior S \<subseteq> affine hull T
[PROOF STEP]
by (meson S hull_subset image_subsetI rel_interior_subset rev_subsetD)
[PROOF STATE]
proof (state)
this:
f ` rel_interior S \<subseteq> affine hull T

goal (5 subgoals):
 1. openin (top_of_set (affine hull S)) (rel_interior S)
 2. affine (affine hull S)
 3. affine (affine hull T)
 4. inj_on f (rel_interior S)
 5. rel_interior S \<noteq> {}
[PROOF STEP]
show "inj_on f (rel_interior S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (rel_interior S)
[PROOF STEP]
by (metis S inj_on_inverseI inj_on_subset rel_interior_subset)
[PROOF STATE]
proof (state)
this:
inj_on f (rel_interior S)

goal (4 subgoals):
 1. openin (top_of_set (affine hull S)) (rel_interior S)
 2. affine (affine hull S)
 3. affine (affine hull T)
 4. rel_interior S \<noteq> {}
[PROOF STEP]
qed (simp_all add: openin_rel_interior assms)
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rank_1_proj_mat_col:
  assumes "A \<in> carrier_mat n n"
  and "i < n"
  and "j < n"
  and "k < n"
shows "(rank_1_proj (Matrix.col A i)) $$ (j, k) = A $$ (j, i) * conjugate (A $$ (k,i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank_1_proj (Matrix.col A i) $$ (j, k) = A $$ (j, i) * conjugate (A $$ (k, i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank_1_proj (Matrix.col A i) $$ (j, k) = A $$ (j, i) * conjugate (A $$ (k, i))
[PROOF STEP]
have "(rank_1_proj (Matrix.col A i)) $$ (j, k) = Matrix.vec_index (Matrix.col A i) j *
    conjugate (Matrix.vec_index (Matrix.col A i) k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank_1_proj (Matrix.col A i) $$ (j, k) = Matrix.col A i $ j * conjugate (Matrix.col A i $ k)
[PROOF STEP]
using index_outer_prod[of "Matrix.col A i" n "Matrix.col A i" n]
      assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Matrix.col A i \<in> carrier_vec n; Matrix.col A i \<in> carrier_vec n; ?i < n; ?j < n\<rbrakk> \<Longrightarrow> outer_prod (Matrix.col A i) (Matrix.col A i) $$ (?i, ?j) = Matrix.col A i $ ?i * conjugate (Matrix.col A i $ ?j)
A \<in> carrier_mat n n
i < n
j < n
k < n

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A i) $$ (j, k) = Matrix.col A i $ j * conjugate (Matrix.col A i $ k)
[PROOF STEP]
unfolding rank_1_proj_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Matrix.col A i \<in> carrier_vec n; Matrix.col A i \<in> carrier_vec n; ?i < n; ?j < n\<rbrakk> \<Longrightarrow> outer_prod (Matrix.col A i) (Matrix.col A i) $$ (?i, ?j) = Matrix.col A i $ ?i * conjugate (Matrix.col A i $ ?j)
A \<in> carrier_mat n n
i < n
j < n
k < n

goal (1 subgoal):
 1. outer_prod (Matrix.col A i) (Matrix.col A i) $$ (j, k) = Matrix.col A i $ j * conjugate (Matrix.col A i $ k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rank_1_proj (Matrix.col A i) $$ (j, k) = Matrix.col A i $ j * conjugate (Matrix.col A i $ k)

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A i) $$ (j, k) = A $$ (j, i) * conjugate (A $$ (k, i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rank_1_proj (Matrix.col A i) $$ (j, k) = Matrix.col A i $ j * conjugate (Matrix.col A i $ k)

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A i) $$ (j, k) = A $$ (j, i) * conjugate (A $$ (k, i))
[PROOF STEP]
have "... = A $$ (j, i) * conjugate (A $$ (k,i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.col A i $ j * conjugate (Matrix.col A i $ k) = A $$ (j, i) * conjugate (A $$ (k, i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
i < n
j < n
k < n

goal (1 subgoal):
 1. Matrix.col A i $ j * conjugate (Matrix.col A i $ k) = A $$ (j, i) * conjugate (A $$ (k, i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Matrix.col A i $ j * conjugate (Matrix.col A i $ k) = A $$ (j, i) * conjugate (A $$ (k, i))

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A i) $$ (j, k) = A $$ (j, i) * conjugate (A $$ (k, i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rank_1_proj (Matrix.col A i) $$ (j, k) = A $$ (j, i) * conjugate (A $$ (k, i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rank_1_proj (Matrix.col A i) $$ (j, k) = A $$ (j, i) * conjugate (A $$ (k, i))

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A i) $$ (j, k) = A $$ (j, i) * conjugate (A $$ (k, i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rank_1_proj (Matrix.col A i) $$ (j, k) = A $$ (j, i) * conjugate (A $$ (k, i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_psi_ineq_aux2:
  assumes "numeral m ^ 2 \<le> (2::nat) ^ (3 * n)"
  shows   "ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
have "ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n \<longleftrightarrow>
          2 * log 2 (real (numeral m)) \<le> 3 * real n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n) = (2 * log 2 (real (numeral m)) \<le> 3 * real n)
[PROOF STEP]
by (simp add: field_simps log_def)
[PROOF STATE]
proof (state)
this:
(ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n) = (2 * log 2 (real (numeral m)) \<le> 3 * real n)

goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n) = (2 * log 2 (real (numeral m)) \<le> 3 * real n)

goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
have "2 * log 2 (real (numeral m)) = log 2 (real (numeral m ^ 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * log 2 (real (numeral m)) = log 2 (real ((numeral m)\<^sup>2))
[PROOF STEP]
by (subst of_nat_power, subst log_nat_power) simp_all
[PROOF STATE]
proof (state)
this:
2 * log 2 (real (numeral m)) = log 2 (real ((numeral m)\<^sup>2))

goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * log 2 (real (numeral m)) = log 2 (real ((numeral m)\<^sup>2))

goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
have "\<dots> \<le> 3 * real n \<longleftrightarrow> real ((numeral m) ^ 2) \<le> 2 powr real (3 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (log 2 (real ((numeral m)\<^sup>2)) \<le> 3 * real n) = (real ((numeral m)\<^sup>2) \<le> 2 powr real (3 * n))
[PROOF STEP]
by (subst Transcendental.log_le_iff) simp_all
[PROOF STATE]
proof (state)
this:
(log 2 (real ((numeral m)\<^sup>2)) \<le> 3 * real n) = (real ((numeral m)\<^sup>2) \<le> 2 powr real (3 * n))

goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(log 2 (real ((numeral m)\<^sup>2)) \<le> 3 * real n) = (real ((numeral m)\<^sup>2) \<le> 2 powr real (3 * n))

goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
have "2 powr (3 * n) = real (2 ^ (3 * n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr real (3 * n) = real (2 ^ (3 * n))
[PROOF STEP]
by (simp add: powr_realpow [symmetric])
[PROOF STATE]
proof (state)
this:
2 powr real (3 * n) = real (2 ^ (3 * n))

goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 powr real (3 * n) = real (2 ^ (3 * n))

goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
have "real ((numeral m) ^ 2) \<le> \<dots> \<longleftrightarrow> numeral m ^ 2 \<le> (2::nat) ^ (3 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real ((numeral m)\<^sup>2) \<le> real (2 ^ (3 * n))) = ((numeral m)\<^sup>2 \<le> 2 ^ (3 * n))
[PROOF STEP]
by (rule of_nat_le_iff)
[PROOF STATE]
proof (state)
this:
(real ((numeral m)\<^sup>2) \<le> real (2 ^ (3 * n))) = ((numeral m)\<^sup>2 \<le> 2 ^ (3 * n))

goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n) = ((numeral m)\<^sup>2 \<le> 2 ^ (3 * n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n) = ((numeral m)\<^sup>2 \<le> 2 ^ (3 * n))

goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n) = ((numeral m)\<^sup>2 \<le> 2 ^ (3 * n))
(numeral m)\<^sup>2 \<le> 2 ^ (3 * n)

goal (1 subgoal):
 1. ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
ln (real (numeral m)) \<le> 3 / 2 * ln 2 * real n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sums_confine_divide:
  fixes f :: "nat \<Rightarrow> 'a::real_normed_field"
  shows "confine f N sums a \<Longrightarrow> confine (\<lambda>n. f n / c) N sums (a/c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. confine f N sums a \<Longrightarrow> confine (\<lambda>n. f n / c) N sums (a / c)
[PROOF STEP]
using sums_divide [of "confine f N" a c]
[PROOF STATE]
proof (prove)
using this:
confine f N sums a \<Longrightarrow> (\<lambda>n. confine f N n / c) sums (a / c)

goal (1 subgoal):
 1. confine f N sums a \<Longrightarrow> confine (\<lambda>n. f n / c) N sums (a / c)
[PROOF STEP]
by (simp add: confine_def if_distrib [of "\<lambda>x. x/c"] cong: if_cong)


[STATEMENT]
lemma interval_uminus_zero[simp]:
  shows "-(0 :: 'a :: group_add interval) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 0 = 0
[PROOF STEP]
by (simp add: zero_interval_def)


[STATEMENT]
lemma path_length_sum :
  assumes "path M q p"
  shows "length p = (\<Sum> q \<in> states M . length (filter (\<lambda>t. t_target t = q) p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length p = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) p))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
path M q p

goal (1 subgoal):
 1. length p = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) p))
[PROOF STEP]
proof (induction p rule: rev_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. path M q [] \<Longrightarrow> length [] = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) []))
 2. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
path M q []

goal (2 subgoals):
 1. path M q [] \<Longrightarrow> length [] = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) []))
 2. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path M q []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
path M q []

goal (1 subgoal):
 1. length [] = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) []))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length [] = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) []))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
case (snoc x xs)
[PROOF STATE]
proof (state)
this:
path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs))
path M q (xs @ [x])

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs))
path M q (xs @ [x])
[PROOF STEP]
have "length xs = (\<Sum>q\<in>states M. length (filter (\<lambda>t. t_target t = q) xs))"
[PROOF STATE]
proof (prove)
using this:
path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs))
path M q (xs @ [x])

goal (1 subgoal):
 1. length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
have *: "t_target x \<in> states M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t_target x \<in> FSM.states M
[PROOF STEP]
using \<open>path M q (xs @ [x])\<close>
[PROOF STATE]
proof (prove)
using this:
path M q (xs @ [x])

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

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t_target x \<in> FSM.states M
[PROOF STEP]
have **: "length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x]))
                  = Suc (length (filter (\<lambda>t. t_target t = t_target x) xs))"
[PROOF STATE]
proof (prove)
using this:
t_target x \<in> FSM.states M

goal (1 subgoal):
 1. length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x])) = Suc (length (filter (\<lambda>t. t_target t = t_target x) xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x])) = Suc (length (filter (\<lambda>t. t_target t = t_target x) xs))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
have "\<And> q . q \<in> states M \<Longrightarrow> q \<noteq> t_target x
          \<Longrightarrow> length (filter (\<lambda>t. t_target t = q) (xs @ [x])) = length (filter (\<lambda>t. t_target t = q) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>q. \<lbrakk>q \<in> FSM.states M; q \<noteq> t_target x\<rbrakk> \<Longrightarrow> length (filter (\<lambda>t. t_target t = q) (xs @ [x])) = length (filter (\<lambda>t. t_target t = q) xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>?q \<in> FSM.states M; ?q \<noteq> t_target x\<rbrakk> \<Longrightarrow> length (filter (\<lambda>t. t_target t = ?q) (xs @ [x])) = length (filter (\<lambda>t. t_target t = ?q) xs)

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?q \<in> FSM.states M; ?q \<noteq> t_target x\<rbrakk> \<Longrightarrow> length (filter (\<lambda>t. t_target t = ?q) (xs @ [x])) = length (filter (\<lambda>t. t_target t = ?q) xs)
[PROOF STEP]
have ***: "(\<Sum>q\<in>states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
                  = (\<Sum>q\<in>states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs))"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<in> FSM.states M; ?q \<noteq> t_target x\<rbrakk> \<Longrightarrow> length (filter (\<lambda>t. t_target t = ?q) (xs @ [x])) = length (filter (\<lambda>t. t_target t = ?q) xs)

goal (1 subgoal):
 1. (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs))
[PROOF STEP]
using fsm_states_finite[of M]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<in> FSM.states M; ?q \<noteq> t_target x\<rbrakk> \<Longrightarrow> length (filter (\<lambda>t. t_target t = ?q) (xs @ [x])) = length (filter (\<lambda>t. t_target t = ?q) xs)
finite (FSM.states M)

goal (1 subgoal):
 1. (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs))
[PROOF STEP]
by (metis (no_types, lifting) DiffE insertCI sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
have "(\<Sum>q\<in>states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
          = (\<Sum>q\<in>states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
              + (length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x])))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) + length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x]))
[PROOF STEP]
using * fsm_states_finite[of M]
[PROOF STATE]
proof (prove)
using this:
t_target x \<in> FSM.states M
finite (FSM.states M)

goal (1 subgoal):
 1. (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) + length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x]))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>t_target x \<in> FSM.states M; finite (FSM.states M)\<rbrakk> \<Longrightarrow> (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) + length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x]))
[PROOF STEP]
have "(\<Sum>a\<in>insert (t_target x) (states M). length (filter (\<lambda>p. t_target p = a) (xs @ [x])))
            = (\<Sum>a\<in>states M. length (filter (\<lambda>p. t_target p = a) (xs @ [x])))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>insert (t_target x) (FSM.states M). length (filter (\<lambda>p. t_target p = a) (xs @ [x]))) = (\<Sum>a\<in>FSM.states M. length (filter (\<lambda>p. t_target p = a) (xs @ [x])))
[PROOF STEP]
by (simp add: \<open>t_target x \<in> states M\<close> insert_absorb)
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>insert (t_target x) (FSM.states M). length (filter (\<lambda>p. t_target p = a) (xs @ [x]))) = (\<Sum>a\<in>FSM.states M. length (filter (\<lambda>p. t_target p = a) (xs @ [x])))

goal (1 subgoal):
 1. \<lbrakk>t_target x \<in> FSM.states M; finite (FSM.states M)\<rbrakk> \<Longrightarrow> (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) + length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>a\<in>insert (t_target x) (FSM.states M). length (filter (\<lambda>p. t_target p = a) (xs @ [x]))) = (\<Sum>a\<in>FSM.states M. length (filter (\<lambda>p. t_target p = a) (xs @ [x])))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>a\<in>insert (t_target x) (FSM.states M). length (filter (\<lambda>p. t_target p = a) (xs @ [x]))) = (\<Sum>a\<in>FSM.states M. length (filter (\<lambda>p. t_target p = a) (xs @ [x])))

goal (1 subgoal):
 1. (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) + length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x]))
[PROOF STEP]
by (simp add: \<open>finite (states M)\<close> sum.insert_remove)
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) + length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x]))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) + length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x]))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) + length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x]))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
have "(\<Sum>q\<in>states M. length (filter (\<lambda>t. t_target t = q) xs))
                  = (\<Sum>q\<in>states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs))
                      + (length (filter (\<lambda>t. t_target t = t_target x) xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs)) + length (filter (\<lambda>t. t_target t = t_target x) xs)
[PROOF STEP]
using * fsm_states_finite[of M]
[PROOF STATE]
proof (prove)
using this:
t_target x \<in> FSM.states M
finite (FSM.states M)

goal (1 subgoal):
 1. (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs)) + length (filter (\<lambda>t. t_target t = t_target x) xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>t_target x \<in> FSM.states M; finite (FSM.states M)\<rbrakk> \<Longrightarrow> (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs)) + length (filter (\<lambda>t. t_target t = t_target x) xs)
[PROOF STEP]
have "(\<Sum>a\<in>insert (t_target x) (states M). length (filter (\<lambda>p. t_target p = a) xs))
            = (\<Sum>a\<in>states M. length (filter (\<lambda>p. t_target p = a) xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>insert (t_target x) (FSM.states M). length (filter (\<lambda>p. t_target p = a) xs)) = (\<Sum>a\<in>FSM.states M. length (filter (\<lambda>p. t_target p = a) xs))
[PROOF STEP]
by (simp add: \<open>t_target x \<in> states M\<close> insert_absorb)
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>insert (t_target x) (FSM.states M). length (filter (\<lambda>p. t_target p = a) xs)) = (\<Sum>a\<in>FSM.states M. length (filter (\<lambda>p. t_target p = a) xs))

goal (1 subgoal):
 1. \<lbrakk>t_target x \<in> FSM.states M; finite (FSM.states M)\<rbrakk> \<Longrightarrow> (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs)) + length (filter (\<lambda>t. t_target t = t_target x) xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>a\<in>insert (t_target x) (FSM.states M). length (filter (\<lambda>p. t_target p = a) xs)) = (\<Sum>a\<in>FSM.states M. length (filter (\<lambda>p. t_target p = a) xs))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>a\<in>insert (t_target x) (FSM.states M). length (filter (\<lambda>p. t_target p = a) xs)) = (\<Sum>a\<in>FSM.states M. length (filter (\<lambda>p. t_target p = a) xs))

goal (1 subgoal):
 1. (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs)) + length (filter (\<lambda>t. t_target t = t_target x) xs)
[PROOF STEP]
by (simp add: \<open>finite (states M)\<close> sum.insert_remove)
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs)) + length (filter (\<lambda>t. t_target t = t_target x) xs)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs)) + length (filter (\<lambda>t. t_target t = t_target x) xs)

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) + length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x]))
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs)) + length (filter (\<lambda>t. t_target t = t_target x) xs)
[PROOF STEP]
have "(\<Sum>q\<in>states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
                    = Suc (\<Sum>q\<in>states M. length (filter (\<lambda>t. t_target t = q) xs))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) + length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x]))
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs)) + length (filter (\<lambda>t. t_target t = t_target x) xs)

goal (1 subgoal):
 1. (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = Suc (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs))
[PROOF STEP]
using ** ***
[PROOF STATE]
proof (prove)
using this:
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) + length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x]))
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs)) + length (filter (\<lambda>t. t_target t = t_target x) xs)
length (filter (\<lambda>t. t_target t = t_target x) (xs @ [x])) = Suc (length (filter (\<lambda>t. t_target t = t_target x) xs))
(\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = (\<Sum>q\<in>FSM.states M - {t_target x}. length (filter (\<lambda>t. t_target t = q) xs))

goal (1 subgoal):
 1. (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = Suc (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = Suc (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path M q xs \<Longrightarrow> length xs = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs)); path M q (xs @ [x])\<rbrakk> \<Longrightarrow> length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = Suc (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x]))) = Suc (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) xs))

goal (1 subgoal):
 1. length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))
[PROOF STEP]
by (simp add: \<open>length xs = (\<Sum>q\<in>states M. length (filter (\<lambda>t. t_target t = q) xs))\<close>)
[PROOF STATE]
proof (state)
this:
length (xs @ [x]) = (\<Sum>q\<in>FSM.states M. length (filter (\<lambda>t. t_target t = q) (xs @ [x])))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_vangle_eq_zero_iff_vangle:
  "cos (vangle u v) = 0 \<longleftrightarrow> (u = 0 \<or> v = 0 \<or> u \<bullet> v = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos (vangle u v) = 0) = (u = (0::'a) \<or> v = (0::'a) \<or> u \<bullet> v = 0)
[PROOF STEP]
using Cauchy_Schwarz_ineq2[of u v]
[PROOF STATE]
proof (prove)
using this:
\<bar>u \<bullet> v\<bar> \<le> norm u * norm v

goal (1 subgoal):
 1. (cos (vangle u v) = 0) = (u = (0::'a) \<or> v = (0::'a) \<or> u \<bullet> v = 0)
[PROOF STEP]
by (auto simp: vangle_def divide_simps algebra_split_simps split: if_splits)


[STATEMENT]
lemma least_antimono: "X\<noteq>{} \<Longrightarrow> X\<subseteq>Y \<Longrightarrow> (LEAST y::_::wellorder. y\<in>Y) \<le> (LEAST x. x\<in>X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<noteq> {}; X \<subseteq> Y\<rbrakk> \<Longrightarrow> (LEAST y. y \<in> Y) \<le> (LEAST x. x \<in> X)
[PROOF STEP]
by (metis LeastI_ex Least_le equals0I rev_subsetD)


[STATEMENT]
lemma spaceN_cmult [simp]:
  assumes "x \<in> space\<^sub>N N"
  shows "c *\<^sub>R x \<in> space\<^sub>N N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c *\<^sub>R x \<in> space\<^sub>N N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> space\<^sub>N N

goal (1 subgoal):
 1. c *\<^sub>R x \<in> space\<^sub>N N
[PROOF STEP]
unfolding spaceN_iff
[PROOF STATE]
proof (prove)
using this:
eNorm N x < \<infinity>

goal (1 subgoal):
 1. eNorm N (c *\<^sub>R x) < \<infinity>
[PROOF STEP]
using eNorm_cmult[of N c x]
[PROOF STATE]
proof (prove)
using this:
eNorm N x < \<infinity>
eNorm N (c *\<^sub>R x) = ennreal \<bar>c\<bar> * eNorm N x

goal (1 subgoal):
 1. eNorm N (c *\<^sub>R x) < \<infinity>
[PROOF STEP]
by (simp add: ennreal_mult_less_top)


[STATEMENT]
lemma bouncing_ball_inv:
  fixes h::real
  shows "g < 0 \<Longrightarrow> h \<ge> 0 \<Longrightarrow> \<lceil>\<lambda>s. s$1 = h \<and> s$2 = 0\<rceil> \<le>
  wp
    (LOOP
      ((x\<acute>= f g & (\<lambda> s. s$1 \<ge> 0) DINV (\<lambda>s. 2 * g * s$1 - 2 * g * h - s$2 * s$2 = 0));
       (IF (\<lambda> s. s$1 = 0) THEN (2 ::= (\<lambda>s. - s$2)) ELSE skip))
    INV (\<lambda>s. 0 \<le> s$1 \<and> 2 * g * s$1 - 2 * g * h - s$2 * s$2 = 0)
  ) \<lceil>\<lambda>s. 0 \<le> s$1 \<and> s$1 \<le> h\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> \<lceil>\<lambda>s. s $ 1 = h \<and> s $ 2 = 0\<rceil> \<le> wp (LOOP x\<acute>=\<lambda>t. f g & \<lambda>s. 0 \<le> s $ 1 on \<lambda>s. {t. 0 \<le> t} UNIV @ 0 DINV \<lambda>s. 2 \<cdot> g \<cdot> s $ 1 - 2 \<cdot> g \<cdot> h - s $ 2 \<cdot> s $ 2 = 0  ; (IF (\<lambda>s. s $ 1 = 0) THEN (2 ::= (\<lambda>s. - s $ 2)) ELSE skip) INV (\<lambda>s. 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 - 2 \<cdot> g \<cdot> h - s $ 2 \<cdot> s $ 2 = 0) ) \<lceil>\<lambda>s. 0 \<le> s $ 1 \<and> s $ 1 \<le> h\<rceil>
[PROOF STEP]
apply(rule wp_loopI, simp_all, force simp: bb_real_arith)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> \<lceil>\<lambda>s. 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 - 2 \<cdot> g \<cdot> h = s $ 2 \<cdot> s $ 2\<rceil> \<le> wp x\<acute>=\<lambda>t. f g & \<lambda>s. 0 \<le> s $ 1 on \<lambda>s. Collect ((\<le>) 0) UNIV @ 0 DINV \<lambda>s. 2 \<cdot> g \<cdot> s $ 1 - 2 \<cdot> g \<cdot> h = s $ 2 \<cdot> s $ 2  \<lceil>\<lambda>s. (s $ 1 = 0 \<longrightarrow> - (2 \<cdot> g \<cdot> h) = s $ 2 \<cdot> s $ 2) \<and> (s $ 1 = 0 \<or> 0 \<le> s $ 1 \<and> 2 \<cdot> g \<cdot> s $ 1 - 2 \<cdot> g \<cdot> h = s $ 2 \<cdot> s $ 2)\<rceil>
[PROOF STEP]
by (rule wp_g_odei) (auto intro!: poly_derivatives diff_invariant_rules)

\<comment> \<open>Verified with annotated dynamics. \<close>


[STATEMENT]
lemma prime_elem_multiplicity_eq_zero_iff:
  "prime_elem p \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> multiplicity p x = 0 \<longleftrightarrow> \<not>p dvd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime_elem p; x \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> (multiplicity p x = 0) = (\<not> p dvd x)
[PROOF STEP]
by (rule multiplicity_eq_zero_iff) simp_all


[STATEMENT]
lemma Suc_Suc_Suc_Suc_induct:
  "\<lbrakk>i < Suc (Suc (Suc (Suc 0))); i = 0 \<Longrightarrow>  P i;
    i = 1 \<Longrightarrow> P i; i =2 \<Longrightarrow> P i;
    i =3 \<Longrightarrow> P i\<rbrakk> \<Longrightarrow> P i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < Suc (Suc (Suc (Suc 0))); i = 0 \<Longrightarrow> P i; i = 1 \<Longrightarrow> P i; i = 2 \<Longrightarrow> P i; i = 3 \<Longrightarrow> P i\<rbrakk> \<Longrightarrow> P i
[PROOF STEP]
apply(cases i, force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. \<lbrakk>i < Suc (Suc (Suc (Suc 0))); i = 0 \<Longrightarrow> P i; i = 1 \<Longrightarrow> P i; i = 2 \<Longrightarrow> P i; i = 3 \<Longrightarrow> P i; i = Suc nat\<rbrakk> \<Longrightarrow> P i
[PROOF STEP]
apply(cases "i - 1", force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat nata. \<lbrakk>i < Suc (Suc (Suc (Suc 0))); i = 0 \<Longrightarrow> P i; i = 1 \<Longrightarrow> P i; i = 2 \<Longrightarrow> P i; i = 3 \<Longrightarrow> P i; i = Suc nat; i - 1 = Suc nata\<rbrakk> \<Longrightarrow> P i
[PROOF STEP]
apply(cases "i - 1 - 1", force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat nata natb. \<lbrakk>i < Suc (Suc (Suc (Suc 0))); i = 0 \<Longrightarrow> P i; i = 1 \<Longrightarrow> P i; i = 2 \<Longrightarrow> P i; i = 3 \<Longrightarrow> P i; i = Suc nat; i - 1 = Suc nata; i - 1 - 1 = Suc natb\<rbrakk> \<Longrightarrow> P i
[PROOF STEP]
by(cases "i - 1 - 1 - 1", auto simp:numeral_eqs_upto_12)


[STATEMENT]
lemma plus_times_less_one_lemma: "i + u - i * u < 1" if "i < 1" "u < 1" for i u::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + u - i * u < 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i + u - i * u < 1
[PROOF STEP]
have "u * (1 - i) < 1 - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u * (1 - i) < 1 - i
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
i < 1
u < 1

goal (1 subgoal):
 1. u * (1 - i) < 1 - i
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
u * (1 - i) < 1 - i

goal (1 subgoal):
 1. i + u - i * u < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u * (1 - i) < 1 - i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u * (1 - i) < 1 - i

goal (1 subgoal):
 1. i + u - i * u < 1
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
i + u - i * u < 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_gcd_mult_int [simp]:
  fixes xs :: "int list"
  shows "list_gcd (map (times a) xs) = \<bar>a\<bar> * list_gcd xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd_list (map ((*) a) xs) = \<bar>a\<bar> * gcd_list xs
[PROOF STEP]
by (simp add: Gcd_mult abs_mult)


[STATEMENT]
lemma Int_stableI:
  "(\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<inter> b \<in> A) \<Longrightarrow> Int_stable A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a \<in> A; b \<in> A\<rbrakk> \<Longrightarrow> a \<inter> b \<in> A) \<Longrightarrow> Int_stable A
[PROOF STEP]
unfolding Int_stable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a \<in> A; b \<in> A\<rbrakk> \<Longrightarrow> a \<inter> b \<in> A) \<Longrightarrow> \<forall>a\<in>A. \<forall>b\<in>A. a \<inter> b \<in> A
[PROOF STEP]
by auto